Removed multiline template because it makes not much sense, instead just comment three lines using the general comment functionality.

Removed special templates for Pascal and some other filetypes using "#" as comment char. The comment characters for fileheader and GPL templates are now added dynamically according to the current filetype.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1160 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-01-06 15:03:53 +00:00
parent 5b3b1af12d
commit b53385de1d
6 changed files with 343 additions and 397 deletions

View File

@ -1,3 +1,15 @@
2007-01-06 Enrico Tröger <enrico.troeger@uvena.de>
* src/callbacks.c, src/sci_cb.c, src/sci_cb.h, src/templates.c,
src/templates.h:
Removed multiline template because it makes not much sense, instead
just comment three lines using the general comment functionality.
Removed special templates for Pascal and some other filetypes using
"#" as comment char. The comment characters for fileheader and GPL
templates are now added dynamically according to the current
filetype.
2007-01-06 Nick Treleaven <nick.treleaven@btinternet.com> 2007-01-06 Nick Treleaven <nick.treleaven@btinternet.com>
* src/keybindings.c: * src/keybindings.c:

View File

@ -1,7 +1,8 @@
/* /*
* callbacks.c - this file is part of Geany, a fast and lightweight IDE * callbacks.c - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2005-2007 Enrico Troeger <enrico.troeger@uvena.de>
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1460,27 +1461,7 @@ on_comments_function_activate (GtkMenuItem *menuitem,
line = utils_get_current_function(idx, &cur_tag); line = utils_get_current_function(idx, &cur_tag);
pos = sci_get_position_from_line(doc_list[idx].sci, line - 1); pos = sci_get_position_from_line(doc_list[idx].sci, line - 1);
switch (doc_list[idx].file_type->id) text = templates_get_template_function(doc_list[idx].file_type->id, 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); sci_insert_text(doc_list[idx].sci, pos, text);
g_free(text); g_free(text);
@ -1492,40 +1473,16 @@ on_comments_multiline_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
gchar *text;
if (doc_list[idx].file_type == NULL) if (! DOC_IDX_VALID(idx) || doc_list[idx].file_type == NULL)
{ {
ui_set_statusbar(_("Please set the filetype for the current file before using this function.")); ui_set_statusbar(_("Please set the filetype for the current file before using this function."));
return; return;
} }
switch (doc_list[idx].file_type->id)
{
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);
}
}
verify_click_pos(idx); // make sure that the click_pos is valid verify_click_pos(idx); // make sure that the click_pos is valid
sci_insert_text(doc_list[idx].sci, editor_info.click_pos, text); sci_cb_insert_multiline_comment(idx);
g_free(text);
} }
@ -1536,7 +1493,7 @@ on_comments_gpl_activate (GtkMenuItem *menuitem,
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
gchar *text; gchar *text;
text = templates_get_template_gpl(FILETYPE_ID(doc_list[idx].file_type)); text = templates_get_template_licence(FILETYPE_ID(doc_list[idx].file_type));
verify_click_pos(idx); // make sure that the click_pos is valid verify_click_pos(idx); // make sure that the click_pos is valid
@ -1545,6 +1502,24 @@ on_comments_gpl_activate (GtkMenuItem *menuitem,
} }
void
on_comments_bsd_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
/*
gint idx = document_get_cur_idx();
gchar *text;
text = templates_get_template_licence(FILETYPE_ID(doc_list[idx].file_type), GEANY_TEMPLATE_BSD);
verify_click_pos(idx); // make sure that the click_pos is valid
sci_insert_text(doc_list[idx].sci, editor_info.click_pos, text);
g_free(text);
*/
}
void void
on_comments_changelog_activate (GtkMenuItem *menuitem, on_comments_changelog_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
@ -1944,7 +1919,7 @@ on_menu_comment_line1_activate (GtkMenuItem *menuitem,
{ {
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return; if (idx == -1 || ! doc_list[idx].is_valid) return;
sci_cb_do_comment(idx, -1); sci_cb_do_comment(idx, -1, FALSE);
} }
@ -2074,6 +2049,15 @@ on_menu_comments_gpl_activate (GtkMenuItem *menuitem,
} }
void
on_menu_comments_bsd_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
insert_callback_from_menu = TRUE;
on_comments_bsd_activate(menuitem, user_data);
}
void void
on_menu_insert_include_activate (GtkMenuItem *menuitem, on_menu_insert_include_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
@ -2090,3 +2074,6 @@ on_menu_insert_date_activate (GtkMenuItem *menuitem,
insert_callback_from_menu = TRUE; insert_callback_from_menu = TRUE;
on_insert_date_activate(menuitem, user_data); on_insert_date_activate(menuitem, user_data);
} }

View File

@ -1,7 +1,8 @@
/* /*
* sci_cb.c - this file is part of Geany, a fast and lightweight IDE * sci_cb.c - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2005-2007 Enrico Troeger <enrico.troeger@uvena.de>
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1479,7 +1480,7 @@ void sci_cb_do_comment_toggle(gint idx)
if (do_continue) continue; if (do_continue) continue;
// we are still here, so the above lines were not already comments, so comment it // we are still here, so the above lines were not already comments, so comment it
sci_cb_do_comment(idx, i); sci_cb_do_comment(idx, i, FALSE);
count_commented++; count_commented++;
} }
// use multi line comment // use multi line comment
@ -1566,7 +1567,7 @@ void sci_cb_do_comment_toggle(gint idx)
} }
void sci_cb_do_comment(gint idx, gint line) void sci_cb_do_comment(gint idx, gint line, gboolean allow_empty_lines)
{ {
gint first_line, last_line; gint first_line, last_line;
gint x, i, line_start, line_len; gint x, i, line_start, line_len;
@ -1622,10 +1623,14 @@ void sci_cb_do_comment(gint idx, gint line)
sci_get_text_range(doc_list[idx].sci, line_start, MIN((line_start + 256), (line_start + line_len - 1)), sel); sci_get_text_range(doc_list[idx].sci, line_start, MIN((line_start + 256), (line_start + line_len - 1)), sel);
sel[MIN(256, (line_len - 1))] = '\0'; sel[MIN(256, (line_len - 1))] = '\0';
/// TODO fix the above code to remove the described segfault below
// The following loop causes a segfault when the cursor is on the last line of doc and
// there are no other characters on this line and Geany was compiled with -O2, with -O0
// all works fine.
while (isspace(sel[x])) x++; while (isspace(sel[x])) x++;
// to skip blank lines // to skip blank lines
if (x < line_len && sel[x] != '\0') if (allow_empty_lines || (x < line_len && sel[x] != '\0'))
{ {
// use single line comment // use single line comment
if (cc == NULL || strlen(cc) == 0) if (cc == NULL || strlen(cc) == 0)
@ -1938,3 +1943,59 @@ gint sci_cb_lexer_get_type_keyword_idx(gint lexer)
return -1; return -1;
} }
} }
// inserts a three-line comment at one line above current cursor position
void sci_cb_insert_multiline_comment(gint idx)
{
gchar *text;
gint text_len;
gint line;
gint pos;
gboolean have_multiline_comment = FALSE;
if (doc_list[idx].file_type->comment_close != NULL &&
strlen(doc_list[idx].file_type->comment_close) > 0)
have_multiline_comment = TRUE;
// insert three lines one line above of the current position
line = sci_get_line_from_position(doc_list[idx].sci, editor_info.click_pos);
pos = sci_get_position_from_line(doc_list[idx].sci, line);
// use the indentation on the current line but only when comment indention is used
// and we don't have multi line comment characters
if (doc_list[idx].use_auto_indention && ! have_multiline_comment &&
doc_list[idx].file_type->comment_use_indent)
{
get_indent(doc_list[idx].sci, editor_info.click_pos, TRUE);
text = g_strdup_printf("%s\n%s\n%s\n", indent, indent, indent);
text_len = strlen(text);
}
else
{
text = g_strdup("\n\n\n");
text_len = 3;
}
sci_insert_text(doc_list[idx].sci, pos, text);
g_free(text);
// select the inserted lines for commenting
sci_set_selection_start(doc_list[idx].sci, pos);
sci_set_selection_end(doc_list[idx].sci, pos + text_len);
sci_cb_do_comment(idx, -1, TRUE);
// set the current position to the start of the first inserted line
pos += strlen(doc_list[idx].file_type->comment_open);
// on multi line comment jump to the next line, otherwise add the length of added indentation
if (have_multiline_comment)
pos += 1;
else
pos += strlen(indent);
sci_set_current_position(doc_list[idx].sci, pos);
// reset the selection
sci_set_anchor(doc_list[idx].sci, pos);
}

View File

@ -1,7 +1,8 @@
/* /*
* sci_cb.h - this file is part of Geany, a fast and lightweight IDE * sci_cb.h - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2005-2007 Enrico Troeger <enrico.troeger@uvena.de>
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -69,7 +70,7 @@ gboolean sci_cb_show_calltip(gint idx, gint pos);
void sci_cb_do_comment_toggle(gint idx); void sci_cb_do_comment_toggle(gint idx);
void sci_cb_do_comment(gint idx, gint line); void sci_cb_do_comment(gint idx, gint line, gboolean allow_empty_lines);
void sci_cb_do_uncomment(gint idx, gint line); void sci_cb_do_uncomment(gint idx, gint line);
@ -83,4 +84,6 @@ gboolean sci_cb_lexer_is_c_like(gint lexer);
gint sci_cb_lexer_get_type_keyword_idx(gint lexer); gint sci_cb_lexer_get_type_keyword_idx(gint lexer);
void sci_cb_insert_multiline_comment(gint idx);
#endif #endif

View File

@ -1,7 +1,8 @@
/* /*
* templates.c - this file is part of Geany, a fast and lightweight IDE * templates.c - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2005-2007 Enrico Troeger <enrico.troeger@uvena.de>
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -21,6 +22,7 @@
*/ */
#include <time.h> #include <time.h>
#include <string.h>
#include "geany.h" #include "geany.h"
@ -32,114 +34,40 @@
// default templates, only for initial tempate file creation on first start of Geany // default templates, only for initial tempate file creation on first start of Geany
static const gchar templates_gpl_notice[] = "\ static const gchar templates_gpl_notice[] = "\
* This program is free software; you can redistribute it and/or modify\n\ 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\ 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\ the Free Software Foundation; either version 2 of the License, or\n\
* (at your option) any later version.\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_gpl_notice_pascal[] = "\
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\ \n\
This program is distributed in the hope that it will be useful,\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\ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
You should have received a copy of the GNU General Public License\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\ 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\ 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[] = "\ static const gchar templates_function_description[] = "\
/* \n\ \n\
* name: {functionname}\n\ name: {functionname}\n\
* @param\n\ @param\n\
* @return\n\ @return\n\
*/\n";
static const gchar templates_function_description_pascal[] = "\
{\n\
name: {functionname}\n\
@param\n\
@return\n\
}\n";
static const gchar templates_function_description_route[] = "\
#\n\
# name: {functionname}\n\
# @param\n\
# @return\n\
"; ";
static const gchar templates_multiline[] = "\ static const gchar templates_multiline[] = "\
/* \n\
* \n\
*/";
static const gchar templates_multiline_pascal[] = "\
{\n\
\n\ \n\
}"; \n\
";
static const gchar templates_multiline_route[] = "\
#\n\
#";
static const gchar templates_fileheader[] = "\ static const gchar templates_fileheader[] = "\
/*\n\ {filename}\n\
* {filename}\n\
*\n\
* Copyright {year} {developer} <{mail}>\n\
*\n\
{gpl}\
*/\n";
static const gchar templates_fileheader_pascal[] = "\
{\n\
{filename}\n\
\n\ \n\
Copyright {year} {developer} <{mail}>\n\ Copyright {year} {developer} <{mail}>\n\
\n\ \n\
{gpl}\ {gpl}\
}\n"; ";
static const gchar templates_fileheader_route[] = "\
#\n\
# {filename}\n\
#\n\
# Copyright {year} {developer} <{mail}>\n\
#\n\
{gpl}\
#\n";
static const gchar templates_changelog[] = "\ static const gchar templates_changelog[] = "\
{date} {developer} <{mail}>\n\ {date} {developer} <{mail}>\n\
@ -210,7 +138,8 @@ static const gchar templates_filetype_html[] = "<!DOCTYPE html PUBLIC \"-//W3C//
</html>\n\ </html>\n\
"; ";
static const gchar templates_filetype_pascal[] = "program {untitled};\n\ static const gchar templates_filetype_pascal[] = "\n\
program {untitled};\n\
\n\ \n\
uses crt;\n\ uses crt;\n\
var i : byte;\n\ var i : byte;\n\
@ -222,10 +151,9 @@ END.\n\
"; ";
static const gchar templates_filetype_java[] = "\n\ static const gchar templates_filetype_java[] = "\n\
\n\
public class {untitled} {\n\ public class {untitled} {\n\
\n\ \n\
public static void main (String args[]) {\n\ public static void main (String args[]) {\
\n\ \n\
\n\ \n\
}\n\ }\n\
@ -248,9 +176,9 @@ static gchar *templates[GEANY_MAX_TEMPLATES];
// some simple macros to reduce code size and make the code readable // some simple macros to reduce code size and make the code readable
#define templates_get_filename(x) g_strconcat(app->configdir, G_DIR_SEPARATOR_S, x, NULL) #define TEMPLATES_GET_FILENAME(x) g_strconcat(app->configdir, G_DIR_SEPARATOR_S, x, NULL)
#define templates_create_file(x, y) if (! g_file_test(x, G_FILE_TEST_EXISTS)) utils_write_file(x, y) #define TEMPLATES_CREATE_FILE(x, y) if (! g_file_test(x, G_FILE_TEST_EXISTS)) utils_write_file(x, y)
#define templates_read_file(x, y) g_file_get_contents(x, y, NULL, NULL); #define TEMPLATES_READ_FILE(x, y) g_file_get_contents(x, y, NULL, NULL);
// prototype, because this function should never be used outside of templates.c // prototype, because this function should never be used outside of templates.c
@ -259,28 +187,19 @@ static gchar *templates_replace_all(gchar *source, gchar *year, gchar *date);
void templates_init(void) void templates_init(void)
{ {
gchar *template_filename_fileheader = templates_get_filename("template.fileheader"); gchar *template_filename_fileheader = TEMPLATES_GET_FILENAME("template.fileheader");
gchar *template_filename_fileheader_pascal =templates_get_filename("template.fileheader.pascal"); gchar *template_filename_gpl = TEMPLATES_GET_FILENAME("template.gpl");
gchar *template_filename_fileheader_route =templates_get_filename("template.fileheader.route"); gchar *template_filename_function = TEMPLATES_GET_FILENAME("template.function");
gchar *template_filename_gpl = templates_get_filename("template.gpl"); gchar *template_filename_changelog = TEMPLATES_GET_FILENAME("template.changelog");
gchar *template_filename_gpl_pascal = templates_get_filename("template.gpl.pascal"); gchar *template_filename_filetype_none = TEMPLATES_GET_FILENAME("template.filetype.none");
gchar *template_filename_gpl_route = templates_get_filename("template.gpl.route"); gchar *template_filename_filetype_c = TEMPLATES_GET_FILENAME("template.filetype.c");
gchar *template_filename_function = templates_get_filename("template.function"); gchar *template_filename_filetype_cpp = TEMPLATES_GET_FILENAME("template.filetype.cpp");
gchar *template_filename_function_pascal = templates_get_filename("template.function.pascal"); gchar *template_filename_filetype_d = TEMPLATES_GET_FILENAME("template.filetype.d");
gchar *template_filename_function_route = templates_get_filename("template.function.route"); gchar *template_filename_filetype_java = TEMPLATES_GET_FILENAME("template.filetype.java");
gchar *template_filename_multiline = templates_get_filename("template.multiline"); gchar *template_filename_filetype_pascal = TEMPLATES_GET_FILENAME("template.filetype.pascal");
gchar *template_filename_multiline_pascal = templates_get_filename("template.multiline.pascal"); gchar *template_filename_filetype_php = TEMPLATES_GET_FILENAME("template.filetype.php");
gchar *template_filename_multiline_route = templates_get_filename("template.multiline.route"); gchar *template_filename_filetype_html = TEMPLATES_GET_FILENAME("template.filetype.html");
gchar *template_filename_changelog = templates_get_filename("template.changelog"); gchar *template_filename_filetype_ruby = TEMPLATES_GET_FILENAME("template.filetype.ruby");
gchar *template_filename_filetype_none = templates_get_filename("template.filetype.none");
gchar *template_filename_filetype_c = templates_get_filename("template.filetype.c");
gchar *template_filename_filetype_cpp = templates_get_filename("template.filetype.cpp");
gchar *template_filename_filetype_d = templates_get_filename("template.filetype.d");
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_html = templates_get_filename("template.filetype.html");
gchar *template_filename_filetype_ruby = templates_get_filename("template.filetype.ruby");
time_t tp = time(NULL); time_t tp = time(NULL);
const struct tm *tm = localtime(&tp); const struct tm *tm = localtime(&tp);
@ -289,95 +208,58 @@ void templates_init(void)
strftime(year, 5, "%Y", tm); strftime(year, 5, "%Y", tm);
// create the template files in the configuration directory, if they don't exist // 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, templates_fileheader);
templates_create_file(template_filename_fileheader_pascal, templates_fileheader_pascal); TEMPLATES_CREATE_FILE(template_filename_gpl, templates_gpl_notice);
templates_create_file(template_filename_fileheader_route, templates_fileheader_route); TEMPLATES_CREATE_FILE(template_filename_function, templates_function_description);
templates_create_file(template_filename_gpl, templates_gpl_notice); TEMPLATES_CREATE_FILE(template_filename_changelog, templates_changelog);
templates_create_file(template_filename_gpl_pascal, templates_gpl_notice_pascal); TEMPLATES_CREATE_FILE(template_filename_filetype_none, templates_filetype_none);
templates_create_file(template_filename_gpl_route, templates_gpl_notice_route); TEMPLATES_CREATE_FILE(template_filename_filetype_c, templates_filetype_c);
templates_create_file(template_filename_function, templates_function_description); TEMPLATES_CREATE_FILE(template_filename_filetype_cpp, templates_filetype_cpp);
templates_create_file(template_filename_function_pascal, templates_function_description_pascal); TEMPLATES_CREATE_FILE(template_filename_filetype_d, templates_filetype_d);
templates_create_file(template_filename_function_route, templates_function_description_route); TEMPLATES_CREATE_FILE(template_filename_filetype_java, templates_filetype_java);
templates_create_file(template_filename_multiline, templates_multiline); TEMPLATES_CREATE_FILE(template_filename_filetype_pascal, templates_filetype_pascal);
templates_create_file(template_filename_multiline_pascal, templates_multiline_pascal); TEMPLATES_CREATE_FILE(template_filename_filetype_php, templates_filetype_php);
templates_create_file(template_filename_multiline_route, templates_multiline_route); TEMPLATES_CREATE_FILE(template_filename_filetype_html, templates_filetype_html);
templates_create_file(template_filename_changelog, templates_changelog); TEMPLATES_CREATE_FILE(template_filename_filetype_ruby, templates_filetype_ruby);
templates_create_file(template_filename_filetype_none, templates_filetype_none);
templates_create_file(template_filename_filetype_c, templates_filetype_c);
templates_create_file(template_filename_filetype_cpp, templates_filetype_cpp);
templates_create_file(template_filename_filetype_d, templates_filetype_d);
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_html, templates_filetype_html);
templates_create_file(template_filename_filetype_ruby, templates_filetype_ruby);
// read the contents // read the contents
templates_read_file(template_filename_fileheader, &templates[GEANY_TEMPLATE_FILEHEADER]); TEMPLATES_READ_FILE(template_filename_fileheader, &templates[GEANY_TEMPLATE_FILEHEADER]);
templates[GEANY_TEMPLATE_FILEHEADER] = templates_replace_all(templates[GEANY_TEMPLATE_FILEHEADER], year, date); templates[GEANY_TEMPLATE_FILEHEADER] = templates_replace_all(templates[GEANY_TEMPLATE_FILEHEADER], year, date);
templates_read_file(template_filename_fileheader_pascal, &templates[GEANY_TEMPLATE_FILEHEADER_PASCAL]); TEMPLATES_READ_FILE(template_filename_gpl, &templates[GEANY_TEMPLATE_GPL]);
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[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_READ_FILE(template_filename_function, &templates[GEANY_TEMPLATE_FUNCTION]);
//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[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_READ_FILE(template_filename_changelog, &templates[GEANY_TEMPLATE_CHANGELOG]);
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); templates[GEANY_TEMPLATE_CHANGELOG] = templates_replace_all(templates[GEANY_TEMPLATE_CHANGELOG], year, date);
TEMPLATES_READ_FILE(template_filename_filetype_none, &templates[GEANY_TEMPLATE_FILETYPE_NONE]);
templates_read_file(template_filename_filetype_none, &templates[GEANY_TEMPLATE_FILETYPE_NONE]);
templates[GEANY_TEMPLATE_FILETYPE_NONE] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_NONE], year, date); templates[GEANY_TEMPLATE_FILETYPE_NONE] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_NONE], year, date);
templates_read_file(template_filename_filetype_c, &templates[GEANY_TEMPLATE_FILETYPE_C]); TEMPLATES_READ_FILE(template_filename_filetype_c, &templates[GEANY_TEMPLATE_FILETYPE_C]);
templates[GEANY_TEMPLATE_FILETYPE_C] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_C], year, date); templates[GEANY_TEMPLATE_FILETYPE_C] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_C], year, date);
templates_read_file(template_filename_filetype_d, &templates[GEANY_TEMPLATE_FILETYPE_D]); TEMPLATES_READ_FILE(template_filename_filetype_d, &templates[GEANY_TEMPLATE_FILETYPE_D]);
templates[GEANY_TEMPLATE_FILETYPE_D] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_D], year, date); templates[GEANY_TEMPLATE_FILETYPE_D] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_D], year, date);
templates_read_file(template_filename_filetype_cpp, &templates[GEANY_TEMPLATE_FILETYPE_CPP]); TEMPLATES_READ_FILE(template_filename_filetype_cpp, &templates[GEANY_TEMPLATE_FILETYPE_CPP]);
templates[GEANY_TEMPLATE_FILETYPE_CPP] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_CPP], year, date); templates[GEANY_TEMPLATE_FILETYPE_CPP] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_CPP], year, date);
templates_read_file(template_filename_filetype_java, &templates[GEANY_TEMPLATE_FILETYPE_JAVA]); TEMPLATES_READ_FILE(template_filename_filetype_java, &templates[GEANY_TEMPLATE_FILETYPE_JAVA]);
templates[GEANY_TEMPLATE_FILETYPE_JAVA] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_JAVA], year, date); templates[GEANY_TEMPLATE_FILETYPE_JAVA] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_JAVA], year, date);
templates_read_file(template_filename_filetype_pascal, &templates[GEANY_TEMPLATE_FILETYPE_PASCAL]); TEMPLATES_READ_FILE(template_filename_filetype_pascal, &templates[GEANY_TEMPLATE_FILETYPE_PASCAL]);
templates[GEANY_TEMPLATE_FILETYPE_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_PASCAL], year, date); templates[GEANY_TEMPLATE_FILETYPE_PASCAL] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_PASCAL], year, date);
templates_read_file(template_filename_filetype_php, &templates[GEANY_TEMPLATE_FILETYPE_PHP]); 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[GEANY_TEMPLATE_FILETYPE_PHP] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_PHP], year, date);
templates_read_file(template_filename_filetype_html, &templates[GEANY_TEMPLATE_FILETYPE_HTML]); TEMPLATES_READ_FILE(template_filename_filetype_html, &templates[GEANY_TEMPLATE_FILETYPE_HTML]);
templates[GEANY_TEMPLATE_FILETYPE_HTML] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_HTML], year, date); templates[GEANY_TEMPLATE_FILETYPE_HTML] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_HTML], year, date);
templates_read_file(template_filename_filetype_ruby, &templates[GEANY_TEMPLATE_FILETYPE_RUBY]); 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); templates[GEANY_TEMPLATE_FILETYPE_RUBY] = templates_replace_all(templates[GEANY_TEMPLATE_FILETYPE_RUBY], year, date);
@ -385,17 +267,8 @@ void templates_init(void)
g_free(date); g_free(date);
g_free(year); g_free(year);
g_free(template_filename_fileheader); 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);
g_free(template_filename_gpl_pascal);
g_free(template_filename_gpl_route);
g_free(template_filename_function); 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_changelog);
g_free(template_filename_filetype_none); g_free(template_filename_filetype_none);
g_free(template_filename_filetype_c); g_free(template_filename_filetype_c);
@ -409,28 +282,33 @@ void templates_init(void)
} }
/* double_comment is a hack for PHP/HTML for whether to first add C style commenting. /* indent is used to make some whitespace between comment char and real start of the line
* In future we could probably remove the need for this by making most templates * e.g. indent = 8 prints " * here comes the text of the line"
* automatically commented (so template files are not commented) */ * indent is meant to be the whole amount of characters before the real line content follows, i.e.
static gchar *make_comment_block(const gchar *comment_text, gint filetype_idx, * 6 characters are filled with whitespace when the comment characters include " *" */
gboolean double_comment) static gchar *make_comment_block(const gchar *comment_text, gint filetype_idx, gint indent)
{ {
gchar *frame_start = ""; // to add before comment_text
gchar *frame_end = ""; // to add after comment_text
gchar *line_prefix; // to add before every line in comment_text
gchar *result;
gchar *tmp;
gchar *prefix;
gchar **lines;
gint i;
/// TODO the following switch could be replaced by some intelligent code which reads
/// frame_start, frame_end and line_prefix from the filetype definition files
switch (filetype_idx) switch (filetype_idx)
{ {
case GEANY_FILETYPES_ALL:
return g_strdup(comment_text); // no need to add to the text
case GEANY_FILETYPES_PHP:
case GEANY_FILETYPES_HTML: case GEANY_FILETYPES_HTML:
{ // double comment case GEANY_FILETYPES_XML:
gchar *tmp = (double_comment) ? case GEANY_FILETYPES_DOCBOOK:
make_comment_block(comment_text, GEANY_FILETYPES_C, FALSE) : {
g_strdup(comment_text); frame_start = "<!--\n";
gchar *block = (filetype_idx == GEANY_FILETYPES_PHP) ? frame_end = "-->\n";
g_strconcat("<?php\n", tmp, "?>\n", NULL) : line_prefix = "";
g_strconcat("<!--\n", tmp, "-->\n", NULL); break;
g_free(tmp);
return block;
} }
case GEANY_FILETYPES_PYTHON: case GEANY_FILETYPES_PYTHON:
@ -438,133 +316,142 @@ static gchar *make_comment_block(const gchar *comment_text, gint filetype_idx,
case GEANY_FILETYPES_SH: case GEANY_FILETYPES_SH:
case GEANY_FILETYPES_MAKE: case GEANY_FILETYPES_MAKE:
case GEANY_FILETYPES_PERL: case GEANY_FILETYPES_PERL:
return g_strconcat("#\n", comment_text, "#\n", NULL); case GEANY_FILETYPES_DIFF:
case GEANY_FILETYPES_TCL:
case GEANY_FILETYPES_OMS:
case GEANY_FILETYPES_CONF:
{
line_prefix = "#";
break;
}
case GEANY_FILETYPES_LATEX:
{
line_prefix = "%";
break;
}
case GEANY_FILETYPES_VHDL:
{
line_prefix = "--";
break;
}
case GEANY_FILETYPES_FORTRAN:
{
line_prefix = "c";
break;
}
case GEANY_FILETYPES_ASM:
{
line_prefix = ";";
break;
}
case GEANY_FILETYPES_PASCAL: case GEANY_FILETYPES_PASCAL:
return g_strconcat("{\n", comment_text, "}\n", NULL); {
frame_start = "{\n";
frame_end = "}\n";
line_prefix = "";
break;
}
default:
return g_strconcat("/*\n", comment_text, " */\n", NULL);
}
}
gchar *templates_get_template_gpl(gint filetype_idx)
{
const gchar *text;
switch (filetype_idx)
{
case GEANY_FILETYPES_PYTHON:
case GEANY_FILETYPES_RUBY:
case GEANY_FILETYPES_SH:
case GEANY_FILETYPES_MAKE:
case GEANY_FILETYPES_PERL:
text = templates[GEANY_TEMPLATE_GPL_ROUTE];
break;
case GEANY_FILETYPES_PASCAL:
case GEANY_FILETYPES_ALL:
text = templates[GEANY_TEMPLATE_GPL_PASCAL];
break;
case GEANY_FILETYPES_HTML:
case GEANY_FILETYPES_PHP: case GEANY_FILETYPES_PHP:
default: {
text = templates[GEANY_TEMPLATE_GPL]; frame_start = "<?\n/*\n";
break; frame_end = " */\n?>\n";
line_prefix = " *";
break;
}
case GEANY_FILETYPES_CAML:
{
frame_start = "(*\n";
frame_end = " *)\n";
line_prefix = " *";
break;
}
case GEANY_FILETYPES_ALL:
{
line_prefix = "";
break;
}
default: // guess /* */ is appropriate
{
frame_start = "/*\n";
frame_end = " */\n";
line_prefix = " *";
}
} }
return make_comment_block(text, filetype_idx, TRUE);
} // construct the real prefix with given amount of whitespace
i = (indent > strlen(line_prefix)) ? (indent - strlen(line_prefix)) : strlen(line_prefix);
tmp = g_strnfill(i, ' ');
prefix = g_strconcat(line_prefix, tmp, NULL);
g_free(tmp);
/* Returns a template chosen by template with GEANY_STRING_UNTITLED.extension // add line_prefix to every line of comment_text
* as filename if idx is -1, or the real filename if idx is greater than -1. lines = g_strsplit(comment_text, "\n", -1);
* The flag gpl decides whether a GPL notice is appended or not */ for (i = 0; i < (g_strv_length(lines) - 1); i++)
static gchar * {
prepare_file_header(gint template, const gchar *extension, const gchar *filename) tmp = lines[i];
{ lines[i] = g_strconcat(prefix, tmp, NULL);
gchar *result = g_strdup(templates[template]); g_free(tmp);
gchar *shortname; }
gchar *date = utils_get_date_time(); tmp = g_strjoinv("\n", lines);
if (filename == NULL) // add frame_start and frame_end
{ result = g_strconcat(frame_start, tmp, frame_end, NULL);
if (extension != NULL)
shortname = g_strconcat(GEANY_STRING_UNTITLED, ".", extension, NULL);
else
shortname = g_strdup(GEANY_STRING_UNTITLED);
}
else
{
shortname = g_path_get_basename(filename);
}
result = utils_str_replace(result, "{filename}", shortname);
if (template == GEANY_TEMPLATE_FILEHEADER_PASCAL) g_free(prefix);
{ g_free(tmp);
result = utils_str_replace(result, "{gpl}", templates[GEANY_TEMPLATE_GPL_PASCAL]); g_strfreev(lines);
}
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]);
}
result = utils_str_replace(result, "{datetime}", date);
g_free(shortname);
g_free(date);
return result; return result;
} }
// ft, fname can be NULL gchar *templates_get_template_licence(gint filetype_idx)
{
//if (licence_type != GEANY_TEMPLATE_GPL)
//return NULL;
return make_comment_block(templates[GEANY_TEMPLATE_GPL], filetype_idx, 8);
}
static gchar *get_file_header(filetype *ft, const gchar *fname) static gchar *get_file_header(filetype *ft, const gchar *fname)
{ {
gchar *text = NULL; gchar *template = g_strdup(templates[GEANY_TEMPLATE_FILEHEADER]);
gchar *shortname;
gchar *result;
gchar *date = utils_get_date_time();
switch (FILETYPE_ID(ft)) if (fname == NULL)
{ {
case GEANY_FILETYPES_ALL: // ft may be NULL if (FILETYPE_ID(ft) == GEANY_FILETYPES_ALL)
{ shortname = g_strdup(GEANY_STRING_UNTITLED);
text = prepare_file_header(GEANY_TEMPLATE_FILEHEADER, NULL, fname); else
break; shortname = g_strconcat(GEANY_STRING_UNTITLED, ".", ft->extension, NULL);
}
case GEANY_FILETYPES_PHP:
case GEANY_FILETYPES_HTML:
{
gchar *tmp = prepare_file_header(
GEANY_TEMPLATE_FILEHEADER, ft->extension, fname);
text = make_comment_block(tmp, ft->id, FALSE);
g_free(tmp);
break;
}
case GEANY_FILETYPES_PASCAL:
{ // Pascal: comments are in { } brackets
text = prepare_file_header(
GEANY_TEMPLATE_FILEHEADER_PASCAL, ft->extension, fname);
break;
}
case GEANY_FILETYPES_PYTHON:
case GEANY_FILETYPES_RUBY:
case GEANY_FILETYPES_SH:
case GEANY_FILETYPES_MAKE:
case GEANY_FILETYPES_PERL:
{
text = prepare_file_header(
GEANY_TEMPLATE_FILEHEADER_ROUTE, ft->extension, fname);
break;
}
default:
{ // -> C, C++, Java, ...
text = prepare_file_header(
GEANY_TEMPLATE_FILEHEADER, ft->extension, fname);
}
} }
return text; else
shortname = g_path_get_basename(fname);
template = utils_str_replace(template, "{filename}", shortname);
template = utils_str_replace(template, "{gpl}", templates[GEANY_TEMPLATE_GPL]);
template = utils_str_replace(template, "{datetime}", date);
result = make_comment_block(template, FILETYPE_ID(ft), 8);
g_free(template);
g_free(shortname);
g_free(date);
return result;
} }
@ -632,21 +519,26 @@ gchar *templates_get_template_generic(gint template)
} }
gchar *templates_get_template_function(gint template, const gchar *func_name) gchar *templates_get_template_function(gint filetype_idx, const gchar *func_name)
{ {
gchar *result = g_strdup(templates[template]); gchar *template = g_strdup(templates[GEANY_TEMPLATE_FUNCTION]);
gchar *date = utils_get_date(); gchar *date = utils_get_date();
gchar *datetime = utils_get_date_time(); gchar *datetime = utils_get_date_time();
gchar *result;
result = utils_str_replace(result, "{date}", date); template = utils_str_replace(template, "{date}", date);
result = utils_str_replace(result, "{datetime}", datetime); template = utils_str_replace(template, "{datetime}", datetime);
result = utils_str_replace(result, "{functionname}", (func_name) ? func_name : ""); template = utils_str_replace(template, "{functionname}", (func_name) ? func_name : "");
result = make_comment_block(template, filetype_idx, 3);
g_free(template);
g_free(date); g_free(date);
g_free(datetime); g_free(datetime);
return result; return result;
} }
gchar *templates_get_template_changelog(void) gchar *templates_get_template_changelog(void)
{ {
gchar *date = utils_get_date_time(); gchar *date = utils_get_date_time();

View File

@ -1,7 +1,8 @@
/* /*
* templates.h - this file is part of Geany, a fast and lightweight IDE * templates.h - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2005-2007 Enrico Troeger <enrico.troeger@uvena.de>
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,7 +26,6 @@
#include "filetypes.h" #include "filetypes.h"
void templates_init(void); void templates_init(void);
gchar *templates_get_template_fileheader(gint idx); gchar *templates_get_template_fileheader(gint idx);
@ -36,28 +36,19 @@ gchar *templates_get_template_changelog(void);
gchar *templates_get_template_generic(gint template); gchar *templates_get_template_generic(gint template);
gchar *templates_get_template_function(gint template, const gchar *func_name); gchar *templates_get_template_function(gint filetype_idx, const gchar *func_name);
gchar *templates_get_template_gpl(gint filetype_idx); gchar *templates_get_template_licence(gint filetype_idx);
void templates_free_templates(void); void templates_free_templates(void);
enum enum
{ {
GEANY_TEMPLATE_GPL_PASCAL = 0, GEANY_TEMPLATE_GPL = 0,
GEANY_TEMPLATE_GPL_ROUTE,
GEANY_TEMPLATE_GPL,
GEANY_TEMPLATE_FILEHEADER_PASCAL,
GEANY_TEMPLATE_FILEHEADER_ROUTE,
GEANY_TEMPLATE_FILEHEADER, GEANY_TEMPLATE_FILEHEADER,
GEANY_TEMPLATE_CHANGELOG, GEANY_TEMPLATE_CHANGELOG,
GEANY_TEMPLATE_FUNCTION, 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_NONE,
GEANY_TEMPLATE_FILETYPE_C, GEANY_TEMPLATE_FILETYPE_C,