Demos: latex demo updated. 08/14308/2
Vladislav TRUBKIN [Thu, 3 Apr 2014 07:17:30 +0000 (09:17 +0200)]
Change-Id: Ia62febd52db4ae39cb8785823322f918457b74c8

scilab/modules/gui/demos/uicontrol_LaTeX.dem.sce

index 9c3de6f..44cda07 100644 (file)
@@ -12,22 +12,16 @@ function mathml_callback()
 endfunction
 
 // Create a figure
-f = figure("figure_name", gettext("Uicontrols demo with LaTeX"),...
-"Position",[50 50 300 195],...
-"BackgroundColor",[0.9 0.9 0.9],...
-"Tag", "uicontrols_LaTeX_demo_figure");
-
-// Remove Scilab 'standard' menus
-delmenu(f.figure_id, gettext("&File"));
-delmenu(f.figure_id, gettext("&Tools"));
-delmenu(f.figure_id, gettext("&Edit"));
-delmenu(f.figure_id, gettext("&?"));
-
-// Disable graphics toolbar
-toolbar(f.figure_id, "off");
-
-// Adjust figure size after toolbar removing
-f.position = [50 50 330 160];
+f = figure( ...
+    "figure_name", gettext("Uicontrols demo with LaTeX"), ...
+    "infobar_visible", "off", ...
+    "toolbar_visible", "off", ...
+    "dockable", "off", ...
+    "menubar", "none", ...
+    "default_axes", "on", ...
+    "layout", "grid", ...
+    "layout_options", createLayoutOptions("grid", [3 1]), ...
+    "figure_position", [50 50]);
 
 // Add custom menus
 mlatex=uimenu(f,"label", '$\LaTeX$');
@@ -41,11 +35,20 @@ mm2=uimenu(mmathml, "label", "<mrow><msup><mn>a</mn><mi>2</mi></msup><mo>+</mo><
 
 demo_viewCode(SCI+ "/modules/gui/demos/uicontrol_LaTeX.dem.sce");
 
-latexButton=uicontrol(f,"style","pushbutton","string",'$\scalebox{2}{\LaTeX\ x^2}$', "Callback", "latex_callback()");
-latexButton.Position = [30, 70, 120, 40];
-latexLabel=uicontrol(f,"Style","text","string","$\text{Text: }\Gamma(s)=\int_0^\infty t^{s-1}\mathrm{e}^{-t}\,\mathrm{d}t$");
-latexLabel.fontsize=15;
-latexLabel.Position = latexLabel.Position + [50, 0, 0, 0];
-mathmlButton=uicontrol(f, "style", "pushbutton", "string", "<mrow><mtext>MathML</mtext><mphantom><mi>a</mi></mphantom><msup><mi>x</mi><mn>2</mn></msup></mrow>",  ..
-"Callback", "mathml_callback()");
-mathmlButton.Position = latexButton.Position + [140, 0, 0, 0];
+uicontrol(f, ...
+    "style", "pushbutton", ...
+    "string", "$\text{Text: }\Gamma(s)=\int_0^\infty t^{s-1}\mathrm{e}^{-t}\,\mathrm{d}t$", ...
+    "horizontalalignment", "center", ...
+    "Fontsize", 16);
+
+uicontrol(f, ...
+    "style", "text", ...
+    "string","<math><mrow><mtext>MathML</mtext><mphantom><mi>a</mi></mphantom><msup><mi>x</mi><mn>2</mn></msup></mrow></math>", ...
+    "horizontalalignment", "center", ...
+    "Callback", "mathml_callback();");
+
+uicontrol(f, ...
+    "style", "pushbutton", ...
+    "string",'$\scalebox{2}{\LaTeX\ x^2}$', ...
+    "horizontalalignment", "center", ...
+    "Callback", "latex_callback();");