* Bug 13466 fixed: Preferences => Demos GUI not-dockable 12/19812/3
Samuel GOUGEON [Wed, 28 Feb 2018 03:06:59 +0000 (04:06 +0100)]
  http://bugzilla.scilab.org/13466

Change-Id: I8f10f252c3f1f52409419e5f6890a356f8caa871

scilab/CHANGES.md
scilab/modules/console/etc/XConfiguration-general.xml
scilab/modules/console/etc/XConfiguration-general.xsl
scilab/modules/demo_tools/macros/demo_gui.sci

index 8c9592a..485c42b 100644 (file)
@@ -231,6 +231,7 @@ input and output arguments.
 * `ndgrid(x)` now accepts only one input `x`, with by default `y=x`.
 * `banner()` updated with ESI Group a 2017-2018 copyright.
 * `%io` is now protected (read-only).
+* The demo GUI can now be set as not-dockable through the Preferences => General => Demos.
 
 Help pages:
 -----------
@@ -384,6 +385,7 @@ Known issues
 * [#11916](http://bugzilla.scilab.org/show_bug.cgi?id=11916): Loading a graphic file containing several figures restored them by superimposing them in the same window.
 * [#12109](http://bugzilla.scilab.org/show_bug.cgi?id=12109): `execstr(.,"errcatch")` calling a macro returning before setting the argout crashed Scilab.
 * [#12566](http://bugzilla.scilab.org/show_bug.cgi?id=12566): `disp()` of a T-list with a single field set to an encoded integer value generated an error.
+* [#13466](http://bugzilla.scilab.org/show_bug.cgi?id=13466): Since Scilab 5.5.0, it was no longer possible to dock the demo GUI.
 * [#13778](http://bugzilla.scilab.org/show_bug.cgi?id=13778): The size of `repmat([], [1 1 3])` was [0 0 3] instead of [0 0].
 * [#14521](http://bugzilla.scilab.org/show_bug.cgi?id=14521): For the CONVERT Xcos block, types codes 2, 6, 7, and 8 were not documented.
 * [#14704](http://bugzilla.scilab.org/show_bug.cgi?id=14704): In Scinotes, URL for the `https://`, `ftp://`, `ftps://`, and `file://` protocols were no longer hyperlinked.
index bae1f4e..00b1c89 100644 (file)
             </actions>
         </body>
     </shortcuts>
+    <demonstrations title="_(Demos)">
+      <body>
+        <demos demoGUIisDockable="checked"/>
+      </body>
+    </demonstrations>
 </general>
index 2993503..6880ac1 100644 (file)
@@ -26,7 +26,7 @@
                         </option>
                     </xsl:for-each>
                 </Select>
-                
+
                 <Label gridx="1" gridy="2" weightx="0" text="_(Printing format: )"/>
                 <Select gridx="3" gridy="2" listener="ActionListener">
                     <xsl:variable name="pf" select="@printing-format"/>
             </VBox>
         </Title>
     </xsl:template>
+
+    <xsl:template match="demos">
+        <Title text="_(Demos)">
+            <Grid>
+                <Checkbox
+                      gridx="1"
+                      gridy="1"
+                      listener="ActionListener"
+                      checked="{@demoGUIisDockable}"
+                      text="_(The demo interface is dockable)"
+                      >
+                    <actionPerformed choose="demoGUIisDockable">
+                        <xsl:call-template name="context"/>
+                    </actionPerformed>
+                </Checkbox>
+            </Grid>
+        </Title>
+    </xsl:template>
 </xsl:stylesheet>
index ac6e4f4..bbf4700 100644 (file)
@@ -44,11 +44,35 @@ function demo_gui()
     end
 
 
-
     // Figure creation
     // =========================================================================
-    demo_fig = loadGui(SCI + "/modules/demo_tools/gui/demo_gui.xml");
+    // We get the user Preferences for the GUI: dockable / not dockable
+    File = SCIHOME + "/XConfiguration.xml";
+    r = getPreferencesValue("//general/demonstrations/body/demos","demoGUIisDockable", File);
+
+    // We tune accordingly the predefined demo GUI
+    File = SCI + "/modules/demo_tools/gui/demo_gui.xml";
+    File2 = TMPDIR + "/demo_gui_dockable.xml";
+    if r=="checked" then
+        if ~isfile(File2) then
+            r = copyfile(File, File2);
+            doc = xmlRead(File2);
+            setPreferencesValue("/scilabgui/figure", ..
+                                ["dockable" "on"
+                                 "infobar_visible" "on"
+                                 "menubar" "figure"
+                                 "menubar_visible" "on"]', doc);
+            xmlWrite(doc);
+            xmlDelete(doc);
+        end
+        File = File2;
+    end
+
+    // We load the preset GUI
+    demo_fig = loadGui(File);
     demo_fig.figure_name = _("Demonstrations");
+
+
     // Parameters
     // =========================================================================
     demo_fig.userdata = struct();