* Bug #13772 fixed - Xcos GUI was not locked while setting parameters. 91/16091/1
Clément DAVID [Wed, 4 Mar 2015 13:03:21 +0000 (14:03 +0100)]
Change-Id: I05ca084a1690a55e7d52574c522b5dbb5b2cf100

scilab/CHANGES_5.5.X
scilab/modules/graph/src/java/org/scilab/modules/graph/ScilabComponent.java
scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/BasicBlock.java

index 420007c..527500f 100644 (file)
@@ -68,6 +68,8 @@ Scilab Bug Fixes
 
 * Bug #13752 fixed - The 'Supported compilers' page was outdated.
 
+* Bug #13772 fixed - Xcos GUI was not locked while setting parameters.
+
 
 Known incompatibilities
 =======================
index 15447e9..b8dc823 100644 (file)
@@ -16,6 +16,7 @@ import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.GraphicsEnvironment;
+import java.awt.event.MouseEvent;
 
 import com.mxgraph.model.mxICell;
 import com.mxgraph.model.mxIGraphModel;
@@ -210,6 +211,18 @@ public class ScilabComponent extends mxGraphComponent {
                 }
             });
         }
+
+        /**
+         * @see javax.swing.JComponent#processMouseMotionEvent(java.awt.event.MouseEvent)
+         *
+         * Overloaded to filter out any cursor update if the graph is locked
+         */
+        @Override
+        protected void processMouseMotionEvent(MouseEvent e) {
+            if (!getGraph().isCellsLocked()) {
+                super.processMouseMotionEvent(e);
+            }
+        }
     }
 
     /*
index ae27acd..d8560e5 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.scilab.modules.xcos.block;
 
+import java.awt.Cursor;
 import java.awt.MouseInfo;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -1163,10 +1164,10 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
         setBlockType(modifiedBlock.getBlockType());
         setSimulationFunctionName(modifiedBlock.getSimulationFunctionName());
         setSimulationFunctionType(modifiedBlock.getSimulationFunctionType());
-        
+
         setNbZerosCrossing(modifiedBlock.getNbZerosCrossing());
         setNmode(modifiedBlock.getNmode());
-        
+
         setEquations(modifiedBlock.getEquations());
         setStyle(modifiedBlock.getStyle());
     }
@@ -1327,6 +1328,9 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
             return;
         }
 
+        graph.setCellsLocked(true);
+        graph.getAsComponent().getGraphControl().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
         // sort children according to the ordering parameter (useful on
         // scilab-5.2.x diagrams)
         sortChildren();
@@ -1363,6 +1367,9 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
                         setLocked(false);
 
                         handler.release();
+
+                        graph.getAsComponent().getGraphControl().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+                        graph.setCellsLocked(false);
                     }
                 }
             };
@@ -1375,6 +1382,9 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
             setLocked(false);
 
             handler.release();
+
+            graph.getAsComponent().getGraphControl().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+            graph.setCellsLocked(false);
         }
     }