52#include <gdk/gdkkeysyms.h>
117 msgwindow.messages_dir = g_strdup(messages_dir);
124 GtkWidgetPath *path = gtk_widget_path_new();
125 GtkStyleContext *ctx = gtk_style_context_new();
127 gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
128 gtk_widget_path_iter_set_name(path, -1, color_name);
129 gtk_style_context_set_screen(ctx, gdk_screen_get_default());
130 gtk_style_context_set_path(ctx, path);
131 gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &rgba_color);
133 color->red = 0xffff * rgba_color.red;
134 color->green = 0xffff * rgba_color.green;
135 color->blue = 0xffff * rgba_color.blue;
137 gtk_widget_path_unref(path);
177 if (enter_or_return || event->keyval == GDK_KEY_space)
179 switch (GPOINTER_TO_INT(data))
200 GtkCellRenderer *renderer;
201 GtkTreeViewColumn *column;
203 msgwindow.store_status = gtk_list_store_new(1, G_TYPE_STRING);
204 gtk_tree_view_set_model(GTK_TREE_VIEW(
msgwindow.tree_status), GTK_TREE_MODEL(
msgwindow.store_status));
207 renderer = gtk_cell_renderer_text_new();
208 column = gtk_tree_view_column_new_with_attributes(
_(
"Status messages"), renderer,
"text", 0,
NULL);
209 gtk_tree_view_append_column(GTK_TREE_VIEW(
msgwindow.tree_status), column);
211 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(
msgwindow.tree_status), FALSE);
215 g_signal_connect(
msgwindow.tree_status,
"button-press-event",
224 GtkCellRenderer *renderer;
225 GtkTreeViewColumn *column;
226 GtkTreeSelection *selection;
230 GDK_TYPE_COLOR, G_TYPE_STRING);
231 gtk_tree_view_set_model(GTK_TREE_VIEW(
msgwindow.tree_msg), GTK_TREE_MODEL(
msgwindow.store_msg));
234 renderer = gtk_cell_renderer_text_new();
235 column = gtk_tree_view_column_new_with_attributes(
NULL, renderer,
237 gtk_tree_view_append_column(GTK_TREE_VIEW(
msgwindow.tree_msg), column);
239 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(
msgwindow.tree_msg), FALSE);
245 g_signal_connect(
msgwindow.tree_msg,
"button-release-event",
248 g_signal_connect(
msgwindow.tree_msg,
"button-press-event",
250 g_signal_connect(
msgwindow.tree_msg,
"key-press-event",
254 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
msgwindow.tree_msg));
255 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
263 GtkCellRenderer *renderer;
264 GtkTreeViewColumn *column;
265 GtkTreeSelection *selection;
268 gtk_tree_view_set_model(GTK_TREE_VIEW(
msgwindow.tree_compiler), GTK_TREE_MODEL(
msgwindow.store_compiler));
269 g_object_unref(
msgwindow.store_compiler);
271 renderer = gtk_cell_renderer_text_new();
272 column = gtk_tree_view_column_new_with_attributes(
NULL, renderer,
274 gtk_tree_view_append_column(GTK_TREE_VIEW(
msgwindow.tree_compiler), column);
276 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(
msgwindow.tree_compiler), FALSE);
282 g_signal_connect(
msgwindow.tree_compiler,
"button-release-event",
285 g_signal_connect(
msgwindow.tree_compiler,
"button-press-event",
287 g_signal_connect(
msgwindow.tree_compiler,
"key-press-event",
291 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
msgwindow.tree_compiler));
292 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
303 default:
return NULL;
326 string = g_strdup_vprintf(
format, args);
349 if (! g_utf8_validate(msg, -1,
NULL))
352 utf8_msg = (gchar *) msg;
354 gtk_list_store_append(
msgwindow.store_compiler, &iter);
355 gtk_list_store_set(
msgwindow.store_compiler, &iter,
360 GtkTreePath *path = gtk_tree_model_get_path(
361 gtk_tree_view_get_model(GTK_TREE_VIEW(
msgwindow.tree_compiler)), &iter);
363 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(
msgwindow.tree_compiler), path,
NULL, TRUE, 0.5, 0.5);
364 gtk_tree_path_free(path);
376 gtk_check_menu_item_set_active(
409 string = g_strdup_vprintf(
format, args);
447 len = strlen(
string);
449 tmp = g_strndup(
string, 1024);
451 tmp = g_strdup(
string);
453 if (! g_utf8_validate(tmp, -1,
NULL))
458 gtk_list_store_append(
msgwindow.store_msg, &iter);
459 gtk_list_store_set(
msgwindow.store_msg, &iter,
484 gchar *statusmsg, *time_str;
488 statusmsg = g_strconcat(time_str,
": ",
string,
NULL);
492 gtk_list_store_append(
msgwindow.store_status, &iter);
493 gtk_list_store_set(
msgwindow.store_status, &iter, 0, statusmsg, -1);
498 GtkTreePath *path = gtk_tree_model_get_path(gtk_tree_view_get_model(GTK_TREE_VIEW(
msgwindow.tree_status)), &iter);
500 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(
msgwindow.tree_status), path,
NULL, FALSE, 0.0, 0.0);
503 gtk_tree_path_free(path);
526 string = g_strdup_vprintf(
format, args);
537 gint tabnum = GPOINTER_TO_INT(user_data);
547 GtkTreeSelection *selection;
552 switch (GPOINTER_TO_INT(user_data))
568 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
tv));
570 if (gtk_tree_selection_get_selected(selection, &model, &iter))
574 gtk_tree_model_get(model, &iter, str_idx, &
string, -1);
577 gtk_clipboard_set_text(gtk_clipboard_get(gdk_atom_intern(
"CLIPBOARD", FALSE)),
587 GtkListStore *store =
msgwindow.store_compiler;
589 GString *str = g_string_new(
"");
593 switch (GPOINTER_TO_INT(user_data))
611 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
616 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, str_idx, &
line, -1);
619 g_string_append(str,
line);
620 g_string_append_c(str,
'\n');
624 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
630 gtk_clipboard_set_text(
631 gtk_clipboard_get(gdk_atom_intern(
"CLIPBOARD", FALSE)),
635 g_string_free(str, TRUE);
648 GtkWidget *message_popup_menu, *
clear, *copy, *copy_all, *image;
650 message_popup_menu = gtk_menu_new();
652 clear = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR,
NULL);
653 gtk_widget_show(
clear);
655 g_signal_connect(
clear,
"activate",
658 copy = gtk_image_menu_item_new_with_mnemonic(
_(
"C_opy"));
659 gtk_widget_show(copy);
661 image = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
662 gtk_widget_show(image);
663 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(copy), image);
664 g_signal_connect(copy,
"activate",
667 copy_all = gtk_image_menu_item_new_with_mnemonic(
_(
"Copy _All"));
668 gtk_widget_show(copy_all);
670 image = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
671 gtk_widget_show(image);
672 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(copy_all), image);
673 g_signal_connect(copy_all,
"activate",
678 return message_popup_menu;
693 item = gtk_separator_menu_item_new();
694 gtk_widget_show(item);
697 item = gtk_menu_item_new_with_mnemonic(
_(
"_Hide Message Window"));
698 gtk_widget_show(item);
711 while (gtk_tree_path_prev(cur))
713 if (gtk_tree_model_get_iter(model, &iter, cur))
732 gboolean ret = FALSE;
735 if (!fname ||
line <= -1)
743 if (!g_file_test(
filename, G_FILE_TEST_EXISTS))
756 if (g_file_test(
name, G_FILE_TEST_EXISTS))
758 ui_set_statusbar(FALSE,
_(
"Could not find file '%s' - trying the current document path."),
772 g_free(utf8_filename);
783 if (ret && focus_editor)
784 gtk_widget_grab_focus(GTK_WIDGET(doc->
editor->
sci));
800 GtkTreeSelection *selection;
804 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
msgwindow.tree_compiler));
805 if (gtk_tree_selection_get_selected(selection, &model, &iter))
812 gdk_color_free(
color);
815 gdk_color_free(
color);
825 path = gtk_tree_model_get_path(model, &iter);
827 gtk_tree_path_free(path);
843 guint skip_dot_slash = 0;
850 if (strncmp(*
filename,
"./", 2) == 0)
921 gchar *tmp =
strstr(
string,
" in ");
995 if (strncmp(
string,
"warning - ", 10) == 0)
1015 if (strncmp(
string,
"Error: Compile Error", 20) == 0)
1058 strncmp(
string,
"[javac]", 7) == 0)
1069 if (
strstr(
string,
"libtool --mode=link") ==
NULL)
1094 gchar *trimmed_string, *utf8_dir;
1099 if (G_UNLIKELY(
string ==
NULL))
1105 utf8_dir = g_strdup(dir);
1106 g_return_if_fail(utf8_dir !=
NULL);
1108 trimmed_string = g_strdup(
string);
1109 g_strchug(trimmed_string);
1120 g_free(trimmed_string);
1131 gboolean incertain = TRUE;
1136 fields = g_strsplit(
string,
":", 2);
1138 if (fields[0] !=
NULL)
1145 if (fields[1] !=
NULL)
1149 *
line = strtol(fields[1], &end, 10);
1150 if (end == fields[1])
1152 else if (*end ==
':' || g_ascii_isspace(*end))
1160 if (incertain && ! g_file_test(*
filename, G_FILE_TEST_EXISTS))
1173 GtkTreeModel *model;
1174 GtkTreeSelection *selection;
1175 gboolean ret = FALSE;
1177 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
msgwindow.tree_msg));
1178 if (gtk_tree_selection_get_selected(selection, &model, &iter))
1186 gtk_tree_model_get(model, &iter,
1188 if (
line >= 0 &&
id > 0)
1200 if (ret && focus_editor)
1201 gtk_widget_grab_focus(GTK_WIDGET(doc->
editor->
sci));
1204 else if (
line < 0 &&
string !=
NULL)
1217 if (ret && focus_editor)
1218 gtk_widget_grab_focus(GTK_WIDGET(doc->
editor->
sci));
1233 gboolean double_click =
event->type == GDK_2BUTTON_PRESS;
1235 if (event->button == 1 && (event->type == GDK_BUTTON_RELEASE || double_click))
1237 switch (GPOINTER_TO_INT(user_data))
1250 return double_click;
1253 if (event->button == 3)
1255 switch (GPOINTER_TO_INT(user_data))
1260 event->button, event->time);
1266 event->button, event->time);
1272 event->button, event->time);
1295 GtkWidget *widget =
NULL;
1304 case MSG_VTE: widget = (vte_info.have_vte) ? vc->vte :
NULL;
break;
1313 gtk_notebook_set_current_page(GTK_NOTEBOOK(
msgwindow.notebook), tabnum);
1315 gtk_widget_grab_focus(widget);
1330 GtkListStore *store =
NULL;
1339 gtk_list_store_clear(
msgwindow.store_compiler);
1348 gtk_list_store_clear(store);
GeanyBuildInfo build_info
gboolean build_parse_make_dir(const gchar *string, gchar **prefix)
void build_menu_update(GeanyDocument *doc)
Interface to the Build menu functionality.
GeanyDocument * document_get_current(void)
Finds the current document.
GeanyDocument * document_find_by_filename(const gchar *utf8_filename)
Finds a document with the given filename.
GeanyDocument * document_open_file(const gchar *locale_filename, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens a document specified by locale_filename.
GeanyDocument * document_find_by_id(guint id)
Lookup an old document by its ID.
Document related actions: new, save, open, etc.
void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line)
Sets an indicator indic on line.
GeanyEditorPrefs editor_prefs
@ GEANY_INDICATOR_ERROR
Indicator to highlight errors in the document text.
Filetype detection, file extensions and filetype menu items.
@ GEANY_FILETYPES_FORTRAN
#define filetypes
Wraps GeanyData::filetypes_array so it can be used with C array syntax.
void keybindings_send_command(guint group_id, guint key_id)
Mimics a (built-in only) keybinding action.
Configurable keyboard shortcuts.
@ GEANY_KEY_GROUP_FOCUS
Group.
@ GEANY_KEYS_FOCUS_EDITOR
Keybinding.
Main program-related commands.
void msgwin_switch_tab(gint tabnum, gboolean show)
Switches to the given notebook tab of the messages window.
static gboolean goto_compiler_file_line(const gchar *fname, gint line, gboolean focus_editor)
void msgwin_status_add_string(const gchar *string)
Logs a new status message without setting the status bar.
static void prepare_status_tree_view(void)
void msgwin_clear_tab(gint tabnum)
Removes all messages from a tab specified by tabnum in the messages window.
gboolean msgwin_goto_messages_file_line(gboolean focus_editor)
static const GdkColor * get_color(gint msg_color)
static void load_color(const gchar *color_name, GdkColor *color)
void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gchar **filename, gint *line)
static void make_absolute(gchar **filename, const gchar *dir)
static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer user_data)
void msgwin_show_hide_tabs(void)
void msgwin_set_messages_dir(const gchar *messages_dir)
Sets the Messages path for opening any parsed filenames without absolute path from message lines.
static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
static gboolean on_msgwin_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
static void parse_compiler_error_line(const gchar *string, gchar **filename, gint *line)
static GdkColor color_context
void msgwin_show_hide(gboolean show)
static GdkColor color_message
void msgwin_compiler_add_string(gint msg_color, const gchar *msg)
Adds a new message in the compiler tab treeview in the messages window.
static void on_message_treeview_clear_activate(GtkMenuItem *menuitem, gpointer user_data)
void msgwin_finalize(void)
void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *format,...)
Adds a formatted message in the messages tab treeview in the messages window.
void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const gchar *string)
Adds a new message in the messages tab treeview in the messages window.
static void on_hide_message_window(GtkMenuItem *menuitem, gpointer user_data)
void msgwin_status_add(const gchar *format,...)
Logs a formatted status message without setting the status bar.
static void on_compiler_treeview_copy_activate(GtkMenuItem *menuitem, gpointer user_data)
gboolean msgwin_goto_compiler_file_line(gboolean focus_editor)
static void msgwin_parse_generic_line(const gchar *string, gchar **filename, gint *line)
static void prepare_msg_tree_view(void)
static void parse_file_line(ParseData *data, gchar **filename, gint *line)
void msgwin_menu_add_common_items(GtkMenu *menu)
static GtkWidget * create_message_popup_menu(gint type)
void msgwin_compiler_add(gint msg_color, const gchar *format,...)
Adds a formatted message in the compiler tab treeview in the messages window.
static gboolean find_prev_build_dir(GtkTreePath *cur, GtkTreeModel *model, gchar **prefix)
static void prepare_compiler_tree_view(void)
static void on_compiler_treeview_copy_all_activate(GtkMenuItem *menuitem, gpointer user_data)
static GdkColor color_error
Message window functions (status, compiler, messages windows).
@ MSG_COMPILER
Index of the compiler tab.
@ MSG_VTE
Index of the VTE tab.
@ MSG_STATUS
Index of the status message tab.
@ MSG_MESSAGE
Index of the messages tab.
@ MSG_SCRATCH
Index of the scratch tab.
@ COLOR_DARK_RED
Color dark red.
gboolean navqueue_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line)
Adds old file position and new file position to the navqueue, then goes to the new position.
char * strstr(const char *str, const char *substr)
gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message, gchar **filename, gint *line)
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button)
Structure for representing an open tab with all its properties.
gchar * file_name
The UTF-8 encoded file name.
gboolean changed
Whether this document has been changed since it was last saved.
GeanyEditor * editor
The editor associated with the document.
guint id
A pseudo-unique ID for this document.
ScintillaObject * sci
The Scintilla editor GtkWidget.
gboolean compiler_tab_autoscroll
whether compiler messages window is automatically scrolled to show new messages
gboolean msgwin_status_visible
whether message window's status tab is visible
gchar * msgwin_font
message window font
gboolean msgwin_compiler_visible
whether message window's compiler tab is visible
gboolean msgwin_scribble_visible
whether message window's scribble tab is visible
gboolean msgwin_messages_visible
whether message window's messages tab is visible
GtkWidget * window
Main window.
GtkWidget * message_window_notebook
Message Window notebook.
gboolean switch_to_status
Defines internationalization macros.
void ui_widget_show_hide(GtkWidget *widget, gboolean show)
gboolean ui_is_keyval_enter_or_return(guint keyval)
Checks whether the passed keyval is the Enter or Return key.
GeanyMainWidgets main_widgets
void ui_set_statusbar(gboolean log, const gchar *format,...)
Displays text on the statusbar.
GtkWidget * ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
Returns a widget from a name in a component, usually created by Glade.
void ui_widget_modify_font_from_string(GtkWidget *widget, const gchar *str)
Modifies the font of a widget using gtk_widget_modify_font().
GeanyInterfacePrefs interface_prefs
User Interface general utility functions.
gchar * utils_get_utf8_from_locale(const gchar *locale_text)
Converts the given string (in locale encoding) into UTF-8 encoding.
gchar * utils_get_current_file_dir_utf8(void)
gchar * utils_get_current_time_string(gboolean include_microseconds)
gboolean utils_is_absolute_path(const gchar *path)
gchar * utils_get_locale_from_utf8(const gchar *utf8_text)
Converts the given UTF-8 encoded string into locale encoding.
General utility functions, non-GTK related.
#define SETPTR(ptr, result)
Assigns result to ptr, then frees the old value.
#define EMPTY(ptr)
Returns TRUE if ptr is NULL or *ptr is FALSE.