[aquaskk-changes 352] CVS update: AquaSKK/src/editor

Zurück zum Archiv-Index

t-suw****@users***** t-suw****@users*****
2007年 9月 2日 (日) 12:36:25 JST


Index: AquaSKK/src/editor/SKKDirectInputState.cpp
diff -u /dev/null AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.1
--- /dev/null	Sun Sep  2 12:36:25 2007
+++ AquaSKK/src/editor/SKKDirectInputState.cpp	Sun Sep  2 12:36:25 2007
@@ -0,0 +1,77 @@
+/* -*- 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 "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) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleEnter(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleJmode(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleDelete(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleTab(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandlePaste(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleCursorRight(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleCursorUp(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
+
+SKKSubController* SKKDirectInputState::HandleCursorDown(SKKContext& context, const SKKEventParam& param) {
+    return new SKKEmptySubController(0);
+}
Index: AquaSKK/src/editor/SKKDirectInputState.h
diff -u /dev/null AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.1
--- /dev/null	Sun Sep  2 12:36:25 2007
+++ AquaSKK/src/editor/SKKDirectInputState.h	Sun Sep  2 12:36:25 2007
@@ -0,0 +1,44 @@
+/* -*- 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__SKKDirectState__
+#define INC__SKKDirectState__
+
+#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 /dev/null AquaSKK/src/editor/SKKEditor.cpp:1.1.2.1
--- /dev/null	Sun Sep  2 12:36:25 2007
+++ AquaSKK/src/editor/SKKEditor.cpp	Sun Sep  2 12:36:25 2007
@@ -0,0 +1,126 @@
+/* -*- 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"
+
+SKKEditor::SKKEditor() {
+    initialize();
+}
+
+SKKEditor::SKKEditor(const std::string& prompt) : context_(prompt) {
+    initialize();
+}
+
+SKKEditor::SKKEditor(const SKKEditor& src) : context_(src.context_), state_(src.state_) {
+}
+
+// 処理結果
+const SKKEventResult& SKKEditor::Result() const {
+    return context_.Result();
+}
+
+// ======================================================================
+// キー入力は全て状態クラスに移譲する
+// ======================================================================
+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) {
+
+}
+
+// 内部状態変更
+void SKKEditor::ChangeState(SKK::EditState state) {
+    switch(state) {
+    case SKK::DirectInput:
+	state_ = &SKKDirectInputState::theInstance();
+	break;
+
+    case SKK::EntryInput:
+    case SKK::OkuriInput:
+    case SKK::AbbrevInput:
+    case SKK::Completion:
+    case SKK::SingleCandidate:
+    case SKK::MultipleCandidate:
+    case SKK::EntryRemove:
+	break;
+    }
+}
+
+std::string SKKEditor::EditString() const {
+    return "";
+}
+
+void SKKEditor::Commit(const std::string& word) {
+}
+
+// ======================================================================
+// private method
+// ======================================================================
+void SKKEditor::initialize() {
+    state_ = &SKKDirectInputState::theInstance();
+}
Index: AquaSKK/src/editor/SKKEditor.h
diff -u /dev/null AquaSKK/src/editor/SKKEditor.h:1.1.2.1
--- /dev/null	Sun Sep  2 12:36:25 2007
+++ AquaSKK/src/editor/SKKEditor.h	Sun Sep  2 12:36:25 2007
@@ -0,0 +1,77 @@
+/* -*- 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 "SKKContext.h"
+
+class SKKState;
+class SKKSubController;
+class SKKEventParam;
+class SKKEventResult;
+
+// 編集インタフェース
+class SKKEditor {
+    SKKContext context_;
+    SKKState* state_;
+
+    void initialize();
+
+public:
+    // キー入力ハンドラー
+    typedef SKKSubController* (SKKEditor::*Handler)(const SKKEventParam&);
+
+    SKKEditor();
+    SKKEditor(const std::string& prompt);
+    SKKEditor(const SKKEditor& src);
+
+    // 処理結果
+    const SKKEventResult& Result() const;
+
+    // キー入力処理
+    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);
+
+    // 編集文字列を取得
+    std::string EditString() const;
+
+    // 確定した文字列を反映
+    void Commit(const std::string& word);
+};
+
+#endif  // INC__SKKEditor__
Index: AquaSKK/src/editor/SKKState.h
diff -u /dev/null AquaSKK/src/editor/SKKState.h:1.1.2.1
--- /dev/null	Sun Sep  2 12:36:25 2007
+++ AquaSKK/src/editor/SKKState.h	Sun Sep  2 12:36:25 2007
@@ -0,0 +1,44 @@
+/* -*- 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__
+
+class SKKContext;
+class SKKEventParam;
+class SKKSubController;
+
+// 状態クラスインタフェース
+struct SKKState {
+    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


aquaskk-changes メーリングリストの案内
Zurück zum Archiv-Index