SF.net SVN: geany:[3637] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 19 17:50:38 UTC 2009


Revision: 3637
          http://geany.svn.sourceforge.net/geany/?rev=3637&view=rev
Author:   eht16
Date:     2009-03-19 17:50:38 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
Add keybindings for the split actions.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/splitwindow.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-03-19 17:50:23 UTC (rev 3636)
+++ trunk/ChangeLog	2009-03-19 17:50:38 UTC (rev 3637)
@@ -12,6 +12,8 @@
    initialisation.
    Add a shortcut of the project's base directory to the
    File Open/Save As dialogs when a project is open for faster access.
+ * src/splitwindow.c:
+   Add keybindings for the split actions.
 
 
 2009-03-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/plugins/splitwindow.c
===================================================================
--- trunk/plugins/splitwindow.c	2009-03-19 17:50:23 UTC (rev 3636)
+++ trunk/plugins/splitwindow.c	2009-03-19 17:50:38 UTC (rev 3637)
@@ -34,6 +34,7 @@
 #include "document.h"
 #include "editor.h"
 #include "plugindata.h"
+#include "keybindings.h"
 #include "geanyfunctions.h"
 
 
@@ -46,6 +47,18 @@
 GeanyFunctions	*geany_functions;
 
 
+/* Keybinding(s) */
+enum
+{
+	KB_SPLIT_HORIZONTAL,
+	KB_SPLIT_VERTICAL,
+	KB_SPLIT_UNSPLIT,
+	KB_COUNT
+};
+
+PLUGIN_KEY_GROUP(split_window, KB_COUNT);
+
+
 enum State
 {
 	STATE_SPLIT_HORIZONTAL,
@@ -354,6 +367,26 @@
 }
 
 
+static void kb_activate(guint key_id)
+{
+	switch (key_id)
+	{
+		case KB_SPLIT_HORIZONTAL:
+			if (plugin_state == STATE_UNSPLIT)
+				split_view(TRUE);
+			break;
+		case KB_SPLIT_VERTICAL:
+			if (plugin_state == STATE_UNSPLIT)
+				split_view(FALSE);
+			break;
+		case KB_SPLIT_UNSPLIT:
+			if (plugin_state != STATE_UNSPLIT)
+				on_unsplit(NULL, NULL);
+			break;
+	}
+}
+
+
 void plugin_init(GeanyData *data)
 {
 	GtkWidget *item, *menu;
@@ -383,6 +416,14 @@
 	gtk_widget_show_all(menu_items.main);
 
 	set_state(STATE_UNSPLIT);
+
+	/* setup keybindings */
+	keybindings_set_item(plugin_key_group, KB_SPLIT_HORIZONTAL, kb_activate,
+		0, 0, "split_horizontal", _("Split Horizontally"), menu_items.horizontal);
+	keybindings_set_item(plugin_key_group, KB_SPLIT_VERTICAL, kb_activate,
+		0, 0, "split_vertical", _("Split Vertically"), menu_items.vertical);
+	keybindings_set_item(plugin_key_group, KB_SPLIT_UNSPLIT, kb_activate,
+		0, 0, "split_unsplit", _("Unsplit"), menu_items.unsplit);
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list