Add 'Switch to last used document' keybinding.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1390 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-03-13 17:00:12 +00:00
parent 5f0889407f
commit 20115f6f54
6 changed files with 33 additions and 1 deletions

View File

@ -7,6 +7,9 @@
* src/document.c:
Count total replacements made when replacing in a rectangular
selection.
* src/keybindings.c, src/keybindings.h, src/callbacks.c,
src/callbacks.h, doc/geany.docbook:
Add 'Switch to last used document' keybinding.
2007-03-12 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -1406,6 +1406,10 @@
<entry>Switch to right document</entry>
<entry>Switches to the next open document.</entry>
</row>
<row>
<entry>Switch to last used document</entry>
<entry>Switches to the previously selected open document.</entry>
</row>
<row>
<entry align="left" spanname="hspan">Editing operations</entry>
</row>

View File

@ -84,6 +84,8 @@ static gboolean insert_callback_from_menu = FALSE;
// the selection-changed signal from tv.tree_openfiles
//static gboolean switch_tv_notebook_page = FALSE;
CallbacksData callbacks_data = {-1};
// real exit function
gint destroyapp(GtkWidget *widget, gpointer gdata)
@ -705,6 +707,8 @@ on_notebook1_switch_page (GtkNotebook *notebook,
{
gint idx;
callbacks_data.last_doc_idx = document_get_cur_idx();
if (closing_all) return;
// guint == -1 seems useless, but it isn't!
@ -749,7 +753,7 @@ on_notebook1_switch_page_after (GtkNotebook *notebook,
utils_check_disk_status(idx, FALSE);
#ifdef HAVE_VTE
vte_cwd(doc_list[idx].file_name, FALSE);
vte_cwd(doc_list[idx].file_name, FALSE);
#endif
}
}

View File

@ -21,6 +21,14 @@
* $Id$
*/
typedef struct
{
gint last_doc_idx;
} CallbacksData;
extern CallbacksData callbacks_data;
gint
destroyapp (GtkWidget *widget, gpointer gdata);

View File

@ -92,6 +92,7 @@ static void cb_func_switch_scribble(guint key_id);
static void cb_func_switch_vte(guint key_id);
static void cb_func_switch_tableft(guint key_id);
static void cb_func_switch_tabright(guint key_id);
static void cb_func_switch_tablastused(guint key_id);
static void cb_func_toggle_sidebar(guint key_id);
// common function for editing keybindings, only valid when scintilla has focus.
@ -210,6 +211,8 @@ void keybindings_init(void)
GDK_Page_Up, GDK_CONTROL_MASK, "switch_tableft", _("Switch to left document"));
keys[GEANY_KEYS_SWITCH_TABRIGHT] = fill(cb_func_switch_tabright,
GDK_Page_Down, GDK_CONTROL_MASK, "switch_tabright", _("Switch to right document"));
keys[GEANY_KEYS_SWITCH_TABLASTUSED] = fill(cb_func_switch_tablastused,
GDK_Tab, GDK_CONTROL_MASK, "switch_tablastused", _("Switch to last used document"));
keys[GEANY_KEYS_EDIT_DUPLICATELINE] = fill(cb_func_edit,
GDK_g, GDK_CONTROL_MASK, "edit_duplicateline", _("Duplicate line or selection"));
@ -760,6 +763,15 @@ static void cb_func_switch_tabright(G_GNUC_UNUSED guint key_id)
utils_switch_document(RIGHT);
}
static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
{
gint last_doc_idx = callbacks_data.last_doc_idx;
if (DOC_IDX_VALID(last_doc_idx))
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook),
document_get_notebook_page(last_doc_idx));
}
static void cb_func_toggle_sidebar(G_GNUC_UNUSED guint key_id)
{
static gint active_page = -1;

View File

@ -92,6 +92,7 @@ enum
GEANY_KEYS_SWITCH_VTE,
GEANY_KEYS_SWITCH_TABLEFT,
GEANY_KEYS_SWITCH_TABRIGHT,
GEANY_KEYS_SWITCH_TABLASTUSED,
GEANY_KEYS_EDIT_TOLOWERCASE,
GEANY_KEYS_EDIT_TOUPPERCASE,
GEANY_KEYS_EDIT_DUPLICATELINE,