diff --git a/src/callbacks.c b/src/callbacks.c index 5e60bd19..2bb50cfb 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -134,12 +134,17 @@ gint destroyapp_early(void) // real exit function gint destroyapp(GtkWidget *widget, gpointer gdata) { - gchar *fifo = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, GEANY_FIFO_NAME, NULL); - geany_debug("Quitting..."); - // delete the fifo early, because we don't accept new files anymore - unlink(fifo); - g_free(fifo); + +#ifdef HAVE_FIFO + if (! app->ignore_fifo) + { + gchar *fifo = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, GEANY_FIFO_NAME, NULL); + // delete the fifo early, because we don't accept new files anymore + unlink(fifo); + g_free(fifo); + } +#endif filetypes_free_types(); styleset_free_styles(); @@ -685,7 +690,7 @@ on_zoom_in1_activate (GtkMenuItem *menuitem, if (doc_list[idx].is_valid) { - if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, TRUE, + if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, (sci_get_zoom(doc_list[idx].sci) / 2)); sci_zoom_in(doc_list[idx].sci); } @@ -700,7 +705,7 @@ on_zoom_out1_activate (GtkMenuItem *menuitem, if (doc_list[idx].is_valid) { if (sci_get_zoom(doc_list[idx].sci) == 0) - sci_set_line_numbers(doc_list[idx].sci, TRUE, 0); + sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); sci_zoom_out(doc_list[idx].sci); } } @@ -714,7 +719,7 @@ on_normal_size1_activate (GtkMenuItem *menuitem, if (doc_list[idx].is_valid) { sci_zoom_off(doc_list[idx].sci); - sci_set_line_numbers(doc_list[idx].sci, TRUE, 0); + sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); } } @@ -882,51 +887,37 @@ on_file_open_selection_changed (GtkFileChooser *filechooser, * save dialog callbacks */ void -on_file_save_cancel_button_clicked (GtkButton *button, - gpointer user_data) +on_file_save_dialog_response (GtkDialog *dialog, + gint response, + gpointer user_data) { gtk_widget_hide(app->save_filesel); -} - -void -on_file_save_save_button_clicked (GtkButton *button, - gpointer user_data) -{ - gint idx = document_get_cur_idx(); - - gtk_widget_hide(app->save_filesel); - - if (doc_list[idx].file_name) g_free(doc_list[idx].file_name); - doc_list[idx].file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel)); - utils_replace_filename(idx); - document_save_file(idx); - - utils_build_show_hide(idx); - - // finally add current file to recent files menu - if (g_queue_find_custom(app->recent_queue, doc_list[idx].file_name, (GCompareFunc) strcmp) == NULL) + if (response == GTK_RESPONSE_ACCEPT) { - g_queue_push_head(app->recent_queue, g_strdup(doc_list[idx].file_name)); - if (g_queue_get_length(app->recent_queue) > app->mru_length) + gint idx = document_get_cur_idx(); + + if (doc_list[idx].file_name) g_free(doc_list[idx].file_name); + doc_list[idx].file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel)); + utils_replace_filename(idx); + document_save_file(idx); + + utils_build_show_hide(idx); + + // finally add current file to recent files menu + if (g_queue_find_custom(app->recent_queue, doc_list[idx].file_name, (GCompareFunc) strcmp) == NULL) { - g_free(g_queue_pop_tail(app->recent_queue)); + g_queue_push_head(app->recent_queue, g_strdup(doc_list[idx].file_name)); + if (g_queue_get_length(app->recent_queue) > app->mru_length) + { + g_free(g_queue_pop_tail(app->recent_queue)); + } + utils_update_recent_menu(); } - utils_update_recent_menu(); } } -gboolean -on_filesavedialog1_delete_event (GtkWidget *widget, - GdkEvent *event, - gpointer user_data) -{ - gtk_widget_hide(app->save_filesel); - return TRUE; -} - - /* * font dialog callbacks */ @@ -1496,20 +1487,11 @@ on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem, void -on_show_indention_guides1_toggled (GtkCheckMenuItem *checkmenuitem, +on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - app->show_indent_guide = (app->show_indent_guide) ? FALSE : TRUE; - utils_show_indention_guides(); -} - - -void -on_show_white_space_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data) -{ - app->show_white_space = (app->show_white_space) ? FALSE : TRUE; - utils_show_white_space(); + app->show_linenumber_margin = (app->show_linenumber_margin) ? FALSE : TRUE; + utils_show_linenumber_margin(); } @@ -1517,11 +1499,10 @@ void on_line_breaking1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - //app->line_breaking = (app->line_breaking) ? FALSE : TRUE; - //utils_line_breaking(); if (! switch_notebook_page) { gint idx = document_get_cur_idx(); + if (idx == -1 || ! doc_list[idx].is_valid) return; doc_list[idx].line_breaking = ! doc_list[idx].line_breaking; sci_set_lines_wrapped(doc_list[idx].sci, doc_list[idx].line_breaking); } @@ -1529,21 +1510,18 @@ on_line_breaking1_toggled (GtkCheckMenuItem *checkmenuitem, void -on_show_line_endings1_toggled (GtkCheckMenuItem *checkmenuitem, +on_use_auto_indention1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - app->show_line_endings = (app->show_line_endings) ? FALSE : TRUE; - utils_show_line_endings(); + if (! switch_notebook_page) + { + gint idx = document_get_cur_idx(); + if (idx == -1 || ! doc_list[idx].is_valid) return; + doc_list[idx].use_auto_indention = ! doc_list[idx].use_auto_indention; + } } -void -on_xml_tag1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - app->auto_close_xml_tags = (app->auto_close_xml_tags) ? FALSE : TRUE; -} - void on_find_usage1_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -1626,22 +1604,6 @@ on_goto_tag_activate (GtkMenuItem *menuitem, } -void -on_construct_completion1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - app->auto_complete_constructs = (app->auto_complete_constructs) ? FALSE : TRUE; -} - - -void -on_use_auto_indention1_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - app->use_auto_indention = (app->use_auto_indention) ? FALSE : TRUE; -} - - void on_count_words1_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -2102,7 +2064,7 @@ on_find_dialog_response (GtkDialog *dialog, return; } gtk_widget_hide(app->find_dialog); - + gtk_combo_box_prepend_text(GTK_COMBO_BOX(user_data), app->search_text); search_flags = (fl1 ? SCFIND_MATCHCASE : 0) | (fl2 ? SCFIND_WHOLEWORD : 0) | @@ -2159,7 +2121,7 @@ on_replace_dialog_response (GtkDialog *dialog, gtk_widget_grab_focus(GTK_WIDGET(GTK_BIN(lookup_widget(app->replace_dialog, "entry_find"))->child)); return; } - + gtk_combo_box_prepend_text(GTK_COMBO_BOX(entry_find), find); gtk_combo_box_prepend_text(GTK_COMBO_BOX(entry_replace), replace); @@ -2558,7 +2520,6 @@ on_recent_file_activate (GtkMenuItem *menuitem, } -// this option is currently disabled, until the document menu item is reordered void on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) @@ -2567,6 +2528,7 @@ on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem, doc_list[idx].readonly = ! doc_list[idx].readonly; sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly); + utils_update_statusbar(idx); } @@ -2581,3 +2543,12 @@ on_file_open_check_hidden_toggled (GtkToggleButton *togglebutton, + + +void +on_file_properties_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + diff --git a/src/callbacks.h b/src/callbacks.h index 0806b128..3eb895ef 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -105,17 +105,9 @@ on_notebook1_switch_page (GtkNotebook *notebook, gpointer user_data); void -on_file_save_cancel_button_clicked (GtkButton *button, - gpointer user_data); - -void -on_file_save_save_button_clicked (GtkButton *button, - gpointer user_data); - -gboolean -on_filesavedialog1_delete_event (GtkWidget *widget, - GdkEvent *event, - gpointer user_data); +on_file_save_dialog_response (GtkDialog *dialog, + gint response, + gpointer user_data); void on_color_ok_button_clicked (GtkButton *button, @@ -191,14 +183,6 @@ void on_replace_tabs_activate (GtkMenuItem *menuitem, gpointer user_data); -void -on_indention_guides_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_white_space_activate (GtkMenuItem *menuitem, - gpointer user_data); - void on_toolbutton18_clicked (GtkToolButton *toolbutton, gpointer user_data); @@ -302,10 +286,6 @@ on_window_configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data); -void -on_markers_margin1_activate (GtkMenuItem *menuitem, - gpointer user_data); - void on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data); @@ -318,22 +298,6 @@ void on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data); -void -on_show_indention_guides1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -void -on_show_white_space_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -void -on_fullscreen1_deselect (GtkItem *item, - gpointer user_data); - -void -on_fullscreen1_select (GtkItem *item, - gpointer user_data); - void on_invisible1_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -342,10 +306,6 @@ void on_toolbutton13_clicked (GtkToolButton *toolbutton, gpointer user_data); -void -on_xml_tag1_activate (GtkMenuItem *menuitem, - gpointer user_data); - void on_find_usage1_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -366,10 +326,6 @@ void on_message_treeview_clear_activate (GtkMenuItem *menuitem, gpointer user_data); -void -on_show_line_endings1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - void on_construct_completion1_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -502,10 +458,6 @@ on_goto_line_entry_activate (GtkEntry *entry, gpointer user_data); -void -on_use_auto_indention1_activate (GtkMenuItem *menuitem, - gpointer user_data); - void on_help1_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -606,3 +558,15 @@ void on_help_shortcuts1_activate (GtkMenuItem *menuitem, gpointer user_data); + +void +on_file_properties_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem, + gpointer user_data); + +void +on_use_auto_indention1_toggled (GtkCheckMenuItem *checkmenuitem, + gpointer user_data); diff --git a/src/dialogs.c b/src/dialogs.c index 5b095d3f..224fcec6 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -90,7 +90,7 @@ void dialogs_show_open_file () g_signal_connect ((gpointer) app->open_filesel, "delete_event", G_CALLBACK(gtk_widget_hide), NULL); g_signal_connect((gpointer) app->open_filesel, "response", - G_CALLBACK (on_file_open_dialog_response), NULL); + G_CALLBACK(on_file_open_dialog_response), NULL); } @@ -127,8 +127,17 @@ void dialogs_show_save_as () if (app->save_filesel == NULL) { - app->save_filesel = create_filesavedialog1(); - /* Make sure the dialog doesn't disappear behind the main window. */ + app->save_filesel = gtk_file_chooser_dialog_new(_("Save File"), NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); + gtk_window_set_modal(GTK_WINDOW(app->save_filesel), TRUE); + gtk_window_set_destroy_with_parent(GTK_WINDOW(app->save_filesel), TRUE); + gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->save_filesel), TRUE); + gtk_window_set_type_hint(GTK_WINDOW(app->save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG); + + g_signal_connect((gpointer) app->save_filesel, "delete_event", G_CALLBACK(gtk_widget_hide), NULL); + g_signal_connect((gpointer) app->save_filesel, "response", G_CALLBACK(on_file_save_dialog_response), NULL); + gtk_window_set_transient_for(GTK_WINDOW(app->save_filesel), GTK_WINDOW(app->window)); } @@ -232,7 +241,7 @@ void dialogs_show_error(const gchar *text, ...) #ifdef GEANY_WIN32 MessageBox(NULL, string, _("Error"), MB_OK | MB_ICONERROR); #else - dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT, + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, string); gtk_dialog_run (GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); @@ -755,7 +764,7 @@ void dialogs_show_find(void) sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci)); sci_get_selected_text(doc_list[idx].sci, sel); } - + if (app->find_dialog == NULL) { GtkWidget *label, *entry, *checkbox1, *checkbox2, *checkbox3, *checkbox4, *checkbox5; @@ -844,7 +853,7 @@ void dialogs_show_replace(void) sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci)); sci_get_selected_text(doc_list[idx].sci, sel); } - + if (app->replace_dialog == NULL) { GtkWidget *label_find, *label_replace, *entry_find, *entry_replace, *checkbox1, *checkbox2, *checkbox3, *checkbox5, *checkbox4; diff --git a/src/document.c b/src/document.c index fd3bcf44..b3e09a2a 100644 --- a/src/document.c +++ b/src/document.c @@ -173,6 +173,9 @@ void document_init_doclist(void) { doc_list[i].is_valid = FALSE; doc_list[i].has_tags = FALSE; + doc_list[i].use_auto_indention = TRUE; + doc_list[i].line_breaking = TRUE; + doc_list[i].readonly = FALSE; doc_list[i].tag_store = NULL; doc_list[i].tag_tree = NULL; doc_list[i].file_name = NULL; @@ -222,11 +225,11 @@ gint document_create_new_sci(const gchar *filename) sci_assign_cmdkey(sci, SCK_END, SCI_LINEENDWRAP); sci_set_mark_long_lines(sci, app->long_line_column, app->long_line_color); sci_set_symbol_margin(sci, app->show_markers_margin); - //sci_set_lines_wrapped(sci, app->line_breaking); - sci_set_lines_wrapped(sci, TRUE); - sci_set_indentionguides(sci, app->show_indent_guide); - sci_set_visible_white_spaces(sci, app->show_white_space); - sci_set_visible_eols(sci, app->show_line_endings); + sci_set_line_numbers(sci, app->show_linenumber_margin, 0); + sci_set_lines_wrapped(sci, app->pref_editor_line_breaking); + sci_set_indentionguides(sci, app->pref_editor_show_indent_guide); + sci_set_visible_white_spaces(sci, app->pref_editor_show_white_space); + sci_set_visible_eols(sci, app->pref_editor_show_line_endings); //sci_set_folding_margin_visible(sci, TRUE); pfd = pango_font_description_from_string(app->editor_font); fname = g_strdup_printf("!%s", pango_font_description_get_family(pfd)); @@ -265,10 +268,11 @@ gint document_create_new_sci(const gchar *filename) this.file_type = NULL; this.mtime = 0; this.changed = FALSE; - this.line_breaking = TRUE; 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; @@ -341,7 +345,7 @@ void document_new_file(filetype *ft) doc_list[idx].changed = FALSE; document_set_text_changed(idx); sci_set_eol_mode(doc_list[idx].sci, SC_EOL_LF); - sci_set_line_numbers(doc_list[idx].sci, TRUE, 0); + sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); sci_empty_undo_buffer(doc_list[idx].sci); sci_goto_pos(doc_list[idx].sci, 0); @@ -482,7 +486,7 @@ void document_open_file(gint idx, const gchar *filename, gint pos, gboolean read editor_mode = utils_get_line_endings(map, size); sci_set_eol_mode(doc_list[idx].sci, editor_mode); - sci_set_line_numbers(doc_list[idx].sci, TRUE, 0); + sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); sci_set_savepoint(doc_list[idx].sci); sci_empty_undo_buffer(doc_list[idx].sci); doc_list[idx].mtime = time(NULL); @@ -602,7 +606,7 @@ void document_save_file(gint idx) // set line numbers again, to reset the margin width, if // there are more lines than before - sci_set_line_numbers(doc_list[idx].sci, TRUE, 0); + sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); sci_set_savepoint(doc_list[idx].sci); doc_list[idx].mtime = time(NULL); if (doc_list[idx].file_type == NULL || doc_list[idx].file_type->id == GEANY_FILETYPES_ALL) diff --git a/src/geany.h b/src/geany.h index 10d4c685..993641fe 100644 --- a/src/geany.h +++ b/src/geany.h @@ -92,6 +92,7 @@ typedef struct document gboolean changed; gboolean do_overwrite; gboolean line_breaking; + gboolean use_auto_indention; time_t last_check; // to remember the last disk check time_t mtime; } document; @@ -119,18 +120,22 @@ typedef struct MyApp gboolean treeview_symbol_visible; gboolean treeview_openfiles_visible; gboolean msgwindow_visible; - gboolean show_white_space; - gboolean use_auto_indention; - gboolean show_indent_guide; - //gboolean line_breaking; - gboolean show_line_endings; - gboolean show_markers_margin; gboolean fullscreen; gboolean beep_on_errors; gboolean switch_msgwin_pages; - gboolean auto_close_xml_tags; - gboolean auto_complete_constructs; + gboolean show_markers_margin; + gboolean show_linenumber_margin; gboolean main_window_realized; + // I know, it is a bit confusing, but this line breaking is globally, + // to change the default value at startup, I think + gboolean pref_editor_line_breaking; + gboolean pref_editor_use_auto_indention; + + gboolean pref_editor_show_white_space; + gboolean pref_editor_show_indent_guide; + gboolean pref_editor_show_line_endings; + gboolean pref_editor_auto_close_xml_tags; + gboolean pref_editor_auto_complete_constructs; gint pref_editor_tab_width; gboolean pref_editor_new_line; gboolean pref_editor_trail_space; @@ -140,6 +145,9 @@ typedef struct MyApp gboolean pref_main_show_search; gint mru_length; gint long_line_column; +#ifdef HAVE_FIFO + gboolean ignore_fifo; +#endif #ifdef HAVE_VTE gchar *lib_vte; #endif diff --git a/src/interface.c b/src/interface.c index 7706933e..249cc028 100644 --- a/src/interface.c +++ b/src/interface.c @@ -37,7 +37,7 @@ create_window1 (void) GtkWidget *menuitem1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image474; + GtkWidget *image562; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -46,12 +46,13 @@ create_window1 (void) GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image475; + GtkWidget *image563; GtkWidget *revert1; + GtkWidget *preferences2; GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image476; + GtkWidget *image564; GtkWidget *menu_separatormenuitem1; GtkWidget *recent_files1; GtkWidget *recent_files1_menu; @@ -69,11 +70,11 @@ create_window1 (void) GtkWidget *menu_delete1; GtkWidget *menu_seperator2; GtkWidget *insert_include2; - GtkWidget *image477; + GtkWidget *image565; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image478; + GtkWidget *image566; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -89,37 +90,33 @@ create_window1 (void) GtkWidget *separator9; GtkWidget *find1; GtkWidget *find_next1; - GtkWidget *image479; + GtkWidget *image567; GtkWidget *replace1; - GtkWidget *image480; + GtkWidget *image568; GtkWidget *separator11; GtkWidget *preferences1; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image481; + GtkWidget *image569; GtkWidget *menu_choose_color1; - GtkWidget *image482; + GtkWidget *image570; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; GtkWidget *menu_show_toolbar1; GtkWidget *menu_markers_margin1; + GtkWidget *menu_linenumber_margin1; GtkWidget *menu_separator5; GtkWidget *menu_zoom_in1; GtkWidget *menu_zoom_out1; GtkWidget *normal_size1; GtkWidget *menu_item4; GtkWidget *menu_item4_menu; - GtkWidget *menu_show_indention_guides1; - GtkWidget *menu_show_white_space; - GtkWidget *menu_show_line_endings1; GtkWidget *menu_line_breaking1; GtkWidget *menu_use_auto_indention1; - GtkWidget *menu_xml_tag1; - GtkWidget *menu_construct_completion1; - GtkWidget *separator10; GtkWidget *set_file_readonly1; + GtkWidget *separator10; GtkWidget *set_filetype1; GtkWidget *set_filetype1_menu; GtkWidget *invisible1; @@ -223,9 +220,9 @@ create_window1 (void) gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1); - image474 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image474); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image474); + image562 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image562); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image562); 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); @@ -263,14 +260,18 @@ create_window1 (void) GDK_s, (GdkModifierType) GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); - image475 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image475); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image475); + image563 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image563); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image563); revert1 = gtk_image_menu_item_new_from_stock ("gtk-revert-to-saved", accel_group); gtk_widget_show (revert1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), revert1); + preferences2 = gtk_image_menu_item_new_from_stock ("gtk-preferences", accel_group); + gtk_widget_show (preferences2); + gtk_container_add (GTK_CONTAINER (menuitem1_menu), preferences2); + separator14 = gtk_separator_menu_item_new (); gtk_widget_show (separator14); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separator14); @@ -288,9 +289,9 @@ create_window1 (void) GDK_d, (GdkModifierType) GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); - image476 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image476); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image476); + image564 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image564); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image564); menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -362,9 +363,9 @@ create_window1 (void) gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2); - image477 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image477); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image477); + image565 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image565); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image565); insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -376,9 +377,9 @@ create_window1 (void) gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1); - image478 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image478); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image478); + image566 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image566); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image566); add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -449,17 +450,17 @@ create_window1 (void) GDK_F3, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); - image479 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU); - gtk_widget_show (image479); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_next1), image479); + image567 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU); + gtk_widget_show (image567); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_next1), image567); replace1 = gtk_image_menu_item_new_with_mnemonic (_("_Replace")); gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (edit1_menu), replace1); - image480 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image480); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image480); + image568 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image568); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image568); separator11 = gtk_separator_menu_item_new (); gtk_widget_show (separator11); @@ -482,18 +483,18 @@ 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); - image481 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image481); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image481); + image569 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image569); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image569); menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("Show Color 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); - image482 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image482); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image482); + image570 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image570); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image570); menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -522,8 +523,15 @@ create_window1 (void) menu_markers_margin1 = gtk_check_menu_item_new_with_mnemonic (_("Show Markers Margin")); gtk_widget_show (menu_markers_margin1); gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_markers_margin1); + gtk_tooltips_set_tip (tooltips, menu_markers_margin1, _("Shows or hides the small margin right of the line numbers, which is used to mark lines."), NULL); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_markers_margin1), TRUE); + menu_linenumber_margin1 = gtk_check_menu_item_new_with_mnemonic (_("Show Line Numbers")); + gtk_widget_show (menu_linenumber_margin1); + gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_linenumber_margin1); + gtk_tooltips_set_tip (tooltips, menu_linenumber_margin1, _("Shows or hides the Line Number margin."), NULL); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_linenumber_margin1), TRUE); + menu_separator5 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator5); gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_separator5); @@ -548,19 +556,6 @@ create_window1 (void) menu_item4_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item4), menu_item4_menu); - menu_show_indention_guides1 = gtk_check_menu_item_new_with_mnemonic (_("Show indention guides")); - gtk_widget_show (menu_show_indention_guides1); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_show_indention_guides1); - - menu_show_white_space = gtk_check_menu_item_new_with_mnemonic (_("Show white space")); - gtk_widget_show (menu_show_white_space); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_show_white_space); - - menu_show_line_endings1 = gtk_check_menu_item_new_with_mnemonic (_("Show line endings")); - gtk_widget_show (menu_show_line_endings1); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_show_line_endings1); - gtk_tooltips_set_tip (tooltips, menu_show_line_endings1, _("Show the line ending character"), NULL); - menu_line_breaking1 = gtk_check_menu_item_new_with_mnemonic (_("Line breaking")); gtk_widget_show (menu_line_breaking1); gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_line_breaking1); @@ -572,28 +567,16 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_use_auto_indention1); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_use_auto_indention1), TRUE); - menu_xml_tag1 = gtk_check_menu_item_new_with_mnemonic (_("XML tag auto completion")); - gtk_widget_show (menu_xml_tag1); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_xml_tag1); - gtk_tooltips_set_tip (tooltips, menu_xml_tag1, _("Automatic completion of open XML tags(includes HTML tags)"), NULL); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_xml_tag1), TRUE); - - menu_construct_completion1 = gtk_check_menu_item_new_with_mnemonic (_("Construct auto completion")); - gtk_widget_show (menu_construct_completion1); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_construct_completion1); - gtk_tooltips_set_tip (tooltips, menu_construct_completion1, _("Automatic completion of often used constructs like if and for"), NULL); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_construct_completion1), TRUE); + set_file_readonly1 = gtk_check_menu_item_new_with_mnemonic (_("Read _only")); + gtk_widget_show (set_file_readonly1); + gtk_container_add (GTK_CONTAINER (menu_item4_menu), set_file_readonly1); + gtk_tooltips_set_tip (tooltips, set_file_readonly1, _("Treat this file as read-only. No changes can be made."), NULL); separator10 = gtk_separator_menu_item_new (); gtk_widget_show (separator10); gtk_container_add (GTK_CONTAINER (menu_item4_menu), separator10); gtk_widget_set_sensitive (separator10, FALSE); - set_file_readonly1 = gtk_check_menu_item_new_with_mnemonic (_("Set file read_only")); - gtk_widget_show (set_file_readonly1); - gtk_container_add (GTK_CONTAINER (menu_item4_menu), set_file_readonly1); - gtk_tooltips_set_tip (tooltips, set_file_readonly1, _("Treat this file as read-only. No changes can be made."), NULL); - set_filetype1 = gtk_menu_item_new_with_mnemonic (_("Set filetype")); gtk_widget_show (set_filetype1); gtk_container_add (GTK_CONTAINER (menu_item4_menu), set_filetype1); @@ -916,6 +899,9 @@ create_window1 (void) g_signal_connect ((gpointer) revert1, "activate", G_CALLBACK (on_toolbutton23_clicked), NULL); + g_signal_connect ((gpointer) preferences2, "activate", + G_CALLBACK (on_file_properties_activate), + NULL); g_signal_connect ((gpointer) menu_close1, "activate", G_CALLBACK (on_close1_activate), NULL); @@ -1000,6 +986,9 @@ create_window1 (void) g_signal_connect ((gpointer) menu_markers_margin1, "toggled", G_CALLBACK (on_markers_margin1_toggled), NULL); + g_signal_connect ((gpointer) menu_linenumber_margin1, "toggled", + G_CALLBACK (on_show_line_numbers1_toggled), + NULL); g_signal_connect ((gpointer) menu_zoom_in1, "activate", G_CALLBACK (on_zoom_in1_activate), NULL); @@ -1009,26 +998,11 @@ create_window1 (void) g_signal_connect ((gpointer) normal_size1, "activate", G_CALLBACK (on_normal_size1_activate), NULL); - g_signal_connect ((gpointer) menu_show_indention_guides1, "toggled", - G_CALLBACK (on_show_indention_guides1_toggled), - NULL); - g_signal_connect ((gpointer) menu_show_white_space, "toggled", - G_CALLBACK (on_show_white_space_toggled), - NULL); - g_signal_connect ((gpointer) menu_show_line_endings1, "toggled", - G_CALLBACK (on_show_line_endings1_toggled), - NULL); g_signal_connect ((gpointer) menu_line_breaking1, "toggled", G_CALLBACK (on_line_breaking1_toggled), NULL); - g_signal_connect ((gpointer) menu_use_auto_indention1, "activate", - G_CALLBACK (on_use_auto_indention1_activate), - NULL); - g_signal_connect ((gpointer) menu_xml_tag1, "activate", - G_CALLBACK (on_xml_tag1_activate), - NULL); - g_signal_connect ((gpointer) menu_construct_completion1, "activate", - G_CALLBACK (on_construct_completion1_activate), + g_signal_connect ((gpointer) menu_use_auto_indention1, "toggled", + G_CALLBACK (on_use_auto_indention1_toggled), NULL); g_signal_connect ((gpointer) set_file_readonly1, "toggled", G_CALLBACK (on_set_file_readonly1_toggled), @@ -1124,7 +1098,7 @@ 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, image474, "image474"); + GLADE_HOOKUP_OBJECT (window1, image562, "image562"); 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"); @@ -1133,12 +1107,13 @@ create_window1 (void) 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, image475, "image475"); + GLADE_HOOKUP_OBJECT (window1, image563, "image563"); GLADE_HOOKUP_OBJECT (window1, revert1, "revert1"); + 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, image476, "image476"); + GLADE_HOOKUP_OBJECT (window1, image564, "image564"); 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"); @@ -1156,11 +1131,11 @@ create_window1 (void) 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, image477, "image477"); + GLADE_HOOKUP_OBJECT (window1, image565, "image565"); 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, image478, "image478"); + GLADE_HOOKUP_OBJECT (window1, image566, "image566"); 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"); @@ -1176,37 +1151,33 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, separator9, "separator9"); GLADE_HOOKUP_OBJECT (window1, find1, "find1"); GLADE_HOOKUP_OBJECT (window1, find_next1, "find_next1"); - GLADE_HOOKUP_OBJECT (window1, image479, "image479"); + GLADE_HOOKUP_OBJECT (window1, image567, "image567"); GLADE_HOOKUP_OBJECT (window1, replace1, "replace1"); - GLADE_HOOKUP_OBJECT (window1, image480, "image480"); + GLADE_HOOKUP_OBJECT (window1, image568, "image568"); GLADE_HOOKUP_OBJECT (window1, separator11, "separator11"); GLADE_HOOKUP_OBJECT (window1, preferences1, "preferences1"); 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, image481, "image481"); + GLADE_HOOKUP_OBJECT (window1, image569, "image569"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image482, "image482"); + GLADE_HOOKUP_OBJECT (window1, image570, "image570"); 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"); GLADE_HOOKUP_OBJECT (window1, menu_show_toolbar1, "menu_show_toolbar1"); GLADE_HOOKUP_OBJECT (window1, menu_markers_margin1, "menu_markers_margin1"); + GLADE_HOOKUP_OBJECT (window1, menu_linenumber_margin1, "menu_linenumber_margin1"); GLADE_HOOKUP_OBJECT (window1, menu_separator5, "menu_separator5"); GLADE_HOOKUP_OBJECT (window1, menu_zoom_in1, "menu_zoom_in1"); GLADE_HOOKUP_OBJECT (window1, menu_zoom_out1, "menu_zoom_out1"); GLADE_HOOKUP_OBJECT (window1, normal_size1, "normal_size1"); GLADE_HOOKUP_OBJECT (window1, menu_item4, "menu_item4"); GLADE_HOOKUP_OBJECT (window1, menu_item4_menu, "menu_item4_menu"); - GLADE_HOOKUP_OBJECT (window1, menu_show_indention_guides1, "menu_show_indention_guides1"); - GLADE_HOOKUP_OBJECT (window1, menu_show_white_space, "menu_show_white_space"); - GLADE_HOOKUP_OBJECT (window1, menu_show_line_endings1, "menu_show_line_endings1"); GLADE_HOOKUP_OBJECT (window1, menu_line_breaking1, "menu_line_breaking1"); GLADE_HOOKUP_OBJECT (window1, menu_use_auto_indention1, "menu_use_auto_indention1"); - GLADE_HOOKUP_OBJECT (window1, menu_xml_tag1, "menu_xml_tag1"); - GLADE_HOOKUP_OBJECT (window1, menu_construct_completion1, "menu_construct_completion1"); - GLADE_HOOKUP_OBJECT (window1, separator10, "separator10"); GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1"); + GLADE_HOOKUP_OBJECT (window1, separator10, "separator10"); GLADE_HOOKUP_OBJECT (window1, set_filetype1, "set_filetype1"); GLADE_HOOKUP_OBJECT (window1, set_filetype1_menu, "set_filetype1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible1, "invisible1"); @@ -1281,59 +1252,6 @@ create_window1 (void) return window1; } -GtkWidget* -create_filesavedialog1 (void) -{ - GtkWidget *filesavedialog1; - GtkWidget *dialog_vbox2; - GtkWidget *dialog_action_area2; - GtkWidget *file_save_cancel_button; - GtkWidget *file_save_save_button; - - filesavedialog1 = gtk_file_chooser_dialog_new (_("Save File"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE, NULL); - gtk_window_set_modal (GTK_WINDOW (filesavedialog1), TRUE); - gtk_window_set_destroy_with_parent (GTK_WINDOW (filesavedialog1), TRUE); - gtk_window_set_skip_taskbar_hint (GTK_WINDOW (filesavedialog1), TRUE); - gtk_window_set_type_hint (GTK_WINDOW (filesavedialog1), GDK_WINDOW_TYPE_HINT_DIALOG); - - dialog_vbox2 = GTK_DIALOG (filesavedialog1)->vbox; - gtk_widget_show (dialog_vbox2); - - dialog_action_area2 = GTK_DIALOG (filesavedialog1)->action_area; - gtk_widget_show (dialog_action_area2); - gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END); - - file_save_cancel_button = gtk_button_new_from_stock ("gtk-cancel"); - gtk_widget_show (file_save_cancel_button); - gtk_dialog_add_action_widget (GTK_DIALOG (filesavedialog1), file_save_cancel_button, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (file_save_cancel_button, GTK_CAN_DEFAULT); - - file_save_save_button = gtk_button_new_from_stock ("gtk-save"); - gtk_widget_show (file_save_save_button); - gtk_dialog_add_action_widget (GTK_DIALOG (filesavedialog1), file_save_save_button, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (file_save_save_button, GTK_CAN_DEFAULT); - - g_signal_connect ((gpointer) filesavedialog1, "delete_event", - G_CALLBACK (on_filesavedialog1_delete_event), - NULL); - g_signal_connect ((gpointer) file_save_cancel_button, "clicked", - G_CALLBACK (on_file_save_cancel_button_clicked), - NULL); - g_signal_connect ((gpointer) file_save_save_button, "clicked", - G_CALLBACK (on_file_save_save_button_clicked), - NULL); - - /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (filesavedialog1, filesavedialog1, "filesavedialog1"); - GLADE_HOOKUP_OBJECT_NO_REF (filesavedialog1, dialog_vbox2, "dialog_vbox2"); - GLADE_HOOKUP_OBJECT_NO_REF (filesavedialog1, dialog_action_area2, "dialog_action_area2"); - GLADE_HOOKUP_OBJECT (filesavedialog1, file_save_cancel_button, "file_save_cancel_button"); - GLADE_HOOKUP_OBJECT (filesavedialog1, file_save_save_button, "file_save_save_button"); - - gtk_widget_grab_default (file_save_save_button); - return filesavedialog1; -} - GtkWidget* create_fontselectiondialog1 (void) { @@ -1857,14 +1775,21 @@ create_prefs_dialog (void) GtkWidget *label19; GtkWidget *frame5; GtkWidget *alignment6; + GtkWidget *vbox12; + GtkWidget *check_indent; + GtkWidget *check_white_space; + GtkWidget *check_line_end; + GtkWidget *check_xmltag; + GtkWidget *check_auto_complete; + GtkWidget *label148; GtkWidget *table3; GtkWidget *label103; - GtkWidget *editor_font; GtkWidget *label133; GtkWidget *label134; - GtkWidget *long_line_color; + GtkWidget *editor_font; GtkObject *spin_long_line_adj; GtkWidget *spin_long_line; + GtkWidget *long_line_color; GtkWidget *label102; GtkWidget *label95; GtkWidget *vbox2; @@ -2247,9 +2172,47 @@ create_prefs_dialog (void) gtk_container_add (GTK_CONTAINER (frame5), alignment6); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment6), 0, 0, 12, 6); + vbox12 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox12); + gtk_container_add (GTK_CONTAINER (alignment6), vbox12); + + check_indent = gtk_check_button_new_with_mnemonic (_("Show indention guides")); + gtk_widget_show (check_indent); + gtk_box_pack_start (GTK_BOX (vbox12), check_indent, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_indent, _("Shows small dotted lines to help you to use the right indention."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_indent), FALSE); + + check_white_space = gtk_check_button_new_with_mnemonic (_("Show white space")); + gtk_widget_show (check_white_space); + gtk_box_pack_start (GTK_BOX (vbox12), check_white_space, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_white_space, _("Marks spaces with dots and tabs with arrows."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_white_space), FALSE); + + check_line_end = gtk_check_button_new_with_mnemonic (_("Show line endings")); + gtk_widget_show (check_line_end); + gtk_box_pack_start (GTK_BOX (vbox12), check_line_end, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_line_end, _("Show the line ending character"), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_line_end), FALSE); + + check_xmltag = gtk_check_button_new_with_mnemonic (_("XML tag auto completion")); + gtk_widget_show (check_xmltag); + gtk_box_pack_start (GTK_BOX (vbox12), check_xmltag, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_xmltag, _("Automatic completion of open XML tags(includes HTML tags)"), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_xmltag), FALSE); + + check_auto_complete = gtk_check_button_new_with_mnemonic (_("Construct auto completion")); + gtk_widget_show (check_auto_complete); + gtk_box_pack_start (GTK_BOX (vbox12), check_auto_complete, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_auto_complete, _("Automatic completion of often used constructs like if and for"), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_auto_complete), FALSE); + + label148 = gtk_label_new (_(" ")); + gtk_widget_show (label148); + gtk_box_pack_start (GTK_BOX (vbox12), label148, FALSE, FALSE, 0); + table3 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table3); - gtk_container_add (GTK_CONTAINER (alignment6), table3); + gtk_box_pack_start (GTK_BOX (vbox12), table3, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table3), 3); gtk_table_set_col_spacings (GTK_TABLE (table3), 25); @@ -2260,13 +2223,6 @@ create_prefs_dialog (void) (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label103), 0, 0.5); - editor_font = gtk_font_button_new (); - gtk_widget_show (editor_font); - gtk_table_attach (GTK_TABLE (table3), editor_font, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, editor_font, _("Sets the font for the editors windows"), NULL); - label133 = gtk_label_new (_("Long line marker")); gtk_widget_show (label133); gtk_table_attach (GTK_TABLE (table3), label133, 0, 1, 1, 2, @@ -2281,6 +2237,23 @@ create_prefs_dialog (void) (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label134), 0, 0.5); + editor_font = gtk_font_button_new (); + gtk_widget_show (editor_font); + gtk_table_attach (GTK_TABLE (table3), editor_font, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, editor_font, _("Sets the font for the editors windows"), NULL); + + spin_long_line_adj = gtk_adjustment_new (72, 0, 1000, 1, 10, 10); + spin_long_line = gtk_spin_button_new (GTK_ADJUSTMENT (spin_long_line_adj), 1, 0); + gtk_widget_show (spin_long_line); + gtk_table_attach (GTK_TABLE (table3), spin_long_line, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, spin_long_line, _("The long line marker is a thin vertical line in the editor. It helps to mark long lines, or as a hint to break the line. To disable set the value to 0, or greater than 0 to specify the column where it should appear."), NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_long_line), TRUE); + gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_long_line), TRUE); + long_line_color = gtk_color_button_new (); gtk_widget_show (long_line_color); gtk_table_attach (GTK_TABLE (table3), long_line_color, 1, 2, 2, 3, @@ -2289,16 +2262,6 @@ create_prefs_dialog (void) gtk_tooltips_set_tip (tooltips, long_line_color, _("Sets the color of the long line marker"), NULL); gtk_color_button_set_title (GTK_COLOR_BUTTON (long_line_color), _("Color Chooser")); - spin_long_line_adj = gtk_adjustment_new (72, 0, 1000, 1, 10, 10); - spin_long_line = gtk_spin_button_new (GTK_ADJUSTMENT (spin_long_line_adj), 1, 0); - gtk_widget_show (spin_long_line); - gtk_table_attach (GTK_TABLE (table3), spin_long_line, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_tooltips_set_tip (tooltips, spin_long_line, _("The long line marker is a thin vertical line in the editor. It helps to mark long lines, or as a hint to break the line. To disable set the value to 0, or greater than 0 to specify the column where it should appear."), NULL); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_long_line), TRUE); - gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_long_line), TRUE); - label102 = gtk_label_new (_("Miscellaneous")); gtk_widget_show (label102); gtk_frame_set_label_widget (GTK_FRAME (frame5), label102); @@ -2807,13 +2770,20 @@ create_prefs_dialog (void) GLADE_HOOKUP_OBJECT (prefs_dialog, label19, "label19"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame5, "frame5"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment6, "alignment6"); + GLADE_HOOKUP_OBJECT (prefs_dialog, vbox12, "vbox12"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_indent, "check_indent"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_white_space, "check_white_space"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_line_end, "check_line_end"); + 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, label148, "label148"); GLADE_HOOKUP_OBJECT (prefs_dialog, table3, "table3"); GLADE_HOOKUP_OBJECT (prefs_dialog, label103, "label103"); - GLADE_HOOKUP_OBJECT (prefs_dialog, editor_font, "editor_font"); GLADE_HOOKUP_OBJECT (prefs_dialog, label133, "label133"); GLADE_HOOKUP_OBJECT (prefs_dialog, label134, "label134"); - GLADE_HOOKUP_OBJECT (prefs_dialog, long_line_color, "long_line_color"); + GLADE_HOOKUP_OBJECT (prefs_dialog, editor_font, "editor_font"); GLADE_HOOKUP_OBJECT (prefs_dialog, spin_long_line, "spin_long_line"); + GLADE_HOOKUP_OBJECT (prefs_dialog, long_line_color, "long_line_color"); GLADE_HOOKUP_OBJECT (prefs_dialog, label102, "label102"); GLADE_HOOKUP_OBJECT (prefs_dialog, label95, "label95"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox2, "vbox2"); diff --git a/src/interface.h b/src/interface.h index a2583c6a..4a9efcf7 100644 --- a/src/interface.h +++ b/src/interface.h @@ -3,7 +3,6 @@ */ GtkWidget* create_window1 (void); -GtkWidget* create_filesavedialog1 (void); GtkWidget* create_fontselectiondialog1 (void); GtkWidget* create_toolbar_popup_menu1 (void); GtkWidget* create_edit_menu1 (void); diff --git a/src/keyfile.c b/src/keyfile.c index 15e35a18..d0cd4c3e 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -83,16 +83,17 @@ void configuration_save(void) g_key_file_set_boolean(config, PACKAGE, "treeview_symbol_visible", app->treeview_symbol_visible); g_key_file_set_boolean(config, PACKAGE, "treeview_openfiles_visible", app->treeview_openfiles_visible); g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible); - g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->use_auto_indention); - g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", app->show_indent_guide); - g_key_file_set_boolean(config, PACKAGE, "show_white_space", app->show_white_space); + g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->pref_editor_use_auto_indention); + 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); - //g_key_file_set_boolean(config, PACKAGE, "line_breaking", app->line_breaking); - g_key_file_set_boolean(config, PACKAGE, "show_line_endings", app->show_line_endings); + g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", app->show_linenumber_margin); + g_key_file_set_boolean(config, PACKAGE, "line_breaking", app->pref_editor_line_breaking); + g_key_file_set_boolean(config, PACKAGE, "show_line_endings", app->pref_editor_show_line_endings); g_key_file_set_boolean(config, PACKAGE, "fullscreen", app->fullscreen); g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages); - g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", app->auto_close_xml_tags); - g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", app->auto_complete_constructs); + g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", app->pref_editor_auto_close_xml_tags); + g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", app->pref_editor_auto_complete_constructs); #ifdef HAVE_VTE g_key_file_set_comment(config, PACKAGE, "terminal_settings", _(" VTE settings: FONT;FOREGROUND;BACKGROUND;scrollback;type;scroll on keystroke;scroll on output"), NULL); @@ -210,16 +211,17 @@ gboolean configuration_load(void) app->treeview_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "treeview_symbol_visible", TRUE); 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->use_auto_indention = utils_get_setting_boolean(config, PACKAGE, "use_auto_indention", TRUE); - app->show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE); - app->show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE); + 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); app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE); - app->show_line_endings = utils_get_setting_boolean(config, PACKAGE, "show_line_endings", FALSE); - //app->line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", TRUE); + app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE); + app->pref_editor_show_line_endings = utils_get_setting_boolean(config, PACKAGE, "show_line_endings", FALSE); + app->pref_editor_line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", TRUE); app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE); app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", TRUE); - app->auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE); - app->auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE); + app->pref_editor_auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE); + app->pref_editor_auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE); app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", "Courier New 9"); app->tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", "Cursor 8"); app->msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", "Cursor 8"); @@ -414,3 +416,18 @@ gboolean configuration_open_files(void) return ret; } + +static gboolean read_filetype_extensions(void) +{ + gboolean config_exists; + guint i, geo_len; + gint *geo = g_malloc(sizeof(gint) * 4); + gsize len = 0; + gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "file", NULL); + gchar *entry = g_malloc(14); + gchar *tmp_string, *tmp_string2; + GKeyFile *config = g_key_file_new(); + GError *error = NULL; + + config_exists = g_key_file_load_from_file(config, configfile, G_KEY_FILE_KEEP_COMMENTS, NULL); +} diff --git a/src/prefs.c b/src/prefs.c index c994120c..308ca020 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -89,6 +89,21 @@ void prefs_init_dialog(void) widget = lookup_widget(app->prefs_dialog, "check_new_line"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_new_line); + widget = lookup_widget(app->prefs_dialog, "check_indent"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_indent_guide); + + widget = lookup_widget(app->prefs_dialog, "check_white_space"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_white_space); + + widget = lookup_widget(app->prefs_dialog, "check_line_end"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_line_endings); + + widget = lookup_widget(app->prefs_dialog, "check_xmltag"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_auto_close_xml_tags); + + widget = lookup_widget(app->prefs_dialog, "check_auto_complete"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_auto_complete_constructs); + widget = lookup_widget(app->prefs_dialog, "editor_font"); gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), app->editor_font); @@ -346,19 +361,22 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat utils_set_font(); // re-colorize all open documents, if tab width or long line settings have changed - if ((app->pref_editor_tab_width != old_tab_width) || +/* if ((app->pref_editor_tab_width != old_tab_width) || (! utils_strcmp(app->long_line_color, old_long_line_color)) || (app->long_line_column != old_long_line_column)) { gint i; - for (i = 0; i < GEANY_MAX_OPEN_FILES; i++) +*/ for (i = 0; i < GEANY_MAX_OPEN_FILES; i++) { if (doc_list[i].is_valid) { sci_set_tab_width(doc_list[i].sci, app->pref_editor_tab_width); sci_set_mark_long_lines(doc_list[i].sci, app->long_line_column, app->long_line_color); + sci_set_visible_eols(doc_list[i].sci, app->pref_editor_show_line_endings); + sci_set_indentionguides(doc_list[i].sci, app->pref_editor_show_indent_guide); + sci_set_visible_white_spaces(doc_list[i].sci, app->pref_editor_show_white_space); } - } +// } old_tab_width = app->pref_editor_tab_width; old_long_line_column = app->long_line_column; g_free(old_long_line_color); diff --git a/src/sci_cb.c b/src/sci_cb.c index de3ffd9a..defbed7c 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -110,7 +110,7 @@ void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer { case '\r': { // simple indentation (only for CR format) - if (app->use_auto_indention && (sci_get_eol_mode(sci) == SC_EOL_CR)) + if (doc_list[idx].use_auto_indention && (sci_get_eol_mode(sci) == SC_EOL_CR)) { sci_cb_get_indent(sci, pos, FALSE); sci_add_text(sci, indent); @@ -124,7 +124,7 @@ void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer } case '\n': { // simple indentation (for CR/LF and LF format) - if (app->use_auto_indention) + if (doc_list[idx].use_auto_indention) { sci_cb_get_indent(sci, pos, FALSE); sci_add_text(sci, indent); @@ -154,7 +154,7 @@ void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer } case ' ': { // if and for autocompletion - if (app->auto_complete_constructs) sci_cb_auto_forif(sci, idx); + if (app->pref_editor_auto_complete_constructs) sci_cb_auto_forif(sci, idx); break; } case '[': @@ -165,7 +165,7 @@ void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer } case '}': { // closing bracket handling - if (app->use_auto_indention) sci_cb_close_block(sci, pos - 1); + if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1); break; } default: sci_cb_start_auto_complete(sci, pos); @@ -446,8 +446,8 @@ void sci_cb_auto_forif(ScintillaObject *sci, gint idx) style == SCE_HPHP_COMMENTLINE || style == SCE_HPHP_COMMENT)) return; - // gets the indention - if (app->use_auto_indention) sci_cb_get_indent(sci, pos, TRUE); + // get the indention + if (doc_list[idx].use_auto_indention) sci_cb_get_indent(sci, pos, TRUE); eol = g_strconcat(utils_get_eol_char(idx), indent, NULL); sci_get_text_range(sci, pos - 7, pos - 1, buf); if (! strncmp("if", buf + 4, 2)) @@ -553,7 +553,7 @@ gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch) // If the user has turned us off, quit now. // This may make sense only in certain languages - if (! app->auto_close_xml_tags || (lexer != SCLEX_HTML && lexer != SCLEX_XML)) + if (! app->pref_editor_auto_close_xml_tags || (lexer != SCLEX_HTML && lexer != SCLEX_XML)) return FALSE;