mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6224 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e21a5dac06
commit
ff84afe558
2 changed files with 70 additions and 49 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Mar 08 20:56:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSFontPanel.m: A few bug fixes and tidyups.
|
||||
|
||||
Wed Mar 08 17:09:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSWindow.m: ([-setLevel:]) implemented.
|
||||
|
|
|
@ -477,10 +477,41 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
|
||||
- (void) _togglePreview: (id)sender
|
||||
{
|
||||
_preview = [sender state];
|
||||
_preview = (sender == nil) ? YES : [sender state];
|
||||
if (_preview)
|
||||
{
|
||||
NSFont *font = [self _fontForSelection: _panelFont];
|
||||
float size = [_sizeField floatValue];
|
||||
NSString *faceName;
|
||||
NSString *familyName;
|
||||
|
||||
if (size == 0 && font != nil)
|
||||
{
|
||||
size = [font pointSize];
|
||||
}
|
||||
if (_family == -1)
|
||||
{
|
||||
familyName = @"NoFamily";
|
||||
}
|
||||
else
|
||||
{
|
||||
familyName = [_familyList objectAtIndex: _family];
|
||||
}
|
||||
if (_face == -1)
|
||||
{
|
||||
faceName = @"NoFace";
|
||||
}
|
||||
else
|
||||
{
|
||||
faceName = [[_faceList objectAtIndex: _face] objectAtIndex: 1];
|
||||
}
|
||||
// build up a font and use it in the preview area
|
||||
if (font != nil)
|
||||
{
|
||||
[_previewArea setFont: font];
|
||||
}
|
||||
[_previewArea setStringValue: [NSString stringWithFormat: @"%@ %@ %d PT",
|
||||
familyName, faceName, (int)size]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,17 +521,16 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
|
||||
[fm modifyFontViaPanel: self];
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (void) cancel: (id)sender
|
||||
{
|
||||
// The cancel button has been pushed
|
||||
// we should reset the items in the panel
|
||||
// and close the window
|
||||
/*
|
||||
* The cancel button has been pushed
|
||||
* we should reset the items in the panel
|
||||
*/
|
||||
[self setPanelFont: _panelFont
|
||||
isMultiple: _multiple];
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (NSFont*) _fontForSelection: (NSFont*)fontObject
|
||||
|
@ -520,9 +550,15 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
size = [fontObject pointSize];
|
||||
}
|
||||
}
|
||||
if (_face == -1)
|
||||
if (_face < 0)
|
||||
{
|
||||
// FIXME: This uses the first face of the font family
|
||||
unsigned i = [_faceList count];
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
return nil; /* Nothing available */
|
||||
}
|
||||
// FIXME - just uses first face
|
||||
fontName = [[_faceList objectAtIndex: 0] objectAtIndex: 0];
|
||||
}
|
||||
else
|
||||
|
@ -555,7 +591,9 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
_face = -1;
|
||||
}
|
||||
else if (sender == _faceBrowser)
|
||||
{
|
||||
_face = row;
|
||||
}
|
||||
else if (sender == _sizeBrowser)
|
||||
{
|
||||
float size = sizes[row];
|
||||
|
@ -564,28 +602,7 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
|
||||
if (_preview)
|
||||
{
|
||||
NSFont *font = [self _fontForSelection: _panelFont];
|
||||
float size = [_sizeField floatValue];
|
||||
NSString *faceName;
|
||||
NSString *familyName;
|
||||
|
||||
if (size == 0)
|
||||
size = [font pointSize];
|
||||
|
||||
if (_family == -1)
|
||||
familyName = @"";
|
||||
else
|
||||
familyName = [_familyList objectAtIndex: _family];
|
||||
|
||||
if (_face == -1)
|
||||
faceName = @"";
|
||||
else
|
||||
faceName = [[_faceList objectAtIndex: _face] objectAtIndex: 1];
|
||||
|
||||
// build up a font and use it in the preview area
|
||||
[_previewArea setFont: font];
|
||||
[_previewArea setStringValue: [NSString stringWithFormat: @"%@ %@ %d PT",
|
||||
familyName, faceName, (int)size]];
|
||||
[self _togglePreview: nil];
|
||||
}
|
||||
|
||||
return YES;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue