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$
|
|
|
|
*/
|
|
|
|
|
2008-03-07 17:23:35 +00:00
|
|
|
/**
|
|
|
|
* @file keybindings.h
|
|
|
|
* Configurable keyboard shortcuts.
|
|
|
|
**/
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
#ifndef GEANY_KEYBINDINGS_H
|
|
|
|
#define GEANY_KEYBINDINGS_H 1
|
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
/* allowed modifier keys (especially NOT Caps lock, no Num lock) */
|
|
|
|
#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-03-10 13:23:57 +00:00
|
|
|
typedef void (*KeyCallback) (guint key_id);
|
2006-10-26 15:22:27 +00:00
|
|
|
|
2008-03-07 17:23:35 +00:00
|
|
|
/** Represents a single keybinding action */
|
2008-01-29 16:11:18 +00:00
|
|
|
typedef struct KeyBinding
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
2008-03-07 17:23:35 +00:00
|
|
|
guint key; /**< Key value in lower-case, such as @c GDK_a */
|
|
|
|
GdkModifierType mods; /**< Modifier keys, such as @c GDK_CONTROL_MASK */
|
|
|
|
const gchar *name; /**< Key name for the configuration file, such as @c "menu_new" */
|
|
|
|
const gchar *label; /**< Label used in the preferences dialog keybindings tab */
|
2008-03-10 13:23:57 +00:00
|
|
|
KeyCallback callback; /**< Callback function called when the key combination is pressed */
|
|
|
|
GtkWidget *menu_item; /**< Menu item widget for setting the menu accelerator */
|
2008-01-29 16:11:18 +00:00
|
|
|
} KeyBinding;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
|
2008-03-07 17:23:35 +00:00
|
|
|
/** A collection of keybindings grouped together. */
|
2008-02-29 19:30:28 +00:00
|
|
|
typedef struct KeyBindingGroup
|
|
|
|
{
|
2008-03-07 17:23:35 +00:00
|
|
|
const gchar *name; /**< Group name used in the configuration file, such as @c "html_chars" */
|
|
|
|
const gchar *label; /**< Group label used in the preferences dialog keybindings tab */
|
|
|
|
gsize count; /**< Count of KeyBinding structs in @a keys */
|
|
|
|
KeyBinding *keys; /**< Fixed array of KeyBinding structs */
|
2008-02-29 19:30:28 +00:00
|
|
|
}
|
|
|
|
KeyBindingGroup;
|
|
|
|
|
|
|
|
extern GPtrArray *keybinding_groups; /* array of KeyBindingGroup pointers */
|
2008-02-12 15:49:54 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
|
|
|
|
/* Plugin API enums - append only to maintain plugin ABI */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYGROUP_FILE,
|
|
|
|
GEANY_KEYGROUP_EDIT,
|
|
|
|
GEANY_KEYGROUP_SEARCH,
|
|
|
|
GEANY_KEYGROUP_VIEW,
|
|
|
|
GEANY_KEYGROUP_DOCUMENT,
|
|
|
|
GEANY_KEYGROUP_BUILD,
|
|
|
|
GEANY_KEYGROUP_TOOLS,
|
|
|
|
GEANY_KEYGROUP_HELP,
|
|
|
|
GEANY_KEYGROUP_FOCUS,
|
|
|
|
GEANY_KEYGROUP_NOTEBOOK,
|
|
|
|
GEANY_KEYGROUP_EDITING,
|
|
|
|
GEANY_KEYGROUP_TAGS,
|
|
|
|
GEANY_KEYGROUP_OTHER,
|
|
|
|
GEANY_KEYGROUP_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_MENU_NEW,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_FILE_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_UNDO,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_EDIT_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_FIND,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_SEARCH_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_TOGGLEALL,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_VIEW_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_REPLACETABS,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_DOCUMENT_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_BUILD_COMPILE,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_BUILD_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_OPENCOLORCHOOSER,
|
|
|
|
GEANY_KEYS_TOOLS_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_MENU_HELP,
|
|
|
|
GEANY_KEYS_HELP_COUNT
|
|
|
|
};
|
2007-07-04 14:41:58 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_SWITCH_EDITOR,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_FOCUS_COUNT
|
|
|
|
};
|
2007-11-06 16:59:01 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_SWITCH_TABLEFT,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_NOTEBOOK_COUNT
|
|
|
|
};
|
2007-03-29 14:39:04 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_EDIT_TOGGLECASE,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_EDITING_COUNT
|
|
|
|
};
|
2007-09-13 16:40:19 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_EDIT_AUTOCOMPLETE,
|
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,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_TAGS_COUNT
|
|
|
|
};
|
2007-11-06 16:59:01 +00:00
|
|
|
|
2008-02-29 19:30:28 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GEANY_KEYS_NAV_FORWARD,
|
2007-11-06 16:59:01 +00:00
|
|
|
GEANY_KEYS_NAV_BACK,
|
2008-02-29 19:30:28 +00:00
|
|
|
GEANY_KEYS_OTHER_COUNT
|
|
|
|
};
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
void keybindings_init(void);
|
|
|
|
|
2008-03-10 13:54:47 +00:00
|
|
|
void keybindings_load_keyfile(void);
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
void keybindings_free(void);
|
|
|
|
|
2008-03-10 13:23:57 +00:00
|
|
|
void keybindings_set_item(KeyBindingGroup *group, gsize key_id,
|
|
|
|
KeyCallback callback, guint key, GdkModifierType mod,
|
|
|
|
const gchar *name, const gchar *label, GtkWidget *menu_item);
|
2008-02-29 19:30:28 +00:00
|
|
|
|
2008-03-10 13:29:35 +00:00
|
|
|
void keybindings_send_command(guint group_id, guint key_id);
|
2008-03-10 13:23:57 +00:00
|
|
|
|
|
|
|
KeyBinding *keybindings_lookup_item(guint group_id, guint key_id);
|
2007-07-18 15:35:52 +00:00
|
|
|
|
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
|
|
|
|
|