2006-05-19 17:18:06 +00:00
|
|
|
/*
|
|
|
|
* keybindings.h - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2008-01-06 18:11:57 +00:00
|
|
|
* Copyright 2006-2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2006-05-19 17:18:06 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GEANY_KEYBINDINGS_H
|
|
|
|
#define GEANY_KEYBINDINGS_H 1
|
|
|
|
|
2006-10-26 15:22:27 +00:00
|
|
|
typedef void (*KBCallback) (guint key_id);
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
// holds all user-definable key bindings
|
2008-01-29 16:11:18 +00:00
|
|
|
typedef struct KeyBinding
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
|
|
|
guint key;
|
|
|
|
GdkModifierType mods;
|
2007-06-03 16:03:46 +00:00
|
|
|
// at the moment only needed as keys for the configuration file because indices or translatable
|
2006-06-08 15:12:55 +00:00
|
|
|
// strings as keys are not very useful
|
2006-05-19 17:18:06 +00:00
|
|
|
const gchar *name;
|
2006-06-08 15:12:55 +00:00
|
|
|
const gchar *label;
|
2006-05-19 17:18:06 +00:00
|
|
|
// function pointer to a callback function, just to keep the code in keypress event
|
|
|
|
// callback function clear
|
2006-10-26 15:22:27 +00:00
|
|
|
KBCallback cb_func;
|
2007-07-09 13:48:41 +00:00
|
|
|
// string to use as a section name in the preferences dialog in keybinding treeview as well as
|
|
|
|
// in the keybinding help dialog, set only for the first binding in the section
|
|
|
|
gchar *section;
|
2008-01-29 16:11:18 +00:00
|
|
|
} KeyBinding;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
|
2008-02-12 15:49:54 +00:00
|
|
|
// allowed modifier keys (especially no Caps lock, no Num lock)
|
2008-02-13 09:30:20 +00:00
|
|
|
#if GTK_CHECK_VERSION(2, 10, 0)
|
|
|
|
# define GEANY_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | \
|
|
|
|
GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK)
|
|
|
|
#else
|
|
|
|
# define GEANY_KEYS_MODIFIER_MASK (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
|
|
|
|
#endif
|
2008-02-12 15:49:54 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
// Plugin API
|
2007-07-18 15:35:52 +00:00
|
|
|
typedef enum
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_FILE = 0,
|
|
|
|
GEANY_KEYS_MENU_NEW = GEANY_KEYS_GROUP_FILE,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_OPEN,
|
2007-05-03 15:38:02 +00:00
|
|
|
GEANY_KEYS_MENU_OPENSELECTED,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_SAVE,
|
2007-01-08 18:15:06 +00:00
|
|
|
GEANY_KEYS_MENU_SAVEAS,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_SAVEALL,
|
2006-06-29 17:14:52 +00:00
|
|
|
GEANY_KEYS_MENU_PRINT,
|
2006-06-21 18:54:07 +00:00
|
|
|
GEANY_KEYS_MENU_CLOSE,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_CLOSEALL,
|
|
|
|
GEANY_KEYS_MENU_RELOADFILE,
|
2007-05-03 15:38:02 +00:00
|
|
|
GEANY_KEYS_MENU_PROJECTPROPERTIES,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_EDIT,
|
|
|
|
GEANY_KEYS_MENU_UNDO = GEANY_KEYS_GROUP_EDIT,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_REDO,
|
2007-12-25 14:00:18 +00:00
|
|
|
GEANY_KEYS_MENU_CUT,
|
|
|
|
GEANY_KEYS_MENU_COPY,
|
|
|
|
GEANY_KEYS_MENU_PASTE,
|
2006-07-01 14:12:05 +00:00
|
|
|
GEANY_KEYS_MENU_SELECTALL,
|
2006-08-19 12:56:30 +00:00
|
|
|
GEANY_KEYS_MENU_INSERTDATE,
|
2006-05-24 13:18:42 +00:00
|
|
|
GEANY_KEYS_MENU_PREFERENCES,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_SEARCH,
|
|
|
|
GEANY_KEYS_MENU_FIND = GEANY_KEYS_GROUP_SEARCH,
|
2006-07-15 11:17:23 +00:00
|
|
|
GEANY_KEYS_MENU_FINDNEXT,
|
2006-05-24 13:18:42 +00:00
|
|
|
GEANY_KEYS_MENU_FINDPREVIOUS,
|
2006-07-15 11:17:23 +00:00
|
|
|
GEANY_KEYS_MENU_FINDINFILES,
|
2007-01-23 17:51:30 +00:00
|
|
|
GEANY_KEYS_MENU_REPLACE,
|
|
|
|
GEANY_KEYS_MENU_FINDNEXTSEL,
|
|
|
|
GEANY_KEYS_MENU_FINDPREVSEL,
|
2006-12-09 17:03:03 +00:00
|
|
|
GEANY_KEYS_MENU_NEXTMESSAGE,
|
2006-05-24 13:18:42 +00:00
|
|
|
GEANY_KEYS_MENU_GOTOLINE,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_VIEW,
|
|
|
|
GEANY_KEYS_MENU_TOGGLEALL = GEANY_KEYS_GROUP_VIEW,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_FULLSCREEN,
|
2006-05-21 14:02:55 +00:00
|
|
|
GEANY_KEYS_MENU_MESSAGEWINDOW,
|
2006-06-17 17:05:41 +00:00
|
|
|
GEANY_KEYS_MENU_SIDEBAR,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_ZOOMIN,
|
|
|
|
GEANY_KEYS_MENU_ZOOMOUT,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_DOCUMENT,
|
|
|
|
GEANY_KEYS_MENU_REPLACETABS = GEANY_KEYS_GROUP_DOCUMENT,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_MENU_FOLDALL,
|
|
|
|
GEANY_KEYS_MENU_UNFOLDALL,
|
2007-03-29 14:39:04 +00:00
|
|
|
GEANY_KEYS_RELOADTAGLIST,
|
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_BUILD,
|
|
|
|
GEANY_KEYS_BUILD_COMPILE = GEANY_KEYS_GROUP_BUILD,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_BUILD_LINK,
|
|
|
|
GEANY_KEYS_BUILD_MAKE,
|
|
|
|
GEANY_KEYS_BUILD_MAKEOWNTARGET,
|
2006-07-06 09:43:10 +00:00
|
|
|
GEANY_KEYS_BUILD_MAKEOBJECT,
|
2006-12-09 17:03:03 +00:00
|
|
|
GEANY_KEYS_BUILD_NEXTERROR,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_BUILD_RUN,
|
|
|
|
GEANY_KEYS_BUILD_RUN2,
|
|
|
|
GEANY_KEYS_BUILD_OPTIONS,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_TOOLS,
|
|
|
|
GEANY_KEYS_MENU_OPENCOLORCHOOSER = GEANY_KEYS_GROUP_TOOLS,
|
2007-03-29 14:39:04 +00:00
|
|
|
GEANY_KEYS_MENU_INSERTSPECIALCHARS,
|
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_HELP,
|
|
|
|
GEANY_KEYS_MENU_HELP = GEANY_KEYS_GROUP_HELP,
|
2007-07-04 14:41:58 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_FOCUS,
|
|
|
|
GEANY_KEYS_SWITCH_EDITOR = GEANY_KEYS_GROUP_FOCUS,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_SWITCH_SCRIBBLE,
|
|
|
|
GEANY_KEYS_SWITCH_VTE,
|
2007-03-30 10:38:13 +00:00
|
|
|
GEANY_KEYS_SWITCH_SEARCH_BAR,
|
2007-11-06 16:59:01 +00:00
|
|
|
|
|
|
|
GEANY_KEYS_GROUP_TABS,
|
|
|
|
GEANY_KEYS_SWITCH_TABLEFT = GEANY_KEYS_GROUP_TABS,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_SWITCH_TABRIGHT,
|
2007-03-13 17:00:12 +00:00
|
|
|
GEANY_KEYS_SWITCH_TABLASTUSED,
|
2007-09-07 12:34:57 +00:00
|
|
|
GEANY_KEYS_MOVE_TABLEFT,
|
|
|
|
GEANY_KEYS_MOVE_TABRIGHT,
|
2007-12-16 16:54:47 +00:00
|
|
|
GEANY_KEYS_MOVE_TABFIRST,
|
|
|
|
GEANY_KEYS_MOVE_TABLAST,
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_EDITING,
|
|
|
|
GEANY_KEYS_EDIT_TOGGLECASE = GEANY_KEYS_GROUP_EDITING,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_EDIT_DUPLICATELINE,
|
2007-07-07 15:12:13 +00:00
|
|
|
GEANY_KEYS_EDIT_DELETELINE,
|
|
|
|
GEANY_KEYS_EDIT_COPYLINE,
|
|
|
|
GEANY_KEYS_EDIT_CUTLINE,
|
|
|
|
GEANY_KEYS_EDIT_TRANSPOSELINE,
|
2006-09-10 11:47:26 +00:00
|
|
|
GEANY_KEYS_EDIT_COMMENTLINETOGGLE,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_EDIT_COMMENTLINE,
|
2006-07-31 09:39:33 +00:00
|
|
|
GEANY_KEYS_EDIT_UNCOMMENTLINE,
|
2006-08-01 10:35:32 +00:00
|
|
|
GEANY_KEYS_EDIT_INCREASEINDENT,
|
|
|
|
GEANY_KEYS_EDIT_DECREASEINDENT,
|
2007-07-16 15:42:12 +00:00
|
|
|
GEANY_KEYS_EDIT_INCREASEINDENTBYSPACE,
|
|
|
|
GEANY_KEYS_EDIT_DECREASEINDENTBYSPACE,
|
|
|
|
GEANY_KEYS_EDIT_AUTOINDENT,
|
2007-02-25 14:26:55 +00:00
|
|
|
GEANY_KEYS_EDIT_SENDTOCMD1,
|
|
|
|
GEANY_KEYS_EDIT_SENDTOCMD2,
|
|
|
|
GEANY_KEYS_EDIT_SENDTOCMD3,
|
2006-10-11 22:01:26 +00:00
|
|
|
GEANY_KEYS_EDIT_GOTOMATCHINGBRACE,
|
2007-03-15 13:14:04 +00:00
|
|
|
GEANY_KEYS_EDIT_TOGGLEMARKER,
|
2007-03-15 12:52:16 +00:00
|
|
|
GEANY_KEYS_EDIT_GOTONEXTMARKER,
|
|
|
|
GEANY_KEYS_EDIT_GOTOPREVIOUSMARKER,
|
2007-03-29 14:39:04 +00:00
|
|
|
GEANY_KEYS_EDIT_SELECTWORD,
|
2007-07-07 15:12:13 +00:00
|
|
|
GEANY_KEYS_EDIT_SELECTLINE,
|
2007-07-06 10:16:51 +00:00
|
|
|
GEANY_KEYS_EDIT_SELECTPARAGRAPH,
|
2007-07-17 16:27:49 +00:00
|
|
|
GEANY_KEYS_EDIT_SCROLLTOLINE,
|
2007-09-05 18:55:51 +00:00
|
|
|
GEANY_KEYS_EDIT_SCROLLLINEUP,
|
|
|
|
GEANY_KEYS_EDIT_SCROLLLINEDOWN,
|
2007-03-29 14:39:04 +00:00
|
|
|
GEANY_KEYS_EDIT_INSERTALTWHITESPACE,
|
2007-09-13 16:40:19 +00:00
|
|
|
GEANY_KEYS_POPUP_FINDUSAGE,
|
|
|
|
GEANY_KEYS_POPUP_CONTEXTACTION,
|
|
|
|
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_GROUP_TAGS,
|
|
|
|
GEANY_KEYS_EDIT_AUTOCOMPLETE = GEANY_KEYS_GROUP_TAGS,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_KEYS_EDIT_CALLTIP,
|
|
|
|
GEANY_KEYS_EDIT_MACROLIST,
|
2007-11-12 09:27:43 +00:00
|
|
|
GEANY_KEYS_EDIT_COMPLETESNIPPET,
|
|
|
|
GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION,
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_POPUP_GOTOTAGDEFINITION,
|
|
|
|
GEANY_KEYS_POPUP_GOTOTAGDECLARATION,
|
|
|
|
|
|
|
|
GEANY_KEYS_GROUP_OTHER,
|
|
|
|
GEANY_KEYS_NAV_FORWARD = GEANY_KEYS_GROUP_OTHER,
|
|
|
|
GEANY_KEYS_NAV_BACK,
|
2006-05-19 17:18:06 +00:00
|
|
|
GEANY_MAX_KEYS
|
2007-07-18 15:35:52 +00:00
|
|
|
}
|
|
|
|
GeanyKeyCommand;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
extern KeyBinding *keys[GEANY_MAX_KEYS];
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
void keybindings_init(void);
|
|
|
|
|
|
|
|
void keybindings_free(void);
|
|
|
|
|
2007-07-18 15:35:52 +00:00
|
|
|
void keybindings_cmd(GeanyKeyCommand cmd_id);
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
/* just write the content of the keys array to the config file */
|
|
|
|
void keybindings_write_to_file(void);
|
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void keybindings_show_shortcuts(void);
|
2007-03-23 16:34:54 +00:00
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
/* central keypress event handler, almost all keypress events go to this function */
|
|
|
|
gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|