From f1e323f1583f1b1c19066153b6d1d77d386d5e3c Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 6 Nov 2007 16:59:01 +0000 Subject: [PATCH] Make VTE interpret all keyboard shortcuts except for focus group keybindings. Add enum values for keybinding groups. Make Notebook tabs keybindings group. Move Go to tags items into Tags keybindings group. Move navigation items into a new Other keybindings group. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2027 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 ++++++ TODO | 2 -- src/keybindings.c | 54 +++++++++++++++++------------------------------ src/keybindings.h | 49 +++++++++++++++++++++++++++--------------- src/plugindata.h | 4 ++-- 5 files changed, 60 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index d050d580..25dc4021 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,13 @@ Capitalize revert menu item. * src/interface.c, src/callbacks.c, src/callbacks.h, geany.glade: Add 'Strip Trailing Spaces' document menu item. + * src/keybindings.c, src/keybindings.h, src/plugindata.h, TODO: + Make VTE interpret all keyboard shortcuts except for focus group + keybindings. + Add enum values for keybinding groups. + Make Notebook tabs keybindings group. + Move Go to tags items into Tags keybindings group. + Move navigation items into a new Other keybindings group. 2007-11-05 Nick Treleaven diff --git a/TODO b/TODO index a817979a..e46c07e3 100644 --- a/TODO +++ b/TODO @@ -6,8 +6,6 @@ TODO List: o fix bug that prevents UTF-16, UTF-32 files from being loaded. o tagmanager fails on UTF-16/32 o fix parsing command line args after given filenames - o make the VTE interpret keybindings first (not just some bash - shortcuts). Next version or later: diff --git a/src/keybindings.c b/src/keybindings.c index 0b2f7570..e28285b9 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -355,17 +355,19 @@ void keybindings_init(void) load_user_kb(); // set section name - keys[GEANY_KEYS_MENU_NEW]->section = _("File menu"); - keys[GEANY_KEYS_MENU_UNDO]->section = _("Edit menu"); - keys[GEANY_KEYS_MENU_FIND]->section = _("Search menu"); - keys[GEANY_KEYS_MENU_TOGGLEALL]->section = _("View menu"); - keys[GEANY_KEYS_MENU_REPLACETABS]->section = _("Document menu"); - keys[GEANY_KEYS_BUILD_COMPILE]->section = _("Build menu"); - keys[GEANY_KEYS_MENU_OPENCOLORCHOOSER]->section = _("Tools menu"); - keys[GEANY_KEYS_MENU_HELP]->section = _("Help menu"); - keys[GEANY_KEYS_SWITCH_EDITOR]->section = _("Focus commands"); - keys[GEANY_KEYS_EDIT_TOGGLECASE]->section = _("Editing commands"); - keys[GEANY_KEYS_EDIT_AUTOCOMPLETE]->section = _("Tag commands"); + keys[GEANY_KEYS_GROUP_FILE]->section = _("File menu"); + keys[GEANY_KEYS_GROUP_EDIT]->section = _("Edit menu"); + keys[GEANY_KEYS_GROUP_SEARCH]->section = _("Search menu"); + keys[GEANY_KEYS_GROUP_VIEW]->section = _("View menu"); + keys[GEANY_KEYS_GROUP_DOCUMENT]->section = _("Document menu"); + keys[GEANY_KEYS_GROUP_BUILD]->section = _("Build menu"); + keys[GEANY_KEYS_GROUP_TOOLS]->section = _("Tools menu"); + keys[GEANY_KEYS_GROUP_HELP]->section = _("Help menu"); + keys[GEANY_KEYS_GROUP_FOCUS]->section = _("Focus commands"); + keys[GEANY_KEYS_GROUP_TABS]->section = _("Notebook tab commands"); + keys[GEANY_KEYS_GROUP_EDITING]->section = _("Editing commands"); + keys[GEANY_KEYS_GROUP_TAGS]->section = _("Tag commands"); + keys[GEANY_KEYS_GROUP_OTHER]->section = _("Other commands"); add_menu_accels(); } @@ -680,40 +682,22 @@ static gboolean set_sensitive(gpointer widget) #ifdef HAVE_VTE static gboolean check_vte(GdkEventKey *event, guint keyval) { + guint i; GtkWidget *widget; if (! vc->enable_bash_keys) return FALSE; if (gtk_window_get_focus(GTK_WINDOW(app->window)) != vc->vte) return FALSE; - if (event->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK) && - (keyval == GDK_c || keyval == GDK_v)) // copy/paste - return TRUE; - if (event->state != GDK_CONTROL_MASK) - return FALSE; + if (event->state == 0) + return FALSE; // just to prevent menubar flickering - // Check Ctrl-[a-z] terminal shortcuts - switch (keyval) + // make focus commands override any bash commands + for (i = GEANY_KEYS_GROUP_FOCUS; i < GEANY_KEYS_GROUP_TABS; i++) { - case GDK_a: - case GDK_c: - case GDK_d: - case GDK_e: - case GDK_l: - case GDK_k: - case GDK_q: - case GDK_r: - case GDK_s: - case GDK_u: - case GDK_w: - case GDK_z: - break; - default: + if (event->state == keys[i]->mods && keyval == keys[i]->key) return FALSE; } - if (event->state == keys[GEANY_KEYS_SWITCH_EDITOR]->mods && - keyval == keys[GEANY_KEYS_SWITCH_EDITOR]->key) - return FALSE; // make switch to editor override any bash commands /* Temporarily disable the menus to prevent conflicting menu accelerators * from overriding the VTE bash shortcuts. diff --git a/src/keybindings.h b/src/keybindings.h index e67159e0..861dd2c1 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -45,9 +45,11 @@ typedef struct binding } binding; +// Plugin API typedef enum { - GEANY_KEYS_MENU_NEW = 0, + GEANY_KEYS_GROUP_FILE = 0, + GEANY_KEYS_MENU_NEW = GEANY_KEYS_GROUP_FILE, GEANY_KEYS_MENU_OPEN, GEANY_KEYS_MENU_OPENSELECTED, GEANY_KEYS_MENU_SAVE, @@ -59,13 +61,15 @@ typedef enum GEANY_KEYS_MENU_RELOADFILE, GEANY_KEYS_MENU_PROJECTPROPERTIES, - GEANY_KEYS_MENU_UNDO, + GEANY_KEYS_GROUP_EDIT, + GEANY_KEYS_MENU_UNDO = GEANY_KEYS_GROUP_EDIT, GEANY_KEYS_MENU_REDO, GEANY_KEYS_MENU_SELECTALL, GEANY_KEYS_MENU_INSERTDATE, GEANY_KEYS_MENU_PREFERENCES, - GEANY_KEYS_MENU_FIND, + GEANY_KEYS_GROUP_SEARCH, + GEANY_KEYS_MENU_FIND = GEANY_KEYS_GROUP_SEARCH, GEANY_KEYS_MENU_FINDNEXT, GEANY_KEYS_MENU_FINDPREVIOUS, GEANY_KEYS_MENU_FINDINFILES, @@ -75,19 +79,22 @@ typedef enum GEANY_KEYS_MENU_NEXTMESSAGE, GEANY_KEYS_MENU_GOTOLINE, - GEANY_KEYS_MENU_TOGGLEALL, + GEANY_KEYS_GROUP_VIEW, + GEANY_KEYS_MENU_TOGGLEALL = GEANY_KEYS_GROUP_VIEW, GEANY_KEYS_MENU_FULLSCREEN, GEANY_KEYS_MENU_MESSAGEWINDOW, GEANY_KEYS_MENU_SIDEBAR, GEANY_KEYS_MENU_ZOOMIN, GEANY_KEYS_MENU_ZOOMOUT, - GEANY_KEYS_MENU_REPLACETABS, + GEANY_KEYS_GROUP_DOCUMENT, + GEANY_KEYS_MENU_REPLACETABS = GEANY_KEYS_GROUP_DOCUMENT, GEANY_KEYS_MENU_FOLDALL, GEANY_KEYS_MENU_UNFOLDALL, GEANY_KEYS_RELOADTAGLIST, - GEANY_KEYS_BUILD_COMPILE, + GEANY_KEYS_GROUP_BUILD, + GEANY_KEYS_BUILD_COMPILE = GEANY_KEYS_GROUP_BUILD, GEANY_KEYS_BUILD_LINK, GEANY_KEYS_BUILD_MAKE, GEANY_KEYS_BUILD_MAKEOWNTARGET, @@ -97,24 +104,28 @@ typedef enum GEANY_KEYS_BUILD_RUN2, GEANY_KEYS_BUILD_OPTIONS, - GEANY_KEYS_MENU_OPENCOLORCHOOSER, + GEANY_KEYS_GROUP_TOOLS, + GEANY_KEYS_MENU_OPENCOLORCHOOSER = GEANY_KEYS_GROUP_TOOLS, GEANY_KEYS_MENU_INSERTSPECIALCHARS, - GEANY_KEYS_MENU_HELP, + GEANY_KEYS_GROUP_HELP, + GEANY_KEYS_MENU_HELP = GEANY_KEYS_GROUP_HELP, - GEANY_KEYS_SWITCH_EDITOR, + GEANY_KEYS_GROUP_FOCUS, + GEANY_KEYS_SWITCH_EDITOR = GEANY_KEYS_GROUP_FOCUS, GEANY_KEYS_SWITCH_SCRIBBLE, GEANY_KEYS_SWITCH_VTE, GEANY_KEYS_SWITCH_SEARCH_BAR, - GEANY_KEYS_SWITCH_TABLEFT, + + GEANY_KEYS_GROUP_TABS, + GEANY_KEYS_SWITCH_TABLEFT = GEANY_KEYS_GROUP_TABS, GEANY_KEYS_SWITCH_TABRIGHT, GEANY_KEYS_SWITCH_TABLASTUSED, GEANY_KEYS_MOVE_TABLEFT, GEANY_KEYS_MOVE_TABRIGHT, - GEANY_KEYS_NAV_FORWARD, - GEANY_KEYS_NAV_BACK, - GEANY_KEYS_EDIT_TOGGLECASE, + GEANY_KEYS_GROUP_EDITING, + GEANY_KEYS_EDIT_TOGGLECASE = GEANY_KEYS_GROUP_EDITING, GEANY_KEYS_EDIT_DUPLICATELINE, GEANY_KEYS_EDIT_DELETELINE, GEANY_KEYS_EDIT_COPYLINE, @@ -142,17 +153,21 @@ typedef enum GEANY_KEYS_EDIT_SCROLLLINEUP, GEANY_KEYS_EDIT_SCROLLLINEDOWN, GEANY_KEYS_EDIT_INSERTALTWHITESPACE, - GEANY_KEYS_POPUP_FINDUSAGE, - GEANY_KEYS_POPUP_GOTOTAGDEFINITION, - GEANY_KEYS_POPUP_GOTOTAGDECLARATION, GEANY_KEYS_POPUP_CONTEXTACTION, - GEANY_KEYS_EDIT_AUTOCOMPLETE, + GEANY_KEYS_GROUP_TAGS, + GEANY_KEYS_EDIT_AUTOCOMPLETE = GEANY_KEYS_GROUP_TAGS, GEANY_KEYS_EDIT_CALLTIP, GEANY_KEYS_EDIT_MACROLIST, GEANY_KEYS_EDIT_COMPLETECONSTRUCT, GEANY_KEYS_EDIT_SUPPRESSCOMPLETION, + GEANY_KEYS_POPUP_GOTOTAGDEFINITION, + GEANY_KEYS_POPUP_GOTOTAGDECLARATION, + + GEANY_KEYS_GROUP_OTHER, + GEANY_KEYS_NAV_FORWARD = GEANY_KEYS_GROUP_OTHER, + GEANY_KEYS_NAV_BACK, GEANY_MAX_KEYS } GeanyKeyCommand; diff --git a/src/plugindata.h b/src/plugindata.h index d032bc55..d786fe5a 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -71,12 +71,12 @@ /* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 27; +static const gint api_version = 28; /* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields * are only appended, as this doesn't affect existing fields. */ -static const gint abi_version = 13; +static const gint abi_version = 14; /* This performs runtime checks that try to ensure: * 1. Geany ABI data types are compatible with this plugin.