[aquaskk-changes 160] CVS update: AquaSKK

Back to archive index

Tomotaka SUWA t-suw****@users*****
2006年 3月 8日 (水) 22:02:07 JST


Index: AquaSKK/CandidatesFrame.m
diff -u AquaSKK/CandidatesFrame.m:1.4.2.3 AquaSKK/CandidatesFrame.m:1.4.2.4
--- AquaSKK/CandidatesFrame.m:1.4.2.3	Mon Mar  6 21:03:00 2006
+++ AquaSKK/CandidatesFrame.m	Wed Mar  8 22:02:07 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: CandidatesFrame.m,v 1.4.2.3 2006/03/06 12:03:00 t-suwa Exp $
+  $Id: CandidatesFrame.m,v 1.4.2.4 2006/03/08 13:02:07 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -213,17 +213,14 @@
 - (void)drawPage:(NSRange)range {
     FrameAttribute* attr = [FrameAttribute sharedFrameAttribute];
 
-    // nnn / mmm ‚ð•`‰æ
+    // nnn / mmm •¶Žš—ñ‚ðì¬
     NSString* tmpstr = [NSString stringWithFormat:@"%3d / %-3d", range.location, range.length];
     NSMutableAttributedString* page = [[NSMutableAttributedString alloc] initWithString:tmpstr
 									 attributes:[attr indexFontAttributes]];
-
-    [[NSColor gridColor] setFill];
-    [page addAttribute:NSBackgroundColorAttributeName
-	  value:[NSColor gridColor] range:NSMakeRange(0, [tmpstr length])];
     [page addAttribute:NSForegroundColorAttributeName
 	  value:[NSColor whiteColor] range:NSMakeRange(0, [tmpstr length])];
 
+    // ”wŒi—p‚̃vƒŒ[ƒg‚ðì¬
     float radius = 0.5 * [page size].height;
     NSRect rc = NSMakeRect([attr itemAreaSize].width + [attr marginSize].width + radius,
 			   [attr marginSize].height,
@@ -243,8 +240,10 @@
     [oval appendBezierPathWithArcWithCenter:NSMakePoint(topleft.x, topleft.y - radius)
 	  radius:radius startAngle:90 endAngle:270];
     [oval closePath];
-    [oval fill];
 
+    // •`‰æ
+    [[NSColor gridColor] setFill];
+    [oval fill];
     [page drawAtPoint:bottomleft];
     [page release];
 }
Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.20.2.11 AquaSKK/ChangeLog:1.20.2.12
--- AquaSKK/ChangeLog:1.20.2.11	Mon Mar  6 21:03:00 2006
+++ AquaSKK/ChangeLog	Wed Mar  8 22:02:07 2006
@@ -1,3 +1,10 @@
+2006-03-08  Tomotaka SUWA  <t.suw****@mac*****>
+
+	* SKKDictionary.cpp: Ž©“®XV‚ªˆê‰ñ‚µ‚©‚Å‚«‚È‚¢•s‹ï‡‚ðC³B
+
+	* CandidatesFrame.m: Œó•âƒEƒBƒ“ƒhƒE‚Ì [Žc‚è remain] ‚ð”pŽ~‚µA
+	wcurrent / totalxŒ`Ž®‚Å•`‰æ‚·‚é‚悤‚ɕύXB
+
 2006-03-06  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* skkserv.cpp: I—¹ˆ—‚ð‚æ‚èˆÀ‘S‚ɏC³B
Index: AquaSKK/SKKDictionary.cpp
diff -u AquaSKK/SKKDictionary.cpp:1.6.2.3 AquaSKK/SKKDictionary.cpp:1.6.2.4
--- AquaSKK/SKKDictionary.cpp:1.6.2.3	Mon Mar  6 21:03:00 2006
+++ AquaSKK/SKKDictionary.cpp	Wed Mar  8 22:02:07 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: SKKDictionary.cpp,v 1.6.2.3 2006/03/06 12:03:00 t-suwa Exp $
+  $Id: SKKDictionary.cpp,v 1.6.2.4 2006/03/08 13:02:07 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -214,7 +214,7 @@
 
 #pragma mark --- SKKAutoUpdateDictionary ---
 
-SKKAutoUpdateDictionary::SKKAutoUpdateDictionary() {
+SKKAutoUpdateDictionary::SKKAutoUpdateDictionary() : host_("openlab.ring.gr.jp"), url_("/skk/skk/dic/") {
     // empty
 }
 
@@ -223,12 +223,8 @@
 }
 
 void SKKAutoUpdateDictionary::load(const std::string& path) {
-    std::string::size_type pos = path.find_first_of('/');
-    host_ = path.substr(0, pos);
-    url_ = path.substr(pos);
-
-    pos = path.find_last_of('/');
-    path_  = SkkConfig::home() + "/Library/AquaSKK" + path.substr(pos);
+    url_ += path;
+    path_  = SkkConfig::home() + "/Library/AquaSKK/" + path;
     initializeContainer(okuriAri_, okuriNasi_);
 
     std::cerr << "SKK AutoUpdate Dictionary(" << path_ << ")" << std::endl
@@ -267,58 +263,58 @@
 void* SKKAutoUpdateDictionary::download(void* param) {
     SKKAutoUpdateDictionary* obj = static_cast<SKKAutoUpdateDictionary*>(param);
 
-    socket_stream session(obj->host_.c_str(), 80);
-    if(!session) {
-	std::cerr << "can't connect to [" << obj->host_ << "]" << std::endl;
-	return NULL;
-    }
-
     while(true) {
-	// Ž«‘‚̍XV“ú•t‚ðŽæ“¾
-	char timestamp[64];
-	struct stat st;
-	if(stat(obj->path_.c_str(), &st) != 0) {
-	    st.st_mtime = 0;
-	}
-	strftime(timestamp, sizeof(timestamp), "%a, %d %b %Y %T %Z", gmtime(&st.st_mtime));
-
-	// ƒŠƒNƒGƒXƒg
-	session << "GET " << obj->url_ << " HTTP/1.1" << std::endl;
-	session << "Host: " << obj->host_ << std::endl;
-	session << "If-Modified-Since: " << timestamp << std::endl;
-	session << "Connection: close" << std::endl << std::endl;
-
-	// ƒŒƒXƒ|ƒ“ƒX
-	std::string response;
-	bool modified = false;
-	while(true) {
-	    getline(session, response);
-	    if(response.find("200 OK") != std::string::npos) {
-		modified = true;
+	std::cerr << "SKKAutoUpdateDictionary: checking " << obj->host_ << obj->url_ << " ..." << std::endl;
+	socket_stream session(obj->host_.c_str(), 80);
+	if(session) {
+	    // Ž«‘‚̍XV“ú•t‚ðŽæ“¾
+	    char timestamp[64];
+	    struct stat st;
+	    if(stat(obj->path_.c_str(), &st) != 0) {
+		st.st_mtime = 0;
 	    }
-	    if(response == "\r") break;
-	}
+	    strftime(timestamp, sizeof(timestamp), "%a, %d %b %Y %T %Z", gmtime(&st.st_mtime));
 
-	if(modified) {
-	    // •Û‘¶
-	    std::ofstream ofs(obj->path_.c_str());
+	    // ƒŠƒNƒGƒXƒg
+	    session << "GET " << obj->url_ << " HTTP/1.1" << std::endl;
+	    session << "Host: " << obj->host_ << std::endl;
+	    session << "If-Modified-Since: " << timestamp << std::endl;
+	    session << "Connection: close" << std::endl << std::endl;
+
+	    // ƒŒƒXƒ|ƒ“ƒX
+	    std::string response;
+	    bool modified = false;
 	    while(true) {
 		getline(session, response);
-		if(response.empty()) break;
-		ofs << response << std::endl;
+		if(response.find("200 OK") != std::string::npos) {
+		    modified = true;
+		}
+		if(response == "\r") break;
 	    }
 
-	    // ƒŠƒ[ƒh
-	    EntryContainer tmpOkuriAri;
-	    EntryContainer tmpOkuriNasi;
-	    obj->initializeContainer(tmpOkuriAri, tmpOkuriNasi);
-
-	    // ’u‚«Š·‚¦
-	    Guard g(obj->mutex_);
-	    tmpOkuriAri.swap(obj->okuriAri_);
-	    tmpOkuriNasi.swap(obj->okuriNasi_);
+	    if(modified) {
+		// •Û‘¶
+		std::ofstream ofs(obj->path_.c_str());
+		while(true) {
+		    getline(session, response);
+		    if(response.empty()) break;
+		    ofs << response << std::endl;
+		}
+
+		// ƒŠƒ[ƒh
+		EntryContainer tmpOkuriAri;
+		EntryContainer tmpOkuriNasi;
+		obj->initializeContainer(tmpOkuriAri, tmpOkuriNasi);
+
+		// ’u‚«Š·‚¦
+		Guard g(obj->mutex_);
+		tmpOkuriAri.swap(obj->okuriAri_);
+		tmpOkuriNasi.swap(obj->okuriNasi_);
 
-	    std::cerr << "SKK AutoUpdate Dictionary(" << obj->path_ << ") updated" << std::endl;
+		std::cerr << "SKKAutoUpdateDictionary: " << obj->path_ << " has been updated" << std::endl;
+	    }
+	} else {
+	    std::cerr << "SKKAutoUpdateDictionary: can't connect to [" << obj->host_ << "]" << std::endl;
 	}
 
 	// 6 ŽžŠÔ‘Ò‚Â


aquaskk-changes メーリングリストの案内
Back to archive index