SF.net SVN: geany:[5557] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Sat Mar 5 22:46:32 UTC 2011


Revision: 5557
          http://geany.svn.sourceforge.net/geany/?rev=5557&view=rev
Author:   colombanw
Date:     2011-03-05 22:46:32 +0000 (Sat, 05 Mar 2011)

Log Message:
-----------
Add possibility to update symbol list in IDLE time

Enabled by default, using a minimal delay of 250ms between two updates.
Also add a preference to configure this in Geany's UI, under
Preferences -> Editor -> Completion.

Modified Paths:
--------------
    trunk/geany.glade
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/interface.c
    trunk/src/keyfile.c

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2011-03-05 22:44:22 UTC (rev 5556)
+++ trunk/geany.glade	2011-03-05 22:46:32 UTC (rev 5557)
@@ -6607,7 +6607,7 @@
 			      <child>
 				<widget class="GtkTable" id="table14">
 				  <property name="visible">True</property>
-				  <property name="n_rows">3</property>
+				  <property name="n_rows">4</property>
 				  <property name="n_columns">2</property>
 				  <property name="homogeneous">False</property>
 				  <property name="row_spacing">3</property>
@@ -6762,6 +6762,56 @@
 				      <property name="y_options"></property>
 				    </packing>
 				  </child>
+
+				  <child>
+				    <widget class="GtkLabel" id="label250">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Symbol list update frequency:</property>
+				      <property name="use_underline">False</property>
+				      <property name="use_markup">False</property>
+				      <property name="justify">GTK_JUSTIFY_LEFT</property>
+				      <property name="wrap">False</property>
+				      <property name="selectable">False</property>
+				      <property name="xalign">0</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xpad">0</property>
+				      <property name="ypad">0</property>
+				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				      <property name="width_chars">-1</property>
+				      <property name="single_line_mode">False</property>
+				      <property name="angle">0</property>
+				    </widget>
+				    <packing>
+				      <property name="left_attach">0</property>
+				      <property name="right_attach">1</property>
+				      <property name="top_attach">3</property>
+				      <property name="bottom_attach">4</property>
+				      <property name="x_options">fill</property>
+				      <property name="y_options"></property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkSpinButton" id="spin_symbol_update_freq">
+				      <property name="visible">True</property>
+				      <property name="tooltip" translatable="yes">Minimal delay (in milliseconds) between two automatic updates of the symbol list. Note that a too short delay may have performance impact, espcially with large files. A delay of 0 disables real-time updates.</property>
+				      <property name="can_focus">True</property>
+				      <property name="climb_rate">1</property>
+				      <property name="digits">0</property>
+				      <property name="numeric">True</property>
+				      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+				      <property name="snap_to_ticks">False</property>
+				      <property name="wrap">False</property>
+				      <property name="adjustment">250 0 10000 10 100 0</property>
+				    </widget>
+				    <packing>
+				      <property name="left_attach">1</property>
+				      <property name="right_attach">2</property>
+				      <property name="top_attach">3</property>
+				      <property name="bottom_attach">4</property>
+				      <property name="y_options"></property>
+				    </packing>
+				  </child>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2011-03-05 22:44:22 UTC (rev 5556)
+++ trunk/src/editor.c	2011-03-05 22:46:32 UTC (rev 5557)
@@ -83,6 +83,9 @@
 /* holds word under the mouse or keyboard cursor */
 static gchar current_word[GEANY_MAX_WORD_LENGTH];
 
+/* whether there is a tag list update pending */
+static gboolean document_tags_update_pending = FALSE;
+
 /* Initialised in keyfile.c. */
 GeanyEditorPrefs editor_prefs;
 
@@ -991,6 +994,29 @@
 }
 
 
+static gboolean on_document_update_tags_idle(gpointer data)
+{
+	GeanyDocument *doc = data;
+
+	if (!main_status.quitting && DOC_VALID(doc))
+		document_update_tag_list(doc, TRUE);
+
+	document_tags_update_pending = FALSE;
+	return FALSE;
+}
+
+
+static void request_tag_list_update(GeanyDocument *doc)
+{
+	if (!document_tags_update_pending)
+	{
+		document_tags_update_pending = TRUE;
+		g_timeout_add_full(G_PRIORITY_LOW, editor_prefs.autocompletion_update_freq,
+				on_document_update_tags_idle, doc, NULL);
+	}
+}
+
+
 static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *editor,
 								 SCNotification *nt, G_GNUC_UNUSED gpointer data)
 {
@@ -1052,6 +1078,12 @@
 				/* handle special fold cases, e.g. #1923350 */
 				fold_changed(sci, nt->line, nt->foldLevelNow, nt->foldLevelPrev);
 			}
+			if (editor_prefs.autocompletion_update_freq > 0 &&
+				(nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) &&
+				filetype_has_tags(doc->file_type))
+			{
+				request_tag_list_update(doc);
+			}
 			break;
 
 		case SCN_CHARADDED:

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2011-03-05 22:44:22 UTC (rev 5556)
+++ trunk/src/editor.h	2011-03-05 22:46:32 UTC (rev 5557)
@@ -146,6 +146,7 @@
 	gint 		show_virtual_space;
 	/* This setting may be overridden when a project is opened. Use @c editor_get_prefs(). */
 	gboolean	long_line_enabled;
+	gint		autocompletion_update_freq;
 }
 GeanyEditorPrefs;
 

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2011-03-05 22:44:22 UTC (rev 5556)
+++ trunk/src/interface.c	2011-03-05 22:46:32 UTC (rev 5557)
@@ -2710,6 +2710,9 @@
   GtkWidget *spin_symbollistheight;
   GtkObject *spin_autocompletion_max_entries_adj;
   GtkWidget *spin_autocompletion_max_entries;
+  GtkWidget *label250;
+  GtkObject *spin_symbol_update_freq_adj;
+  GtkWidget *spin_symbol_update_freq;
   GtkWidget *label177;
   GtkWidget *frame38;
   GtkWidget *alignment42;
@@ -3974,7 +3977,7 @@
   gtk_widget_show (check_completion_drops_rest_of_word);
   gtk_box_pack_start (GTK_BOX (vbox19), check_completion_drops_rest_of_word, FALSE, FALSE, 0);
 
-  table14 = gtk_table_new (3, 2, FALSE);
+  table14 = gtk_table_new (4, 2, FALSE);
   gtk_widget_show (table14);
   gtk_box_pack_start (GTK_BOX (vbox19), table14, FALSE, FALSE, 0);
   gtk_table_set_row_spacings (GTK_TABLE (table14), 3);
@@ -4028,6 +4031,22 @@
   gtk_tooltips_set_tip (tooltips, spin_autocompletion_max_entries, _("Maximum number of entries to display in the autocompletion list"), NULL);
   gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_autocompletion_max_entries), TRUE);
 
+  label250 = gtk_label_new (_("Symbol list update frequency:"));
+  gtk_widget_show (label250);
+  gtk_table_attach (GTK_TABLE (table14), label250, 0, 1, 3, 4,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label250), 0, 0.5);
+
+  spin_symbol_update_freq_adj = gtk_adjustment_new (250, 0, 10000, 10, 100, 0);
+  spin_symbol_update_freq = gtk_spin_button_new (GTK_ADJUSTMENT (spin_symbol_update_freq_adj), 1, 0);
+  gtk_widget_show (spin_symbol_update_freq);
+  gtk_table_attach (GTK_TABLE (table14), spin_symbol_update_freq, 1, 2, 3, 4,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_tooltips_set_tip (tooltips, spin_symbol_update_freq, _("Minimal delay (in milliseconds) between two automatic updates of the symbol list. Note that a too short delay may have performance impact, espcially with large files. A delay of 0 disables real-time updates."), NULL);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_symbol_update_freq), TRUE);
+
   label177 = gtk_label_new (_("<b>Completions</b>"));
   gtk_widget_show (label177);
   gtk_frame_set_label_widget (GTK_FRAME (frame18), label177);
@@ -5216,6 +5235,8 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbol_complete_chars, "spin_symbol_complete_chars");
   GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbollistheight, "spin_symbollistheight");
   GLADE_HOOKUP_OBJECT (prefs_dialog, spin_autocompletion_max_entries, "spin_autocompletion_max_entries");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label250, "label250");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbol_update_freq, "spin_symbol_update_freq");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label177, "label177");
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame38, "frame38");
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment42, "alignment42");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2011-03-05 22:44:22 UTC (rev 5556)
+++ trunk/src/keyfile.c	2011-03-05 22:46:32 UTC (rev 5557)
@@ -83,6 +83,7 @@
 #define GEANY_DEFAULT_FONT_EDITOR		"Monospace 10"
 #define GEANY_TOGGLE_MARK				"~ "
 #define GEANY_MAX_AUTOCOMPLETE_WORDS	30
+#define GEANY_MAX_SYMBOLS_UPDATE_FREQ	250
 
 
 static gchar *scribble_text = NULL;
@@ -165,6 +166,8 @@
 	stash_group_add_spin_button_integer(group, (gint*)&editor_prefs.autocompletion_max_entries,
 		"autocompletion_max_entries", GEANY_MAX_AUTOCOMPLETE_WORDS,
 		"spin_autocompletion_max_entries");
+	stash_group_add_spin_button_integer(group, (gint*)&editor_prefs.autocompletion_update_freq,
+		"autocompletion_update_freq", GEANY_MAX_SYMBOLS_UPDATE_FREQ, "spin_symbol_update_freq");
 	stash_group_add_string(group, &editor_prefs.color_scheme,
 		"color_scheme", NULL);
 


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