mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Committing a fix for the "default" font issue. Also adding some of the things I have been working on for NSToolbar/NSToolbarItem.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15368 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ef4235871b
commit
d0ee6298b7
7 changed files with 195 additions and 14 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Sun Dec 29 12:27:35 2002 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/gnustep/gui/GSNibTemplates.h: Added declaration for
|
||||
class GSFontProxy.
|
||||
* Source/NSBundleAdditions.m: Added definition for class
|
||||
GSFontProxy. This class handles the fall back which is
|
||||
necessary when unarchiving NSFont when the specified font is
|
||||
unavailable. Modified unarchiving code to use the new
|
||||
class when unarchiving.
|
||||
* Headers/gnustep/gui/NSToolbarItem.h: Corrected spelling of
|
||||
NSToolbarFlexibleSpaceItemIdentifier.
|
||||
* Source/NSToolbarItem.m: Did some initial work on the
|
||||
default toolbar items.
|
||||
* Source/externs.m: Corrected spelling of
|
||||
NSToolbarFlexibleSpaceItemIdentifier.
|
||||
|
||||
|
||||
Sat Dec 28 01:42:40 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/NSWindow.m ([-_initBackendWindow:]): Fixed code resetting
|
||||
|
|
|
@ -144,4 +144,11 @@
|
|||
- (void) setTemplate: (id)template;
|
||||
@end
|
||||
|
||||
@interface GSFontProxy : NSFont
|
||||
@end
|
||||
|
||||
/*
|
||||
@interface GSStringProxy : NSString
|
||||
@end
|
||||
*/
|
||||
#endif /* _GNUstep_H_GSNibTemplates */
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
*/
|
||||
APPKIT_EXPORT NSString *NSToolbarSeperatorItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarSpaceItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarFlexibleSpaveItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarFlexibleSpaceItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarShowColorsItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarShowFontsItemIdentifier;
|
||||
APPKIT_EXPORT NSString *NSToolbarCustomizeToolbarItemIdentifier;
|
||||
|
|
|
@ -294,6 +294,10 @@ Class gmodel_class(void)
|
|||
{
|
||||
id obj;
|
||||
|
||||
// font fallback and automatic translation...
|
||||
[unarchiver decodeClassName: @"NSFont" asClassName: @"GSFontProxy"];
|
||||
// [unarchiver decodeClassName: @"NSString" asClassName: @"GSStringProxy"];
|
||||
|
||||
NSDebugLog(@"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObject];
|
||||
|
@ -609,7 +613,7 @@ Class gmodel_class(void)
|
|||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
int version = [aCoder versionForClassName: @"GSNibContainer"];
|
||||
|
||||
|
||||
if(version == GNUSTEP_NIB_VERSION)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &nameTable];
|
||||
|
@ -1542,3 +1546,32 @@ Class gmodel_class(void)
|
|||
ASSIGN(_template, template);
|
||||
}
|
||||
@end
|
||||
|
||||
// Font proxy...
|
||||
@implementation GSFontProxy
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
id result = [super initWithCoder: aDecoder];
|
||||
NSDebugLog(@"Inside font proxy...");
|
||||
if(result == nil)
|
||||
{
|
||||
NSDebugLog(@"Couldn't find the font specified, so supply a system font instead.");
|
||||
result = [NSFont systemFontOfSize: [NSFont systemFontSize]];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
|
||||
// String proxy for dynamic translation...
|
||||
/*
|
||||
@implementation GSStringProxy
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
id result = [[NSString alloc] initWithCoder: aDecoder];
|
||||
NSLog(@"Do your translation here... %@", result);
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
*/
|
||||
// end of NSBundleAdditions...
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
#include <AppKit/NSToolbar.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
// #include <AppKit/GSHbox.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
|
||||
// internal
|
||||
static NSNotificationCenter *nc = nil;
|
||||
static const int current_version = 1;
|
||||
|
||||
|
@ -165,15 +166,9 @@ static const int current_version = 1;
|
|||
tableKey = [NSString stringWithFormat: @"NSToolbar Config %@",
|
||||
_identifier];
|
||||
config = [defaults objectForKey: tableKey];
|
||||
|
||||
if (config != nil)
|
||||
{
|
||||
NSEnumerator *en = [config objectEnumerator];
|
||||
id item = nil;
|
||||
|
||||
while ((item = [en nextObject]) != nil)
|
||||
{
|
||||
}
|
||||
[self setConfigurationFromDictionary: config];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +183,6 @@ static const int current_version = 1;
|
|||
return self;
|
||||
}
|
||||
|
||||
/* FIXME */
|
||||
- (void) dealloc
|
||||
{
|
||||
DESTROY (_identifier);
|
||||
|
@ -236,6 +230,8 @@ static const int current_version = 1;
|
|||
|
||||
- (void) runCustomizationPalette: (id)sender
|
||||
{
|
||||
_customizationPaletteIsRunning = [NSBundle loadNibNamed: @"GSToolbarCustomizationPalette"
|
||||
owner: self];
|
||||
}
|
||||
|
||||
- (void) setAllowsUserCustomization: (BOOL)flag
|
||||
|
@ -301,11 +297,18 @@ static const int current_version = 1;
|
|||
|
||||
- (void) validateVisibleItems
|
||||
{
|
||||
NSEnumerator *en = [_visibleItems objectEnumerator];
|
||||
NSToolbarItem *item = nil;
|
||||
|
||||
while((item = [en nextObject]) != nil)
|
||||
{
|
||||
[item validate];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) visibleItems
|
||||
{
|
||||
return nil;
|
||||
return _visibleItems;
|
||||
}
|
||||
@end /* interface of NSToolbar */
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
- (id)initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
ASSIGN(_itemIdentifier,itemIdentifier);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -161,6 +162,9 @@
|
|||
|
||||
- (void)validate
|
||||
{
|
||||
// validate by default, we know that all of the
|
||||
// "standard" items are correct.
|
||||
_enabled = YES;
|
||||
}
|
||||
|
||||
- (NSView *)view
|
||||
|
@ -179,10 +183,127 @@
|
|||
return _target;
|
||||
}
|
||||
|
||||
|
||||
// NSCopying protocol
|
||||
- (id)copyWithZone: (NSZone *)zone
|
||||
{
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
*
|
||||
* Standard toolbar items.
|
||||
*
|
||||
*/
|
||||
|
||||
// ---- NSToolbarSeperatorItemIdentifier
|
||||
@interface GSToolbarSeperatorItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarSeperatorItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarSeperatorItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarSpaceItemIdentifier
|
||||
@interface GSToolbarSpaceItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarSpaceItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarSpaceItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarFlexibleSpaceItemIdentifier
|
||||
@interface GSToolbarFlexibleSpaceItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarFlexibleSpaceItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarFlexibleSpaceItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarShowColorsItemIdentifier
|
||||
@interface GSToolbarShowColorsItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarShowColorsItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarShowColorsItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarShowFontsItemIdentifier
|
||||
@interface GSToolbarShowFontsItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarShowFontsItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarShowFontsItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarCustomizeToolbarItemIdentifier
|
||||
@interface GSToolbarCustomizeToolbarItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarCustomizeToolbarItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarCustomizeToolbarItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
// ---- NSToolbarPrintItemIdentifier
|
||||
@interface GSToolbarPrintItem : NSToolbarItem
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSToolbarPrintItem
|
||||
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"GSToolbarPrintItem"];
|
||||
[super initWithItemIdentifier: itemIdentifier];
|
||||
[self setImage: image];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -431,7 +431,7 @@ NSString *NSToolbarWillAddItemNotification = @"NSToolbarWillAddItemNotification"
|
|||
// NSToolbarItem constants
|
||||
NSString *NSToolbarSeperatorItemIdentifier = @"NSToolbarSeperatorItemIdentifier";
|
||||
NSString *NSToolbarSpaceItemIdentifier = @"NSToolbarSpaceItemIdentifier";
|
||||
NSString *NSToolbarFlexibleSpaveItemIdentifier = @"NSToolbarFlexibleSpaveItemIdentifier";
|
||||
NSString *NSToolbarFlexibleSpaceItemIdentifier = @"NSToolbarFlexibleSpaceItemIdentifier";
|
||||
NSString *NSToolbarShowColorsItemIdentifier = @"NSToolbarShowColorsItemIdentifier";
|
||||
NSString *NSToolbarShowFontsItemIdentifier = @"NSToolbarShowFontsItemIdentifier";
|
||||
NSString *NSToolbarCustomizeToolbarItemIdentifier = @"NSToolbarCustomizeToolbarItemIdentifier";
|
||||
|
|
Loading…
Reference in a new issue