command priority management 04/17004/4
Cedric Delamarre [Thu, 6 Aug 2015 13:14:01 +0000 (15:14 +0200)]
* Set command from gui (help, clc, resume, pause, abort) as prioritary command.
* Documentation updated about callback_type 0, 2, 10, 12.
* menu control => abort fixed

Change-Id: I19c0ffa03910eb8869e8d825f4439d3280d79288

scilab/modules/console/src/java/org/scilab/modules/console/ClearConsoleAction.java
scilab/modules/console/src/java/org/scilab/modules/console/HelpAction.java
scilab/modules/core/src/cpp/runner.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/CallBack.java
scilab/modules/gui/etc/graphics_toolbar.xml
scilab/modules/gui/etc/main_menubar.xml
scilab/modules/gui/etc/main_toolbar.xml
scilab/modules/gui/help/en_US/uicontrol_properties.xml
scilab/modules/gui/help/ja_JP/uicontrol_properties.xml
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CommonCallBack.java

index 392b192..0b1f27e 100644 (file)
@@ -37,6 +37,6 @@ public class ClearConsoleAction extends AbstractConsoleAction {
      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
     public void actionPerformed(ActionEvent e) {
-        InterpreterManagement.putCommandInScilabQueue("clc();");
+        InterpreterManagement.requestScilabExec("clc();");
     }
 }
index 7583a19..9713224 100644 (file)
@@ -37,6 +37,6 @@ public class HelpAction extends AbstractConsoleAction {
      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
     public void actionPerformed(ActionEvent e) {
-        InterpreterManagement.putCommandInScilabQueue("help();");
+        InterpreterManagement.requestScilabExec("help();");
     }
 }
index 032cc17..5982dce 100644 (file)
@@ -53,6 +53,7 @@ void StaticRunner::launch()
         if (ConfigVariable::getPauseLevel())
         {
             ConfigVariable::DecreasePauseLevel();
+            delete runMe;
             throw ia;
         }
 
@@ -63,11 +64,13 @@ void StaticRunner::launch()
             pCtx->scope_end();
         }
 
-        // management of exit/quit
-        if (ConfigVariable::getForceQuit())
+        if (runMe->isConsoleCommand())
         {
-            throw ia;
+            ThreadManagement::SendConsoleExecDoneSignal();
         }
+
+        delete runMe;
+        throw ia;
     }
 
     if (getScilabMode() != SCILAB_NWNI && getScilabMode() != SCILAB_API)
@@ -179,4 +182,4 @@ int StaticRunner_isInterruptibleCommand(void)
 void StaticRunner_setInterruptibleCommand(int val)
 {
     StaticRunner::setInterruptibleCommand(val == 1);
-}
\ No newline at end of file
+}
index 0c2e082..37e5f89 100644 (file)
@@ -53,7 +53,7 @@ public class CallBack {
     public static final int JAVA_OUT_OF_XCLICK_AND_XGETMOUSE = -3;
 
     /**
-     * Scilab instruction without GCBO setting (old addmenu compatibility)
+     * Scilab instruction without GCBO setting (used in case of pause/resume/abort)
      */
     public static final int SCILAB_INSTRUCTION_WITHOUT_GCBO = 4;
 
index e2e72f6..6cd051a 100644 (file)
@@ -35,6 +35,6 @@
     <separator/>
     <!-- Help -->
     <button icon="help-browser" tooltiptext="Help Browser">
-        <callback instruction="help();" type="-2"/>
+        <callback instruction="help();" type="10"/>
     </button>
 </toolbar>
index f55b3cf..9cf4aaf 100644 (file)
     <!-- Control menu -->
     <menu label="&amp;Control" enabled="true">
         <submenu label="&amp;Resume" icon="media-playback-start">
-            <callback instruction="resume;" type="-2"/>
+            <callback instruction="resume;" type="4"/>
         </submenu>
         <submenu label="&amp;Abort" icon="process-stop">
-            <callback instruction="abort;" type="-2"/>
+            <callback instruction="abort;" type="4"/>
         </submenu>
         <submenu label="&amp;Interrupt">
-            <callback instruction="pause;" type="-2"/>
+            <callback instruction="pause;" type="4"/>
         </submenu>
     </menu>
     <!-- Applications menu -->
     <!-- Help menu -->
     <menu label="&amp;?" enabled="true">
         <submenu label="Scilab &amp;Help" accelerator="F1" icon="help-browser">
-            <callback instruction="help();" type="0"/>
+            <callback instruction="help();" type="10"/>
         </submenu>
         <separator/>
         <submenu label="Scilab &amp;Demonstrations" icon="applications-system">
-            <callback instruction="demo_gui();" type="0"/>
+            <callback instruction="demo_gui();" type="10"/>
         </submenu>
         <separator/>
         <submenu label="&amp;Links">
index 2de468a..630a827 100644 (file)
@@ -23,7 +23,7 @@
     <separator/>
     <!-- Clear -->
     <button icon="edit-clear" tooltiptext="Clear Console">
-        <callback instruction="clc();" type="0"/>
+        <callback instruction="clc();" type="10"/>
     </button>
     <separator/>
     <!-- Print -->
@@ -52,6 +52,6 @@
     </button>
     <!-- Help -->
     <button icon="help-browser" tooltiptext="Help Browser">
-        <callback instruction="help();" type="0"/>
+        <callback instruction="help();" type="10"/>
     </button>
 </toolbar>
index 5d0789f..709d272 100644 (file)
@@ -53,7 +53,7 @@
             <varlistentry>
                 <term>Callback_Type</term>
                 <listitem>
-                    <para>Integer</para>
+                    <para>Scalar</para>
                     <para>The type of callback transmitted to the uicontrol.</para>
                     <itemizedlist>
                         <listitem>
@@ -63,7 +63,8 @@
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>0</literal> a Scilab instruction
+                                <literal>0</literal> or <literal>2</literal> a Scilab instruction
+                                <literal>10</literal> or <literal>12</literal> a prioritary, non-interruptible Scilab instruction
                             </para>
                         </listitem>
                         <listitem>
                                 <literal>1</literal> a C or a Fortran function
                             </para>
                         </listitem>
-                        <listitem>
-                            <para>
-                                <literal>2</literal> a Scilab function
-                            </para>
-                        </listitem>
                     </itemizedlist>
                 </listitem>
             </varlistentry>
                 <listitem>
                     <para>String</para>
                     <para>
-                        Used for <literal>radiobutton</literal> and <literal>checkbox</literal> style uicontrols, 
+                        Used for <literal>radiobutton</literal> and <literal>checkbox</literal> style uicontrols,
                         this property allow to manage uicontrols of the same group as a whole. For example, <literal>checkbox</literal> uicontrols of a group
                         will manage selection unicity automatically.
                     </para>
                     </para>
                     <itemizedlist>
                         <listitem>
-                            <para>  
+                            <para>
                                 For <literal>pushbutton</literal> or <literal>text</literal> uicontrols, if the text is enclosed between two $ (dollar sign), then it will be
                                 considered as a LaTeX expression, and if it is enclosed between &lt; and &gt;, it will be considered
                                 as a MathML one.
                             <para>
                                 For <literal>listbox</literal> and <literal>popupmenu</literal> uicontrols which manage colors selection, icons, background
                                 and foreground colors, the <literal>String</literal> property can be set to a matrix matching the format:
-                                <literal>["#color1", "Item1", "#background1", "#foreground1"; "#color2", "Item2", ..., ...]</literal> 
-                                <literal>["icon1", "Item1", "#background1", "#foreground1"; "icon2", "Item2", ..., ...]</literal> 
+                                <literal>["#color1", "Item1", "#background1", "#foreground1"; "#color2", "Item2", ..., ...]</literal>
+                                <literal>["icon1", "Item1", "#background1", "#foreground1"; "icon2", "Item2", ..., ...]</literal>
                                 with <literal>"#color1"</literal>, <literal>"#background1"</literal> and <literal>"#foreground1"</literal> in HTML format <literal>#XXXXXX</literal>.
                                 Then the component will display a colored box or icon on the left of the associated string,
                                 and different background/foreground colors for items.
                 <listitem>
                     <para>Boolean</para>
                     <para>
-                        Indicates whether the tabs of a <literal>tab</literal> style uicontrol 
+                        Indicates whether the tabs of a <literal>tab</literal> style uicontrol
                         must be wrapped (<literal>title_scroll=%F</literal>) or scrolled (<literal>title_scroll=%T</literal>).
                     </para>
                 </listitem>
index 2cb35a8..21ce532 100644 (file)
@@ -38,7 +38,7 @@
                 <listitem>
                     <para>Borderオブジェクト.</para>
                     <para>
-                        <literal>frame</literal>スタイルのuicontrolsでのみ使用され, 
+                        <literal>frame</literal>スタイルのuicontrolsでのみ使用され,
                         このオブジェクトは <link linkend="createBorder">createBorder</link>
                         により作成されます.
                     </para>
@@ -57,7 +57,7 @@
                         Scilabインタプリタで評価される命令.
                     </para>
                     <para>
-                        このプロパティは <literal>layer</literal>, 
+                        このプロパティは <literal>layer</literal>,
                         <literal>frame</literal> および <literal>text</literal> スタイルの
                         uicontrolsでは使用されません.
                     </para>
             <varlistentry>
                 <term>Callback_Type</term>
                 <listitem>
-                    <para>整数</para>
-                    <para>uicontrolに送信されるコールバックの型.</para>
+                    <para>Scalar</para>
+                    <para>The type of callback transmitted to the uicontrol.</para>
                     <itemizedlist>
                         <listitem>
                             <para>
-                                <literal>-1</literal> none (コールバックはアクティブではありません)
+                                <literal>-1</literal> none (callback desactivated)
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>0</literal> Scilab命令
+                                <literal>0</literal> or <literal>2</literal> a Scilab instruction
+                                <literal>10</literal> or <literal>12</literal> a prioritary, non-interruptible Scilab instruction
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>1</literal> CまたはFortran関数
-                            </para>
-                        </listitem>
-                        <listitem>
-                            <para>
-                                <literal>2</literal> Scilab関数
+                                <literal>1</literal> a C or a Fortran function
                             </para>
                         </listitem>
                     </itemizedlist>
                 <listitem>
                     <para>{on} | off</para>
                     <para>
-                        uicontrolを有効または無効にします. 
+                        uicontrolを有効または無効にします.
                         このプロパティを<literal>"on"</literal> (デフォルト)に
                         設定した場合, uicontrolは有効となりますが,
                         このプロパティに<literal>"off"</literal>を指定すると
                 <listitem>
                     <para>文字列</para>
                     <para>
-                        <literal>radiobutton</literal> および <literal>checkbox</literal> 
+                        <literal>radiobutton</literal> および <literal>checkbox</literal>
                         スタイルuicontrolsの場合,
                         本プロパティにより同じグループ全体のuicontrolを
                         管理できるようになります.
                     <para>文字列.</para>
                     <para>
                         このプロパティは,
-                        (<link linkend="pwd">Scilabワーキングディレクトリ</link>に対する) 
+                        (<link linkend="pwd">Scilabワーキングディレクトリ</link>に対する)
                         相対パス,または,
                         <literal>pushbutton</literal> または <literal>text</literal>
                         uicontrolで使用される
                                                  <listitem>
                             <para>
                                 <literal>checkbox</literal> および
-                                <literal>radiobutton</literal> uicontrols: 
+                                <literal>radiobutton</literal> uicontrols:
                                 Max はコントロールがチェックされた際に
                                 とる"Value"プロパティの値です.
                             </para>
                         <listitem>
                             <para>
                                 <literal>slider</literal> および
-                                <literal>spinner</literal> uicontrols: 
+                                <literal>spinner</literal> uicontrols:
                                 要素の最大値.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
                                 <literal>checkbox</literal> および <literal>radiobutton</literal>
-                                uicontrols: 
+                                uicontrols:
                                 Minはコントロールのチェックが外された際に
                                 "Value"プロパティがとる値です.
                             </para>
                         <listitem>
                             <para>
                                 <literal>slider</literal> および
-                                <literal>spinner</literal> uicontrols: 
+                                <literal>spinner</literal> uicontrols:
                                 要素の最小値.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>listbox</literal> uicontrols: 
+                                <literal>listbox</literal> uicontrols:
                                 (Max-Min)&gt;1 の場合,リストで複数の選択を行うことができます.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>edit</literal> uicontrols: 
+                                <literal>edit</literal> uicontrols:
                                 (Max-Min)&gt;1 の場合, edit は複数行を選択することができます.
                             </para>
                         </listitem>
                 <listitem>
                     <para>ハンドル</para>
                     <para>
-                        uicontrolの親のハンドル. 
+                        uicontrolの親のハンドル.
                         このプロパティを変更すると,
                         コントロールをある図から別の図に移動することができます.
                     </para>
                     <itemizedlist>
                         <listitem>
                             <para>
-                                <literal>pushbutton</literal> uicontrols: 
+                                <literal>pushbutton</literal> uicontrols:
                                 "Relief" プロパティのデフォルト値は "raised"です.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>edit</literal> uicontrols: 
+                                <literal>edit</literal> uicontrols:
                                 "Relief" プロパティのデフォルト値は "sunken"です.
                             </para>
                         </listitem>
                         <listitem>
-                            <para>他の uicontrols: 
+                            <para>他の uicontrols:
                                 "Relief"プロパティのデフォルト値は "flat"です.
                             </para>
                         </listitem>
                 <term>SliderStep</term>
                 <listitem>
                     <para>[1,2] 実数ベクトル</para>
-                    <para>[small big], 
+                    <para>[small big],
                         smallステップはスライダをクリックした際,
                         または(スライダにフォーカスがある時に)
                         キーボード矢印をタッピングした際の移動量を表します;
                         スケールの1/10がデフォルト値となります.
                     </para>
                     <para>
-                        <literal>spinner</literal> uicontrolの場合, 
+                        <literal>spinner</literal> uicontrolの場合,
                         このプロパティの最初の値が固定ステップとして使用されます.
                     </para>
                 </listitem>
                     </para>
                     <itemizedlist>
                         <listitem>
-                            <para>  
+                            <para>
                                 <literal>pushbutton</literal> または <literal>text</literal> uicontrols
-                                の場合, 
+                                の場合,
                                 テキストを2つの$ (ドル記号)で括ると,そのテキストは
                                 LaTeX式とみなされます.
                                 また,&lt; および &gt; で括ると,MathML式とみなされます.
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>layer</literal> および <literal>tab</literal> uicontrolsの場合, 
+                                <literal>layer</literal> および <literal>tab</literal> uicontrolsの場合,
                                 この値は選択された子のタグを指定します.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>image</literal> uicontrolsの場合, 
+                                <literal>image</literal> uicontrolsの場合,
                                 この値は画像ファイルのパスを指定します.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>table</literal> uicontrolsの場合, 
+                                <literal>table</literal> uicontrolsの場合,
                                 この値は以下のように表データを指定します: <literal>[IGNORED COL1-HEADER...COLN-HEADER;ROW1-HEADER, ROW1COL1-DATA, ROW1COLN-DATA;...;ROWM-HEADER, ROWMCOL1-DATA, ROWMCOLN-DATA]</literal>.
                             </para>
                         </listitem>
                                 の場合,
                                 <literal>String</literal> プロパティを
                                 以下の形式に一致する行列に設定できます:
-                                <literal>["#color1", "Item1", "#background1", "#foreground1"; "#color2", "Item2", ..., ...]</literal> 
-                                <literal>["icon1", "Item1", "#background1", "#foreground1"; "icon2", "Item2", ..., ...]</literal> 
-                                ただし, <literal>"#color1"</literal>, 
+                                <literal>["#color1", "Item1", "#background1", "#foreground1"; "#color2", "Item2", ..., ...]</literal>
+                                <literal>["icon1", "Item1", "#background1", "#foreground1"; "icon2", "Item2", ..., ...]</literal>
+                                ただし, <literal>"#color1"</literal>,
                                 <literal>"#background1"</literal> および
                                 <literal>"#foreground1"</literal> はHTML形式
                                 <literal>#XXXXXX</literal>です.
                         <listitem>
                             <para>
                                 <literal>listbox</literal> および
-                                <literal>popupmenu</literal> uicontrols: 
+                                <literal>popupmenu</literal> uicontrols:
                                 値はリスト内で選択されたエントリの添字に対応する
                                 添字のベクトルとなります.
                                 1はリストの最初の要素です.
                         <listitem>
                             <para>
                                 <literal>slider</literal> および
-                                <literal>spinner</literal> uicontrols: 
+                                <literal>spinner</literal> uicontrols:
                                 要素により指定された値.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>layer</literal> および <literal>tab</literal> uicontrols: 
+                                <literal>layer</literal> および <literal>tab</literal> uicontrols:
                                 表示された要素の添字.
                             </para>
                         </listitem>
                         <listitem>
                             <para>
-                                <literal>image</literal> uicontrols: 
+                                <literal>image</literal> uicontrols:
                                 値は,画像プロパティ
                                 <literal>[X-Scale Y-Scale X-Shear Y-Shear RotationAngle]</literal>
                                 を設定する際に使用されます.
index f949489..4864740 100644 (file)
@@ -101,7 +101,7 @@ public abstract class CommonCallBack extends AbstractAction {
                 callback = JavaCallBack.createOutOfXclickAndXgetmouse(command);
                 break;
             case CallBack.SCILAB_INSTRUCTION_WITHOUT_GCBO :
-                callback = ScilabCallBack.create(command);
+                callback = ScilabCallBack.create(command, false);
                 break;
             case CallBack.SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE :
                 callback = ScilabCallBack.createOutOfXclickAndXgetmouse(command);