Revision: 505 Author: eht16 Date: 2006-06-29 10:14:52 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=505&view=rev
Log Message: ----------- Implemented simple printing support.
Modified Paths: -------------- trunk/ChangeLog trunk/geany.glade trunk/src/callbacks.c trunk/src/callbacks.h trunk/src/dialogs.c trunk/src/document.c trunk/src/document.h trunk/src/geany.h trunk/src/interface.c trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/keyfile.c trunk/src/prefs.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/ChangeLog 2006-06-29 17:14:52 UTC (rev 505) @@ -13,6 +13,10 @@ Renamed tools settings from build_* in tools_*. * src/main.c: Ignore SIGPIPE to prevent crashes when running external programs. + * src/geany.h, src/dialogs.c, src/callbacks.c, src/keyfile.c, + src/utils.c, src/prefs.c, geany.glade, src/interface.c, + src/keybindings.c, src/document.c: + Implemented simple printing support.
2006-06-28 Enrico Tröger enrico.troeger@uvena.de
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/geany.glade 2006-06-29 17:14:52 UTC (rev 505) @@ -57,7 +57,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image738"> + <widget class="GtkImage" id="image754"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -150,7 +150,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="image739"> + <widget class="GtkImage" id="image755"> <property name="visible">True</property> <property name="stock">gtk-save</property> <property name="icon_size">1</property> @@ -188,6 +188,22 @@ </child>
<child> + <widget class="GtkSeparatorMenuItem" id="separator24"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="print1"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Prints the current file</property> + <property name="label">gtk-print</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_print1_activate" last_modification_time="Thu, 29 Jun 2006 12:48:54 GMT"/> + </widget> + </child> + + <child> <widget class="GtkSeparatorMenuItem" id="separator14"> <property name="visible">True</property> </widget> @@ -211,7 +227,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="image740"> + <widget class="GtkImage" id="image756"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -327,7 +343,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image741"> + <widget class="GtkImage" id="image757"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -359,7 +375,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image742"> + <widget class="GtkImage" id="image758"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -537,7 +553,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="image743"> + <widget class="GtkImage" id="image759"> <property name="visible">True</property> <property name="stock">gtk-find-and-replace</property> <property name="icon_size">1</property> @@ -564,7 +580,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="image744"> + <widget class="GtkImage" id="image760"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property> @@ -599,7 +615,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="image745"> + <widget class="GtkImage" id="image761"> <property name="visible">True</property> <property name="stock">gtk-select-font</property> <property name="icon_size">1</property> @@ -621,7 +637,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="image746"> + <widget class="GtkImage" id="image762"> <property name="visible">True</property> <property name="stock">gtk-select-color</property> <property name="icon_size">1</property> @@ -3865,7 +3881,7 @@ <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">3</property> <property name="homogeneous">False</property> <property name="row_spacing">7</property> @@ -4107,6 +4123,85 @@ <property name="y_options"></property> </packing> </child> + + <child> + <widget class="GtkLabel" id="label154"> + <property name="visible">True</property> + <property name="label" translatable="yes">Print command</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="entry_print"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Path to the command for printing files(use %f for the filename).</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="button_print"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkImage" id="image763"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="padding">0</property>
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/callbacks.c 2006-06-29 17:14:52 UTC (rev 505) @@ -2420,3 +2420,12 @@ utils_update_statusbar(idx, -1); }
+ +void +on_print1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + gint idx = document_get_cur_idx(); + + document_print(idx); +}
Modified: trunk/src/callbacks.h =================================================================== --- trunk/src/callbacks.h 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/callbacks.h 2006-06-29 17:14:52 UTC (rev 505) @@ -582,3 +582,7 @@ void on_encoding_change (GtkMenuItem *menuitem, gpointer user_data); + +void +on_print1_activate (GtkMenuItem *menuitem, + gpointer user_data);
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/dialogs.c 2006-06-29 17:14:52 UTC (rev 505) @@ -880,7 +880,7 @@ gchar *sel = NULL;
if (idx == -1 || ! doc_list[idx].is_valid) return; - + if (sci_get_lines_selected(doc_list[idx].sci) == 1) { sel = g_malloc(sci_get_selected_text_length(doc_list[idx].sci)); @@ -1666,7 +1666,7 @@ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), encoding_string); g_free(encoding_string); } - + #ifdef HAVE_VTE if (app->have_vte) { @@ -1816,6 +1816,8 @@ "clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_term")); g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_browser"), "clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_browser")); + g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_print"), + "clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_print"));
}
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/document.c 2006-06-29 17:14:52 UTC (rev 505) @@ -40,6 +40,7 @@ # include <fcntl.h> #endif #include <ctype.h> +#include <stdlib.h>
#include "document.h" #include "callbacks.h" @@ -524,11 +525,11 @@ document_set_filetype(idx, use_ft); utils_build_show_hide(idx); } - else + else { document_update_tag_list(idx, TRUE); } - + document_set_text_changed(idx);
g_free(data); @@ -613,8 +614,8 @@
// try to convert it from UTF-8 to original encoding conv_file_contents = g_convert(data, -1, doc_list[idx].encoding, "UTF-8", - NULL, NULL, &conv_error); - + NULL, NULL, &conv_error); + if (conv_error != NULL) { dialogs_show_error( @@ -1103,10 +1104,10 @@ 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;
@@ -1120,10 +1121,42 @@ 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); } + + +/* simple file print */ +void document_print(gint idx) +{ + /// TODO test under Win32 + gchar *cmdline; + + if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_name == NULL) return; + + cmdline = g_strdup(app->tools_print_cmd); + cmdline = utils_str_replace(cmdline, "%f", doc_list[idx].file_name); + + if (dialogs_show_question(_("The file "%s" will be printed with the following command:\n\n%s"), + doc_list[idx].file_name, cmdline)) + { + gint rc; + // system() is not the best way, but the only one I found to get the following working: + // a2ps -1 --medium=A4 -o - %f | xfprint4 + rc = system(cmdline); + if (rc != 0) + { + dialogs_show_error(_("Printing of "%s" failed(return code: %d)."), + doc_list[idx].file_name, rc); + } + else + { + msgwin_status_add(_("File %s printed."), doc_list[idx].file_name); + } + } + g_free(cmdline); +}
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/document.h 2006-06-29 17:14:52 UTC (rev 505) @@ -88,7 +88,6 @@ be UTF-8). */ void document_save_file (gint);
- void document_find_text(gint, const gchar*, gint, gboolean);
void document_replace_text(gint, const gchar*, const gchar*, gint, gboolean); @@ -99,13 +98,10 @@
void document_find_next(gint, const gchar*, gint, gboolean, gboolean);
- void document_set_font(gint, const gchar*, gint);
- void document_update_tag_list(gint, gboolean);
- void document_set_filetype(gint, filetype*);
gchar *document_get_eol_mode(gint); @@ -120,4 +116,7 @@
void document_clear_indicators(gint idx);
+/* simple file print */ +void document_print(gint idx); + #endif
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/geany.h 2006-06-29 17:14:52 UTC (rev 505) @@ -205,7 +205,7 @@ GtkWidget *redo_items[2]; GtkWidget *undo_items[2]; GtkWidget *save_buttons[2]; - GtkWidget *sensitive_buttons[32]; + GtkWidget *sensitive_buttons[33]; GtkWidget *open_colorsel; GtkWidget *open_fontsel; GtkWidget *open_filesel;
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/interface.c 2006-06-29 17:14:52 UTC (rev 505) @@ -37,7 +37,7 @@ GtkWidget *menuitem1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image738; + GtkWidget *image754; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -49,14 +49,16 @@ GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image739; + GtkWidget *image755; GtkWidget *revert1; GtkWidget *separator21; GtkWidget *preferences2; + GtkWidget *separator24; + GtkWidget *print1; GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image740; + GtkWidget *image756; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -70,11 +72,11 @@ GtkWidget *menu_delete1; GtkWidget *menu_seperator2; GtkWidget *insert_include2; - GtkWidget *image741; + GtkWidget *image757; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image742; + GtkWidget *image758; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -95,16 +97,16 @@ GtkWidget *find_next1; GtkWidget *find_previous1; GtkWidget *replace1; - GtkWidget *image743; + GtkWidget *image759; GtkWidget *separator11; GtkWidget *go_to_line1; - GtkWidget *image744; + GtkWidget *image760; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image745; + GtkWidget *image761; GtkWidget *menu_choose_color1; - GtkWidget *image746; + GtkWidget *image762; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; @@ -235,9 +237,9 @@ gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1);
- image738 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image738); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image738); + image754 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image754); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image754);
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); @@ -282,9 +284,9 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1); gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
- image739 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image739); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image739); + image755 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image755); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image755);
revert1 = gtk_image_menu_item_new_from_stock ("gtk-revert-to-saved", accel_group); gtk_widget_show (revert1); @@ -299,6 +301,16 @@ gtk_widget_show (preferences2); gtk_container_add (GTK_CONTAINER (menuitem1_menu), preferences2);
+ separator24 = gtk_separator_menu_item_new (); + gtk_widget_show (separator24); + gtk_container_add (GTK_CONTAINER (menuitem1_menu), separator24); + gtk_widget_set_sensitive (separator24, FALSE); + + print1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group); + gtk_widget_show (print1); + gtk_container_add (GTK_CONTAINER (menuitem1_menu), print1); + gtk_tooltips_set_tip (tooltips, print1, _("Prints the current file"), NULL); + separator14 = gtk_separator_menu_item_new (); gtk_widget_show (separator14); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separator14); @@ -313,9 +325,9 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1); gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
- image740 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image740); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image740); + image756 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image756); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image756);
menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -372,9 +384,9 @@ gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
- image741 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image741); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image741); + image757 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image757); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image757);
insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -386,9 +398,9 @@ gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
- image742 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image742); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image742); + image758 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image758); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image758);
add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -475,9 +487,9 @@ gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
- image743 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image743); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image743); + image759 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image759); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image759);
separator11 = gtk_separator_menu_item_new (); gtk_widget_show (separator11); @@ -488,9 +500,9 @@ gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
- image744 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image744); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image744); + image760 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image760); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image760);
menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); @@ -504,18 +516,18 @@ gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1); gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
- image745 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image745); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image745); + image761 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image761); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image761);
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);
- image746 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image746); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image746); + image762 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image762); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image762);
menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -980,6 +992,9 @@ g_signal_connect ((gpointer) preferences2, "activate", G_CALLBACK (on_file_properties_activate), NULL); + g_signal_connect ((gpointer) print1, "activate", + G_CALLBACK (on_print1_activate), + NULL); g_signal_connect ((gpointer) menu_close1, "activate", G_CALLBACK (on_close1_activate), NULL); @@ -1197,7 +1212,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, image738, "image738"); + GLADE_HOOKUP_OBJECT (window1, image754, "image754"); 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"); @@ -1209,14 +1224,16 @@ 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, image739, "image739"); + GLADE_HOOKUP_OBJECT (window1, image755, "image755"); GLADE_HOOKUP_OBJECT (window1, revert1, "revert1"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); GLADE_HOOKUP_OBJECT (window1, preferences2, "preferences2"); + GLADE_HOOKUP_OBJECT (window1, separator24, "separator24"); + GLADE_HOOKUP_OBJECT (window1, print1, "print1"); 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, image740, "image740"); + GLADE_HOOKUP_OBJECT (window1, image756, "image756"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1230,11 +1247,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, image741, "image741"); + GLADE_HOOKUP_OBJECT (window1, image757, "image757"); 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, image742, "image742"); + GLADE_HOOKUP_OBJECT (window1, image758, "image758"); 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"); @@ -1255,16 +1272,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, image743, "image743"); + GLADE_HOOKUP_OBJECT (window1, image759, "image759"); GLADE_HOOKUP_OBJECT (window1, separator11, "separator11"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image744, "image744"); + GLADE_HOOKUP_OBJECT (window1, image760, "image760"); 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, image745, "image745"); + GLADE_HOOKUP_OBJECT (window1, image761, "image761"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image746, "image746"); + GLADE_HOOKUP_OBJECT (window1, image762, "image762"); 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"); @@ -1882,6 +1899,10 @@ GtkWidget *image286; GtkWidget *button_browser; GtkWidget *image287; + GtkWidget *label154; + GtkWidget *entry_print; + GtkWidget *button_print; + GtkWidget *image763; GtkWidget *label96; GtkWidget *vbox9; GtkWidget *label120; @@ -2399,7 +2420,7 @@ gtk_box_pack_start (GTK_BOX (vbox2), label17, FALSE, FALSE, 0); gtk_misc_set_padding (GTK_MISC (label17), 0, 6);
- table1 = gtk_table_new (3, 3, FALSE); + table1 = gtk_table_new (4, 3, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox2), table1, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table1), 7); @@ -2477,6 +2498,30 @@ gtk_widget_show (image287); gtk_container_add (GTK_CONTAINER (button_browser), image287);
+ label154 = gtk_label_new (_("Print command")); + gtk_widget_show (label154); + gtk_table_attach (GTK_TABLE (table1), label154, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label154), 0, 0.5); + + entry_print = gtk_entry_new (); + gtk_widget_show (entry_print); + gtk_table_attach (GTK_TABLE (table1), entry_print, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, entry_print, _("Path to the command for printing files(use %f for the filename)."), NULL); + + button_print = gtk_button_new (); + gtk_widget_show (button_print); + gtk_table_attach (GTK_TABLE (table1), button_print, 2, 3, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + image763 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON); + gtk_widget_show (image763); + gtk_container_add (GTK_CONTAINER (button_print), image763); + label96 = gtk_label_new (_("Tools")); gtk_widget_show (label96); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 2), label96); @@ -2724,6 +2769,10 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, image286, "image286"); GLADE_HOOKUP_OBJECT (prefs_dialog, button_browser, "button_browser"); GLADE_HOOKUP_OBJECT (prefs_dialog, image287, "image287"); + GLADE_HOOKUP_OBJECT (prefs_dialog, label154, "label154"); + GLADE_HOOKUP_OBJECT (prefs_dialog, entry_print, "entry_print"); + GLADE_HOOKUP_OBJECT (prefs_dialog, button_print, "button_print"); + GLADE_HOOKUP_OBJECT (prefs_dialog, image763, "image763"); GLADE_HOOKUP_OBJECT (prefs_dialog, label96, "label96"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox9, "vbox9"); GLADE_HOOKUP_OBJECT (prefs_dialog, label120, "label120");
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/keybindings.c 2006-06-29 17:14:52 UTC (rev 505) @@ -47,6 +47,7 @@ static void cb_func_menu_open(void); static void cb_func_menu_save(void); static void cb_func_menu_saveall(void); +static void cb_func_menu_print(void); static void cb_func_menu_close(void); static void cb_func_menu_closeall(void); static void cb_func_menu_reloadfile(void); @@ -111,6 +112,8 @@ GDK_s, GDK_CONTROL_MASK, "menu_save", _("Save")); keys[GEANY_KEYS_MENU_SAVEALL] = fill(cb_func_menu_saveall, GDK_S, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "menu_saveall", _("Save all")); + keys[GEANY_KEYS_MENU_PRINT] = fill(cb_func_menu_print, + GDK_p, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "menu_print", _("Print")); keys[GEANY_KEYS_MENU_CLOSE] = fill(cb_func_menu_close, GDK_w, GDK_CONTROL_MASK, "menu_close", _("Close")); keys[GEANY_KEYS_MENU_CLOSEALL] = fill(cb_func_menu_closeall, @@ -237,6 +240,7 @@
// apply the settings GEANY_ADD_ACCEL(GEANY_KEYS_MENU_SAVEALL, menu_save_all1); + GEANY_ADD_ACCEL(GEANY_KEYS_MENU_PRINT, print1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_CLOSE, menu_close1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_CLOSEALL, menu_close_all1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_RELOADFILE, revert1); @@ -463,21 +467,21 @@ static void cb_func_menu_foldall(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; document_fold_all(idx); }
static void cb_func_menu_unfoldall(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; document_unfold_all(idx); }
static void cb_func_build_compile(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_type->menu_items->can_compile && doc_list[idx].file_name != NULL) on_build_compile_activate(NULL, NULL); } @@ -485,7 +489,7 @@ static void cb_func_build_link(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_type->menu_items->can_link && doc_list[idx].file_name != NULL) on_build_build_activate(NULL, NULL); } @@ -493,7 +497,7 @@ static void cb_func_build_make(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_name != NULL) on_build_make_activate(NULL, GINT_TO_POINTER(0)); } @@ -501,7 +505,7 @@ static void cb_func_build_makeowntarget(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_name != NULL) on_build_make_activate(NULL, GINT_TO_POINTER(1)); } @@ -509,7 +513,7 @@ static void cb_func_build_run(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_type->menu_items->can_exec && doc_list[idx].file_name != NULL) on_build_execute_activate(NULL, GINT_TO_POINTER(0)); } @@ -517,7 +521,7 @@ static void cb_func_build_run2(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (doc_list[idx].file_type->menu_items->can_exec && doc_list[idx].file_name != NULL) on_build_execute_activate(NULL, GINT_TO_POINTER(1)); } @@ -525,7 +529,7 @@ static void cb_func_build_options(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if ((doc_list[idx].file_type->menu_items->can_compile || doc_list[idx].file_type->menu_items->can_link || doc_list[idx].file_type->menu_items->can_exec) && @@ -536,7 +540,7 @@ static void cb_func_reloadtaglist(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; document_update_tag_list(idx, TRUE); }
@@ -565,7 +569,7 @@ gint pos;
if (idx == -1 || ! doc_list[idx].is_valid) return; - + pos = sci_get_current_position(doc_list[idx].sci);
utils_find_current_word(doc_list[idx].sci, pos, @@ -594,7 +598,7 @@ static void cb_func_switch_editor(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci)); }
@@ -627,7 +631,7 @@ static gboolean symbol = FALSE; static gboolean openfiles = FALSE; static gboolean is_visible = FALSE; - static gint active_page = -1; + static gint active_page = -1;
/* this code is a bit confusing, but I want to keep the settings in the preferences dialog * synchronous with the real status of the sidebar, so we have to store the previous state when @@ -656,7 +660,7 @@ static void cb_func_edit_duplicateline(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; if (sci_can_copy(doc_list[idx].sci)) sci_selection_duplicate(doc_list[idx].sci); else @@ -666,35 +670,35 @@ static void cb_func_edit_commentline(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; sci_cb_do_comment(idx); }
static void cb_func_edit_autocomplete(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; sci_cb_start_auto_complete(doc_list[idx].sci, sci_get_current_position(doc_list[idx].sci)); }
static void cb_func_edit_calltip(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; sci_cb_show_calltip(doc_list[idx].sci, -1); }
static void cb_func_edit_macrolist(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; sci_cb_show_macro_list(doc_list[idx].sci); }
static void cb_func_edit_suppresscompletion(void) { gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid) return; sci_add_text(doc_list[idx].sci, " "); }
@@ -702,3 +706,10 @@ { on_replace_tabs_activate(NULL, NULL); } + +static void cb_func_menu_print(void) +{ + gint idx = document_get_cur_idx(); + if (idx == -1 || ! doc_list[idx].is_valid) return; + document_print(idx); +}
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/keybindings.h 2006-06-29 17:14:52 UTC (rev 505) @@ -45,6 +45,7 @@ GEANY_KEYS_MENU_OPEN, GEANY_KEYS_MENU_SAVE, GEANY_KEYS_MENU_SAVEALL, + GEANY_KEYS_MENU_PRINT, GEANY_KEYS_MENU_CLOSE, GEANY_KEYS_MENU_CLOSEALL, GEANY_KEYS_MENU_RELOADFILE,
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/keyfile.c 2006-06-29 17:14:52 UTC (rev 505) @@ -134,6 +134,7 @@ g_key_file_set_string(config, "tools", "make_cmd", app->tools_make_cmd ? app->tools_make_cmd : ""); g_key_file_set_string(config, "tools", "terminal_cmd", app->tools_term_cmd ? app->tools_term_cmd : ""); g_key_file_set_string(config, "tools", "browser_cmd", app->tools_browser_cmd ? app->tools_browser_cmd : ""); + g_key_file_set_string(config, "tools", "print_cmd", app->tools_print_cmd ? app->tools_print_cmd : "");
for (i = 0; i < app->mru_length; i++) { @@ -285,17 +286,23 @@ app->pref_editor_trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", TRUE);
tmp_string = g_find_program_in_path("make"); - app->tools_make_cmd = utils_get_setting_string(config, "tools", "tools_make_cmd", tmp_string); + app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string); g_free(tmp_string);
tmp_string = g_find_program_in_path("xterm"); - app->tools_term_cmd = utils_get_setting_string(config, "tools", "tools_term_cmd", tmp_string); + app->tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string); g_free(tmp_string);
tmp_string = g_find_program_in_path("mozilla"); - app->tools_browser_cmd = utils_get_setting_string(config, "tools", "tools_browser_cmd", tmp_string); + app->tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string); g_free(tmp_string);
+ tmp_string2 = g_find_program_in_path("lpr"); + tmp_string = g_strconcat(tmp_string2, " %f", NULL); + app->tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string); + g_free(tmp_string); + g_free(tmp_string2); + recent_files = g_key_file_get_string_list(config, "files", "recent_files", &len, NULL); if (recent_files != NULL) {
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2006-06-29 17:10:17 UTC (rev 504) +++ trunk/src/prefs.c 2006-06-29 17:14:52 UTC (rev 505) @@ -185,7 +185,10 @@ if (app->tools_browser_cmd) gtk_entry_set_text(GTK_ENTRY(lookup_widget(app->prefs_dialog, "entry_browser")), app->tools_browser_cmd);
+ if (app->tools_browser_cmd) + gtk_entry_set_text(GTK_ENTRY(lookup_widget(app->prefs_dialog, "entry_print")), app->tools_print_cmd);
+ // Template settings widget = lookup_widget(app->prefs_dialog, "entry_template_developer"); gtk_entry_set_text(GTK_ENTRY(widget), app->pref_template_developer); @@ -381,6 +384,10 @@ g_free(app->tools_browser_cmd); app->tools_browser_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
+ widget = lookup_widget(app->prefs_dialog, "entry_print"); + g_free(app->tools_print_cmd); + app->tools_print_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); + // Template settings widget = lookup_widget(app->prefs_dialog, "entry_template_developer"); g_free(app->pref_template_developer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.