mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Document. Fix up NSDebugLogs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14727 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
31a22a7150
commit
356a824ea8
24 changed files with 199 additions and 159 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2002-10-11 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/gui/NSOpenPanel.h: Move comments to source file
|
||||
as autogsdoc.
|
||||
* Headers/gnustep/gui/NSSavePanel.h: Idem.
|
||||
* Source/NSOpenPanel.m: Document.
|
||||
* Source/NSSavePanel.m: Idem.
|
||||
|
||||
* Source/NSBrowser.m: Change NSDebugLog to NSDebugLLog (or remove).
|
||||
* Source/NSButtonCell.m, Source/NSCell.m, Source/NSControl.m,
|
||||
Source/NSEvent.m, Source/NSFontManager.m, Source/NSFontPanel.m,
|
||||
Source/NSImageCell.m, Source/NSMatrix.m, Source/NSMenu.m,
|
||||
Source/NSMenuItem.m, Source/NSResponder.m, Source/NSRulerView.m,
|
||||
Source/NSScrollView.m, Source/NSSplitView.m, Source/NSStepper.m,
|
||||
Source/NSTableHeaderView.m, Source/NSWindow.m: Idem.
|
||||
|
||||
Fri Oct 11 15:10:42 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Headers/gnustep/gui/AppKit.h: Include AppKit/NSFileWrapper.h
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
NSOpenPanel.h
|
||||
|
||||
Standard open panel for opening files
|
||||
Standard panel for opening files
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -59,10 +59,6 @@
|
|||
- (void)setCanChooseDirectories:(BOOL)flag;
|
||||
- (void)setCanChooseFiles:(BOOL)flag;
|
||||
|
||||
// Querying the Chosen Files
|
||||
// Returns an array containing the absolute paths (as NSString
|
||||
// objects) of the selected files and directories. If multiple
|
||||
// selections aren't allowed, the array contains a single name.
|
||||
- (NSArray *)filenames;
|
||||
|
||||
// Running an NSOpenPanel
|
||||
|
|
|
@ -95,82 +95,26 @@ enum {
|
|||
*/
|
||||
- (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.
|
||||
*/
|
||||
- (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.
|
||||
*/
|
||||
- (NSString *) prompt;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
- (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.
|
||||
*/
|
||||
- (void) setRequiredFileType: (NSString *)fileType;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
- (int) runModalForDirectory: (NSString *)path file: (NSString *)filename;
|
||||
- (int) runModal;
|
||||
|
||||
|
@ -191,14 +135,6 @@ enum {
|
|||
/*
|
||||
* 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;
|
||||
|
||||
|
@ -218,7 +154,7 @@ 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
|
||||
|
|
|
@ -570,7 +570,8 @@ static NSTextFieldCell *titleCell;
|
|||
// if unable to find a cell whose title matches aStr return NO
|
||||
if (found == NO)
|
||||
{
|
||||
NSDebugLog (@"NSBrowser: unable to find cell '%@' in column %d\n",
|
||||
NSDebugLLog (@"NSBrowser",
|
||||
@"unable to find cell '%@' in column %d\n",
|
||||
aStr, column + i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1111,8 +1111,6 @@
|
|||
BOOL tmp;
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: start encoding\n");
|
||||
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeObject: _keyEquivalentFont];
|
||||
[aCoder encodeObject: _altContents];
|
||||
|
@ -1127,7 +1125,6 @@
|
|||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: finish encoding\n");
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -1136,8 +1133,6 @@
|
|||
BOOL tmp;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: start decoding\n");
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalent];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altContents];
|
||||
|
@ -1151,8 +1146,6 @@
|
|||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: finish decoding\n");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ static NSColor *shadowCol;
|
|||
}
|
||||
default:
|
||||
{
|
||||
NSDebugLog (@"cell attribute %d not supported", aParameter);
|
||||
NSWarnLog (@"cell attribute %d not supported", aParameter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ static NSColor *shadowCol;
|
|||
}
|
||||
default:
|
||||
{
|
||||
NSDebugLog (@"cell attribute %d not supported", aParameter);
|
||||
NSWarnLog (@"cell attribute %d not supported", aParameter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1270,11 +1270,8 @@ static NSColor *shadowCol;
|
|||
BOOL done;
|
||||
BOOL mouseWentUp;
|
||||
|
||||
NSDebugLog(@"NSCell start tracking\n");
|
||||
NSDebugLog(@"NSCell tracking in rect %f %f %f %f\n",
|
||||
cellFrame.origin.x, cellFrame.origin.y,
|
||||
cellFrame.size.width, cellFrame.size.height);
|
||||
NSDebugLog(@"NSCell initial point %f %f\n", point.x, point.y);
|
||||
NSDebugLLog(@"NSCell", @"cell start tracking in rect %@ initial point %f %f",
|
||||
NSStringFromRect(cellFrame), point.x, point.y);
|
||||
|
||||
_mouse_down_flags = [theEvent modifierFlags];
|
||||
if (![self startTrackingAt: point inView: controlView])
|
||||
|
@ -1294,7 +1291,7 @@ static NSColor *shadowCol;
|
|||
event_mask |= NSPeriodicMask;
|
||||
}
|
||||
|
||||
NSDebugLog(@"NSCell get mouse events\n");
|
||||
NSDebugLLog(@"NSCell", @"cell get mouse events\n");
|
||||
mouseWentUp = NO;
|
||||
done = NO;
|
||||
while (!done)
|
||||
|
@ -1328,23 +1325,23 @@ static NSColor *shadowCol;
|
|||
location = [theEvent locationInWindow];
|
||||
}
|
||||
point = [controlView convertPoint: location fromView: nil];
|
||||
NSDebugLog(@"NSCell location %f %f\n", location.x, location.y);
|
||||
NSDebugLog(@"NSCell point %f %f\n", point.x, point.y);
|
||||
NSDebugLLog(@"NSCell", @"location %f %f\n", location.x, location.y);
|
||||
NSDebugLLog(@"NSCell", @"point %f %f\n", point.x, point.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
periodCount++;
|
||||
NSDebugLog (@"got a periodic event");
|
||||
NSDebugLLog (@"NSCell", @"cell got a periodic event");
|
||||
}
|
||||
|
||||
if (![controlView mouse: point inRect: cellFrame])
|
||||
{
|
||||
NSDebugLog(@"NSCell point not in cell frame\n");
|
||||
NSDebugLLog(@"NSCell", @"point not in cell frame\n");
|
||||
|
||||
pointIsInCell = NO;
|
||||
if (flag == NO)
|
||||
{
|
||||
NSDebugLog(@"NSCell return immediately\n");
|
||||
NSDebugLLog(@"NSCell", @"cell return immediately\n");
|
||||
done = YES;
|
||||
}
|
||||
}
|
||||
|
@ -1357,14 +1354,14 @@ static NSColor *shadowCol;
|
|||
at: point // tracking?
|
||||
inView: controlView])
|
||||
{
|
||||
NSDebugLog(@"NSCell stop tracking\n");
|
||||
NSDebugLLog(@"NSCell", @"cell stop tracking\n");
|
||||
done = YES;
|
||||
}
|
||||
|
||||
// Did the mouse go up?
|
||||
if (eventType == NSLeftMouseUp)
|
||||
{
|
||||
NSDebugLog(@"NSCell mouse went up\n");
|
||||
NSDebugLLog(@"NSCell", @"cell mouse went up\n");
|
||||
mouseWentUp = YES;
|
||||
done = YES;
|
||||
}
|
||||
|
@ -1397,11 +1394,11 @@ static NSColor *shadowCol;
|
|||
// Return YES only if the mouse went up within the cell
|
||||
if (mouseWentUp && (flag || [controlView mouse: point inRect: cellFrame]))
|
||||
{
|
||||
NSDebugLog(@"NSCell mouse went up in cell\n");
|
||||
NSDebugLLog(@"NSCell", @"mouse went up in cell\n");
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSDebugLog(@"NSCell mouse did not go up in cell\n");
|
||||
NSDebugLLog(@"NSCell", @"mouse did not go up in cell\n");
|
||||
return NO; // Otherwise return NO
|
||||
}
|
||||
|
||||
|
@ -1646,8 +1643,6 @@ static NSColor *shadowCol;
|
|||
|
||||
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
NSDebugLog (@"NSCell drawWithFrame: inView: ");
|
||||
|
||||
// do nothing if cell's frame rect is zero
|
||||
if (NSIsEmptyRect(cellFrame) || ![controlView window])
|
||||
return;
|
||||
|
|
|
@ -55,7 +55,6 @@ static Class actionCellClass;
|
|||
{
|
||||
if (self == [NSControl class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSControl class\n");
|
||||
[self setVersion: 1];
|
||||
cellClass = [NSCell class];
|
||||
usedCellClass = cellClass;
|
||||
|
@ -493,7 +492,6 @@ static Class actionCellClass;
|
|||
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask
|
||||
| NSMouseMovedMask | NSLeftMouseDraggedMask | NSOtherMouseDraggedMask
|
||||
| NSRightMouseDraggedMask;
|
||||
NSDebugLog(@"NSControl mouseDown\n");
|
||||
|
||||
if (![self isEnabled])
|
||||
return;
|
||||
|
@ -542,7 +540,6 @@ static Class actionCellClass;
|
|||
if (done)
|
||||
break;
|
||||
|
||||
NSDebugLog(@"NSControl process another event\n");
|
||||
e = [theApp nextEventMatchingMask: event_mask
|
||||
untilDate: nil
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
|
||||
@implementation NSDocument
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
}
|
||||
|
||||
+ (NSArray *)readableTypes
|
||||
{
|
||||
return [[NSDocumentController sharedDocumentController]
|
||||
|
@ -53,7 +49,8 @@
|
|||
|
||||
+ (NSArray *)writableTypes
|
||||
{
|
||||
return [[NSDocumentController sharedDocumentController] _editorTypesForClass:self];
|
||||
return [[NSDocumentController sharedDocumentController]
|
||||
_editorTypesForClass:self];
|
||||
}
|
||||
|
||||
+ (BOOL)isNativeType:(NSString *)type
|
||||
|
|
|
@ -71,7 +71,6 @@ static Class eventClass;
|
|||
{
|
||||
if (self == [NSEvent class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSEvent class\n");
|
||||
[self setVersion: 1];
|
||||
eventClass = [NSEvent class];
|
||||
}
|
||||
|
@ -283,7 +282,7 @@ static Class eventClass;
|
|||
NSTimer *timer;
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"startPeriodicEventsAfterDelay: withPeriod: ");
|
||||
NSDebugLLog (@"NSEvent", @"startPeriodicEventsAfterDelay: withPeriod: ");
|
||||
|
||||
if ([dict objectForKey: timerKey])
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -322,7 +321,7 @@ static Class eventClass;
|
|||
data1: 0
|
||||
data2: 0];
|
||||
|
||||
NSDebugLog (@"_timerFired: ");
|
||||
NSDebugLLog (@"NSEvent", @"_timerFired: ");
|
||||
[NSApp postEvent: periodicEvent atStart: NO];
|
||||
}
|
||||
|
||||
|
@ -334,7 +333,7 @@ static Class eventClass;
|
|||
NSTimer *realTimer;
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"_registerRealTimer: ");
|
||||
NSDebugLLog (@"NSEvent", @"_registerRealTimer: ");
|
||||
{
|
||||
NSTimeInterval timeInterval;
|
||||
NSEvent *periodicEvent;
|
||||
|
@ -368,7 +367,7 @@ static Class eventClass;
|
|||
NSTimer *timer;
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"stopPeriodicEvents");
|
||||
NSDebugLLog (@"NSEvent", @"stopPeriodicEvents");
|
||||
timer = [dict objectForKey: timerKey];
|
||||
[timer invalidate];
|
||||
[dict removeObjectForKey: timerKey];
|
||||
|
|
|
@ -62,8 +62,6 @@ static Class fontPanelClass = Nil;
|
|||
{
|
||||
if (self == [NSFontManager class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSFontManager class\n");
|
||||
|
||||
// Initial version
|
||||
[self setVersion: 1];
|
||||
|
||||
|
@ -90,7 +88,6 @@ static Class fontPanelClass = Nil;
|
|||
{
|
||||
if (!sharedFontManager)
|
||||
{
|
||||
NSDebugLog(@"Initializing NSFontManager fonts\n");
|
||||
sharedFontManager = [[fontManagerClass alloc] init];
|
||||
}
|
||||
return sharedFontManager;
|
||||
|
|
|
@ -100,9 +100,6 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
{
|
||||
if (self == [NSFontPanel class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSFontPanel class\n");
|
||||
|
||||
// Initial version
|
||||
[self setVersion: 1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,25 +365,20 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
|||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
NSDebugLog(@"NSImageCell: start encoding");
|
||||
[aCoder encodeValueOfObjCType: @encode(NSImageAlignment) at: &_imageAlignment];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSImageFrameStyle) at: &_frameStyle];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSImageScaling) at: &_imageScaling];
|
||||
[aCoder encodeSize: _original_image_size];
|
||||
NSDebugLog(@"NSImageCell: finish encoding");
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
NSDebugLog(@"NSImageCell: start decoding");
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSImageAlignment) at: &_imageAlignment];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSImageFrameStyle) at: &_frameStyle];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSImageScaling) at: &_imageScaling];
|
||||
_original_image_size = [aDecoder decodeSize];
|
||||
NSDebugLog(@"NSImageCell: finish decoding");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -2388,7 +2388,7 @@ static SEL getSel;
|
|||
switch ([theEvent type])
|
||||
{
|
||||
case NSPeriodic:
|
||||
NSDebugLog(@"NSMatrix: got NSPeriodic event\n");
|
||||
NSDebugLLog(@"NSMatrix", @"matrix: got NSPeriodic event\n");
|
||||
shouldProceedEvent = YES;
|
||||
break;
|
||||
|
||||
|
@ -2397,7 +2397,7 @@ static SEL getSel;
|
|||
case NSLeftMouseDown:
|
||||
default:
|
||||
shouldProceedEvent = YES;
|
||||
NSDebugLog(@"NSMatrix: got event of type: %d\n",
|
||||
NSDebugLLog(@"NSMatrix", @"matrix: got event of type: %d\n",
|
||||
[theEvent type]);
|
||||
ASSIGN(lastEvent, theEvent);
|
||||
continue;
|
||||
|
|
|
@ -163,8 +163,6 @@ static NSNotificationCenter *nc;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSDebugLog (@"NSMenu `%@' dealloc", _title);
|
||||
|
||||
[nc removeObserver: self];
|
||||
|
||||
RELEASE(_notifications);
|
||||
|
|
|
@ -416,8 +416,6 @@ static Class imageClass;
|
|||
{
|
||||
NSMenuItem *copy = (NSMenuItem*)NSCopyObject (self, 0, zone);
|
||||
|
||||
NSDebugLog (@"menu item '%@' copy", _title);
|
||||
|
||||
// We reset the menu to nil to allow the reuse of the copy
|
||||
copy->_menu = nil;
|
||||
copy->_title = [_title copyWithZone: zone];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** <title>NSOpenPanel</title> -*-objc-*-
|
||||
|
||||
<abstract>Standard open panel for opening files</abstract>
|
||||
<abstract>Standard panel for opening files</abstract>
|
||||
|
||||
Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -225,6 +225,28 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
<p>Implements a panel that allows the user to select a file or files.
|
||||
NSOpenPanel is based on the NSSavePanel implementation and shares
|
||||
a lot of similarities with it.
|
||||
</p>
|
||||
<p>
|
||||
There is only one open panel per application and this panel is obtained
|
||||
by calling the +openPanel class method. From here, you should set the
|
||||
characteristics of the file selection mechanism using the
|
||||
-setCanChooseFiles:, -setCanChooseDirectories: and
|
||||
-setAllowsMultipleSelection: methods. The default is YES except for
|
||||
allowing multiple selection. When ready to show the panel, use the
|
||||
-runModalForTypes:, or a similar method to show the panel in a modal
|
||||
session. Other methods allow you to set the initial directory and
|
||||
initially selected file. The method will return one of NSOKButton
|
||||
or NSCancelButton depending on which button the user pressed.
|
||||
</p>
|
||||
<p>
|
||||
Use the -filename or -filenames: method to retrieve the name of the
|
||||
file the user selected.
|
||||
</p>
|
||||
*/
|
||||
@implementation NSOpenPanel
|
||||
|
||||
/*
|
||||
|
@ -241,6 +263,7 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
/*
|
||||
* Accessing the NSOpenPanel shared instance
|
||||
*/
|
||||
/** Returns the shared NSOpenPanel instance */
|
||||
+ (NSOpenPanel *) openPanel
|
||||
{
|
||||
if (!_gs_gui_open_panel)
|
||||
|
@ -264,37 +287,47 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
/*
|
||||
* Filtering Files
|
||||
*/
|
||||
/** Allows the user to select multiple files if flag is YES. */
|
||||
- (void) setAllowsMultipleSelection: (BOOL)flag
|
||||
{
|
||||
[_browser setAllowsMultipleSelection: flag];
|
||||
}
|
||||
|
||||
/** Returns YES if the user is allowed to select multiple files. The
|
||||
default behavior is not to allow mutiple selections. */
|
||||
- (BOOL) allowsMultipleSelection
|
||||
{
|
||||
return [_browser allowsMultipleSelection];
|
||||
}
|
||||
|
||||
/** Allows the user to choose directories if flag is YES. */
|
||||
- (void) setCanChooseDirectories: (BOOL)flag
|
||||
{
|
||||
_canChooseDirectories = flag;
|
||||
[_browser setAllowsBranchSelection: flag];
|
||||
}
|
||||
|
||||
/** Returns YES if the user is allowed to choose directories The
|
||||
default behavior is to allow choosing directories. */
|
||||
- (BOOL) canChooseDirectories
|
||||
{
|
||||
return _canChooseDirectories;
|
||||
}
|
||||
|
||||
/** Allows the user to choose files if flag is YES */
|
||||
- (void) setCanChooseFiles: (BOOL)flag
|
||||
{
|
||||
_canChooseFiles = flag;
|
||||
}
|
||||
|
||||
/** Returns YES if the user is allowed to choose files. The
|
||||
default behavior it to allow choosing files. */
|
||||
- (BOOL) canChooseFiles
|
||||
{
|
||||
return _canChooseFiles;
|
||||
}
|
||||
|
||||
/** Returns the absolute path of the file selected by the user. */
|
||||
- (NSString*) filename
|
||||
{
|
||||
NSArray *ret;
|
||||
|
@ -307,9 +340,10 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Querying the Chosen Files
|
||||
*/
|
||||
/** Returns an array containing the absolute paths (as NSString
|
||||
objects) of the selected files and directories. If multiple
|
||||
selections aren't allowed, the array contains a single name.
|
||||
*/
|
||||
- (NSArray *) filenames
|
||||
{
|
||||
if ([_browser allowsMultipleSelection])
|
||||
|
@ -353,6 +387,7 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns an array of the selected files as URLs */
|
||||
- (NSArray *) URLs
|
||||
{
|
||||
NSMutableArray *ret = [NSMutableArray new];
|
||||
|
@ -370,13 +405,19 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
/*
|
||||
* Running the NSOpenPanel
|
||||
*/
|
||||
/** Displays the open panel in a modal session, filtering for
|
||||
files that have the specified types */
|
||||
- (int) runModalForTypes: (NSArray *)fileTypes
|
||||
{
|
||||
return [self runModalForDirectory: nil
|
||||
file: nil
|
||||
return [self runModalForDirectory: @""
|
||||
file: @""
|
||||
types: fileTypes];
|
||||
}
|
||||
|
||||
/** Displays the open panel in a modal session, with the directory
|
||||
path shown and file name (if any) selected. Files are filtered for the
|
||||
specified types. The directory and filename can be empty strings
|
||||
but must not be nil. */
|
||||
- (int) runModalForDirectory: (NSString *)path
|
||||
file: (NSString *)name
|
||||
types: (NSArray *)fileTypes
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
{
|
||||
if (self == [NSResponder class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSResponder class\n");
|
||||
|
||||
[self setVersion: 1];
|
||||
|
||||
/* Gets the current input manager - this forces it to read the
|
||||
|
|
|
@ -178,7 +178,6 @@ static NSMutableDictionary *units = nil;
|
|||
NSArray *array2;
|
||||
NSArray *array10;
|
||||
|
||||
NSDebugLog(@"Initialize NSRulerView class\n");
|
||||
[self setVersion: 0.01];
|
||||
|
||||
units = [[NSMutableDictionary alloc] init];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** <title>NSSavePanel</title>
|
||||
|
||||
<abstract>Standard save panel for saving files</abstract>
|
||||
<abstract>Standard panel for saving files</abstract>
|
||||
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -468,6 +468,24 @@ selectCellWithString: (NSString*)title
|
|||
//
|
||||
// NSSavePanel methods
|
||||
//
|
||||
/**
|
||||
<p>Implements a panel that allows the user to save a file.
|
||||
</p>
|
||||
<p>
|
||||
There is only one save panel per application and this panel is obtained
|
||||
by calling the +savePanel class method. From here, you should set the
|
||||
required file extension using -setRequiredFileType:
|
||||
When ready to show the panel, use the
|
||||
-runModal, or a similar method to show the panel in a modal
|
||||
session. Other methods allow you to set the initial directory and
|
||||
initially choosen file. The method will return one of NSOKButton
|
||||
or NSCancelButton depending on which button the user pressed.
|
||||
</p>
|
||||
<p>
|
||||
Use the -filename method to retrieve the name of the
|
||||
file the user choose.
|
||||
</p>
|
||||
*/
|
||||
@implementation NSSavePanel
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -486,6 +504,7 @@ selectCellWithString: (NSString*)title
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the shared NSSavePanel instance */
|
||||
+ (id) savePanel
|
||||
{
|
||||
if (_gs_gui_save_panel == nil)
|
||||
|
@ -529,6 +548,14 @@ selectCellWithString: (NSString*)title
|
|||
return self;
|
||||
}
|
||||
|
||||
/** Sets an accessory view which is shown near the bottom of the
|
||||
panel. The panel is automatically expanded with enough room to
|
||||
show the extra view. You can use this extra view to customize
|
||||
various characteristics of the file selection mechanism. For instance
|
||||
you could add a popup button which allows the user to select the
|
||||
format that the file is saved in (e.g. rtf or txt). See
|
||||
also -validateVisibleColumns .
|
||||
*/
|
||||
- (void) setAccessoryView: (NSView*)aView
|
||||
{
|
||||
NSRect accessoryViewFrame, bottomFrame;
|
||||
|
@ -635,6 +662,12 @@ selectCellWithString: (NSString*)title
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
[_titleField setStringValue: title];
|
||||
|
@ -644,27 +677,39 @@ selectCellWithString: (NSString*)title
|
|||
[_titleField sizeToFit];
|
||||
}
|
||||
|
||||
/** Returns the title of the save panel */
|
||||
- (NSString*) title
|
||||
{
|
||||
return [_titleField stringValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the prompt of the Save panel field that holds
|
||||
* the current pathname or file name. By default this
|
||||
* prompt is 'Name: '.
|
||||
*/
|
||||
- (void) setPrompt: (NSString*)prompt
|
||||
{
|
||||
[[_form cellAtIndex: 0] setTitle: prompt];
|
||||
[_form setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
/** Returns the prompt used in the current path field. */
|
||||
- (NSString*) prompt
|
||||
{
|
||||
return [[_form cellAtIndex: 0] title];
|
||||
}
|
||||
|
||||
/** Returns the accesory view (if any). */
|
||||
- (NSView*) accessoryView
|
||||
{
|
||||
return _accessoryView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current path name in the Save panel's browser.
|
||||
* The path argument must be an absolute path name.
|
||||
*/
|
||||
- (void) setDirectory: (NSString*)path
|
||||
{
|
||||
NSString *standardizedPath = [path stringByStandardizingPath];
|
||||
|
@ -680,31 +725,64 @@ selectCellWithString: (NSString*)title
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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*)fileType
|
||||
{
|
||||
ASSIGN(_requiredFileType, fileType);
|
||||
}
|
||||
|
||||
/** Returns the required file type. The default is no required file type. */
|
||||
- (NSString*) requiredFileType
|
||||
{
|
||||
return _requiredFileType;
|
||||
}
|
||||
|
||||
/** Returns YES if file packages are shown as directories. The default
|
||||
is NO. */
|
||||
- (BOOL) treatsFilePackagesAsDirectories
|
||||
{
|
||||
return _treatsFilePackagesAsDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
_treatsFilePackagesAsDirectories = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates and possibly reloads the browser columns that are 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 to 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
|
||||
{
|
||||
[_browser validateVisibleColumns];
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the save panel for the user. This method invokes
|
||||
* -runModalForDirectory:file: with empty strings for the directory and
|
||||
* filename. Returns NSOKButton (if the user clicks the OK button) or
|
||||
* NSCancelButton (if the user clicks the Cancel button).
|
||||
*/
|
||||
- (int) runModal
|
||||
{
|
||||
if (_directory)
|
||||
|
@ -715,6 +793,16 @@ selectCellWithString: (NSString*)title
|
|||
file: @""];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 NSApplication:-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).
|
||||
*/
|
||||
- (int) runModalForDirectory: (NSString*)path file: (NSString*)filename
|
||||
{
|
||||
[self _setupForDirectory: path file: filename];
|
||||
|
@ -755,6 +843,11 @@ selectCellWithString: (NSString*)title
|
|||
contextInfo: contextInfo];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the directory choosen by the user. Do not invoke directory
|
||||
* within a modal loop because the information that these methods
|
||||
* fetch is updated only upon return.
|
||||
*/
|
||||
- (NSString*) directory
|
||||
{
|
||||
if (_directory)
|
||||
|
@ -763,6 +856,11 @@ selectCellWithString: (NSString*)title
|
|||
return @"";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute filename choosen by the user. Do not invoke
|
||||
* filename within a modal loop because the information that these
|
||||
* methods fetch is updated only upon return.
|
||||
*/
|
||||
- (NSString*) filename
|
||||
{
|
||||
if (_fullFileName == nil)
|
||||
|
|
|
@ -56,7 +56,6 @@ static float scrollerWidth;
|
|||
{
|
||||
if (self == [NSScrollView class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSScrollView class\n");
|
||||
[self setRulerViewClass: [NSRulerView class]];
|
||||
scrollerWidth = [NSScroller scrollerWidth];
|
||||
[self setVersion: 2];
|
||||
|
@ -318,7 +317,7 @@ static float scrollerWidth;
|
|||
/* If view is flipped reverse the scroll direction */
|
||||
amount = -amount;
|
||||
}
|
||||
NSDebugLog (@"increment/decrement: amount = %f, flipped = %d",
|
||||
NSDebugLLog (@"NSScrollView", @"increment/decrement: amount = %f, flipped = %d",
|
||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||
|
||||
point.y = clipViewBounds.origin.y + amount;
|
||||
|
@ -463,7 +462,7 @@ static float scrollerWidth;
|
|||
}
|
||||
point = clipViewBounds.origin;
|
||||
|
||||
NSDebugLog (@"_doScroll: float value = %f", floatValue);
|
||||
NSDebugLLog (@"NSScrollView", @"_doScroll: float value = %f", floatValue);
|
||||
|
||||
/* do nothing if scroller is unknown */
|
||||
if (scroller != _horizScroller && scroller != _vertScroller)
|
||||
|
@ -522,7 +521,8 @@ static float scrollerWidth;
|
|||
/* If view is flipped reverse the scroll direction */
|
||||
amount = -amount;
|
||||
}
|
||||
NSDebugLog (@"increment/decrement: amount = %f, flipped = %d",
|
||||
NSDebugLLog (@"NSScrollView",
|
||||
@"increment/decrement: amount = %f, flipped = %d",
|
||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||
point.y = clipViewBounds.origin.y + amount;
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ static float scrollerWidth;
|
|||
return;
|
||||
}
|
||||
|
||||
NSDebugLog (@"reflectScrolledClipView:");
|
||||
NSDebugLLog (@"NSScrollView", @"reflectScrolledClipView:");
|
||||
|
||||
if (_contentView)
|
||||
{
|
||||
|
@ -1240,7 +1240,6 @@ static float scrollerWidth;
|
|||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start encoding\n");
|
||||
[aCoder encodeObject: _contentView];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
||||
|
@ -1273,7 +1272,6 @@ static float scrollerWidth;
|
|||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||
|
||||
/* We do not need to encode headerview, cornerview stuff */
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish encoding\n");
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -347,8 +347,8 @@ static NSNotificationCenter *nc = nil;
|
|||
}
|
||||
if (NSEqualRects(r, oldRect) == NO)
|
||||
{
|
||||
NSDebugLog(@"drawing divider at x: %d, y: %d, w: %d, h: %d\n",
|
||||
(int)NSMinX(r), (int)NSMinY(r), (int)NSWidth(r), (int)NSHeight(r));
|
||||
NSDebugLLog(@"NSSplitView", @"drawing divider at %@\n",
|
||||
NSStringFromRect(r));
|
||||
[_dividerColor set];
|
||||
|
||||
|
||||
|
@ -552,7 +552,7 @@ static NSNotificationCenter *nc = nil;
|
|||
}
|
||||
}
|
||||
[prev setFrame: r];
|
||||
NSDebugLog(@"drawing PREV at x: %d, y: %d, w: %d, h: %d\n",
|
||||
NSDebugLLog(@"NSSplitView", @"drawing PREV at x: %d, y: %d, w: %d, h: %d\n",
|
||||
(int)NSMinX(r),(int)NSMinY(r),(int)NSWidth(r),(int)NSHeight(r));
|
||||
|
||||
r1 = [v frame];
|
||||
|
@ -583,7 +583,7 @@ static NSNotificationCenter *nc = nil;
|
|||
}
|
||||
}
|
||||
[v setFrame: r1];
|
||||
NSDebugLog(@"drawing LAST at x: %d, y: %d, w: %d, h: %d\n",
|
||||
NSDebugLLog(@"NSSplitView", @"drawing LAST at x: %d, y: %d, w: %d, h: %d\n",
|
||||
(int)NSMinX(r1),(int)NSMinY(r1),(int)NSWidth(r1),
|
||||
(int)NSHeight(r1));
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ id _nsstepperCellClass = nil;
|
|||
{
|
||||
if (self == [NSStepper class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSStepper class\n");
|
||||
[self setVersion: 1];
|
||||
[self setCellClass: [NSStepperCell class]];
|
||||
}
|
||||
|
|
|
@ -812,7 +812,8 @@
|
|||
|
||||
if (![self mouse: point inRect: cellFrame])
|
||||
{
|
||||
NSDebugLog(@"NSCell point not in cell frame\n");
|
||||
NSDebugLLog(@"NSCell",
|
||||
@"tableheaderview point not in cell frame\n");
|
||||
{
|
||||
NSRect rect = [self headerRectOfColumn: columnIndex];
|
||||
[_tableView _mouseDownInHeaderOfTableColumn:
|
||||
|
|
|
@ -472,7 +472,6 @@ static NSNotificationCenter *nc = nil;
|
|||
{
|
||||
if (self == [NSWindow class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSWindow class\n");
|
||||
[self setVersion: 2];
|
||||
ccSel = @selector(_checkCursorRectangles:forEvent:);
|
||||
ctSel = @selector(_checkTrackingRectangles:forEvent:);
|
||||
|
@ -569,8 +568,6 @@ static NSNotificationCenter *nc = nil;
|
|||
{
|
||||
int style;
|
||||
|
||||
NSDebugLog(@"NSWindow -init\n");
|
||||
|
||||
style = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSMiniaturizableWindowMask | NSResizableWindowMask;
|
||||
|
||||
|
@ -3746,8 +3743,6 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
NSDebugLog(@"NSWindow: start encoding\n");
|
||||
|
||||
[aCoder encodeRect: [[self contentView] frame]];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &_styleMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSBackingStoreType) at: &_backingType];
|
||||
|
@ -3785,8 +3780,6 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
|
||||
[aCoder encodeObject: _miniaturizedImage];
|
||||
[aCoder encodeConditionalObject: _initialFirstResponder];
|
||||
|
||||
NSDebugLog(@"NSWindow: finish encoding\n");
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -3804,7 +3797,6 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
int anInt;
|
||||
id obj;
|
||||
|
||||
NSDebugLog(@"NSWindow: start decoding\n");
|
||||
aRect = [aDecoder decodeRect];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned)
|
||||
at: &aStyle];
|
||||
|
@ -3866,7 +3858,6 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
at: &_initialFirstResponder];
|
||||
|
||||
[self setFrameTopLeftPoint: p];
|
||||
NSDebugLog(@"NSWindow: finish decoding\n");
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue