summaryrefslogtreecommitdiff
path: root/modules/demo_tools/macros
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/demo_tools/macros
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/demo_tools/macros')
-rwxr-xr-xmodules/demo_tools/macros/add_demo.binbin0 -> 5900 bytes
-rwxr-xr-xmodules/demo_tools/macros/add_demo.sci58
-rwxr-xr-xmodules/demo_tools/macros/buildmacros.bat11
-rwxr-xr-xmodules/demo_tools/macros/buildmacros.sce15
-rwxr-xr-xmodules/demo_tools/macros/cleanmacros.bat13
-rwxr-xr-xmodules/demo_tools/macros/demo_begin.binbin0 -> 2832 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_begin.sci39
-rwxr-xr-xmodules/demo_tools/macros/demo_choose.binbin0 -> 468 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_choose.sci14
-rwxr-xr-xmodules/demo_tools/macros/demo_compiler.binbin0 -> 752 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_compiler.sci18
-rwxr-xr-xmodules/demo_tools/macros/demo_end.binbin0 -> 2280 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_end.sci32
-rwxr-xr-xmodules/demo_tools/macros/demo_file_choice.binbin0 -> 4632 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_file_choice.sci81
-rwxr-xr-xmodules/demo_tools/macros/demo_folder_choice.binbin0 -> 4868 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_folder_choice.sci63
-rwxr-xr-xmodules/demo_tools/macros/demo_function_choice.binbin0 -> 1348 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_function_choice.sci25
-rwxr-xr-xmodules/demo_tools/macros/demo_gui.binbin0 -> 18124 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_gui.sci156
-rwxr-xr-xmodules/demo_tools/macros/demo_run.binbin0 -> 216 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_run.sci13
-rwxr-xr-xmodules/demo_tools/macros/demo_viewCode.binbin0 -> 3356 bytes
-rwxr-xr-xmodules/demo_tools/macros/demo_viewCode.sci43
-rwxr-xr-xmodules/demo_tools/macros/libbin0 -> 540 bytes
-rwxr-xr-xmodules/demo_tools/macros/names11
27 files changed, 592 insertions, 0 deletions
diff --git a/modules/demo_tools/macros/add_demo.bin b/modules/demo_tools/macros/add_demo.bin
new file mode 100755
index 000000000..16709cf1e
--- /dev/null
+++ b/modules/demo_tools/macros/add_demo.bin
Binary files differ
diff --git a/modules/demo_tools/macros/add_demo.sci b/modules/demo_tools/macros/add_demo.sci
new file mode 100755
index 000000000..9f29a47dd
--- /dev/null
+++ b/modules/demo_tools/macros/add_demo.sci
@@ -0,0 +1,58 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// Copyright (C) DIGITEO - 2011 - Allan CORNET
+//
+// 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 add_demo(demotitle, path)
+
+ if and(getscilabmode() <> ["NW";"STD"]) then
+ return;
+ end
+
+ global demolist;
+ global demolistlock;
+
+ if isempty(demolist) then
+ if isempty(demolistlock) then
+ demolistlock = %t;
+ // we load scilab demos only when it is required
+ modules = getmodules();
+ for i=1:size(modules,"*")
+ if isfile("SCI/modules/"+modules(i)+"/demos/" + modules(i) + ".dem.gateway.sce") then
+ exec("SCI/modules/"+modules(i)+"/demos/" + modules(i) + ".dem.gateway.sce",-1);
+ end
+ end
+ clear demolistlock;
+ clearglobal demolistlock;
+ end
+ end
+
+ path = pathconvert(path, %f, %t);
+
+ if ~isfile(path) then
+ error(msprintf(gettext("%s: The file %s does not exist.\n"), "add_demo", path));
+ end
+
+ if isdir(path) then
+ error(msprintf(gettext("%s: Wrong input argument #%d: Path to a scilab script file expected.\n"), "add_demo", 2));
+ end
+
+ k = find(demolist(:,1) == demotitle);
+
+ if k == [] then
+ demolist = [demolist; demotitle,path];
+ else
+ k1 = find(demolist(k,2) == path)
+ if k1 == [] then
+ demolist = [demolist; demotitle + " (" + string(size(k,"*")) + ")", path];
+ end
+ end
+
+ clear demolist
+
+endfunction
diff --git a/modules/demo_tools/macros/buildmacros.bat b/modules/demo_tools/macros/buildmacros.bat
new file mode 100755
index 000000000..a73ca67f8
--- /dev/null
+++ b/modules/demo_tools/macros/buildmacros.bat
@@ -0,0 +1,11 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2008 - INRIA
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
diff --git a/modules/demo_tools/macros/buildmacros.sce b/modules/demo_tools/macros/buildmacros.sce
new file mode 100755
index 000000000..1e1f691e1
--- /dev/null
+++ b/modules/demo_tools/macros/buildmacros.sce
@@ -0,0 +1,15 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
+//
+// 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
+
+if (isdef("genlib") == %f) then
+ exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce");
+end
+
+genlib("demo_toolslib","SCI/modules/demo_tools/macros",%f,%t);
diff --git a/modules/demo_tools/macros/cleanmacros.bat b/modules/demo_tools/macros/cleanmacros.bat
new file mode 100755
index 000000000..4ad1bbae2
--- /dev/null
+++ b/modules/demo_tools/macros/cleanmacros.bat
@@ -0,0 +1,13 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2008 - INRIA
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@del *.bin 2>NUL
+@del lib 2>NUL
+@del names 2>NUL
diff --git a/modules/demo_tools/macros/demo_begin.bin b/modules/demo_tools/macros/demo_begin.bin
new file mode 100755
index 000000000..04187ce14
--- /dev/null
+++ b/modules/demo_tools/macros/demo_begin.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_begin.sci b/modules/demo_tools/macros/demo_begin.sci
new file mode 100755
index 000000000..d04bcd092
--- /dev/null
+++ b/modules/demo_tools/macros/demo_begin.sci
@@ -0,0 +1,39 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
+//
+// 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 demo_begin()
+
+ // Sauvegarde du mode
+ demo_save_mode = mode();
+
+ // Sauvegarde de la pagination
+ demo_save_lines = lines();
+
+ // Sauvegarde des variables locales
+ local_variables = who("local");
+
+ // Construction de la commande pour sauvegarder les variables locales
+ local_cmd_str = "save(TMPDIR+''/who_local.dat''";
+ for i=1:size(local_variables,"r")
+ local_cmd_str = local_cmd_str + "," + local_variables(i);
+ end
+ local_cmd_str = local_cmd_str + ");";
+
+ // Sauvegarde des variables locales dans le fichier TMPDIR/who_local.dat
+ execstr(local_cmd_str);
+
+ // Suppression des variables afin d'avoir un environnement propre pour les
+ // Démos
+ clear
+
+ // Suppression de la pagination
+ lines(0);
+
+endfunction
diff --git a/modules/demo_tools/macros/demo_choose.bin b/modules/demo_tools/macros/demo_choose.bin
new file mode 100755
index 000000000..260a3ddf7
--- /dev/null
+++ b/modules/demo_tools/macros/demo_choose.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_choose.sci b/modules/demo_tools/macros/demo_choose.sci
new file mode 100755
index 000000000..ca0209284
--- /dev/null
+++ b/modules/demo_tools/macros/demo_choose.sci
@@ -0,0 +1,14 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Ghislain HELIOT
+//
+// 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 [num]=demo_choose(fil)
+ load(fil,"choice","titl");
+ num=x_choose(choice,titl);
+endfunction
diff --git a/modules/demo_tools/macros/demo_compiler.bin b/modules/demo_tools/macros/demo_compiler.bin
new file mode 100755
index 000000000..0220a65a0
--- /dev/null
+++ b/modules/demo_tools/macros/demo_compiler.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_compiler.sci b/modules/demo_tools/macros/demo_compiler.sci
new file mode 100755
index 000000000..90e83ef05
--- /dev/null
+++ b/modules/demo_tools/macros/demo_compiler.sci
@@ -0,0 +1,18 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Ghislain HELIOT
+//
+// 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 [ans]=demo_compiler()
+ if (~haveacompiler()) then
+ messagebox(["Scilab doesn''t find a C compiler","This demo is disabled"],"modal");
+ ans=%f;
+ else
+ ans=%t;
+ end
+endfunction
diff --git a/modules/demo_tools/macros/demo_end.bin b/modules/demo_tools/macros/demo_end.bin
new file mode 100755
index 000000000..86d5768a2
--- /dev/null
+++ b/modules/demo_tools/macros/demo_end.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_end.sci b/modules/demo_tools/macros/demo_end.sci
new file mode 100755
index 000000000..1d0c4b4e8
--- /dev/null
+++ b/modules/demo_tools/macros/demo_end.sci
@@ -0,0 +1,32 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
+//
+// 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 demo_end()
+
+ // Suppression des variables utilisées durant la démonstration
+ clear;
+
+ // Récupération de l'environnement
+ load(TMPDIR+"/who_local.dat");
+
+ // Suppression du fichier de sauvegarde de l'environnement
+ mdelete(TMPDIR+"/who_local.dat");
+
+ // Récupération de la pagination
+ lines(demo_save_lines);
+
+ // Récupération du mode
+ mode(demo_save_mode);
+
+ // Suppression de ces deux variables unitiles
+ clear demo_save_lines;
+ clear demo_save_mode;
+
+endfunction
diff --git a/modules/demo_tools/macros/demo_file_choice.bin b/modules/demo_tools/macros/demo_file_choice.bin
new file mode 100755
index 000000000..ccfbe0cbc
--- /dev/null
+++ b/modules/demo_tools/macros/demo_file_choice.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_file_choice.sci b/modules/demo_tools/macros/demo_file_choice.sci
new file mode 100755
index 000000000..149cee61d
--- /dev/null
+++ b/modules/demo_tools/macros/demo_file_choice.sci
@@ -0,0 +1,81 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
+//
+// 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
+
+// demolist
+// demopath
+// demolistlabel
+
+function [] = demo_file_choice()
+
+ while %t then
+
+ if ~exists("demolistlabel") then
+ demolistlabel = "choose a demo";
+ end
+
+ num = x_choose_modeless(demolist(:,1),demolistlabel);
+
+ if num == 0 then
+
+ demo_clean();
+ return;
+
+ else
+
+ script_path = demolist(num,2);
+
+ if (exists("demopath")) & (demopath <> "") then
+ script_path = pathconvert( demopath + "/" + script_path , %F , %T );
+ end
+
+ if grep(script_path,"dem.gateway.sce") == 1 then
+
+ // Gateway
+
+ previous_demolist = demolist;
+ previous_demopath = demopath;
+ previous_demolistlabel = demolistlabel;
+
+ exec(script_path,-1);
+ demo_file_choice();
+
+ demolist = previous_demolist;
+ demopath = previous_demopath;
+ demolistlabel = previous_demolistlabel;
+
+ elseif grep(script_path,"dem.sce") == 1 then
+ // Demonstration
+ demo_clean();
+ demo_run(script_path);
+ else
+ // Old system
+ exec(script_path,-1);
+
+ end
+ end
+ end
+
+endfunction
+
+
+function [] = demo_clean()
+
+ // Suppression de toutes les fenêtres graphiques créé
+ // par les précédentes démos
+
+ opened_windows = winsid();
+
+ for i=1:size(opened_windows,"c")
+ if (opened_windows(i)>=100000) & (opened_windows(i)<=100100) then
+ xdel(opened_windows(i));
+ end
+ end
+
+endfunction
diff --git a/modules/demo_tools/macros/demo_folder_choice.bin b/modules/demo_tools/macros/demo_folder_choice.bin
new file mode 100755
index 000000000..41b7ad54e
--- /dev/null
+++ b/modules/demo_tools/macros/demo_folder_choice.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_folder_choice.sci b/modules/demo_tools/macros/demo_folder_choice.sci
new file mode 100755
index 000000000..e930fc8ea
--- /dev/null
+++ b/modules/demo_tools/macros/demo_folder_choice.sci
@@ -0,0 +1,63 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Ghislain HELIOT
+//
+// 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 []=demo_folder_choice(path,ch)
+
+ if ch=="anim" then
+ deff("[]=demoexc(num)","exec(path+demolist(num,2),-1)")
+ fs = get("figure_style");
+ while %t then
+ num=x_choose_modeless(demolist(:,1),"Choose a demo");
+ if num==0 then
+ set("figure_style",fs);
+ lines(oldln(1));
+ return
+ else
+ set("figure_style","old");
+ xdel();
+ clf();
+ demoexc(num);
+ end
+ end
+
+ else
+
+ if ch=="root" then
+ deff("[]=demoexec(num)","exec(demolist(num,2),-1)")
+ while %t then
+ num=x_choose_modeless(demolist(:,1),["Click to choose a demo";
+ "(see also in SCIDIR/demos/...)"]);
+ if num==0 then
+ lines(oldln(1))
+ return
+ else
+ demoexec(num);
+ end
+ end
+
+ else
+ deff("[]=demoex(num)","exec(path+demolist(num,2),-1)")
+ while %t then
+ num=x_choose_modeless(demolist(:,1),"Choose a demo");
+ if num==0 then
+ lines(oldln(1))
+ return
+ else
+ xdel(0);
+ clf();
+ demoex(num);
+ end
+ end
+ end
+ end
+
+ mode(0);
+
+endfunction
diff --git a/modules/demo_tools/macros/demo_function_choice.bin b/modules/demo_tools/macros/demo_function_choice.bin
new file mode 100755
index 000000000..5acbc5e98
--- /dev/null
+++ b/modules/demo_tools/macros/demo_function_choice.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_function_choice.sci b/modules/demo_tools/macros/demo_function_choice.sci
new file mode 100755
index 000000000..562f4de9e
--- /dev/null
+++ b/modules/demo_tools/macros/demo_function_choice.sci
@@ -0,0 +1,25 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Ghislain HELIOT
+//
+// 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 []=demo_function_choice()
+ while %t then
+ num=x_choose(demolist(:,1),"Choose a demo");
+ if num==0 then
+ xdel(0);
+ lines(oldln(1));
+ return;
+ else
+ xdel(0);
+ clf();
+ execstr(demolist(num,2));
+ end,
+ end
+ mode(0);
+endfunction
diff --git a/modules/demo_tools/macros/demo_gui.bin b/modules/demo_tools/macros/demo_gui.bin
new file mode 100755
index 000000000..fa438b8af
--- /dev/null
+++ b/modules/demo_tools/macros/demo_gui.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_gui.sci b/modules/demo_tools/macros/demo_gui.sci
new file mode 100755
index 000000000..6cf7c9144
--- /dev/null
+++ b/modules/demo_tools/macros/demo_gui.sci
@@ -0,0 +1,156 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Pierre MARECHAL
+// Copyright (C) 2012 - DIGITEO - Vincent COUVERT
+// Copyright (C) 2014 - Scilab Enterprises - Anais AUBERT
+//
+// 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 demo_gui()
+
+ global demolist; // Demos list is defined in scilab.start
+ global demolistlock;
+ if isempty(demolist) then
+ if isempty(demolistlock) then
+ demolistlock = %t;
+ // we load scilab demos only when it is required
+ modules = getmodules();
+ for i=1:size(modules,"*")
+ if isfile("SCI/modules/"+modules(i)+"/demos/" + modules(i) + ".dem.gateway.sce") then
+ exec("SCI/modules/"+modules(i)+"/demos/" + modules(i) + ".dem.gateway.sce",-1);
+ end
+ end
+ clear demolistlock;
+ clearglobal demolistlock;
+ end
+ end
+
+ if get("scilab_demo_fig") <> [] then
+ delete(get("scilab_demo_fig"));
+ end
+
+
+
+ // Figure creation
+ // =========================================================================
+ demo_fig = loadGui(SCI + "/modules/demo_tools/gui/demo_gui.xml");
+ demo_fig.figure_name = _("Demonstrations");
+ // Parameters
+ // =========================================================================
+ demo_fig.userdata = struct();
+ demo_fig.userdata.frame_number = 1; // Frame number
+ demo_fig.userdata.subdemolist = [];
+
+ lst_vars_locals = ["%h_delete";
+ "demo_fig";
+ "get_figure_handle";
+ "subdemolist";
+ "demolistlock";
+ "resize_gui";
+ "demo_gui_update";
+ "demo_gui"];
+
+ clear_vars_str = strcat("clear " + lst_vars_locals, ";") + ";";
+
+ callback_close_str = "delete(get(""scilab_demo_fig""));";
+ callback_close_str = callback_close_str + clear_vars_str + "clearglobal demolistlock;";
+
+ b = get("frame_1", "border");
+ b.title = _("Demonstrations");
+ set("frame_1", "border", b);
+ set("listbox_1", "string", "<html>"+demolist(:, 1)+" &#x25B8; </html>");
+ set("listbox_1", "userdata", demolist);
+
+ demo_fig.closerequestfcn = callback_close_str;
+
+ demo_fig.visible = "on"; // Display now
+
+endfunction
+
+function script_path = demo_gui_update()
+ global subdemolist;
+
+ // 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
+ for fig_index = 1:size(all_figs, "*")
+ fig_to_del = get_figure_handle(all_figs(fig_index));
+ if ~isempty(fig_to_del) then
+ delete(fig_to_del);
+ end
+ end
+
+ // Handle de la figure
+ demo_fig = get("scilab_demo_fig");
+
+ // Frame sur laquelle on a cliqué
+ my_selframe_num = msscanf(gcbo.tag, "listbox_%d");
+
+ // Récupération de la liste des démos
+ my_index = gcbo.value;
+ if my_index == [] then
+ script_path = [];
+ return;
+ end
+
+ 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.userdata.frame_number);
+ previous_demolist = demo_fig.userdata.subdemolist;
+
+ mode(-1);
+ exec(script_path,-1); // This script erases subdemolist variable if needed
+
+ // Create a temporary variable for userdata
+ // because mixing handles and structs can lead to problems
+ ud = demo_fig.userdata;
+ ud.subdemolist = subdemolist;
+ demo_fig.userdata = ud;
+ clearglobal subdemolist
+
+ frame = get("frame_" + string(my_selframe_num+1));
+
+ b = frame.border;
+ b.title = my_data(my_index(1,1),1)
+ frame.border = b;
+
+ listbox = get("listbox_" + string(my_selframe_num+1));
+ listbox.string = demo_fig.userdata.subdemolist(:, 1);
+
+ listbox.userdata = demo_fig.userdata.subdemolist;
+
+ //Prints an arrow if its a submenu
+ a = grep(listbox.userdata(:,2),"dem.gateway.sce")
+ listbox.string(a) = "<html>"+listbox.string(a)+" &#x25B8; </html>";
+
+ 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.userdata.frame_number);
+ end
+endfunction
+
+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";
+ //hide other frame
+ demo_fig.children($-frame_number:-1:1).visible = "off";
+ //clean listbox
+ demo_fig.children($-frame_number:-1:1).children(1).string = "";
+endfunction
diff --git a/modules/demo_tools/macros/demo_run.bin b/modules/demo_tools/macros/demo_run.bin
new file mode 100755
index 000000000..49fbdc3dc
--- /dev/null
+++ b/modules/demo_tools/macros/demo_run.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_run.sci b/modules/demo_tools/macros/demo_run.sci
new file mode 100755
index 000000000..8a9b89280
--- /dev/null
+++ b/modules/demo_tools/macros/demo_run.sci
@@ -0,0 +1,13 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA - Ghislain HELIOT
+//
+// 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 demo_run(fil)
+ exec(fil);
+endfunction
diff --git a/modules/demo_tools/macros/demo_viewCode.bin b/modules/demo_tools/macros/demo_viewCode.bin
new file mode 100755
index 000000000..bf4b3e43d
--- /dev/null
+++ b/modules/demo_tools/macros/demo_viewCode.bin
Binary files differ
diff --git a/modules/demo_tools/macros/demo_viewCode.sci b/modules/demo_tools/macros/demo_viewCode.sci
new file mode 100755
index 000000000..908e6ba38
--- /dev/null
+++ b/modules/demo_tools/macros/demo_viewCode.sci
@@ -0,0 +1,43 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Pierre MARECHAL
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// 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 demo_viewCode(this_script)
+
+ if (~isdef("editor") & (funptr("editor")==0)) then
+ return
+ end
+
+ if isfile(this_script) then
+ path = fullpath(this_script);
+ else
+ path = get_absolute_file_path(this_script) + this_script;
+ end
+
+ // Récupération du handle sur la fenêtre courante
+ my_fig = gcf();
+
+ //Création du nouveau menu
+ if getos() == "Darwin" then
+ my_menu = uimenu( "parent", my_fig, ..
+ "label" , gettext(" -- View Code -- "));
+ my_submenu = uimenu("parent", my_menu , ..
+ "label" , gettext("Open in Editor"), ..
+ "Foregroundcolor" , [ 0/255 81/255 6/255 ] , ..
+ "callback" , "editor("""+path+""", ""readonly"")" );
+ else
+ my_menu = uimenu( "parent" , my_fig , ..
+ "label" , gettext(" -- View Code -- ") , ..
+ "Foregroundcolor" , [ 0/255 81/255 6/255 ] , ..
+ "callback" , "editor("""+path+""", ""readonly"")" );
+ end
+endfunction
+
diff --git a/modules/demo_tools/macros/lib b/modules/demo_tools/macros/lib
new file mode 100755
index 000000000..cfadfe206
--- /dev/null
+++ b/modules/demo_tools/macros/lib
Binary files differ
diff --git a/modules/demo_tools/macros/names b/modules/demo_tools/macros/names
new file mode 100755
index 000000000..edff891c9
--- /dev/null
+++ b/modules/demo_tools/macros/names
@@ -0,0 +1,11 @@
+add_demo
+demo_begin
+demo_choose
+demo_compiler
+demo_end
+demo_file_choice
+demo_folder_choice
+demo_function_choice
+demo_gui
+demo_run
+demo_viewCode