S.Abe
xdd****@users*****
2005年 9月 24日 (土) 20:55:39 JST
Index: AquaSKK/CandidatesFrame.m diff -u AquaSKK/CandidatesFrame.m:1.2 AquaSKK/CandidatesFrame.m:1.3 --- AquaSKK/CandidatesFrame.m:1.2 Mon Sep 19 17:28:32 2005 +++ AquaSKK/CandidatesFrame.m Sat Sep 24 20:55:39 2005 @@ -1,4 +1,4 @@ -/* $Id: CandidatesFrame.m,v 1.2 2005/09/19 08:28:32 xdd Exp $ +/* $Id: CandidatesFrame.m,v 1.3 2005/09/24 11:55:39 xdd Exp $ MacOS X implementation of the SKK input method. Copyright (C) 2002-2004 phonohawk @@ -24,10 +24,12 @@ - (id)init { if(self = [super init]) { - float fontSize = [[[NSUserDefaults standardUserDefaults] objectForKey:@"dic.FontSize.Window"] floatValue]; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSFont *font = [NSFont fontWithName:[defaults objectForKey:@"dic.FontName.Window"] + size:[[defaults objectForKey:@"dic.FontSize.Window"] floatValue]]; labels_ = @"ASDFJKL"; attributes_ = [NSDictionary - dictionaryWithObject:[NSFont systemFontOfSize:fontSize] + dictionaryWithObject:font forKey:NSFontAttributeName]; candidates_ = [[NSMutableArray alloc] init]; Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.5 AquaSKK/ChangeLog:1.6 --- AquaSKK/ChangeLog:1.5 Wed Sep 21 01:45:40 2005 +++ AquaSKK/ChangeLog Sat Sep 24 20:55:39 2005 @@ -1,3 +1,10 @@ +2005-09-24 Shin_ichi Abe <xdd****@mac*****> + + * PreferencesController.*: tHgÝèÌÇÁB + AquaSKKÌ«ÝèÅÏ·EBhEÌtHgÌÝèªÂ\B + + * Preferences.nib: tHgÝèRg[ÌÇÁB + 2005-09-19 Shin_ichi Abe <xdd****@mac*****> * PreferencesController.*: tHgTCXÝèÌÇÁB Index: AquaSKK/PreferencesController.h diff -u AquaSKK/PreferencesController.h:1.2 AquaSKK/PreferencesController.h:1.3 --- AquaSKK/PreferencesController.h:1.2 Mon Sep 19 17:28:32 2005 +++ AquaSKK/PreferencesController.h Sat Sep 24 20:55:39 2005 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: PreferencesController.h,v 1.2 2005/09/19 08:28:32 xdd Exp $ + $Id: PreferencesController.h,v 1.3 2005/09/24 11:55:39 xdd Exp $ --------- MacOS X implementation of the SKK input method. @@ -27,6 +27,7 @@ @interface PreferencesController : NSWindowController { IBOutlet id skkEggLikeNewlineBtn; + IBOutlet id fontBtn; IBOutlet id fontSizePopUp; IBOutlet id winColor; IBOutlet id winTransparent; @@ -46,6 +47,9 @@ NSString* path_to_sub_dic; NSMutableArray *dicPath; + + NSFont *font; + NSFontPanel* fontPanel; } + (PreferencesController*)sharedController; - (NSString*)getPathToMainDic; @@ -54,6 +58,8 @@ - init; +- (IBAction)showFontPanel:(id)sender; + - (NSColor *)windowColor; - (float)windowAlpha; - (BOOL)isSkkEggLikeNewline; Index: AquaSKK/PreferencesController.mm diff -u AquaSKK/PreferencesController.mm:1.2 AquaSKK/PreferencesController.mm:1.3 --- AquaSKK/PreferencesController.mm:1.2 Mon Sep 19 17:28:32 2005 +++ AquaSKK/PreferencesController.mm Sat Sep 24 20:55:39 2005 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: PreferencesController.mm,v 1.2 2005/09/19 08:28:32 xdd Exp $ + $Id: PreferencesController.mm,v 1.3 2005/09/24 11:55:39 xdd Exp $ --------- MacOS X implementation of the SKK input method. @@ -54,6 +54,7 @@ [NSMutableArray array], @"dic.path.kotoeri", [NSArchiver archivedDataWithRootObject:color], @"dic.WindowColor.kotoeri", [NSNumber numberWithInt:0], @"dic.FontSize.Window", + [[NSFont systemFontOfSize:0] fontName], @"dic.FontName.Window", @"0.7", @"dic.WindowAlpha.kotoeri", @"5", @"dic.showCandsWindowAfterNthCand", @"NO", @"dic.skk-egg-like-newline.kotoeri", @@ -74,7 +75,11 @@ dicPath = [[NSMutableArray alloc] initWithArray:[defaults arrayForKey:@"dic.path.kotoeri"]]; [winColor setColor:[NSUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"dic.WindowColor.kotoeri"]]]; - [fontSizePopUp selectItemAtIndex:[fontSizePopUp indexOfItemWithTag:[[defaults objectForKey:@"dic.FontSize.Window"] intValue]]]; + font = [[NSFont fontWithName:[defaults objectForKey:@"dic.FontName.Window"] + size:[[defaults objectForKey:@"dic.FontSize.Window"] floatValue]] retain]; + + [self setFontButtonTitle:font]; + [winTransparent setDoubleValue:[defaults floatForKey:@"dic.WindowAlpha.kotoeri"]]; [skkEggLikeNewlineBtn setState:[defaults boolForKey:@"dic.skk-egg-like-newline.kotoeri"]]; @@ -97,7 +102,9 @@ [defaults setObject:[NSArchiver archivedDataWithRootObject:[winColor color]] forKey:@"dic.WindowColor.kotoeri"]; [defaults setFloat:[winTransparent doubleValue] forKey:@"dic.WindowAlpha.kotoeri"]; [defaults setBool:[skkEggLikeNewlineBtn state] forKey:@"dic.skk-egg-like-newline.kotoeri"]; - [defaults setObject:[NSNumber numberWithInt:[[fontSizePopUp selectedItem] tag]] forKey:@"dic.FontSize.Window"]; + + [defaults setObject:[NSNumber numberWithFloat:[font pointSize]] forKey:@"dic.FontSize.Window"]; + [defaults setObject:[font fontName] forKey:@"dic.FontName.Window"]; // skkserv [defaults setBool:[skkserv_enabled state] forKey:@"pref.skkserv.enabled"]; @@ -108,6 +115,29 @@ } +- (IBAction)showFontPanel:(id)sender +{ + [fontPanel release]; + fontPanel = [[[NSFontManager sharedFontManager] fontPanel:YES] retain]; + [fontPanel makeKeyAndOrderFront:self]; +} + +- (void)changeFont:(id)fontManager +{ + [font release]; + font = [[fontManager convertFont:[NSFont systemFontOfSize:14]] retain]; + + [self setFontButtonTitle:font]; + + [self saveUserDefault:self]; +} + +- (void)setFontButtonTitle:(NSFont *)aFont +{ + [[fontBtn cell] setFont:[NSFont fontWithName:[aFont fontName] size:0]]; + [fontBtn setTitle:[NSString stringWithFormat:@"%@ - %2.1f",[aFont displayName],[aFont pointSize]]]; +} + - (NSColor *)windowColor { return [winColor color]; @@ -206,6 +236,8 @@ } } + [fontPanel close]; + [self saveUserDefault:self]; return TRUE; }