summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDialog.c
diff options
context:
space:
mode:
authorculler <culler>2017-11-09 19:42:01 (GMT)
committerculler <culler>2017-11-09 19:42:01 (GMT)
commit3dfc96b9884aa8f62d3f70fd310c7a14fe6d725f (patch)
tree4c578ca134618a0c233c9c64d77618ef455aab58 /macosx/tkMacOSXDialog.c
parent6b0ff4b181b7cca5c965201e71f929d0086f2f67 (diff)
downloadtk-3dfc96b9884aa8f62d3f70fd310c7a14fe6d725f.zip
tk-3dfc96b9884aa8f62d3f70fd310c7a14fe6d725f.tar.gz
tk-3dfc96b9884aa8f62d3f70fd310c7a14fe6d725f.tar.bz2
Added some #ifdef __clang__ sections to allow building with gcc on OSX 10.6.
Tk now builds and runs on Snow Leopard, but does not support retina displays or filtering in file dialogs, and generates some errors about colorspaces.
Diffstat (limited to 'macosx/tkMacOSXDialog.c')
-rw-r--r--macosx/tkMacOSXDialog.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 3bcbf1f..b728393 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -270,7 +270,11 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) {
- (void)selectFormat:(id)sender {
NSPopUpButton *button = (NSPopUpButton *)sender;
filterInfo.fileTypeIndex = [button indexOfSelectedItem];
+#ifdef __clang__
NSMutableArray *allowedtypes = filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex];
+#else
+ NSMutableArray *allowedtypes = nil;
+#endif
[openpanel setAllowedFileTypes:allowedtypes];
filterInfo.userHasSelectedFilter = true;
@@ -279,7 +283,11 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) {
- (void)saveFormat:(id)sender {
NSPopUpButton *button = (NSPopUpButton *)sender;
filterInfo.fileTypeIndex = [button indexOfSelectedItem];
+#ifdef __clang__
NSMutableArray *allowedtypes = filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex];
+#else
+ NSMutableArray *allowedtypes = nil;
+#endif
[savepanel setAllowedFileTypes:allowedtypes];
}
@@ -717,7 +725,11 @@ Tk_GetOpenFileObjCmd(
#if 0
NSLog(@"result: %i modal: %li", result, (long)modalReturnCode);
#endif
+ #ifdef __clang__
NSString * selectedFilter = filterInfo.fileTypeNames[filterInfo.fileTypeIndex];
+ #else
+ NSString * selectedFilter = [NSString string];
+ #endif
Tcl_ObjSetVar2(interp, typeVariablePtr, NULL,
Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY);
}
@@ -884,8 +896,10 @@ Tk_GetSaveFileObjCmd(
[savepanel setAccessoryView:accessoryView];
+ #ifdef __clang__
[savepanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]];
[savepanel setAllowsOtherFileTypes:NO];
+ #endif
} else if (defaultType) {
/* If no filetypes are given, defaultextension is an alternative way
* to specify the attached extension. Just propose this extension,
@@ -971,7 +985,11 @@ Tk_GetSaveFileObjCmd(
#if 0
NSLog(@"result: %i modal: %li", result, (long)modalReturnCode);
#endif
+ #ifdef __clang__
NSString * selectedFilter = filterInfo.fileTypeNames[filterInfo.fileTypeIndex];
+ #else
+ NSString * selectedFilter = [NSString string];
+ #endif
Tcl_ObjSetVar2(interp, typeVariablePtr, NULL,
Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY);
}