Enable helpbrowser within YaSp
[scilab.git] / scilab / modules / gui / sci_gateway / c / gw_gui.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2006 - INRIA - Allan CORNET
4  * Copyright (C) 2008 - INRIA - Vincent COUVERT
5  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  */
13
14 #include <string.h>
15 #include "gw_gui.h"
16 #include "stack-c.h"
17 #include "sci_mode.h"
18 #include "callFunctionFromGateway.h"
19 #include "localization.h"
20 #include "Scierror.h"
21 #include "loadOnUseClassPath.h"
22 /*--------------------------------------------------------------------------*/
23 static BOOL loadedDep = FALSE;
24 /*--------------------------------------------------------------------------*/
25 static gw_generic_table Tab[]=
26 {
27         {sci_x_dialog,"x_dialog"},
28         {sci_x_choose,"x_choose"},
29         {sci_x_mdialog,"x_mdialog"},
30         {sci_x_choice,"xchoicesi"},
31         {sci_delmenu,"delmenu"},
32         {sci_setmenu,"setmenu"},
33         {sci_unsetmenu,"unsetmenu"},
34         {sci_raise_window,"raise_window"},
35         {sci_getlookandfeel,"getlookandfeel"},
36         {sci_getinstalledlookandfeels,"getinstalledlookandfeels"},
37         {sci_setlookandfeel,"setlookandfeel"},
38         {sci_ClipBoard,"ClipBoard"},
39         {sci_toolbar,"toolbar"},
40         {sci_uigetdir,"uigetdir"},
41         {sci_uicontrol,"uicontrol"},
42         {sci_uimenu,"uimenu"},
43         {sci_mpopup,"uipopup"},
44         {sci_x_choose_modeless,"x_choose_modeless"},
45         {sci_uicontextmenu,"uicontextmenu"},
46         {sci_uiwait,"uiwait"},
47         {sci_messagebox,"messagebox"},
48         {sci_waitbar,"waitbar"},
49         {sci_progressionbar,"progressionbar"},
50         {NULL, ""}, // helpbrowser
51         {sci_uigetfont,"uigetfont"},
52         {sci_uigetcolor,"uigetcolor"},
53         {sci_getcallbackobject, "getcallbackobject"},
54         {sci_printfigure, "printfigure"},
55         {sci_exportUI, "exportUI"},
56         {sci_printsetupbox,"printsetupbox"},
57         {sci_toprint,"toprint"},
58         {sci_uigetfile,"uigetfile"},
59         {sci_usecanvas,"usecanvas"},
60         {sci_displaytree,"uiDisplayTree"},
61         {sci_uiputfile,"uiputfile"},
62     {NULL, ""} // about
63 };
64 /*--------------------------------------------------------------------------*/
65 int gw_gui(void)
66 {
67         Rhs = Max(0, Rhs);
68
69         if ( getScilabMode() == SCILAB_NWNI)
70         {
71                 Scierror(999,_("Scilab '%s' module disabled in -nogui or -nwni mode.\n"), "GUI");
72                 return 0;
73         }
74
75         /**
76          * We have to load the 'graphic' jars for
77          * - uicontrol
78          * - uimenu
79          * because these functions need to create a figure to put the created object inside.
80          *
81          * **** TODO create Scilab figures without a canvas inside and remove this crappy test. ****
82          *
83          */
84         if (!loadedDep && (strcmp(Tab[Fin-1].name, "uicontrol")==0
85                            || strcmp(Tab[Fin-1].name, "uimenu")==0
86                            || strcmp(Tab[Fin-1].name, "usecanvas")==0))
87           {
88             loadOnUseClassPath("graphics");
89             loadedDep = TRUE;
90           }
91
92
93         callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
94
95         return 0;
96 }
97 /*--------------------------------------------------------------------------*/