Comitting fixes contributed by Andy to correct default encoding issue.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17634 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-09-07 14:42:24 +00:00
parent 5a32088d14
commit ccc7b38d8d
9 changed files with 91 additions and 24 deletions

View file

@ -1,3 +1,19 @@
2003-09-07 Andrew Ruder <aeruder@ksu.edu>
comitted by Gregory Casamento
* Gorm.m: Added use of new sharedGormFontViewController
method when setting up the font panel.
* GormBoxEditor.m: Added setFont: and font to allow changing
of fonts in the title of an NSBox.
* GormFontViewController.[hm]: Added sharedGormFontViewController
implementation and refactored selectFont into selectFont and
convertFont methods. Also added code to enable/disable encoding
of font with default size.
* GormViewWithSubviewsEditor.m: Added sharedGormFontViewController
and convertFont to properly get the new font setting.
* Resources/GormFontView.gorm: Added switch to control
if font is encoded with default size.
2003-09-01 Gregory John Casamento <greg_casamento@yahoo.com>
* ClassInformation.plist: Added information for NSStepper and

View file

@ -114,6 +114,7 @@ Gorm_RESOURCE_FILES = \
Images/FileIcon_gmodel.tiff \
Images/tabtop_nib.tiff \
Images/tabbot_nib.tiff \
Images/GormView.tiff \
Resources/GormViewSizeInspector.gorm \
Resources/GormCustomClassInspector.gorm \
Resources/GormSoundInspector.gorm \
@ -140,6 +141,7 @@ Gorm_HEADERS = \
GormViewEditor.h \
GormViewWithSubviewsEditor.h \
GormViewWithContentViewEditor.h \
GormViewWindow.h \
GormBoxEditor.h \
GormClassManager.h \
GormControlEditor.h \
@ -178,6 +180,7 @@ Gorm_OBJC_FILES = \
GormViewEditor.m \
GormViewWithSubviewsEditor.m \
GormViewWithContentViewEditor.m \
GormViewWindow.m \
GormBoxEditor.m \
GormControlEditor.m \
GormButtonEditor.m \

3
Gorm.m
View file

@ -856,7 +856,8 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
- (void) orderFrontFontPanel: (id) sender
{
NSFontPanel *fontPanel = [NSFontPanel sharedFontPanel];
GormFontViewController *gfvc = [[GormFontViewController alloc] init];
GormFontViewController *gfvc =
[GormFontViewController sharedGormFontViewController];
[fontPanel setAccessoryView: [gfvc view]];
[[NSFontManager sharedFontManager] orderFrontFontPanel: self];
}

View file

@ -40,6 +40,14 @@
{
return @"GormBoxEditor";
}
- (NSFont *) font
{
return [self titleFont];
}
- (void) setFont: (NSFont *)aFont
{
[self setTitleFont: aFont];
}
@end

View file

@ -6,7 +6,10 @@
{
id fontSelector;
id view;
id encodeButton;
}
+ (GormFontViewController *) sharedGormFontViewController;
- (NSFont *) convertFont: (NSFont *)oldFont;
- (void) selectFont: (id)sender;
- (id) view;
// - (void) changeFont: (id)sender;

View file

@ -3,8 +3,17 @@
#include <AppKit/AppKit.h>
#include "GormFontViewController.h"
@implementation GormFontViewController
static GormFontViewController *gorm_font_cont = nil;
@implementation GormFontViewController
+ (GormFontViewController *) sharedGormFontViewController
{
if (gorm_font_cont == nil)
{
gorm_font_cont = [[self alloc] init];
}
return gorm_font_cont;
}
- (id) init
{
self = [super init];
@ -21,59 +30,81 @@
}
return self;
}
- (void) selectFont: (id)sender
- (NSFont *) convertFont: (NSFont *)aFont
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *font = nil;
float size;
NSFont *font;
// If aFont isn't nil and the button is off then set the size
// to the size of the passed in font.
size = (aFont && [encodeButton state] == NSOffState)
? [aFont pointSize] : 0.0;
switch([fontSelector indexOfSelectedItem])
{
default:
case 0: // selected font
font = [fontManager selectedFont];
font = (aFont) ? aFont :
[[NSFontManager sharedFontManager] selectedFont];
if (!font) font = [NSFont userFontOfSize: size];
break;
case 1: // bold system font
font = [NSFont boldSystemFontOfSize: 0];
font = [NSFont boldSystemFontOfSize: size];
break;
case 2: // system font
font = [NSFont systemFontOfSize: 0];
font = [NSFont systemFontOfSize: size];
break;
case 3: // user fixed font
font = [NSFont userFixedPitchFontOfSize: 0];
font = [NSFont userFixedPitchFontOfSize: size];
break;
case 4: // user font
font = [NSFont userFontOfSize: 0];
font = [NSFont userFontOfSize: size];
break;
case 5: // title bar font
font = [NSFont titleBarFontOfSize: 0];
font = [NSFont titleBarFontOfSize: size];
break;
case 6: // menu font
font = [NSFont menuFontOfSize: 0];
font = [NSFont menuFontOfSize: size];
break;
case 7: // message font
font = [NSFont messageFontOfSize: 0];
font = [NSFont messageFontOfSize: size];
break;
case 8: // palette font
font = [NSFont paletteFontOfSize: 0];
font = [NSFont paletteFontOfSize: size];
break;
case 9: // tooltops font
font = [NSFont toolTipsFontOfSize: 0];
font = [NSFont toolTipsFontOfSize: size];
break;
case 10: // control content font
font = [NSFont controlContentFontOfSize: 0];
font = [NSFont controlContentFontOfSize: size];
break;
case 11:
font = [NSFont labelFontOfSize: 0];
break;
default:
font = nil;
font = [NSFont labelFontOfSize: size];
break;
}
return font;
}
- (void) selectFont: (id)sender
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *font;
if(font != nil)
font = [self convertFont: nil];
[fontManager setSelectedFont: font isMultiple: NO];
if ([fontSelector indexOfSelectedItem] == 0)
{
[fontManager setSelectedFont: font isMultiple: NO];
[encodeButton setEnabled: NO];
[encodeButton setState: NSOffState];
}
else
{
[encodeButton setEnabled: YES];
[encodeButton setState: NSOnState];
}
}
- (id) view

View file

@ -28,6 +28,8 @@
#include "GormViewWithSubviewsEditor.h"
#include "GormFontViewController.h"
@class GormEditorToParent;
@implementation GormViewWithSubviewsEditor
@ -186,6 +188,8 @@
&& [anObject respondsToSelector: @selector(setFont:)])
{
newFont = [sender convertFont: [anObject font]];
newFont = [[GormFontViewController sharedGormFontViewController]
convertFont: newFont];
[anObject setFont: newFont];
}
}

View file

@ -149,7 +149,8 @@
);
Outlets = (
view,
fontSelector
fontSelector,
encodeButton
);
Super = NSObject;
};