mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 09:21:22 +00:00
Changfes suggested by Marc.Champesme@lipn.univ-paris13.fr
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4125 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2055a4b0e0
commit
3af213e955
5 changed files with 620 additions and 544 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Apr 23 16:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Changes based on report by Marc.Champesme@lipn.univ-paris13.fr
|
||||
* Source/NSOpenPanel.m: Tidied a little.
|
||||
* Source/NSSavePanel.m: ditto
|
||||
* Headers/AppKit/NSPanel.m: Added NS_ALERTDEFAULT etc.
|
||||
* Headers/AppKit/NSSavePanel.m: Bracket MacOS-X method with
|
||||
#ifndef STRICT_OPENSTEP
|
||||
|
||||
1999-04-22 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Model/test.m: fixed NSGraphic's'Context type-o.
|
||||
|
|
|
@ -45,6 +45,13 @@ enum {
|
|||
NSAlertErrorReturn = -2
|
||||
};
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
#define NS_ALERTDEFAULT NSAlertDefaultReturn
|
||||
#define NS_ALERTALTERNATE NSAlertAlternateReturn
|
||||
#define NS_ALERTOTHER NSAlertOtherReturn
|
||||
#define NS_ALERTERROR NSAlertErrorReturn
|
||||
#endif
|
||||
|
||||
@interface NSPanel : NSWindow <NSCoding>
|
||||
{
|
||||
// Attributes
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Standard save panel for saving files
|
||||
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
@ -56,12 +56,12 @@ enum {
|
|||
|
||||
@interface NSSavePanel : NSPanel <NSCoding>
|
||||
{
|
||||
|
||||
NSBrowser *browser; // from Daniel's source
|
||||
NSBrowser *browser;
|
||||
id form;
|
||||
id homeButton;
|
||||
id okButton;
|
||||
id mountButton,unmountButton;
|
||||
id mountButton;
|
||||
id unmountButton;
|
||||
id separator;
|
||||
id titleField;
|
||||
NSString *lastValidPath;
|
||||
|
@ -69,7 +69,7 @@ enum {
|
|||
NSSet *typeTable;
|
||||
|
||||
// Attributes
|
||||
id panelImage; // from Scott's source
|
||||
id panelImage;
|
||||
id panelTitleField;
|
||||
id panelPromptField;
|
||||
id panelBrowser;
|
||||
|
@ -81,109 +81,134 @@ enum {
|
|||
BOOL _delegateRespondsToCompare;
|
||||
BOOL _delegateRespondsToShow;
|
||||
BOOL _delegateRespondsToValid;
|
||||
// to do finish integration, eliminate excess FAR
|
||||
NSView *_accessoryView; // integrated by Felipe
|
||||
NSView *_accessoryView;
|
||||
BOOL treatsFilePackagesAsDirectories;
|
||||
|
||||
// Reserved for back-end use
|
||||
void *be_save_reserved;
|
||||
}
|
||||
|
||||
//
|
||||
// Creating an NSSavePanel
|
||||
//
|
||||
+ (NSSavePanel *)savePanel; // Returns an instance of NSSavePanel,
|
||||
// creating one if necessary.
|
||||
//
|
||||
// Customizing the NSSavePanel
|
||||
//
|
||||
/*
|
||||
* Creating an NSSavePanel
|
||||
*/
|
||||
+ (NSSavePanel *) savePanel;
|
||||
|
||||
/*
|
||||
* Customizing the NSSavePanel
|
||||
*/
|
||||
- (void) setAccessoryView: (NSView *)aView;
|
||||
- (NSView *) accessoryView;
|
||||
// Sets the title of the NSSavePanel to title. By default,
|
||||
// ªSaveº is the title string. If you adapt the NSSavePanel
|
||||
// for other uses, its title should reflect the user action
|
||||
// that brings it to the screen.
|
||||
|
||||
/*
|
||||
* Sets the title of the NSSavePanel to title. By default,
|
||||
* ªSaveº is the title string. If you adapt the NSSavePanel
|
||||
* for other uses, its title should reflect the user action
|
||||
* that brings it to the screen.
|
||||
*/
|
||||
- (void) setTitle: (NSString *)title;
|
||||
- (NSString *) title;
|
||||
- (void) setPrompt: (NSString *)prompt;
|
||||
// Returns the prompt of the Save panel field that holds
|
||||
// the current pathname or file name. By default this
|
||||
// prompt is ªName:º. *Note - currently no prompt is shown.
|
||||
|
||||
/*
|
||||
* Returns the prompt of the Save panel field that holds
|
||||
* the current pathname or file name. By default this
|
||||
* prompt is ªName: º. *Note - currently no prompt is shown.
|
||||
*/
|
||||
- (NSString *) prompt;
|
||||
|
||||
//
|
||||
// Setting Directory and File Type
|
||||
//
|
||||
/*
|
||||
* Setting Directory and File Type
|
||||
*/
|
||||
- (NSString *) requiredFileType;
|
||||
// Sets the current path name in the Save panel's browser.
|
||||
// The path argument must be an absolute path name.
|
||||
|
||||
/*
|
||||
* Sets the current path name in the Save panel's browser.
|
||||
* The path argument must be an absolute path name.
|
||||
*/
|
||||
- (void) setDirectory: (NSString *)path;
|
||||
// Specifies the type, a file name extension to be appended to
|
||||
// any selected files that don't already have that extension;
|
||||
// The argument type should not include the period that begins
|
||||
// the extension. Invoke this method each time the Save panel
|
||||
// is used for another file type within the application.
|
||||
|
||||
/*
|
||||
* Specifies the type, a file name extension to be appended to
|
||||
* any selected files that don't already have that extension;
|
||||
* The argument type should not include the period that begins
|
||||
* the extension. Invoke this method each time the Save panel
|
||||
* is used for another file type within the application.
|
||||
*/
|
||||
- (void) setRequiredFileType: (NSString *)type;
|
||||
// Sets the NSSavePanel's behavior for displaying file packages
|
||||
// (for example, MyApp.app) to the user. If flag is YES, the
|
||||
// user is shown files and subdirectories within a file
|
||||
// package. If NO, the NSSavePanel shows each file package as
|
||||
// a file, thereby giving no indication that it is a directory.
|
||||
|
||||
/*
|
||||
* Sets the NSSavePanel's behavior for displaying file packages
|
||||
* (for example, MyApp.app) to the user. If flag is YES, the
|
||||
* user is shown files and subdirectories within a file
|
||||
* package. If NO, the NSSavePanel shows each file package as
|
||||
* a file, thereby giving no indication that it is a directory.
|
||||
*/
|
||||
- (void) setTreatsFilePackagesAsDirectories: (BOOL)flag;
|
||||
- (BOOL) treatsFilePackagesAsDirectories;
|
||||
// Validates and possibly reloads the browser columns visible
|
||||
// in the Save panel by causing the delegate method
|
||||
// panel:shouldShowFilename: to be invoked. One situation in
|
||||
// which this method would find use is whey you want the
|
||||
// browser show only files with certain extensions based on the
|
||||
// selection made in an accessory-view pop-up list. When the
|
||||
// user changes the selection, you would invoke this method to
|
||||
// revalidate the visible columns.
|
||||
- (void)validateVisibleColumns;
|
||||
|
||||
//
|
||||
// Running the NSSavePanel
|
||||
//
|
||||
// Initializes the panel to the directory specified by path
|
||||
// and, optionally, the file specified by filename, then
|
||||
// displays it and begins its modal event loop; path and
|
||||
// filename can be empty strings, but cannot be nil. The
|
||||
// method invokes Application's runModalForWindow: method with
|
||||
// self as the argument. Returns NSOKButton (if the user
|
||||
// clicks the OK button) or NSCancelButton (if the user clicks
|
||||
// the Cancel button). Do not invoke filename or directory
|
||||
// within a modal loop because the information that these
|
||||
// methods fetch is updated only upon return.
|
||||
#ifndef STRICT_OPENSTEP
|
||||
/*
|
||||
* Validates and possibly reloads the browser columns visible
|
||||
* in the Save panel by causing the delegate method
|
||||
* panel: shouldShowFilename: to be invoked. One situation in
|
||||
* which this method would find use is whey you want the
|
||||
* browser show only files with certain extensions based on the
|
||||
* selection made in an accessory-view pop-up list. When the
|
||||
* user changes the selection, you would invoke this method to
|
||||
* revalidate the visible columns.
|
||||
*/
|
||||
- (void) validateVisibleColumns;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Running the NSSavePanel
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initializes the panel to the directory specified by path
|
||||
* and, optionally, the file specified by filename, then
|
||||
* displays it and begins its modal event loop; path and
|
||||
* filename can be empty strings, but cannot be nil. The
|
||||
* method invokes Application's runModalForWindow: method with
|
||||
* self as the argument. Returns NSOKButton (if the user
|
||||
* clicks the OK button) or NSCancelButton (if the user clicks
|
||||
* the Cancel button). Do not invoke filename or directory
|
||||
* within a modal loop because the information that these
|
||||
* methods fetch is updated only upon return.
|
||||
*/
|
||||
- (int) runModalForDirectory: (NSString *)path file: (NSString *)filename;
|
||||
- (int) runModal;
|
||||
|
||||
//
|
||||
// Reading Save Information
|
||||
//
|
||||
// Returns the absolute pathname of the directory currently
|
||||
// shown in the panel. Do not invoke this method within a
|
||||
// modal session (runModal or runModalForDirectory:file:)
|
||||
// because the directory information is only updated just
|
||||
// before the modal session ends.
|
||||
/*
|
||||
* Reading Save Information
|
||||
*/
|
||||
|
||||
/*
|
||||
* Returns the absolute pathname of the directory currently
|
||||
* shown in the panel. Do not invoke this method within a
|
||||
* modal session (runModal or runModalForDirectory: file: )
|
||||
* because the directory information is only updated just
|
||||
* before the modal session ends.
|
||||
*/
|
||||
- (NSString *) directory;
|
||||
- (NSString *) filename;
|
||||
|
||||
//
|
||||
// Target and Action Methods
|
||||
//
|
||||
- (void)ok:(id)sender; // target/action of panel's OK button.
|
||||
- (void)cancel:(id)sender; // target/action of panel's cancel button
|
||||
/*
|
||||
* Target and Action Methods
|
||||
*/
|
||||
- (void) ok: (id)sender; /* target/action of panel's OK button. */
|
||||
- (void) cancel: (id)sender; /* target/action of panel's cancel button. */
|
||||
|
||||
//
|
||||
// Responding to User Input
|
||||
//
|
||||
/*
|
||||
* Responding to User Input
|
||||
*/
|
||||
- (void) selectText: (id)sender;
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -191,15 +216,17 @@ enum {
|
|||
// Methods Implemented by the Delegate
|
||||
//
|
||||
@interface NSObject(NSSavePanelDelegate)
|
||||
// The NSSavePanel sends this message just before the end of a
|
||||
// modal session for each file name displayed or selected
|
||||
// (including file names in multiple selections). The delegate
|
||||
// determines whether it wants the file identified by filename;
|
||||
// it returns YES if the file name is valid, or NO if the
|
||||
// NSSavePanel should stay in its modal loop and wait for the
|
||||
// user to type in or select a different file name or names. If
|
||||
// the delegate refuses a file name in a multiple selection,
|
||||
// none of the file names in the selection are accepted.
|
||||
/*
|
||||
* The NSSavePanel sends this message just before the end of a
|
||||
* modal session for each file name displayed or selected
|
||||
* (including file names in multiple selections). The delegate
|
||||
* determines whether it wants the file identified by filename;
|
||||
* it returns YES if the file name is valid, or NO if the
|
||||
* NSSavePanel should stay in its modal loop and wait for the
|
||||
* user to type in or select a different file name or names. If
|
||||
* the delegate refuses a file name in a multiple selection,
|
||||
* none of the file names in the selection are accepted.
|
||||
*/
|
||||
- (BOOL) panel: (id)sender isValidFilename: (NSString*)filename;
|
||||
- (NSComparisonResult) panel: (id)sender
|
||||
compareFilename: (NSString *)filename1
|
||||
|
|
|
@ -36,26 +36,30 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <AppKit/NSOpenPanel.h>
|
||||
|
||||
// toDo: - canChooseFiles unimplemented
|
||||
// - allowsMultipleSelection untested
|
||||
// - setCanChooseDirectories untested
|
||||
/*
|
||||
* toDo: - canChooseFiles unimplemented
|
||||
* - allowsMultipleSelection untested
|
||||
* - setCanChooseDirectories untested
|
||||
*/
|
||||
|
||||
static NSOpenPanel *gnustep_gui_open_panel = nil;
|
||||
|
||||
@implementation NSOpenPanel
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSOpenPanel class])
|
||||
[self setVersion:1]; // Initial version
|
||||
{
|
||||
[self setVersion: 1];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Accessing the NSOpenPanel
|
||||
//
|
||||
/*
|
||||
* Accessing the NSOpenPanel
|
||||
*/
|
||||
+ (NSOpenPanel *) openPanel
|
||||
{
|
||||
if (!gnustep_gui_open_panel)
|
||||
|
@ -68,14 +72,14 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
|
|||
return gnustep_gui_open_panel;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
|
||||
//
|
||||
// Initialization
|
||||
//
|
||||
- init
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
[self setTitle: @"Open"];
|
||||
|
@ -85,25 +89,48 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Filtering Files
|
||||
//
|
||||
/*
|
||||
* Filtering Files
|
||||
*/
|
||||
- (void) setAllowsMultipleSelection: (BOOL)flag
|
||||
{
|
||||
allowsMultipleSelection=flag;
|
||||
[browser setAllowsMultipleSelection: flag];
|
||||
}
|
||||
|
||||
-(BOOL) allowsMultipleSelection { return allowsMultipleSelection; }
|
||||
-(void) setCanChooseDirectories:(BOOL)flag { canChooseDirectories = flag; }
|
||||
-(BOOL) canChooseDirectories { return canChooseDirectories; }
|
||||
-(void) setCanChooseFiles:(BOOL)flag { canChooseFiles = flag; }
|
||||
-(BOOL) canChooseFiles { return canChooseFiles; }
|
||||
-(NSString*) filename { return [browser path]; }
|
||||
- (BOOL) allowsMultipleSelection
|
||||
{
|
||||
return allowsMultipleSelection;
|
||||
}
|
||||
|
||||
//
|
||||
// Querying the Chosen Files
|
||||
//
|
||||
- (void) setCanChooseDirectories: (BOOL)flag
|
||||
{
|
||||
canChooseDirectories = flag;
|
||||
}
|
||||
|
||||
- (BOOL) canChooseDirectories
|
||||
{
|
||||
return canChooseDirectories;
|
||||
}
|
||||
|
||||
- (void) setCanChooseFiles: (BOOL)flag
|
||||
{
|
||||
canChooseFiles = flag;
|
||||
}
|
||||
|
||||
- (BOOL) canChooseFiles
|
||||
{
|
||||
return canChooseFiles;
|
||||
}
|
||||
|
||||
- (NSString*) filename
|
||||
{
|
||||
return [browser path];
|
||||
}
|
||||
|
||||
/*
|
||||
* Querying the Chosen Files
|
||||
*/
|
||||
- (NSArray *) filenames
|
||||
{
|
||||
if (!allowsMultipleSelection)
|
||||
|
@ -126,9 +153,9 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Running the NSOpenPanel
|
||||
//
|
||||
/*
|
||||
* Running the NSOpenPanel
|
||||
*/
|
||||
- (int) runModalForTypes: (NSArray *)fileTypes
|
||||
{
|
||||
return [self runModalForDirectory: [self directory]
|
||||
|
@ -147,9 +174,9 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
|
|||
return [self runModalForDirectory: path file: name];
|
||||
}
|
||||
|
||||
//
|
||||
// Target and Action Methods
|
||||
//
|
||||
/*
|
||||
* Target and Action Methods
|
||||
*/
|
||||
- (void) ok_ORIGINAL_NOT_USED: (id)sender // excess? fix me FAR
|
||||
{
|
||||
char *sp, files[4096], *p;
|
||||
|
@ -196,9 +223,9 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
|
|
@ -46,19 +46,21 @@
|
|||
#include <AppKit/IMLoading.h>
|
||||
#include <AppKit/GMArchiver.h>
|
||||
|
||||
// toDo:
|
||||
// - interactive directory creation in SavePanel
|
||||
// - accessory view support
|
||||
// - parse ".hidden" files; array of suffixes of directories treated as single
|
||||
// files
|
||||
/*
|
||||
* toDo:
|
||||
* - interactive directory creation in SavePanel
|
||||
* - accessory view support
|
||||
* - parse ".hidden" files; array of suffixes of directories treated as single
|
||||
* files
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Fake class for gmodel
|
||||
//
|
||||
//
|
||||
// Class variables
|
||||
//
|
||||
/*
|
||||
* Fake class for gmodel
|
||||
*/
|
||||
/*
|
||||
* Class variables
|
||||
*/
|
||||
static NSSavePanel *gnustep_gui_save_panel = nil;
|
||||
|
||||
@interface _SavePanel : NSObject
|
||||
|
@ -69,9 +71,9 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
column: (int)column;
|
||||
@end
|
||||
|
||||
//======================================================================
|
||||
// _SavePanel: used for loading gmodels, NSBrowser delegate
|
||||
//======================================================================
|
||||
/*
|
||||
* _SavePanel: used for loading gmodels, NSBrowser delegate
|
||||
*/
|
||||
@implementation _SavePanel
|
||||
|
||||
+ (id) init
|
||||
|
@ -79,9 +81,9 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
NSLog(@"asdasdasd");
|
||||
return (self = [super init]);
|
||||
}
|
||||
//
|
||||
// Model stuff
|
||||
//
|
||||
/*
|
||||
* Model stuff
|
||||
*/
|
||||
- (id) initWithModelUnarchiver : (GMUnarchiver*)unarchiver
|
||||
{
|
||||
if (!gnustep_gui_save_panel)
|
||||
|
@ -104,13 +106,14 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *ptc = [sender pathToColumn: column];
|
||||
NSArray *files = [fm directoryContentsAtPath: ptc];
|
||||
int i, count = [files count];
|
||||
unsigned i, count = [files count];
|
||||
|
||||
if (!count)
|
||||
return;
|
||||
|
||||
[matrix addColumn];
|
||||
for (i=0 ; i<count ; ++i) {
|
||||
for (i =0; i<count; ++i)
|
||||
{
|
||||
id cell;
|
||||
BOOL exists = NO, is_dir = NO;
|
||||
NSMutableString *s = [[[NSMutableString alloc] initWithString: ptc]
|
||||
|
@ -166,23 +169,25 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
// Save panel
|
||||
@implementation NSSavePanel
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSSavePanel class])
|
||||
[self setVersion: 1]; //initial version
|
||||
}
|
||||
|
||||
//
|
||||
// Creating an NSSavePanel
|
||||
//
|
||||
/*
|
||||
* Creating an NSSavePanel
|
||||
*/
|
||||
+ (NSSavePanel *) savePanel
|
||||
{
|
||||
if(!gnustep_gui_save_panel) {
|
||||
if (![GMModel loadIMFile :@"SavePanel" owner:[_SavePanel alloc]]) {
|
||||
fprintf(stderr, "Cannot open save panel model file\n");
|
||||
if (!gnustep_gui_save_panel)
|
||||
{
|
||||
if (![GMModel loadIMFile : @"SavePanel" owner: [_SavePanel alloc]])
|
||||
{
|
||||
NSLog(@"Cannot open save panel model file\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -190,12 +195,12 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
return gnustep_gui_save_panel;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
//
|
||||
// Initialization
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
- (void) setDefaults
|
||||
{
|
||||
directory = @"\\";
|
||||
|
@ -207,7 +212,7 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
treatsFilePackagesAsDirectories = YES;
|
||||
}
|
||||
|
||||
- init
|
||||
- (id) init
|
||||
{
|
||||
[super init];
|
||||
|
||||
|
@ -215,9 +220,9 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Customizing the NSSavePanel
|
||||
//
|
||||
/*
|
||||
* Customizing the NSSavePanel
|
||||
*/
|
||||
- (void) setAccessoryView: (NSView *)aView
|
||||
{
|
||||
_accessoryView = aView;
|
||||
|
@ -243,7 +248,8 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
}
|
||||
|
||||
- (void) setPrompt: (NSString *)prompt
|
||||
{ // does currently not work since i went with NSTextField instead of NSForm
|
||||
{
|
||||
// does currently not work since i went with NSTextField instead of NSForm
|
||||
[[form cell] setTitle: prompt];
|
||||
}
|
||||
|
||||
|
@ -252,9 +258,9 @@ static NSSavePanel *gnustep_gui_save_panel = nil;
|
|||
return [[form cell] title];
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Directory and File Type
|
||||
//
|
||||
/*
|
||||
* Setting Directory and File Type
|
||||
*/
|
||||
- (NSString *) requiredFileType
|
||||
{
|
||||
if (!requiredTypes || ![requiredTypes count])
|
||||
|
@ -292,9 +298,9 @@ NSString *standardizedPath=[path stringByStandardizingPath];
|
|||
return treatsFilePackagesAsDirectories;
|
||||
}
|
||||
|
||||
//
|
||||
// Running the NSSavePanel
|
||||
//
|
||||
/*
|
||||
* Running the NSSavePanel
|
||||
*/
|
||||
- (int) runModalForDirectory: (NSString *)path file: (NSString *)name
|
||||
{
|
||||
int ret;
|
||||
|
@ -316,8 +322,9 @@ NSString *standardizedPath=[path stringByStandardizingPath];
|
|||
|
||||
// replace warning
|
||||
/*
|
||||
if([self class] == [NSSavePanel class] &&
|
||||
[[browser selectedCell] isLeaf] && ret == NSOKButton) {
|
||||
if ([self class] == [NSSavePanel class]
|
||||
&& [[browser selectedCell] isLeaf] && ret == NSOKButton)
|
||||
{
|
||||
//if (NSRunAlertPanel(@"Save",@"The file %@ in %@ exists. Replace it?",
|
||||
//dafplace",@"Cancel",nil,[form stringValue],
|
||||
// [self directory]) == NSAlertAlternateReturn)
|
||||
|
@ -333,9 +340,9 @@ NSString *standardizedPath=[path stringByStandardizingPath];
|
|||
return [self runModalForDirectory: [self directory] file: @""];
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Save Information
|
||||
//
|
||||
/*
|
||||
* Reading Save Information
|
||||
*/
|
||||
- (NSString *) directory
|
||||
{
|
||||
NSString *path;
|
||||
|
@ -355,8 +362,8 @@ NSString *path;
|
|||
{
|
||||
NSString *ret = [NSString stringWithFormat: @"%@/%@",[self directory],
|
||||
[form stringValue]];
|
||||
// if path does not exist ask the user to
|
||||
// create each missing directory
|
||||
|
||||
/* if path does not exist ask the user to create each missing directory */
|
||||
if ([[self requiredFileType] length] && ![ret hasSuffix: [NSString
|
||||
stringWithFormat: @".%@",[self requiredFileType]]])
|
||||
ret = [NSString stringWithFormat: @"%@.%@",ret,[self requiredFileType]];
|
||||
|
@ -364,11 +371,11 @@ NSString *ret = [NSString stringWithFormat:@"%@/%@",[self directory],
|
|||
return [ret stringByExpandingTildeInPath];
|
||||
}
|
||||
|
||||
//
|
||||
// Target and Action Methods
|
||||
//
|
||||
/*
|
||||
* Target and Action Methods
|
||||
*/
|
||||
- (void) ok: (id)sender
|
||||
{ // iterate through selection if a multiple selection
|
||||
{
|
||||
if (![self panel: self isValidFilename: [self filename]])
|
||||
return;
|
||||
|
||||
|
@ -382,17 +389,17 @@ NSString *ret = [NSString stringWithFormat:@"%@/%@",[self directory],
|
|||
[self orderOut: self];
|
||||
}
|
||||
|
||||
//
|
||||
// Responding to User Input
|
||||
//
|
||||
/*
|
||||
* Responding to User Input
|
||||
*/
|
||||
- (void) selectText: (id)sender
|
||||
{
|
||||
[form selectText: sender];
|
||||
}
|
||||
|
||||
//
|
||||
// Methods Implemented by the Delegate
|
||||
//
|
||||
/*
|
||||
* Methods Implemented by the Delegate
|
||||
*/
|
||||
- (NSComparisonResult) panel: (id)sender
|
||||
compareFilename: (NSString *)filename1
|
||||
with: (NSString *)filename2
|
||||
|
@ -408,8 +415,7 @@ NSString *ret = [NSString stringWithFormat:@"%@/%@",[self directory],
|
|||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
- (BOOL)panel:(id)sender
|
||||
shouldShowFilename:(NSString *)filename
|
||||
- (BOOL) panel: (id)sender shouldShowFilename: (NSString *)filename
|
||||
{
|
||||
if ([delegate respondsToSelector: @selector(panel: shouldShowFilename: )])
|
||||
return [delegate panel: sender shouldShowFilename: filename];
|
||||
|
@ -425,9 +431,9 @@ shouldShowFilename:(NSString *)filename
|
|||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[aCoder encodeObject: _accessoryView];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue