Add filetypes.common fold_symbol_highlight color setting.

Add API macro foreach_range().



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5078 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2010-07-01 14:33:41 +00:00
parent 9f3677d3e2
commit 4d8c71d5ab
6 changed files with 49 additions and 33 deletions

View File

@ -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>

View File

@ -17,6 +17,7 @@ brace_bad=0xff0000;0xFFFFFF;true;false
# 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)

View File

@ -4467,8 +4467,14 @@ or to use the color defined by each filetype for the white space.
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 @@ 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-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>

View File

@ -3812,8 +3812,17 @@ white_space
*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.

View File

@ -79,6 +79,7 @@ enum /* Geany common styling */
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 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_
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 @@ static void styleset_common(ScintillaObject *sci, filetype_id ft_id)
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 @@ static void styleset_common(ScintillaObject *sci, filetype_id ft_id)
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 @@ apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id)
}
#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)

View File

@ -107,6 +107,13 @@
#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);