Small changes to prepare for merge of NSToolbar and GSToolbar.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27488 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2009-01-01 19:22:50 +00:00
parent 68bac76652
commit 7ce954508f
6 changed files with 36 additions and 78 deletions

View file

@ -1,4 +1,14 @@
2009-01-10 Richard Frith-Macdonald <rfm@gnu.org> 2009-01-01 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSToolbar.h,
* Source/GSToolbar.m,
* Source/NSToolbar.m: Remove unused initializer.
* Source/GSToolbarView.m: Remove method _setToolbar:, code is now
in setToolbar:.
* Source/NSWindow+Toolbar.m (-setToolbar:): Adopt to changes in
GSToolbarView.
2009-01-01 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepGUI/GSTheme.h: * Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSTheme.m: * Source/GSTheme.m:

View file

@ -85,10 +85,6 @@ APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification;
// Instance methods // Instance methods
- (id) initWithIdentifier: (NSString*)identifier; - (id) initWithIdentifier: (NSString*)identifier;
- (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode;
- (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier atIndex: (int)index; - (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier atIndex: (int)index;
- (void) removeItemAtIndex: (int)index; - (void) removeItemAtIndex: (int)index;
- (void) runCustomizationPalette: (id)sender; - (void) runCustomizationPalette: (id)sender;

View file

@ -474,7 +474,6 @@ static GSValidationCenter *vc = nil;
// Private class method // Private class method
+ (NSArray *) _toolbars;
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier; + (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier;
- (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier - (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier
@ -546,11 +545,6 @@ static GSValidationCenter *vc = nil;
// Private class method to access static variable toolbars in subclasses // Private class method to access static variable toolbars in subclasses
+ (NSArray *) _toolbars
{
return toolbars;
}
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier + (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier
{ {
return [toolbars objectsWithValue: identifier return [toolbars objectsWithValue: identifier
@ -559,18 +553,8 @@ static GSValidationCenter *vc = nil;
// Instance methods // Instance methods
- (id) initWithIdentifier: (NSString *)identifier
{
return [self initWithIdentifier: identifier
displayMode: NSToolbarDisplayModeIconAndLabel
sizeMode: NSToolbarSizeModeRegular];
}
// default initialiser // default initialiser
- (id) initWithIdentifier: (NSString *)identifier - (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode
{ {
GSToolbar *toolbarModel; GSToolbar *toolbarModel;
@ -589,12 +573,8 @@ static GSValidationCenter *vc = nil;
_allowsUserCustomization = [toolbarModel allowsUserCustomization]; _allowsUserCustomization = [toolbarModel allowsUserCustomization];
_autosavesConfiguration = [toolbarModel autosavesConfiguration]; _autosavesConfiguration = [toolbarModel autosavesConfiguration];
ASSIGN(_configurationDictionary, [toolbarModel configurationDictionary]); ASSIGN(_configurationDictionary, [toolbarModel configurationDictionary]);
_displayMode = [toolbarModel displayMode];
if ([toolbarModel displayMode] != displayMode _sizeMode = [toolbarModel sizeMode];
&& [toolbarModel sizeMode] != sizeMode)
{
// Raise an exception.
}
// [self _loadConfig]; // [self _loadConfig];
} }
@ -604,14 +584,15 @@ static GSValidationCenter *vc = nil;
_allowsUserCustomization = NO; _allowsUserCustomization = NO;
_autosavesConfiguration = NO; _autosavesConfiguration = NO;
_configurationDictionary = nil; _configurationDictionary = nil;
_displayMode = NSToolbarDisplayModeIconAndLabel;
_sizeMode = NSToolbarSizeModeRegular;
// [self _loadConfig]; // [self _loadConfig];
} }
_displayMode = displayMode;
_sizeMode = sizeMode;
_delegate = nil; _delegate = nil;
// Store in list of toolbars
[toolbars addObject: self]; [toolbars addObject: self];
return self; return self;
@ -638,6 +619,7 @@ static GSValidationCenter *vc = nil;
[super dealloc]; [super dealloc];
} }
// FIXME: Hack
- (void) release - (void) release
{ {
// We currently only worry about when our toolbar view is deallocated. // We currently only worry about when our toolbar view is deallocated.
@ -651,10 +633,6 @@ static GSValidationCenter *vc = nil;
[super release]; [super release];
} }
/*
* FIXME: Replace the deprecated method which follows by this one when -base
* NSObject will implement it.
*
- (id) valueForUndefinedKey: (NSString *)key - (id) valueForUndefinedKey: (NSString *)key
{ {
if ([key isEqualToString: @"window"] || [key isEqualToString: @"_window"]) if ([key isEqualToString: @"window"] || [key isEqualToString: @"_window"])
@ -662,15 +640,6 @@ static GSValidationCenter *vc = nil;
return [super valueForUndefinedKey: key]; return [super valueForUndefinedKey: key];
} }
*/
- (id) handleQueryWithUnboundKey: (NSString *)key
{
if ([key isEqualToString: @"window"] || [key isEqualToString: @"_window"])
return [NSNull null];
return [super handleQueryWithUnboundKey: key];
}
- (void) insertItemWithItemIdentifier: (NSString *)itemIdentifier - (void) insertItemWithItemIdentifier: (NSString *)itemIdentifier
atIndex: (int)index atIndex: (int)index

View file

@ -178,7 +178,6 @@ static void initSystemExtensionsColors(void)
- (void) _handleBackViewsFrame; - (void) _handleBackViewsFrame;
- (void) _handleViewsVisibility; - (void) _handleViewsVisibility;
- (void) _reload; - (void) _reload;
- (void) _setToolbar: (GSToolbar *)toolbar;
- (void) _takeInAccountFlexibleSpaces; - (void) _takeInAccountFlexibleSpaces;
- (int) _insertionIndexAtPoint: (NSPoint)location; - (int) _insertionIndexAtPoint: (NSPoint)location;
@ -659,13 +658,21 @@ static void initSystemExtensionsColors(void)
- (void) setToolbar: (GSToolbar *)toolbar - (void) setToolbar: (GSToolbar *)toolbar
{ {
if ([toolbar isKindOfClass: NSClassFromString(@"NSToolbar")]) if ([toolbar sizeMode] != _sizeMode)
[NSException raise: NSInvalidArgumentException ; // FIXME: Raise exception here
format: @"NSToolbar instance can't be attached directly to a \
toolbar view, setToolbar: from the NSWindow toolbar \ if (_toolbar == toolbar)
category must be used."]; return;
[self _setToolbar: toolbar]; // We unset the toolbar view from the previous toolbar
[_toolbar _setToolbarView: nil];
ASSIGN(_toolbar, toolbar);
// We set the toolbar view on the new toolbar
[_toolbar _setToolbarView: self];
[_clippedItemsMark setToolbar: _toolbar];
// Load the toolbar in the toolbar view
[self _reload];
} }
- (NSColor *) standardBackgroundColor - (NSColor *) standardBackgroundColor
@ -821,21 +828,6 @@ static void initSystemExtensionsColors(void)
[self setNeedsDisplay: YES]; [self setNeedsDisplay: YES];
} }
- (void) _setToolbar: (GSToolbar *)toolbar
{
if ([toolbar sizeMode] != _sizeMode)
; // FIXME: Raise exception here
[toolbar _setToolbarView: self]; // We set the toolbar view on the new toolbar
[_toolbar _setToolbarView: nil]; // We unset the toolbar view from the previous toolbar
ASSIGN(_toolbar, toolbar);
[_clippedItemsMark setToolbar: _toolbar];
[self _reload]; // Load the toolbar in the toolbar view
}
- (void) _takeInAccountFlexibleSpaces - (void) _takeInAccountFlexibleSpaces
{ {
NSArray *items = [_toolbar items]; NSArray *items = [_toolbar items];

View file

@ -93,14 +93,10 @@ static const int current_version = 1;
// Instance methods // Instance methods
- (id) initWithIdentifier: (NSString *)identifier - (id) initWithIdentifier: (NSString *)identifier
displayMode: (NSToolbarDisplayMode)displayMode
sizeMode: (NSToolbarSizeMode)sizeMode
{ {
NSToolbar *toolbarModel = nil; NSToolbar *toolbarModel = nil;
if ((self = [super initWithIdentifier: identifier if ((self = [super initWithIdentifier: identifier]) == nil)
displayMode: displayMode
sizeMode: sizeMode]) == nil)
{ {
return nil; return nil;
} }
@ -109,14 +105,10 @@ static const int current_version = 1;
if (toolbarModel != nil) if (toolbarModel != nil)
{ {
_displayMode = [toolbarModel displayMode];
_sizeMode = [toolbarModel sizeMode];
_visible = [toolbarModel isVisible]; _visible = [toolbarModel isVisible];
} }
else else
{ {
_displayMode = displayMode;
_sizeMode = sizeMode;
_visible = YES; _visible = YES;
} }

View file

@ -39,7 +39,6 @@
@end @end
@interface GSToolbarView (GNUstepPrivate) @interface GSToolbarView (GNUstepPrivate)
- (void) _setToolbar: (NSToolbar *)toolbar;
- (float) _heightFromLayout; - (float) _heightFromLayout;
- (void) _reload; - (void) _reload;
@end @end
@ -135,7 +134,7 @@
{ {
[self _toggleToolbarView]; [self _toggleToolbarView];
} }
[toolbarView _setToolbar: nil]; [toolbarView setToolbar: nil];
// Release the toolbarView, this will release the toolbar // Release the toolbarView, this will release the toolbar
RELEASE(toolbarView); RELEASE(toolbarView);
} }
@ -164,7 +163,7 @@
[toolbarView setBorderMask: GSToolbarViewBottomBorder]; [toolbarView setBorderMask: GSToolbarViewBottomBorder];
// Load the toolbar inside the toolbar view // Load the toolbar inside the toolbar view
// Will set the _toolbarView variable for the toolbar // Will set the _toolbarView variable for the toolbar
[toolbarView _setToolbar: toolbar]; [toolbarView setToolbar: toolbar];
} }
// Make the toolbar view visible // Make the toolbar view visible