diff --git a/ChangeLog b/ChangeLog index 6be5beeba..3cfa6994f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-02-29 Fred Kiefer + + * Header/AppKit/NSTableView.h: + * Header/AppKit/NSSavePanel.h: + * Source/NSTableView.m: + * Source/NSSavePanel.m: + Declared some more MacOSX 10.3 methods and added place holders for + them. + * Source/NSTextView.m: + Implemented keyed unarchiving. + 2004-02-29 Adam Fedor * Headers/AppKit/NSPageLayout.h: Update tags. diff --git a/Headers/AppKit/NSSavePanel.h b/Headers/AppKit/NSSavePanel.h index dfdc70c96..544c3f2f1 100644 --- a/Headers/AppKit/NSSavePanel.h +++ b/Headers/AppKit/NSSavePanel.h @@ -98,10 +98,16 @@ enum { - (NSString *) prompt; #ifndef STRICT_OPENSTEP +- (void) setNameFieldLabel: (NSString *)label; +- (NSString *) nameFieldLabel; +- (void) setMessage: (NSString *)message; +- (NSString *) message; + /* * Hidding extensions */ - (void) setCanSelectHiddenExtension: (BOOL) flag; +- (BOOL) canSelectHiddenExtension; - (BOOL) isExtensionHidden; - (void) setExtensionHidden: (BOOL) flag; #endif @@ -113,11 +119,23 @@ enum { - (void) setDirectory: (NSString *)path; - (void) setRequiredFileType: (NSString *)fileType; +#ifndef STRICT_OPENSTEP +- (void) setAllowedFileTypes: (NSArray *)types; +- (void) setAllowsOtherFileTypes: (BOOL)flag; +- (NSArray *) allowedFileTypes; +- (BOOL) allowsOtherFileTypes; +#endif + - (void) setTreatsFilePackagesAsDirectories: (BOOL)flag; - (BOOL) treatsFilePackagesAsDirectories; - (void) validateVisibleColumns; +#ifndef STRICT_OPENSTEP +- (void) setCanCreateDirectories: (BOOL)flag; +- (BOOL) canCreateDirectories; +#endif + /* * Running the NSSavePanel */ @@ -182,6 +200,12 @@ enum { - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)fileName confirmed: (BOOL)okFlag; + +#ifndef STRICT_OPENSTEP +- (void) panel: (id)sender willExpand: (BOOL)expanding; +- (void) panelSelectionDidChange: (id)sender; +- (void) panel: (id)sender directoryDidChange: (NSString *)path; +#endif @end #endif /* _GNUstep_H_NSSavePanel */ diff --git a/Headers/AppKit/NSTableView.h b/Headers/AppKit/NSTableView.h index 7db88844c..5adeeeed0 100644 --- a/Headers/AppKit/NSTableView.h +++ b/Headers/AppKit/NSTableView.h @@ -31,8 +31,10 @@ #include #include +#include @class NSArray; +@class NSIndexSet; @class NSTableColumn; @class NSTableHeaderView; @class NSText; @@ -43,7 +45,13 @@ typedef enum _NSTableViewDropOperation { NSTableViewDropAbove } NSTableViewDropOperation; -@interface NSTableView : NSControl +enum { + NSTableViewGridNone = 0, + NSTableViewSolidVerticalGridLineMask = 1, + NSTableViewSolidHorizontalGridLineMask = 2 +}; + +@interface NSTableView : NSControl { /* * Real Ivars @@ -114,18 +122,6 @@ typedef enum _NSTableViewDropOperation { BOOL _tilingDisabled; } -/* Table Dimensions */ -- (int) numberOfColumns; -- (int) numberOfRows; - -/* Columns */ -- (void) addTableColumn: (NSTableColumn *)aColumn; -- (void) removeTableColumn: (NSTableColumn *)aColumn; -- (void) moveColumn: (int)columnIndex toColumn: (int)newIndex; -- (NSArray *) tableColumns; -- (int) columnWithIdentifier: (id)identifier; -- (NSTableColumn *) tableColumnWithIdentifier: (id)anObject; - /* Data Source */ - (void) setDataSource: (id)anObject; - (id) dataSource; @@ -158,10 +154,24 @@ typedef enum _NSTableViewDropOperation { - (float) rowHeight; - (void) setBackgroundColor: (NSColor *)aColor; - (NSColor *) backgroundColor; +- (void) setUsesAlternatingRowBackgroundColors: (BOOL)useAlternatingRowColors; +- (BOOL) usesAlternatingRowBackgroundColors; + +/* Columns */ +- (void) addTableColumn: (NSTableColumn *)aColumn; +- (void) removeTableColumn: (NSTableColumn *)aColumn; +- (void) moveColumn: (int)columnIndex toColumn: (int)newIndex; +- (NSArray *) tableColumns; +- (int) columnWithIdentifier: (id)identifier; +- (NSTableColumn *) tableColumnWithIdentifier: (id)anObject; /* Selecting Columns and Rows */ - (void) selectColumn: (int) columnIndex byExtendingSelection: (BOOL)flag; - (void) selectRow: (int) rowIndex byExtendingSelection: (BOOL)flag; +- (void) selectColumnIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend; +- (void) selectRowIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend; +- (NSIndexSet *) selectedColumnIndexes; +- (NSIndexSet *) selectedRowIndexes; - (void) deselectColumn: (int)columnIndex; - (void) deselectRow: (int)rowIndex; - (int) numberOfSelectedColumns; @@ -175,11 +185,17 @@ typedef enum _NSTableViewDropOperation { - (void) selectAll: (id)sender; - (void) deselectAll: (id)sender; +/* Table Dimensions */ +- (int) numberOfColumns; +- (int) numberOfRows; + /* Grid Drawing attributes */ - (void) setDrawsGrid: (BOOL)flag; - (BOOL) drawsGrid; - (void) setGridColor: (NSColor *)aColor; - (NSColor *) gridColor; +- (void) setGridStyleMask: (unsigned int)gridType; +- (unsigned int) gridStyleMask; /* Editing Cells */ /* ALL TODOS */ @@ -208,8 +224,6 @@ typedef enum _NSTableViewDropOperation { - (void) setAutoresizesAllColumnsToFit: (BOOL)flag; - (BOOL) autoresizesAllColumnsToFit; - (void) sizeLastColumnToFit; -// - (void) sizeToFit; inherited from NSControl -- (void) setFrame: (NSRect) frameRect; - (void) noteNumberOfRowsChanged; - (void) tile; diff --git a/Source/NSSavePanel.m b/Source/NSSavePanel.m index 7aff0fa32..0547c7252 100644 --- a/Source/NSSavePanel.m +++ b/Source/NSSavePanel.m @@ -796,6 +796,29 @@ selectCellWithString: (NSString*)title return _accessoryView; } +- (void) setNameFieldLabel: (NSString *)label +{ + // FIXME +} + +- (NSString *) nameFieldLabel +{ + // FIXME + return @"Save As"; +} + +- (void) setMessage: (NSString *)message +{ + // FIXME +} + +- (NSString *) message +{ + // FIXME + return nil; +} + + /** * Sets the current path name in the Save panel's browser. * The path argument must be an absolute path name. @@ -833,6 +856,28 @@ selectCellWithString: (NSString*)title return _requiredFileType; } +- (void) setAllowedFileTypes: (NSArray *)types +{ + // FIXME +} + +- (void) setAllowsOtherFileTypes: (BOOL)flag +{ + // FIXME +} + +- (NSArray *) allowedFileTypes; +{ + // FIXME + return nil; +} + +- (BOOL) allowsOtherFileTypes; +{ + // FIXME + return NO; +} + /** Returns YES if file packages are shown as directories. The default is NO. */ - (BOOL) treatsFilePackagesAsDirectories @@ -867,6 +912,17 @@ selectCellWithString: (NSString*)title [_browser validateVisibleColumns]; } +- (void) setCanCreateDirectories: (BOOL)flag +{ + // FIXME +} + +- (BOOL) canCreateDirectories +{ + // FIXME + return NO; +} + /** * Shows the save panel for the user. This method invokes * -runModalForDirectory:file: with empty strings for the filename. @@ -1131,6 +1187,11 @@ selectCellWithString: (NSString*)title { // FIXME } +- (BOOL) canSelectHiddenExtension +{ + // FIXME + return NO; +} - (BOOL) isExtensionHidden { diff --git a/Source/NSTableView.m b/Source/NSTableView.m index 1cb3c6384..65ab443fa 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -3387,6 +3388,16 @@ _isCellEditable (id delegate, NSArray *tableColumns, { return _backgroundColor; } +- (void) setUsesAlternatingRowBackgroundColors: (BOOL)useAlternatingRowColors +{ + // FIXME +} + +- (BOOL) usesAlternatingRowBackgroundColors +{ + // FIXME + return NO; +} /* * Selecting Columns and Rows @@ -3618,6 +3629,28 @@ byExtendingSelection: (BOOL)flag } } +- (void) selectColumnIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend +{ + // FIXME +} + +- (void) selectRowIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend +{ + // FIXME +} + +- (NSIndexSet *) selectedColumnIndexes; +{ + // FIXME + return nil; +} + +- (NSIndexSet *) selectedRowIndexes; +{ + // FIXME + return nil; +} + - (void) deselectColumn: (int)columnIndex { NSNumber *num = [NSNumber numberWithInt: columnIndex]; @@ -3900,6 +3933,17 @@ byExtendingSelection: (BOOL)flag return _gridColor; } +- (void) setGridStyleMask: (unsigned int)gridType +{ + // FIXME +} + +- (unsigned int) gridStyleMask; +{ + // FIXME + return 0; +} + /* * Editing Cells */ @@ -5440,6 +5484,15 @@ byExtendingSelection: (BOOL)flag } } +- (void) drawBackgroundInClipRect: (NSRect)clipRect +{ + // FIXME + /* + [_backgroundColor set]; + NSRectFill (clipRect); + */ +} + - (void) drawRect: (NSRect)aRect { int startingRow; @@ -5447,11 +5500,8 @@ byExtendingSelection: (BOOL)flag int i; /* Draw background */ + [self drawBackgroundInClipRect: aRect]; - /* - [_backgroundColor set]; - NSRectFill (aRect); - */ if ((_numberOfRows == 0) || (_numberOfColumns == 0)) { return; @@ -6568,6 +6618,28 @@ byExtendingSelection: (BOOL)flag { } +/* + * sorting + */ +- (void) setSortDescriptors: (NSArray *)array +{ + // FIXME +} + +- (NSArray *)sortDescriptors +{ + // FIXME + return nil; +} + +/* + * User interface validation + */ +- (BOOL) validateUserInterfaceItem: (id )anItem +{ + // FIXME + return YES; +} /* * (NotificationRequestMethods) diff --git a/Source/NSTextView.m b/Source/NSTextView.m index ad4500549..9e1d1516a 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -121,6 +122,51 @@ Interface for a bunch of internal methods that need to be cleaned up. -(void) pasteSelection; @end +// This class is a helper for keyed unarchiving only +@interface NSTextViewSharedData : NSObject +{ +@public + NSColor *backgroundColor; + NSParagraphStyle *paragraphStyle; + int flags; + NSColor *insertionColor; + NSArray *linkAttr; + NSArray *markAttr; + NSArray *selectedAttr; +} +@end + +@implementation NSTextViewSharedData + +- (id) initWithCoder: (NSCoder*)aDecoder +{ + if ([aDecoder allowsKeyedCoding]) + { + ASSIGN(backgroundColor, [aDecoder decodeObjectForKey: @"NSBackgroundColor"]); + ASSIGN(paragraphStyle, [aDecoder decodeObjectForKey: @"NSDefaultParagraphStyle"]); + flags = [aDecoder decodeIntForKey: @"NSFlags"]; + ASSIGN(insertionColor, [aDecoder decodeObjectForKey: @"NSInsertionColor"]); + ASSIGN(linkAttr, [aDecoder decodeObjectForKey: @"NSLinkAttributes"]); + ASSIGN(markAttr, [aDecoder decodeObjectForKey: @"NSMarkedAttributes"]); + ASSIGN(selectedAttr, [aDecoder decodeObjectForKey: @"NSSelectedAttributes"]); + } + else + { + } + return self; +} + +- (void) dealloc +{ + RELEASE(backgroundColor); + RELEASE(paragraphStyle); + RELEASE(insertionColor); + RELEASE(linkAttr); + RELEASE(markAttr); + RELEASE(selectedAttr); +} + +@end /**** Misc. helpers and stuff ****/ @@ -598,77 +644,80 @@ that makes decoding and encoding compatible with the old code. -(id) initWithCoder: (NSCoder *)aDecoder { - int version = [aDecoder versionForClassName: - @"NSTextView"]; + self = [super initWithCoder: aDecoder]; - /* Common stuff for version 1 and 2. */ - { - BOOL flag; - - self = [super initWithCoder: aDecoder]; - - _delegate = [aDecoder decodeObject]; - - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_field_editor = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_editable = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_selectable = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_rich_text = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.imports_graphics = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.draws_background = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_horizontally_resizable = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_vertically_resizable = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.uses_font_panel = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.uses_ruler = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.is_ruler_visible = flag; - - _backgroundColor = RETAIN([aDecoder decodeObject]); - [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_minSize]; - [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_maxSize]; - } - - if (version == currentVersion) + if ([aDecoder allowsKeyedCoding]) { - NSTextContainer *aTextContainer; - BOOL flag; - NSSize containerSize; + if ([aDecoder containsValueForKey: @"NSDelegate"]) + { + [self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]]; + } + if ([aDecoder containsValueForKey: @"NSMaxSize"]) + { + [self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]]; + } + // Is this a mistype from Apple? + if ([aDecoder containsValueForKey: @"NSMinize"]) + { + [self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]]; + } + if ([aDecoder containsValueForKey: @"NSTextContainer"]) + { + [self setTextContainer: [aDecoder decodeObjectForKey: @"NSTextContainer"]]; + } - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.smart_insert_delete = flag; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - _tf.allows_undo = flag; - - _insertionPointColor = RETAIN([aDecoder decodeObject]); - [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &containerSize]; - /* build up the rest of the text system, which doesn't get stored - . */ - aTextContainer = [self buildUpTextNetwork: _frame.size]; - [aTextContainer setTextView: (NSTextView *)self]; - [aTextContainer setContainerSize: containerSize]; - - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - [aTextContainer setWidthTracksTextView: flag]; - [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; - [aTextContainer setHeightTracksTextView: flag]; - - /* See initWithFrame: for comments on this RELEASE */ - RELEASE(self); + // FIXME set the flags, shared data, storage + if ([aDecoder containsValueForKey: @"NSTVFlags"]) + { + //int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"]; + // FIXME set the flags + } + if ([aDecoder containsValueForKey: @"NSSharedData"]) + { + //NSTextViewSharedData *shared = [aDecoder decodeObjectForKey: @"NSSharedData"]; + } + if ([aDecoder containsValueForKey: @"NSTextStorage"]) + { + //NSTextStorage *storage = [aDecoder decodeObjectForKey: @"NSTextStorage"]; + } } - else if (version == 1) + else { - NSTextContainer *aTextContainer; BOOL flag; + NSTextContainer *aTextContainer; + int version = [aDecoder versionForClassName: + @"NSTextView"]; + /* Common stuff for version 1 and 2. */ + _delegate = [aDecoder decodeObject]; + + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_field_editor = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_editable = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_selectable = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_rich_text = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.imports_graphics = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.draws_background = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_horizontally_resizable = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_vertically_resizable = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.uses_font_panel = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.uses_ruler = flag; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + _tf.is_ruler_visible = flag; + + _backgroundColor = RETAIN([aDecoder decodeObject]); + [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_minSize]; + [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_maxSize]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; _tf.smart_insert_delete = flag; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; @@ -680,17 +729,31 @@ that makes decoding and encoding compatible with the old code. [aTextContainer setTextView: (NSTextView *)self]; /* See initWithFrame: for comments on this RELEASE */ RELEASE(self); + + if (version == currentVersion) + { + NSSize containerSize; + + _insertionPointColor = RETAIN([aDecoder decodeObject]); + [aDecoder decodeValueOfObjCType: @encode(NSSize) at: &containerSize]; + [aTextContainer setContainerSize: containerSize]; + + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + [aTextContainer setWidthTracksTextView: flag]; + [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag]; + [aTextContainer setHeightTracksTextView: flag]; + } + + [self _recacheDelegateResponses]; + [self invalidateTextContainerOrigin]; + + [self setPostsFrameChangedNotifications: YES]; + [notificationCenter addObserver: self + selector: @selector(_updateState:) + name: NSViewFrameDidChangeNotification + object: self]; } - [self _recacheDelegateResponses]; - [self invalidateTextContainerOrigin]; - - [self setPostsFrameChangedNotifications: YES]; - [notificationCenter addObserver: self - selector: @selector(_updateState:) - name: NSViewFrameDidChangeNotification - object: self]; - return self; }