New Java Help Browser for Scilab.
Vincent Couvert [Fri, 14 Mar 2008 09:34:09 +0000 (09:34 +0000)]
This help browser is not yet available because it needs new help compilation system (Some lines are commented out in sci_help.c).

34 files changed:
scilab/build.incl.xml
scilab/etc/classpath.xml
scilab/modules/gui/Makefile.am
scilab/modules/gui/Makefile.in
scilab/modules/gui/includes/CallHelpBrowser.h [new file with mode: 0644]
scilab/modules/gui/includes/gw_gui.h
scilab/modules/gui/sci_gateway/c/gw_gui.c
scilab/modules/gui/sci_gateway/c/sci_help.c [new file with mode: 0644]
scilab/modules/gui/sci_gateway/gui_gateway.xml
scilab/modules/gui/src/c/gui.vcproj
scilab/modules/gui/src/cpp/CallHelpBrowser.cpp [new file with mode: 0644]
scilab/modules/gui/src/cpp/CallHelpBrowser.hxx [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/console/SwingScilabConsole.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowser.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/window/SwingScilabWindow.java
scilab/modules/gui/src/java/org/scilab/modules/gui/console/ScilabConsole.java
scilab/modules/gui/src/java/org/scilab/modules/gui/console/ScilabConsoleBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/console/SimpleConsole.java
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/HelpBrowser.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowser.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowserBridge.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/SimpleHelpBrowser.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/SimpleTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/Tab.java
scilab/modules/gui/src/jni/CallScilabBridge.cpp
scilab/modules/gui/src/jni/CallScilabBridge.giws.xml
scilab/modules/gui/src/jni/CallScilabBridge.hxx
scilab/scilab-lib.properties.in
scilab/scilab-lib.properties.vc

index 07120dc..b1274f2 100644 (file)
@@ -74,6 +74,8 @@
 
                <pathelement location="${jogl.jar}"/>
                
+               <pathelement location="${jhall.jar}"/>
+
        </path>
        
        <taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath"/>
index 9fe83e0..c77317d 100644 (file)
@@ -23,6 +23,7 @@
 <path value="$SCILAB/thirdparty/skinlf.jar"/>
 <path value="$SCILAB/thirdparty/looks-2.1.1.jar"/>
 <path value="$SCILAB/thirdparty/commons-logging-1.1.jar"/>
+<path value="$SCILAB/thirdparty/jhall.jar"/>
 <path value="$SCILAB/modules/jvm/jar/org.scilab.modules.jvm.jar"/>
 <path value="$SCILAB/modules/shell/jar/org.scilab.modules.shell.jar"/>
 <path value="$SCILAB/modules/history_manager/jar/org.scilab.modules.history_manager.jar"/>
index 4a6030d..547a0b0 100644 (file)
@@ -38,6 +38,7 @@ src/cpp/CallFileChooser.cpp \
 src/cpp/CallFigure.cpp \
 src/cpp/CallMessageBox.cpp \
 src/cpp/CallWaitBar.cpp \
+src/cpp/CallHelpBrowser.cpp \
 src/cpp/PushButton.cpp \
 src/cpp/EditBox.cpp \
 src/cpp/Label.cpp \
@@ -126,7 +127,8 @@ sci_gateway/c/sci_uiwait.c \
 sci_gateway/c/sci_mpopup.c \
 sci_gateway/c/sci_messagebox.c \
 sci_gateway/c/sci_waitbar.c \
-sci_gateway/c/sci_progressionbar.c
+sci_gateway/c/sci_progressionbar.c \
+sci_gateway/c/sci_help.c
 
 libscigui_la_CFLAGS=   -Isrc/c/ \
                        -Isrc/c/xsci/ \
index a8df142..a133954 100644 (file)
@@ -123,13 +123,14 @@ am__libscigui_la_SOURCES_DIST = src/nogui/nogui.c \
        sci_gateway/c/sci_uicontextmenu.c sci_gateway/c/sci_uimenu.c \
        sci_gateway/c/sci_uiwait.c sci_gateway/c/sci_mpopup.c \
        sci_gateway/c/sci_messagebox.c sci_gateway/c/sci_waitbar.c \
-       sci_gateway/c/sci_progressionbar.c src/cpp/InitUIMenu.cpp \
-       src/jni/CallScilabBridge.cpp src/jni/Jxclick.cpp \
-       src/cpp/DestroyUIControl.cpp src/cpp/DestroyWaitBar.cpp \
-       src/cpp/CallJxclick.cpp src/jni/Jxgetmouse.cpp \
-       src/cpp/CallJxgetmouse.cpp src/cpp/CallFileChooser.cpp \
-       src/cpp/CallFigure.cpp src/cpp/CallMessageBox.cpp \
-       src/cpp/CallWaitBar.cpp src/cpp/PushButton.cpp \
+       sci_gateway/c/sci_progressionbar.c sci_gateway/c/sci_help.c \
+       src/cpp/InitUIMenu.cpp src/jni/CallScilabBridge.cpp \
+       src/jni/Jxclick.cpp src/cpp/DestroyUIControl.cpp \
+       src/cpp/DestroyWaitBar.cpp src/cpp/CallJxclick.cpp \
+       src/jni/Jxgetmouse.cpp src/cpp/CallJxgetmouse.cpp \
+       src/cpp/CallFileChooser.cpp src/cpp/CallFigure.cpp \
+       src/cpp/CallMessageBox.cpp src/cpp/CallWaitBar.cpp \
+       src/cpp/CallHelpBrowser.cpp src/cpp/PushButton.cpp \
        src/cpp/EditBox.cpp src/cpp/Label.cpp src/cpp/CheckBox.cpp \
        src/cpp/RadioButton.cpp src/cpp/Slider.cpp \
        src/cpp/PopupMenu.cpp src/cpp/ContextMenu.cpp \
@@ -209,7 +210,8 @@ am__libscigui_la_SOURCES_DIST = src/nogui/nogui.c \
 @GUI_TRUE@     libscigui_la-sci_mpopup.lo \
 @GUI_TRUE@     libscigui_la-sci_messagebox.lo \
 @GUI_TRUE@     libscigui_la-sci_waitbar.lo \
-@GUI_TRUE@     libscigui_la-sci_progressionbar.lo
+@GUI_TRUE@     libscigui_la-sci_progressionbar.lo \
+@GUI_TRUE@     libscigui_la-sci_help.lo
 @GUI_TRUE@am__objects_3 = libscigui_la-InitUIMenu.lo \
 @GUI_TRUE@     libscigui_la-CallScilabBridge.lo \
 @GUI_TRUE@     libscigui_la-Jxclick.lo \
@@ -222,6 +224,7 @@ am__libscigui_la_SOURCES_DIST = src/nogui/nogui.c \
 @GUI_TRUE@     libscigui_la-CallFigure.lo \
 @GUI_TRUE@     libscigui_la-CallMessageBox.lo \
 @GUI_TRUE@     libscigui_la-CallWaitBar.lo \
+@GUI_TRUE@     libscigui_la-CallHelpBrowser.lo \
 @GUI_TRUE@     libscigui_la-PushButton.lo libscigui_la-EditBox.lo \
 @GUI_TRUE@     libscigui_la-Label.lo libscigui_la-CheckBox.lo \
 @GUI_TRUE@     libscigui_la-RadioButton.lo libscigui_la-Slider.lo \
@@ -584,6 +587,7 @@ JARMASK = *.jar
 @GUI_TRUE@src/cpp/CallFigure.cpp \
 @GUI_TRUE@src/cpp/CallMessageBox.cpp \
 @GUI_TRUE@src/cpp/CallWaitBar.cpp \
+@GUI_TRUE@src/cpp/CallHelpBrowser.cpp \
 @GUI_TRUE@src/cpp/PushButton.cpp \
 @GUI_TRUE@src/cpp/EditBox.cpp \
 @GUI_TRUE@src/cpp/Label.cpp \
@@ -672,7 +676,8 @@ JARMASK = *.jar
 @GUI_TRUE@sci_gateway/c/sci_mpopup.c \
 @GUI_TRUE@sci_gateway/c/sci_messagebox.c \
 @GUI_TRUE@sci_gateway/c/sci_waitbar.c \
-@GUI_TRUE@sci_gateway/c/sci_progressionbar.c
+@GUI_TRUE@sci_gateway/c/sci_progressionbar.c \
+@GUI_TRUE@sci_gateway/c/sci_help.c
 
 @GUI_FALSE@libscigui_la_CFLAGS = -Iincludes/ \
 @GUI_FALSE@                    -I$(top_srcdir)/modules/output_stream/includes
@@ -908,6 +913,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallFigure.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallFileChooser.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallHelpBrowser.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallJxclick.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallJxgetmouse.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-CallMessageBox.Plo@am__quote@
@@ -993,6 +999,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_delmenu.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_getinstalledlookandfeels.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_getlookandfeel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_help.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_messagebox.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_mpopup.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_progressionbar.Plo@am__quote@
@@ -1331,6 +1338,13 @@ libscigui_la-sci_progressionbar.lo: sci_gateway/c/sci_progressionbar.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -c -o libscigui_la-sci_progressionbar.lo `test -f 'sci_gateway/c/sci_progressionbar.c' || echo '$(srcdir)/'`sci_gateway/c/sci_progressionbar.c
 
+libscigui_la-sci_help.lo: sci_gateway/c/sci_help.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -MT libscigui_la-sci_help.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_help.Tpo -c -o libscigui_la-sci_help.lo `test -f 'sci_gateway/c/sci_help.c' || echo '$(srcdir)/'`sci_gateway/c/sci_help.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/libscigui_la-sci_help.Tpo $(DEPDIR)/libscigui_la-sci_help.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_help.c' object='libscigui_la-sci_help.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -c -o libscigui_la-sci_help.lo `test -f 'sci_gateway/c/sci_help.c' || echo '$(srcdir)/'`sci_gateway/c/sci_help.c
+
 .cpp.o:
 @am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
 @am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@@ -1436,6 +1450,13 @@ libscigui_la-CallWaitBar.lo: src/cpp/CallWaitBar.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-CallWaitBar.lo `test -f 'src/cpp/CallWaitBar.cpp' || echo '$(srcdir)/'`src/cpp/CallWaitBar.cpp
 
+libscigui_la-CallHelpBrowser.lo: src/cpp/CallHelpBrowser.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-CallHelpBrowser.lo -MD -MP -MF $(DEPDIR)/libscigui_la-CallHelpBrowser.Tpo -c -o libscigui_la-CallHelpBrowser.lo `test -f 'src/cpp/CallHelpBrowser.cpp' || echo '$(srcdir)/'`src/cpp/CallHelpBrowser.cpp
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/libscigui_la-CallHelpBrowser.Tpo $(DEPDIR)/libscigui_la-CallHelpBrowser.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/CallHelpBrowser.cpp' object='libscigui_la-CallHelpBrowser.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-CallHelpBrowser.lo `test -f 'src/cpp/CallHelpBrowser.cpp' || echo '$(srcdir)/'`src/cpp/CallHelpBrowser.cpp
+
 libscigui_la-PushButton.lo: src/cpp/PushButton.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-PushButton.lo -MD -MP -MF $(DEPDIR)/libscigui_la-PushButton.Tpo -c -o libscigui_la-PushButton.lo `test -f 'src/cpp/PushButton.cpp' || echo '$(srcdir)/'`src/cpp/PushButton.cpp
 @am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/libscigui_la-PushButton.Tpo $(DEPDIR)/libscigui_la-PushButton.Plo
diff --git a/scilab/modules/gui/includes/CallHelpBrowser.h b/scilab/modules/gui/includes/CallHelpBrowser.h
new file mode 100644 (file)
index 0000000..8eaaa4a
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __CALLHELPBROWSER_H__
+#define __CALLHELPBROWSER_H__
+
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent COUVERT
+ * 
+ * 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-en.txt
+ *
+ */
+
+#include "machine.h"
+#include "BOOL.h"
+
+/**
+ * Launch a Scilab Help Browser
+ */
+void launchHelpBrowser(void);
+
+/**
+ * Search a keyword in Scilab Help Browser
+ *
+ * @param keyword the keyword to search
+ */
+BOOL searchKeyword(char *keyword);
+
+#endif /* !__CALLHELPBROWSER_H__ */
+
index cf463ed..eebf8a2 100644 (file)
@@ -42,6 +42,7 @@ int sci_uiwait(char *fname,unsigned long l);
 int sci_messagebox(char *fname,unsigned long l);
 int sci_waitbar(char *fname,unsigned long l);
 int sci_progressionbar(char *fname,unsigned long l);
+int sci_help(char *fname,unsigned long l);
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_GUI__ */
 /*--------------------------------------------------------------------------*/
index 4da522f..013134d 100644 (file)
@@ -44,7 +44,8 @@ static gw_generic_table Tab[]=
        {sci_uiwait,"uiwait"},
        {sci_messagebox,"messagebox"},
        {sci_waitbar,"waitbar"},
-       {sci_progressionbar,"progressionbar"}
+       {sci_progressionbar,"progressionbar"},
+       {sci_help,"jhelp"}
 };
 /*--------------------------------------------------------------------------*/
 int gw_gui(void)
diff --git a/scilab/modules/gui/sci_gateway/c/sci_help.c b/scilab/modules/gui/sci_gateway/c/sci_help.c
new file mode 100644 (file)
index 0000000..70da3cc
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent COUVERT
+ * 
+ * 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-en.txt
+ *
+ */
+
+#include "gw_gui.h"
+#include "machine.h"
+#include "stack-c.h"
+#include "localization.h"
+#include "CallHelpBrowser.h"
+#include "Scierror.h"
+#include "getPropertyAssignedValue.h"
+
+/*--------------------------------------------------------------------------*/
+int sci_help(char *fname,unsigned long fname_len)
+{
+  int nbRow = 0, nbCol = 0, keywordAdr = 0;
+  
+  CheckRhs(0,1);
+  CheckLhs(0,1);
+
+  if (Rhs == 0)
+    {
+      //launchHelpBrowser();
+    }
+  else
+    {
+      if (VarType(1) == sci_strings)
+        {
+          GetRhsVar(1, MATRIX_OF_STRING_DATATYPE, &nbRow, &nbCol, &keywordAdr);
+          if (nbRow*nbCol != 1)
+            {
+              Scierror(999, _("%s: Wrong size for first input argument: Single string expected.\n"), "help");
+              return FALSE;
+            }
+        }
+      else
+        {
+          Scierror(999, _("%s: Wrong type for first input argument: Single string expected.\n"), "help");
+          return FALSE;
+        }
+      
+      //if (!searchKeyword(getStringMatrixFromStack(keywordAdr)[0])) {
+      //  sciprint(_("Could not find help page for function: %s.\n"),getStringMatrixFromStack(keywordAdr)[0]);
+      //}
+    }
+  
+  LhsVar(1) = 0;
+    
+  PutLhsVar();
+
+  return TRUE;
+
+}
+/*--------------------------------------------------------------------------*/
index 6729c4c..2266a26 100644 (file)
@@ -55,4 +55,5 @@
 <PRIMITIVE gatewayId="25" primitiveId="22" primitiveName="messagebox" />
 <PRIMITIVE gatewayId="25" primitiveId="23" primitiveName="waitbar" />
 <PRIMITIVE gatewayId="25" primitiveId="24" primitiveName="progressionbar" />
+<PRIMITIVE gatewayId="25" primitiveId="25" primitiveName="jhelp" />
 </GATEWAY>
\ No newline at end of file
index 723478e..e5d7be5 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath="..\cpp\CallHelpBrowser.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\cpp\CallJxclick.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\sci_gateway\c\sci_help.c"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\sci_gateway\c\sci_messagebox.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\includes\CallHelpBrowser.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\cpp\CallHelpBrowser.hxx"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\includes\CallJxclick.h"
                                >
                        </File>
diff --git a/scilab/modules/gui/src/cpp/CallHelpBrowser.cpp b/scilab/modules/gui/src/cpp/CallHelpBrowser.cpp
new file mode 100644 (file)
index 0000000..9337200
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent COUVERT
+ * 
+ * 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-en.txt
+ *
+ */
+
+#include "CallHelpBrowser.hxx"
+
+using namespace org_scilab_modules_gui_bridge;
+
+void launchHelpBrowser()
+{
+  CallScilabBridge::launchHelpBrowser(getScilabJavaVM());
+}
+
+BOOL searchKeyword(char *keyword)
+{
+  return CallScilabBridge::searchKeyword(getScilabJavaVM(), keyword);
+}
diff --git a/scilab/modules/gui/src/cpp/CallHelpBrowser.hxx b/scilab/modules/gui/src/cpp/CallHelpBrowser.hxx
new file mode 100644 (file)
index 0000000..7fcb9e2
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef __CALLHELPBROWSER_HXX__
+#define __CALLHELPBROWSER_HXX__
+
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent COUVERT
+ * 
+ * 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-en.txt
+ *
+ */
+
+#include "CallScilabBridge.hxx"
+extern "C" {
+#include "getScilabJavaVM.h"
+#include "CallHelpBrowser.h"
+}
+
+#endif /* !#define __CALLHELPBROWSER_HXX__ */
index fa7e623..17fcf4c 100644 (file)
@@ -29,6 +29,7 @@ import org.scilab.modules.gui.filechooser.ScilabFileChooser;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.frame.ScilabFrame;
 import org.scilab.modules.gui.graphicWindow.ScilabRendererProperties;
+import org.scilab.modules.gui.helpbrowser.ScilabHelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.label.ScilabLabel;
 import org.scilab.modules.gui.listbox.ListBox;
@@ -1832,5 +1833,34 @@ public class CallScilabBridge {
        public static void setWaitBarIndeterminateMode(int id, boolean status) {
                ((WaitBar) UIElementMapper.getCorrespondingUIElement(id)).setIndeterminateMode(status);
        }
+       
+       /**********************/
+       /*                    */
+       /* HELPBROWSER BRIDGE */
+       /*                    */
+       /**********************/
+       
+       /**
+        * Launch Scilab help browser if not already created
+        */
+       public static void launchHelpBrowser() {
+               ScilabHelpBrowser.createHelpBrowser();
+       }
+       
+       /**
+        * Search a keyword in Scilab Help Browser
+        * @param keyword the keyword to search
+        * @return true if the keyword is a function name
+        */
+       public static boolean searchKeyword(String keyword) {
+               return ScilabHelpBrowser.createHelpBrowser().searchKeywork(keyword);
+       }
+
+       /**
+        * Close Scilab Help Browser
+        */
+       public static void closeHelpBrowser() {
+               ScilabHelpBrowser.getHelpBrowser().close();
+       }
 
 }
index e31dedd..2059654 100644 (file)
@@ -41,6 +41,9 @@ import org.scilab.modules.gui.filechooser.SimpleFileChooser;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.frame.ScilabFrameBridge;
 import org.scilab.modules.gui.frame.SimpleFrame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
+import org.scilab.modules.gui.helpbrowser.ScilabHelpBrowserBridge;
+import org.scilab.modules.gui.helpbrowser.SimpleHelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.label.ScilabLabelBridge;
 import org.scilab.modules.gui.label.SimpleLabel;
@@ -598,6 +601,16 @@ public class ScilabBridge {
        }
 
        /**
+        * We want to be able to add directly a HelpBrowser in a Tab.
+        * @param tab the tab where we want to add the member
+        * @param member the member to add
+        * @return the position of the HelpBrowser in the member list.
+        */
+       public static int addMember(Tab tab, HelpBrowser member) {
+               return ScilabTabBridge.addMember(tab, member);
+       }
+       
+       /**
         * Add a member (dockable element) to a tab and returns the index of this member
         * @param tab the tab where we want to add the member
         * @param member the member to add
@@ -757,7 +770,7 @@ public class ScilabBridge {
         * Displays data in the console
         * @param console the console to display the data in
         * @param dataToDisplay the data to be displayed
-        * @see org.scilab.modules.console.Console#display()
+        * @see org.scilab.modules.console.HelpBrowser#display()
         */
        public static void display(Console console, String dataToDisplay) {
                ScilabConsoleBridge.display(console, dataToDisplay);
@@ -767,7 +780,7 @@ public class ScilabBridge {
         * Reads input data in the console
         * @param console the console to read the data from
         * @return the data entered by the user
-        * @see org.scilab.modules.console.Console#readLine()
+        * @see org.scilab.modules.console.HelpBrowser#readLine()
         */
        public static String readLine(Console console) {
                return ScilabConsoleBridge.readLine(console);
@@ -881,7 +894,7 @@ public class ScilabBridge {
         * Reads one user input char
         * @param console the console used to get the char
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#getCharWithoutOutput()
+        * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
         */
        public static int getCharWithoutOutput(Console console) {
                return ScilabConsoleBridge.getCharWithoutOutput(console);
@@ -4112,5 +4125,43 @@ public class ScilabBridge {
                ScilabWaitBarBridge.setIndeterminateMode(waitBar, status);
        }
 
+       /***********************/
+       /* Help Browser Bridge */
+       /***********************/
+
+       /**
+        * Create a new Help Browser
+        * @return the created Help Browser
+        */
+       public static SimpleHelpBrowser createHelpBrowser() {
+               return ScilabHelpBrowserBridge.createHelpBrowser();
+       }
+
+       /**
+        * Display the Help Browser
+        * @param browser the Help Browser
+        */
+       public static void display(HelpBrowser browser) {
+               ScilabHelpBrowserBridge.display(browser);
+       }
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param browser the Help Browser
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       public static boolean searchKeywork(HelpBrowser browser, String keyword) {
+               return ScilabHelpBrowserBridge.searchKeywork(browser, keyword);
+       }
+       
+       /**
+        * Close the HelpBrowser
+        * @param browser the Help Browser
+        */
+       public static void close(HelpBrowser browser) {
+               ScilabHelpBrowserBridge.close(browser);
+       }
+
 
 }
index 5f5fc4b..af7874f 100644 (file)
@@ -45,7 +45,7 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
        /**
         * Displays data in the console
         * @param dataToDisplay the data to be displayed
-        * @see fr.scilab.console.Console#display(java.lang.String)
+        * @see fr.scilab.console.HelpBrowser#display(java.lang.String)
         */
        public void display(String dataToDisplay) {
                this.getConfiguration().getOutputView().append(dataToDisplay);
@@ -83,7 +83,7 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
        /**
         * Reads one user input char
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#getCharWithoutOutput()
+        * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
         */
        public int getCharWithoutOutput() {
                int retChar;
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowser.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowser.java
new file mode 100644 (file)
index 0000000..80fb79d
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent Couvert
+ * 
+ * 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-en.txt
+ *
+ */
+package org.scilab.modules.gui.bridge.helpbrowser;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+import javax.help.BadIDException;
+import javax.help.DefaultHelpModel;
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+import javax.help.JHelp;
+
+import org.scilab.modules.gui.helpbrowser.SimpleHelpBrowser;
+
+/**
+ * Scilab Help Browser in GUIs
+ * @author Vincent COUVERT
+ */
+public class SwingScilabHelpBrowser extends JHelp implements SimpleHelpBrowser {
+       
+       private static final long serialVersionUID = 5306766011092074961L;
+
+    private HelpSet helpSet;
+
+    /**
+        * Constructor
+        */
+       public SwingScilabHelpBrowser() {
+               super();
+
+        File[] jarFiles = new File[1];
+        jarFiles[0] = new File(System.getenv("SCI") + "/thirdparty/scilab_help.jar");
+        for (int i = 0; i < jarFiles.length; ++i) {
+            URI jarURI = jarFiles[i].toURI();
+
+            StringBuilder buffer = new StringBuilder("jar:");
+            buffer.append(jarURI);
+            buffer.append("!/");
+            buffer.append(rootName(jarURI));
+            buffer.append("/jhelpset.hs");
+
+            URL helpSetURL = null;
+            try {
+                helpSetURL = new URL(buffer.toString());
+            } catch (MalformedURLException cannotHappen) {
+                cannotHappen.printStackTrace();
+                continue;
+            }
+
+            try {
+                               helpSet = new HelpSet(/*classLoader*/ null, helpSetURL);
+                       } catch (HelpSetException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
+            this.setModel(new DefaultHelpModel(helpSet));
+        }
+       }
+       
+       /**
+        * Display the Help Browser
+        */
+       public void display() {
+               
+       }
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       public boolean searchKeywork(String keyword) {
+               try {
+                       setCurrentID(keyword);
+                       return true;
+               } catch (BadIDException e) {
+                       return false;
+               }
+       }
+       
+       /**
+        * Close the HelpBrowser
+        */
+       public void close() {
+               
+       }
+
+       
+    /**
+     * Get teh root name of an URI
+     * @param uri the URI
+     * @return the root name
+     */
+    private static String rootName(URI uri) {
+        String path = uri.toString();
+
+        String baseName;
+        int pos = path.lastIndexOf('/');
+        if (pos < 0) {
+            baseName = path;
+        } else {
+            baseName = path.substring(pos + 1);
+        }
+        String rootName;
+        pos = baseName.lastIndexOf('.');
+        if (pos < 0) {
+            rootName = baseName;
+        } else {
+            rootName = baseName.substring(0, pos);
+        }
+
+        return rootName;
+    }
+
+}
index 0dd6a05..0b57b12 100644 (file)
@@ -23,6 +23,7 @@ import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
 import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
 import org.scilab.modules.gui.bridge.editbox.SwingScilabEditBox;
 import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
+import org.scilab.modules.gui.bridge.helpbrowser.SwingScilabHelpBrowser;
 import org.scilab.modules.gui.bridge.label.SwingScilabLabel;
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
@@ -36,6 +37,7 @@ import org.scilab.modules.gui.dockable.Dockable;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.events.callback.CallBack;
 import org.scilab.modules.gui.frame.Frame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -205,6 +207,25 @@ public class SwingScilabTab extends View implements SimpleTab {
         * @param member the member to add
         * @return index of member in ArrayList
         */
+       public int addMember(HelpBrowser member) {
+               return this.addMember((SwingScilabHelpBrowser) member.getAsSimpleHelpBrowser());
+       }
+
+       /**
+        * Add a member (dockable element) to container and returns its index
+        * @param member the member to add
+        * @return index of member in ArrayList
+        */
+       private int addMember(SwingScilabHelpBrowser member) {
+               this.setContentPane(member);
+               return this.getComponentZOrder(member);
+       }
+       
+       /**
+        * Add a member (dockable element) to container and returns its index
+        * @param member the member to add
+        * @return index of member in ArrayList
+        */
        public int addMember(Frame member) {
                return this.addMember((SwingScilabFrame) member.getAsSimpleFrame());
        }
index 9d84a57..a997e02 100644 (file)
@@ -219,6 +219,7 @@ public class SwingScilabWindow extends JFrame implements SimpleWindow {
                        this.menuBar = null;
                        super.setJMenuBar(null);
                }
+               this.repaint();
        }
 
        /**
index 858b963..75f2d23 100644 (file)
@@ -69,7 +69,7 @@ public class ScilabConsole extends ScilabDockable implements Console {
        /**
         * Displays data in the console
         * @param dataToDisplay the data to be displayed
-        * @see fr.scilab.console.Console#display()
+        * @see fr.scilab.console.HelpBrowser#display()
         */
        public void display(String dataToDisplay) {
                ScilabBridge.display(this, dataToDisplay);
@@ -78,7 +78,7 @@ public class ScilabConsole extends ScilabDockable implements Console {
        /**
         * Reads input data in the console
         * @return the data entered by the user
-        * @see org.scilab.modules.shell.Console#readLine()
+        * @see org.scilab.modules.shell.HelpBrowser#readLine()
         */
        public String readLine() {
                return ScilabBridge.readLine(this);
@@ -171,7 +171,7 @@ public class ScilabConsole extends ScilabDockable implements Console {
        /**
         * Reads one user input char
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#getCharWithoutOutput()
+        * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
         */
        public int getCharWithoutOutput() {
                return ScilabBridge.getCharWithoutOutput(this);
index 6dee9f3..fe4e835 100644 (file)
@@ -42,7 +42,7 @@ public class ScilabConsoleBridge {
         * Displays data in the console
         * @param console the console to display the data in
         * @param dataToDisplay the data to be displayed
-        * @see fr.scilab.console.Console#display()
+        * @see fr.scilab.console.HelpBrowser#display()
         */
        public static void display(Console console, String dataToDisplay) {
                console.getAsSimpleConsole().display(dataToDisplay);
@@ -52,7 +52,7 @@ public class ScilabConsoleBridge {
         * Reads input data in the console
         * @param console the console to read the data from
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#readLine()
+        * @see fr.scilab.console.HelpBrowser#readLine()
         */
        public static String readLine(Console console) {
                return console.getAsSimpleConsole().readLine();
@@ -160,7 +160,7 @@ public class ScilabConsoleBridge {
         * Reads one user input char
         * @param console the console used to get the char
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#getCharWithoutOutput()
+        * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
         */
        public static int getCharWithoutOutput(Console console) {
                return console.getAsSimpleConsole().getCharWithoutOutput();
index f1753ef..cae423d 100644 (file)
@@ -89,7 +89,7 @@ public interface SimpleConsole {
        /**
         * Reads one user input char
         * @return the data entered by the user
-        * @see fr.scilab.console.Console#getCharWithoutOutput()
+        * @see fr.scilab.console.HelpBrowser#getCharWithoutOutput()
         */
        int getCharWithoutOutput();
 
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/HelpBrowser.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/HelpBrowser.java
new file mode 100644 (file)
index 0000000..982a1a5
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent Couvert
+ * 
+ * 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-en.txt
+ *
+ */
+
+package org.scilab.modules.gui.helpbrowser;
+
+import org.scilab.modules.gui.dockable.Dockable;
+
+/**
+ * Interface for Scilab Help Browser in GUIs
+ * @author Vincent COUVERT
+ */
+public interface HelpBrowser extends Dockable {
+
+       /**
+        * Gets this Bridge component object
+        * @return this Bridge component object
+        */
+       SimpleHelpBrowser getAsSimpleHelpBrowser();
+
+       /**
+        * Display the Help Browser
+        */
+       void display();
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       boolean searchKeywork(String keyword);
+       
+       /**
+        * Close the HelpBrowser
+        */
+       void close();
+}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowser.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowser.java
new file mode 100644 (file)
index 0000000..c62e14a
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent Couvert
+ * 
+ * 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-en.txt
+ *
+ */
+
+package org.scilab.modules.gui.helpbrowser;
+
+import org.scilab.modules.gui.bridge.ScilabBridge;
+import org.scilab.modules.gui.dockable.ScilabDockable;
+import org.scilab.modules.gui.events.callback.ScilabCallBack;
+import org.scilab.modules.gui.menu.Menu;
+import org.scilab.modules.gui.menu.ScilabMenu;
+import org.scilab.modules.gui.menubar.MenuBar;
+import org.scilab.modules.gui.menubar.ScilabMenuBar;
+import org.scilab.modules.gui.tab.ScilabTab;
+import org.scilab.modules.gui.tab.Tab;
+import org.scilab.modules.gui.textbox.ScilabTextBox;
+import org.scilab.modules.gui.textbox.TextBox;
+import org.scilab.modules.gui.utils.Position;
+import org.scilab.modules.gui.utils.Size;
+import org.scilab.modules.gui.window.ScilabWindow;
+import org.scilab.modules.gui.window.Window;
+
+/**
+ * Class for Scilab Help Browser in GUIs
+ * @author Vincent COUVERT
+ */
+public class ScilabHelpBrowser extends ScilabDockable implements HelpBrowser {
+
+       private static HelpBrowser instance;
+       
+       private static Tab helpTab;
+       
+       private SimpleHelpBrowser component;
+
+       /**
+        * Constructor
+        */
+       protected ScilabHelpBrowser() {
+               component = ScilabBridge.createHelpBrowser();
+       }
+
+       /**
+        * Creates a Scilab Help Browser
+        * @return the created Help Browser
+        */
+       public static HelpBrowser createHelpBrowser() {
+               if (instance == null) {
+                       instance = new ScilabHelpBrowser();
+                       helpTab = ScilabTab.createTab("Help Browser");
+                       helpTab.addMember(instance);
+                       helpTab.setCallback(ScilabCallBack
+                                       .createCallback("org.scilab.modules.gui.bridge.CallScilabBridge.closeHelpBrowser", ScilabCallBack.JAVA));
+                       
+                       MenuBar menubar = ScilabMenuBar.createMenuBar();
+                       
+                       Menu menu = ScilabMenu.createMenu();
+                       menu.setText("File");
+                       menubar.add(menu);
+                       
+                       menu = ScilabMenu.createMenu();
+                       menu.setText("?");
+                       menubar.add(menu);
+                       
+                       helpTab.addMenuBar(menubar);
+
+                       TextBox infobar = ScilabTextBox.createTextBox();
+                       helpTab.addInfoBar(infobar);
+
+                       Window helpWindow = ScilabWindow.createWindow();
+                       helpWindow.addTab(helpTab);
+                       helpWindow.draw();
+               }
+               return instance;
+       }
+
+       /**
+        * Get the Scilab Help Browser
+        * @return the console
+        */
+       public static HelpBrowser getHelpBrowser() {
+               if (instance == null) {
+                       instance = new ScilabHelpBrowser();
+               }
+               return instance;
+       }
+       
+       /**
+        * Display the Help Browser
+        */
+       public void display() {
+               ScilabBridge.display(this);
+       }
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       public boolean searchKeywork(String keyword) {
+               return ScilabBridge.searchKeywork(this, keyword);
+       }
+       
+       /**
+        * Close the HelpBrowser
+        */
+       public void close() {
+               ScilabBridge.close(this);
+               helpTab.close();
+               instance = null;
+       }
+
+
+       /**
+        * Not used
+        */
+       public void draw() {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Gets this Bridge component object
+        * @return this Bridge component object
+        */
+       public SimpleHelpBrowser getAsSimpleHelpBrowser() {
+               return component;
+       }
+
+       /**
+        * Not used
+        * @return nothing
+        */
+       public Size getDims() {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Not used
+        * @return nothing
+        */
+       public Position getPosition() {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Not used
+        * @return nothing
+        */
+       public boolean isVisible() {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Not used
+        * @param newSize not used
+        */
+       public void setDims(Size newSize) {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Not used
+        * @param newPosition not used
+        */
+       public void setPosition(Position newPosition) {
+               throw new UnsupportedOperationException();
+       }
+
+       /**
+        * Not used
+        * @param newVisibleState not used
+        */
+       public void setVisible(boolean newVisibleState) {
+               throw new UnsupportedOperationException();
+       }
+}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowserBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowserBridge.java
new file mode 100644 (file)
index 0000000..9ca2ca7
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent Couvert
+ * 
+ * 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-en.txt
+ *
+ */
+package org.scilab.modules.gui.helpbrowser;
+
+import org.scilab.modules.gui.bridge.helpbrowser.SwingScilabHelpBrowser;
+
+/**
+ * Bridge for Scilab Help Browser in GUIs
+ * @author Vincent COUVERT
+ */
+public class ScilabHelpBrowserBridge {
+
+       /**
+        * Constructor
+        */
+       protected ScilabHelpBrowserBridge() {
+               throw new UnsupportedOperationException(); /* Prevents calls from subclass */
+       };
+
+       /**
+        * Creates a Scilab HelpBrowser
+        * @return the created HelpBrowser
+        */
+       public static SimpleHelpBrowser createHelpBrowser() {
+               return new SwingScilabHelpBrowser();
+       }
+
+       /**
+        * Display the Help Browser
+        * @param browser the Help Browser
+        */
+       public static void display(HelpBrowser browser) {
+               browser.display();
+       }
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param browser the Help Browser
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       public static boolean searchKeywork(HelpBrowser browser, String keyword) {
+               return browser.getAsSimpleHelpBrowser().searchKeywork(keyword);
+       }
+
+       /**
+        * Close the HelpBrowser
+        * @param browser the Help Browser
+        */
+       public static void close(HelpBrowser browser) {
+               browser.getAsSimpleHelpBrowser().close();
+       }
+
+}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/SimpleHelpBrowser.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/SimpleHelpBrowser.java
new file mode 100644 (file)
index 0000000..50f2d75
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Vincent Couvert
+ * 
+ * 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-en.txt
+ *
+ */
+
+package org.scilab.modules.gui.helpbrowser;
+
+/**
+ * Interface for Scilab Help Browser in GUIs
+ * @author Vincent COUVERT
+ */
+public interface SimpleHelpBrowser {
+
+       /**
+        * Display the Help Browser
+        */
+       void display();
+       
+       /**
+        * Display the matching items for a specified keyword
+        * @param keyword the keyword
+        * @return true if the keyword exists
+        */
+       boolean searchKeywork(String keyword);
+       
+       /**
+        * Close the HelpBrowser
+        */
+       void close();
+
+}
index 1659327..585a8d9 100644 (file)
@@ -22,6 +22,7 @@ import org.scilab.modules.gui.dockable.Dockable;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.events.callback.CallBack;
 import org.scilab.modules.gui.frame.Frame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -179,6 +180,15 @@ public class ScilabTab extends ScilabContainer implements Tab {
        }
        
        /**
+        * We want to be able to add directly a HelpBrowser in a Tab.
+        * @param member the member to add
+        * @return the position of the HelpBrowser in the member list.
+        */
+       public int addMember(HelpBrowser member) {
+               return ScilabBridge.addMember(this, member);            
+       }
+
+       /**
         * Add a member (dockable element) to container and returns its index
         * @param member the member to add
         * @return index of member in ArrayList
index d1d2117..1f9f36d 100644 (file)
@@ -19,6 +19,7 @@ import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.events.callback.CallBack;
 import org.scilab.modules.gui.frame.Frame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -152,6 +153,16 @@ public class ScilabTabBridge {
        }
 
        /**
+        * We want to be able to add directly a HelpBrowser in a Tab.
+        * @param tab the tab where we want to add the member
+        * @param member the member to add
+        * @return the position of the HelpBrowser in the member list.
+        */
+       public static int addMember(Tab tab, HelpBrowser member) {
+               return tab.getAsSimpleTab().addMember(member);
+       }
+
+       /**
         * Add a member (dockable element) to a tab and returns the index of this member
         * @param tab the tab where we want to add the member
         * @param member the member to add
index 9502ef5..6f72cf1 100644 (file)
@@ -19,6 +19,7 @@ import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.events.callback.CallBack;
 import org.scilab.modules.gui.frame.Frame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -66,6 +67,13 @@ public interface SimpleTab {
        int addMember(Console member);
 
        /**
+        * We want to be able to add directly a HelpBrowser in a Tab.
+        * @param member the member to add
+        * @return the position of the HelpBrowser in the member list.
+        */
+       int addMember(HelpBrowser member);
+
+       /**
         * We want to be able to add directly a Console in a Tab.
         * @param member the member to add
         * @return the position of the console in the member list.
index 1a8e7f6..16865c2 100644 (file)
@@ -19,6 +19,7 @@ import org.scilab.modules.gui.container.Container;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.events.callback.CallBack;
 import org.scilab.modules.gui.frame.Frame;
+import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.popupmenu.PopupMenu;
@@ -66,6 +67,13 @@ public interface Tab extends Container {
        int addMember(Console member);
        
        /**
+        * We want to be able to add directly a HelpBrowser in a Tab.
+        * @param member the member to add
+        * @return the position of the HelpBrowser in the member list.
+        */
+       int addMember(HelpBrowser member);
+       
+       /**
         * We want to be able to add a Frame in a Tab.
         * @param member the member to add
         * @return the position of the Frame in the member list.
index 13ce5fa..3b085ab 100644 (file)
@@ -233,6 +233,8 @@ voidsetWaitBarMessagejintjobjectArrayID=NULL;
 voidsetWaitBarValuejintjintID=NULL; 
 voiddestroyWaitBarjintID=NULL; 
 voidsetWaitBarIndeterminateModejintjbooleanID=NULL; 
+voidlaunchHelpBrowserID=NULL; 
+jbooleansearchKeywordjstringID=NULL; 
 
 
 }
@@ -389,6 +391,8 @@ voidsetWaitBarMessagejintjobjectArrayID=NULL;
 voidsetWaitBarValuejintjintID=NULL; 
 voiddestroyWaitBarjintID=NULL; 
 voidsetWaitBarIndeterminateModejintjbooleanID=NULL; 
+voidlaunchHelpBrowserID=NULL; 
+jbooleansearchKeywordjstringID=NULL; 
 
 
 }
@@ -3816,4 +3820,50 @@ curEnv->ExceptionDescribe() ;
                         
 }
 
+void CallScilabBridge::launchHelpBrowser (JavaVM * jvm_){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread((void **) &curEnv, NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID voidlaunchHelpBrowserID = curEnv->GetStaticMethodID(cls, "launchHelpBrowser", "()V" ) ;
+if (voidlaunchHelpBrowserID == NULL) {
+std::cerr << "Could not access to the method " << "launchHelpBrowser" << std::endl;
+exit(EXIT_FAILURE);
+}
+
+                         curEnv->CallStaticVoidMethod(cls, voidlaunchHelpBrowserID );
+                        
+if (curEnv->ExceptionOccurred()) {
+curEnv->ExceptionDescribe() ;
+}
+
+                        
+}
+
+bool CallScilabBridge::searchKeyword (JavaVM * jvm_, char * keyword){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread((void **) &curEnv, NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID jbooleansearchKeywordjstringID = curEnv->GetStaticMethodID(cls, "searchKeyword", "(Ljava/lang/String;)Z" ) ;
+if (jbooleansearchKeywordjstringID == NULL) {
+std::cerr << "Could not access to the method " << "searchKeyword" << std::endl;
+exit(EXIT_FAILURE);
+}
+
+jstring keyword_ = curEnv->NewStringUTF( keyword );
+
+                        jboolean res =  (jboolean) curEnv->CallStaticBooleanMethod(cls, jbooleansearchKeywordjstringID ,keyword_);
+                        
+if (curEnv->ExceptionOccurred()) {
+curEnv->ExceptionDescribe() ;
+}
+
+                        
+return (res == JNI_TRUE);
+
+}
+
 }
index a5ad4b2..2493e09 100644 (file)
           <parameter type="int" name="objID"/>
           <parameter type="boolean" name="status"/>
         </method>
+<!-- Help Browser -->
+       <method name="launchHelpBrowser" returnType="void" modifier="static"/>      
+        <method name="searchKeyword" returnType="boolean" modifier="static">
+          <parameter type="String" name="keyword"/>
+        </method>
   </object>
 </package>
\ No newline at end of file
index eceae8e..bb532a5 100644 (file)
@@ -184,6 +184,8 @@ jmethodID voidsetWaitBarMessagejintjobjectArrayID; // cache method id
 jmethodID voidsetWaitBarValuejintjintID; // cache method id
 jmethodID voiddestroyWaitBarjintID; // cache method id
 jmethodID voidsetWaitBarIndeterminateModejintjbooleanID; // cache method id
+jmethodID voidlaunchHelpBrowserID; // cache method id
+jmethodID jbooleansearchKeywordjstringID; // cache method id
 
 
 /**
@@ -487,6 +489,10 @@ static void destroyWaitBar(JavaVM * jvm_, long objID);
 
 static void setWaitBarIndeterminateMode(JavaVM * jvm_, long objID, bool status);
 
+static void launchHelpBrowser(JavaVM * jvm_);
+
+static bool searchKeyword(JavaVM * jvm_, char * keyword);
+
 
                         /**
                         * Get class name to use for static methods
index ea21a4b..5106e38 100644 (file)
@@ -7,6 +7,8 @@ flexdock.jar=@FLEXDOCK@
 
 jogl.jar=@JOGL@
 
+jhall.jar=@JHALL@
+
 gluegen.jar=@GLUEGEN_RT@
 
 jrosetta-API.jar=@JROSETTA_API@
index a5b6682..837c83d 100644 (file)
@@ -6,6 +6,8 @@ flexdock.jar=${thirdparty.dir}/flexdock-0.5.1.jar
 
 jogl.jar=${thirdparty.dir}/jogl.jar
 
+jhall.jar=${thirdparty.dir}/jhall.jar
+
 gluegen.jar=${thirdparty.dir}/gluegen-rt.jar
 
 jrosetta-API.jar=${thirdparty.dir}/jrosetta-API.jar