mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 12:01:16 +00:00
[-acceptsFirstResponder] new method, returns YES
[-initWithObject] set self as initialFirstResponder of the window [-changeFont:] new method, change the font of the selected controls [-selectObjects:] update the font in the font panel git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@10753 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ec56a5175e
commit
ad8240812b
1 changed files with 40 additions and 0 deletions
|
@ -186,6 +186,7 @@ _constrainPointToBounds(NSPoint point, NSRect bounds)
|
|||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||
- (BOOL) activate;
|
||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
|
||||
- (void) changeFont: (id) sender;
|
||||
- (void) close;
|
||||
- (void) closeSubeditors;
|
||||
- (void) copySelection;
|
||||
|
@ -213,6 +214,11 @@ _constrainPointToBounds(NSPoint point, NSRect bounds)
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -1190,6 +1196,24 @@ static BOOL done_editing;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)changeFont: (id)sender
|
||||
{
|
||||
NSEnumerator *enumerator = [selection objectEnumerator];
|
||||
id anObject;
|
||||
NSFont *newFont;
|
||||
while ((anObject = [enumerator nextObject]))
|
||||
{
|
||||
if ([anObject respondsToSelector: @selector(font)]
|
||||
&& [anObject respondsToSelector: @selector(setFont:)])
|
||||
{
|
||||
newFont = [sender convertFont: [anObject font]];
|
||||
[anObject setFont: newFont];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) close
|
||||
{
|
||||
NSAssert(isClosed == NO, NSInternalInconsistencyException);
|
||||
|
@ -1399,6 +1423,7 @@ static BOOL done_editing;
|
|||
}
|
||||
[win setContentView: self];
|
||||
|
||||
|
||||
ASSIGN(document, aDocument);
|
||||
ASSIGN(edited, anObject);
|
||||
selection = [NSMutableArray new];
|
||||
|
@ -1412,6 +1437,7 @@ static BOOL done_editing;
|
|||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
IBViewPboardType, GormLinkPboardType, nil]];
|
||||
|
||||
[win setInitialFirstResponder: self];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1618,6 +1644,20 @@ static BOOL done_editing;
|
|||
[selection removeObjectAtIndex: count];
|
||||
}
|
||||
}
|
||||
if ([selection count] == 1)
|
||||
{
|
||||
id item;
|
||||
item = [selection objectAtIndex: 0];
|
||||
if ([item respondsToSelector: @selector(font)]
|
||||
&& [item respondsToSelector: @selector(setFont:)])
|
||||
[[NSFontManager sharedFontManager] setSelectedFont: [item font]
|
||||
isMultiple: NO];
|
||||
}
|
||||
else if ([selection count] > 0)
|
||||
{
|
||||
[[NSFontManager sharedFontManager] setSelectedFont: nil
|
||||
isMultiple: YES];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Now we must let the document (and hence the rest of the app) know
|
||||
|
|
Loading…
Reference in a new issue