t-suw****@users*****
t-suw****@users*****
2007年 10月 6日 (土) 00:03:54 JST
Index: AquaSKK/src/controller/SKKController.cpp diff -u AquaSKK/src/controller/SKKController.cpp:1.1.2.4 AquaSKK/src/controller/SKKController.cpp:removed --- AquaSKK/src/controller/SKKController.cpp:1.1.2.4 Mon Sep 24 10:55:19 2007 +++ AquaSKK/src/controller/SKKController.cpp Sat Oct 6 00:03:54 2007 @@ -1,142 +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 "SKKController.h" -#include "SKKSubController.h" - -typedef SKKController::Event Event; -typedef SKKController::State State; -typedef SKKController::Handler Handler; -typedef SKKController::Output Output; - -static SKKEventParam dummy; - -SKKController::SKKController() { - // ãã©ã¤ããªã¨ãã£ã¿ãçæ - stack_.push_back(SKKEditor()); -} - -// ãã¼å ¥åå¦ç -State SKKController::HandleInput(const SKKEventParam& param) { - return invoke(&SKKEditor::HandleInput, param); -} - -State SKKController::HandleJmode() { - return invoke(&SKKEditor::HandleJmode, dummy); -} - -State SKKController::HandleEnter() { - return invoke(&SKKEditor::HandleEnter, dummy); -} - -State SKKController::HandleCancel() { - return invoke(&SKKEditor::HandleCancel, dummy); -} - -State SKKController::HandleBackSpace() { - return invoke(&SKKEditor::HandleBackSpace, dummy); -} - -State SKKController::HandleDelete() { - return invoke(&SKKEditor::HandleDelete, dummy); -} - -State SKKController::HandleTab() { - return invoke(&SKKEditor::HandleTab, dummy); -} - -State SKKController::HandlePaste() { - return invoke(&SKKEditor::HandlePaste, dummy); -} - -State SKKController::HandleCursorLeft() { - return invoke(&SKKEditor::HandleCursorLeft, dummy); -} - -State SKKController::HandleCursorRight() { - return invoke(&SKKEditor::HandleCursorRight, dummy); -} - -State SKKController::HandleCursorUp() { - return invoke(&SKKEditor::HandleCursorUp, dummy); -} - -State SKKController::HandleCursorDown() { - return invoke(&SKKEditor::HandleCursorDown, dummy); -} - -// å ¥åã¢ã¼ãå¤æ´ -void SKKController::SelectInputMode(SKK::InputMode mode) { - editor().SelectInputMode(mode); -} - -// å é¨ç¶æ å¤æ´ -void SKKController::ChangeState(SKK::EditState state) { - editor().ChangeState(state); -} - -// ç»é²éå§ -void SKKController::BeginRegistration(const std::string& prompt, State returnPoint) { - stack_.push_back(SKKRegistrationInfo(prompt, returnPoint)); -} - -// ç»é²çµäº -State SKKController::EndRegistration(bool commit) { - if(stack_.size() == 1) return 0; - - SKKRegistrationInfo info(editor().RegistrationInfo()); - std::string word(editor().EditString()); - - stack_.pop_back(); - - if(commit) { - editor().Commit(word); - } else { - editor().Commit(""); - } - - return info.ReturnPoint(); -} - -// ====================================================================== -// private method -// ====================================================================== -SKKEditor& SKKController::editor() { - return stack_.back(); -} - -const SKKEditor& SKKController::editor() const { - return stack_.back(); -} - -State SKKController::invoke(SKKEditor::Handler handler, const SKKEventParam& param) { - SKKSubController* result = (editor().*handler)(param); - - if(result) { - // SKKEditor.HandleXXX ãèµ·åãã - std::auto_ptr<SKKSubController> sub(result); - - // å¯ä½ç¨ãé©ç¨ãã - return sub->Apply(*this); - } - - return 0; -} Index: AquaSKK/src/controller/SKKController.h diff -u AquaSKK/src/controller/SKKController.h:1.1.2.3 AquaSKK/src/controller/SKKController.h:removed --- AquaSKK/src/controller/SKKController.h:1.1.2.3 Mon Sep 24 10:55:19 2007 +++ AquaSKK/src/controller/SKKController.h Sat Oct 6 00:03:54 2007 @@ -1,69 +0,0 @@ -/* -*- C++ -*- - $Id: SKKController.h,v 1.1.2.3 2007/09/24 01:55:19 t-suwa Exp $ - - 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__SKKController__ -#define INC__SKKController__ - -#include <string> -#include <vector> -#include "SKK.h" -#include "SKKEventParam.h" -#include "SKKEngine.h" -#include "SKKEditor.h" - -class SKKController : public StateContainerTraits<SKKEngine> { - std::vector<SKKEditor> stack_; - - SKKEditor& editor(); - const SKKEditor& editor() const; - - State invoke(SKKEditor::Handler handler, const SKKEventParam& param); - -public: - SKKController(); - - // ãã¼å ¥åå¦ç - State HandleInput(const SKKEventParam& param); - State HandleJmode(); - State HandleEnter(); - State HandleCancel(); - State HandleBackSpace(); - State HandleDelete(); - State HandleTab(); - State HandlePaste(); - State HandleCursorLeft(); - State HandleCursorRight(); - State HandleCursorUp(); - State HandleCursorDown(); - - // å ¥åã¢ã¼ãå¤æ´ - void SelectInputMode(SKK::InputMode); - - // å é¨ç¶æ å¤æ´ - void ChangeState(SKK::EditState); - - // å帰çè¾æ¸ç»é² - void BeginRegistration(const std::string& prompt, State returnPoint); - State EndRegistration(bool commit); -}; - -#endif Index: AquaSKK/src/controller/SKKEmptySubController.cpp diff -u AquaSKK/src/controller/SKKEmptySubController.cpp:1.1.2.1 AquaSKK/src/controller/SKKEmptySubController.cpp:removed --- AquaSKK/src/controller/SKKEmptySubController.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKEmptySubController.cpp Sat Oct 6 00:03:54 2007 @@ -1,29 +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 "SKKEmptySubController.h" - -SKKEmptySubController::SKKEmptySubController(State target) : state_(target) { -} - -SKKEmptySubController::State SKKEmptySubController::Apply(SKKController&) { - return state_; -} Index: AquaSKK/src/controller/SKKEmptySubController.h diff -u AquaSKK/src/controller/SKKEmptySubController.h:1.1.2.1 AquaSKK/src/controller/SKKEmptySubController.h:removed --- AquaSKK/src/controller/SKKEmptySubController.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKEmptySubController.h Sat Oct 6 00:03:54 2007 @@ -1,39 +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__SKKEmptySubController__ -#define INC__SKKEmptySubController__ - -#include "SKKSubController.h" - -// 空ã®ãããã¥ã¬ã¼ã¿ã¼ -class SKKEmptySubController : public SKKSubController { - State state_; - - SKKEmptySubController(); - -public: - SKKEmptySubController(State target); - - virtual State Apply(SKKController& controller); -}; - -#endif Index: AquaSKK/src/controller/SKKSubController.h diff -u AquaSKK/src/controller/SKKSubController.h:1.1.2.2 AquaSKK/src/controller/SKKSubController.h:removed --- AquaSKK/src/controller/SKKSubController.h:1.1.2.2 Sun Sep 23 23:56:54 2007 +++ AquaSKK/src/controller/SKKSubController.h Sat Oct 6 00:03:54 2007 @@ -1,32 +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__SKKSubController__ -#define INC__SKKSubController__ - -#include "SKKController.h" - -// SKKController ç¨ãããã¥ã¬ã¼ã¿ã¼ -struct SKKSubController : public StateContainerTraits<SKKEngine> { - virtual State Apply(SKKController& controller) = 0; -}; - -#endif