summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Wish.pbproj/jingham.pbxuser136
-rw-r--r--macosx/Wish.pbproj/project.pbxproj119
-rw-r--r--macosx/tkMacOSXDefault.h4
-rw-r--r--macosx/tkMacOSXDialog.c159
-rw-r--r--macosx/tkMacOSXDraw.c336
-rw-r--r--macosx/tkMacOSXEvent.c4
-rw-r--r--macosx/tkMacOSXHLEvents.c3
-rw-r--r--macosx/tkMacOSXInit.c6
-rw-r--r--macosx/tkMacOSXKeyEvent.c1
-rw-r--r--macosx/tkMacOSXMenu.c29
-rw-r--r--macosx/tkMacOSXMenus.c15
-rw-r--r--macosx/tkMacOSXMouseEvent.c1
-rw-r--r--macosx/tkMacOSXWindowEvent.c1
-rw-r--r--macosx/tkMacOSXWm.c226
-rw-r--r--macosx/tkMacOSXXStubs.c10
15 files changed, 849 insertions, 201 deletions
diff --git a/macosx/Wish.pbproj/jingham.pbxuser b/macosx/Wish.pbproj/jingham.pbxuser
index 007485b..7d26fab 100644
--- a/macosx/Wish.pbproj/jingham.pbxuser
+++ b/macosx/Wish.pbproj/jingham.pbxuser
@@ -1,5 +1,11 @@
// !$*UTF8*$!
{
+ F50D961501961F0201DC9062 = {
+ fileReference = F5375551016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 902;
+ state = 2;
+ };
F537552A016C352C01DC9062 = {
activeBuildStyle = F537552C016C352C01DC9062;
activeTarget = F53756A0016C4DD401DC9062;
@@ -16,68 +22,78 @@
F571FE4E01796F9201DC9062,
F571FE4F0179702301DC9062,
F571FE500179702301DC9062,
- F5D47B92017C934C01DC9062,
- F54B24D6017FF76601DC9062,
- F54B24D7017FFFBF01DC9062,
+ F583DC0E018D092D01DC9062,
+ F583DC0F018D0CB501DC9062,
+ F583DC13018D2B4A01DC9062,
+ F58907BE018DCE8F01DC9062,
+ F58907C5018DD1C301DC9062,
+ F50D961501961F0201DC9062,
+ F566083B0197283B01DC9062,
+ F566083C0197823801DC9062,
+ F5A5146F01D05DC201DC9062,
+ F5A5147001D0758C01DC9062,
+ F5A852D6020F6C6C01DC9062,
);
+ intermediatesDirectory = /Volumes/CodeBits/jingham/Tcl/Build;
perUserDictionary = {
PBXWorkspaceConfiguration = {
- ContentSize = "{906, 673}";
+ ContentSize = "{906, 681}";
LeftSlideOut = {
ActiveTab = 0;
- Frame = "{{0, 23}, {906, 650}}";
+ Frame = "{{0, 23}, {906, 658}}";
Split0 = {
- Frame = "{{322, 0}, {584, 650}}";
+ ActiveTab = 2;
+ Frame = "{{259, 0}, {647, 658}}";
Split0 = {
- Frame = "{{0, 25}, {584, 625}}";
+ Frame = "{{0, 307}, {647, 351}}";
};
SplitCount = 1;
Tab0 = {
Debugger = {
- ActiveTab = 1;
- Frame = "{{0, 0}, {516, 264}}";
+ ActiveTab = 0;
+ Frame = "{{0, 0}, {647, 264}}";
Split0 = {
- Frame = "{{0, 263}, {516, 1}}";
+ Frame = "{{0, 136}, {647, 128}}";
Split0 = {
- Frame = "{{0, 0}, {66, 1}}";
+ Frame = "{{0, 0}, {187, 128}}";
};
Split1 = {
- Frame = "{{75, 0}, {441, 1}}";
+ Frame = "{{196, 0}, {451, 128}}";
};
SplitCount = 2;
};
SplitCount = 1;
Tab0 = {
- Frame = "{{0, 0}, {616, 112}}";
+ Frame = "{{0, 0}, {647, 112}}";
};
Tab1 = {
- Frame = "{{0, 0}, {516, 238}}";
+ Frame = "{{0, 0}, {647, 114}}";
};
TabCount = 2;
};
- Frame = "{{0, 0}, {516, 264}}";
+ Frame = "{{0, 0}, {647, 264}}";
LauncherConfigVersion = 4;
};
Tab1 = {
- Frame = "{{0, 0}, {516, 133}}";
+ Frame = "{{0, 0}, {647, 133}}";
LauncherConfigVersion = 3;
Runner = {
- Frame = "{{0, 0}, {516, 133}}";
+ Frame = "{{0, 0}, {647, 133}}";
};
};
Tab2 = {
- BuildMessageFrame = "{{0, 0}, {615, 53}}";
- BuildTranscriptFrame = "{{0, 62}, {615, 126}}";
- Frame = "{{0, 0}, {613, 186}}";
+ BuildMessageFrame = "{{0, 0}, {649, 118}}";
+ BuildTranscriptFrame = "{{0, 127}, {649, 158}}";
+ Frame = "{{0, 0}, {647, 283}}";
};
Tab3 = {
- Frame = "{{0, 0}, {516, 295}}";
+ Frame = "{{0, 0}, {647, 225}}";
};
TabCount = 4;
};
SplitCount = 1;
Tab0 = {
- Frame = "{{0, 0}, {297, 650}}";
+ Frame = "{{0, 0}, {235, 658}}";
};
Tab1 = {
ClassesFrame = "{{0, 0}, {202, 56}}";
@@ -89,22 +105,23 @@
Frame = "{{0, 0}, {200, 644}}";
};
Tab3 = {
- Frame = "{{0, 0}, {200, 651}}";
+ Frame = "{{0, 0}, {177, 658}}";
Split0 = {
- Frame = "{{0, 0}, {200, 312}}";
+ Frame = "{{0, 0}, {177, 314}}";
};
Split1 = {
- Frame = "{{0, 321}, {200, 330}}";
+ Frame = "{{0, 323}, {177, 335}}";
};
SplitCount = 2;
};
Tab4 = {
- Frame = "{{0, 0}, {250, 655}}";
+ Frame = "{{0, 0}, {250, 658}}";
};
TabCount = 5;
};
};
};
+ productDirectory = /Volumes/CodeBits/jingham/Tcl/Products;
wantsIndex = 1;
wantsSCM = -1;
};
@@ -138,17 +155,16 @@
sourceDirectories = (
);
};
- F54B24D6017FF76601DC9062 = {
+ F566083B0197283B01DC9062 = {
fileReference = F5375548016C376E01DC9062;
isa = PBXFileBreakpoint;
- lineNumber = 129;
- state = 1;
+ lineNumber = 208;
+ state = 2;
};
- F54B24D7017FFFBF01DC9062 = {
- fileReference = F53755AA016C389901DC9062;
- isa = PBXFileBreakpoint;
- lineNumber = 141;
- state = 1;
+ F566083C0197823801DC9062 = {
+ isa = PBXSymbolicBreakpoint;
+ state = 2;
+ symbolName = Tcl_CreateObjCommand;
};
F571FE470179562E01DC9062 = {
fileReference = F5375583016C389901DC9062;
@@ -192,16 +208,58 @@
lineNumber = 469;
state = 2;
};
- F5B2CDC10175829501DC9062 = {
- fileReference = F5375583016C389901DC9062;
+ F583DC0E018D092D01DC9062 = {
+ fileReference = F5375551016C376E01DC9062;
isa = PBXFileBreakpoint;
- lineNumber = 2584;
+ lineNumber = 531;
+ state = 2;
+ };
+ F583DC0F018D0CB501DC9062 = {
+ fileReference = F5375551016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 547;
state = 2;
};
- F5D47B92017C934C01DC9062 = {
+ F583DC13018D2B4A01DC9062 = {
+ fileReference = F5375551016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 1478;
+ state = 2;
+ };
+ F58907BE018DCE8F01DC9062 = {
fileReference = F5375548016C376E01DC9062;
isa = PBXFileBreakpoint;
- lineNumber = 269;
+ lineNumber = 190;
+ state = 2;
+ };
+ F58907C5018DD1C301DC9062 = {
+ fileReference = F5375551016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 502;
+ state = 2;
+ };
+ F5A5146F01D05DC201DC9062 = {
+ fileReference = F5375550016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 651;
state = 1;
};
+ F5A5147001D0758C01DC9062 = {
+ fileReference = F5375550016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 838;
+ state = 1;
+ };
+ F5A852D6020F6C6C01DC9062 = {
+ fileReference = F5375550016C376E01DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 277;
+ state = 1;
+ };
+ F5B2CDC10175829501DC9062 = {
+ fileReference = F5375583016C389901DC9062;
+ isa = PBXFileBreakpoint;
+ lineNumber = 2584;
+ state = 2;
+ };
}
diff --git a/macosx/Wish.pbproj/project.pbxproj b/macosx/Wish.pbproj/project.pbxproj
index 042282f..ae96ae8 100644
--- a/macosx/Wish.pbproj/project.pbxproj
+++ b/macosx/Wish.pbproj/project.pbxproj
@@ -5,12 +5,102 @@
};
objectVersion = 34;
objects = {
+ F50D96120196176E01DC9062 = {
+ isa = PBXFrameworkReference;
+ name = ApplicationServices.framework;
+ path = /System/Library/Frameworks/ApplicationServices.framework;
+ refType = 0;
+ };
+ F50D96130196176E01DC9062 = {
+ fileRef = F50D96120196176E01DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F50D96140196176E01DC9062 = {
+ fileRef = F50D96120196176E01DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F51D903E0181474301DC9062 = {
fileRef = F5875C7B016FEF1D01DC9062;
isa = PBXBuildFile;
settings = {
};
};
+ F51D903F018149BD01DC9062 = {
+ buildActionMask = 2147483647;
+ dstPath = "Versions/$(FRAMEWORK_VERSION)/Headers/X11";
+ dstSubfolderSpec = 1;
+ files = (
+ F51D9040018149FD01DC9062,
+ F51D9041018149FD01DC9062,
+ F51D9042018149FD01DC9062,
+ F51D9043018149FD01DC9062,
+ F51D9044018149FD01DC9062,
+ F51D9045018149FD01DC9062,
+ F51D9046018149FD01DC9062,
+ F51D9047018149FD01DC9062,
+ F51D9048018149FD01DC9062,
+ );
+ isa = PBXCopyFilesBuildPhase;
+ name = "Copy Files";
+ };
+ F51D9040018149FD01DC9062 = {
+ fileRef = F53755CE016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9041018149FD01DC9062 = {
+ fileRef = F53755CF016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9042018149FD01DC9062 = {
+ fileRef = F53755D0016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9043018149FD01DC9062 = {
+ fileRef = F53755D1016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9044018149FD01DC9062 = {
+ fileRef = F53755D2016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9045018149FD01DC9062 = {
+ fileRef = F53755D3016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9046018149FD01DC9062 = {
+ fileRef = F53755D4016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9047018149FD01DC9062 = {
+ fileRef = F53755D5016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F51D9048018149FD01DC9062 = {
+ fileRef = F53755D6016C389901DC9062;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F537552A016C352C01DC9062 = {
buildStyles = (
F537552C016C352C01DC9062,
@@ -1239,7 +1329,9 @@
F53755E3016C38D301DC9062,
F53755E4016C38D301DC9062,
F5B1FC08016FFE3501DC9062,
+ F51D903F018149BD01DC9062,
F56570CF01722FA201DC9062,
+ F5C1D51901B88F9A01DC9062,
);
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 8.4;
@@ -1251,12 +1343,15 @@
LIBRARY_SEARCH_PATHS = "";
OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "-DMAC_OSX_TCL -DMAC_OSX_TK -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DNO_VALUES_H=1 -DNO_DLFCN_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DNEED_MATHERR=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1";
- OTHER_LDFLAGS = "-seg1addr 0x350000";
+ OTHER_LDFLAGS = "-seg1addr 0x400000";
OTHER_LIBTOOL_FLAGS = "";
OTHER_REZFLAGS = "-i \"../../tcl/generic\" -i \"../generic\"";
PRINCIPAL_CLASS = "";
PRODUCT_NAME = Tk;
SECTORDER_FLAGS = "";
+ TK_MAJOR_VERSION = 8;
+ TK_MINOR_VERSION = 4;
+ TK_PATCH_LEVEL = a4;
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
WRAPPER_EXTENSION = framework;
};
@@ -1486,6 +1581,7 @@ Copyright Apple Computer, Inc 2001</string>
files = (
F51D903E0181474301DC9062,
F537567E016C3ADB01DC9062,
+ F50D96130196176E01DC9062,
);
isa = PBXFrameworksBuildPhase;
name = "Frameworks & Libraries";
@@ -2324,18 +2420,24 @@ Copyright Apple Computer, Inc 2001</string>
fileRef = F53755CE016C389901DC9062;
isa = PBXBuildFile;
settings = {
+ ATTRIBUTES = (
+ );
};
};
F537566F016C3A1F01DC9062 = {
fileRef = F53755CF016C389901DC9062;
isa = PBXBuildFile;
settings = {
+ ATTRIBUTES = (
+ );
};
};
F5375670016C3A1F01DC9062 = {
fileRef = F53755D0016C389901DC9062;
isa = PBXBuildFile;
settings = {
+ ATTRIBUTES = (
+ );
};
};
F5375671016C3A1F01DC9062 = {
@@ -2406,6 +2508,7 @@ Copyright Apple Computer, Inc 2001</string>
};
F537567C016C3ADB01DC9062 = {
children = (
+ F50D96120196176E01DC9062,
F5875C7B016FEF1D01DC9062,
F537567D016C3ADB01DC9062,
);
@@ -2707,6 +2810,7 @@ Copyright Apple Computer, Inc 2001</string>
F53756A8016C4DD401DC9062,
F5875C7D016FEF1D01DC9062,
F53756A7016C4DD401DC9062,
+ F50D96140196176E01DC9062,
);
isa = PBXFrameworksBuildPhase;
name = "Frameworks & Libraries";
@@ -2995,6 +3099,19 @@ Copyright Apple Computer, Inc 2001</string>
settings = {
};
};
+ F5C1D51901B88F9A01DC9062 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ generatedFileNames = (
+ );
+ isa = PBXShellScriptBuildPhase;
+ name = "Shell Script";
+ neededFileNames = (
+ );
+ shellPath = /bin/sh;
+ shellScript = "source buildConfig";
+ };
F5C88659017D625C01DC9062 = {
children = (
F5C8865A017D625C01DC9062,
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index fbeacd7..9faf5ac 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#ifndef _TKMACDEFAULT
@@ -436,6 +436,7 @@
* Defaults for texts:
*/
+#define DEF_TEXT_AUTO_SEPARATORS "1"
#define DEF_TEXT_BG_COLOR NORMAL_BG
#define DEF_TEXT_BG_MONO WHITE
#define DEF_TEXT_BORDER_WIDTH "0"
@@ -470,6 +471,7 @@
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
#define DEF_TEXT_TAKE_FOCUS (char *) NULL
+#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
#define DEF_TEXT_WRAP "char"
#define DEF_TEXT_XSCROLL_COMMAND ""
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 3d359eb..5de92e1 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.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: tkMacOSXDialog.c,v 1.1.2.2 2001/10/24 06:00:04 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.1.2.3 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include <Carbon/Carbon.h>
@@ -69,10 +69,14 @@ pascal void OpenEventProc(NavEventCallbackMessage callBackSelector,
NavCallBackUserData callBackUD );
static void InitFileDialogs();
static int NavServicesGetFile(Tcl_Interp *interp, OpenFileData *ofd,
- AEDesc *initialDesc, unsigned char *initialFile,
+ AEDesc *initialDescPtr,
+ unsigned char *initialFile, AEDescList *selectDescPtr,
StringPtr title, StringPtr message, int multiple, int isOpen);
-static int HandleInitialDirectory (Tcl_Interp *interp, char *initialDir, FSSpec *dirSpec,
- AEDesc *dirDescPtr);
+static int HandleInitialDirectory (Tcl_Interp *interp,
+ char *initialFile, char *initialDir,
+ FSRef *dirRef,
+ AEDescList *selectDescPtr,
+ AEDesc *dirDescPtr);
/*
* Have we initialized the file dialog subsystem
@@ -117,7 +121,6 @@ Tk_ChooseColorObjCmd(
Tk_Window parent;
char *title;
int i, picked, srcRead, dstWrote;
- long response;
OSErr err;
ColorPickerInfo cpinfo;
static int inited = 0;
@@ -254,8 +257,10 @@ Tk_GetOpenFileObjCmd(
Tk_Window parent;
Str255 message, title;
AEDesc initialDesc = {typeNull, NULL};
- FSSpec dirSpec;
+ FSRef dirRef;
AEDesc *initialPtr = NULL;
+ AEDescList selectDesc = {typeNull, NULL};
+ char *initialFile = NULL, *initialDir = NULL;
static char *openOptionStrings[] = {
"-defaultextension", "-filetypes",
"-initialdir", "-initialfile",
@@ -316,14 +321,10 @@ Tk_GetOpenFileObjCmd(
}
break;
case OPEN_INITDIR:
- choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
- result = TCL_ERROR;
- goto end;
- }
+ initialDir = Tcl_GetStringFromObj(objv[i + 1], NULL);
break;
case OPEN_INITFILE:
+ initialFile = Tcl_GetStringFromObj(objv[i + 1], NULL);
break;
case OPEN_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
@@ -356,16 +357,24 @@ Tk_GetOpenFileObjCmd(
break;
}
}
-
- if (initialDesc.descriptorType == typeFSS) {
+
+ if (HandleInitialDirectory(interp, initialFile, initialDir, &dirRef,
+ &selectDesc, &initialDesc) != TCL_OK) {
+ result = TCL_ERROR;
+ goto end;
+ }
+
+ if (initialDesc.descriptorType == typeFSRef) {
initialPtr = &initialDesc;
}
- result = NavServicesGetFile(interp, &ofd, initialPtr, NULL,
- title, message, multiple, OPEN_FILE);
+ result = NavServicesGetFile(interp, &ofd, initialPtr,
+ NULL, &selectDesc,
+ title, message, multiple, OPEN_FILE);
end:
TkFreeFileFilters(&ofd.fl);
AEDisposeDesc(&initialDesc);
+ AEDisposeDesc(&selectDesc);
return result;
}
@@ -398,7 +407,7 @@ Tk_GetSaveFileObjCmd(
Tk_Window parent;
AEDesc initialDesc = {typeNull, NULL};
AEDesc *initialPtr = NULL;
- FSSpec dirSpec;
+ FSRef dirRef;
Str255 title, message;
OpenFileData ofd;
static char *saveOptionStrings[] = {
@@ -445,8 +454,8 @@ Tk_GetSaveFileObjCmd(
break;
case SAVE_INITDIR:
choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
+ if (HandleInitialDirectory(interp, NULL, choice, &dirRef,
+ NULL, &initialDesc) != TCL_OK) {
result = TCL_ERROR;
goto end;
}
@@ -491,10 +500,10 @@ Tk_GetSaveFileObjCmd(
TkInitFileFilters(&ofd.fl);
ofd.usePopup = 0;
- if (initialDesc.descriptorType == typeFSS) {
+ if (initialDesc.descriptorType == typeFSRef) {
initialPtr = &initialDesc;
}
- result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile,
+ result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile, NULL,
title, message, false, SAVE_FILE);
end:
@@ -534,7 +543,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
Tk_Window parent;
AEDesc initialDesc = {typeNull, NULL};
AEDesc *initialPtr = NULL;
- FSSpec dirSpec;
+ FSRef dirRef;
Str255 message, title;
int srcRead, dstWrote;
OpenFileData ofd;
@@ -577,8 +586,8 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
switch (index) {
case CHOOSE_INITDIR:
choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
- if (HandleInitialDirectory(interp, choice, &dirSpec,
- &initialDesc) != TCL_OK) {
+ if (HandleInitialDirectory(interp, NULL, choice, &dirRef,
+ NULL, &initialDesc) != TCL_OK) {
result = TCL_ERROR;
goto end;
}
@@ -612,10 +621,10 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
ofd.usePopup = 0;
- if (initialDesc.descriptorType == typeFSS) {
+ if (initialDesc.descriptorType == typeFSRef) {
initialPtr = &initialDesc;
}
- result = NavServicesGetFile(interp, &ofd, initialPtr, NULL,
+ result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, NULL,
title, message, false, CHOOSE_FOLDER);
end:
@@ -627,42 +636,74 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
int
HandleInitialDirectory (
Tcl_Interp *interp,
- char *initialDir,
- FSSpec *dirSpec,
+ char *initialFile,
+ char *initialDir,
+ FSRef *dirRef,
+ AEDescList *selectDescPtr,
AEDesc *dirDescPtr)
{
- Tcl_DString ds;
- long dirID;
- OSErr err;
- Boolean isDirectory;
- Str255 dir;
- int srcRead, dstWrote;
-
- fprintf(stderr,"HandleInitialDir\n");
- if (Tcl_TranslateFileName(interp, initialDir, &ds) == NULL) {
+ Tcl_DString ds;
+ OSErr err;
+ Boolean isDirectory;
+ char *dirName = NULL;
+ int result = TCL_OK;
+
+ if (initialDir != NULL) {
+ dirName = Tcl_TranslateFileName(interp, initialDir, &ds);
+ if (dirName == NULL) {
return TCL_ERROR;
}
- Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds), 0, NULL, StrBody(dir), 255,
- &srcRead, &dstWrote, NULL);
- StrLength(dir) = (unsigned char) dstWrote;
- Tcl_DStringFree(&ds);
-
- err = FSpLocationFromPath(StrLength(dir), StrBody(dir), dirSpec);
+
+ err = FSPathMakeRef(dirName,
+ dirRef, &isDirectory);
+
if (err != noErr) {
- Tcl_AppendResult(interp, "bad directory \"",
- initialDir, "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(interp, "bad directory \"",
+ initialDir, "\"", NULL);
+ result = TCL_ERROR;
+ goto end;
}
- err = FSpGetDirectoryID(dirSpec, &dirID, &isDirectory);
- if ((err != noErr) || !isDirectory) {
- Tcl_AppendResult(interp, "bad directory \"",
- initialDir, "\"", NULL);
+ if (!isDirectory) {
+ Tcl_AppendResult(interp, "-intialdir \"",
+ initialDir, " is a file, not a directory.\"", NULL);
+ result = TCL_ERROR;
+ goto end;
+ }
+
+ AECreateDesc(typeFSRef, dirRef, sizeof(*dirRef), dirDescPtr);
+ }
+
+ if (initialFile != NULL && selectDescPtr != NULL) {
+ FSRef fileRef;
+ AEDesc fileDesc;
+ char *namePtr;
+
+ if (initialDir != NULL) {
+ Tcl_DStringAppend(&ds, "/", 1);
+ Tcl_DStringAppend(&ds, initialFile, -1);
+ namePtr = Tcl_DStringValue(&ds);
+ } else {
+ namePtr = initialFile;
+ }
+
+ AECreateList(NULL, 0, false, selectDescPtr);
+
+ err = FSPathMakeRef(namePtr, &fileRef, &isDirectory);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
+ "\" file does not exist.", NULL);
return TCL_ERROR;
}
+ AECreateDesc(typeFSRef, &fileRef, sizeof(fileRef), &fileDesc);
+ AEPutDesc(selectDescPtr, 1, &fileDesc);
+ AEDisposeDesc(&fileDesc);
+ }
- AECreateDesc( typeFSS, dirSpec, sizeof(*dirSpec), dirDescPtr);
- return TCL_OK;
+end:
+ if (dirName != NULL) {
+ Tcl_DStringFree(&ds);
+ }
+ return result;
}
static void
@@ -677,8 +718,9 @@ static int
NavServicesGetFile(
Tcl_Interp *interp,
OpenFileData *ofdPtr,
- AEDesc *initialDesc,
+ AEDesc *initialDescPtr,
unsigned char *initialFile,
+ AEDescList *selectDescPtr,
StringPtr title,
StringPtr message,
int multiple,
@@ -790,7 +832,16 @@ NavServicesGetFile(
dialogRef = NULL;
}
}
+
if (dialogRef) {
+ if (initialDescPtr != NULL) {
+ NavCustomControl (dialogRef, kNavCtlSetLocation, initialDescPtr);
+ }
+ if ((selectDescPtr != NULL)
+ && (selectDescPtr->descriptorType != typeNull)) {
+ NavCustomControl(dialogRef, kNavCtlSetSelection, &selectDescPtr);
+ }
+
if ((err = NavDialogRun(dialogRef)) != noErr ){
fprintf(stderr,"NavDialogRun failed, %d\n", err );
} else {
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index fb2611d..f38e31f 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -11,14 +11,13 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include "tkInt.h"
#include "X11/X.h"
#include "X11/Xlib.h"
#include <stdio.h>
-#include <tcl.h>
#include <Carbon/Carbon.h>
#include "tkMacOSXInt.h"
@@ -28,6 +27,9 @@
#ifndef PI
# define PI 3.14159265358979323846
#endif
+#define RGBFLOATRED( c ) (float)((float)(c.red) / 65535.0)
+#define RGBFLOATGREEN( c ) (float)((float)(c.green) / 65535.0)
+#define RGBFLOATBLUE( c ) (float)((float)(c.blue) / 65535.0)
/*
* Temporary regions that can be reused.
@@ -38,11 +40,17 @@ static RgnHandle tmpRgn2 = NULL;
static PixPatHandle gPenPat = NULL;
+static int useCGDrawing = 0;
+
/*
* Prototypes for functions used only in this file.
*/
static unsigned char InvertByte _ANSI_ARGS_((unsigned char data));
-
+
+void TkMacOSXSetUpCGContext(MacDrawable *macWin,
+ CGrafPtr destPort, GC gc, CGContextRef *contextPtr);
+void TkMacOSXReleaseCGContext(MacDrawable *macWin, CGrafPtr destPort,
+ CGContextRef *context);
/*
*----------------------------------------------------------------------
*
@@ -517,24 +525,44 @@ XDrawLines(
TkMacOSXSetUpClippingRgn(d);
- TkMacOSXSetUpGraphicsPort(gc, destPort);
-
- ShowPen();
-
- PenPixPat(gPenPat);
- MoveTo((short) (macWin->xOff + points[0].x),
- (short) (macWin->yOff + points[0].y));
- for (i = 1; i < npoints; i++) {
+ if (useCGDrawing) {
+ CGContextRef outContext;
+
+ TkMacOSXSetUpCGContext(macWin, destPort, gc, &outContext);
+
+ CGContextBeginPath(outContext);
+ CGContextMoveToPoint(outContext, (float) points[0].x,
+ (float) points[0].y);
if (mode == CoordModeOrigin) {
- LineTo((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- } else {
- Line((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
+ for (i = 1; i < npoints; i++) {
+ CGContextAddLineToPoint(outContext,
+ (float) points[i].x,
+ (float) points[i].y);
+ }
}
- }
- HidePen();
+
+ CGContextStrokePath(outContext);
+ TkMacOSXReleaseCGContext(macWin, destPort, &outContext);
+ } else {
+ TkMacOSXSetUpGraphicsPort(gc, destPort);
+
+ ShowPen();
+
+ PenPixPat(gPenPat);
+ MoveTo((short) (macWin->xOff + points[0].x),
+ (short) (macWin->yOff + points[0].y));
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModeOrigin) {
+ LineTo((short) (macWin->xOff + points[i].x),
+ (short) (macWin->yOff + points[i].y));
+ } else {
+ Line((short) (macWin->xOff + points[i].x),
+ (short) (macWin->yOff + points[i].y));
+ }
+ }
+ HidePen();
+ }
SetGWorld(saveWorld, saveDevice);
}
@@ -576,19 +604,37 @@ void XDrawSegments(
TkMacOSXSetUpClippingRgn(d);
- TkMacOSXSetUpGraphicsPort(gc, destPort);
+ if (useCGDrawing) {
+ CGContextRef outContext;
- ShowPen();
+ TkMacOSXSetUpCGContext(macWin, destPort, gc, &outContext);
- PenPixPat(gPenPat);
- for (i = 0; i < nsegments; i++) {
- MoveTo((short) (macWin->xOff + segments[i].x1),
- (short) (macWin->yOff + segments[i].y1));
- LineTo((short) (macWin->xOff + segments[i].x2),
- (short) (macWin->yOff + segments[i].y2));
- }
- HidePen();
+ CGContextBeginPath(outContext);
+ for (i = 0; i < nsegments; i++) {
+ CGContextMoveToPoint(outContext,
+ (float) segments[i].x1,
+ (float) segments[i].y1);
+ CGContextAddLineToPoint (outContext,
+ (float) segments[i].x2,
+ (float) segments[i].y2);
+ }
+ CGContextStrokePath(outContext);
+ TkMacOSXReleaseCGContext(macWin, destPort, &outContext);
+ } else {
+ TkMacOSXSetUpGraphicsPort(gc, destPort);
+
+ ShowPen();
+ PenPixPat(gPenPat);
+ for (i = 0; i < nsegments; i++) {
+ MoveTo((short) (macWin->xOff + segments[i].x1),
+ (short) (macWin->yOff + segments[i].y1));
+ LineTo((short) (macWin->xOff + segments[i].x2),
+ (short) (macWin->yOff + segments[i].y2));
+ }
+ HidePen();
+ }
+
SetGWorld(saveWorld, saveDevice);
}
@@ -633,28 +679,49 @@ XFillPolygon(
TkMacOSXSetUpClippingRgn(d);
- TkMacOSXSetUpGraphicsPort(gc, destPort);
-
- PenNormal();
- polygon = OpenPoly();
-
- MoveTo((short) (macWin->xOff + points[0].x),
- (short) (macWin->yOff + points[0].y));
- for (i = 1; i < npoints; i++) {
- if (mode == CoordModePrevious) {
- Line((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
- } else {
- LineTo((short) (macWin->xOff + points[i].x),
- (short) (macWin->yOff + points[i].y));
+ if (useCGDrawing) {
+ CGContextRef outContext;
+
+ TkMacOSXSetUpCGContext(macWin, destPort, gc, &outContext);
+
+ CGContextBeginPath(outContext);
+ CGContextMoveToPoint(outContext, (float) (points[0].x),
+ (float) (points[0].y));
+ for (i = 1; i < npoints; i++) {
+
+ if (mode == CoordModePrevious) {
+ CGContextAddLineToPoint(outContext, (float) points[i].x,
+ (float) points[i].y);
+ } else {
+ }
+ }
+ //CGContextStrokePath(outContext);
+ CGContextFillPath(outContext);
+ TkMacOSXReleaseCGContext(macWin, destPort, &outContext);
+ } else {
+ TkMacOSXSetUpGraphicsPort(gc, destPort);
+
+ PenNormal();
+ polygon = OpenPoly();
+
+ MoveTo((short) (macWin->xOff + points[0].x),
+ (short) (macWin->yOff + points[0].y));
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModePrevious) {
+ Line((short) (macWin->xOff + points[i].x),
+ (short) (macWin->yOff + points[i].y));
+ } else {
+ LineTo((short) (macWin->xOff + points[i].x),
+ (short) (macWin->yOff + points[i].y));
+ }
}
+
+ ClosePoly();
+
+ FillCPoly(polygon, gPenPat);
+
+ KillPoly(polygon);
}
-
- ClosePoly();
-
- FillCPoly(polygon, gPenPat);
-
- KillPoly(polygon);
SetGWorld(saveWorld, saveDevice);
}
@@ -815,7 +882,15 @@ XDrawArc(
CGrafPtr saveWorld;
GDHandle saveDevice;
GWorldPtr destPort;
+ float fX = (float) x,
+ fY = (float) y,
+ fWidth = (float) width,
+ fHeight = (float) height;
+ if (width == 0 || height == 0) {
+ return;
+ }
+
destPort = TkMacOSXGetDrawablePort(d);
display->request++;
@@ -824,20 +899,52 @@ XDrawArc(
TkMacOSXSetUpClippingRgn(d);
- TkMacOSXSetUpGraphicsPort(gc, destPort);
+ if (useCGDrawing) {
+ CGContextRef outContext;
+ CGAffineTransform transform;
+ int clockwise = angle1 ? 0 : 1;
- theRect.left = (short) (macWin->xOff + x);
- theRect.top = (short) (macWin->yOff + y);
- theRect.right = (short) (theRect.left + width);
- theRect.bottom = (short) (theRect.top + height);
- start = (short) (90 - (angle1 / 64));
- extent = (short) (-(angle2 / 64));
+ TkMacOSXSetUpCGContext(macWin, destPort, gc, &outContext);
- ShowPen();
- PenPixPat(gPenPat);
- FrameArc(&theRect, start, extent);
- HidePen();
+ CGContextBeginPath(outContext);
+
+ /*
+ * If we are drawing an oval, we have to squash the coordinate
+ * system before drawing, since CGContextAddArcToPoint only draws
+ * circles.
+ */
+
+ CGContextSaveGState(outContext);
+ transform = CGAffineTransformMakeTranslation((float) (x + width/2),
+ (float) (y + height/2));
+ transform = CGAffineTransformScale(transform, 1.0, fHeight/fWidth);
+ CGContextConcatCTM(outContext, transform);
+
+ CGContextAddArc(outContext, 0.0, 0.0,
+ (float) width/2,
+ (float) angle1, (float) angle2, clockwise);
+ CGContextRestoreGState(outContext);
+
+ CGContextStrokePath(outContext);
+ TkMacOSXReleaseCGContext(macWin, destPort, &outContext);
+ } else {
+ TkMacOSXSetUpGraphicsPort(gc, destPort);
+
+
+ theRect.left = (short) (macWin->xOff + x);
+ theRect.top = (short) (macWin->yOff + y);
+ theRect.right = (short) (theRect.left + width);
+ theRect.bottom = (short) (theRect.top + height);
+ start = (short) (90 - (angle1 / 64));
+ extent = (short) (-(angle2 / 64));
+
+ ShowPen();
+ PenPixPat(gPenPat);
+ FrameArc(&theRect, start, extent);
+ HidePen();
+ }
+
SetGWorld(saveWorld, saveDevice);
}
@@ -1299,7 +1406,116 @@ TkMacOSXSetUpGraphicsPort(
*/
}
}
-
+ /*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetUpGraphicsPort --
+ *
+ * Set up the graphics port from the given GC.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The current port is adjusted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetUpCGContext(
+ MacDrawable *macWin,
+ CGrafPtr destPort,
+ GC gc,
+ CGContextRef *contextPtr) /* GC to apply to current port. */
+{
+ RGBColor macColor;
+ CGContextRef outContext;
+ OSStatus err;
+ Rect boundsRect;
+ CGAffineTransform coordsTransform;
+
+ err = QDBeginCGContext(destPort, contextPtr);
+ outContext = *contextPtr;
+
+ CGContextSaveGState(outContext);
+
+ GetPortBounds(destPort, &boundsRect);
+
+ CGContextResetCTM(outContext);
+ coordsTransform = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0,
+ (float)(boundsRect.bottom - boundsRect.top));
+ CGContextConcatCTM(outContext, coordsTransform);
+
+ if (macWin->clipRgn != NULL) {
+ ClipCGContextToRegion(outContext, &boundsRect, macWin->clipRgn);
+ } else {
+ RgnHandle clipRgn = NewRgn();
+ GetPortClipRegion(destPort, clipRgn);
+ ClipCGContextToRegion(outContext, &boundsRect,
+ clipRgn);
+ DisposeRgn(clipRgn);
+ }
+
+ /* Now offset the CTM to the subwindow offset */
+
+ CGContextTranslateCTM(outContext, macWin->xOff, macWin->yOff);
+
+ if (TkSetMacColor(gc->foreground, &macColor) == true) {
+ CGContextSetRGBStrokeColor(outContext, RGBFLOATRED(macColor),
+ RGBFLOATGREEN(macColor),
+ RGBFLOATBLUE(macColor), 1.0);
+ }
+ if (TkSetMacColor(gc->background, &macColor) == true) {
+ CGContextSetRGBFillColor(outContext, RGBFLOATRED(macColor),
+ RGBFLOATGREEN(macColor),
+ RGBFLOATBLUE(macColor), 1.0);
+ }
+
+ if(gc->function == GXxor) {
+ }
+
+ CGContextSetLineWidth(outContext, (float) gc->line_width);
+
+ if (gc->line_style != LineSolid) {
+ unsigned char *p = (unsigned char *) &(gc->dashes);
+ /*
+ * Here the dash pattern should be set in the drawing,
+ * environment, but I don't know how to do that for the Mac.
+ *
+ * p[] is an array of unsigned chars containing the dash list.
+ * A '\0' indicates the end of this list.
+ *
+ * Someone knows how to implement this? If you have a more
+ * complete implementation of SetUpGraphicsPort() for
+ * the Mac (or for Windows), please let me know.
+ *
+ * Jan Nijtmans
+ * CMG Arnhem, B.V.
+ * email: j.nijtmans@chello.nl (private)
+ * jan.nijtmans@cmg.nl (work)
+ * url: http://purl.oclc.org/net/nijtmans/
+ *
+ * FIXME:
+ * This is not possible with QuickDraw line drawing, we either
+ * have to convert all line drawings to regions, or, on Mac OS X
+ * we can use CG to draw our lines instead of QuickDraw.
+ */
+ }
+}
+
+void
+TkMacOSXReleaseCGContext(
+ MacDrawable *macWin,
+ CGrafPtr destPort,
+ CGContextRef *outContext)
+{
+ CGContextResetCTM(*outContext);
+ CGContextRestoreGState(*outContext);
+ QDEndCGContext(destPort, outContext);
+
+}
+
/*
*----------------------------------------------------------------------
*
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 9ad448c..fe22933 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include <stdio.h>
@@ -22,8 +22,6 @@
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <tcl.h>
-
#include "tkMacOSXInt.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index bd26954..f0a95ab 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -10,10 +10,9 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
-#include "tcl.h"
#include "tkMacOSXUtil.h"
#include "tkMacOSXInt.h"
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e9ee26b..f78774a 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.3 2002/01/22 01:28:18 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.4 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include "tkInt.h"
@@ -137,8 +137,8 @@ TkpGetAppName(interp, namePtr)
void
TkpDisplayWarning(msg, title)
- char *msg; /* Message to be displayed. */
- char *title; /* Title of warning. */
+ CONST char *msg; /* Message to be displayed. */
+ CONST char *title; /* Title of warning. */
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 44a0193..f72873a 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -51,7 +51,6 @@
* license.
*/
-#include <tcl.h>
#include "tkMacOSXInt.h"
#include "tkPort.h"
#include "tkMacOSXEvent.h"
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index abe0b6d..713fcba 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.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: tkMacOSXMenu.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMenuButton.h"
@@ -2008,19 +2008,20 @@ TkMacOSXDispatchMenuEvent(
} else {
Tcl_HashEntry *commandEntryPtr =
Tcl_FindHashEntry(&commandTable, (char *) ((int)menuID));
- TkMenu *menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
- if ((currentAppleMenuID == menuID)
- && (index > menuPtr->numEntries + 1)) {
- Str255 itemText;
-
- GetMenuItemText(GetMenuHandle(menuID), index, itemText);
-#ifdef STUBBED_OUT_FOR_OSX
- OpenDeskAcc(itemText);
-#endif
- result = TCL_OK;
- } else {
- result = TkInvokeMenu(menuPtr->interp, menuPtr, index - 1);
- }
+ if (commandEntryPtr != NULL) {
+ TkMenu *menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
+ if ((currentAppleMenuID == menuID)
+ && (index > menuPtr->numEntries + 1)) {
+ Str255 itemText;
+
+ GetMenuItemText(GetMenuHandle(menuID), index, itemText);
+ result = TCL_OK;
+ } else {
+ result = TkInvokeMenu(menuPtr->interp, menuPtr, index - 1);
+ }
+ } else {
+ return TCL_ERROR;
+ }
}
}
return result;
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index 59411e4..0f90002 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -10,10 +10,9 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
-#include "tcl.h"
#include "tk.h"
#include "tkInt.h"
#include "tkMacOSXInt.h"
@@ -96,16 +95,6 @@ TkMacOSXHandleMenuSelect(
}
break;
}
-#ifdef STUBBED_OUT_FOR_OSX
- default:
- {
- Str255 name;
- GetItem(tkAppleMenu, theItem, name);
- HiliteMenu(0);
- OpenDeskAcc(name);
- return;
- }
-#endif
}
break;
case kFileMenu:
@@ -148,7 +137,7 @@ TkMacOSXHandleMenuSelect(
* Finally we unhighlight the menu.
*/
HiliteMenu(0);
-} /* TkMacOSXHandleMenuSelect */
+}
/*
*----------------------------------------------------------------------
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index a0bb51a..71c4555 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -55,7 +55,6 @@
#include <X11/X.h>
#include <X11/Xlib.h>
#include "tkMacOSXEvent.h"
-#include <tcl.h>
#include "tkMacOSXInt.h"
#include "tkPort.h"
#include "tkMacOSXDebug.h"
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 20cc294..d21d1f1 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -51,7 +51,6 @@
* license.
*/
-#include <tcl.h>
#include "tkMacOSXInt.h"
#include "tkPort.h"
#include "tkMacOSXWm.h"
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 4e4c9b4..d4afe64 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWm.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include <Carbon/Carbon.h>
@@ -1297,6 +1297,99 @@ Tk_WmCmd(
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
goto updateGeom;
+ } else if ((c == 's') && (strncmp(argv[1], "stackorder", length) == 0)
+ && (length >= 2)) {
+ TkWindow **windows, **window_ptr;
+
+ if ((argc != 3) && (argc != 5)) {
+ Tcl_AppendResult(interp, "wrong # arguments: must be \"",
+ argv[0],
+ " stackorder window ?isabove|isbelow? ?window?\"",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (argc == 3) {
+ windows = TkWmStackorderToplevel(winPtr);
+ if (windows == NULL) {
+ panic("TkWmStackorderToplevel failed");
+ } else {
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ }
+ ckfree((char *) windows);
+ return TCL_OK;
+ }
+ } else {
+ TkWindow *winPtr2;
+ int index1=-1, index2=-1, result;
+
+ winPtr2 = (TkWindow *) Tk_NameToWindow(interp, argv[4], tkwin);
+ if (winPtr2 == NULL) {
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsTopLevel(winPtr2)) {
+ Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
+ "\" isn't a top-level window", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsMapped(winPtr)) {
+ Tcl_AppendResult(interp, "window \"", winPtr->pathName,
+ "\" isn't mapped", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsMapped(winPtr2)) {
+ Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
+ "\" isn't mapped", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Lookup stacking order of all toplevels that are children
+ * of "." and find the position of winPtr and winPtr2
+ * in the stacking order.
+ */
+
+ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
+
+ if (windows == NULL) {
+ Tcl_AppendResult(interp, "TkWmStackorderToplevel failed",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ if (*window_ptr == winPtr)
+ index1 = (window_ptr - windows);
+ if (*window_ptr == winPtr2)
+ index2 = (window_ptr - windows);
+ }
+ if (index1 == -1)
+ panic("winPtr window not found");
+ if (index2 == -1)
+ panic("winPtr2 window not found");
+
+ ckfree((char *) windows);
+ }
+
+ c = argv[3][0];
+ length = strlen(argv[3]);
+ if ((length > 2) && (c == 'i')
+ && (strncmp(argv[3], "isabove", length) == 0)) {
+ result = index1 > index2;
+ } else if ((length > 2) && (c == 'i')
+ && (strncmp(argv[3], "isbelow", length) == 0)) {
+ result = index1 < index2;
+ } else {
+ Tcl_AppendResult(interp, "bad argument \"", argv[3],
+ "\": must be isabove or isbelow", (char *) NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), result);
+ return TCL_OK;
+ }
} else if ((c == 's') && (strncmp(argv[1], "state", length) == 0)
&& (length >= 2)) {
if ((argc < 3) || (argc > 4)) {
@@ -4203,4 +4296,133 @@ TkpChangeFocus(winPtr, force)
*/
return NextRequest(winPtr->display);
-} \ No newline at end of file
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmStackorderToplevelWrapperMap --
+ *
+ * This procedure will create a table that maps the reparent wrapper
+ * X id for a toplevel to the TkWindow structure that is wraps.
+ * Tk keeps track of a mapping from the window X id to the TkWindow
+ * structure but that does us no good here since we only get the X
+ * id of the wrapper window. Only those toplevel windows that are
+ * mapped have a position in the stacking order.
+ *
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Adds entries to the passed hashtable.
+ *
+ *----------------------------------------------------------------------
+ */
+void
+TkWmStackorderToplevelWrapperMap(winPtr, table)
+ TkWindow *winPtr; /* TkWindow to recurse on */
+ Tcl_HashTable *table; /* Maps mac window to TkWindow */
+{
+ TkWindow *childPtr;
+ Tcl_HashEntry *hPtr;
+ void *wrapper;
+ int newEntry;
+
+ if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr)) {
+ wrapper = (void *) TkMacOSXGetDrawablePort(winPtr->window);
+
+ hPtr = Tcl_CreateHashEntry(table,
+ (char *) wrapper, &newEntry);
+ Tcl_SetHashValue(hPtr, winPtr);
+ }
+
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ TkWmStackorderToplevelWrapperMap(childPtr, table);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmStackorderToplevel --
+ *
+ * This procedure returns the stack order of toplevel windows.
+ *
+ * Results:
+ * An array of pointers to tk window objects in stacking order
+ * or else NULL if there was an error.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkWindow **
+TkWmStackorderToplevel(parentPtr)
+ TkWindow *parentPtr; /* Parent toplevel window. */
+{
+ WindowRef frontWindow;
+ TkWindow *childWinPtr, **windows, **window_ptr;
+ Tcl_HashTable table;
+ Tcl_HashEntry *hPtr;
+ Tcl_HashSearch search;
+
+ /*
+ * Map mac windows to a TkWindow of the wrapped toplevel.
+ */
+
+ Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
+ TkWmStackorderToplevelWrapperMap(parentPtr, &table);
+
+ windows = (TkWindow **) ckalloc((table.numEntries+1)
+ * sizeof(TkWindow *));
+
+ /*
+ * Special cases: If zero or one toplevels were mapped
+ * there is no need to enumerate Windows.
+ */
+
+ switch (table.numEntries) {
+ case 0:
+ windows[0] = NULL;
+ goto done;
+ case 1:
+ hPtr = Tcl_FirstHashEntry(&table, &search);
+ windows[0] = (TkWindow *) Tcl_GetHashValue(hPtr);
+ windows[1] = NULL;
+ goto done;
+ }
+
+ frontWindow = (WindowRef) FrontWindow();
+
+ if (frontWindow == NULL) {
+ ckfree((char *) windows);
+ windows = NULL;
+ } else {
+ window_ptr = windows + table.numEntries;
+ *window_ptr-- = NULL;
+ while (frontWindow != NULL) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
+ if (hPtr != NULL) {
+ childWinPtr = (TkWindow *) Tcl_GetHashValue(hPtr);
+ *window_ptr-- = childWinPtr;
+ }
+ frontWindow = GetNextWindow(frontWindow);
+ }
+ if (window_ptr != (windows-1))
+ panic("num matched toplevel windows does not equal num children");
+ }
+
+ done:
+ Tcl_DeleteHashTable(&table);
+ return windows;
+}
+
+
+
+
+
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index a8bee2e..ea7eaf0 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
*/
#include "tkInt.h"
@@ -23,8 +23,6 @@
#include <pthread.h>
#include <sys/types.h>
-#include <tcl.h>
-
#include <X11/Xatom.h>
#include <Carbon/Carbon.h>
@@ -92,7 +90,7 @@ int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
TkDisplay *
TkpOpenDisplay(
- char *display_name)
+ CONST char *display_name)
{
Display *display;
Screen *screen;
@@ -843,10 +841,10 @@ XCreateIC(
*----------------------------------------------------------------------
*/
-char *
+CONST char *
TkGetDefaultScreenName(
Tcl_Interp *interp, /* Not used. */
- char *screenName) /* If NULL, use default string. */
+ CONST char *screenName) /* If NULL, use default string. */
{
#if 0
if ((screenName == NULL) || (screenName[0] == '\0')) {