diff --git a/src/callbacks.c b/src/callbacks.c index f6c40144..653d3a50 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -2284,7 +2284,7 @@ on_comments_function_activate (GtkMenuItem *menuitem, { line = utils_get_current_tag(idx, &cur_tag); // utils_get_current_tag returns -1 on failure, so sci_get_position_from_line - // returns the current position, soit should be safe + // returns the current position, so it should be safe pos = sci_get_position_from_line(doc_list[idx].sci, line - 1); } @@ -2295,14 +2295,28 @@ on_comments_function_activate (GtkMenuItem *menuitem, cur_tag = g_strdup(_("unknown")); } - if (doc_list[idx].file_type->id == GEANY_FILETYPES_PASCAL) + switch (doc_list[idx].file_type->id) { - text = templates_get_template_function(GEANY_TEMPLATE_FUNCTION_PASCAL, cur_tag); - } - else - { - text = templates_get_template_function(GEANY_TEMPLATE_FUNCTION, cur_tag); + case GEANY_FILETYPES_PASCAL: + { + text = templates_get_template_function(GEANY_TEMPLATE_FUNCTION_PASCAL, cur_tag); + break; + } + case GEANY_FILETYPES_PYTHON: + case GEANY_FILETYPES_RUBY: + case GEANY_FILETYPES_SH: + case GEANY_FILETYPES_MAKE: + case GEANY_FILETYPES_PERL: + { + text = templates_get_template_function(GEANY_TEMPLATE_FUNCTION_ROUTE, cur_tag); + break; + } + default: + { + text = templates_get_template_function(GEANY_TEMPLATE_FUNCTION, cur_tag); + } } + sci_insert_text(doc_list[idx].sci, pos, text); g_free(cur_tag); g_free(text); @@ -2316,14 +2330,28 @@ on_comments_multiline_activate (GtkMenuItem *menuitem, gint idx = document_get_cur_idx(); gchar *text; - if (doc_list[idx].file_type->id == GEANY_FILETYPES_PASCAL) + switch (doc_list[idx].file_type->id) { - text = templates_get_template_generic(GEANY_TEMPLATE_MULTILINE_PASCAL); - } - else - { - text = templates_get_template_generic(GEANY_TEMPLATE_MULTILINE); + case GEANY_FILETYPES_PASCAL: + { + text = templates_get_template_generic(GEANY_TEMPLATE_MULTILINE_PASCAL); + break; + } + case GEANY_FILETYPES_PYTHON: + case GEANY_FILETYPES_RUBY: + case GEANY_FILETYPES_SH: + case GEANY_FILETYPES_MAKE: + case GEANY_FILETYPES_PERL: + { + text = templates_get_template_generic(GEANY_TEMPLATE_MULTILINE_ROUTE); + break; + } + default: + { + text = templates_get_template_generic(GEANY_TEMPLATE_MULTILINE); + } } + sci_insert_text(doc_list[idx].sci, -1, text); g_free(text); } @@ -2336,14 +2364,28 @@ on_comments_gpl_activate (GtkMenuItem *menuitem, gint idx = document_get_cur_idx(); gchar *text; - if (doc_list[idx].file_type->id == GEANY_FILETYPES_PASCAL) + switch (doc_list[idx].file_type->id) { - text = templates_get_template_gpl(GEANY_TEMPLATE_GPL_PASCAL); - } - else - { - text = templates_get_template_gpl(GEANY_TEMPLATE_GPL); + case GEANY_FILETYPES_PASCAL: + { + text = templates_get_template_gpl(GEANY_TEMPLATE_GPL_PASCAL); + break; + } + case GEANY_FILETYPES_PYTHON: + case GEANY_FILETYPES_RUBY: + case GEANY_FILETYPES_SH: + case GEANY_FILETYPES_MAKE: + case GEANY_FILETYPES_PERL: + { + text = templates_get_template_gpl(GEANY_TEMPLATE_GPL_ROUTE); + break; + } + default: + { + text = templates_get_template_gpl(GEANY_TEMPLATE_GPL); + } } + sci_insert_text(doc_list[idx].sci, -1, text); g_free(text); } @@ -2375,14 +2417,28 @@ on_comments_fileheader_activate (GtkMenuItem *menuitem, gint idx = document_get_cur_idx(); gchar *text; - if (doc_list[idx].file_type->id == GEANY_FILETYPES_PASCAL) + switch (doc_list[idx].file_type->id) { - text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_PASCAL, NULL, idx); - } - else - { - text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER, NULL, idx); + case GEANY_FILETYPES_PASCAL: + { + text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_PASCAL, NULL, idx); + break; + } + case GEANY_FILETYPES_PYTHON: + case GEANY_FILETYPES_RUBY: + case GEANY_FILETYPES_SH: + case GEANY_FILETYPES_MAKE: + case GEANY_FILETYPES_PERL: + { + text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_ROUTE, NULL, idx); + break; + } + default: + { + text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER, NULL, idx); + } } + sci_insert_text(doc_list[idx].sci, 0, text); sci_goto_pos(doc_list[idx].sci, 0, FALSE); g_free(text); diff --git a/src/document.c b/src/document.c index e626fb97..2c4daa96 100644 --- a/src/document.c +++ b/src/document.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -908,14 +908,21 @@ void document_update_tag_list(gint idx) g_free(locale_filename); if (! doc_list[idx].tm_file) return; tm_workspace_add_object(doc_list[idx].tm_file); + /// TODO seems to be useless, but I'm not sure // parse the file after setting the filetype - TM_SOURCE_FILE(doc_list[idx].tm_file)->lang = getNamedLanguage((doc_list[idx].file_type)->name); - tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE); + //TM_SOURCE_FILE(doc_list[idx].tm_file)->lang = getNamedLanguage((doc_list[idx].file_type)->name); + //tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE); utils_update_tag_list(idx, TRUE); } else { + gint len = sci_get_length(doc_list[idx].sci) + 1; + gchar *buf = (gchar*) g_malloc(len); + + sci_get_text(doc_list[idx].sci, len, buf); + if (tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE)) + //if (tm_source_file_buffer_update(doc_list[idx].tm_file, buf, len, TRUE)) { utils_update_tag_list(idx, TRUE); } @@ -999,8 +1006,8 @@ gchar *document_get_eol_mode(gint idx) gchar *document_prepare_template(filetype *ft) { gchar *gpl_notice = NULL; - gchar *template; - gchar *ft_template; + gchar *template = NULL; + gchar *ft_template = NULL; if (ft != NULL) { @@ -1020,6 +1027,16 @@ gchar *document_prepare_template(filetype *ft) GEANY_TEMPLATE_FILEHEADER_PASCAL, ft->extension, -1); break; } + case GEANY_FILETYPES_PYTHON: + case GEANY_FILETYPES_RUBY: + case GEANY_FILETYPES_SH: + case GEANY_FILETYPES_MAKE: + case GEANY_FILETYPES_PERL: + { + gpl_notice = templates_get_template_fileheader( + GEANY_TEMPLATE_FILEHEADER_ROUTE, ft->extension, -1); + break; + } default: { // -> C, C++, Java, ... gpl_notice = templates_get_template_fileheader( diff --git a/src/filetypes.c b/src/filetypes.c index 0974c5a7..514400fe 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -275,7 +275,7 @@ void filetypes_init_types(void) filetypes[GEANY_FILETYPES_CSS] = g_new0(filetype, 1); filetypes[GEANY_FILETYPES_CSS]->id = GEANY_FILETYPES_CSS; filetypes[GEANY_FILETYPES_CSS]->name = g_strdup("CSS"); - filetypes[GEANY_FILETYPES_CSS]->has_tags = FALSE; + filetypes[GEANY_FILETYPES_CSS]->has_tags = TRUE; filetypes[GEANY_FILETYPES_CSS]->title = g_strdup(_("Cascading StyleSheet")); filetypes[GEANY_FILETYPES_CSS]->extension = g_strdup("css"); filetypes[GEANY_FILETYPES_CSS]->pattern = g_new0(gchar*, 2); @@ -371,6 +371,24 @@ void filetypes_init_types(void) filetypes_init_build_programs(filetypes[GEANY_FILETYPES_OMS]); filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_OMS]->title, filetypes[GEANY_FILETYPES_OMS]); +#define RUBY + filetypes[GEANY_FILETYPES_RUBY] = g_new0(filetype, 1); + filetypes[GEANY_FILETYPES_RUBY]->id = GEANY_FILETYPES_RUBY; + filetypes[GEANY_FILETYPES_RUBY]->name = g_strdup("Ruby"); + filetypes[GEANY_FILETYPES_RUBY]->has_tags = TRUE; + filetypes[GEANY_FILETYPES_RUBY]->title = g_strdup(_("Ruby source file")); + filetypes[GEANY_FILETYPES_RUBY]->extension = g_strdup("rb"); + filetypes[GEANY_FILETYPES_RUBY]->pattern = g_new0(gchar*, 3); + filetypes[GEANY_FILETYPES_RUBY]->pattern[0] = g_strdup("*.rb"); + filetypes[GEANY_FILETYPES_RUBY]->pattern[1] = g_strdup("*.rhtml"); + filetypes[GEANY_FILETYPES_RUBY]->pattern[2] = NULL; + filetypes[GEANY_FILETYPES_RUBY]->style_func_ptr = styleset_ruby; + filetypes[GEANY_FILETYPES_RUBY]->comment_open = g_strdup("#"); + filetypes[GEANY_FILETYPES_RUBY]->comment_close = NULL; + filetypes_init_build_programs(filetypes[GEANY_FILETYPES_RUBY]); + filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_RUBY]->title, filetypes[GEANY_FILETYPES_RUBY]); + filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_RUBY]->title, filetypes[GEANY_FILETYPES_RUBY]); + #define ALL filetypes[GEANY_FILETYPES_ALL] = g_new0(filetype, 1); filetypes[GEANY_FILETYPES_ALL]->id = GEANY_FILETYPES_ALL; @@ -394,7 +412,7 @@ void filetypes_init_types(void) static void filetypes_init_build_programs(filetype *ftype) { ftype->programs = g_new0(struct build_programs, 1); - + ftype->menu_items = g_new0(struct build_menu_items, 1); } @@ -523,6 +541,8 @@ gchar *filetypes_get_template(filetype *ft) return templates_get_template_generic(GEANY_TEMPLATE_FILETYPE_JAVA); break; case GEANY_FILETYPES_PASCAL: return templates_get_template_generic(GEANY_TEMPLATE_FILETYPE_PASCAL); break; + case GEANY_FILETYPES_RUBY: + return templates_get_template_generic(GEANY_TEMPLATE_FILETYPE_RUBY); break; default: return NULL; } } @@ -542,7 +562,7 @@ void filetypes_get_config(GKeyFile *config, gint ft) { g_free(filetypes[ft]->comment_open); filetypes[ft]->comment_open = result; - } + } result = g_key_file_get_string(config, "settings", "comment_close", NULL); if (result != NULL) @@ -554,33 +574,33 @@ void filetypes_get_config(GKeyFile *config, gint ft) tmp = g_key_file_get_boolean(config, "settings", "comment_use_indent", &error); if (error) g_error_free(error); else filetypes[ft]->comment_use_indent = tmp; - + // read build settings result = g_key_file_get_string(config, "build_settings", "compiler", NULL); if (result != NULL) { filetypes[ft]->programs->compiler = result; filetypes[ft]->menu_items->can_compile = TRUE; - } + } result = g_key_file_get_string(config, "build_settings", "linker", NULL); if (result != NULL) { filetypes[ft]->programs->linker = result; filetypes[ft]->menu_items->can_link = TRUE; - } + } result = g_key_file_get_string(config, "build_settings", "run_cmd", NULL); if (result != NULL) { filetypes[ft]->programs->run_cmd = result; filetypes[ft]->menu_items->can_exec = TRUE; - } + } result = g_key_file_get_string(config, "build_settings", "run_cmd2", NULL); if (result != NULL) { filetypes[ft]->programs->run_cmd2 = result; filetypes[ft]->menu_items->can_exec = TRUE; - } + } } diff --git a/src/templates.c b/src/templates.c index d5352318..b0dc99ad 100644 --- a/src/templates.c +++ b/src/templates.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -44,12 +44,16 @@ void templates_init(void) { gchar *template_filename_fileheader = templates_get_filename("template.fileheader"); gchar *template_filename_fileheader_pascal =templates_get_filename("template.fileheader.pascal"); + gchar *template_filename_fileheader_route =templates_get_filename("template.fileheader.route"); gchar *template_filename_gpl = templates_get_filename("template.gpl"); gchar *template_filename_gpl_pascal = templates_get_filename("template.gpl.pascal"); + gchar *template_filename_gpl_route = templates_get_filename("template.gpl.route"); gchar *template_filename_function = templates_get_filename("template.function"); gchar *template_filename_function_pascal = templates_get_filename("template.function.pascal"); + gchar *template_filename_function_route = templates_get_filename("template.function.route"); gchar *template_filename_multiline = templates_get_filename("template.multiline"); gchar *template_filename_multiline_pascal = templates_get_filename("template.multiline.pascal"); + gchar *template_filename_multiline_route = templates_get_filename("template.multiline.route"); gchar *template_filename_changelog = templates_get_filename("template.changelog"); gchar *template_filename_filetype_none = templates_get_filename("template.filetype.none"); gchar *template_filename_filetype_c = templates_get_filename("template.filetype.c"); @@ -57,7 +61,7 @@ void templates_init(void) gchar *template_filename_filetype_java = templates_get_filename("template.filetype.java"); gchar *template_filename_filetype_pascal = templates_get_filename("template.filetype.pascal"); gchar *template_filename_filetype_php = templates_get_filename("template.filetype.php"); - gchar *template_filename_filetype_latex = templates_get_filename("template.filetype.latex"); + gchar *template_filename_filetype_ruby = templates_get_filename("template.filetype.ruby"); time_t tp = time(NULL); const struct tm *tm = localtime(&tp); @@ -68,12 +72,16 @@ void templates_init(void) // create the template files in the configuration directory, if they don't exist templates_create_file(template_filename_fileheader, templates_fileheader); templates_create_file(template_filename_fileheader_pascal, templates_fileheader_pascal); + templates_create_file(template_filename_fileheader_route, templates_fileheader_route); templates_create_file(template_filename_gpl, templates_gpl_notice); templates_create_file(template_filename_gpl_pascal, templates_gpl_notice_pascal); + templates_create_file(template_filename_gpl_route, templates_gpl_notice_route); templates_create_file(template_filename_function, templates_function_description); templates_create_file(template_filename_function_pascal, templates_function_description_pascal); + templates_create_file(template_filename_function_route, templates_function_description_route); templates_create_file(template_filename_multiline, templates_multiline); templates_create_file(template_filename_multiline_pascal, templates_multiline_pascal); + templates_create_file(template_filename_multiline_route, templates_multiline_route); templates_create_file(template_filename_changelog, templates_changelog); templates_create_file(template_filename_filetype_none, templates_filetype_none); templates_create_file(template_filename_filetype_c, templates_filetype_c); @@ -81,7 +89,7 @@ void templates_init(void) templates_create_file(template_filename_filetype_java, templates_filetype_java); templates_create_file(template_filename_filetype_pascal, templates_filetype_pascal); templates_create_file(template_filename_filetype_php, templates_filetype_php); - templates_create_file(template_filename_filetype_latex, templates_filetype_none); + templates_create_file(template_filename_filetype_ruby, templates_filetype_ruby); // read the contents templates_read_file(template_filename_fileheader, &templates[GEANY_TEMPLATE_FILEHEADER]); @@ -90,24 +98,36 @@ void templates_init(void) templates_read_file(template_filename_fileheader_pascal, &templates[GEANY_TEMPLATE_FILEHEADER_PASCAL]); templates[GEANY_TEMPLATE_FILEHEADER_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_FILEHEADER_PASCAL], year, date); + templates_read_file(template_filename_fileheader_route, &templates[GEANY_TEMPLATE_FILEHEADER_ROUTE]); + templates[GEANY_TEMPLATE_FILEHEADER_ROUTE] = templates_replace_all(templates[GEANY_TEMPLATE_FILEHEADER_ROUTE], year, date); + templates_read_file(template_filename_gpl, &templates[GEANY_TEMPLATE_GPL]); //templates[GEANY_TEMPLATE_GPL] = templates_replace_all(templates[GEANY_TEMPLATE_GPL], year, date); templates_read_file(template_filename_gpl_pascal, &templates[GEANY_TEMPLATE_GPL_PASCAL]); //templates[GEANY_TEMPLATE_GPL_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_GPL_PASCAL], year, date); + templates_read_file(template_filename_gpl_route, &templates[GEANY_TEMPLATE_GPL_ROUTE]); + //templates[GEANY_TEMPLATE_GPL_ROUTE] = templates_replace_all(templates[GEANY_TEMPLATE_GPL_ROUTE], year, date); + templates_read_file(template_filename_function, &templates[GEANY_TEMPLATE_FUNCTION]); templates[GEANY_TEMPLATE_FUNCTION] = templates_replace_all(templates[GEANY_TEMPLATE_FUNCTION], year, date); templates_read_file(template_filename_function_pascal, &templates[GEANY_TEMPLATE_FUNCTION_PASCAL]); templates[GEANY_TEMPLATE_FUNCTION_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_FUNCTION_PASCAL], year, date); + templates_read_file(template_filename_function_route, &templates[GEANY_TEMPLATE_FUNCTION_ROUTE]); + templates[GEANY_TEMPLATE_FUNCTION_ROUTE] = templates_replace_all(templates[GEANY_TEMPLATE_FUNCTION_ROUTE], year, date); + templates_read_file(template_filename_multiline, &templates[GEANY_TEMPLATE_MULTILINE]); //templates[GEANY_TEMPLATE_MULTILINE] = templates_replace_all(templates[GEANY_TEMPLATE_MULTILINE], year, date); templates_read_file(template_filename_multiline_pascal, &templates[GEANY_TEMPLATE_MULTILINE_PASCAL]); //templates[GEANY_TEMPLATE_MULTILINE_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_MULTILINE_PASCAL], year, date); + templates_read_file(template_filename_multiline_route, &templates[GEANY_TEMPLATE_MULTILINE_ROUTE]); + //templates[GEANY_TEMPLATE_MULTILINE_ROUTE] = templates_replace_all(templates[GEANY_TEMPLATE_MULTILINE_ROUTE], year, date); + templates_read_file(template_filename_changelog, &templates[GEANY_TEMPLATE_CHANGELOG]); templates[GEANY_TEMPLATE_CHANGELOG] = templates_replace_all(templates[GEANY_TEMPLATE_CHANGELOG], year, date); @@ -130,9 +150,8 @@ void templates_init(void) templates_read_file(template_filename_filetype_php, &templates[GEANY_TEMPLATE_FILETYPE_PHP]); templates[GEANY_TEMPLATE_FILETYPE_PHP] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_PHP], year, date); - templates_read_file(template_filename_filetype_latex, &templates[GEANY_TEMPLATE_FILETYPE_LATEX]); - templates[GEANY_TEMPLATE_FILETYPE_LATEX] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_LATEX], year, date); - + templates_read_file(template_filename_filetype_ruby, &templates[GEANY_TEMPLATE_FILETYPE_RUBY]); + templates[GEANY_TEMPLATE_FILETYPE_RUBY] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_RUBY], year, date); // free the whole stuff @@ -140,12 +159,16 @@ void templates_init(void) g_free(year); g_free(template_filename_fileheader); g_free(template_filename_fileheader_pascal); + g_free(template_filename_fileheader_route); g_free(template_filename_gpl); g_free(template_filename_gpl_pascal); + g_free(template_filename_gpl_route); g_free(template_filename_function); g_free(template_filename_function_pascal); + g_free(template_filename_function_route); g_free(template_filename_multiline); g_free(template_filename_multiline_pascal); + g_free(template_filename_multiline_route); g_free(template_filename_changelog); g_free(template_filename_filetype_none); g_free(template_filename_filetype_c); @@ -153,7 +176,7 @@ void templates_init(void) g_free(template_filename_filetype_java); g_free(template_filename_filetype_php); g_free(template_filename_filetype_pascal); - g_free(template_filename_filetype_latex); + g_free(template_filename_filetype_ruby); } @@ -184,6 +207,10 @@ gchar *templates_get_template_fileheader(gint template, const gchar *extension, { result = utils_str_replace(result, "{gpl}", templates[GEANY_TEMPLATE_GPL_PASCAL]); } + else if (template == GEANY_TEMPLATE_FILEHEADER_ROUTE) + { + result = utils_str_replace(result, "{gpl}", templates[GEANY_TEMPLATE_GPL_ROUTE]); + } else { result = utils_str_replace(result, "{gpl}", templates[GEANY_TEMPLATE_GPL]); @@ -219,13 +246,22 @@ gchar *templates_get_template_function(gint template, gchar *func_name) gchar *templates_get_template_gpl(gint template) { - if (template == GEANY_TEMPLATE_GPL_PASCAL) + switch (template) { - return g_strconcat("{\n", templates[template], "}\n", NULL); - } - else - { - return g_strconcat("/*\n", templates[template], "*/\n", NULL); + case GEANY_TEMPLATE_GPL_PASCAL: + { + return g_strconcat("{\n", templates[template], "}\n", NULL); + break; + } + case GEANY_TEMPLATE_GPL_ROUTE: + { + return g_strconcat("#\n", templates[template], "#\n", NULL); + break; + } + default: + { + return g_strconcat("/*\n", templates[template], "*/\n", NULL); + } } } diff --git a/src/templates.h b/src/templates.h index c1d960be..4f8a17c1 100644 --- a/src/templates.h +++ b/src/templates.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -42,14 +42,18 @@ void templates_free_templates(void); enum { GEANY_TEMPLATE_GPL_PASCAL = 0, + GEANY_TEMPLATE_GPL_ROUTE, GEANY_TEMPLATE_GPL, GEANY_TEMPLATE_FILEHEADER_PASCAL, + GEANY_TEMPLATE_FILEHEADER_ROUTE, GEANY_TEMPLATE_FILEHEADER, GEANY_TEMPLATE_CHANGELOG, GEANY_TEMPLATE_FUNCTION, GEANY_TEMPLATE_FUNCTION_PASCAL, + GEANY_TEMPLATE_FUNCTION_ROUTE, GEANY_TEMPLATE_MULTILINE, GEANY_TEMPLATE_MULTILINE_PASCAL, + GEANY_TEMPLATE_MULTILINE_ROUTE, GEANY_TEMPLATE_FILETYPE_NONE, GEANY_TEMPLATE_FILETYPE_C, @@ -57,7 +61,7 @@ enum GEANY_TEMPLATE_FILETYPE_JAVA, GEANY_TEMPLATE_FILETYPE_PHP, GEANY_TEMPLATE_FILETYPE_PASCAL, - GEANY_TEMPLATE_FILETYPE_LATEX, + GEANY_TEMPLATE_FILETYPE_RUBY, GEANY_MAX_TEMPLATES }; @@ -79,7 +83,7 @@ static const gchar templates_gpl_notice[] = "\ *\n\ * You should have received a copy of the GNU General Public License\n\ * along with this program; if not, write to the Free Software\n\ - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ "; static const gchar templates_gpl_notice_pascal[] = "\ @@ -95,7 +99,23 @@ static const gchar templates_gpl_notice_pascal[] = "\ \n\ You should have received a copy of the GNU General Public License\n\ along with this program; if not, write to the Free Software\n\ - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ +"; + +static const gchar templates_gpl_notice_route[] = "\ +# This program is free software; you can redistribute it and/or modify\n\ +# it under the terms of the GNU General Public License as published by\n\ +# the Free Software Foundation; either version 2 of the License, or\n\ +# (at your option) any later version.\n\ +#\n\ +# This program is distributed in the hope that it will be useful,\n\ +# but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ +# GNU General Public License for more details.\n\ +#\n\ +# You should have received a copy of the GNU General Public License\n\ +# along with this program; if not, write to the Free Software\n\ +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ "; static const gchar templates_function_description[] = "\ @@ -112,6 +132,13 @@ static const gchar templates_function_description_pascal[] = "\ @return\n\ }\n"; +static const gchar templates_function_description_route[] = "\ +#\n\ +# name: {functionname}\n\ +# @param\n\ +# @return\n\ +"; + static const gchar templates_multiline[] = "\ /* \n\ * \n\ @@ -122,6 +149,10 @@ static const gchar templates_multiline_pascal[] = "\ \n\ }"; +static const gchar templates_multiline_route[] = "\ +#\n\ +#"; + static const gchar templates_fileheader[] = "\ /*\n\ * {filename}\n\ @@ -140,6 +171,15 @@ static const gchar templates_fileheader_pascal[] = "\ {gpl}\ }\n\n"; +static const gchar templates_fileheader_route[] = "\ +#\n\ +# {filename}\n\ +#\n\ +# Copyright {year} {developer} <{mail}>\n\ +#\n\ +{gpl}\ +#\n\n"; + static const gchar templates_changelog[] = "\ {date} {developer} <{mail}>\n\ \n\ @@ -205,6 +245,15 @@ public class {untitled} {\n\ }\n\ "; -static const gchar templates_filetype_latex[] = ""; +static const gchar templates_filetype_ruby[] = "\n\ +\n\ +class StdClass\n\ + def initialize\n\ + \n\ + end\n\ +end\n\ +\n\ +x = StdClass.new\\n\ +"; #endif