Bug fix #11530 & #11363: Raise (help, scinotes...) windows when iconified 89/19489/3
Antoine ELIAS [Wed, 11 Oct 2017 14:48:01 +0000 (16:48 +0200)]
Change-Id: I06418a319caa434f1917d384217d6c1ac6071a0c

15 files changed:
scilab/CHANGES.md
scilab/modules/atoms/macros/atoms_gui/atomsGui.sci
scilab/modules/commons/src/java/org/scilab/modules/commons/gui/ScilabGUIUtilities.java
scilab/modules/demo_tools/macros/demo_gui.sci
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/WindowsConfigurationManager.java
scilab/modules/gui/tests/nonreg_tests/bug_11363.tst [new file with mode: 0644]
scilab/modules/gui/tests/nonreg_tests/bug_11530.tst [new file with mode: 0644]
scilab/modules/history_browser/src/c/history_browser.vcxproj
scilab/modules/history_browser/src/c/history_browser.vcxproj.filters
scilab/modules/history_browser/src/java/org/scilab/modules/history_browser/CommandHistory.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotes.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/filebrowser/ScilabFileBrowser.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/ScilabVariableBrowser.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variableeditor/ScilabVariableEditor.java

index 8fb08b4..0af4aec 100644 (file)
@@ -382,6 +382,7 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox.
 * [#9519](http://bugzilla.scilab.org/show_bug.cgi?id=9519): The console menu `File -> Open a file` opened any file in Scinotes. Binary files like .zcos blocked Scinotes.
 * [#10270](http://bugzilla.scilab.org/show_bug.cgi?id=10270): `execstr(["%val=[int16(1)";"]"])` needed entering twice <enter> to be actually performed.
 * [#11196](http://bugzilla.scilab.org/show_bug.cgi?id=11196): Some recursive extractions from a mlist failed.
+* [#11530](http://bugzilla.scilab.org/show_bug.cgi?id=11530): Raise (help, scinotes, ...) windows when iconified ( recall or startup )
 * [#11756](http://bugzilla.scilab.org/show_bug.cgi?id=11756): In the categories of the ATOMS GUI, actually available modules might be not listed.
 * [#12195](http://bugzilla.scilab.org/show_bug.cgi?id=12195): `generateBlockImage` sometimes changed the current graphic driver.
 * [#12372](http://bugzilla.scilab.org/show_bug.cgi?id=12372): The `mode` function was poorly documented.
index 159b88d..844f03d 100644 (file)
@@ -186,9 +186,7 @@ function atomsGui()
     end //creation
 
     if ~isempty(get("atomsFigure")) then
-        // Get focus on the GUI
-        fig = get("atomsFigure");
-        fig.visible = "on";
+        set("atomsFigure", "visible", "on");
         return;
     end
 
index 76cca43..90f4b24 100644 (file)
@@ -32,6 +32,7 @@ public class ScilabGUIUtilities {
      * @param window the window to bring to the front
      */
     public static void toFront(final JFrame window) {
+        /*
         WindowFocusListener listener = new WindowFocusListener() {
 
             public void windowGainedFocus(WindowEvent e) {
@@ -43,7 +44,15 @@ public class ScilabGUIUtilities {
                 window.removeWindowFocusListener(this);
             }
         };
-        window.addWindowFocusListener(listener);
+        */
+        
+        int state = window.getExtendedState();
+        if((state & JFrame.ICONIFIED) == JFrame.ICONIFIED) {
+            window.setExtendedState(state - JFrame.ICONIFIED);
+        }
+
+        /* not sure to understand the goal of that Oo*/
+        //window.addWindowFocusListener(listener);
         window.toFront();
         SwingUtilities.invokeLater(new Runnable() {
             public void run() {
index 878895c..701ba73 100644 (file)
@@ -34,7 +34,8 @@ function demo_gui()
     end
 
     if get("scilab_demo_fig") <> [] then
-        delete(get("scilab_demo_fig"));
+        set("scilab_demo_fig", "visible", "on");
+        return;
     end
 
 
index dc01d1e..f82e2d9 100644 (file)
@@ -190,6 +190,14 @@ public class SwingScilabCommonPanel {
                 if (component.getParentWindow().getNbDockedObjects() == 1) {
                     component.getParentWindow().setVisible((Boolean) value);
                 }
+
+                //de-iconify windows
+                if((Boolean)value == true) {
+                    int state = component.getParentWindow().getExtendedState();
+                    if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                        component.getParentWindow().setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                    } 
+                }
                 break;
             case __GO_INFOBAR_VISIBLE__: {
                 component.disableResizeEvent();
index 4f56402..5c9e619 100644 (file)
@@ -441,8 +441,14 @@ public class WindowsConfigurationManager implements XConfigurationListener {
         }
 
         window.setSize(((Integer) attrs.get("width")).intValue(), ((Integer) attrs.get("height")).intValue());
-        window.setExtendedState(((Integer) attrs.get("state")).intValue());
+        
+        /* remove ICONIFIED at restoration */
+        int state = ((Integer)attrs.get("state")).intValue();
+        if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+            state -= SwingScilabWindow.ICONIFIED;
+        }
 
+        window.setExtendedState(state);
         return window;
     }
 
diff --git a/scilab/modules/gui/tests/nonreg_tests/bug_11363.tst b/scilab/modules/gui/tests/nonreg_tests/bug_11363.tst
new file mode 100644 (file)
index 0000000..73bf1a3
--- /dev/null
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - ESI - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- INTERACTIVE TEST -->
+
+//
+// <-- Non-regression test for bug 11363 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/11363
+//
+// <-- Short Description -->
+// figure.visible = "on" de-iconify window
+
+f = gcf();
+
+//minimize new figure
+
+f.visible = "on";
+
+//figure must raise from taskbar
\ No newline at end of file
diff --git a/scilab/modules/gui/tests/nonreg_tests/bug_11530.tst b/scilab/modules/gui/tests/nonreg_tests/bug_11530.tst
new file mode 100644 (file)
index 0000000..8d79e9c
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - ESI - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- Non-regression test for bug 11530 -->
+// <-- INTERACTIVE TEST -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/11530
+//
+// <-- Short Description -->
+// Raised iconified windows when recall it
+
+//open scinotes
+scinotes
+
+//click to minimize it
+
+//recall scinotes
+scinotes
+
+//check that window is restored
+
+//open help
+help
+
+//click to minimize it
+
+//recall help
+help
+
+//check that window is restored
+
index 7e05d03..3009173 100644 (file)
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\sci_gateway\c\sci_browsehistory.c" />
     <ClCompile Include="..\jni\CommandHistory.cpp" />
     <ClCompile Include="..\cpp\CommandHistory_Wrap.cpp" />
     <ClCompile Include="DllmainHISTORY_BROWSER.c" />
index 6a201b1..9c9792a 100644 (file)
@@ -26,6 +26,9 @@
     <ClCompile Include="DllmainHISTORY_BROWSER.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\c\sci_browsehistory.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\jni\CommandHistory.hxx">
index e0f1d6f..440d0ef 100644 (file)
@@ -159,6 +159,7 @@ public final class CommandHistory extends SwingScilabDockablePanel implements Si
             renderer.setOpenIcon(null);
 
             initialized = true;
+        } else {
         }
     }
 
@@ -413,7 +414,16 @@ public final class CommandHistory extends SwingScilabDockablePanel implements Si
                 window.setSize(500, 500);
                 window.setVisible(true);
             }
+        } else {
+            SwingScilabWindow window = (SwingScilabWindow) SwingUtilities.getAncestorOfClass(SwingScilabWindow.class, browserTab);
+            if(window != null) {
+                int state = window.getExtendedState();
+                if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                    window.setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                }
+            }
         }
+        
         browserTab.setVisible(true);
         expandAll();
     }
index f5d58b7..05db424 100644 (file)
@@ -745,6 +745,14 @@ public class SciNotes extends SwingScilabDockablePanel {
                 SciNotesGUI.init(editor.getParentWindow(), editor, SCINOTES);
                 WindowsConfigurationManager.unregisterEndedRestoration(editor);
             }
+        } else {
+            /* restore if it is iconified */
+            if(editor.getParentWindow() != null) {
+                int state = editor.getParentWindow().getExtendedState();
+                if((state & JFrame.ICONIFIED) == JFrame.ICONIFIED) {
+                    editor.getParentWindow().setExtendedState(state - JFrame.ICONIFIED);
+                }
+            }
         }
 
         if (!editor.restored) {
index e6ffbf8..4b24ba6 100644 (file)
@@ -95,8 +95,12 @@ public final class ScilabFileBrowser {
             }
         } else {
             SwingScilabWindow window = (SwingScilabWindow) SwingUtilities.getAncestorOfClass(SwingScilabWindow.class, instance);
-            window.setVisible(true);
-            window.toFront();
+            if(window != null) {
+                int state = window.getExtendedState();
+                if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                    window.setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                }
+            }
         }
 
         return instance;
index e026a1b..ddfffc3 100644 (file)
@@ -86,6 +86,14 @@ public final class ScilabVariableBrowser implements VariableBrowser {
                 window.setVisible(true);
                 window.toFront();
             }
+        } else {
+            SwingScilabWindow window = (SwingScilabWindow) SwingUtilities.getAncestorOfClass(SwingScilabWindow.class, browserTab);
+            if(window != null) {
+                int state = window.getExtendedState();
+                if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                    window.setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                }
+            }
         }
         return instance;
     }
index b63430c..308d095 100644 (file)
@@ -164,6 +164,11 @@ public final class ScilabVariableEditor extends SwingScilabDockingWindow impleme
                         table.setRowSelectionInterval(r, r);
                         table.setColumnSelectionInterval(c, c);
                     }
+                    
+                    int state = window.getExtendedState();
+                    if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                        window.setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                    }                    
                 }
             });
         }