mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Added font view controller for accessory view in Gorm's font panel.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@16899 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2402c3e4ee
commit
fe9a5134a6
7 changed files with 136 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
|||
2003-06-09 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GNUmakefile: Added mention of GormFontViewController.[hm]
|
||||
to the makefile.
|
||||
* Gorm.m: added header and updated orderFrontFontPanel: to
|
||||
install the view when the font panel is instantiated.
|
||||
* GormScrollViewEditor.m: Minor code cleanup.
|
||||
* GormFontViewController.[hm]: Added.
|
||||
|
||||
2003-06-08 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormScrollViewEditor.m: Added -[destroyAndListSubviews]
|
||||
|
|
|
@ -122,6 +122,7 @@ Gorm_RESOURCE_FILES = \
|
|||
Resources/GormPrefGeneral.gorm \
|
||||
Resources/GormScrollViewAttributesInspector.gorm \
|
||||
Resources/GormClassInspector.gorm \
|
||||
Resources/GormFontView.gorm \
|
||||
Resources/Gorm.gorm
|
||||
|
||||
Gorm_HEADERS = \
|
||||
|
@ -151,6 +152,7 @@ Gorm_HEADERS = \
|
|||
GormPrefController.h\
|
||||
GormHeadersPref.h \
|
||||
GormClassInspector.h \
|
||||
GormFontViewController.h \
|
||||
GormGeneralPref.h
|
||||
|
||||
|
||||
|
@ -188,8 +190,9 @@ Gorm_OBJC_FILES = \
|
|||
GormImageEditor.m \
|
||||
GormSoundEditor.m \
|
||||
GormPrefController.m \
|
||||
GormHeadersPref.m\
|
||||
GormClassInspector.m\
|
||||
GormHeadersPref.m \
|
||||
GormClassInspector.m \
|
||||
GormFontViewController.m \
|
||||
GormGeneralPref.m
|
||||
|
||||
|
||||
|
|
7
Gorm.m
7
Gorm.m
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "GormPrivate.h"
|
||||
#include "GormPrefController.h"
|
||||
#include "GormFontViewController.h"
|
||||
|
||||
// for templates...
|
||||
#include <AppKit/NSControl.h>
|
||||
|
@ -1053,6 +1054,10 @@ static NSButtonType _buttonTypeForObject( id button )
|
|||
|
||||
- (void) orderFrontFontPanel: (id) sender
|
||||
{
|
||||
NSFontPanel *fontPanel = [NSFontPanel sharedFontPanel];
|
||||
GormFontViewController *gfvc = [[GormFontViewController alloc] init];
|
||||
[fontPanel setAccessoryView: [gfvc view]];
|
||||
[fontPanel setNextResponder: gfvc];
|
||||
[[NSFontManager sharedFontManager] orderFrontFontPanel: self];
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1067,7 @@ static NSButtonType _buttonTypeForObject( id button )
|
|||
if (self != nil)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *path;
|
||||
|
||||
path = [bundle pathForImageResource: @"GormLinkImage"];
|
||||
|
|
13
GormFontViewController.h
Normal file
13
GormFontViewController.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* All Rights reserved */
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
@interface GormFontViewController : NSObject
|
||||
{
|
||||
id fontSelector;
|
||||
id view;
|
||||
}
|
||||
- (void) selectFont: (id)sender;
|
||||
- (id) view;
|
||||
// - (void) changeFont: (id)sender;
|
||||
@end
|
103
GormFontViewController.m
Normal file
103
GormFontViewController.m
Normal file
|
@ -0,0 +1,103 @@
|
|||
/* All Rights reserved */
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#include "GormFontViewController.h"
|
||||
|
||||
@implementation GormFontViewController
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
// load the gui...
|
||||
if (![NSBundle loadNibNamed: @"GormFontView"
|
||||
owner: self])
|
||||
{
|
||||
NSLog(@"Could not open gorm GormFontView");
|
||||
return nil;
|
||||
}
|
||||
[[NSFontManager sharedFontManager] setDelegate: self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) selectFont: (id)sender
|
||||
{
|
||||
NSFontManager *fontManager = [NSFontManager sharedFontManager];
|
||||
NSFont *font = nil;
|
||||
|
||||
switch([fontSelector indexOfSelectedItem])
|
||||
{
|
||||
case 0: // selected font
|
||||
font = [fontManager selectedFont];
|
||||
break;
|
||||
case 1: // bold system font
|
||||
font = [NSFont boldSystemFontOfSize: 0];
|
||||
break;
|
||||
case 2: // system font
|
||||
font = [NSFont systemFontOfSize: 0];
|
||||
break;
|
||||
case 3: // user fixed font
|
||||
font = [NSFont userFixedPitchFontOfSize: 0];
|
||||
break;
|
||||
case 4: // user font
|
||||
font = [NSFont userFontOfSize: 0];
|
||||
break;
|
||||
case 5: // title bar font
|
||||
font = [NSFont titleBarFontOfSize: 0];
|
||||
break;
|
||||
case 6: // menu font
|
||||
font = [NSFont menuFontOfSize: 0];
|
||||
break;
|
||||
case 7: // message font
|
||||
font = [NSFont messageFontOfSize: 0];
|
||||
break;
|
||||
case 8: // palette font
|
||||
font = [NSFont paletteFontOfSize: 0];
|
||||
break;
|
||||
case 9: // tooltops font
|
||||
font = [NSFont toolTipsFontOfSize: 0];
|
||||
break;
|
||||
case 10: // control content font
|
||||
font = [NSFont controlContentFontOfSize: 0];
|
||||
break;
|
||||
case 11:
|
||||
font = [NSFont labelFontOfSize: 0];
|
||||
break;
|
||||
default:
|
||||
font = nil;
|
||||
break;
|
||||
}
|
||||
|
||||
if(font != nil)
|
||||
{
|
||||
[fontManager setSelectedFont: font isMultiple: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) view
|
||||
{
|
||||
return view;
|
||||
}
|
||||
|
||||
/*
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) becomeFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
// delegate methods
|
||||
- (void) changeFont: (id)sender
|
||||
{
|
||||
NSLog(@"change");
|
||||
[fontSelector selectItem: 0];
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
|
@ -176,7 +176,6 @@
|
|||
NSMutableArray *newSelection = [NSMutableArray array];
|
||||
|
||||
[parent makeSubeditorResign];
|
||||
// NSLog(@"documentview = %@",[_EO documentView]);
|
||||
while ((subview = [enumerator nextObject]) != nil)
|
||||
{
|
||||
id v;
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue