Xcos icons: fix block.graphics.sz resize heuristic 76/18976/2
Clément DAVID [Thu, 26 Jan 2017 16:06:36 +0000 (17:06 +0100)]
Change-Id: Id51e5b9a767e30b04ff9ef78f4fb805eb277cb13

scilab/modules/xcos/images/palettes/CLINDUMMY_f.png
scilab/modules/xcos/images/palettes/CLKGotoTagVisibility.png
scilab/modules/xcos/images/palettes/DEBUG.png
scilab/modules/xcos/images/palettes/ENDBLK.png
scilab/modules/xcos/images/palettes/GotoTagVisibility.png
scilab/modules/xcos/images/palettes/GotoTagVisibilityMO.png
scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/model/XcosCellFactory.java

index c92a2d6..845b401 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/CLINDUMMY_f.png and b/scilab/modules/xcos/images/palettes/CLINDUMMY_f.png differ
index a4bc42f..0bf7bdc 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/CLKGotoTagVisibility.png and b/scilab/modules/xcos/images/palettes/CLKGotoTagVisibility.png differ
index 042e6bb..e49a39f 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/DEBUG.png and b/scilab/modules/xcos/images/palettes/DEBUG.png differ
index 398528b..48247d7 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/ENDBLK.png and b/scilab/modules/xcos/images/palettes/ENDBLK.png differ
index b67c857..55fe6ba 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/GotoTagVisibility.png and b/scilab/modules/xcos/images/palettes/GotoTagVisibility.png differ
index 0950d32..8d67488 100644 (file)
Binary files a/scilab/modules/xcos/images/palettes/GotoTagVisibilityMO.png and b/scilab/modules/xcos/images/palettes/GotoTagVisibilityMO.png differ
index 950a1ed..97ab13e 100644 (file)
@@ -453,16 +453,17 @@ public final class XcosCellFactory {
         if (block instanceof SplitBlock) {
             convertGeometry = false;
         } else if (block instanceof RoundBlock) {
-            int numberOfPorts = properties.get(ObjectProperties.INPUTS) +
-                                properties.get(ObjectProperties.OUTPUTS) +
-                                properties.get(ObjectProperties.EVENT_INPUTS) +
-                                properties.get(ObjectProperties.EVENT_OUTPUTS);
+            int numberOfPorts = properties.get(ObjectProperties.INPUTS) + 1 +
+                                properties.get(ObjectProperties.OUTPUTS) + 1 +
+                                properties.get(ObjectProperties.EVENT_INPUTS) + 1 +
+                                properties.get(ObjectProperties.EVENT_OUTPUTS) + 1;
             convertGeometry = (2 * w + 2 * h) < (numberOfPorts * BasicPort.DEFAULT_PORTSIZE);
         } else {
-            convertGeometry = h < (properties.get(ObjectProperties.INPUTS) * BasicPort.DEFAULT_PORTSIZE) |
-                              h < (properties.get(ObjectProperties.OUTPUTS) * BasicPort.DEFAULT_PORTSIZE) |
-                              w < (properties.get(ObjectProperties.EVENT_INPUTS) * BasicPort.DEFAULT_PORTSIZE) |
-                              w < (properties.get(ObjectProperties.EVENT_OUTPUTS) * BasicPort.DEFAULT_PORTSIZE);
+            double minimalHeight = Math.max((properties.get(ObjectProperties.INPUTS) + 1) * BasicPort.DEFAULT_PORTSIZE, (properties.get(ObjectProperties.OUTPUTS) + 1) * BasicPort.DEFAULT_PORTSIZE);
+            double minimalWidth = Math.max((properties.get(ObjectProperties.EVENT_INPUTS) + 1) * BasicPort.DEFAULT_PORTSIZE, (properties.get(ObjectProperties.EVENT_OUTPUTS) + 1) * BasicPort.DEFAULT_PORTSIZE);
+
+            convertGeometry = h < minimalHeight | w < minimalWidth;
+            convertGeometry |= h * w < minimalHeight * minimalWidth;
         }
 
         if (convertGeometry) {