From 68197215c9cafd00b1f281790d7842abfde061ad Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Thu, 27 Aug 2015 15:13:59 +0000
Subject: [PATCH] Better handling of avatar transition info

---
 src/ui/TDiagramPanel.java                     |  7 +++++++
 src/ui/avatarsmd/AvatarSMDTransitionInfo.java | 18 +++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java
index 30a52c5686..83ba58f8a1 100755
--- a/src/ui/TDiagramPanel.java
+++ b/src/ui/TDiagramPanel.java
@@ -193,6 +193,8 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
 
     private boolean isScaled;
     private boolean overcomeShowing = false;
+    private boolean drawingMain = true;
+
 
     //protected Image offScreenBuffer;
 
@@ -291,6 +293,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         }
     }
 
+    public boolean isDrawingMain() {
+	return drawingMain;
+    }
+
     public void updateComponentsAfterZoom() {
         //TraceManager.addDev("Zoom factor=" + zoom);
         TGComponent tgc;
@@ -401,6 +407,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
     public void paintMycomponents(Graphics g, boolean b, double w, double h) {
 
         lastGraphics = g;
+	drawingMain = b;
 
         //TraceManager.addDev("Nb of components: " + componentList.size());
 
diff --git a/src/ui/avatarsmd/AvatarSMDTransitionInfo.java b/src/ui/avatarsmd/AvatarSMDTransitionInfo.java
index 4f75237baf..ecaa411fd5 100755
--- a/src/ui/avatarsmd/AvatarSMDTransitionInfo.java
+++ b/src/ui/avatarsmd/AvatarSMDTransitionInfo.java
@@ -127,11 +127,15 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
 
         g.setColor(ColorManager.AVATAR_GUARD);
 
+	if (tdp.isDrawingMain()) {
+	    width = minWidth;
+	}
+
         if (guard.length() > 0) {
             if (guard.compareTo("[ ]") != 0) {
                 g.drawString(guard, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(guard), width);
                     width = Math.max(minWidth, width);
                 }
@@ -146,7 +150,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
                 s = "after (" + afterMin + "," + afterMax + ")";
                 g.drawString(s, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(s), width);
                     width = Math.max(minWidth, width);
                 }
@@ -155,7 +159,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
                 s = "after (" + afterMin + ")";
                 g.drawString(s, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(s), width);
                     width = Math.max(minWidth, width);
                 }
@@ -168,7 +172,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
                 s = "computeFor (" + computeMin + "," + computeMax + ")";
                 g.drawString(s, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(s), width);
                     width = Math.max(minWidth, width);
                 }
@@ -177,7 +181,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
                 s = "computeFor (" + computeMin + ")";
                 g.drawString(s, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(s), width);
                     width = Math.max(minWidth, width);
                 }
@@ -192,7 +196,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
             if (s.length() > 0) {
                 g.drawString(s, x, y + step);
                 atLeastOneThing = true;
-                if (!tdp.isScaled()) {
+                if (tdp.isDrawingMain()) {
                     width = Math.max(g.getFontMetrics().stringWidth(s), width);
                     width = Math.max(minWidth, width);
                 }
@@ -225,7 +229,7 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent {
 
 
 
-        if (!tdp.isScaled()) {
+        if (tdp.isDrawingMain()) {
             height = Math.max(step, minHeight);
         }
 
-- 
GitLab