From 8a7647bd12f383730c886b34c431ae976ec5ff83 Mon Sep 17 00:00:00 2001
From: albert-github <albert.tests@gmail.com>
Date: Mon, 24 Feb 2020 14:46:26 +0100
Subject: [PATCH] issue #7583 External Links in Inheritance Diagrams open in
 the Image Frame.

When having a function it opens in the current frame and uses the complete frame. Images (e.g. inherited diagrams) are displayed in a small "sub frame" and when displaying the link here it is not readable and furthermore the user doesn't know anything about the "sub frame". In case of an image the link should be displayed in the parent frame of the image.
---
 src/diagram.cpp        | 2 +-
 src/dotfilepatcher.cpp | 2 +-
 src/util.cpp           | 9 +++++++--
 src/util.h             | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/diagram.cpp b/src/diagram.cpp
index 18817e9..25b2c06 100644
--- a/src/diagram.cpp
+++ b/src/diagram.cpp
@@ -261,7 +261,7 @@ static void writeMapArea(FTextStream &t,const ClassDef *cd,QCString relPath,
     t << "<area ";
     if (!ref.isEmpty()) 
     {
-      t << externalLinkTarget();
+      t << externalLinkTarget(true);
     }
     t << "href=\"";
     t << externalRef(relPath,ref,TRUE);
diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp
index efc6341..7a65d89 100644
--- a/src/dotfilepatcher.cpp
+++ b/src/dotfilepatcher.cpp
@@ -173,7 +173,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath,
         QCString url = link.mid(marker+1);
         if (!ref.isEmpty())
         {
-          result = externalLinkTarget();
+          result = externalLinkTarget(true);
           if (result != "") setTarget = TRUE;
         }
         result+= href+"=\"";
diff --git a/src/util.cpp b/src/util.cpp
index 25ca13e..92f593c 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -8163,10 +8163,15 @@ void writeSummaryLink(OutputList &ol,const char *label,const char *title,
 }
 #endif
 
-QCString externalLinkTarget()
+QCString externalLinkTarget(const bool parent)
 {
   static bool extLinksInWindow = Config_getBool(EXT_LINKS_IN_WINDOW);
-  if (extLinksInWindow) return "target=\"_blank\" "; else return "";
+  if (extLinksInWindow)
+    return "target=\"_blank\" ";
+  else if (parent)
+    return "target=\"_parent\" ";
+  else
+    return "";
 }
 
 QCString externalRef(const QCString &relPath,const QCString &ref,bool href)
diff --git a/src/util.h b/src/util.h
index b9628e9..19827b5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -437,7 +437,7 @@ QCString filterTitle(const QCString &title);
 
 bool patternMatch(const QFileInfo &fi,const QStrList *patList);
 
-QCString externalLinkTarget();
+QCString externalLinkTarget(const bool parent = false);
 QCString externalRef(const QCString &relPath,const QCString &ref,bool href);
 int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos);
 const char *writeUtf8Char(FTextStream &t,const char *s);
-- 
1.8.3.1

