From 2bb49a38c80d97c8d63fd1d414fcd59cd21f2895 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 12 Aug 2009 11:19:54 +0000 Subject: [PATCH 2/6] Support adding custom filetype files e.g. filetype.Foo.conf. (Only tested with empty file so far). Allow GeanyFiletype::extension to be NULL. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@4070 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 9 +++++++ src/dialogs.c | 5 ++-- src/document.c | 6 ++++- src/filetypes.c | 59 ++++++++++++++++++++++++++++++++++++++++++---- src/filetypes.h | 2 +- src/highlighting.c | 3 +++ src/symbols.c | 5 ++-- src/templates.c | 4 +++- 8 files changed, 80 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1b63efc..31c24d3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-08-12 Nick Treleaven + + * src/templates.c, src/highlighting.c, src/dialogs.c, src/filetypes.c, + src/filetypes.h, src/document.c, src/symbols.c: + Support adding custom filetype files e.g. filetype.Foo.conf. (Only + tested with empty file so far). + Allow GeanyFiletype::extension to be NULL. + + 2009-08-11 Nick Treleaven * src/highlighting.c: diff --git a/src/dialogs.c b/src/dialogs.c index e5c286df..1106f2da 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -88,7 +88,7 @@ on_file_open_dialog_response (GtkDialog *dialog, gboolean ro = (response == GEANY_RESPONSE_VIEW); /* View clicked */ /* ignore detect from file item */ - if (filetype_idx > 0 && filetype_idx < GEANY_MAX_BUILT_IN_FILETYPES) + if (filetype_idx > 0) ft = g_slist_nth_data(filetypes_by_title, filetype_idx); if (encoding_idx >= 0 && encoding_idx < GEANY_ENCODINGS_MAX) charset = encodings[encoding_idx].charset; @@ -511,8 +511,7 @@ static gboolean gtk_show_save_as(void) { gchar *fname = NULL; - if (doc->file_type != NULL && doc->file_type->id != GEANY_FILETYPES_NONE && - doc->file_type->extension != NULL) + if (doc->file_type != NULL && doc->file_type->extension != NULL) fname = g_strconcat(GEANY_STRING_UNTITLED, ".", doc->file_type->extension, NULL); else diff --git a/src/document.c b/src/document.c index 79309418..ed805c5b 100644 --- a/src/document.c +++ b/src/document.c @@ -1461,7 +1461,11 @@ static void replace_header_filename(GeanyDocument *doc) g_return_if_fail(doc != NULL); g_return_if_fail(doc->file_type != NULL); - filebase = g_strconcat(GEANY_STRING_UNTITLED, ".", (doc->file_type)->extension, NULL); + if (doc->file_type->extension) + filebase = g_strconcat(GEANY_STRING_UNTITLED, ".", doc->file_type->extension, NULL); + else + filebase = g_strdup(GEANY_STRING_UNTITLED); + filename = g_path_get_basename(doc->file_name); /* only search the first 3 lines */ diff --git a/src/filetypes.c b/src/filetypes.c index f8a30103..2c83c4a1 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -112,7 +112,7 @@ static void init_builtin_filetypes(void) ft->lang = -2; ft->name = g_strdup(_("None")); ft->title = g_strdup(_("None")); - ft->extension = g_strdup("*"); + ft->extension = NULL; ft->pattern = utils_strv_new("*", NULL); ft->comment_open = NULL; ft->comment_close = NULL; @@ -656,6 +656,51 @@ static void filetype_add(GeanyFiletype *ft) } +static void add_custom_filetype(const gchar *filename) +{ + gchar *fn = utils_strdupa(strstr(filename, ".") + 1); + gchar *dot = g_strrstr(fn, ".conf"); + GeanyFiletype *ft; + + g_return_if_fail(dot); + + *dot = 0x0; + + geany_debug("Adding filetype %s.", fn); + ft = filetype_new(); + ft->name = g_strdup(fn); + filetype_make_title(ft, TITLE_FILE); + ft->pattern = g_new0(gchar*, 1); + filetype_add(ft); +} + + +static void init_custom_filetypes(const gchar *path) +{ + GDir *dir; + + g_return_if_fail(path); + + dir = g_dir_open(path, 0, NULL); + if (dir == NULL) + return; + + while (1) + { + const gchar *filename = g_dir_read_name(dir); + + if (filename == NULL) + break; + + if (g_str_has_prefix(filename, "filetype.") && g_str_has_suffix(filename + 9, ".conf")) + { + add_custom_filetype(filename); + } + } + g_dir_close(dir); +} + + /* Create the filetypes array and fill it with the known filetypes. */ void filetypes_init_types() { @@ -679,6 +724,8 @@ void filetypes_init_types() { filetype_add(filetypes[ft_id]); } + init_custom_filetypes(app->datadir); + init_custom_filetypes(utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, NULL)); } @@ -745,16 +792,18 @@ static void create_set_filetype_menu(void) { GeanyFiletype *ft = node->data; - if (ft->id != GEANY_FILETYPES_NONE) + if (ft->group != GEANY_FILETYPE_GROUP_NONE) create_radio_menu_item(group_menus[ft->group], ft); + else + create_radio_menu_item(filetype_menu, ft); } - create_radio_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_NONE]); } void filetypes_init() { filetypes_init_types(); + create_set_filetype_menu(); setup_config_file_menus(); } @@ -1284,9 +1333,9 @@ void filetypes_save_commands(void) { gchar *conf_prefix = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.", NULL); - gint i; + guint i; - for (i = 1; i < GEANY_MAX_BUILT_IN_FILETYPES; i++) + for (i = 1; i < filetypes_array->len; i++) { struct build_programs *bp = filetypes[i]->programs; GKeyFile *config_home; diff --git a/src/filetypes.h b/src/filetypes.h index ea1c6357..ed59f7c1 100644 --- a/src/filetypes.h +++ b/src/filetypes.h @@ -125,7 +125,7 @@ struct GeanyFiletype langType lang; gchar *name; /**< Used as name for tagmanager. E.g. "C". */ gchar *title; /**< Shown in the file open dialog. E.g. "C source file". */ - gchar *extension; /**< Default file extension for new files. */ + gchar *extension; /**< Default file extension for new files, or @c NULL. */ gchar **pattern; /**< Array of filename-matching wildcard strings. */ gchar *context_action_cmd; gchar *comment_open; diff --git a/src/highlighting.c b/src/highlighting.c index 1ae5bf69..5bc0a6dc 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -3497,6 +3497,9 @@ static void styleset_ada(ScintillaObject *sci) /* Called by filetypes_load_config(). */ void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *configh) { + if (filetype_idx >= GEANY_MAX_BUILT_IN_FILETYPES) + return; /* not supported yet */ + /* Clear old information if necessary - e.g. reloading config */ styleset_free(filetype_idx); diff --git a/src/symbols.c b/src/symbols.c index 39f41e9f..1f995314 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -1487,15 +1487,16 @@ static GHashTable *init_user_tags(void) static void load_user_tags(filetype_id ft_id) { - static guchar tags_loaded[GEANY_MAX_BUILT_IN_FILETYPES] = {0}; + static guchar *tags_loaded = NULL; static GHashTable *lang_hash = NULL; GList *fnames; const GList *node; GeanyFiletype *ft = filetypes[ft_id]; g_return_if_fail(ft_id > 0); - g_return_if_fail(ft_id < GEANY_MAX_BUILT_IN_FILETYPES); + if (!tags_loaded) + tags_loaded = g_new0(guchar, filetypes_array->len); if (tags_loaded[ft_id]) return; tags_loaded[ft_id] = TRUE; /* prevent reloading */ diff --git a/src/templates.c b/src/templates.c index 8b8ea2a1..9f124c8f 100644 --- a/src/templates.c +++ b/src/templates.c @@ -240,6 +240,8 @@ static const gchar templates_filetype_latex[] = "\ "; static gchar *templates[GEANY_MAX_TEMPLATES]; + +/* TODO: remove filetype templates, use custom file templates instead. */ static gchar *ft_templates[GEANY_MAX_BUILT_IN_FILETYPES] = {NULL}; @@ -684,7 +686,7 @@ gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname) if (fname == NULL) { - if (ft_id == GEANY_FILETYPES_NONE) + if (!ft->extension) shortname = g_strdup(GEANY_STRING_UNTITLED); else shortname = g_strconcat(GEANY_STRING_UNTITLED, ".", ft->extension, NULL); From 1665bc61bc0f64998e49653cde036253959096f9 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 12 Aug 2009 14:47:44 +0000 Subject: [PATCH 3/6] Change custom filetype filename format to filetypes.Foo.conf for consistency with built-in filetype files. Fix loading custom filetype settings (e.g. default extension). Add note about using GeanyFiletype pointer instead of filetype_id for function arguments. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@4071 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/filetypes.c | 30 +++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31c24d3f..e331adf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ Support adding custom filetype files e.g. filetype.Foo.conf. (Only tested with empty file so far). Allow GeanyFiletype::extension to be NULL. + * src/filetypes.c: + Change custom filetype filename format to filetypes.Foo.conf for + consistency with built-in filetype files. + Fix loading custom filetype settings (e.g. default extension). + Add note about using GeanyFiletype pointer instead of filetype_id + for function arguments. 2009-08-11 Nick Treleaven diff --git a/src/filetypes.c b/src/filetypes.c index 2c83c4a1..7ad1af87 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -26,6 +26,9 @@ * Filetype detection, file extensions and filetype menu items. */ +/* Note: we use filetype_id for some function arguments, but GeanyFiletype is better; we should + * only use GeanyFiletype for API functions. */ + #include #include @@ -61,6 +64,7 @@ typedef struct GeanyFiletypePrivate regex_t error_regex; gboolean error_regex_compiled; #endif + gboolean custom; } GeanyFiletypePrivate; @@ -671,6 +675,7 @@ static void add_custom_filetype(const gchar *filename) ft->name = g_strdup(fn); filetype_make_title(ft, TITLE_FILE); ft->pattern = g_new0(gchar*, 1); + ft->priv->custom = TRUE; filetype_add(ft); } @@ -687,12 +692,14 @@ static void init_custom_filetypes(const gchar *path) while (1) { + const gchar prefix[] = "filetypes."; const gchar *filename = g_dir_read_name(dir); if (filename == NULL) break; - if (g_str_has_prefix(filename, "filetype.") && g_str_has_suffix(filename + 9, ".conf")) + if (g_str_has_prefix(filename, prefix) && + g_str_has_suffix(filename + strlen(prefix), ".conf")) { add_custom_filetype(filename); } @@ -1253,13 +1260,16 @@ static void load_settings(gint ft_id, GKeyFile *config, GKeyFile *configh) /* simple wrapper function to print file errors in DEBUG mode */ static void load_system_keyfile(GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, - G_GNUC_UNUSED GError **just_for_compatibility) + GeanyFiletype *ft) { GError *error = NULL; gboolean done = g_key_file_load_from_file(key_file, file, flags, &error); - if (G_UNLIKELY(! done) && G_UNLIKELY(error != NULL)) + + if (error != NULL) { - geany_debug("Failed to open %s (%s)", file, error->message); + if (!done && !ft->priv->custom) + geany_debug("Failed to open %s (%s)", file, error->message); + g_error_free(error); error = NULL; } @@ -1273,10 +1283,12 @@ void filetypes_load_config(gint ft_id, gboolean reload) { GKeyFile *config, *config_home; GeanyFiletypePrivate *pft; + GeanyFiletype *ft; g_return_if_fail(ft_id >= 0 && ft_id < (gint) filetypes_array->len); - pft = filetypes[ft_id]->priv; + ft = filetypes[ft_id]; + pft = ft->priv; /* when reloading, proceed only if the settings were already loaded */ if (reload && G_UNLIKELY(! pft->keyfile_loaded)) @@ -1297,7 +1309,7 @@ void filetypes_load_config(gint ft_id, gboolean reload) gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.", ext, NULL); - load_system_keyfile(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); + load_system_keyfile(config, f0, G_KEY_FILE_KEEP_COMMENTS, ft); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL); g_free(ext); @@ -1316,6 +1328,10 @@ void filetypes_load_config(gint ft_id, gboolean reload) gchar *filetypes_get_conf_extension(gint filetype_idx) { gchar *result; + GeanyFiletype *ft = filetypes[filetype_idx]; + + if (ft->priv->custom) + return g_strconcat(ft->name, ".conf", NULL); /* Handle any special extensions different from lowercase filetype->name */ switch (filetype_idx) @@ -1323,7 +1339,7 @@ gchar *filetypes_get_conf_extension(gint filetype_idx) case GEANY_FILETYPES_CPP: result = g_strdup("cpp"); break; case GEANY_FILETYPES_CS: result = g_strdup("cs"); break; case GEANY_FILETYPES_MAKE: result = g_strdup("makefile"); break; - default: result = g_ascii_strdown(filetypes[filetype_idx]->name, -1); break; + default: result = g_ascii_strdown(ft->name, -1); break; } return result; } From 858a97e90a881007e5b77c62c01f8e305fe32720 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 12 Aug 2009 15:12:50 +0000 Subject: [PATCH 4/6] Prevent adding entries for both system and user custom filetype files. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@4072 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ src/filetypes.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index e331adf1..3de5054d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ Fix loading custom filetype settings (e.g. default extension). Add note about using GeanyFiletype pointer instead of filetype_id for function arguments. + * src/filetypes.c: + Prevent adding entries for both system and user custom filetype + files. 2009-08-11 Nick Treleaven diff --git a/src/filetypes.c b/src/filetypes.c index 7ad1af87..79f73a50 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -670,6 +670,9 @@ static void add_custom_filetype(const gchar *filename) *dot = 0x0; + if (g_hash_table_lookup(filetypes_hash, fn)) + return; + geany_debug("Adding filetype %s.", fn); ft = filetype_new(); ft->name = g_strdup(fn); From 352254b0babbfd3cd1348a63b3eaaf8a2e7cc7de Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 14 Aug 2009 11:05:47 +0000 Subject: [PATCH 5/6] Fix setting wordchars for custom filetypes. Use style_sets array for custom filetypes too. Replace styleset_none() with styleset_default(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@4080 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 8 ++++++++ src/highlighting.c | 46 ++++++++++++++++++++++------------------------ src/main.c | 2 +- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3de5054d..7ada97d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-08-14 Nick Treleaven + + * src/highlighting.c, src/main.c: + Fix setting wordchars for custom filetypes. + Use style_sets array for custom filetypes too. + Replace styleset_none() with styleset_default(). + + 2009-08-12 Nick Treleaven * src/templates.c, src/highlighting.c, src/dialogs.c, src/filetypes.c, diff --git a/src/highlighting.c b/src/highlighting.c index 5bc0a6dc..b832ad33 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -62,7 +62,7 @@ typedef struct } StyleSet; /* each filetype has a styleset except GEANY_FILETYPES_NONE, which uses common_style_set */ -static StyleSet style_sets[GEANY_MAX_BUILT_IN_FILETYPES] = {{0, NULL, NULL, NULL}}; +static StyleSet *style_sets = NULL; enum /* Geany common styling */ @@ -402,7 +402,7 @@ static guint invert(guint icolour) static GeanyLexerStyle *get_style(guint ft_id, guint styling_index) { - g_assert(ft_id < GEANY_MAX_BUILT_IN_FILETYPES); + g_assert(ft_id < filetypes_array->len); if (G_UNLIKELY(ft_id == GEANY_FILETYPES_NONE)) { @@ -432,13 +432,16 @@ static void set_sci_style(ScintillaObject *sci, gint style, guint ft_id, guint s void highlighting_free_styles() { - gint i; + guint i; - for (i = 0; i < GEANY_MAX_BUILT_IN_FILETYPES; i++) + for (i = 0; i < filetypes_array->len; i++) styleset_free(i); if (named_style_hash) g_hash_table_destroy(named_style_hash); + + if (style_sets) + g_free(style_sets); } @@ -600,10 +603,15 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_ } -static void styleset_common(ScintillaObject *sci) +static void styleset_common(ScintillaObject *sci, filetype_id ft_id) { SSM(sci, SCI_STYLECLEARALL, 0, 0); + 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); + /* caret colour, style and width */ SSM(sci, SCI_SETCARETFORE, invert(common_style_set.styling[GCS_CARET].foreground), 0); SSM(sci, SCI_SETCARETWIDTH, common_style_set.styling[GCS_CARET].background, 0); @@ -793,13 +801,7 @@ apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id) SSM(sci, SCI_SETLEXER, lexer, 0); - SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) style_sets[ft_id].wordchars); - /* have to set whitespace after setting wordchars */ - SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars); - - SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.symbolcompletion_max_height, 0); - - styleset_common(sci); + styleset_common(sci, ft_id); } @@ -2164,17 +2166,14 @@ static void styleset_docbook(ScintillaObject *sci) } -static void styleset_none(ScintillaObject *sci) +static void styleset_default(ScintillaObject *sci, gint ft_id) { SSM(sci, SCI_SETLEXER, SCLEX_NULL, 0); /* we need to set STYLE_DEFAULT before we call SCI_STYLECLEARALL in styleset_common() */ set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_NONE, GCS_DEFAULT); - styleset_common(sci); - - SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) common_style_set.wordchars); - SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars); + styleset_common(sci, ft_id); } @@ -2897,8 +2896,6 @@ static void styleset_matlab(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_MATLAB; - styleset_common(sci); - apply_filetype_properties(sci, SCLEX_MATLAB, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_MATLAB].keywords[0]); @@ -3497,10 +3494,10 @@ static void styleset_ada(ScintillaObject *sci) /* Called by filetypes_load_config(). */ void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *configh) { - if (filetype_idx >= GEANY_MAX_BUILT_IN_FILETYPES) - return; /* not supported yet */ + if (!style_sets) + style_sets = g_new0(StyleSet, filetypes_array->len); - /* Clear old information if necessary - e.g. reloading config */ + /* Clear old information if necessary - e.g. when reloading config */ styleset_free(filetype_idx); /* All stylesets depend on filetypes.common */ @@ -3619,8 +3616,9 @@ void highlighting_set_styles(ScintillaObject *sci, gint filetype_idx) styleset_case(GEANY_FILETYPES_VHDL, styleset_vhdl); styleset_case(GEANY_FILETYPES_XML, styleset_xml); styleset_case(GEANY_FILETYPES_YAML, styleset_yaml); + case GEANY_FILETYPES_NONE: default: - styleset_case(GEANY_FILETYPES_NONE, styleset_none); + styleset_default(sci, filetype_idx); } } @@ -3635,7 +3633,7 @@ void highlighting_set_styles(ScintillaObject *sci, gint filetype_idx) * @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with ScintillaFuncs::send_message(). */ const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id) { - if (ft_id < 0 || ft_id > GEANY_MAX_BUILT_IN_FILETYPES) + if (ft_id < 0 || ft_id >= (gint)filetypes_array->len) return NULL; /* ensure filetype loaded */ diff --git a/src/main.c b/src/main.c index 4b7dbb04..c605ae3d 100644 --- a/src/main.c +++ b/src/main.c @@ -1088,7 +1088,6 @@ void main_quit() navqueue_free(); keybindings_free(); filetypes_save_commands(); - filetypes_free_types(); highlighting_free_styles(); templates_free_templates(); msgwin_finalize(); @@ -1103,6 +1102,7 @@ void main_quit() toolbar_finalize(); treeviews_finalize(); configuration_finalize(); + filetypes_free_types(); log_finalize(); tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace)); From 4c55a5506b26ffa75097ca3d45f49ec0a88555c3 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 14 Aug 2009 11:13:22 +0000 Subject: [PATCH 6/6] Rename new_style_array -> new_styleset. Rename styleset_free -> free_styleset. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@4081 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 ++ src/highlighting.c | 92 +++++++++++++++++++++++----------------------- 2 files changed, 49 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ada97d7..f92b4281 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ Fix setting wordchars for custom filetypes. Use style_sets array for custom filetypes too. Replace styleset_none() with styleset_default(). + * src/highlighting.c: + Rename new_style_array -> new_styleset. + Rename styleset_free -> free_styleset. 2009-08-12 Nick Treleaven diff --git a/src/highlighting.c b/src/highlighting.c index b832ad33..d32d2c7a 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -123,7 +123,7 @@ static GHashTable *named_style_hash = NULL; static GeanyLexerStyle gsd_default = {0x000000, 0xffffff, FALSE, FALSE}; -static void new_style_array(gint file_type_id, gint styling_count) +static void new_styleset(gint file_type_id, gint styling_count) { StyleSet *set = &style_sets[file_type_id]; @@ -132,7 +132,7 @@ static void new_style_array(gint file_type_id, gint styling_count) } -static void styleset_free(gint file_type_id) +static void free_styleset(gint file_type_id) { StyleSet *style_ptr; style_ptr = &style_sets[file_type_id]; @@ -435,7 +435,7 @@ void highlighting_free_styles() guint i; for (i = 0; i < filetypes_array->len; i++) - styleset_free(i); + free_styleset(i); if (named_style_hash) g_hash_table_destroy(named_style_hash); @@ -834,7 +834,7 @@ static void load_style_entries(GKeyFile *config, GKeyFile *config_home, gint fil } -/* call new_style_array(filetype_idx, >= 20) before using this. */ +/* call new_styleset(filetype_idx, >= 20) before using this. */ static void styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, gint filetype_idx) { @@ -898,7 +898,7 @@ static void styleset_c_like(ScintillaObject *sci, gint filetype_idx) static void styleset_c_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_C, 21); + new_styleset(GEANY_FILETYPES_C, 21); styleset_c_like_init(config, config_home, GEANY_FILETYPES_C); get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor", 1, 0, &style_sets[GEANY_FILETYPES_C].styling[20]); @@ -937,7 +937,7 @@ static void styleset_c(ScintillaObject *sci) static void styleset_cpp_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CPP, 21); + new_styleset(GEANY_FILETYPES_CPP, 21); styleset_c_like_init(config, config_home, GEANY_FILETYPES_CPP); get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor", 1, 0, &style_sets[GEANY_FILETYPES_CPP].styling[20]); @@ -977,7 +977,7 @@ static void styleset_cpp(ScintillaObject *sci) static void styleset_glsl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_GLSL, 21); + new_styleset(GEANY_FILETYPES_GLSL, 21); styleset_c_like_init(config, config_home, GEANY_FILETYPES_GLSL); get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor", 1, 0, &style_sets[GEANY_FILETYPES_GLSL].styling[20]); @@ -1027,7 +1027,7 @@ static void styleset_glsl(ScintillaObject *sci) static void styleset_cs_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CS, 21); + new_styleset(GEANY_FILETYPES_CS, 21); styleset_c_like_init(config, config_home, GEANY_FILETYPES_CS); get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor", 1, 0, &style_sets[GEANY_FILETYPES_CS].styling[20]); @@ -1069,7 +1069,7 @@ static void styleset_cs(ScintillaObject *sci) static void styleset_vala_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_VALA, 21); + new_styleset(GEANY_FILETYPES_VALA, 21); styleset_c_like_init(config, config_home, GEANY_FILETYPES_VALA); get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor", 1, 0, &style_sets[GEANY_FILETYPES_VALA].styling[20]); @@ -1126,7 +1126,7 @@ static void styleset_vala(ScintillaObject *sci) static void styleset_pascal_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PASCAL, 15); + new_styleset(GEANY_FILETYPES_PASCAL, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PASCAL].styling[0]); get_keyfile_hex(config, config_home, "identifier", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PASCAL].styling[1]); get_keyfile_hex(config, config_home, "comment", 0xd00000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PASCAL].styling[2]); @@ -1182,7 +1182,7 @@ static void styleset_pascal(ScintillaObject *sci) static void styleset_makefile_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_MAKE, 7); + new_styleset(GEANY_FILETYPES_MAKE, 7); get_keyfile_hex(config, config_home, "default", 0x00002f, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MAKE].styling[0]); get_keyfile_named_style(config, config_home, "comment", "comment", &style_sets[GEANY_FILETYPES_MAKE].styling[1]); get_keyfile_hex(config, config_home, "preprocessor", 0x007f7f, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MAKE].styling[2]); @@ -1214,7 +1214,7 @@ static void styleset_makefile(ScintillaObject *sci) static void styleset_diff_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_DIFF, 8); + new_styleset(GEANY_FILETYPES_DIFF, 8); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DIFF].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DIFF].styling[1]); get_keyfile_hex(config, config_home, "command", 0x7f7f00, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DIFF].styling[2]); @@ -1248,7 +1248,7 @@ static void styleset_diff(ScintillaObject *sci) static void styleset_latex_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_LATEX, 5); + new_styleset(GEANY_FILETYPES_LATEX, 5); get_keyfile_hex(config, config_home, "default", 0x00002f, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_LATEX].styling[0]); get_keyfile_hex(config, config_home, "command", 0xff0000, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_LATEX].styling[1]); get_keyfile_hex(config, config_home, "tag", 0x007f7f, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_LATEX].styling[2]); @@ -1318,7 +1318,7 @@ static void styleset_html(ScintillaObject *sci) static void styleset_markup_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_XML, 56); + new_styleset(GEANY_FILETYPES_XML, 56); get_keyfile_hex(config, config_home, "html_default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_XML].styling[0]); get_keyfile_hex(config, config_home, "html_tag", 0x000099, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_XML].styling[1]); get_keyfile_hex(config, config_home, "html_tagunknown", 0xff0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_XML].styling[2]); @@ -1548,7 +1548,7 @@ static void styleset_markup(ScintillaObject *sci, gboolean set_keywords) static void styleset_java_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_JAVA, 20); + new_styleset(GEANY_FILETYPES_JAVA, 20); styleset_c_like_init(config, config_home, GEANY_FILETYPES_JAVA); style_sets[GEANY_FILETYPES_JAVA].keywords = g_new(gchar*, 5); @@ -1583,7 +1583,7 @@ static void styleset_java(ScintillaObject *sci) static void styleset_perl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PERL, 35); + new_styleset(GEANY_FILETYPES_PERL, 35); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PERL].styling[0]); get_keyfile_hex(config, config_home, "error", 0xff0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PERL].styling[1]); get_keyfile_named_style(config, config_home, "commentline", "comment", &style_sets[GEANY_FILETYPES_PERL].styling[2]); @@ -1705,7 +1705,7 @@ static void styleset_perl(ScintillaObject *sci) static void styleset_python_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PYTHON, 16); + new_styleset(GEANY_FILETYPES_PYTHON, 16); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PYTHON].styling[0]); get_keyfile_hex(config, config_home, "commentline", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PYTHON].styling[1]); get_keyfile_hex(config, config_home, "number", 0x400080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PYTHON].styling[2]); @@ -1764,7 +1764,7 @@ static void styleset_python(ScintillaObject *sci) static void styleset_cmake_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CMAKE, 15); + new_styleset(GEANY_FILETYPES_CMAKE, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CMAKE].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CMAKE].styling[1]); get_keyfile_hex(config, config_home, "stringdq", 0xff901e, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CMAKE].styling[2]); @@ -1820,7 +1820,7 @@ static void styleset_cmake(ScintillaObject *sci) static void styleset_r_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_R, 12); + new_styleset(GEANY_FILETYPES_R, 12); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_R].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_R].styling[1]); @@ -1871,7 +1871,7 @@ static void styleset_r(ScintillaObject *sci) static void styleset_ruby_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_RUBY, 35); + new_styleset(GEANY_FILETYPES_RUBY, 35); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_RUBY].styling[0]); get_keyfile_named_style(config, config_home, "commentline", "comment", &style_sets[GEANY_FILETYPES_RUBY].styling[1]); get_keyfile_hex(config, config_home, "number", 0x400080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_RUBY].styling[2]); @@ -1963,7 +1963,7 @@ static void styleset_ruby(ScintillaObject *sci) static void styleset_sh_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_SH, 14); + new_styleset(GEANY_FILETYPES_SH, 14); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_SH].styling[0]); get_keyfile_named_style(config, config_home, "commentline", "comment", &style_sets[GEANY_FILETYPES_SH].styling[1]); get_keyfile_hex(config, config_home, "number", 0x007f00, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_SH].styling[2]); @@ -2024,7 +2024,7 @@ static void styleset_xml(ScintillaObject *sci) static void styleset_docbook_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_DOCBOOK, 29); + new_styleset(GEANY_FILETYPES_DOCBOOK, 29); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DOCBOOK].styling[0]); get_keyfile_hex(config, config_home, "tag", 0x000099, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DOCBOOK].styling[1]); get_keyfile_hex(config, config_home, "tagunknown", 0xff0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_DOCBOOK].styling[2]); @@ -2179,7 +2179,7 @@ static void styleset_default(ScintillaObject *sci, gint ft_id) static void styleset_css_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CSS, 22); + new_styleset(GEANY_FILETYPES_CSS, 22); get_keyfile_hex(config, config_home, "default", 0x003399, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CSS].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CSS].styling[1]); get_keyfile_hex(config, config_home, "tag", 0x2166a4, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_CSS].styling[2]); @@ -2256,7 +2256,7 @@ static void styleset_css(ScintillaObject *sci) static void styleset_nsis_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_NSIS, 19); + new_styleset(GEANY_FILETYPES_NSIS, 19); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_NSIS].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_NSIS].styling[1]); get_keyfile_hex(config, config_home, "stringdq", 0xff901e, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_NSIS].styling[2]); @@ -2325,7 +2325,7 @@ static void styleset_nsis(ScintillaObject *sci) static void styleset_po_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PO, 9); + new_styleset(GEANY_FILETYPES_PO, 9); get_keyfile_hex(config, config_home, "default", 0x7f0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PO].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_PO].styling[1]); get_keyfile_hex(config, config_home, "msgid", 0x00007f, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_PO].styling[2]); @@ -2361,7 +2361,7 @@ static void styleset_po(ScintillaObject *sci) static void styleset_conf_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CONF, 6); + new_styleset(GEANY_FILETYPES_CONF, 6); get_keyfile_hex(config, config_home, "default", 0x7f0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CONF].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CONF].styling[1]); get_keyfile_hex(config, config_home, "section", 0x000090, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_CONF].styling[2]); @@ -2393,7 +2393,7 @@ static void styleset_conf(ScintillaObject *sci) static void styleset_asm_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_ASM, 15); + new_styleset(GEANY_FILETYPES_ASM, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_ASM].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_ASM].styling[1]); get_keyfile_hex(config, config_home, "number", 0x007f00, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_ASM].styling[2]); @@ -2451,7 +2451,7 @@ static void styleset_asm(ScintillaObject *sci) static void styleset_f77_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_F77, 15); + new_styleset(GEANY_FILETYPES_F77, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_F77].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_F77].styling[1]); get_keyfile_hex(config, config_home, "number", 0x007f00, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_F77].styling[2]); @@ -2507,7 +2507,7 @@ static void styleset_f77(ScintillaObject *sci) static void styleset_fortran_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_FORTRAN, 15); + new_styleset(GEANY_FILETYPES_FORTRAN, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_FORTRAN].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_FORTRAN].styling[1]); get_keyfile_hex(config, config_home, "number", 0x007f00, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_FORTRAN].styling[2]); @@ -2563,7 +2563,7 @@ static void styleset_fortran(ScintillaObject *sci) static void styleset_sql_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_SQL, 15); + new_styleset(GEANY_FILETYPES_SQL, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_SQL].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_SQL].styling[1]); get_keyfile_hex(config, config_home, "commentline", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_SQL].styling[2]); @@ -2642,7 +2642,7 @@ static void styleset_sql(ScintillaObject *sci) static void styleset_markdown_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_MARKDOWN, 17); + new_styleset(GEANY_FILETYPES_MARKDOWN, 17); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MARKDOWN].styling[0]); get_keyfile_hex(config, config_home, "strong", 0xff0000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MARKDOWN].styling[1]); @@ -2698,7 +2698,7 @@ static void styleset_markdown(ScintillaObject *sci) static void styleset_haskell_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_HASKELL, 17); + new_styleset(GEANY_FILETYPES_HASKELL, 17); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_HASKELL].styling[0]); get_keyfile_hex(config, config_home, "commentline", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_HASKELL].styling[1]); @@ -2756,7 +2756,7 @@ static void styleset_haskell(ScintillaObject *sci) static void styleset_caml_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_CAML, 14); + new_styleset(GEANY_FILETYPES_CAML, 14); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CAML].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_CAML].styling[1]); @@ -2813,7 +2813,7 @@ static void styleset_caml(ScintillaObject *sci) static void styleset_tcl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_TCL, 16); + new_styleset(GEANY_FILETYPES_TCL, 16); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_TCL].styling[0]); get_keyfile_named_style(config, config_home, "comment", "comment", &style_sets[GEANY_FILETYPES_TCL].styling[1]); get_keyfile_named_style(config, config_home, "commentline", "comment", &style_sets[GEANY_FILETYPES_TCL].styling[2]); @@ -2875,7 +2875,7 @@ static void styleset_tcl(ScintillaObject *sci) static void styleset_matlab_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_MATLAB, 9); + new_styleset(GEANY_FILETYPES_MATLAB, 9); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MATLAB].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_MATLAB].styling[1]); get_keyfile_hex(config, config_home, "command", 0x111199, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_MATLAB].styling[2]); @@ -2915,7 +2915,7 @@ static void styleset_matlab(ScintillaObject *sci) static void styleset_d_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_D, 18); + new_styleset(GEANY_FILETYPES_D, 18); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_D].styling[0]); get_keyfile_hex(config, config_home, "comment", 0xd00000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_D].styling[1]); @@ -2996,7 +2996,7 @@ static void styleset_d(ScintillaObject *sci) static void styleset_ferite_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_FERITE, 20); + new_styleset(GEANY_FILETYPES_FERITE, 20); styleset_c_like_init(config, config_home, GEANY_FILETYPES_FERITE); style_sets[GEANY_FILETYPES_FERITE].keywords = g_new(gchar*, 4); @@ -3023,7 +3023,7 @@ static void styleset_ferite(ScintillaObject *sci) static void styleset_vhdl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_VHDL, 15); + new_styleset(GEANY_FILETYPES_VHDL, 15); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_VHDL].styling[0]); get_keyfile_hex(config, config_home, "comment", 0xd00000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_VHDL].styling[1]); @@ -3109,7 +3109,7 @@ static void styleset_vhdl(ScintillaObject *sci) static void styleset_yaml_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_YAML, 10); + new_styleset(GEANY_FILETYPES_YAML, 10); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_YAML].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_YAML].styling[1]); @@ -3152,7 +3152,7 @@ static void styleset_yaml(ScintillaObject *sci) static void styleset_js_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_JS, 20); + new_styleset(GEANY_FILETYPES_JS, 20); styleset_c_like_init(config, config_home, GEANY_FILETYPES_JS); style_sets[GEANY_FILETYPES_JS].keywords = g_new(gchar*, 2); @@ -3188,7 +3188,7 @@ static void styleset_js(ScintillaObject *sci) static void styleset_lua_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_LUA, 20); + new_styleset(GEANY_FILETYPES_LUA, 20); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_LUA].styling[0]); get_keyfile_hex(config, config_home, "comment", 0xd00000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_LUA].styling[1]); @@ -3292,7 +3292,7 @@ static void styleset_lua(ScintillaObject *sci) static void styleset_basic_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_BASIC, 19); + new_styleset(GEANY_FILETYPES_BASIC, 19); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_BASIC].styling[0]); get_keyfile_hex(config, config_home, "comment", 0x808080, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_BASIC].styling[1]); @@ -3371,7 +3371,7 @@ static void styleset_basic(ScintillaObject *sci) static void styleset_actionscript_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_AS, 20); + new_styleset(GEANY_FILETYPES_AS, 20); styleset_c_like_init(config, config_home, GEANY_FILETYPES_AS); style_sets[GEANY_FILETYPES_AS].keywords = g_new(gchar *, 4); @@ -3397,7 +3397,7 @@ static void styleset_actionscript(ScintillaObject *sci) static void styleset_haxe_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_HAXE, 20); + new_styleset(GEANY_FILETYPES_HAXE, 20); styleset_c_like_init(config, config_home, GEANY_FILETYPES_HAXE); style_sets[GEANY_FILETYPES_HAXE].keywords = g_new(gchar*, 4); @@ -3440,7 +3440,7 @@ static void styleset_haxe(ScintillaObject *sci) static void styleset_ada_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_ADA, 12); + new_styleset(GEANY_FILETYPES_ADA, 12); get_keyfile_hex(config, config_home, "default", 0x000000, 0xffffff, FALSE, &style_sets[GEANY_FILETYPES_ADA].styling[0]); get_keyfile_hex(config, config_home, "word", 0x00007f, 0xffffff, TRUE, &style_sets[GEANY_FILETYPES_ADA].styling[1]); @@ -3498,7 +3498,7 @@ void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *con style_sets = g_new0(StyleSet, filetypes_array->len); /* Clear old information if necessary - e.g. when reloading config */ - styleset_free(filetype_idx); + free_styleset(filetype_idx); /* All stylesets depend on filetypes.common */ if (filetype_idx != GEANY_FILETYPES_NONE)