diff options
author | Peng Wu <alexepico@gmail.com> | 2010-05-07 11:12:27 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-05-19 10:09:33 +0800 |
commit | 31a21dbb7c449813d61459a1a232dbbd0b576d1e (patch) | |
tree | 4e253bcc79c3fa2f5153e643162d0b75a0ac4ea3 /src | |
parent | e2295b71251476650fb376a3d973c53e0c319bdc (diff) | |
download | ibus-pinyin-31a21dbb7c449813d61459a1a232dbbd0b576d1e.tar.gz |
begin to write input logic.
Diffstat (limited to 'src')
-rw-r--r-- | src/ExtEditor.cc | 40 | ||||
-rw-r--r-- | src/ExtEditor.h | 9 |
2 files changed, 48 insertions, 1 deletions
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); |