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. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5262 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
e130292c86
commit
d8dce113a2
13
ChangeLog
13
ChangeLog
@ -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:
|
||||
|
@ -23,4 +23,7 @@ codebk=0x005f00;0xffffff;false;false
|
||||
# default extension used when saving files
|
||||
extension=mdml
|
||||
|
||||
# sort tags by appearance
|
||||
symbol_list_sort_mode=1
|
||||
|
||||
|
||||
|
@ -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 @@ comment_open=..
|
||||
|
||||
# context action command (please see Geany's main documentation for details)
|
||||
context_action_cmd=
|
||||
|
||||
# sort tags by appearance
|
||||
symbol_list_sort_mode=1
|
||||
|
@ -28,6 +28,9 @@ postproc=0xC05600;0xffffff;false;true
|
||||
# default extension used when saving files
|
||||
extension=txt2tags
|
||||
|
||||
# sort tags by appearance
|
||||
symbol_list_sort_mode=1
|
||||
|
||||
[keywords]
|
||||
primary=includeconf options toc
|
||||
|
||||
|
@ -4354,6 +4354,28 @@ context_action_cmd=firefox "<a class="reference" href="http://www.php.net/%
|
||||
<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 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
|
||||
<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>
|
||||
|
@ -3667,6 +3667,16 @@ lexer_filetype
|
||||
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
|
||||
````````````````````````
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "navqueue.h"
|
||||
#include "win32.h"
|
||||
#include "search.h"
|
||||
#include "filetypesprivate.h"
|
||||
|
||||
|
||||
GeanyFilePrefs file_prefs;
|
||||
@ -2472,6 +2473,7 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type,
|
||||
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);
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "geany.h"
|
||||
#include "filetypes.h"
|
||||
#include "filetypesprivate.h"
|
||||
#include "highlighting.h"
|
||||
#include "support.h"
|
||||
#include "templates.h"
|
||||
@ -43,28 +44,10 @@
|
||||
#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 */
|
||||
|
||||
@ -1264,12 +1247,14 @@ static void load_settings(gint ft_id, GKeyFile *config, GKeyFile *configh)
|
||||
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)
|
||||
|
@ -129,8 +129,9 @@ struct GeanyFiletype
|
||||
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;
|
||||
|
49
src/filetypesprivate.h
Normal file
49
src/filetypesprivate.h
Normal file
@ -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
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user