Revision: 5262 http://geany.svn.sourceforge.net/geany/?rev=5262&view=rev Author: ntrel Date: 2010-09-30 13:50:33 +0000 (Thu, 30 Sep 2010)
Log Message: ----------- Add symbol_list_sort_mode per-filetype setting, set to sort by line number by default for Markdown, reStructuredText and Txt2Tags. Add utils_get_setting() macro for reading a key from a home or system keyfile. Move GeanyFiletypePrivate to filetypesprivate.h.
Modified Paths: -------------- trunk/ChangeLog trunk/data/filetypes.markdown trunk/data/filetypes.restructuredtext trunk/data/filetypes.txt2tags trunk/doc/geany.html trunk/doc/geany.txt trunk/src/document.c trunk/src/filetypes.c trunk/src/filetypes.h trunk/src/utils.h
Added Paths: ----------- trunk/src/filetypesprivate.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/ChangeLog 2010-09-30 13:50:33 UTC (rev 5262) @@ -1,3 +1,16 @@ +2010-09-30 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/utils.h, src/filetypesprivate.h, src/filetypes.c, + src/filetypes.h, src/document.c, doc/geany.txt, doc/geany.html, + data/filetypes.txt2tags, data/filetypes.markdown, + data/filetypes.restructuredtext: + Add symbol_list_sort_mode per-filetype setting, set to sort by line + number by default for Markdown, reStructuredText and Txt2Tags. + Add utils_get_setting() macro for reading a key from a home or + system keyfile. + Move GeanyFiletypePrivate to filetypesprivate.h. + + 2010-09-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/editor.c:
Modified: trunk/data/filetypes.markdown =================================================================== --- trunk/data/filetypes.markdown 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/data/filetypes.markdown 2010-09-30 13:50:33 UTC (rev 5262) @@ -23,4 +23,7 @@ # default extension used when saving files extension=mdml
+# sort tags by appearance +symbol_list_sort_mode=1
+
Modified: trunk/data/filetypes.restructuredtext =================================================================== --- trunk/data/filetypes.restructuredtext 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/data/filetypes.restructuredtext 2010-09-30 13:50:33 UTC (rev 5262) @@ -10,7 +10,7 @@ #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# if only single comment char is supported like # in this file, leave comment_close blank -comment_open=.. +comment_open=.. #comment_close= # this is an alternative way, so multiline comments are used #comment_open=/* @@ -26,3 +26,6 @@
# context action command (please see Geany's main documentation for details) context_action_cmd= + +# sort tags by appearance +symbol_list_sort_mode=1
Modified: trunk/data/filetypes.txt2tags =================================================================== --- trunk/data/filetypes.txt2tags 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/data/filetypes.txt2tags 2010-09-30 13:50:33 UTC (rev 5262) @@ -28,6 +28,9 @@ # default extension used when saving files extension=txt2tags
+# sort tags by appearance +symbol_list_sort_mode=1 + [keywords] primary=includeconf options toc
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/doc/geany.html 2010-09-30 13:50:33 UTC (rev 5262) @@ -4354,6 +4354,28 @@ <dd>A filetype name to setup syntax highlighting from another filetype. This must not be recursive, i.e. it should be a filetype name that doesn't use the lexer_filetype key itself.</dd> +<dt>symbol_list_sort_mode</dt> +<dd><p class="first">What the default symbol list sort order should be.</p> +<table border="1" class="last docutils"> +<colgroup> +<col width="12%" /> +<col width="88%" /> +</colgroup> +<thead valign="bottom"> +<tr><th class="head">Value</th> +<th class="head">Meaning</th> +</tr> +</thead> +<tbody valign="top"> +<tr><td>0</td> +<td>Sort tags by name</td> +</tr> +<tr><td>1</td> +<td>Sort tags by appearance (line number)</td> +</tr> +</tbody> +</table> +</dd> </dl> </div> <div class="section"> @@ -6185,7 +6207,7 @@ <div class="footer"> <hr class="footer" /> <a class="reference" href="geany.txt">View document source</a>. -Generated on: 2010-09-23 16:20 UTC. +Generated on: 2010-09-23 18:04 UTC. Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt =================================================================== --- trunk/doc/geany.txt 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/doc/geany.txt 2010-09-30 13:50:33 UTC (rev 5262) @@ -3667,7 +3667,17 @@ This must not be recursive, i.e. it should be a filetype name that doesn't use the lexer_filetype key itself.
+symbol_list_sort_mode + What the default symbol list sort order should be.
+ ===== ===================================== + Value Meaning + ===== ===================================== + 0 Sort tags by name + 1 Sort tags by appearance (line number) + ===== ===================================== + + [build_settings] Section ````````````````````````
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/src/document.c 2010-09-30 13:50:33 UTC (rev 5262) @@ -78,6 +78,7 @@ #include "navqueue.h" #include "win32.h" #include "search.h" +#include "filetypesprivate.h"
GeanyFilePrefs file_prefs; @@ -2472,6 +2473,7 @@ editor_set_indentation_guides(doc->editor); build_menu_update(doc); queue_colourise(doc); + doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode; }
document_update_tag_list(doc, TRUE);
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/src/filetypes.c 2010-09-30 13:50:33 UTC (rev 5262) @@ -34,6 +34,7 @@
#include "geany.h" #include "filetypes.h" +#include "filetypesprivate.h" #include "highlighting.h" #include "support.h" #include "templates.h" @@ -43,29 +44,11 @@ #include "utils.h" #include "sciwrappers.h" #include "ui_utils.h" +#include "symbols.h"
#include <stdlib.h>
-#ifdef HAVE_REGEX_H -# include <regex.h> -#else -# include "gnuregex.h" -#endif
- -/* Private GeanyFiletype fields */ -typedef struct GeanyFiletypePrivate -{ - GtkWidget *menu_item; /* holds a pointer to the menu item for this filetype */ - gboolean keyfile_loaded; - regex_t error_regex; - gboolean error_regex_compiled; - gchar *last_string; /* last one compiled */ - gboolean custom; -} -GeanyFiletypePrivate; - - GPtrArray *filetypes_array = NULL; /* Dynamic array of filetype pointers */
static GHashTable *filetypes_hash = NULL; /* Hash of filetype pointers based on name keys */ @@ -1264,12 +1247,14 @@ g_free(result); }
+ ft->priv->symbol_list_sort_mode = utils_get_setting(integer, configh, config, "settings", + "symbol_list_sort_mode", SYMBOLS_SORT_BY_NAME); + /* read build settings */ build_load_menu(config, GEANY_BCS_FT, (gpointer)ft); build_load_menu(configh, GEANY_BCS_HOME_FT, (gpointer)ft); }
- /* simple wrapper function to print file errors in DEBUG mode */ static void load_system_keyfile(GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, GeanyFiletype *ft)
Modified: trunk/src/filetypes.h =================================================================== --- trunk/src/filetypes.h 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/src/filetypes.h 2010-09-30 13:50:33 UTC (rev 5262) @@ -129,8 +129,9 @@ struct GeanyFiletypePrivate *priv; /* must be last, append fields before this item */ #ifdef GEANY_PRIVATE /* Do not use following fields in plugins */ - GeanyBuildCommand *filecmds; /* these need to be visible since used in build.c so not in private part */ - GeanyBuildCommand *ftdefcmds; /* filetype dependent defaults for non_ft commands */ + /* TODO: move these fields into filetypesprivate.h */ + GeanyBuildCommand *filecmds; + GeanyBuildCommand *ftdefcmds; GeanyBuildCommand *execcmds; GeanyBuildCommand *homefilecmds; GeanyBuildCommand *homeexeccmds;
Added: trunk/src/filetypesprivate.h =================================================================== --- trunk/src/filetypesprivate.h (rev 0) +++ trunk/src/filetypesprivate.h 2010-09-30 13:50:33 UTC (rev 5262) @@ -0,0 +1,49 @@ +/* + * filetypesprivate.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2008-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + * Copyright 2008-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * $Id$ + */ + + +#ifndef GEANY_FILETYPES_PRIVATE_H +#define GEANY_FILETYPES_PRIVATE_H + +#ifdef HAVE_REGEX_H +# include <regex.h> +#else +# include "gnuregex.h" +#endif + + +/* Private GeanyFiletype fields */ +typedef struct GeanyFiletypePrivate +{ + GtkWidget *menu_item; /* holds a pointer to the menu item for this filetype */ + gboolean keyfile_loaded; + regex_t error_regex; + gboolean error_regex_compiled; + gchar *last_string; /* last one compiled */ + gboolean custom; + gint symbol_list_sort_mode; +} +GeanyFiletypePrivate; + +#endif
Property changes on: trunk/src/filetypesprivate.h ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2010-09-27 07:08:49 UTC (rev 5261) +++ trunk/src/utils.h 2010-09-30 13:50:33 UTC (rev 5262) @@ -57,6 +57,14 @@ #define utils_strdupa(str) \ strcpy(g_alloca(strlen(str) + 1), str)
+/* Get a keyfile setting, using the home keyfile if the key exists, + * otherwise system keyfile. */ +#define utils_get_setting(type, home, sys, group, key, default_val)\ + (g_key_file_has_key(home, group, key, NULL)) ?\ + utils_get_setting_##type(home, group, key, default_val) :\ + utils_get_setting_##type(sys, group, key, default_val) + + /** Iterates all the items in @a array using pointers. * @param item pointer to an item in @a array. * @param array C array to traverse.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.