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,sIh,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ÈçSpм¼[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) {
- // ívvgðo·B±ÌÏ·ªÀÍ[U[«ÉÚÁĢȩÁ½ÆµÄà
- // Ê|ÈÌÅ»Ìðí´í´mFµÈ¢Bv]Åà êÎʾª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) {
- // ¼ppðSppÉÏ·µÄ©ç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/Spp[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 {
- // êÂàó⪳¢BPêo^JnB
- startRegisteringWord();
- }
- }
- else if (status == STATUS_BLACK) {
- // ÌóâÖ
- current_candidate_index++;
-
- if (current_candidate_index >= candidates.size()) { // IíèÜÅsÁ½çPêo^JnB
- startRegisteringWord();
- }
- else if (current_candidate_index >= show_cands_window_after_Nth_cand - 1) {
- // ±êÈ~Ì[e[VÅóâIðEChEð\¦·é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[ÖsB
- goToNextCandidatesFrame();
- }
- else {
- // ÅãÌt[¾Á½çAPêo^ðJnB
- closeCandidatesWindow();
- startRegisteringWord();
- }
- }
- }
- else {
- if (status == STATUS_WHITE) {
- // indexɽ¾ÇÁB
- index += inputChar;
- }
- else if (status == STATUS_BLACK) {
- // »ÝÌóâðmèµ½ãAú»µÄI¹·éªA
- // ¯É¡ñÌ\¦/fixª½f³êȢƢéÌÅ
- // AXL[Ï·[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) {
- // asdfjkli1t[½èÌóâª7æèȯêαêà¸éBj̶ŠêÎ
- // »Ìóâð½¾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()) {
- // ±ÌCfBbNXª³êéÈçmèB
- current_candidate_index = new_index;
- return true;
- }
- }
- return false;
- }
- else if (status == STATUS_PROMPT) {
- // »ÌÜÜprompt_inputÉÇÁ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) {
- // EChEðJOÉß·
- current_candidate_index = show_cands_window_after_Nth_cand - 2;
-
- // EChEð¶é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) {
- // EChEð¶éB
- closeCandidatesWindow();
- }
- }
-
- // AXL[Ï·[hðI¹·éB
- parent->setEnabledAsciiConvertionMode(false);
- initialize();
- return false;
-}
-
-bool AsciiConvertionMode::handleCg() {
- if (word_register_mode) {
- return word_register_mode->handleCg();
- }
-
- // ½¼¼Cvbg[hÌhandleCgðÄÑAgetStringToFix()àÄÔªAÄÔ¾¯B
- parent->getCurrentInputMode().handleCg();
- parent->getCurrentInputMode().getStringToFix();
-
- if (status == STATUS_WHITE) {
- // AXL[Ï·[hI¹
- parent->setEnabledAsciiConvertionMode(false);
- initialize();
- }
- else if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
- // okuriªóÈçSTATUS_WHITE_ROOTÖB»¤ÅȯêÎSTATUS_WHITE_OKURIÖB
- // EChEª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();
-
- // â®Ìó⪠êÎâ®JnB³¯êν๸Éßé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) {
- // EChEð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) {
- // [vvg][üÍ]
- 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();
-
- // EChEð¶éB
- closeCandidatesWindow();
- }
- else /* if (status == STATUS_NULL) */ {
- result = CppCFString().append(kIgnoreThis);
- }
-
- // ±êªÄÎê½Æ¢¤±ÆÍfix³ê鯢¤±ÆÈÌÅAXL[Ï·[hI¹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() {
- // EChEID(UInt16)ðÜÞCFDatað쬵AIÖéB
- ServerConnectionFactory::sharedFactory().newConnection().send(
- kSKKCandidatesWindowNext,
- newCFDataRefWithWindowID(candidates_window_id));
-
- // »ÝÌt[ÔðCNg
- candidates_window_current_frame++;
-
- // »ÝÌóâÔðt[½èÌóâªâ·B
- current_candidate_index += candidates_window_cands_per_frame;
-}
-
-void AsciiConvertionMode::goToPrevCandidatesFrame() {
- // EChEID(UInt16)ðÜÞCFDatað쬵AIÖéB
- ServerConnectionFactory::sharedFactory().newConnection().send(
- kSKKCandidatesWindowPrev,
- newCFDataRefWithWindowID(candidates_window_id));
-
- // »ÝÌt[ÔðfNg
- candidates_window_current_frame--;
-
- // »ÝÌóâÔðt[½èÌó⪸ç·B
- current_candidate_index -= candidates_window_cands_per_frame;
-}
-
-void AsciiConvertionMode::closeCandidatesWindow() {
- // EChEID(UInt16)ðÜÞCFDatað쬵AIÖé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; // AXL[Ï·[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ðEChEªJ¢Ä¢éB
- static const int STATUS_PROMPT = 4; // vvgð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; // vvgÌíÞB
- CppCFString prompt; // vvg
- CppCFString prompt_input; // vvgÉ[U[ªü͵½¶ñ
-
- vector<CppCFString> candidates; // SÄÌóâ
- unsigned current_candidate_index; // »ÝÌóâÔ
-
- unsigned show_cands_window_after_Nth_cand; // ½ÂÚÈ~ÌóâðóâIðEChEÉ\¦·é©B
-
- unsigned candidates_window_id; // statusªSTATUS_BLACK_WITH_WINDOWÌÆ«AóâIðEChEÌIDB
- unsigned candidates_window_current_frame; // óâIðEChEÌ»ÝÌt[
- unsigned candidates_window_cands_per_frame; // óâIðEChEÌ1t[½èÌóâ
- unsigned candidates_window_num_of_frames; // óâIðEChEÌt[
-
- bool completion_mode; // ©oµêâ®[hB±Ì[hÅÍsIhÆ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êpB
- virtual void wordRegistrationCanceled(); // WordRegisterModeêpB
-
- private:
- bool handleInputChar(unsigned char inputChar);
-};