Revision: 1390 http://svn.sourceforge.net/geany/?rev=1390&view=rev Author: ntrel Date: 2007-03-13 10:00:12 -0700 (Tue, 13 Mar 2007)
Log Message: ----------- Add 'Switch to last used document' keybinding.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/geany.docbook trunk/src/callbacks.c trunk/src/callbacks.h trunk/src/keybindings.c trunk/src/keybindings.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/ChangeLog 2007-03-13 17:00:12 UTC (rev 1390) @@ -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
Modified: trunk/doc/geany.docbook =================================================================== --- trunk/doc/geany.docbook 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/doc/geany.docbook 2007-03-13 17:00:12 UTC (rev 1390) @@ -1407,6 +1407,10 @@ <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> <row>
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/src/callbacks.c 2007-03-13 17:00:12 UTC (rev 1390) @@ -84,7 +84,9 @@ // 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 @@ { 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 @@ 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 } }
Modified: trunk/src/callbacks.h =================================================================== --- trunk/src/callbacks.h 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/src/callbacks.h 2007-03-13 17:00:12 UTC (rev 1390) @@ -21,6 +21,14 @@ * $Id$ */
+typedef struct +{ + gint last_doc_idx; +} CallbacksData; + +extern CallbacksData callbacks_data; + + gint destroyapp (GtkWidget *widget, gpointer gdata);
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/src/keybindings.c 2007-03-13 17:00:12 UTC (rev 1390) @@ -92,6 +92,7 @@ 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 @@ 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 @@ 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;
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2007-03-13 15:40:59 UTC (rev 1389) +++ trunk/src/keybindings.h 2007-03-13 17:00:12 UTC (rev 1390) @@ -92,6 +92,7 @@ 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,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.