[aquaskk-changes 6] CVS update: sandbox/AquaSKK

Back to archive index

Tomotaka SUWA t-suw****@users*****
2005年 7月 17日 (日) 18:50:51 JST


Index: sandbox/AquaSKK/AsciiConvertionMode.cpp
diff -u sandbox/AquaSKK/AsciiConvertionMode.cpp:1.1.1.1 sandbox/AquaSKK/AsciiConvertionMode.cpp:removed
--- sandbox/AquaSKK/AsciiConvertionMode.cpp:1.1.1.1	Sun Jul 17 18:09:03 2005
+++ sandbox/AquaSKK/AsciiConvertionMode.cpp	Sun Jul 17 18:50:51 2005
@@ -1,706 +0,0 @@
-/*  $Id: AsciiConvertionMode.cpp,v 1.1.1.1 2005/07/17 09:09:03 t-suwa Exp $
-	
-    MacOS X implementation of the SKK input method.
-    Copyright (C) 2002-2004 phonohawk
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-#include "AsciiConvertionMode.h"
-#include "BIMInputEvents.h"
-#include "HiraganaInputMode.h"
-#include "ParentInputMode.h"
-#include "CppCFData.h"
-#include "WordRegisterMode.h"
-#include "ServerConnectionFactory.h"
-#include "KanjiConversionMode.h" // KanjiConversionMode‚Ì”ñƒƒ“ƒoŠÖ”‚ð—¬—p‚·‚éB
-#include "ClientConfiguration.h"
-#include "SkkConfig.h"
-
-AsciiConvertionMode::AsciiConvertionMode(ParentInputMode& parent)
-    :ChildInputMode(parent),
-     word_register_mode(NULL),
-     status(STATUS_NULL),
-     show_cands_window_after_Nth_cand(5),
-     completion_mode(false),
-     henkanModeStatus(false) {
-    
-}
-
-AsciiConvertionMode::~AsciiConvertionMode() {
-    if (word_register_mode) {
-	delete word_register_mode;
-    }
-}
-
-void AsciiConvertionMode::start() {
-    status = STATUS_WHITE;
-}
-
-bool AsciiConvertionMode::handleInput(unsigned char inputChar) {
-    bool result = handleInputChar(inputChar);
-    henkanModeStatus = !result;
-    
-    return result;
-}
-
-bool AsciiConvertionMode::handleInputChar(unsigned char inputChar) {
-    if (word_register_mode) {
-	word_register_mode->handleInput(inputChar);
-	return false; // WordRegisterMode::handleInput()‚ª‰½‚ð•Ô‚»‚¤‚Æ‚àŠm’è‚Í‚µ‚È‚¢B
-    }
-    
-    if (SkkConfig::config().isAbbrevNextKey(inputChar)) {
-	if (status == STATUS_WHITE && completion_mode) {
-	    // ŽŸ‚ÌŒó•â‚ցBÅŒã‚܂ōs‚Á‚½‚çÅ‰‚É–ß‚éB
-	    current_completion_index++;
-	    if (current_completion_index >= completions.size()) {
-		current_completion_index = 0;
-	    }
-	    index = completions[current_completion_index];
-	    return false;
-	}
-    }
-    
-    if (SkkConfig::config().isAbbrevPrevKey(inputChar)) {
-	if (status == STATUS_WHITE && completion_mode) {
-	    // ‘O‚ÌŒó•â‚ցBÅ‰‚܂ōs‚Á‚½‚çÅŒã‚É–ß‚éB
-	    if (current_completion_index == 0) {
-		current_completion_index = completions.size() - 1;
-	    }
-	    else {
-		current_completion_index--;
-	    }
-	    index = completions[current_completion_index];
-	    return false;
-	}
-    }
-    
-    // tab,ƒsƒŠƒIƒh,ƒJƒ“ƒ}ˆÈŠO‚Ì‚¢‚©‚Ȃ镶Žš‚ª“ü—Í‚³‚ê‚Ä‚à•âŠ®ƒ‚[ƒh‚𔲂¯‚éB
-    completion_mode = false;
-    
-    if (SkkConfig::config().isToggleKanaKey(inputChar)) {
-	if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	    // Œ»Ý‚ÌŒó•â‚ðŠm’èB
-	    // 1) •½‰¼–¼ƒ‚[ƒh‚È‚ç‘SŠp•Ð‰¼–¼ƒ‚[ƒh‚Ö
-	    // 2) ‚»‚êˆÈŠO‚Ȃ畽‰¼–¼ƒ‚[ƒh‚Ö
-	    
-	    parent->setEnabledKanjiMode(false);
-	    if (parent->isHiraganaInputMode()) {
-		parent->goZenKataInputMode();
-	    }
-	    else {
-		parent->goHiraganaInputMode();
-	    }
-	    return true;
-	}
-    }
-    
-    if (SkkConfig::config().isPrevKouhoKey(inputChar)) {
-	if (status == STATUS_BLACK) {
-	    // ˆê‚‘O‚ÌŒó•â‚ցBÅ‰‚ÌŒó•â‚¾‚Á‚½‚灤ƒ‚[ƒh‚Ö–ß‚éB
-	    if (current_candidate_index > 0) {
-		current_candidate_index--;
-	    }
-	    else {
-		status = STATUS_WHITE;
-	    }
-	    return false;
-	}
-	else if (status == STATUS_BLACK_WITH_WINDOW) {
-	    // delete‚ª‰Ÿ‚³‚ꂽ‚à‚Ì‚ÆŒ©˜ô‚·
-	    handleBackSpace();
-	    return false;
-	}
-	// ‚»‚êˆÈŠO‚È‚ç‘f’Ê‚è
-    }
-    
-    if (SkkConfig::config().isPurgeFromJisyoKey(inputChar)) {
-	if (status == STATUS_BLACK) {
-	    // íœƒvƒƒ“ƒvƒg‚ðo‚·B‚±‚Ì•ÏŠ·‚ªŽÀ‚̓†[ƒU[Ž«‘‚ɍڂÁ‚Ä‚¢‚È‚©‚Á‚½‚Æ‚µ‚Ä‚à
-	    // –Ê“|‚È‚Ì‚Å‚»‚ÌŽ–‚ð‚í‚´‚í‚´Šm”F‚µ‚È‚¢B—v–]‚Å‚à‚ ‚ê‚Εʂ¾‚ªB
-	    status = STATUS_PROMPT;
-	    prompt_type = PROMPT_DELETE_FROM_USER_DIC;
-	    prompt_input.clear();
-	    prompt.clear().append(0x672c).append(0x5f53).append(0x306b).append(' ');
-	    prompt.append('/').append(index).append('/');
-	    prompt.append(candidates[current_candidate_index]).append("/ ");
-	    prompt.append(0x3092).append(0x524a).append(0x9664).append(0x3057).append(0x3066).
-		append(0x3082).append(0x5b9c).append(0x3057).append(0x3044).append(0x3067).
-		append(0x3059).append(0x304b).append(0xff1f).append("(yes/no)");
-	    return false;
-	}
-    }
-    
-    if (SkkConfig::config().isToggleKatakanaKey(inputChar)) {
-	if (status == STATUS_WHITE) {
-	    // ”¼Šp‰p”Žš‚ð‘SŠp‰p”Žš‚É•ÏŠ·‚µ‚Ä‚©‚çŠm’肵‚ďI—¹
-	    parent->fix(ZenAscInputMode::convert(index));
-	    
-	    parent->setEnabledAsciiConvertionMode(false);
-	    initialize();
-	    
-	    return false;
-	}
-	if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	    // Œ»Ý‚ÌŒó•â‚ðŠm’肵‚Ä‚©‚çA
-	    // 1) ”¼Šp•Ð‰¼–¼ƒ‚[ƒh‚Ȃ畽‰¼–¼ƒ‚[ƒh‚Ö
-	    // 2) ‚»‚êˆÈŠO‚Ȃ甼Šp•Ð‰¼–¼‰¼–¼ƒ‚[ƒh‚Ö
-	    
-	    parent->setEnabledAsciiConvertionMode(false);
-	    if (parent->isHanKataInputMode()) {
-		parent->goHiraganaInputMode();
-	    }
-	    else {
-		parent->goHanKataInputMode();
-	    }
-	    return true;
-	}
-    }
-    
-    if (SkkConfig::config().isKakuteiKey(inputChar)) {
-	return true; // Šm’è‚Ì‚Ý
-    }
-    
-    if (SkkConfig::config().isLatinModeKey(inputChar)
-	|| SkkConfig::config().isJisx0208LatinModeKey(inputChar)) {
-	if (status == STATUS_BLACK) {
-	    // ‚»‚ꂼ‚ê‚ðŠm’肵‚Ä”¼Šp/‘SŠp‰p”Žšƒ‚[ƒh‚ցB
-	    if (SkkConfig::config().isLatinModeKey(inputChar)) {
-		parent->goHanAscInputMode();
-	    }
-	    else {
-		parent->goZenAscInputMode();
-	    }
-	    return true;
-	}
-	// ¤ƒ‚[ƒh‚âŒó•â‘I‘ð‰æ–Ê‚È‚ç‘f’Ê‚èB
-    }
-    
-    if (SkkConfig::config().isAbbrevModeKey(inputChar)) {
-	if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	    parent->fix(this->getStringToFix());
-	    parent->handleInput(inputChar);
-	    return false;
-	}
-    }
-    
-    if (SkkConfig::config().isNextKouhoKey(inputChar)) {
-	if (status == STATUS_WHITE) {
-	    if (index.length() == 0) {
-		// I—¹
-		parent->setEnabledAsciiConvertionMode(false);
-		parent->display(CppCFString());
-		initialize();
-		return false;
-	    }
-	    
-	    // ŽI‚É–â‚¢‡‚킹
-	    askServerTheCandidates();
-	    
-	    if (candidates.size() > 0) {
-		// Œó•â‚ª‘¶Ý‚µ‚½B¥ƒ‚[ƒh‚ցB
-		status = STATUS_BLACK;
-		current_candidate_index = 0; // Å‰‚ÌŒó•âB
-	    }
-	    else {
-		// ˆê‚‚àŒó•â‚ª–³‚¢B’PŒê“o˜^ŠJŽnB
-		startRegisteringWord();
-	    }
-	}
-	else if (status == STATUS_BLACK) {
-	    // ŽŸ‚ÌŒó•â‚Ö
-	    current_candidate_index++;
-	    
-	    if (current_candidate_index >= candidates.size()) { // I‚í‚è‚܂ōs‚Á‚½‚ç’PŒê“o˜^ŠJŽnB
-		startRegisteringWord();
-	    }
-	    else if (current_candidate_index >= show_cands_window_after_Nth_cand - 1) {
-		// ‚±‚êˆÈ~‚̃[ƒe[ƒVƒ‡ƒ“‚ÅŒó•â‘I‘ðƒEƒCƒ“ƒhƒE‚ð•\Ž¦‚·‚éB
-		status = STATUS_BLACK_WITH_WINDOW;
-		openCandidatesWindow();
-	    }
-	}
-	else if (status == STATUS_BLACK_WITH_WINDOW) {
-	    if (candidates_window_current_frame < candidates_window_num_of_frames - 1) {
-		// ÅŒã‚̃tƒŒ[ƒ€‚Å‚È‚¯‚ê‚΁AŽŸ‚̃tƒŒ[ƒ€‚֍s‚­B
-		goToNextCandidatesFrame();
-	    }
-	    else {
-		// ÅŒã‚̃tƒŒ[ƒ€‚¾‚Á‚½‚çA’PŒê“o˜^‚ðŠJŽnB
-		closeCandidatesWindow();
-		startRegisteringWord();
-	    }
-	}
-    }
-    else {
-	if (status == STATUS_WHITE) {
-	    // index‚É‚½‚¾’ljÁB
-	    index += inputChar;
-	}
-	else if (status == STATUS_BLACK) {
-	    // Œ»Ý‚ÌŒó•â‚ðŠm’肵‚½ŒãA‰Šú‰»‚µ‚ďI—¹‚·‚邪A
-	    // “¯Žž‚ɍ¡‰ñ‚Ì•\Ž¦/fix‚ª”½‰f‚³‚ê‚È‚¢‚ƍ¢‚é‚Ì‚Å
-	    // ƒAƒXƒL[•ÏŠ·ƒ‚[ƒh‚ðI—¹‚³‚¹‚Ä‚©‚çparent‚ÌhandleInput‚É“n‚·B
-	    // AsciiConvertionMode‚ÍSTATUS_NULL‚ÌŽž‚É‚Í
-	    // í‚ÉkIgnoreThis‚ð•Ô‚·B
-	    
-	    // ŽI‚É‘—M
-	    sendCurrentCandidateToServerToRegister();
-	    
-	    // „šû‚³‚ê‚È‚¢‚ªA‹­§“I‚ÉŠm’肳‚¹‚éB
-	    parent->fix(candidates[current_candidate_index]);
-	    
-	    parent->setEnabledAsciiConvertionMode(false);
-	    initialize();
-	    
-	    parent->handleInput(inputChar);
-	}
-	else if (status == STATUS_BLACK_WITH_WINDOW) {
-	    // asdfjkli1ƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”‚ª7‚æ‚菭‚È‚¯‚ê‚΂±‚ê‚àŒ¸‚éBj‚Ì•¶Žš‚Å‚ ‚ê‚Î
-	    // ‚»‚ÌŒó•â‚ð‚½‚¾Šm’è‚·‚éB
-	    // ‚»‚¤‚Å‚È‚¯‚ê‚ÎŒ»Ý‚ÌŒó•â‚ð‚½‚¾Šm’è‚·‚éB
-	    int cand_index = CppCFString("asdfjkl").substring(0,candidates_window_cands_per_frame).indexOf(inputChar);
-	    if (cand_index != -1) {
-		unsigned new_index = current_candidate_index + cand_index;
-		if (new_index < candidates.size()) {
-		    // ‚±‚̃Cƒ“ƒfƒBƒbƒNƒX‚ª‹–‚³‚ê‚é‚È‚çŠm’èB
-		    current_candidate_index = new_index;
-		    return true;
-		}				
-	    }
-	    return false;
-	}
-	else if (status == STATUS_PROMPT) {
-	    // ‚»‚Ì‚Ü‚Üprompt_input‚ɒljÁB
-	    prompt_input += inputChar;
-	}
-    }
-    return false;
-}
-
-void AsciiConvertionMode::startRegisteringWord() {
-    word_register_mode = new WordRegisterMode(*this,index);
-    word_register_mode->redisplay();
-}
-
-bool AsciiConvertionMode::handleBackSpace() {
-    if (word_register_mode) {
-	word_register_mode->handleBackSpace();
-	return true; // WordRegisterMode::handleBackSpace()‚ª‰½‚ð•Ô‚»‚¤‚Æ‚à–{•¶‚͏Á‚³‚È‚¢B
-    }
-    
-    if (status == STATUS_NULL) {
-	return false;
-    }
-    
-    if (status == STATUS_WHITE) {
-	// index‚ª‹ó‚Ȃ珉Šú‰»‚µ‚ďI—¹
-	// ‹ó‚Å‚È‚¯‚ê‚Îindex‚̍Ōã‚Ì•¶Žš‚ðÁ‚·B
-	if (index.length() == 0) {
-	    parent->setEnabledAsciiConvertionMode(false);
-	    parent->display(CppCFString());
-	    initialize();
-	}
-	else {
-	    completion_mode = false; // •âŠ®ƒ‚[ƒh‚¾‚Á‚½ê‡‚͕⊮ƒ‚[ƒh‚𔲂¯‚éB
-	    index.eraseLast(1);
-	}
-    }
-    else if (status == STATUS_BLACK) {
-	// Œ»Ý‚ÌŒó•â‚ðŠm’肵‚Ä‚©‚çÅŒã‚Ì•¶Žš‚ðíœB
-	// ‚»‚µ‚ú‰»‚µ‚ďI—¹B
-	CppCFString str_to_fix(candidates[current_candidate_index]);
-	str_to_fix.eraseLast(1);
-	
-	// ŽI‚É‘—M
-	sendCurrentCandidateToServerToRegister();
-	
-	// ‰œ‚ÌŽè
-	parent->fix(str_to_fix);
-	parent->display(CppCFString());
-	
-	parent->setEnabledAsciiConvertionMode(false);
-	initialize();
-    }
-    else if (status == STATUS_BLACK_WITH_WINDOW) {
-	// Å‰‚̃tƒŒ[ƒ€‚È‚çA¥ƒ‚[ƒh‚Ö–ß‚é
-	// ‚»‚¤‚Å‚È‚¯‚ê‚ΑO‚̃tƒŒ[ƒ€‚ցB
-	if (candidates_window_current_frame == 0) {
-	    // ƒEƒCƒ“ƒhƒE‚ðŠJ‚­‘O‚É–ß‚·
-	    current_candidate_index = show_cands_window_after_Nth_cand - 2;
-	    
-	    // ƒEƒCƒ“ƒhƒE‚ð•Â‚¶‚éB
-	    closeCandidatesWindow();
-	    
-	    status = STATUS_BLACK;
-	}
-	else {
-	    goToPrevCandidatesFrame();
-	}
-    }
-    else if (status == STATUS_PROMPT) {
-	// prompt_input‚ª‹ó‚Å‚È‚¯‚ê‚΍Ōã‚Ì•¶Žš‚ðÁ‚·B
-	if (prompt_input.length() > 0) {
-	    prompt_input.eraseLast(1);
-	}
-    }
-    return true;
-}
-
-bool AsciiConvertionMode::handleReturn() {
-    if (word_register_mode) {
-	word_register_mode->handleReturn();
-	
-	if (word_register_mode) {
-	    // handleReturn‚©‚çwordRegistrationFinished‚ªŒÄ‚΂ꂽ‚çword_register_mode‚Í”jŠü‚³‚ê‚邽‚߁B
-	    word_register_mode->redisplay();
-	}
-	
-	return true; // í‚Étrue‚ð•Ô‚·B
-    }
-    
-    if (status == STATUS_PROMPT) {
-	switch (prompt_type) {
-	case PROMPT_DELETE_FROM_USER_DIC: {
-	    // prompt_input‚ªyes‚È‚çíœ‚µ‚ÄSTATUS_WHITE‚É–ß‚éB
-	    // ‚»‚êˆÈŠO‚È‚çSTATUS_BLACK‚É–ß‚éB
-	    if (prompt_input == "yes") {
-		// íœ
-		makeServerRemoveWord();
-		
-		// STATUS_WHITE‚Ö
-		status = STATUS_WHITE;
-	    }
-	    else {
-		status = STATUS_BLACK;
-	    }
-	}
-	    break;
-	    
-	default:
-	    break;
-	}
-	return true;
-    }
-    
-    if (ClientConfiguration::sharedConfiguration().isSkkEggLikeNewline()) {
-	// skk-egglike-newlineƒ‚[ƒh‚È‚çAŽ©—Í‚ÅŠm’肳‚¹‚Ä‚©‚珉Šú‰»‚µ‚Ätrue‚ð•Ô‚·B
-	
-	// ŽI‚É‘—M
-	parent->fix(getStringToFix());
-	return true;
-    }
-    else {
-	return false;
-    }
-}
-
-bool AsciiConvertionMode::handleArrow(int kind) {
-    if (word_register_mode) {
-	return word_register_mode->handleArrow(kind); // ˆÏ÷
-    }
-    
-    if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	// ŽI‚É‘—M
-	sendCurrentCandidateToServerToRegister();
-	
-	// Œ»Ý‚ÌŒó•â‚ðŠm’èB
-	parent->fix(candidates[current_candidate_index]);
-	
-	if (status == STATUS_BLACK_WITH_WINDOW) {
-	    // ƒEƒCƒ“ƒhƒE‚ð•Â‚¶‚éB
-	    closeCandidatesWindow();
-	}
-    }
-    
-    // ƒAƒXƒL[•ÏŠ·ƒ‚[ƒh‚ðI—¹‚·‚éB
-    parent->setEnabledAsciiConvertionMode(false);
-    initialize();
-    return false;
-}
-
-bool AsciiConvertionMode::handleCg() {
-    if (word_register_mode) {
-	return word_register_mode->handleCg();
-    }
-    
-    // •½‰¼–¼ƒCƒ“ƒvƒbƒgƒ‚[ƒh‚ÌhandleCg‚ðŒÄ‚сAgetStringToFix()‚àŒÄ‚Ô‚ªAŒÄ‚Ô‚¾‚¯B
-    parent->getCurrentInputMode().handleCg();
-    parent->getCurrentInputMode().getStringToFix();
-    
-    if (status == STATUS_WHITE) {
-	// ƒAƒXƒL[•ÏŠ·ƒ‚[ƒhI—¹
-	parent->setEnabledAsciiConvertionMode(false);
-	initialize();
-    }
-    else if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	// okuri‚ª‹ó‚È‚çSTATUS_WHITE_ROOT‚ցB‚»‚¤‚Å‚È‚¯‚ê‚ÎSTATUS_WHITE_OKURI‚ցB
-	// ƒEƒCƒ“ƒhƒE‚ªŠJ‚©‚ê‚Ä‚¢‚½‚ç•Â‚¶‚éB
-	if (status == STATUS_BLACK_WITH_WINDOW) {
-	    closeCandidatesWindow();
-	}
-	
-	status = STATUS_WHITE;
-    }
-    return true;
-}
-
-bool AsciiConvertionMode::handleCy() {
-    if (word_register_mode) {
-	return word_register_mode->handleCy();
-    }
-    else {
-	return false;
-    }
-}
-
-bool AsciiConvertionMode::handleTab() {
-    if (word_register_mode) {
-	return word_register_mode->handleTab();
-    }
-    
-    if (status == STATUS_WHITE) {
-	if (completion_mode) {
-	    // ŽŸ‚ÌŒó•â‚ցBÅŒã‚܂ōs‚Á‚½‚çÅ‰‚É–ß‚éB
-	    current_completion_index++;
-	    if (current_completion_index >= completions.size()) {
-		current_completion_index = 0;
-	    }
-	    index = completions[current_completion_index];
-	}
-	else {
-	    // ŽI‚É–â‚¢‡‚킹‚éB
-	    askServerTheCompletions();
-	    
-	    // •âŠ®‚ÌŒó•â‚ª‚ ‚ê‚Ε⊮ŠJŽnB–³‚¯‚ê‚Ή½‚à‚¹‚¸‚É–ß‚éB
-	    if (completions.size() > 0) {
-		completion_mode = true;
-		index = completions[0];
-	    }
-	}
-	return false;
-    }
-    
-    return false;
-}
-
-void AsciiConvertionMode::terminate() {
-    if (word_register_mode) {
-	word_register_mode->terminate();
-    }
-    
-    parent->fix(this->getStringToFix()); // Šm’è‚·‚é
-    parent->setEnabledAsciiConvertionMode(false);
-    initialize();
-}
-
-void AsciiConvertionMode::wordRegistrationFinished() {
-    if (word_register_mode) {
-	CppCFString content = word_register_mode->getContent();
-	if (content.length() > 0) {
-	    // ŽI‚É‘—M
-	    sendWordToServerToRegister(index,content);
-	    
-	    // Šm’è
-	    parent->fix(content);
-	    
-	    // I—¹
-	    parent->setEnabledAsciiConvertionMode(false);
-	    initialize();
-	}
-	else {
-	    status = STATUS_WHITE;
-	}
-	
-	delete word_register_mode;
-	word_register_mode = NULL;
-	parent->updatePencilMenuIcon();
-    }
-}
-
-void AsciiConvertionMode::wordRegistrationCanceled() {
-    delete word_register_mode;
-    word_register_mode = NULL;
-    parent->updatePencilMenuIcon();
-    
-    if (status == STATUS_WHITE) {
-	// do nothing
-    }
-    else if (status == STATUS_BLACK) {
-	current_candidate_index = candidates.size() - 1; // ÅŒã‚ÌŒó•â‚ցB
-    }
-    else if (status == STATUS_BLACK_WITH_WINDOW) {
-	// ƒEƒCƒ“ƒhƒE‚ðŠJ‚¢‚čŌã‚̃tƒŒ[ƒ€‚ðo‚·
-	current_candidate_index = show_cands_window_after_Nth_cand - 1; // goToNextCandidatesFrame()‚Å‚¸‚ê‚éB
-	openCandidatesWindow();
-	for (unsigned i = 1;i < candidates_window_num_of_frames;i++) {
-	    goToNextCandidatesFrame();
-	}
-    }
-}
-
-CppCFString AsciiConvertionMode::getStringToDisplay() {
-    if (word_register_mode) {
-	// –³Ž‹‚³‚¹‚éB‚³‚à‚È‚¢‚Ɛ܊pWordRegisterMode‚ªÝ’肵‚½•¶Žš‚ð’ׂµ‚Ä‚µ‚Ü‚¤B
-	return CppCFString().append(kIgnoreThis);
-    }
-    
-    if (status == STATUS_WHITE) {
-	// ¤index
-	return CppCFString().append(0x25bd).append(index);
-    }
-    else if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	// ¥Œ»Ý‚ÌŒó•â
-	return CppCFString().append(0x25bc).append(candidates[current_candidate_index]);
-    }
-    else if (status == STATUS_PROMPT) {
-	// [ƒvƒƒ“ƒvƒg][“ü—Í]
-	return CppCFString('[').append(prompt).append("][").append(prompt_input).append(kCaret).append(']');
-    }
-    else {
-	return CppCFString().append(kIgnoreThis);
-    }
-}
-
-CppCFString AsciiConvertionMode::getStringToFix() {
-    CppCFString result;
-    if (status == STATUS_WHITE) {
-	result = index;
-    }
-    else if (status == STATUS_BLACK) {
-	result = candidates[current_candidate_index];
-	
-	// ŽI‚É‘—M
-	sendCurrentCandidateToServerToRegister();
-    }
-    else if (status == STATUS_BLACK_WITH_WINDOW) {
-	result = candidates[current_candidate_index];
-	
-	// ŽI‚É‘—M
-	sendCurrentCandidateToServerToRegister();
-	
-	// ƒEƒCƒ“ƒhƒE‚ð•Â‚¶‚éB
-	closeCandidatesWindow();
-    }
-    else /* if (status == STATUS_NULL) */ {
-	result = CppCFString().append(kIgnoreThis);
-    }
-    
-    // ‚±‚ꂪŒÄ‚΂ꂽ‚Æ‚¢‚¤‚±‚Æ‚Ífix‚³‚ê‚é‚Æ‚¢‚¤‚±‚ƂȂ̂ŃAƒXƒL[•ÏŠ·ƒ‚[ƒhI—¹B
-    // ‰Šú‰»‚·‚éB
-    parent->setEnabledAsciiConvertionMode(false);
-    initialize();
-    
-    return result;
-}
-
-void AsciiConvertionMode::initialize() {
-    status = STATUS_NULL;
-    index.clear();
-    candidates.clear();
-    current_candidate_index = 0;
-    completion_mode = false;
-    completions.clear();
-    current_completion_index = 0;
-}
-
-void AsciiConvertionMode::askServerTheCandidates() {
-    // ahya@¨@-ahya
-    CppCFData query;
-	query.own(CppCFString().append('-').append(index).toCFData());
-    
-    current_candidate_index = 0;
-    ::askServerTheCandidates(query,candidates);
-}
-
-void AsciiConvertionMode::askServerTheCompletions() {
-    // ŽI‚ɐq‚Ë‚é
-    CppCFData cfdata_query;
-	cfdata_query.own(index.toCFData());
-	
-    current_completion_index = 0;
-    ::askServerTheCompletions(cfdata_query,completions);
-}
-
-void AsciiConvertionMode::sendCurrentCandidateToServerToRegister() {
-    // ŽI‚É‘—M
-    sendWordToServerToRegister(index,candidates[current_candidate_index]);
-}
-
-void AsciiConvertionMode::makeServerRemoveWord() {
-    CppCFString query;
-    // ahya i߁Í߁j@¨@-ahya i߁Í߁j
-    query.append('-').append(index).append(' ').append(candidates[current_candidate_index]);
-    
-    // ŽI‚É“n‚·
-    CppCFData cfdata_query;
-	cfdata_query.own(query.toCFData());
-    ::makeServerRemoveWord(cfdata_query);
-}
-
-void AsciiConvertionMode::openCandidatesWindow() {
-    // candidates‚Ì4”Ԗڈȍ~‚̍€–Ú‚ðŽ‚Â”z—ñ‚ðì‚éB
-    //vector<CppCFString> cands(candidates.begin()+(show_cands_window_after_Nth_cand-1),candidates.end());
-    CppCFString space(" ");
-    CppCFString nbsp("[20]");
-    vector<CppCFString> cands;
-    for (vector<CppCFString>::const_iterator ite =
-	     candidates.begin() + (show_cands_window_after_Nth_cand-1);
-	 ite != candidates.end();
-	 ite++) {
-	cands.push_back(ite->replaceClone(space,nbsp));
-    }
-    
-    ::openCandidatesWindow(join(' ',cands),
-			   candidates_window_id,
-			   candidates_window_cands_per_frame,
-			   candidates_window_num_of_frames);
-    candidates_window_current_frame = 0;
-}
-
-
-void AsciiConvertionMode::goToNextCandidatesFrame() {
-    // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    ServerConnectionFactory::sharedFactory().newConnection().send(
-	kSKKCandidatesWindowNext,
-	newCFDataRefWithWindowID(candidates_window_id));
-    
-    // Œ»Ý‚̃tƒŒ[ƒ€”ԍ†‚ðƒCƒ“ƒNƒŠƒƒ“ƒg
-    candidates_window_current_frame++;
-    
-    // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ª‘‚â‚·B
-    current_candidate_index += candidates_window_cands_per_frame;
-}
-
-void AsciiConvertionMode::goToPrevCandidatesFrame() {
-    // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    ServerConnectionFactory::sharedFactory().newConnection().send(
-	kSKKCandidatesWindowPrev,
-	newCFDataRefWithWindowID(candidates_window_id));
-    
-    // Œ»Ý‚̃tƒŒ[ƒ€”ԍ†‚ðƒfƒNƒŠƒƒ“ƒg
-    candidates_window_current_frame--;
-    
-    // Œ»Ý‚ÌŒó•â”ԍ†‚ðƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”•ªŒ¸‚ç‚·B
-    current_candidate_index -= candidates_window_cands_per_frame;
-}
-
-void AsciiConvertionMode::closeCandidatesWindow() {
-    // ƒEƒCƒ“ƒhƒEID(UInt16)‚ðŠÜ‚ÞCFData‚ðì¬‚µAŽI‚Ö‘—‚éB
-    ServerConnectionFactory::sharedFactory().newConnection().send(
-	kSKKCloseCandidatesWindow,
-	newCFDataRefWithWindowID(candidates_window_id));
-}
-
Index: sandbox/AquaSKK/AsciiConvertionMode.h
diff -u sandbox/AquaSKK/AsciiConvertionMode.h:1.1.1.1 sandbox/AquaSKK/AsciiConvertionMode.h:removed
--- sandbox/AquaSKK/AsciiConvertionMode.h:1.1.1.1	Sun Jul 17 18:09:03 2005
+++ sandbox/AquaSKK/AsciiConvertionMode.h	Sun Jul 17 18:50:51 2005
@@ -1,99 +0,0 @@
-/*
-	$Id: AsciiConvertionMode.h,v 1.1.1.1 2005/07/17 09:09:03 t-suwa Exp $
-	---------
-	
-    MacOS X implementation of the SKK input method.
-    Copyright (C) 2002 phonohawk
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-#pragma once
-#include <Carbon/Carbon.h>
-#include <vector>
-#include "CppCFString.h"
-#include "BIM.h"
-#include "InputMode.h"
-#include "ChildInputMode.h"
-#include "RegistrationStarter.h"
-using namespace std;
-
-class AsciiConvertionMode : public ChildInputMode , public RegistrationStarter
-{
-	protected:
-		static const int STATUS_NULL = 0; // ƒAƒXƒL[•ÏŠ·ƒ‚[ƒh‚É‚È‚Á‚Ä‚¢‚È‚¢ó‘ԁBæ“ª‚Ɂ¤‚à¥‚à–³‚¢B
-		static const int STATUS_WHITE = 1; // ¤ƒ‚[ƒh
-		static const int STATUS_BLACK = 2; // ¥ƒ‚[ƒh
-		static const int STATUS_BLACK_WITH_WINDOW = 3; // ¥ƒ‚[ƒh‚ŁAŒó•â‘I‘ðƒEƒCƒ“ƒhƒE‚ªŠJ‚¢‚Ä‚¢‚éB
-		static const int STATUS_PROMPT = 4; // ƒvƒƒ“ƒvƒg‚ðo‚µ‚Ä‚¢‚éB
-		
-		class WordRegisterMode* word_register_mode; // NULL‚Å‚È‚¢Žž‚Í’PŒê“o˜^ƒ‚[ƒh‚ª‹N“®’†B
-		
-		int status;
-		CppCFString index; // Œ©o‚µŒê
-		
-		static const int PROMPT_DELETE_FROM_USER_DIC = 1; // ƒ†[ƒU[Ž«‘‚©‚ç’PŒê‚ðíœ
-		int prompt_type; // ƒvƒƒ“ƒvƒg‚ÌŽí—ށB
-		CppCFString prompt; // ƒvƒƒ“ƒvƒg
-		CppCFString prompt_input; // ƒvƒƒ“ƒvƒg‚Ƀ†[ƒU[‚ª“ü—Í‚µ‚½•¶Žš—ñ
-		
-		vector<CppCFString> candidates; // ‘S‚Ä‚ÌŒó•â
-		unsigned current_candidate_index; // Œ»Ý‚ÌŒó•â”ԍ†
-		
-		unsigned show_cands_window_after_Nth_cand; // ‰½ŒÂ–ڈȍ~‚ÌŒó•â‚ðŒó•â‘I‘ðƒEƒCƒ“ƒhƒE‚É•\Ž¦‚·‚é‚©B
-		
-		unsigned candidates_window_id; // status‚ªSTATUS_BLACK_WITH_WINDOW‚Ì‚Æ‚«AŒó•â‘I‘ðƒEƒCƒ“ƒhƒE‚ÌIDB
-		unsigned candidates_window_current_frame; // Œó•â‘I‘ðƒEƒCƒ“ƒhƒE‚ÌŒ»Ý‚̃tƒŒ[ƒ€
-		unsigned candidates_window_cands_per_frame; // Œó•â‘I‘ðƒEƒCƒ“ƒhƒE‚Ì1ƒtƒŒ[ƒ€“–‚½‚è‚ÌŒó•â”
-		unsigned candidates_window_num_of_frames; // Œó•â‘I‘ðƒEƒCƒ“ƒhƒE‚̃tƒŒ[ƒ€”
-		
-		bool completion_mode; // Œ©o‚µŒê•âŠ®ƒ‚[ƒhB‚±‚̃‚[ƒh‚ł̓sƒŠƒIƒh‚ƃJƒ“ƒ}‚ª•âŠ®‚Ì‘€ì‚ÉŽg‚í‚ê‚éB
-		vector<CppCFString> completions; // •âŠ®‚ÌŒó•â
-		unsigned current_completion_index; // Œ»Ý‚̕⊮‚ÌŒó•â”ԍ†
-		
-		bool henkanModeStatus;
-
-		virtual void startRegisteringWord();
-		virtual void askServerTheCandidates();
-		virtual void askServerTheCompletions();
-		virtual void makeServerRemoveWord();
-		virtual void sendCurrentCandidateToServerToRegister();
-		virtual void openCandidatesWindow();
-		virtual void goToPrevCandidatesFrame();
-		virtual void goToNextCandidatesFrame();
-		virtual void closeCandidatesWindow();
-		virtual void initialize();
-	
-	public:
-		AsciiConvertionMode(class ParentInputMode& parent);
-		virtual ~AsciiConvertionMode();
-		
-		virtual void start(); // ‚±‚ꂪŒÄ‚΂ê‚é‚Ɓ¤ƒ‚[ƒh‚É‚È‚éB
-		virtual bool handleInput(unsigned char inputChar);
-		virtual bool handleBackSpace();
-		virtual bool handleReturn();
-		virtual bool handleArrow(int kind);
-		virtual bool handleCg();
-		virtual bool handleCy();
-		virtual bool handleTab();
-		virtual void terminate();
-		virtual CppCFString getStringToDisplay();
-		virtual CppCFString getStringToFix();
-		
-		virtual void wordRegistrationFinished(); // WordRegisterModeê—pB
-		virtual void wordRegistrationCanceled(); // WordRegisterModeê—pB
-
-	private:
-		bool handleInputChar(unsigned char inputChar);
-};


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