Add Next Message and Next Error menu items.

Don't select the last build message on completing a build.
Change build_get_menu_items(-1) to return current build menu.
Add Copy popup menu item for Status and Messages windows.
Move on_message_treeview_clear_activate(),
on_compiler_treeview_copy_activate() to msgwindow.c.
Create the Recent files submenu item manually because Glade 2.10
removes empty menus.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1068 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2006-12-08 15:50:10 +00:00
parent d14742366c
commit 978de6fe6f
13 changed files with 377 additions and 222 deletions

View File

@ -1,3 +1,19 @@
2006-12-08 Nick Treleaven <nick.treleaven@btinternet.com>
* src/build.c, src/interface.c, src/ui_utils.h, src/build.h,
src/keybindings.c, src/msgwindow.c, src/callbacks.c,
src/msgwindow.h, src/callbacks.h, src/main.c, src/ui_utils.c,
geany.glade:
Add Next Message and Next Error menu items.
Don't select the last build message on completing a build.
Change build_get_menu_items(-1) to return current build menu.
Add Copy popup menu item for Status and Messages windows.
Move on_message_treeview_clear_activate(),
on_compiler_treeview_copy_activate() to msgwindow.c.
Create the Recent files submenu item manually because Glade 2.10
removes empty menus.
2006-12-08 Enrico Troeger <enrico.troeger@uvena.de>
* src/build.c: Made the created run script for command execution a bit

View File

@ -18,7 +18,6 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Geany</atkproperty>
</accessibility>
@ -32,8 +31,6 @@
<child>
<widget class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
<property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
<child>
<widget class="GtkMenuItem" id="menuitem1">
@ -60,7 +57,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1176">
<widget class="GtkImage" id="image1252">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -105,11 +102,6 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Recent _files</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="recent_files1_menu">
</widget>
</child>
</widget>
</child>
@ -146,7 +138,7 @@
<signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1177">
<widget class="GtkImage" id="image1253">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@ -167,7 +159,7 @@
<signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1178">
<widget class="GtkImage" id="image1254">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -187,7 +179,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1179">
<widget class="GtkImage" id="image1255">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -267,7 +259,7 @@
<signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1180">
<widget class="GtkImage" id="image1256">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
@ -475,7 +467,7 @@
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1181">
<widget class="GtkImage" id="image1257">
<property name="visible">True</property>
<property name="stock">gtk-indent</property>
<property name="icon_size">1</property>
@ -496,7 +488,7 @@
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1182">
<widget class="GtkImage" id="image1258">
<property name="visible">True</property>
<property name="stock">gtk-unindent</property>
<property name="icon_size">1</property>
@ -526,7 +518,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1183">
<widget class="GtkImage" id="image1259">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -558,7 +550,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1184">
<widget class="GtkImage" id="image1260">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -701,6 +693,15 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="find_in_files1">
<property name="visible">True</property>
<property name="label" translatable="yes">Find in f_iles</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_find_in_files1_activate" last_modification_time="Thu, 06 Jul 2006 11:31:09 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="replace1">
<property name="visible">True</property>
@ -709,7 +710,7 @@
<signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1185">
<widget class="GtkImage" id="image1261">
<property name="visible">True</property>
<property name="stock">gtk-find-and-replace</property>
<property name="icon_size">1</property>
@ -723,22 +724,22 @@
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator27">
<widget class="GtkSeparatorMenuItem" id="separator33">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="find_in_files1">
<widget class="GtkMenuItem" id="next_message1">
<property name="visible">True</property>
<property name="label" translatable="yes">Find in f_iles</property>
<property name="label" translatable="yes">Next _Message</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_find_in_files1_activate" last_modification_time="Thu, 06 Jul 2006 11:31:09 GMT"/>
<signal name="activate" handler="on_next_message1_activate" last_modification_time="Tue, 05 Dec 2006 11:15:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator11">
<widget class="GtkSeparatorMenuItem" id="separator32">
<property name="visible">True</property>
</widget>
</child>
@ -751,7 +752,7 @@
<signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1186">
<widget class="GtkImage" id="image1262">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -786,7 +787,7 @@
<signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1187">
<widget class="GtkImage" id="image1263">
<property name="visible">True</property>
<property name="stock">gtk-select-font</property>
<property name="icon_size">1</property>
@ -1017,7 +1018,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Convert and set to _CR/LF (Win)</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="active">True</property>
<signal name="activate" handler="on_crlf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
</widget>
</child>
@ -1027,7 +1028,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Convert and set to _LF (Unix)</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<property name="active">True</property>
<property name="group">crlf</property>
<signal name="activate" handler="on_lf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
</widget>
@ -1136,7 +1137,7 @@
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1188">
<widget class="GtkImage" id="image1264">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
@ -2654,7 +2655,6 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">

View File

@ -63,9 +63,9 @@ enum
};
static BuildMenuItems default_menu_items =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static BuildMenuItems latex_menu_items =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
@ -83,6 +83,7 @@ static void free_pointers(gpointer first, ...);
static void kill_process(GPid *pid);
#endif
void build_finalize()
{
g_free(build_info.dir);
@ -430,7 +431,7 @@ static GPid build_spawn_cmd(gint idx, gchar **cmd)
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)"), utf8_cmd_string, utf8_working_dir);
msgwin_compiler_add(COLOR_BLUE, _("%s (in directory: %s)"), utf8_cmd_string, utf8_working_dir);
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
// set the build info for the message window
@ -678,7 +679,7 @@ static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
}
g_free(filename);
}
msgwin_compiler_add(color, FALSE, msg);
msgwin_compiler_add(color, msg);
g_free(msg);
}
@ -697,7 +698,7 @@ static void show_build_result_message(gboolean failure)
if (failure)
{
msg = _("Compilation failed.");
msgwin_compiler_add(COLOR_DARK_RED, TRUE, "%s", msg);
msgwin_compiler_add(COLOR_DARK_RED, "%s", msg);
// If msgwindow is hidden, user will want to display it to see the error
if (! app->msgwindow_visible)
{
@ -711,7 +712,7 @@ static void show_build_result_message(gboolean failure)
else
{
msg = _("Compilation finished successfully.");
msgwin_compiler_add(COLOR_BLUE, TRUE, "%s", msg);
msgwin_compiler_add(COLOR_BLUE, "%s", msg);
if (! app->msgwindow_visible ||
gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
ui_set_statusbar("%s", msg);
@ -877,6 +878,17 @@ static void create_build_menu_gen(BuildMenuItems *menu_items)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
// next error
item = gtk_image_menu_item_new_with_mnemonic(_("_Next Error"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_next_error), NULL);
menu_items->item_next_error = item;
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
// execute the code
item = gtk_image_menu_item_new_from_stock("gtk-execute", accel_group);
gtk_widget_show(item);
@ -949,12 +961,9 @@ static void create_build_menu_tex(BuildMenuItems *menu_items)
G_CALLBACK(on_build_tex_activate), GINT_TO_POINTER(LATEX_CMD_TO_PDF));
menu_items->item_link = item;
if (item != NULL)
{
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
}
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
// build the code with make all
item = gtk_image_menu_item_new_with_mnemonic(_("_Make all"));
@ -978,14 +987,22 @@ static void create_build_menu_tex(BuildMenuItems *menu_items)
GINT_TO_POINTER(GBO_MAKE_CUSTOM));
menu_items->item_make_custom = item;
if (item != NULL)
{
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
}
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
#endif
// next error
item = gtk_image_menu_item_new_with_mnemonic(_("_Next Error"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_next_error), NULL);
menu_items->item_next_error = item;
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
// DVI view
#define LATEX_VIEW_DVI_LABEL _("View DVI file") // used later again
item = gtk_image_menu_item_new_with_mnemonic(LATEX_VIEW_DVI_LABEL);
@ -1063,7 +1080,7 @@ static gboolean is_c_header(const gchar *fname)
void build_menu_update(gint idx)
{
filetype *ft;
gboolean have_path, can_build, can_make, can_run, can_set_args;
gboolean have_path, can_build, can_make, can_run, can_set_args, have_errors;
BuildMenuItems *menu_items;
if (idx == -1)
@ -1090,7 +1107,7 @@ void build_menu_update(gint idx)
ft->menu_items->can_link = FALSE;
#endif
menu_items = build_get_menu_items(ft);
menu_items = build_get_menu_items(ft->id);
/* Note: don't remove the submenu first because it can now cause an X hang if
* the menu is already open when called from build_exit_cb(). */
gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")),
@ -1138,6 +1155,10 @@ void build_menu_update(gint idx)
// show the stop command if a program is running, otherwise show run command
set_stop_button(run_info.pid > 1);
have_errors = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_compiler),
NULL) > 0;
gtk_widget_set_sensitive(menu_items->item_next_error, have_errors);
}
@ -1146,7 +1167,7 @@ static void set_stop_button(gboolean stop)
{
GtkStockItem sitem;
GtkWidget *menuitem =
build_get_menu_items(filetypes[run_info.file_type_id])->item_exec;
build_get_menu_items(run_info.file_type_id)->item_exec;
if (stop && utils_str_equal(
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(app->run_button)), "gtk-stop")) return;
@ -1195,12 +1216,23 @@ static void set_stop_button(gboolean stop)
}
// Creates the relevant build menu if necessary.
BuildMenuItems *build_get_menu_items(const filetype *ft)
/* Creates the relevant build menu if necessary.
* If filetype_id is -1, the current filetype is used, or GEANY_FILETYPES_ALL */
BuildMenuItems *build_get_menu_items(gint filetype_id)
{
BuildMenuItems *items;
if (FILETYPE_ID(ft) == GEANY_FILETYPES_LATEX)
if (filetype_id == -1)
{
gint idx = document_get_cur_idx();
filetype *ft = NULL;
if (DOC_IDX_VALID(idx))
ft = doc_list[idx].file_type;
filetype_id = FILETYPE_ID(ft);
}
if (filetype_id == GEANY_FILETYPES_LATEX)
{
items = &latex_menu_items;
if (items->menu == NULL)
@ -1430,3 +1462,13 @@ static void free_pointers(gpointer first, ...)
}
void
on_build_next_error (GtkMenuItem *menuitem,
gpointer user_data)
{
if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_compiler),
msgwin_goto_compiler_file_line))
ui_set_statusbar(_("No more build errors."));
}

View File

@ -24,8 +24,6 @@
#ifndef GEANY_BUILD_H
#define GEANY_BUILD_H 1
#include "filetypes.h"
typedef enum // Geany Build Options
{
GBO_COMPILE,
@ -54,6 +52,7 @@ typedef struct
GtkWidget *item_make_all;
GtkWidget *item_make_custom;
GtkWidget *item_make_object;
GtkWidget *item_next_error;
GtkWidget *item_exec;
GtkWidget *item_exec2;
GtkWidget *item_set_args;
@ -77,7 +76,7 @@ GPid build_run_cmd(gint idx);
void build_menu_update(gint idx);
BuildMenuItems *build_get_menu_items(const filetype *ft);
BuildMenuItems *build_get_menu_items(gint filetype_id);
void
@ -104,4 +103,7 @@ void
on_build_arguments_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_build_next_error (GtkMenuItem *menuitem,
gpointer user_data);
#endif

View File

@ -1240,36 +1240,6 @@ on_show_color_chooser1_activate (GtkMenuItem *menuitem,
}
void
on_message_treeview_clear_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gtk_list_store_clear(GTK_LIST_STORE(user_data));
}
void
on_compiler_treeview_copy_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkTreeIter iter;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_compiler));
GtkTreeModel *model;
gchar *string;
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
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)), string, -1);
}
g_free(string);
}
}
void
on_compile_button_clicked (GtkToolButton *toolbutton,
gpointer user_data)
@ -2015,3 +1985,12 @@ on_menu_decrease_indent1_activate (GtkMenuItem *menuitem,
}
}
void
on_next_message1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_msg),
msgwin_goto_messages_file_line))
ui_set_statusbar(_("No more message items."));
}

View File

@ -272,19 +272,10 @@ void
on_goto_tag_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_compiler_treeview_copy_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_message_treeview_clear_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_construct_completion1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_count_words1_activate (GtkMenuItem *menuitem,
gpointer user_data);
@ -546,3 +537,8 @@ void
on_menu_toggle_line_commentation1_activate
(GtkMenuItem *menuitem,
gpointer user_data);
void
on_next_message1_activate (GtkMenuItem *menuitem,
gpointer user_data);

View File

@ -37,22 +37,21 @@ create_window1 (void)
GtkWidget *menuitem1_menu;
GtkWidget *menu_new1;
GtkWidget *menu_new_with_template1;
GtkWidget *image1176;
GtkWidget *image1252;
GtkWidget *menu_new_with_template1_menu;
GtkWidget *invisible2;
GtkWidget *separator12;
GtkWidget *menu_open1;
GtkWidget *recent_files1;
GtkWidget *recent_files1_menu;
GtkWidget *separator13;
GtkWidget *menu_save1;
GtkWidget *menu_save_as1;
GtkWidget *menu_save_all1;
GtkWidget *image1177;
GtkWidget *image1253;
GtkWidget *menu_reload1;
GtkWidget *image1178;
GtkWidget *image1254;
GtkWidget *menu_reload_as1;
GtkWidget *image1179;
GtkWidget *image1255;
GtkWidget *menu_reload_as1_menu;
GtkWidget *invisible7;
GtkWidget *separator21;
@ -62,7 +61,7 @@ create_window1 (void)
GtkWidget *separator14;
GtkWidget *menu_close1;
GtkWidget *menu_close_all1;
GtkWidget *image1180;
GtkWidget *image1256;
GtkWidget *menu_separatormenuitem1;
GtkWidget *menu_quit1;
GtkWidget *edit1;
@ -88,16 +87,16 @@ create_window1 (void)
GtkWidget *menu_duplicate_line1;
GtkWidget *separator29;
GtkWidget *menu_increase_indent1;
GtkWidget *image1181;
GtkWidget *image1257;
GtkWidget *menu_decrease_indent1;
GtkWidget *image1182;
GtkWidget *image1258;
GtkWidget *separator18;
GtkWidget *insert_include2;
GtkWidget *image1183;
GtkWidget *image1259;
GtkWidget *insert_include2_menu;
GtkWidget *invisible4;
GtkWidget *add_comments1;
GtkWidget *image1184;
GtkWidget *image1260;
GtkWidget *add_comments1_menu;
GtkWidget *menu_add_changelog_entry1;
GtkWidget *insert_file_header1;
@ -114,17 +113,18 @@ create_window1 (void)
GtkWidget *find1;
GtkWidget *find_next1;
GtkWidget *find_previous1;
GtkWidget *replace1;
GtkWidget *image1185;
GtkWidget *separator27;
GtkWidget *find_in_files1;
GtkWidget *separator11;
GtkWidget *replace1;
GtkWidget *image1261;
GtkWidget *separator33;
GtkWidget *next_message1;
GtkWidget *separator32;
GtkWidget *go_to_line1;
GtkWidget *image1186;
GtkWidget *image1262;
GtkWidget *menuitem3;
GtkWidget *menuitem3_menu;
GtkWidget *menu_change_font1;
GtkWidget *image1187;
GtkWidget *image1263;
GtkWidget *menu_separator4;
GtkWidget *menu_fullscreen1;
GtkWidget *menu_show_messages_window1;
@ -166,7 +166,7 @@ create_window1 (void)
GtkWidget *tools1;
GtkWidget *tools1_menu;
GtkWidget *menu_choose_color1;
GtkWidget *image1188;
GtkWidget *image1264;
GtkWidget *menu_count_words1;
GtkWidget *menu_item5;
GtkWidget *menu_item5_menu;
@ -266,9 +266,9 @@ create_window1 (void)
gtk_widget_show (menu_new_with_template1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1);
image1176 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1176);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1176);
image1252 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1252);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1252);
menu_new_with_template1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
@ -289,9 +289,6 @@ create_window1 (void)
gtk_widget_show (recent_files1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), recent_files1);
recent_files1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files1), recent_files1_menu);
separator13 = gtk_separator_menu_item_new ();
gtk_widget_show (separator13);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), separator13);
@ -310,25 +307,25 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1);
gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
image1177 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1177);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1177);
image1253 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1253);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1253);
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
gtk_widget_show (menu_reload1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload1);
image1178 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1178);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1178);
image1254 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1254);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1254);
menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload as"));
gtk_widget_show (menu_reload_as1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload_as1);
image1179 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1179);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1179);
image1255 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1255);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1255);
menu_reload_as1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
@ -369,9 +366,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1);
gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
image1180 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1180);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1180);
image1256 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1256);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1256);
menu_separatormenuitem1 = gtk_separator_menu_item_new ();
gtk_widget_show (menu_separatormenuitem1);
@ -479,17 +476,17 @@ create_window1 (void)
gtk_widget_show (menu_increase_indent1);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
image1181 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1181);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1181);
image1257 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1257);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1257);
menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
gtk_widget_show (menu_decrease_indent1);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
image1182 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1182);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1182);
image1258 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1258);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1258);
separator18 = gtk_separator_menu_item_new ();
gtk_widget_show (separator18);
@ -500,9 +497,9 @@ create_window1 (void)
gtk_widget_show (insert_include2);
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
image1183 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1183);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1183);
image1259 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1259);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1259);
insert_include2_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
@ -514,9 +511,9 @@ create_window1 (void)
gtk_widget_show (add_comments1);
gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
image1184 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1184);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1184);
image1260 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1260);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1260);
add_comments1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
@ -584,35 +581,39 @@ create_window1 (void)
gtk_widget_show (find_previous1);
gtk_container_add (GTK_CONTAINER (search1_menu), find_previous1);
replace1 = gtk_image_menu_item_new_with_mnemonic (_("_Replace"));
gtk_widget_show (replace1);
gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
image1185 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1185);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1185);
separator27 = gtk_separator_menu_item_new ();
gtk_widget_show (separator27);
gtk_container_add (GTK_CONTAINER (search1_menu), separator27);
gtk_widget_set_sensitive (separator27, FALSE);
find_in_files1 = gtk_menu_item_new_with_mnemonic (_("Find in f_iles"));
gtk_widget_show (find_in_files1);
gtk_container_add (GTK_CONTAINER (search1_menu), find_in_files1);
separator11 = gtk_separator_menu_item_new ();
gtk_widget_show (separator11);
gtk_container_add (GTK_CONTAINER (search1_menu), separator11);
gtk_widget_set_sensitive (separator11, FALSE);
replace1 = gtk_image_menu_item_new_with_mnemonic (_("_Replace"));
gtk_widget_show (replace1);
gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
image1261 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1261);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1261);
separator33 = gtk_separator_menu_item_new ();
gtk_widget_show (separator33);
gtk_container_add (GTK_CONTAINER (search1_menu), separator33);
gtk_widget_set_sensitive (separator33, FALSE);
next_message1 = gtk_menu_item_new_with_mnemonic (_("Next _Message"));
gtk_widget_show (next_message1);
gtk_container_add (GTK_CONTAINER (search1_menu), next_message1);
separator32 = gtk_separator_menu_item_new ();
gtk_widget_show (separator32);
gtk_container_add (GTK_CONTAINER (search1_menu), separator32);
gtk_widget_set_sensitive (separator32, FALSE);
go_to_line1 = gtk_image_menu_item_new_with_mnemonic (_("_Go to line"));
gtk_widget_show (go_to_line1);
gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
image1186 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1186);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1186);
image1262 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1262);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1262);
menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View"));
gtk_widget_show (menuitem3);
@ -626,9 +627,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1);
gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
image1187 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1187);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1187);
image1263 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1263);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1263);
menu_separator4 = gtk_separator_menu_item_new ();
gtk_widget_show (menu_separator4);
@ -748,11 +749,13 @@ create_window1 (void)
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (crlf));
gtk_widget_show (crlf);
gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), crlf);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (crlf), TRUE);
lf = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and set to _LF (Unix)"));
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (lf));
gtk_widget_show (lf);
gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), lf);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lf), TRUE);
cr = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and set to CR (_Mac)"));
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (cr));
@ -811,9 +814,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
image1188 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1188);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1188);
image1264 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1264);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1264);
menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
gtk_widget_show (menu_count_words1);
@ -1228,11 +1231,14 @@ create_window1 (void)
g_signal_connect ((gpointer) find_previous1, "activate",
G_CALLBACK (on_find_previous1_activate),
NULL);
g_signal_connect ((gpointer) find_in_files1, "activate",
G_CALLBACK (on_find_in_files1_activate),
NULL);
g_signal_connect ((gpointer) replace1, "activate",
G_CALLBACK (on_replace1_activate),
NULL);
g_signal_connect ((gpointer) find_in_files1, "activate",
G_CALLBACK (on_find_in_files1_activate),
g_signal_connect ((gpointer) next_message1, "activate",
G_CALLBACK (on_next_message1_activate),
NULL);
g_signal_connect ((gpointer) go_to_line1, "activate",
G_CALLBACK (on_go_to_line1_activate),
@ -1397,22 +1403,21 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menuitem1_menu, "menuitem1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
GLADE_HOOKUP_OBJECT (window1, image1176, "image1176");
GLADE_HOOKUP_OBJECT (window1, image1252, "image1252");
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
GLADE_HOOKUP_OBJECT (window1, menu_open1, "menu_open1");
GLADE_HOOKUP_OBJECT (window1, recent_files1, "recent_files1");
GLADE_HOOKUP_OBJECT (window1, recent_files1_menu, "recent_files1_menu");
GLADE_HOOKUP_OBJECT (window1, separator13, "separator13");
GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
GLADE_HOOKUP_OBJECT (window1, image1177, "image1177");
GLADE_HOOKUP_OBJECT (window1, image1253, "image1253");
GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
GLADE_HOOKUP_OBJECT (window1, image1178, "image1178");
GLADE_HOOKUP_OBJECT (window1, image1254, "image1254");
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
GLADE_HOOKUP_OBJECT (window1, image1179, "image1179");
GLADE_HOOKUP_OBJECT (window1, image1255, "image1255");
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
@ -1422,7 +1427,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
GLADE_HOOKUP_OBJECT (window1, image1180, "image1180");
GLADE_HOOKUP_OBJECT (window1, image1256, "image1256");
GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
@ -1448,16 +1453,16 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
GLADE_HOOKUP_OBJECT (window1, image1181, "image1181");
GLADE_HOOKUP_OBJECT (window1, image1257, "image1257");
GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
GLADE_HOOKUP_OBJECT (window1, image1182, "image1182");
GLADE_HOOKUP_OBJECT (window1, image1258, "image1258");
GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
GLADE_HOOKUP_OBJECT (window1, image1183, "image1183");
GLADE_HOOKUP_OBJECT (window1, image1259, "image1259");
GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
GLADE_HOOKUP_OBJECT (window1, image1184, "image1184");
GLADE_HOOKUP_OBJECT (window1, image1260, "image1260");
GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
@ -1474,17 +1479,18 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, find1, "find1");
GLADE_HOOKUP_OBJECT (window1, find_next1, "find_next1");
GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
GLADE_HOOKUP_OBJECT (window1, image1185, "image1185");
GLADE_HOOKUP_OBJECT (window1, separator27, "separator27");
GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
GLADE_HOOKUP_OBJECT (window1, separator11, "separator11");
GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
GLADE_HOOKUP_OBJECT (window1, image1261, "image1261");
GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1");
GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
GLADE_HOOKUP_OBJECT (window1, image1186, "image1186");
GLADE_HOOKUP_OBJECT (window1, image1262, "image1262");
GLADE_HOOKUP_OBJECT (window1, menuitem3, "menuitem3");
GLADE_HOOKUP_OBJECT (window1, menuitem3_menu, "menuitem3_menu");
GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
GLADE_HOOKUP_OBJECT (window1, image1187, "image1187");
GLADE_HOOKUP_OBJECT (window1, image1263, "image1263");
GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
GLADE_HOOKUP_OBJECT (window1, menu_show_messages_window1, "menu_show_messages_window1");
@ -1525,7 +1531,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
GLADE_HOOKUP_OBJECT (window1, image1188, "image1188");
GLADE_HOOKUP_OBJECT (window1, image1264, "image1264");
GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
GLADE_HOOKUP_OBJECT (window1, menu_item5, "menu_item5");
GLADE_HOOKUP_OBJECT (window1, menu_item5_menu, "menu_item5_menu");

View File

@ -575,7 +575,7 @@ static void cb_func_build_action(guint key_id)
ft = doc_list[idx].file_type;
if (! ft) return;
menu_items = build_get_menu_items(ft);
menu_items = build_get_menu_items(ft->id);
switch (key_id)
{

View File

@ -244,6 +244,9 @@ static void main_init(void)
app->window = create_window1();
app->new_file_menu = gtk_menu_new();
app->recent_files_toolbar = gtk_menu_new();
app->recent_files_menubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "recent_files1")),
app->recent_files_menubar);
// store important pointers in the MyApp structure
app->toolbar = lookup_widget(app->window, "toolbar1");
@ -255,7 +258,6 @@ static void main_init(void)
app->toolbar_menu = create_toolbar_popup_menu1();
app->compile_button = lookup_widget(app->window, "toolbutton13");
app->run_button = lookup_widget(app->window, "toolbutton26");
app->recent_files_menubar = lookup_widget(app->window, "recent_files1_menu");
app->popup_goto_items[0] = lookup_widget(app->popup_menu, "goto_tag_definition1");
app->popup_goto_items[1] = lookup_widget(app->popup_menu, "goto_tag_declaration1");
app->popup_goto_items[2] = lookup_widget(app->popup_menu, "find_usage1");
@ -561,9 +563,9 @@ gint main(gint argc, gchar **argv)
msgwin_prepare_status_tree_view();
msgwin_prepare_msg_tree_view();
msgwin_prepare_compiler_tree_view();
msgwindow.popup_status_menu = msgwin_create_message_popup_menu(3);
msgwindow.popup_msg_menu = msgwin_create_message_popup_menu(4);
msgwindow.popup_compiler_menu = msgwin_create_message_popup_menu(5);
msgwindow.popup_status_menu = msgwin_create_message_popup_menu(MSG_STATUS);
msgwindow.popup_msg_menu = msgwin_create_message_popup_menu(MSG_MESSAGE);
msgwindow.popup_compiler_menu = msgwin_create_message_popup_menu(MSG_COMPILER);
#ifdef HAVE_VTE
vte_init();
#endif

View File

@ -67,6 +67,8 @@ void msgwin_init()
msgwindow.tree_msg = lookup_widget(app->window, "treeview4");
msgwindow.tree_compiler = lookup_widget(app->window, "treeview5");
msgwindow.find_in_files_dir = NULL;
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
}
@ -155,15 +157,16 @@ void msgwin_prepare_compiler_tree_view(void)
}
static const GdkColor color_error = {0, 65535, 0, 0};
// adds string to the compiler textview
void msgwin_compiler_add(gint msg_color, gboolean scroll, const gchar *format, ...)
void msgwin_compiler_add(gint msg_color, const gchar *format, ...)
{
GtkTreeIter iter;
GtkTreePath *path;
const GdkColor *color;
const GdkColor red = {0, 65535, 0, 0};
const GdkColor dark_red = {0, 65535 / 2, 0, 0};
const GdkColor blue = {0, 0, 0, 65535};
const GdkColor blue = {0, 0, 0, 0xD000}; // not too bright ;-)
const GdkColor black = {0, 0, 0, 0};
gchar string[512];
va_list args;
@ -174,7 +177,7 @@ void msgwin_compiler_add(gint msg_color, gboolean scroll, const gchar *format, .
switch (msg_color)
{
case COLOR_RED: color = &red; break;
case COLOR_RED: color = &color_error; break;
case COLOR_DARK_RED: color = &dark_red; break;
case COLOR_BLUE: color = &blue; break;
default: color = &black;
@ -188,13 +191,11 @@ void msgwin_compiler_add(gint msg_color, gboolean scroll, const gchar *format, .
path = gtk_tree_model_get_path(
gtk_tree_view_get_model(GTK_TREE_VIEW(msgwindow.tree_compiler)), &iter);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(msgwindow.tree_compiler), path, NULL, TRUE, 0.5, 0.5);
if (scroll)
{
gtk_tree_view_set_cursor(GTK_TREE_VIEW(msgwindow.tree_compiler), path, NULL, FALSE);
}
gtk_tree_path_free(path);
}
// calling build_menu_update for every build message would be overkill
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, TRUE);
}
@ -216,6 +217,8 @@ void msgwin_msg_add(gint line, gint idx, const gchar *string)
gtk_list_store_append(msgwindow.store_msg, &iter);
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2,
((state++ % 2) == 0) ? &white : &dark, 3, string, -1);
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), TRUE);
}
@ -260,9 +263,77 @@ void msgwin_status_add(const gchar *format, ...)
}
static void
on_message_treeview_clear_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkListStore *store;
switch (GPOINTER_TO_INT(user_data))
{
case MSG_STATUS:
store = msgwindow.store_status;
break;
case MSG_MESSAGE:
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), FALSE);
store = msgwindow.store_msg;
break;
case MSG_COMPILER:
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
store = msgwindow.store_compiler;
break;
}
gtk_list_store_clear(store);
}
static void
on_compiler_treeview_copy_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkWidget *tv = NULL;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
gint str_idx = 1;
switch (GPOINTER_TO_INT(user_data))
{
case MSG_STATUS:
tv = msgwindow.tree_status;
break;
case MSG_COMPILER:
tv = msgwindow.tree_compiler;
break;
case MSG_MESSAGE:
tv = msgwindow.tree_msg;
str_idx = 3;
break;
}
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
gchar *string;
gtk_tree_model_get(model, &iter, str_idx, &string, -1);
if (string && *string)
{
gtk_clipboard_set_text(gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)),
string, -1);
}
g_free(string);
}
}
GtkWidget *msgwin_create_message_popup_menu(gint type)
{
GtkWidget *message_popup_menu, *clear;
GtkWidget *message_popup_menu, *clear, *copy;
message_popup_menu = gtk_menu_new();
@ -270,19 +341,14 @@ GtkWidget *msgwin_create_message_popup_menu(gint type)
gtk_widget_show(clear);
gtk_container_add(GTK_CONTAINER(message_popup_menu), clear);
if (type == 3)
g_signal_connect((gpointer)clear, "activate", G_CALLBACK(on_message_treeview_clear_activate), msgwindow.store_status);
else if (type == 4)
g_signal_connect((gpointer)clear, "activate", G_CALLBACK(on_message_treeview_clear_activate), msgwindow.store_msg);
else if (type == 5)
{
GtkWidget *copy = gtk_image_menu_item_new_from_stock("gtk-copy", NULL);
gtk_widget_show(copy);
gtk_container_add(GTK_CONTAINER(message_popup_menu), copy);
copy = gtk_image_menu_item_new_from_stock("gtk-copy", NULL);
gtk_widget_show(copy);
gtk_container_add(GTK_CONTAINER(message_popup_menu), copy);
g_signal_connect((gpointer)copy, "activate", G_CALLBACK(on_compiler_treeview_copy_activate), NULL);
g_signal_connect((gpointer)clear, "activate", G_CALLBACK(on_message_treeview_clear_activate), msgwindow.store_compiler);
}
g_signal_connect((gpointer)copy, "activate",
G_CALLBACK(on_compiler_treeview_copy_activate), GINT_TO_POINTER(type));
g_signal_connect((gpointer)clear, "activate",
G_CALLBACK(on_message_treeview_clear_activate), GINT_TO_POINTER(type));
return message_popup_menu;
}
@ -295,10 +361,20 @@ gboolean msgwin_goto_compiler_file_line()
GtkTreeSelection *selection;
gchar *string;
gboolean ret = FALSE;
GdkColor *color;
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_compiler));
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
// if the item is not coloured red, it's not an error line
gtk_tree_model_get(model, &iter, 0, &color, -1);
if (! gdk_color_equal(color, &color_error))
{
gdk_color_free(color);
return FALSE;
}
gdk_color_free(color);
gtk_tree_model_get(model, &iter, 1, &string, -1);
if (string != NULL)
{
@ -564,7 +640,9 @@ gboolean msgwin_goto_messages_file_line()
gtk_tree_model_get(model, &iter, 0, &line, 1, &idx, 3, &string, -1);
if (line >= 0 && idx >= 0)
utils_goto_line(idx, line); //checks valid idx
{
ret = utils_goto_line(idx, line); // checks valid idx
}
else if (line < 0 && string != NULL)
{
gchar *filename;
@ -659,3 +737,5 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *
}
return FALSE;
}

View File

@ -76,8 +76,8 @@ void msgwin_show();
void msgwin_msg_add(gint line, gint idx, const gchar *string);
void msgwin_compiler_add(gint msg_color, gboolean scroll, const gchar *format, ...)
G_GNUC_PRINTF (3, 4);
void msgwin_compiler_add(gint msg_color, const gchar *format, ...)
G_GNUC_PRINTF (2, 3);
void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
@ -85,11 +85,6 @@ GtkWidget *msgwin_create_message_popup_menu(gint type);
gboolean msgwin_goto_compiler_file_line();
/* try to parse the file and line number where the error occured described in line
* and when something useful is found, it stores the line number in *line and the
* relevant file with the error in filename.
* *line will be -1 if no error was found in string.
* filename must be freed unless it is NULL. */
void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gint *line);
gboolean msgwin_goto_messages_file_line();

View File

@ -1180,3 +1180,35 @@ void ui_update_tab_status(gint idx)
}
/* Returns FALSE if the treeview has items but no matching next item. */
gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb)
{
GtkTreeSelection *treesel;
GtkTreeIter iter;
GtkTreeModel *model;
treesel = gtk_tree_view_get_selection(treeview);
if (gtk_tree_selection_get_selected(treesel, &model, &iter))
{
// get the next selected item
if (! gtk_tree_model_iter_next(model, &iter))
return FALSE; // no more items
}
else // no selection
{
if (! gtk_tree_model_get_iter_first(model, &iter))
return TRUE; // no items
}
while (TRUE)
{
gtk_tree_selection_select_iter(treesel, &iter);
if (cb())
break; // found next message
if (! gtk_tree_model_iter_next(model, &iter))
return FALSE; // no more items
}
return TRUE;
}

View File

@ -105,4 +105,9 @@ void ui_combo_box_add_to_history(GtkComboBox *combo, const gchar *text);
void ui_update_tab_status(gint idx);
typedef gboolean TVMatchCallback();
gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb);
#endif