SF.net SVN: geany:[4542] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Jan 24 16:30:37 UTC 2010


Revision: 4542
          http://geany.svn.sourceforge.net/geany/?rev=4542&view=rev
Author:   eht16
Date:     2010-01-24 16:30:29 +0000 (Sun, 24 Jan 2010)

Log Message:
-----------
Rename fold_symbol_click() to editor_toggle_fold().
Use editor_toggle_fold() when the 'Toggle current fold' keybinding was used to respect the 'Fold/unfold all children' preference (closes #2935053).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-01-24 16:18:11 UTC (rev 4541)
+++ trunk/ChangeLog	2010-01-24 16:30:29 UTC (rev 4542)
@@ -12,6 +12,11 @@
    Replace the old icons with smiley icons from the Rodent icon theme.
    Fix showing the same icon for two or more slots.
    Minor cleanups.
+ * src/editor.c, src/editor.j, src/keybindings.c:
+   Rename fold_symbol_click() to editor_toggle_fold().
+   Use editor_toggle_fold() when the 'Toggle current fold' keybinding
+   was used to respect the 'Fold/unfold all children' preference
+   (closes #2935053).
 
 
 2010-01-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-01-24 16:18:11 UTC (rev 4541)
+++ trunk/src/editor.c	2010-01-24 16:30:29 UTC (rev 4542)
@@ -272,16 +272,21 @@
 }
 
 
-static void fold_symbol_click(ScintillaObject *sci, SCNotification *nt)
+void editor_toggle_fold(GeanyEditor *editor, gint line, gint modifiers)
 {
-	gint line = sci_get_line_from_position(sci, nt->position);
+	ScintillaObject *sci;
 
+	g_return_if_fail(editor != NULL);
+
+	sci = editor->sci;
+
 	sci_toggle_fold(sci, line);
+
 	/* extra toggling of child fold points
 	 * use when editor_prefs.unfold_all_children is set and Shift is NOT pressed or when
 	 * editor_prefs.unfold_all_children is NOT set but Shift is pressed */
-	if ((editor_prefs.unfold_all_children && ! (nt->modifiers & SCMOD_SHIFT)) ||
-		(! editor_prefs.unfold_all_children && (nt->modifiers & SCMOD_SHIFT)))
+	if ((editor_prefs.unfold_all_children && ! (modifiers & SCMOD_SHIFT)) ||
+		(! editor_prefs.unfold_all_children && (modifiers & SCMOD_SHIFT)))
 	{
 		gint last_line = SSM(sci, SCI_GETLASTCHILD, line, -1);
 		gint i;
@@ -312,20 +317,21 @@
 }
 
 
-static void on_margin_click(ScintillaObject *sci, SCNotification *nt)
+static void on_margin_click(GeanyEditor *editor, SCNotification *nt)
 {
 	/* left click to marker margin marks the line */
 	if (nt->margin == 1)
 	{
-		gint line = sci_get_line_from_position(sci, nt->position);
+		gint line = sci_get_line_from_position(editor->sci, nt->position);
 
 		/*sci_marker_delete_all(editor->sci, 1);*/
-		sci_toggle_marker_at_line(sci, line, 1);	/* toggle the marker */
+		sci_toggle_marker_at_line(editor->sci, line, 1);	/* toggle the marker */
 	}
 	/* left click on the folding margin to toggle folding state of current line */
 	else if (nt->margin == 2 && editor_prefs.folding)
 	{
-		fold_symbol_click(sci, nt);
+		gint line = sci_get_line_from_position(editor->sci, nt->position);
+		editor_toggle_fold(editor, line, nt->modifiers);
 	}
 }
 
@@ -849,7 +855,7 @@
 			break;
 
 		case SCN_MARGINCLICK:
-			on_margin_click(sci, nt);
+			on_margin_click(editor, nt);
 			break;
 
 		case SCN_UPDATEUI:

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2010-01-24 16:18:11 UTC (rev 4541)
+++ trunk/src/editor.h	2010-01-24 16:30:29 UTC (rev 4542)
@@ -281,4 +281,6 @@
 	 						  gint insert_pos, gint cursor_index,
 	 						  gint newline_indent_size, gboolean replace_newlines);
 
+void editor_toggle_fold(GeanyEditor *editor, gint line, gint modifiers);
+
 #endif

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2010-01-24 16:18:11 UTC (rev 4541)
+++ trunk/src/keybindings.c	2010-01-24 16:30:29 UTC (rev 4542)
@@ -2479,7 +2479,7 @@
 			if (editor_prefs.folding)
 			{
 				gint line = sci_get_current_line(doc->editor->sci);
-				sci_toggle_fold(doc->editor->sci, line);
+				editor_toggle_fold(doc->editor, line, 0);
 				break;
 			}
 	}


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