Revision: 1174 http://svn.sourceforge.net/geany/?rev=1174&view=rev Author: ntrel Date: 2007-01-12 04:33:17 -0800 (Fri, 12 Jan 2007)
Log Message: ----------- Use '::' context separator for C also (so C/C++ share the same syntax, and C++ .h headers use correct syntax). Add symbols_get_context_separator() and use for calltips and the symbol list.
Modified Paths: -------------- trunk/ChangeLog trunk/src/sci_cb.c trunk/src/symbols.c trunk/src/symbols.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-01-11 11:59:40 UTC (rev 1173) +++ trunk/ChangeLog 2007-01-12 12:33:17 UTC (rev 1174) @@ -1,3 +1,12 @@ +2007-01-12 Nick Treleaven nick.treleaven@btinternet.com + + * src/sci_cb.c, src/symbols.c, src/symbols.h: + Use '::' context separator for C also (so C/C++ share the same + syntax, and C++ .h headers use correct syntax). + Add symbols_get_context_separator() and use for calltips and the + symbol list. + + 2007-01-11 Nick Treleaven nick.treleaven@btinternet.com
* src/sci_cb.c:
Modified: trunk/src/sci_cb.c =================================================================== --- trunk/src/sci_cb.c 2007-01-11 11:59:40 UTC (rev 1173) +++ trunk/src/sci_cb.c 2007-01-12 12:33:17 UTC (rev 1174) @@ -537,7 +537,7 @@ }
-static gchar *tag_to_calltip(const TMTag *tag, gint ft_id) +static gchar *tag_to_calltip(const TMTag *tag, filetype_id ft_id) { GString *str; gchar *result; @@ -559,11 +559,10 @@ } if (tag->atts.entry.scope) { + const gchar *cosep = symbols_get_context_separator(ft_id); + g_string_append(str, tag->atts.entry.scope); - if (ft_id == GEANY_FILETYPES_D) - g_string_append_c(str, '.'); - else - g_string_append(str, "::"); + g_string_append(str, cosep); } g_string_append(str, tag->name); g_string_append_c(str, ' ');
Modified: trunk/src/symbols.c =================================================================== --- trunk/src/symbols.c 2007-01-11 11:59:40 UTC (rev 1173) +++ trunk/src/symbols.c 2007-01-12 12:33:17 UTC (rev 1174) @@ -150,6 +150,32 @@ }
+const gchar *symbols_get_context_separator(filetype_id ft_id) +{ + gchar *cosep; + + switch (ft_id) + { + case GEANY_FILETYPES_C: // for C++ .h headers or C structs + case GEANY_FILETYPES_CPP: + { + static gchar cc[] = "::"; + + cosep = cc; + } + break; + + default: + { + static gchar def[] = "."; + + cosep = def; + } + } + return cosep; // return ptr to static string +} + + const GList *symbols_get_tag_list(gint idx, guint tag_types) { static GList *tag_names = NULL; @@ -162,6 +188,8 @@ GeanySymbol *symbol; gboolean doc_is_utf8 = FALSE; gchar *utf8_name; + const gchar *cosep = + symbols_get_context_separator(FILETYPE_ID(doc_list[idx].file_type));
if (tag_names) { @@ -191,9 +219,6 @@ else utf8_name = tag->name; if ((tag->atts.entry.scope != NULL) && isalpha(tag->atts.entry.scope[0])) { - // context separator - gchar *cosep = (doc_list[idx].file_type->id == GEANY_FILETYPES_CPP) ? "::" : "."; - symbol = g_new0(GeanySymbol, 1); symbol->str = g_strdup_printf("%s%s%s [%ld]", tag->atts.entry.scope, cosep, utf8_name, tag->atts.entry.line);
Modified: trunk/src/symbols.h =================================================================== --- trunk/src/symbols.h 2007-01-11 11:59:40 UTC (rev 1173) +++ trunk/src/symbols.h 2007-01-12 12:33:17 UTC (rev 1174) @@ -25,6 +25,8 @@ #ifndef GEANY_SYMBOLS_H #define GEANY_SYMBOLS_H 1
+#include "filetypes.h" + extern const guint TM_GLOBAL_TYPE_MASK;
@@ -32,6 +34,8 @@
GString *symbols_find_tags_as_string(GPtrArray *tags_array, guint tag_types);
+const gchar *symbols_get_context_separator(filetype_id ft_id); + const GList *symbols_get_tag_list(gint idx, guint tag_types);
GString *symbols_get_macro_list();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.