Added filetype_id typedef so that GEANY_FILETYPES_* can be shown

when debugging (also renamed some filetype_id variable names).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1155 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-01-03 16:21:44 +00:00
parent fe39c70821
commit 7170df59b8
7 changed files with 44 additions and 38 deletions

View File

@ -5,6 +5,12 @@
Parse pointers in function return type for C-like files. Parse pointers in function return type for C-like files.
Show scope in calltips. Show scope in calltips.
Made tm_tag_destroy() static. 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 <enrico.troeger@uvena.de> 2006-12-31 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -1286,22 +1286,22 @@ static void set_stop_button(gboolean stop)
/* Creates the relevant build menu if necessary. /* Creates the relevant build menu if necessary.
* If filetype_id is -1, the current filetype is used, or GEANY_FILETYPES_ALL */ * If filetype_idx is -1, the current filetype is used, or GEANY_FILETYPES_ALL */
BuildMenuItems *build_get_menu_items(gint filetype_id) BuildMenuItems *build_get_menu_items(gint filetype_idx)
{ {
BuildMenuItems *items; BuildMenuItems *items;
if (filetype_id == -1) if (filetype_idx == -1)
{ {
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
filetype *ft = NULL; filetype *ft = NULL;
if (DOC_IDX_VALID(idx)) if (DOC_IDX_VALID(idx))
ft = doc_list[idx].file_type; 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; items = &latex_menu_items;
if (items->menu == NULL) if (items->menu == NULL)

View File

@ -78,7 +78,7 @@ gboolean build_parse_make_dir(gchar *string, gchar **prefix);
void build_menu_update(gint idx); void build_menu_update(gint idx);
BuildMenuItems *build_get_menu_items(gint filetype_id); BuildMenuItems *build_get_menu_items(gint filetype_idx);
void void

View File

@ -32,7 +32,7 @@
#include "ScintillaWidget.h" #include "ScintillaWidget.h"
enum typedef enum
{ {
GEANY_FILETYPES_C = 0, GEANY_FILETYPES_C = 0,
GEANY_FILETYPES_CPP, GEANY_FILETYPES_CPP,
@ -62,7 +62,7 @@ enum
GEANY_FILETYPES_CONF, GEANY_FILETYPES_CONF,
GEANY_FILETYPES_ALL, // must be last filetype GEANY_FILETYPES_ALL, // must be last filetype
GEANY_MAX_FILE_TYPES GEANY_MAX_FILE_TYPES
}; } filetype_id;
// Safe wrapper to get the id field of a possibly NULL filetype pointer. // Safe wrapper to get the id field of a possibly NULL filetype pointer.
#define FILETYPE_ID(filetype_ptr) \ #define FILETYPE_ID(filetype_ptr) \
@ -87,7 +87,7 @@ struct build_programs
typedef struct filetype typedef struct filetype
{ {
guint id; filetype_id id;
guint uid; // unique id as reference for saved filetype in config file guint uid; // unique id as reference for saved filetype in config file
GtkWidget *item; // holds a pointer to the menu item for this filetypes GtkWidget *item; // holds a pointer to the menu item for this filetypes
langType lang; // represents the langType of tagmanager(see the table langType lang; // represents the langType of tagmanager(see the table

View File

@ -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, STYLE_DEFAULT, filetype_idx, 0);
set_sci_style(sci, SCE_C_DEFAULT, filetype_id, 0); set_sci_style(sci, SCE_C_DEFAULT, filetype_idx, 0);
set_sci_style(sci, SCE_C_COMMENT, filetype_id, 1); set_sci_style(sci, SCE_C_COMMENT, filetype_idx, 1);
set_sci_style(sci, SCE_C_COMMENTLINE, filetype_id, 2); set_sci_style(sci, SCE_C_COMMENTLINE, filetype_idx, 2);
set_sci_style(sci, SCE_C_COMMENTDOC, filetype_id, 3); set_sci_style(sci, SCE_C_COMMENTDOC, filetype_idx, 3);
set_sci_style(sci, SCE_C_NUMBER, filetype_id, 4); set_sci_style(sci, SCE_C_NUMBER, filetype_idx, 4);
set_sci_style(sci, SCE_C_WORD, filetype_id, 5); set_sci_style(sci, SCE_C_WORD, filetype_idx, 5);
set_sci_style(sci, SCE_C_WORD2, filetype_id, 6); set_sci_style(sci, SCE_C_WORD2, filetype_idx, 6);
set_sci_style(sci, SCE_C_STRING, filetype_id, 7); set_sci_style(sci, SCE_C_STRING, filetype_idx, 7);
set_sci_style(sci, SCE_C_CHARACTER, filetype_id, 8); set_sci_style(sci, SCE_C_CHARACTER, filetype_idx, 8);
set_sci_style(sci, SCE_C_UUID, filetype_id, 9); set_sci_style(sci, SCE_C_UUID, filetype_idx, 9);
set_sci_style(sci, SCE_C_PREPROCESSOR, filetype_id, 10); set_sci_style(sci, SCE_C_PREPROCESSOR, filetype_idx, 10);
set_sci_style(sci, SCE_C_OPERATOR, filetype_id, 11); set_sci_style(sci, SCE_C_OPERATOR, filetype_idx, 11);
set_sci_style(sci, SCE_C_IDENTIFIER, filetype_id, 12); set_sci_style(sci, SCE_C_IDENTIFIER, filetype_idx, 12);
set_sci_style(sci, SCE_C_STRINGEOL, filetype_id, 13); set_sci_style(sci, SCE_C_STRINGEOL, filetype_idx, 13);
set_sci_style(sci, SCE_C_VERBATIM, filetype_id, 14); set_sci_style(sci, SCE_C_VERBATIM, filetype_idx, 14);
set_sci_style(sci, SCE_C_REGEX, filetype_id, 15); set_sci_style(sci, SCE_C_REGEX, filetype_idx, 15);
set_sci_style(sci, SCE_C_COMMENTLINEDOC, filetype_id, 16); set_sci_style(sci, SCE_C_COMMENTLINEDOC, filetype_idx, 16);
set_sci_style(sci, SCE_C_COMMENTDOCKEYWORD, filetype_id, 17); set_sci_style(sci, SCE_C_COMMENTDOCKEYWORD, filetype_idx, 17);
set_sci_style(sci, SCE_C_COMMENTDOCKEYWORDERROR, filetype_id, 18); set_sci_style(sci, SCE_C_COMMENTDOCKEYWORDERROR, filetype_idx, 18);
// is used for local structs and typedefs // 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);
} }

View File

@ -412,10 +412,10 @@ void templates_init(void)
/* double_comment is a hack for PHP/HTML for whether to first add C style commenting. /* 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 * In future we could probably remove the need for this by making most templates
* automatically commented (so template files are not commented) */ * 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) gboolean double_comment)
{ {
switch (filetype_id) switch (filetype_idx)
{ {
case GEANY_FILETYPES_ALL: case GEANY_FILETYPES_ALL:
return g_strdup(comment_text); // no need to add to the text 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) ? gchar *tmp = (double_comment) ?
make_comment_block(comment_text, GEANY_FILETYPES_C, FALSE) : make_comment_block(comment_text, GEANY_FILETYPES_C, FALSE) :
g_strdup(comment_text); g_strdup(comment_text);
gchar *block = (filetype_id == GEANY_FILETYPES_PHP) ? gchar *block = (filetype_idx == GEANY_FILETYPES_PHP) ?
g_strconcat("<?php\n", tmp, "?>\n", NULL) : g_strconcat("<?php\n", tmp, "?>\n", NULL) :
g_strconcat("<!--\n", tmp, "-->\n", NULL); g_strconcat("<!--\n", tmp, "-->\n", NULL);
g_free(tmp); 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; const gchar *text;
switch (filetype_id) switch (filetype_idx)
{ {
case GEANY_FILETYPES_PYTHON: case GEANY_FILETYPES_PYTHON:
case GEANY_FILETYPES_RUBY: case GEANY_FILETYPES_RUBY:
@ -474,7 +474,7 @@ gchar *templates_get_template_gpl(gint filetype_id)
text = templates[GEANY_TEMPLATE_GPL]; text = templates[GEANY_TEMPLATE_GPL];
break; break;
} }
return make_comment_block(text, filetype_id, TRUE); return make_comment_block(text, filetype_idx, TRUE);
} }

View File

@ -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_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); void templates_free_templates(void);