SF.net SVN: geany:[5642] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Mon Mar 28 20:36:06 UTC 2011


Revision: 5642
          http://geany.svn.sourceforge.net/geany/?rev=5642&view=rev
Author:   colombanw
Date:     2011-03-28 20:36:06 +0000 (Mon, 28 Mar 2011)

Log Message:
-----------
Don't update parent WorkObjects when updating one in real-time

Updating the parent may lead to performance issues if an object have
too many parents since they are updated recursively.

Parent objects are still updated when saving the file.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-03-27 16:05:00 UTC (rev 5641)
+++ trunk/ChangeLog	2011-03-28 20:36:06 UTC (rev 5642)
@@ -1,3 +1,10 @@
+2011-03-28  Colomban Wendling  <colomban(at)geany(dot)org>
+
+ * src/document.c, src/document.h, src/editor.c, src/keybindings.c:
+   Don't update parent WorkObjects when updating one in real-time. This
+   should fix some performance issues if a WorkObject has many parents.
+
+
 2011-03-27  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/makefile.win32, src/main.c, src/Makefile.am, configure.ac,

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2011-03-27 16:05:00 UTC (rev 5641)
+++ trunk/src/document.c	2011-03-28 20:36:06 UTC (rev 5642)
@@ -109,7 +109,7 @@
 
 static void document_undo_clear(GeanyDocument *doc);
 static void document_redo_add(GeanyDocument *doc, guint type, gpointer data);
-static gboolean update_tags_from_buffer(GeanyDocument *doc);
+static gboolean update_tags_from_buffer(GeanyDocument *doc, gboolean update_parent);
 
 
 /* ignore the case of filenames and paths under WIN32, causes errors if not */
@@ -771,7 +771,7 @@
 
 	ui_set_window_title(doc);
 	build_menu_update(doc);
-	document_update_tag_list(doc, FALSE);
+	document_update_tag_list(doc, FALSE, TRUE);
 	document_set_text_changed(doc, FALSE);
 	ui_document_show_hide(doc); /* update the document menu */
 
@@ -2250,7 +2250,7 @@
 }
 
 
-static gboolean update_tags_from_buffer(GeanyDocument *doc)
+static gboolean update_tags_from_buffer(GeanyDocument *doc, gboolean update_parent)
 {
 	gboolean result;
 #if 0
@@ -2263,14 +2263,14 @@
 		/* we copy the whole text into memory instead using a direct char pointer from
 		 * Scintilla because tm_source_file_buffer_update() does modify the string slightly */
 		sci_get_text(doc->editor->sci, len, text);
-		result = tm_source_file_buffer_update(doc->tm_file, (guchar*) text, len, TRUE);
+		result = tm_source_file_buffer_update(doc->tm_file, (guchar*) text, len, update_parent);
 		g_free(text);
 #endif
 	return result;
 }
 
 
-void document_update_tag_list(GeanyDocument *doc, gboolean update)
+void document_update_tag_list(GeanyDocument *doc, gboolean update, gboolean update_parent)
 {
 	/* We must call sidebar_update_tag_list() before returning,
 	 * to ensure that the symbol list is always updated properly (e.g.
@@ -2306,14 +2306,14 @@
 			else
 			{
 				if (update)
-					update_tags_from_buffer(doc);
+					update_tags_from_buffer(doc, update_parent);
 				success = TRUE;
 			}
 		}
 	}
 	else
 	{
-		success = update_tags_from_buffer(doc);
+		success = update_tags_from_buffer(doc, update_parent);
 		if (G_UNLIKELY(! success))
 			geany_debug("tag list updating failed");
 	}
@@ -2449,7 +2449,7 @@
 		doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode;
 	}
 
-	document_update_tag_list(doc, TRUE);
+	document_update_tag_list(doc, TRUE, TRUE);
 
 	/* Update session typename keywords. */
 	update_type_keywords(doc, type->lang);

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2011-03-27 16:05:00 UTC (rev 5641)
+++ trunk/src/document.h	2011-03-28 20:36:06 UTC (rev 5642)
@@ -229,7 +229,7 @@
 void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, gint flags,
 						  gboolean escaped_chars);
 
-void document_update_tag_list(GeanyDocument *doc, gboolean update);
+void document_update_tag_list(GeanyDocument *doc, gboolean update, gboolean update_parent);
 
 void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding);
 

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2011-03-27 16:05:00 UTC (rev 5641)
+++ trunk/src/editor.c	2011-03-28 20:36:06 UTC (rev 5642)
@@ -999,7 +999,7 @@
 	GeanyDocument *doc = data;
 
 	if (!main_status.quitting && DOC_VALID(doc))
-		document_update_tag_list(doc, TRUE);
+		document_update_tag_list(doc, TRUE, FALSE);
 
 	document_tags_update_pending = FALSE;
 	return FALSE;

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2011-03-27 16:05:00 UTC (rev 5641)
+++ trunk/src/keybindings.c	2011-03-28 20:36:06 UTC (rev 5642)
@@ -2524,7 +2524,7 @@
 			ui_document_show_hide(doc);
 			break;
 		case GEANY_KEYS_DOCUMENT_RELOADTAGLIST:
-			document_update_tag_list(doc, TRUE);
+			document_update_tag_list(doc, TRUE, TRUE);
 			break;
 		case GEANY_KEYS_DOCUMENT_FOLDALL:
 			editor_fold_all(doc->editor);


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