demo_gui rewriten 16/13916/7
Antoine ELIAS [Wed, 5 Mar 2014 16:11:53 +0000 (17:11 +0100)]
Change-Id: Id7ced5342868e231468bd3243e85d08625def412

scilab/modules/commons/src/java/org/scilab/modules/commons/ScilabCommonsUtils.java
scilab/modules/commons/src/java/org/scilab/modules/commons/gui/FindIconHelper.java
scilab/modules/demo_tools/macros/delete_frame.sci [deleted file]
scilab/modules/demo_tools/macros/demo_gui.sci
scilab/modules/demo_tools/macros/demo_gui.xml [new file with mode: 0644]
scilab/modules/gui/demos/cb_uicontrol_plot3d.dem.sci
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uiimage/SwingScilabUiImage.java

index 816a82c..917df11 100644 (file)
@@ -123,20 +123,26 @@ public final class ScilabCommonsUtils {
      * @return correct base directory
      */
     public static String getCorrectedPath(String path) {
+        String sciUnixStyle = "";
         path = path.trim();
+        String pathLinux = path.replace("\\", "/");
         if (path != null && !path.isEmpty()) {
-            if (path.startsWith("~" + File.separator) || path.equals("~")) {
-                return path.replaceFirst("~", ScilabConstants.USERHOME);
-            } else if (path.startsWith("SCI" + File.separator) || path.equals("SCI")) {
+            if (path.startsWith("~" + "/") || path.equals("~")) {
+                sciUnixStyle = ScilabConstants.USERHOME.replace("\\", "/");
+                return path.replaceFirst("~", sciUnixStyle);
+            } else if (path.startsWith("SCI/") || path.equals("SCI")) {
                 try {
-                    return path.replaceFirst("SCI", ScilabConstants.SCI.getCanonicalPath());
+                    sciUnixStyle = ScilabConstants.SCI.getCanonicalPath().replace("\\", "/");
                 } catch (IOException e) {
-                    return path.replaceFirst("SCI", ScilabConstants.SCI.getAbsolutePath());
+                    sciUnixStyle = ScilabConstants.SCI.getAbsolutePath().replace("\\", "/");
                 }
-            } else if (path.startsWith("SCIHOME" + File.separator) || path.equals("SCIHOME")) {
-                return path.replaceFirst("SCIHOME", ScilabConstants.SCIHOME.toString());
-            } else if (path.startsWith("TMPDIR" + File.separator) || path.equals("TMPDIR")) {
-                return path.replaceFirst("TMPDIR", ScilabCommons.getTMPDIR());
+                return pathLinux.replaceFirst("SCI", sciUnixStyle).replace("/", File.separator);
+            } else if (path.startsWith("SCIHOME/") || path.equals("SCIHOME")) {
+                sciUnixStyle = ScilabConstants.SCIHOME.toString().replace("\\", "/");
+                return path.replaceFirst("SCIHOME", sciUnixStyle).replace("/", File.separator);
+            } else if (path.startsWith("TMPDIR/") || path.equals("TMPDIR")) {
+                sciUnixStyle = ScilabCommons.getTMPDIR().replace("\\", "/");
+                return path.replaceFirst("TMPDIR", sciUnixStyle).replace("/", File.separator);
             }
         }
 
index 75782e9..70251ff 100644 (file)
@@ -13,6 +13,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.scilab.modules.commons.OS;
+import org.scilab.modules.commons.ScilabCommonsUtils;
 
 public final class FindIconHelper {
     /**
@@ -228,6 +229,12 @@ public final class FindIconHelper {
     }
 
     public static String findImage(final String image) {
+
+        File file = new File(ScilabCommonsUtils.getCorrectedPath(image));
+        if (file.exists()) {
+            return file.getAbsolutePath();
+        }
+
         for (String directory : THEME_BASENAME) {
             final File f = new File(directory + SEP + image);
             if (f.exists()) {
diff --git a/scilab/modules/demo_tools/macros/delete_frame.sci b/scilab/modules/demo_tools/macros/delete_frame.sci
deleted file mode 100644 (file)
index 3356dd9..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Pierre MARECHAL
-//
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at
-// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
-//
-
-function delete_frame(my_fig_handle,fr_position)
-
-    my_frame         = findobj("tag", "frame_"    +string(fr_position));
-    my_frame_title     = findobj("tag", "title_frame_"+string(fr_position));
-    my_listbox       = findobj("tag", "listbox_"  +string(fr_position));
-
-    delete(my_frame);
-    delete(my_frame_title);
-    delete(my_listbox);
-
-endfunction
index d2161ce..1968558 100644 (file)
@@ -29,203 +29,51 @@ function demo_gui()
         end
     end
 
+    if get("scilab_demo_fig") <> [] then
+        delete(get("scilab_demo_fig"));
+    end
+
+
+
     // Figure creation
     // =========================================================================
-
-    demo_fig     = figure(100000);
-    demo_fig.visible = "off";
-    demo_fig.children(1).visible = "off"; // to be sure that no plot can appear in the axe
-    demo_fig.tag = "scilab_demo_fig";
+    demo_fig = loadGui(SCI + "/modules/demo_tools/macros/demo_gui.xml");
 
     // Parameters
     // =========================================================================
-
     demo_fig.userdata = struct();
-    demo_fig.userdata.frame_w  = 200;   // Frame width
-    demo_fig.userdata.frame_h  = 450;   // Frame height
-
-    demo_fig.userdata.margin_x = 15;    // Horizontal margin between each elements
-    demo_fig.userdata.margin_y = 15;    // Vertical margin between each elements
-
     demo_fig.userdata.frame_number = 1;      // Frame number
-
     demo_fig.userdata.subdemolist = [];
 
-
-    axes_w     = (demo_fig.userdata.frame_number+1)*demo_fig.userdata.margin_x + ..
-    demo_fig.userdata.frame_number*demo_fig.userdata.frame_w; // axes width
-    axes_h     = 3*demo_fig.userdata.margin_y + demo_fig.userdata.frame_h; // axes height
-
-    // Remove Scilab graphics menus & toolbar
-
-    delmenu(demo_fig.figure_id, gettext("&File"));
-    delmenu(demo_fig.figure_id, gettext("&Tools"));
-    delmenu(demo_fig.figure_id, gettext("&Edit"));
-    delmenu(demo_fig.figure_id, gettext("&?"));
-    toolbar(demo_fig.figure_id, "off");
-
-    // Add the new one
-
-    h = uimenu( "parent", demo_fig,      ..
-    "label" , gettext("File"));
-
     lst_vars_locals = ["%h_delete";
     "demo_fig";
     "get_figure_handle";
     "subdemolist";
     "demolistlock";
-    "delete_frame";
     "resize_gui";
     "demo_gui_update";
-    "create_frame";
     "demo_gui"];
 
     clear_vars_str = strcat("clear " + lst_vars_locals, ";") + ";";
 
-    callback_close_str = "demo_fig=get_figure_handle(100000);delete(demo_fig);";
-    callback_close_str = callback_close_str + clear_vars_str + "clearglobal demolistlock;";
-
-    uimenu( "parent"  , h,         ..
-    "label"   , gettext("Close"),  ..
-    "callback"  , callback_close_str, ..
-    "tag"     , "close_menu");
-
-    // Background, Resize, title ...
-
-    demo_fig.background    = -2;
-    demo_fig.axes_size     = [axes_w axes_h];
-    demo_fig.figure_name   = gettext("Demos");
-
-    // Frame creation
-
-    create_frame(demo_fig,1,"Demos",demolist);
+    callback_close_str = "delete(get(""scilab_demo_fig""));";
+    callback_close_str = callback_close_str + clear_vars_str + "clearglobal demolistlock demolist;";
 
-    demo_fig.axes_size     = [axes_w axes_h];
+    b = get("frame_1", "borders");
+    b.title = _("Demonstrations");
+    set("frame_1", "borders", b);
+    set("listbox_1", "string", demolist(:, 1));
+    set("listbox_1", "userdata", demolist);
 
-    demo_fig.resizefcn = "resize_demo_gui";
+    demo_fig.closerequestfcn = callback_close_str;
 
     demo_fig.visible = "on"; // Display now
 
 endfunction
 
-function create_frame(my_fig_handle,fr_position,fr_title,fr_items)
-
-    // my_fig_handle : Handle de la figure englobante
-    // fr_position   : position de la frame à créer
-    // fr_position   : titre de la frame à créer
-    // fr_items    : liste des items de la listbox
-
-    // Parameters
-    // =========================================================================
-
-    frame_w    = my_fig_handle.userdata.frame_w;   // Frame width
-    frame_h    = my_fig_handle.userdata.frame_h;   // Frame height
-
-    margin_x   = my_fig_handle.userdata.margin_x;    // Horizontal margin between each elements
-    margin_y   = my_fig_handle.userdata.margin_y;    // Vertical margin between each elements
-
-    // =========================================================================
-
-
-    // if no item, no display
-    if fr_items == []  then
-        my_visible = "off";
-    else
-        my_visible = "on";
-    end
-
-    axes_h = my_fig_handle.axes_size(2);
-
-
-    if fr_position <> 1 then
-        this_frame_w   = frame_w;
-        this_frame_h   = frame_h;
-        this_frame_pos_x = (margin_x+(fr_position-1)*(margin_x+frame_w));
-        this_frame_pos_y = axes_h-(margin_y+frame_h);
-    else
-        this_frame_w   = frame_w;
-        this_frame_h   = frame_h - 150 ;
-        this_frame_pos_x = (margin_x+(fr_position-1)*(margin_x+frame_w));
-        this_frame_pos_y = axes_h-(margin_y+frame_h)+150;
-    end
-
-    // frame
-    curFrame = findobj("tag", "frame_"+string(fr_position));
-    if ~isempty(curFrame) then
-        delete_frame(my_fig_handle, fr_position);
-    end
-    uicontrol( ...
-    "parent"        , my_fig_handle,...
-    "relief"        , "groove",...
-    "style"         , "frame",...
-    "units"         , "pixels",...
-    "position"      , [ this_frame_pos_x this_frame_pos_y this_frame_w this_frame_h ],...
-    "horizontalalignment" , "center", ...
-    "background"      , [1 1 1], ...
-    "visible"       , my_visible, ...
-    "tag"         , "frame_"+string(fr_position));
-
-    // Frame title
-    uicontrol( ...
-    "parent"        , my_fig_handle,...
-    "style"         , "text",...
-    "string"        , " "+gettext(fr_title),...
-    "units"         , "pixels",...
-    "position"      , [ this_frame_pos_x+10 axes_h-(margin_y)-9 this_frame_w-20 18 ],...
-    "fontunits"       , "points",...
-    "fontsize"      , 12,...
-    "fontWeight"      , "bold",...
-    "horizontalalignment" , "center", ...
-    "background"      , [1 1 1], ...
-    "visible"       , my_visible, ...
-    "tag"         , "title_frame_"+string(fr_position));
-
-    // List Box
-    uicontrol( ...
-    "parent"        , my_fig_handle,...
-    "style"         , "listbox",...
-    "string"        , " "+strcat(fr_items(:,1),"| "),...
-    "units"         , "pixels",...
-    "position"      , [ this_frame_pos_x+5 this_frame_pos_y+5 this_frame_w-12 this_frame_h-14-10 ],...
-    "fontunits"       , "points",...
-    "fontsize"      , 12,...
-    "horizontalalignment" , "left", ...
-    "BackgroundColor"   , [255/255 , 255/255 , 255/255 ], ...
-    "callback"      , "script_path = demo_gui_update();exec(script_path,-1);clear script_path;",...
-    "visible"       , my_visible, ...
-    "user_data"       , fr_items, ...
-    "tag"         , "listbox_"+string(fr_position));
-
-    // Logo Scilab
-    // =========================================================================
-
-    if fr_position == 1 then
-
-        uicontrol( ...
-        "parent"        , my_fig_handle,...
-        "style"         , "image",...
-        "string"        , SCI+"/modules/demo_tools/images/logo_scilab.png",...
-        "units"         , "pixels",...
-        "position"      , [ (margin_x+(fr_position-1)*(margin_x+frame_w)) axes_h-(margin_y+frame_h) frame_w 150],...
-        "background"      , [1 1 1], ...
-        "tag"         , "scilab_logo", ...
-        "horizontalalignment" , "center", ...
-        "verticalalignment"   , "middle" ...
-        );
-
-    end
-
-
-endfunction
-
 function script_path = demo_gui_update()
-
-    my_counter = 0;
-
     global subdemolist;
 
-    my_selframe   = get(gcbo,"tag");
-
     // Suppression d'une figure précédemment dessinée, si figure il y a ...
     all_figs = winsid();
     all_figs = all_figs(all_figs >= 100001); // All Scilab graphic windows opened for demos
@@ -237,25 +85,28 @@ function script_path = demo_gui_update()
     end
 
     // Handle de la figure
-    demo_fig    = gcbo.parent;
+    demo_fig = get("scilab_demo_fig");
 
     // Frame sur laquelle on a cliqué
-    my_selframe_num = msscanf(my_selframe,"listbox_%d");
+    my_selframe_num = msscanf(gcbo.tag, "listbox_%d");
 
     // Récupération de la liste des démos
-    my_index = get(findobj("tag",my_selframe), "value"  );
-    my_data  = get(findobj("tag",my_selframe), "user_data");
+    my_index = gcbo.value;
+    if my_index == [] then
+        script_path = [];
+        return;
+    end
 
-    script_path = my_data(my_index(1,1),2);
+    my_data = gcbo.user_data;
 
+    script_path = my_data(my_index(1,1),2);
     if grep(script_path,"dem.gateway.sce") == 1 then
-
         // On est dans le cas ou une nouvelle frame va être affichée
 
         // Mise à jour du nombre de frame
-        demo_fig.userdata.frame_number  = my_selframe_num+1;
-        resize_gui(demo_fig, demo_fig.userdata.frame_number);
-        previous_demolist    = demo_fig.userdata.subdemolist;
+        demo_fig.userdata.frame_number = my_selframe_num+1;
+        resize_gui(demo_fig.userdata.frame_number);
+        previous_demolist = demo_fig.userdata.subdemolist;
 
         mode(-1);
         exec(script_path,-1); // This script erases subdemolist variable if needed
@@ -267,44 +118,30 @@ function script_path = demo_gui_update()
         demo_fig.userdata = ud;
         clearglobal subdemolist
 
-        create_frame(demo_fig,my_selframe_num+1,my_data(my_index(1,1),1), demo_fig.userdata.subdemolist);
-        demo_fig.userdata.subdemolist = previous_demolist;
+        frame = get("frame_" + string(my_selframe_num+1));
+
+        b = frame.borders;
+        b.title = my_data(my_index(1,1),1)
+        frame.borders = b;
+
+        listbox = get("listbox_" + string(my_selframe_num+1));
+        listbox.string = demo_fig.userdata.subdemolist(:, 1);
+        listbox.userdata = demo_fig.userdata.subdemolist;
 
+        ud = demo_fig.userdata;
+        ud.subdemolist = previous_demolist;
+        demo_fig.userdata = ud;
     else
         // Mise à jour du nombre de frame
-        demo_fig.userdata.frame_number  = my_selframe_num;
-        resize_gui(demo_fig, demo_fig.userdata.frame_number);
+        demo_fig.userdata.frame_number = my_selframe_num;
+        resize_gui(demo_fig.userdata.frame_number);
     end
-
 endfunction
 
-function resize_gui(my_fig_handle,frame_number)
-
-    // Parameters
-    // =========================================================================
-
-    frame_w    = my_fig_handle.userdata.frame_w;   // Frame width
-    frame_h    = my_fig_handle.userdata.frame_h;   // Frame height
-
-    margin_x   = my_fig_handle.userdata.margin_x;    // Horizontal margin between each elements
-    margin_y   = my_fig_handle.userdata.margin_y;    // Vertical margin between each elements
-
-    // =========================================================================
-
-    axes_w           = (frame_number+1)*margin_x + frame_number*frame_w; // axes width
-    my_fig_handle.axes_size(1) = axes_w;
-
-    for i=(frame_number+1):10
-
-        my_frame         = findobj("tag", "frame_"    +string(i));
-        my_frame_title     = findobj("tag", "title_frame_"+string(i));
-        my_listbox       = findobj("tag", "listbox_"  +string(i));
-
-        if my_frame <> [] then
-            delete_frame(my_fig_handle,i);
-        end
-
-    end
-
+function resize_gui(frame_number)
+    axes_w = frame_number * 250; // axes width
+    demo_fig = get("scilab_demo_fig");
+    demo_fig.axes_size(1) = axes_w;
+    demo_fig.children($:-1:$-(frame_number+1)).visible = "on";
+    demo_fig.children($-frame_number:-1:1).visible = "off";
 endfunction
-
diff --git a/scilab/modules/demo_tools/macros/demo_gui.xml b/scilab/modules/demo_tools/macros/demo_gui.xml
new file mode 100644 (file)
index 0000000..6e30020
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scilabgui usedeprecatedskin="off" version="1.0">
+    <figure axes_size="250,500" default_axes="off" dockable="off" figure_id="100000" figure_name="" infobar_visible="off" layout="1" menubar="0" menubar_visible="off" resizefcn="resize_demo_gui" tag="scilab_demo_fig" toolbar="0" toolbar_visible="off" visible="off" icon="applications-system">
+        <frame gridbagfill="3" gridbaggrid="10,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_10" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_10" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="9,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_9" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_9" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="8,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_8" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_8" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="7,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_7" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_7" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="6,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_6" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_6" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="5,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_5" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_5" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="4,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_4" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_74" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="3,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_3" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_3" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="2,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_2" visible="off">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_2" value="3.0"/>
+        </frame>
+        <frame gridbagfill="3" gridbaggrid="1,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_1">
+            <borders color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="2" style="titled" title="">
+                <title style="empty"/>
+            </borders>
+            <image gridbagfill="3" gridbaggrid="1,5,1,1" gridbagweight="1.0,0.1" horizontalalignment="center" string="SCI/modules/demo_tools/images/logo_scilab.png" tag="scilab_logo"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" tag="listbox_1" value="3.0"/>
+        </frame>
+    </figure>
+</scilabgui>
index f334315..dfed178 100644 (file)
@@ -1,5 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2008 - INRIA - Pierre MARECHAL
+// Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
 //
 // This file must be used under the terms of the CeCILL.
 // This source file is licensed as described in the file COPYING, which
 //
 
 function uicontrol_plot3d()
-
-    global margin_x;
-    global margin_y;
-
-    global padding_x;
-    global padding_y;
-
-    global frame_w;
-    global frame_h;
-
-    global plot_w;
-    global plot_h;
-
-    // Parameters
-    // =========================================================================
-
-    frame_w            = 300;     // Frame width
-    frame_h            = 550;     // Frame height
-
-    plot_w             = 600;     // Plot width
-    plot_h             = frame_h; // Plot height
-
-    margin_x           = 15;      // Horizontal margin between each elements
-    margin_y           = 15;      // Vertical margin between each elements
-
-    padding_x          = 10;      // Horizontal padding between each elements
-    padding_y          = 10;      // Vertical padding between each elements
-
-    button_w           = 100;     // Button width
-    button_h           = 30;      // Button height
-
-    defaultfont        = "arial"; // Default Font
-    subframe_font_size = 12;      // Title font size (Rotation angle, Colormap, ...)
-    text_font_size     = 11;      // Text font size
-
-
-    // Figure creation
-    // =========================================================================
-
-    axes_w       = 3*margin_x + frame_w + plot_w; // axes width
-    axes_h       = 2*margin_y + frame_h;          // axes height (100 => toolbar height)
-
-    demo_plot3d = scf(100001);
-
-    // Remove Scilab graphics menus & toolbar
-
-    delmenu(demo_plot3d.figure_id, gettext("&File"));
-    delmenu(demo_plot3d.figure_id, gettext("&Tools"));
-    delmenu(demo_plot3d.figure_id, gettext("&Edit"));
-    delmenu(demo_plot3d.figure_id, gettext("&?"));
-    toolbar(demo_plot3d.figure_id, "off");
-
+    demo_plot3d = figure( ...
+        "dockable", "off", ...
+        "infobar_visible", "off", ...
+        "toolbar_visible", "off", ...
+        "toolbar", "none", ...
+        "menubar_visible", "on", ...
+        "menubar", "none", ...
+        "default_axes", "off", ...
+        "layout", "gridbag", ...
+        "visible", "off");
+
+    demo_plot3d.figure_id       = 100001;
     demo_plot3d.background      = -2;
-    demo_plot3d.color_map       = jetcolormap(128);
+    demo_plot3d.color_map       = jetcolormap(32);
     demo_plot3d.figure_position = [0 0];
     demo_plot3d.figure_name     = gettext("Control Plot3d");
+    demo_plot3d.axes_size       = [900 450];
 
     // New menu
 
-    h = uimenu( "parent", demo_plot3d,       ..
-    "label" , gettext("File"));
+    h = uimenu(demo_plot3d, ...
+        "label" , gettext("File"));
 
-    uimenu( "parent"    , h,                 ..
-    "label"     , gettext("Close"),  ..
-    "callback"  , "demo_plot3d=get_figure_handle(100001);delete(demo_plot3d);", ..
-    "tag"       , "close_menu");
+    uimenu(h, ...
+        "label"     , gettext("Close"), ...
+        "callback"  , "demo_plot3d=get_figure_handle(100001);delete(demo_plot3d);", ...
+        "tag"       , "close_menu");
 
     demo_viewCode(SCI+ "/modules/gui/demos/cb_uicontrol_plot3d.dem.sci");
 
-    sleep(500);
-    demo_plot3d.axes_size       = [axes_w axes_h];
-
-    // Frames creation [Control Panel]
-    // =========================================================================
-
-    my_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ margin_x margin_y frame_w frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_control" ...
-    );
-
-    // Frame title
-    my_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Control Panel",...
-    "units"               , "pixels",...
-    "position"            , [ 30+margin_x margin_y+frame_h-10 frame_w-60 20 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , 16,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_control" ...
-    );
-
-
-    // Rotation Angle
-    // =========================================================================
-
-    my_slider_angle = 0;
-
-    my_ra_frame_w     = frame_w-2*padding_x
-    my_ra_frame_h     = 50;
-    my_ra_frame_pos_x = padding_x+margin_x;
-    my_ra_frame_pos_y = (margin_y+frame_h) - 4*padding_y - my_ra_frame_h;
-
-    my_slider_width      = my_ra_frame_w - 20;
-    my_slider_height     = 20;
-    my_slider_position_x = my_ra_frame_pos_x + 10;
-    my_slider_position_y = my_ra_frame_pos_y + 10;
-
-    // frame
-
-    my_ra_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ my_ra_frame_pos_x my_ra_frame_pos_y my_ra_frame_w my_ra_frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_control" ...
-    );
-
-    // Frame title
-
-    my_ra_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Rotation angle",...
-    "units"               , "pixels",...
-    "position"            , [ 70+my_ra_frame_pos_x my_ra_frame_pos_y+my_ra_frame_h-9 my_ra_frame_w-140 18 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , subframe_font_size,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_control" ...
-    );
-
-    my_slider_angle = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "slider",...
-    "Min"                 , 0,...
-    "Max"                 , 360,...
-    "Value"               , 70,...
-    "SliderStep"          , [2 30],...
-    "units"               , "pixels",...
-    "position"            , [ my_slider_position_x my_slider_position_y my_slider_width my_slider_height ],...
-    "tag"                 , "slider_angle", ...
-    "callback"            , "update_plot3d_angle()" ...
-    );
-
-    // Colormap frame creation
-    // =========================================================================
-
-    my_cmap_frame_w     = frame_w-2*padding_x
-    my_cmap_frame_h     = 100;
-    my_cmap_frame_pos_x = padding_x+margin_x;
-    my_cmap_frame_pos_y = my_ra_frame_pos_y - 2*padding_y - my_cmap_frame_h;
-
-    // Colormap : frame
-
-    my_cmap_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ my_cmap_frame_pos_x my_cmap_frame_pos_y my_cmap_frame_w my_cmap_frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_control" ...
-    );
-
-    // Colormap : Frame title
-
-    my_cmap_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Colormap",...
-    "units"               , "pixels",...
-    "position"            , [ 100+my_cmap_frame_pos_x my_cmap_frame_pos_y+my_cmap_frame_h-9 my_cmap_frame_w-200 18 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , subframe_font_size,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_control" ...
-    );
-
-    // Colormap : Jetcolormap
-
-    jetcolormap_radio = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "radiobutton",...
-    "string"             , "Jetcolormap",...
-    "position"           , [ my_cmap_frame_pos_x+10 my_cmap_frame_pos_y+my_cmap_frame_h-50 my_cmap_frame_w-25 15],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "min"                , 0, ...
-    "max"                , 1, ...
-    "value"              , 1, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_colormap",...
-    "tag"                , "jetcolormap_radio");
-
-    // Colormap : Hotcolormap
-
-    hotcolormap_radio = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "radiobutton",...
-    "string"             , "Hotcolormap",...
-    "position"           , [ my_cmap_frame_pos_x+10 my_cmap_frame_pos_y+my_cmap_frame_h-70 my_cmap_frame_w-25 15],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "min"                , 0, ...
-    "max"                , 1, ...
-    "value"              , 0, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_colormap",...
-    "tag"                , "hotcolormap_radio");
-
-    // Colormap : Graycolormap
-
-    graycolormap_radio = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "radiobutton",...
-    "string"             , "Graycolormap",...
-    "position"           , [ my_cmap_frame_pos_x+10 my_cmap_frame_pos_y+my_cmap_frame_h-90 my_cmap_frame_w-25 20],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontsize"           , text_font_size,...
-    "fontunits"          , "points",...
-    "min"                , 0, ...
-    "max"                , 1, ...
-    "value"              , 0, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_colormap",...
-    "tag"                , "graycolormap_radio");
-
-
-    // Background axes color
-    // =========================================================================
-
-
-    my_bac_frame_w     = frame_w-2*padding_x
-    my_bac_frame_h     = 65;
-    my_bac_frame_pos_x = padding_x+margin_x;
-    my_bac_frame_pos_y = my_cmap_frame_pos_y - 2*padding_y - my_bac_frame_h;
-
-    my_bac_pushbutton_w     = 100;
-    my_bac_pushbutton_h     = 30;
-    my_bac_pushbutton_pos_x = my_bac_frame_pos_x + floor( (my_bac_frame_w/2) - (my_bac_pushbutton_w/2) );
-    my_bac_pushbutton_pos_y = my_bac_frame_pos_y + floor( (my_bac_frame_h/2) - (my_bac_pushbutton_h/2) );
-
-    // Background axes color : frame
-
-    my_bac_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ my_bac_frame_pos_x my_bac_frame_pos_y my_bac_frame_w my_bac_frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_bac" ...
-    );
-
-    // Background axes color : Frame title
-
-    my_bac_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Background Color",...
-    "units"               , "pixels",...
-    "position"            , [ 70+my_bac_frame_pos_x my_bac_frame_pos_y+my_bac_frame_h-9 my_bac_frame_w-140 18 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , subframe_font_size,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_bac" ...
-    );
-
-    // Background axes color : Pushbutton
-
-    my_bac_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "pushbutton",...
-    "string"              , "",...
-    "units"               , "pixels",...
-    "position"            , [ my_bac_pushbutton_pos_x my_bac_pushbutton_pos_y my_bac_pushbutton_w my_bac_pushbutton_h],...
-    "background"          , [1 1 1], ...
-    "callback"            , "update_background_color",...
-    "tag"                 , "pushbutton_bac" ...
-    );
-
-    // show/hide frame creation
-    // =========================================================================
-
-    my_sh_frame_w     = frame_w-2*padding_x
-    my_sh_frame_h     = 120;
-    my_sh_frame_pos_x = padding_x+margin_x;
-    my_sh_frame_pos_y = my_bac_frame_pos_y - 2*padding_y - my_sh_frame_h;
-
-    // show/hide : frame
-
-    my_sh_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ my_sh_frame_pos_x my_sh_frame_pos_y my_sh_frame_w my_sh_frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_show_hide" ...
-    );
-
-    // show/hide : Frame title
-
-    my_sh_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Show/Hide",...
-    "units"               , "pixels",...
-    "position"            , [ 100+my_sh_frame_pos_x my_sh_frame_pos_y+my_sh_frame_h-9 my_sh_frame_w-200 18 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , subframe_font_size,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_show_hide" ...
-    );
-
-    // show/hide : tics
-
-    tics_checkbox = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "checkbox",...
-    "string"             , "Tics",...
-    "position"           , [ my_sh_frame_pos_x+10 my_sh_frame_pos_y+my_sh_frame_h-50 my_sh_frame_w-25 15],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "value"              , 1, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_tics_visible",...
-    "tag"                , "tics_checkbox");
-
-    // show/hide : title
-
-    title_checkbox = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "checkbox",...
-    "string"             , "Title",...
-    "position"           , [ my_sh_frame_pos_x+10 my_sh_frame_pos_y+my_sh_frame_h-70 my_sh_frame_w-25 20],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "value"              , 1, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_title_visible",...
-    "tag"                , "title_checkbox");
-
-    // show/hide : labels
-
-    labels_checkbox = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "checkbox",...
-    "string"             , "Labels",...
-    "position"           , [ my_sh_frame_pos_x+10 my_sh_frame_pos_y+my_sh_frame_h-90 my_sh_frame_w-25 20],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "value"              , 1, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_labels_visible",...
-    "tag"                , "labels_checkbox");
-
-    // show/hide : edges
-
-    labels_checkbox = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "checkbox",...
-    "string"             , "Edges",...
-    "position"           , [ my_sh_frame_pos_x+10 my_sh_frame_pos_y+my_sh_frame_h-110 my_sh_frame_w-25 20],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "value"              , 1, ...
-    "background"          , [1 1 1], ...
-    "callback"           , "update_edges_visible",...
-    "tag"                , "edges_checkbox");
-
-    // Edit title
-    // =========================================================================
-
-    my_edittitle_frame_w     = frame_w-2*padding_x
-    my_edittitle_frame_h     = 75;
-    my_edittitle_frame_pos_x = padding_x+margin_x;
-    my_edittitle_frame_pos_y = my_sh_frame_pos_y - 2*padding_y - my_edittitle_frame_h;
-
-    // Edit title : frame
-
-    my_edittitle_frame = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "relief"              , "groove",...
-    "style"               , "frame",...
-    "units"               , "pixels",...
-    "position"            , [ my_edittitle_frame_pos_x my_edittitle_frame_pos_y my_edittitle_frame_w my_edittitle_frame_h],...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "frame_edittitle" ...
-    );
-
-    // Edit title : Frame title
-
-    my_edittitle_frame_title = uicontrol( ...
-    "parent"              , demo_plot3d,...
-    "style"               , "text",...
-    "string"              , "Title",...
-    "units"               , "pixels",...
-    "position"            , [ 100+my_edittitle_frame_pos_x my_edittitle_frame_pos_y+my_edittitle_frame_h-9 my_edittitle_frame_w-200 18 ],...
-    "fontname"            , defaultfont,...
-    "fontunits"           , "points",...
-    "fontsize"            , subframe_font_size,...
-    "horizontalalignment" , "center", ...
-    "background"          , [1 1 1], ...
-    "tag"                 , "title_frame_edittitle" ...
-    );
-
-    // Edit title : tics
-
-    tics_checkbox = uicontrol( ...
-    "parent"             , demo_plot3d,...
-    "style"              , "edit",...
-    "position"           , [ my_edittitle_frame_pos_x+10 my_edittitle_frame_pos_y+my_edittitle_frame_h-50 my_edittitle_frame_w-25 25],...
-    "horizontalalignment", "left",...
-    "fontname"           , defaultfont,...
-    "fontunits"          , "points",...
-    "fontsize"           , text_font_size,...
-    "string"             , "My Beautiful Plot", ...
-    "callback"           , "update_title_string",...
-    "tag"                , "edittitle");
-
-    // Plot3d creation
-    // =========================================================================
-
-    drawlater();
-
-    newaxes();
-    my_plot_axes = gca();
-
-    my_plot_axes.x_label.text       = "X";
-    my_plot_axes.y_label.text       = "Y";
-    my_plot_axes.z_label.text       = "Z";
-    my_plot_axes.title.text         = "My Beautiful Plot";
-    my_plot_axes.title.font_size    = 5;
-    my_plot_axes.rotation_angles(1) = 80;
-    my_plot_axes.axes_bounds        = [1/3,0,2/3,1];
-
-    // define colormap
-    colormapSize = 128;
-    f = gcf();
-    f.color_map = jetcolormap(128);
-
-    // generate facet coordinates
-    x = %pi * [-1:0.05:1]';z = sin(x)*cos(x)';
-    [x,y,z] = genfac3d(x,x,z);
-
-    // generate colors
-    // colors depending on z, between 1 and colormap size
-    facetsColors = (z + 1) * (colormapSize - 1) / 2 + 1;
-
-    // plot
-    plot3d(x,y,list(z, facetsColors));
-
-    my_plot3d = gce();
-    my_plot3d.color_flag = 3;
-
-    my_plot_axes.rotation_angles(1) = 80;
-
-    drawnow();
-
+    frame_left = uicontrol(demo_plot3d, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 1, 1, 1], [0.4, 1], "both", "left", [0, 0], [0, 0]), ...
+        "border", createBorders("titled", createBorders("empty"), _("Control Panel"), "center", "top", createFontBorder("", 16, "bold"), "black"), ...
+        "layout", "gridbag");
+
+    //estetic panel
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 1, 1, 1], [0, 0], "both", "center", [0, 5]));
+
+    //angle
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 2, 1, 1], [0, 0], "both", "center"), ...
+        "border", createBorders("titled", createBorders("line", "lightGray", 1), _("Rotation angle"), "center", "top", createFontBorder("", 11, "bold"), "black"), ...
+        "layout", "border");
+
+    uicontrol(frame_angle, ...
+        "style", "slider", ...
+        "value", 70, ...
+        "min", 0, ...
+        "max", 360, ...
+        "sliderstep", [2, 30], ...
+        "callback", "update_plot3d_angle");
+
+    //estetic panel
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 3, 1, 1], [0, 0], "both", "center", [0, 5]));
+
+    //colormap
+    frame_colormap = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 4, 1, 1], [0, 0], "both", "center"), ...
+        "border", createBorders("titled", createBorders("line", "lightGray", 1), _("Colormap"), "center", "top", createFontBorder("", 11, "bold"), "black"), ...
+        "layout_options", createLayoutOptions("grid", [3, 1]));
+
+    frame_colormap.layout = "grid";
+
+    uicontrol(frame_colormap, ...
+        "style", "radiobutton", ...
+        "tag", "graycolormap", ...
+        "string", "Graycolormap", ...
+        "groupname", "colormap", ...
+        "callback", "update_colormap");
+
+    uicontrol(frame_colormap, ...
+        "style", "radiobutton", ...
+        "tag", "hotcolormap", ...
+        "string", "Hotcolormap", ...
+        "groupname", "colormap", ...
+        "callback", "update_colormap");
+
+    jet = uicontrol(frame_colormap, ...
+        "tag", "jetcolormap", ...
+        "style", "radiobutton", ...
+        "string", "Jetcolormap", ...
+        "groupname", "colormap", ...
+        "callback", "update_colormap");
+
+    jet.value = 1;
+
+    //estetic panel
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 5, 1, 1], [0, 0], "both", "center", [0, 5]));
+
+    //background
+    frame_background = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 6, 1, 1], [0, 0], "both", "center"), ...
+        "border", createBorders("titled", createBorders("line", "lightGray", 1), _("Background Color"), "center", "top", createFontBorder("", 11, "bold"), "black"), ..
+        "layout", "border");
+
+    uicontrol(frame_background, ...
+        "tag", "button", ...
+        "style", "pushbutton", ...
+        "backgroundcolor", [1 1 1], ...
+        "relief", "raised", ...
+        "constraints", createConstraints("border", "center", [30 30]), ...
+        "string", "Color picker", ...
+        "callback", "update_background_color");
+
+    //estetic panel
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 7, 1, 1], [0, 0], "both", "center", [0, 5]));
+
+    //Show/hide
+    frame_style = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 8, 1, 1], [1, 1], "both", "center"), ...
+        "border", createBorders("titled", createBorders("line", "lightGray", 1), _("Show / Hide"), "center", "top", createFontBorder("", 11, "bold"), "black"), ...
+        "layout_options", createLayoutOptions("grid", [4, 1]));
+
+    frame_style.layout = "grid";
+
+    uicontrol(frame_style, ...
+        "style", "checkbox", ...
+        "value", 1, ...
+        "string", "Edges", ...
+        "callback", "update_edges_visible");
+
+    uicontrol(frame_style, ...
+        "style", "checkbox", ...
+        "value", 1, ...
+        "string", "Labels", ...
+        "callback", "update_labels_visible");
+
+    uicontrol(frame_style, ...
+        "style", "checkbox", ...
+        "value", 1, ...
+        "string", "Title", ...
+        "callback", "update_title_visible");
+
+    uicontrol(frame_style, ...
+        "style", "checkbox", ...
+        "value", 1, ...
+        "string", "Tics", ...
+        "callback", "update_tics_visible");
+
+    //estetic panel
+    frame_angle = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 9, 1, 1], [0, 0], "both", "center", [0, 5]));
+
+    //Title
+    frame_style = uicontrol(frame_left, ...
+        "style", "frame", ...
+        "constraints", createConstraints("gridbag", [1, 10, 1, 1], [1, 0], "both", "center"), ...
+        "border", createBorders("titled", createBorders("line", "lightGray", 1), _("Title"), "center", "top", createFontBorder("", 11, "bold"), "black"), ...
+        "layout", "border");
+
+    uicontrol(frame_style, ...
+        "style", "edit", ...
+        "string", "My Beautiful Plot", ...
+        "callback", "update_title_string", ...
+        "tag", "title");
+
+    //Plot
+    frame_right = uicontrol(demo_plot3d, ...
+        "style", "frame", ...
+        "layout", "border", ...
+        "constraints", createConstraints("gridbag", [2, 1, 1, 1], [1, 1], "both"));
+
+
+    newaxes(frame_right);
+    demo_plot3d.immediate_drawing = "off";
+    plot3d();
+    light(visible="on", type="point", position=[0 0 1]);
+
+    a = gca();
+    a.tag                   = "plot";
+    a.title.text            = "My Beautiful Plot";
+    a.title.font_size       = 5;
+    a.rotation_angles(1)    = 70;
+
+    a.x_label.text          = "X";
+    a.y_label.text          = "Y";
+    a.z_label.text          = "Z";
+
+    demo_plot3d.immediate_drawing     = "on";
+
+    demo_plot3d.visible     = "on";
 endfunction
 
 
@@ -516,7 +214,7 @@ endfunction
 function update_plot3d_angle()
 
     my_plot_axes = gca();
-    my_new_angle = get(gcbo,"Value");
+    my_new_angle = get(gcbo,"value");
 
     if( my_new_angle>0 & my_new_angle<360 ) then
         my_plot_axes.rotation_angles(2) = my_new_angle;
@@ -529,8 +227,6 @@ function update_colormap()
     my_figure    = gcf();
     my_plot_axes = gca();
 
-    my_figure.immediate_drawing = "off";
-
     my_cur_color_map    = my_figure.color_map;
     my_cur_bg_color_id  = my_plot_axes.background;
 
@@ -540,20 +236,12 @@ function update_colormap()
         my_cur_bg_color_b = my_cur_color_map(my_cur_bg_color_id,3);
     end
 
-    set(findobj("tag", "jetcolormap_radio") , "value", 0);
-    set(findobj("tag", "hotcolormap_radio") , "value", 0);
-    set(findobj("tag", "graycolormap_radio"), "value", 0);
-
-    set(gcbo, "value", 1);
-
-    my_wanted_colormap = get(gcbo,"tag");
-
-    if get(gcbo, "tag") == "jetcolormap_radio" then
-        my_figure.color_map = jetcolormap(128);
-    elseif get(gcbo, "tag") == "hotcolormap_radio" then
-        my_figure.color_map = hotcolormap(128);
-    elseif get(gcbo, "tag") == "graycolormap_radio" then
-        my_figure.color_map = graycolormap(128);
+    if get(gcbo, "tag") == "jetcolormap" then
+        my_figure.color_map = jetcolormap(32);
+    elseif get(gcbo, "tag") == "hotcolormap" then
+        my_figure.color_map = hotcolormap(32);
+    elseif get(gcbo, "tag") == "graycolormap" then
+        my_figure.color_map = graycolormap(32);
     end
 
     if my_cur_bg_color_id > 32 then
@@ -567,8 +255,6 @@ function update_colormap()
         my_plot_axes.background = color_id;
     end
 
-    my_figure.immediate_drawing = "on";
-
 endfunction
 
 function update_background_color()
@@ -592,7 +278,7 @@ function update_tics_visible()
 
     my_plot_axes = gca();
 
-    if get(gcbo,"Value") == 0 then
+    if get(gcbo,"value") == 0 then
         my_plot_axes.axes_visible = ["off" "off" "off" ];
     else
         my_plot_axes.axes_visible = ["on" "on" "on" ];
@@ -604,7 +290,7 @@ function update_title_visible()
 
     my_plot_axes = gca();
 
-    if get(gcbo,"Value") == 0 then
+    if get(gcbo,"value") == 0 then
         my_plot_axes.title.visible = "off";
     else
         my_plot_axes.title.visible = "on";
@@ -616,7 +302,7 @@ function update_labels_visible()
 
     my_plot_axes = gca();
 
-    if get(gcbo,"Value") == 0 then
+    if get(gcbo,"value") == 0 then
         my_plot_axes.x_label.visible = "off";
         my_plot_axes.y_label.visible = "off";
         my_plot_axes.z_label.visible = "off";
@@ -631,9 +317,9 @@ endfunction
 function update_edges_visible()
 
     my_plot_axes = gca();
-    my_plot3d    = my_plot_axes.children;
+    my_plot3d    = my_plot_axes.children(2);
 
-    if get(gcbo,"Value") == 0 then
+    if get(gcbo,"value") == 0 then
         my_plot3d.color_mode = -1;
     else
         my_plot3d.color_mode = +1;
@@ -644,16 +330,6 @@ endfunction
 function update_title_string
 
     my_plot_axes = gca();
-    my_plot_axes.title.text = get(gcbo,"String");
+    my_plot_axes.title.text = get(gcbo,"string");
 
 endfunction
-
-function str = html2str(filename)
-
-    str = mgetl(filename);
-    str = strsubst(str,"SCI",SCI);
-    str = stripblanks(str,%T) + " ";
-    str = strcat(str);
-
-endfunction
-
index 636efd2..7382c30 100644 (file)
@@ -18,12 +18,16 @@ import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Image;
 import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
 
+import javax.imageio.ImageIO;
 import javax.swing.ImageIcon;
 import javax.swing.JLabel;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 
+import org.scilab.modules.commons.gui.FindIconHelper;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
@@ -231,9 +235,23 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
      */
     public void setText(String newText) {
         imageFile = newText;
-        imi = new ImageIcon(imageFile);
-        img = imi.getImage();
-        setIcon(imi);
+
+        File file = new File(imageFile);
+        if (file.exists() == false) {
+            String filename = FindIconHelper.findImage(imageFile);
+            file = new File(filename);
+        }
+
+        try {
+            imi = new ImageIcon(ImageIO.read(file));
+            img = imi.getImage();
+            setIcon(imi);
+        } catch (IOException e) {
+        }
+
+        //        imi = new ImageIcon(imageFile);
+        //        img = imi.getImage();
+        //        setIcon(imi);
     }
 
     /**