SF.net SVN: geany: [1044] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Dec 3 22:33:47 UTC 2006


Revision: 1044
          http://svn.sourceforge.net/geany/?rev=1044&view=rev
Author:   eht16
Date:     2006-12-03 14:33:46 -0800 (Sun, 03 Dec 2006)

Log Message:
-----------
Added new preference to unfold all children of a fold point if the fold point is unfolded.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/geany.glade
    trunk/src/geany.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/prefs.c
    trunk/src/sci_cb.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/ChangeLog	2006-12-03 22:33:46 UTC (rev 1044)
@@ -4,6 +4,10 @@
    data/filetypes.ferite, data/filetypes.java, src/highlighting.c:
    Added new style for doc keyword error and added some doc key words
    for Doxygen and Javadoc.
+ * geany.glade, src/geany.h, src/interface.c, src/keyfile.c,
+   src/prefs.c, src/sci_cb.c:
+   Added new preference to unfold all children of a fold point if the
+   fold point is unfolded.
 
 
 2006-12-02  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/geany.glade	2006-12-03 22:33:46 UTC (rev 1044)
@@ -5131,6 +5131,26 @@
 			  </child>
 
 			  <child>
+			    <widget class="GtkCheckButton" id="check_unfold_children">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Unfold all children of a fold point when unfolding it.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Unfold all children of a fold point</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
 			    <widget class="GtkCheckButton" id="check_indicators">
 			      <property name="visible">True</property>
 			      <property name="tooltip" translatable="yes">Whether to use indicators (a squiggly underline) to highlight the lines where the compiler found a warning or an error.</property>

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/src/geany.h	2006-12-03 22:33:46 UTC (rev 1044)
@@ -105,6 +105,7 @@
 	gboolean			 pref_editor_auto_close_xml_tags;
 	gboolean			 pref_editor_auto_complete_constructs;
 	gboolean			 pref_editor_folding;
+	gboolean			 pref_editor_unfold_all_children;
 	gint				 pref_editor_tab_width;
 	gint				 pref_editor_default_encoding;
 	gboolean			 pref_editor_new_line;

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/src/interface.c	2006-12-03 22:33:46 UTC (rev 1044)
@@ -2264,6 +2264,7 @@
   GtkWidget *check_auto_indent;
   GtkWidget *check_line_wrapping;
   GtkWidget *check_folding;
+  GtkWidget *check_unfold_children;
   GtkWidget *check_indicators;
   GtkWidget *label172;
   GtkWidget *frame18;
@@ -3141,6 +3142,12 @@
   gtk_tooltips_set_tip (tooltips, check_folding, _("Whether to enable folding the code"), NULL);
   gtk_button_set_focus_on_click (GTK_BUTTON (check_folding), FALSE);
 
+  check_unfold_children = gtk_check_button_new_with_mnemonic (_("Unfold all children of a fold point"));
+  gtk_widget_show (check_unfold_children);
+  gtk_box_pack_start (GTK_BOX (vbox17), check_unfold_children, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_unfold_children, _("Unfold all children of a fold point when unfolding it."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_unfold_children), FALSE);
+
   check_indicators = gtk_check_button_new_with_mnemonic (_("Use indicators to show compile errors"));
   gtk_widget_show (check_indicators);
   gtk_box_pack_start (GTK_BOX (vbox17), check_indicators, FALSE, FALSE, 0);
@@ -3674,6 +3681,7 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_indent, "check_auto_indent");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_line_wrapping, "check_line_wrapping");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_folding, "check_folding");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_unfold_children, "check_unfold_children");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_indicators, "check_indicators");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label172, "label172");
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame18, "frame18");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/src/keyfile.c	2006-12-03 22:33:46 UTC (rev 1044)
@@ -100,6 +100,7 @@
 	g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
 	g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
 	g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding);
+	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", app->pref_editor_unfold_all_children);
 	g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->pref_editor_use_auto_indention);
 	g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators);
 	g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", app->pref_editor_show_indent_guide);
@@ -314,6 +315,7 @@
 	app->pref_editor_auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE);
 	app->pref_editor_auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE);
 	app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
+	app->pref_editor_unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
 	app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
 	app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
 	app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/src/prefs.c	2006-12-03 22:33:46 UTC (rev 1044)
@@ -62,6 +62,7 @@
 static gboolean find_duplicate(guint idx, guint key, GdkModifierType mods, const gchar *action);
 static void on_pref_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data);
 static void on_pref_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data);
+static void on_pref_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
 
 
 void prefs_init_dialog(void)
@@ -241,6 +242,11 @@
 	widget = lookup_widget(app->prefs_dialog, "check_folding");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_folding);
 
+	widget = lookup_widget(app->prefs_dialog, "check_unfold_children");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_unfold_all_children);
+	on_pref_use_folding_toggled(GTK_TOGGLE_BUTTON(
+					lookup_widget(app->prefs_dialog, "check_folding")), NULL);
+
 	widget = lookup_widget(app->prefs_dialog, "check_indicators");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_indicators);
 
@@ -514,6 +520,9 @@
 		app->pref_editor_folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 		ui_update_fold_items();
 
+		widget = lookup_widget(app->prefs_dialog, "check_unfold_children");
+		app->pref_editor_unfold_all_children = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
 		widget = lookup_widget(app->prefs_dialog, "check_indent");
 		app->pref_editor_show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
@@ -647,7 +656,7 @@
 		// store all settings
 		configuration_save();
 	}
-	
+
 	if (response != GTK_RESPONSE_APPLY)
 	{
 		gtk_list_store_clear(store);
@@ -930,6 +939,14 @@
 }
 
 
+static void on_pref_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gboolean sens = gtk_toggle_button_get_active(togglebutton);
+
+	gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "check_unfold_children"), sens);
+}
+
+
 void dialogs_show_prefs_dialog(void)
 {
 	if (app->prefs_dialog == NULL)
@@ -981,7 +998,8 @@
 				"toggled", G_CALLBACK(on_pref_toolbar_show_toggled), NULL);
 		g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "check_show_notebook_tabs"),
 				"toggled", G_CALLBACK(on_pref_show_notebook_tabs_toggled), NULL);
-
+		g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "check_folding"),
+				"toggled", G_CALLBACK(on_pref_use_folding_toggled), NULL);
 	}
 
 	prefs_init_dialog();

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-12-03 22:11:42 UTC (rev 1043)
+++ trunk/src/sci_cb.c	2006-12-03 22:33:46 UTC (rev 1044)
@@ -120,9 +120,26 @@
 				//sci_marker_delete_all(doc_list[idx].sci, 1);
 				sci_set_marker_at_line(sci, line, sci_is_marker_set_at_line(sci, line, 1), 1);
 			}
+			// left click on the folding margin to toggle folding state of current line
 			else if (nt->margin == 2 && app->pref_editor_folding)
 			{
-				SSM(sci, SCI_TOGGLEFOLD, SSM(sci, SCI_LINEFROMPOSITION, nt->position, 0), 0);
+				gint line = SSM(sci, SCI_LINEFROMPOSITION, nt->position, 0);
+
+				SSM(sci, SCI_TOGGLEFOLD, line, 0);
+				if (app->pref_editor_unfold_all_children &&
+					SSM(sci, SCI_GETLINEVISIBLE, line + 1, 0))
+				{	// unfold all children of the current fold point
+					gint last_line = SSM(sci, SCI_GETLASTCHILD, line, -1);
+					gint i;
+
+					for (i = line; i < last_line; i++)
+					{
+						if (! SSM(sci, SCI_GETLINEVISIBLE, i, 0))
+						{
+							SSM(sci, SCI_TOGGLEFOLD, SSM(sci, SCI_GETFOLDPARENT, i, 0), 0);
+						}
+					}
+				}
 			}
 			break;
 		}
@@ -1016,7 +1033,7 @@
 /**
  * (stolen from anjuta and heavily modified)
  * This routine will auto complete XML or HTML tags that are still open by closing them
- * @parm ch The character we are dealing with, currently only works with the '>' character
+ * @param ch The character we are dealing with, currently only works with the '>' character
  * @return True if handled, false otherwise
  */
 
@@ -1042,7 +1059,7 @@
 	if (min < 0) min = 0;
 
 	if (pos - min < 3)
-		return FALSE; // Smallest tag is 3 characters ex. <p>
+		return FALSE; // Smallest tag is 3 characters e.g. <p>
 
 	sci_get_text_range(sci, min, pos, sel);
 	sel[sizeof(sel) - 1] = '\0';


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