SF.net SVN: geany:[5078] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jul 1 14:33:42 UTC 2010


Revision: 5078
          http://geany.svn.sourceforge.net/geany/?rev=5078&view=rev
Author:   ntrel
Date:     2010-07-01 14:33:41 +0000 (Thu, 01 Jul 2010)

Log Message:
-----------
Add filetypes.common fold_symbol_highlight color setting.
Add API macro foreach_range().

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-07-01 12:08:38 UTC (rev 5077)
+++ trunk/ChangeLog	2010-07-01 14:33:41 UTC (rev 5078)
@@ -3,6 +3,10 @@
  * scintilla/LexCPP.cxx, src/highlighting.c:
    Add C++ lexer property fold.cpp.comment.explicit (patch sent); set
    it disabled.
+ * src/utils.h, src/highlighting.c, doc/geany.txt, doc/geany.html,
+   data/filetypes.common:
+   Add filetypes.common fold_symbol_highlight color setting.
+   Add API macro foreach_range().
 
 
 2010-06-30  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/data/filetypes.common
===================================================================
--- trunk/data/filetypes.common	2010-07-01 12:08:38 UTC (rev 5077)
+++ trunk/data/filetypes.common	2010-07-01 14:33:41 UTC (rev 5078)
@@ -17,6 +17,7 @@
 # the following settings define the colours of the margins on the left side
 margin_linenumber=0x000000;0xd0d0d0;
 margin_folding=0x000000;0xdfdfdf;
+fold_symbol_highlight=0xffffff
 
 # background colour of the current line, only the second and third argument is interpreted
 # use the third argument to enable or disable the highlighting of the current line (has to be true/false)

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2010-07-01 12:08:38 UTC (rev 5077)
+++ trunk/doc/geany.html	2010-07-01 14:33:41 UTC (rev 5078)
@@ -4467,8 +4467,14 @@
 The fourth argument defines whether to use the background color.</p>
 <p class="last"><em>Example:</em> <tt class="docutils literal"><span class="pre">white_space=0xc0c0c0;0xffffff;true;true</span></tt></p>
 </dd>
+<dt>margin_linenumber</dt>
+<dd>Line number margin foreground and background colors.</dd>
 </dl>
 <dl class="docutils" id="folding-settings">
+<dt>margin_folding</dt>
+<dd>Fold margin foreground and background colors.</dd>
+<dt>fold_symbol_highlight</dt>
+<dd>Highlight color of folding symbols.</dd>
 <dt>folding_style</dt>
 <dd><p class="first">The style of folding icons. Only first and second arguments are
 used.</p>
@@ -6140,7 +6146,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-06-29 15:37 UTC.
+Generated on: 2010-07-01 14:28 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-07-01 12:08:38 UTC (rev 5077)
+++ trunk/doc/geany.txt	2010-07-01 14:33:41 UTC (rev 5078)
@@ -3812,8 +3812,17 @@
 
     *Example:* ``white_space=0xc0c0c0;0xffffff;true;true``
 
+margin_linenumber
+    Line number margin foreground and background colors.
+
 .. _Folding Settings:
 
+margin_folding
+    Fold margin foreground and background colors.
+
+fold_symbol_highlight
+    Highlight color of folding symbols.
+
 folding_style
     The style of folding icons. Only first and second arguments are
     used.

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2010-07-01 12:08:38 UTC (rev 5077)
+++ trunk/src/highlighting.c	2010-07-01 14:33:41 UTC (rev 5078)
@@ -79,6 +79,7 @@
 	GCS_BRACE_BAD,
 	GCS_MARGIN_LINENUMBER,
 	GCS_MARGIN_FOLDING,
+	GCS_FOLD_SYMBOL_HIGHLIGHT,
 	GCS_CURRENT_LINE,
 	GCS_CARET,
 	GCS_INDENT_GUIDE,
@@ -587,6 +588,7 @@
 	get_keyfile_style(config, config_home, "brace_bad", &common_style_set.styling[GCS_BRACE_BAD]);
 	get_keyfile_style(config, config_home, "margin_linenumber", &common_style_set.styling[GCS_MARGIN_LINENUMBER]);
 	get_keyfile_style(config, config_home, "margin_folding", &common_style_set.styling[GCS_MARGIN_FOLDING]);
+	get_keyfile_style(config, config_home, "fold_symbol_highlight", &common_style_set.styling[GCS_FOLD_SYMBOL_HIGHLIGHT]);
 	get_keyfile_style(config, config_home, "current_line", &common_style_set.styling[GCS_CURRENT_LINE]);
 	get_keyfile_style(config, config_home, "caret", &common_style_set.styling[GCS_CARET]);
 	get_keyfile_style(config, config_home, "indent_guide", &common_style_set.styling[GCS_INDENT_GUIDE]);
@@ -749,35 +751,26 @@
 			SSM(sci, SCI_MARKERDEFINE,  SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY);
 			break;
 	}
+	{
+		gint markers[] = {
+			SC_MARKNUM_FOLDEROPEN,
+			SC_MARKNUM_FOLDER,
+			SC_MARKNUM_FOLDERSUB,
+			SC_MARKNUM_FOLDERTAIL,
+			SC_MARKNUM_FOLDEREND,
+			SC_MARKNUM_FOLDEROPENMID,
+			SC_MARKNUM_FOLDERMIDTAIL
+		};
+		guint i;
 
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDEROPEN,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPEN,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDER,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDER,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDERSUB,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDERSUB,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDERTAIL,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDERTAIL,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDEREND,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDEREND,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDEROPENMID,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPENMID,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
-	SSM(sci, SCI_MARKERSETFORE, SC_MARKNUM_FOLDERMIDTAIL,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
-	SSM(sci, SCI_MARKERSETBACK, SC_MARKNUM_FOLDERMIDTAIL,
-		invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
+		foreach_range(i, G_N_ELEMENTS(markers))
+		{
+			SSM(sci, SCI_MARKERSETFORE, markers[i],
+				invert(common_style_set.styling[GCS_FOLD_SYMBOL_HIGHLIGHT].foreground));
+			SSM(sci, SCI_MARKERSETBACK, markers[i],
+				invert(common_style_set.styling[GCS_MARGIN_FOLDING].foreground));
+		}
+	}
 
 	/* set some common defaults */
 	sci_set_property(sci, "fold", "1");
@@ -795,7 +788,6 @@
 
 	SSM(sci, SCI_SETSTYLEBITS, SSM(sci, SCI_GETSTYLEBITSNEEDED, 0, 0), 0);
 
-	/* TODO maybe we want to split the colour and hicolour to allow more fine-grained control */
 	SSM(sci, SCI_SETFOLDMARGINCOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
 	SSM(sci, SCI_SETFOLDMARGINHICOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
 	set_sci_style(sci, STYLE_LINENUMBER, GEANY_FILETYPES_NONE, GCS_MARGIN_LINENUMBER);
@@ -848,9 +840,6 @@
 }
 
 
-#define foreach_range(i, size) \
-		for (i = 0; i < size; i++)
-
 /* names: the style names for the filetype. */
 static void load_style_entries(GKeyFile *config, GKeyFile *config_home, gint filetype_idx,
 		const gchar **names, gsize names_len)

Modified: trunk/src/utils.h
===================================================================
--- trunk/src/utils.h	2010-07-01 12:08:38 UTC (rev 5077)
+++ trunk/src/utils.h	2010-07-01 14:33:41 UTC (rev 5078)
@@ -107,7 +107,14 @@
 #define foreach_str(char_ptr, string) \
 	for (char_ptr = string; *char_ptr; char_ptr++)
 
+/** Iterates from 0 to @a size.
+ * @param i Integer.
+ * @param size Number of iterations.
+ * @since Geany 0.20. */
+#define foreach_range(i, size) \
+	for (i = 0; i < size; i++)
 
+
 void utils_open_browser(const gchar *uri);
 
 gint utils_get_line_endings(const gchar* buffer, glong size);


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