SF.net SVN: geany: [2710] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Jun 19 15:58:15 UTC 2008


Revision: 2710
          http://geany.svn.sourceforge.net/geany/?rev=2710&view=rev
Author:   eht16
Date:     2008-06-19 08:58:10 -0700 (Thu, 19 Jun 2008)

Log Message:
-----------
Add keybindings for Line wrapping, Line breaking, Toggle fold and Replace Spaces by tabs.
Refactor different document keybindings callback functions into cb_func_document_action().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/keybindings.c
    trunk/src/keybindings.h
    trunk/src/plugindata.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/ChangeLog	2008-06-19 15:58:10 UTC (rev 2710)
@@ -5,6 +5,12 @@
  * geany.glade, src/callbacks.c, src/callbacks.h, src/editor.c,
    src/editor.h, src/interface.c:
    Add "Replace spaces by tabs".
+ * doc/geany.txt, doc/geany.html, src/keybindings.c, src/keybindings.h,
+   src/plugindata.h:
+   Add keybindings for Line wrapping, Line breaking, Toggle fold and
+   Replace Spaces by tabs.
+   Refactor different document keybindings callback functions into
+   cb_func_document_action().
 
 
 2008-06-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/doc/geany.html	2008-06-19 15:58:10 UTC (rev 2710)
@@ -6,7 +6,7 @@
 <meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
 <title>Geany</title>
 <meta name="authors" content="Enrico Tröger  Nick Treleaven  Frank Lanitz" />
-<meta name="date" content="2008-05-18" />
+<meta name="date" content="2008-06-08" />
 <style type="text/css">
 
 /*
@@ -139,7 +139,7 @@
 <br />Nick Treleaven
 <br />Frank Lanitz</td></tr>
 <tr><th class="docinfo-name">Date:</th>
-<td>2008-05-18</td></tr>
+<td>2008-06-08</td></tr>
 <tr><th class="docinfo-name">Version:</th>
 <td>0.15</td></tr>
 </tbody>
@@ -2740,6 +2740,14 @@
 <td> </td>
 <td>Replaces all tabs with the right amount of spaces.</td>
 </tr>
+<tr><td>Replace spaces by tabs</td>
+<td> </td>
+<td>Replaces all spaces with tab characters.</td>
+</tr>
+<tr><td>Toggle current fold</td>
+<td> </td>
+<td>Toggles the folding state of the current code block.</td>
+</tr>
 <tr><td>Fold all</td>
 <td> </td>
 <td>Folds all contractible code blocks.</td>
@@ -2752,6 +2760,15 @@
 <td>Ctrl-Shift-R</td>
 <td>Reloads the tag/symbol list.</td>
 </tr>
+<tr><td>Toggle Line wrapping</td>
+<td> </td>
+<td>Enables or disables wrapping of long lines.</td>
+</tr>
+<tr><td>Toggle Line breaking</td>
+<td> </td>
+<td>Enables or disables automatic breaking of long
+lines at a configurable column.</td>
+</tr>
 <tr><td><strong>Build</strong></td>
 <td> </td>
 <td> </td>
@@ -4124,7 +4141,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2008-06-08 12:16 UTC.
+Generated on: 2008-06-19 15:57 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/doc/geany.txt	2008-06-19 15:58:10 UTC (rev 2710)
@@ -2417,12 +2417,21 @@
 
 Replace tabs by space                                     Replaces all tabs with the right amount of spaces.
 
+Replace spaces by tabs                                    Replaces all spaces with tab characters.
+
+Toggle current fold                                       Toggles the folding state of the current code block.
+
 Fold all                                                  Folds all contractible code blocks.
 
 Unfold all                                                Unfolds all contracted code blocks.
 
 Reload symbol list              Ctrl-Shift-R              Reloads the tag/symbol list.
 
+Toggle Line wrapping                                      Enables or disables wrapping of long lines.
+
+Toggle Line breaking                                      Enables or disables automatic breaking of long
+                                                          lines at a configurable column.
+
 **Build**
 
 Compile                         F8                        Compiles the current file.

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/src/keybindings.c	2008-06-19 15:58:10 UTC (rev 2710)
@@ -67,6 +67,7 @@
 static void cb_func_goto_action(guint key_id);
 static void cb_func_clipboard(guint key_id);
 static void cb_func_build_action(guint key_id);
+static void cb_func_document_action(guint key_id);
 
 /* TODO: refactor individual callbacks per group */
 static void cb_func_menu_help(guint key_id);
@@ -78,11 +79,6 @@
 static void cb_func_menu_zoomin(guint key_id);
 static void cb_func_menu_zoomout(guint key_id);
 
-static void cb_func_menu_replacetabs(guint key_id);
-static void cb_func_menu_foldall(guint key_id);
-static void cb_func_menu_unfoldall(guint key_id);
-static void cb_func_reloadtaglist(guint key_id);
-
 static void cb_func_menu_opencolorchooser(guint key_id);
 
 static void cb_func_switch_editor(guint key_id);
@@ -405,13 +401,21 @@
 
 	group = ADD_KB_GROUP(DOCUMENT, _("Document"));
 
-	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_REPLACETABS, cb_func_menu_replacetabs,
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_LINEWRAP, cb_func_document_action,
+		0, 0, "menu_linewrap", _("Toggle Line wrapping"), LW(menu_line_wrapping1));
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_LINEBREAK, cb_func_document_action,
+		0, 0, "menu_linebreak", _("Toggle Line breaking"), LW(line_breaking1));
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_REPLACETABS, cb_func_document_action,
 		0, 0, "menu_replacetabs", _("Replace tabs by space"), LW(menu_replace_tabs));
-	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_FOLDALL, cb_func_menu_foldall,
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_REPLACESPACES, cb_func_document_action,
+		0, 0, "menu_replacespaces", _("Replace spaces by tabs"), LW(menu_replace_spaces));
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_TOGGLEFOLD, cb_func_document_action,
+		0, 0, "menu_togglefold", _("Toggle current fold"), NULL);
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_FOLDALL, cb_func_document_action,
 		0, 0, "menu_foldall", _("Fold all"), LW(menu_fold_all1));
-	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_UNFOLDALL, cb_func_menu_unfoldall,
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_UNFOLDALL, cb_func_document_action,
 		0, 0, "menu_unfoldall", _("Unfold all"), LW(menu_unfold_all1));
-	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_RELOADTAGLIST, cb_func_reloadtaglist,
+	keybindings_set_item(group, GEANY_KEYS_DOCUMENT_RELOADTAGLIST, cb_func_document_action,
 		GDK_r, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "reloadtaglist", _("Reload symbol list"), NULL);
 
 	group = ADD_KB_GROUP(BUILD, _("Build"));
@@ -1064,20 +1068,6 @@
 	on_zoom_out1_activate(NULL, NULL);
 }
 
-static void cb_func_menu_foldall(G_GNUC_UNUSED guint key_id)
-{
-	GeanyDocument *doc = document_get_current();
-	if (doc != NULL)
-		editor_fold_all(doc);
-}
-
-static void cb_func_menu_unfoldall(G_GNUC_UNUSED guint key_id)
-{
-	GeanyDocument *doc = document_get_current();
-	if (doc != NULL)
-		editor_unfold_all(doc);
-}
-
 static void cb_func_build_action(guint key_id)
 {
 	GtkWidget *item;
@@ -1131,14 +1121,6 @@
 		gtk_menu_item_activate(GTK_MENU_ITEM(item));
 }
 
-static void cb_func_reloadtaglist(G_GNUC_UNUSED guint key_id)
-{
-	GeanyDocument *doc = document_get_current();
-	if (doc != NULL)
-		document_update_tag_list(doc, TRUE);
-}
-
-
 static gboolean check_current_word(void)
 {
 	gint pos;
@@ -1160,7 +1142,6 @@
 	return TRUE;
 }
 
-
 static void cb_func_switch_editor(G_GNUC_UNUSED guint key_id)
 {
 	GeanyDocument *doc = document_get_current();
@@ -1587,9 +1568,43 @@
 }
 
 
-static void cb_func_menu_replacetabs(G_GNUC_UNUSED guint key_id)
+static void cb_func_document_action(guint key_id)
 {
-	on_replace_tabs_activate(NULL, NULL);
+	GeanyDocument *doc = document_get_current();
+	if (doc == NULL)
+		return;
+
+	switch (key_id)
+	{
+		case GEANY_KEYS_DOCUMENT_REPLACETABS:
+			on_replace_tabs_activate(NULL, NULL);
+			break;
+		case GEANY_KEYS_DOCUMENT_REPLACESPACES:
+			on_replace_spaces_activate(NULL, NULL);
+			break;
+		case GEANY_KEYS_DOCUMENT_LINEBREAK:
+			on_line_breaking1_activate(NULL, NULL);
+			break;
+		case GEANY_KEYS_DOCUMENT_LINEWRAP:
+			on_line_wrapping1_toggled(NULL, NULL);
+			break;
+		case GEANY_KEYS_DOCUMENT_RELOADTAGLIST:
+			document_update_tag_list(doc, TRUE);
+			break;
+		case GEANY_KEYS_DOCUMENT_FOLDALL:
+			editor_fold_all(doc);
+			break;
+		case GEANY_KEYS_DOCUMENT_UNFOLDALL:
+			editor_unfold_all(doc);
+			break;
+		case GEANY_KEYS_DOCUMENT_TOGGLEFOLD:
+			if (editor_prefs.folding)
+			{
+				gint line = sci_get_current_line(doc->sci);
+				sci_toggle_fold(doc->sci, line);
+				break;
+			}
+	}
 }
 
 

Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/src/keybindings.h	2008-06-19 15:58:10 UTC (rev 2710)
@@ -265,9 +265,13 @@
 enum
 {
 	GEANY_KEYS_DOCUMENT_REPLACETABS,
+	GEANY_KEYS_DOCUMENT_REPLACESPACES,
+	GEANY_KEYS_DOCUMENT_TOGGLEFOLD,
 	GEANY_KEYS_DOCUMENT_FOLDALL,
 	GEANY_KEYS_DOCUMENT_UNFOLDALL,
 	GEANY_KEYS_DOCUMENT_RELOADTAGLIST,
+	GEANY_KEYS_DOCUMENT_LINEWRAP,
+	GEANY_KEYS_DOCUMENT_LINEBREAK,
 	GEANY_KEYS_DOCUMENT_COUNT
 };
 

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-06-19 14:34:53 UTC (rev 2709)
+++ trunk/src/plugindata.h	2008-06-19 15:58:10 UTC (rev 2710)
@@ -36,7 +36,7 @@
 
 /* The API version should be incremented whenever any plugin data types below are
  * modified or appended to. */
-static const gint api_version = 70;
+static const gint api_version = 71;
 
 /* The ABI version should be incremented whenever existing fields in the plugin
  * data types below have to be changed or reordered. It should stay the same if fields


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