Add switching to a notebook tab number using Alt-1 to Alt-9; Alt-0
switches to the last tab. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1021 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
4cbe4f4170
commit
a9722ee94a
@ -4,6 +4,9 @@
|
||||
data/filetypes.*:
|
||||
Only use [a-zA-Z0-9] chars for default wordchars, to avoid problems
|
||||
with word matching when using Find & Replace functions.
|
||||
* src/keybindings.c:
|
||||
Add switching to a notebook tab number using Alt-1 to Alt-9; Alt-0
|
||||
switches to the last tab.
|
||||
|
||||
|
||||
2006-11-22 Frank Lanitz <frank@frank.uvena.de>
|
||||
|
@ -41,6 +41,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
const gboolean swap_alt_tab_order = FALSE;
|
||||
|
||||
|
||||
/* simple convenience function to allocate and fill the struct */
|
||||
static binding *fill(KBCallback func, guint key, GdkModifierType mod, const gchar *name,
|
||||
@ -373,11 +375,35 @@ void keybindings_free(void)
|
||||
}
|
||||
|
||||
|
||||
static gboolean check_fixed_kb(GdkEventKey *event)
|
||||
{
|
||||
// check alt-0 to alt-9 for setting current notebook page
|
||||
if (event->state & GDK_MOD1_MASK && event->keyval >= GDK_0 && event->keyval <= GDK_9)
|
||||
{
|
||||
gint page = event->keyval - GDK_0 - 1;
|
||||
gint npages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
|
||||
|
||||
// alt-0 is for the rightmost tab
|
||||
if (event->keyval == GDK_0)
|
||||
page = npages - 1;
|
||||
// invert the order if tabs are added on the other side
|
||||
if (swap_alt_tab_order && ! app->tab_order_ltr)
|
||||
page = (npages - 1) - page;
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* central keypress event handler, almost all keypress events go to this function */
|
||||
gboolean keybindings_got_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
|
||||
{
|
||||
guint i, k;
|
||||
|
||||
if (check_fixed_kb(event)) return TRUE;
|
||||
|
||||
for (i = 0; i < GEANY_MAX_KEYS; i++)
|
||||
{
|
||||
// ugly hack to get around that CTRL+Shift+r results in 'R' not 'r'
|
||||
|
Loading…
x
Reference in New Issue
Block a user