Revert NSSavePanel code due to problems on new mingw/clang development environment

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38781 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-07-09 16:38:45 +00:00
parent de5f907dca
commit b4a222b226
2 changed files with 7 additions and 51 deletions

View file

@ -34,7 +34,6 @@
#ifndef _GNUstep_H_NSSavePanel #ifndef _GNUstep_H_NSSavePanel
#define _GNUstep_H_NSSavePanel #define _GNUstep_H_NSSavePanel
#import <GNUstepBase/GSVersionMacros.h> #import <GNUstepBase/GSVersionMacros.h>
#import <GNUstepBase/GSBlocks.h>
#import <AppKit/NSPanel.h> #import <AppKit/NSPanel.h>
@ -59,7 +58,7 @@ enum {
}; };
@protocol NSOpenSavePanelDelegate <NSObject> @protocol NSOpenSavePanelDelegate <NSObject>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL #ifdef __OBJC2__
@optional @optional
#else #else
@end @end
@ -82,7 +81,6 @@ enum {
- (BOOL)panel:(id)sender shouldShowFilename:(NSString*)filename; - (BOOL)panel:(id)sender shouldShowFilename:(NSString*)filename;
@end @end
DEFINE_BLOCK_TYPE(GSSavePanelCompletionHandler, void, NSInteger);
@interface NSSavePanel : NSPanel @interface NSSavePanel : NSPanel
{ {
@ -119,7 +117,6 @@ DEFINE_BLOCK_TYPE(GSSavePanelCompletionHandler, void, NSInteger);
BOOL _OKButtonPressed; BOOL _OKButtonPressed;
NSMenu *_showsHiddenFilesMenu; NSMenu *_showsHiddenFilesMenu;
GSSavePanelCompletionHandler _completionHandler;
} }
/* /*
@ -209,12 +206,6 @@ DEFINE_BLOCK_TYPE(GSSavePanelCompletionHandler, void, NSInteger);
contextInfo: (void *)contextInfo; contextInfo: (void *)contextInfo;
#endif #endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (void) beginSheetModalForWindow:(NSWindow *)window
completionHandler:(GSSavePanelCompletionHandler)handler;
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler;
#endif
/* /*
* Reading Save Information * Reading Save Information
*/ */

View file

@ -55,7 +55,6 @@
#import "AppKit/NSDragging.h" #import "AppKit/NSDragging.h"
#import "AppKit/NSSavePanel.h" #import "AppKit/NSSavePanel.h"
#import "AppKit/NSTextField.h" #import "AppKit/NSTextField.h"
#import "AppKit/NSWindowController.h"
#import "AppKit/NSWorkspace.h" #import "AppKit/NSWorkspace.h"
#import "GSGuiPrivate.h" #import "GSGuiPrivate.h"
@ -859,9 +858,8 @@ selectCellWithString: (NSString*)title
*/ */
- (void) setTitle: (NSString*)title - (void) setTitle: (NSString*)title
{ {
// keep the window title in sync with the title field
[super setTitle:title];
[_titleField setStringValue: title]; [_titleField setStringValue: title];
[super setTitle:title]; // keep the window title in sync with the title field
// TODO: Improve the following by managing // TODO: Improve the following by managing
// vertical alignment better. // vertical alignment better.
@ -1110,22 +1108,7 @@ selectCellWithString: (NSString*)title
*/ */
- (NSInteger) runModal - (NSInteger) runModal
{ {
return [self runModalForDirectory: [self directory] return [self runModalForDirectory: [self directory] file: [self filename]];
file: [[self filename] lastPathComponent]];
}
- (void) beginSheetModalForWindow:(NSWindow *)window
completionHandler:(GSSavePanelCompletionHandler)handler
{
NSInteger result = [NSApp runModalForWindow: self
relativeToWindow: window];
CALL_BLOCK(handler, result);
}
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler
{
self->_completionHandler = Block_copy(handler);
[self makeKeyAndOrderFront: self];
} }
/**<p> Initializes the panel to the directory specified by path and, /**<p> Initializes the panel to the directory specified by path and,
@ -1204,7 +1187,7 @@ selectCellWithString: (NSString*)title
if (_allowedFileTypes == nil || if (_allowedFileTypes == nil ||
[_allowedFileTypes indexOfObject: @""] != NSNotFound) [_allowedFileTypes indexOfObject: @""] != NSNotFound)
return AUTORELEASE([_fullFileName copy]); return _fullFileName;
/* add file type extension if the file name does not have an extension or /* add file type extension if the file name does not have an extension or
the file name's extension is not one of the allowed extensions and the the file name's extension is not one of the allowed extensions and the
@ -1219,7 +1202,7 @@ selectCellWithString: (NSString*)title
} }
else else
{ {
return AUTORELEASE([_fullFileName copy]); return _fullFileName;
} }
} }
@ -1236,16 +1219,7 @@ selectCellWithString: (NSString*)title
{ {
ASSIGN(_directory, pathToColumn(_browser, [_browser lastColumn])); ASSIGN(_directory, pathToColumn(_browser, [_browser lastColumn]));
[self _updateDefaultDirectory]; [self _updateDefaultDirectory];
[NSApp stopModalWithCode: NSCancelButton];
if (self->_completionHandler == NULL)
[NSApp stopModalWithCode: NSCancelButton];
else
{
CALL_BLOCK(self->_completionHandler, NSCancelButton);
Block_release(self->_completionHandler);
self->_completionHandler = NULL;
}
[_okButton setEnabled: NO]; [_okButton setEnabled: NO];
[self close]; [self close];
} }
@ -1416,16 +1390,7 @@ selectCellWithString: (NSString*)title
return; return;
[self _updateDefaultDirectory]; [self _updateDefaultDirectory];
[NSApp stopModalWithCode: NSOKButton];
if (self->_completionHandler == NULL)
[NSApp stopModalWithCode: NSOKButton];
else
{
CALL_BLOCK(self->_completionHandler, NSOKButton);
Block_release(self->_completionHandler);
self->_completionHandler = NULL;
}
[_okButton setEnabled: NO]; [_okButton setEnabled: NO];
[self close]; [self close];
} }