2005-11-22 12:26:26 +00:00
|
|
|
/*
|
2006-09-30 11:13:58 +00:00
|
|
|
* highlighting.c - this file is part of Geany, a fast and lightweight IDE
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2010-01-01 22:55:18 +00:00
|
|
|
* Copyright 2005-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-05-15 19:49:30 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2005-11-27 20:46:36 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
2008-08-26 12:43:46 +00:00
|
|
|
/**
|
|
|
|
* @file highlighting.h
|
2007-02-24 11:41:56 +00:00
|
|
|
* Syntax highlighting for the different filetypes, using the Scintilla lexers.
|
|
|
|
*/
|
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
#include "geany.h"
|
|
|
|
|
2006-05-05 16:03:55 +00:00
|
|
|
#include <stdlib.h>
|
2009-05-30 11:57:56 +00:00
|
|
|
#include <ctype.h>
|
2009-06-03 15:42:01 +00:00
|
|
|
#include <string.h>
|
2006-01-03 12:45:31 +00:00
|
|
|
|
2006-07-04 21:31:08 +00:00
|
|
|
#include "SciLexer.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "highlighting.h"
|
2007-05-28 16:07:30 +00:00
|
|
|
#include "editor.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "utils.h"
|
2006-08-20 20:39:59 +00:00
|
|
|
#include "filetypes.h"
|
2006-10-02 11:31:54 +00:00
|
|
|
#include "symbols.h"
|
2009-01-14 19:19:08 +00:00
|
|
|
#include "ui_utils.h"
|
2009-07-07 11:57:50 +00:00
|
|
|
#include "utils.h"
|
2009-11-04 12:36:56 +00:00
|
|
|
#include "main.h"
|
|
|
|
#include "support.h"
|
2009-12-07 14:17:40 +00:00
|
|
|
#include "sciwrappers.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
#define GEANY_COLORSCHEMES_SUBDIR "colorschemes"
|
|
|
|
|
2007-07-07 11:33:32 +00:00
|
|
|
/* Whitespace has to be set after setting wordchars. */
|
2007-08-31 12:01:22 +00:00
|
|
|
#define GEANY_WHITESPACE_CHARS " \t" "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"
|
2007-07-07 11:33:32 +00:00
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2007-07-07 11:33:32 +00:00
|
|
|
static gchar *whitespace_chars;
|
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2006-11-04 22:38:11 +00:00
|
|
|
static void styleset_markup(ScintillaObject *sci, gboolean set_keywords);
|
|
|
|
|
2007-07-07 11:33:32 +00:00
|
|
|
|
2006-09-30 11:13:58 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-05-30 11:57:56 +00:00
|
|
|
gsize count; /* number of styles */
|
2008-08-26 12:43:46 +00:00
|
|
|
GeanyLexerStyle *styling; /* array of styles, NULL if not used or uninitialised */
|
2009-05-30 11:57:56 +00:00
|
|
|
gchar **keywords;
|
|
|
|
gchar *wordchars; /* NULL used for style sets with no styles */
|
2009-11-18 16:48:17 +00:00
|
|
|
gchar **property_keys;
|
|
|
|
gchar **property_values;
|
2006-09-30 11:13:58 +00:00
|
|
|
} StyleSet;
|
|
|
|
|
2009-12-07 18:08:35 +00:00
|
|
|
/* each filetype has a styleset but GEANY_FILETYPES_NONE uses common_style_set for styling */
|
2009-08-14 11:05:47 +00:00
|
|
|
static StyleSet *style_sets = NULL;
|
2006-09-30 11:13:58 +00:00
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
enum /* Geany common styling */
|
2006-09-30 11:13:58 +00:00
|
|
|
{
|
2007-03-09 18:14:34 +00:00
|
|
|
GCS_DEFAULT,
|
2006-09-30 11:13:58 +00:00
|
|
|
GCS_SELECTION,
|
|
|
|
GCS_BRACE_GOOD,
|
|
|
|
GCS_BRACE_BAD,
|
|
|
|
GCS_MARGIN_LINENUMBER,
|
|
|
|
GCS_MARGIN_FOLDING,
|
2010-07-01 14:33:41 +00:00
|
|
|
GCS_FOLD_SYMBOL_HIGHLIGHT,
|
2006-09-30 11:13:58 +00:00
|
|
|
GCS_CURRENT_LINE,
|
|
|
|
GCS_CARET,
|
|
|
|
GCS_INDENT_GUIDE,
|
|
|
|
GCS_WHITE_SPACE,
|
2008-03-07 15:42:46 +00:00
|
|
|
GCS_LINE_WRAP_VISUALS,
|
|
|
|
GCS_LINE_WRAP_INDENT,
|
|
|
|
GCS_TRANSLUCENCY,
|
2008-03-23 14:57:53 +00:00
|
|
|
GCS_MARKER_LINE,
|
|
|
|
GCS_MARKER_SEARCH,
|
2009-07-08 22:22:28 +00:00
|
|
|
GCS_MARKER_MARK,
|
2008-03-23 14:57:53 +00:00
|
|
|
GCS_MARKER_TRANSLUCENCY,
|
2009-07-08 22:21:45 +00:00
|
|
|
GCS_LINE_HEIGHT,
|
2009-12-29 18:45:21 +00:00
|
|
|
GCS_CALLTIPS,
|
2006-09-30 11:13:58 +00:00
|
|
|
GCS_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
2008-08-26 12:43:46 +00:00
|
|
|
GeanyLexerStyle styling[GCS_MAX];
|
2009-09-27 15:59:58 +00:00
|
|
|
|
2010-04-22 17:16:46 +00:00
|
|
|
/* icon style, 1-4 */
|
2009-09-27 15:59:58 +00:00
|
|
|
gint fold_marker;
|
2010-04-22 17:16:46 +00:00
|
|
|
/* vertical line style, 0-2 */
|
2009-09-27 15:59:58 +00:00
|
|
|
gint fold_lines;
|
2010-04-22 17:16:46 +00:00
|
|
|
/* horizontal line when folded, 0-2 */
|
2009-09-27 15:59:58 +00:00
|
|
|
gint fold_draw_line;
|
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
gchar *wordchars;
|
2006-09-30 11:13:58 +00:00
|
|
|
} common_style_set;
|
|
|
|
|
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
/* For filetypes.common [named_styles] section.
|
2009-06-22 15:26:44 +00:00
|
|
|
* 0xBBGGRR format.
|
|
|
|
* e.g. "comment" => &GeanyLexerStyle{0x0000d0, 0xffffff, FALSE, FALSE} */
|
2009-05-30 11:57:56 +00:00
|
|
|
static GHashTable *named_style_hash = NULL;
|
|
|
|
|
2009-09-28 15:33:05 +00:00
|
|
|
/* 0xBBGGRR format, set by "default" named style. */
|
2009-06-18 14:20:07 +00:00
|
|
|
static GeanyLexerStyle gsd_default = {0x000000, 0xffffff, FALSE, FALSE};
|
2009-05-30 11:57:56 +00:00
|
|
|
|
|
|
|
|
2009-10-14 16:00:40 +00:00
|
|
|
/* Note: use sciwrappers.h instead where possible.
|
|
|
|
* Do not use SSM in files unrelated to scintilla. */
|
2009-10-04 11:19:46 +00:00
|
|
|
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
|
|
|
|
|
2009-11-18 16:48:17 +00:00
|
|
|
/* filetypes should use the filetypes.foo [lexer_properties] group instead of hardcoding */
|
2009-10-04 11:15:26 +00:00
|
|
|
static void sci_set_property(ScintillaObject *sci, const gchar *name, const gchar *value)
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETPROPERTY, (uptr_t) name, (sptr_t) value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-14 11:13:22 +00:00
|
|
|
static void new_styleset(gint file_type_id, gint styling_count)
|
2006-09-30 11:13:58 +00:00
|
|
|
{
|
2008-08-26 09:48:18 +00:00
|
|
|
StyleSet *set = &style_sets[file_type_id];
|
|
|
|
|
|
|
|
set->count = styling_count;
|
2008-08-26 12:43:46 +00:00
|
|
|
set->styling = g_new0(GeanyLexerStyle, styling_count);
|
2006-09-30 11:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-14 11:13:22 +00:00
|
|
|
static void free_styleset(gint file_type_id)
|
2009-07-13 11:58:21 +00:00
|
|
|
{
|
|
|
|
StyleSet *style_ptr;
|
|
|
|
style_ptr = &style_sets[file_type_id];
|
|
|
|
|
|
|
|
style_ptr->count = 0;
|
|
|
|
g_free(style_ptr->styling);
|
|
|
|
style_ptr->styling = NULL;
|
|
|
|
g_strfreev(style_ptr->keywords);
|
|
|
|
style_ptr->keywords = NULL;
|
|
|
|
g_free(style_ptr->wordchars);
|
|
|
|
style_ptr->wordchars = NULL;
|
2009-11-18 16:48:17 +00:00
|
|
|
g_strfreev(style_ptr->property_keys);
|
|
|
|
style_ptr->property_keys = NULL;
|
|
|
|
g_strfreev(style_ptr->property_values);
|
|
|
|
style_ptr->property_values = NULL;
|
2009-07-13 11:58:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-29 12:54:56 +00:00
|
|
|
static void get_keyfile_keywords(GKeyFile *config, GKeyFile *configh,
|
2009-09-28 16:14:24 +00:00
|
|
|
const gchar *key, gint ft_id, gint pos)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-05-29 12:54:56 +00:00
|
|
|
const gchar section[] = "keywords";
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *result;
|
2009-09-28 16:14:24 +00:00
|
|
|
const gchar *default_value = "";
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-05-29 12:54:56 +00:00
|
|
|
if (config == NULL || configh == NULL)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2009-05-29 12:54:56 +00:00
|
|
|
style_sets[ft_id].keywords[pos] = g_strdup(default_value);
|
2006-04-27 18:06:35 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-05-15 19:49:30 +00:00
|
|
|
result = g_key_file_get_string(configh, section, key, NULL);
|
2006-04-27 18:06:35 +00:00
|
|
|
if (result == NULL)
|
2009-04-05 21:07:40 +00:00
|
|
|
result = g_key_file_get_string(config, section, key, NULL);
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (result == NULL)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2009-05-29 12:54:56 +00:00
|
|
|
style_sets[ft_id].keywords[pos] = g_strdup(default_value);
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
2006-05-09 16:07:27 +00:00
|
|
|
else
|
2006-05-15 19:49:30 +00:00
|
|
|
{
|
2009-05-29 12:54:56 +00:00
|
|
|
style_sets[ft_id].keywords[pos] = result;
|
2006-05-15 19:49:30 +00:00
|
|
|
}
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-23 11:42:10 +00:00
|
|
|
static void get_keyfile_wordchars(GKeyFile *config, GKeyFile *configh, gchar **wordchars)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
|
|
|
gchar *result;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (config == NULL || configh == NULL)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2006-11-23 11:42:10 +00:00
|
|
|
*wordchars = g_strdup(GEANY_WORDCHARS);
|
2006-04-27 18:06:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-15 19:49:30 +00:00
|
|
|
result = g_key_file_get_string(configh, "settings", "wordchars", NULL);
|
|
|
|
if (result == NULL) result = g_key_file_get_string(config, "settings", "wordchars", NULL);
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (result == NULL)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2006-11-23 11:42:10 +00:00
|
|
|
*wordchars = g_strdup(GEANY_WORDCHARS);
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
2006-05-09 16:07:27 +00:00
|
|
|
else
|
2006-09-30 11:13:58 +00:00
|
|
|
*wordchars = result;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-18 17:13:59 +00:00
|
|
|
static gboolean read_named_style(const gchar *named_style, GeanyLexerStyle *style)
|
2009-05-30 11:57:56 +00:00
|
|
|
{
|
2009-06-03 15:42:01 +00:00
|
|
|
GeanyLexerStyle *cs;
|
2009-06-18 14:20:07 +00:00
|
|
|
gchar *comma, *name = NULL;
|
2009-06-03 15:42:01 +00:00
|
|
|
const gchar *bold = NULL;
|
|
|
|
const gchar *italic = NULL;
|
|
|
|
|
2010-10-18 17:13:59 +00:00
|
|
|
g_return_val_if_fail(named_style, FALSE);
|
2009-07-07 11:57:50 +00:00
|
|
|
name = utils_strdupa(named_style); /* named_style must not be written to, may be a static string */
|
2009-06-03 15:42:01 +00:00
|
|
|
|
|
|
|
comma = strstr(name, ",");
|
|
|
|
if (comma)
|
|
|
|
{
|
|
|
|
bold = strstr(comma, ",bold");
|
|
|
|
italic = strstr(comma, ",italic");
|
|
|
|
*comma = '\0'; /* terminate name to make lookup work */
|
|
|
|
}
|
|
|
|
cs = g_hash_table_lookup(named_style_hash, name);
|
2009-05-30 11:57:56 +00:00
|
|
|
|
|
|
|
if (cs)
|
2009-06-03 15:42:01 +00:00
|
|
|
{
|
2009-06-18 14:20:07 +00:00
|
|
|
*style = *cs;
|
|
|
|
if (bold)
|
|
|
|
style->bold = !style->bold;
|
|
|
|
if (italic)
|
|
|
|
style->italic = !style->italic;
|
2009-06-03 15:42:01 +00:00
|
|
|
}
|
2009-05-30 11:57:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
*style = gsd_default;
|
|
|
|
}
|
2010-10-18 17:13:59 +00:00
|
|
|
return (cs != NULL);
|
2009-05-30 11:57:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-05 15:59:58 +00:00
|
|
|
static void parse_color(const gchar *str, gint *clr)
|
|
|
|
{
|
|
|
|
gint c;
|
|
|
|
|
|
|
|
/* ignore empty strings */
|
|
|
|
if (!NZV(str))
|
|
|
|
return;
|
|
|
|
|
|
|
|
c = utils_strtod(str, NULL, FALSE);
|
|
|
|
if (c > -1)
|
|
|
|
{
|
|
|
|
*clr = c;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
geany_debug("Bad color '%s'", str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
static void parse_keyfile_style(gchar **list,
|
|
|
|
const GeanyLexerStyle *default_style, GeanyLexerStyle *style)
|
2006-10-27 11:30:23 +00:00
|
|
|
{
|
2009-06-05 15:59:58 +00:00
|
|
|
gsize len;
|
|
|
|
gchar *str;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(default_style);
|
|
|
|
g_return_if_fail(style);
|
2006-10-27 11:30:23 +00:00
|
|
|
|
2009-06-05 15:59:58 +00:00
|
|
|
*style = *default_style;
|
2009-05-30 11:57:56 +00:00
|
|
|
|
2009-06-05 15:59:58 +00:00
|
|
|
if (!list)
|
|
|
|
return;
|
2006-10-27 11:30:23 +00:00
|
|
|
|
2009-06-05 15:59:58 +00:00
|
|
|
len = g_strv_length(list);
|
2006-10-27 11:30:23 +00:00
|
|
|
|
2009-06-05 15:59:58 +00:00
|
|
|
str = list[0];
|
|
|
|
if (len == 1 && isalpha(str[0]))
|
2010-10-18 17:13:59 +00:00
|
|
|
{
|
|
|
|
if (!read_named_style(str, style))
|
|
|
|
geany_debug(
|
|
|
|
"No named style '%s'! Check filetype styles or %s color scheme.",
|
|
|
|
str, NVL(editor_prefs.color_scheme, "filetypes.common"));
|
|
|
|
}
|
2009-05-29 13:35:55 +00:00
|
|
|
else
|
2009-06-05 15:59:58 +00:00
|
|
|
{
|
|
|
|
switch (len)
|
|
|
|
{
|
|
|
|
case 4:
|
|
|
|
style->italic = utils_atob(list[3]);
|
|
|
|
case 3:
|
|
|
|
style->bold = utils_atob(list[2]);
|
|
|
|
case 2:
|
|
|
|
parse_color(list[1], &style->background);
|
|
|
|
case 1:
|
|
|
|
parse_color(list[0], &style->foreground);
|
|
|
|
}
|
|
|
|
}
|
2009-05-30 11:57:56 +00:00
|
|
|
}
|
|
|
|
|
2006-10-27 11:30:23 +00:00
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
static void get_keyfile_style(GKeyFile *config, GKeyFile *configh,
|
2009-09-28 15:33:05 +00:00
|
|
|
const gchar *key_name, GeanyLexerStyle *style)
|
2009-05-30 11:57:56 +00:00
|
|
|
{
|
|
|
|
gchar **list;
|
|
|
|
gsize len;
|
|
|
|
|
|
|
|
g_return_if_fail(config);
|
|
|
|
g_return_if_fail(configh);
|
|
|
|
g_return_if_fail(key_name);
|
|
|
|
g_return_if_fail(style);
|
|
|
|
|
|
|
|
list = g_key_file_get_string_list(configh, "styling", key_name, &len, NULL);
|
|
|
|
if (list == NULL)
|
|
|
|
list = g_key_file_get_string_list(config, "styling", key_name, &len, NULL);
|
|
|
|
|
2009-09-28 15:33:05 +00:00
|
|
|
parse_keyfile_style(list, &gsd_default, style);
|
2006-10-27 11:30:23 +00:00
|
|
|
g_strfreev(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-22 15:26:44 +00:00
|
|
|
/* Convert 0xRRGGBB to 0xBBGGRR, which scintilla expects. */
|
2009-06-18 14:20:07 +00:00
|
|
|
static gint rotate_rgb(gint color)
|
|
|
|
{
|
|
|
|
return ((color & 0xFF0000) >> 16) +
|
|
|
|
(color & 0x00FF00) +
|
|
|
|
((color & 0x0000FF) << 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-27 16:38:37 +00:00
|
|
|
static void convert_int(const gchar *int_str, gint *val)
|
|
|
|
{
|
|
|
|
gchar *end;
|
|
|
|
gint v = strtol(int_str, &end, 10);
|
|
|
|
|
|
|
|
if (int_str != end)
|
|
|
|
*val = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Get first and second integer numbers, store in foreground and background fields of @a style. */
|
2006-09-30 11:13:58 +00:00
|
|
|
static void get_keyfile_int(GKeyFile *config, GKeyFile *configh, const gchar *section,
|
|
|
|
const gchar *key, gint fdefault_val, gint sdefault_val,
|
2008-08-26 12:43:46 +00:00
|
|
|
GeanyLexerStyle *style)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
|
|
|
gchar **list;
|
|
|
|
gsize len;
|
2009-09-27 16:38:37 +00:00
|
|
|
GeanyLexerStyle def = {fdefault_val, sdefault_val, FALSE, FALSE};
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(config);
|
|
|
|
g_return_if_fail(configh);
|
|
|
|
g_return_if_fail(section);
|
|
|
|
g_return_if_fail(key);
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2006-05-15 19:49:30 +00:00
|
|
|
list = g_key_file_get_string_list(configh, section, key, &len, NULL);
|
2009-04-05 21:07:40 +00:00
|
|
|
if (list == NULL)
|
|
|
|
list = g_key_file_get_string_list(config, section, key, &len, NULL);
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2009-09-27 16:38:37 +00:00
|
|
|
*style = def;
|
|
|
|
if (!list)
|
|
|
|
return;
|
2006-05-09 16:07:27 +00:00
|
|
|
|
2009-09-27 16:38:37 +00:00
|
|
|
if (list[0])
|
|
|
|
{
|
|
|
|
convert_int(list[0], &style->foreground);
|
|
|
|
if (list[1])
|
|
|
|
{
|
|
|
|
convert_int(list[1], &style->background);
|
|
|
|
}
|
|
|
|
}
|
2006-04-27 18:06:35 +00:00
|
|
|
g_strfreev(list);
|
|
|
|
}
|
|
|
|
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-09-27 15:59:58 +00:00
|
|
|
/* first or second can be NULL. */
|
|
|
|
static void get_keyfile_ints(GKeyFile *config, GKeyFile *configh, const gchar *section,
|
|
|
|
const gchar *key,
|
|
|
|
gint fdefault_val, gint sdefault_val,
|
|
|
|
gint *first, gint *second)
|
|
|
|
{
|
|
|
|
GeanyLexerStyle tmp_style;
|
|
|
|
|
|
|
|
get_keyfile_int(config, configh, section, key, fdefault_val, sdefault_val, &tmp_style);
|
|
|
|
if (first)
|
|
|
|
*first = tmp_style.foreground;
|
|
|
|
if (second)
|
|
|
|
*second = tmp_style.background;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-16 14:28:53 +00:00
|
|
|
static guint invert(guint icolour)
|
|
|
|
{
|
2009-09-14 11:53:08 +00:00
|
|
|
if (interface_prefs.highlighting_invert_all)
|
2009-05-08 17:00:28 +00:00
|
|
|
return utils_invert_color(icolour);
|
2006-06-16 14:28:53 +00:00
|
|
|
|
|
|
|
return icolour;
|
|
|
|
}
|
|
|
|
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2008-08-26 12:43:46 +00:00
|
|
|
static GeanyLexerStyle *get_style(guint ft_id, guint styling_index)
|
2006-02-10 20:52:17 +00:00
|
|
|
{
|
2009-08-14 11:05:47 +00:00
|
|
|
g_assert(ft_id < filetypes_array->len);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-04-05 21:07:40 +00:00
|
|
|
if (G_UNLIKELY(ft_id == GEANY_FILETYPES_NONE))
|
2008-08-26 09:48:18 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
g_assert(styling_index < GCS_MAX);
|
2008-08-26 09:48:18 +00:00
|
|
|
return &common_style_set.styling[styling_index];
|
|
|
|
}
|
2006-09-30 11:13:58 +00:00
|
|
|
else
|
2008-08-26 09:48:18 +00:00
|
|
|
{
|
|
|
|
StyleSet *set = &style_sets[ft_id];
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_assert(styling_index < set->count);
|
2008-08-26 09:48:18 +00:00
|
|
|
return &set->styling[styling_index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void set_sci_style(ScintillaObject *sci, gint style, guint ft_id, guint styling_index)
|
|
|
|
{
|
2008-08-26 12:43:46 +00:00
|
|
|
GeanyLexerStyle *style_ptr = get_style(ft_id, styling_index);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
|
|
|
SSM(sci, SCI_STYLESETFORE, style, invert(style_ptr->foreground));
|
|
|
|
SSM(sci, SCI_STYLESETBACK, style, invert(style_ptr->background));
|
|
|
|
SSM(sci, SCI_STYLESETBOLD, style, style_ptr->bold);
|
|
|
|
SSM(sci, SCI_STYLESETITALIC, style, style_ptr->italic);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
void highlighting_free_styles()
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-08-14 11:05:47 +00:00
|
|
|
guint i;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
for (i = 0; i < filetypes_array->len; i++)
|
2009-08-14 11:13:22 +00:00
|
|
|
free_styleset(i);
|
2009-05-30 11:57:56 +00:00
|
|
|
|
|
|
|
if (named_style_hash)
|
|
|
|
g_hash_table_destroy(named_style_hash);
|
2009-08-14 11:05:47 +00:00
|
|
|
|
2010-09-09 17:21:05 +00:00
|
|
|
g_free(style_sets);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-09 12:04:15 +00:00
|
|
|
static GString *get_global_typenames(gint lang)
|
2006-11-08 11:42:05 +00:00
|
|
|
{
|
|
|
|
GString *s = NULL;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (app->tm_workspace)
|
2006-11-08 11:42:05 +00:00
|
|
|
{
|
|
|
|
GPtrArray *tags_array = app->tm_workspace->global_tags;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (tags_array)
|
2006-11-08 11:42:05 +00:00
|
|
|
{
|
2007-10-09 12:04:15 +00:00
|
|
|
s = symbols_find_tags_as_string(tags_array, TM_GLOBAL_TYPE_MASK, lang);
|
2006-11-08 11:42:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-07 11:33:32 +00:00
|
|
|
static gchar*
|
|
|
|
get_keyfile_whitespace_chars(GKeyFile *config, GKeyFile *configh)
|
|
|
|
{
|
|
|
|
gchar *result;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (config == NULL || configh == NULL)
|
2007-07-07 11:33:32 +00:00
|
|
|
{
|
|
|
|
result = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = g_key_file_get_string(configh, "settings", "whitespace_chars", NULL);
|
|
|
|
if (result == NULL)
|
|
|
|
result = g_key_file_get_string(config, "settings", "whitespace_chars", NULL);
|
|
|
|
}
|
|
|
|
if (result == NULL)
|
|
|
|
result = g_strdup(GEANY_WHITESPACE_CHARS);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-22 15:26:44 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-30 11:57:56 +00:00
|
|
|
static void get_named_styles(GKeyFile *config)
|
|
|
|
{
|
|
|
|
const gchar group[] = "named_styles";
|
|
|
|
gchar **keys = g_key_file_get_keys(config, group, NULL, NULL);
|
|
|
|
gchar **ptr = keys;
|
|
|
|
|
|
|
|
if (!ptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
const gchar *key = *ptr;
|
|
|
|
|
|
|
|
if (!key)
|
|
|
|
break;
|
|
|
|
|
2009-06-22 15:26:44 +00:00
|
|
|
/* don't replace already read default style with system one */
|
|
|
|
if (!g_str_equal(key, "default"))
|
|
|
|
add_named_style(config, key);
|
2009-05-30 11:57:56 +00:00
|
|
|
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
g_strfreev(keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
static GKeyFile *utils_key_file_new(const gchar *filename)
|
|
|
|
{
|
|
|
|
GKeyFile *config = g_key_file_new();
|
|
|
|
|
|
|
|
g_key_file_load_from_file(config, filename, G_KEY_FILE_KEEP_COMMENTS, NULL);
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 14:47:07 +00:00
|
|
|
static void load_named_styles(GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-04 12:36:56 +00:00
|
|
|
const gchar *scheme = editor_prefs.color_scheme;
|
2009-11-05 18:03:34 +00:00
|
|
|
gboolean free_kf = FALSE;
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2009-07-13 11:58:21 +00:00
|
|
|
if (named_style_hash)
|
2009-07-15 14:23:02 +00:00
|
|
|
g_hash_table_destroy(named_style_hash); /* reloading */
|
|
|
|
|
|
|
|
named_style_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
|
2009-06-22 15:26:44 +00:00
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
if (NZV(scheme))
|
|
|
|
{
|
2009-11-05 18:03:34 +00:00
|
|
|
gchar *path, *path_home;
|
|
|
|
|
|
|
|
path = g_build_path(G_DIR_SEPARATOR_S, app->datadir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL);
|
|
|
|
path_home = g_build_path(G_DIR_SEPARATOR_S, app->configdir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL);
|
|
|
|
|
|
|
|
if (g_file_test(path, G_FILE_TEST_EXISTS) || g_file_test(path_home, G_FILE_TEST_EXISTS))
|
|
|
|
{
|
|
|
|
config = utils_key_file_new(path);
|
|
|
|
config_home = utils_key_file_new(path_home);
|
|
|
|
free_kf = TRUE;
|
|
|
|
}
|
|
|
|
/* if color scheme is missing, use default */
|
|
|
|
g_free(path);
|
|
|
|
g_free(path_home);
|
2009-11-04 12:36:56 +00:00
|
|
|
}
|
2009-06-22 15:26:44 +00:00
|
|
|
/* first set default to the "default" named style */
|
|
|
|
add_named_style(config, "default");
|
2009-11-04 14:59:16 +00:00
|
|
|
read_named_style("default", &gsd_default); /* in case user overrides but not with both colors */
|
2009-06-22 15:26:44 +00:00
|
|
|
add_named_style(config_home, "default");
|
|
|
|
read_named_style("default", &gsd_default);
|
|
|
|
|
2009-06-01 13:46:21 +00:00
|
|
|
get_named_styles(config);
|
2009-06-22 15:26:44 +00:00
|
|
|
/* home overrides any system named style */
|
2009-06-01 13:46:21 +00:00
|
|
|
get_named_styles(config_home);
|
|
|
|
|
2009-11-05 18:03:34 +00:00
|
|
|
if (free_kf)
|
2009-11-04 12:36:56 +00:00
|
|
|
{
|
|
|
|
g_key_file_free(config);
|
|
|
|
g_key_file_free(config_home);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-04 14:47:07 +00:00
|
|
|
load_named_styles(config, config_home);
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2009-09-28 15:33:05 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &common_style_set.styling[GCS_DEFAULT]);
|
|
|
|
get_keyfile_style(config, config_home, "selection", &common_style_set.styling[GCS_SELECTION]);
|
|
|
|
get_keyfile_style(config, config_home, "brace_good", &common_style_set.styling[GCS_BRACE_GOOD]);
|
|
|
|
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]);
|
2010-07-01 14:33:41 +00:00
|
|
|
get_keyfile_style(config, config_home, "fold_symbol_highlight", &common_style_set.styling[GCS_FOLD_SYMBOL_HIGHLIGHT]);
|
2009-09-28 15:33:05 +00:00
|
|
|
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]);
|
|
|
|
get_keyfile_style(config, config_home, "white_space", &common_style_set.styling[GCS_WHITE_SPACE]);
|
|
|
|
get_keyfile_style(config, config_home, "marker_line", &common_style_set.styling[GCS_MARKER_LINE]);
|
|
|
|
get_keyfile_style(config, config_home, "marker_search", &common_style_set.styling[GCS_MARKER_SEARCH]);
|
|
|
|
get_keyfile_style(config, config_home, "marker_mark", &common_style_set.styling[GCS_MARKER_MARK]);
|
2009-12-29 18:45:21 +00:00
|
|
|
get_keyfile_style(config, config_home, "calltips", &common_style_set.styling[GCS_CALLTIPS]);
|
2009-09-27 15:59:58 +00:00
|
|
|
|
|
|
|
get_keyfile_ints(config, config_home, "styling", "folding_style",
|
|
|
|
1, 1, &common_style_set.fold_marker, &common_style_set.fold_lines);
|
|
|
|
get_keyfile_ints(config, config_home, "styling", "folding_horiz_line",
|
|
|
|
2, 0, &common_style_set.fold_draw_line, NULL);
|
|
|
|
get_keyfile_ints(config, config_home, "styling", "caret_width",
|
|
|
|
1, 0, &common_style_set.styling[GCS_CARET].background, NULL); /* caret.foreground used earlier */
|
|
|
|
get_keyfile_int(config, config_home, "styling", "line_wrap_visuals",
|
|
|
|
3, 0, &common_style_set.styling[GCS_LINE_WRAP_VISUALS]);
|
|
|
|
get_keyfile_int(config, config_home, "styling", "line_wrap_indent",
|
|
|
|
0, 0, &common_style_set.styling[GCS_LINE_WRAP_INDENT]);
|
|
|
|
get_keyfile_int(config, config_home, "styling", "translucency",
|
|
|
|
256, 256, &common_style_set.styling[GCS_TRANSLUCENCY]);
|
|
|
|
get_keyfile_int(config, config_home, "styling", "marker_translucency",
|
|
|
|
256, 256, &common_style_set.styling[GCS_MARKER_TRANSLUCENCY]);
|
|
|
|
get_keyfile_int(config, config_home, "styling", "line_height",
|
|
|
|
0, 0, &common_style_set.styling[GCS_LINE_HEIGHT]);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-23 11:42:10 +00:00
|
|
|
get_keyfile_wordchars(config, config_home, &common_style_set.wordchars);
|
2007-07-07 11:33:32 +00:00
|
|
|
whitespace_chars = get_keyfile_whitespace_chars(config, config_home);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
static void styleset_common(ScintillaObject *sci, filetype_id ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
SSM(sci, SCI_STYLECLEARALL, 0, 0);
|
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) (ft_id == GEANY_FILETYPES_NONE ?
|
|
|
|
common_style_set.wordchars : style_sets[ft_id].wordchars));
|
|
|
|
/* have to set whitespace after setting wordchars */
|
|
|
|
SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars);
|
|
|
|
|
2008-03-07 15:42:46 +00:00
|
|
|
/* caret colour, style and width */
|
2006-09-30 11:13:58 +00:00
|
|
|
SSM(sci, SCI_SETCARETFORE, invert(common_style_set.styling[GCS_CARET].foreground), 0);
|
2007-03-20 18:15:07 +00:00
|
|
|
SSM(sci, SCI_SETCARETWIDTH, common_style_set.styling[GCS_CARET].background, 0);
|
2008-03-07 15:42:46 +00:00
|
|
|
if (common_style_set.styling[GCS_CARET].bold)
|
|
|
|
SSM(sci, SCI_SETCARETSTYLE, CARETSTYLE_BLOCK, 0);
|
|
|
|
else
|
|
|
|
SSM(sci, SCI_SETCARETSTYLE, CARETSTYLE_LINE, 0);
|
2006-07-30 16:02:21 +00:00
|
|
|
|
2009-07-08 22:21:45 +00:00
|
|
|
/* line height */
|
|
|
|
SSM(sci, SCI_SETEXTRAASCENT, common_style_set.styling[GCS_LINE_HEIGHT].foreground, 0);
|
|
|
|
SSM(sci, SCI_SETEXTRADESCENT, common_style_set.styling[GCS_LINE_HEIGHT].background, 0);
|
|
|
|
|
2009-05-11 15:56:08 +00:00
|
|
|
/* colourise the current line */
|
2006-09-30 11:13:58 +00:00
|
|
|
SSM(sci, SCI_SETCARETLINEBACK, invert(common_style_set.styling[GCS_CURRENT_LINE].background), 0);
|
2008-03-07 15:42:46 +00:00
|
|
|
/* bold=enable current line */
|
|
|
|
SSM(sci, SCI_SETCARETLINEVISIBLE, common_style_set.styling[GCS_CURRENT_LINE].bold, 0);
|
|
|
|
|
|
|
|
/* Translucency for current line and selection */
|
|
|
|
SSM(sci, SCI_SETCARETLINEBACKALPHA, common_style_set.styling[GCS_TRANSLUCENCY].foreground, 0);
|
|
|
|
SSM(sci, SCI_SETSELALPHA, common_style_set.styling[GCS_TRANSLUCENCY].background, 0);
|
|
|
|
|
|
|
|
/* line wrapping visuals */
|
|
|
|
SSM(sci, SCI_SETWRAPVISUALFLAGS,
|
|
|
|
common_style_set.styling[GCS_LINE_WRAP_VISUALS].foreground, 0);
|
|
|
|
SSM(sci, SCI_SETWRAPVISUALFLAGSLOCATION,
|
|
|
|
common_style_set.styling[GCS_LINE_WRAP_VISUALS].background, 0);
|
|
|
|
SSM(sci, SCI_SETWRAPSTARTINDENT, common_style_set.styling[GCS_LINE_WRAP_INDENT].foreground, 0);
|
2009-07-04 09:21:44 +00:00
|
|
|
SSM(sci, SCI_SETWRAPINDENTMODE, common_style_set.styling[GCS_LINE_WRAP_INDENT].background, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-10-25 18:57:00 +00:00
|
|
|
/* Error indicator */
|
|
|
|
SSM(sci, SCI_INDICSETSTYLE, GEANY_INDICATOR_ERROR, INDIC_SQUIGGLE);
|
|
|
|
SSM(sci, SCI_INDICSETFORE, GEANY_INDICATOR_ERROR, invert(rotate_rgb(0xff0000)));
|
|
|
|
|
|
|
|
/* Search indicator, used for 'Mark' matches */
|
|
|
|
SSM(sci, SCI_INDICSETSTYLE, GEANY_INDICATOR_SEARCH, INDIC_ROUNDBOX);
|
2009-07-08 22:22:28 +00:00
|
|
|
SSM(sci, SCI_INDICSETFORE, GEANY_INDICATOR_SEARCH,
|
|
|
|
invert(common_style_set.styling[GCS_MARKER_SEARCH].background));
|
|
|
|
SSM(sci, SCI_INDICSETALPHA, GEANY_INDICATOR_SEARCH, 60);
|
2006-07-14 10:15:12 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* define marker symbols
|
|
|
|
* 0 -> line marker */
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, 0, SC_MARK_SHORTARROW);
|
2008-03-23 14:57:53 +00:00
|
|
|
SSM(sci, SCI_MARKERSETFORE, 0, invert(common_style_set.styling[GCS_MARKER_LINE].foreground));
|
|
|
|
SSM(sci, SCI_MARKERSETBACK, 0, invert(common_style_set.styling[GCS_MARKER_LINE].background));
|
|
|
|
SSM(sci, SCI_MARKERSETALPHA, 0, common_style_set.styling[GCS_MARKER_TRANSLUCENCY].foreground);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* 1 -> user marker */
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, 1, SC_MARK_PLUS);
|
2009-07-08 22:22:28 +00:00
|
|
|
SSM(sci, SCI_MARKERSETFORE, 1, invert(common_style_set.styling[GCS_MARKER_MARK].foreground));
|
|
|
|
SSM(sci, SCI_MARKERSETBACK, 1, invert(common_style_set.styling[GCS_MARKER_MARK].background));
|
2008-03-23 14:57:53 +00:00
|
|
|
SSM(sci, SCI_MARKERSETALPHA, 1, common_style_set.styling[GCS_MARKER_TRANSLUCENCY].background);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* 2 -> folding marker, other folding settings */
|
2006-02-26 18:19:28 +00:00
|
|
|
SSM(sci, SCI_SETMARGINTYPEN, 2, SC_MARGIN_SYMBOL);
|
|
|
|
SSM(sci, SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS);
|
2006-11-07 18:53:39 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* drawing a horizontal line when text if folded */
|
2009-09-27 15:59:58 +00:00
|
|
|
switch (common_style_set.fold_draw_line)
|
2006-11-07 18:53:39 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETFOLDFLAGS, 4, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETFOLDFLAGS, 16, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
SSM(sci, SCI_SETFOLDFLAGS, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* choose the folding style - boxes or circles, I prefer boxes, so it is default ;-) */
|
2010-04-22 17:16:46 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY);
|
2009-09-27 15:59:58 +00:00
|
|
|
switch (common_style_set.fold_marker)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
|
|
|
case 2:
|
2010-04-22 17:16:46 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED);
|
2006-04-27 18:06:35 +00:00
|
|
|
break;
|
2006-05-09 16:07:27 +00:00
|
|
|
default:
|
2010-04-22 17:16:46 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_ARROWDOWN);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_ARROW);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_PLUS);
|
2006-04-27 18:06:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* choose the folding style - straight or curved, I prefer straight, so it is default ;-) */
|
2009-09-27 15:59:58 +00:00
|
|
|
switch (common_style_set.fold_lines)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
|
|
|
case 2:
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE);
|
2010-04-22 17:16:46 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
|
2006-04-27 18:06:35 +00:00
|
|
|
break;
|
|
|
|
default:
|
2009-09-16 14:13:38 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER);
|
2010-04-22 17:16:46 +00:00
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY);
|
|
|
|
SSM(sci, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY);
|
2006-04-27 18:06:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-07-01 14:33:41 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2010-07-01 11:49:30 +00:00
|
|
|
/* set some common defaults */
|
2009-10-04 11:15:26 +00:00
|
|
|
sci_set_property(sci, "fold", "1");
|
|
|
|
sci_set_property(sci, "fold.compact", "0");
|
2010-06-30 11:34:11 +00:00
|
|
|
sci_set_property(sci, "fold.comment", "1");
|
2009-10-04 11:15:26 +00:00
|
|
|
sci_set_property(sci, "fold.preprocessor", "1");
|
|
|
|
sci_set_property(sci, "fold.at.else", "1");
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* bold (3rd argument) is whether to override default foreground selection */
|
2006-09-30 11:13:58 +00:00
|
|
|
if (common_style_set.styling[GCS_SELECTION].bold)
|
|
|
|
SSM(sci, SCI_SETSELFORE, 1, invert(common_style_set.styling[GCS_SELECTION].foreground));
|
2008-02-27 13:17:29 +00:00
|
|
|
/* italic (4th argument) is whether to override default background selection */
|
2006-09-30 11:13:58 +00:00
|
|
|
if (common_style_set.styling[GCS_SELECTION].italic)
|
|
|
|
SSM(sci, SCI_SETSELBACK, 1, invert(common_style_set.styling[GCS_SELECTION].background));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-09-28 18:07:08 +00:00
|
|
|
SSM(sci, SCI_SETSTYLEBITS, SSM(sci, SCI_GETSTYLEBITSNEEDED, 0, 0), 0);
|
2006-06-16 14:28:53 +00:00
|
|
|
|
2006-09-30 11:13:58 +00:00
|
|
|
SSM(sci, SCI_SETFOLDMARGINCOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
|
2010-05-08 13:10:14 +00:00
|
|
|
SSM(sci, SCI_SETFOLDMARGINHICOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));
|
2008-05-07 13:54:21 +00:00
|
|
|
set_sci_style(sci, STYLE_LINENUMBER, GEANY_FILETYPES_NONE, GCS_MARGIN_LINENUMBER);
|
|
|
|
set_sci_style(sci, STYLE_BRACELIGHT, GEANY_FILETYPES_NONE, GCS_BRACE_GOOD);
|
|
|
|
set_sci_style(sci, STYLE_BRACEBAD, GEANY_FILETYPES_NONE, GCS_BRACE_BAD);
|
|
|
|
set_sci_style(sci, STYLE_INDENTGUIDE, GEANY_FILETYPES_NONE, GCS_INDENT_GUIDE);
|
2006-08-13 15:04:30 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* bold = common whitespace settings enabled */
|
2006-09-30 11:13:58 +00:00
|
|
|
SSM(sci, SCI_SETWHITESPACEFORE, common_style_set.styling[GCS_WHITE_SPACE].bold,
|
|
|
|
invert(common_style_set.styling[GCS_WHITE_SPACE].foreground));
|
2007-05-15 15:39:26 +00:00
|
|
|
SSM(sci, SCI_SETWHITESPACEBACK, common_style_set.styling[GCS_WHITE_SPACE].italic,
|
2006-09-30 11:13:58 +00:00
|
|
|
invert(common_style_set.styling[GCS_WHITE_SPACE].background));
|
2009-12-29 18:45:21 +00:00
|
|
|
|
|
|
|
if (common_style_set.styling[GCS_CALLTIPS].bold)
|
|
|
|
SSM(sci, SCI_CALLTIPSETFORE, invert(common_style_set.styling[GCS_CALLTIPS].foreground), 1);
|
|
|
|
if (common_style_set.styling[GCS_CALLTIPS].italic)
|
|
|
|
SSM(sci, SCI_CALLTIPSETBACK, invert(common_style_set.styling[GCS_CALLTIPS].background), 1);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-07 13:24:11 +00:00
|
|
|
/* Merge & assign global typedefs and user secondary keywords.
|
|
|
|
* keyword_idx is used for both style_sets[].keywords and scintilla keyword style number */
|
|
|
|
static void merge_type_keywords(ScintillaObject *sci, gint ft_id, gint keyword_idx)
|
2007-03-02 16:04:29 +00:00
|
|
|
{
|
2009-12-07 13:24:11 +00:00
|
|
|
const gchar *user_words = style_sets[ft_id].keywords[keyword_idx];
|
2007-03-02 16:04:29 +00:00
|
|
|
GString *s;
|
2007-03-09 13:52:26 +00:00
|
|
|
|
2009-12-07 13:24:11 +00:00
|
|
|
s = get_global_typenames(filetypes[ft_id]->lang);
|
2009-04-05 21:07:40 +00:00
|
|
|
if (G_UNLIKELY(s == NULL))
|
2007-03-02 16:04:29 +00:00
|
|
|
s = g_string_sized_new(200);
|
|
|
|
else
|
2008-02-27 13:17:29 +00:00
|
|
|
g_string_append_c(s, ' '); /* append a space as delimiter to the existing list of words */
|
2007-03-09 13:52:26 +00:00
|
|
|
|
2007-03-02 16:04:29 +00:00
|
|
|
g_string_append(s, user_words);
|
2007-03-09 13:52:26 +00:00
|
|
|
|
2009-12-07 13:24:11 +00:00
|
|
|
sci_set_keywords(sci, keyword_idx, s->str);
|
2007-03-02 16:04:29 +00:00
|
|
|
g_string_free(s, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-11 15:01:24 +00:00
|
|
|
/* All stylesets except None should call this. */
|
|
|
|
static void
|
|
|
|
apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id)
|
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
g_assert(ft_id != GEANY_FILETYPES_NONE);
|
2008-10-01 17:17:33 +00:00
|
|
|
|
2007-07-11 15:01:24 +00:00
|
|
|
SSM(sci, SCI_SETLEXER, lexer, 0);
|
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
styleset_common(sci, ft_id);
|
2007-07-11 15:01:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-28 15:55:49 +00:00
|
|
|
/* names: the style names for the filetype. */
|
2009-06-18 14:20:07 +00:00
|
|
|
static void load_style_entries(GKeyFile *config, GKeyFile *config_home, gint filetype_idx,
|
2009-09-28 15:55:49 +00:00
|
|
|
const gchar **names, gsize names_len)
|
2009-06-18 14:20:07 +00:00
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
2009-09-28 15:55:49 +00:00
|
|
|
foreach_range(i, names_len)
|
2009-06-18 14:20:07 +00:00
|
|
|
{
|
2009-09-28 15:55:49 +00:00
|
|
|
const gchar *name = names[i];
|
2009-06-18 14:20:07 +00:00
|
|
|
GeanyLexerStyle *style = &style_sets[filetype_idx].styling[i];
|
|
|
|
|
2009-09-28 15:33:05 +00:00
|
|
|
get_keyfile_style(config, config_home, name, style);
|
2009-06-18 14:20:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-28 15:55:49 +00:00
|
|
|
/* styles: the style IDs for the filetype.
|
|
|
|
* STYLE_DEFAULT will be set to match the first style. */
|
|
|
|
static void apply_style_entries(ScintillaObject *sci, gint filetype_idx,
|
|
|
|
gint *styles, gsize styles_len)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
g_return_if_fail(styles_len > 0);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, filetype_idx, 0);
|
|
|
|
|
|
|
|
foreach_range(i, styles_len)
|
|
|
|
set_sci_style(sci, styles[i], filetype_idx, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-14 11:13:22 +00:00
|
|
|
/* call new_styleset(filetype_idx, >= 20) before using this. */
|
2006-12-04 14:57:06 +00:00
|
|
|
static void
|
|
|
|
styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, gint filetype_idx)
|
2006-10-27 11:30:23 +00:00
|
|
|
{
|
2009-09-28 15:33:05 +00:00
|
|
|
const gchar *entries[] =
|
2009-06-18 14:20:07 +00:00
|
|
|
{
|
2009-09-28 15:33:05 +00:00
|
|
|
"default",
|
|
|
|
"comment",
|
|
|
|
"commentline",
|
|
|
|
"commentdoc",
|
|
|
|
"number",
|
|
|
|
"word",
|
|
|
|
"word2",
|
|
|
|
"string",
|
|
|
|
"character",
|
|
|
|
"uuid",
|
|
|
|
"preprocessor",
|
|
|
|
"operator",
|
|
|
|
"identifier",
|
|
|
|
"stringeol",
|
|
|
|
"verbatim",
|
|
|
|
"regex",
|
|
|
|
"commentlinedoc",
|
|
|
|
"commentdockeyword",
|
|
|
|
"commentdockeyworderror",
|
|
|
|
"globalclass"
|
2006-10-27 11:30:23 +00:00
|
|
|
};
|
|
|
|
|
2009-12-03 16:08:06 +00:00
|
|
|
new_styleset(filetype_idx, G_N_ELEMENTS(entries));
|
2009-06-18 14:20:07 +00:00
|
|
|
load_style_entries(config, config_home, filetype_idx, entries, G_N_ELEMENTS(entries));
|
2006-12-04 14:57:06 +00:00
|
|
|
}
|
2006-10-27 11:30:23 +00:00
|
|
|
|
2006-12-04 14:57:06 +00:00
|
|
|
|
2009-12-03 13:43:37 +00:00
|
|
|
static void styleset_c_like(ScintillaObject *sci, gint ft_id)
|
2006-12-04 14:57:06 +00:00
|
|
|
{
|
2009-09-28 15:55:49 +00:00
|
|
|
gint styles[] = {
|
|
|
|
SCE_C_DEFAULT,
|
|
|
|
SCE_C_COMMENT,
|
|
|
|
SCE_C_COMMENTLINE,
|
|
|
|
SCE_C_COMMENTDOC,
|
|
|
|
SCE_C_NUMBER,
|
|
|
|
SCE_C_WORD,
|
|
|
|
SCE_C_WORD2,
|
|
|
|
SCE_C_STRING,
|
|
|
|
SCE_C_CHARACTER,
|
|
|
|
SCE_C_UUID,
|
|
|
|
SCE_C_PREPROCESSOR,
|
|
|
|
SCE_C_OPERATOR,
|
|
|
|
SCE_C_IDENTIFIER,
|
|
|
|
SCE_C_STRINGEOL,
|
|
|
|
SCE_C_VERBATIM,
|
|
|
|
SCE_C_REGEX,
|
|
|
|
SCE_C_COMMENTLINEDOC,
|
|
|
|
SCE_C_COMMENTDOCKEYWORD,
|
|
|
|
SCE_C_COMMENTDOCKEYWORDERROR,
|
|
|
|
/* used for local structs and typedefs */
|
|
|
|
SCE_C_GLOBALCLASS
|
|
|
|
};
|
|
|
|
|
2009-10-04 12:15:29 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_CPP, ft_id);
|
|
|
|
apply_style_entries(sci, ft_id, styles, G_N_ELEMENTS(styles));
|
2010-07-01 11:49:30 +00:00
|
|
|
|
|
|
|
/* Disable explicit //{ folding as it can seem like a bug */
|
|
|
|
sci_set_property(sci, "fold.cpp.comment.explicit", "0");
|
2006-10-27 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_c_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "docComment", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_c(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* assign global types, merge them with user defined keywords and set them */
|
2009-12-07 13:24:11 +00:00
|
|
|
merge_type_keywords(sci, ft_id, 1);
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_pascal_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "comment2", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor2", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "hexnumber", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "asm", &style_sets[ft_id].styling[14]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_pascal(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_PASCAL, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PAS_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PAS_IDENTIFIER, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_PAS_COMMENT, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_PAS_COMMENT2, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_PAS_COMMENTLINE, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_PAS_PREPROCESSOR, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_PAS_PREPROCESSOR2, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_PAS_NUMBER, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_PAS_HEXNUMBER, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_PAS_WORD, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_PAS_STRING, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_PAS_STRINGEOL, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_PAS_CHARACTER, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_PAS_OPERATOR, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_PAS_ASM, ft_id, 14);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_makefile_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 7);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "target", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "ideol", &style_sets[ft_id].styling[6]);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_makefile(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_MAKEFILE, ft_id);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MAKE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MAKE_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_MAKE_PREPROCESSOR, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_MAKE_IDENTIFIER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_MAKE_OPERATOR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_MAKE_TARGET, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_MAKE_IDEOL, ft_id, 6);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_diff_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-08-27 17:39:34 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 8);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "header", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "position", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "deleted", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "added", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "changed", &style_sets[ft_id].styling[7]);
|
2006-08-27 17:39:34 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = NULL;
|
2006-08-27 17:39:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_diff(ScintillaObject *sci, gint ft_id)
|
2006-08-27 17:39:34 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_DIFF, ft_id);
|
2006-08-27 17:39:34 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_DIFF_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_DIFF_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_DIFF_COMMAND, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_DIFF_HEADER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_DIFF_POSITION, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_DIFF_DELETED, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_DIFF_ADDED, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_DIFF_CHANGED, ft_id, 7);
|
2006-08-27 17:39:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-06 17:10:15 +00:00
|
|
|
static void styleset_lisp_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "multicomment", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "special_keyword", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "symbol", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "special", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "macro", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "macrodispatch", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "special_keywords", ft_id, 1);
|
|
|
|
style_sets[ft_id].keywords[2] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_lisp(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_LISP, ft_id);
|
|
|
|
|
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_LISP_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_LISP_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_LISP_MULTI_COMMENT, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_LISP_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_LISP_KEYWORD, ft_id, 4);
|
|
|
|
/*
|
|
|
|
set_sci_style(sci, SCE_LISP_SPECIAL_KEYWORD, ft_id, 5);
|
|
|
|
*/
|
|
|
|
set_sci_style(sci, SCE_LISP_SYMBOL, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_LISP_STRING, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_LISP_STRINGEOL, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_LISP_IDENTIFIER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_LISP_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_LISP_SPECIAL, ft_id, 11);
|
|
|
|
/*
|
|
|
|
set_sci_style(sci, SCE_LISP_CHARACTER, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_LISP_MACRO, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_LISP_MACRO_DISPATCH, ft_id, 14);
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-20 15:45:25 +00:00
|
|
|
static void styleset_erlang_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
|
|
|
new_styleset(ft_id, 26);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "atom", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "function_name", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "macro", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "record", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "preproc", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "node_name", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_function", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_module", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_doc", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_doc_macro", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "atom_quoted", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "macro_quoted", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "record_quoted", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "node_name_quoted", &style_sets[ft_id].styling[21]);
|
|
|
|
get_keyfile_style(config, config_home, "bifs", &style_sets[ft_id].styling[22]);
|
|
|
|
get_keyfile_style(config, config_home, "modules", &style_sets[ft_id].styling[23]);
|
|
|
|
get_keyfile_style(config, config_home, "modules_att", &style_sets[ft_id].styling[24]);
|
|
|
|
get_keyfile_style(config, config_home, "unknown", &style_sets[ft_id].styling[25]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 6);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "bifs", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "preproc", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "module", ft_id, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "doc", ft_id, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "doc_macro", ft_id, 5);
|
|
|
|
style_sets[ft_id].keywords[6] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_erlang(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_ERLANG, ft_id);
|
|
|
|
|
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]);
|
|
|
|
sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_VARIABLE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_KEYWORD, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_STRING, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_OPERATOR, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_ATOM, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_FUNCTION_NAME, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_CHARACTER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_MACRO, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_RECORD, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_PREPROC, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_NODE_NAME, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_COMMENT_FUNCTION, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_COMMENT_MODULE, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_COMMENT_DOC, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_COMMENT_DOC_MACRO, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_ATOM_QUOTED, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_MACRO_QUOTED, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_RECORD_QUOTED, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_NODE_NAME_QUOTED, ft_id, 21);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_BIFS, ft_id, 22);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_MODULES, ft_id, 23);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_MODULES_ATT, ft_id, 24);
|
|
|
|
set_sci_style(sci, SCE_ERLANG_UNKNOWN, ft_id, 25);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_latex_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 5);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "math", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[4]);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_latex(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_LATEX, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2006-04-27 18:06:35 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_L_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_L_COMMAND, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_L_TAG, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_L_MATH, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_L_COMMENT, ft_id, 4);
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_php_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].styling = NULL;
|
|
|
|
style_sets[ft_id].keywords = NULL;
|
2006-09-01 17:07:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_php(ScintillaObject *sci, gint ft_id)
|
2006-09-01 17:07:49 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_HTML, ft_id);
|
2006-09-01 17:07:49 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* use the same colouring as for XML */
|
2006-11-04 22:38:11 +00:00
|
|
|
styleset_markup(sci, TRUE);
|
2006-09-01 17:07:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_html_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-09-01 17:07:49 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].styling = NULL;
|
|
|
|
style_sets[ft_id].keywords = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_html(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_HTML, ft_id);
|
2006-08-13 15:04:30 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* use the same colouring for HTML; XML and so on */
|
2006-11-04 22:38:11 +00:00
|
|
|
styleset_markup(sci, TRUE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_markup_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-18 17:07:12 +00:00
|
|
|
new_styleset(GEANY_FILETYPES_XML, 56);
|
2009-09-28 15:33:05 +00:00
|
|
|
get_keyfile_style(config, config_home, "html_default", &style_sets[GEANY_FILETYPES_XML].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "html_tag", &style_sets[GEANY_FILETYPES_XML].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "html_tagunknown", &style_sets[GEANY_FILETYPES_XML].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "html_attribute", &style_sets[GEANY_FILETYPES_XML].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "html_attributeunknown", &style_sets[GEANY_FILETYPES_XML].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "html_number", &style_sets[GEANY_FILETYPES_XML].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "html_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "html_singlestring", &style_sets[GEANY_FILETYPES_XML].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "html_other", &style_sets[GEANY_FILETYPES_XML].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "html_comment", &style_sets[GEANY_FILETYPES_XML].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "html_entity", &style_sets[GEANY_FILETYPES_XML].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "html_tagend", &style_sets[GEANY_FILETYPES_XML].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "html_xmlstart", &style_sets[GEANY_FILETYPES_XML].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "html_xmlend", &style_sets[GEANY_FILETYPES_XML].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "html_script", &style_sets[GEANY_FILETYPES_XML].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "html_asp", &style_sets[GEANY_FILETYPES_XML].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "html_aspat", &style_sets[GEANY_FILETYPES_XML].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "html_cdata", &style_sets[GEANY_FILETYPES_XML].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "html_question", &style_sets[GEANY_FILETYPES_XML].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "html_value", &style_sets[GEANY_FILETYPES_XML].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "html_xccomment", &style_sets[GEANY_FILETYPES_XML].styling[20]);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "sgml_default", &style_sets[GEANY_FILETYPES_XML].styling[21]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_comment", &style_sets[GEANY_FILETYPES_XML].styling[22]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_special", &style_sets[GEANY_FILETYPES_XML].styling[23]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_command", &style_sets[GEANY_FILETYPES_XML].styling[24]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[25]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_simplestring", &style_sets[GEANY_FILETYPES_XML].styling[26]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_1st_param", &style_sets[GEANY_FILETYPES_XML].styling[27]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_entity", &style_sets[GEANY_FILETYPES_XML].styling[28]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_block_default", &style_sets[GEANY_FILETYPES_XML].styling[29]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_1st_param_comment", &style_sets[GEANY_FILETYPES_XML].styling[30]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_error", &style_sets[GEANY_FILETYPES_XML].styling[31]);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "php_default", &style_sets[GEANY_FILETYPES_XML].styling[32]);
|
|
|
|
get_keyfile_style(config, config_home, "php_simplestring", &style_sets[GEANY_FILETYPES_XML].styling[33]);
|
|
|
|
get_keyfile_style(config, config_home, "php_hstring", &style_sets[GEANY_FILETYPES_XML].styling[34]);
|
|
|
|
get_keyfile_style(config, config_home, "php_number", &style_sets[GEANY_FILETYPES_XML].styling[35]);
|
|
|
|
get_keyfile_style(config, config_home, "php_word", &style_sets[GEANY_FILETYPES_XML].styling[36]);
|
|
|
|
get_keyfile_style(config, config_home, "php_variable", &style_sets[GEANY_FILETYPES_XML].styling[37]);
|
|
|
|
get_keyfile_style(config, config_home, "php_comment", &style_sets[GEANY_FILETYPES_XML].styling[38]);
|
|
|
|
get_keyfile_style(config, config_home, "php_commentline", &style_sets[GEANY_FILETYPES_XML].styling[39]);
|
|
|
|
get_keyfile_style(config, config_home, "php_operator", &style_sets[GEANY_FILETYPES_XML].styling[40]);
|
|
|
|
get_keyfile_style(config, config_home, "php_hstring_variable", &style_sets[GEANY_FILETYPES_XML].styling[41]);
|
|
|
|
get_keyfile_style(config, config_home, "php_complex_variable", &style_sets[GEANY_FILETYPES_XML].styling[42]);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "jscript_start", &style_sets[GEANY_FILETYPES_XML].styling[43]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_default", &style_sets[GEANY_FILETYPES_XML].styling[44]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_comment", &style_sets[GEANY_FILETYPES_XML].styling[45]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_commentline", &style_sets[GEANY_FILETYPES_XML].styling[46]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_commentdoc", &style_sets[GEANY_FILETYPES_XML].styling[47]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_number", &style_sets[GEANY_FILETYPES_XML].styling[48]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_word", &style_sets[GEANY_FILETYPES_XML].styling[49]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_keyword", &style_sets[GEANY_FILETYPES_XML].styling[50]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[51]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_singlestring", &style_sets[GEANY_FILETYPES_XML].styling[52]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_symbols", &style_sets[GEANY_FILETYPES_XML].styling[53]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_stringeol", &style_sets[GEANY_FILETYPES_XML].styling[54]);
|
|
|
|
get_keyfile_style(config, config_home, "jscript_regex", &style_sets[GEANY_FILETYPES_XML].styling[55]);
|
2009-09-27 16:16:18 +00:00
|
|
|
|
2006-09-30 11:13:58 +00:00
|
|
|
style_sets[GEANY_FILETYPES_XML].keywords = g_new(gchar*, 7);
|
2009-09-28 16:14:24 +00:00
|
|
|
get_keyfile_keywords(config, config_home, "html", GEANY_FILETYPES_XML, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "javascript", GEANY_FILETYPES_XML, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "vbscript", GEANY_FILETYPES_XML, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "python", GEANY_FILETYPES_XML, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "php", GEANY_FILETYPES_XML, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "sgml", GEANY_FILETYPES_XML, 5);
|
2006-09-30 11:13:58 +00:00
|
|
|
style_sets[GEANY_FILETYPES_XML].keywords[6] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-04 22:38:11 +00:00
|
|
|
static void styleset_markup(ScintillaObject *sci, gboolean set_keywords)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-05-11 15:56:08 +00:00
|
|
|
guint i;
|
|
|
|
const gchar *keywords;
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
/* Used by several filetypes */
|
|
|
|
if (style_sets[GEANY_FILETYPES_XML].styling == NULL)
|
2008-06-30 15:59:00 +00:00
|
|
|
filetypes_load_config(GEANY_FILETYPES_XML, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-05-12 12:20:49 +00:00
|
|
|
/* manually initialise filetype Python for use with embedded Python */
|
2008-06-30 15:59:00 +00:00
|
|
|
filetypes_load_config(GEANY_FILETYPES_PYTHON, FALSE);
|
2008-05-12 12:20:49 +00:00
|
|
|
|
2009-05-11 15:56:08 +00:00
|
|
|
/* Set keywords. If we don't want to use keywords, we must at least unset maybe previously set
|
|
|
|
* keywords, e.g. when switching between filetypes. */
|
|
|
|
for (i = 0; i < 5; i++)
|
2006-11-04 22:38:11 +00:00
|
|
|
{
|
2009-05-11 15:56:08 +00:00
|
|
|
keywords = (set_keywords) ? style_sets[GEANY_FILETYPES_XML].keywords[i] : "";
|
2009-09-28 16:27:14 +00:00
|
|
|
sci_set_keywords(sci, i, keywords);
|
2006-11-04 22:38:11 +00:00
|
|
|
}
|
2009-09-30 12:10:24 +00:00
|
|
|
/* always set SGML keywords */
|
2009-09-28 16:27:14 +00:00
|
|
|
sci_set_keywords(sci, 5, style_sets[GEANY_FILETYPES_XML].keywords[5]);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_XML, 0);
|
|
|
|
set_sci_style(sci, SCE_H_DEFAULT, GEANY_FILETYPES_XML, 0);
|
|
|
|
set_sci_style(sci, SCE_H_TAG, GEANY_FILETYPES_XML, 1);
|
|
|
|
set_sci_style(sci, SCE_H_TAGUNKNOWN, GEANY_FILETYPES_XML, 2);
|
|
|
|
set_sci_style(sci, SCE_H_ATTRIBUTE, GEANY_FILETYPES_XML, 3);
|
|
|
|
set_sci_style(sci, SCE_H_ATTRIBUTEUNKNOWN, GEANY_FILETYPES_XML, 4);
|
|
|
|
set_sci_style(sci, SCE_H_NUMBER, GEANY_FILETYPES_XML, 5);
|
|
|
|
set_sci_style(sci, SCE_H_DOUBLESTRING, GEANY_FILETYPES_XML, 6);
|
|
|
|
set_sci_style(sci, SCE_H_SINGLESTRING, GEANY_FILETYPES_XML, 7);
|
|
|
|
set_sci_style(sci, SCE_H_OTHER, GEANY_FILETYPES_XML, 8);
|
|
|
|
set_sci_style(sci, SCE_H_COMMENT, GEANY_FILETYPES_XML, 9);
|
|
|
|
set_sci_style(sci, SCE_H_ENTITY, GEANY_FILETYPES_XML, 10);
|
|
|
|
set_sci_style(sci, SCE_H_TAGEND, GEANY_FILETYPES_XML, 11);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_XMLSTART, 1);
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, SCE_H_XMLSTART, GEANY_FILETYPES_XML, 12);
|
|
|
|
set_sci_style(sci, SCE_H_XMLEND, GEANY_FILETYPES_XML, 13);
|
|
|
|
set_sci_style(sci, SCE_H_SCRIPT, GEANY_FILETYPES_XML, 14);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_ASP, 1);
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, SCE_H_ASP, GEANY_FILETYPES_XML, 15);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_ASPAT, 1);
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, SCE_H_ASPAT, GEANY_FILETYPES_XML, 16);
|
|
|
|
set_sci_style(sci, SCE_H_CDATA, GEANY_FILETYPES_XML, 17);
|
|
|
|
set_sci_style(sci, SCE_H_QUESTION, GEANY_FILETYPES_XML, 18);
|
|
|
|
set_sci_style(sci, SCE_H_VALUE, GEANY_FILETYPES_XML, 19);
|
|
|
|
set_sci_style(sci, SCE_H_XCCOMMENT, GEANY_FILETYPES_XML, 20);
|
|
|
|
|
|
|
|
set_sci_style(sci, SCE_H_SGML_DEFAULT, GEANY_FILETYPES_XML, 21);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_COMMENT, GEANY_FILETYPES_XML, 22);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_SPECIAL, GEANY_FILETYPES_XML, 23);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_COMMAND, GEANY_FILETYPES_XML, 24);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_DOUBLESTRING, GEANY_FILETYPES_XML, 25);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_SIMPLESTRING, GEANY_FILETYPES_XML, 26);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_1ST_PARAM, GEANY_FILETYPES_XML, 27);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_ENTITY, GEANY_FILETYPES_XML, 28);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_BLOCK_DEFAULT, GEANY_FILETYPES_XML, 29);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_1ST_PARAM_COMMENT, GEANY_FILETYPES_XML, 30);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_ERROR, GEANY_FILETYPES_XML, 31);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-05-12 12:20:49 +00:00
|
|
|
/* embedded JavaScript */
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, SCE_HJ_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HJ_DEFAULT, GEANY_FILETYPES_XML, 44);
|
|
|
|
set_sci_style(sci, SCE_HJ_COMMENT, GEANY_FILETYPES_XML, 45);
|
|
|
|
set_sci_style(sci, SCE_HJ_COMMENTLINE, GEANY_FILETYPES_XML, 46);
|
|
|
|
set_sci_style(sci, SCE_HJ_COMMENTDOC, GEANY_FILETYPES_XML, 47);
|
|
|
|
set_sci_style(sci, SCE_HJ_NUMBER, GEANY_FILETYPES_XML, 48);
|
|
|
|
set_sci_style(sci, SCE_HJ_WORD, GEANY_FILETYPES_XML, 49);
|
|
|
|
set_sci_style(sci, SCE_HJ_KEYWORD, GEANY_FILETYPES_XML, 50);
|
|
|
|
set_sci_style(sci, SCE_HJ_DOUBLESTRING, GEANY_FILETYPES_XML, 51);
|
|
|
|
set_sci_style(sci, SCE_HJ_SINGLESTRING, GEANY_FILETYPES_XML, 52);
|
|
|
|
set_sci_style(sci, SCE_HJ_SYMBOLS, GEANY_FILETYPES_XML, 53);
|
|
|
|
set_sci_style(sci, SCE_HJ_STRINGEOL, GEANY_FILETYPES_XML, 54);
|
2009-06-17 19:04:17 +00:00
|
|
|
set_sci_style(sci, SCE_HJ_REGEX, GEANY_FILETYPES_XML, 55);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-05-12 12:20:49 +00:00
|
|
|
/* for HB, VBScript?, use the same styles as for JavaScript */
|
|
|
|
set_sci_style(sci, SCE_HB_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HB_DEFAULT, GEANY_FILETYPES_XML, 44);
|
|
|
|
set_sci_style(sci, SCE_HB_COMMENTLINE, GEANY_FILETYPES_XML, 46);
|
|
|
|
set_sci_style(sci, SCE_HB_NUMBER, GEANY_FILETYPES_XML, 48);
|
2009-10-01 11:16:12 +00:00
|
|
|
set_sci_style(sci, SCE_HB_WORD, GEANY_FILETYPES_XML, 50); /* keywords */
|
2008-05-12 12:20:49 +00:00
|
|
|
set_sci_style(sci, SCE_HB_STRING, GEANY_FILETYPES_XML, 51);
|
|
|
|
set_sci_style(sci, SCE_HB_IDENTIFIER, GEANY_FILETYPES_XML, 53);
|
|
|
|
set_sci_style(sci, SCE_HB_STRINGEOL, GEANY_FILETYPES_XML, 54);
|
|
|
|
|
|
|
|
/* for HBA, VBScript?, use the same styles as for JavaScript */
|
|
|
|
set_sci_style(sci, SCE_HBA_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HBA_DEFAULT, GEANY_FILETYPES_XML, 44);
|
|
|
|
set_sci_style(sci, SCE_HBA_COMMENTLINE, GEANY_FILETYPES_XML, 46);
|
|
|
|
set_sci_style(sci, SCE_HBA_NUMBER, GEANY_FILETYPES_XML, 48);
|
2009-10-01 11:16:12 +00:00
|
|
|
set_sci_style(sci, SCE_HBA_WORD, GEANY_FILETYPES_XML, 50); /* keywords */
|
2008-05-12 12:20:49 +00:00
|
|
|
set_sci_style(sci, SCE_HBA_STRING, GEANY_FILETYPES_XML, 51);
|
|
|
|
set_sci_style(sci, SCE_HBA_IDENTIFIER, GEANY_FILETYPES_XML, 53);
|
|
|
|
set_sci_style(sci, SCE_HBA_STRINGEOL, GEANY_FILETYPES_XML, 54);
|
|
|
|
|
|
|
|
/* for HJA, ASP Javascript, use the same styles as for JavaScript */
|
|
|
|
set_sci_style(sci, SCE_HJA_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HJA_DEFAULT, GEANY_FILETYPES_XML, 44);
|
|
|
|
set_sci_style(sci, SCE_HJA_COMMENT, GEANY_FILETYPES_XML, 45);
|
|
|
|
set_sci_style(sci, SCE_HJA_COMMENTLINE, GEANY_FILETYPES_XML, 46);
|
|
|
|
set_sci_style(sci, SCE_HJA_COMMENTDOC, GEANY_FILETYPES_XML, 47);
|
|
|
|
set_sci_style(sci, SCE_HJA_NUMBER, GEANY_FILETYPES_XML, 48);
|
|
|
|
set_sci_style(sci, SCE_HJA_WORD, GEANY_FILETYPES_XML, 49);
|
|
|
|
set_sci_style(sci, SCE_HJA_KEYWORD, GEANY_FILETYPES_XML, 50);
|
|
|
|
set_sci_style(sci, SCE_HJA_DOUBLESTRING, GEANY_FILETYPES_XML, 51);
|
|
|
|
set_sci_style(sci, SCE_HJA_SINGLESTRING, GEANY_FILETYPES_XML, 52);
|
|
|
|
set_sci_style(sci, SCE_HJA_SYMBOLS, GEANY_FILETYPES_XML, 53);
|
|
|
|
set_sci_style(sci, SCE_HJA_STRINGEOL, GEANY_FILETYPES_XML, 54);
|
|
|
|
|
|
|
|
/* for embedded Python we use the Python styles */
|
|
|
|
set_sci_style(sci, SCE_HP_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HP_DEFAULT, GEANY_FILETYPES_PYTHON, 0);
|
|
|
|
set_sci_style(sci, SCE_HP_COMMENTLINE, GEANY_FILETYPES_PYTHON, 1);
|
|
|
|
set_sci_style(sci, SCE_HP_NUMBER, GEANY_FILETYPES_PYTHON, 2);
|
|
|
|
set_sci_style(sci, SCE_HP_STRING, GEANY_FILETYPES_PYTHON, 3);
|
|
|
|
set_sci_style(sci, SCE_HP_CHARACTER, GEANY_FILETYPES_PYTHON, 4);
|
|
|
|
set_sci_style(sci, SCE_HP_WORD, GEANY_FILETYPES_PYTHON, 5);
|
|
|
|
set_sci_style(sci, SCE_HP_TRIPLE, GEANY_FILETYPES_PYTHON, 6);
|
|
|
|
set_sci_style(sci, SCE_HP_TRIPLEDOUBLE, GEANY_FILETYPES_PYTHON, 7);
|
|
|
|
set_sci_style(sci, SCE_HP_CLASSNAME, GEANY_FILETYPES_PYTHON, 8);
|
|
|
|
set_sci_style(sci, SCE_HP_DEFNAME, GEANY_FILETYPES_PYTHON, 9);
|
|
|
|
set_sci_style(sci, SCE_HP_OPERATOR, GEANY_FILETYPES_PYTHON, 10);
|
|
|
|
set_sci_style(sci, SCE_HP_IDENTIFIER, GEANY_FILETYPES_PYTHON, 11);
|
|
|
|
|
|
|
|
/* for embedded HPA (what is this?) we use the Python styles */
|
|
|
|
set_sci_style(sci, SCE_HPA_START, GEANY_FILETYPES_XML, 43);
|
|
|
|
set_sci_style(sci, SCE_HPA_DEFAULT, GEANY_FILETYPES_PYTHON, 0);
|
|
|
|
set_sci_style(sci, SCE_HPA_COMMENTLINE, GEANY_FILETYPES_PYTHON, 1);
|
|
|
|
set_sci_style(sci, SCE_HPA_NUMBER, GEANY_FILETYPES_PYTHON, 2);
|
|
|
|
set_sci_style(sci, SCE_HPA_STRING, GEANY_FILETYPES_PYTHON, 3);
|
|
|
|
set_sci_style(sci, SCE_HPA_CHARACTER, GEANY_FILETYPES_PYTHON, 4);
|
|
|
|
set_sci_style(sci, SCE_HPA_WORD, GEANY_FILETYPES_PYTHON, 5);
|
|
|
|
set_sci_style(sci, SCE_HPA_TRIPLE, GEANY_FILETYPES_PYTHON, 6);
|
|
|
|
set_sci_style(sci, SCE_HPA_TRIPLEDOUBLE, GEANY_FILETYPES_PYTHON, 7);
|
|
|
|
set_sci_style(sci, SCE_HPA_CLASSNAME, GEANY_FILETYPES_PYTHON, 8);
|
|
|
|
set_sci_style(sci, SCE_HPA_DEFNAME, GEANY_FILETYPES_PYTHON, 9);
|
|
|
|
set_sci_style(sci, SCE_HPA_OPERATOR, GEANY_FILETYPES_PYTHON, 10);
|
|
|
|
set_sci_style(sci, SCE_HPA_IDENTIFIER, GEANY_FILETYPES_PYTHON, 11);
|
|
|
|
|
|
|
|
/* PHP */
|
2006-09-30 11:13:58 +00:00
|
|
|
set_sci_style(sci, SCE_HPHP_DEFAULT, GEANY_FILETYPES_XML, 32);
|
|
|
|
set_sci_style(sci, SCE_HPHP_SIMPLESTRING, GEANY_FILETYPES_XML, 33);
|
|
|
|
set_sci_style(sci, SCE_HPHP_HSTRING, GEANY_FILETYPES_XML, 34);
|
|
|
|
set_sci_style(sci, SCE_HPHP_NUMBER, GEANY_FILETYPES_XML, 35);
|
|
|
|
set_sci_style(sci, SCE_HPHP_WORD, GEANY_FILETYPES_XML, 36);
|
|
|
|
set_sci_style(sci, SCE_HPHP_VARIABLE, GEANY_FILETYPES_XML, 37);
|
|
|
|
set_sci_style(sci, SCE_HPHP_COMMENT, GEANY_FILETYPES_XML, 38);
|
|
|
|
set_sci_style(sci, SCE_HPHP_COMMENTLINE, GEANY_FILETYPES_XML, 39);
|
|
|
|
set_sci_style(sci, SCE_HPHP_OPERATOR, GEANY_FILETYPES_XML, 40);
|
|
|
|
set_sci_style(sci, SCE_HPHP_HSTRING_VARIABLE, GEANY_FILETYPES_XML, 41);
|
|
|
|
set_sci_style(sci, SCE_HPHP_COMPLEX_VARIABLE, GEANY_FILETYPES_XML, 42);
|
2006-06-06 17:23:27 +00:00
|
|
|
|
2009-11-18 17:07:12 +00:00
|
|
|
/* note: normally this would be in the filetype file instead */
|
2009-10-04 11:15:26 +00:00
|
|
|
sci_set_property(sci, "fold.html", "1");
|
|
|
|
sci_set_property(sci, "fold.html.preprocessor", "0");
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_java_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "doccomment", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "typedefs", ft_id, 3);
|
|
|
|
style_sets[ft_id].keywords[4] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_java(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[3]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-10-03 16:35:34 +00:00
|
|
|
/* assign global types, merge them with user defined keywords and set them */
|
2009-12-07 13:24:11 +00:00
|
|
|
merge_type_keywords(sci, ft_id, 1);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_perl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 35);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "scalar", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "pod", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "regex", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "array", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "hash", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "symboltable", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "pod_verbatim", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "reg_subst", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "datasection", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "here_delim", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[21]);
|
|
|
|
get_keyfile_style(config, config_home, "here_qq", &style_sets[ft_id].styling[22]);
|
|
|
|
get_keyfile_style(config, config_home, "here_qx", &style_sets[ft_id].styling[23]);
|
|
|
|
get_keyfile_style(config, config_home, "string_q", &style_sets[ft_id].styling[24]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qq", &style_sets[ft_id].styling[25]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qx", &style_sets[ft_id].styling[26]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qr", &style_sets[ft_id].styling[27]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qw", &style_sets[ft_id].styling[28]);
|
|
|
|
get_keyfile_style(config, config_home, "variable_indexer", &style_sets[ft_id].styling[29]);
|
|
|
|
get_keyfile_style(config, config_home, "punctuation", &style_sets[ft_id].styling[30]);
|
|
|
|
get_keyfile_style(config, config_home, "longquote", &style_sets[ft_id].styling[31]);
|
|
|
|
get_keyfile_style(config, config_home, "sub_prototype", &style_sets[ft_id].styling[32]);
|
|
|
|
get_keyfile_style(config, config_home, "format_ident", &style_sets[ft_id].styling[33]);
|
|
|
|
get_keyfile_style(config, config_home, "format", &style_sets[ft_id].styling[34]);
|
|
|
|
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_perl(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_PERL, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PL_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PL_ERROR, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_PL_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_PL_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_PL_WORD, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_PL_CHARACTER, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_PL_PREPROCESSOR, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_PL_OPERATOR, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_PL_IDENTIFIER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_PL_SCALAR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_PL_POD, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_PL_REGEX, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_PL_ARRAY, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_PL_HASH, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_PL_SYMBOLTABLE, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_PL_BACKTICKS, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_PL_POD_VERB, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_PL_REGSUBST, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_PL_DATASECTION, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_PL_HERE_DELIM, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_PL_HERE_Q, ft_id, 21);
|
|
|
|
set_sci_style(sci, SCE_PL_HERE_QQ, ft_id, 22);
|
|
|
|
set_sci_style(sci, SCE_PL_HERE_QX, ft_id, 23);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING_Q, ft_id, 24);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING_QQ, ft_id, 25);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING_QX, ft_id, 26);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING_QR, ft_id, 27);
|
|
|
|
set_sci_style(sci, SCE_PL_STRING_QW, ft_id, 28);
|
|
|
|
set_sci_style(sci, SCE_PL_VARIABLE_INDEXER, ft_id, 29);
|
|
|
|
set_sci_style(sci, SCE_PL_PUNCTUATION, ft_id, 30);
|
|
|
|
set_sci_style(sci, SCE_PL_LONGQUOTE, ft_id, 31);
|
|
|
|
set_sci_style(sci, SCE_PL_SUB_PROTOTYPE, ft_id, 32);
|
|
|
|
set_sci_style(sci, SCE_PL_FORMAT_IDENT, ft_id, 33);
|
|
|
|
set_sci_style(sci, SCE_PL_FORMAT, ft_id, 34);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_python_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 16);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "triple", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "tripledouble", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "classname", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "defname", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "decorator", &style_sets[ft_id].styling[15]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "identifiers", ft_id, 1);
|
|
|
|
style_sets[ft_id].keywords[2] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_python(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_PYTHON, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_P_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_P_COMMENTLINE, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_P_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_P_STRING, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_P_CHARACTER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_P_WORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_P_TRIPLE, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_P_TRIPLEDOUBLE, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_P_CLASSNAME, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_P_DEFNAME, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_P_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_P_IDENTIFIER, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_P_COMMENTBLOCK, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_P_STRINGEOL, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_P_WORD2, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_P_DECORATOR, ft_id, 15);
|
2006-05-09 16:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-21 20:31:09 +00:00
|
|
|
static void styleset_cmake_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "stringdq", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "stringlq", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "stringrq", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "parameters", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "userdefined", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "whiledef", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "foreachdef", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "ifdefinedef", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "macrodef", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringvar", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "commands", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "parameters", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "userdefined", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_cmake(ScintillaObject *sci, gint ft_id)
|
2008-12-21 20:31:09 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_CMAKE, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_STRINGDQ, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_STRINGLQ, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_STRINGRQ, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_COMMANDS, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_PARAMETERS, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_VARIABLE, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_USERDEFINED, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_WHILEDEF, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_FOREACHDEF, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_IFDEFINEDEF, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_MACRODEF, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_STRINGVAR, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_CMAKE_NUMBER, ft_id, 14);
|
2008-12-21 20:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-26 12:23:59 +00:00
|
|
|
static void styleset_r_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 12);
|
2008-09-26 12:23:59 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "kword", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "basekword", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "otherkword", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "infix", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "infixeol", &style_sets[ft_id].styling[11]);
|
2008-09-29 18:10:42 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "package", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "package_other", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
2008-09-26 12:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_r(ScintillaObject *sci, gint ft_id)
|
2008-09-26 12:23:59 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_R, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
2008-09-26 12:23:59 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_R_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_R_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_R_KWORD, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_R_OPERATOR, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_R_BASEKWORD, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_R_OTHERKWORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_R_NUMBER, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_R_STRING, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_R_STRING2, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_R_IDENTIFIER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_R_INFIX, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_R_INFIXEOL, ft_id, 11);
|
2008-09-26 12:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_ruby_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-05-09 16:07:27 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 35);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "global", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "symbol", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "classname", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "defname", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "modulename", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "instancevar", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "classvar", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "datasection", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "heredelim", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "worddemoted", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "stdin", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "stdout", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "stderr", &style_sets[ft_id].styling[21]);
|
|
|
|
get_keyfile_style(config, config_home, "datasection", &style_sets[ft_id].styling[22]);
|
|
|
|
get_keyfile_style(config, config_home, "regex", &style_sets[ft_id].styling[23]);
|
|
|
|
get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[24]);
|
|
|
|
get_keyfile_style(config, config_home, "here_qq", &style_sets[ft_id].styling[25]);
|
|
|
|
get_keyfile_style(config, config_home, "here_qx", &style_sets[ft_id].styling[26]);
|
|
|
|
get_keyfile_style(config, config_home, "string_q", &style_sets[ft_id].styling[27]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qq", &style_sets[ft_id].styling[28]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qx", &style_sets[ft_id].styling[29]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qr", &style_sets[ft_id].styling[30]);
|
|
|
|
get_keyfile_style(config, config_home, "string_qw", &style_sets[ft_id].styling[31]);
|
|
|
|
get_keyfile_style(config, config_home, "upper_bound", &style_sets[ft_id].styling[32]);
|
|
|
|
get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[33]);
|
|
|
|
get_keyfile_style(config, config_home, "pod", &style_sets[ft_id].styling[34]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_ruby(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_RUBY, ft_id);
|
2006-05-09 16:07:27 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_RB_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_RB_COMMENTLINE, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_RB_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_RB_CHARACTER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_RB_WORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_RB_GLOBAL, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_RB_SYMBOL, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_RB_CLASSNAME, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_RB_DEFNAME, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_RB_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_RB_IDENTIFIER, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_RB_MODULE_NAME, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_RB_BACKTICKS, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_RB_INSTANCE_VAR, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_RB_CLASS_VAR, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_RB_DATASECTION, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_RB_HERE_DELIM, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_RB_WORD_DEMOTED, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_RB_STDIN, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_RB_STDOUT, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_RB_STDERR, ft_id, 21);
|
|
|
|
set_sci_style(sci, SCE_RB_DATASECTION, ft_id, 22);
|
|
|
|
set_sci_style(sci, SCE_RB_REGEX, ft_id, 23);
|
|
|
|
set_sci_style(sci, SCE_RB_HERE_Q, ft_id, 24);
|
|
|
|
set_sci_style(sci, SCE_RB_HERE_QQ, ft_id, 25);
|
|
|
|
set_sci_style(sci, SCE_RB_HERE_QX, ft_id, 26);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING_Q, ft_id, 27);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING_QQ, ft_id, 28);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING_QX, ft_id, 29);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING_QR, ft_id, 30);
|
|
|
|
set_sci_style(sci, SCE_RB_STRING_QW, ft_id, 31);
|
|
|
|
set_sci_style(sci, SCE_RB_UPPER_BOUND, ft_id, 32);
|
|
|
|
set_sci_style(sci, SCE_RB_ERROR, ft_id, 33);
|
|
|
|
set_sci_style(sci, SCE_RB_POD, ft_id, 34);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_sh_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 14);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "param", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "scalar", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "here_delim", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[13]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_sh(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_BASH, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_SH_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_SH_COMMENTLINE, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_SH_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_SH_WORD, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_SH_STRING, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_SH_CHARACTER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_SH_OPERATOR, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_SH_IDENTIFIER, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_SH_BACKTICKS, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_SH_PARAM, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_SH_SCALAR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_SH_ERROR, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_SH_HERE_DELIM, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_SH_HERE_Q, ft_id, 13);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_xml(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_XML, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* use the same colouring for HTML; XML and so on */
|
2006-11-04 22:38:11 +00:00
|
|
|
styleset_markup(sci, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_docbook_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 29);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "tagunknown", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "attributeunknown", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "doublestring", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "singlestring", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "other", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "entity", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "tagend", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "xmlstart", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "xmlend", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "cdata", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "question", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "value", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "xccomment", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_default", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_comment", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_special", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_command", &style_sets[ft_id].styling[21]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_doublestring", &style_sets[ft_id].styling[22]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_simplestring", &style_sets[ft_id].styling[23]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_1st_param", &style_sets[ft_id].styling[24]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_entity", &style_sets[ft_id].styling[25]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_block_default", &style_sets[ft_id].styling[26]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_1st_param_comment", &style_sets[ft_id].styling[27]);
|
|
|
|
get_keyfile_style(config, config_home, "sgml_error", &style_sets[ft_id].styling[28]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "elements", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "dtd", ft_id, 1);
|
|
|
|
style_sets[ft_id].keywords[2] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_docbook(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_XML, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 5, style_sets[ft_id].keywords[1]);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* Unknown tags and attributes are highlighed in red.
|
|
|
|
* If a tag is actually OK, it should be added in lower case to the htmlKeyWords string. */
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_H_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_H_TAG, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_H_TAGUNKNOWN, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_H_ATTRIBUTE, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_H_ATTRIBUTEUNKNOWN, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_H_NUMBER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_H_DOUBLESTRING, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_H_SINGLESTRING, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_H_OTHER, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_H_COMMENT, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_H_ENTITY, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_H_TAGEND, ft_id, 11);
|
2005-11-22 12:26:26 +00:00
|
|
|
SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_XMLSTART, 1);
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, SCE_H_XMLSTART, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_H_XMLEND, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_H_CDATA, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_H_QUESTION, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_H_VALUE, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_H_XCCOMMENT, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_DEFAULT, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_H_DEFAULT, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_SPECIAL, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_COMMAND, ft_id, 21);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_DOUBLESTRING, ft_id, 22);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_SIMPLESTRING, ft_id, 23);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_1ST_PARAM, ft_id, 24);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_ENTITY, ft_id, 25);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_BLOCK_DEFAULT, ft_id, 26);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_1ST_PARAM_COMMENT, ft_id, 27);
|
|
|
|
set_sci_style(sci, SCE_H_SGML_ERROR, ft_id, 28);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
static void styleset_default(ScintillaObject *sci, gint ft_id)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-03-13 17:08:13 +00:00
|
|
|
SSM(sci, SCI_SETLEXER, SCLEX_NULL, 0);
|
2007-03-09 15:38:31 +00:00
|
|
|
|
2008-10-15 14:14:48 +00:00
|
|
|
/* we need to set STYLE_DEFAULT before we call SCI_STYLECLEARALL in styleset_common() */
|
2008-05-07 13:54:21 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_NONE, GCS_DEFAULT);
|
2007-03-09 15:38:31 +00:00
|
|
|
|
2009-08-14 11:05:47 +00:00
|
|
|
styleset_common(sci, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_css_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2010-06-06 18:40:35 +00:00
|
|
|
new_styleset(ft_id, 23);
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "class", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "pseudoclass", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "unknown_pseudoclass", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "unknown_identifier", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "doublestring", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "singlestring", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "value", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "id", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier2", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "important", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "directive", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier3", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "pseudoelement", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "extended_identifier", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "extended_pseudoclass", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "extended_pseudoelement", &style_sets[ft_id].styling[21]);
|
2010-06-06 18:40:35 +00:00
|
|
|
get_keyfile_style(config, config_home, "media", &style_sets[ft_id].styling[22]);
|
2009-11-24 15:47:44 +00:00
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 9);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "pseudoclasses", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "css3_properties", ft_id, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "pseudo_elements", ft_id, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "browser_css_properties", ft_id, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "browser_pseudo_classes", ft_id, 6);
|
|
|
|
get_keyfile_keywords(config, config_home, "browser_pseudo_elements", ft_id, 7);
|
|
|
|
style_sets[ft_id].keywords[8] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_css(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2008-10-18 17:00:03 +00:00
|
|
|
guint i;
|
2007-05-11 11:58:56 +00:00
|
|
|
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_CSS, ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-10-18 17:00:03 +00:00
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, i, style_sets[ft_id].keywords[i]);
|
2008-10-18 17:00:03 +00:00
|
|
|
}
|
2006-10-10 17:28:12 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CSS_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CSS_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_CSS_TAG, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_CSS_CLASS, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_CSS_PSEUDOCLASS, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_CSS_UNKNOWN_PSEUDOCLASS, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_CSS_UNKNOWN_IDENTIFIER, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_CSS_OPERATOR, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_CSS_IDENTIFIER, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_CSS_DOUBLESTRING, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_CSS_SINGLESTRING, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_CSS_ATTRIBUTE, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_CSS_VALUE, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_CSS_ID, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_CSS_IDENTIFIER2, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_CSS_IMPORTANT, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_CSS_DIRECTIVE, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_CSS_IDENTIFIER3, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_CSS_PSEUDOELEMENT, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_CSS_EXTENDED_IDENTIFIER, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_CSS_EXTENDED_PSEUDOCLASS, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_CSS_EXTENDED_PSEUDOELEMENT, ft_id, 21);
|
2010-06-06 18:40:35 +00:00
|
|
|
set_sci_style(sci, SCE_CSS_MEDIA, ft_id, 22);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2005-11-27 20:46:36 +00:00
|
|
|
|
|
|
|
|
2008-12-21 20:31:09 +00:00
|
|
|
static void styleset_nsis_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 19);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "stringdq", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "stringlq", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "stringrq", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "function", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "userdefined", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "sectiondef", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "subsectiondef", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "ifdefinedef", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "macrodef", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringvar", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "sectiongroup", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "pageex", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "functiondef", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "commentbox", &style_sets[ft_id].styling[18]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "functions", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "variables", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "lables", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "userdefined", ft_id, 3);
|
|
|
|
style_sets[ft_id].keywords[4] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_nsis(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2008-12-21 20:31:09 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_NSIS, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_NSIS_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_NSIS_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_NSIS_STRINGDQ, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_NSIS_STRINGLQ, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_NSIS_STRINGRQ, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_NSIS_FUNCTION, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_NSIS_VARIABLE, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_NSIS_LABEL, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_NSIS_USERDEFINED, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_NSIS_SECTIONDEF, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_NSIS_SUBSECTIONDEF, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_NSIS_IFDEFINEDEF, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_NSIS_MACRODEF, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_NSIS_STRINGVAR, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_NSIS_NUMBER, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_NSIS_SECTIONGROUP, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_NSIS_PAGEEX, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_NSIS_FUNCTIONDEF, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_NSIS_COMMENTBOX, ft_id, 18);
|
2008-12-21 20:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-28 16:32:49 +00:00
|
|
|
static void styleset_po_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 9);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "msgid", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "msgid_text", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "msgstr", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "msgstr_text", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "msgctxt", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "msgctxt_text", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "fuzzy", &style_sets[ft_id].styling[8]);
|
2008-09-28 16:32:49 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = NULL;
|
2008-09-28 16:32:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_po(ScintillaObject *sci, gint ft_id)
|
2008-09-28 16:32:49 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_PO, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PO_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PO_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGID, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGID_TEXT, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGSTR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGSTR_TEXT, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGCTXT, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_PO_MSGCTXT_TEXT, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_PO_FUZZY, ft_id, 8);
|
2008-09-28 16:32:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_conf_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-11-27 20:46:36 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 6);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "section", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "key", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "assignment", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "defval", &style_sets[ft_id].styling[5]);
|
2005-11-27 20:46:36 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = NULL;
|
2005-11-27 20:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_conf(ScintillaObject *sci, gint ft_id)
|
2005-11-27 20:46:36 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_PROPERTIES, ft_id);
|
2005-11-27 20:46:36 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PROPS_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_PROPS_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_PROPS_SECTION, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_PROPS_KEY, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_PROPS_ASSIGNMENT, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_PROPS_DEFVAL, ft_id, 5);
|
2005-11-27 20:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_asm_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2005-12-05 20:50:46 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "cpuinstruction", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "mathinstruction", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "register", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "directive", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "directiveoperand", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "extinstruction", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "instructions", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "registers", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "directives", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_asm(ScintillaObject *sci, gint ft_id)
|
2005-12-05 20:50:46 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_ASM, ft_id);
|
2005-12-05 20:50:46 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
/*sci_set_keywords(sci, 1, style_sets[ft_id].keywords[0]);*/
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[2]);
|
|
|
|
/*sci_set_keywords(sci, 5, style_sets[ft_id].keywords[0]);*/
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ASM_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ASM_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_ASM_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_ASM_STRING, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_ASM_OPERATOR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_ASM_IDENTIFIER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_ASM_CPUINSTRUCTION, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_ASM_MATHINSTRUCTION, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_ASM_REGISTER, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_ASM_DIRECTIVE, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_ASM_DIRECTIVEOPERAND, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_ASM_COMMENTBLOCK, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_ASM_CHARACTER, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_ASM_STRINGEOL, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_ASM_EXTINSTRUCTION, ft_id, 14);
|
2006-02-10 20:52:17 +00:00
|
|
|
}
|
2005-12-05 20:50:46 +00:00
|
|
|
|
|
|
|
|
2008-07-14 18:27:20 +00:00
|
|
|
static void styleset_f77_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "operator2", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "continuation", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "intrinsic_functions", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "user_functions", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_f77(ScintillaObject *sci, gint ft_id)
|
2008-07-14 18:27:20 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_F77, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_F_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_F_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_F_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_F_STRING1, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_F_OPERATOR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_F_IDENTIFIER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_F_STRING2, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_F_WORD, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_F_WORD2, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_F_WORD3, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_F_PREPROCESSOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_F_OPERATOR2, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_F_CONTINUATION, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_F_STRINGEOL, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_F_LABEL, ft_id, 14);
|
2008-07-14 18:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-30 16:59:22 +00:00
|
|
|
static void styleset_forth_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
|
|
|
new_styleset(ft_id, 12);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentml", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "control", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "defword", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "preword1", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "preword2", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "locale", &style_sets[ft_id].styling[11]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_forth(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_FORTH, ft_id);
|
|
|
|
|
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_FORTH_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_FORTH_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_FORTH_COMMENT_ML, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_FORTH_IDENTIFIER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_FORTH_CONTROL, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_FORTH_KEYWORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_FORTH_DEFWORD, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_FORTH_PREWORD1, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_FORTH_PREWORD2, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_FORTH_NUMBER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_FORTH_STRING, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_FORTH_LOCALE, ft_id, 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_fortran_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-08-15 17:57:41 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "operator2", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "continuation", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "intrinsic_functions", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "user_functions", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_fortran(ScintillaObject *sci, gint ft_id)
|
2006-08-15 17:57:41 +00:00
|
|
|
{
|
2008-07-14 18:27:20 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_FORTRAN, ft_id);
|
2006-08-15 17:57:41 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_F_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_F_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_F_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_F_STRING1, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_F_OPERATOR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_F_IDENTIFIER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_F_STRING2, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_F_WORD, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_F_WORD2, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_F_WORD3, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_F_PREPROCESSOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_F_OPERATOR2, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_F_CONTINUATION, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_F_STRINGEOL, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_F_LABEL, ft_id, 14);
|
2006-08-15 17:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_sql_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-02-10 20:52:17 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "sqlplus", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "sqlplus_prompt", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "sqlplus_comment", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "quotedidentifier", &style_sets[ft_id].styling[14]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2006-02-10 20:52:17 +00:00
|
|
|
}
|
2005-12-05 20:50:46 +00:00
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_sql(ScintillaObject *sci, gint ft_id)
|
2006-02-10 20:52:17 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_SQL, ft_id);
|
2006-02-10 20:52:17 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_SQL_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_SQL_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_SQL_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_SQL_COMMENTDOC, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_SQL_NUMBER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_SQL_WORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_SQL_WORD2, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_SQL_STRING, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_SQL_CHARACTER, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_SQL_OPERATOR, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_SQL_IDENTIFIER, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_SQL_SQLPLUS, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_SQL_SQLPLUS_PROMPT, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_SQL_SQLPLUS_COMMENT, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_SQL_QUOTEDIDENTIFIER, ft_id, 14);
|
2006-02-10 20:52:17 +00:00
|
|
|
}
|
2005-12-05 20:50:46 +00:00
|
|
|
|
|
|
|
|
2009-07-30 11:29:53 +00:00
|
|
|
static void styleset_markdown_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 17);
|
2009-07-30 11:29:53 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "strong", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "emphasis", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "header1", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "header2", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "header3", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "header4", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "header5", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "header6", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "ulist_item", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "olist_item", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "blockquote", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "strikeout", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "hrule", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "link", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "code", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "codebk", &style_sets[ft_id].styling[16]);
|
2009-07-30 11:29:53 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = NULL;
|
2009-07-30 11:29:53 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_markdown(ScintillaObject *sci, gint ft_id)
|
2009-07-30 11:29:53 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_MARKDOWN, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_LINE_BEGIN, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_PRECHAR, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_STRONG1, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_STRONG2, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_EM1, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_EM2, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER1, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER2, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER3, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER4, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER5, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HEADER6, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_ULIST_ITEM, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_OLIST_ITEM, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_BLOCKQUOTE, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_STRIKEOUT, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_HRULE, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_LINK, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_CODE, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_CODE2, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_MARKDOWN_CODEBK, ft_id, 16);
|
2009-07-30 11:29:53 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_haskell_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2007-05-06 14:05:43 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 17);
|
2007-05-06 14:05:43 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "commentblock2", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "commentblock3", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "import", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "class", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "instance", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "capital", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "module", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "data", &style_sets[ft_id].styling[16]);
|
2007-05-06 14:05:43 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2007-05-06 14:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_haskell(ScintillaObject *sci, gint ft_id)
|
2007-05-06 14:05:43 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_HASKELL, ft_id);
|
2007-05-06 14:05:43 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_HA_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_HA_COMMENTLINE, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_HA_COMMENTBLOCK, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_HA_COMMENTBLOCK2, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_HA_COMMENTBLOCK3, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_HA_NUMBER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_HA_KEYWORD, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_HA_IMPORT, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_HA_STRING, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_HA_CHARACTER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_HA_CLASS, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_HA_OPERATOR, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_HA_IDENTIFIER, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_HA_INSTANCE, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_HA_CAPITAL, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_HA_MODULE, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_HA_DATA, ft_id, 16);
|
2007-05-06 14:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_caml_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-02-10 20:52:17 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 14);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "comment1", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "comment2", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "comment3", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword2", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "char", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "tagname", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "linenum", &style_sets[ft_id].styling[13]);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords_optional", ft_id, 1);
|
|
|
|
style_sets[ft_id].keywords[2] = NULL;
|
2006-02-10 20:52:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_caml(ScintillaObject *sci, gint ft_id)
|
2006-02-10 20:52:17 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_CAML, ft_id);
|
2006-02-10 20:52:17 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CAML_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_CAML_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_CAML_COMMENT1, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_CAML_COMMENT2, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_CAML_COMMENT3, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_CAML_NUMBER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_CAML_KEYWORD, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_CAML_KEYWORD2, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_CAML_STRING, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_CAML_CHAR, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_CAML_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_CAML_IDENTIFIER, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_CAML_TAGNAME, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_CAML_LINENUM, ft_id, 13);
|
2006-02-10 20:52:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_tcl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-05-16 19:04:04 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 16);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "wordinquote", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "inquote", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "substitution", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "modifier", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "expand", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "wordtcl", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "wordtk", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "worditcl", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "wordtkcmds", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "wordexpand", &style_sets[ft_id].styling[15]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 6);
|
|
|
|
get_keyfile_keywords(config, config_home, "tcl", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "tk", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "itcl", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "tkcommands", ft_id, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "expand", ft_id, 4);
|
|
|
|
style_sets[ft_id].keywords[5] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_tcl(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_TCL, ft_id);
|
2006-05-16 19:04:04 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TCL_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TCL_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_TCL_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_TCL_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_TCL_OPERATOR, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_TCL_IDENTIFIER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD_IN_QUOTE, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_TCL_IN_QUOTE, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_TCL_SUBSTITUTION, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_TCL_MODIFIER, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_TCL_EXPAND, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD2, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD3, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD4, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_TCL_WORD5, ft_id, 15);
|
2006-05-16 19:04:04 +00:00
|
|
|
}
|
|
|
|
|
2010-08-23 12:14:58 +00:00
|
|
|
static void styleset_txt2tags_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
|
|
|
new_styleset(ft_id, 22);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "strong", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "emphasis", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "header1", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "header2", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "header3", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "header4", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "header5", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "header6", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "ulist_item", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "olist_item", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "blockquote", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "strikeout", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "hrule", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "link", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "code", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "codebk", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "underlined", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "option", &style_sets[ft_id].styling[19]);
|
|
|
|
get_keyfile_style(config, config_home, "preproc", &style_sets[ft_id].styling[20]);
|
|
|
|
get_keyfile_style(config, config_home, "postproc", &style_sets[ft_id].styling[21]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_txt2tags(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_TXT2TAGS, ft_id);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_LINE_BEGIN, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_PRECHAR, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_STRONG1, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_STRONG2, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_EM1, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_EM2, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER1, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER2, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER3, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER4, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER5, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HEADER6, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_ULIST_ITEM, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_OLIST_ITEM, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_BLOCKQUOTE, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_STRIKEOUT, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_HRULE, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_LINK, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_CODE, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_CODE2, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_CODEBK, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_COMMENT, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_OPTION, ft_id, 19);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_PREPROC, ft_id, 20);
|
|
|
|
set_sci_style(sci, SCE_TXT2TAGS_POSTPROC, ft_id, 21);
|
|
|
|
}
|
|
|
|
|
2008-11-07 14:39:45 +00:00
|
|
|
|
|
|
|
static void styleset_matlab_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 9);
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "doublequotedstring", &style_sets[ft_id].styling[8]);
|
2008-11-07 14:39:45 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2008-11-07 14:39:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_matlab(ScintillaObject *sci, gint ft_id)
|
2008-11-07 14:39:45 +00:00
|
|
|
{
|
2010-08-17 14:07:58 +00:00
|
|
|
/* We use SCLEX_OCTAVE instead of SCLEX_MATLAB to also support Octave # comment char */
|
|
|
|
apply_filetype_properties(sci, SCLEX_OCTAVE, ft_id);
|
2008-11-07 14:39:45 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2008-11-07 14:39:45 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_COMMAND, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_KEYWORD, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_STRING, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_OPERATOR, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_IDENTIFIER, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_MATLAB_DOUBLEQUOTESTRING, ft_id, 8);
|
2008-11-07 14:39:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_d_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-07-09 14:41:53 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 18);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdocnested", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "typedef", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "commentlinedoc", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdockeyword", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdockeyworderror", &style_sets[ft_id].styling[17]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "docComment", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "types", ft_id, 3);
|
|
|
|
style_sets[ft_id].keywords[4] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_d(ScintillaObject *sci, gint ft_id)
|
2006-07-09 14:41:53 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_D, ft_id);
|
2006-07-09 14:41:53 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
2009-12-07 13:24:11 +00:00
|
|
|
/* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */
|
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[3]);
|
|
|
|
|
|
|
|
/* assign global types, merge them with user defined keywords and set them */
|
|
|
|
merge_type_keywords(sci, ft_id, 1);
|
2009-11-24 15:47:44 +00:00
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_D_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTDOC, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTNESTED, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_D_NUMBER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_D_WORD, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_D_WORD2, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_D_WORD3, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_D_TYPEDEF, ft_id, 9);
|
2009-12-07 13:24:11 +00:00
|
|
|
set_sci_style(sci, SCE_D_WORD5, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_D_STRING, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_D_STRINGB, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_D_STRINGR, ft_id, 10);
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, SCE_D_STRINGEOL, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_D_CHARACTER, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_D_OPERATOR, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_D_IDENTIFIER, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTLINEDOC, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTDOCKEYWORD, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_D_COMMENTDOCKEYWORDERROR, ft_id, 17);
|
2006-07-09 14:41:53 +00:00
|
|
|
}
|
2006-02-10 20:52:17 +00:00
|
|
|
|
2006-08-27 17:39:34 +00:00
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_ferite_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-08-27 17:39:34 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2006-09-30 11:13:58 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "types", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "docComment", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
2006-08-27 17:39:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_ferite(ScintillaObject *sci, gint ft_id)
|
2006-08-27 17:39:34 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2006-08-27 17:39:34 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
2006-08-27 17:39:34 +00:00
|
|
|
}
|
2006-11-13 22:11:19 +00:00
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_vhdl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2006-11-13 22:11:19 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 15);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_line_bang", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "stdoperator", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "stdfunction", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "stdpackage", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "stdtype", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "userword", &style_sets[ft_id].styling[14]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 8);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "operators", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "attributes", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "std_functions", ft_id, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "std_packages", ft_id, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "std_types", ft_id, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "userwords", ft_id, 6);
|
|
|
|
style_sets[ft_id].keywords[7] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_vhdl(ScintillaObject *sci, gint ft_id)
|
2006-11-13 22:11:19 +00:00
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_VHDL, ft_id);
|
2006-11-13 22:11:19 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]);
|
|
|
|
sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]);
|
|
|
|
sci_set_keywords(sci, 6, style_sets[ft_id].keywords[6]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_VHDL_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_VHDL_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_VHDL_COMMENTLINEBANG, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_VHDL_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STRING, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_VHDL_OPERATOR, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_VHDL_IDENTIFIER, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STRINGEOL, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_VHDL_KEYWORD, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STDOPERATOR, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_VHDL_ATTRIBUTE, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STDFUNCTION, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STDPACKAGE, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_VHDL_STDTYPE, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_VHDL_USERWORD, ft_id, 14);
|
2006-11-13 22:11:19 +00:00
|
|
|
}
|
|
|
|
|
2007-01-13 20:16:09 +00:00
|
|
|
|
2009-12-07 17:51:37 +00:00
|
|
|
static void styleset_verilog_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
|
|
|
new_styleset(ft_id, 14);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_line", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "comment_line_bang", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "userword", &style_sets[ft_id].styling[13]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "word", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "word2", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "word3", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_verilog(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_VERILOG, ft_id);
|
|
|
|
|
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_V_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_V_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_V_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_V_COMMENTLINEBANG, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_V_NUMBER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_V_WORD, ft_id,5);
|
|
|
|
set_sci_style(sci, SCE_V_STRING, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_V_WORD2, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_V_WORD3, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_V_PREPROCESSOR, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_V_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_V_IDENTIFIER, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_V_STRINGEOL, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_V_USER, ft_id, 13);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-29 12:51:50 +00:00
|
|
|
static void styleset_yaml_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 10);
|
2008-11-29 12:51:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "reference", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "document", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "text", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[9]);
|
2008-11-29 12:51:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2008-11-29 12:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_yaml(ScintillaObject *sci, gint ft_id)
|
2008-11-29 12:51:50 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_YAML, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2008-11-29 12:51:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_YAML_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_YAML_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_YAML_IDENTIFIER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_YAML_KEYWORD, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_YAML_NUMBER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_YAML_REFERENCE, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_YAML_DOCUMENT, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_YAML_TEXT, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_YAML_ERROR, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_YAML_OPERATOR, ft_id, 9);
|
2008-11-29 12:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_js_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2007-01-13 20:16:09 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2007-01-13 20:16:09 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2007-01-13 20:16:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_js(ScintillaObject *sci, gint ft_id)
|
2007-01-13 20:16:09 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2007-01-13 20:16:09 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2007-01-13 20:16:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_lua_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2007-01-13 20:16:09 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 20);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "literalstring", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "function_basic", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "function_other", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "coroutines", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "word5", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "word6", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "word7", &style_sets[ft_id].styling[18]);
|
|
|
|
get_keyfile_style(config, config_home, "word8", &style_sets[ft_id].styling[19]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 9);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "function_basic", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "function_other", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "coroutines", ft_id, 3);
|
|
|
|
get_keyfile_keywords(config, config_home, "user1", ft_id, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "user2", ft_id, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "user3", ft_id, 6);
|
|
|
|
get_keyfile_keywords(config, config_home, "user4", ft_id, 7);
|
|
|
|
style_sets[ft_id].keywords[8] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_lua(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_LUA, ft_id);
|
2007-01-13 20:16:09 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]);
|
|
|
|
sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]);
|
|
|
|
sci_set_keywords(sci, 6, style_sets[ft_id].keywords[6]);
|
|
|
|
sci_set_keywords(sci, 7, style_sets[ft_id].keywords[7]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_LUA_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_LUA_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_LUA_COMMENTLINE, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_LUA_COMMENTDOC, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_LUA_NUMBER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_LUA_STRING, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_LUA_CHARACTER, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_LUA_LITERALSTRING, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_LUA_PREPROCESSOR, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_LUA_OPERATOR, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_LUA_IDENTIFIER, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_LUA_STRINGEOL, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD2, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD3, ft_id, 14);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD4, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD5, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD6, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD7, ft_id, 18);
|
|
|
|
set_sci_style(sci, SCE_LUA_WORD8, ft_id, 19);
|
2007-01-13 20:16:09 +00:00
|
|
|
}
|
2007-06-22 17:34:31 +00:00
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_basic_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2007-06-22 17:34:31 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 19);
|
|
|
|
|
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "date", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[11]);
|
|
|
|
get_keyfile_style(config, config_home, "word4", &style_sets[ft_id].styling[12]);
|
|
|
|
get_keyfile_style(config, config_home, "constant", &style_sets[ft_id].styling[13]);
|
|
|
|
get_keyfile_style(config, config_home, "asm", &style_sets[ft_id].styling[14]);
|
|
|
|
get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[15]);
|
|
|
|
get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[16]);
|
|
|
|
get_keyfile_style(config, config_home, "hexnumber", &style_sets[ft_id].styling[17]);
|
|
|
|
get_keyfile_style(config, config_home, "binnumber", &style_sets[ft_id].styling[18]);
|
|
|
|
|
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 5);
|
|
|
|
get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "preprocessor", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "user1", ft_id, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "user2", ft_id, 3);
|
|
|
|
style_sets[ft_id].keywords[4] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void styleset_basic(ScintillaObject *sci, gint ft_id)
|
|
|
|
{
|
2007-07-11 15:01:24 +00:00
|
|
|
apply_filetype_properties(sci, SCLEX_FREEBASIC, ft_id);
|
2007-06-22 17:34:31 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]);
|
|
|
|
|
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_B_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_B_COMMENT, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_B_NUMBER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_B_KEYWORD, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_B_STRING, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_B_PREPROCESSOR, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_B_OPERATOR, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_B_IDENTIFIER, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_B_DATE, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_B_STRINGEOL, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_B_KEYWORD2, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_B_KEYWORD3, ft_id, 11);
|
|
|
|
set_sci_style(sci, SCE_B_KEYWORD4, ft_id, 12);
|
|
|
|
set_sci_style(sci, SCE_B_CONSTANT, ft_id, 13);
|
|
|
|
set_sci_style(sci, SCE_B_ASM, ft_id, 14); /* (still?) unused by the lexer */
|
|
|
|
set_sci_style(sci, SCE_B_LABEL, ft_id, 15);
|
|
|
|
set_sci_style(sci, SCE_B_ERROR, ft_id, 16);
|
|
|
|
set_sci_style(sci, SCE_B_HEXNUMBER, ft_id, 17);
|
|
|
|
set_sci_style(sci, SCE_B_BINNUMBER, ft_id, 18);
|
2007-06-22 17:34:31 +00:00
|
|
|
}
|
2007-07-26 09:50:12 +00:00
|
|
|
|
2009-03-13 09:58:27 +00:00
|
|
|
|
|
|
|
static void styleset_actionscript_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2009-03-13 09:58:27 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar *, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "classes", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
2009-03-13 09:58:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_actionscript(ScintillaObject *sci, gint ft_id)
|
2009-03-13 09:58:27 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2009-03-13 09:58:27 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[2]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[1]);
|
2009-03-13 09:58:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
static void styleset_haxe_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
2007-07-26 09:50:12 +00:00
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
styleset_c_like_init(config, config_home, ft_id);
|
2007-07-26 09:50:12 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 4);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
get_keyfile_keywords(config, config_home, "secondary", ft_id, 1);
|
|
|
|
get_keyfile_keywords(config, config_home, "classes", ft_id, 2);
|
|
|
|
style_sets[ft_id].keywords[3] = NULL;
|
2007-07-26 09:50:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_haxe(ScintillaObject *sci, gint ft_id)
|
2007-07-26 09:50:12 +00:00
|
|
|
{
|
2009-12-03 13:43:37 +00:00
|
|
|
styleset_c_like(sci, ft_id);
|
2007-07-26 09:50:12 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
|
|
|
sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
|
|
|
|
sci_set_keywords(sci, 3, style_sets[ft_id].keywords[2]);
|
2007-07-26 09:50:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-04 16:00:50 +00:00
|
|
|
static void styleset_ada_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
|
|
|
{
|
2009-11-24 15:47:44 +00:00
|
|
|
new_styleset(ft_id, 12);
|
2009-01-04 16:00:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
|
|
|
|
get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[1]);
|
|
|
|
get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[2]);
|
|
|
|
get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
|
|
|
|
get_keyfile_style(config, config_home, "delimiter", &style_sets[ft_id].styling[4]);
|
|
|
|
get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[5]);
|
|
|
|
get_keyfile_style(config, config_home, "charactereol", &style_sets[ft_id].styling[6]);
|
|
|
|
get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]);
|
|
|
|
get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[8]);
|
|
|
|
get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[9]);
|
|
|
|
get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[10]);
|
|
|
|
get_keyfile_style(config, config_home, "illegal", &style_sets[ft_id].styling[11]);
|
2009-01-04 16:00:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
style_sets[ft_id].keywords = g_new(gchar*, 2);
|
|
|
|
get_keyfile_keywords(config, config_home, "primary", ft_id, 0);
|
|
|
|
style_sets[ft_id].keywords[1] = NULL;
|
2009-01-04 16:00:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
static void styleset_ada(ScintillaObject *sci, gint ft_id)
|
2009-01-04 16:00:50 +00:00
|
|
|
{
|
|
|
|
apply_filetype_properties(sci, SCLEX_ADA, ft_id);
|
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
|
2009-01-04 16:00:50 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ADA_DEFAULT, ft_id, 0);
|
|
|
|
set_sci_style(sci, SCE_ADA_WORD, ft_id, 1);
|
|
|
|
set_sci_style(sci, SCE_ADA_IDENTIFIER, ft_id, 2);
|
|
|
|
set_sci_style(sci, SCE_ADA_NUMBER, ft_id, 3);
|
|
|
|
set_sci_style(sci, SCE_ADA_DELIMITER, ft_id, 4);
|
|
|
|
set_sci_style(sci, SCE_ADA_CHARACTER, ft_id, 5);
|
|
|
|
set_sci_style(sci, SCE_ADA_CHARACTEREOL, ft_id, 6);
|
|
|
|
set_sci_style(sci, SCE_ADA_STRING, ft_id, 7);
|
|
|
|
set_sci_style(sci, SCE_ADA_STRINGEOL, ft_id, 8);
|
|
|
|
set_sci_style(sci, SCE_ADA_LABEL, ft_id, 9);
|
|
|
|
set_sci_style(sci, SCE_ADA_COMMENTLINE, ft_id, 10);
|
|
|
|
set_sci_style(sci, SCE_ADA_ILLEGAL, ft_id, 11);
|
2009-01-04 16:00:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 16:48:17 +00:00
|
|
|
static void get_key_values(GKeyFile *config, const gchar *group, gchar **keys, gchar **values)
|
|
|
|
{
|
|
|
|
while (*keys)
|
|
|
|
{
|
|
|
|
gchar *str = g_key_file_get_string(config, group, *keys, NULL);
|
|
|
|
|
|
|
|
if (str)
|
|
|
|
setptr(*values, str);
|
|
|
|
|
|
|
|
keys++;
|
|
|
|
values++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void read_properties(GeanyFiletype *ft, GKeyFile *config, GKeyFile *configh)
|
|
|
|
{
|
|
|
|
gchar group[] = "lexer_properties";
|
2010-10-05 11:07:10 +00:00
|
|
|
gchar **keys;
|
2009-11-24 16:22:14 +00:00
|
|
|
gchar **keysh = g_key_file_get_keys(configh, group, NULL, NULL);
|
2010-10-05 11:07:10 +00:00
|
|
|
gchar **ptr;
|
2009-11-18 16:48:17 +00:00
|
|
|
|
2010-10-05 11:07:10 +00:00
|
|
|
/* remove overridden keys from system keyfile */
|
|
|
|
foreach_strv(ptr, keysh)
|
|
|
|
g_key_file_remove_key(config, group, *ptr, NULL);
|
|
|
|
|
|
|
|
/* merge sys and user keys */
|
|
|
|
keys = g_key_file_get_keys(config, group, NULL, NULL);
|
|
|
|
keys = utils_strv_join(keys, keysh);
|
2009-11-18 16:48:17 +00:00
|
|
|
|
|
|
|
if (keys)
|
|
|
|
{
|
2009-11-24 16:22:14 +00:00
|
|
|
gchar **values = g_new0(gchar*, g_strv_length(keys) + 1);
|
2009-11-18 16:48:17 +00:00
|
|
|
|
|
|
|
style_sets[ft->id].property_keys = keys;
|
|
|
|
style_sets[ft->id].property_values = values;
|
|
|
|
|
|
|
|
get_key_values(config, group, keys, values);
|
|
|
|
get_key_values(configh, group, keys, values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-07 13:50:23 +00:00
|
|
|
static gint get_lexer_filetype(GeanyFiletype *ft)
|
|
|
|
{
|
|
|
|
ft = NVL(ft->lexer_filetype, ft);
|
|
|
|
return ft->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
/* lang_name is the name used for the styleset_foo_init function, e.g. foo. */
|
2009-07-24 14:31:43 +00:00
|
|
|
#define init_styleset_case(ft_id, init_styleset_func) \
|
2007-11-02 17:44:05 +00:00
|
|
|
case (ft_id): \
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_func(filetype_idx, config, configh); \
|
|
|
|
break
|
2007-11-02 17:44:05 +00:00
|
|
|
|
|
|
|
/* Called by filetypes_load_config(). */
|
|
|
|
void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *configh)
|
|
|
|
{
|
2009-11-18 16:48:17 +00:00
|
|
|
GeanyFiletype *ft = filetypes[filetype_idx];
|
2009-12-07 13:50:23 +00:00
|
|
|
gint lexer_id = get_lexer_filetype(ft);
|
2009-11-18 16:48:17 +00:00
|
|
|
|
2009-12-07 18:08:35 +00:00
|
|
|
if (!style_sets)
|
|
|
|
style_sets = g_new0(StyleSet, filetypes_array->len);
|
|
|
|
|
|
|
|
/* Clear old information if necessary - e.g. when reloading config */
|
|
|
|
free_styleset(filetype_idx);
|
|
|
|
|
|
|
|
read_properties(ft, config, configh);
|
|
|
|
|
2009-12-07 17:23:33 +00:00
|
|
|
/* None filetype handled specially */
|
|
|
|
if (filetype_idx == GEANY_FILETYPES_NONE)
|
|
|
|
{
|
|
|
|
styleset_common_init(GEANY_FILETYPES_NONE, config, configh);
|
|
|
|
return;
|
|
|
|
}
|
2007-11-02 17:44:05 +00:00
|
|
|
/* All stylesets depend on filetypes.common */
|
2009-12-07 17:23:33 +00:00
|
|
|
filetypes_load_config(GEANY_FILETYPES_NONE, FALSE);
|
2007-11-02 17:44:05 +00:00
|
|
|
|
2009-11-24 16:47:35 +00:00
|
|
|
switch (lexer_id)
|
2007-11-02 17:44:05 +00:00
|
|
|
{
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_ADA, styleset_ada_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_ASM, styleset_asm_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_BASIC, styleset_basic_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_C, styleset_c_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_CAML, styleset_caml_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_CMAKE, styleset_cmake_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_CONF, styleset_conf_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_CSS, styleset_css_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_D, styleset_d_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_DIFF, styleset_diff_init);
|
2010-10-06 17:10:15 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_LISP, styleset_lisp_init);
|
2010-10-20 15:45:25 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_ERLANG, styleset_erlang_init);
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_F77, styleset_f77_init);
|
2010-09-30 16:59:22 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_FORTH, styleset_forth_init);
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_FORTRAN, styleset_fortran_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_HASKELL, styleset_haskell_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_HAXE, styleset_haxe_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_AS, styleset_actionscript_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_HTML, styleset_html_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_JAVA, styleset_java_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_JS, styleset_js_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_LATEX, styleset_latex_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_LUA, styleset_lua_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_MAKE, styleset_makefile_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_MATLAB, styleset_matlab_init);
|
2009-07-30 11:29:53 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_MARKDOWN, styleset_markdown_init);
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_NSIS, styleset_nsis_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_PASCAL, styleset_pascal_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_PERL, styleset_perl_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_PHP, styleset_php_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_PO, styleset_po_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_PYTHON, styleset_python_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_R, styleset_r_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_RUBY, styleset_ruby_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_SH, styleset_sh_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_SQL, styleset_sql_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_TCL, styleset_tcl_init);
|
2010-08-23 12:14:58 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_TXT2TAGS, styleset_txt2tags_init);
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_VHDL, styleset_vhdl_init);
|
2009-12-07 17:51:37 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_VERILOG, styleset_verilog_init);
|
2009-07-24 14:31:43 +00:00
|
|
|
init_styleset_case(GEANY_FILETYPES_XML, styleset_markup_init);
|
|
|
|
init_styleset_case(GEANY_FILETYPES_YAML, styleset_yaml_init);
|
2009-12-07 17:23:33 +00:00
|
|
|
default:
|
|
|
|
if (ft->lexer_filetype)
|
|
|
|
geany_debug("Filetype %s has a recursive lexer_filetype %s set!",
|
|
|
|
ft->name, ft->lexer_filetype->name);
|
2007-11-02 17:44:05 +00:00
|
|
|
}
|
2009-11-18 16:48:17 +00:00
|
|
|
|
2009-08-11 14:18:44 +00:00
|
|
|
/* should be done in filetypes.c really: */
|
2009-12-07 17:23:33 +00:00
|
|
|
get_keyfile_wordchars(config, configh, &style_sets[filetype_idx].wordchars);
|
2007-11-02 17:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* lang_name is the name used for the styleset_foo function, e.g. foo. */
|
2009-07-24 14:31:43 +00:00
|
|
|
#define styleset_case(ft_id, styleset_func) \
|
2007-11-02 17:44:05 +00:00
|
|
|
case (ft_id): \
|
2009-11-24 16:47:35 +00:00
|
|
|
styleset_func(sci, ft->id); \
|
2009-07-24 14:31:43 +00:00
|
|
|
break
|
2007-11-02 17:44:05 +00:00
|
|
|
|
2010-03-12 18:15:48 +00:00
|
|
|
/** Sets up highlighting and other visual settings.
|
2009-10-15 16:54:15 +00:00
|
|
|
* @param sci Scintilla widget.
|
|
|
|
* @param ft Filetype settings to use. */
|
|
|
|
void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
|
2007-11-02 17:44:05 +00:00
|
|
|
{
|
2009-12-07 13:50:23 +00:00
|
|
|
gint lexer_id = get_lexer_filetype(ft);
|
2009-11-24 15:47:44 +00:00
|
|
|
|
2009-10-15 16:54:15 +00:00
|
|
|
filetypes_load_config(ft->id, FALSE); /* load filetypes.ext */
|
2008-02-26 17:11:02 +00:00
|
|
|
|
2009-11-24 15:47:44 +00:00
|
|
|
switch (lexer_id)
|
2007-11-02 17:44:05 +00:00
|
|
|
{
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_ADA, styleset_ada);
|
|
|
|
styleset_case(GEANY_FILETYPES_ASM, styleset_asm);
|
|
|
|
styleset_case(GEANY_FILETYPES_BASIC, styleset_basic);
|
|
|
|
styleset_case(GEANY_FILETYPES_C, styleset_c);
|
|
|
|
styleset_case(GEANY_FILETYPES_CAML, styleset_caml);
|
|
|
|
styleset_case(GEANY_FILETYPES_CMAKE, styleset_cmake);
|
|
|
|
styleset_case(GEANY_FILETYPES_CONF, styleset_conf);
|
|
|
|
styleset_case(GEANY_FILETYPES_CSS, styleset_css);
|
|
|
|
styleset_case(GEANY_FILETYPES_D, styleset_d);
|
|
|
|
styleset_case(GEANY_FILETYPES_DIFF, styleset_diff);
|
2010-10-06 17:10:15 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_LISP, styleset_lisp);
|
2010-10-20 15:45:25 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_ERLANG, styleset_erlang);
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook);
|
|
|
|
styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite);
|
|
|
|
styleset_case(GEANY_FILETYPES_F77, styleset_f77);
|
2010-09-30 16:59:22 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_FORTH, styleset_forth);
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_FORTRAN, styleset_fortran);
|
|
|
|
styleset_case(GEANY_FILETYPES_HASKELL, styleset_haskell);
|
|
|
|
styleset_case(GEANY_FILETYPES_HAXE, styleset_haxe);
|
|
|
|
styleset_case(GEANY_FILETYPES_AS, styleset_actionscript);
|
|
|
|
styleset_case(GEANY_FILETYPES_HTML, styleset_html);
|
|
|
|
styleset_case(GEANY_FILETYPES_JAVA, styleset_java);
|
|
|
|
styleset_case(GEANY_FILETYPES_JS, styleset_js);
|
|
|
|
styleset_case(GEANY_FILETYPES_LATEX, styleset_latex);
|
|
|
|
styleset_case(GEANY_FILETYPES_LUA, styleset_lua);
|
|
|
|
styleset_case(GEANY_FILETYPES_MAKE, styleset_makefile);
|
2009-07-30 11:29:53 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_MARKDOWN, styleset_markdown);
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_MATLAB, styleset_matlab);
|
|
|
|
styleset_case(GEANY_FILETYPES_NSIS, styleset_nsis);
|
|
|
|
styleset_case(GEANY_FILETYPES_PASCAL, styleset_pascal);
|
|
|
|
styleset_case(GEANY_FILETYPES_PERL, styleset_perl);
|
|
|
|
styleset_case(GEANY_FILETYPES_PHP, styleset_php);
|
|
|
|
styleset_case(GEANY_FILETYPES_PO, styleset_po);
|
|
|
|
styleset_case(GEANY_FILETYPES_PYTHON, styleset_python);
|
|
|
|
styleset_case(GEANY_FILETYPES_R, styleset_r);
|
|
|
|
styleset_case(GEANY_FILETYPES_RUBY, styleset_ruby);
|
|
|
|
styleset_case(GEANY_FILETYPES_SH, styleset_sh);
|
|
|
|
styleset_case(GEANY_FILETYPES_SQL, styleset_sql);
|
|
|
|
styleset_case(GEANY_FILETYPES_TCL, styleset_tcl);
|
2010-08-23 12:14:58 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_TXT2TAGS, styleset_txt2tags);
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_VHDL, styleset_vhdl);
|
2009-12-07 17:51:37 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_VERILOG, styleset_verilog);
|
2009-07-24 14:31:43 +00:00
|
|
|
styleset_case(GEANY_FILETYPES_XML, styleset_xml);
|
|
|
|
styleset_case(GEANY_FILETYPES_YAML, styleset_yaml);
|
2009-08-14 11:05:47 +00:00
|
|
|
case GEANY_FILETYPES_NONE:
|
2007-11-02 17:44:05 +00:00
|
|
|
default:
|
2009-10-15 16:54:15 +00:00
|
|
|
styleset_default(sci, ft->id);
|
2007-11-02 17:44:05 +00:00
|
|
|
}
|
2009-11-18 16:48:17 +00:00
|
|
|
/* [lexer_properties] settings */
|
|
|
|
if (style_sets[ft->id].property_keys)
|
|
|
|
{
|
|
|
|
gchar **prop = style_sets[ft->id].property_keys;
|
|
|
|
gchar **val = style_sets[ft->id].property_values;
|
|
|
|
|
|
|
|
while (*prop)
|
|
|
|
{
|
|
|
|
sci_set_property(sci, *prop, *val);
|
|
|
|
prop++;
|
|
|
|
val++;
|
|
|
|
}
|
|
|
|
}
|
2007-11-02 17:44:05 +00:00
|
|
|
}
|
2007-12-16 11:27:59 +00:00
|
|
|
|
|
|
|
|
2010-03-12 18:15:48 +00:00
|
|
|
/** Retrieves a style @a style_id for the filetype @a ft_id.
|
2008-08-26 12:43:46 +00:00
|
|
|
* If the style was not already initialised
|
2007-12-16 11:27:59 +00:00
|
|
|
* (e.g. by by opening a file of this type), it will be initialised. The returned pointer is
|
|
|
|
* owned by Geany and must not be freed.
|
2008-08-26 12:43:46 +00:00
|
|
|
* @param ft_id Filetype ID, e.g. @c GEANY_FILETYPES_DIFF.
|
|
|
|
* @param style_id A Scintilla lexer style, e.g. @c SCE_DIFF_ADDED. See scintilla/include/SciLexer.h.
|
|
|
|
* @return A pointer to the style struct.
|
2010-01-25 15:53:54 +00:00
|
|
|
* @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with scintilla_send_message(). */
|
2008-08-26 12:43:46 +00:00
|
|
|
const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id)
|
2007-12-16 11:27:59 +00:00
|
|
|
{
|
2009-08-14 11:05:47 +00:00
|
|
|
if (ft_id < 0 || ft_id >= (gint)filetypes_array->len)
|
2007-12-16 11:27:59 +00:00
|
|
|
return NULL;
|
|
|
|
|
2008-08-26 09:48:18 +00:00
|
|
|
/* ensure filetype loaded */
|
|
|
|
filetypes_load_config(ft_id, FALSE);
|
2007-12-16 11:27:59 +00:00
|
|
|
|
2008-08-26 09:48:18 +00:00
|
|
|
/* TODO: style_id might not be the real array index (Scintilla styles are not always synced
|
|
|
|
* with array indices) */
|
|
|
|
return get_style(ft_id, style_id);
|
2007-12-16 11:27:59 +00:00
|
|
|
}
|
2009-11-04 12:36:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_color_scheme_clicked(GtkMenuItem *menuitem, gpointer user_data)
|
|
|
|
{
|
|
|
|
gchar *fname;
|
|
|
|
gchar *path;
|
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
/* prevent callback on setting initial value */
|
|
|
|
if (!GTK_WIDGET_MAPPED(menuitem))
|
|
|
|
return;
|
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
/* check if default item */
|
2010-10-20 11:49:50 +00:00
|
|
|
if (!user_data)
|
2009-11-04 12:36:56 +00:00
|
|
|
{
|
|
|
|
setptr(editor_prefs.color_scheme, NULL);
|
2009-11-04 15:06:56 +00:00
|
|
|
filetypes_reload();
|
2009-11-04 12:36:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
fname = ui_menu_item_get_text(menuitem);
|
|
|
|
setptr(fname, utils_get_locale_from_utf8(fname));
|
|
|
|
|
|
|
|
/* fname is just the basename from the menu item, so prepend the custom files path */
|
|
|
|
path = g_build_path(G_DIR_SEPARATOR_S, app->configdir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL);
|
|
|
|
if (!g_file_test(path, G_FILE_TEST_EXISTS))
|
|
|
|
{
|
|
|
|
/* try the system path */
|
|
|
|
g_free(path);
|
|
|
|
path = g_build_path(G_DIR_SEPARATOR_S, app->datadir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL);
|
|
|
|
}
|
|
|
|
if (g_file_test(path, G_FILE_TEST_EXISTS))
|
|
|
|
{
|
|
|
|
setptr(editor_prefs.color_scheme, fname);
|
|
|
|
fname = NULL;
|
2009-11-04 15:06:56 +00:00
|
|
|
filetypes_reload();
|
2009-11-04 12:36:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setptr(fname, utils_get_utf8_from_locale(fname));
|
|
|
|
ui_set_statusbar(TRUE, _("Could not find file '%s'."), fname);
|
|
|
|
}
|
|
|
|
g_free(path);
|
|
|
|
g_free(fname);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
static void add_color_scheme_item(GtkWidget *menu, const gchar *fname)
|
2009-11-04 12:36:56 +00:00
|
|
|
{
|
2010-10-20 11:49:50 +00:00
|
|
|
static GSList *group = NULL;
|
|
|
|
GtkWidget *item;
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
if (fname)
|
|
|
|
{
|
|
|
|
gchar *label = utils_get_utf8_from_locale(fname);
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
item = gtk_radio_menu_item_new_with_label(group, label);
|
|
|
|
g_free(label);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
item = gtk_radio_menu_item_new_with_mnemonic(group, _("_Default"));
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
|
|
|
|
if (utils_str_equal(editor_prefs.color_scheme, fname))
|
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
2009-11-04 12:36:56 +00:00
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
gtk_widget_show(item);
|
|
|
|
gtk_container_add(GTK_CONTAINER(menu), item);
|
|
|
|
g_signal_connect(item, "activate",
|
|
|
|
G_CALLBACK(on_color_scheme_clicked), GINT_TO_POINTER(fname != NULL));
|
2009-11-04 12:36:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean add_color_scheme_items(GtkWidget *menu)
|
|
|
|
{
|
2010-10-20 11:49:50 +00:00
|
|
|
GSList *list, *node;
|
|
|
|
|
|
|
|
g_return_val_if_fail(menu, FALSE);
|
|
|
|
|
|
|
|
add_color_scheme_item(menu, NULL);
|
|
|
|
list = utils_get_config_files(GEANY_COLORSCHEMES_SUBDIR);
|
2009-11-04 12:36:56 +00:00
|
|
|
|
|
|
|
foreach_slist(node, list)
|
|
|
|
{
|
|
|
|
gchar *fname = node->data;
|
|
|
|
|
|
|
|
if (g_str_has_suffix(fname, ".conf"))
|
2010-10-20 11:49:50 +00:00
|
|
|
add_color_scheme_item(menu, fname);
|
|
|
|
|
2009-11-04 12:36:56 +00:00
|
|
|
g_free(fname);
|
|
|
|
}
|
|
|
|
g_slist_free(list);
|
|
|
|
return list != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void create_color_scheme_menu(void)
|
|
|
|
{
|
|
|
|
GtkWidget *item, *menu, *root;
|
|
|
|
|
|
|
|
menu = ui_lookup_widget(main_widgets.window, "menu_view_editor1_menu");
|
|
|
|
item = ui_image_menu_item_new(GTK_STOCK_SELECT_COLOR, _("_Color Schemes"));
|
|
|
|
gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item);
|
|
|
|
root = item;
|
|
|
|
|
|
|
|
menu = gtk_menu_new();
|
|
|
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
|
|
|
|
|
2010-10-20 11:49:50 +00:00
|
|
|
add_color_scheme_items(menu);
|
|
|
|
gtk_widget_show_all(root);
|
2009-11-04 12:36:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void highlighting_init(void)
|
|
|
|
{
|
|
|
|
create_color_scheme_menu();
|
|
|
|
}
|
|
|
|
|