diff --git a/ChangeLog b/ChangeLog index c3ab74cf..c87d5bd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ Parse pointers in function return type for C-like files. Show scope in calltips. Made tm_tag_destroy() static. + * src/treeviews.c: + Fix for C89 compatibility. + * src/templates.c, src/build.c, src/templates.h, src/build.h, + src/highlighting.c, src/filetypes.h: + Added filetype_id typedef so that GEANY_FILETYPES_* can be shown + when debugging (also renamed some filetype_id variable names). 2006-12-31 Enrico Tröger diff --git a/src/build.c b/src/build.c index 0336198d..73f5f5d4 100644 --- a/src/build.c +++ b/src/build.c @@ -1286,22 +1286,22 @@ static void set_stop_button(gboolean stop) /* Creates the relevant build menu if necessary. - * If filetype_id is -1, the current filetype is used, or GEANY_FILETYPES_ALL */ -BuildMenuItems *build_get_menu_items(gint filetype_id) + * If filetype_idx is -1, the current filetype is used, or GEANY_FILETYPES_ALL */ +BuildMenuItems *build_get_menu_items(gint filetype_idx) { BuildMenuItems *items; - if (filetype_id == -1) + if (filetype_idx == -1) { gint idx = document_get_cur_idx(); filetype *ft = NULL; if (DOC_IDX_VALID(idx)) ft = doc_list[idx].file_type; - filetype_id = FILETYPE_ID(ft); + filetype_idx = FILETYPE_ID(ft); } - if (filetype_id == GEANY_FILETYPES_LATEX) + if (filetype_idx == GEANY_FILETYPES_LATEX) { items = &latex_menu_items; if (items->menu == NULL) diff --git a/src/build.h b/src/build.h index edd634c4..d06f172b 100644 --- a/src/build.h +++ b/src/build.h @@ -78,7 +78,7 @@ gboolean build_parse_make_dir(gchar *string, gchar **prefix); void build_menu_update(gint idx); -BuildMenuItems *build_get_menu_items(gint filetype_id); +BuildMenuItems *build_get_menu_items(gint filetype_idx); void diff --git a/src/filetypes.h b/src/filetypes.h index 895e36df..92d50140 100644 --- a/src/filetypes.h +++ b/src/filetypes.h @@ -32,7 +32,7 @@ #include "ScintillaWidget.h" -enum +typedef enum { GEANY_FILETYPES_C = 0, GEANY_FILETYPES_CPP, @@ -62,7 +62,7 @@ enum GEANY_FILETYPES_CONF, GEANY_FILETYPES_ALL, // must be last filetype GEANY_MAX_FILE_TYPES -}; +} filetype_id; // Safe wrapper to get the id field of a possibly NULL filetype pointer. #define FILETYPE_ID(filetype_ptr) \ @@ -87,7 +87,7 @@ struct build_programs typedef struct filetype { - guint id; + filetype_id id; guint uid; // unique id as reference for saved filetype in config file GtkWidget *item; // holds a pointer to the menu item for this filetypes langType lang; // represents the langType of tagmanager(see the table diff --git a/src/highlighting.c b/src/highlighting.c index f478fd8a..0651e6f9 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -618,30 +618,30 @@ styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, gint filetype_idx) } -static void styleset_c_like(ScintillaObject *sci, gint filetype_id) +static void styleset_c_like(ScintillaObject *sci, gint filetype_idx) { - set_sci_style(sci, STYLE_DEFAULT, filetype_id, 0); - set_sci_style(sci, SCE_C_DEFAULT, filetype_id, 0); - set_sci_style(sci, SCE_C_COMMENT, filetype_id, 1); - set_sci_style(sci, SCE_C_COMMENTLINE, filetype_id, 2); - set_sci_style(sci, SCE_C_COMMENTDOC, filetype_id, 3); - set_sci_style(sci, SCE_C_NUMBER, filetype_id, 4); - set_sci_style(sci, SCE_C_WORD, filetype_id, 5); - set_sci_style(sci, SCE_C_WORD2, filetype_id, 6); - set_sci_style(sci, SCE_C_STRING, filetype_id, 7); - set_sci_style(sci, SCE_C_CHARACTER, filetype_id, 8); - set_sci_style(sci, SCE_C_UUID, filetype_id, 9); - set_sci_style(sci, SCE_C_PREPROCESSOR, filetype_id, 10); - set_sci_style(sci, SCE_C_OPERATOR, filetype_id, 11); - set_sci_style(sci, SCE_C_IDENTIFIER, filetype_id, 12); - set_sci_style(sci, SCE_C_STRINGEOL, filetype_id, 13); - set_sci_style(sci, SCE_C_VERBATIM, filetype_id, 14); - set_sci_style(sci, SCE_C_REGEX, filetype_id, 15); - set_sci_style(sci, SCE_C_COMMENTLINEDOC, filetype_id, 16); - set_sci_style(sci, SCE_C_COMMENTDOCKEYWORD, filetype_id, 17); - set_sci_style(sci, SCE_C_COMMENTDOCKEYWORDERROR, filetype_id, 18); + set_sci_style(sci, STYLE_DEFAULT, filetype_idx, 0); + set_sci_style(sci, SCE_C_DEFAULT, filetype_idx, 0); + set_sci_style(sci, SCE_C_COMMENT, filetype_idx, 1); + set_sci_style(sci, SCE_C_COMMENTLINE, filetype_idx, 2); + set_sci_style(sci, SCE_C_COMMENTDOC, filetype_idx, 3); + set_sci_style(sci, SCE_C_NUMBER, filetype_idx, 4); + set_sci_style(sci, SCE_C_WORD, filetype_idx, 5); + set_sci_style(sci, SCE_C_WORD2, filetype_idx, 6); + set_sci_style(sci, SCE_C_STRING, filetype_idx, 7); + set_sci_style(sci, SCE_C_CHARACTER, filetype_idx, 8); + set_sci_style(sci, SCE_C_UUID, filetype_idx, 9); + set_sci_style(sci, SCE_C_PREPROCESSOR, filetype_idx, 10); + set_sci_style(sci, SCE_C_OPERATOR, filetype_idx, 11); + set_sci_style(sci, SCE_C_IDENTIFIER, filetype_idx, 12); + set_sci_style(sci, SCE_C_STRINGEOL, filetype_idx, 13); + set_sci_style(sci, SCE_C_VERBATIM, filetype_idx, 14); + set_sci_style(sci, SCE_C_REGEX, filetype_idx, 15); + set_sci_style(sci, SCE_C_COMMENTLINEDOC, filetype_idx, 16); + set_sci_style(sci, SCE_C_COMMENTDOCKEYWORD, filetype_idx, 17); + set_sci_style(sci, SCE_C_COMMENTDOCKEYWORDERROR, filetype_idx, 18); // is used for local structs and typedefs - set_sci_style(sci, SCE_C_GLOBALCLASS, filetype_id, 19); + set_sci_style(sci, SCE_C_GLOBALCLASS, filetype_idx, 19); } diff --git a/src/templates.c b/src/templates.c index f218f177..9df2b6d7 100644 --- a/src/templates.c +++ b/src/templates.c @@ -412,10 +412,10 @@ void templates_init(void) /* double_comment is a hack for PHP/HTML for whether to first add C style commenting. * In future we could probably remove the need for this by making most templates * automatically commented (so template files are not commented) */ -static gchar *make_comment_block(const gchar *comment_text, gint filetype_id, +static gchar *make_comment_block(const gchar *comment_text, gint filetype_idx, gboolean double_comment) { - switch (filetype_id) + switch (filetype_idx) { case GEANY_FILETYPES_ALL: return g_strdup(comment_text); // no need to add to the text @@ -426,7 +426,7 @@ static gchar *make_comment_block(const gchar *comment_text, gint filetype_id, gchar *tmp = (double_comment) ? make_comment_block(comment_text, GEANY_FILETYPES_C, FALSE) : g_strdup(comment_text); - gchar *block = (filetype_id == GEANY_FILETYPES_PHP) ? + gchar *block = (filetype_idx == GEANY_FILETYPES_PHP) ? g_strconcat("\n", NULL) : g_strconcat("\n", NULL); g_free(tmp); @@ -449,11 +449,11 @@ static gchar *make_comment_block(const gchar *comment_text, gint filetype_id, } -gchar *templates_get_template_gpl(gint filetype_id) +gchar *templates_get_template_gpl(gint filetype_idx) { const gchar *text; - switch (filetype_id) + switch (filetype_idx) { case GEANY_FILETYPES_PYTHON: case GEANY_FILETYPES_RUBY: @@ -474,7 +474,7 @@ gchar *templates_get_template_gpl(gint filetype_id) text = templates[GEANY_TEMPLATE_GPL]; break; } - return make_comment_block(text, filetype_id, TRUE); + return make_comment_block(text, filetype_idx, TRUE); } diff --git a/src/templates.h b/src/templates.h index e40f766f..4b1dab9c 100644 --- a/src/templates.h +++ b/src/templates.h @@ -38,7 +38,7 @@ gchar *templates_get_template_generic(gint template); gchar *templates_get_template_function(gint template, const gchar *func_name); -gchar *templates_get_template_gpl(gint filetype_id); +gchar *templates_get_template_gpl(gint filetype_idx); void templates_free_templates(void);