SF.net SVN: geany:[3172] branches/symbol-tree
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Nov 4 18:14:04 UTC 2008
Revision: 3172
http://geany.svn.sourceforge.net/geany/?rev=3172&view=rev
Author: ntrel
Date: 2008-11-04 18:14:04 +0000 (Tue, 04 Nov 2008)
Log Message:
-----------
Fix sorting tags whose scope name doesn't have a tag (e.g. for C++
source file methods with class definition in a header file).
Modified Paths:
--------------
branches/symbol-tree/ChangeLog
branches/symbol-tree/src/symbols.c
Modified: branches/symbol-tree/ChangeLog
===================================================================
--- branches/symbol-tree/ChangeLog 2008-11-04 13:43:30 UTC (rev 3171)
+++ branches/symbol-tree/ChangeLog 2008-11-04 18:14:04 UTC (rev 3172)
@@ -1,3 +1,10 @@
+2008-11-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/symbols.c:
+ Fix sorting tags whose scope name doesn't have a tag (e.g. for C++
+ source file methods with class definition in a header file).
+
+
2008-11-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* treeviews.c, treeviews.h, symbols.c:
Modified: branches/symbol-tree/src/symbols.c
===================================================================
--- branches/symbol-tree/src/symbols.c 2008-11-04 13:43:30 UTC (rev 3171)
+++ branches/symbol-tree/src/symbols.c 2008-11-04 18:14:04 UTC (rev 3172)
@@ -1061,6 +1061,14 @@
}
+/* Whether iters can be sorted based on tag name and line, not scope.
+ * If the scope was prepended, e.g. 'ScopeNameWithNoTag::TagName', this returns FALSE */
+#define tag_is_name_sortable(tag, iter) \
+ ((tag) && \
+ (!NZV((tag)->atts.entry.scope) || \
+ gtk_tree_store_iter_depth(GTK_TREE_STORE(model), (iter)) > 1))
+
+
static gint tree_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
gpointer user_data)
{
@@ -1070,7 +1078,8 @@
gtk_tree_model_get(model, a, SYMBOLS_COLUMN_TAG, &tag_a, -1);
gtk_tree_model_get(model, b, SYMBOLS_COLUMN_TAG, &tag_b, -1);
- if (tag_a && tag_b)
+ if (tag_is_name_sortable(tag_a, a) &&
+ tag_is_name_sortable(tag_b, b))
{
return sort_by_name ? compare_symbol(tag_a, tag_b) :
compare_symbol_lines(tag_a, tag_b);
@@ -1085,10 +1094,17 @@
/* if a is toplevel, b must be also */
if (gtk_tree_store_iter_depth(GTK_TREE_STORE(model), a) == 0)
+ {
cmp = compare_top_level_names(astr, bstr);
+ }
else
+ {
cmp = strcmp(astr, bstr);
+ /* sort duplicate 'ScopeName::OverloadedTagName' items by line as well */
+ if ((!sort_by_name || cmp == 0) && tag_a && tag_b)
+ cmp = tag_a->atts.entry.line - tag_b->atts.entry.line;
+ }
g_free(astr);
g_free(bstr);
return cmp;
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