[aquaskk-changes 151] CVS update: AquaSKK

Tomotaka SUWA t-suw****@users*****
2006年 2月 25日 (土) 16:27:32 JST


Index: AquaSKK/AquaSKKServer.mm
diff -u AquaSKK/AquaSKKServer.mm:1.1.2.3 AquaSKK/AquaSKKServer.mm:1.1.2.4
--- AquaSKK/AquaSKKServer.mm:1.1.2.3	Tue Feb 21 23:58:51 2006
+++ AquaSKK/AquaSKKServer.mm	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: AquaSKKServer.mm,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: AquaSKKServer.mm,v 1.1.2.4 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -24,14 +24,13 @@
 #include <AppKit/AppKit.h>
 #include "BIMClientServer.h"
 #include "AquaSKKServer.h"
-#include "PreferenceKeys.h"
+#include "PreferencesController.h"
 #include "DictionarySet.h"
 #include "ServerMessageReceiver.h"
 #include "skkserv.h"
 
 @implementation AquaSKKServer
 
-// ‰Šú‰»
 + (void)initialize {
     NSString* defaultsPlist;
     NSDictionary* userDefaults;
@@ -48,23 +47,14 @@
 
     // ~/Library/AquaSKK/ ‚ðì¬‚·‚é
     [[NSFileManager defaultManager]
-	createDirectoryAtPath:[@"~/Library/AquaSKK" stringByExpandingTildeInPath] attributes:nil];
+	createDirectoryAtPath:[[PreferencesController sharedController] pathForLibrary] attributes:nil];
 }
 
 - (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
     NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
 
     // Ž«‘‚Ì”z—ñ‚ðƒ[ƒh‚·‚é
-    NSString* error;
-    NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
-    NSData* plist = [NSData dataWithContentsOfFile:path];
-    NSArray* content = [NSPropertyListSerialization propertyListFromData:plist
-						    mutabilityOption:NSPropertyListImmutable
-						    format:nil errorDescription:&error];
-    if(!content) {
-	NSLog(@"loading plist[%@] failed: %@\n", path, error);
-	[error release];
-    }
+    NSArray* content = [[PreferencesController sharedController] contentForDictionarySet];
 
     // Ž«‘ƒT[ƒo[‚ð‹N“®‚·‚é
     DictionarySet::theInstance().initialize((CFArrayRef)content);
@@ -83,6 +73,9 @@
     // Ž«‘ƒT[ƒo[‚ð—Ž‚Æ‚·
     DictionarySet::theInstance().terminate();
 
+    // skkserv ƒGƒ~ƒ…ƒŒ[ƒVƒ‡ƒ“‚ðŽ~‚ß‚é
+    skkserv::theInstance().stop();
+
     return NSTerminateNow;
 }
 
Index: AquaSKK/BIM.r
diff -u AquaSKK/BIM.r:1.3.4.3 AquaSKK/BIM.r:1.3.4.4
--- AquaSKK/BIM.r:1.3.4.3	Sun Feb 19 13:50:54 2006
+++ AquaSKK/BIM.r	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: BIM.r,v 1.3.4.3 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: BIM.r,v 1.3.4.4 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -79,8 +79,8 @@
     kAquaSKKBaseResouceID,	// name ID
     'STR ',			// info type
     kAquaSKKBaseResouceID + 1,	// info ID
-    0,				// icon type
-    0,				// icon ID
+    'kcs8',			// icon type
+    kAquaSKKBaseResouceID,	// icon ID
     0x00010000,			// version
     componentHasMultiplePlatforms, // registration flags
     0,				// resource ID of icon family
@@ -109,3 +109,40 @@
 resource 'STR ' (kAquaSKKBaseResouceID + 1) {
     "AquaSKK Input Method for Mac OS X"
 };
+
+data 'kcs#' (kAquaSKKBaseResouceID) {
+	$"FEFE FE82 7C44 7C44 3828 3828 1010 0000"
+	$"FEFE 82FE 447C 447C 2838 2838 1010 0000"
+	$"FEFE FEFE 7C7C 7C7C 3838 3838 1010 0000"
+	$"FEFE FEFE 7C7C 7C7C 3838 3838 1010 0000"
+};
+
+data 'kcs4' (kAquaSKKBaseResouceID) {
+	$"EEEE EEE0 DDDD DDD0 EDDE EFE0 D00C CCD0"
+	$"0EEE FE00 0DCC CD00 0EEE FE00 0DCC CD00"
+	$"00EF E000 00DC D000 00EF E000 00DC D000"
+	$"000E 0000 000D 0000 0000 0000 0000 0000"
+	$"DDDD DDD0 EEEE EEE0 D00C CCD0 EDDE EFE0"
+	$"0DCC CD00 0EEE FE00 0DCC CD00 0EEE FE00"
+	$"00DC D000 00EF E000 00DC D000 00EF E000"
+	$"000D 0000 000E 0000 0000 0000 0000 0000"
+};
+
+data 'kcs8' (kAquaSKKBaseResouceID) {
+	$"FBFB FBFB FBFB FB00 F9F9 F9F9 F9F9 F900"
+	$"FAF9 FAFB FCFD FA00 F800 F5F6 2BF7 F800"
+	$"00FB FBFC FDFB 0000 00F9 F62B F7F9 0000"
+	$"00FA FBFC FDFA 0000 00F8 F62B F7F8 0000"
+	$"0000 FBFD FB00 0000 0000 F9F7 F900 0000"
+	$"0000 FAFD FA00 0000 0000 F8F7 F800 0000"
+	$"0000 00FB 0000 0000 0000 00F9 0000 0000"
+	$"0000 0000 0000 0000 0000 0000 0000 0000"
+	$"F9F9 F9F9 F9F9 F900 FBFB FBFB FBFB FB00"
+	$"F800 F5F6 2BF7 F800 FAF9 FAFB FCFD FA00"
+	$"00F9 F62B F7F9 0000 00FB FBFC FDFB 0000"
+	$"00F8 F62B F7F8 0000 00FA FBFC FDFA 0000"
+	$"0000 F9F7 F900 0000 0000 FBFD FB00 0000"
+	$"0000 F8F7 F800 0000 0000 FAFD FA00 0000"
+	$"0000 00F9 0000 0000 0000 00FB 0000 0000"
+	$"0000 0000 0000 0000 0000 0000 0000 0000"
+};
Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.20.2.9 AquaSKK/ChangeLog:1.20.2.10
--- AquaSKK/ChangeLog:1.20.2.9	Tue Feb 21 23:58:51 2006
+++ AquaSKK/ChangeLog	Sat Feb 25 16:27:32 2006
@@ -1,3 +1,24 @@
+2006-02-25  Tomotaka SUWA  <t.suw****@mac*****>
+
+	* AquaSKK.pbproj/project.pbxproj: Panther —p‚ɏC³B
+
+	* skkserv.cpp: skkinput ‚Ì‹““®‚ɑΉžB
+
+	* Package/scripts/postflight: DictionarySet.plist ‚ðì¬‚·‚é‚悤‚É
+	C³B
+
+	* DictionarySet.cpp: Ž«‘‚̏‰Šú‰»‚ðC³B
+
+	* AquaSKKServer.mm: pathForLibrary ‚Æ pathForDictionarySetPlist ‚É
+	‘ΉžBI—¹Žž‚É skkserv ƒGƒ~ƒ…ƒŒ[ƒVƒ‡ƒ“‚à’âŽ~‚·‚é‚悤‚ɏC³B
+
+	* BIM.r: Panther —p‚̃AƒCƒRƒ“‚ð’ljÁB
+
+	* PreferencesController.* (pathForLibrary,
+	pathForDictionarySetPlist) V‹K’ljÁBƒpƒX‚ð•Ô‚·B
+
+	* UserDefaults.plist: •s—v‚ȃL[‚ðíœB
+
 2006-02-21  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* PreferencesController.*: NSArrayController ‚Æ
Index: AquaSKK/DictionarySet.cpp
diff -u AquaSKK/DictionarySet.cpp:1.1.2.3 AquaSKK/DictionarySet.cpp:1.1.2.4
--- AquaSKK/DictionarySet.cpp:1.1.2.3	Tue Feb 21 23:58:51 2006
+++ AquaSKK/DictionarySet.cpp	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: DictionarySet.cpp,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: DictionarySet.cpp,v 1.1.2.4 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -22,7 +22,6 @@
 */
 
 #include <iostream>
-#include <sstream>
 #include <set>
 #include "CppCFString.h"
 #include "OkuriganaEntry.h"
@@ -41,8 +40,28 @@
 // ’萔‚È‚Ç
 const char* SKK_USER_DICT_PATH = "/Library/AquaSKK/skk-user-dic";
 
-// ƒ†[ƒeƒBƒŠƒeƒB
-static void removeRedundantItems(std::vector<CppCFString>& candidates);
+// d•¡‚µ‚½ƒGƒ“ƒgƒŠ‚ðíœ‚·‚é
+static void removeRedundantItems(std::vector<CppCFString>& candidates) {
+    std::set<CppCFString> check;
+    std::vector<CppCFString> result;
+
+    for(std::vector<CppCFString>::iterator iter = candidates.begin(); iter != candidates.end(); ++ iter) {
+	if(check.find(*iter) == check.end()) {
+	    check.insert(check.lower_bound(*iter), *iter);
+	    result.push_back(*iter);
+	}
+    }
+    result.swap(candidates);
+}
+
+// Ž«‘íœƒtƒ@ƒ“ƒNƒ^
+struct DeleteDictionary {
+    void operator()(std::pair<std::string, Dictionary*> entry) {
+	std::cerr << "AquaSKK: Delete Dictionary: " << entry.first << std::endl;
+	delete entry.second;
+	entry.second = NULL;
+    }
+};
 
 // Null Ž«‘
 class NullDictionary: public Dictionary {
@@ -120,20 +139,23 @@
 }
 
 void DictionarySet::load(CFArrayRef arrayRef) {
+    DictionaryContainer cache;
+    DictionaryPref entry;
+
     // ŒÃ‚¢î•ñ‚ðƒNƒŠƒA‚·‚é
     prefs_.clear();
 
     // ŒÂlŽ«‘‚ðæ“ª‚É“ü‚ê‚é
-    DictionaryPref entry;
     entry.active = true;
     entry.type = SKKDictionaryType;
     entry.location = SkkConfig::home() + SKK_USER_DICT_PATH;
     prefs_.push_back(entry);
-    if(dicts_.find(generateID(entry)) == dicts_.end()) {
-	dicts_[generateID(entry)] = userdict_;
+    cache[generateID(entry)] = userdict_;
+    if(dicts_.find(generateID(entry)) != dicts_.end()) {
+	dicts_.erase(generateID(entry));
     }
 
-    // —LŒø‚ÈŽ«‘‚ð‘S‚㍁[ƒh‚·‚é
+    // ’è‹`‚³‚ꂽŽ«‘‚ð‘S‚㍁[ƒh‚·‚é
     for(CFIndex index = 0; index < CFArrayGetCount(arrayRef); ++ index) {
 	CFDictionaryRef dictRef = (CFDictionaryRef)CFRetain(CFArrayGetValueAtIndex(arrayRef, index));
 
@@ -151,24 +173,26 @@
 
 	// ì¬Ï‚Ý‚ÌŽ«‘‚ª‚ ‚ê‚΁AŽæ“¾‚µ‚Ä‚¨‚­
 	DictionaryIterator iter = dicts_.find(generateID(entry));
+	if(iter != dicts_.end()) {
+	    cache[generateID(entry)] = iter->second;
+	    dicts_.erase(generateID(entry));
+	} else {
+	    // ƒLƒƒƒbƒVƒ…‚É‚à‚È‚¢H
+	    if(cache.find(generateID(entry)) == cache.end()) {
+		cache[generateID(entry)] = createDictionary(entry);
+	    }
+	}
 
-	// —LŒø‚©H
+	// —LŒø‚È‚ç’ljÁ
 	if(entry.active) {
 	    prefs_.push_back(entry);
-
-	    // Œ©‚‚©‚ç‚È‚¯‚ê‚΁A’ljÁ‚µ‚Ä‚¨‚­
-	    if(iter == dicts_.end()) {
-		dicts_[generateID(entry)] = createDictionary(entry);
-	    }
-	} else {
-	    // ì¬Ï‚Ý‚Å–³Œø‚É‚³‚ꂽŽ«‘‚͏Á‚·
-	    if(iter != dicts_.end()) {
-		delete iter->second;
-		dicts_.erase(generateID(entry));
-	    }
 	}
 	CFRelease(dictRef);
     }
+
+    // Ž«‘‚̃LƒƒƒbƒVƒ…‚ð“ü‚ê‘Ö‚¦‚é
+    std::for_each(dicts_.begin(), dicts_.end(), DeleteDictionary());
+    cache.swap(dicts_);
 }
 
 DictionarySet::DictionarySet() {
@@ -188,23 +212,12 @@
 
 void DictionarySet::initialize(CFArrayRef arrayRef) {
     // Ž«‘‚ðƒ[ƒh‚·‚é
-    if(arrayRef) {
-	CFRetain(arrayRef);
-	load(arrayRef);
-	CFRelease(arrayRef);
-    }
+    load(arrayRef);
 }
 
 void DictionarySet::terminate() {
-    struct local {
-	static void DeleteDictionary(std::pair<std::string, Dictionary*> entry) {
-	    delete entry.second;
-	    entry.second = NULL;
-	}
-    };
-
     // ‘S‚Ä‚ÌŽ«‘‚ðíœ‚·‚é
-    std::for_each(dicts_.begin(), dicts_.end(), local::DeleteDictionary);
+    std::for_each(dicts_.begin(), dicts_.end(), DeleteDictionary());
     dicts_.clear();
 }
 
@@ -475,21 +488,7 @@
     CppCFString head = query.replaceClone(nbsp, space);
     std::vector<CppCFString> result = userdict_->findCompletions(head);
 
-    D_PRINTF("REPLY: %s\n",
-	     join(' ',result).toCString(kCFStringEncodingEUC_JP));
+    D_PRINTF("REPLY: %s\n", join(' ',result).toCString(kCFStringEncodingEUC_JP));
 
     return join(' ', result);
 }
-
-static void removeRedundantItems(std::vector<CppCFString>& candidates) {
-    std::set<CppCFString> check;
-    std::vector<CppCFString> result;
-
-    for(std::vector<CppCFString>::iterator iter = candidates.begin(); iter != candidates.end(); ++ iter) {
-	if(check.find(*iter) == check.end()) {
-	    check.insert(check.lower_bound(*iter), *iter);
-	    result.push_back(*iter);
-	}
-    }
-    result.swap(candidates);
-}
Index: AquaSKK/DictionarySet.h
diff -u AquaSKK/DictionarySet.h:1.1.2.2 AquaSKK/DictionarySet.h:1.1.2.3
--- AquaSKK/DictionarySet.h:1.1.2.2	Tue Feb 21 23:58:51 2006
+++ AquaSKK/DictionarySet.h	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
-  $Id: DictionarySet.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: DictionarySet.h,v 1.1.2.3 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -24,6 +24,7 @@
 #pragma once
 
 #include <string>
+#include <sstream>
 #include <vector>
 #include <map>
 
Index: AquaSKK/PreferenceKeys.h
diff -u AquaSKK/PreferenceKeys.h:1.1.2.2 AquaSKK/PreferenceKeys.h:1.1.2.3
--- AquaSKK/PreferenceKeys.h:1.1.2.2	Tue Feb 21 23:58:51 2006
+++ AquaSKK/PreferenceKeys.h	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: PreferenceKeys.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: PreferenceKeys.h,v 1.1.2.3 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -26,7 +26,7 @@
 
 // ƒ†[ƒU[ƒfƒtƒHƒ‹ƒg—p‚̃L[
 extern NSString* KEY_egg_like_newline;
-extern NSString* KEY_numkeypad_must_halfwidth;
+extern NSString* KEY_numkeypad_use_halfwidth;
 extern NSString* KEY_force_ascii_mode_startup;
 extern NSString* KEY_keyboard_layout_id;
 
@@ -40,7 +40,4 @@
 extern NSString* KEY_skkserv_port;
 extern NSString* KEY_skkserv_localonly;
 
-// ŒŸõŽ«‘‚Ì”z—ñ‚ð’è‹`‚·‚é plist ƒtƒ@ƒCƒ‹(ƒz[ƒ€ƒfƒBƒŒƒNƒgƒŠ‚©‚ç‚Ì‘Š‘΃pƒX)
-extern NSString* PLIST_dictionary_info;
-
 #endif
Index: AquaSKK/PreferencesController.h
diff -u AquaSKK/PreferencesController.h:1.6.2.6 AquaSKK/PreferencesController.h:1.6.2.7
--- AquaSKK/PreferencesController.h:1.6.2.6	Tue Feb 21 23:58:51 2006
+++ AquaSKK/PreferencesController.h	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: PreferencesController.h,v 1.6.2.6 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: PreferencesController.h,v 1.6.2.7 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -21,6 +21,7 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include "PreferenceKeys.h"
 #include "DictArrayController.h"
 
 @interface PreferencesController : NSWindowController {
@@ -38,5 +39,8 @@
 - (IBAction)showFontPanel:(id)sender;
 - (void)changeFont:(id)sender;
 - (void)setFontButtonTitle:(NSFont*)aFont;
+- (NSString*)pathForLibrary;
+- (NSString*)pathForDictionarySetPlist;
+- (NSArray*)contentForDictionarySet;
 
 @end
Index: AquaSKK/PreferencesController.mm
diff -u AquaSKK/PreferencesController.mm:1.6.2.8 AquaSKK/PreferencesController.mm:1.6.2.9
--- AquaSKK/PreferencesController.mm:1.6.2.8	Tue Feb 21 23:58:51 2006
+++ AquaSKK/PreferencesController.mm	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /*  -*- objc -*-
-  $Id: PreferencesController.mm,v 1.6.2.8 2006/02/21 14:58:51 t-suwa Exp $
+  $Id: PreferencesController.mm,v 1.6.2.9 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -34,7 +34,7 @@
 // ƒ†[ƒU[ƒfƒtƒHƒ‹ƒg—p
 NSString* KEY_keyboard_layout_id = @"keyboard_layout_id";
 NSString* KEY_egg_like_newline = @"egg_like_newline";
-NSString* KEY_numkeypad_must_halfwidth = @"numkeypad_must_halfwidth";
+NSString* KEY_numkeypad_use_halfwidth = @"numkeypad_use_halfwidth";
 NSString* KEY_force_ascii_mode_startup = @"force_ascii_mode_startup";
 
 NSString* KEY_candidates_font_name = @"candidates_font_name";
@@ -47,13 +47,14 @@
 NSString* KEY_skkserv_port = @"skkserv_port";
 NSString* KEY_skkserv_localonly = @"skkserv_localonly";
 
-// ŒŸõŽ«‘‚Ì”z—ñ‚ð’è‹`‚·‚é plist ƒtƒ@ƒCƒ‹(ƒz[ƒ€ƒfƒBƒŒƒNƒgƒŠ‚©‚ç‚Ì‘Š‘΃pƒX)
-NSString* PLIST_dictionary_info = @"/Library/AquaSKK/DictionarySet.plist";
+// ŠeŽíƒpƒX
+NSString* path_for_library = @"Library/AquaSKK";
+NSString* path_for_dictionary_set = @"DictionarySet.plist";
 
 // ƒL[ƒ{[ƒhƒŒƒCƒAƒEƒg—p
-const NSString* KbdIdKey = @"Identifier";
-const NSString* KbdNameKey = @"LocalizedName";
-const NSString* KbdIconKey = @"Icon";
+NSString* KbdIdKey = @"Identifier";
+NSString* KbdNameKey = @"LocalizedName";
+NSString* KbdIconKey = @"Icon";
 
 @implementation PreferencesController
 
@@ -123,47 +124,51 @@
     [kbdLayoutPopUp setMenu:kbdLayoutMenu];
 }
 
-+ (PreferencesController*)sharedController {
-    static PreferencesController* _shared_instance = nil;
-    if(_shared_instance == nil) {
-	_shared_instance = [[PreferencesController alloc] init];
-    }
-    return _shared_instance;
-}
-
-- (id)init {
-    self = [super initWithWindowNibName:@"Preferences"];
-    [self window];
-
-    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
-
-    // ‰Šú‰»
-    [self initKbdLayoutPopUp];
-    int index = [kbdLayoutPopUp indexOfItemWithTag:[defaults integerForKey:KEY_keyboard_layout_id]];
-    [kbdLayoutPopUp selectItemAtIndex:index];
-
-    font = [[NSFont fontWithName:[defaults objectForKey:KEY_candidates_font_name]
-		    size:[defaults floatForKey:KEY_candidates_font_size]] retain];
-    [self setFontButtonTitle:font];
-
+- (void)initDictArrayController {
     // Ž«‘‚Ì”z—ñ‚ðƒ[ƒh‚·‚é
-    NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
     NSString* error;
-    NSData* plist = [NSData dataWithContentsOfFile:path];
+    NSData* plist = [NSData dataWithContentsOfFile:[self pathForDictionarySetPlist]];
     NSMutableArray* content = [NSPropertyListSerialization propertyListFromData:plist
 							   mutabilityOption:NSPropertyListMutableContainersAndLeaves
 							   format:nil errorDescription:&error];
-    if(content) {
-	[dictArray setContent:content];
-    } else {
+    [dictArray setContent:content];
+    if(!content) {
 	NSLog(@"loading plist failed: %@\n", error);
 	[error release];
     }
+}
+
+- (id)init {
+    self = [super initWithWindowNibName:@"Preferences"];
+
+    if(self) {
+	NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
+
+	[self window];
+	[self initDictArrayController];
+	[self initKbdLayoutPopUp];
+	int index = [kbdLayoutPopUp indexOfItemWithTag:[defaults integerForKey:KEY_keyboard_layout_id]];
+	[kbdLayoutPopUp selectItemAtIndex:index];
+
+	font = [[NSFont fontWithName:[defaults objectForKey:KEY_candidates_font_name]
+			size:[defaults floatForKey:KEY_candidates_font_size]] retain];
+	[self setFontButtonTitle:font];
+    }
 
     return self;
 }
 
++ (PreferencesController*)sharedController {
+    static PreferencesController* _shared_instance = nil;
+    if(_shared_instance == nil) {
+	_shared_instance = [[PreferencesController alloc] init];
+    }
+    return _shared_instance;
+}
+
 - (IBAction)showWindow:(id)sender {
+    [self initDictArrayController];
+
     [NSApp activateIgnoringOtherApps:YES];
     [[self window] makeKeyAndOrderFront:nil];
 
@@ -179,21 +184,17 @@
 
     // Ž«‘‚Ì”z—ñ‚ð XML Œ`Ž®‚Å•Û‘¶‚·‚é
     NSString* error;
-    NSData* plist = [NSPropertyListSerialization dataFromPropertyList:[dictArray content]
+    NSData* plist = [NSPropertyListSerialization dataFromPropertyList:[self contentForDictionarySet]
 						 format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];
     if(plist) {
-	NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
-	[plist writeToFile:path atomically:YES];
+	[plist writeToFile:[self pathForDictionarySetPlist] atomically:YES];
     } else {
 	NSLog(@"saving plist failed: %@\n", error);
 	[error release];
     }
 
-    // ƒNƒ‰ƒCƒ“ƒg‚ɕύX‚ð’Ê’m‚·‚é
-    ClientConnectionFactory::theInstance().newConnection().send(kSKKClientConfigurationModified, CppCFData());
-
     // Ä“xAŽ«‘ƒT[ƒo[‚ð‰Šú‰»‚·‚é
-    DictionarySet::theInstance().initialize((CFArrayRef)[dictArray content]);
+    DictionarySet::theInstance().initialize((CFArrayRef)[self contentForDictionarySet]);
 
     // skkserv ƒGƒ~ƒ…ƒŒ[ƒVƒ‡ƒ“‚̍ċN“®
     skkserv& skkserv = skkserv::theInstance();
@@ -202,6 +203,9 @@
 	skkserv.start([defaults integerForKey:KEY_skkserv_port], [defaults boolForKey:KEY_skkserv_localonly]);
     }
 
+    // ƒNƒ‰ƒCƒ“ƒg‚ɕύX‚ð’Ê’m‚·‚é
+    ClientConnectionFactory::theInstance().newConnection().send(kSKKClientConfigurationModified, CppCFData());
+
     return TRUE;
 }
 
@@ -228,4 +232,16 @@
     [fontButton setTitle:[NSString stringWithFormat:@"%@ - %2.1f", [aFont displayName], [aFont pointSize]]];
 }
 
+- (NSString*)pathForLibrary {
+    return [NSHomeDirectory() stringByAppendingPathComponent:path_for_library];
+}
+
+- (NSString*)pathForDictionarySetPlist {
+    return [[self pathForLibrary] stringByAppendingPathComponent:path_for_dictionary_set];
+}
+
+- (NSArray*)contentForDictionarySet {
+    return [dictArray content];
+}
+
 @end
Index: AquaSKK/ServerMessageReceiver.mm
diff -u AquaSKK/ServerMessageReceiver.mm:1.4.2.3 AquaSKK/ServerMessageReceiver.mm:1.4.2.4
--- AquaSKK/ServerMessageReceiver.mm:1.4.2.3	Sun Feb 19 13:50:54 2006
+++ AquaSKK/ServerMessageReceiver.mm	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: ServerMessageReceiver.mm,v 1.4.2.3 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: ServerMessageReceiver.mm,v 1.4.2.4 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -112,7 +112,7 @@
 	reply = valueForKey(KEY_egg_like_newline);
 	break;
     case kBasicMessageIsNumericKeypad_HalfWidth:
-	reply = valueForKey(KEY_numkeypad_must_halfwidth);
+	reply = valueForKey(KEY_numkeypad_use_halfwidth);
 	break; 
     case kBasicMessageIsAsciiModeStartup:
 	reply = valueForKey(KEY_force_ascii_mode_startup);
Index: AquaSKK/UserDefaults.plist
diff -u AquaSKK/UserDefaults.plist:1.1.2.2 AquaSKK/UserDefaults.plist:1.1.2.3
--- AquaSKK/UserDefaults.plist:1.1.2.2	Sun Feb 19 18:09:02 2006
+++ AquaSKK/UserDefaults.plist	Sat Feb 25 16:27:32 2006
@@ -16,32 +16,13 @@
 	</data>
 	<key>candidates_window_show_after_nth_cand</key>
 	<integer>5</integer>
-	<key>dictionary_info_array</key>
-	<array>
-		<dict>
-			<key>active</key>
-			<true/>
-			<key>location</key>
-			<string>~/.skk-jisyo</string>
-			<key>type</key>
-			<integer>10</integer>
-		</dict>
-		<dict>
-			<key>active</key>
-			<true/>
-			<key>location</key>
-			<string>~/Library/AquaSKK/SKK-JISYO.L</string>
-			<key>type</key>
-			<integer>10</integer>
-		</dict>
-	</array>
 	<key>egg_like_new_line</key>
 	<false/>
 	<key>force_ascii_mode_startup</key>
 	<false/>
 	<key>keyboard_layout_id</key>
 	<integer>0</integer>
-	<key>numkeypad_must_halfwidth</key>
+	<key>numkeypad_use_halfwidth</key>
 	<false/>
 	<key>skkserv_enabled</key>
 	<false/>
Index: AquaSKK/skkserv.cpp
diff -u AquaSKK/skkserv.cpp:1.1.2.4 AquaSKK/skkserv.cpp:1.1.2.5
--- AquaSKK/skkserv.cpp:1.1.2.4	Sun Feb 19 16:09:11 2006
+++ AquaSKK/skkserv.cpp	Sat Feb 25 16:27:32 2006
@@ -1,5 +1,5 @@
 /*  -*- c++ -*-
-  $Id: skkserv.cpp,v 1.1.2.4 2006/02/19 07:09:11 t-suwa Exp $
+  $Id: skkserv.cpp,v 1.1.2.5 2006/02/25 07:27:32 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -21,6 +21,7 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <iostream>
 #include <string>
 #include <unistd.h>
 #include "CppCFString.h"
@@ -68,7 +69,7 @@
         int fd = obj->server_.accept();
         if(fd > 0) {
 	    if(obj->localonly_ && ip_address::getpeername(fd) != "127.0.0.1") {
-		std::cerr << "AquaSKK: connection rejected[" << ip_address::getpeername(fd) << "]" << std::endl;
+		std::cerr << "AquaSKK(skkserv): reject[" << ip_address::getpeername(fd) << "]" << std::endl;
 		continue;
 	    }
 	    pthread_t pth;
@@ -83,7 +84,7 @@
 void* skkserv::session(void* param) {
     socket_stream sock((int)param);
     ip_address peer = ip_address::getpeername((int)param);
-    std::cerr << "AquaSKK: new session[" << peer << "]" << std::endl;
+    std::cerr << "AquaSKK(skkserv): new session[" << peer << "]" << std::endl;
 
     unsigned char cmd;
     do {
@@ -118,15 +119,14 @@
 	    sock << ip_address::getsockname(sock.socket()) << "::" << std::endl;
             sock.flush();
             break;
-        default:
-            std::cerr << "Unknown command: " << cmd << std::endl;
-	    cmd = '0';
+        default:		// –³Œø‚ȃRƒ}ƒ“ƒh
+	    fprintf(stderr, "AquaSKK(skkserv): Unknown command[0x%02x]\n", cmd);
             break;
 	}
     } while(cmd != '0');
     sock.close();
 
-    std::cerr << "AquaSKK: session closed[" << peer << "]" << std::endl;
+    std::cerr << "AquaSKK(skkserv): session closed[" << peer << "]" << std::endl;
 
     return NULL;
 }


aquaskk-changes メーリングリストの案内