Update syntax highlighting after changing the 'Invert syntax

highlighting colors' pref, instead of requiring a restart.
Remove filetypes.common invert_all option - use 'Invert syntax
highlighting colors' pref instead (closes #2854525).



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4184 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-09-14 11:53:08 +00:00
parent f4822ae10a
commit 683e09aae5
11 changed files with 49 additions and 62 deletions

View File

@ -2,6 +2,13 @@
* src/utils.c: * src/utils.c:
Fix opening filenames beginning with two dots (closes #2858487). Fix opening filenames beginning with two dots (closes #2858487).
* src/interface.c, src/highlighting.c, src/prefs.c, src/filetypes.c,
src/filetypes.h, src/main.c, doc/geany.txt, doc/geany.html,
data/filetypes.common, geany.glade:
Update syntax highlighting after changing the 'Invert syntax
highlighting colors' pref, instead of requiring a restart.
Remove filetypes.common invert_all option - use 'Invert syntax
highlighting colors' pref instead (closes #2854525).
2009-09-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2009-09-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -71,9 +71,6 @@ folding_style=1;1;false;false
# 2 to draw the line below folded text # 2 to draw the line below folded text
folding_horiz_line=2;0;false;false folding_horiz_line=2;0;false;false
# only first argument is interpreted, sets whether all defined colours should be inverted
invert_all=0;0;false;false
# only first and second argument is interpreted # only first and second argument is interpreted
# first argument: drawing of visual flags to indicate a line is wrapped. This is a bitmask of the # first argument: drawing of visual flags to indicate a line is wrapped. This is a bitmask of the
# values: 0 - No visual flags, 1 - Visual flag at end of subline of a wrapped line, 2 - Visual flag # values: 0 - No visual flags, 1 - Visual flag at end of subline of a wrapped line, 2 - Visual flag

View File

@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Geany</title> <title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2009-08-25" /> <meta name="date" content="2009-09-10" />
<style type="text/css"> <style type="text/css">
/* /*
@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
<br />Nick Treleaven <br />Nick Treleaven
<br />Frank Lanitz</td></tr> <br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th> <tr><th class="docinfo-name">Date:</th>
<td>2009-08-25</td></tr> <td>2009-09-10</td></tr>
<tr><th class="docinfo-name">Version:</th> <tr><th class="docinfo-name">Version:</th>
<td>0.19</td></tr> <td>0.19</td></tr>
</tbody> </tbody>
@ -2151,12 +2151,8 @@ characters this should work.</p>
<h4><a class="toc-backref" href="#id105" id="display" name="display">Display</a></h4> <h4><a class="toc-backref" href="#id105" id="display" name="display">Display</a></h4>
<dl class="docutils"> <dl class="docutils">
<dt>Invert syntax highlighting colors</dt> <dt>Invert syntax highlighting colors</dt>
<dd><p class="first">Use white text on a black background and invert all colors. <dd>Invert all colors, by default this makes white text on a black
If the <tt class="docutils literal"><span class="pre">invert_all</span></tt> setting in <tt class="docutils literal"><span class="pre">filetypes.common</span></tt> is set, this background.</dd>
option is always enabled. See <a class="reference" href="#special-file-filetypes-common">Special file filetypes.common</a>
for details.</p>
<p class="last">This option requires a restart of Geany. The value of this option</p>
</dd>
<dt>Show indendation guides</dt> <dt>Show indendation guides</dt>
<dd>Show vertical lines to help show how much leading indentation there <dd>Show vertical lines to help show how much leading indentation there
is on each line.</dd> is on each line.</dd>
@ -3956,15 +3952,6 @@ first argument is used.</p>
</ul> </ul>
<p class="last"><em>Example:</em> <tt class="docutils literal"><span class="pre">folding_horiz_line=0;0;false;false</span></tt></p> <p class="last"><em>Example:</em> <tt class="docutils literal"><span class="pre">folding_horiz_line=0;0;false;false</span></tt></p>
</dd> </dd>
<dt>invert_all</dt>
<dd><p class="first">Whether to invert all defined colors. This is useful if you like a
dark background color(e.g. black) and do not want to change every
single line. Please note, at time of writing this was only tested
with the C syntax highlighting.</p>
<p>Only first argument is interpreted. Set it to 1 to invert all
colors.</p>
<p class="last"><em>Example:</em> <tt class="docutils literal"><span class="pre">invert_all=0;0;false;false</span></tt></p>
</dd>
<dt>line_wrap_visuals</dt> <dt>line_wrap_visuals</dt>
<dd><p class="first">First argument: drawing of visual flags to indicate a line is wrapped. <dd><p class="first">First argument: drawing of visual flags to indicate a line is wrapped.
This is a bitmask of the values:</p> This is a bitmask of the values:</p>
@ -5413,7 +5400,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer"> <div class="footer">
<hr class="footer" /> <hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>. <a class="reference" href="geany.txt">View document source</a>.
Generated on: 2009-09-10 16:55 UTC. Generated on: 2009-09-14 11:50 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. 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> </div>

View File

@ -1883,12 +1883,8 @@ Display
``````` ```````
Invert syntax highlighting colors Invert syntax highlighting colors
Use white text on a black background and invert all colors. Invert all colors, by default this makes white text on a black
If the ``invert_all`` setting in ``filetypes.common`` is set, this background.
option is always enabled. See `Special file filetypes.common`_
for details.
This option requires a restart of Geany. The value of this option
Show indendation guides Show indendation guides
Show vertical lines to help show how much leading indentation there Show vertical lines to help show how much leading indentation there
@ -3517,17 +3513,6 @@ folding_horiz_line
*Example:* ``folding_horiz_line=0;0;false;false`` *Example:* ``folding_horiz_line=0;0;false;false``
invert_all
Whether to invert all defined colors. This is useful if you like a
dark background color(e.g. black) and do not want to change every
single line. Please note, at time of writing this was only tested
with the C syntax highlighting.
Only first argument is interpreted. Set it to 1 to invert all
colors.
*Example:* ``invert_all=0;0;false;false``
line_wrap_visuals line_wrap_visuals
First argument: drawing of visual flags to indicate a line is wrapped. First argument: drawing of visual flags to indicate a line is wrapped.
This is a bitmask of the values: This is a bitmask of the values:

View File

@ -6480,7 +6480,7 @@ Match braces</property>
<child> <child>
<widget class="GtkCheckButton" id="check_highlighting_invert"> <widget class="GtkCheckButton" id="check_highlighting_invert">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Use white text on a black background and invert all colors, this option requires a restart of Geany</property> <property name="tooltip" translatable="yes">Invert all colors, by default using white text on a black background</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Invert syntax highlighting colors</property> <property name="label" translatable="yes">Invert syntax highlighting colors</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>

View File

@ -1576,3 +1576,24 @@ GeanyFiletype *filetypes_index(gint idx)
{ {
return (idx >= 0 && idx < (gint) filetypes_array->len) ? filetypes[idx] : NULL; return (idx >= 0 && idx < (gint) filetypes_array->len) ? filetypes[idx] : NULL;
} }
void filetypes_reload(void)
{
guint i;
/* save possibly changed commands before re-reading them */
filetypes_save_commands();
/* reload filetype configs */
for (i = 0; i < filetypes_array->len; i++)
{
/* filetypes_load_config() will skip not loaded filetypes */
filetypes_load_config(i, TRUE);
}
/* update document styling */
documents_foreach(i)
document_reload_config(documents[i]);
}

View File

@ -156,6 +156,9 @@ void filetypes_init_types(void);
void filetypes_read_extensions(void); void filetypes_read_extensions(void);
void filetypes_reload(void);
GeanyFiletype *filetypes_index(gint idx); GeanyFiletype *filetypes_index(gint idx);
GeanyFiletype *filetypes_detect_from_document(GeanyDocument *doc); GeanyFiletype *filetypes_detect_from_document(GeanyDocument *doc);

View File

@ -100,7 +100,6 @@ static struct
{ {
GeanyLexerStyle styling[GCS_MAX]; GeanyLexerStyle styling[GCS_MAX];
FoldingStyle folding_style; FoldingStyle folding_style;
gboolean invert_all;
gchar *wordchars; gchar *wordchars;
} common_style_set; } common_style_set;
@ -393,7 +392,7 @@ static void get_keyfile_int(GKeyFile *config, GKeyFile *configh, const gchar *se
static guint invert(guint icolour) static guint invert(guint icolour)
{ {
if (common_style_set.invert_all) if (interface_prefs.highlighting_invert_all)
return utils_invert_color(icolour); return utils_invert_color(icolour);
return icolour; return icolour;
@ -565,9 +564,6 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_
1, 1, &tmp_style); 1, 1, &tmp_style);
common_style_set.folding_style.marker = tmp_style.foreground; common_style_set.folding_style.marker = tmp_style.foreground;
common_style_set.folding_style.lines = tmp_style.background; common_style_set.folding_style.lines = tmp_style.background;
get_keyfile_int(config, config_home, "styling", "invert_all",
0, 0, &tmp_style);
common_style_set.invert_all = tmp_style.foreground;
get_keyfile_int(config, config_home, "styling", "folding_horiz_line", get_keyfile_int(config, config_home, "styling", "folding_horiz_line",
2, 0, &tmp_style); 2, 0, &tmp_style);
common_style_set.folding_style.draw_line = tmp_style.foreground; common_style_set.folding_style.draw_line = tmp_style.foreground;
@ -596,8 +592,6 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_
common_style_set.styling[GCS_LINE_HEIGHT].background = tmp_style.background; common_style_set.styling[GCS_LINE_HEIGHT].background = tmp_style.background;
} }
common_style_set.invert_all = interface_prefs.highlighting_invert_all =
(common_style_set.invert_all || interface_prefs.highlighting_invert_all);
get_keyfile_wordchars(config, config_home, &common_style_set.wordchars); get_keyfile_wordchars(config, config_home, &common_style_set.wordchars);
whitespace_chars = get_keyfile_whitespace_chars(config, config_home); whitespace_chars = get_keyfile_whitespace_chars(config, config_home);
} }

View File

@ -3783,7 +3783,7 @@ create_prefs_dialog (void)
check_highlighting_invert = gtk_check_button_new_with_mnemonic (_("Invert syntax highlighting colors")); check_highlighting_invert = gtk_check_button_new_with_mnemonic (_("Invert syntax highlighting colors"));
gtk_widget_show (check_highlighting_invert); gtk_widget_show (check_highlighting_invert);
gtk_box_pack_start (GTK_BOX (vbox12), check_highlighting_invert, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox12), check_highlighting_invert, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_highlighting_invert, _("Use white text on a black background and invert all colors, this option requires a restart of Geany"), NULL); gtk_tooltips_set_tip (tooltips, check_highlighting_invert, _("Invert all colors, by default using white text on a black background"), NULL);
check_indent = gtk_check_button_new_with_mnemonic (_("Show indentation guides")); check_indent = gtk_check_button_new_with_mnemonic (_("Show indentation guides"));
gtk_widget_show (check_indent); gtk_widget_show (check_indent);

View File

@ -1182,8 +1182,6 @@ void *rpl_malloc(size_t n)
**/ **/
void main_reload_configuration(void) void main_reload_configuration(void)
{ {
guint i;
/* reload templates */ /* reload templates */
templates_free_templates(); templates_free_templates();
templates_init(); templates_init();
@ -1195,17 +1193,7 @@ void main_reload_configuration(void)
/* reload filetype extensions */ /* reload filetype extensions */
filetypes_read_extensions(); filetypes_read_extensions();
/* save possibly changed commands before re-reading them */ filetypes_reload();
filetypes_save_commands();
/* reload filetype configs */
for (i = 0; i < filetypes_array->len; i++)
{
/* filetypes_load_config() will skip not loaded filetypes */
filetypes_load_config(i, TRUE);
}
documents_foreach(i)
document_reload_config(documents[i]);
/* C tag names to ignore */ /* C tag names to ignore */
symbols_reload_config_files(); symbols_reload_config_files();

View File

@ -56,6 +56,7 @@
#include "toolbar.h" #include "toolbar.h"
#include "stash.h" #include "stash.h"
#include "keyfile.h" #include "keyfile.h"
#include "filetypes.h"
#ifdef HAVE_VTE #ifdef HAVE_VTE
# include "vte.h" # include "vte.h"
@ -739,10 +740,14 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
GtkWidget *widget; GtkWidget *widget;
guint i; guint i;
guint autoclose_brackets[5]; guint autoclose_brackets[5];
gboolean old_invert_all = interface_prefs.highlighting_invert_all;
/* Synchronize Stash settings */ /* Synchronize Stash settings */
prefs_action(PREF_UPDATE); prefs_action(PREF_UPDATE);
if (interface_prefs.highlighting_invert_all != old_invert_all)
filetypes_reload();
/* General settings */ /* General settings */
/* startup */ /* startup */
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session"); widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session");