Kaydet (Commit) 83f7b577 authored tarafından Nick Treleaven's avatar Nick Treleaven

Move snippet completion keybindings into Editing group.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/plugin-keybindings@2322 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst e57535bb
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
Load keybindings keyfile after plugins have loaded at startup, so Load keybindings keyfile after plugins have loaded at startup, so
their shortcuts are also loaded. Still to do: loading individual their shortcuts are also loaded. Still to do: loading individual
plugin keybindings after startup. plugin keybindings after startup.
* src/keybindings.c, src/keybindings.h:
Move snippet completion keybindings into Editing group.
2008-03-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2008-03-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
...@@ -385,6 +385,10 @@ static void init_default_kb(void) ...@@ -385,6 +385,10 @@ static void init_default_kb(void)
GDK_Down, GDK_MOD1_MASK, "edit_scrolllinedown", _("Scroll down the view by one line"), NULL); GDK_Down, GDK_MOD1_MASK, "edit_scrolllinedown", _("Scroll down the view by one line"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_INSERTALTWHITESPACE, cb_func_editing, keybindings_set_item(group, GEANY_KEYS_EDIT_INSERTALTWHITESPACE, cb_func_editing,
0, 0, "edit_insertwhitespace", _("Insert alternative whitespace"), NULL); 0, 0, "edit_insertwhitespace", _("Insert alternative whitespace"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_COMPLETESNIPPET, NULL, /* handled specially in check_snippet_completion() */
GDK_Tab, 0, "edit_completesnippet", _("Complete snippet"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION, cb_func_editing,
0, 0, "edit_suppresssnippetcompletion", _("Suppress snippet completion"), NULL);
/* popup menu editing commands */ /* popup menu editing commands */
keybindings_set_item(group, GEANY_KEYS_POPUP_FINDUSAGE, cb_func_current_word, keybindings_set_item(group, GEANY_KEYS_POPUP_FINDUSAGE, cb_func_current_word,
...@@ -400,10 +404,6 @@ static void init_default_kb(void) ...@@ -400,10 +404,6 @@ static void init_default_kb(void)
GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"), NULL); GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_MACROLIST, cb_func_tags, keybindings_set_item(group, GEANY_KEYS_EDIT_MACROLIST, cb_func_tags,
GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list"), NULL); GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_COMPLETESNIPPET, NULL, /* has special callback */
GDK_Tab, 0, "edit_completesnippet", _("Complete snippet"), NULL);
keybindings_set_item(group, GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION, cb_func_tags,
0, 0, "edit_suppresssnippetcompletion", _("Suppress snippet completion"), NULL);
keybindings_set_item(group, GEANY_KEYS_POPUP_GOTOTAGDEFINITION, cb_func_current_word, keybindings_set_item(group, GEANY_KEYS_POPUP_GOTOTAGDEFINITION, cb_func_current_word,
0, 0, "popup_gototagdefinition", _("Go to Tag Definition"), NULL); 0, 0, "popup_gototagdefinition", _("Go to Tag Definition"), NULL);
keybindings_set_item(group, GEANY_KEYS_POPUP_GOTOTAGDECLARATION, cb_func_current_word, keybindings_set_item(group, GEANY_KEYS_POPUP_GOTOTAGDECLARATION, cb_func_current_word,
...@@ -792,7 +792,7 @@ static gboolean check_fixed_kb(guint keyval, guint state) ...@@ -792,7 +792,7 @@ static gboolean check_fixed_kb(guint keyval, guint state)
* return FALSE if no completion occurs, so the tab or space is handled normally. */ * return FALSE if no completion occurs, so the tab or space is handled normally. */
static gboolean check_snippet_completion(guint keyval, guint state) static gboolean check_snippet_completion(guint keyval, guint state)
{ {
KeyBinding *kb = keybindings_lookup_item(GEANY_KEYGROUP_TAGS, KeyBinding *kb = keybindings_lookup_item(GEANY_KEYGROUP_EDITING,
GEANY_KEYS_EDIT_COMPLETESNIPPET); GEANY_KEYS_EDIT_COMPLETESNIPPET);
if (kb->key == keyval && kb->mods == state) if (kb->key == keyval && kb->mods == state)
...@@ -1461,6 +1461,24 @@ static void cb_func_editing(guint key_id) ...@@ -1461,6 +1461,24 @@ static void cb_func_editing(guint key_id)
if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2) if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2)
tools_execute_custom_command(idx, ui_prefs.custom_commands[2]); tools_execute_custom_command(idx, ui_prefs.custom_commands[2]);
break; break;
case GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION:
{
KeyBinding *kb = keybindings_lookup_item(GEANY_KEYGROUP_EDITING,
GEANY_KEYS_EDIT_COMPLETESNIPPET);
switch (kb->key)
{
case GDK_space:
sci_add_text(doc_list[idx].sci, " ");
break;
case GDK_Tab:
sci_cmd(doc_list[idx].sci, SCI_TAB);
break;
default:
break;
}
break;
}
} }
} }
...@@ -1485,24 +1503,6 @@ static void cb_func_tags(guint key_id) ...@@ -1485,24 +1503,6 @@ static void cb_func_tags(guint key_id)
case GEANY_KEYS_EDIT_MACROLIST: case GEANY_KEYS_EDIT_MACROLIST:
editor_show_macro_list(doc_list[idx].sci); editor_show_macro_list(doc_list[idx].sci);
break; break;
case GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION:
{
KeyBinding *kb = keybindings_lookup_item(GEANY_KEYGROUP_TAGS,
GEANY_KEYS_EDIT_COMPLETESNIPPET);
switch (kb->key)
{
case GDK_space:
sci_add_text(doc_list[idx].sci, " ");
break;
case GDK_Tab:
sci_cmd(doc_list[idx].sci, SCI_TAB);
break;
default:
break;
}
break;
}
} }
} }
......
...@@ -66,7 +66,7 @@ KeyBindingGroup; ...@@ -66,7 +66,7 @@ KeyBindingGroup;
extern GPtrArray *keybinding_groups; /* array of KeyBindingGroup pointers */ extern GPtrArray *keybinding_groups; /* array of KeyBindingGroup pointers */
/* Plugin API enums - append only to maintain plugin ABI */ /** Keybinding group IDs */
enum enum
{ {
GEANY_KEYGROUP_FILE, GEANY_KEYGROUP_FILE,
...@@ -85,6 +85,7 @@ enum ...@@ -85,6 +85,7 @@ enum
GEANY_KEYGROUP_COUNT GEANY_KEYGROUP_COUNT
}; };
/** File group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_NEW, GEANY_KEYS_MENU_NEW,
...@@ -101,6 +102,7 @@ enum ...@@ -101,6 +102,7 @@ enum
GEANY_KEYS_FILE_COUNT GEANY_KEYS_FILE_COUNT
}; };
/** Edit group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_UNDO, GEANY_KEYS_MENU_UNDO,
...@@ -114,6 +116,7 @@ enum ...@@ -114,6 +116,7 @@ enum
GEANY_KEYS_EDIT_COUNT GEANY_KEYS_EDIT_COUNT
}; };
/** Search group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_FIND, GEANY_KEYS_MENU_FIND,
...@@ -128,6 +131,7 @@ enum ...@@ -128,6 +131,7 @@ enum
GEANY_KEYS_SEARCH_COUNT GEANY_KEYS_SEARCH_COUNT
}; };
/** View group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_TOGGLEALL, GEANY_KEYS_MENU_TOGGLEALL,
...@@ -139,6 +143,7 @@ enum ...@@ -139,6 +143,7 @@ enum
GEANY_KEYS_VIEW_COUNT GEANY_KEYS_VIEW_COUNT
}; };
/** Document group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_REPLACETABS, GEANY_KEYS_MENU_REPLACETABS,
...@@ -148,6 +153,7 @@ enum ...@@ -148,6 +153,7 @@ enum
GEANY_KEYS_DOCUMENT_COUNT GEANY_KEYS_DOCUMENT_COUNT
}; };
/** Build group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_BUILD_COMPILE, GEANY_KEYS_BUILD_COMPILE,
...@@ -162,18 +168,21 @@ enum ...@@ -162,18 +168,21 @@ enum
GEANY_KEYS_BUILD_COUNT GEANY_KEYS_BUILD_COUNT
}; };
/** Tools group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_OPENCOLORCHOOSER, GEANY_KEYS_MENU_OPENCOLORCHOOSER,
GEANY_KEYS_TOOLS_COUNT GEANY_KEYS_TOOLS_COUNT
}; };
/** Help group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_MENU_HELP, GEANY_KEYS_MENU_HELP,
GEANY_KEYS_HELP_COUNT GEANY_KEYS_HELP_COUNT
}; };
/** Focus group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_SWITCH_EDITOR, GEANY_KEYS_SWITCH_EDITOR,
...@@ -183,6 +192,7 @@ enum ...@@ -183,6 +192,7 @@ enum
GEANY_KEYS_FOCUS_COUNT GEANY_KEYS_FOCUS_COUNT
}; };
/** Notebook tab group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_SWITCH_TABLEFT, GEANY_KEYS_SWITCH_TABLEFT,
...@@ -195,6 +205,7 @@ enum ...@@ -195,6 +205,7 @@ enum
GEANY_KEYS_NOTEBOOK_COUNT GEANY_KEYS_NOTEBOOK_COUNT
}; };
/** Editing group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_EDIT_TOGGLECASE, GEANY_KEYS_EDIT_TOGGLECASE,
...@@ -225,23 +236,25 @@ enum ...@@ -225,23 +236,25 @@ enum
GEANY_KEYS_EDIT_SCROLLLINEUP, GEANY_KEYS_EDIT_SCROLLLINEUP,
GEANY_KEYS_EDIT_SCROLLLINEDOWN, GEANY_KEYS_EDIT_SCROLLLINEDOWN,
GEANY_KEYS_EDIT_INSERTALTWHITESPACE, GEANY_KEYS_EDIT_INSERTALTWHITESPACE,
GEANY_KEYS_EDIT_COMPLETESNIPPET,
GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION,
GEANY_KEYS_POPUP_FINDUSAGE, GEANY_KEYS_POPUP_FINDUSAGE,
GEANY_KEYS_POPUP_CONTEXTACTION, GEANY_KEYS_POPUP_CONTEXTACTION,
GEANY_KEYS_EDITING_COUNT GEANY_KEYS_EDITING_COUNT
}; };
/** Tags group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_EDIT_AUTOCOMPLETE, GEANY_KEYS_EDIT_AUTOCOMPLETE,
GEANY_KEYS_EDIT_CALLTIP, GEANY_KEYS_EDIT_CALLTIP,
GEANY_KEYS_EDIT_MACROLIST, GEANY_KEYS_EDIT_MACROLIST,
GEANY_KEYS_EDIT_COMPLETESNIPPET,
GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION,
GEANY_KEYS_POPUP_GOTOTAGDEFINITION, GEANY_KEYS_POPUP_GOTOTAGDEFINITION,
GEANY_KEYS_POPUP_GOTOTAGDECLARATION, GEANY_KEYS_POPUP_GOTOTAGDECLARATION,
GEANY_KEYS_TAGS_COUNT GEANY_KEYS_TAGS_COUNT
}; };
/** Other group keybinding command IDs */
enum enum
{ {
GEANY_KEYS_NAV_FORWARD, GEANY_KEYS_NAV_FORWARD,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment