From 31a21dbb7c449813d61459a1a232dbbd0b576d1e Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 7 May 2010 11:12:27 +0800 Subject: begin to write input logic. --- src/ExtEditor.cc | 40 +++++++++++++++++++++++++++++++++++++++- src/ExtEditor.h | 9 +++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ExtEditor.cc b/src/ExtEditor.cc index f4a2d7d..05f7932 100644 --- a/src/ExtEditor.cc +++ b/src/ExtEditor.cc @@ -2,6 +2,10 @@ namespace PY { +/* Write digit/alpha/none Label generator here. + * foreach (results): 1, from get_retval; 2..n from get_retvals. + */ + ExtEditor::ExtEditor (PinyinProperties & props) : Editor (props) { @@ -30,9 +34,28 @@ ExtEditor::resetLuaState() gboolean ExtEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers) { + modifiers &= (IBUS_SHIFT_MASK | + IBUS_CONTROL_MASK | + IBUS_MOD1_MASK | + IBUS_SUPER_MASK | + IBUS_HYPER_MASK | + IBUS_META_MASK | + IBUS_LOCK_MASK); + if ( modifiers ) + return FALSE; + /* Remember the input string. */ + switch (keyval){ + case IBUS_a ... IBUS_z: + break; + case IBUS_0 ... IBUS_9: + case IBUS_KP_0 ... IBUS_KP_9: + break; + } + /* Deal other staff with updateStateFromInput(). */ - return false; + updateStateFromInput(); + return FALSE; } void @@ -125,6 +148,21 @@ ExtEditor::fillCommandCandidates(std::string prefix) return true; } +bool +ExtEditor::fillCommand(std::string command_name, const char * argument){ + lua_command_t * command = ibus_engine_plugin_lookup_command(m_lua_plugin, command_name.c_str()); + if ( NULL == command ) + return false; + + int result_num = ibus_engine_plugin_call(m_lua_plugin, command->lua_function_name, argument); + + + + + return true; +} + + void ExtEditor::clearLookupTable() { diff --git a/src/ExtEditor.h b/src/ExtEditor.h index 8fdfb41..030efdd 100644 --- a/src/ExtEditor.h +++ b/src/ExtEditor.h @@ -14,6 +14,15 @@ extern "C" { namespace PY { +enum ExtEditorLabelMode{ + LABEL_NONE, + LABEL_LIST_COMMANDS, + LABEL_LIST_NONE, + LABEL_LIST_DIGIT, + LABEL_LIST_ALPHA, + LABEL_LAST, +}; + class ExtEditor : public Editor { public: ExtEditor (PinyinProperties &props); -- cgit v1.2.1