SF.net SVN: geany:[3890] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jun 22 15:26:44 UTC 2009


Revision: 3890
          http://geany.svn.sourceforge.net/geany/?rev=3890&view=rev
Author:   ntrel
Date:     2009-06-22 15:26:44 +0000 (Mon, 22 Jun 2009)

Log Message:
-----------
Make filetypes.common named styles use the "default" named style for
all missing style fields.
Set named styles to usually leave the background style empty. This
currently allows C-like filetypes to have a common default
background color.
Allow hard-coded colors to use -1 for the default color.
Add some highlighting style examples to the manual.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/data/filetypes.common
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/highlighting.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/ChangeLog	2009-06-22 15:26:44 UTC (rev 3890)
@@ -1,3 +1,16 @@
+2009-06-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/highlighting.c, doc/geany.txt, doc/geany.html,
+   data/filetypes.common, TODO:
+   Make filetypes.common named styles use the "default" named style for
+   all missing style fields.
+   Set named styles to usually leave the background style empty. This
+   currently allows C-like filetypes to have a common default
+   background color.
+   Allow hard-coded colors to use -1 for the default color.
+   Add some highlighting style examples to the manual.
+
+
 2009-06-21  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/templates.c:

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/TODO	2009-06-22 15:26:44 UTC (rev 3890)
@@ -9,7 +9,8 @@
 	Next version or later:
 	o documentation: list and explain filetype modes
 	o common default highlighting styles configurable for all
-	  programming languages (filetypes.common named styles now done)
+	  programming languages (done for C-like filetypes using
+	  filetypes.common named styles)
 	o configurable filetype and project make commands (e.g. using
 	  bud for D)
 	o (support for adding plugin filetypes - SCI_LOADLEXERLIBRARY?)

Modified: trunk/data/filetypes.common
===================================================================
--- trunk/data/filetypes.common	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/data/filetypes.common	2009-06-22 15:26:44 UTC (rev 3890)
@@ -1,8 +1,10 @@
 # For complete documentation of this file, please see Geany's main documentation
 [styling]
-# foreground;background;bold;italic - used for filetype All/None
-default=0x000000;0xffffff;false;false
+# use foreground;background;bold;italic or named_style,bold,italic
 
+# used for filetype All/None
+default=default
+
 # 3rd selection argument is true to override default foreground
 # 4th selection argument is true to override default background
 selection=0x000000;0xc0c0c0;false;false
@@ -47,7 +49,7 @@
 caret_width=1;0;false;false
 
 # set foreground and background colour of indentation guides
-indent_guide=0xc0c0c0;0xffffff;false;false
+indent_guide=0xc0c0c0;;false;false
 
 # third argument: if true, use this foreground color. If false, use the default value defined by the filetypes.
 # fourth argument: if true, use this background color. If false, use the default value defined by the filetypes.
@@ -87,17 +89,20 @@
 
 [named_styles]
 # style names to use in filetypes.* [styling] sections
+# use foreground;background;bold;italic
+# normally background should be left blank to use the "default" style
+
 default=0x000000;0xffffff;false;false
-comment=0xd00000;0xffffff;false;false
-commentdoc=0x3f5fbf;0xffffff;false;false
-number=0x007f00;0xffffff;false;false
+comment=0xd00000
+commentdoc=0x3f5fbf
+number=0x007f00
 # keyword
-word=0x00007f;0xffffff;true;false
-# e.g. types from global tags file
-word2=0x991111;0xffffff;true;false
-string=0xff901e;0xffffff;false;false
-preprocessor=0x007f7f;0xffffff;false;false
-operator=0x301010;0xffffff;false;false
+word=0x00007f;;true;false
+# e.g. global types from a *.c.tags file
+word2=0x991111;;true;false
+string=0xff901e
+preprocessor=0x007f7f
+operator=0x301010
 # unterminated string
 stringeol=0x000000;0xe0c0e0;false;false
-type=0x0000d0;0xffffff;true;false
+type=0x0000d0;;true;false

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/doc/geany.html	2009-06-22 15:26:44 UTC (rev 3890)
@@ -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-06-01" />
+<meta name="date" content="2009-06-20" />
 <style type="text/css">
 
 /*
@@ -139,7 +139,7 @@
 <br />Nick Treleaven
 <br />Frank Lanitz</td></tr>
 <tr><th class="docinfo-name">Date:</th>
-<td>2009-06-01</td></tr>
+<td>2009-06-20</td></tr>
 <tr><th class="docinfo-name">Version:</th>
 <td>0.18</td></tr>
 </tbody>
@@ -359,69 +359,72 @@
 <li><a class="reference" href="#global-configuration-file" id="id142" name="id142">Global configuration file</a></li>
 <li><a class="reference" href="#filetype-definition-files" id="id143" name="id143">Filetype definition files</a><ul>
 <li><a class="reference" href="#format" id="id144" name="id144">Format</a><ul>
-<li><a class="reference" href="#styling-section" id="id145" name="id145">[styling] Section</a></li>
-<li><a class="reference" href="#keywords-section" id="id146" name="id146">[keywords] Section</a></li>
-<li><a class="reference" href="#settings-section" id="id147" name="id147">[settings] Section</a></li>
-<li><a class="reference" href="#build-settings-section" id="id148" name="id148">[build_settings] Section</a></li>
+<li><a class="reference" href="#styling-section" id="id145" name="id145">[styling] Section</a><ul>
+<li><a class="reference" href="#using-a-named-style" id="id146" name="id146">Using a named style</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#special-file-filetypes-common" id="id149" name="id149">Special file filetypes.common</a><ul>
-<li><a class="reference" href="#named-styles-section" id="id150" name="id150">[named_styles] Section</a></li>
-<li><a class="reference" href="#id4" id="id151" name="id151">[styling] Section</a></li>
-<li><a class="reference" href="#id5" id="id152" name="id152">[settings] Section</a></li>
+<li><a class="reference" href="#keywords-section" id="id147" name="id147">[keywords] Section</a></li>
+<li><a class="reference" href="#settings-section" id="id148" name="id148">[settings] Section</a></li>
+<li><a class="reference" href="#build-settings-section" id="id149" name="id149">[build_settings] Section</a></li>
 </ul>
 </li>
+<li><a class="reference" href="#special-file-filetypes-common" id="id150" name="id150">Special file filetypes.common</a><ul>
+<li><a class="reference" href="#named-styles-section" id="id151" name="id151">[named_styles] Section</a></li>
+<li><a class="reference" href="#id4" id="id152" name="id152">[styling] Section</a></li>
+<li><a class="reference" href="#id5" id="id153" name="id153">[settings] Section</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#filetype-extensions" id="id153" name="id153">Filetype extensions</a></li>
-<li><a class="reference" href="#templates" id="id154" name="id154">Templates</a><ul>
-<li><a class="reference" href="#template-meta-data" id="id155" name="id155">Template meta data</a></li>
-<li><a class="reference" href="#file-templates" id="id156" name="id156">File templates</a><ul>
-<li><a class="reference" href="#custom-file-templates" id="id157" name="id157">Custom file templates</a></li>
-<li><a class="reference" href="#filetype-templates" id="id158" name="id158">Filetype templates</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-templates" id="id159" name="id159">Customizing templates</a><ul>
-<li><a class="reference" href="#template-wildcards" id="id160" name="id160">Template wildcards</a></li>
+<li><a class="reference" href="#filetype-extensions" id="id154" name="id154">Filetype extensions</a></li>
+<li><a class="reference" href="#templates" id="id155" name="id155">Templates</a><ul>
+<li><a class="reference" href="#template-meta-data" id="id156" name="id156">Template meta data</a></li>
+<li><a class="reference" href="#file-templates" id="id157" name="id157">File templates</a><ul>
+<li><a class="reference" href="#custom-file-templates" id="id158" name="id158">Custom file templates</a></li>
+<li><a class="reference" href="#filetype-templates" id="id159" name="id159">Filetype templates</a></li>
 </ul>
 </li>
+<li><a class="reference" href="#customizing-templates" id="id160" name="id160">Customizing templates</a><ul>
+<li><a class="reference" href="#template-wildcards" id="id161" name="id161">Template wildcards</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-the-toolbar" id="id161" name="id161">Customizing the toolbar</a><ul>
-<li><a class="reference" href="#available-toolbar-elements" id="id162" name="id162">Available toolbar elements</a></li>
 </ul>
 </li>
+<li><a class="reference" href="#customizing-the-toolbar" id="id162" name="id162">Customizing the toolbar</a><ul>
+<li><a class="reference" href="#available-toolbar-elements" id="id163" name="id163">Available toolbar elements</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#plugin-documentation" id="id163" name="id163">Plugin documentation</a><ul>
-<li><a class="reference" href="#instant-save" id="id164" name="id164">Instant Save</a></li>
-<li><a class="reference" href="#backup-copy" id="id165" name="id165">Backup Copy</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#contributing-to-this-document" id="id166" name="id166">Contributing to this document</a></li>
-<li><a class="reference" href="#scintilla-keyboard-commands" id="id167" name="id167">Scintilla keyboard commands</a><ul>
-<li><a class="reference" href="#keyboard-commands" id="id168" name="id168">Keyboard commands</a></li>
+<li><a class="reference" href="#plugin-documentation" id="id164" name="id164">Plugin documentation</a><ul>
+<li><a class="reference" href="#instant-save" id="id165" name="id165">Instant Save</a></li>
+<li><a class="reference" href="#backup-copy" id="id166" name="id166">Backup Copy</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#tips-and-tricks" id="id169" name="id169">Tips and tricks</a><ul>
-<li><a class="reference" href="#document-notebook" id="id170" name="id170">Document notebook</a></li>
-<li><a class="reference" href="#editor" id="id171" name="id171">Editor</a></li>
-<li><a class="reference" href="#interface" id="id172" name="id172">Interface</a></li>
-<li><a class="reference" href="#gtk-related" id="id173" name="id173">GTK-related</a></li>
+<li><a class="reference" href="#contributing-to-this-document" id="id167" name="id167">Contributing to this document</a></li>
+<li><a class="reference" href="#scintilla-keyboard-commands" id="id168" name="id168">Scintilla keyboard commands</a><ul>
+<li><a class="reference" href="#keyboard-commands" id="id169" name="id169">Keyboard commands</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#hidden-preferences" id="id174" name="id174">Hidden preferences</a></li>
-<li><a class="reference" href="#compile-time-options" id="id175" name="id175">Compile-time options</a><ul>
-<li><a class="reference" href="#src-geany-h" id="id176" name="id176">src/geany.h</a></li>
-<li><a class="reference" href="#project-h" id="id177" name="id177">project.h</a></li>
-<li><a class="reference" href="#editor-h" id="id178" name="id178">editor.h</a></li>
-<li><a class="reference" href="#keyfile-c" id="id179" name="id179">keyfile.c</a></li>
-<li><a class="reference" href="#build-h" id="id180" name="id180">build.h</a></li>
+<li><a class="reference" href="#tips-and-tricks" id="id170" name="id170">Tips and tricks</a><ul>
+<li><a class="reference" href="#document-notebook" id="id171" name="id171">Document notebook</a></li>
+<li><a class="reference" href="#editor" id="id172" name="id172">Editor</a></li>
+<li><a class="reference" href="#interface" id="id173" name="id173">Interface</a></li>
+<li><a class="reference" href="#gtk-related" id="id174" name="id174">GTK-related</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#gnu-general-public-license" id="id181" name="id181">GNU General Public License</a></li>
-<li><a class="reference" href="#license-for-scintilla-and-scite" id="id182" name="id182">License for Scintilla and SciTE</a></li>
+<li><a class="reference" href="#hidden-preferences" id="id175" name="id175">Hidden preferences</a></li>
+<li><a class="reference" href="#compile-time-options" id="id176" name="id176">Compile-time options</a><ul>
+<li><a class="reference" href="#src-geany-h" id="id177" name="id177">src/geany.h</a></li>
+<li><a class="reference" href="#project-h" id="id178" name="id178">project.h</a></li>
+<li><a class="reference" href="#editor-h" id="id179" name="id179">editor.h</a></li>
+<li><a class="reference" href="#keyfile-c" id="id180" name="id180">keyfile.c</a></li>
+<li><a class="reference" href="#build-h" id="id181" name="id181">build.h</a></li>
 </ul>
+</li>
+<li><a class="reference" href="#gnu-general-public-license" id="id182" name="id182">GNU General Public License</a></li>
+<li><a class="reference" href="#license-for-scintilla-and-scite" id="id183" name="id183">License for Scintilla and SciTE</a></li>
+</ul>
 </div>
 <div class="section">
 <h1><a class="toc-backref" href="#id11" id="introduction" name="introduction">Introduction</a></h1>
@@ -3333,13 +3336,19 @@
 <p>In this section the colors for syntax highlighting are defined. The
 manual format is:</p>
 <ul class="simple">
-<li><tt class="docutils literal"><span class="pre">key=foreground_color;background_color;bold;italic</span></tt></li>
+<li><tt class="docutils literal"><span class="pre">key=foreground_color;background_color;bold_flag;italic_flag</span></tt></li>
 </ul>
 <p>Colors have to be specified as RGB hex values prefixed by
 0x. For example red is 0xff0000, blue is 0x0000ff. The values are
 case-insensitive, but it is a good idea to use small letters. Bold
 and italic are flags and should only be "true" or "false". If their
 value is something other than "true" or "false", "false" is assumed.</p>
+<p>You can omit fields to use the <tt class="docutils literal"><span class="pre">"default"</span></tt> named style.</p>
+<p>E.g. <tt class="docutils literal"><span class="pre">key=0xff0000;;true</span></tt></p>
+<p>This makes the key style have red foreground text, default background
+color text and bold emphasis.</p>
+<div class="section">
+<h5><a class="toc-backref" href="#id146" id="using-a-named-style" name="using-a-named-style">Using a named style</a></h5>
 <p>The second format uses a <em>named style</em> name to reference a style
 defined in filetypes.common.</p>
 <ul class="simple">
@@ -3348,17 +3357,17 @@
 </ul>
 <p>The bold and italic parts are optional, and if present are used to
 toggle the bold or italic flags to the opposite of the named style's
-flags.</p>
-<div class="note">
-<p class="first admonition-title">Note</p>
-<p class="last">Commas are used for these so Geany can easily determine whether a
-named style is used or not.</p>
-</div>
+flags. In contrast to style definition booleans, they are a literal
+",bold,italic" and commas are used instead of semi-colons.</p>
+<p>E.g. <tt class="docutils literal"><span class="pre">key=comment,italic</span></tt></p>
+<p>This makes the key style match the <tt class="docutils literal"><span class="pre">"comment"</span></tt> named style, but with
+italic emphasis.</p>
 <p>To define named styles, see the filetypes.common <a class="reference" href="#named-styles-section">[named_styles]
 Section</a>.</p>
 </div>
+</div>
 <div class="section">
-<h4><a class="toc-backref" href="#id146" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
+<h4><a class="toc-backref" href="#id147" id="keywords-section" name="keywords-section">[keywords] Section</a></h4>
 <p>This section contains keys for different keyword lists specific to
 the filetype. Some filetypes do not support keywords, so adding a
 new key will not work. You can only add or remove keywords to/from
@@ -3369,7 +3378,7 @@
 </div>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id147" id="settings-section" name="settings-section">[settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id148" id="settings-section" name="settings-section">[settings] Section</a></h4>
 <dl class="docutils">
 <dt>extension</dt>
 <dd><p class="first">This is the default file extension used when saving files, not
@@ -3430,7 +3439,7 @@
 </dl>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id148" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id149" id="build-settings-section" name="build-settings-section">[build_settings] Section</a></h4>
 <dl class="docutils">
 <dt>error_regex</dt>
 <dd><p class="first">This is a GNU-style extended regular expression to parse a filename
@@ -3479,13 +3488,13 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id149" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
+<h3><a class="toc-backref" href="#id150" id="special-file-filetypes-common" name="special-file-filetypes-common">Special file filetypes.common</a></h3>
 <p>There is a special filetype definition file called
 filetypes.common. This file defines some general non-filetype-specific
 settings.</p>
 <p>See the <a class="reference" href="#format">Format</a> section for how to define styles.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id150" id="named-styles-section" name="named-styles-section">[named_styles] Section</a></h4>
+<h4><a class="toc-backref" href="#id151" id="named-styles-section" name="named-styles-section">[named_styles] Section</a></h4>
 <p>Named styles declared here can be used in the [styling] section of any
 filetypes.* file.</p>
 <p>For example:</p>
@@ -3510,7 +3519,7 @@
 </div>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id151" id="id4" name="id4">[styling] Section</a></h4>
+<h4><a class="toc-backref" href="#id152" id="id4" name="id4">[styling] Section</a></h4>
 <dl class="docutils">
 <dt>default</dt>
 <dd><p class="first">This is the default style. It is used for styling files without a
@@ -3665,7 +3674,7 @@
 </dl>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id152" id="id5" name="id5">[settings] Section</a></h4>
+<h4><a class="toc-backref" href="#id153" id="id5" name="id5">[settings] Section</a></h4>
 <dl class="docutils">
 <dt>whitespace_chars</dt>
 <dd><p class="first">Characters to treat as whitespace. These characters are ignored
@@ -3679,7 +3688,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id153" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
+<h2><a class="toc-backref" href="#id154" id="filetype-extensions" name="filetype-extensions">Filetype extensions</a></h2>
 <p>To change the default filetype extension used when saving a new file,
 see <a class="reference" href="#filetype-definition-files">Filetype definition files</a>.</p>
 <p>You can override the list of file extensions that Geany uses for each
@@ -3705,7 +3714,7 @@
 </pre>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id154" id="templates" name="templates">Templates</a></h2>
+<h2><a class="toc-backref" href="#id155" id="templates" name="templates">Templates</a></h2>
 <p>Geany supports the following templates:</p>
 <ul class="simple">
 <li>ChangeLog entry</li>
@@ -3728,7 +3737,7 @@
 function description won't contain the correct function name but "unknown"
 instead.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id155" id="template-meta-data" name="template-meta-data">Template meta data</a></h3>
+<h3><a class="toc-backref" href="#id156" id="template-meta-data" name="template-meta-data">Template meta data</a></h3>
 <p>Meta data can be used with all templates, but by default user set
 meta data is only used for the ChangeLog and File header templates.</p>
 <p>In the configuration dialog you can find a tab "Templates" (see
@@ -3738,7 +3747,7 @@
 at startup.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id156" id="file-templates" name="file-templates">File templates</a></h3>
+<h3><a class="toc-backref" href="#id157" id="file-templates" name="file-templates">File templates</a></h3>
 <p>File templates are templates used as the basis of a new file. To
 use them, choose the <em>New (with Template)</em> menu item from the <em>File</em>
 menu.</p>
@@ -3750,7 +3759,7 @@
 be placed anywhere, but is usually on the first line of the file,
 followed by a blank line.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id157" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
+<h4><a class="toc-backref" href="#id158" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
 <p>These are read from the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/files</span></tt> directory
 (created the first time Geany is started). The filetype to use is
 detected from the template file's extension, if any. For example, creating
@@ -3761,7 +3770,7 @@
 template.</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id158" id="filetype-templates" name="filetype-templates">Filetype templates</a></h4>
+<h4><a class="toc-backref" href="#id159" id="filetype-templates" name="filetype-templates">Filetype templates</a></h4>
 <p>Filetype template files are read from the <tt class="docutils literal"><span class="pre">~/.config/geany/templates</span></tt>
 directory, and are named "filetype." followed by the filetype
 name, e.g. "filetype.python", "filetype.sh", etc. If you are
@@ -3773,7 +3782,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id159" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
+<h3><a class="toc-backref" href="#id160" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
 <p>Each template can be customized to your needs. The templates are
 stored in the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/</span></tt> directory (see the section called
 <a class="reference" href="#command-line-options">Command line options</a> for further information about the configuration
@@ -3781,7 +3790,7 @@
 Geany ;-) ) and edit the template to your needs. There are some
 wildcards which will be automatically replaced by Geany at startup.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id160" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
+<h4><a class="toc-backref" href="#id161" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
 <p>All wildcards must be enclosed by "{" and "}", e.g. {date}.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -3902,7 +3911,7 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id161" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
+<h2><a class="toc-backref" href="#id162" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
 <p>You can add, remove and reorder the elements in the toolbar by editing
 the file <tt class="docutils literal"><span class="pre">ui_toolbar.xml</span></tt>.</p>
 <p>To override the system-wide configuration file, copy it from
@@ -3918,17 +3927,16 @@
 you wish and add or remove additional separators.
 This file must be valid XML, otherwise the global toolbar UI definition
 will be used instead.</p>
+<p>Your changes are applied once you save the file.</p>
 <div class="note">
 <p class="first admonition-title">Note</p>
 <ol class="last arabic simple">
 <li>You cannot add new actions which are not listed below.</li>
 <li>Everything you add or change must be inside the /ui/toolbar/ path.</li>
-<li>After you finish editing the file, you need to restart Geany
-for changes to take effect.</li>
 </ol>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id162" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
+<h3><a class="toc-backref" href="#id163" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
 <table border="1" class="docutils">
 <colgroup>
 <col width="19%" />
@@ -4042,9 +4050,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id163" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
+<h1><a class="toc-backref" href="#id164" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id164" id="instant-save" name="instant-save">Instant Save</a></h2>
+<h2><a class="toc-backref" href="#id165" id="instant-save" name="instant-save">Instant Save</a></h2>
 <p>This plugin sets on every new file (File->New or File-> New (with template))
 a randomly chosen filename and set its filetype appropriate to the used template
 or when no template was used, to a configurable default filetype.
@@ -4054,7 +4062,7 @@
 similar.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id165" id="backup-copy" name="backup-copy">Backup Copy</a></h2>
+<h2><a class="toc-backref" href="#id166" id="backup-copy" name="backup-copy">Backup Copy</a></h2>
 <p>This plugin creates a backup copy of the current file in Geany when it is
 saved. You can specify the directory where the backup copy is saved and
 you can configure the automatically added extension in the configure dialog
@@ -4064,7 +4072,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id166" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
+<h1><a class="toc-backref" href="#id167" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
 <p>This document (<tt class="docutils literal"><span class="pre">geany.txt</span></tt>) is written in <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
 (or "reST"). The source file for it is located in Geany's <tt class="docutils literal"><span class="pre">doc</span></tt>
 subdirectory.  If you intend on making changes, you should grab the
@@ -4084,7 +4092,7 @@
 and Fedora systems.</p>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id167" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
+<h1><a class="toc-backref" href="#id168" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
 <p>Copyright © 1998, 2006 Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>This appendix is distributed under the terms of the License for
 Scintilla and SciTE. A copy of this license can be found in the file
@@ -4093,7 +4101,7 @@
 Scintilla and SciTE</a>.</p>
 <p>20 June 2006</p>
 <div class="section">
-<h2><a class="toc-backref" href="#id168" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
+<h2><a class="toc-backref" href="#id169" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
 <p>Keyboard commands for Scintilla mostly follow common Windows and GTK+
 conventions. All move keys (arrows, page up/down, home and end)
 allows to extend or reduce the stream selection when holding the
@@ -4181,9 +4189,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id169" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
+<h1><a class="toc-backref" href="#id170" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id170" id="document-notebook" name="document-notebook">Document notebook</a></h2>
+<h2><a class="toc-backref" href="#id171" id="document-notebook" name="document-notebook">Document notebook</a></h2>
 <ul class="simple">
 <li>Double-click on empty space in the notebook tab bar to open a
 new document.</li>
@@ -4194,7 +4202,7 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id171" id="editor" name="editor">Editor</a></h2>
+<h2><a class="toc-backref" href="#id172" id="editor" name="editor">Editor</a></h2>
 <ul class="simple">
 <li>Alt-scroll wheel moves up/down a page.</li>
 <li>Ctrl-scroll wheel zooms in/out.</li>
@@ -4204,13 +4212,13 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id172" id="interface" name="interface">Interface</a></h2>
+<h2><a class="toc-backref" href="#id173" id="interface" name="interface">Interface</a></h2>
 <ul class="simple">
 <li>Double-click on a symbol-list group to expand or compact it.</li>
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id173" id="gtk-related" name="gtk-related">GTK-related</a></h2>
+<h2><a class="toc-backref" href="#id174" id="gtk-related" name="gtk-related">GTK-related</a></h2>
 <ul class="simple">
 <li>Scrolling the mouse wheel over a notebook tab bar will switch
 notebook pages.</li>
@@ -4225,7 +4233,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id174" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
+<h1><a class="toc-backref" href="#id175" id="hidden-preferences" name="hidden-preferences">Hidden preferences</a></h1>
 <p>There are some uncommon preferences that are not shown in the Preferences
 dialog. These can be set by editing <tt class="docutils literal"><span class="pre">~/.config/geany/geany.conf</span></tt>, then
 restarting Geany. Search for the key name, then edit the value. Example:</p>
@@ -4334,7 +4342,7 @@
 </table>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id175" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
+<h1><a class="toc-backref" href="#id176" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
 <p>There are some options which can only be changed at compile time,
 and some options which are used as the default for configurable
 options. To change these options, edit the appropriate source file
@@ -4346,7 +4354,7 @@
 <p class="last">Most users should not need to change these options.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id176" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
+<h2><a class="toc-backref" href="#id177" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4403,7 +4411,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id177" id="project-h" name="project-h">project.h</a></h2>
+<h2><a class="toc-backref" href="#id178" id="project-h" name="project-h">project.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4428,7 +4436,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id178" id="editor-h" name="editor-h">editor.h</a></h2>
+<h2><a class="toc-backref" href="#id179" id="editor-h" name="editor-h">editor.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4454,7 +4462,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id179" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
+<h2><a class="toc-backref" href="#id180" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
 <p>These are default settings that can be overridden in the <a class="reference" href="#preferences">Preferences</a> dialog.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -4535,7 +4543,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id180" id="build-h" name="build-h">build.h</a></h2>
+<h2><a class="toc-backref" href="#id181" id="build-h" name="build-h">build.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -4566,7 +4574,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id181" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
+<h1><a class="toc-backref" href="#id182" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
 <pre class="literal-block">
             GNU GENERAL PUBLIC LICENSE
                Version 2, June 1991
@@ -4911,7 +4919,7 @@
 </pre>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id182" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
+<h1><a class="toc-backref" href="#id183" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
 <p>Copyright 1998-2003 by Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>All Rights Reserved</p>
 <p>Permission to use, copy, modify, and distribute this software and
@@ -4931,7 +4939,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2009-06-03 15:37 UTC.
+Generated on: 2009-06-22 15:21 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	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/doc/geany.txt	2009-06-22 15:26:44 UTC (rev 3890)
@@ -2926,7 +2926,7 @@
 In this section the colors for syntax highlighting are defined. The
 manual format is:
 
-* ``key=foreground_color;background_color;bold;italic``
+* ``key=foreground_color;background_color;bold_flag;italic_flag``
 
 Colors have to be specified as RGB hex values prefixed by
 0x. For example red is 0xff0000, blue is 0x0000ff. The values are
@@ -2934,6 +2934,15 @@
 and italic are flags and should only be "true" or "false". If their
 value is something other than "true" or "false", "false" is assumed.
 
+You can omit fields to use the ``"default"`` named style.
+
+E.g. ``key=0xff0000;;true``
+
+This makes the key style have red foreground text, default background
+color text and bold emphasis.
+
+Using a named style
+*******************
 The second format uses a *named style* name to reference a style
 defined in filetypes.common.
 
@@ -2942,12 +2951,14 @@
 
 The bold and italic parts are optional, and if present are used to
 toggle the bold or italic flags to the opposite of the named style's
-flags.
+flags. In contrast to style definition booleans, they are a literal
+",bold,italic" and commas are used instead of semi-colons.
 
-.. note::
-    Commas are used for these so Geany can easily determine whether a
-    named style is used or not.
+E.g. ``key=comment,italic``
 
+This makes the key style match the ``"comment"`` named style, but with
+italic emphasis.
+
 To define named styles, see the filetypes.common `[named_styles]
 Section`_.
 

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2009-06-22 15:09:16 UTC (rev 3889)
+++ trunk/src/highlighting.c	2009-06-22 15:26:44 UTC (rev 3890)
@@ -112,9 +112,11 @@
 
 
 /* For filetypes.common [named_styles] section.
- * e.g. "comment" => &GeanyLexerStyle{0xd00000, 0xffffff, FALSE, FALSE} */
+ * 0xBBGGRR format.
+ * e.g. "comment" => &GeanyLexerStyle{0x0000d0, 0xffffff, FALSE, FALSE} */
 static GHashTable *named_style_hash = NULL;
 
+/* 0xBBGGRR format. */
 static GeanyLexerStyle gsd_default = {0x000000, 0xffffff, FALSE, FALSE};
 
 
@@ -302,7 +304,7 @@
 }
 
 
-/* convert 0x..RRGGBB to 0x..BBGGRR */
+/* Convert 0xRRGGBB to 0xBBGGRR, which scintilla expects. */
 static gint rotate_rgb(gint color)
 {
 	return ((color & 0xFF0000) >> 16) +
@@ -311,6 +313,22 @@
 }
 
 
+/* Convert a hard-coded style to scintilla format, allowing -1 to use the default color. */
+static void convert_hex_style(GeanyLexerStyle *style)
+{
+
+	if (style->foreground == -1)
+		style->foreground = gsd_default.foreground;
+	else
+		style->foreground = rotate_rgb(style->foreground);
+
+	if (style->background == -1)
+		style->background = gsd_default.background;
+	else
+		style->background = rotate_rgb(style->background);
+}
+
+
 /* foreground and background are in 0xRRGGBB format */
 static void get_keyfile_hex(GKeyFile *config, GKeyFile *configh,
 				const gchar *key,
@@ -319,8 +337,7 @@
 {
 	GeanyLexerStyle def = {foreground, background, bold, FALSE};
 
-	def.foreground = rotate_rgb(def.foreground);
-	def.background = rotate_rgb(def.background);
+	convert_hex_style(&def);
 	get_keyfile_style(config, configh, key, &def, style);
 }
 
@@ -459,6 +476,25 @@
 }
 
 
+static void add_named_style(GKeyFile *config, const gchar *key)
+{
+	const gchar group[] = "named_styles";
+	gchar **list;
+	gsize len;
+
+	list = g_key_file_get_string_list(config, group, key, &len, NULL);
+	/* we allow a named style to reference another style above it */
+	if (list && len >= 1)
+	{
+		GeanyLexerStyle *style = g_new0(GeanyLexerStyle, 1);
+
+		parse_keyfile_style(list, &gsd_default, style);
+		g_hash_table_insert(named_style_hash, g_strdup(key), style);
+	}
+	g_strfreev(list);
+}
+
+
 static void get_named_styles(GKeyFile *config)
 {
 	const gchar group[] = "named_styles";
@@ -470,23 +506,15 @@
 
 	while (1)
 	{
-		gchar **list;
-		gsize len;
 		const gchar *key = *ptr;
 
 		if (!key)
 			break;
 
-		list = g_key_file_get_string_list(config, group, key, &len, NULL);
-		/* we allow a named style to reference another style above it */
-		if (list && len >= 1)
-		{
-			GeanyLexerStyle *style = g_new0(GeanyLexerStyle, 1);
+		/* don't replace already read default style with system one */
+		if (!g_str_equal(key, "default"))
+			add_named_style(config, key);
 
-			parse_keyfile_style(list, &gsd_default, style);
-			g_hash_table_insert(named_style_hash, g_strdup(key), style);
-		}
-		g_strfreev(list);
 		ptr++;
 	}
 	g_strfreev(keys);
@@ -503,8 +531,14 @@
 
 	/* named styles */
 	named_style_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+	/* first set default to the "default" named style */
+	add_named_style(config, "default");
+	add_named_style(config_home, "default");
+	read_named_style("default", &gsd_default);
+
 	get_named_styles(config);
-	/* home overwrites any system named style */
+	/* home overrides any system named style */
 	get_named_styles(config_home);
 
 	get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &common_style_set.styling[GCS_DEFAULT]);
@@ -761,7 +795,8 @@
 #define foreach_range(i, size) \
 		for (i = 0; i < size; i++)
 
-/* If used, entries[n].style should have foreground and background in 0xRRGGBB format */
+/* entries contains the default styles for the filetype.
+ * If used, entries[n].style should have foreground and background in 0xRRGGBB format, or -1. */
 static void load_style_entries(GKeyFile *config, GKeyFile *config_home, gint filetype_idx,
 		StyleEntry *entries, gsize entries_len)
 {
@@ -779,8 +814,7 @@
 		{
 			GeanyLexerStyle *def = entry->style;
 
-			def->foreground = rotate_rgb(def->foreground);
-			def->background = rotate_rgb(def->background);
+			convert_hex_style(def);
 			get_keyfile_style(config, config_home, entry->name, def, style);
 		}
 	}
@@ -791,9 +825,9 @@
 static void
 styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, gint filetype_idx)
 {
-	static GeanyLexerStyle uuid = {0x404080, 0xffffff, FALSE, FALSE};
-	static GeanyLexerStyle verbatim = {0x301010, 0xffffff, FALSE, FALSE};
-	static GeanyLexerStyle regex = {0x105090, 0xffffff, FALSE, FALSE};
+	static GeanyLexerStyle uuid = {0x404080, -1, FALSE, FALSE};
+	static GeanyLexerStyle verbatim = {0x301010, -1, FALSE, FALSE};
+	static GeanyLexerStyle regex = {0x105090, -1, FALSE, FALSE};
 	StyleEntry entries[] =
  	{
 		{"default",		"default", NULL},


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list