mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 06:30:47 +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
|
@ -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…
Add table
Add a link
Reference in a new issue