t-suw****@users*****
t-suw****@users*****
2007年 10月 5日 (金) 23:40:16 JST
Index: AquaSKK/src/editor/SKKDirectInputState.cpp diff -u AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.3 AquaSKK/src/editor/SKKDirectInputState.cpp:removed --- AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.3 Mon Sep 24 11:09:04 2007 +++ AquaSKK/src/editor/SKKDirectInputState.cpp Fri Oct 5 23:40:16 2007 @@ -1,155 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 <iostream> -#include "SKKDirectInputState.h" -#include "SKKContext.h" -#include "SKKEventParam.h" -#include "SKKEmptySubController.h" - -SKKDirectInputState& SKKDirectInputState::theInstance() { - static SKKDirectInputState obj; - return obj; -} - -SKKSubController* SKKDirectInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { - // ç´æ¥å ¥åæåã¯ç¡è¦ãã - if(param.IsDirect()) { - // port å¼ã³åºã - return 0; - } - - SKKInputBuffer& buffer = context.InputBuffer(); - SKKOutputPort& port = context.OutputPort(); - if(!buffer.Input(param.code)) { - State state = 0; - // 確å®ããªãã®ã¯ããªå ¥åæã®ã¿ - do { - if(param.IsSwitchToAscii()) { - state = State::Transition(&SKKEnvironment::Ascii); - break; - } - - if(param.IsSwitchToJisx0208Latin()) { - state = State::Transition(&SKKEnvironment::Jisx0208Latin); - break; - } - - if(param.IsUpperCases()) { - state = State::Forward(&SKKEnvironment::Japanese); - break; - } - - if(param.IsEnterJapanese()) { - state = State::Transition(&SKKEnvironment::Japanese); - break; - } - - if(param.IsEnterAbbrev()) { - state = State::Transition(&SKKEnvironment::Abbreviation); - break; - } - } while(0); - - if(state) { - buffer.Clear(); - port.Terminate(); - return new SKKEmptySubController(state); - } - } - - if(!buffer.FixedString().empty()) { - port.FixString(buffer.FixedString()); - } - - port.DisplayString(buffer.InputString()); - - return 0; -} - -SKKSubController* SKKDirectInputState::HandleEnter(SKKContext&, const SKKEventParam&) { - // ç»é²å®äºã®å ´åããã - return 0; -} - -SKKSubController* SKKDirectInputState::HandleJmode(SKKContext&, const SKKEventParam&) { - return 0; -} - -SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKOutputPort& port = context.OutputPort(); - - if(!buffer.IsEmpty()) { - buffer.Clear(); - } else { - // port å¼ã³åºã - } - - port.DisplayString(buffer.InputString()); - - return 0; -} - -SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKOutputPort& port = context.OutputPort(); - - if(!buffer.IsEmpty()) { - buffer.BackSpace(); - } - - port.DisplayString(buffer.InputString()); - - return 0; -} - -SKKSubController* SKKDirectInputState::HandleDelete(SKKContext&, const SKKEventParam&) { - return 0; -} - -SKKSubController* SKKDirectInputState::HandleTab(SKKContext&, const SKKEventParam&) { - return 0; -} - -SKKSubController* SKKDirectInputState::HandlePaste(SKKContext&, const SKKEventParam&) { - // port å¼ã³åºã - return 0; -} - -SKKSubController* SKKDirectInputState::HandleCursorLeft(SKKContext&, const SKKEventParam&) { - // port å¼ã³åºã - return 0; -} - -SKKSubController* SKKDirectInputState::HandleCursorRight(SKKContext&, const SKKEventParam&) { - // port å¼ã³åºã - return 0; -} - -SKKSubController* SKKDirectInputState::HandleCursorUp(SKKContext&, const SKKEventParam&) { - // port å¼ã³åºã - return 0; -} - -SKKSubController* SKKDirectInputState::HandleCursorDown(SKKContext&, const SKKEventParam&) { - // port å¼ã³åºã - return 0; -} Index: AquaSKK/src/editor/SKKDirectInputState.h diff -u AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.3 AquaSKK/src/editor/SKKDirectInputState.h:removed --- AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.3 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKDirectInputState.h Fri Oct 5 23:40:16 2007 @@ -1,44 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 -*/ - -#ifndef INC__SKKDirectInputState__ -#define INC__SKKDirectInputState__ - -#include "SKKState.h" - -// ç´æ¥å ¥åç¶æ -struct SKKDirectInputState : public SKKState { - static SKKDirectInputState& theInstance(); - - virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param); -}; - -#endif Index: AquaSKK/src/editor/SKKEditor.cpp diff -u AquaSKK/src/editor/SKKEditor.cpp:1.1.2.3 AquaSKK/src/editor/SKKEditor.cpp:removed --- AquaSKK/src/editor/SKKEditor.cpp:1.1.2.3 Mon Sep 24 11:09:04 2007 +++ AquaSKK/src/editor/SKKEditor.cpp Fri Oct 5 23:40:16 2007 @@ -1,152 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 "SKKEditor.h" -#include "SKKDirectInputState.h" -#include "SKKEntryInputState.h" - -// ====================================================================== -// SKKRegistrationInfo ã¤ã³ã¿ãã§ã¼ã¹ -// ====================================================================== -SKKRegistrationInfo::SKKRegistrationInfo() { -} - -SKKRegistrationInfo::SKKRegistrationInfo(const std::string& prompt, SKKEngine::State returnPoint) - : prompt_(prompt), returnPoint_(returnPoint) { -} - -const std::string& SKKRegistrationInfo::Prompt() const { - return prompt_; -} - -const SKKEngine::State SKKRegistrationInfo::ReturnPoint() const { - return returnPoint_; -} - -// ====================================================================== -// SKKEditor ã¤ã³ã¿ãã§ã¼ã¹ -// ====================================================================== -SKKEditor::SKKEditor() { - initialize(); -} - -SKKEditor::SKKEditor(const SKKRegistrationInfo& info) : context_(info.Prompt()), registrationInfo_(info) { - initialize(); -} - -SKKEditor::SKKEditor(const SKKEditor& src) - : context_(src.context_), registrationInfo_(src.registrationInfo_), state_(src.state_) { -} - -// ====================================================================== -// ãã¼å ¥åã¯å ¨ã¦ç¶æ ã¯ã©ã¹ã«ç§»è²ãã -// ====================================================================== -SKKSubController* SKKEditor::HandleInput(const SKKEventParam& param) { - return state_->HandleInput(context_, param); -} - -SKKSubController* SKKEditor::HandleEnter(const SKKEventParam& param) { - return state_->HandleEnter(context_, param); -} - -SKKSubController* SKKEditor::HandleJmode(const SKKEventParam& param) { - return state_->HandleJmode(context_, param); -} - -SKKSubController* SKKEditor::HandleCancel(const SKKEventParam& param) { - return state_->HandleCancel(context_, param); -} - -SKKSubController* SKKEditor::HandleBackSpace(const SKKEventParam& param) { - return state_->HandleBackSpace(context_, param); -} - -SKKSubController* SKKEditor::HandleDelete(const SKKEventParam& param) { - return state_->HandleDelete(context_, param); -} - -SKKSubController* SKKEditor::HandleTab(const SKKEventParam& param) { - return state_->HandleTab(context_, param); -} - -SKKSubController* SKKEditor::HandlePaste(const SKKEventParam& param) { - return state_->HandlePaste(context_, param); -} - -SKKSubController* SKKEditor::HandleCursorLeft(const SKKEventParam& param) { - return state_->HandleCursorLeft(context_, param); -} - -SKKSubController* SKKEditor::HandleCursorRight(const SKKEventParam& param) { - return state_->HandleCursorRight(context_, param); -} - -SKKSubController* SKKEditor::HandleCursorUp(const SKKEventParam& param) { - return state_->HandleCursorUp(context_, param); -} - -SKKSubController* SKKEditor::HandleCursorDown(const SKKEventParam& param) { - return state_->HandleCursorDown(context_, param); -} - -// å ¥åã¢ã¼ãå¤æ´ -void SKKEditor::SelectInputMode(SKK::InputMode mode) { - context_.InputBuffer().SelectInputMode(mode); -} - -// å é¨ç¶æ å¤æ´ -void SKKEditor::ChangeState(SKK::EditState state) { - switch(state) { - case SKK::DirectInput: - state_ = &SKKDirectInputState::theInstance(); - break; - - case SKK::EntryInput: - state_ = &SKKEntryInputState::theInstance(); - break; - - case SKK::OkuriInput: - case SKK::AbbrevInput: - case SKK::Completion: - case SKK::SingleCandidate: - case SKK::MultipleCandidate: - case SKK::EntryRemove: - break; - } -} - -const SKKRegistrationInfo& SKKEditor::RegistrationInfo() const { - return registrationInfo_; -} - -const std::string& SKKEditor::EditString() const { - return context_.Word(); -} - -void SKKEditor::Commit(const std::string& str) { - context_.OutputPort().FixString(str); -} - -// ====================================================================== -// private method -// ====================================================================== -void SKKEditor::initialize() { - state_ = &SKKDirectInputState::theInstance(); -} Index: AquaSKK/src/editor/SKKEditor.h diff -u AquaSKK/src/editor/SKKEditor.h:1.1.2.3 AquaSKK/src/editor/SKKEditor.h:removed --- AquaSKK/src/editor/SKKEditor.h:1.1.2.3 Mon Sep 24 11:09:04 2007 +++ AquaSKK/src/editor/SKKEditor.h Fri Oct 5 23:40:16 2007 @@ -1,91 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 -*/ - -#ifndef INC__SKKEditor__ -#define INC__SKKEditor__ - -#include "SKK.h" -#include "SKKEngine.h" -#include "SKKContext.h" - -class SKKState; -class SKKSubController; -class SKKEventParam; - -// å帰çè¾æ¸ç»é²ç¨ãã¼ã¿ -class SKKRegistrationInfo { - std::string prompt_; - SKKEngine::State returnPoint_; - -public: - SKKRegistrationInfo(); - SKKRegistrationInfo(const std::string& prompt, SKKEngine::State returnPoint); - - const std::string& Prompt() const; - const SKKEngine::State ReturnPoint() const; -}; - -// ç·¨éã¤ã³ã¿ãã§ã¼ã¹ -class SKKEditor { - SKKContext context_; - SKKState* state_; - SKKRegistrationInfo registrationInfo_; - - void initialize(); - -public: - // ãã¼å ¥åãã³ãã©ã¼ - typedef SKKSubController* (SKKEditor::*Handler)(const SKKEventParam&); - - SKKEditor(); - SKKEditor(const SKKRegistrationInfo& info); - SKKEditor(const SKKEditor& src); - - // ãã¼å ¥åå¦ç - SKKSubController* HandleInput(const SKKEventParam& param); - SKKSubController* HandleEnter(const SKKEventParam& param); - SKKSubController* HandleJmode(const SKKEventParam& param); - SKKSubController* HandleCancel(const SKKEventParam& param); - SKKSubController* HandleBackSpace(const SKKEventParam& param); - SKKSubController* HandleDelete(const SKKEventParam& param); - SKKSubController* HandleTab(const SKKEventParam& param); - SKKSubController* HandlePaste(const SKKEventParam& param); - SKKSubController* HandleCursorLeft(const SKKEventParam& param); - SKKSubController* HandleCursorRight(const SKKEventParam& param); - SKKSubController* HandleCursorUp(const SKKEventParam& param); - SKKSubController* HandleCursorDown(const SKKEventParam& param); - - // å ¥åã¢ã¼ãå¤æ´ - void SelectInputMode(SKK::InputMode mode); - - // å é¨ç¶æ å¤æ´ - void ChangeState(SKK::EditState state); - - // ç»é²æ å ±ãåå¾ - const SKKRegistrationInfo& RegistrationInfo() const; - - // ç·¨éæååãåå¾ - const std::string& EditString() const; - - // ç¢ºå® - void Commit(const std::string& str); -}; - -#endif // INC__SKKEditor__ Index: AquaSKK/src/editor/SKKEntryInputState.cpp diff -u AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.2 AquaSKK/src/editor/SKKEntryInputState.cpp:removed --- AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.2 Mon Sep 24 11:09:04 2007 +++ AquaSKK/src/editor/SKKEntryInputState.cpp Fri Oct 5 23:40:16 2007 @@ -1,308 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 <iostream> -#include "SKKEntryInputState.h" -#include "SKKContext.h" -#include "SKKEventParam.h" -#include "SKKEmptySubController.h" -#include "jconv.h" - -SKKEntryInputState& SKKEntryInputState::theInstance() { - static SKKEntryInputState obj; - return obj; -} - -SKKSubController* SKKEntryInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - SKKOutputPort& port = context.OutputPort(); - - if(!edit.IsEmpty()) { - State state = 0; - - do { - // ãã°ã«å¤æ #1 - if(param.IsToggleKana()) { - std::string result; - toggleKana(buffer.InputMode(), edit.EditString(), result); - edit.Clear(); - port.FixString(result); - state = State::Transition(&SKKEnvironment::KanaInput); - break; - } - - // ãã°ã«å¤æ #2 - if(param.IsToggleJisx0201Kana()) { - std::string result; - toggleJisx0201Kana(buffer.InputMode(), edit.EditString(), result); - edit.Clear(); - port.FixString(result); - state = State::Transition(&SKKEnvironment::KanaInput); - break; - } - - // éããã - if(param.IsUpperCases()) { - std::cerr << "éãããéå§" << std::endl; - state = State::Transition(&SKKEnvironment::Okuri); - break; - } - - // å¤æ - if(param.IsNextCandidate()) { - std::cerr << "å¤æéå§" << std::endl; - break; - } - } while(0); - - if(state) { - port.Terminate(); - return new SKKEmptySubController(state); - } - } - - if(buffer.Input(std::tolower(param.code))) { - edit.Insert(buffer.FixedString()); - } else { - State state = 0; - - do { - if(param.IsSwitchToAscii()) { - state = State::Transition(&SKKEnvironment::Ascii); - break; - } - - if(param.IsSwitchToJisx0208Latin()) { - state = State::Transition(&SKKEnvironment::Jisx0208Latin); - break; - } - - if(param.IsEnterJapanese() && !edit.IsEmpty()) { - state = State::Transition(&SKKEnvironment::Japanese); - break; - } - } while(0); - - if(state) { - port.FixString(edit.EditString()); - edit.Clear(); - buffer.Clear(); - return new SKKEmptySubController(state); - } - - if(!buffer.FixedString().empty()) { - edit.Insert(buffer.FixedString()); - } - } - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleEnter(SKKContext& context, const SKKEventParam& param) { - SKKSubController* result = HandleJmode(context, param); - - // æ¹è¡ãããã©ããï¼(egg-like-new-line) - - return result; -} - -SKKSubController* SKKEntryInputState::HandleJmode(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - SKKOutputPort& port = context.OutputPort(); - - // ç¾å¨ã®åè£ã§ç¢ºå® - port.FixString(edit.EditString()); - - edit.Clear(); - buffer.Clear(); - - return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); -} - -SKKSubController* SKKEntryInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - SKKOutputPort& port = context.OutputPort(); - - edit.Clear(); - buffer.Clear(); - - // 空ã«ãã - port.Terminate(); - - return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); -} - -SKKSubController* SKKEntryInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - SKKOutputPort& port = context.OutputPort(); - - if(!buffer.IsEmpty()) { - buffer.BackSpace(); - } else { - if(!edit.IsEmpty()) { - edit.BackSpace(); - } else { - port.Terminate(); - - return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); - } - } - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleDelete(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - - if(buffer.IsEmpty() && !edit.IsEmpty()) { - edit.Delete(); - } - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleTab(SKKContext&, const SKKEventParam&) { - // æ¤ç´¢ã§ããï¼ - if(0) { - // è£å®ã¢ã¼ã - return new SKKEmptySubController(State::Transition(&SKKEnvironment::EntryCompletion)); - } else { - return 0; - } -} - -SKKSubController* SKKEntryInputState::HandlePaste(SKKContext& context, const SKKEventParam&) { - // ããã¹ããããï¼ - if(0) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - - buffer.Clear(); - edit.Insert("paste string"); - - display(context); - } - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam&) { - context.InputBuffer().Clear(); - context.EditBuffer().CursorLeft(); - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleCursorRight(SKKContext& context, const SKKEventParam&) { - context.InputBuffer().Clear(); - context.EditBuffer().CursorRight(); - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleCursorUp(SKKContext& context, const SKKEventParam&) { - context.InputBuffer().Clear(); - context.EditBuffer().CursorUp(); - - display(context); - - return 0; -} - -SKKSubController* SKKEntryInputState::HandleCursorDown(SKKContext& context, const SKKEventParam&) { - context.InputBuffer().Clear(); - context.EditBuffer().CursorDown(); - - display(context); - - return 0; -} - -// ====================================================================== -// private method -// ====================================================================== -void SKKEntryInputState::display(SKKContext& context) { - SKKOutputPort& port = context.OutputPort(); - SKKInputBuffer& input = context.InputBuffer(); - SKKEditBuffer edit(context.EditBuffer()); - - if(!input.IsEmpty()) { - edit.Insert(input.InputString()); - } - - port.DisplayString("â½" + edit.EditString(), 1 + edit.CursorPosition()); -} - -void SKKEntryInputState::toggleKana(SKK::InputMode mode, const std::string& from, std::string& to) { - to.clear(); - - switch(mode) { - case SKK::Hirakana: - jconv::hirakana_to_katakana(from, to); - break; - - case SKK::Katakana: - jconv::katakana_to_hirakana(from, to); - break; - - case SKK::Jisx0201Kana: - jconv::jisx0201_kana_to_katakana(from, to); - break; - - default: - break; - } -} - -void SKKEntryInputState::toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to) { - to.clear(); - - switch(mode) { - case SKK::Hirakana: - jconv::hirakana_to_jisx0201_kana(from, to); - break; - - case SKK::Katakana: - jconv::katakana_to_jisx0201_kana(from, to); - break; - - case SKK::Jisx0201Kana: - jconv::jisx0201_kana_to_hirakana(from, to); - break; - - default: - break; - } -} Index: AquaSKK/src/editor/SKKEntryInputState.h diff -u AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.2 AquaSKK/src/editor/SKKEntryInputState.h:removed --- AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.2 Mon Sep 24 11:09:04 2007 +++ AquaSKK/src/editor/SKKEntryInputState.h Fri Oct 5 23:40:16 2007 @@ -1,51 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 -*/ - -#ifndef INC__SKKEntryInputState__ -#define INC__SKKEntryInputState__ - -#include <string> -#include "SKK.h" -#include "SKKState.h" - -// è¦åºãèªå ¥åç¶æ -class SKKEntryInputState : public SKKState { - void display(SKKContext& context); - void toggleKana(SKK::InputMode mode, const std::string& from, std::string& to); - void toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to); - -public: - static SKKEntryInputState& theInstance(); - - virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param); - virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param); -}; - -#endif Index: AquaSKK/src/editor/SKKState.h diff -u AquaSKK/src/editor/SKKState.h:1.1.2.2 AquaSKK/src/editor/SKKState.h:removed --- AquaSKK/src/editor/SKKState.h:1.1.2.2 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKState.h Fri Oct 5 23:40:16 2007 @@ -1,46 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - 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 -*/ - -#ifndef INC__SKKState__ -#define INC__SKKState__ - -#include "SKKEngine.h" - -class SKKContext; -class SKKEventParam; -class SKKSubController; - -// ç¶æ ã¯ã©ã¹ã¤ã³ã¿ãã§ã¼ã¹ -struct SKKState : public StateContainerTraits<SKKEngine> { - virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param) = 0; - virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param) = 0; -}; - -#endif