From 7537db67d400a0caa7e9f40b939653b3f1e2708f Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Thu, 26 Jul 2007 10:58:44 +0000
Subject: [PATCH] Add helper to wrap long (template) class labels in dot graphs

---
 doclib/Doxyfile.global |  9 ++++++---
 doclib/dot             |  5 +++++
 doclib/dot-munge.pl    | 30 ++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100755 doclib/dot
 create mode 100755 doclib/dot-munge.pl

diff --git a/doclib/Doxyfile.global b/doclib/Doxyfile.global
index 5d8dbba62..b2d630395 100644
--- a/doclib/Doxyfile.global
+++ b/doclib/Doxyfile.global
@@ -36,13 +36,16 @@ GENERATE_XML           = YES
 
 HAVE_DOT               = YES
 CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = YES
-TEMPLATE_RELATIONS     = YES
+COLLABORATION_GRAPH    = NO
+TEMPLATE_RELATIONS     = NO
 INCLUDE_GRAPH          = YES
 INCLUDED_BY_GRAPH      = YES
+GROUP_GRAPHS           = NO
 MAX_DOT_GRAPH_WIDTH    = 800
-MAX_DOT_GRAPH_HEIGHT   = 1200
+MAX_DOT_GRAPH_HEIGHT   = 1600
 MAX_DOT_GRAPH_DEPTH    = 3
 DOT_MULTI_TARGETS      = YES
+DOT_CLEANUP            = NO
+DOT_PATH               = "$(TOPDIR)/doclib"
 
 @INCLUDE = "$(TOPDIR)/Doxyfile.local"
diff --git a/doclib/dot b/doclib/dot
new file mode 100755
index 000000000..fca62c89c
--- /dev/null
+++ b/doclib/dot
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+topdir="`dirname "$0"`"; topdir="`cd "$topdir/.."; pwd`"
+"$topdir/doclib/dot-munge.pl" "$1"
+exec dot "$@"
diff --git a/doclib/dot-munge.pl b/doclib/dot-munge.pl
new file mode 100755
index 000000000..d11a55668
--- /dev/null
+++ b/doclib/dot-munge.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -i -n
+
+# Reduce font size
+s/fontsize=10/fontsize=8/g; 
+
+# Wrap long labels (templates)
+if (/label=\"([^"]*)\"/) {              		    #"])){ # To make emacs happy ...
+    $pre=$`; 
+    $post=$'; 			                            #'     # To make emacs happy ...
+    $label=$1;
+
+    # Break at each komma
+    $label=~s/,/,\\r\\ \\ \\ \\ \\ \\ \\ \\ /g; 
+
+    # If more than one '<' is in the label, break after each '<'
+    if (($label=~tr/</</)>1) { 
+	$label=~s/</<\\r\\ \\ \\ \\ \\ \\ \\ \\ /g;
+    }
+
+    # If at least one break is in there ...
+    if ($label=~/\\r/) {
+	# Make last line flush right
+	$label.="\\r";
+	# and first line flush left
+	$label=~s/\\r/\\l/;
+    }
+    print "${pre}label=\"${label}\"${post}";
+} else { 
+    print;
+}
-- 
GitLab