mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 16:51:56 +00:00
Make sure name of current theme is correct.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a3849e0898
commit
d8c2a89202
2 changed files with 51 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInfoPanel.m:
|
||||
Update name of current theme when it changes.
|
||||
|
||||
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSBrowser.m:
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSEnumerator.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
|
||||
#include "AppKit/NSApplication.h"
|
||||
|
@ -164,6 +165,41 @@ new_label (NSString *value)
|
|||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* When the current theme changes, we need to update the info panel to match.
|
||||
*/
|
||||
- (void) _themeDidActivate: (NSNotification*)n
|
||||
{
|
||||
NSView *c = [self contentView];
|
||||
NSEnumerator *e = [[c subviews] objectEnumerator];
|
||||
NSView *v;
|
||||
NSButton *b;
|
||||
|
||||
while ((v = [e nextObject]) != nil)
|
||||
{
|
||||
if ([v isKindOfClass: [NSButton class]]
|
||||
&& [(b = (NSButton*)v) target] == [GSTheme class])
|
||||
{
|
||||
NSString *s;
|
||||
NSRect f;
|
||||
|
||||
s = [NSString stringWithFormat: @"%@: %@",
|
||||
_(@"Current theme"), [[GSTheme theme] name]];
|
||||
[b setStringValue: s];
|
||||
[b sizeToFit];
|
||||
f = [b frame];
|
||||
f.origin.x = ([c frame].size.width - f.size.width) / 2;
|
||||
[b setFrame: f];
|
||||
[c setNeedsDisplay: YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithDictionary: (NSDictionary *)dictionary;
|
||||
{
|
||||
/* Info to show */
|
||||
|
@ -527,7 +563,7 @@ new_label (NSString *value)
|
|||
if (tmp_A > height)
|
||||
height = tmp_A;
|
||||
|
||||
/* Add border to both wihdt and height */
|
||||
/* Add border to both width and height */
|
||||
width += 32;
|
||||
height += 36;
|
||||
|
||||
|
@ -647,19 +683,26 @@ new_label (NSString *value)
|
|||
f = [copyrightDescriptionLabel frame];
|
||||
f.origin.x = (width - f.size.width) / 2;
|
||||
f.origin.y = tmp_b - 2 - f.size.height;
|
||||
tmp_b = f.origin.y;
|
||||
[cv addSubview: copyrightDescriptionLabel];
|
||||
[copyrightDescriptionLabel setFrame: f];
|
||||
}
|
||||
|
||||
f = [themeLabel frame];
|
||||
f.origin.x = (width - f.size.width) / 2;
|
||||
f.origin.y = tmp_b - 25 - f.size.height;
|
||||
f.origin.y = tmp_b - 5 - f.size.height;
|
||||
tmp_b = f.origin.y;
|
||||
[cv addSubview: themeLabel];
|
||||
[themeLabel setFrame: f];
|
||||
[themeLabel setTarget: [GSTheme class]];
|
||||
[themeLabel setAction: @selector(orderFrontSharedThemePanel:)];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_themeDidActivate:)
|
||||
name: GSThemeDidActivateNotification
|
||||
object: nil];
|
||||
|
||||
[self center];
|
||||
return self;
|
||||
}
|
||||
|
@ -700,8 +743,7 @@ new_label (NSString *value)
|
|||
}
|
||||
|
||||
// FIXME: Hard coded
|
||||
if (character == 'c' &&
|
||||
[theEvent modifierFlags] & NSCommandKeyMask)
|
||||
if (character == 'c' && ([theEvent modifierFlags] & NSCommandKeyMask))
|
||||
{
|
||||
[self copy: nil];
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue