jsmooth-cvs Mailing List for JSmooth
Status: Beta
Brought to you by:
reyes
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(64) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(44) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(23) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(35) |
Mar
(75) |
Apr
(105) |
May
(89) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(12) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:50
|
Update of /cvsroot/jsmooth/jsmooth In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30988 Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/build.xml,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** build.xml 19 May 2007 15:27:37 -0000 1.42 --- build.xml 12 Oct 2008 19:32:44 -0000 1.43 *************** *** 4,14 **** <!-- see the README.txt file for additional information --> <!-- DO NOT SKIP THIS PART! REALLY! IT WON'T WORK OTHERWISE --> ! <property name="JDKDIR" value="c:\Program Files\Java\jdk1.5.0_11"/> <property name="RM" value="CMD /C DEL"/> <!-- Values below should be standard, but check it anyway --> <!-- Also make sure that the bin folder of MINGW is in your PATH --> ! <property name="mingw-make" value="mingw32-make.exe"/> ! <property name="mingw-strip" value="strip.exe"/> <!-- the autodownload skeleton needs the fltk lib to be available --> --- 4,14 ---- <!-- see the README.txt file for additional information --> <!-- DO NOT SKIP THIS PART! REALLY! IT WON'T WORK OTHERWISE --> ! <property name="JDKDIR" value="c:/Program Files/Java/jdk1.5.0_16"/> <property name="RM" value="CMD /C DEL"/> <!-- Values below should be standard, but check it anyway --> <!-- Also make sure that the bin folder of MINGW is in your PATH --> ! <property name="mingw-make" value="c:/MinGW/bin/mingw32-make.exe"/> ! <property name="mingw-strip" value="c:/MinGW/bin/strip.exe"/> <!-- the autodownload skeleton needs the fltk lib to be available --> *************** *** 25,30 **** <!-- What's below is optional (needed only if you build a dist) --> ! <property name="FOP" value="c:/Programs/fop-0.93\fop.bat"/> ! <property name="DOCBOOKBASE" value="c:\programs\docbook-xsl-1.72.0"/> <!-- set here the properties specific to the release --> --- 25,30 ---- <!-- What's below is optional (needed only if you build a dist) --> ! <property name="FOP" value="c:/opt/fop-0.95\fop.bat"/> ! <property name="DOCBOOKBASE" value="C:\opt\docbook-xsl-1.74.0"/> <!-- set here the properties specific to the release --> *************** *** 342,345 **** --- 342,346 ---- <ant dir="skeletons/simplewrap/samplejar" /> <ant dir="skeletons/consolewrapper/samplejar" /> + <ant antfile="build.xml" dir="skeletons/winservice/sample" target="dist"/> <antcall target="compileskel"> *************** *** 354,357 **** --- 355,368 ---- </antcall> <antcall target="compileskel"> + <param name="skelname" value="util-gui"/> + <param name="skelflags" value="${skelflags}"/> + <param name="target" value="all"/> + </antcall> + <antcall target="compileskel"> + <param name="skelname" value="jnismooth"/> + <param name="skelflags" value="${skelflags}"/> + <param name="target" value="all"/> + </antcall> + <antcall target="compileskel"> <param name="skelname" value="commonjava"/> <param name="skelflags" value="${skelflags}"/> *************** *** 388,391 **** --- 399,407 ---- <ant antfile="build.xml" dir="sample" target="clean"/> + <ant antfile="build.xml" dir="skeletons/consolewrapper/samplejar" target="clean"/> + <ant antfile="build.xml" dir="skeletons/jnismooth" target="clean"/> + <ant antfile="build.xml" dir="skeletons/samplejar" target="clean"/> + <ant antfile="build.xml" dir="skeletons/simplewrap/samplejar" target="clean"/> + <ant antfile="build.xml" dir="skeletons/winservice/sample" target="clean"/> <antcall target="compileskel"> *************** *** 400,403 **** --- 416,429 ---- </antcall> <antcall target="compileskel"> + <param name="skelname" value="util-gui"/> + <param name="skelflags" value="${skelflags}"/> + <param name="target" value="clean"/> + </antcall> + <antcall target="compileskel"> + <param name="skelname" value="jnismooth"/> + <param name="skelflags" value="${skelflags}"/> + <param name="target" value="clean"/> + </antcall> + <antcall target="compileskel"> <param name="skelname" value="commonjava"/> <param name="skelflags" value="${skelflags}"/> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:35
|
Update of /cvsroot/jsmooth/jsmooth In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30958 Modified Files: build.number Log Message: fix build cleaning Index: build.number =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/build.number,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** build.number 19 May 2007 23:34:06 -0000 1.39 --- build.number 12 Oct 2008 19:32:28 -0000 1.40 *************** *** 1,3 **** ! #Build Number for ANT. Do not edit! ! #Sun May 20 01:00:46 CEST 2007 ! build.number=256 --- 1,3 ---- ! #Build Number for ANT. Do not edit! ! #Sun Oct 12 21:27:19 CEST 2008 ! build.number=265 |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:14
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/samplejar In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/samplejar Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/samplejar/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.xml 18 May 2007 21:34:00 -0000 1.2 --- build.xml 12 Oct 2008 19:31:59 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- <target name="clean"> <delete dir="${classes}"/> + <delete file="sample.jar"/> </target> </project> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:14
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/jnismooth In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/jnismooth Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/jnismooth/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 19 May 2007 15:09:44 -0000 1.1 --- build.xml 12 Oct 2008 19:31:59 -0000 1.2 *************** *** 34,37 **** --- 34,38 ---- <target name="clean"> <delete dir="${classes}"/> + <delete file="jnismooth.jar"/> </target> </project> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:14
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/winservice In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/winservice Modified Files: Makefile.win Log Message: fix build cleaning Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/winservice/Makefile.win,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.win 27 May 2007 09:14:52 -0000 1.5 --- Makefile.win 12 Oct 2008 19:31:59 -0000 1.6 *************** *** 24,28 **** clean: clean-custom ! $(RM) $(OBJ) $(BIN) winservice_private.res $(BIN): $(LINKOBJ) ../commonjava/CommonJava.a --- 24,28 ---- clean: clean-custom ! $(RM) $(OBJ) $(BIN) winservice_private.res WinService.o $(BIN): $(LINKOBJ) ../commonjava/CommonJava.a |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:14
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/commonjava Modified Files: Makefile.win Log Message: fix build cleaning Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/Makefile.win,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.win 26 May 2007 11:24:36 -0000 1.10 --- Makefile.win 12 Oct 2008 19:31:59 -0000 1.11 *************** *** 23,27 **** clean: clean-custom ! $(RM) $(OBJ) $(BIN) $(BIN): $(LINKOBJ) test.cpp --- 23,27 ---- clean: clean-custom ! $(RM) $(OBJ) $(BIN) test.exe $(BIN): $(LINKOBJ) test.cpp |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:11
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/consolewrapper/samplejar In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/consolewrapper/samplejar Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/consolewrapper/samplejar/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 2 Sep 2003 06:01:03 -0000 1.1 --- build.xml 12 Oct 2008 19:31:59 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- <target name="clean"> <delete dir="${classes}"/> + <delete file="sample.jar"/> </target> </project> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:10
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/samplejar In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/simplewrap/samplejar Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/samplejar/build.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.xml 3 Aug 2003 14:43:17 -0000 1.1.1.1 --- build.xml 12 Oct 2008 19:31:59 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- <target name="clean"> <delete dir="${classes}"/> + <delete file="sample.jar"/> </target> </project> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:10
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/winservice/sample In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/winservice/sample Modified Files: build.xml Log Message: fix build cleaning Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/winservice/sample/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 9 Apr 2007 17:15:50 -0000 1.1 --- build.xml 12 Oct 2008 19:31:59 -0000 1.2 *************** *** 35,38 **** --- 35,39 ---- <target name="clean"> <delete dir="${classes}"/> + <delete file="sample.jar"/> </target> </project> |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:06
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/util-net In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/util-net Modified Files: Makefile.win Log Message: fix build cleaning Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-net/Makefile.win,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.win 16 May 2007 22:04:19 -0000 1.5 --- Makefile.win 12 Oct 2008 19:31:59 -0000 1.6 *************** *** 1,34 **** ! # Project: CommonJava ! ! PROJECTNAME=util-net ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = "c:/MinGW" ! FLTK-LDFLAGS = $(shell fltk-config --ldflags) ! FLTK-CXXFLAGS = $(shell fltk-config --cxxflags) ! RES = ! OBJ = WinHttpClient.o HttpClient.o URL.o downloadgui.o httpdownload.o $(RES) ! LIBS = -L"$(MINGW)/lib" -L"/lib" -lws2_32 -lwininet $(FLTK-LDFLAGS) ! CXXINCS = -Os -I"../util-core" -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" $(FLTK-CXXFLAGS) ! BIN = $(PROJECTNAME).a ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(PROJECTNAME).a testmain.cpp all-after ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) test.exe testmain.o ! ! $(BIN): $(OBJ) ! ar r $(BIN) $(OBJ) ! ranlib $(BIN) ! $(CPP) -g $(OBJ) ../util-core/util-core.a testmain.o -o test.exe $(LIBS) ! ! $(PROJECTNAME).a: $(OBJ) testmain.o ! ! ! testmain.o: testmain.cpp ! $(CPP) -c testmain.cpp -o testmain.o $(CXXFLAGS) --- 1,34 ---- ! # Project: CommonJava ! ! PROJECTNAME=util-net ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = "c:/MinGW" ! FLTK-LDFLAGS = $(shell fltk-config --ldflags) ! FLTK-CXXFLAGS = $(shell fltk-config --cxxflags) ! RES = ! OBJ = WinHttpClient.o HttpClient.o URL.o downloadgui.o httpdownload.o $(RES) ! LIBS = -L"$(MINGW)/lib" -L"/lib" -lws2_32 -lwininet $(FLTK-LDFLAGS) ! CXXINCS = -Os -I"../util-core" -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" $(FLTK-CXXFLAGS) ! BIN = $(PROJECTNAME).a ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(PROJECTNAME).a testmain.cpp all-after ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) test.exe testmain.o ! ! $(BIN): $(OBJ) ! ar r $(BIN) $(OBJ) ! ranlib $(BIN) ! $(CPP) -g $(OBJ) ../util-core/util-core.a testmain.o -o test.exe $(LIBS) ! ! $(PROJECTNAME).a: $(OBJ) testmain.o ! ! ! testmain.o: testmain.cpp ! $(CPP) -c testmain.cpp -o testmain.o $(CXXFLAGS) |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:32:06
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/simplewrap In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30866/skeletons/simplewrap Modified Files: Makefile.win Log Message: fix build cleaning Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/Makefile.win,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Makefile.win 27 May 2007 09:14:51 -0000 1.15 --- Makefile.win 12 Oct 2008 19:31:59 -0000 1.16 *************** *** 33,35 **** JWrap_private.res: JWrap_private.rc mainres.rc ! $(WINDRES) -i JWrap_private.rc -I rc -o JWrap_private.res -O coff --- 33,35 ---- JWrap_private.res: JWrap_private.rc mainres.rc ! $(WINDRES) -i JWrap_private.rc -J rc -o JWrap_private.res -O coff |
From: Rodrigo R. <re...@us...> - 2008-10-12 19:31:03
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/jnismooth/src/jsmooth In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30779/skeletons/jnismooth/src/jsmooth Added Files: SplashWindow.java Log Message: inclusion --- NEW FILE: SplashWindow.java --- /* JSmooth: a VM wrapper toolkit for Windows Copyright (C) 2003 Rodrigo Reyes <re...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package jsmooth; /** * */ public class SplashWindow { private SplashWindow() { } native public boolean isVisible(); native public void hide(); native public void setProgress(int current, int maximum); } |
From: Rodrigo R. <re...@us...> - 2007-05-27 14:52:02
|
Update of /cvsroot/jsmooth/jsmooth/docs In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11297/docs Modified Files: jsmooth-doc.xml Log Message: update with splash window example, and some other minor change Index: jsmooth-doc.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/docs/jsmooth-doc.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** jsmooth-doc.xml 19 May 2007 14:59:24 -0000 1.23 --- jsmooth-doc.xml 27 May 2007 14:51:54 -0000 1.24 *************** *** 1089,1103 **** JNI option, and add the <function>jsmooth.Native</function> calls in your java code. You need to build your project using the ! <function>jnismooth.jar</function> library, but don't need to ! package it with your application, as it is embedded (as well as the ! native functions implementation) in the wrappers. ! </para> ! <para>Before using any JNI feature from the <function>jsmooth.Native</function>, you must check that the native methods are correctly bound to their native implementation by using the <function>jsmooth.Native.isAvailable()</function> method. If this method returns false, you cannot use any of the ! native method.</para> <sect2><title>Examples</title> --- 1089,1106 ---- JNI option, and add the <function>jsmooth.Native</function> calls in your java code. You need to build your project using the ! <function>jnismooth.jar</function> library, and include if possible ! the jar in your application, to avoid a ClassNotFoundException that ! could be raised. Using the library is always safe if you first ! check that you can use it with the ! <function>isAvailable()</function> method.</para> ! <warning> ! <para>Before using any JNI feature from the <function>jsmooth.Native</function>, you must check that the native methods are correctly bound to their native implementation by using the <function>jsmooth.Native.isAvailable()</function> method. If this method returns false, you cannot use any of the ! native method (an exception shall be raised in this case)</para> ! </warning> <sect2><title>Examples</title> *************** *** 1213,1216 **** --- 1216,1265 ---- </sect3> + <sect3><title>Interacting with the splash window</title> + <para> + When the splash window is enabled, the JSmooth wrapper displays an image + at startup, until your application opens its first own window. + </para> + + <para>If your application takes some time loading its resources, it + may be convenient to use the JSmooth progress bar feature of the + splash window to provide an indication of completion to the user. + + <programlisting> + + jsmooth.SplashWindow spw = null; + + // + // First, we need to check if the JNI bridge is available... + if (jsmooth.Native.isAvailable()) + { + // + // If the splash window exists, this method returns a + // SplashWindow object that we can use. If there is no + // splash window displayed, this method returns null + spw = jsmooth.Native.getSplashWindow(); + } + + // + // Let's say there are 50 resources to load... + for (int i=0; i<=50; i+=1) + { + loadResource(i); + + // + // Update the progress bar, if it exists + if (spw != null) + spw.setProgress(i, 50); + } + + </programlisting> + </para> + + <para> + It is safe to assume that the splash window may not be available, for + any reason. For instance if your application is not launched with + JSmooth... </para> + + </sect3> *************** *** 1251,1284 **** </question> <answer> - <para> - - Whenever possible, the wrappers delete the file on - exit. Note however that this is not always possible. For - example, an instance of a JVM created using the JVM DLL does - not unload cleanly. This behaviour (not to call it a bug) is - documented by Sun, and there is no known work-around for it. - - </para> <para> ! ! Both Windowed and Console wrapper always prefer the JVM ! instanciation methods that allow them to delete the temp jar ! after the application exits. Note that embedding a jar in ! the exe is not required, it is always a safe choice to just ! leave it on the filesystem near the executable, either in ! the same directory, or in a sibling or parent directory. ! ! </para> ! ! <para> ! ! Note also that deleting the files in the windows TEMP ! directory is not required for Windows applications, and most ! application just leave them, letting the operating system ! manage it. The standard behaviour of MS Windows is to ! propose the user to delete the temporary files when the ! disks are running low on available space. ! </para> --- 1300,1315 ---- </question> <answer> <para> ! Whenever possible, the wrappers delete the file when the ! application exits. Note however that this is not always ! possible, as some versions of Sun's DLL do not return ! properly. In any case, all the temporary files used by ! JSmooth, including the extracted jar, are flagged to windows ! as "Delete On Reboot". Therefore, even if the wrapper does ! not get a chance to delete a temporary files, it is anyway ! always deleted automatically by windows during the next ! booting sequence, preventing the files to proliferate on the ! end-user's disk. </para> *************** *** 1300,1304 **** No. While the jsmooth wrappers may use a jar to bootstrap ! the java application, you can reference other jar files in a jsmooth project. Those jar files will be accessible to your executable binary, provided the path specified is --- 1331,1335 ---- No. While the jsmooth wrappers may use a jar to bootstrap ! the java application, you can refer other jar files in a jsmooth project. Those jar files will be accessible to your executable binary, provided the path specified is *************** *** 1405,1412 **** Wrapper-specific options can also be passed in order to ! override the defaults parameters set up at wrapper ! creation. Those options start with ! <function>-Jskel_</function> (names are case-sensitive as ! well). <itemizedlist> --- 1436,1442 ---- Wrapper-specific options can also be passed in order to ! override the default parameters set up at wrapper ! creation time. Those options start with ! <function>-Jskel_</function> (names are also case-sensitive). <itemizedlist> *************** *** 1451,1457 **** I have a filetype associated to my program. However, when I ! launch a document, my application can't find its resources, because the current directory is the directory of the ! document. How do I fix that ? </para> --- 1481,1488 ---- I have a filetype associated to my program. However, when I ! open a document, my application can't find its resources, because the current directory is the directory of the ! document, not the directory of the executable. How do I fix ! that ? </para> *************** *** 1460,1468 **** <para> ! You can force the wrappers to always force the current ! directory of your application to be the executable's instead ! of the document's by enabling the "Sets the executable ! folder as current directory of the application" option ! (located in the executable settings panel). </para> --- 1491,1499 ---- <para> ! You can force the wrappers to modify the current working ! directory at startup. In this case, you just need to enable ! the "Sets the executable folder as current directory of the ! application" option (located in the executable settings ! panel). </para> *************** *** 1470,1475 **** <para> This works correctly because Windows always provides the ! document as an absolute path argument of the application. ! </para> </answer> --- 1501,1506 ---- <para> This works correctly because Windows always provides the ! document location as an absolute path to the default ! application. </para> </answer> *************** *** 1511,1518 **** arguments (only the first argument of the command line is taken into account). If the "autostart" option is ! enabled, the service will be automatically when Windows ! is started. ! </para> ! </listitem> <listitem> --- 1542,1547 ---- arguments (only the first argument of the command line is taken into account). If the "autostart" option is ! enabled, the service will be automatically started by ! Windows. </para> </listitem> <listitem> *************** *** 1582,1586 **** <para> ! The first thing to do, is to run the wrapper with the additional argument <function>-JskelDebug=1</function> (the option is case-sensitive). This will start the wrapper in --- 1611,1615 ---- <para> ! The very first thing to do, is to run the wrapper with the additional argument <function>-JskelDebug=1</function> (the option is case-sensitive). This will start the wrapper in |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:56
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui/editors Modified Files: ExecutableIcon.java ExecutableName.java SkeletonPropertiesEditor.java Log Message: adds support for the splash screen in the jsmooth application Index: SkeletonPropertiesEditor.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/SkeletonPropertiesEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SkeletonPropertiesEditor.java 7 Apr 2007 10:47:33 -0000 1.4 --- SkeletonPropertiesEditor.java 27 May 2007 09:15:49 -0000 1.5 *************** *** 1,244 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003 Rodrigo Reyes <re...@ch...> ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.editors; ! ! import net.charabia.jsmoothgen.application.gui.skeleditors.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! import javax.swing.*; ! import java.awt.*; ! import java.util.*; ! import com.l2fprod.common.swing.*; ! import com.l2fprod.common.propertysheet.*; ! ! import se.datadosen.component.RiverLayout; ! ! public class SkeletonPropertiesEditor extends Editor implements JSmoothModelBean.SkeletonChangedListener ! { ! private String m_currentSkelName = null; ! private SkeletonBean m_skel = null; ! private SkelPanel m_panel = new SkelPanel(); ! private Vector m_editors = new Vector(); ! ! public SkeletonPropertiesEditor() ! { ! setLayout(new BorderLayout()); ! add(m_panel, BorderLayout.CENTER); ! } ! ! public void rebuildProperties() ! { ! // System.out.println("============================================="); ! // System.out.println("============================================="); ! // System.out.println("=== REBUILD PROPERTIES !!!! ==========="); ! // System.out.println("============================================="); ! // System.out.println("============================================="); ! ! m_skel = null; ! if (m_currentSkelName != null) ! m_skel = Main.SKELETONS.getSkeleton(m_currentSkelName); ! ! SkeletonProperty[] sprops = null; ! if (m_skel != null) ! sprops = m_skel.getSkeletonProperties(); ! else ! sprops = new SkeletonProperty[0]; ! ! m_panel.removeAll(); ! m_panel.setLayout(new RiverLayout()); ! m_editors.clear(); ! ! for (int i=0; i<sprops.length; i++) ! { ! SkelPropEditor spe = null; ! if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_STRING)) ! { ! spe = new StringEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_TEXTAREA)) ! { ! spe = new TextAreaEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_BOOLEAN)) ! { ! spe = new CheckBoxEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_AUTODOWNLOADURL)) ! { ! spe = new AutoDownloadURLEditor(); ! } ! ! if (spe == null) ! { ! spe = new StringEditor(); ! } ! ! m_editors.add(spe); ! spe.bind(sprops[i]); ! ! if (spe.labelAtLeft()) ! { ! m_panel.add("br", new JLabel(Main.local(sprops[i].getLabel()))); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", spe.getGUI()); ! } ! else ! { ! m_panel.add("br right", spe.getGUI()); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", new JLabel(Main.local(sprops[i].getLabel()))); ! } ! } ! ! revalidate(); ! m_panel.revalidate(); ! doLayout(); ! m_panel.doLayout(); ! } ! ! public void dataChanged() ! { ! // System.out.println("========================================================"); ! // System.out.println("SkeletonPropertiesEditor: data changed, " + m_model.getSkeletonName()); ! if (m_model.getSkeletonName() == null) ! { ! // System.out.println("SkeletonPropertiesEditor, no name"); ! m_currentSkelName = null; ! rebuildProperties(); ! } ! ! if ((m_model != null) && (m_model.getSkeletonName() != null) && (!m_model.getSkeletonName().equalsIgnoreCase(m_currentSkelName))) ! { ! // System.out.println("SkeletonPropertiesEditor, different..."); ! m_currentSkelName = m_model.getSkeletonName(); ! rebuildProperties(); ! } ! ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! // System.out.println("jsprop is null ? " + jsprop + " / " + ((jsprop!=null)?jsprop.length:-1)); ! if (jsprop != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! JSmoothModelBean.Property p = getPropertyInstance(spe.getIdName()); ! if (p != null) ! spe.valueChanged(p.getValue()); ! } ! } ! else ! { // if no properties are defined for this model, we use the default values ! ! SkeletonBean skel = Main.SKELETONS.getSkeleton( m_model.getSkeletonName() ); ! SkeletonProperty[] sprops = null; ! if (skel != null) ! sprops = skel.getSkeletonProperties(); ! ! if (sprops != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! for (int i=0; i<sprops.length; i++) ! { ! if (sprops[i].getIdName().equals(spe.getIdName())) ! spe.valueChanged(sprops[i].getValue()); ! } ! } ! } ! } ! ! // System.out.println("DONE NOTHING! " +m_currentSkelName + "/" + m_model.getSkeletonName()); ! } ! ! JSmoothModelBean.Property getPropertyInstance(String name) ! { ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! for (int i=0; i<jsprop.length; i++) ! { ! if (jsprop[i].getKey().equals(name)) ! return jsprop[i]; ! } ! return null; ! } ! ! public void updateModel() ! { ! if (m_skel != null) ! { ! JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[m_editors.size()]; ! int index = 0; ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! // System.out.println("IMODEL property " + spe + "/" + spe.getIdName() + "=" + spe.get()); ! props[index] = new JSmoothModelBean.Property(); ! props[index].setKey(spe.getIdName()); ! props[index].setValue(spe.get()); ! index++; ! } ! m_model.setSkeletonProperties(props); ! } ! ! // if (m_skel != null) ! // { ! // System.out.println("UPDATE MODEL for skeletons..."); ! // SkeletonProperty[] sp = m_skel.getSkeletonProperties(); ! // JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[sp.length]; ! // for (int i=0; i<sp.length; i++) ! // { ! // props[i] = new JSmoothModelBean.Property(); ! // props[i].setKey(sp[i].getIdName()); ! // props[i].setValue(sp[i].getValue()); ! // System.out.println(props[i]); ! // } ! // m_model.setSkeletonProperties(props); ! // } ! ! } ! ! ! public void skeletonChanged() ! { ! // dataChanged(); ! rebuildProperties(); ! dataChanged(); ! } ! ! public String getLabel() ! { ! return "SKELETONPROPERTIES_LABEL"; ! } ! ! public String getDescription() ! { ! return "SKELETONPROPERTIES_HELP"; ! } ! ! public boolean needsBigSpace() ! { ! return true; ! } ! ! } --- 1,242 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003 Rodrigo Reyes <re...@ch...> ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.editors; ! ! import net.charabia.jsmoothgen.application.gui.skeleditors.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! import javax.swing.*; ! import java.awt.*; ! import java.util.*; ! import com.l2fprod.common.swing.*; ! //import com.l2fprod.common.propertysheet.*; ! ! import se.datadosen.component.RiverLayout; ! ! public class SkeletonPropertiesEditor extends Editor implements JSmoothModelBean.SkeletonChangedListener ! { ! private String m_currentSkelName = null; ! private SkeletonBean m_skel = null; ! private SkelPanel m_panel = new SkelPanel(); ! private Vector m_editors = new Vector(); ! ! public SkeletonPropertiesEditor() ! { ! setLayout(new BorderLayout()); ! add(m_panel, BorderLayout.CENTER); ! } ! ! public void rebuildProperties() ! { ! m_skel = null; ! if (m_currentSkelName != null) ! m_skel = Main.SKELETONS.getSkeleton(m_currentSkelName); ! ! SkeletonProperty[] sprops = null; ! if (m_skel != null) ! sprops = m_skel.getSkeletonProperties(); ! else ! sprops = new SkeletonProperty[0]; ! ! m_panel.removeAll(); ! m_panel.setLayout(new RiverLayout()); ! m_editors.clear(); ! ! for (int i=0; i<sprops.length; i++) ! { ! SkelPropEditor spe = null; ! if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_STRING)) ! { ! spe = new StringEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_TEXTAREA)) ! { ! spe = new TextAreaEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_BOOLEAN)) ! { ! spe = new CheckBoxEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_AUTODOWNLOADURL)) ! { ! spe = new AutoDownloadURLEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_IMAGESELECTOR)) ! { ! spe = new ImageSelectorEditor(); ! } ! ! if (spe == null) ! { ! spe = new StringEditor(); ! } ! ! m_editors.add(spe); ! spe.bind(sprops[i]); ! ! if (spe.labelAtLeft()) ! { ! m_panel.add("br", new JLabel(Main.local(sprops[i].getLabel()))); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", spe.getGUI()); ! } ! else ! { ! m_panel.add("br right", spe.getGUI()); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", new JLabel(Main.local(sprops[i].getLabel()))); ! } ! } ! ! revalidate(); ! m_panel.revalidate(); ! doLayout(); ! m_panel.doLayout(); ! } ! ! public void dataChanged() ! { ! // System.out.println("========================================================"); ! // System.out.println("SkeletonPropertiesEditor: data changed, " + m_model.getSkeletonName()); ! ! ! if (m_model.getSkeletonName() == null) ! { ! // System.out.println("SkeletonPropertiesEditor, no name"); ! m_currentSkelName = null; ! rebuildProperties(); ! } ! ! if ((m_model != null) && (m_model.getSkeletonName() != null) && (!m_model.getSkeletonName().equalsIgnoreCase(m_currentSkelName))) ! { ! // System.out.println("SkeletonPropertiesEditor, different..."); ! m_currentSkelName = m_model.getSkeletonName(); ! rebuildProperties(); ! } ! ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! // System.out.println("jsprop is null ? " + jsprop + " / " + ((jsprop!=null)?jsprop.length:-1)); ! if (jsprop != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! JSmoothModelBean.Property p = getPropertyInstance(spe.getIdName()); ! if (p != null) ! spe.valueChanged(p.getValue()); ! } ! } ! else ! { // if no properties are defined for this model, we use the default values ! ! SkeletonBean skel = Main.SKELETONS.getSkeleton( m_model.getSkeletonName() ); ! SkeletonProperty[] sprops = null; ! if (skel != null) ! sprops = skel.getSkeletonProperties(); ! ! if (sprops != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! for (int i=0; i<sprops.length; i++) ! { ! if (sprops[i].getIdName().equals(spe.getIdName())) ! spe.valueChanged(sprops[i].getValue()); ! } ! } ! } ! } ! ! java.io.File root = Main.MAIN.getProjectFile(); ! if ((root != null) && (root.getParentFile() != null)) ! { ! root = root.getParentFile(); ! ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! spe.setBaseDir(root); ! } ! } ! ! // System.out.println("DONE NOTHING! " +m_currentSkelName + "/" + m_model.getSkeletonName()); ! } ! ! JSmoothModelBean.Property getPropertyInstance(String name) ! { ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! for (int i=0; i<jsprop.length; i++) ! { ! if (jsprop[i].getKey().equals(name)) ! return jsprop[i]; ! } ! return null; ! } ! ! public void updateModel() ! { ! if (m_skel != null) ! { ! JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[m_editors.size()]; ! int index = 0; ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! // System.out.println("IMODEL property " + spe + "/" + spe.getIdName() + "=" + spe.get()); ! props[index] = new JSmoothModelBean.Property(); ! props[index].setKey(spe.getIdName()); ! props[index].setValue(spe.get()); ! props[index].isLocalFile = spe.isLocalFile(); ! index++; ! } ! m_model.setSkeletonProperties(props); ! } ! ! } ! ! ! public void skeletonChanged() ! { ! // dataChanged(); ! rebuildProperties(); ! dataChanged(); ! } ! ! public String getLabel() ! { ! return "SKELETONPROPERTIES_LABEL"; ! } ! ! public String getDescription() ! { ! return "SKELETONPROPERTIES_HELP"; ! } ! ! public boolean needsBigSpace() ! { ! return true; ! } ! ! } Index: ExecutableIcon.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/ExecutableIcon.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExecutableIcon.java 7 Apr 2007 10:47:33 -0000 1.2 --- ExecutableIcon.java 27 May 2007 09:15:48 -0000 1.3 *************** *** 74,77 **** --- 74,80 ---- public void updateModel() { + if (m_model == null) + return; + File f = m_selector.getFile(); if (f != null) Index: ExecutableName.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/ExecutableName.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExecutableName.java 16 Mar 2004 08:05:16 -0000 1.1 --- ExecutableName.java 27 May 2007 09:15:49 -0000 1.2 *************** *** 50,53 **** --- 50,54 ---- else m_selector.setFile(null); + } |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:55
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui/util Modified Files: FileSelectionTextField.java Log Message: adds support for the splash screen in the jsmooth application Index: FileSelectionTextField.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/FileSelectionTextField.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileSelectionTextField.java 7 Apr 2007 10:47:33 -0000 1.9 --- FileSelectionTextField.java 27 May 2007 09:15:49 -0000 1.10 *************** *** 140,144 **** } } ! public void setFile(java.io.File f) { --- 140,149 ---- } } ! ! public void setFileFilter(javax.swing.filechooser.FileFilter filter) ! { ! m_fileChooser.setFileFilter(filter); ! } ! public void setFile(java.io.File f) { *************** *** 186,192 **** m_fileChooser.setCurrentDirectory(root); m_basedir = root; } ! public File getBaseDir() { return m_basedir; --- 191,199 ---- m_fileChooser.setCurrentDirectory(root); m_basedir = root; + if (getFile() != null) + setFile(getFile()); } ! public java.io.File getBaseDir() { return m_basedir; |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:55
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application Modified Files: JSmoothModelBean.java PropertiesBuilder.java Log Message: adds support for the splash screen in the jsmooth application Index: PropertiesBuilder.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/PropertiesBuilder.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PropertiesBuilder.java 13 May 2007 20:06:25 -0000 1.17 --- PropertiesBuilder.java 27 May 2007 09:15:48 -0000 1.18 *************** *** 128,131 **** --- 128,137 ---- { String val = prop.getValue(); + if (prop.isLocalFile) + { + // TODO + val = getRenormalizedPathIfNeeded(val, basedir, curdir); + } + if (val == null) val = ""; Index: JSmoothModelBean.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/JSmoothModelBean.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** JSmoothModelBean.java 13 May 2007 20:06:25 -0000 1.16 --- JSmoothModelBean.java 27 May 2007 09:15:48 -0000 1.17 *************** *** 62,66 **** public String Key; public String Value; ! public void setKey(String key) { --- 62,67 ---- public String Key; public String Value; ! public boolean isLocalFile = false; ! public void setKey(String key) { |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:55
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/skeleditors In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui/skeleditors Modified Files: SkelPropEditor.java Added Files: ImageSelectorEditor.java Log Message: adds support for the splash screen in the jsmooth application --- NEW FILE: ImageSelectorEditor.java --- /* JSmooth: a VM wrapper toolkit for Windows Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package net.charabia.jsmoothgen.application.gui.skeleditors; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import java.util.*; import java.awt.event.*; import net.charabia.jsmoothgen.application.gui.util.*; import java.io.*; public class ImageSelectorEditor extends SkelPropEditor { protected FileSelectionTextField m_comp = new FileSelectionTextField(); public ImageSelectorEditor() { GenericFileFilter gff = new GenericFileFilter("Image"); gff.addSuffix("gif"); gff.addSuffix("png"); gff.addSuffix("jpg"); gff.addSuffix("bmp"); m_comp.setFileFilter(gff); } public java.awt.Component getGUI() { return m_comp; } public void valueChanged(String val) { m_comp.setFile(new File(val)); } public boolean labelAtLeft() { return true; } public void set(String o) { m_comp.setFile(new File(o.toString())); } public String get() { if (m_comp.getFile()!=null) return m_comp.getFile().toString(); return "";} public void setBaseDir(java.io.File base) { m_comp.setBaseDir(base); } public boolean isLocalFile() { return true; } } Index: SkelPropEditor.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/skeleditors/SkelPropEditor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SkelPropEditor.java 27 Mar 2007 20:21:02 -0000 1.1 --- SkelPropEditor.java 27 May 2007 09:15:48 -0000 1.2 *************** *** 1,66 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.skeleditors; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! ! abstract public class SkelPropEditor ! { ! protected SkeletonProperty m_property; ! ! public void bind(SkeletonProperty prop) ! { ! m_property = prop; ! } ! ! public String getIdName() ! { ! return m_property.getIdName(); ! } ! ! ! public boolean labelAtLeft() ! { ! return true; ! } ! ! public abstract java.awt.Component getGUI(); ! public abstract void valueChanged(String val); ! ! public abstract void set(String o); ! public abstract String get(); ! // { ! // System.out.println("setvalue of " + o + " on " + m_property); ! // m_property.setValue(o.toString()); ! // } ! ! // { ! // System.out.println("getvalue from " + m_property + "=" + m_property.getValue()); ! // return m_property.getValue(); ! // } ! ! } ! --- 1,65 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.skeleditors; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! ! abstract public class SkelPropEditor ! { ! protected SkeletonProperty m_property; ! ! public void bind(SkeletonProperty prop) ! { ! m_property = prop; ! } ! ! public String getIdName() ! { ! return m_property.getIdName(); ! } ! ! public boolean labelAtLeft() ! { ! return true; ! } ! ! public abstract java.awt.Component getGUI(); ! public abstract void valueChanged(String val); ! ! public abstract void set(String o); ! public abstract String get(); ! ! public void setBaseDir(java.io.File base) ! { ! } ! ! public boolean isLocalFile() ! { ! return false; ! } ! ! } ! |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:55
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui Modified Files: Main.java MasterPanel.java Log Message: adds support for the splash screen in the jsmooth application Index: Main.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/Main.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.java 13 May 2007 20:06:25 -0000 1.8 --- Main.java 27 May 2007 09:15:48 -0000 1.9 *************** *** 47,58 **** private Main() { ! Splash splash = new Splash(this, "/icons/splash.png", false); ! splash.setVersion(VERSION); ! splash.show(); m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); getContentPane().setLayout(new BorderLayout()); m_panel = new MasterPanel(); getContentPane().add(BorderLayout.CENTER, m_panel); --- 47,63 ---- private Main() { ! setupSplash(this); ! ! setSplashProgress(3, 100); m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); + setSplashProgress(6, 100); + getContentPane().setLayout(new BorderLayout()); m_panel = new MasterPanel(); + + setSplashProgress(90, 100); + getContentPane().add(BorderLayout.CENTER, m_panel); *************** *** 60,63 **** --- 65,70 ---- setupToolBar(); + setSplashProgress(95, 100); + addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) *************** *** 69,73 **** setTitle("Untitled"); loadWindowSettings(); ! splash.dispose(); } --- 76,83 ---- setTitle("Untitled"); loadWindowSettings(); ! ! setSplashProgress(100, 100); ! ! closeSplash(); } *************** *** 137,140 **** --- 147,155 ---- + public java.io.File getProjectFile() + { + return m_panel.getProjectFile(); + } + private final Icon ICON_NEW = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_new.png")); public final Action NEW = new AbstractAction(local("NEW"), ICON_NEW) { *************** *** 161,166 **** } ! // if (openDirect(m_projectFileChooser.getSelectedFile())) ! // m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); } } --- 176,181 ---- } ! // if (openDirect(m_projectFileChooser.getSelectedFile())) ! // m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); } } *************** *** 332,338 **** --- 347,393 ---- } + static Splash s_splashWindow = null; + + static private void setupSplash(Frame parent) + { + jsmooth.SplashWindow spw = null; + if (jsmooth.Native.isAvailable()) + spw = jsmooth.Native.getSplashWindow(); + + if (spw == null) + { + s_splashWindow = new Splash(parent, "/icons/splash.png", false); + s_splashWindow.setVersion(VERSION); + s_splashWindow.show(); + } + } + + static public Object setSplashProgress(int cur, int max) + { + if (s_splashWindow == null) + { + System.out.println("setSplashProgress... " + cur + "/" + max); + jsmooth.SplashWindow spw = null; + if (jsmooth.Native.isAvailable()) + spw = jsmooth.Native.getSplashWindow(); + + if (spw != null) + { + spw.setProgress(cur, max); + } + } + return null; + } + + static private void closeSplash() + { + if (s_splashWindow != null) + s_splashWindow.dispose(); + } + public static void main(String args[]) { System.out.println("Running JSmooth..."); + try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); *************** *** 355,358 **** --- 410,414 ---- } + closeSplash(); Main.MAIN.setVisible(true); } Index: MasterPanel.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/MasterPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MasterPanel.java 7 Apr 2007 10:47:33 -0000 1.4 --- MasterPanel.java 27 May 2007 09:15:48 -0000 1.5 *************** *** 35,41 **** public class MasterPanel extends JPanel { ! private JButtonBar m_leftBar = new JButtonBar(JButtonBar.VERTICAL); ! private ButtonGroup m_leftGroup = new ButtonGroup(); ! private JPanel m_mainpanel = new JPanel(); private JScrollBar m_mainpanelVBar; private JScrollPane m_scrollpane; --- 35,41 ---- public class MasterPanel extends JPanel { ! private JButtonBar m_leftBar; ! private ButtonGroup m_leftGroup; ! private JPanel m_mainpanel; private JScrollBar m_mainpanelVBar; private JScrollPane m_scrollpane; *************** *** 48,99 **** private java.io.File m_modelLocation = null; ! private EditorPool m_edPool = new EditorPool(); private String m_currentPanelName = ""; ! private Object[] m_skelElements = { ! new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), ! new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() ! }; ! private Object[] m_execElements = { ! "GUI_LABEL_EXECUTABLE_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , ! new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , ! new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() ! }; ! private Object[] m_appElements = { ! "GUI_LABEL_APPLICATION_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.MainClass(), ! new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), ! "GUI_LABEL_EMBEDDEDJAR_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), ! new net.charabia.jsmoothgen.application.gui.editors.ClassPath() ! }; ! private Object[] m_jvmSelElements = { ! "GUI_LABEL_JAVA_VERSION", ! new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), ! new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), ! "GUI_LABEL_BUNDLEDJRE", ! new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), ! new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() ! }; ! private Object[] m_jvmCfgElements = { ! "GUI_LABEL_MEMORYSETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), ! new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), ! new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() ! }; ! private Object[] m_jsInfo = { ! new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() ! }; public MasterPanel() { setLayout(new BorderLayout()); add(BorderLayout.WEST, m_scrollpane = new JScrollPane(m_leftBar)); --- 48,171 ---- private java.io.File m_modelLocation = null; ! private EditorPool m_edPool; // = new EditorPool(); private String m_currentPanelName = ""; ! private Object[] m_skelElements, m_execElements, m_appElements, m_jvmSelElements, m_jvmCfgElements, m_jsInfo; ! // private Object[] m_skelElements = { ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() ! // // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() ! // }; ! // private Object[] m_execElements = { ! // "GUI_LABEL_EXECUTABLE_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , ! // new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , ! // new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() ! // }; ! // private Object[] m_appElements = { ! // "GUI_LABEL_APPLICATION_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.MainClass(), ! // new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), ! // "GUI_LABEL_EMBEDDEDJAR_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), ! // new net.charabia.jsmoothgen.application.gui.editors.ClassPath() ! // }; ! // private Object[] m_jvmSelElements = { ! // "GUI_LABEL_JAVA_VERSION", ! // new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), ! // new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), ! // "GUI_LABEL_BUNDLEDJRE", ! // new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), ! // new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() ! // }; ! // private Object[] m_jvmCfgElements = { ! // "GUI_LABEL_MEMORYSETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), ! // new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), ! // new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() ! // }; ! ! // private Object[] m_jsInfo = { ! // new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() ! // }; public MasterPanel() { + Main.setSplashProgress(10,100); + + // m_edPool = new EditorPool(); + Main.setSplashProgress(12,100); + m_leftBar = new JButtonBar(JButtonBar.VERTICAL); + m_leftGroup = new ButtonGroup(); + m_mainpanel = new JPanel(); + + Main.setSplashProgress(15,100); + + m_skelElements = new Object[] { + new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), + Main.setSplashProgress(18,100), + new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() + // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() + }; + Main.setSplashProgress(20,100); + + m_execElements = new Object[] { + "GUI_LABEL_EXECUTABLE_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , + Main.setSplashProgress(25,100), + new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , + Main.setSplashProgress(30,100), + new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() + }; + Main.setSplashProgress(40,100); + + m_appElements = new Object[] { + "GUI_LABEL_APPLICATION_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.MainClass(), + Main.setSplashProgress(35,100), + new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), + Main.setSplashProgress(40,100), + "GUI_LABEL_EMBEDDEDJAR_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), + Main.setSplashProgress(45,100), + new net.charabia.jsmoothgen.application.gui.editors.ClassPath() + }; + Main.setSplashProgress(50,100); + + m_jvmSelElements = new Object[] { + "GUI_LABEL_JAVA_VERSION", + new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), + Main.setSplashProgress(55,100), + new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), + Main.setSplashProgress(60,100), + "GUI_LABEL_BUNDLEDJRE", + new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), + Main.setSplashProgress(65,100), + new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() + }; + Main.setSplashProgress(70,100); + + m_jvmCfgElements = new Object[] { + "GUI_LABEL_MEMORYSETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), + Main.setSplashProgress(75,100), + new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), + Main.setSplashProgress(80,100), + new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() + }; + Main.setSplashProgress(85,100); + + m_jsInfo = new Object[] { + new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() + }; + + Main.setSplashProgress(90,100); + setLayout(new BorderLayout()); add(BorderLayout.WEST, m_scrollpane = new JScrollPane(m_leftBar)); *************** *** 105,108 **** --- 177,181 ---- m_mainpanel.setLayout(new RiverLayout()); + Main.setSplashProgress(92,100); addAction("Welcome", "/icons/stock_form-properties.png", m_jsInfo); addAction("Skeleton", "/icons/stock_new-template.png", m_skelElements); *************** *** 111,115 **** addAction("JVM Selection", "/icons/stock_search.png", m_jvmSelElements); addAction("JVM Configuration", "/icons/stock_form-properties.png", m_jvmCfgElements); ! setupPanel(m_jsInfo); } --- 184,189 ---- addAction("JVM Selection", "/icons/stock_search.png", m_jvmSelElements); addAction("JVM Configuration", "/icons/stock_form-properties.png", m_jvmCfgElements); ! Main.setSplashProgress(94,100); ! setupPanel(m_jsInfo); } *************** *** 157,164 **** JPanel pgroup = null; ! for (int i=0; i<els.length; i++) { ! if (els[i] instanceof Editor) { // Editor ed = m_edPool.getInstance(els[i]); --- 231,244 ---- JPanel pgroup = null; ! Main.setSplashProgress(50,100); for (int i=0; i<els.length; i++) { ! Main.setSplashProgress(55+(i*3),100); ! ! if (els[i] == null) ! { ! // to nothing... ! } ! else if (els[i] instanceof Editor) { // Editor ed = m_edPool.getInstance(els[i]); *************** *** 344,349 **** m_model.normalizePaths(m_modelLocation.getParentFile(), true); JSmoothModelPersistency.save(m_modelLocation, m_model); ! // System.out.println("saving model " + m_model); ! // fireModelChanged(); return true; } catch (java.io.IOException iox) --- 424,429 ---- m_model.normalizePaths(m_modelLocation.getParentFile(), true); JSmoothModelPersistency.save(m_modelLocation, m_model); ! System.out.println("saving model " + m_model); ! fireModelChanged(); return true; } catch (java.io.IOException iox) *************** *** 423,427 **** m_modelLocation = prjfile; } - public JSmoothModelBean getModel() --- 503,506 ---- |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:53
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/skeleton In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/skeleton Modified Files: SkeletonProperty.java Log Message: adds support for the splash screen in the jsmooth application Index: SkeletonProperty.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/skeleton/SkeletonProperty.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SkeletonProperty.java 7 Apr 2007 10:09:27 -0000 1.5 --- SkeletonProperty.java 27 May 2007 09:15:48 -0000 1.6 *************** *** 17,20 **** --- 17,21 ---- static public String TYPE_BOOLEAN = "boolean"; static public String TYPE_AUTODOWNLOADURL = "autodownloadurl"; + static public String TYPE_IMAGESELECTOR = "imgselector"; private String m_idName = ""; |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:52
|
Update of /cvsroot/jsmooth/jsmooth/src/locale In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/locale Modified Files: Texts.properties Texts_fr.properties Log Message: adds support for the splash screen in the jsmooth application Index: Texts.properties =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/locale/Texts.properties,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Texts.properties 18 May 2007 21:35:29 -0000 1.16 --- Texts.properties 27 May 2007 09:15:47 -0000 1.17 *************** *** 133,141 **** SKEL_WINSERVICE_INTERACTIVE_LABEL=Interactive service SKEL_WINSERVICE_INTERACTIVE_DESCRIPTION=Enable this value if the service shall be allowed by Windows to operate interactions with the desktop. <p> For security reasons, Microsoft recommands to use a client-server approach to add a GUI to a service. <p> If this option is not enabled, the application will not be able to create windows or use the desktop. Note also that if your service starts at startup, the desktop may not be available. ! # GENERAL_CANTOPENFILE=The JSmooth application couldn't open the file specified GENERAL_ERROR_LABEL=Error ! JSMOOTH_WELCOME_SCREEN=<h1>JSmooth release @{VERSION}@ @{RELEASEINFO}@</h1>\ <h2>Thanks for using JSmooth!</h2>\ --- 133,141 ---- SKEL_WINSERVICE_INTERACTIVE_LABEL=Interactive service SKEL_WINSERVICE_INTERACTIVE_DESCRIPTION=Enable this value if the service shall be allowed by Windows to operate interactions with the desktop. <p> For security reasons, Microsoft recommands to use a client-server approach to add a GUI to a service. <p> If this option is not enabled, the application will not be able to create windows or use the desktop. Note also that if your service starts at startup, the desktop may not be available. ! # # GENERAL_CANTOPENFILE=The JSmooth application couldn't open the file specified GENERAL_ERROR_LABEL=Error ! # JSMOOTH_WELCOME_SCREEN=<h1>JSmooth release @{VERSION}@ @{RELEASEINFO}@</h1>\ <h2>Thanks for using JSmooth!</h2>\ *************** *** 151,155 **** <li> Some wrappers also provide a <a href="docs/jniapi/index.html">JSmooth JNI API</a> to access Windows-specific function from your java program. \ </ul><h2>JSmooth Support</h2> \ ! Please submit any bug you may find to <a href="http://sourceforge.net/tracker/?group_id=86730">the jsmooth tracker</a>. Should you have any question, please use <a href="http://sourceforge.net/forum/?group_id=86730">the forum</a> (hosted at sourceforge's). # # --- 151,156 ---- <li> Some wrappers also provide a <a href="docs/jniapi/index.html">JSmooth JNI API</a> to access Windows-specific function from your java program. \ </ul><h2>JSmooth Support</h2> \ ! Please submit any bug you may find to <a href="http://sourceforge.net/tracker/?group_id=86730">the jsmooth tracker</a>. Should you have any question, please use <a href="http://sourceforge.net/forum/?group_id=86730">the forum</a> (hosted at sourceforge's).\ ! <p> Thanks to Sourceforge for hosting the project. <br> No Swing objects were hurt during the development of this tool. # # *************** *** 159,160 **** --- 160,164 ---- SKEL_GENERIC_JNISMOOTH=Use JNISmooth classes SKEL_GENERIC_JNISMOOTH_DESCRIPTION=When launched with JSmooth, your application can optionnally be provided the jsmooth.Native class, which offers functions that are not available from a standard JVM. If you don't use the jsmooth.Native class, you can leave this option disabled (although it won't harm). + # + SKEL_GENERIC_PROPERTY_SPLASH=Splash Window + SKEL_GENERIC_PROPERTY_SPLASH_DESCRIPTION=The wrapper can display an image at startup, while it loads the Java VM and starts your application. <br> The splash window is automatically closed when your application opens its first visible window, or at exit. <br> Note: it is possible use the JNI bridge provided by JSmooth to add a progress bar to the splash window or to close it programmatically. Index: Texts_fr.properties =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/locale/Texts_fr.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Texts_fr.properties 18 May 2007 21:35:29 -0000 1.11 --- Texts_fr.properties 27 May 2007 09:15:47 -0000 1.12 *************** *** 146,150 **** <li> Vous pouvez également utiliser <a href="docs/jniapi/index.html">l'API JNI de JSmooth</a> pour accéder à certaines fonctions spécifiques de Windows depuis votre application java.\ </ul><h2>Support utilisateurs</h2> \ ! Si vous rencontrez un bug, merci de le soumettre au <a href="http://sourceforge.net/tracker/?group_id=86730">tracker de jsmooth</a>. Si vous avez des questions sur l'utilisation de JSmooth, n'hésitez pas à utiliser <a href="http://sourceforge.net/forum/?group_id=86730">le forum</a> (anglais) sur sourceforge. # # --- 146,151 ---- <li> Vous pouvez également utiliser <a href="docs/jniapi/index.html">l'API JNI de JSmooth</a> pour accéder à certaines fonctions spécifiques de Windows depuis votre application java.\ </ul><h2>Support utilisateurs</h2> \ ! Si vous rencontrez un bug, merci de le soumettre au <a href="http://sourceforge.net/tracker/?group_id=86730">tracker de jsmooth</a>. Si vous avez des questions sur l'utilisation de JSmooth, n'hésitez pas à utiliser <a href="http://sourceforge.net/forum/?group_id=86730">le forum</a> (anglais) sur sourceforge.\ ! <p> Merci à Sourceforge pour l'hébergement du projet. <br> Aucun object Swing n'a été maltraité durant le développement de cet outil. # # *************** *** 154,155 **** --- 155,159 ---- SKEL_GENERIC_JNISMOOTH=Utiliser les classes JNI de JSmooth SKEL_GENERIC_JNISMOOTH_DESCRIPTION=JSmooth peut mettre à disposition de votre application certaines classes offrant un accès à des fonctions natives de Windows, qui ne sont normalement pas accessible depuis Java. Pour avoir accès à ces fonctionnalité, activez cette option. + # + SKEL_GENERIC_PROPERTY_SPLASH=Fenêtre Splash + SKEL_GENERIC_PROPERTY_SPLASH_DESCRIPTION=JSmooth peut prendre en charge l'affichage d'une image splash au démarrage, pendant que l'exécutable charge la VM Java et démarre votre application. <br> La fenêtre splash se ferme automatiquement dès que votre application ouvre une fenêtre ou quitte. <br> Note: il est possible d'utiliser le pont JNI fourni par JSmooth pour rajouter une barre de progression ou pour fermer la fenêtre depuis Java. |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:14:58
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/winservice In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14482/skeletons/winservice Modified Files: Makefile.win WinService.cpp Log Message: splash screen support and small overall refactoring Index: WinService.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/winservice/WinService.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WinService.cpp 19 May 2007 22:55:49 -0000 1.7 --- WinService.cpp 27 May 2007 09:14:52 -0000 1.8 *************** *** 1,406 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "WinService.h" ! ! #include "FileUtils.h" ! #include "StringUtils.h" ! ! #include "resource.h" ! ! #include "common.h" ! #include "ResourceManager.h" ! #include "JVMRegistryLookup.h" ! #include "JavaMachineManager.h" ! #include "JClassProxy.h" ! #include "JArgs.h" ! ! WinService* winservice_ref; ! ! ! void winservice_thread_support(void* param) ! { ! WinService* service = (WinService*)param; ! service->run(); ! } ! ! void winservice_ctrlhandler(DWORD ccode) ! { ! WinService* service = winservice_ref; ! service->serviceCtrlHandler(ccode); ! } ! ! ! WINAPI void *winservice_servicemain_support(DWORD argCount,LPSTR* arguments) ! { ! WinService* service = winservice_ref; ! service->serviceMain(argCount,arguments); ! } ! ! ! void winservice_thread_stop(void* param) ! { ! WinService* service = (WinService*)param; ! service->kill(); ! } ! ! WinService::WinService(const std::string& name, const std::string& filename) ! { ! m_log = new Log(filename); ! m_log->out("Constructing winservice object " + name); ! ! m_jvm = 0; ! m_status_checkpoint = 0; ! ! m_serviceName = name; ! m_serviceDescription = ""; ! m_autostart = false; ! ! strcpy(m_cname, m_serviceName.c_str()); ! m_dispatchTable[0].lpServiceName = m_cname; ! m_dispatchTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)winservice_servicemain_support; ! m_dispatchTable[1].lpServiceName = 0; ! m_dispatchTable[1].lpServiceProc = 0; ! winservice_ref = this; ! } ! ! WinService::~WinService() ! { ! if (m_jvm != 0) ! { ! SunJVMDLL* runner = m_jvm->getDLL(); ! log("Calling java.lang.System.exit(0)..."); ! ! JClassProxy disp(runner, "java.lang.System"); ! disp.invokeStatic("void exit(int)", JArgs(0)); ! log("exit(0) returned successfully"); ! ! // m_jvm->callDLLStaticMethodInt("java.lang.System", "exit", "(I)V", 0); ! } ! } ! ! void WinService::connect() ! { ! log(std::string("setting up a connection with the control dispatcher (") + getName() + ")"); ! ! int handle = StartServiceCtrlDispatcher(m_dispatchTable); ! if (handle == 0) ! { ! int err = GetLastError(); ! printf("connect error %d (%d)!\n", err, ERROR_INVALID_DATA); ! } ! } ! ! bool WinService::install() ! { ! log(std::string("Installation of ") + getName()); ! ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! std::string exepath = FileUtils::concFile(FileUtils::getExecutablePath(), FileUtils::getExecutableFileName()); ! ! HANDLE service = (HANDLE)CreateService((SC_HANDLE)scman, m_cname, ! m_serviceDisplayName.c_str(), // service name to display ! SERVICE_ALL_ACCESS, // desired access ! SERVICE_WIN32_OWN_PROCESS | (m_interactive?SERVICE_INTERACTIVE_PROCESS:0), // service type ! m_autostart?SERVICE_AUTO_START:SERVICE_DEMAND_START, // start type ! SERVICE_ERROR_NORMAL, // error control type ! exepath.c_str(), // service's binary ! NULL, // no load ordering group ! NULL, // no tag identifier ! NULL, // no dependencies ! NULL, // LocalSystem account ! NULL); // no password ! ! CloseServiceHandle((SC_HANDLE)scman); ! ! if (service == 0) ! { ! log("Failed to install!"); ! return false; ! } ! ! log("Service installed!"); ! return true; ! } ! ! ! bool WinService::uninstall() ! { ! bool result = false; ! ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return result; ! std::string exepath = FileUtils::getExecutablePath(); ! ! SC_HANDLE service = OpenService( ! (SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! result = DeleteService(service ); ! } ! ! log("Service uninstalled!"); ! ! CloseServiceHandle((SC_HANDLE)scman); ! return result; ! } ! ! bool WinService::setStatus(int currentState) ! { ! SERVICE_STATUS status; ! std::string meaning = ""; ! switch(currentState) ! { ! case SERVICE_STOPPED: ! meaning = "SERVICE_STOPPED"; ! break; ! case SERVICE_START_PENDING: ! meaning = "SERVICE_START_PENDING"; ! break; ! case SERVICE_STOP_PENDING: ! meaning = "SERVICE_STOP_PENDING"; ! break; ! case SERVICE_RUNNING: ! meaning = "SERVICE_RUNNING"; ! break; ! case SERVICE_CONTINUE_PENDING: ! meaning = "SERVICE_CONTINUE_PENDING"; ! break; ! case SERVICE_PAUSE_PENDING: ! meaning = "SERVICE_PAUSE_PENDING"; ! break; ! case SERVICE_PAUSED: ! meaning = "SERVICE_PAUSED"; ! break; ! } ! ! log("set status " + StringUtils::toString(currentState) + " (" + meaning + ")"); ! ! status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ! status.dwCurrentState = currentState; ! if ( currentState==SERVICE_START_PENDING ) ! status.dwControlsAccepted=0; ! else ! status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ! status.dwWin32ExitCode = NO_ERROR; ! status.dwServiceSpecificExitCode = 0; ! status.dwCheckPoint = m_status_checkpoint++; ! status.dwWaitHint = 60*1000; ! ! return SetServiceStatus(m_serviceStatusHandle,&status); ! ! } ! ! const char* WinService::getName() const ! { ! return m_cname; ! } ! ! void WinService::log(const std::string& msg) const ! { ! m_log->out(msg); ! } ! ! void WinService::log(const char* msg) const ! { ! m_log->out(msg); ! } ! ! void WinService::serviceMain(DWORD argCount,LPSTR* arguments) ! { ! log(std::string("in service main... (") + StringUtils::toString(argCount) + std::string(" args)")); ! for (int i=0; i<argCount; i++) ! { ! log( std::string("argument ") + StringUtils::toString(i) + ": " + arguments[i]); ! } ! m_serviceStatusHandle = RegisterServiceCtrlHandler(getName(), ! (LPHANDLER_FUNCTION)winservice_ctrlhandler); ! ! setStatus(SERVICE_START_PENDING); ! ! m_stopEventHandle = CreateEvent(NULL,TRUE, FALSE,NULL); ! ! if (!setStatus(SERVICE_START_PENDING)) ! return; ! ! m_serviceThread.start(winservice_thread_support, (void*)this); ! setStatus(SERVICE_RUNNING); ! m_serviceThread.join(); ! setStatus(SERVICE_STOPPED); ! } ! ! void WinService::serviceCtrlHandler(DWORD nControlCode) ! { ! switch(nControlCode) ! { ! case SERVICE_CONTROL_SHUTDOWN: ! case SERVICE_CONTROL_STOP: ! setStatus(SERVICE_STOP_PENDING); ! m_serviceThread.start(winservice_thread_stop, (void*)this); ! return; ! ! default: ! break; ! } ! ! setStatus(SERVICE_RUNNING); ! } ! ! void WinService::run() ! { ! setStatus(SERVICE_START_PENDING); ! log("Run..."); ! ! ResourceManager* globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID); ! ! // ! // sets up the debug mode, if requested ! std::string dodebug = globalResMan->getProperty("skel_Debug"); ! dodebug = "1"; ! if (StringUtils::parseInt(dodebug) != 0) ! { ! globalResMan->printDebug(); ! } ! ! JavaMachineManager man(*globalResMan); ! man.setAcceptExe(false); ! man.setAcceptDLL(true); ! man.setUseConsole(false); ! man.setPreferDLL(true); ! ! setStatus(SERVICE_RUNNING); ! SunJVMLauncher* launcher = man.runDLLFromRegistry(true); ! ! if (launcher != 0) ! { ! m_jvm = launcher; ! log("JVM found and instanciated successfully (" + launcher->toString() + ")"); ! ! setStatus(SERVICE_RUNNING); ! ! SunJVMDLL* jdll = m_jvm->getDLL(); ! if (jdll != 0) ! { ! jdll->run( globalResMan->getProperty(ResourceManager::KEY_MAINCLASSNAME), true); ! } ! else ! log("ERROR: JVM is launched, but can't get a DLL... ?"); ! ! } ! else ! { ! log("ERROR: could not find any suitable Java Virtual Machine"); ! std::string errmsg = globalResMan->getProperty("skel_Message"); ! MessageBox(NULL, ! errmsg.c_str(), FileUtils::getExecutableFileName().c_str(), ! MB_OK|MB_ICONQUESTION|MB_APPLMODAL); ! } ! ! setStatus(SERVICE_STOPPED); ! return; ! } ! ! void WinService::kill() ! { ! log("Stopping the service..."); ! if (m_jvm != 0) ! { ! setStatus(SERVICE_STOPPED); ! // We are never here for a very long time, as the ! // SERVICE_STOPPED signal kills this thread asap. Therefore, we ! // do nothing here, we delay the java.lang.System.exit() call to ! // the destructor of this class ! } ! else ! log("no jvm available"); ! } ! ! bool WinService::startService() ! { ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! ! SC_HANDLE service = OpenService((SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! return StartService(service, 0, NULL); ! } ! ! return false; ! } ! ! bool WinService::stopService() ! { ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! ! SC_HANDLE service = OpenService((SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! SERVICE_STATUS status; ! ! status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ! status.dwCurrentState = SERVICE_STOP_PENDING; ! status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ! status.dwWin32ExitCode = NO_ERROR; ! status.dwServiceSpecificExitCode = 0; ! status.dwCheckPoint = m_status_checkpoint++; ! status.dwWaitHint = 60*1000; ! ! return ControlService(service, SERVICE_CONTROL_STOP, &status); ! } ! ! return false; ! } ! ! ! void WinService::setDescription(const std::string& description) ! { ! m_serviceDescription = description; ! } ! ! void WinService::setAutostart(bool b) ! { ! m_autostart = b; ! } ! ! void WinService::setInteractive(bool b) ! { ! m_interactive = b; ! } ! ! void WinService::setDisplayName(const std::string& displayname) ! { ! m_serviceDisplayName = displayname; ! } --- 1,413 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "WinService.h" ! ! #include "FileUtils.h" ! #include "StringUtils.h" ! ! #include "resource.h" ! #include <vector> ! ! #include "common.h" ! #include "ResourceManager.h" ! #include "JVMRegistryLookup.h" ! #include "JavaMachineManager.h" ! #include "JClassProxy.h" ! #include "JArgs.h" ! #include "JniSmoothRegister.h" ! #include "JNIRegister.h" ! ! WinService* winservice_ref; ! ! ! void winservice_thread_support(void* param) ! { ! WinService* service = (WinService*)param; ! service->run(); ! } ! ! void winservice_ctrlhandler(DWORD ccode) ! { ! WinService* service = winservice_ref; ! service->serviceCtrlHandler(ccode); ! } ! ! ! WINAPI void *winservice_servicemain_support(DWORD argCount,LPSTR* arguments) ! { ! WinService* service = winservice_ref; ! service->serviceMain(argCount,arguments); ! } ! ! ! void winservice_thread_stop(void* param) ! { ! WinService* service = (WinService*)param; ! service->kill(); ! } ! ! WinService::WinService(const std::string& name, const std::string& filename) ! { ! m_log = new Log(filename); ! m_log->out("Constructing winservice object " + name); ! ! m_jvm = 0; ! m_status_checkpoint = 0; ! ! m_serviceName = name; ! m_serviceDescription = ""; ! m_autostart = false; ! ! strcpy(m_cname, m_serviceName.c_str()); ! m_dispatchTable[0].lpServiceName = m_cname; ! m_dispatchTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)winservice_servicemain_support; ! m_dispatchTable[1].lpServiceName = 0; ! m_dispatchTable[1].lpServiceProc = 0; ! winservice_ref = this; ! } ! ! WinService::~WinService() ! { ! if (m_jvm != 0) ! { ! SunJVMDLL* runner = m_jvm->getDLL(); ! log("Calling java.lang.System.exit(0)..."); ! ! JClassProxy disp(runner, "java.lang.System"); ! disp.invokeStatic("void exit(int)", JArgs(0)); ! log("exit(0) returned successfully"); ! ! // m_jvm->callDLLStaticMethodInt("java.lang.System", "exit", "(I)V", 0); ! } ! } ! ! void WinService::connect() ! { ! log(std::string("setting up a connection with the control dispatcher (") + getName() + ")"); ! ! int handle = StartServiceCtrlDispatcher(m_dispatchTable); ! if (handle == 0) ! { ! int err = GetLastError(); ! printf("connect error %d (%d)!\n", err, ERROR_INVALID_DATA); ! } ! } ! ! bool WinService::install() ! { ! log(std::string("Installation of ") + getName()); ! ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! std::string exepath = FileUtils::concFile(FileUtils::getExecutablePath(), FileUtils::getExecutableFileName()); ! ! HANDLE service = (HANDLE)CreateService((SC_HANDLE)scman, m_cname, ! m_serviceDisplayName.c_str(), // service name to display ! SERVICE_ALL_ACCESS, // desired access ! SERVICE_WIN32_OWN_PROCESS | (m_interactive?SERVICE_INTERACTIVE_PROCESS:0), // service type ! m_autostart?SERVICE_AUTO_START:SERVICE_DEMAND_START, // start type ! SERVICE_ERROR_NORMAL, // error control type ! exepath.c_str(), // service's binary ! NULL, // no load ordering group ! NULL, // no tag identifier ! NULL, // no dependencies ! NULL, // LocalSystem account ! NULL); // no password ! ! CloseServiceHandle((SC_HANDLE)scman); ! ! if (service == 0) ! { ! log("Failed to install!"); ! return false; ! } ! ! log("Service installed!"); ! return true; ! } ! ! ! bool WinService::uninstall() ! { ! bool result = false; ! ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return result; ! std::string exepath = FileUtils::getExecutablePath(); ! ! SC_HANDLE service = OpenService( ! (SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! result = DeleteService(service ); ! } ! ! log("Service uninstalled!"); ! ! CloseServiceHandle((SC_HANDLE)scman); ! return result; ! } ! ! bool WinService::setStatus(int currentState) ! { ! SERVICE_STATUS status; ! std::string meaning = ""; ! switch(currentState) ! { ! case SERVICE_STOPPED: ! meaning = "SERVICE_STOPPED"; ! break; ! case SERVICE_START_PENDING: ! meaning = "SERVICE_START_PENDING"; ! break; ! case SERVICE_STOP_PENDING: ! meaning = "SERVICE_STOP_PENDING"; ! break; ! case SERVICE_RUNNING: ! meaning = "SERVICE_RUNNING"; ! break; ! case SERVICE_CONTINUE_PENDING: ! meaning = "SERVICE_CONTINUE_PENDING"; ! break; ! case SERVICE_PAUSE_PENDING: ! meaning = "SERVICE_PAUSE_PENDING"; ! break; ! case SERVICE_PAUSED: ! meaning = "SERVICE_PAUSED"; ! break; ! } ! ! log("set status " + StringUtils::toString(currentState) + " (" + meaning + ")"); ! ! status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ! status.dwCurrentState = currentState; ! if ( currentState==SERVICE_START_PENDING ) ! status.dwControlsAccepted=0; ! else ! status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ! status.dwWin32ExitCode = NO_ERROR; ! status.dwServiceSpecificExitCode = 0; ! status.dwCheckPoint = m_status_checkpoint++; ! status.dwWaitHint = 60*1000; ! ! return SetServiceStatus(m_serviceStatusHandle,&status); ! ! } ! ! const char* WinService::getName() const ! { ! return m_cname; ! } ! ! void WinService::log(const std::string& msg) const ! { ! m_log->out(msg); ! } ! ! void WinService::log(const char* msg) const ! { ! m_log->out(msg); ! } ! ! void WinService::serviceMain(DWORD argCount,LPSTR* arguments) ! { ! log(std::string("in service main... (") + StringUtils::toString(argCount) + std::string(" args)")); ! for (int i=0; i<argCount; i++) ! { ! log( std::string("argument ") + StringUtils::toString(i) + ": " + arguments[i]); ! } ! m_serviceStatusHandle = RegisterServiceCtrlHandler(getName(), ! (LPHANDLER_FUNCTION)winservice_ctrlhandler); ! ! setStatus(SERVICE_START_PENDING); ! ! m_stopEventHandle = CreateEvent(NULL,TRUE, FALSE,NULL); ! ! if (!setStatus(SERVICE_START_PENDING)) ! return; ! ! m_serviceThread.start(winservice_thread_support, (void*)this); ! setStatus(SERVICE_RUNNING); ! m_serviceThread.join(); ! setStatus(SERVICE_STOPPED); ! } ! ! void WinService::serviceCtrlHandler(DWORD nControlCode) ! { ! switch(nControlCode) ! { ! case SERVICE_CONTROL_SHUTDOWN: ! case SERVICE_CONTROL_STOP: ! setStatus(SERVICE_STOP_PENDING); ! m_serviceThread.start(winservice_thread_stop, (void*)this); ! return; ! ! default: ! break; ! } ! ! setStatus(SERVICE_RUNNING); ! } ! ! void WinService::run() ! { ! setStatus(SERVICE_START_PENDING); ! log("Run..."); ! ! ResourceManager* globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID); ! ! // ! // sets up the debug mode, if requested ! std::string dodebug = globalResMan->getProperty("skel_Debug"); ! dodebug = "1"; ! if (StringUtils::parseInt(dodebug) != 0) ! { ! globalResMan->printDebug(); ! } ! ! vector<JNIRegister*> jnireg; ! jnireg.push_back(new JniSmoothRegister()); ! ! JavaMachineManager man(*globalResMan); ! man.setJNI(jnireg); ! man.setAcceptExe(false); ! man.setAcceptDLL(true); ! man.setUseConsole(false); ! man.setPreferDLL(true); ! ! setStatus(SERVICE_RUNNING); ! SunJVMLauncher* launcher = man.runDLLFromRegistry(true); ! ! if (launcher != 0) ! { ! m_jvm = launcher; ! log("JVM found and instanciated successfully (" + launcher->toString() + ")"); ! ! setStatus(SERVICE_RUNNING); ! ! SunJVMDLL* jdll = m_jvm->getDLL(); ! if (jdll != 0) ! { ! jdll->run( globalResMan->getProperty(ResourceManager::KEY_MAINCLASSNAME), true); ! } ! else ! log("ERROR: JVM is launched, but can't get a DLL... ?"); ! ! } ! else ! { ! log("ERROR: could not find any suitable Java Virtual Machine"); ! std::string errmsg = globalResMan->getProperty("skel_Message"); ! MessageBox(NULL, ! errmsg.c_str(), FileUtils::getExecutableFileName().c_str(), ! MB_OK|MB_ICONQUESTION|MB_APPLMODAL); ! } ! ! setStatus(SERVICE_STOPPED); ! return; ! } ! ! void WinService::kill() ! { ! log("Stopping the service..."); ! if (m_jvm != 0) ! { ! setStatus(SERVICE_STOPPED); ! // We are never here for a very long time, as the ! // SERVICE_STOPPED signal kills this thread asap. Therefore, we ! // do nothing here, we delay the java.lang.System.exit() call to ! // the destructor of this class ! } ! else ! log("no jvm available"); ! } ! ! bool WinService::startService() ! { ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! ! SC_HANDLE service = OpenService((SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! return StartService(service, 0, NULL); ! } ! ! return false; ! } ! ! bool WinService::stopService() ! { ! HANDLE scman = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); ! if (scman == 0) ! return false; ! ! SC_HANDLE service = OpenService((SC_HANDLE)scman, // handle to service control manager database ! m_cname, // pointer to name of service to start ! SERVICE_ALL_ACCESS // type of access to service ! ); ! if (service != 0) ! { ! SERVICE_STATUS status; ! ! status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ! status.dwCurrentState = SERVICE_STOP_PENDING; ! status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ! status.dwWin32ExitCode = NO_ERROR; ! status.dwServiceSpecificExitCode = 0; ! status.dwCheckPoint = m_status_checkpoint++; ! status.dwWaitHint = 60*1000; ! ! return ControlService(service, SERVICE_CONTROL_STOP, &status); ! } ! ! return false; ! } ! ! ! void WinService::setDescription(const std::string& description) ! { ! m_serviceDescription = description; ! } ! ! void WinService::setAutostart(bool b) ! { ! m_autostart = b; ! } ! ! void WinService::setInteractive(bool b) ! { ! m_interactive = b; ! } ! ! void WinService::setDisplayName(const std::string& displayname) ! { ! m_serviceDisplayName = displayname; ! } Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/winservice/Makefile.win,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.win 18 May 2007 21:34:00 -0000 1.4 --- Makefile.win 27 May 2007 09:14:52 -0000 1.5 *************** *** 9,16 **** RES = winservice_private.res OBJ = main.o $(RES) LINKOBJ = WinService.o main.o $(RES) ! LIBS = -L"/lib" -L"../commonjava" -L"../util-core" ../commonjava/CommonJava.a ../util-core/util-core.a INCS = -I"/include" -I"../util-core" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -I"/include/c++" -I"/include/c++/mingw32" -I"/include/c++/backward" -I"/include" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I../util-core BIN = winservice.exe CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" --- 9,18 ---- RES = winservice_private.res OBJ = main.o $(RES) + FLTK-LDFLAGS = $(shell fltk-config --use-images --ldflags ) + FLTK-CXXFLAGS = $(shell fltk-config --use-images --cxxflags ) LINKOBJ = WinService.o main.o $(RES) ! LIBS = -L"/lib" -L"../commonjava" -L"../util-core" ../commonjava/CommonJava.a ../util-core/util-core.a ../jnismooth/jnismooth.a ../util-gui/util-gui.a $(FLTK-LDFLAGS) -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg INCS = -I"/include" -I"../util-core" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -I"/include/c++" -I"/include/c++/mingw32" -I"/include/c++/backward" -I"/include" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I../util-core -I../jnismooth BIN = winservice.exe CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:14:57
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/util-net In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14482/skeletons/util-net Modified Files: httpdownload.cpp Log Message: splash screen support and small overall refactoring Index: httpdownload.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-net/httpdownload.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** httpdownload.cpp 16 May 2007 22:04:19 -0000 1.4 --- httpdownload.cpp 27 May 2007 09:14:52 -0000 1.5 *************** *** 1,137 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "httpdownload.h" ! ! #include "Thread.h" ! ! #include <stdlib.h> ! ! Fl_Window *httpWindow ; ! WinHttpClient httpClient; ! char downloadLabel[256]; ! unsigned long downloadThread; ! HttpUpdater updater; ! ! void HttpUpdater::httpDownloadUpdate(int current, int total) ! { ! Fl::lock(); ! hcg_progressbar->maximum((float)total); ! hcg_progressbar->value((float)current); ! ! if (total != 0) ! sprintf(downloadLabel, "Downloading %d%%", (current*100)/total); ! else ! sprintf(downloadLabel, "Downloading..."); ! ! printf("%s\n", downloadLabel); ! ! hcg_progressbar->label(downloadLabel); ! hcg_progressbar->redraw(); ! Fl::unlock(); ! } ! ! // ! // A timeout'ed method to refresh the progress bar display ! // ! void updateProgressBar(void*p) ! { ! hcg_progressbar->redraw(); ! Fl::repeat_timeout(0.15, updateProgressBar); ! } ! ! // ! // The struct for the download thread ! // ! struct downloadThreadParams ! { ! std::string outputFile; ! bool downloadResult; ! }; ! ! ! // ! // The download thread... it sets up the http client class and sends ! // the requests. ! // ! void downloadHttpThread(void* param) ! { ! downloadThreadParams* dparam = (downloadThreadParams*)param; ! ! std::string outputFile = (std::string) dparam->outputFile; ! ! URL urltarget(outputFile); ! httpClient.addListener(updater); ! httpClient.setURL(urltarget); ! map<string,string> headr; ! httpClient.sendGet(); ! if (httpClient.saveResponseBody()) ! dparam->downloadResult = true; ! else ! dparam->downloadResult = false; ! ! Fl::lock(); ! httpWindow->hide(); ! Fl::unlock(); ! } ! ! ! // ! // Callback for the cancel button ! // ! void cancelDownload(Fl_Widget* param) ! { ! httpClient.cancel(); ! ! Fl::lock(); ! httpWindow->hide(); ! Fl::unlock(); ! } ! ! // ! // The main download class... it spawns a thread that runs the ! // download, and waits for it to complete. ! std::string httpDownload(const std::string& url) ! { ! httpWindow = make_window_downloadgui(); ! httpWindow->end(); ! char bu[0][0]; ! httpWindow->show(0, (char**)bu); ! ! hcg_cancelbutton->callback(cancelDownload); ! ! downloadThreadParams params; ! params.outputFile = url; ! params.downloadResult = false; ! ! Thread th; ! th.start(downloadHttpThread, ¶ms); ! ! Fl::add_timeout(1.0, updateProgressBar); ! Fl::run(); ! ! if (httpClient.isCancelled()) ! return ""; ! ! if (params.downloadResult) ! return httpClient.getTemporaryFile(); ! else ! return ""; ! } --- 1,137 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "httpdownload.h" ! ! #include "Thread.h" ! ! #include <stdlib.h> ! ! Fl_Window *httpWindow ; ! WinHttpClient httpClient; ! char downloadLabel[256]; ! unsigned long downloadThread; ! HttpUpdater updater; ! ! void HttpUpdater::httpDownloadUpdate(int current, int total) ! { ! Fl::lock(); ! hcg_progressbar->maximum((float)total); ! hcg_progressbar->value((float)current); ! ! if (total != 0) ! sprintf(downloadLabel, "Downloading %d%%", (current*100)/total); ! else ! sprintf(downloadLabel, "Downloading..."); ! ! printf("%s\n", downloadLabel); ! ! hcg_progressbar->label(downloadLabel); ! hcg_progressbar->redraw(); ! Fl::unlock(); ! } ! ! // ! // A timeout'ed method to refresh the progress bar display ! // ! void updateProgressBar(void*p) ! { ! hcg_progressbar->redraw(); ! Fl::repeat_timeout(0.15, updateProgressBar); ! } ! ! // ! // The struct for the download thread ! // ! struct downloadThreadParams ! { ! std::string outputFile; ! bool downloadResult; ! }; ! ! ! // ! // The download thread... it sets up the http client class and sends ! // the requests. ! // ! void downloadHttpThread(void* param) ! { ! downloadThreadParams* dparam = (downloadThreadParams*)param; ! ! std::string outputFile = (std::string) dparam->outputFile; ! ! URL urltarget(outputFile); ! httpClient.addListener(updater); ! httpClient.setURL(urltarget); ! map<string,string> headr; ! httpClient.sendGet(); ! if (httpClient.saveResponseBody()) ! dparam->downloadResult = true; ! else ! dparam->downloadResult = false; ! ! Fl::lock(); ! httpWindow->hide(); ! Fl::unlock(); ! } ! ! ! // ! // Callback for the cancel button ! // ! void cancelDownload(Fl_Widget* param) ! { ! httpClient.cancel(); ! ! Fl::lock(); ! httpWindow->hide(); ! Fl::unlock(); ! } ! ! // ! // The main download class... it spawns a thread that runs the ! // download, and waits for it to complete. ! std::string httpDownload(const std::string& url) ! { ! httpWindow = make_window_downloadgui(); ! httpWindow->end(); ! char bu[0][0]; ! httpWindow->show(0, (char**)bu); ! ! hcg_cancelbutton->callback(cancelDownload); ! ! downloadThreadParams params; ! params.outputFile = url; ! params.downloadResult = false; ! ! Thread th; ! th.start(downloadHttpThread, ¶ms); ! ! Fl::add_timeout(1.0, updateProgressBar); ! Fl::run(); ! ! if (httpClient.isCancelled()) ! return ""; ! ! if (params.downloadResult) ! return httpClient.getTemporaryFile(); ! else ! return ""; ! } |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:14:57
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/util-core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14482/skeletons/util-core Modified Files: Thread.cpp Thread.h Process.cpp Makefile.win Process.h SingleInstanceManager.cpp testmain.cpp Added Files: md5.h RegistryKey.cpp RegistryKey.h md5.c Log Message: splash screen support and small overall refactoring Index: SingleInstanceManager.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/SingleInstanceManager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SingleInstanceManager.cpp 18 May 2007 21:34:00 -0000 1.2 --- SingleInstanceManager.cpp 27 May 2007 09:14:52 -0000 1.3 *************** *** 1,177 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "SingleInstanceManager.h" ! ! #include <windows.h> ! #include <winbase.h> ! ! void pipe_wait_callback(void* param) ! { ! SingleInstanceManager* sim = (SingleInstanceManager*)param; ! while (true) ! { ! std::string msg = sim->waitPipeMessage(); ! printf("Got MESSAGE: %s\n", msg.c_str()); ! sim->processMessage(msg); ! fflush(stdout); ! } ! } ! ! ! SingleInstanceManager::SingleInstanceManager() ! { ! std::string name = "{"+FileUtils::getExecutablePath() + "::" + FileUtils::getExecutableFileName() + "}"; ! name = StringUtils::replace(name, "\\", ":"); ! init(name); ! } ! ! SingleInstanceManager::SingleInstanceManager(const std::string& uniqueName) ! { ! init(uniqueName); ! } ! ! SingleInstanceManager::~SingleInstanceManager() ! { ! if (m_mutex != NULL) ! CloseHandle(m_mutex); ! } ! ! void SingleInstanceManager::init(const std::string& uniqname) ! { ! m_name = uniqname; ! m_mutex = CreateMutex(NULL, FALSE, uniqname.c_str()); //do early ! m_lasterror = GetLastError(); //save for use later... ! m_alreadyexists = (m_lasterror == ERROR_ALREADY_EXISTS)?true:false; ! } ! ! void SingleInstanceManager::startMasterInstanceServer() ! { ! if (!m_alreadyexists) ! { ! m_pipethread.start(pipe_wait_callback, this); ! } ! } ! ! void SingleInstanceManager::sendMessageInstanceShow() ! { ! char *message = "SHOWWINDOW PLZ"; ! DWORD msglen = strlen(message); ! char bufferout[256]; ! DWORD lenout = 255, readlen=0; ! ! CallNamedPipe(getPipeName().c_str(), ! message, msglen, ! bufferout, lenout, ! &readlen, ! 2); ! ! } ! ! bool SingleInstanceManager::alreadyExists() ! { ! return m_alreadyexists; ! } ! ! std::string SingleInstanceManager::waitPipeMessage() ! { ! std::string result = ""; ! ! std::string pipename = getPipeName(); ! ! m_pipe = CreateNamedPipe(pipename.c_str(), ! PIPE_ACCESS_DUPLEX, ! PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, ! 6, ! 256, ! 256, ! NMPWAIT_USE_DEFAULT_WAIT, ! NULL); ! ! if (m_pipe == INVALID_HANDLE_VALUE) ! { ! m_pipe = NULL; ! return ""; ! } ! ! if (ConnectNamedPipe(m_pipe, NULL)) ! { ! printf("waitPipeMessage...\n"); ! fflush(stdout); ! ! printf("connected to named pipe...\n"); ! fflush(stdout); ! char buffer[256]; ! DWORD length; ! ! bool res = ReadFile(m_pipe, buffer, sizeof(buffer), &length, NULL); ! buffer[length] = 0; ! printf("read file %s\n", buffer); ! fflush(stdout); ! ! if (res && (length>0)) ! { ! bool res = WriteFile(m_pipe, buffer, strlen(buffer), &length, NULL); ! result = buffer; ! } ! ! DisconnectNamedPipe(m_pipe); ! } ! ! CloseHandle(m_pipe); ! ! return result; ! } ! ! BOOL CALLBACK displayWindowForProcess(HWND hwnd, LPARAM lParam ) ! { ! DWORD myprocessid = GetCurrentProcessId(); ! DWORD hid; ! GetWindowThreadProcessId(hwnd, &hid); ! printf("Checking %d, %d, %d\n", hwnd, hid, myprocessid); fflush(stdout); ! if (hid == myprocessid) ! { ! LONG style = GetWindowLong(hwnd, GWL_STYLE); ! if ((style & (WS_VISIBLE)) != 0) ! { ! SetForegroundWindow(hwnd); ! return false; ! } ! } ! return true; ! } ! ! void SingleInstanceManager::processMessage(const std::string& msg) ! { ! printf("PROCESSING MESSAGE\n"); ! fflush(stdout); ! EnumWindows(displayWindowForProcess, 0); ! } ! ! std::string SingleInstanceManager::getPipeName() ! { ! std::string pipename = "\\\\.\\pipe\\"; ! if (m_name.length() > (255-9)) ! pipename += m_name.substr( m_name.length() - (255-9) ); ! else ! pipename += m_name; ! ! return pipename; ! } --- 1,166 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "SingleInstanceManager.h" ! ! #include <windows.h> ! #include <winbase.h> ! ! ! void pipe_wait_callback(void* param) ! { ! SingleInstanceManager* sim = (SingleInstanceManager*)param; ! while (true) ! { ! std::string msg = sim->waitPipeMessage(); ! sim->processMessage(msg); ! } ! } ! ! SingleInstanceManager::SingleInstanceManager() ! { ! std::string name = "{"+FileUtils::getExecutablePath() + "::" + FileUtils::getExecutableFileName() + "}"; ! name = StringUtils::replace(name, "\\", ":"); ! init(name); ! } ! ! SingleInstanceManager::SingleInstanceManager(const std::string& uniqueName) ! { ! init(uniqueName); ! } ! ! SingleInstanceManager::~SingleInstanceManager() ! { ! if (m_mutex != NULL) ! CloseHandle(m_mutex); ! } ! ! void SingleInstanceManager::init(const std::string& uniqname) ! { ! m_name = uniqname; ! m_mutex = CreateMutex(NULL, FALSE, uniqname.c_str()); //do early ! m_lasterror = GetLastError(); //save for use later... ! m_alreadyexists = (m_lasterror == ERROR_ALREADY_EXISTS)?true:false; ! } ! ! void SingleInstanceManager::startMasterInstanceServer() ! { ! if (!m_alreadyexists) ! { ! m_pipethread.start(pipe_wait_callback, this); ! } ! } ! ! void SingleInstanceManager::sendMessageInstanceShow() ! { ! char *message = "SHOWWINDOW PLZ"; ! DWORD msglen = strlen(message); ! char bufferout[256]; ! DWORD lenout = 255, readlen=0; ! ! CallNamedPipe(getPipeName().c_str(), ! message, msglen, ! bufferout, lenout, ! &readlen, ! 2); ! ! } ! ! bool SingleInstanceManager::alreadyExists() ! { ! return m_alreadyexists; ! } ! ! std::string SingleInstanceManager::waitPipeMessage() ! { ! std::string result = ""; ! ! std::string pipename = getPipeName(); ! ! m_pipe = CreateNamedPipe(pipename.c_str(), ! PIPE_ACCESS_DUPLEX, ! PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, ! 6, ! 256, ! 256, ! NMPWAIT_USE_DEFAULT_WAIT, ! NULL); ! ! if (m_pipe == INVALID_HANDLE_VALUE) ! { ! m_pipe = NULL; ! return ""; ! } ! ! if (ConnectNamedPipe(m_pipe, NULL)) ! { ! char buffer[256]; ! DWORD length; ! ! bool res = ReadFile(m_pipe, buffer, sizeof(buffer), &length, NULL); ! buffer[length] = 0; ! ! if (res && (length>0)) ! { ! bool res = WriteFile(m_pipe, buffer, strlen(buffer), &length, NULL); ! result = buffer; ! } ! ! DisconnectNamedPipe(m_pipe); ! } ! ! CloseHandle(m_pipe); ! ! return result; ! } ! ! BOOL CALLBACK displayWindowForProcess(HWND hwnd, LPARAM lParam ) ! { ! DWORD myprocessid = GetCurrentProcessId(); ! DWORD hid; ! GetWindowThreadProcessId(hwnd, &hid); ! ! if (hid == myprocessid) ! { ! LONG style = GetWindowLong(hwnd, GWL_STYLE); ! if ((style & (WS_VISIBLE)) != 0) ! { ! SetForegroundWindow(hwnd); ! return false; ! } ! } ! return true; ! } ! ! void SingleInstanceManager::processMessage(const std::string& msg) ! { ! EnumWindows(displayWindowForProcess, 0); ! } ! ! std::string SingleInstanceManager::getPipeName() ! { ! std::string pipename = "\\\\.\\pipe\\"; ! if (m_name.length() > (255-9)) ! pipename += m_name.substr( m_name.length() - (255-9) ); ! else ! pipename += m_name; ! ! return pipename; ! } --- NEW FILE: md5.h --- /* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch gh...@al... */ /* $Id: md5.h,v 1.1 2007/05/27 09:14:51 reyes Exp $ */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.h is L. Peter Deutsch <gh...@al...>. Other authors are noted in the change history that follows (in reverse chronological order): 2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke <pur...@bn...>. 1999-05-03 lpd Original version. */ #ifndef md5_INCLUDED # define md5_INCLUDED /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is * defined as non-zero, the code will be compiled to run only on big-endian * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ /* Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ md5_byte_t buf[64]; /* accumulate block */ } md5_state_t; #ifdef __cplusplus extern "C" { #endif /* Initialize the algorithm. */ void md5_init(md5_state_t *pms); /* Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); /* Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* md5_INCLUDED */ --- NEW FILE: RegistryKey.cpp --- /* JSmooth: a VM wrapper toolkit for Windows Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "RegistryKey.h" #include "StringUtils.h" RegistryKey::RegistryKey(KEYBASE parent, const std::string& subkey) { switch(parent) { case CURRENT_USER: init(HKEY_CURRENT_USER, subkey); break; case LOCAL_MACHINE: init(HKEY_LOCAL_MACHINE, subkey); break; case USERS: init(HKEY_USERS, subkey); break; } } RegistryKey::RegistryKey(const RegistryKey& parent, const std::string& subkey) { init(parent.m_key, subkey); } RegistryKey::~RegistryKey() { if (m_key != 0) RegCloseKey(m_key); } void RegistryKey::init(HKEY key, const std::string& subkey) { DWORD lpdwDisposition; if (RegCreateKeyEx(key, subkey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_key, &lpdwDisposition) != ERROR_SUCCESS) m_key = 0; } void RegistryKey::set(const std::string& name, const std::string& value) { if (m_key != 0) RegSetValueEx(m_key, name.c_str(), 0, REG_SZ, (const BYTE*) value.c_str(), value.size()+1); } void RegistryKey::set(const std::string& name, DWORD value) { if (m_key != 0) RegSetValueEx(m_key, name.c_str(), 0, REG_DWORD, (const BYTE*)&value, 4); } std::string RegistryKey::getString(const std::string& name) { DWORD lpType, size = 1024; byte buffer[1024]; byte*data = buffer; LONG res = RegQueryValueEx(m_key, name.c_str(), NULL, &lpType, data, &size); if (res == ERROR_SUCCESS) { switch(lpType) { case REG_DWORD: return StringUtils::toString(* ( (int*)data )); break; case REG_SZ: buffer[size] = 0; return std::string((char*)data); } } return ""; } DWORD RegistryKey::getInt(const std::string& name) { DWORD lpType, size = 1024; byte buffer[1024]; byte*data = buffer; LONG res = RegQueryValueEx(m_key, name.c_str(), NULL, &lpType, data, &size); if (res == ERROR_SUCCESS) { switch(lpType) { case REG_DWORD: return * ( (int*)data ); break; case REG_SZ: buffer[size] = 0; return StringUtils::parseInt((char*)data); } } return 0; } --- NEW FILE: md5.c --- /* Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch gh...@al... */ /* $Id: md5.c,v 1.1 2007/05/27 09:14:52 reyes Exp $ */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.c is L. Peter Deutsch <gh...@al...>. Other authors are noted in the change history that follows (in reverse chronological order): 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order either statically or dynamically; added missing #include <string.h> in library. 2002-03-11 lpd Corrected argument list for main(), and added int return type, in test program and T value program. 2002-02-21 lpd Added missing #include <stdio.h> in test program. 2000-07-03 lpd Patched to eliminate warnings about "constant is unsigned in ANSI C, signed in traditional"; made test program self-checking. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). 1999-05-03 lpd Original version. */ #include "md5.h" #include <string.h> #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN # define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) #else # define BYTE_ORDER 0 #endif #define T_MASK ((md5_word_t)~0) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) #define T3 0x242070db #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) #define T6 0x4787c62a #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) #define T9 0x698098d8 #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) #define T13 0x6b901122 #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) #define T16 0x49b40821 #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) #define T19 0x265e5a51 #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) #define T22 0x02441453 #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) #define T25 0x21e1cde6 #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) #define T28 0x455a14ed #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) #define T31 0x676f02d9 #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) #define T35 0x6d9d6122 #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) #define T38 0x4bdecfa9 #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) #define T41 0x289b7ec6 #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) #define T44 0x04881d05 #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) #define T47 0x1fa27cf8 #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) #define T50 0x432aff97 #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) #define T53 0x655b59c3 #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) #define T57 0x6fa87e4f #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) #define T60 0x4e0811a1 #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) #define T63 0x2ad7d2bb #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; md5_word_t t; #if BYTE_ORDER > 0 /* Define storage only for big-endian CPUs. */ md5_word_t X[16]; #else /* Define storage for little-endian or both types of CPUs. */ md5_word_t xbuf[16]; const md5_word_t *X; #endif { #if BYTE_ORDER == 0 /* * Determine dynamically whether this is a big-endian or * little-endian machine, since we can use a more efficient * algorithm on the latter. */ static const int w = 1; if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ #endif #if BYTE_ORDER <= 0 /* little-endian */ { /* * On little-endian machines, we can process properly aligned * data without copying it. */ if (!((data - (const md5_byte_t *)0) & 3)) { /* data are properly aligned */ X = (const md5_word_t *)data; } else { /* not aligned */ memcpy(xbuf, data, 64); X = xbuf; } } #endif #if BYTE_ORDER == 0 else /* dynamic big-endian */ #endif #if BYTE_ORDER >= 0 /* big-endian */ { /* * On big-endian machines, we must arrange the bytes in the * right order. */ const md5_byte_t *xp = data; int i; # if BYTE_ORDER == 0 X = xbuf; /* (dynamic only) */ # else # define xbuf X /* (static only) */ # endif for (i = 0; i < 16; ++i, xp += 4) xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); } #endif } #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) /* Round 1. */ /* Let [abcd k s i] denote the operation a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + F(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 7, T1); SET(d, a, b, c, 1, 12, T2); SET(c, d, a, b, 2, 17, T3); SET(b, c, d, a, 3, 22, T4); SET(a, b, c, d, 4, 7, T5); SET(d, a, b, c, 5, 12, T6); SET(c, d, a, b, 6, 17, T7); SET(b, c, d, a, 7, 22, T8); SET(a, b, c, d, 8, 7, T9); SET(d, a, b, c, 9, 12, T10); SET(c, d, a, b, 10, 17, T11); SET(b, c, d, a, 11, 22, T12); SET(a, b, c, d, 12, 7, T13); SET(d, a, b, c, 13, 12, T14); SET(c, d, a, b, 14, 17, T15); SET(b, c, d, a, 15, 22, T16); #undef SET /* Round 2. */ /* Let [abcd k s i] denote the operation a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + G(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 1, 5, T17); SET(d, a, b, c, 6, 9, T18); SET(c, d, a, b, 11, 14, T19); SET(b, c, d, a, 0, 20, T20); SET(a, b, c, d, 5, 5, T21); SET(d, a, b, c, 10, 9, T22); SET(c, d, a, b, 15, 14, T23); SET(b, c, d, a, 4, 20, T24); SET(a, b, c, d, 9, 5, T25); SET(d, a, b, c, 14, 9, T26); SET(c, d, a, b, 3, 14, T27); SET(b, c, d, a, 8, 20, T28); SET(a, b, c, d, 13, 5, T29); SET(d, a, b, c, 2, 9, T30); SET(c, d, a, b, 7, 14, T31); SET(b, c, d, a, 12, 20, T32); #undef SET /* Round 3. */ /* Let [abcd k s t] denote the operation a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET(a, b, c, d, k, s, Ti)\ t = a + H(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 5, 4, T33); SET(d, a, b, c, 8, 11, T34); SET(c, d, a, b, 11, 16, T35); SET(b, c, d, a, 14, 23, T36); SET(a, b, c, d, 1, 4, T37); SET(d, a, b, c, 4, 11, T38); SET(c, d, a, b, 7, 16, T39); SET(b, c, d, a, 10, 23, T40); SET(a, b, c, d, 13, 4, T41); SET(d, a, b, c, 0, 11, T42); SET(c, d, a, b, 3, 16, T43); SET(b, c, d, a, 6, 23, T44); SET(a, b, c, d, 9, 4, T45); SET(d, a, b, c, 12, 11, T46); SET(c, d, a, b, 15, 16, T47); SET(b, c, d, a, 2, 23, T48); #undef SET /* Round 4. */ /* Let [abcd k s t] denote the operation a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + I(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 6, T49); SET(d, a, b, c, 7, 10, T50); SET(c, d, a, b, 14, 15, T51); SET(b, c, d, a, 5, 21, T52); SET(a, b, c, d, 12, 6, T53); SET(d, a, b, c, 3, 10, T54); SET(c, d, a, b, 10, 15, T55); SET(b, c, d, a, 1, 21, T56); SET(a, b, c, d, 8, 6, T57); SET(d, a, b, c, 15, 10, T58); SET(c, d, a, b, 6, 15, T59); SET(b, c, d, a, 13, 21, T60); SET(a, b, c, d, 4, 6, T61); SET(d, a, b, c, 11, 10, T62); SET(c, d, a, b, 2, 15, T63); SET(b, c, d, a, 9, 21, T64); #undef SET /* Then perform the following additions. (That is increment each of the four registers by the value it had before this block was started.) */ pms->abcd[0] += a; pms->abcd[1] += b; pms->abcd[2] += c; pms->abcd[3] += d; } void md5_init(md5_state_t *pms) { pms->count[0] = pms->count[1] = 0; pms->abcd[0] = 0x67452301; pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; pms->abcd[3] = 0x10325476; } void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) { const md5_byte_t *p = data; int left = nbytes; int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) return; /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; if (pms->count[0] < nbits) pms->count[1]++; /* Process an initial partial block. */ if (offset) { int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; left -= copy; md5_process(pms, pms->buf); } /* Process full blocks. */ for (; left >= 64; p += 64, left -= 64) md5_process(pms, p); /* Process a final partial block. */ if (left) memcpy(pms->buf, p, left); } void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) { static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; md5_byte_t data[8]; int i; /* Save the length before padding. */ for (i = 0; i < 8; ++i) data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); /* Pad to 56 bytes mod 64. */ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ md5_append(pms, data, 8); for (i = 0; i < 16; ++i) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } Index: Process.h =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Process.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Process.h 1 May 2007 19:40:16 -0000 1.2 --- Process.h 27 May 2007 09:14:52 -0000 1.3 *************** *** 1,60 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #ifndef __JSMOOTHCOREPROCESS_H_ ! #define __JSMOOTHCOREPROCESS_H_ ! ! ! #include <process.h> ! #include <windows.h> ! #include <winbase.h> ! ! #include <string> ! #include <stdio.h> ! /** ! * Provides basic string operations. ! * ! * @author Rodrigo Reyes <re...@ch...> ! */ ! ! class Process ! { ! PROCESS_INFORMATION m_procinfo; ! bool m_useconsole; ! std::string m_commandline; ! bool m_started; ! std::string m_redirection; ! bool m_redirectstderr; ! HANDLE m_redirectHandle; ! DWORD m_exitCode; ! ! public: ! Process(const std::string& commandline, bool useconsole); ! ! void setRedirect(const std::string& filename); ! ! bool run(); ! void join(); ! ! int getExitCode(); ! }; ! ! ! #endif --- 1,62 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #ifndef __JSMOOTHCOREPROCESS_H_ ! #define __JSMOOTHCOREPROCESS_H_ ! ! ! #include <process.h> ! #include <windows.h> ! #include <winbase.h> ! ! #include <string> ! #include <stdio.h> ! /** ! * Provides basic string operations. ! * ! * @author Rodrigo Reyes <re...@ch...> ! */ ! ! class Process ! { ! PROCESS_INFORMATION m_procinfo; ! bool m_useconsole; ! std::string m_commandline; ! bool m_started; ! std::string m_redirection; ! bool m_redirectstderr; ! HANDLE m_redirectHandle; ! DWORD m_exitCode; ! ! public: ! Process(const std::string& commandline, bool useconsole); ! ! void setRedirect(const std::string& filename); ! ! bool run(); ! void join(); ! ! DWORD getProcessId(); ! ! int getExitCode(); ! }; ! ! ! #endif Index: Thread.h =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Thread.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Thread.h 9 Apr 2007 17:17:04 -0000 1.1 --- Thread.h 27 May 2007 09:14:51 -0000 1.2 *************** *** 1,87 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #ifndef __JSMOOTHCORETHREAD_H_ ! #define __JSMOOTHCORETHREAD_H_ ! ! ! #include <process.h> ! #include <windows.h> ! #include <winbase.h> ! ! #include <stdio.h> ! /** ! * Provides basic string operations. ! * ! * @author Rodrigo Reyes <re...@ch...> ! */ ! ! class Thread ! { ! protected: ! unsigned long m_threadId; ! void (*m_callback)(void*); ! void* m_param; ! bool m_stopRequested; ! ! public: ! Thread(); ! ! /** ! * Starts the thread, and execute the run() method. ! */ ! void start(); ! ! /** ! * Starts the thread and execute the run method. If the run method ! * is not overloaded, it executes the callback fonction, and pass ! * the param as parameter to the function. ! */ ! void start(void (*callback)(void*), void* param); ! ! /** ! * The method executed by the thread. ! */ ! void run(); ! ! /* ! * Waits for the thread to complete ! */ ! void join(); ! ! /* ! * Waits for the thread to complete. If the timeout (millis) is ! * reached, returns false. Returns true if the thread ended. ! */ ! bool join(int millis); ! ! /** ! * Waits a number of milliseconds. ! */ ! static void sleep(int millis); ! ! bool isStopRequested(); ! ! void setStopRequested(bool stop=true); ! ! }; ! ! ! #endif --- 1,91 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #ifndef __JSMOOTHCORETHREAD_H_ ! #define __JSMOOTHCORETHREAD_H_ ! ! ! #include <process.h> ! #include <windows.h> ! #include <winbase.h> ! ! #include <stdio.h> ! /** ! * Provides basic string operations. ! * ! * @author Rodrigo Reyes <re...@ch...> ! */ ! ! class Thread ! { ! protected: ! unsigned long m_threadId; ! void (*m_callback)(void*); ! void* m_param; ! bool m_stopRequested; ! bool m_autodelete; ! ! public: ! Thread(); ! ! /** ! * Starts the thread, and execute the run() method. ! */ ! void start(); ! ! /** ! * Starts the thread and execute the run method. If the run method ! * is not overloaded, it executes the callback fonction, and pass ! * the param as parameter to the function. ! */ ! void start(void (*callback)(void*), void* param); ! ! /** ! * The method executed by the thread. ! */ ! void run(); ! ! /* ! * Waits for the thread to complete ! */ ! void join(); ! ! /* ! * Waits for the thread to complete. If the timeout (millis) is ! * reached, returns false. Returns true if the thread ended. ! */ ! bool join(int millis); ! ! /** ! * Waits a number of milliseconds. ! */ ! static void sleep(int millis); ! ! bool isStopRequested(); ! ! void setStopRequested(bool stop=true); ! ! void setAutoDelete(bool v); ! bool isAutoDelete(); ! ! }; ! ! ! #endif Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Makefile.win,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.win 17 May 2007 10:56:18 -0000 1.5 --- Makefile.win 27 May 2007 09:14:52 -0000 1.6 *************** *** 1,32 **** ! # Project: util-core ! ! PROJECTNAME=util-core ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = ! RES = ! OBJ = SingleInstanceManager.o Process.o Log.o Thread.o FileUtils.o StringUtils.o DebugConsole.o $(RES) ! LIBS = -L"$(MINGW)/lib" -L"/lib" -lws2_32 ! INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -Os -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! BIN = $(PROJECTNAME).a ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! CFLAGS = $(INCS) ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(PROJECTNAME).a testmain.cpp all-after ! ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) testmain.o test.exe ! ! $(BIN): $(OBJ) ! ar r $(BIN) $(OBJ) ! ranlib $(BIN) ! $(CPP) $(OBJ) testmain.o -o test.exe $(LIBS) ! ! $(PROJECTNAME).a: $(OBJ) testmain.o ! --- 1,32 ---- ! # Project: util-core ! ! PROJECTNAME=util-core ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = ! RES = ! OBJ = md5.o RegistryKey.o SingleInstanceManager.o Process.o Log.o Thread.o FileUtils.o StringUtils.o DebugConsole.o $(RES) ! LIBS = -L"$(MINGW)/lib" -L"/lib" -lws2_32 ! INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -Os -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! BIN = $(PROJECTNAME).a ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! CFLAGS = $(INCS) ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(PROJECTNAME).a testmain.cpp all-after ! ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) testmain.o test.exe ! ! $(BIN): $(OBJ) ! ar r $(BIN) $(OBJ) ! ranlib $(BIN) ! $(CPP) testmain.o -o test.exe $(BIN) ! ! $(PROJECTNAME).a: $(OBJ) testmain.o ! Index: Process.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Process.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Process.cpp 4 May 2007 20:53:28 -0000 1.3 --- Process.cpp 27 May 2007 09:14:52 -0000 1.4 *************** *** 1,118 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "Process.h" ! #include "StringUtils.h" ! ! Process::Process(const std::string& commandline, bool useconsole) ! { ! m_commandline = commandline; ! m_useconsole = useconsole; ! m_started = false; ! m_redirectHandle = INVALID_HANDLE_VALUE; ! } ! ! ! void Process::setRedirect(const std::string& filename) ! { ! m_redirection = filename; ! m_useconsole = true; ! } ! ! bool Process::run() ! { ! STARTUPINFO info; ! GetStartupInfo(&info); ! int creationFlags = 0; ! int inheritsHandle; ! ! if (m_useconsole == true) ! { ! info.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; ! info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); ! info.hStdError = GetStdHandle(STD_ERROR_HANDLE); ! info.hStdInput = GetStdHandle(STD_INPUT_HANDLE); ! creationFlags = NORMAL_PRIORITY_CLASS; ! inheritsHandle = TRUE; ! } ! else ! { ! info.dwFlags = STARTF_USESHOWWINDOW; ! creationFlags = NORMAL_PRIORITY_CLASS | DETACHED_PROCESS; ! inheritsHandle = FALSE; ! } ! ! if (m_redirection.size() > 0) ! { ! SECURITY_ATTRIBUTES secattrs; ! secattrs.nLength = sizeof(SECURITY_ATTRIBUTES); ! secattrs.lpSecurityDescriptor = NULL; ! secattrs.bInheritHandle = TRUE; ! ! m_redirectHandle = CreateFile(m_redirection.c_str(), GENERIC_WRITE, ! FILE_SHARE_WRITE, &secattrs, ! CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ! ! if (m_redirectHandle == INVALID_HANDLE_VALUE) ! { ! return false; ! } ! info.hStdOutput = m_redirectHandle; ! info.hStdError = m_redirectHandle; ! info.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; ! info.lpTitle = NULL; ! info.wShowWindow = SW_HIDE; // OR SW_SHOWMINIMIZED? SW_SHOWMINNOACTIVE? ! } ! ! // string exeline = StringUtils::fixQuotes(exepath) + " " + arguments; ! int res = CreateProcess(NULL, (char*)m_commandline.c_str(), ! NULL, NULL, inheritsHandle, creationFlags, ! NULL, NULL, &info, &m_procinfo); ! ! if (res != 0) ! { ! m_started = true; ! return true; ! } ! ! return false; ! } ! ! void Process::join() ! { ! if (!m_started) ! return; ! ! WaitForSingleObject(m_procinfo.hProcess, INFINITE); ! ! if (m_redirectHandle != INVALID_HANDLE_VALUE) ! { ! CloseHandle(m_redirectHandle); ! } ! ! } ! ! int Process::getExitCode() ! { ! GetExitCodeProcess(m_procinfo.hProcess, ! &m_exitCode); ! return (int)m_exitCode; ! } ! --- 1,122 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "Process.h" ! #include "StringUtils.h" ! ! Process::Process(const std::string& commandline, bool useconsole) ! { ! m_commandline = commandline; ! m_useconsole = useconsole; ! m_started = false; ! m_redirectHandle = INVALID_HANDLE_VALUE; ! } ! ! ! void Process::setRedirect(const std::string& filename) ! { ! m_redirection = filename; ! m_useconsole = true; ! } ! ! bool Process::run() ! { ! STARTUPINFO info; ! GetStartupInfo(&info); ! int creationFlags = 0; ! int inheritsHandle; ! ! if (m_useconsole == true) ! { ! info.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; ! info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); ! info.hStdError = GetStdHandle(STD_ERROR_HANDLE); ! info.hStdInput = GetStdHandle(STD_INPUT_HANDLE); ! creationFlags = NORMAL_PRIORITY_CLASS; ! inheritsHandle = TRUE; ! } ! else ! { ! info.dwFlags = STARTF_USESHOWWINDOW; ! creationFlags = NORMAL_PRIORITY_CLASS | DETACHED_PROCESS; ! inheritsHandle = FALSE; ! } ! ! if (m_redirection.size() > 0) ! { ! SECURITY_ATTRIBUTES secattrs; ! secattrs.nLength = sizeof(SECURITY_ATTRIBUTES); ! secattrs.lpSecurityDescriptor = NULL; ! secattrs.bInheritHandle = TRUE; ! ! m_redirectHandle = CreateFile(m_redirection.c_str(), GENERIC_WRITE, ! FILE_SHARE_WRITE, &secattrs, ! CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ! ! if (m_redirectHandle == INVALID_HANDLE_VALUE) ! { ! return false; ! } ! info.hStdOutput = m_redirectHandle; ! info.hStdError = m_redirectHandle; ! info.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; ! info.lpTitle = NULL; ! info.wShowWindow = SW_HIDE; // OR SW_SHOWMINIMIZED? SW_SHOWMINNOACTIVE? ! } ! ! // string exeline = StringUtils::fixQuotes(exepath) + " " + arguments; ! int res = CreateProcess(NULL, (char*)m_commandline.c_str(), ! NULL, NULL, inheritsHandle, creationFlags, ! NULL, NULL, &info, &m_procinfo); ! ! if (res != 0) ! { ! m_started = true; ! return true; ! } ! ! return false; ! } ! ! void Process::join() ! { ! if (!m_started) ! return; ! ! WaitForSingleObject(m_procinfo.hProcess, INFINITE); ! ! if (m_redirectHandle != INVALID_HANDLE_VALUE) ! { ! CloseHandle(m_redirectHandle); ! } ! ! } ! ! int Process::getExitCode() ! { ! GetExitCodeProcess(m_procinfo.hProcess, ! &m_exitCode); ! return (int)m_exitCode; ! } ! ! DWORD Process::getProcessId() ! { ! return m_procinfo.dwProcessId; ! } Index: testmain.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/testmain.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testmain.cpp 17 May 2007 10:56:19 -0000 1.5 --- testmain.cpp 27 May 2007 09:14:52 -0000 1.6 *************** *** 1,88 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include <iostream> ! #include <stdlib.h> ! ! #include "StringUtils.h" ! #include <winnls.h> ! #include "FileUtils.h" ! #include "Process.h" ! ! #include "SingleInstanceManager.h" ! ! void _debugOutput(const std::string& text) ! { ! printf("%s\n", text.c_str()); ! } ! ! void _debugWaitKey() ! { ! } ! ! int main(int argc, char *argv[]) ! { ! // char buffer[256]; ! // buffer[0] = 0; ! // int res = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, ! // buffer, 255); ! ! // if (res > 0) ! // printf("result: %s\n", buffer); ! ! SingleInstanceManager singinst; ! if (singinst.alreadyExists()) ! { ! printf("Already running...\n"); ! exit(0); ! } ! else ! Sleep(50000); ! ! std::string exeline = "C:\\Program Files\\Java\\jdk1.5.0_11\\bin\\java.exe -version"; ! string tmpfilename = FileUtils::createTempFileName(".tmp"); ! ! Process proc(exeline, true); ! proc.setRedirect(tmpfilename); ! proc.run(); ! proc.join(); ! ! std::string voutput = FileUtils::readFile(tmpfilename); ! // printf("GOT: %s\n", voutput.c_str()); ! ! // std::string cmdlinetest = " \"this is my\ test\\\" \"here and then\""; ! // cmdlinetest = " \"this is my\ test here\\\" \"and\" \"then\""; ! // printf("splitting line <%s>\n", cmdlinetest.c_str()); ! // std::vector<std::string> args = StringUtils::split(cmdlinetest, " \t\n\r", "\"'", false, false); ! // for (int i=0; i<args.size(); i++) ! // { ! // printf("ARG[%d]=%s\n", i, args[i].c_str(), false, false); ! // } ! ! // std::string fqmethod = "void mytest1(java.lang.String test[ ] ) "; ! // std::vector<std::string> t1 = StringUtils::split(fqmethod, " \t(,);][", "", false, true); ! ! // for (std::vector<std::string>::iterator i=t1.begin(); i != t1.end(); i++) ! // printf("TOK: %s\n" , i->c_str()); ! ! // std::string readf = FileUtils::readFile("Log.h"); ! // printf("READ: <<%s>>", readf.c_str()); ! ! } --- 1,99 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include <iostream> ! #include <stdlib.h> ! ! #include "StringUtils.h" ! #include <winnls.h> ! #include "FileUtils.h" ! #include "Process.h" ! ! #include "SingleInstanceManager.h" ! #include "RegistryKey.h" ! ! void _debugOutput(const std::string& text) ! { ! printf("%s\n", text.c_str()); ! } ! ! void _debugWaitKey() ! { ! } ! ! int main(int argc, char *argv[]) ! { ! ! RegistryKey k(RegistryKey::CURRENT_USER, "Software\\JSmooth"); ! RegistryKey k2(k, "Test"); ! ! // k.set("HAB", "ceci est un test"); ! // k.set("HAB2", 1234); ! ! printf("HAB = %s\n", k.getString("HAB").c_str()); ! printf("HAB2 = %d\n", k.getInt("HAB2")); ! ! // char buffer[256]; ! // buffer[0] = 0; ! // int res = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, ! // buffer, 255); ! ! // if (res > 0) ! // printf("result: %s\n", buffer); ! ! // SingleInstanceManager singinst; ! // if (singinst.alreadyExists()) ! // { ! // printf("Already running...\n"); ! // exit(0); ! // } ! // else ! // Sleep(50000); ! ! // std::string exeline = "C:\\Program Files\\Java\\jdk1.5.0_11\\bin\\java.exe -version"; ! // string tmpfilename = FileUtils::createTempFileName(".tmp"); ! ! // Process proc(exeline, true); ! // proc.setRedirect(tmpfilename); ! // proc.run(); ! // proc.join(); ! ! // std::string voutput = FileUtils::readFile(tmpfilename); ! // printf("GOT: %s\n", voutput.c_str()); ! ! // std::string cmdlinetest = " \"this is my\ test\\\" \"here and then\""; ! // cmdlinetest = " \"this is my\ test here\\\" \"and\" \"then\""; ! // printf("splitting line <%s>\n", cmdlinetest.c_str()); ! // std::vector<std::string> args = StringUtils::split(cmdlinetest, " \t\n\r", "\"'", false, false); ! // for (int i=0; i<args.size(); i++) ! // { ! // printf("ARG[%d]=%s\n", i, args[i].c_str(), false, false); ! // } ! ! // std::string fqmethod = "void mytest1(java.lang.String test[ ] ) "; ! // std::vector<std::string> t1 = StringUtils::split(fqmethod, " \t(,);][", "", false, true); ! ! // for (std::vector<std::string>::iterator i=t1.begin(); i != t1.end(); i++) ! // printf("TOK: %s\n" , i->c_str()); ! ! // std::string readf = FileUtils::readFile("Log.h"); ! // printf("READ: <<%s>>", readf.c_str()); ! ! } --- NEW FILE: RegistryKey.h --- /* JSmooth: a VM wrapper toolkit for Windows Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __REGISTRYKEY_H_ #define __REGISTRYKEY_H_ #include <string> #include <vector> #include <windows.h> class RegistryKey { private: HKEY m_key; public: enum KEYBASE { CURRENT_USER = 1, LOCAL_MACHINE = 2, USERS = 3 } ; RegistryKey(KEYBASE parent, const std::string& subkey); RegistryKey(const RegistryKey& parent, const std::string& subkey); ~RegistryKey(); void set(const std::string& name, const std::string& value); void set(const std::string& name, DWORD value); std::string getString(const std::string& name); DWORD getInt(const std::string& name); private: void init(HKEY key, const std::string& subkey); }; #endif Index: Thread.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/util-core/Thread.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Thread.cpp 9 Apr 2007 17:17:04 -0000 1.1 --- Thread.cpp 27 May 2007 09:14:51 -0000 1.2 *************** *** 1,99 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "Thread.h" ! ! void thread_support_fn(void* param) ! { ! Thread *t = (Thread*) param; ! try { ! t->run(); ! } catch (...) ! { ! // ! } ! _endthread(); ! } ! ! Thread::Thread() ! { ! m_callback = 0; ! } ! ! void Thread::start() ! { ! m_threadId = _beginthread((void( __cdecl * )( void * ))thread_support_fn, 0, (void*) this); ! } ! ! void Thread::start(void (*callback)(void*), void* param) ! { ! m_callback = callback; ! m_param = param; ! m_threadId = _beginthread((void( __cdecl * )( void * ))thread_support_fn, 0, (void*) this); ! } ! ! void Thread::run() ! { ! if (m_callback != 0) ! { ! (*m_callback)(m_param); ! } ! } ! ! void Thread::sleep(int millis) ! { ! Sleep(millis); ! } ! ! void Thread::join() ! { ! WaitForSingleObject ( (void*)m_threadId, INFINITE ); ! } ! ! bool Thread::join(int millis) ! { ! int result = WaitForSingleObject( (void*)m_threadId, millis); ! switch(result) ! { ! case WAIT_ABANDONED: ! printf("WAIT_ABANDONED\n"); ! break; ! case WAIT_OBJECT_0: ! printf("WAIT_OBJECT_0"); ! return true; ! break; ! case WAIT_TIMEOUT: ! printf("WAIT_TIMEOUT"); ! break; ! } ! ! return false; ! } ! ! ! bool Thread::isStopRequested() ! { ! return m_stopRequested; ! } ! ! void Thread::setStopRequested(bool stop) ! { ! m_stopRequested = stop; ! } --- 1,117 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003-2007 Rodrigo Reyes <re...@ch...> ! ! This library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public ! License as published by the Free Software Foundation; either ! version 2 of the License, or (at your option) any later version. ! ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; if not, write to the Free ! Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! #include "Thread.h" ! ! void thread_support_fn(void* param) ! { ! Thread *t = (Thread*) param; ! try { ! t->run(); ! } catch (...) ! { ! // ! } ! _endthread(); ! ! if (t->isAutoDelete()) ! { ! delete t; ! } ! } ! ! Thread::Thread() ! { ! m_callback = 0; ! m_autodelete = false; ! } ! ! void Thread::start() ! { ! m_threadId = _beginthread((void( __cdecl * )( void * ))thread_support_fn, 0, (void*) this); ! } ! ! void Thread::start(void (*callback)(void*), void* param) ! { ! m_callback = callback; ! m_param = param; ! m_threadId = _beginthread((void( __cdecl * )( void * ))thread_support_fn, 0, (void*) this); ! } ! ! void Thread::run() ! { ! if (m_callback != 0) ! { ! (*m_callback)(m_param); ! } ! } ! ! void Thread::sleep(int millis) ! { ! Sleep(millis); ! } ! ! void Thread::join() ! { ! WaitForSingleObject ( (void*)m_threadId, INFINITE ); ! } ! ! bool Thread::join(int millis) ! { ! int result = WaitForSingleObject( (void*)m_threadId, millis); ! switch(result) ! { ! case WAIT_ABANDONED: ! printf("WAIT_ABANDONED\n"); ! break; ! case WAIT_OBJECT_0: ! printf("WAIT_OBJECT_0"); ! return true; ! break; ! case WAIT_TIMEOUT: ! printf("WAIT_TIMEOUT"); ! break; ! } ! ! return false; ! } ! ! ! bool Thread::isStopRequested() ! { ! return m_stopRequested; ! } ! ! void Thread::setStopRequested(bool stop) ! { ! m_stopRequested = stop; ! } ! ! void Thread::setAutoDelete(bool v) ! { ! m_autodelete = v; ! } ! ! bool Thread::isAutoDelete() ! { ! return m_autodelete; ! } ! ! |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:14:55
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/simplewrap In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14482/skeletons/simplewrap Modified Files: description.skel Makefile.win main.cpp Log Message: splash screen support and small overall refactoring Index: description.skel =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/description.skel,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** description.skel 18 May 2007 21:34:00 -0000 1.10 --- description.skel 27 May 2007 09:14:51 -0000 1.11 *************** *** 44,47 **** --- 44,54 ---- </skeletonProperties> <skeletonProperties> + <description>SKEL_GENERIC_PROPERTY_SPLASH_DESCRIPTION</description> + <idName>SplashImg</idName> + <label>SKEL_GENERIC_PROPERTY_SPLASH</label> + <type>imgselector</type> + <value></value> + </skeletonProperties> + <skeletonProperties> <description>SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION</description> <idName>Debug</idName> Index: main.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/main.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** main.cpp 20 May 2007 21:05:39 -0000 1.32 --- main.cpp 27 May 2007 09:14:51 -0000 1.33 *************** *** 29,32 **** --- 29,36 ---- #include "SingleInstanceManager.h" + #include "JniSmoothRegister.h" + #include "splashhelper.h" + #include "JVMBase.h" + ResourceManager* globalResMan; DebugConsole *DEBUGCONSOLE = 0; *************** *** 44,47 **** --- 48,52 ---- if (DEBUGCONSOLE != NULL) DEBUGCONSOLE->writeline(text); + printf("%s\n",text.c_str()); fflush(stdout); } *************** *** 51,55 **** DEBUGCONSOLE->waitKey(); } ! int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, --- 56,68 ---- DEBUGCONSOLE->waitKey(); } ! ! class JVMListener : public JVMSetUpListener ! { ! virtual void jvmHasPid(int pid) ! { ! splashwindow_setProcessId(pid); ! } ! }; ! int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, *************** *** 57,72 **** int nFunsterStil) { ! atexit(lastExit); ! SingleInstanceManager instanceman; ! globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID); ! // sets up the command line arguments ! // not sure if lpszArgument can be null on Windows... ! if ((lpszArgument!=NULL) && (strlen(lpszArgument)>0)) ! { ! std::vector<std::string> args = StringUtils::split(lpszArgument, " \t\n\r", "\"'", false); ! globalResMan->setUserArguments( args ); ! } --- 70,88 ---- int nFunsterStil) { ! atexit(lastExit); ! SingleInstanceManager instanceman; ! vector<JNIRegister*> jnireg; ! jnireg.push_back(new JniSmoothRegister()); ! globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID); ! ! // sets up the command line arguments ! // not sure if lpszArgument can be null on Windows... ! if ((lpszArgument!=NULL) && (strlen(lpszArgument)>0)) ! { ! std::vector<std::string> args = StringUtils::split(lpszArgument, " \t\n\r", "\"'", false); ! globalResMan->setUserArguments( args ); ! } *************** *** 78,84 **** } ! if (DEBUGCONSOLE!=0) ! globalResMan->printDebug(); ! bool singleinstance = globalResMan->getBooleanProperty("skel_SingleInstance"); --- 94,99 ---- } ! if (DEBUGCONSOLE!=0) ! globalResMan->printDebug(); bool singleinstance = globalResMan->getBooleanProperty("skel_SingleInstance"); *************** *** 96,146 **** } ! DEBUG(string("Main class: ") + globalResMan->getMainName()); - char curdir[256]; - GetCurrentDirectory(256, curdir); - DEBUG(string("Currentdir: ") + curdir); ! string newcurdir = globalResMan->getCurrentDirectory(); ! SetCurrentDirectory(newcurdir.c_str()); ! JavaMachineManager man(*globalResMan); ! man.setAcceptExe(true); ! man.setAcceptDLL(true); ! if (dodebug) ! man.setUseConsole(true); ! else ! man.setUseConsole(false); ! bool singleprocess = globalResMan->getBooleanProperty("skel_SingleProcess"); ! bool jnismooth = globalResMan->getBooleanProperty("skel_JniSmooth"); ! if (singleprocess || jnismooth) ! man.setPreferDLL(true); ! else ! man.setPreferDLL(false); ! int retvalue = 0; ! if (man.run() == false) { DEBUG("Displaying error message to user..."); ! std::string errmsg = globalResMan->getProperty("skel_Message"); ! std::string url = globalResMan->getProperty("skel_URL"); ! if (MessageBox(NULL, errmsg.c_str(), "No Java?", MB_OKCANCEL|MB_ICONQUESTION|MB_APPLMODAL) == IDOK) { ! ShellExecute(NULL, "open", url.c_str(), NULL, "", 0); } } ! else ! { ! retvalue = man.getExitCode(); ! } ! DEBUG("NORMAL EXIT"); ! DEBUGWAITKEY(); ! /* The program return-value is 0 - The value that PostQuitMessage() gave */ ! return retvalue; } --- 111,176 ---- } ! std::string splashimg = globalResMan->getProperty("skel_SplashImg"); ! DEBUG("splash: " + splashimg); ! if (splashimg.size() > 0) ! { ! splashwindow_start(splashimg); ! // Sleep(1000); ! } ! DEBUG(string("Main class: ") + globalResMan->getMainName()); ! char curdir[256]; ! GetCurrentDirectory(256, curdir); ! DEBUG(string("Currentdir: ") + curdir); ! string newcurdir = globalResMan->getCurrentDirectory(); ! SetCurrentDirectory(newcurdir.c_str()); ! JavaMachineManager man(*globalResMan); ! man.setJNI(jnireg); ! man.setAcceptExe(true); ! man.setAcceptDLL(true); ! if (dodebug) ! man.setUseConsole(true); ! else ! man.setUseConsole(false); ! bool singleprocess = globalResMan->getBooleanProperty("skel_SingleProcess"); ! bool jnismooth = globalResMan->getBooleanProperty("skel_JniSmooth"); ! if (singleprocess || jnismooth) ! man.setPreferDLL(true); ! else ! man.setPreferDLL(false); ! ! if (splashimg.size() > 0) ! { ! man.addListener(new JVMListener()); ! } ! ! int retvalue = 0; ! ! if (man.run() == false) { DEBUG("Displaying error message to user..."); ! std::string errmsg = globalResMan->getProperty("skel_Message"); ! std::string url = globalResMan->getProperty("skel_URL"); ! if (MessageBox(NULL, errmsg.c_str(), "No Java?", MB_OKCANCEL|MB_ICONQUESTION|MB_APPLMODAL) == IDOK) { ! ShellExecute(NULL, "open", url.c_str(), NULL, "", 0); } } ! else ! { ! retvalue = man.getExitCode(); ! } ! DEBUG("NORMAL EXIT"); ! DEBUGWAITKEY(); ! /* The program return-value is 0 - The value that PostQuitMessage() gave */ ! return retvalue; } Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/Makefile.win,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Makefile.win 18 May 2007 21:34:00 -0000 1.14 --- Makefile.win 27 May 2007 09:14:51 -0000 1.15 *************** *** 8,15 **** RES = JWrap_private.res OBJ = main.o $(RES) LINKOBJ = main.o $(RES) ! LIBS = -L"/lib" -L"../commonjava" -L"../util-core" -mwindows ../commonjava/CommonJava.a ../util-core/util-core.a INCS = -I"/include" -I"$(JDK)/include/win32" -I"$(JDK)/include" -I"../commonjava" -I"../util-core" ! CXXINCS = -g -I"/include/c++" -I"/include/c++/mingw32" -I"/include/c++/backward" -I"/include" -I"$(JDK)/include/win32" -I"$(JDK)/include" -I"../commonjava" -I../util-core BIN = JWrap.exe CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" --- 8,17 ---- RES = JWrap_private.res OBJ = main.o $(RES) + FLTK-LDFLAGS = $(shell fltk-config --use-images --ldflags ) + FLTK-CXXFLAGS = $(shell fltk-config --use-images --cxxflags ) LINKOBJ = main.o $(RES) ! LIBS = -L"/lib" -L"../commonjava" -L"../util-core" -mwindows ../commonjava/CommonJava.a ../util-core/util-core.a ../util-gui/util-gui.a $(FLTK-LDFLAGS) -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg ../jnismooth/jnismooth.a INCS = -I"/include" -I"$(JDK)/include/win32" -I"$(JDK)/include" -I"../commonjava" -I"../util-core" ! CXXINCS = -g -I"/include/c++" -I"/include/c++/mingw32" -I"/include/c++/backward" -I"/include" -I"$(JDK)/include/win32" -I"$(JDK)/include" -I"../commonjava" -I../util-core -I../util-gui -I../jnismooth BIN = JWrap.exe CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" |
From: Rodrigo R. <re...@us...> - 2007-05-27 09:14:55
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/autodownload In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14482/skeletons/autodownload Modified Files: mainres.rc customdownload.skel main.cpp autodownload.skel Makefile.win Log Message: splash screen support and small overall refactoring Index: Makefile.win =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/autodownload/Makefile.win,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.win 18 May 2007 21:33:58 -0000 1.7 --- Makefile.win 27 May 2007 09:14:50 -0000 1.8 *************** *** 1,46 **** ! # Project: util-core ! ! PROJECTNAME=autodownload ! ##libmscabd_la_SOURCES = mspack/system.c mspack/cabd.c mspack/lzxd.c mspack/mszipd.c mspack/qtmd.c ! ##libmscabd_la_OBJS = system.o cabd.o lzxd.o mszipd.o qtmd.o ! ! SHELL = /bin/sh ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = ! RES = JWrap_private.res ! LINKOBJ = main.o execcab.o execexe.o $(RES) ! OBJ = main.o execcab.o execexe.o $(libmscabd_la_OBJS) $(RES) ! FLTK-LDFLAGS = $(shell fltk-config --ldflags --use-images) ! FLTK-CXXFLAGS = $(shell fltk-config --cxxflags --use-images) ! ##LINKLIBS = ../commonjava/CommonJava.a ../util-core/util-core.a mspack.a ../util-net/util-net.a ! LINKLIBS = ../commonjava/CommonJava.a ../util-net/util-net.a ../util-core/util-core.a ! LIBS = -L. -L"$(MINGW)/lib" -L"/lib" -lws2_32 -L"/lib" -L"../commonjava" -mwindows -L"../util-core" -L"../util-net" $(LINKLIBS) $(FLTK-LDFLAGS) -lsetupapi -lwininet ! INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" $(FLTK-CXXFLAGS) ! BIN = autodownload.exe ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! CFLAGS = $(INCS) ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(BIN) all-after ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) JWrap_private.res ! ! $(BIN): $(LINKOBJ) $(LINKLIBS) ! $(CPP) $(CXXFLAGS) $(LINKOBJ) $(LIBS) -o $(BIN) ! ! #mspack.a: $(libmscabd_la_SOURCES) ! # $(CC) -c -Imspack $(libmscabd_la_SOURCES) ! # ar r mspack.a $(libmscabd_la_OBJS) ! # ranlib mspack.a ! ! JWrap_private.res: JWrap_private.rc mainres.rc ! $(WINDRES) -i JWrap_private.rc -I rc -o JWrap_private.res -O coff ! ! main.o: main.cpp ! $(CPP) -c main.cpp $(CXXFLAGS) --- 1,46 ---- ! # Project: util-core ! ! PROJECTNAME=autodownload ! ##libmscabd_la_SOURCES = mspack/system.c mspack/cabd.c mspack/lzxd.c mspack/mszipd.c mspack/qtmd.c ! ##libmscabd_la_OBJS = system.o cabd.o lzxd.o mszipd.o qtmd.o ! ! SHELL = /bin/sh ! RM = rm -f ! CPP = g++.exe ! CC = gcc.exe ! WINDRES = windres.exe ! MINGW = ! RES = JWrap_private.res ! LINKOBJ = main.o execcab.o execexe.o $(RES) ! OBJ = main.o execcab.o execexe.o $(libmscabd_la_OBJS) $(RES) ! FLTK-LDFLAGS = $(shell fltk-config --use-images --ldflags ) ! FLTK-CXXFLAGS = $(shell fltk-config --use-images --cxxflags ) ! ##LINKLIBS = ../commonjava/CommonJava.a ../util-core/util-core.a mspack.a ../util-net/util-net.a ! LINKLIBS = ../commonjava/CommonJava.a ../util-net/util-net.a ../util-gui/util-gui.a ../util-core/util-core.a ../jnismooth/jnismooth.a ../util-gui/util-gui.a ! LIBS = -L. -L"$(MINGW)/lib" -L"/lib" -lws2_32 -L"/lib" -L"../commonjava" -mwindows -L"../util-core" -L"../util-net" -L"../util-gui" $(LINKLIBS) -lsetupapi -lwininet $(FLTK-LDFLAGS) -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg ! INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" ! CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" -I"../util-gui" -I"../jnismooth" $(FLTK-CXXFLAGS) ! BIN = autodownload.exe ! CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)" ! CFLAGS = $(INCS) ! ! .PHONY: all all-before all-after clean clean-custom $(PROJECTNAME) ! ! all: all-before $(BIN) all-after ! ! clean: clean-custom ! $(RM) $(OBJ) $(BIN) JWrap_private.res ! ! $(BIN): $(LINKOBJ) $(LINKLIBS) ! $(CPP) $(CXXFLAGS) $(LINKOBJ) $(LIBS) -o $(BIN) ! ! #mspack.a: $(libmscabd_la_SOURCES) ! # $(CC) -c -Imspack $(libmscabd_la_SOURCES) ! # ar r mspack.a $(libmscabd_la_OBJS) ! # ranlib mspack.a ! ! JWrap_private.res: JWrap_private.rc mainres.rc ! $(WINDRES) -i JWrap_private.rc -I rc -o JWrap_private.res -O coff ! ! main.o: main.cpp ! $(CPP) -c main.cpp $(CXXFLAGS) Index: main.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/autodownload/main.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** main.cpp 19 May 2007 15:11:53 -0000 1.10 --- main.cpp 27 May 2007 09:14:50 -0000 1.11 *************** *** 33,36 **** --- 33,43 ---- #include "execcab.h" + #include <FL/Fl_Shared_Image.H> + #include "Splash.h" + + #include "JniSmooth.h" + #include "JniSmoothRegister.h" + #include "splashhelper.h" + #include "JVMBase.h" ResourceManager* globalResMan; *************** *** 59,63 **** --- 66,90 ---- } + void displaySplash(void *param) + { + } + class JVMListener : public JVMSetUpListener + { + virtual void jvmHasPid(int pid) + { + splashwindow_setProcessId(pid); + } + }; + + // SplashWindow* sw; + + // void splashwindow_runnerthread(void* param) + // { + // Fl::lock(); + // sw->splashOn(); + // Fl::run(); + // Fl::unlock(); + // } int WINAPI WinMain (HINSTANCE hThisInstance, *************** *** 69,72 **** --- 96,108 ---- SingleInstanceManager instanceman; + vector<JNIRegister*> jnireg; + jnireg.push_back(new JniSmoothRegister()); + + // fl_register_images(); + // sw = new SplashWindow("z:\\SOURCE\\RELEASE\\jsmooth\\skeletons\\autodownload\\splash.jpg"); + + // Thread splashthread; + // splashthread.start(splashwindow_runnerthread, NULL); + globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID); *************** *** 102,105 **** --- 138,149 ---- } + std::string splashimg = globalResMan->getProperty("skel_SplashImg"); + DEBUG("splash: " + splashimg); + if (splashimg.size() > 0) + { + splashwindow_start(splashimg); + // Sleep(1000); + } + DEBUG(string("Main class: ") + globalResMan->getMainName()); *************** *** 112,115 **** --- 156,160 ---- JavaMachineManager man(*globalResMan); + man.setJNI(jnireg); man.setAcceptExe(true); man.setAcceptDLL(true); *************** *** 120,123 **** --- 165,173 ---- man.setPreferDLL(globalResMan->getBooleanProperty("skel_SingleProcess")); + if (splashimg.size() > 0) + { + man.addListener(new JVMListener()); + } + if (man.run() == false) { Index: customdownload.skel =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/autodownload/customdownload.skel,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** customdownload.skel 18 May 2007 21:33:58 -0000 1.5 --- customdownload.skel 27 May 2007 09:14:50 -0000 1.6 *************** *** 44,47 **** --- 44,54 ---- </skeletonProperties> <skeletonProperties> + <description>SKEL_GENERIC_PROPERTY_SPLASH_DESCRIPTION</description> + <idName>SplashImg</idName> + <label>SKEL_GENERIC_PROPERTY_SPLASH</label> + <type>imgselector</type> + <value></value> + </skeletonProperties> + <skeletonProperties> <description>SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION</description> <idName>Debug</idName> Index: mainres.rc =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/autodownload/mainres.rc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mainres.rc 18 May 2007 21:33:58 -0000 1.2 --- mainres.rc 27 May 2007 09:14:50 -0000 1.3 *************** *** 1,3 **** - #include "resource.h" --- 1,2 ---- Index: autodownload.skel =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/autodownload/autodownload.skel,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** autodownload.skel 18 May 2007 21:33:58 -0000 1.7 --- autodownload.skel 27 May 2007 09:14:50 -0000 1.8 *************** *** 44,47 **** --- 44,54 ---- </skeletonProperties> <skeletonProperties> + <description>SKEL_GENERIC_PROPERTY_SPLASH_DESCRIPTION</description> + <idName>SplashImg</idName> + <label>SKEL_GENERIC_PROPERTY_SPLASH</label> + <type>imgselector</type> + <value></value> + </skeletonProperties> + <skeletonProperties> <description>SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION</description> <idName>Debug</idName> |