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:
		
							parent
							
								
									f4822ae10a
								
							
						
					
					
						commit
						683e09aae5
					
				@ -2,6 +2,13 @@
 | 
			
		||||
 | 
			
		||||
 * src/utils.c:
 | 
			
		||||
   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>
 | 
			
		||||
 | 
			
		||||
@ -71,9 +71,6 @@ folding_style=1;1;false;false
 | 
			
		||||
# 2 to draw the line below folded text
 | 
			
		||||
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
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@
 | 
			
		||||
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
 | 
			
		||||
<title>Geany</title>
 | 
			
		||||
<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">
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
 | 
			
		||||
<br />Nick Treleaven
 | 
			
		||||
<br />Frank Lanitz</td></tr>
 | 
			
		||||
<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>
 | 
			
		||||
<td>0.19</td></tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
@ -2151,12 +2151,8 @@ characters this should work.</p>
 | 
			
		||||
<h4><a class="toc-backref" href="#id105" id="display" name="display">Display</a></h4>
 | 
			
		||||
<dl class="docutils">
 | 
			
		||||
<dt>Invert syntax highlighting colors</dt>
 | 
			
		||||
<dd><p class="first">Use white text on a black background and invert all colors.
 | 
			
		||||
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
 | 
			
		||||
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>
 | 
			
		||||
<dd>Invert all colors, by default this makes white text on a black
 | 
			
		||||
background.</dd>
 | 
			
		||||
<dt>Show indendation guides</dt>
 | 
			
		||||
<dd>Show vertical lines to help show how much leading indentation there
 | 
			
		||||
is on each line.</dd>
 | 
			
		||||
@ -3956,15 +3952,6 @@ first argument is used.</p>
 | 
			
		||||
</ul>
 | 
			
		||||
<p class="last"><em>Example:</em> <tt class="docutils literal"><span class="pre">folding_horiz_line=0;0;false;false</span></tt></p>
 | 
			
		||||
</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>
 | 
			
		||||
<dd><p class="first">First argument: drawing of visual flags to indicate a line is wrapped.
 | 
			
		||||
This is a bitmask of the values:</p>
 | 
			
		||||
@ -5413,7 +5400,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: 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.
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
@ -1883,12 +1883,8 @@ Display
 | 
			
		||||
```````
 | 
			
		||||
 | 
			
		||||
Invert syntax highlighting colors
 | 
			
		||||
    Use white text on a black background and invert all colors.
 | 
			
		||||
    If the ``invert_all`` setting in ``filetypes.common`` is set, this
 | 
			
		||||
    option is always enabled. See `Special file filetypes.common`_
 | 
			
		||||
    for details.
 | 
			
		||||
 | 
			
		||||
    This option requires a restart of Geany. The value of this option
 | 
			
		||||
    Invert all colors, by default this makes white text on a black
 | 
			
		||||
    background.
 | 
			
		||||
 | 
			
		||||
Show indendation guides
 | 
			
		||||
    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``
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
    First argument: drawing of visual flags to indicate a line is wrapped.
 | 
			
		||||
    This is a bitmask of the values:
 | 
			
		||||
 | 
			
		||||
@ -6480,7 +6480,7 @@ Match braces</property>
 | 
			
		||||
			      <child>
 | 
			
		||||
				<widget class="GtkCheckButton" id="check_highlighting_invert">
 | 
			
		||||
				  <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="label" translatable="yes">Invert syntax highlighting colors</property>
 | 
			
		||||
				  <property name="use_underline">True</property>
 | 
			
		||||
 | 
			
		||||
@ -379,7 +379,7 @@ static void init_builtin_filetypes(void)
 | 
			
		||||
	ft->comment_open = NULL;
 | 
			
		||||
	ft->comment_close = NULL;
 | 
			
		||||
	ft->group = GEANY_FILETYPE_GROUP_MISC;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
#define TXT2TAGS
 | 
			
		||||
	ft = filetypes[GEANY_FILETYPES_TXT2TAGS];
 | 
			
		||||
	ft->lang = 37;
 | 
			
		||||
@ -1576,3 +1576,24 @@ GeanyFiletype *filetypes_index(gint idx)
 | 
			
		||||
{
 | 
			
		||||
	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]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -156,6 +156,9 @@ void filetypes_init_types(void);
 | 
			
		||||
 | 
			
		||||
void filetypes_read_extensions(void);
 | 
			
		||||
 | 
			
		||||
void filetypes_reload(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GeanyFiletype *filetypes_index(gint idx);
 | 
			
		||||
 | 
			
		||||
GeanyFiletype *filetypes_detect_from_document(GeanyDocument *doc);
 | 
			
		||||
 | 
			
		||||
@ -100,7 +100,6 @@ static struct
 | 
			
		||||
{
 | 
			
		||||
	GeanyLexerStyle	 styling[GCS_MAX];
 | 
			
		||||
	FoldingStyle	 folding_style;
 | 
			
		||||
	gboolean		 invert_all;
 | 
			
		||||
	gchar			*wordchars;
 | 
			
		||||
} common_style_set;
 | 
			
		||||
 | 
			
		||||
@ -393,7 +392,7 @@ static void get_keyfile_int(GKeyFile *config, GKeyFile *configh, const gchar *se
 | 
			
		||||
 | 
			
		||||
static guint invert(guint icolour)
 | 
			
		||||
{
 | 
			
		||||
	if (common_style_set.invert_all)
 | 
			
		||||
	if (interface_prefs.highlighting_invert_all)
 | 
			
		||||
		return utils_invert_color(icolour);
 | 
			
		||||
 | 
			
		||||
	return icolour;
 | 
			
		||||
@ -565,9 +564,6 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_
 | 
			
		||||
			1, 1, &tmp_style);
 | 
			
		||||
		common_style_set.folding_style.marker = tmp_style.foreground;
 | 
			
		||||
		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",
 | 
			
		||||
			2, 0, &tmp_style);
 | 
			
		||||
		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.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);
 | 
			
		||||
	whitespace_chars = get_keyfile_whitespace_chars(config, config_home);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3783,7 +3783,7 @@ create_prefs_dialog (void)
 | 
			
		||||
  check_highlighting_invert = gtk_check_button_new_with_mnemonic (_("Invert syntax highlighting colors"));
 | 
			
		||||
  gtk_widget_show (check_highlighting_invert);
 | 
			
		||||
  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"));
 | 
			
		||||
  gtk_widget_show (check_indent);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/main.c
									
									
									
									
									
								
							@ -1182,8 +1182,6 @@ void *rpl_malloc(size_t n)
 | 
			
		||||
 **/
 | 
			
		||||
void main_reload_configuration(void)
 | 
			
		||||
{
 | 
			
		||||
	guint i;
 | 
			
		||||
 | 
			
		||||
	/* reload templates */
 | 
			
		||||
	templates_free_templates();
 | 
			
		||||
	templates_init();
 | 
			
		||||
@ -1195,17 +1193,7 @@ void main_reload_configuration(void)
 | 
			
		||||
	/* reload filetype extensions */
 | 
			
		||||
	filetypes_read_extensions();
 | 
			
		||||
 | 
			
		||||
	/* 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);
 | 
			
		||||
	}
 | 
			
		||||
	documents_foreach(i)
 | 
			
		||||
		document_reload_config(documents[i]);
 | 
			
		||||
	filetypes_reload();
 | 
			
		||||
 | 
			
		||||
	/* C tag names to ignore */
 | 
			
		||||
	symbols_reload_config_files();
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,7 @@
 | 
			
		||||
#include "toolbar.h"
 | 
			
		||||
#include "stash.h"
 | 
			
		||||
#include "keyfile.h"
 | 
			
		||||
#include "filetypes.h"
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VTE
 | 
			
		||||
# include "vte.h"
 | 
			
		||||
@ -739,10 +740,14 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
 | 
			
		||||
		GtkWidget *widget;
 | 
			
		||||
		guint i;
 | 
			
		||||
		guint autoclose_brackets[5];
 | 
			
		||||
		gboolean old_invert_all = interface_prefs.highlighting_invert_all;
 | 
			
		||||
 | 
			
		||||
		/* Synchronize Stash settings */
 | 
			
		||||
		prefs_action(PREF_UPDATE);
 | 
			
		||||
 | 
			
		||||
		if (interface_prefs.highlighting_invert_all != old_invert_all)
 | 
			
		||||
			filetypes_reload();
 | 
			
		||||
 | 
			
		||||
		/* General settings */
 | 
			
		||||
		/* startup */
 | 
			
		||||
		widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
 | 
			
		||||
@ -1581,7 +1586,7 @@ void prefs_show_dialog(void)
 | 
			
		||||
				"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(3));
 | 
			
		||||
		g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "long_line_color"),
 | 
			
		||||
				"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(1));
 | 
			
		||||
		/* file chooser buttons in the tools tab 
 | 
			
		||||
		/* file chooser buttons in the tools tab
 | 
			
		||||
		g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "button_make"),
 | 
			
		||||
				"clicked", G_CALLBACK(on_prefs_tools_button_clicked), ui_lookup_widget(ui_widgets.prefs_dialog, "entry_com_make")); */
 | 
			
		||||
		g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "button_term"),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user