|
From: Andreas R. <and...@us...> - 2002-05-26 18:52:14
|
Update of /cvsroot/squeak/squeak/platforms/win32/vm
In directory usw-pr-cvs1:/tmp/cvs-serv12825
Modified Files:
sqWin32.h sqWin32Args.c sqWin32Intel.c sqWin32Prefs.c
sqWin32Utils.c sqWin32Window.c
Log Message:
* added support for ini-file based on VM name (e.g., "foo.exe" uses "foo.ini").
* added support for "ImageName" in ini-file (provides full or relative image name)
* added support for "WindowTitle" in ini-file (provides fixed window title)
Index: sqWin32.h
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sqWin32.h 6 May 2002 10:36:25 -0000 1.4
--- sqWin32.h 26 May 2002 18:52:10 -0000 1.5
***************
*** 241,245 ****
#endif
! #define SQUEAK_VM_VERSION TEXT("Squeak 3.2.1 VM (release candidate) from ") TEXT(__DATE__) \
TEXT("\n") TEXT("Compiler: ") TEXT(COMPILER) TEXT(VERSION)
--- 241,245 ----
#endif
! #define SQUEAK_VM_VERSION TEXT("Squeak 3.2.2 VM (release candidate) from ") TEXT(__DATE__) \
TEXT("\n") TEXT("Compiler: ") TEXT(COMPILER) TEXT(VERSION)
***************
*** 257,260 ****
--- 257,267 ----
extern TCHAR vmPath[]; /* full path to interpreter's directory */
extern TCHAR vmName[]; /* name of the interpreter's executable */
+ extern TCHAR windowTitle[]; /* window title string */
+
+ extern const TCHAR U_ON[];
+ extern const TCHAR U_OFF[];
+ extern const TCHAR U_GLOBAL[];
+ extern const TCHAR U_SLASH[];
+ extern const TCHAR U_BACKSLASH[];
#ifndef NO_PREFERENCES
***************
*** 330,333 ****
--- 337,341 ----
TCHAR* toUnicodeNew(const char *ptr); /* Inline Ansi -> Unicode */
char* fromUnicodeNew(const TCHAR *ptr); /* Inline Unicode -> Ansi */
+ TCHAR *lstrrchr(TCHAR *source, TCHAR c);
/******************************************************/
Index: sqWin32Args.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32Args.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sqWin32Args.c 4 May 2002 23:20:28 -0000 1.3
--- sqWin32Args.c 26 May 2002 18:52:10 -0000 1.4
***************
*** 175,196 ****
string = parseStringArg(string, &tmpImageName);
if(!string) return NULL; /* parse error */
!
! if(*tmpImageName && IsImage(tmpImageName))
! {
strcpy(imageName, tmpImageName);
! }
! /* The default image names are taken out so we always
! present a file open dialog when more than one image
! file is in the current directory */
! #if 0
! else
! { /* Not the image name -- use default */
! if(IsImage(DEFAULT_IMAGE_NAME))
! strcpy(imageName, DEFAULT_IMAGE_NAME);
! else if(IsImage(BASE_IMAGE_NAME))
! strcpy(imageName, BASE_IMAGE_NAME);
! }
! #endif
! imageOptions[numOptionsImage++] = imageName;
while(string && *string)
{
--- 175,187 ----
string = parseStringArg(string, &tmpImageName);
if(!string) return NULL; /* parse error */
! if(*imageName == 0) {
! /* only attempt to use image name if none is provided */
! if(*tmpImageName && IsImage(tmpImageName))
strcpy(imageName, tmpImageName);
! } else {
! /* provide image name as second argument if implicitly specified */
! imageOptions[numOptionsImage++] = imageName;
! }
! imageOptions[numOptionsImage++] = tmpImageName;
while(string && *string)
{
Index: sqWin32Intel.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32Intel.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sqWin32Intel.c 4 May 2002 23:20:28 -0000 1.3
--- sqWin32Intel.c 26 May 2002 18:52:10 -0000 1.4
***************
*** 599,602 ****
--- 599,603 ----
int virtualMemory;
+ LoadPreferences();
/* parse command line args */
if(!parseArguments(strdup(GetCommandLine()), args))
Index: sqWin32Prefs.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32Prefs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sqWin32Prefs.c 6 May 2002 10:36:25 -0000 1.4
--- sqWin32Prefs.c 26 May 2002 18:52:10 -0000 1.5
***************
*** 26,33 ****
HMENU vmPrefsMenu; /* preferences menu */
- const TCHAR U_ON[] = TEXT("1");
- const TCHAR U_OFF[] = TEXT("0");
- const TCHAR U_GLOBAL[] = TEXT("Global");
-
/****************************************************************************/
/* Preference functions */
--- 26,29 ----
***************
*** 128,136 ****
}
-
void LoadPreferences()
{
/* Set preferences */
#ifndef WCE_PREFERENCES
fDeferredUpdate =
GetPrivateProfileInt(U_GLOBAL,TEXT("DeferUpdate"),
--- 124,156 ----
}
void LoadPreferences()
{
/* Set preferences */
#ifndef WCE_PREFERENCES
+ int size;
+
+ /* make ini file name based on executable file name */
+ lstrcpy(squeakIniName, vmName);
+ size = lstrlen(squeakIniName);
+ lstrcpy(squeakIniName + (size-3), TEXT("ini"));
+
+ /* get image file name from ini file */
+ size = GetPrivateProfileString(U_GLOBAL, TEXT("ImageFile"),
+ TEXT(""), imageName, MAX_PATH, squeakIniName);
+ if(size > 0) {
+ if( !(imageName[0] == '\\' && imageName[1] == '\\') && !(imageName[1] == ':' && imageName[2] == '\\')) {
+ /* make the path relative to VM directory */
+ lstrcpy(imageName, vmName);
+ (lstrrchr(imageName,U_BACKSLASH[0]))[1] = 0;
+ size = lstrlen(imageName);
+ size = GetPrivateProfileString(U_GLOBAL, TEXT("ImageFile"),
+ TEXT(""), imageName + size, MAX_PATH - size, squeakIniName);
+ }
+ }
+
+ /* get window title from ini file */
+ GetPrivateProfileString(U_GLOBAL, TEXT("WindowTitle"),
+ TEXT(""), windowTitle, MAX_PATH, squeakIniName);
+
fDeferredUpdate =
GetPrivateProfileInt(U_GLOBAL,TEXT("DeferUpdate"),
***************
*** 186,193 ****
HMENU hMenu,pMenu;
- /* make ini file */
- lstrcpy(squeakIniName, vmPath);
- lstrcat(squeakIniName,TEXT("Squeak.ini"));
- LoadPreferences();
pMenu = CreatePopupMenu();
AppendMenu(pMenu,MF_STRING | MF_DISABLED, 0,
--- 206,209 ----
Index: sqWin32Utils.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32Utils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sqWin32Utils.c 4 May 2002 23:20:28 -0000 1.2
--- sqWin32Utils.c 26 May 2002 18:52:10 -0000 1.3
***************
*** 101,104 ****
--- 101,116 ----
}
+ TCHAR *lstrrchr(TCHAR *source, TCHAR c)
+ { TCHAR *tmp;
+
+ /* point to the last char */
+ tmp = source + lstrlen(source)-1;
+ while(tmp >= source)
+ if(*tmp == c) return tmp;
+ else tmp--;
+ return NULL;
+ }
+
+
/****************************************************************************/
/* Helper to pop up a message box with a message formatted from the */
Index: sqWin32Window.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32Window.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** sqWin32Window.c 11 May 2002 17:09:03 -0000 1.7
--- sqWin32Window.c 26 May 2002 18:52:10 -0000 1.8
***************
*** 52,55 ****
--- 52,62 ----
TCHAR vmPath[MAX_PATH+1]; /* full path to interpreter's directory */
TCHAR vmName[MAX_PATH+1]; /* name of the interpreter's executable */
+ TCHAR windowTitle[MAX_PATH]; /* what should we display in the title? */
+
+ const TCHAR U_ON[] = TEXT("1");
+ const TCHAR U_OFF[] = TEXT("0");
+ const TCHAR U_GLOBAL[] = TEXT("Global");
+ const TCHAR U_SLASH[] = TEXT("/");
+ const TCHAR U_BACKSLASH[] = TEXT("\\");
int savedWindowSize= 0; /* initial size of window */
***************
*** 139,145 ****
static sqInputEvent *nextEventPut(void);
- /* UNICODE stuff */
- const TCHAR U_SLASH[] = TEXT("/");
- const TCHAR U_BACKSLASH[] = TEXT("\\");
/****************************************************************************/
--- 146,149 ----
***************
*** 675,679 ****
if(!IsWindow(stWindow)) return;
! wsprintf(titleString,TEXT("Squeak! (%s)"), toUnicode(imageName));
SetWindowText(stWindow,titleString);
}
--- 679,687 ----
if(!IsWindow(stWindow)) return;
! if(*windowTitle) {
! lstrcpy(titleString, windowTitle);
! } else {
! wsprintf(titleString,TEXT("Squeak! (%s)"), toUnicode(imageName));
! }
SetWindowText(stWindow,titleString);
}
***************
*** 2424,2438 ****
/* File Startup */
/****************************************************************************/
-
- static TCHAR *lstrrchr(TCHAR *source, TCHAR c)
- { TCHAR *tmp;
-
- /* point to the last char */
- tmp = source + lstrlen(source)-1;
- while(tmp >= source)
- if(*tmp == c) return tmp;
- else tmp--;
- return NULL;
- }
/* Check if the path/file name is subdirectory of the image path */
--- 2432,2435 ----
|