head	1.12;
access;
symbols
	core-8-4-19:1.10
	core-8-4-18:1.10
	core-8-4-17:1.10
	core-8-4-16:1.10
	core-8-4-15:1.10
	core-8-4-14:1.10
	core-8-4-13:1.10
	core-8-4-12:1.10
	core-8-4-11:1.10
	core-8-4-10:1.10
	core-8-4-9-branch:1.10.0.6
	core-8-4-9:1.10
	core-8-4-8:1.10
	core-8-4-7:1.10
	core-8-5-a1:1.11
	core-8-4-6:1.10
	core-8-4-5:1.10
	mistachkin-dev-branch:1.10.0.4
	core-8-4-4:1.10
	core-8-4-3:1.10
	core-8-4-branch:1.10.0.2
	core-8-4-2:1.10
	core-8-4-1:1.10
	core-8-3-5:1.3.12.3
	core-8-4-0:1.10
	macosx-8-4-merge-2002-08-31-trunk:1.10
	macosx-8-4-premerge-2002-08-31-branch:1.3.18.3
	macosx-8-4-premerge-2002-08-31-trunk:1.10
	macosx-8-4-merge-2002-08-30-branch:1.3.18.3
	macosx-8-4-merge-2002-08-30-trunk:1.10
	macosx-8-4-merge-2002-08-20-branch:1.3.18.3
	macosx-8-4-merge-2002-08-20-trunk:1.10
	core-8-4-b2:1.10
	core-8-4-b1:1.10
	macosx-premerge-6-9-02:1.3.18.2
	core-8-4-a4:1.8
	core-8-3-4:1.3.12.2
	macosx-8-4-branch:1.3.0.18
	macosx-8-4-branchpoint:1.3
	core-8-4-a3:1.3
	core-8-3-3:1.3
	dgp-privates-into-namespace:1.3.0.16
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.3.0.14
	core-8-4-a2:1.3
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.12
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.10
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.8
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.6
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.4
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.2
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.2
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.2
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.12
date	2004.03.17.18.15.46;	author das;	state dead;
branches;
next	1.11;

1.11
date	2004.01.13.02.06.01;	author davygrvy;	state Exp;
branches;
next	1.10;

1.10
date	2002.05.20.12.30.16;	author das;	state Exp;
branches;
next	1.9;

1.9
date	2002.05.20.10.21.31;	author das;	state Exp;
branches;
next	1.8;

1.8
date	2002.02.08.02.57.11;	author dgp;	state Exp;
branches;
next	1.7;

1.7
date	2002.01.27.11.10.53;	author das;	state Exp;
branches;
next	1.6;

1.6
date	2002.01.25.21.09.37;	author dgp;	state Exp;
branches;
next	1.5;

1.5
date	2001.12.27.22.45.10;	author das;	state Exp;
branches;
next	1.4;

1.4
date	2001.11.23.02.05.52;	author das;	state Exp;
branches;
next	1.3;

1.3
date	99.04.16.01.51.31;	author stanton;	state Exp;
branches
	1.3.12.1
	1.3.14.1
	1.3.18.1;
next	1.2;

1.2
date	98.09.14.18.23.36;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.57.02;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.29.00.25.40;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.18.08;	author stanton;	state Exp;
branches;
next	;

1.3.12.1
date	2001.10.17.19.29.51;	author das;	state Exp;
branches;
next	1.3.12.2;

1.3.12.2
date	2001.10.19.19.40.18;	author das;	state Exp;
branches;
next	1.3.12.3;

1.3.12.3
date	2002.05.20.12.29.37;	author das;	state Exp;
branches;
next	;

1.3.14.1
date	2002.04.02.20.57.54;	author hobbs;	state Exp;
branches;
next	;

1.3.18.1
date	2001.10.15.09.22.00;	author wolfsuit;	state Exp;
branches;
next	1.3.18.2;

1.3.18.2
date	2002.02.05.02.25.16;	author wolfsuit;	state Exp;
branches;
next	1.3.18.3;

1.3.18.3
date	2002.06.10.05.38.24;	author wolfsuit;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@/* 
 * tkMacInit.c --
 *
 *	This file contains Mac-specific interpreter initialization
 *	functions.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * 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.11 2004/01/13 02:06:01 davygrvy Exp $
 */

#include <Resources.h>
#include <Files.h>
#include <TextUtils.h>
#include <Strings.h>
#include "tkInt.h"
#include "tkMacInt.h"
#include "tclMacInt.h"

/*
 * The following global is used by various parts of Tk to access
 * information in the global qd variable.  It is provided as a pointer
 * in the AppInit because we don't assume that Tk is running as an
 * application.  For example, Tk could be a plugin and may not have
 * access to the qd variable.  This mechanism provides a way for the
 * container application to give a pointer to the qd variable.
 */

QDGlobalsPtr tcl_macQdPtr = NULL;

/*
 *----------------------------------------------------------------------
 *
 * TkpInit --
 *
 *	Performs Mac-specific interpreter initialization related to the
 *      tk_library variable.
 *
 * Results:
 *	A standard Tcl completion code (TCL_OK or TCL_ERROR).  Also
 *	leaves information in the interp's result.
 *
 * Side effects:
 *	Sets "tk_library" Tcl variable, runs initialization scripts
 *	for Tk.
 *
 *----------------------------------------------------------------------
 */

int
TkpInit(
    Tcl_Interp *interp)		/* Interp to initialize. */
{
    CONST char *libDir, *tempPath;
    Tcl_DString path, ds;
    int result;

    static char initCmd[] = "if {[info proc tkInit]==\"\"} {\n\
proc tkInit {} {\n\
proc sourcePath {file} {\n\
  global tk_library\n\
  if {[catch {uplevel #0 [list source [file join $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 dialog\n\
sourcePath focus\n\
sourcePath optMenu\n\
sourcePath palette\n\
sourcePath tearoff\n\
if {[catch {package require msgcat}]} {sourcePath msgcat}\n\
sourcePath bgerror\n\
sourcePath msgbox\n\
sourcePath comdlg\n\
rename sourcePath {}\n\
rename tkInit {}\n\
} }\n\
tkInit";

    Tcl_DStringInit(&path);
    Tcl_DStringInit(&ds);

    /*
     * The tk_library path can be found in several places.  Here is the order
     * in which the are searched.
     *		1) the variable may already exist
     *		2) env array
     *		3) System Folder:Extensions:Tool Command Language:
     */
     
    libDir = Tcl_GetVar(interp, "tk_library", TCL_GLOBAL_ONLY);
    if (libDir == NULL) {
    libDir = TclGetEnv("TK_LIBRARY", &ds);
    }
    if ((libDir == NULL) || (libDir[0] == '\0')) {
    tempPath = TclGetEnv("EXT_FOLDER", &ds);
    if ((tempPath != NULL) && (tempPath[0] != '\0')) {
	    Tcl_DString libPath;
	    CONST char *argv[3];
	    
	    argv[0] = tempPath;
	    argv[1] = "Tool Command Language";	    
	    Tcl_DStringInit(&libPath);
	    Tcl_DStringAppend(&libPath, "tk", -1);
	    argv[2] = Tcl_DStringAppend(&libPath, TK_VERSION, -1);
	    libDir = Tcl_JoinPath(3, argv, &path);
	    Tcl_DStringFree(&libPath);
	}
    }
    if (libDir == NULL) {
	libDir = "no library";
    }

    /*
     * Assign path to the global Tcl variable tcl_library.
     */
    Tcl_SetVar(interp, "tk_library", libDir, TCL_GLOBAL_ONLY);
    Tcl_DStringFree(&path);
    Tcl_DStringFree(&ds);

	result = Tcl_Eval(interp, initCmd);
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpGetAppName --
 *
 *	Retrieves the name of the current application from a platform
 *	specific location.  On the Macintosh we look to see if the
 *	App Name is specified in a resource.  If not, the application 
 *	name is the root of the tail of the path contained in the tcl
 *	variable argv0.
 *
 * Results:
 *	Returns the application name in the given Tcl_DString.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TkpGetAppName(
    Tcl_Interp *interp,		/* The main interpreter. */
    Tcl_DString *namePtr)	/* A previously initialized Tcl_DString. */
{
    int argc;
    CONST char **argv = NULL, *name, *p;
    int nameLength = -1;
    Handle h = NULL;

    h = GetNamedResource('STR ', "\pTk App Name");
    if (h != NULL) {
	HLock(h);
	Tcl_DStringAppend(namePtr, (*h)+1, **h);
	HUnlock(h);
	ReleaseResource(h);
	return;
    }
    
    name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
    if (name != NULL) {
	Tcl_SplitPath(name, &argc, &argv);
	if (argc > 0) {
	    name = argv[argc-1];
	    p = strrchr(name, '.');
	    if (p != NULL) {
		nameLength = p - name;
	    }
	} else {
	    name = NULL;
	}
    }
    if ((name == NULL) || (*name == 0) || (nameLength == 0)) {
	name = "tk";
	nameLength = -1;
    }
    Tcl_DStringAppend(namePtr, name, nameLength);
    if (argv != NULL) {
	ckfree((char *)argv);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDisplayWarning --
 *
 *	This routines is called from Tk_Main to display warning
 *	messages that occur during startup.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Displays a message box.
 *
 *----------------------------------------------------------------------
 */

void
TkpDisplayWarning(
    CONST char *msg,		/* Message to be displayed. */
    CONST char *title)		/* Title of warning. */
{
    Tcl_DString ds;
    Tcl_DStringInit(&ds);
    Tcl_DStringAppend(&ds, title, -1);
    Tcl_DStringAppend(&ds, ": ", -1);
    Tcl_DStringAppend(&ds, msg, -1);
    Tcl_Panic(Tcl_DStringValue(&ds));
    Tcl_DStringFree(&ds);
}
@


1.11
log
@	* generic/tk3d.c:	All uses of 'panic' (the macro) changed
	* generic/tkBind.c:	to 'Tcl_Panic' (the function).  The #define
	* generic/tkBitmap.c:	of panic in tcl.h clearly states it is
	* generic/tkCanvArc.c:	deprecated in the comments.
	* generic/tkCanvBmap.c: [Tcl Patch 865264]
	* generic/tkCanvImg.c:
	* generic/tkCanvLine.c:
	* generic/tkCanvPoly.c:
	* generic/tkCanvText.c:
	* generic/tkCanvWind.c:
	* generic/tkColor.c:
	* generic/tkConfig.c:
	* generic/tkCursor.c:
	* generic/tkError.c:
	* generic/tkEvent.c:
	* generic/tkFocus.c:
	* generic/tkFont.c:
	* generic/tkFrame.c:
	* generic/tkGC.c:
	* generic/tkGrid.c:
	* generic/tkImgBmap.c:
	* generic/tkImgPhoto.c:
	* generic/tkImgUtil.c:
	* generic/tkMenu.c:
	* generic/tkObj.c:
	* generic/tkPack.c:
	* generic/tkPlace.c:
	* generic/tkRectOval.c:
	* generic/tkSelect.c:
	* generic/tkText.c:
	* generic/tkTextBTree.c:
	* generic/tkTextDisp.c:
	* generic/tkTextImage.c:
	* generic/tkTextIndex.c:
	* generic/tkTextMark.c:
	* generic/tkTextWind.c:
	* generic/tkVisual.c:
	* generic/tkWindow.c:
	* mac/tkMacAppInit.c:
	* mac/tkMacAppearanceStubs.c:
	* mac/tkMacButton.c:
	* mac/tkMacDraw.c:
	* mac/tkMacEmbed.c:
	* mac/tkMacFont.c:
	* mac/tkMacInit.c:
	* mac/tkMacMenus.c:
	* mac/tkMacPort.h:
	* mac/tkMacSubwindows.c:
	* mac/tkMacWm.c:
	* mac/tkMacXStubs.c:
	* macosx/tkMacOSXEmbed.c:
	* macosx/tkMacOSXFont.c:
	* macosx/tkMacOSXMenus.c:
	* macosx/tkMacOSXNotify.c:
	* macosx/tkMacOSXPort.h:
	* macosx/tkMacOSXSubwindows.c:
	* macosx/tkMacOSXWm.c:
	* macosx/tkMacOSXXStubs.c:
	* unix/tkUnix3d.c:
	* unix/tkUnixColor.c:
	* unix/tkUnixEmbed.c:
	* unix/tkUnixEvent.c:
	* unix/tkUnixFocus.c:
	* unix/tkUnixFont.c:
	* unix/tkUnixSelect.c:
	* unix/tkUnixSend.c:
	* unix/tkUnixWm.c:
	* win/tkWin3d.c:
	* win/tkWinButton.c:
	* win/tkWinColor.c:
	* win/tkWinDialog.c:
	* win/tkWinDraw.c:
	* win/tkWinEmbed.c:
	* win/tkWinFont.c:
	* win/tkWinPixmap.c:
	* win/tkWinPointer.c:
	* win/tkWinScrlbr.c:
	* win/tkWinWm.c:
	* win/tkWinX.c:
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.10 2002/05/20 12:30:16 das Exp $
@


1.10
log
@	* mac/tkMacInit.c:
	* mac/tkMacTclCode.r: include msgcat package in resources
	as bgerror depends on it. Restores ability of mac static
	build to run standalone (except for encoding file issues).
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.9 2002/05/20 10:21:31 das Exp $
d226 1
a226 1
    panic(Tcl_DStringValue(&ds));
@


1.9
log
@	* mac/tkMacInit.c:
	* library/console.tcl:
	* library/tk.tcl: fix tk.tcl not sourcing library files
	that define bindings at startup on mac. (independent of
	tk library files being in resources or on auto_path)
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.8 2002/02/08 02:57:11 dgp Exp $
d83 1
@


1.8
log
@	* modified some callers of Tcl routines that
        were restored to return (char *) pointing into Tcl_DStrings.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.7 2002/01/27 11:10:53 das Exp $
a77 1
sourcePath button\n\
a78 1
sourcePath entry\n\
a79 2
sourcePath listbox\n\
sourcePath menu\n\
a81 2
sourcePath scale\n\
sourcePath scrlbar\n\
a82 1
sourcePath text\n\
a85 1
sourcePath spinbox\n\
@


1.7
log
@	* generic/tkFileFilter.c:
	* mac/tkMacInit.c:
	* mac/tkMacKeyboard.c:
	* mac/tkMacMenus.c: TIP 27 CONSTification induced changes
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.6 2002/01/25 21:09:37 dgp Exp $
d124 2
a125 3
	    Tcl_DStringAppend(&libPath, TK_VERSION, -1);
	    argv[2] = Tcl_DStringValue(&libPath);
	    Tcl_JoinPath(3, argv, &path);
a126 1
	    libDir = Tcl_DStringValue(&path);
@


1.6
log
@	* Updated callers of Tcl_SplitList and Tcl_Merge.
	* Updated callers of Tcl_GetStringResult.
	  Rewrote PrintScrollFractions to ScrollFractions to stop scribbling
	  directly on interp->result.
	* Updated callers of Tcl_GetVar, Tcl_GetVar2
	* Updated callers of Tcl_SplitPath, Tcl_JoinPath, and
	  Tcl_TranslateFileName.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.5 2001/12/27 22:45:10 das Exp $
d173 1
d192 1
a192 1
		*p = '\0';
d198 1
a198 1
    if ((name == NULL) || (*name == 0)) {
d200 1
d202 1
a202 1
    Tcl_DStringAppend(namePtr, name, -1);
@


1.5
log
@	* mac/mac/tkMacInit.c:
	* mac/mac/tkMacResource.r: synced up tkInit features to unix/win:
	use existing tkInit proc if defined. Added spinbox.tcl resource.
	Used TclGetEnv() instead of Tcl_GetVar2(interp, env)
	* mac/tkMacApplication.r:
	* mac/tkMacLibrary.r: minor version resources cleanup
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.4 2001/11/23 02:05:52 das Exp $
d57 1
a57 1
    char *libDir, *tempPath;
d118 1
a118 1
	    char *argv[3];
d172 1
a172 1
    char **argv = NULL, *name, *p;
d225 2
a226 2
    char *msg,			/* Message to be displayed. */
    char *title)		/* Title of warning. */
@


1.4
log
@	**  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
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3 1999/04/16 01:51:31 stanton Exp $
d58 1
a58 1
    Tcl_DString path;
d61 2
a62 6
    /*
     * The following does not work with
     * safe interps because file exists is restricted.
     * to be fixed using [interp issafe] like in Unix & Windows.
     */
    static char initCmd[] = "\
d65 1
a65 1
  if {[catch {uplevel #0 [list source $tk_library:$file.tcl]}] == 0} {\n\
d72 3
a74 3
  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\
d93 5
a97 1
rename sourcePath {}";
d100 1
d112 1
a112 1
	libDir = Tcl_GetVar2(interp, "env", "TK_LIBRARY", TCL_GLOBAL_ONLY);
d114 3
a116 3
    if (libDir == NULL) {
	tempPath = Tcl_GetVar2(interp, "env", "EXT_FOLDER", TCL_GLOBAL_ONLY);
	if (tempPath != NULL) {
d125 1
a125 1
	    argv[2] = libPath.string;
d128 1
a128 1
	    libDir = path.string;
d140 1
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d66 32
a97 18
    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\
	}";
d117 1
d119 2
a120 2
	    Tcl_JoinPath(1, &tempPath, &path);
	    
d122 1
a122 1
	    Tcl_DStringAppend(&libPath, ":Tool Command Language:tk", -1);
d124 2
a125 1
	    Tcl_JoinPath(1, &libPath.string, &path);
a139 22
    /*
     * 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) {
a140 1
    }
@


1.3.14.1
log
@sync with head
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.8 2002/02/08 02:57:11 dgp Exp $
d57 2
a58 2
    CONST char *libDir, *tempPath;
    Tcl_DString path, ds;
d61 23
a83 37
    static char initCmd[] = "if {[info proc tkInit]==\"\"} {\n\
proc tkInit {} {\n\
proc sourcePath {file} {\n\
  global tk_library\n\
  if {[catch {uplevel #0 [list source [file join $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\
sourcePath spinbox\n\
rename sourcePath {}\n\
rename tkInit {}\n\
} }\n\
tkInit";
a85 1
    Tcl_DStringInit(&ds);
d97 1
a97 1
    libDir = TclGetEnv("TK_LIBRARY", &ds);
d99 3
a101 3
    if ((libDir == NULL) || (libDir[0] == '\0')) {
    tempPath = TclGetEnv("EXT_FOLDER", &ds);
    if ((tempPath != NULL) && (tempPath[0] != '\0')) {
a102 1
	    CONST char *argv[3];
d104 2
a105 2
	    argv[0] = tempPath;
	    argv[1] = "Tool Command Language";	    
d107 3
a109 3
	    Tcl_DStringAppend(&libPath, "tk", -1);
	    argv[2] = Tcl_DStringAppend(&libPath, TK_VERSION, -1);
	    libDir = Tcl_JoinPath(3, argv, &path);
d111 1
a122 1
    Tcl_DStringFree(&ds);
d124 22
d147 1
d177 1
a177 2
    CONST char **argv = NULL, *name, *p;
    int nameLength = -1;
d196 1
a196 1
		nameLength = p - name;
d202 1
a202 1
    if ((name == NULL) || (*name == 0) || (nameLength == 0)) {
a203 1
	nameLength = -1;
d205 1
a205 1
    Tcl_DStringAppend(namePtr, name, nameLength);
d230 2
a231 2
    CONST char *msg,		/* Message to be displayed. */
    CONST char *title)		/* Title of warning. */
@


1.3.12.1
log
@Backport of some mac specific changes added to 8.4 since 8.3.3
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3 1999/04/16 01:51:31 stanton Exp $
a102 1
	    char *argv[3];
d104 2
a105 2
	    argv[0] = tempPath;
	    argv[1] = "Tool Command Language";	    
d107 1
a107 1
	    Tcl_DStringAppend(&libPath, "tk", -1);
d109 1
a109 2
	    argv[2] = libPath.string;
	    Tcl_JoinPath(3, argv, &path);
@


1.3.12.2
log
@        * generic/tkConsole.c:
        * library/console.tcl:
        * mac/tkMacInit.c:
        * mac/tkMacResource.r: corrected how mac deals with tcl library
        files present both in resources and in $tk_library directory.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3.12.1 2001/10/17 19:29:51 das Exp $
d66 18
a83 32
    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 {}";
d126 22
d149 1
@


1.3.12.3
log
@	* mac/tkMacInit.c:
	* mac/tkMacResource.r: include msgcat package in resources
	as bgerror depends on it. Restores ability of mac static
	build to run standalone (except for encoding file issues).
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3.12.2 2001/10/19 19:40:18 das Exp $
d69 1
a69 1
  if {[catch {uplevel #0 [list source [file join $tk_library $file.tcl]]}] == 0} {\n\
a93 1
if {[catch {package require msgcat}]} {sourcePath msgcat}\n\
@


1.3.18.1
log
@First checkin of support for Tk on Mac OS X.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3 1999/04/16 01:51:31 stanton Exp $
a84 1
    Tcl_SetVar2(interp, "tcl_platform", "windowingsystem", "classic", TCL_GLOBAL_ONLY);
@


1.3.18.2
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.3.18.1 2001/10/15 09:22:00 wolfsuit Exp $
d57 2
a58 2
    CONST char *libDir, *tempPath;
    Tcl_DString path, ds;
d61 23
a83 37
    static char initCmd[] = "if {[info proc tkInit]==\"\"} {\n\
proc tkInit {} {\n\
proc sourcePath {file} {\n\
  global tk_library\n\
  if {[catch {uplevel #0 [list source [file join $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\
sourcePath spinbox\n\
rename sourcePath {}\n\
rename tkInit {}\n\
} }\n\
tkInit";
a86 1
    Tcl_DStringInit(&ds);
d98 1
a98 1
    libDir = TclGetEnv("TK_LIBRARY", &ds);
d100 3
a102 3
    if ((libDir == NULL) || (libDir[0] == '\0')) {
    tempPath = TclGetEnv("EXT_FOLDER", &ds);
    if ((tempPath != NULL) && (tempPath[0] != '\0')) {
a103 1
	    CONST char *argv[3];
d105 2
a106 2
	    argv[0] = tempPath;
	    argv[1] = "Tool Command Language";	    
d108 1
a108 1
	    Tcl_DStringAppend(&libPath, "tk", -1);
d110 1
a110 2
	    argv[2] = Tcl_DStringValue(&libPath);
	    Tcl_JoinPath(3, argv, &path);
d112 1
a112 1
	    libDir = Tcl_DStringValue(&path);
a123 1
    Tcl_DStringFree(&ds);
d125 22
d148 1
d178 1
a178 2
    CONST char **argv = NULL, *name, *p;
    int nameLength = -1;
d197 1
a197 1
		nameLength = p - name;
d203 1
a203 1
    if ((name == NULL) || (*name == 0) || (nameLength == 0)) {
a204 1
	nameLength = -1;
d206 1
a206 1
    Tcl_DStringAppend(namePtr, name, nameLength);
d231 2
a232 2
    CONST char *msg,		/* Message to be displayed. */
    CONST char *title)		/* Title of warning. */
@


1.3.18.3
log
@Merging with TOT as of 06/09/2002.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d78 1
d80 1
d82 2
d86 2
d89 1
a89 1
if {[catch {package require msgcat}]} {sourcePath msgcat}\n\
d93 1
d99 1
d125 3
a127 2
	    argv[2] = Tcl_DStringAppend(&libPath, TK_VERSION, -1);
	    libDir = Tcl_JoinPath(3, argv, &path);
d129 1
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d7 1
a7 1
 * Copyright (c) 1995-1996 Sun Microsystems, Inc.
d44 1
a44 1
 *	leaves information in interp->result.
@


1.1
log
@Initial revision
@
text
@d12 1
a12 1
 * SCCS: @@(#) tkMacInit.c 1.30 96/12/17 15:20:16
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d7 1
a7 1
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
d44 1
a44 1
 *	leaves information in the interp's result.
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacInit.c,v 1.2 1998/09/14 18:23:36 stanton Exp $
@


