several bugfixes and improvements
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@281 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
c80b8a576a
commit
002503decd
490
src/build.c
490
src/build.c
@ -40,14 +40,23 @@
|
||||
#include "msgwindow.h"
|
||||
|
||||
|
||||
static GIOChannel *build_set_up_io_channel (gint fd, GIOCondition cond, GIOFunc func, gpointer data);
|
||||
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
|
||||
static gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *cmd);
|
||||
static GPid build_spawn_cmd(gint idx, gchar **cmd);
|
||||
|
||||
|
||||
|
||||
GPid build_compile_tex_file(gint idx, gint mode)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar*, 3);
|
||||
argv[0] = (mode == 0) ? g_strdup(app->build_tex_dvi_cmd) : g_strdup(app->build_tex_pdf_cmd);
|
||||
argv[1] = g_path_get_basename(doc_list[idx].file_name);
|
||||
argv[2] = NULL;
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
argv = g_new0(gchar*, 2);
|
||||
argv[0] = (mode == 0) ? g_strdup(doc_list[idx].file_type->programs->compiler) :
|
||||
g_strdup(doc_list[idx].file_type->programs->linker);
|
||||
argv[1] = NULL;
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
@ -56,59 +65,85 @@ GPid build_compile_tex_file(gint idx, gint mode)
|
||||
GPid build_view_tex_file(gint idx, gint mode)
|
||||
{
|
||||
gchar **argv;
|
||||
gchar *executable = g_malloc0(strlen(doc_list[idx].file_name));
|
||||
gchar *view_file;
|
||||
gchar *last_dot = strrchr(doc_list[idx].file_name, '.');
|
||||
gchar *executable = NULL;
|
||||
gchar *view_file = NULL;
|
||||
gchar *locale_filename = NULL;
|
||||
gchar *cmd_string = NULL;
|
||||
gchar *locale_cmd_string = NULL;
|
||||
GError *error = NULL;
|
||||
gint i = 0;
|
||||
GPid child_pid;
|
||||
GPid child_pid;
|
||||
struct stat st;
|
||||
|
||||
while ((doc_list[idx].file_name + i) != last_dot)
|
||||
{
|
||||
executable[i] = doc_list[idx].file_name[i];
|
||||
i++;
|
||||
}
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
executable = utils_remove_ext_from_filename(doc_list[idx].file_name);
|
||||
view_file = g_strconcat(executable, (mode == 0) ? ".dvi" : ".pdf", NULL);
|
||||
g_free(executable);
|
||||
|
||||
// try convert in locale for stat()
|
||||
locale_filename = g_locale_from_utf8(view_file, -1, NULL, NULL, NULL);
|
||||
if (locale_filename == NULL) locale_filename = g_strdup(view_file);
|
||||
|
||||
// check wether view_file exists
|
||||
if (stat(view_file, &st) != 0)
|
||||
if (stat(locale_filename, &st) != 0)
|
||||
{
|
||||
msgwin_status_add(_("Failed to view %s (make sure it is already compiled)"), view_file);
|
||||
g_free(executable);
|
||||
g_free(view_file);
|
||||
g_free(locale_filename);
|
||||
return (GPid) 1;
|
||||
}
|
||||
|
||||
argv = g_new(gchar*, 3);
|
||||
argv[0] = (mode == 0) ? g_strdup(app->build_tex_view_dvi_cmd) : g_strdup(app->build_tex_view_pdf_cmd);
|
||||
argv[1] = view_file;
|
||||
argv[2] = NULL;
|
||||
// replace %f and %e in the run_cmd string
|
||||
cmd_string = g_strdup((mode == 0) ? g_strdup(doc_list[idx].file_type->programs->run_cmd) :
|
||||
g_strdup(doc_list[idx].file_type->programs->run_cmd2));
|
||||
cmd_string = utils_str_replace(cmd_string, "%f", view_file);
|
||||
cmd_string = utils_str_replace(cmd_string, "%e", executable);
|
||||
|
||||
// try convert in locale
|
||||
locale_cmd_string = g_locale_from_utf8(cmd_string, -1, NULL, NULL, NULL);
|
||||
if (locale_cmd_string == NULL) locale_cmd_string = g_strdup(view_file);
|
||||
|
||||
argv = g_new0(gchar *, 4);
|
||||
argv[0] = g_strdup("/bin/sh");
|
||||
argv[1] = g_strdup("-c");
|
||||
argv[2] = locale_cmd_string;
|
||||
argv[3] = NULL;
|
||||
|
||||
if (! g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
|
||||
NULL, NULL, &child_pid, NULL, NULL, NULL, &error))
|
||||
{
|
||||
geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
|
||||
msgwin_status_add(_("Process failed (%s)"), error->message);
|
||||
|
||||
g_free(view_file);
|
||||
g_free(executable);
|
||||
g_free(locale_filename);
|
||||
g_free(cmd_string);
|
||||
g_strfreev(argv);
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
return (GPid) 0;
|
||||
}
|
||||
|
||||
g_free(view_file);
|
||||
g_free(executable);
|
||||
g_free(locale_filename);
|
||||
g_free(cmd_string);
|
||||
g_strfreev(argv);
|
||||
|
||||
return child_pid;
|
||||
}
|
||||
|
||||
|
||||
GPid build_make_c_file(gint idx, gboolean cust_target)
|
||||
GPid build_make_file(gint idx, gboolean cust_target)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar*, 3);
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
argv = g_new0(gchar*, 3);
|
||||
if (cust_target && app->build_make_custopt)
|
||||
{
|
||||
//cust-target
|
||||
{ //cust-target
|
||||
argv[0] = g_strdup(app->build_make_cmd);
|
||||
argv[1] = g_strdup(app->build_make_custopt);
|
||||
argv[2] = NULL;
|
||||
@ -124,49 +159,44 @@ GPid build_make_c_file(gint idx, gboolean cust_target)
|
||||
}
|
||||
|
||||
|
||||
GPid build_compile_c_file(gint idx)
|
||||
GPid build_compile_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar*, 5);
|
||||
argv[0] = g_strdup(app->build_c_cmd);
|
||||
argv[1] = g_strdup("-c");
|
||||
argv[2] = g_path_get_basename(doc_list[idx].file_name);
|
||||
argv[3] = g_strdup(app->build_args_inc);
|
||||
argv[4] = NULL;
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
argv = g_new0(gchar *, 2);
|
||||
argv[0] = g_strdup(doc_list[idx].file_type->programs->compiler);
|
||||
argv[1] = NULL;
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
GPid build_link_c_file(gint idx)
|
||||
GPid build_link_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
gchar *executable = g_malloc0(strlen(doc_list[idx].file_name));
|
||||
gchar *object_file;
|
||||
gchar *last_dot = strrchr(doc_list[idx].file_name, '.');
|
||||
gint i = 0;
|
||||
gchar *executable = NULL;
|
||||
gchar *object_file, *locale_filename;
|
||||
struct stat st, st2;
|
||||
|
||||
while ((doc_list[idx].file_name + i) != last_dot)
|
||||
{
|
||||
executable[i] = doc_list[idx].file_name[i];
|
||||
i++;
|
||||
}
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
locale_filename = g_locale_from_utf8(doc_list[idx].file_name, -1, NULL, NULL, NULL);
|
||||
if (locale_filename == NULL) locale_filename = g_strdup(doc_list[idx].file_name);
|
||||
|
||||
executable = utils_remove_ext_from_filename(locale_filename);
|
||||
object_file = g_strdup_printf("%s.o", executable);
|
||||
|
||||
// check wether object file (file.o) exists
|
||||
if (stat(object_file, &st) != 0)
|
||||
{
|
||||
g_free(object_file);
|
||||
object_file = NULL;
|
||||
}
|
||||
else
|
||||
if (stat(object_file, &st) == 0)
|
||||
{ // check wether src is newer than object file
|
||||
if (stat(doc_list[idx].file_name, &st2) == 0)
|
||||
if (stat(locale_filename, &st2) == 0)
|
||||
{
|
||||
if (st2.st_mtime > st.st_mtime)
|
||||
{
|
||||
// set object_file to NULL, so the source file will be used for linking,
|
||||
// more precisely then we compile and link instead of just linking
|
||||
g_free(object_file);
|
||||
object_file = NULL;
|
||||
}
|
||||
@ -178,143 +208,66 @@ GPid build_link_c_file(gint idx)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
argv = g_new(gchar *, 6);
|
||||
argv[0] = g_strdup(app->build_c_cmd);
|
||||
argv = g_new0(gchar *, 4);
|
||||
argv[0] = g_strdup(doc_list[idx].file_type->programs->linker);
|
||||
argv[1] = g_strdup("-o");
|
||||
argv[2] = g_path_get_basename(executable);
|
||||
argv[3] = g_path_get_basename((object_file) ? object_file : doc_list[idx].file_name);
|
||||
argv[4] = g_strdup(app->build_args_libs);
|
||||
argv[5] = NULL;
|
||||
argv[3] = NULL;
|
||||
|
||||
g_free(executable);
|
||||
g_free(object_file);
|
||||
g_free(locale_filename);
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
GPid build_compile_cpp_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar *, 5);
|
||||
argv[0] = g_strdup(app->build_cpp_cmd);
|
||||
argv[1] = g_strdup("-c");
|
||||
argv[2] = g_path_get_basename(doc_list[idx].file_name);
|
||||
argv[3] = g_strdup(app->build_args_inc);
|
||||
argv[4] = NULL;
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
GPid build_link_cpp_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
gchar *executable = g_malloc0(strlen(doc_list[idx].file_name));
|
||||
gchar *object_file;
|
||||
gchar *last_dot = strrchr(doc_list[idx].file_name, '.');
|
||||
gint i = 0;
|
||||
struct stat st, st2;
|
||||
|
||||
while ((doc_list[idx].file_name + i) != last_dot)
|
||||
{
|
||||
executable[i] = doc_list[idx].file_name[i];
|
||||
i++;
|
||||
}
|
||||
object_file = g_strdup_printf("%s.o", executable);
|
||||
|
||||
// check wether object file (file.o) exists
|
||||
if (stat(object_file, &st) != 0)
|
||||
{
|
||||
g_free(object_file);
|
||||
object_file = NULL;
|
||||
}
|
||||
else
|
||||
{ // check wether src is newer than object file
|
||||
if (stat(doc_list[idx].file_name, &st2) == 0)
|
||||
{
|
||||
if (st2.st_mtime > st.st_mtime)
|
||||
{
|
||||
g_free(object_file);
|
||||
object_file = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_show_error("Something very strange is occured, could not stat %s (%s)",
|
||||
doc_list[idx].file_name, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
argv = g_new(gchar *, 6);
|
||||
argv[0] = g_strdup(app->build_cpp_cmd);
|
||||
argv[1] = g_strdup("-o");
|
||||
argv[2] = g_path_get_basename(executable);
|
||||
argv[3] = g_path_get_basename((object_file) ? object_file : doc_list[idx].file_name);
|
||||
argv[4] = g_strdup(app->build_args_libs);
|
||||
argv[5] = NULL;
|
||||
|
||||
g_free(executable);
|
||||
g_free(object_file);
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
GPid build_compile_pascal_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar *, 4);
|
||||
argv[0] = g_strdup(app->build_fpc_cmd);
|
||||
argv[1] = g_path_get_basename(doc_list[idx].file_name);
|
||||
argv[2] = g_strdup(app->build_args_inc);
|
||||
argv[3] = NULL;
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
GPid build_compile_java_file(gint idx)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
argv = g_new(gchar *, 4);
|
||||
argv[0] = g_strdup(app->build_javac_cmd);
|
||||
argv[1] = g_path_get_basename(doc_list[idx].file_name);
|
||||
argv[2] = g_strdup(app->build_args_inc);
|
||||
argv[3] = NULL;
|
||||
|
||||
return build_spawn_cmd(idx, argv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
static GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar **argv;
|
||||
gchar *working_dir;
|
||||
gchar *utf8_working_dir;
|
||||
gchar *cmd_string;
|
||||
gchar *utf8_cmd_string;
|
||||
gchar *locale_filename;
|
||||
gchar *executable;
|
||||
gchar *tmp;
|
||||
GPid child_pid;
|
||||
gint stdout_fd;
|
||||
gint stderr_fd;
|
||||
|
||||
app->cur_idx = idx;
|
||||
cmd_string = g_strjoinv(" ", cmd);
|
||||
g_strfreev(cmd);
|
||||
|
||||
argv = g_new(gchar *, 4);
|
||||
locale_filename = g_locale_from_utf8(doc_list[idx].file_name, -1, NULL, NULL, NULL);
|
||||
if (locale_filename == NULL) locale_filename = g_strdup(doc_list[idx].file_name);
|
||||
|
||||
executable = utils_remove_ext_from_filename(locale_filename);
|
||||
|
||||
// replace %f and %e in the command string
|
||||
tmp = g_path_get_basename(locale_filename);
|
||||
cmd_string = utils_str_replace(cmd_string, "%f", tmp);
|
||||
g_free(tmp);
|
||||
tmp = g_path_get_basename(executable);
|
||||
cmd_string = utils_str_replace(cmd_string, "%e", tmp);
|
||||
g_free(tmp);
|
||||
g_free(executable);
|
||||
|
||||
utf8_cmd_string = g_locale_to_utf8(cmd_string, -1, NULL, NULL, NULL);
|
||||
if (utf8_cmd_string == NULL) utf8_cmd_string = g_strdup(cmd_string);
|
||||
|
||||
argv = g_new0(gchar *, 4);
|
||||
argv[0] = g_strdup("/bin/sh");
|
||||
argv[1] = g_strdup("-c");
|
||||
argv[2] = cmd_string;
|
||||
argv[3] = NULL;
|
||||
|
||||
working_dir = g_path_get_dirname(doc_list[idx].file_name);
|
||||
working_dir = g_path_get_dirname(locale_filename);
|
||||
utf8_working_dir = g_path_get_dirname(doc_list[idx].file_name);
|
||||
gtk_list_store_clear(msgwindow.store_compiler);
|
||||
msgwin_compiler_add(COLOR_BLUE, FALSE, _("%s (in directory: %s)"), cmd_string, working_dir);
|
||||
msgwin_compiler_add(COLOR_BLUE, FALSE, _("%s (in directory: %s)"), utf8_cmd_string, utf8_working_dir);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
|
||||
|
||||
if (! g_spawn_async_with_pipes(working_dir, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
|
||||
@ -325,6 +278,9 @@ GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
g_strfreev(argv);
|
||||
g_error_free(error);
|
||||
g_free(working_dir);
|
||||
g_free(utf8_working_dir);
|
||||
g_free(utf8_cmd_string);
|
||||
g_free(locale_filename);
|
||||
error = NULL;
|
||||
return (GPid) 0;
|
||||
}
|
||||
@ -334,8 +290,10 @@ GPid build_spawn_cmd(gint idx, gchar **cmd)
|
||||
build_set_up_io_channel(stderr_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, build_iofunc, GINT_TO_POINTER(1));
|
||||
|
||||
g_strfreev(argv);
|
||||
g_strfreev(cmd);
|
||||
g_free(utf8_working_dir);
|
||||
g_free(utf8_cmd_string);
|
||||
g_free(working_dir);
|
||||
g_free(locale_filename);
|
||||
|
||||
return child_pid;
|
||||
}
|
||||
@ -347,70 +305,112 @@ GPid build_run_cmd(gint idx)
|
||||
GPid result_id; // either child_pid or error id.
|
||||
GError *error = NULL;
|
||||
gchar **argv = NULL;
|
||||
gchar **term_argv = NULL;
|
||||
gchar *working_dir = NULL;
|
||||
gchar *long_executable = NULL;
|
||||
gchar *check_executable = NULL;
|
||||
gchar *utf8_check_executable = NULL;
|
||||
gchar *locale_filename = NULL;
|
||||
gchar *locale_term_cmd = NULL;
|
||||
gchar *cmd = NULL;
|
||||
gchar *tmp = NULL;
|
||||
gchar *executable = NULL;
|
||||
gchar *script_name = g_strdup("./geany_run_script.sh");
|
||||
gchar *script_name;
|
||||
guint term_argv_len, i;
|
||||
struct stat st;
|
||||
|
||||
/* removes the filetype extension from the filename
|
||||
* this fails if the file has no extension, but even though a filetype,
|
||||
* but in this case the build menu is disabled */
|
||||
long_executable = utils_remove_ext_from_filename(doc_list[idx].file_name);
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
script_name = g_strdup("./geany_run_script.sh");
|
||||
|
||||
// add .class extension for JAVA source files
|
||||
if (doc_list[idx].file_type->id == GEANY_FILETYPES_JAVA)
|
||||
check_executable = g_strconcat(long_executable, ".class", NULL);
|
||||
else check_executable = g_strdup(long_executable);
|
||||
locale_filename = g_locale_from_utf8(doc_list[idx].file_name, -1, NULL, NULL, NULL);
|
||||
if (locale_filename == NULL) locale_filename = g_strdup(doc_list[idx].file_name);
|
||||
|
||||
// check wether executable exists
|
||||
if (stat(check_executable, &st) != 0)
|
||||
locale_term_cmd = g_locale_from_utf8(app->build_term_cmd, -1, NULL, NULL, NULL);
|
||||
if (locale_term_cmd == NULL) locale_term_cmd = g_strdup(app->build_term_cmd);
|
||||
// split the term_cmd, so arguments will work too
|
||||
term_argv = g_strsplit(locale_term_cmd, " ", -1);
|
||||
term_argv_len = g_strv_length(term_argv);
|
||||
|
||||
long_executable = utils_remove_ext_from_filename(locale_filename);
|
||||
|
||||
// only check for existing executable, if executable is required by %e
|
||||
if (strstr(doc_list[idx].file_type->programs->run_cmd, "%e") != NULL)
|
||||
{
|
||||
msgwin_status_add(_("Failed to execute %s (make sure it is already built)"), check_executable);
|
||||
result_id = (GPid) 1;
|
||||
goto free_strings;
|
||||
// add .class extension for JAVA source files (only for stat)
|
||||
if (doc_list[idx].file_type->id == GEANY_FILETYPES_JAVA)
|
||||
check_executable = g_strconcat(long_executable, ".class", NULL);
|
||||
else
|
||||
check_executable = g_strdup(long_executable);
|
||||
|
||||
// check whether executable exists
|
||||
if (stat(check_executable, &st) != 0)
|
||||
{
|
||||
utf8_check_executable = utils_remove_ext_from_filename(doc_list[idx].file_name);
|
||||
msgwin_status_add(_("Failed to execute %s (make sure it is already built)"),
|
||||
utf8_check_executable);
|
||||
result_id = (GPid) 1;
|
||||
goto free_strings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check if terminal path is set (to prevent misleading error messages)
|
||||
if (stat(app->build_term_cmd, &st) != 0)
|
||||
if (stat(term_argv[0], &st) != 0)
|
||||
{
|
||||
msgwin_status_add(
|
||||
_("Could not find terminal '%s' "
|
||||
"(check path for Terminal tool setting in Preferences)"),
|
||||
app->build_term_cmd);
|
||||
"(check path for Terminal tool setting in Preferences)"), app->build_term_cmd);
|
||||
result_id = (GPid) 1;
|
||||
goto free_strings;
|
||||
}
|
||||
|
||||
executable = g_path_get_basename(long_executable);
|
||||
|
||||
working_dir = g_path_get_dirname(doc_list[idx].file_name);
|
||||
working_dir = g_path_get_dirname(locale_filename);
|
||||
if (chdir(working_dir) != 0)
|
||||
{
|
||||
gchar *utf8_working_dir = NULL;
|
||||
utf8_working_dir = g_locale_to_utf8(working_dir, -1, NULL, NULL, NULL);
|
||||
if (utf8_working_dir == NULL) utf8_working_dir = g_strdup(working_dir);
|
||||
|
||||
msgwin_status_add(_("Failed to change the working directory to %s"), working_dir);
|
||||
result_id = (GPid) 1; // return 1, to prevent error handling of the caller
|
||||
g_free(utf8_working_dir);
|
||||
goto free_strings;
|
||||
}
|
||||
|
||||
// replace %f and %e in the run_cmd string
|
||||
cmd = g_strdup(doc_list[idx].file_type->programs->run_cmd);
|
||||
tmp = g_path_get_basename(locale_filename);
|
||||
cmd = utils_str_replace(cmd, "%f", tmp);
|
||||
g_free(tmp);
|
||||
cmd = utils_str_replace(cmd, "%e", executable);
|
||||
|
||||
// write a little shellscript to call the executable (similar to anjuta_launcher but "internal")
|
||||
if (! build_create_shellscript(idx, script_name, executable, app->build_args_prog))
|
||||
// (script_name should be ok in UTF8 without converting in locale because it contains no umlauts)
|
||||
if (! build_create_shellscript(idx, script_name, cmd))
|
||||
{
|
||||
msgwin_status_add(_("Failed to execute %s (start-script could not be created)"), executable);
|
||||
utf8_check_executable = utils_remove_ext_from_filename(doc_list[idx].file_name);
|
||||
msgwin_status_add(_("Failed to execute %s (start-script could not be created)"),
|
||||
utf8_check_executable);
|
||||
result_id = (GPid) 1;
|
||||
goto free_strings;
|
||||
}
|
||||
|
||||
argv = g_new(gchar *, 4);
|
||||
argv[0] = g_strdup(app->build_term_cmd);
|
||||
argv[1] = g_strdup("-e");
|
||||
argv[2] = g_strdup(script_name);
|
||||
argv[3] = NULL;
|
||||
argv = g_new0(gchar *, term_argv_len + 3);
|
||||
for (i = 0; i < term_argv_len; i++)
|
||||
{
|
||||
argv[i] = g_strdup(term_argv[i]);
|
||||
}
|
||||
argv[term_argv_len ] = g_strdup("-e");
|
||||
argv[term_argv_len + 1] = g_strdup(script_name);
|
||||
argv[term_argv_len + 2] = NULL;
|
||||
|
||||
if (! g_spawn_async_with_pipes(working_dir, argv, NULL, G_SPAWN_SEARCH_PATH,
|
||||
NULL, NULL, &child_pid, NULL, NULL, NULL, &error))
|
||||
{
|
||||
g_warning("g_spawn_async_with_pipes() failed: %s", error->message);
|
||||
geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
|
||||
msgwin_status_add(_("Process failed (%s)"), error->message);
|
||||
unlink(script_name);
|
||||
g_error_free(error);
|
||||
@ -419,22 +419,19 @@ GPid build_run_cmd(gint idx)
|
||||
goto free_strings;
|
||||
}
|
||||
|
||||
/* check if the script is really deleted, this doesn't work because of g_spawn_ASYNC_with_pipes
|
||||
anyone knows a solution? */
|
||||
/* if (stat(script_name, &st) == 0)
|
||||
{
|
||||
g_warning("The run script did not deleted itself.");
|
||||
unlink(script_name);
|
||||
}
|
||||
*/
|
||||
result_id = child_pid; // g_spawn was successful, result is child process id
|
||||
|
||||
free_strings:
|
||||
/* free all non-NULL strings */
|
||||
g_strfreev(argv);
|
||||
g_strfreev(term_argv);
|
||||
g_free(working_dir);
|
||||
g_free(long_executable);
|
||||
g_free(cmd);
|
||||
g_free(utf8_check_executable);
|
||||
g_free(locale_filename);
|
||||
g_free(locale_term_cmd);
|
||||
g_free(check_executable);
|
||||
g_free(long_executable);
|
||||
g_free(executable);
|
||||
g_free(script_name);
|
||||
|
||||
@ -442,25 +439,23 @@ GPid build_run_cmd(gint idx)
|
||||
}
|
||||
|
||||
|
||||
gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
|
||||
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
|
||||
{
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
//GIOStatus s;
|
||||
gchar *msg;
|
||||
guint x = 1;
|
||||
|
||||
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg)
|
||||
{
|
||||
//if (s != G_IO_STATUS_NORMAL && s != G_IO_STATUS_EOF) break;
|
||||
if (GPOINTER_TO_INT(data))
|
||||
{
|
||||
msgwin_compiler_add(COLOR_RED, FALSE, g_strstrip(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
msgwin_compiler_add(COLOR_BLACK, FALSE, g_strstrip(msg));
|
||||
}
|
||||
|
||||
x++;
|
||||
g_free(msg);
|
||||
}
|
||||
}
|
||||
@ -471,7 +466,7 @@ gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
|
||||
}
|
||||
|
||||
|
||||
GIOChannel *build_set_up_io_channel(gint fd, GIOCondition cond, GIOFunc func, gpointer data)
|
||||
static GIOChannel *build_set_up_io_channel(gint fd, GIOCondition cond, GIOFunc func, gpointer data)
|
||||
{
|
||||
GIOChannel *ioc;
|
||||
GError *error = NULL;
|
||||
@ -537,43 +532,34 @@ void build_exit_cb(GPid child_pid, gint status, gpointer user_data)
|
||||
}
|
||||
|
||||
|
||||
gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *exec, const gchar *args)
|
||||
static gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *cmd)
|
||||
{
|
||||
FILE *fp;
|
||||
gchar *str, *java_cmd, *new_args, **tmp_args = NULL;
|
||||
gint i;
|
||||
gchar *str, *exec, **tmp_args = NULL, *tmp;
|
||||
|
||||
fp = fopen(fname, "w");
|
||||
if (! fp) return FALSE;
|
||||
|
||||
if (args != NULL)
|
||||
{ // enclose all args in ""
|
||||
gint i;
|
||||
gchar *tmp;
|
||||
|
||||
tmp_args = g_strsplit(args, " ", -1);
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (tmp_args[i] == NULL) break;
|
||||
tmp = g_strdup(tmp_args[i]);
|
||||
g_free(tmp_args[i]);
|
||||
tmp_args[i] = g_strconcat("\"", tmp, "\"", NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
new_args = g_strjoinv(" ", tmp_args);
|
||||
// enclose all args in ""
|
||||
tmp_args = g_strsplit(cmd, " ", -1);
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (tmp_args[i] == NULL) break;
|
||||
tmp = g_strdup(tmp_args[i]);
|
||||
g_free(tmp_args[i]);
|
||||
tmp_args[i] = g_strconcat("\"", tmp, "\"", NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
else new_args = g_strdup("");
|
||||
exec = g_strjoinv(" ", tmp_args);
|
||||
|
||||
java_cmd = g_strconcat(app->build_java_cmd, " ", NULL);
|
||||
str = g_strdup_printf(
|
||||
"#!/bin/sh\n\n%s%s %s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
|
||||
\n\necho \"Press return to continue\"\nread\nunlink $0\n",
|
||||
(doc_list[idx].file_type->id == GEANY_FILETYPES_JAVA) ? java_cmd : "./",
|
||||
exec, new_args);
|
||||
"#!/bin/sh\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
|
||||
\n\necho \"Press return to continue\"\nread\nunlink $0\n", exec);
|
||||
fputs(str, fp);
|
||||
g_free(java_cmd);
|
||||
g_free(str);
|
||||
g_free(new_args);
|
||||
if (new_args != NULL) g_strfreev(tmp_args);
|
||||
g_free(exec);
|
||||
g_strfreev(tmp_args);
|
||||
|
||||
if (chmod(fname, 0700) != 0)
|
||||
{
|
||||
@ -586,57 +572,3 @@ gboolean build_create_shellscript(const gint idx, const gchar *fname, const gcha
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
void build_c_file(gint idx)
|
||||
{
|
||||
gint gcc_err, gcc_out, len, status;
|
||||
//gchar *argv[] = { "/bin/sh", "-c", "gcc", "-c", doc_list[idx].file_name, NULL };
|
||||
gchar *argv[] = { "gcc", "-Wall -c", doc_list[idx].file_name, NULL };
|
||||
GError *error = NULL;
|
||||
GPid pid;
|
||||
GIOChannel *c;
|
||||
gchar *msg;
|
||||
const gchar *encoding;
|
||||
|
||||
msgwin_treeview_clear(msgwindow.store_compiler);
|
||||
msgwin_compiler_add(FALSE, g_strjoinv(" ", argv));
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
|
||||
|
||||
g_spawn_async_with_pipes(g_path_get_dirname(doc_list[idx].file_name), argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pid,
|
||||
NULL, NULL, &gcc_err, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning("compile: %s", error->message);
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
c = g_io_channel_unix_new(gcc_err);
|
||||
//g_io_channel_set_flags(c, G_IO_FLAG_NONBLOCK, NULL);
|
||||
if (! g_get_charset(&encoding))
|
||||
{ // hope this works reliably
|
||||
g_io_channel_set_encoding(c, encoding, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning("compile: %s", error->message);
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (g_io_channel_read_line(c, &msg, &len, NULL, NULL) == G_IO_STATUS_NORMAL)
|
||||
{
|
||||
msgwin_compiler_add(TRUE, g_strstrip(msg));
|
||||
g_free(msg);
|
||||
}
|
||||
|
||||
g_io_channel_unref(c);
|
||||
g_io_channel_shutdown(c, FALSE, NULL);
|
||||
g_spawn_close_pid(pid);
|
||||
|
||||
close(gcc_err);
|
||||
}
|
||||
#endif
|
||||
|
24
src/build.h
24
src/build.h
@ -26,34 +26,18 @@
|
||||
|
||||
#include "geany.h"
|
||||
|
||||
GPid build_make_c_file(gint idx, gboolean cust_target);
|
||||
GPid build_make_file(gint idx, gboolean cust_target);
|
||||
|
||||
GPid build_compile_c_file(gint idx);
|
||||
GPid build_compile_file(gint idx);
|
||||
|
||||
GPid build_link_file(gint idx);
|
||||
|
||||
GPid build_compile_tex_file(gint idx, gint mode);
|
||||
|
||||
GPid build_view_tex_file(gint idx, gint mode);
|
||||
|
||||
GPid build_link_c_file(gint idx);
|
||||
|
||||
GPid build_compile_cpp_file(gint idx);
|
||||
|
||||
GPid build_link_cpp_file(gint idx);
|
||||
|
||||
GPid build_compile_java_file(gint idx);
|
||||
|
||||
GPid build_compile_pascal_file(gint idx);
|
||||
|
||||
GPid build_spawn_cmd(gint idx, gchar **cmd);
|
||||
|
||||
GPid build_run_cmd(gint idx);
|
||||
|
||||
void build_exit_cb (GPid child_pid, gint status, gpointer user_data);
|
||||
|
||||
GIOChannel *build_set_up_io_channel (gint fd, GIOCondition cond, GIOFunc func, gpointer data);
|
||||
|
||||
gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
|
||||
|
||||
gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *exec, const gchar *args);
|
||||
|
||||
#endif
|
||||
|
380
src/callbacks.c
380
src/callbacks.c
@ -24,6 +24,7 @@
|
||||
#include "geany.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
@ -86,26 +87,6 @@ void signal_cb(gint sig)
|
||||
{
|
||||
on_exit_clicked(NULL, NULL);
|
||||
}
|
||||
/* else if (sig == SIGUSR1)
|
||||
{
|
||||
#define BUFLEN 512
|
||||
gint fd;
|
||||
gchar *buffer = g_malloc0(BUFLEN);
|
||||
|
||||
geany_debug("got SIGUSR1 signal, try to read from named pipe");
|
||||
|
||||
if ((fd = open(fifo_name, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
{
|
||||
geany_debug("error opening named pipe (%s)", strerror(errno));
|
||||
return;
|
||||
}
|
||||
usleep(10000);
|
||||
if (read(fd, buffer, BUFLEN) != -1) geany_debug("Inhalt: %s", buffer);
|
||||
|
||||
close(fd);
|
||||
g_free(buffer);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -142,17 +123,9 @@ gint destroyapp(GtkWidget *widget, gpointer gdata)
|
||||
g_free(app->pref_template_mail);
|
||||
g_free(app->pref_template_initial);
|
||||
g_free(app->pref_template_version);
|
||||
g_free(app->build_c_cmd);
|
||||
g_free(app->build_cpp_cmd);
|
||||
g_free(app->build_java_cmd);
|
||||
g_free(app->build_javac_cmd);
|
||||
g_free(app->build_fpc_cmd);
|
||||
g_free(app->build_make_cmd);
|
||||
g_free(app->build_term_cmd);
|
||||
g_free(app->build_browser_cmd);
|
||||
g_free(app->build_args_inc);
|
||||
g_free(app->build_args_libs);
|
||||
g_free(app->build_args_prog);
|
||||
while (! g_queue_is_empty(app->recent_queue))
|
||||
{
|
||||
g_free(g_queue_pop_tail(app->recent_queue));
|
||||
@ -174,14 +147,8 @@ gint destroyapp(GtkWidget *widget, gpointer gdata)
|
||||
scintilla_release_resources();
|
||||
gtk_widget_destroy(app->window);
|
||||
// kill explicitly since only one or none menu is shown at a time
|
||||
if (dialogs_build_menus.menu_c.menu && GTK_IS_WIDGET(dialogs_build_menus.menu_c.menu))
|
||||
gtk_widget_destroy(dialogs_build_menus.menu_c.menu);
|
||||
if (dialogs_build_menus.menu_misc.menu && GTK_IS_WIDGET(dialogs_build_menus.menu_misc.menu))
|
||||
gtk_widget_destroy(dialogs_build_menus.menu_misc.menu);
|
||||
if (dialogs_build_menus.menu_tex.menu && GTK_IS_WIDGET(dialogs_build_menus.menu_tex.menu))
|
||||
gtk_widget_destroy(dialogs_build_menus.menu_tex.menu);
|
||||
|
||||
/// destroy popup menus - FIXME TEST THIS CODE
|
||||
// destroy popup menus
|
||||
if (app->popup_menu && GTK_IS_WIDGET(app->popup_menu))
|
||||
gtk_widget_destroy(app->popup_menu);
|
||||
if (app->toolbar_menu && GTK_IS_WIDGET(app->toolbar_menu))
|
||||
@ -234,7 +201,8 @@ on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
||||
{
|
||||
if (app->pref_main_confirm_exit)
|
||||
{
|
||||
if (dialogs_show_confirm_exit() && on_close_all1_activate(NULL, NULL)) destroyapp(NULL, gdata);
|
||||
if (dialogs_show_question(_("Do you really want to quit?")) &&
|
||||
on_close_all1_activate(NULL, NULL)) destroyapp(NULL, gdata);
|
||||
else app->quitting = FALSE;
|
||||
}
|
||||
else
|
||||
@ -248,7 +216,7 @@ on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
||||
{
|
||||
if (app->pref_main_confirm_exit)
|
||||
{
|
||||
if (dialogs_show_confirm_exit()) destroyapp(NULL, gdata);
|
||||
if (dialogs_show_question(_("Do you really want to quit?"))) destroyapp(NULL, gdata);
|
||||
else app->quitting = FALSE;
|
||||
}
|
||||
else
|
||||
@ -443,49 +411,7 @@ void
|
||||
on_preferences1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (app->prefs_dialog)
|
||||
{
|
||||
prefs_init_dialog();
|
||||
gtk_widget_show(app->prefs_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
app->prefs_dialog = create_prefs_dialog();
|
||||
g_signal_connect((gpointer) app->prefs_dialog, "response", G_CALLBACK(on_prefs_button_clicked), NULL);
|
||||
g_signal_connect((gpointer) app->prefs_dialog, "delete_event", G_CALLBACK(on_prefs_delete_event), NULL);
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "tagbar_font"),
|
||||
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(1));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "msgwin_font"),
|
||||
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(2));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "editor_font"),
|
||||
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(3));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "font_term"),
|
||||
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(4));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "long_line_color"),
|
||||
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(1));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "color_fore"),
|
||||
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(2));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "color_back"),
|
||||
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(3));
|
||||
// file chooser buttons in the tools tab
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_gcc"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_c"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_gpp"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_cpp"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_javac"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_javac"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_java"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_java"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_make"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_make"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_term"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_term"));
|
||||
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_browser"),
|
||||
"clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_browser"));
|
||||
|
||||
prefs_init_dialog();
|
||||
gtk_widget_show(app->prefs_dialog);
|
||||
}
|
||||
dialogs_show_prefs_dialog();
|
||||
}
|
||||
|
||||
|
||||
@ -523,17 +449,15 @@ on_toolbutton23_clicked (GtkToolButton *toolbutton,
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gchar *basename = g_path_get_basename(doc_list[idx].file_name);
|
||||
gchar *buffer = g_strdup_printf(_
|
||||
("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
|
||||
basename);
|
||||
|
||||
if (dialogs_show_reload_warning(buffer))
|
||||
if (dialogs_show_question(_
|
||||
("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
|
||||
basename))
|
||||
{
|
||||
document_open_file(idx, NULL, 0, doc_list[idx].readonly, doc_list[idx].file_type);
|
||||
}
|
||||
|
||||
g_free(basename);
|
||||
g_free(buffer);
|
||||
}
|
||||
|
||||
|
||||
@ -765,7 +689,7 @@ on_notebook1_switch_page (GtkNotebook *notebook,
|
||||
|
||||
document_set_text_changed(idx);
|
||||
utils_build_show_hide(idx);
|
||||
utils_update_statusbar(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
utils_set_window_title(idx);
|
||||
utils_update_tag_list(idx, FALSE);
|
||||
utils_check_disk_status(idx);
|
||||
@ -797,17 +721,18 @@ on_file_open_dialog_response (GtkDialog *dialog,
|
||||
{
|
||||
gtk_widget_hide(app->open_filesel);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
if (response == GTK_RESPONSE_ACCEPT || response == GTK_RESPONSE_APPLY)
|
||||
{
|
||||
GSList *filelist;
|
||||
GSList *flist;
|
||||
gint ft_id = gtk_combo_box_get_active(GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(dialog), "filetype_combo")));
|
||||
filetype *ft = NULL;
|
||||
gboolean ro = gtk_toggle_button_get_active(
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(GTK_WIDGET(dialog), "check_readonly")));
|
||||
gboolean ro = (response == GTK_RESPONSE_APPLY); // View clicked
|
||||
|
||||
if (ft_id >= 0 && ft_id < GEANY_FILETYPES_ALL) ft = filetypes[ft_id];
|
||||
|
||||
flist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(app->open_filesel));
|
||||
filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(app->open_filesel));
|
||||
flist = filelist;
|
||||
while(flist != NULL)
|
||||
{
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) < GEANY_MAX_OPEN_FILES)
|
||||
@ -820,12 +745,13 @@ on_file_open_dialog_response (GtkDialog *dialog,
|
||||
else
|
||||
{
|
||||
dialogs_show_file_open_error();
|
||||
g_slist_foreach(flist, (GFunc)g_free, NULL);
|
||||
break;
|
||||
}
|
||||
g_free(flist->data);
|
||||
flist = flist->next;
|
||||
}
|
||||
g_slist_free(flist);
|
||||
g_slist_free(filelist);
|
||||
}
|
||||
}
|
||||
|
||||
@ -838,15 +764,15 @@ on_file_open_entry_activate (GtkEntry *entry,
|
||||
gchar *locale_filename = g_locale_from_utf8(gtk_entry_get_text(entry), -1, NULL, NULL, NULL);
|
||||
if (locale_filename == NULL) locale_filename = g_strdup(gtk_entry_get_text(entry));
|
||||
|
||||
if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
|
||||
if (g_file_test(locale_filename, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
}
|
||||
else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
|
||||
{
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
on_file_open_dialog_response(GTK_DIALOG(app->open_filesel), GTK_RESPONSE_ACCEPT, NULL);
|
||||
}
|
||||
else if (g_file_test(locale_filename, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
}
|
||||
|
||||
g_free(locale_filename);
|
||||
}
|
||||
@ -884,14 +810,23 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
gint response,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_hide(app->save_filesel);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gchar *new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel));
|
||||
|
||||
// check if file exists and ask whether to overwrite or not
|
||||
if (g_file_test(new_filename, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
if (dialogs_show_question(
|
||||
_("The file '%s' already exists. Do you want to overwrite it?"),
|
||||
new_filename) == FALSE) return;
|
||||
}
|
||||
gtk_widget_hide(app->save_filesel);
|
||||
|
||||
if (doc_list[idx].file_name) g_free(doc_list[idx].file_name);
|
||||
doc_list[idx].file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel));
|
||||
doc_list[idx].file_name = new_filename;
|
||||
|
||||
utils_replace_filename(idx);
|
||||
document_save_file(idx);
|
||||
|
||||
@ -908,6 +843,7 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
utils_update_recent_menu();
|
||||
}
|
||||
}
|
||||
else gtk_widget_hide(app->save_filesel);
|
||||
}
|
||||
|
||||
|
||||
@ -1019,8 +955,7 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
//gint idx = geany_document_get_cur_idx();
|
||||
gboolean ret = FALSE;
|
||||
gboolean ret = TRUE;
|
||||
gint idx = GPOINTER_TO_INT(user_data);
|
||||
gint pos = sci_get_current_position(doc_list[idx].sci);
|
||||
|
||||
@ -1033,8 +968,9 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_line_duplicate(doc_list[idx].sci);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// show userlist with macros and variables on strg+space
|
||||
@ -1045,28 +981,26 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
sci_cb_start_auto_complete(
|
||||
doc_list[GPOINTER_TO_INT(user_data)].sci,
|
||||
sci_get_current_position(doc_list[idx].sci));
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
{ // ALT+Space
|
||||
sci_cb_show_calltip(doc_list[idx].sci, -1);
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (event->state & GDK_SHIFT_MASK)
|
||||
{ // Shift+Space, catch this explicitly to suppress sci_cb_auto_forif() ;-)
|
||||
sci_add_text(doc_list[idx].sci, " ");
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// refreshs the tag lists
|
||||
case 'R':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
document_update_tag_list(idx);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// reloads the document
|
||||
@ -1075,79 +1009,73 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
gchar *basename = g_path_get_basename(doc_list[idx].file_name);
|
||||
gchar *buffer = g_strdup_printf(_
|
||||
("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
|
||||
basename);
|
||||
|
||||
if (dialogs_show_reload_warning(buffer))
|
||||
if (dialogs_show_question(_
|
||||
("Are you sure you want to reload '%s'?\nAny unsaved changes will be lost."),
|
||||
basename))
|
||||
{
|
||||
document_open_file(idx, NULL, 0, doc_list[idx].readonly, doc_list[idx].file_type);
|
||||
}
|
||||
|
||||
g_free(basename);
|
||||
g_free(buffer);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// comment the current line or selected lines
|
||||
case 'd':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_cb_do_comment(idx);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// uri handling testing
|
||||
case '^':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_cb_handle_uri(doc_list[idx].sci, pos);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// zoom in the text
|
||||
case '+':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_zoom_in(doc_list[idx].sci);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// zoom out the text
|
||||
case '-':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_zoom_out(doc_list[idx].sci);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
|
||||
break;
|
||||
}
|
||||
// open the preferences dialog
|
||||
case 'p':
|
||||
{
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
on_preferences1_activate(NULL, NULL);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// switch to the next open notebook tab to the right
|
||||
case GDK_Right:
|
||||
{
|
||||
if (event->state & GDK_MOD1_MASK)
|
||||
{
|
||||
utils_switch_document(RIGHT);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// switch to the next open notebook tab to the right
|
||||
@ -1156,8 +1084,9 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
if (event->state & GDK_MOD1_MASK)
|
||||
{
|
||||
utils_switch_document(LEFT);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
// show macro list
|
||||
@ -1166,22 +1095,23 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
sci_cb_show_macro_list(doc_list[idx].sci);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
case GDK_Insert:
|
||||
{
|
||||
if (! (event->state & GDK_SHIFT_MASK))
|
||||
doc_list[idx].do_overwrite = (doc_list[idx].do_overwrite) ? FALSE : TRUE;
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
case GDK_F12:
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_SCRATCH);
|
||||
gtk_widget_grab_focus(lookup_widget(app->window, "textview_scribble"));
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_VTE
|
||||
@ -1193,10 +1123,44 @@ on_editor_key_press_event (GtkWidget *widget,
|
||||
gtk_widget_grab_focus(vc->vte);
|
||||
break;
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// build menu shortcuts temporarily defined here, until new keyboard shortcuts management is
|
||||
// implemented, hope this fixes at least for the moment the shortcut problem
|
||||
case GDK_F8:
|
||||
{
|
||||
if (doc_list[idx].file_type->menu_items->can_compile &&
|
||||
doc_list[idx].file_name != NULL)
|
||||
{
|
||||
on_build_compile_activate(NULL, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GDK_F9:
|
||||
{
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
if (doc_list[idx].file_name != NULL) on_build_make_activate(NULL, NULL);
|
||||
}
|
||||
else if (doc_list[idx].file_type->menu_items->can_link &&
|
||||
doc_list[idx].file_name != NULL)
|
||||
{
|
||||
on_build_build_activate(NULL, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GDK_F5:
|
||||
{
|
||||
if (doc_list[idx].file_type->menu_items->can_exec &&
|
||||
doc_list[idx].file_name != NULL)
|
||||
{
|
||||
on_build_execute_activate(NULL, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: ret = FALSE;
|
||||
|
||||
/* following code is unusable unless I get a signal for a line changed, don't want to do this with
|
||||
* updateUI(), additional problem: at line changes the column isn't kept
|
||||
case GDK_End:
|
||||
@ -1259,10 +1223,12 @@ on_editor_button_press_event (GtkWidget *widget,
|
||||
|
||||
if (event->button == 3)
|
||||
{
|
||||
/// TODO pos should possibly be the position of the mouse pointer instead of the current sci position
|
||||
/// TODO pos should possibly be the position of the mouse pointer instead of the
|
||||
/// current sci position
|
||||
gint pos = sci_get_current_position(doc_list[GPOINTER_TO_INT(user_data)].sci);
|
||||
|
||||
utils_find_current_word(doc_list[GPOINTER_TO_INT(user_data)].sci, pos, current_word);
|
||||
utils_find_current_word(doc_list[GPOINTER_TO_INT(user_data)].sci, pos,
|
||||
current_word, sizeof current_word);
|
||||
|
||||
utils_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
|
||||
utils_update_popup_copy_items(GPOINTER_TO_INT(user_data));
|
||||
@ -1498,7 +1464,7 @@ on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
if (idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
doc_list[idx].readonly = ! doc_list[idx].readonly;
|
||||
sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly);
|
||||
utils_update_statusbar(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1563,7 +1529,8 @@ void
|
||||
on_goto_tag_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint i, j, type;
|
||||
gint type;
|
||||
guint i, j;
|
||||
const GPtrArray *tags;
|
||||
|
||||
if (utils_strcmp(_("Goto tag definition"), gtk_label_get_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menuitem))))))
|
||||
@ -1796,7 +1763,6 @@ on_compiler_treeview_copy_activate (GtkMenuItem *menuitem,
|
||||
gtk_tree_model_get(model, &iter, 1, &string, -1);
|
||||
if (string || strlen (string) > 0)
|
||||
{
|
||||
//gtk_clipboard_set_text(gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)), strrchr(string, ':') + 2, -1);
|
||||
gtk_clipboard_set_text(gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)), string, -1);
|
||||
}
|
||||
g_free(string);
|
||||
@ -1809,23 +1775,7 @@ void
|
||||
on_compile_button_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
|
||||
if (sci_get_lexer(doc_list[idx].sci) == SCLEX_HTML ||
|
||||
sci_get_lexer(doc_list[idx].sci) == SCLEX_XML)
|
||||
{
|
||||
#ifdef GEANY_WIN32
|
||||
gchar *uri = g_strconcat("file:///", g_path_skip_root(doc_list[idx].file_name), NULL);
|
||||
#else
|
||||
gchar *uri = g_strconcat("file://", doc_list[idx].file_name, NULL);
|
||||
#endif
|
||||
utils_start_browser(uri);
|
||||
g_free(uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
on_build_compile_activate(NULL, NULL);
|
||||
}
|
||||
on_build_compile_activate(NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1838,15 +1788,11 @@ on_build_compile_activate (GtkMenuItem *menuitem,
|
||||
|
||||
if (doc_list[idx].changed) document_save_file(idx);
|
||||
|
||||
switch (doc_list[idx].file_type->id)
|
||||
{
|
||||
case GEANY_FILETYPES_C: child_pid = build_compile_c_file(idx); break;
|
||||
case GEANY_FILETYPES_CPP: child_pid = build_compile_cpp_file(idx); break;
|
||||
case GEANY_FILETYPES_JAVA: child_pid = build_compile_java_file(idx); break;
|
||||
case GEANY_FILETYPES_PASCAL: child_pid = build_compile_pascal_file(idx); break;
|
||||
case GEANY_FILETYPES_TEX: child_pid = build_compile_tex_file(idx, 0); break;
|
||||
}
|
||||
|
||||
if (doc_list[idx].file_type->id == GEANY_FILETYPES_LATEX)
|
||||
child_pid = build_compile_tex_file(idx, 0);
|
||||
else
|
||||
child_pid = build_compile_file(idx);
|
||||
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
@ -1889,14 +1835,10 @@ on_build_build_activate (GtkMenuItem *menuitem,
|
||||
|
||||
if (doc_list[idx].changed) document_save_file(idx);
|
||||
|
||||
switch (doc_list[idx].file_type->id)
|
||||
{
|
||||
case GEANY_FILETYPES_C: child_pid = build_link_c_file(idx); break;
|
||||
case GEANY_FILETYPES_CPP: child_pid = build_link_cpp_file(idx); break;
|
||||
/* FIXME: temporary switch to catch F5-shortcut pressed on LaTeX files, as long as
|
||||
* LaTeX build menu has no key accelerator */
|
||||
case GEANY_FILETYPES_TEX: child_pid = build_compile_tex_file(idx, 1); break;
|
||||
}
|
||||
if (doc_list[idx].file_type->id == GEANY_FILETYPES_LATEX)
|
||||
child_pid = build_compile_tex_file(idx, 1);
|
||||
else
|
||||
child_pid = build_link_file(idx);
|
||||
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
@ -1922,7 +1864,7 @@ on_build_make_activate (GtkMenuItem *menuitem,
|
||||
|
||||
if (doc_list[idx].changed) document_save_file(idx);
|
||||
|
||||
child_pid = build_make_c_file(idx, FALSE);
|
||||
child_pid = build_make_file(idx, FALSE);
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
@ -1938,24 +1880,18 @@ on_build_execute_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
|
||||
/* FIXME: temporary switch to catch F5-shortcut pressed on LaTeX files, as long as
|
||||
* LaTeX build menu has no key accelerator */
|
||||
switch (doc_list[idx].file_type->id)
|
||||
if (doc_list[idx].file_type->id == GEANY_FILETYPES_LATEX)
|
||||
{
|
||||
case GEANY_FILETYPES_TEX:
|
||||
if (build_view_tex_file(idx, 0) == (GPid) 0)
|
||||
{
|
||||
if (build_view_tex_file(idx, 0) == (GPid) 0)
|
||||
{
|
||||
msgwin_status_add(_("Failed to execute the DVI view program"));
|
||||
}
|
||||
break;
|
||||
msgwin_status_add(_("Failed to execute the view program"));
|
||||
}
|
||||
default:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (build_run_cmd(idx) == (GPid) 0)
|
||||
{
|
||||
if (build_run_cmd(idx) == (GPid) 0)
|
||||
{
|
||||
msgwin_status_add(_("Failed to execute the terminal program"));
|
||||
}
|
||||
msgwin_status_add(_("Failed to execute the terminal program"));
|
||||
}
|
||||
}
|
||||
//gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci));
|
||||
@ -1966,7 +1902,7 @@ void
|
||||
on_build_arguments_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
dialogs_show_includes_arguments_gen(GPOINTER_TO_INT(user_data));
|
||||
dialogs_show_includes_arguments_gen();
|
||||
}
|
||||
|
||||
|
||||
@ -1992,7 +1928,7 @@ on_make_target_dialog_response (GtkDialog *dialog,
|
||||
|
||||
strncpy(app->build_make_custopt, gtk_entry_get_text(GTK_ENTRY(user_data)), 255);
|
||||
|
||||
child_pid = build_make_c_file(idx, TRUE);
|
||||
child_pid = build_make_file(idx, TRUE);
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
@ -2479,15 +2415,26 @@ on_includes_arguments_dialog_response (GtkDialog *dialog,
|
||||
{
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
if (app->build_args_inc) g_free(app->build_args_inc);
|
||||
app->build_args_inc = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry1"))));
|
||||
if (app->build_args_libs) g_free(app->build_args_libs);
|
||||
app->build_args_libs = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry2"))));
|
||||
if (app->build_args_prog) g_free(app->build_args_prog);
|
||||
app->build_args_prog = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry3"))));
|
||||
filetype *ft = doc_list[GPOINTER_TO_INT(user_data)].file_type;
|
||||
|
||||
if (ft->menu_items->can_compile)
|
||||
{
|
||||
if (ft->programs->compiler) g_free(ft->programs->compiler);
|
||||
ft->programs->compiler = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry1"))));
|
||||
}
|
||||
if (ft->menu_items->can_link)
|
||||
{
|
||||
if (ft->programs->linker) g_free(ft->programs->linker);
|
||||
ft->programs->linker = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry2"))));
|
||||
}
|
||||
if (ft->menu_items->can_exec)
|
||||
{
|
||||
if (ft->programs->run_cmd) g_free(ft->programs->run_cmd);
|
||||
ft->programs->run_cmd = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "includes_entry3"))));
|
||||
}
|
||||
}
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
}
|
||||
@ -2500,17 +2447,19 @@ on_includes_arguments_tex_dialog_response (GtkDialog *dialog,
|
||||
{
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
if (app->build_tex_dvi_cmd) g_free(app->build_tex_dvi_cmd);
|
||||
app->build_tex_dvi_cmd = g_strdup(gtk_entry_get_text(
|
||||
filetype *ft = doc_list[GPOINTER_TO_INT(user_data)].file_type;
|
||||
|
||||
if (ft->programs->compiler) g_free(ft->programs->compiler);
|
||||
ft->programs->compiler = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "tex_entry1"))));
|
||||
if (app->build_tex_pdf_cmd) g_free(app->build_tex_pdf_cmd);
|
||||
app->build_tex_pdf_cmd = g_strdup(gtk_entry_get_text(
|
||||
if (ft->programs->linker) g_free(ft->programs->linker);
|
||||
ft->programs->linker = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "tex_entry2"))));
|
||||
if (app->build_tex_view_dvi_cmd) g_free(app->build_tex_view_dvi_cmd);
|
||||
app->build_tex_view_dvi_cmd = g_strdup(gtk_entry_get_text(
|
||||
if (ft->programs->run_cmd) g_free(ft->programs->run_cmd);
|
||||
ft->programs->run_cmd = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "tex_entry3"))));
|
||||
if (app->build_tex_view_pdf_cmd) g_free(app->build_tex_view_pdf_cmd);
|
||||
app->build_tex_view_pdf_cmd = g_strdup(gtk_entry_get_text(
|
||||
if (ft->programs->run_cmd2) g_free(ft->programs->run_cmd2);
|
||||
ft->programs->run_cmd2 = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(lookup_widget(GTK_WIDGET(dialog), "tex_entry4"))));
|
||||
}
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
@ -2522,7 +2471,11 @@ on_recent_file_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gchar *locale_filename = g_locale_from_utf8((gchar*) user_data, -1, NULL, NULL, NULL);
|
||||
|
||||
if (locale_filename == NULL) locale_filename = g_strdup((gchar*) user_data);
|
||||
|
||||
document_open_file(-1, locale_filename, 0, FALSE, NULL);
|
||||
|
||||
g_free(locale_filename);
|
||||
}
|
||||
|
||||
@ -2571,3 +2524,10 @@ on_menu_unfold_all1_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_run_button_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
on_build_execute_activate(NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -564,3 +564,7 @@ on_entry_goto_line_activate (GtkEntry *entry,
|
||||
void
|
||||
on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_run_button_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data);
|
||||
|
871
src/dialogs.c
871
src/dialogs.c
File diff suppressed because it is too large
Load Diff
@ -26,29 +26,13 @@
|
||||
#ifndef GEANY_DIALOGS_H
|
||||
#define GEANY_DIALOGS_H 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item_compile;
|
||||
GtkWidget *item_link;
|
||||
GtkWidget *item_exec;
|
||||
} build_menus_items;
|
||||
build_menus_items dialogs_build_menus_items;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
build_menus_items menu_c;
|
||||
build_menus_items menu_tex;
|
||||
build_menus_items menu_misc;
|
||||
} build_menus;
|
||||
build_menus dialogs_build_menus;
|
||||
|
||||
|
||||
/* This shows the file selection dialog to open a file. */
|
||||
void dialogs_show_open_file (void);
|
||||
void dialogs_show_open_file(void);
|
||||
|
||||
/* This shows the file selection dialog to save a file. */
|
||||
void dialogs_show_save_as ();
|
||||
void dialogs_show_save_as();
|
||||
|
||||
void dialogs_show_file_open_error(void);
|
||||
|
||||
@ -60,10 +44,6 @@ void dialogs_show_error(const gchar *text, ...);
|
||||
|
||||
gboolean dialogs_show_fifo_error(const gchar *text, ...);
|
||||
|
||||
gboolean dialogs_show_reload_warning(const gchar *text);
|
||||
|
||||
gboolean dialogs_show_confirm_exit(void);
|
||||
|
||||
gboolean dialogs_show_unsaved_file(gint idx);
|
||||
|
||||
/* This shows the font selection dialog to choose a font. */
|
||||
@ -75,9 +55,9 @@ void dialogs_show_word_count(void);
|
||||
|
||||
void dialogs_show_color(void);
|
||||
|
||||
GtkWidget *dialogs_create_build_menu_gen(gboolean link, gboolean execute, build_menus_items *type);
|
||||
GtkWidget *dialogs_create_build_menu_gen(gint idx);
|
||||
|
||||
GtkWidget *dialogs_create_build_menu_tex(build_menus_items *type);
|
||||
GtkWidget *dialogs_create_build_menu_tex(gint idx);
|
||||
|
||||
void dialogs_show_make_target(void);
|
||||
|
||||
@ -87,7 +67,7 @@ void dialogs_show_replace(void);
|
||||
|
||||
void dialogs_show_goto_line(void);
|
||||
|
||||
void dialogs_show_includes_arguments_gen(gboolean link);
|
||||
void dialogs_show_includes_arguments_gen(void);
|
||||
|
||||
void dialogs_show_includes_arguments_tex(void);
|
||||
|
||||
@ -99,4 +79,8 @@ gboolean dialogs_show_mkcfgdir_error(gint error_nr);
|
||||
|
||||
void dialogs_show_file_properties(gint idx);
|
||||
|
||||
void dialogs_show_prefs_dialog(void);
|
||||
|
||||
gboolean dialogs_show_question(const gchar *text, ...);
|
||||
|
||||
#endif
|
||||
|
154
src/document.c
154
src/document.c
@ -95,7 +95,7 @@ gint document_find_by_sci(ScintillaObject *sci)
|
||||
/* returns the index of the given notebook page in the document list */
|
||||
gint document_get_n_idx(guint page_num)
|
||||
{
|
||||
if (page_num < 0 || page_num >= GEANY_MAX_OPEN_FILES) return -1;
|
||||
if (page_num >= GEANY_MAX_OPEN_FILES) return -1;
|
||||
|
||||
ScintillaObject *sci = (ScintillaObject*)gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->notebook), page_num);
|
||||
@ -193,6 +193,7 @@ gint document_create_new_sci(const gchar *filename)
|
||||
{
|
||||
ScintillaObject *sci;
|
||||
GtkWidget *hbox, *but;
|
||||
GtkWidget *align;
|
||||
PangoFontDescription *pfd;
|
||||
gchar *title, *fname;
|
||||
document this;
|
||||
@ -209,18 +210,21 @@ gint document_create_new_sci(const gchar *filename)
|
||||
gtk_container_set_border_width(GTK_CONTAINER(but), 0);
|
||||
gtk_widget_set_size_request(but, 17, 15);
|
||||
|
||||
align = gtk_alignment_new(1.0, 0.0, 0.0, 0.0);
|
||||
gtk_container_add(GTK_CONTAINER(align), but);
|
||||
|
||||
gtk_button_set_relief(GTK_BUTTON(but), GTK_RELIEF_NONE);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), this.tab_label, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), align, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all(hbox);
|
||||
|
||||
/* SCI - Code */
|
||||
sci = SCINTILLA(scintilla_new());
|
||||
scintilla_set_id(sci, new_idx);
|
||||
#ifdef GEANY_WIN32
|
||||
sci_set_codepage(sci, 0);
|
||||
sci_set_codepage(sci, 0);
|
||||
#else
|
||||
sci_set_codepage(sci, SC_CP_UTF8);
|
||||
sci_set_codepage(sci, SC_CP_UTF8);
|
||||
#endif
|
||||
//SSM(sci, SCI_SETWRAPSTARTINDENT, 4, 0);
|
||||
// disable scintilla provided popup menu
|
||||
@ -244,8 +248,19 @@ gint document_create_new_sci(const gchar *filename)
|
||||
gtk_widget_show(GTK_WIDGET(sci));
|
||||
|
||||
this.tabmenu_label = gtk_label_new(title);
|
||||
gtk_notebook_insert_page_menu(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(sci), hbox, this.tabmenu_label, 0);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), 0);
|
||||
if (app->tab_order_ltr)
|
||||
{
|
||||
gint npage;
|
||||
npage = gtk_notebook_append_page_menu(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(sci),
|
||||
hbox, this.tabmenu_label);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), npage);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_notebook_insert_page_menu(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(sci), hbox,
|
||||
this.tabmenu_label, 0);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), 0);
|
||||
}
|
||||
iter = treeviews_openfiles_add(new_idx, title);
|
||||
g_free(title);
|
||||
|
||||
@ -253,11 +268,14 @@ gint document_create_new_sci(const gchar *filename)
|
||||
this.tag_tree = NULL;
|
||||
|
||||
// "the" SCI signal
|
||||
g_signal_connect((GtkWidget*) sci, "sci-notify", G_CALLBACK(on_editor_notification), GINT_TO_POINTER(new_idx));
|
||||
g_signal_connect((GtkWidget*) sci, "sci-notify",
|
||||
G_CALLBACK(on_editor_notification), GINT_TO_POINTER(new_idx));
|
||||
// signal for insert-key(works without too, but to update the right status bar)
|
||||
g_signal_connect((GtkWidget*) sci, "key-press-event", G_CALLBACK(on_editor_key_press_event), GINT_TO_POINTER(new_idx));
|
||||
g_signal_connect((GtkWidget*) sci, "key-press-event",
|
||||
G_CALLBACK(on_editor_key_press_event), GINT_TO_POINTER(new_idx));
|
||||
// signal for the popup menu
|
||||
g_signal_connect((GtkWidget*) sci, "button-press-event", G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
|
||||
g_signal_connect((GtkWidget*) sci, "button-press-event",
|
||||
G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
|
||||
// signal for clicking the tab-close button
|
||||
g_signal_connect(G_OBJECT(but), "clicked", G_CALLBACK(on_tab_close_clicked), sci);
|
||||
|
||||
@ -312,6 +330,7 @@ gboolean document_remove(guint page_num)
|
||||
doc_list[idx].sci = NULL;
|
||||
doc_list[idx].file_name = NULL;
|
||||
doc_list[idx].file_type = NULL;
|
||||
doc_list[idx].encoding = NULL;
|
||||
doc_list[idx].tm_file = NULL;
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
{
|
||||
@ -341,6 +360,7 @@ void document_new_file(filetype *ft)
|
||||
sci_set_text(doc_list[idx].sci, template);
|
||||
g_free(template);
|
||||
|
||||
doc_list[idx].encoding = g_strdup("UTF-8");
|
||||
document_set_filetype(idx, (ft) ? ft : filetypes[GEANY_FILETYPES_ALL]);
|
||||
utils_set_window_title(idx);
|
||||
utils_build_show_hide(idx);
|
||||
@ -378,9 +398,9 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
GError *err = NULL;
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) && defined(HAVE_FCNTL_H)
|
||||
gint fd;
|
||||
void *map;
|
||||
void *map = NULL;
|
||||
#else
|
||||
gchar *map;
|
||||
gchar *map = NULL;
|
||||
#endif
|
||||
//struct timeval tv, tv1;
|
||||
//struct timezone tz;
|
||||
@ -393,13 +413,22 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
}
|
||||
else
|
||||
{
|
||||
// filename must not be NULL when it is a new file
|
||||
if (filename == NULL)
|
||||
{
|
||||
msgwin_status_add(_("Invalid filename"));
|
||||
return;
|
||||
}
|
||||
|
||||
// try to get the UTF-8 equivalent for the filename, fallback to filename if error
|
||||
locale_filename = g_strdup(filename);
|
||||
utf8_filename = g_locale_to_utf8(locale_filename, -1, NULL, NULL, &err);
|
||||
if (utf8_filename == NULL)
|
||||
{
|
||||
msgwin_status_add("Invalid filename (%s)", err->message);
|
||||
if (err != NULL) msgwin_status_add("%s (%s)", _("Invalid filename"), err->message);
|
||||
else msgwin_status_add(_("Invalid filename"));
|
||||
utf8_filename = g_strdup(locale_filename);
|
||||
g_error_free(err);
|
||||
err = NULL; // set to NULL for further usage
|
||||
}
|
||||
|
||||
@ -431,7 +460,8 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
g_free(locale_filename);
|
||||
return;
|
||||
}
|
||||
if ((map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED)
|
||||
/// EXPERIMENTAL map is NULL if size is 0, I hope this works in all cases
|
||||
if ((st.st_size > 0) && ((map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED))
|
||||
{
|
||||
msgwin_status_add(_("Could not open file %s (%s)"), utf8_filename, g_strerror(errno));
|
||||
g_free(utf8_filename);
|
||||
@ -444,6 +474,7 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
if (! g_file_get_contents(utf8_filename, &map, NULL, &err))
|
||||
{
|
||||
msgwin_status_add(_("Could not open file %s (%s)"), utf8_filename, err->message);
|
||||
g_error_free(err);
|
||||
g_free(utf8_filename);
|
||||
g_free(locale_filename);
|
||||
return;
|
||||
@ -478,17 +509,21 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
}
|
||||
else
|
||||
{
|
||||
map = converted_text;
|
||||
map = (void*)converted_text;
|
||||
size = strlen(converted_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
enc = g_strdup("UTF-8");
|
||||
}
|
||||
|
||||
if (! reload) idx = document_create_new_sci(utf8_filename);
|
||||
|
||||
// sets editor mode and add the text to the ScintillaObject
|
||||
sci_add_text_buffer(doc_list[idx].sci, map, size);
|
||||
editor_mode = utils_get_line_endings(map, size);
|
||||
editor_mode = utils_get_line_endings(map, size);
|
||||
sci_set_eol_mode(doc_list[idx].sci, editor_mode);
|
||||
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
@ -507,6 +542,7 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
else
|
||||
{
|
||||
filetype *use_ft = (ft != NULL) ? ft : filetypes_get_from_filename(utf8_filename);
|
||||
|
||||
sci_goto_pos(doc_list[idx].sci, pos, TRUE);
|
||||
//if (app->main_window_realized) // avoids warnings, but doesn't scroll, so accept warning
|
||||
sci_scroll_to_line(doc_list[idx].sci, sci_get_line_from_position(doc_list[idx].sci, pos) - 10);
|
||||
@ -519,7 +555,8 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
utf8_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)),
|
||||
(readonly) ? _(", read-only") : "");
|
||||
}
|
||||
utils_update_tag_list(idx, TRUE);
|
||||
//utils_update_tag_list(idx, TRUE);
|
||||
document_update_tag_list(idx);
|
||||
document_set_text_changed(idx);
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) && defined(HAVE_FCNTL_H)
|
||||
@ -622,7 +659,7 @@ void document_save_file(gint idx)
|
||||
gtk_label_set_text(GTK_LABEL(doc_list[idx].tabmenu_label), basename);
|
||||
treeviews_openfiles_update(doc_list[idx].iter, doc_list[idx].file_name);
|
||||
msgwin_status_add(_("File %s saved."), doc_list[idx].file_name);
|
||||
utils_update_statusbar(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
treeviews_openfiles_update(doc_list[idx].iter, basename);
|
||||
g_free(basename);
|
||||
}
|
||||
@ -875,64 +912,55 @@ void document_update_tag_list(gint idx)
|
||||
/* sets the filetype of the the document (sets syntax highlighting and tagging) */
|
||||
void document_set_filetype(gint idx, filetype *type)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (! type || idx < 0) return;
|
||||
if (type->id > GEANY_MAX_FILE_TYPES) return;
|
||||
|
||||
for(i = 0; i < GEANY_MAX_FILE_TYPES; i++)
|
||||
doc_list[idx].file_type = type;
|
||||
document_update_tag_list(idx);
|
||||
type->style_func_ptr(doc_list[idx].sci);
|
||||
|
||||
// For C/C++/Java files, get list of typedefs for colourising
|
||||
if (sci_get_lexer(doc_list[idx].sci) == SCLEX_CPP)
|
||||
{
|
||||
if (filetypes[i] && type == filetypes[i])
|
||||
guint j, n;
|
||||
|
||||
// assign project keywords
|
||||
if ((app->tm_workspace) && (app->tm_workspace->work_object.tags_array))
|
||||
{
|
||||
doc_list[idx].file_type = filetypes[i];
|
||||
document_update_tag_list(idx);
|
||||
filetypes[i]->style_func_ptr(doc_list[idx].sci);
|
||||
|
||||
/* For C/C++/Java files, get list of typedefs for colorizing */
|
||||
if (sci_get_lexer(doc_list[idx].sci) == SCLEX_CPP)
|
||||
{
|
||||
guint j, n;
|
||||
|
||||
/* assign project keywords */
|
||||
if ((app->tm_workspace) && (app->tm_workspace->work_object.tags_array))
|
||||
{
|
||||
GPtrArray *typedefs = tm_tags_extract(app->tm_workspace->work_object.tags_array,
|
||||
GPtrArray *typedefs = tm_tags_extract(app->tm_workspace->work_object.tags_array,
|
||||
tm_tag_typedef_t | tm_tag_struct_t | tm_tag_class_t);
|
||||
if ((typedefs) && (typedefs->len > 0))
|
||||
if ((typedefs) && (typedefs->len > 0))
|
||||
{
|
||||
GString *s = g_string_sized_new(typedefs->len * 10);
|
||||
for (j = 0; j < typedefs->len; ++j)
|
||||
{
|
||||
if (!(TM_TAG(typedefs->pdata[j])->atts.entry.scope))
|
||||
{
|
||||
GString *s = g_string_sized_new(typedefs->len * 10);
|
||||
for (j = 0; j < typedefs->len; ++j)
|
||||
if (TM_TAG(typedefs->pdata[j])->name)
|
||||
{
|
||||
if (!(TM_TAG(typedefs->pdata[j])->atts.entry.scope))
|
||||
{
|
||||
if (TM_TAG(typedefs->pdata[j])->name)
|
||||
{
|
||||
g_string_append(s, TM_TAG(typedefs->pdata[j])->name);
|
||||
g_string_append_c(s, ' ');
|
||||
}
|
||||
}
|
||||
g_string_append(s, TM_TAG(typedefs->pdata[j])->name);
|
||||
g_string_append_c(s, ' ');
|
||||
}
|
||||
for (n = 0; n < GEANY_MAX_OPEN_FILES; n++)
|
||||
{
|
||||
if (doc_list[n].sci)
|
||||
{
|
||||
sci_set_keywords(doc_list[n].sci, 3, s->str);
|
||||
sci_colourise(doc_list[n].sci, 0, -1);
|
||||
}
|
||||
}
|
||||
//SSM(doc_list[idx].sci, SCI_SETKEYWORDS, 3, (sptr_t) s->str);
|
||||
g_string_free(s, TRUE);
|
||||
}
|
||||
g_ptr_array_free(typedefs, TRUE);
|
||||
}
|
||||
for (n = 0; n < GEANY_MAX_OPEN_FILES; n++)
|
||||
{
|
||||
if (doc_list[n].sci)
|
||||
{
|
||||
sci_set_keywords(doc_list[n].sci, 3, s->str);
|
||||
sci_colourise(doc_list[n].sci, 0, -1);
|
||||
}
|
||||
}
|
||||
//SSM(doc_list[idx].sci, SCI_SETKEYWORDS, 3, (sptr_t) s->str);
|
||||
g_string_free(s, TRUE);
|
||||
}
|
||||
sci_colourise(doc_list[idx].sci, 0, -1);
|
||||
utils_build_show_hide(idx);
|
||||
geany_debug("%s : %s (%s)",
|
||||
(doc_list[idx].file_name) ? doc_list[idx].file_name : "(null)",
|
||||
filetypes[i]->name, doc_list[idx].encoding);
|
||||
break;
|
||||
g_ptr_array_free(typedefs, TRUE);
|
||||
}
|
||||
}
|
||||
sci_colourise(doc_list[idx].sci, 0, -1);
|
||||
utils_build_show_hide(idx);
|
||||
geany_debug("%s : %s (%s)", (doc_list[idx].file_name) ? doc_list[idx].file_name : "(null)",
|
||||
type->name, doc_list[idx].encoding);
|
||||
}
|
||||
|
||||
|
||||
|
300
src/filetypes.c
300
src/filetypes.c
@ -32,6 +32,12 @@
|
||||
#include "msgwindow.h"
|
||||
|
||||
|
||||
static void filetypes_create_menu_item(GtkWidget *menu, gchar *label, filetype *ftype);
|
||||
static void filetypes_create_newmenu_item(GtkWidget *menu, gchar *label, filetype *ftype);
|
||||
static void filetypes_init_build_programs(filetype *ftype);
|
||||
|
||||
|
||||
|
||||
/* inits the filetype array and fill it with the known filetypes
|
||||
* and create the filetype menu*/
|
||||
void filetypes_init_types(void)
|
||||
@ -39,75 +45,93 @@ void filetypes_init_types(void)
|
||||
GtkWidget *filetype_menu = lookup_widget(app->window, "set_filetype1_menu");
|
||||
GtkWidget *template_menu = lookup_widget(app->window, "menu_new_with_template1_menu");
|
||||
|
||||
filetypes[GEANY_FILETYPES_C] = g_new(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_C] = (filetype*)g_malloc(sizeof(filetype));
|
||||
#define C // these macros are only to ease navigation
|
||||
filetypes[GEANY_FILETYPES_C] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_C]->id = GEANY_FILETYPES_C;
|
||||
filetypes[GEANY_FILETYPES_C]->name = g_strdup("C");
|
||||
filetypes[GEANY_FILETYPES_C]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_C]->title = g_strdup(_("C source file"));
|
||||
filetypes[GEANY_FILETYPES_C]->extension = g_strdup("c");
|
||||
filetypes[GEANY_FILETYPES_C]->pattern = g_new(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_C]->pattern = g_new0(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_C]->pattern[0] = g_strdup("*.c");
|
||||
filetypes[GEANY_FILETYPES_C]->pattern[1] = g_strdup("*.h");
|
||||
filetypes[GEANY_FILETYPES_C]->pattern[2] = NULL;
|
||||
filetypes[GEANY_FILETYPES_C]->comment_open = g_strdup("/*");
|
||||
filetypes[GEANY_FILETYPES_C]->comment_close = g_strdup("*/");
|
||||
filetypes[GEANY_FILETYPES_C]->style_func_ptr = styleset_c;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_C]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_C]->title, filetypes[GEANY_FILETYPES_C]);
|
||||
filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_C]->title, filetypes[GEANY_FILETYPES_C]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_CPP] = g_new(filetype, 1);
|
||||
#define CPP
|
||||
filetypes[GEANY_FILETYPES_CPP] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_CPP]->id = GEANY_FILETYPES_CPP;
|
||||
filetypes[GEANY_FILETYPES_CPP]->name = g_strdup("C++");
|
||||
filetypes[GEANY_FILETYPES_CPP]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_CPP]->title = g_strdup(_("C++ source file"));
|
||||
filetypes[GEANY_FILETYPES_CPP]->extension = g_strdup("cpp");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern = g_new(gchar*, 9);
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern = g_new0(gchar*, 11);
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[0] = g_strdup("*.cpp");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[1] = g_strdup("*.cxx");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[2] = g_strdup("*.cc");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[3] = g_strdup("*.h");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[4] = g_strdup("*.hpp");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[5] = g_strdup("*.hxx");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[6] = g_strdup("*.hh");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[7] = g_strdup("*.C");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[8] = NULL;
|
||||
filetypes[GEANY_FILETYPES_CPP]->style_func_ptr = styleset_c;
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[2] = g_strdup("*.c++");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[3] = g_strdup("*.cc");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[4] = g_strdup("*.h");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[5] = g_strdup("*.hpp");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[6] = g_strdup("*.hxx");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[7] = g_strdup("*.h++");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[8] = g_strdup("*.hh");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[9] = g_strdup("*.C");
|
||||
filetypes[GEANY_FILETYPES_CPP]->pattern[10] = NULL;
|
||||
filetypes[GEANY_FILETYPES_CPP]->style_func_ptr = styleset_cpp;
|
||||
filetypes[GEANY_FILETYPES_CPP]->comment_open = g_strdup("//");
|
||||
filetypes[GEANY_FILETYPES_CPP]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_CPP]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_CPP]->title, filetypes[GEANY_FILETYPES_CPP]);
|
||||
filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_CPP]->title, filetypes[GEANY_FILETYPES_CPP]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_JAVA] = g_new(filetype, 1);
|
||||
#define JAVA
|
||||
filetypes[GEANY_FILETYPES_JAVA] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_JAVA]->id = GEANY_FILETYPES_JAVA;
|
||||
filetypes[GEANY_FILETYPES_JAVA]->name = g_strdup("Java");
|
||||
filetypes[GEANY_FILETYPES_JAVA]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_JAVA]->title = g_strdup(_("Java source file"));
|
||||
filetypes[GEANY_FILETYPES_JAVA]->extension = g_strdup("java");
|
||||
filetypes[GEANY_FILETYPES_JAVA]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_JAVA]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_JAVA]->pattern[0] = g_strdup("*.java");
|
||||
filetypes[GEANY_FILETYPES_JAVA]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_JAVA]->comment_open = g_strdup("/*");
|
||||
filetypes[GEANY_FILETYPES_JAVA]->comment_close = g_strdup("*/");
|
||||
filetypes[GEANY_FILETYPES_JAVA]->style_func_ptr = styleset_java;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_JAVA]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_JAVA]->title, filetypes[GEANY_FILETYPES_JAVA]);
|
||||
filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_JAVA]->title, filetypes[GEANY_FILETYPES_JAVA]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_PERL] = g_new(filetype, 1);
|
||||
#define PERL
|
||||
filetypes[GEANY_FILETYPES_PERL] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_PERL]->id = GEANY_FILETYPES_PERL;
|
||||
filetypes[GEANY_FILETYPES_PERL]->name = g_strdup("Perl");
|
||||
filetypes[GEANY_FILETYPES_PERL]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_PERL]->title = g_strdup(_("Perl source file"));
|
||||
filetypes[GEANY_FILETYPES_PERL]->extension = g_strdup("perl");
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern = g_new(gchar*, 4);
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern = g_new0(gchar*, 4);
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern[0] = g_strdup("*.pl");
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern[1] = g_strdup("*.perl");
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern[2] = g_strdup("*.pm");
|
||||
filetypes[GEANY_FILETYPES_PERL]->pattern[3] = NULL;
|
||||
filetypes[GEANY_FILETYPES_PERL]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_PERL]->comment_close = NULL;
|
||||
filetypes[GEANY_FILETYPES_PERL]->style_func_ptr = styleset_perl;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_PERL]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_PERL]->title, filetypes[GEANY_FILETYPES_PERL]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_PHP] = g_new(filetype, 1);
|
||||
#define PHP
|
||||
filetypes[GEANY_FILETYPES_PHP] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_PHP]->id = GEANY_FILETYPES_PHP;
|
||||
filetypes[GEANY_FILETYPES_PHP]->name = g_strdup("PHP");
|
||||
filetypes[GEANY_FILETYPES_PHP]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_PHP]->title = g_strdup(_("PHP / HTML source file"));
|
||||
filetypes[GEANY_FILETYPES_PHP]->extension = g_strdup("php");
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern = g_new(gchar*, 7);
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern = g_new0(gchar*, 7);
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern[0] = g_strdup("*.php");
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern[1] = g_strdup("*.php3");
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern[2] = g_strdup("*.php4");
|
||||
@ -116,68 +140,88 @@ void filetypes_init_types(void)
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern[5] = g_strdup("*.htm");
|
||||
filetypes[GEANY_FILETYPES_PHP]->pattern[6] = NULL;
|
||||
filetypes[GEANY_FILETYPES_PHP]->style_func_ptr = styleset_php;
|
||||
filetypes[GEANY_FILETYPES_PHP]->comment_open = g_strdup("//");
|
||||
filetypes[GEANY_FILETYPES_PHP]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_PHP]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_PHP]->title, filetypes[GEANY_FILETYPES_PHP]);
|
||||
filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_PHP]->title, filetypes[GEANY_FILETYPES_PHP]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_XML] = g_new(filetype, 1);
|
||||
#define XML
|
||||
filetypes[GEANY_FILETYPES_XML] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_XML]->id = GEANY_FILETYPES_XML;
|
||||
filetypes[GEANY_FILETYPES_XML]->name = g_strdup("XML");
|
||||
filetypes[GEANY_FILETYPES_XML]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_XML]->title = g_strdup(_("XML source file"));
|
||||
filetypes[GEANY_FILETYPES_XML]->extension = g_strdup("xml");
|
||||
filetypes[GEANY_FILETYPES_XML]->pattern = g_new(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_XML]->pattern = g_new0(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_XML]->pattern[0] = g_strdup("*.xml");
|
||||
filetypes[GEANY_FILETYPES_XML]->pattern[1] = g_strdup("*.sgml");
|
||||
filetypes[GEANY_FILETYPES_XML]->pattern[2] = NULL;
|
||||
filetypes[GEANY_FILETYPES_XML]->style_func_ptr = styleset_xml;
|
||||
filetypes[GEANY_FILETYPES_XML]->comment_open = g_strdup("<!--");
|
||||
filetypes[GEANY_FILETYPES_XML]->comment_close = g_strdup("-->");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_XML]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_XML]->title, filetypes[GEANY_FILETYPES_XML]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK] = g_new(filetype, 1);
|
||||
#define DOCBOOK
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->id = GEANY_FILETYPES_DOCBOOK;
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->name = g_strdup("Docbook");
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->title = g_strdup(_("Docbook source file"));
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->extension = g_strdup("docbook");
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->pattern[0] = g_strdup("*.docbook");
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->style_func_ptr = styleset_docbook;
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->comment_open = g_strdup("<!--");
|
||||
filetypes[GEANY_FILETYPES_DOCBOOK]->comment_close = g_strdup("-->");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_DOCBOOK]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_DOCBOOK]->title, filetypes[GEANY_FILETYPES_DOCBOOK]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_PYTHON] = g_new(filetype, 1);
|
||||
#define PYTHON
|
||||
filetypes[GEANY_FILETYPES_PYTHON] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->id = GEANY_FILETYPES_PYTHON;
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->name = g_strdup("Python");
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->title = g_strdup(_("Python source file"));
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->extension = g_strdup("py");
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->pattern = g_new(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->pattern = g_new0(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->pattern[0] = g_strdup("*.py");
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->pattern[1] = g_strdup("*.pyw");
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->pattern[2] = NULL;
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->style_func_ptr = styleset_python;
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_PYTHON]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_PYTHON]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_PYTHON]->title, filetypes[GEANY_FILETYPES_PYTHON]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_TEX] = g_new(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_TEX]->id = GEANY_FILETYPES_TEX;
|
||||
filetypes[GEANY_FILETYPES_TEX]->name = g_strdup("Tex");
|
||||
filetypes[GEANY_FILETYPES_TEX]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_TEX]->title = g_strdup(_("LaTex source file"));
|
||||
filetypes[GEANY_FILETYPES_TEX]->extension = g_strdup("tex");
|
||||
filetypes[GEANY_FILETYPES_TEX]->pattern = g_new(gchar*, 4);
|
||||
filetypes[GEANY_FILETYPES_TEX]->pattern[0] = g_strdup("*.tex");
|
||||
filetypes[GEANY_FILETYPES_TEX]->pattern[1] = g_strdup("*.sty");
|
||||
filetypes[GEANY_FILETYPES_TEX]->pattern[2] = g_strdup("*.idx");
|
||||
filetypes[GEANY_FILETYPES_TEX]->pattern[3] = NULL;
|
||||
filetypes[GEANY_FILETYPES_TEX]->style_func_ptr = styleset_tex;
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_TEX]->title, filetypes[GEANY_FILETYPES_TEX]);
|
||||
#define LATEX
|
||||
filetypes[GEANY_FILETYPES_LATEX] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_LATEX]->id = GEANY_FILETYPES_LATEX;
|
||||
filetypes[GEANY_FILETYPES_LATEX]->name = g_strdup("LaTeX");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_LATEX]->title = g_strdup(_("LaTeX source file"));
|
||||
filetypes[GEANY_FILETYPES_LATEX]->extension = g_strdup("tex");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->pattern = g_new0(gchar*, 4);
|
||||
filetypes[GEANY_FILETYPES_LATEX]->pattern[0] = g_strdup("*.tex");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->pattern[1] = g_strdup("*.sty");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->pattern[2] = g_strdup("*.idx");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->pattern[3] = NULL;
|
||||
filetypes[GEANY_FILETYPES_LATEX]->style_func_ptr = styleset_latex;
|
||||
filetypes[GEANY_FILETYPES_LATEX]->comment_open = g_strdup("%");
|
||||
filetypes[GEANY_FILETYPES_LATEX]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_LATEX]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_LATEX]->title, filetypes[GEANY_FILETYPES_LATEX]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_PASCAL] = g_new(filetype, 1);
|
||||
#define PASCAL
|
||||
filetypes[GEANY_FILETYPES_PASCAL] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->id = GEANY_FILETYPES_PASCAL;
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->name = g_strdup("Pascal");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->title = g_strdup(_("Pascal source file"));
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->extension = g_strdup("pas");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern = g_new(gchar*, 6);
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern = g_new0(gchar*, 6);
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern[0] = g_strdup("*.pas");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern[1] = g_strdup("*.pp");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern[2] = g_strdup("*.inc");
|
||||
@ -185,128 +229,176 @@ void filetypes_init_types(void)
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern[4] = g_strdup("*.dpk");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->pattern[5] = NULL;
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->style_func_ptr = styleset_pascal;
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->comment_open = g_strdup("{");
|
||||
filetypes[GEANY_FILETYPES_PASCAL]->comment_close = g_strdup("}");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_PASCAL]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_PASCAL]->title, filetypes[GEANY_FILETYPES_PASCAL]);
|
||||
filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_PASCAL]->title, filetypes[GEANY_FILETYPES_PASCAL]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_SH] = g_new(filetype, 1);
|
||||
#define SH
|
||||
filetypes[GEANY_FILETYPES_SH] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_SH]->id = GEANY_FILETYPES_SH;
|
||||
filetypes[GEANY_FILETYPES_SH]->name = g_strdup("Sh");
|
||||
filetypes[GEANY_FILETYPES_SH]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_SH]->title = g_strdup(_("Shell script file"));
|
||||
filetypes[GEANY_FILETYPES_SH]->extension = g_strdup("sh");
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern = g_new(gchar*, 5);
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern = g_new0(gchar*, 5);
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern[0] = g_strdup("*.sh");
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern[1] = g_strdup("configure");
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern[2] = g_strdup("*.ksh");
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern[3] = g_strdup("*.zsh");
|
||||
filetypes[GEANY_FILETYPES_SH]->pattern[4] = NULL;
|
||||
filetypes[GEANY_FILETYPES_SH]->style_func_ptr = styleset_sh;
|
||||
filetypes[GEANY_FILETYPES_SH]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_SH]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_SH]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_SH]->title, filetypes[GEANY_FILETYPES_SH]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_MAKE] = g_new(filetype, 1);
|
||||
#define MAKE
|
||||
filetypes[GEANY_FILETYPES_MAKE] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_MAKE]->id = GEANY_FILETYPES_MAKE;
|
||||
filetypes[GEANY_FILETYPES_MAKE]->name = g_strdup("Make");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_MAKE]->title = g_strdup(_("Makefile"));
|
||||
filetypes[GEANY_FILETYPES_MAKE]->extension = g_strdup("mak");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern = g_new(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern[0] = g_strdup("Makefile*");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern[1] = g_strdup("*.mak");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern = g_new0(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern[0] = g_strdup("*.mak");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern[1] = g_strdup("Makefile*");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->pattern[2] = NULL;
|
||||
filetypes[GEANY_FILETYPES_MAKE]->style_func_ptr = styleset_makefile;
|
||||
filetypes[GEANY_FILETYPES_MAKE]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_MAKE]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_MAKE]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_MAKE]->title, filetypes[GEANY_FILETYPES_MAKE]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_CSS] = g_new(filetype, 1);
|
||||
#define CSS
|
||||
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]->title = g_strdup(_("Cascading StyleSheet"));
|
||||
filetypes[GEANY_FILETYPES_CSS]->extension = g_strdup("css");
|
||||
filetypes[GEANY_FILETYPES_CSS]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_CSS]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_CSS]->pattern[0] = g_strdup("*.css");
|
||||
filetypes[GEANY_FILETYPES_CSS]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_CSS]->style_func_ptr = styleset_css;
|
||||
filetypes[GEANY_FILETYPES_CSS]->comment_open = g_strdup("/*");
|
||||
filetypes[GEANY_FILETYPES_CSS]->comment_close = g_strdup("*/");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_CSS]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_CSS]->title, filetypes[GEANY_FILETYPES_CSS]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_CONF] = g_new(filetype, 1);
|
||||
#define CONF
|
||||
filetypes[GEANY_FILETYPES_CONF] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_CONF]->id = GEANY_FILETYPES_CONF;
|
||||
filetypes[GEANY_FILETYPES_CONF]->name = g_strdup("Conf");
|
||||
filetypes[GEANY_FILETYPES_CONF]->has_tags = TRUE;
|
||||
filetypes[GEANY_FILETYPES_CONF]->title = g_strdup(_("Config file"));
|
||||
filetypes[GEANY_FILETYPES_CONF]->extension = g_strdup("conf");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern = g_new(gchar*, 5);
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[0] = g_strdup("*.ini");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[1] = g_strdup("*.conf");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern = g_new0(gchar*, 5);
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[0] = g_strdup("*.conf");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[1] = g_strdup("*.ini");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[2] = g_strdup("config");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[3] = g_strdup("*rc");
|
||||
filetypes[GEANY_FILETYPES_CONF]->pattern[4] = NULL;
|
||||
filetypes[GEANY_FILETYPES_CONF]->style_func_ptr = styleset_conf;
|
||||
filetypes[GEANY_FILETYPES_CONF]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_CONF]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_CONF]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_CONF]->title, filetypes[GEANY_FILETYPES_CONF]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_ASM] = g_new(filetype, 1);
|
||||
#define ASM
|
||||
filetypes[GEANY_FILETYPES_ASM] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_ASM]->id = GEANY_FILETYPES_ASM;
|
||||
filetypes[GEANY_FILETYPES_ASM]->name = g_strdup("ASM");
|
||||
filetypes[GEANY_FILETYPES_ASM]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_ASM]->title = g_strdup(_("Assembler source file"));
|
||||
filetypes[GEANY_FILETYPES_ASM]->extension = g_strdup("asm");
|
||||
filetypes[GEANY_FILETYPES_ASM]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_ASM]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_ASM]->pattern[0] = g_strdup("*.asm");
|
||||
filetypes[GEANY_FILETYPES_ASM]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_ASM]->style_func_ptr = styleset_asm;
|
||||
filetypes[GEANY_FILETYPES_ASM]->comment_open = g_strdup(";");
|
||||
filetypes[GEANY_FILETYPES_ASM]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_ASM]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_ASM]->title, filetypes[GEANY_FILETYPES_ASM]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_SQL] = g_new(filetype, 1);
|
||||
#define SQL
|
||||
filetypes[GEANY_FILETYPES_SQL] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_SQL]->id = GEANY_FILETYPES_SQL;
|
||||
filetypes[GEANY_FILETYPES_SQL]->name = g_strdup("SQL");
|
||||
filetypes[GEANY_FILETYPES_SQL]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_SQL]->title = g_strdup(_("SQL Dump file"));
|
||||
filetypes[GEANY_FILETYPES_SQL]->extension = g_strdup("sql");
|
||||
filetypes[GEANY_FILETYPES_SQL]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_SQL]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_SQL]->pattern[0] = g_strdup("*.sql");
|
||||
filetypes[GEANY_FILETYPES_SQL]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_SQL]->style_func_ptr = styleset_sql;
|
||||
filetypes[GEANY_FILETYPES_SQL]->comment_open = g_strdup("/*");
|
||||
filetypes[GEANY_FILETYPES_SQL]->comment_close = g_strdup("*/");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_SQL]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_SQL]->title, filetypes[GEANY_FILETYPES_SQL]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_CAML] = g_new(filetype, 1);
|
||||
#define CAML
|
||||
filetypes[GEANY_FILETYPES_CAML] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_CAML]->id = GEANY_FILETYPES_CAML;
|
||||
filetypes[GEANY_FILETYPES_CAML]->name = g_strdup("CAML");
|
||||
filetypes[GEANY_FILETYPES_CAML]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_CAML]->title = g_strdup(_("(O)Caml source file"));
|
||||
filetypes[GEANY_FILETYPES_CAML]->extension = g_strdup("ml");
|
||||
filetypes[GEANY_FILETYPES_CAML]->pattern = g_new(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_CAML]->pattern = g_new0(gchar*, 3);
|
||||
filetypes[GEANY_FILETYPES_CAML]->pattern[0] = g_strdup("*.ml");
|
||||
filetypes[GEANY_FILETYPES_CAML]->pattern[1] = g_strdup("*.mli");
|
||||
filetypes[GEANY_FILETYPES_CAML]->pattern[2] = NULL;
|
||||
filetypes[GEANY_FILETYPES_CAML]->style_func_ptr = styleset_caml;
|
||||
filetypes[GEANY_FILETYPES_CAML]->comment_open = g_strdup("(*");
|
||||
filetypes[GEANY_FILETYPES_CAML]->comment_close = g_strdup("*)");
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_CAML]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_CAML]->title, filetypes[GEANY_FILETYPES_CAML]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_OMS] = g_new(filetype, 1);
|
||||
#define OMS
|
||||
filetypes[GEANY_FILETYPES_OMS] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_OMS]->id = GEANY_FILETYPES_OMS;
|
||||
filetypes[GEANY_FILETYPES_OMS]->name = g_strdup("O-Matrix");
|
||||
filetypes[GEANY_FILETYPES_OMS]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_OMS]->title = g_strdup(_("O-Matrix source file"));
|
||||
filetypes[GEANY_FILETYPES_OMS]->extension = g_strdup("oms");
|
||||
filetypes[GEANY_FILETYPES_OMS]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_OMS]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_OMS]->pattern[0] = g_strdup("*.oms");
|
||||
filetypes[GEANY_FILETYPES_OMS]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_OMS]->style_func_ptr = styleset_oms;
|
||||
filetypes[GEANY_FILETYPES_OMS]->comment_open = g_strdup("#");
|
||||
filetypes[GEANY_FILETYPES_OMS]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_OMS]);
|
||||
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_OMS]->title, filetypes[GEANY_FILETYPES_OMS]);
|
||||
|
||||
filetypes[GEANY_FILETYPES_ALL] = g_new(filetype, 1);
|
||||
#define ALL
|
||||
filetypes[GEANY_FILETYPES_ALL] = g_new0(filetype, 1);
|
||||
filetypes[GEANY_FILETYPES_ALL]->id = GEANY_FILETYPES_ALL;
|
||||
filetypes[GEANY_FILETYPES_ALL]->name = g_strdup("None");
|
||||
filetypes[GEANY_FILETYPES_ALL]->has_tags = FALSE;
|
||||
filetypes[GEANY_FILETYPES_ALL]->title = g_strdup(_("All files"));
|
||||
filetypes[GEANY_FILETYPES_ALL]->extension = g_strdup("*");
|
||||
filetypes[GEANY_FILETYPES_ALL]->pattern = g_new(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_ALL]->pattern = g_new0(gchar*, 2);
|
||||
filetypes[GEANY_FILETYPES_ALL]->pattern[0] = g_strdup("*");
|
||||
filetypes[GEANY_FILETYPES_ALL]->pattern[1] = NULL;
|
||||
filetypes[GEANY_FILETYPES_ALL]->style_func_ptr = styleset_none;
|
||||
filetypes[GEANY_FILETYPES_ALL]->comment_open = NULL;
|
||||
filetypes[GEANY_FILETYPES_ALL]->comment_close = NULL;
|
||||
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_ALL]);
|
||||
filetypes_create_menu_item(filetype_menu, _("None"), filetypes[GEANY_FILETYPES_ALL]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* convenient function to save code size */
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/* simple filetype selection based on the filename extension */
|
||||
filetype *filetypes_get_from_filename(const gchar *filename)
|
||||
{
|
||||
@ -350,7 +442,7 @@ filetype *filetypes_get_from_filename(const gchar *filename)
|
||||
}
|
||||
|
||||
|
||||
void filetypes_create_menu_item(GtkWidget *menu, gchar *label, filetype *ftype)
|
||||
static void filetypes_create_menu_item(GtkWidget *menu, gchar *label, filetype *ftype)
|
||||
{
|
||||
GtkWidget *tmp = gtk_menu_item_new_with_label(label);
|
||||
gtk_widget_show(tmp);
|
||||
@ -359,9 +451,9 @@ void filetypes_create_menu_item(GtkWidget *menu, gchar *label, filetype *ftype)
|
||||
}
|
||||
|
||||
|
||||
void filetypes_create_newmenu_item(GtkWidget *menu, gchar *label, filetype *ftype)
|
||||
static void filetypes_create_newmenu_item(GtkWidget *menu, gchar *label, filetype *ftype)
|
||||
{
|
||||
gchar *new_label = g_strdup_printf(" %s", label);
|
||||
gchar *new_label = g_strdup_printf("%s", label);
|
||||
GtkWidget *tmp_menu = gtk_menu_item_new_with_label(new_label);
|
||||
GtkWidget *tmp_button = gtk_menu_item_new_with_label(new_label);
|
||||
g_free(new_label);
|
||||
@ -386,6 +478,27 @@ void filetypes_free_types(void)
|
||||
g_free(filetypes[i]->name);
|
||||
g_free(filetypes[i]->title);
|
||||
g_free(filetypes[i]->extension);
|
||||
g_free(filetypes[i]->comment_open);
|
||||
g_free(filetypes[i]->comment_close);
|
||||
g_free(filetypes[i]->programs->compiler);
|
||||
g_free(filetypes[i]->programs->linker);
|
||||
g_free(filetypes[i]->programs->run_cmd);
|
||||
g_free(filetypes[i]->programs->run_cmd2);
|
||||
g_free(filetypes[i]->programs);
|
||||
if (filetypes[i]->menu_items->menu != NULL &&
|
||||
GTK_IS_WIDGET(filetypes[i]->menu_items->menu))
|
||||
gtk_widget_destroy(filetypes[i]->menu_items->menu);
|
||||
/// TODO not necessary because they got freed with the menu?
|
||||
/* if (filetypes[i]->menu_items->item_compile != NULL &&
|
||||
GTK_IS_WIDGET(filetypes[i]->menu_items->item_compile))
|
||||
gtk_widget_destroy(filetypes[i]->menu_items->item_compile);
|
||||
if (filetypes[i]->menu_items->item_link != NULL &&
|
||||
GTK_IS_WIDGET(filetypes[i]->menu_items->item_link))
|
||||
gtk_widget_destroy(filetypes[i]->menu_items->item_link);
|
||||
if (filetypes[i]->menu_items->item_exec != NULL &&
|
||||
GTK_IS_WIDGET(filetypes[i]->menu_items->item_exec))
|
||||
gtk_widget_destroy(filetypes[i]->menu_items->item_exec);
|
||||
*/ g_free(filetypes[i]->menu_items);
|
||||
|
||||
g_strfreev(filetypes[i]->pattern);
|
||||
g_free(filetypes[i]);
|
||||
@ -414,3 +527,60 @@ gchar *filetypes_get_template(filetype *ft)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void filetypes_get_config(GKeyFile *config, gint ft)
|
||||
{
|
||||
gchar *result;
|
||||
GError *error = NULL;
|
||||
gboolean tmp;
|
||||
|
||||
if (config == NULL || ft < 0 || ft >= GEANY_MAX_FILE_TYPES) return;
|
||||
|
||||
// read comment notes
|
||||
result = g_key_file_get_string(config, "settings", "comment_open", NULL);
|
||||
if (result != NULL)
|
||||
{
|
||||
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)
|
||||
{
|
||||
g_free(filetypes[ft]->comment_close);
|
||||
filetypes[ft]->comment_close = result;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -27,38 +27,61 @@
|
||||
|
||||
enum
|
||||
{
|
||||
GEANY_FILETYPES_C = 0,
|
||||
GEANY_FILETYPES_CPP,
|
||||
GEANY_FILETYPES_JAVA,
|
||||
GEANY_FILETYPES_PERL,
|
||||
GEANY_FILETYPES_PHP,
|
||||
GEANY_FILETYPES_XML,
|
||||
GEANY_FILETYPES_DOCBOOK,
|
||||
GEANY_FILETYPES_PYTHON,
|
||||
GEANY_FILETYPES_TEX,
|
||||
GEANY_FILETYPES_PASCAL,
|
||||
GEANY_FILETYPES_SH,
|
||||
GEANY_FILETYPES_MAKE,
|
||||
GEANY_FILETYPES_CSS,
|
||||
GEANY_FILETYPES_CONF,
|
||||
GEANY_FILETYPES_ASM,
|
||||
GEANY_FILETYPES_SQL,
|
||||
GEANY_FILETYPES_CAML,
|
||||
GEANY_FILETYPES_OMS,
|
||||
GEANY_FILETYPES_ALL,
|
||||
GEANY_MAX_FILE_TYPES
|
||||
GEANY_FILETYPES_C = 0, // 0
|
||||
GEANY_FILETYPES_CPP, // 1
|
||||
GEANY_FILETYPES_JAVA, // 2
|
||||
GEANY_FILETYPES_PERL, // 3
|
||||
GEANY_FILETYPES_PHP, // 4
|
||||
GEANY_FILETYPES_XML, // 5
|
||||
GEANY_FILETYPES_DOCBOOK, // 6
|
||||
GEANY_FILETYPES_PYTHON, // 7
|
||||
GEANY_FILETYPES_LATEX, // 8
|
||||
GEANY_FILETYPES_PASCAL, // 9
|
||||
GEANY_FILETYPES_SH, // 10
|
||||
GEANY_FILETYPES_MAKE, // 11
|
||||
GEANY_FILETYPES_CSS, // 12
|
||||
GEANY_FILETYPES_CONF, // 13
|
||||
GEANY_FILETYPES_ASM, // 14
|
||||
GEANY_FILETYPES_SQL, // 15
|
||||
GEANY_FILETYPES_CAML, // 16
|
||||
GEANY_FILETYPES_OMS, // 17
|
||||
GEANY_FILETYPES_ALL, // 18
|
||||
GEANY_MAX_FILE_TYPES // 19
|
||||
};
|
||||
|
||||
struct build_menu_items
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item_compile;
|
||||
GtkWidget *item_link;
|
||||
GtkWidget *item_exec;
|
||||
gboolean can_compile;
|
||||
gboolean can_link;
|
||||
gboolean can_exec;
|
||||
};
|
||||
|
||||
struct build_programs
|
||||
{
|
||||
gchar *compiler;
|
||||
gchar *linker;
|
||||
gchar *run_cmd;
|
||||
gchar *run_cmd2;
|
||||
};
|
||||
|
||||
typedef struct filetype
|
||||
{
|
||||
guint id;
|
||||
gchar *name; // will be used as name for tagmanager
|
||||
gboolean has_tags; // indicates whether there is a tag parser for it or not
|
||||
gchar *title; // will be shown in the file open dialog
|
||||
gchar *extension;
|
||||
gchar **pattern;
|
||||
void (*style_func_ptr) (ScintillaObject*);
|
||||
guint id;
|
||||
gchar *name; // will be used as name for tagmanager
|
||||
gboolean has_tags; // indicates whether there is a tag parser for it or not
|
||||
gchar *title; // will be shown in the file open dialog
|
||||
gchar *extension;
|
||||
gchar **pattern;
|
||||
gchar *comment_open;
|
||||
gchar *comment_close;
|
||||
gboolean comment_use_indent;
|
||||
struct build_programs *programs;
|
||||
struct build_menu_items *menu_items;
|
||||
void (*style_func_ptr) (ScintillaObject*);
|
||||
} filetype;
|
||||
|
||||
filetype *filetypes[GEANY_MAX_FILE_TYPES];
|
||||
@ -72,15 +95,11 @@ void filetypes_init_types(void);
|
||||
/* simple filetype selection based on the filename extension */
|
||||
filetype *filetypes_get_from_filename(const gchar *filename);
|
||||
|
||||
|
||||
void filetypes_create_menu_item(GtkWidget *menu, gchar *label, filetype *ftype);
|
||||
|
||||
void filetypes_create_newmenu_item(GtkWidget *menu, gchar *label, filetype *ftype);
|
||||
|
||||
/* frees the array and all related pointers */
|
||||
void filetypes_free_types(void);
|
||||
|
||||
gchar *filetypes_get_template(filetype *ft);
|
||||
|
||||
void filetypes_get_config(GKeyFile *config, gint ft);
|
||||
|
||||
#endif
|
||||
|
27
src/geany.h
27
src/geany.h
@ -61,7 +61,7 @@
|
||||
#define GEANY_CODENAME "Nivers"
|
||||
#define GEANY_HOMEPAGE "http://geany.uvena.de/"
|
||||
#define GEANY_MAX_OPEN_FILES 25
|
||||
#define GEANY_SESSION_FILES 15
|
||||
#define GEANY_SESSION_FILES 25
|
||||
#define GEANY_MAX_TAGS_COUNT 1000
|
||||
#define GEANY_CHECK_FILE_DELAY 30
|
||||
#define GEANY_WORDCHARS "_#&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
@ -129,8 +129,10 @@ typedef struct MyApp
|
||||
gboolean fullscreen;
|
||||
gboolean beep_on_errors;
|
||||
gboolean switch_msgwin_pages;
|
||||
gboolean tab_order_ltr;
|
||||
gboolean show_markers_margin;
|
||||
gboolean show_linenumber_margin;
|
||||
gboolean brace_match_ltgt;
|
||||
gboolean main_window_realized;
|
||||
// I know, it is a bit confusing, but this line breaking is globally,
|
||||
// to change the default value at startup, I think
|
||||
@ -151,7 +153,7 @@ typedef struct MyApp
|
||||
gboolean pref_main_confirm_exit;
|
||||
gboolean pref_main_show_search;
|
||||
gboolean pref_main_show_goto;
|
||||
gint cur_idx; // currently only used by he build system (build_spawn_cmd)
|
||||
gint cur_idx; // currently only used by the build system (build_spawn_cmd)
|
||||
gint mru_length;
|
||||
gint long_line_column;
|
||||
#ifdef HAVE_FIFO
|
||||
@ -172,27 +174,14 @@ typedef struct MyApp
|
||||
gchar *configdir;
|
||||
gchar *search_text;
|
||||
gchar *terminal_settings;
|
||||
gchar *build_args_inc;
|
||||
gchar *build_args_libs;
|
||||
gchar *build_args_prog;
|
||||
gchar build_make_custopt[256];
|
||||
gchar *build_browser_cmd;
|
||||
gchar *build_c_cmd;
|
||||
gchar *build_cpp_cmd;
|
||||
/* I called it fpc (www.freepascal.org) to demonstrate I mean a pascal compiler,
|
||||
* but feel free to use the GNU one as well */
|
||||
gchar *build_fpc_cmd;
|
||||
gchar *build_tex_dvi_cmd;
|
||||
gchar *build_tex_pdf_cmd;
|
||||
gchar *build_tex_view_dvi_cmd;
|
||||
gchar *build_tex_view_pdf_cmd;
|
||||
gchar *build_java_cmd;
|
||||
gchar *build_javac_cmd;
|
||||
gchar *build_make_cmd;
|
||||
gchar *build_term_cmd;
|
||||
gchar **recent_files;
|
||||
GtkIconSize toolbar_icon_size;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *run_button;
|
||||
GtkWidget *compile_button;
|
||||
GtkWidget *compile_button_image;
|
||||
GtkWidget *tagbar;
|
||||
@ -219,16 +208,13 @@ typedef struct MyApp
|
||||
GtkWidget *find_dialog;
|
||||
GtkWidget *replace_dialog;
|
||||
GtkWidget *default_tag_tree;
|
||||
//GtkTreeStore *default_tag_store;
|
||||
const TMWorkspace *tm_workspace;
|
||||
GQueue *recent_queue;
|
||||
} MyApp;
|
||||
|
||||
MyApp *app;
|
||||
|
||||
gint this_year;
|
||||
gint this_month;
|
||||
gint this_day;
|
||||
|
||||
|
||||
|
||||
// small struct to track tag name and type together
|
||||
@ -275,4 +261,5 @@ extern langType getNamedLanguage(const char *const name);
|
||||
// implementation in main.c
|
||||
void geany_debug(gchar const *format, ...);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -39,10 +39,13 @@
|
||||
|
||||
|
||||
static style_set *types[GEANY_MAX_FILE_TYPES] = { NULL };
|
||||
static gboolean global_c_tags_loaded = FALSE;
|
||||
|
||||
|
||||
|
||||
/* simple wrapper function to print file errors in DEBUG mode */
|
||||
static void style_set_load_file(GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, GError **just_for_compatibility)
|
||||
static void style_set_load_file(GKeyFile *key_file, const gchar *file, GKeyFileFlags flags,
|
||||
GError **just_for_compatibility)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gboolean done = g_key_file_load_from_file(key_file, file, flags, &error);
|
||||
@ -54,18 +57,46 @@ static void style_set_load_file(GKeyFile *key_file, const gchar *file, GKeyFileF
|
||||
}
|
||||
|
||||
|
||||
static gchar *styleset_get_string(GKeyFile *config, const gchar *section, const gchar *key)
|
||||
static void styleset_get_keywords(GKeyFile *config, const gchar *section, const gchar *key,
|
||||
gint index, gint pos, const gchar *default_value)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *result;
|
||||
|
||||
if (config == NULL || section == NULL) return NULL;
|
||||
if (config == NULL || section == NULL)
|
||||
{
|
||||
types[index]->keywords[pos] = g_strdup(default_value);
|
||||
return;
|
||||
}
|
||||
|
||||
result = g_key_file_get_string(config, section, key, &error);
|
||||
//if (error) geany_debug(error->message);
|
||||
if (error) g_error_free(error);
|
||||
result = g_key_file_get_string(config, section, key, NULL);
|
||||
|
||||
return result;
|
||||
if (result == NULL)
|
||||
{
|
||||
types[index]->keywords[pos] = g_strdup(default_value);
|
||||
}
|
||||
else
|
||||
types[index]->keywords[pos] = result;
|
||||
}
|
||||
|
||||
|
||||
static void styleset_get_wordchars(GKeyFile *config, gint index, const gchar *default_value)
|
||||
{
|
||||
gchar *result;
|
||||
|
||||
if (config == NULL)
|
||||
{
|
||||
types[index]->wordchars = g_strdup(default_value);
|
||||
return;
|
||||
}
|
||||
|
||||
result = g_key_file_get_string(config, "settings", "wordchars", NULL);
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
types[index]->wordchars = g_strdup(default_value);
|
||||
}
|
||||
else
|
||||
types[index]->wordchars = result;
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +124,30 @@ static void styleset_get_hex(GKeyFile *config, const gchar *section, const gchar
|
||||
}
|
||||
|
||||
|
||||
static void styleset_get_int(GKeyFile *config, const gchar *section, const gchar *key,
|
||||
gint fdefault_val, gint sdefault_val, gint array[])
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar **list;
|
||||
gsize len;
|
||||
|
||||
if (config == NULL || section == NULL) return;
|
||||
|
||||
list = g_key_file_get_string_list(config, section, key, &len, &error);
|
||||
|
||||
if (list != NULL && list[0] != NULL) array[0] = atoi(list[0]);
|
||||
else array[0] = fdefault_val;
|
||||
if (list != NULL && list[1] != NULL) array[1] = atoi(list[1]);
|
||||
else array[1] = sdefault_val;
|
||||
|
||||
// if there was an error, atoi() returns 0, so then we use default_val
|
||||
if (array[0] == 0) array[0] = fdefault_val;
|
||||
if (array[1] == 0) array[1] = sdefault_val;
|
||||
|
||||
g_strfreev(list);
|
||||
}
|
||||
|
||||
|
||||
static void styleset_set_style(ScintillaObject *sci, gint style, gint filetype, gint styling_index)
|
||||
{
|
||||
SSM(sci, SCI_STYLESETFORE, style, types[filetype]->styling[styling_index][0]);
|
||||
@ -111,6 +166,7 @@ void styleset_free_styles()
|
||||
if (types[i] != NULL)
|
||||
{
|
||||
g_strfreev(types[i]->keywords);
|
||||
g_free(types[i]->wordchars);
|
||||
g_free(types[i]);
|
||||
}
|
||||
}
|
||||
@ -129,8 +185,11 @@ static void styleset_common_init(void)
|
||||
styleset_get_hex(config, "styling", "brace_good", "0xff0000", "0xffffff", "false", types[GEANY_FILETYPES_ALL]->styling[2]);
|
||||
styleset_get_hex(config, "styling", "brace_bad", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_ALL]->styling[3]);
|
||||
styleset_get_hex(config, "styling", "current_line", "0x000000", "0xE5E5E5", "false", types[GEANY_FILETYPES_ALL]->styling[4]);
|
||||
styleset_get_int(config, "styling", "folding_style", 1, 1, types[GEANY_FILETYPES_ALL]->styling[5]);
|
||||
|
||||
types[GEANY_FILETYPES_ALL]->keywords = NULL;
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_ALL, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_ALL);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
@ -173,25 +232,58 @@ void styleset_common(ScintillaObject *sci, gint style_bits)
|
||||
SSM(sci, SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS);
|
||||
SSM(sci, SCI_SETFOLDFLAGS, 0, 0);
|
||||
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS);
|
||||
// choose the folding style - boxes or circles, I prefer boxes, so it is default ;-)
|
||||
switch (types[GEANY_FILETYPES_ALL]->styling[5][0])
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// choose the folding style - straight or curved, I prefer straight, so it is default ;-)
|
||||
switch (types[GEANY_FILETYPES_ALL]->styling[5][1])
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
|
||||
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDEROPEN, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPEN, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDER, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDER, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDERSUB, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDERSUB, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDERTAIL, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDERTAIL, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDEREND, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDEREND, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDEROPENMID, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPENMID, 0x000000);
|
||||
SSM (sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
|
||||
SSM (sci,SCI_MARKERSETFORE, SC_MARKNUM_FOLDERMIDTAIL, 0xffffff);
|
||||
SSM (sci,SCI_MARKERSETBACK, SC_MARKNUM_FOLDERMIDTAIL, 0x000000);
|
||||
|
||||
@ -240,18 +332,21 @@ static void styleset_c_init(void)
|
||||
styleset_get_hex(config, "styling", "globalclass", "0xbb1111", "0xffffff", "true", types[GEANY_FILETYPES_C]->styling[18]);
|
||||
|
||||
types[GEANY_FILETYPES_C]->keywords = g_new(gchar*, 3);
|
||||
types[GEANY_FILETYPES_C]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_C]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_C]->keywords[0] = g_strdup("if const struct char int float double void long for while do case switch return");
|
||||
types[GEANY_FILETYPES_C]->keywords[1] = styleset_get_string(config, "keywords", "docComment");
|
||||
if (types[GEANY_FILETYPES_C]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_C]->keywords[1] = g_strdup("TODO FIXME");
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_C, 0, "if const struct char int float double void long for while do case switch return");
|
||||
styleset_get_keywords(config, "keywords", "docComment", GEANY_FILETYPES_C, 1, "TODO FIXME");
|
||||
types[GEANY_FILETYPES_C]->keywords[2] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_C, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_C);
|
||||
|
||||
g_key_file_free(config);
|
||||
|
||||
// load global tags file for C autocompletion
|
||||
if (! app->ignore_global_tags) tm_workspace_load_global_tags(GEANY_DATA_DIR "/global.tags");
|
||||
if (! app->ignore_global_tags && ! global_c_tags_loaded)
|
||||
{
|
||||
tm_workspace_load_global_tags(GEANY_DATA_DIR "/global.tags");
|
||||
global_c_tags_loaded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -285,12 +380,12 @@ void styleset_c(ScintillaObject *sci)
|
||||
g_ptr_array_free(g_typedefs, TRUE);
|
||||
}
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_C]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_CPP, 0);
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_CPP, 0);
|
||||
|
||||
//SSM (sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
//SSM(sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_C]->keywords[0]);
|
||||
//SSM(sci, SCI_SETKEYWORDS, 1, (sptr_t) secondaryKeyWords);
|
||||
@ -310,7 +405,7 @@ void styleset_c(ScintillaObject *sci)
|
||||
styleset_set_style(sci, SCE_C_PREPROCESSOR, GEANY_FILETYPES_C, 10);
|
||||
styleset_set_style(sci, SCE_C_OPERATOR, GEANY_FILETYPES_C, 11);
|
||||
styleset_set_style(sci, SCE_C_IDENTIFIER, GEANY_FILETYPES_C, 12);
|
||||
styleset_set_style(sci, SCE_C_STRINGEOL, GEANY_FILETYPES_ALL, 13);
|
||||
styleset_set_style(sci, SCE_C_STRINGEOL, GEANY_FILETYPES_C, 13);
|
||||
styleset_set_style(sci, SCE_C_VERBATIM, GEANY_FILETYPES_C, 14);
|
||||
styleset_set_style(sci, SCE_C_REGEX, GEANY_FILETYPES_C, 15);
|
||||
styleset_set_style(sci, SCE_C_COMMENTLINEDOC, GEANY_FILETYPES_C, 16);
|
||||
@ -326,7 +421,128 @@ void styleset_c(ScintillaObject *sci)
|
||||
SSM(sci, SCI_SETWHITESPACEFORE, 1, 0xc0c0c0);
|
||||
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "file.patterns.cpp", (sptr_t) "*.cpp;*.cxx;*.cc");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.symbol.$(file.patterns.cpp)", (sptr_t) "#");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.start.$(file.patterns.cpp)", (sptr_t) "if ifdef ifndef");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.middle.$(file.patterns.cpp)", (sptr_t) "else elif");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.end.$(file.patterns.cpp)", (sptr_t) "endif");
|
||||
}
|
||||
|
||||
|
||||
static void styleset_cpp_init(void)
|
||||
{
|
||||
GKeyFile *config = g_key_file_new();
|
||||
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.cpp", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
|
||||
types[GEANY_FILETYPES_CPP] = g_new(style_set, 1);
|
||||
styleset_get_hex(config, "styling", "default", "0x000000", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[0]);
|
||||
styleset_get_hex(config, "styling", "comment", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[1]);
|
||||
styleset_get_hex(config, "styling", "commentline", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[2]);
|
||||
styleset_get_hex(config, "styling", "commentdoc", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[3]);
|
||||
styleset_get_hex(config, "styling", "number", "0x007f00", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[4]);
|
||||
styleset_get_hex(config, "styling", "word", "0x991111", "0xffffff", "true", types[GEANY_FILETYPES_CPP]->styling[5]);
|
||||
styleset_get_hex(config, "styling", "word2", "0x00007F", "0xffffff", "true", types[GEANY_FILETYPES_CPP]->styling[6]);
|
||||
styleset_get_hex(config, "styling", "string", "0x1E90FF", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[7]);
|
||||
styleset_get_hex(config, "styling", "character", "0x1E90FF", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[8]);
|
||||
styleset_get_hex(config, "styling", "uuid", "0x804040", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[9]);
|
||||
styleset_get_hex(config, "styling", "preprocessor", "0x7F7F00", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[10]);
|
||||
styleset_get_hex(config, "styling", "operator", "0x101030", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[11]);
|
||||
styleset_get_hex(config, "styling", "identifier", "0x100000", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[12]);
|
||||
styleset_get_hex(config, "styling", "stringeol", "0x000000", "0xe0c0e0", "false", types[GEANY_FILETYPES_CPP]->styling[13]);
|
||||
styleset_get_hex(config, "styling", "verbatim", "0x101030", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[14]);
|
||||
styleset_get_hex(config, "styling", "regex", "0x101030", "0xffffff", "false", types[GEANY_FILETYPES_CPP]->styling[15]);
|
||||
styleset_get_hex(config, "styling", "commentlinedoc", "0x0000ff", "0xffffff", "true", types[GEANY_FILETYPES_CPP]->styling[16]);
|
||||
styleset_get_hex(config, "styling", "commentdockeyword", "0x0000ff", "0xffffff", "true", types[GEANY_FILETYPES_CPP]->styling[17]);
|
||||
styleset_get_hex(config, "styling", "globalclass", "0xbb1111", "0xffffff", "true", types[GEANY_FILETYPES_CPP]->styling[18]);
|
||||
|
||||
types[GEANY_FILETYPES_CPP]->keywords = g_new(gchar*, 3);
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_CPP, 0, "this private public protected if const struct char int float double void long for while do case switch return");
|
||||
styleset_get_keywords(config, "keywords", "docComment", GEANY_FILETYPES_CPP, 1, "TODO FIXME");
|
||||
types[GEANY_FILETYPES_CPP]->keywords[2] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_CPP, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_CPP);
|
||||
|
||||
g_key_file_free(config);
|
||||
|
||||
// load global tags file for C autocompletion
|
||||
if (! app->ignore_global_tags && ! global_c_tags_loaded)
|
||||
{
|
||||
tm_workspace_load_global_tags(GEANY_DATA_DIR "/global.tags");
|
||||
global_c_tags_loaded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void styleset_cpp(ScintillaObject *sci)
|
||||
{
|
||||
|
||||
if (types[GEANY_FILETYPES_CPP] == NULL) styleset_cpp_init();
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
|
||||
/* Assign global keywords */
|
||||
if ((app->tm_workspace) && (app->tm_workspace->global_tags))
|
||||
{
|
||||
guint j;
|
||||
GPtrArray *g_typedefs = tm_tags_extract(app->tm_workspace->global_tags, tm_tag_typedef_t | tm_tag_struct_t | tm_tag_class_t);
|
||||
if ((g_typedefs) && (g_typedefs->len > 0))
|
||||
{
|
||||
GString *s = g_string_sized_new(g_typedefs->len * 10);
|
||||
for (j = 0; j < g_typedefs->len; ++j)
|
||||
{
|
||||
if (!(TM_TAG(g_typedefs->pdata[j])->atts.entry.scope))
|
||||
{
|
||||
g_string_append(s, TM_TAG(g_typedefs->pdata[j])->name);
|
||||
g_string_append_c(s, ' ');
|
||||
}
|
||||
}
|
||||
SSM(sci, SCI_SETKEYWORDS, 1, (sptr_t) s->str);
|
||||
g_string_free(s, TRUE);
|
||||
}
|
||||
g_ptr_array_free(g_typedefs, TRUE);
|
||||
}
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_CPP]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_CPP, 0);
|
||||
|
||||
//SSM(sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_CPP]->keywords[0]);
|
||||
SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) types[GEANY_FILETYPES_CPP]->keywords[1]);
|
||||
|
||||
styleset_set_style(sci, SCE_C_DEFAULT, GEANY_FILETYPES_CPP, 0);
|
||||
styleset_set_style(sci, SCE_C_COMMENT, GEANY_FILETYPES_CPP, 1);
|
||||
styleset_set_style(sci, SCE_C_COMMENTLINE, GEANY_FILETYPES_CPP, 2);
|
||||
styleset_set_style(sci, SCE_C_COMMENTDOC, GEANY_FILETYPES_CPP, 3);
|
||||
styleset_set_style(sci, SCE_C_NUMBER, GEANY_FILETYPES_CPP, 4);
|
||||
styleset_set_style(sci, SCE_C_WORD, GEANY_FILETYPES_CPP, 5);
|
||||
styleset_set_style(sci, SCE_C_WORD2, GEANY_FILETYPES_CPP, 6);
|
||||
styleset_set_style(sci, SCE_C_STRING, GEANY_FILETYPES_CPP, 7);
|
||||
styleset_set_style(sci, SCE_C_CHARACTER, GEANY_FILETYPES_CPP, 8);
|
||||
styleset_set_style(sci, SCE_C_UUID, GEANY_FILETYPES_CPP, 9);
|
||||
styleset_set_style(sci, SCE_C_PREPROCESSOR, GEANY_FILETYPES_CPP, 10);
|
||||
styleset_set_style(sci, SCE_C_OPERATOR, GEANY_FILETYPES_CPP, 11);
|
||||
styleset_set_style(sci, SCE_C_IDENTIFIER, GEANY_FILETYPES_CPP, 12);
|
||||
styleset_set_style(sci, SCE_C_STRINGEOL, GEANY_FILETYPES_CPP, 13);
|
||||
styleset_set_style(sci, SCE_C_VERBATIM, GEANY_FILETYPES_CPP, 14);
|
||||
styleset_set_style(sci, SCE_C_REGEX, GEANY_FILETYPES_CPP, 15);
|
||||
styleset_set_style(sci, SCE_C_COMMENTLINEDOC, GEANY_FILETYPES_CPP, 16);
|
||||
styleset_set_style(sci, SCE_C_COMMENTDOCKEYWORD, GEANY_FILETYPES_CPP, 17);
|
||||
|
||||
SSM(sci, SCI_STYLESETFORE, SCE_C_COMMENTDOCKEYWORDERROR, 0x0000ff);
|
||||
SSM(sci, SCI_STYLESETBACK, SCE_C_COMMENTDOCKEYWORDERROR, 0xFFFFFF);
|
||||
SSM(sci, SCI_STYLESETITALIC, SCE_C_COMMENTDOCKEYWORDERROR, TRUE);
|
||||
|
||||
// is used for local structs and typedefs
|
||||
styleset_set_style(sci, SCE_C_GLOBALCLASS, GEANY_FILETYPES_CPP, 18);
|
||||
|
||||
SSM(sci, SCI_SETWHITESPACEFORE, 1, 0xc0c0c0);
|
||||
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.symbol.$(file.patterns.cpp)", (sptr_t) "#");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.start.$(file.patterns.cpp)", (sptr_t) "if ifdef ifndef");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.middle.$(file.patterns.cpp)", (sptr_t) "else elif");
|
||||
@ -355,13 +571,14 @@ static void styleset_pascal_init(void)
|
||||
styleset_get_hex(config, "styling", "commentdoc", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_PASCAL]->styling[11]);
|
||||
|
||||
types[GEANY_FILETYPES_PASCAL]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_PASCAL]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_PASCAL]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_PASCAL]->keywords[0] = g_strdup("word integer char string byte real \
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_PASCAL, 0, "word integer char string byte real \
|
||||
for to do until repeat program if uses then else case var begin end \
|
||||
asm unit interface implementation procedure function object try class");
|
||||
types[GEANY_FILETYPES_PASCAL]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_PASCAL, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_PASCAL);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -372,7 +589,7 @@ void styleset_pascal(ScintillaObject *sci)
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_PASCAL]->wordchars);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_PASCAL, 0);
|
||||
@ -416,6 +633,9 @@ static void styleset_makefile_init(void)
|
||||
|
||||
types[GEANY_FILETYPES_MAKE]->keywords = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_MAKE, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_MAKE);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -427,7 +647,8 @@ void styleset_makefile(ScintillaObject *sci)
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_MAKEFILE, 0);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_MAKE]->wordchars);
|
||||
|
||||
styleset_set_style(sci, SCE_MAKE_DEFAULT, GEANY_FILETYPES_MAKE, 0);
|
||||
styleset_set_style(sci, SCE_MAKE_COMMENT, GEANY_FILETYPES_MAKE, 1);
|
||||
styleset_set_style(sci, SCE_MAKE_PREPROCESSOR, GEANY_FILETYPES_MAKE, 2);
|
||||
@ -438,60 +659,81 @@ void styleset_makefile(ScintillaObject *sci)
|
||||
}
|
||||
|
||||
|
||||
static void styleset_tex_init(void)
|
||||
static void styleset_latex_init(void)
|
||||
{
|
||||
GKeyFile *config = g_key_file_new();
|
||||
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.tex", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.latex", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
|
||||
types[GEANY_FILETYPES_TEX] = g_new(style_set, 1);
|
||||
styleset_get_hex(config, "styling", "default", "0xFF0000", "0xffffff", "false", types[GEANY_FILETYPES_TEX]->styling[0]);
|
||||
styleset_get_hex(config, "styling", "command", "0x0000ff", "0xffffff", "true", types[GEANY_FILETYPES_TEX]->styling[1]);
|
||||
styleset_get_hex(config, "styling", "tag", "0x7F7F00", "0xffffff", "true", types[GEANY_FILETYPES_TEX]->styling[2]);
|
||||
styleset_get_hex(config, "styling", "math", "0x007F00", "0xffffff", "false", types[GEANY_FILETYPES_TEX]->styling[3]);
|
||||
styleset_get_hex(config, "styling", "comment", "0x007F00", "0xffffff", "false", types[GEANY_FILETYPES_TEX]->styling[4]);
|
||||
types[GEANY_FILETYPES_LATEX] = g_new(style_set, 1);
|
||||
styleset_get_hex(config, "styling", "default", "0xFF0000", "0xffffff", "false", types[GEANY_FILETYPES_LATEX]->styling[0]);
|
||||
styleset_get_hex(config, "styling", "command", "0x0000ff", "0xffffff", "true", types[GEANY_FILETYPES_LATEX]->styling[1]);
|
||||
styleset_get_hex(config, "styling", "tag", "0x7F7F00", "0xffffff", "true", types[GEANY_FILETYPES_LATEX]->styling[2]);
|
||||
styleset_get_hex(config, "styling", "math", "0x007F00", "0xffffff", "false", types[GEANY_FILETYPES_LATEX]->styling[3]);
|
||||
styleset_get_hex(config, "styling", "comment", "0x007F00", "0xffffff", "false", types[GEANY_FILETYPES_LATEX]->styling[4]);
|
||||
|
||||
types[GEANY_FILETYPES_TEX]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_TEX]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_TEX]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_TEX]->keywords[0] = g_strdup("section subsection begin item");
|
||||
types[GEANY_FILETYPES_TEX]->keywords[1] = NULL;
|
||||
types[GEANY_FILETYPES_LATEX]->keywords = g_new(gchar*, 2);
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_LATEX, 0, "section subsection begin item");
|
||||
types[GEANY_FILETYPES_LATEX]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_LATEX, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_LATEX);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
|
||||
void styleset_tex(ScintillaObject *sci)
|
||||
void styleset_latex(ScintillaObject *sci)
|
||||
{
|
||||
if (types[GEANY_FILETYPES_TEX] == NULL) styleset_tex_init();
|
||||
if (types[GEANY_FILETYPES_LATEX] == NULL) styleset_latex_init();
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_LATEX, 0);
|
||||
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_TEX]->keywords[0]);
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_LATEX]->keywords[0]);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_LATEX]->wordchars);
|
||||
|
||||
styleset_set_style(sci, SCE_L_DEFAULT, GEANY_FILETYPES_TEX, 0);
|
||||
styleset_set_style(sci, SCE_L_COMMAND, GEANY_FILETYPES_TEX, 1);
|
||||
styleset_set_style(sci, SCE_L_TAG, GEANY_FILETYPES_TEX, 2);
|
||||
styleset_set_style(sci, SCE_L_MATH, GEANY_FILETYPES_TEX, 3);
|
||||
styleset_set_style(sci, SCE_L_COMMENT, GEANY_FILETYPES_TEX, 4);
|
||||
styleset_set_style(sci, SCE_L_DEFAULT, GEANY_FILETYPES_LATEX, 0);
|
||||
styleset_set_style(sci, SCE_L_COMMAND, GEANY_FILETYPES_LATEX, 1);
|
||||
styleset_set_style(sci, SCE_L_TAG, GEANY_FILETYPES_LATEX, 2);
|
||||
styleset_set_style(sci, SCE_L_MATH, GEANY_FILETYPES_LATEX, 3);
|
||||
styleset_set_style(sci, SCE_L_COMMENT, GEANY_FILETYPES_LATEX, 4);
|
||||
}
|
||||
|
||||
|
||||
static void styleset_php_init(void)
|
||||
{
|
||||
GKeyFile *config = g_key_file_new();
|
||||
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.php", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
|
||||
types[GEANY_FILETYPES_PHP] = g_new(style_set, 1);
|
||||
types[GEANY_FILETYPES_PHP]->keywords = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_PHP, GEANY_WORDCHARS"$");
|
||||
filetypes_get_config(config, GEANY_FILETYPES_PHP);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
|
||||
void styleset_php(ScintillaObject *sci)
|
||||
{
|
||||
if (types[GEANY_FILETYPES_PHP] == NULL) styleset_php_init();
|
||||
|
||||
styleset_common(sci, 7);
|
||||
|
||||
SSM (sci, SCI_SETPROPERTY, (sptr_t) "phpscript.mode", (sptr_t) "1");
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_HTML, 0);
|
||||
|
||||
// DWELL notification for URL highlighting
|
||||
SSM(sci, SCI_SETMOUSEDWELLTIME, 500, 0);
|
||||
//SSM(sci, SCI_SETMOUSEDWELLTIME, 500, 0);
|
||||
|
||||
// use the same colouring for HTML; XML and so on
|
||||
styleset_markup(sci);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_PHP]->wordchars);
|
||||
}
|
||||
|
||||
|
||||
@ -499,7 +741,7 @@ static void styleset_markup_init(void)
|
||||
{
|
||||
GKeyFile *config = g_key_file_new();
|
||||
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.markup", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
style_set_load_file(config, GEANY_DATA_DIR "/filetypes.xml", G_KEY_FILE_KEEP_COMMENTS, NULL);
|
||||
|
||||
types[GEANY_FILETYPES_XML] = g_new(style_set, 1);
|
||||
styleset_get_hex(config, "styling", "html_default", "0x000000", "0xffffff", "false", types[GEANY_FILETYPES_XML]->styling[0]);
|
||||
@ -562,26 +804,17 @@ static void styleset_markup_init(void)
|
||||
styleset_get_hex(config, "styling", "jscript_stringeol", "0x000000", "0xe0c0e0", "false", types[GEANY_FILETYPES_XML]->styling[54]);
|
||||
|
||||
types[GEANY_FILETYPES_XML]->keywords = g_new(gchar*, 7);
|
||||
types[GEANY_FILETYPES_XML]->keywords[0] = styleset_get_string(config, "keywords", "html");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[0] = g_strdup("a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em embed fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q quality s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns leftmargin topmargin abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder selected headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media framespacing method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt pluginspage readonly rel rev rows rowspan rules scheme scope scrolling shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public doctype xml");
|
||||
types[GEANY_FILETYPES_XML]->keywords[1] = styleset_get_string(config, "keywords", "javascript");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[1] = g_strdup("break this for while null else var false void new delete typeof if in continue true function with return case super extends do const try debugger catch switch finally enum export default class throw import length concat join pop push reverse shift slice splice sort unshift Date Infinity NaN undefined escape eval isFinite isNaN Number parseFloat parseInt string unescape Math abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan MAX_VALUE MIN_VALUE NEGATIVE_INFINITY POSITIVE_INFINITY toString valueOf String length anchor big bold charAt charCodeAt concat fixed fontcolor fontsize fromCharCode indexOf italics lastIndexOf link slice small split strike sub substr substring sup toLowerCase toUpperCase");
|
||||
types[GEANY_FILETYPES_XML]->keywords[2] = styleset_get_string(config, "keywords", "vbscript");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[2] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[2] = g_strdup("and as byref byval case call const continue dim do each else elseif end error exit false for function global goto if in loop me new next not nothing on optional or private public redim rem resume select set sub then to true type while with boolean byte currency date double integer long object single string type variant");
|
||||
types[GEANY_FILETYPES_XML]->keywords[3] = styleset_get_string(config, "keywords", "python");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[3] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[3] = g_strdup("and assert break class continue complex def del elif else except exec finally for from global if import in inherit is int lambda not or pass print raise return tuple try unicode while yield long float str list");
|
||||
types[GEANY_FILETYPES_XML]->keywords[4] = styleset_get_string(config, "keywords", "php");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[4] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[4] = g_strdup("and or xor FILE exception LINE array as break case class const continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends for foreach function global if include include_once isset list new print require require_once return static switch unset use var while FUNCTION CLASS METHOD final php_user_filter interface implements extends public private protected abstract clone try catch throw cfunction old_function this");
|
||||
types[GEANY_FILETYPES_XML]->keywords[5] = styleset_get_string(config, "keywords", "sgml");
|
||||
if (types[GEANY_FILETYPES_XML]->keywords[5] == NULL)
|
||||
types[GEANY_FILETYPES_XML]->keywords[5] = g_strdup("ELEMENT DOCTYPE ATTLIST ENTITY NOTATION");
|
||||
styleset_get_keywords(config, "keywords", "html", GEANY_FILETYPES_XML, 0, "a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em embed fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q quality s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns leftmargin topmargin abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder selected headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media framespacing method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt pluginspage readonly rel rev rows rowspan rules scheme scope scrolling shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public doctype xml");
|
||||
styleset_get_keywords(config, "keywords", "javascript", GEANY_FILETYPES_XML, 1, "break this for while null else var false void new delete typeof if in continue true function with return case super extends do const try debugger catch switch finally enum export default class throw import length concat join pop push reverse shift slice splice sort unshift Date Infinity NaN undefined escape eval isFinite isNaN Number parseFloat parseInt string unescape Math abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan MAX_VALUE MIN_VALUE NEGATIVE_INFINITY POSITIVE_INFINITY toString valueOf String length anchor big bold charAt charCodeAt concat fixed fontcolor fontsize fromCharCode indexOf italics lastIndexOf link slice small split strike sub substr substring sup toLowerCase toUpperCase");
|
||||
styleset_get_keywords(config, "keywords", "vbscript", GEANY_FILETYPES_XML, 2, "and as byref byval case call const continue dim do each else elseif end error exit false for function global goto if in loop me new next not nothing on optional or private public redim rem resume select set sub then to true type while with boolean byte currency date double integer long object single string type variant");
|
||||
styleset_get_keywords(config, "keywords", "python", GEANY_FILETYPES_XML, 3, "and assert break class continue complex def del elif else except exec finally for from global if import in inherit is int lambda not or pass print raise return tuple try unicode while yield long float str list");
|
||||
styleset_get_keywords(config, "keywords", "php", GEANY_FILETYPES_XML, 4, "and or xor FILE exception LINE array as break case class const continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends for foreach function global if include include_once isset list new print require require_once return static switch unset use var while FUNCTION CLASS METHOD final php_user_filter interface implements extends public private protected abstract clone try catch throw cfunction old_function this");
|
||||
styleset_get_keywords(config, "keywords", "sgml", GEANY_FILETYPES_XML, 5, "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION");
|
||||
types[GEANY_FILETYPES_XML]->keywords[6] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_XML, GEANY_WORDCHARS"$");
|
||||
filetypes_get_config(config, GEANY_FILETYPES_XML);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -606,7 +839,6 @@ void styleset_markup(ScintillaObject *sci)
|
||||
SSM(sci, SCI_SETHOTSPOTSINGLELINE, 1, 0);
|
||||
SSM(sci, SCI_STYLESETHOTSPOT, SCE_H_QUESTION, 1);
|
||||
|
||||
|
||||
styleset_set_style(sci, SCE_H_DEFAULT, GEANY_FILETYPES_XML, 0);
|
||||
styleset_set_style(sci, SCE_H_TAG, GEANY_FILETYPES_XML, 1);
|
||||
styleset_set_style(sci, SCE_H_TAGUNKNOWN, GEANY_FILETYPES_XML, 2);
|
||||
@ -833,25 +1065,21 @@ static void styleset_java_init(void)
|
||||
styleset_get_hex(config, "styling", "globalclass", "0x109040", "0xffffff", "true", types[GEANY_FILETYPES_JAVA]->styling[18]);
|
||||
|
||||
types[GEANY_FILETYPES_JAVA]->keywords = g_new(gchar*, 5);
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_JAVA]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[0] = g_strdup(" abstract assert break case catch class \
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_JAVA, 0, "\
|
||||
abstract assert break case catch class \
|
||||
const continue default do else extends final finally for future \
|
||||
generic goto if implements import inner instanceof interface \
|
||||
native new outer package private protected public rest \
|
||||
return static super switch synchronized this throw throws \
|
||||
transient try var volatile while");
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[1] = styleset_get_string(config, "keywords", "secondary");
|
||||
if (types[GEANY_FILETYPES_JAVA]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[1] = g_strdup("boolean byte char double float int long null short void NULL");
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[2] = styleset_get_string(config, "keywords", "doccomment");
|
||||
if (types[GEANY_FILETYPES_JAVA]->keywords[2] == NULL)
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[2] = g_strdup("return param author");
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[3] = styleset_get_string(config, "keywords", "typedefs");
|
||||
if (types[GEANY_FILETYPES_JAVA]->keywords[3] == NULL)
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[3] = g_strdup("");
|
||||
styleset_get_keywords(config, "keywords", "secondary", GEANY_FILETYPES_JAVA, 1, "boolean byte char double float int long null short void NULL");
|
||||
styleset_get_keywords(config, "keywords", "doccomment", GEANY_FILETYPES_JAVA, 2, "return param author");
|
||||
styleset_get_keywords(config, "keywords", "typedefs", GEANY_FILETYPES_JAVA, 3, "");
|
||||
types[GEANY_FILETYPES_JAVA]->keywords[4] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_JAVA, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_JAVA);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -863,7 +1091,7 @@ void styleset_java(ScintillaObject *sci)
|
||||
styleset_common(sci, 5);
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_CPP, 0);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_JAVA]->wordchars);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
@ -928,10 +1156,8 @@ static void styleset_perl_init(void)
|
||||
styleset_get_hex(config, "styling", "backticks", "0x000000", "0xe0c0e0", "false", types[GEANY_FILETYPES_PERL]->styling[16]);
|
||||
|
||||
types[GEANY_FILETYPES_PERL]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_PERL]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_PERL]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_PERL]->keywords[0] = g_strdup(
|
||||
"NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD \
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_PERL, 0, "\
|
||||
NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD \
|
||||
BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept \
|
||||
alarm and atan2 bind binmode bless caller chdir chmod chomp chop \
|
||||
chown chr chroot close closedir cmp connect continue cos crypt \
|
||||
@ -960,6 +1186,9 @@ static void styleset_perl_init(void)
|
||||
x xor y");
|
||||
types[GEANY_FILETYPES_PERL]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_PERL, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_PERL);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -973,8 +1202,8 @@ void styleset_perl(ScintillaObject *sci)
|
||||
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_PERL]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_PERL]->keywords[0]);
|
||||
|
||||
@ -1023,11 +1252,12 @@ static void styleset_python_init(void)
|
||||
styleset_get_hex(config, "styling", "stringeol", "0x000000", "0xe0c0e0", "false", types[GEANY_FILETYPES_PYTHON]->styling[13]);
|
||||
|
||||
types[GEANY_FILETYPES_PYTHON]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_PYTHON]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_PYTHON]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_PYTHON]->keywords[0] = g_strdup("and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while yield");
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_PYTHON, 0, "and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while yield");
|
||||
types[GEANY_FILETYPES_PYTHON]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_PYTHON, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_PYTHON);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1078,11 +1308,12 @@ static void styleset_sh_init(void)
|
||||
styleset_get_hex(config, "styling", "scalar", "0x905010", "0xffffff", "false", types[GEANY_FILETYPES_SH]->styling[10]);
|
||||
|
||||
types[GEANY_FILETYPES_SH]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_SH]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_SH]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_SH]->keywords[0] = g_strdup("break case continue do done else esac eval exit export fi for goto if in integer return set shift then while");
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_SH, 0, "break case continue do done else esac eval exit export fi for goto if in integer return set shift then while");
|
||||
types[GEANY_FILETYPES_SH]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_SH, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_SH);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1094,7 +1325,7 @@ void styleset_sh(ScintillaObject *sci)
|
||||
styleset_common(sci, 5);
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_BASH, 0);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_SH]->wordchars);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
@ -1125,6 +1356,8 @@ void styleset_xml(ScintillaObject *sci)
|
||||
|
||||
// use the same colouring for HTML; XML and so on
|
||||
styleset_markup(sci);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_XML]->wordchars);
|
||||
}
|
||||
|
||||
|
||||
@ -1165,11 +1398,9 @@ static void styleset_docbook_init(void)
|
||||
styleset_get_hex(config, "styling", "sgml_1st_param_comment", "0x906040", "0xffffff", "false", types[GEANY_FILETYPES_DOCBOOK]->styling[27]);
|
||||
styleset_get_hex(config, "styling", "sgml_error", "0x0000ff", "0xffffff", "false", types[GEANY_FILETYPES_DOCBOOK]->styling[28]);
|
||||
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords[0] = styleset_get_string(config, "keywords", "elements");
|
||||
if (types[GEANY_FILETYPES_DOCBOOK]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords[0] = g_strdup("\
|
||||
abbrev abstract accel ackno acronym action address affiliation alt anchor \
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords = g_new(gchar*, 3);
|
||||
styleset_get_keywords(config, "keywords", "elements", GEANY_FILETYPES_DOCBOOK, 0,
|
||||
"abbrev abstract accel ackno acronym action address affiliation alt anchor \
|
||||
answer appendix appendixinfo application area areaset areaspec arg article \
|
||||
articleinfo artpagenums attribution audiodata audioobject author authorblurb \
|
||||
authorgroup authorinitials beginpage bibliocoverage bibliodiv biblioentry \
|
||||
@ -1224,11 +1455,12 @@ static void styleset_docbook_init(void)
|
||||
videoobject void volumenum warning wordasword xref year cols colnum align spanname\
|
||||
arch condition conformance id lang os remap role revision revisionflag security \
|
||||
userlevel url vendor xreflabel status label endterm linkend space width");
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords[1] = styleset_get_string(config, "keywords", "dtd");
|
||||
if (types[GEANY_FILETYPES_DOCBOOK]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords[1] = g_strdup("ELEMENT DOCTYPE ATTLIST ENTITY NOTATION");
|
||||
styleset_get_keywords(config, "keywords", "dtd", GEANY_FILETYPES_DOCBOOK, 1, "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION");
|
||||
types[GEANY_FILETYPES_DOCBOOK]->keywords[2] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_DOCBOOK, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_DOCBOOK);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1243,8 +1475,8 @@ void styleset_docbook(ScintillaObject *sci)
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) types[GEANY_FILETYPES_DOCBOOK]->keywords[0]);
|
||||
SSM(sci, SCI_SETKEYWORDS, 5, (sptr_t) types[GEANY_FILETYPES_DOCBOOK]->keywords[1]);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_DOCBOOK]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
// Unknown tags and attributes are highlighed in red.
|
||||
// If a tag is actually OK, it should be added in lower case to the htmlKeyWords string.
|
||||
@ -1286,6 +1518,8 @@ void styleset_none(ScintillaObject *sci)
|
||||
{
|
||||
styleset_common(sci, 5);
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_NULL, 0);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_ALL]->wordchars);
|
||||
}
|
||||
|
||||
|
||||
@ -1311,9 +1545,8 @@ static void styleset_css_init(void)
|
||||
styleset_get_hex(config, "styling", "value", "0x7F7F00", "0xffffff", "false", types[GEANY_FILETYPES_CSS]->styling[12]);
|
||||
|
||||
types[GEANY_FILETYPES_CSS]->keywords = g_new(gchar*, 4);
|
||||
types[GEANY_FILETYPES_CSS]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_CSS]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_CSS]->keywords[0] = g_strdup("color background-color background-image background-repeat background-attachment background-position background \
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_CSS, 0,
|
||||
"color background-color background-image background-repeat background-attachment background-position background \
|
||||
font-family font-style font-variant font-weight font-size font \
|
||||
word-spacing letter-spacing text-decoration vertical-align text-transform text-align text-indent line-height \
|
||||
margin-top margin-right margin-bottom margin-left margin \
|
||||
@ -1322,9 +1555,8 @@ static void styleset_css_init(void)
|
||||
border-top border-right border-bottom border-left border \
|
||||
border-color border-style width height float clear \
|
||||
display white-space list-style-type list-style-image list-style-position list-style");
|
||||
types[GEANY_FILETYPES_CSS]->keywords[1] = styleset_get_string(config, "keywords", "secondary");
|
||||
if (types[GEANY_FILETYPES_CSS]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_CSS]->keywords[1] = g_strdup("border-top-color border-right-color border-bottom-color border-left-color border-color \
|
||||
styleset_get_keywords(config, "keywords", "secondary", GEANY_FILETYPES_CSS, 1,
|
||||
"border-top-color border-right-color border-bottom-color border-left-color border-color \
|
||||
border-top-style border-right-style border-bottom-style border-left-style border-style \
|
||||
top right bottom left position z-index direction unicode-bidi \
|
||||
min-width max-width min-height max-height overflow clip visibility content quotes \
|
||||
@ -1338,11 +1570,12 @@ static void styleset_css_init(void)
|
||||
volume speak pause-before pause-after pause cue-before cue-after cue \
|
||||
play-during azimuth elevation speech-rate voice-family pitch pitch-range stress richness \
|
||||
speak-punctuation speak-numeral");
|
||||
types[GEANY_FILETYPES_CSS]->keywords[2] = styleset_get_string(config, "keywords", "pseudoclasses");
|
||||
if (types[GEANY_FILETYPES_CSS]->keywords[2] == NULL)
|
||||
types[GEANY_FILETYPES_CSS]->keywords[2] = g_strdup("first-letter first-line link active visited lang first-child focus hover before after left right first");
|
||||
styleset_get_keywords(config, "keywords", "pseudoclasses", GEANY_FILETYPES_CSS, 2, "first-letter first-line link active visited lang first-child focus hover before after left right first");
|
||||
types[GEANY_FILETYPES_CSS]->keywords[3] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_CSS, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_CSS);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1353,7 +1586,7 @@ void styleset_css(ScintillaObject *sci)
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_CSS]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_CSS, 0);
|
||||
@ -1390,6 +1623,9 @@ static void styleset_conf_init(void)
|
||||
|
||||
types[GEANY_FILETYPES_CONF]->keywords = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_CONF, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_CONF);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1401,7 +1637,7 @@ void styleset_conf(ScintillaObject *sci)
|
||||
styleset_common(sci, 5);
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_PROPERTIES, 0);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_CONF]->wordchars);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
@ -1439,17 +1675,14 @@ static void styleset_asm_init(void)
|
||||
styleset_get_hex(config, "styling", "extinstruction", "0x7F7F00", "0xffffff", "false", types[GEANY_FILETYPES_ASM]->styling[14]);
|
||||
|
||||
types[GEANY_FILETYPES_ASM]->keywords = g_new(gchar*, 4);
|
||||
types[GEANY_FILETYPES_ASM]->keywords[0] = styleset_get_string(config, "keywords", "instructions");
|
||||
if (types[GEANY_FILETYPES_ASM]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_ASM]->keywords[0] = g_strdup("HLT LAD SPI ADD SUB MUL DIV JMP JEZ JGZ JLZ SWAP JSR RET PUSHAC POPAC ADDST SUBST MULST DIVST LSA LDS PUSH POP CLI LDI INK LIA DEK LDX");
|
||||
types[GEANY_FILETYPES_ASM]->keywords[1] = styleset_get_string(config, "keywords", "registers");
|
||||
if (types[GEANY_FILETYPES_ASM]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_ASM]->keywords[1] = g_strdup("");
|
||||
types[GEANY_FILETYPES_ASM]->keywords[2] = styleset_get_string(config, "keywords", "directives");
|
||||
if (types[GEANY_FILETYPES_ASM]->keywords[2] == NULL)
|
||||
types[GEANY_FILETYPES_ASM]->keywords[2] = g_strdup("ORG LIST NOLIST PAGE EQUIVALENT WORD TEXT");
|
||||
styleset_get_keywords(config, "keywords", "instructions", GEANY_FILETYPES_ASM, 0, "HLT LAD SPI ADD SUB MUL DIV JMP JEZ JGZ JLZ SWAP JSR RET PUSHAC POPAC ADDST SUBST MULST DIVST LSA LDS PUSH POP CLI LDI INK LIA DEK LDX");
|
||||
styleset_get_keywords(config, "keywords", "registers", GEANY_FILETYPES_ASM, 1, "");
|
||||
styleset_get_keywords(config, "keywords", "directives", GEANY_FILETYPES_ASM, 2, "ORG LIST NOLIST PAGE EQUIVALENT WORD TEXT");
|
||||
types[GEANY_FILETYPES_ASM]->keywords[3] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_ASM, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_ASM);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1460,7 +1693,7 @@ void styleset_asm(ScintillaObject *sci)
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_ASM]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_ASM, 0);
|
||||
@ -1513,9 +1746,8 @@ static void styleset_sql_init(void)
|
||||
styleset_get_hex(config, "styling", "quotedidentifier", "0x991111", "0xffffff", "false", types[GEANY_FILETYPES_SQL]->styling[14]);
|
||||
|
||||
types[GEANY_FILETYPES_SQL]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_SQL]->keywords[0] = styleset_get_string(config, "keywords", "keywords");
|
||||
if (types[GEANY_FILETYPES_SQL]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_SQL]->keywords[0] = g_strdup("absolute action add admin after aggregate \
|
||||
styleset_get_keywords(config, "keywords", "keywords", GEANY_FILETYPES_SQL, 0,
|
||||
"absolute action add admin after aggregate \
|
||||
alias all allocate alter and any are array as asc \
|
||||
assertion at authorization before begin binary bit blob boolean both breadth by \
|
||||
call cascade cascaded case cast catalog char character check class clob close collate \
|
||||
@ -1544,6 +1776,9 @@ static void styleset_sql_init(void)
|
||||
value values varchar variable varying view when whenever where with without work write");
|
||||
types[GEANY_FILETYPES_SQL]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_SQL, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_SQL);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1554,7 +1789,7 @@ void styleset_sql(ScintillaObject *sci)
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_SQL]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_SQL, 0);
|
||||
@ -1603,17 +1838,17 @@ static void styleset_caml_init(void)
|
||||
styleset_get_hex(config, "styling", "linenum", "0x000000", "0xC0C0C0", "false", types[GEANY_FILETYPES_CAML]->styling[13]);
|
||||
|
||||
types[GEANY_FILETYPES_CAML]->keywords = g_new(gchar*, 3);
|
||||
types[GEANY_FILETYPES_CAML]->keywords[0] = styleset_get_string(config, "keywords", "keywords");
|
||||
if (types[GEANY_FILETYPES_CAML]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_CAML]->keywords[0] = g_strdup("and as assert asr begin class constraint do \
|
||||
styleset_get_keywords(config, "keywords", "keywords", GEANY_FILETYPES_CAML, 0,
|
||||
"and as assert asr begin class constraint do \
|
||||
done downto else end exception external false for fun function functor if in include inherit \
|
||||
initializer land lazy let lor lsl lsr lxor match method mod module mutable new object of open \
|
||||
or private rec sig struct then to true try type val virtual when while with");
|
||||
types[GEANY_FILETYPES_CAML]->keywords[1] = styleset_get_string(config, "keywords", "keywords_optional");
|
||||
if (types[GEANY_FILETYPES_CAML]->keywords[1] == NULL)
|
||||
types[GEANY_FILETYPES_CAML]->keywords[1] = g_strdup("option Some None ignore ref");
|
||||
styleset_get_keywords(config, "keywords", "keywords_optional", GEANY_FILETYPES_CAML, 1, "option Some None ignore ref");
|
||||
types[GEANY_FILETYPES_CAML]->keywords[2] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_CAML, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_CAML);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1624,7 +1859,7 @@ void styleset_caml(ScintillaObject *sci)
|
||||
|
||||
styleset_common(sci, 5);
|
||||
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_CAML]->wordchars);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM(sci, SCI_SETLEXER, SCLEX_CAML, 0);
|
||||
@ -1669,15 +1904,16 @@ static void styleset_oms_init(void)
|
||||
styleset_get_hex(config, "styling", "scalar", "0xff0000", "0xffffff", "false", types[GEANY_FILETYPES_OMS]->styling[10]);
|
||||
|
||||
types[GEANY_FILETYPES_OMS]->keywords = g_new(gchar*, 2);
|
||||
types[GEANY_FILETYPES_OMS]->keywords[0] = styleset_get_string(config, "keywords", "primary");
|
||||
if (types[GEANY_FILETYPES_OMS]->keywords[0] == NULL)
|
||||
types[GEANY_FILETYPES_OMS]->keywords[0] = g_strdup("clear seq fillcols fillrowsgaspect gaddview \
|
||||
styleset_get_keywords(config, "keywords", "primary", GEANY_FILETYPES_OMS, 0, "clear seq fillcols fillrowsgaspect gaddview \
|
||||
gtitle gxaxis gyaxis max contour gcolor gplot gaddview gxaxis gyaxis gcolor fill coldim gplot \
|
||||
gtitle clear arcov dpss fspec cos gxaxis gyaxis gtitle gplot gupdate rowdim fill print for to begin \
|
||||
end write cocreate coinvoke codispsave cocreate codispset copropput colsum sqrt adddialog \
|
||||
addcontrol addcontrol delwin fillrows function gaspect conjdir");
|
||||
types[GEANY_FILETYPES_OMS]->keywords[1] = NULL;
|
||||
|
||||
styleset_get_wordchars(config, GEANY_FILETYPES_OMS, GEANY_WORDCHARS);
|
||||
filetypes_get_config(config, GEANY_FILETYPES_OMS);
|
||||
|
||||
g_key_file_free(config);
|
||||
}
|
||||
|
||||
@ -1689,7 +1925,7 @@ void styleset_oms(ScintillaObject *sci)
|
||||
styleset_common(sci, 5);
|
||||
SSM (sci, SCI_SETLEXER, SCLEX_OMS, 0);
|
||||
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) GEANY_WORDCHARS);
|
||||
SSM (sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_OMS]->wordchars);
|
||||
SSM (sci, SCI_AUTOCSETMAXHEIGHT, 8, 0);
|
||||
|
||||
SSM (sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint styling[55][4];
|
||||
gchar **keywords;
|
||||
gint styling[55][4];
|
||||
gchar **keywords;
|
||||
gchar *wordchars;
|
||||
} style_set;
|
||||
|
||||
|
||||
@ -38,9 +39,11 @@ void styleset_common(ScintillaObject *sci, gint style_bits);
|
||||
|
||||
void styleset_c(ScintillaObject *sci);
|
||||
|
||||
void styleset_cpp(ScintillaObject *sci);
|
||||
|
||||
void styleset_makefile(ScintillaObject *sci);
|
||||
|
||||
void styleset_tex(ScintillaObject *sci);
|
||||
void styleset_latex(ScintillaObject *sci);
|
||||
|
||||
void styleset_php(ScintillaObject *sci);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user