Revision: 442 Author: eht16 Date: 2006-06-13 12:37:21 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=442&view=rev
Log Message: ----------- Implemented code for setting indicators while compiling.
Modified Paths: -------------- trunk/ChangeLog trunk/geany.glade trunk/src/build.c trunk/src/callbacks.h trunk/src/document.c trunk/src/document.h trunk/src/geany.h trunk/src/highlighting.c trunk/src/interface.c trunk/src/keyfile.c trunk/src/prefs.c trunk/src/sciwrappers.c trunk/src/sciwrappers.h trunk/src/utils.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/ChangeLog 2006-06-13 19:37:21 UTC (rev 442) @@ -6,6 +6,10 @@ keybindings to new action identifiers. * src/utils.c: Improved and finished switching between files when clicking on compiler error messages. + * src/sciwrappers.c, src/document.c, src/highlighting.c, src/build.c, + src/keyfile.c, src/prefs.c, src/interface.c, geany.glade, + src/geany.h: + Implemented code for setting indicators while compiling.
2006-06-12 Enrico Troeger enrico.troeger@uvena.de
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/geany.glade 2006-06-13 19:37:21 UTC (rev 442) @@ -57,7 +57,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image650"> + <widget class="GtkImage" id="image674"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -130,7 +130,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="image651"> + <widget class="GtkImage" id="image675"> <property name="visible">True</property> <property name="stock">gtk-save</property> <property name="icon_size">1</property> @@ -191,7 +191,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="image652"> + <widget class="GtkImage" id="image676"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -333,7 +333,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image653"> + <widget class="GtkImage" id="image677"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -365,7 +365,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image654"> + <widget class="GtkImage" id="image678"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -543,7 +543,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="image655"> + <widget class="GtkImage" id="image679"> <property name="visible">True</property> <property name="stock">gtk-find-and-replace</property> <property name="icon_size">1</property> @@ -570,7 +570,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="image656"> + <widget class="GtkImage" id="image680"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property> @@ -605,7 +605,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="image657"> + <widget class="GtkImage" id="image681"> <property name="visible">True</property> <property name="stock">gtk-select-font</property> <property name="icon_size">1</property> @@ -627,7 +627,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="image658"> + <widget class="GtkImage" id="image682"> <property name="visible">True</property> <property name="stock">gtk-select-color</property> <property name="icon_size">1</property> @@ -885,6 +885,22 @@ <signal name="activate" handler="on_menu_unfold_all1_activate" last_modification_time="Sun, 26 Feb 2006 15:42:32 GMT"/> </widget> </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator23"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menu_remove_indicators1"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Removes all set indicators in the current document.</property> + <property name="label" translatable="yes">Remove all _indicators</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menu_remove_indicators1_activate" last_modification_time="Tue, 13 Jun 2006 19:25:23 GMT"/> + </widget> + </child> </widget> </child> </widget> @@ -3479,6 +3495,26 @@ </child>
<child> + <widget class="GtkCheckButton" id="check_indicators"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Whether to use indicators(a squiggly underline) to highlight the lines, where the compiler found a warning or an error.</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Use indicators to show compile errors</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="label148"> <property name="visible">True</property> <property name="label" translatable="yes"></property>
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/build.c 2006-06-13 19:37:21 UTC (rev 442) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -38,6 +38,7 @@ #include "utils.h" #include "dialogs.h" #include "msgwindow.h" +#include "document.h"
static GIOChannel *build_set_up_io_channel (gint fd, GIOCondition cond, GIOFunc func, gpointer data); @@ -446,12 +447,20 @@ //GIOStatus s; gchar *msg; guint x = 1; + gint line, idx;
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)); + if (app->pref_editor_use_indicators) + { + utils_parse_compiler_error_line(g_strstrip(msg), &idx, &line); + if (line != -1) document_set_indicator(idx, line - 1); + } + } else msgwin_compiler_add(COLOR_BLACK, FALSE, g_strstrip(msg));
Modified: trunk/src/callbacks.h =================================================================== --- trunk/src/callbacks.h 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/callbacks.h 2006-06-13 19:37:21 UTC (rev 442) @@ -576,3 +576,7 @@ GtkNotebookPage *page, guint page_num, gpointer user_data); + +void +on_menu_remove_indicators1_activate (GtkMenuItem *menuitem, + gpointer user_data);
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/document.c 2006-06-13 19:37:21 UTC (rev 442) @@ -39,6 +39,7 @@ #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif +#include <ctype.h>
#include "document.h" #include "callbacks.h" @@ -198,13 +199,12 @@ GtkWidget *align; PangoFontDescription *pfd; gchar *title, *fname; - document this; GtkTreeIter iter; gint new_idx = document_get_new_idx(); - + document *this = &(doc_list[new_idx]); + title = (filename) ? g_path_get_basename(filename) : g_strdup(GEANY_STRING_UNTITLED); - this.tab_label = gtk_label_new(title); - //gtk_widget_show(this.tab_label); + this->tab_label = gtk_label_new(title);
hbox = gtk_hbox_new(FALSE, 0); but = gtk_button_new(); @@ -216,7 +216,7 @@ 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), this->tab_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), align, TRUE, TRUE, 0); gtk_widget_show_all(hbox);
@@ -224,6 +224,7 @@ /* SCI - Code */ sci = SCINTILLA(scintilla_new()); scintilla_set_id(sci, new_idx); + this->sci = sci;
gtk_widget_show(GTK_WIDGET(sci));
@@ -247,7 +248,7 @@ sci_set_visible_eols(sci, app->pref_editor_show_line_endings); pfd = pango_font_description_from_string(app->editor_font); fname = g_strdup_printf("!%s", pango_font_description_get_family(pfd)); - document_set_font(sci, fname, pango_font_description_get_size(pfd) / PANGO_SCALE); + document_set_font(new_idx, fname, pango_font_description_get_size(pfd) / PANGO_SCALE); pango_font_description_free(pfd); g_free(fname);
@@ -258,26 +259,26 @@ SSM(sci, SCI_SETTWOPHASEDRAW, 0, 0); }
- this.tabmenu_label = gtk_label_new(title); - gtk_misc_set_alignment(GTK_MISC(this.tabmenu_label), 0.0, 0); + this->tabmenu_label = gtk_label_new(title); + gtk_misc_set_alignment(GTK_MISC(this->tabmenu_label), 0.0, 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); + 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); + this->tabmenu_label, 0); gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), 0); } iter = treeviews_openfiles_add(new_idx, title); g_free(title);
- this.tag_store = NULL; - this.tag_tree = NULL; + this->tag_store = NULL; + this->tag_tree = NULL;
// "the" SCI signal g_signal_connect((GtkWidget*) sci, "sci-notify", @@ -294,22 +295,20 @@ utils_close_buttons_toggle();
// store important pointers in the tab list - this.file_name = (filename) ? g_strdup(filename) : NULL; - this.sci = sci; - this.encoding = NULL; - this.tm_file = NULL; - this.iter = iter; - this.file_type = NULL; - this.mtime = 0; - this.changed = FALSE; - this.last_check = time(NULL); - this.do_overwrite = FALSE; - this.readonly = FALSE; - this.line_breaking = TRUE; - this.use_auto_indention = TRUE; - this.has_tags = FALSE; - this.is_valid = TRUE; - doc_list[new_idx] = this; + this->file_name = (filename) ? g_strdup(filename) : NULL; + this->encoding = NULL; + this->tm_file = NULL; + this->iter = iter; + this->file_type = NULL; + this->mtime = 0; + this->changed = FALSE; + this->last_check = time(NULL); + this->do_overwrite = FALSE; + this->readonly = FALSE; + this->line_breaking = TRUE; + this->use_auto_indention = TRUE; + this->has_tags = FALSE; + this->is_valid = TRUE;
return new_idx; } @@ -859,19 +858,18 @@ }
-void document_set_font(ScintillaObject *sci, const gchar *font_name, gint size) +void document_set_font(gint idx, const gchar *font_name, gint size) { gint style;
for (style = 0; style <= 127; style++) - sci_set_font(sci, style, font_name, size); + sci_set_font(doc_list[idx].sci, style, font_name, size); // line number and braces - sci_set_font(sci, STYLE_LINENUMBER, font_name, size); - sci_set_font(sci, STYLE_BRACELIGHT, font_name, size); - sci_set_font(sci, STYLE_BRACEBAD, font_name, size); + sci_set_font(doc_list[idx].sci, STYLE_LINENUMBER, font_name, size); + sci_set_font(doc_list[idx].sci, STYLE_BRACELIGHT, font_name, size); + sci_set_font(doc_list[idx].sci, STYLE_BRACEBAD, font_name, size); // zoom to 100% to prevent confusion - sci_zoom_off(sci); - //sci_colourise(sci, 0, sci_get_length(sci)); + sci_zoom_off(doc_list[idx].sci); }
@@ -985,6 +983,7 @@ }
+/// TODO move me to filetypes.c gchar *document_prepare_template(filetype *ft) { gchar *gpl_notice = NULL; @@ -1073,3 +1072,47 @@ } } } + + +void document_clear_indicators(gint idx) +{ + glong last_pos = sci_get_length(doc_list[idx].sci); + if (last_pos > 0) + { + sci_start_styling(doc_list[idx].sci, 0, INDIC2_MASK); + sci_set_styling(doc_list[idx].sci, last_pos, 0); + } +} + + +void document_set_indicator(gint idx, gint line) +{ + gint start, end, current_mask; + guint i = 0, len; + gchar *linebuf; + + if (idx == -1 || ! doc_list[idx].is_valid) return; + + start = sci_get_position_from_line(doc_list[idx].sci, line); + end = sci_get_position_from_line(doc_list[idx].sci, line + 1); + + // skip blank lines + if ((start + 1) == end) return; + + len = end - start; + linebuf = g_malloc(len); + + // don't set the indicator on whitespace + sci_get_line(doc_list[idx].sci, line, linebuf); + if (linebuf == NULL) return; + + while (isspace(linebuf[i])) i++; + while (isspace(linebuf[len-1])) len--; + g_free(linebuf); + + current_mask = sci_get_style_at(doc_list[idx].sci, start); + current_mask &= INDICS_MASK; + current_mask |= INDIC2_MASK; + sci_start_styling(doc_list[idx].sci, start + i, INDIC2_MASK); + sci_set_styling(doc_list[idx].sci, len - i, current_mask); +}
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/document.h 2006-06-13 19:37:21 UTC (rev 442) @@ -98,7 +98,7 @@ void document_find_next(gint, const gchar*, gint, gboolean, gboolean);
-void document_set_font(ScintillaObject*, const gchar*, gint); +void document_set_font(gint, const gchar*, gint);
void document_update_tag_list(gint, gboolean); @@ -114,4 +114,8 @@
void document_unfold_all(gint idx);
+void document_set_indicator(gint idx, gint line); + +void document_clear_indicators(gint idx); + #endif
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/geany.h 2006-06-13 19:37:21 UTC (rev 442) @@ -139,7 +139,7 @@ // to change the default value at startup, I think gboolean pref_editor_line_breaking; gboolean pref_editor_use_auto_indention; - + gboolean pref_editor_use_indicators; gboolean pref_editor_show_white_space; gboolean pref_editor_show_indent_guide; gboolean pref_editor_show_line_endings;
Modified: trunk/src/highlighting.c =================================================================== --- trunk/src/highlighting.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/highlighting.c 2006-06-13 19:37:21 UTC (rev 442) @@ -211,9 +211,14 @@ SSM(sci, SCI_SETCARETLINEBACK, types[GEANY_FILETYPES_ALL]->styling[4][1], 0); SSM(sci, SCI_SETCARETLINEVISIBLE, 1, 0);
+ // indicator settings + SSM(sci, SCI_INDICSETSTYLE, 2, INDIC_SQUIGGLE); + // why? if I let this out, the indicator remains green with PHP + SSM(sci, SCI_INDICSETFORE, 0, 0x0000ff); + SSM(sci, SCI_INDICSETFORE, 2, 0x0000ff); + // a darker grey for the line number margin SSM(sci, SCI_STYLESETBACK, STYLE_LINENUMBER, 0xD0D0D0); - //SSM(sci, SCI_STYLESETBACK, STYLE_LINENUMBER, 0xD0D0D0);
// define marker symbols // 0 -> line marker
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/interface.c 2006-06-13 19:37:21 UTC (rev 442) @@ -37,7 +37,7 @@ GtkWidget *menuitem1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image650; + GtkWidget *image674; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -46,14 +46,14 @@ GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image651; + GtkWidget *image675; GtkWidget *revert1; GtkWidget *separator21; GtkWidget *preferences2; GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image652; + GtkWidget *image676; GtkWidget *menu_separatormenuitem1; GtkWidget *recent_files1; GtkWidget *recent_files1_menu; @@ -71,11 +71,11 @@ GtkWidget *menu_delete1; GtkWidget *menu_seperator2; GtkWidget *insert_include2; - GtkWidget *image653; + GtkWidget *image677; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image654; + GtkWidget *image678; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -96,16 +96,16 @@ GtkWidget *find_next1; GtkWidget *find_previous1; GtkWidget *replace1; - GtkWidget *image655; + GtkWidget *image679; GtkWidget *separator11; GtkWidget *go_to_line1; - GtkWidget *image656; + GtkWidget *image680; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image657; + GtkWidget *image681; GtkWidget *menu_choose_color1; - GtkWidget *image658; + GtkWidget *image682; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; @@ -135,6 +135,8 @@ GtkWidget *separator22; GtkWidget *menu_fold_all1; GtkWidget *menu_unfold_all1; + GtkWidget *separator23; + GtkWidget *menu_remove_indicators1; GtkWidget *menu_build1; GtkWidget *menu_item5; GtkWidget *menu_item5_menu; @@ -232,9 +234,9 @@ gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1);
- image650 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image650); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image650); + image674 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image674); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image674);
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); @@ -269,9 +271,9 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1); gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
- image651 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image651); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image651); + image675 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image675); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image675);
revert1 = gtk_image_menu_item_new_from_stock ("gtk-revert-to-saved", accel_group); gtk_widget_show (revert1); @@ -300,9 +302,9 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1); gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
- image652 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image652); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image652); + image676 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image676); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image676);
menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -374,9 +376,9 @@ gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
- image653 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image653); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image653); + image677 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image677); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image677);
insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -388,9 +390,9 @@ gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
- image654 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image654); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image654); + image678 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image678); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image678);
add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -477,9 +479,9 @@ gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
- image655 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image655); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image655); + image679 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image679); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image679);
separator11 = gtk_separator_menu_item_new (); gtk_widget_show (separator11); @@ -490,9 +492,9 @@ gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
- image656 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image656); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image656); + image680 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image680); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image680);
menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); @@ -506,18 +508,18 @@ gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1); gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
- image657 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image657); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image657); + image681 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image681); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image681);
menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("Show _Colour Chooser")); gtk_widget_show (menu_choose_color1); gtk_container_add (GTK_CONTAINER (menuitem3_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);
- image658 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image658); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image658); + image682 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image682); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image682);
menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -651,6 +653,16 @@ gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_unfold_all1); gtk_tooltips_set_tip (tooltips, menu_unfold_all1, _("Unfolds all contracted code blocks"), NULL);
+ separator23 = gtk_separator_menu_item_new (); + gtk_widget_show (separator23); + gtk_container_add (GTK_CONTAINER (menu_item4_menu), separator23); + gtk_widget_set_sensitive (separator23, FALSE); + + menu_remove_indicators1 = gtk_menu_item_new_with_mnemonic (_("Remove all _indicators")); + gtk_widget_show (menu_remove_indicators1); + gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_remove_indicators1); + gtk_tooltips_set_tip (tooltips, menu_remove_indicators1, _("Removes all set indicators in the current document."), NULL); + menu_build1 = gtk_menu_item_new_with_mnemonic (_("_Build")); gtk_widget_show (menu_build1); gtk_container_add (GTK_CONTAINER (menubar1), menu_build1); @@ -1094,6 +1106,9 @@ g_signal_connect ((gpointer) menu_unfold_all1, "activate", G_CALLBACK (on_menu_unfold_all1_activate), NULL); + g_signal_connect ((gpointer) menu_remove_indicators1, "activate", + G_CALLBACK (on_menu_remove_indicators1_activate), + NULL); g_signal_connect ((gpointer) help1, "activate", G_CALLBACK (on_help1_activate), NULL); @@ -1179,7 +1194,7 @@ 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, image650, "image650"); + GLADE_HOOKUP_OBJECT (window1, image674, "image674"); 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"); @@ -1188,14 +1203,14 @@ 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, image651, "image651"); + GLADE_HOOKUP_OBJECT (window1, image675, "image675"); GLADE_HOOKUP_OBJECT (window1, revert1, "revert1"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); GLADE_HOOKUP_OBJECT (window1, preferences2, "preferences2"); 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, image652, "image652"); + GLADE_HOOKUP_OBJECT (window1, image676, "image676"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, recent_files1, "recent_files1"); GLADE_HOOKUP_OBJECT (window1, recent_files1_menu, "recent_files1_menu"); @@ -1213,11 +1228,11 @@ GLADE_HOOKUP_OBJECT (window1, menu_delete1, "menu_delete1"); GLADE_HOOKUP_OBJECT (window1, menu_seperator2, "menu_seperator2"); GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2"); - GLADE_HOOKUP_OBJECT (window1, image653, "image653"); + GLADE_HOOKUP_OBJECT (window1, image677, "image677"); 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, image654, "image654"); + GLADE_HOOKUP_OBJECT (window1, image678, "image678"); 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"); @@ -1238,16 +1253,16 @@ 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, image655, "image655"); + GLADE_HOOKUP_OBJECT (window1, image679, "image679"); GLADE_HOOKUP_OBJECT (window1, separator11, "separator11"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image656, "image656"); + GLADE_HOOKUP_OBJECT (window1, image680, "image680"); 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, image657, "image657"); + GLADE_HOOKUP_OBJECT (window1, image681, "image681"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image658, "image658"); + GLADE_HOOKUP_OBJECT (window1, image682, "image682"); 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"); @@ -1277,6 +1292,8 @@ GLADE_HOOKUP_OBJECT (window1, separator22, "separator22"); GLADE_HOOKUP_OBJECT (window1, menu_fold_all1, "menu_fold_all1"); GLADE_HOOKUP_OBJECT (window1, menu_unfold_all1, "menu_unfold_all1"); + GLADE_HOOKUP_OBJECT (window1, separator23, "separator23"); + GLADE_HOOKUP_OBJECT (window1, menu_remove_indicators1, "menu_remove_indicators1"); GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1"); GLADE_HOOKUP_OBJECT (window1, menu_item5, "menu_item5"); GLADE_HOOKUP_OBJECT (window1, menu_item5_menu, "menu_item5_menu"); @@ -1829,6 +1846,7 @@ GtkWidget *check_xmltag; GtkWidget *check_auto_complete; GtkWidget *check_folding; + GtkWidget *check_indicators; GtkWidget *label148; GtkWidget *table3; GtkWidget *label103; @@ -2268,6 +2286,12 @@ gtk_tooltips_set_tip (tooltips, check_folding, _("Whether to enable folding the code"), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_folding), FALSE);
+ check_indicators = gtk_check_button_new_with_mnemonic (_("Use indicators to show compile errors")); + gtk_widget_show (check_indicators); + gtk_box_pack_start (GTK_BOX (vbox12), check_indicators, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_indicators, _("Whether to use indicators(a squiggly underline) to highlight the lines, where the compiler found a warning or an error."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_indicators), FALSE); + label148 = gtk_label_new (""); gtk_widget_show (label148); gtk_box_pack_start (GTK_BOX (vbox12), label148, FALSE, FALSE, 0); @@ -2636,6 +2660,7 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, check_xmltag, "check_xmltag"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_complete, "check_auto_complete"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_folding, "check_folding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_indicators, "check_indicators"); GLADE_HOOKUP_OBJECT (prefs_dialog, label148, "label148"); GLADE_HOOKUP_OBJECT (prefs_dialog, table3, "table3"); GLADE_HOOKUP_OBJECT (prefs_dialog, label103, "label103");
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/keyfile.c 2006-06-13 19:37:21 UTC (rev 442) @@ -86,6 +86,7 @@ g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible); g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding); g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->pref_editor_use_auto_indention); + g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators); g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", app->pref_editor_show_indent_guide); g_key_file_set_boolean(config, PACKAGE, "show_white_space", app->pref_editor_show_white_space); g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", app->show_markers_margin); @@ -209,6 +210,7 @@ app->treeview_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "treeview_openfiles_visible", TRUE); app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE); app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE); + app->pref_editor_use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE); app->pref_editor_use_auto_indention = utils_get_setting_boolean(config, PACKAGE, "use_auto_indention", TRUE); app->pref_editor_show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE); app->pref_editor_show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE);
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/prefs.c 2006-06-13 19:37:21 UTC (rev 442) @@ -137,6 +137,9 @@ widget = lookup_widget(app->prefs_dialog, "check_folding"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_folding);
+ widget = lookup_widget(app->prefs_dialog, "check_indicators"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_use_indicators); + widget = lookup_widget(app->prefs_dialog, "editor_font"); gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), app->editor_font);
@@ -346,7 +349,10 @@ widget = lookup_widget(app->prefs_dialog, "check_auto_complete"); app->pref_editor_auto_complete_constructs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = lookup_widget(app->prefs_dialog, "check_indicators"); + app->pref_editor_use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ // Tools Settings widget = lookup_widget(app->prefs_dialog, "entry_com_make"); g_free(app->build_make_cmd);
Modified: trunk/src/sciwrappers.c =================================================================== --- trunk/src/sciwrappers.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/sciwrappers.c 2006-06-13 19:37:21 UTC (rev 442) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -795,3 +795,13 @@ return SSM(sci, SCI_LINEFROMPOSITION, end, 0) - SSM(sci, SCI_LINEFROMPOSITION, start, 0) + 1; } + +void sci_set_styling(ScintillaObject *sci, gint len, gint style) +{ + SSM(sci, SCI_SETSTYLING, len, style); +} + +void sci_start_styling(ScintillaObject *sci, gint pos, gint mask) +{ + SSM(sci, SCI_STARTSTYLING, pos, mask); +}
Modified: trunk/src/sciwrappers.h =================================================================== --- trunk/src/sciwrappers.h 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/sciwrappers.h 2006-06-13 19:37:21 UTC (rev 442) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ */ @@ -146,5 +146,8 @@ void sci_cmd (ScintillaObject * sci, gint cmd); gint sci_get_current_line (ScintillaObject * sci, gint pos); gint sci_get_lines_selected (ScintillaObject * sci); +void sci_set_styling (ScintillaObject * sci, gint len, gint style); +void sci_start_styling (ScintillaObject * sci, gint pos, gint mask);
+ #endif
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2006-06-13 15:49:19 UTC (rev 441) +++ trunk/src/utils.c 2006-06-13 19:37:21 UTC (rev 442) @@ -352,7 +352,7 @@ { if (doc_list[i].sci) { - document_set_font(doc_list[i].sci, fname, size); + document_set_font(i, fname, size); } } pango_font_description_free(font_desc); @@ -2285,13 +2285,12 @@ */
-/* try to parse the file and line number where the error occured described in string - * and when something useful is found, it jumps to file and scrolls to the line */ -void utils_parse_compiler_error_line(const gchar *string) +/* 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 index of + * the file in *idx_of_error_file. */ +void utils_parse_compiler_error_line(const gchar *string, gint *idx_of_error_file, gint *line) { gint idx = document_get_cur_idx(); - gint idx_of_error_file; - gint line = -1; gchar *end = NULL; gchar *path; gchar *filename; @@ -2301,7 +2300,9 @@ guint field_idx_line; // idx of the field where the line is guint field_idx_file; // idx of the field where the filename is - + *line = -1; + *idx_of_error_file = -1; + if (string == NULL || ! doc_list[app->cur_idx].is_valid || doc_list[app->cur_idx].file_type == NULL) return; @@ -2374,7 +2375,7 @@ return; }
- line = strtol(fields[field_idx_line], &end, 10); + *line = strtol(fields[field_idx_line], &end, 10);
// if the line could not be read, line is 0 and an error occurred, so we leave if (fields[field_idx_line] == end) @@ -2388,23 +2389,17 @@ filename = g_strconcat(path, G_DIR_SEPARATOR_S, fields[field_idx_file], NULL);
// use document_open_file to find an already opened file, or to open it in place - idx_of_error_file = document_open_file(-1, filename, 0, FALSE, NULL); + *idx_of_error_file = document_open_file(-1, filename, 0, FALSE, NULL);
g_free(path); g_free(filename); - g_strfreev(fields);
- if (idx_of_error_file == -1 || ! doc_list[idx_of_error_file].is_valid || line == -1) + if (*idx_of_error_file != -1 && doc_list[*idx_of_error_file].is_valid && + *line == -1 && idx != *idx_of_error_file) { - return; - } - - // finally jump to the line (and file) - if (idx != idx_of_error_file) - { gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), - gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), - GTK_WIDGET(doc_list[idx_of_error_file].sci))); + gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), + GTK_WIDGET(doc_list[*idx_of_error_file].sci))); } - utils_goto_line(idx_of_error_file, line); + g_strfreev(fields); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.