diff options
author | das <das> | 2001-11-23 02:04:08 (GMT) |
---|---|---|
committer | das <das> | 2001-11-23 02:04:08 (GMT) |
commit | aa409cc42da819e8ab1d081e7a1f175b33c1c2cf (patch) | |
tree | 0d0864ac4fc0b0ff178f5869f1600d2c584109c8 /mac/tkMacInit.c | |
parent | 5efa25f6e1ad2a687cac8c1caab6d8c10f978269 (diff) | |
download | tk-aa409cc42da819e8ab1d081e7a1f175b33c1c2cf.zip tk-aa409cc42da819e8ab1d081e7a1f175b33c1c2cf.tar.gz tk-aa409cc42da819e8ab1d081e7a1f175b33c1c2cf.tar.bz2 |
** upport to 8.4 of mac code changes for 8.3.3 & various new
** changes for 8.4, some already backported to 8.3.4 (patch #435660)
see ChangeLog for details
Diffstat (limited to 'mac/tkMacInit.c')
-rw-r--r-- | mac/tkMacInit.c | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/mac/tkMacInit.c b/mac/tkMacInit.c index ba90fc9..ad3118e 100644 --- a/mac/tkMacInit.c +++ b/mac/tkMacInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacInit.c,v 1.3 1999/04/16 01:51:31 stanton Exp $ + * RCS: @(#) $Id: tkMacInit.c,v 1.4 2001/11/23 02:05:52 das Exp $ */ #include <Resources.h> @@ -63,24 +63,38 @@ TkpInit( * safe interps because file exists is restricted. * to be fixed using [interp issafe] like in Unix & Windows. */ - static char initCmd[] = - "if [file exists $tk_library:tk.tcl] {\n\ - source $tk_library:tk.tcl\n\ - source $tk_library:button.tcl\n\ - source $tk_library:entry.tcl\n\ - source $tk_library:listbox.tcl\n\ - source $tk_library:menu.tcl\n\ - source $tk_library:scale.tcl\n\ - source $tk_library:scrlbar.tcl\n\ - source $tk_library:text.tcl\n\ - source $tk_library:comdlg.tcl\n\ - source $tk_library:msgbox.tcl\n\ - } else {\n\ - set msg \"can't find tk resource or $tk_library:tk.tcl;\"\n\ - append msg \" perhaps you need to\\ninstall Tk or set your \"\n\ - append msg \"TK_LIBRARY environment variable?\"\n\ - error $msg\n\ - }"; + static char initCmd[] = "\ +proc sourcePath {file} {\n\ + global tk_library\n\ + if {[catch {uplevel #0 [list source $tk_library:$file.tcl]}] == 0} {\n\ + return\n\ + }\n\ + if {[catch {uplevel #0 [list source -rsrc $file]}] == 0} {\n\ + return\n\ + }\n\ + rename sourcePath {}\n\ + set msg \"can't find $file resource or a usable $file.tcl file\"\n\ + append msg \" perhaps you need to install Tk or set your \"\n\ + append msg \"TK_LIBRARY environment variable?\"\n\ + error $msg\n\ +}\n\ +sourcePath tk\n\ +sourcePath button\n\ +sourcePath dialog\n\ +sourcePath entry\n\ +sourcePath focus\n\ +sourcePath listbox\n\ +sourcePath menu\n\ +sourcePath optMenu\n\ +sourcePath palette\n\ +sourcePath scale\n\ +sourcePath scrlbar\n\ +sourcePath tearoff\n\ +sourcePath text\n\ +sourcePath bgerror\n\ +sourcePath msgbox\n\ +sourcePath comdlg\n\ +rename sourcePath {}"; Tcl_DStringInit(&path); @@ -100,13 +114,15 @@ TkpInit( tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY); if (tempPath != NULL) { Tcl_DString libPath; + char *argv[3]; - Tcl_JoinPath(1, &tempPath, &path); - + argv[0] = tempPath; + argv[1] = "Tool Command Language"; Tcl_DStringInit(&libPath); - Tcl_DStringAppend(&libPath, ":Tool Command Language:tk", -1); + Tcl_DStringAppend(&libPath, "tk", -1); Tcl_DStringAppend(&libPath, TK_VERSION, -1); - Tcl_JoinPath(1, &libPath.string, &path); + argv[2] = libPath.string; + Tcl_JoinPath(3, argv, &path); Tcl_DStringFree(&libPath); libDir = path.string; } @@ -121,30 +137,7 @@ TkpInit( Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY); Tcl_DStringFree(&path); - /* - * Source the needed Tk libraries from the resource - * fork of the application. - */ - result = Tcl_MacEvalResource(interp, "tk", 0, NULL); - result |= Tcl_MacEvalResource(interp, "button", 0, NULL); - result |= Tcl_MacEvalResource(interp, "entry", 0, NULL); - result |= Tcl_MacEvalResource(interp, "listbox", 0, NULL); - result |= Tcl_MacEvalResource(interp, "menu", 0, NULL); - result |= Tcl_MacEvalResource(interp, "scale", 0, NULL); - result |= Tcl_MacEvalResource(interp, "scrollbar", 0, NULL); - result |= Tcl_MacEvalResource(interp, "text", 0, NULL); - result |= Tcl_MacEvalResource(interp, "dialog", 0, NULL); - result |= Tcl_MacEvalResource(interp, "focus", 0, NULL); - result |= Tcl_MacEvalResource(interp, "optionMenu", 0, NULL); - result |= Tcl_MacEvalResource(interp, "palette", 0, NULL); - result |= Tcl_MacEvalResource(interp, "tearoff", 0, NULL); - result |= Tcl_MacEvalResource(interp, "tkerror", 0, NULL); - result |= Tcl_MacEvalResource(interp, "comdlg", 0, NULL); - result |= Tcl_MacEvalResource(interp, "msgbox", 0, NULL); - - if (result != TCL_OK) { result = Tcl_Eval(interp, initCmd); - } return result; } |