diff -rbu2 gnumeric-1.0.4/AUTHORS gnumeric-1.0.4-edit/AUTHORS --- gnumeric-1.0.4/AUTHORS Wed Aug 15 12:08:27 2001 +++ gnumeric-1.0.4-edit/AUTHORS Wed Mar 13 13:59:40 2002 @@ -31,4 +31,5 @@ Vladimir Vuksan, financial functions. Morten Welinder, Gnumeric hacker and leak plugging demi-god. +Matthew Chappee, --print support. NOTE : Keep this in sync with the about dialog and the webpage. Only in gnumeric-1.0.4-edit/src: Makefile Only in gnumeric-1.0.4-edit/src/dialogs: Makefile diff -rbu2 gnumeric-1.0.4/src/dialogs/dialog-printer-setup.c gnumeric-1.0.4-edit/src/dialogs/dialog-printer-setup.c --- gnumeric-1.0.4/src/dialogs/dialog-printer-setup.c Mon Dec 24 15:11:55 2001 +++ gnumeric-1.0.4-edit/src/dialogs/dialog-printer-setup.c Wed Mar 13 10:57:35 2002 @@ -1558,5 +1558,5 @@ sheet = state->sheet; gnome_dialog_close (GNOME_DIALOG (state->dialog)); - sheet_print (wbcg, sheet, FALSE, PRINT_ACTIVE_SHEET); + sheet_print (wbcg, sheet, FALSE, PRINT_ACTIVE_SHEET, TRUE); } @@ -1565,5 +1565,5 @@ { fetch_settings (state); - sheet_print (state->wbcg, state->sheet, TRUE, PRINT_ACTIVE_SHEET); + sheet_print (state->wbcg, state->sheet, TRUE, PRINT_ACTIVE_SHEET, TRUE); } Only in gnumeric-1.0.4-edit/src/functions: Makefile diff -rbu2 gnumeric-1.0.4/src/main.c gnumeric-1.0.4-edit/src/main.c --- gnumeric-1.0.4/src/main.c Mon Dec 31 19:13:25 2001 +++ gnumeric-1.0.4-edit/src/main.c Wed Mar 13 14:49:05 2002 @@ -35,4 +35,5 @@ #include "sheet-autofill.h" #include "xml-io.h" +#include "print.h" #include @@ -65,4 +66,5 @@ int dependency_debugging = 0; int immediate_exit_flag = 0; +int print_immediate_flag = 0; int print_debugging = 0; gboolean initial_workbook_open_complete = FALSE; @@ -110,4 +112,7 @@ N_("Exit immediately after loading the selected books (useful for testing)."), NULL }, + { "print", '\0', POPT_ARG_NONE, &print_immediate_flag, 0, + N_("Print the active sheet upon startup, then exits. No GUI is shown."), NULL }, + { NULL, '\0', 0, NULL, 0 } }; @@ -176,4 +181,5 @@ WorkbookControl *wbc; const char *gnumeric_binary = argv[0]; + Sheet *sheet; /* Make stdout line buffered - we only use it for debug info */ @@ -190,4 +196,7 @@ gnumeric_arg_parse (argc, argv); + if (print_immediate_flag) + immediate_exit_flag = 1; + if (gnumeric_show_version) { printf (_("gnumeric version '%s'\ndatadir := '%s'\nlibdir := '%s'\n"), @@ -259,5 +268,5 @@ bonobo_activate (); #endif - wbc = workbook_control_gui_new (NULL, NULL); + wbc = workbook_control_gui_new (NULL, NULL, print_immediate_flag); plugins_init (COMMAND_CONTEXT (wbc)); if (startup_files) { @@ -275,4 +284,9 @@ poptFreeContext (ctx); + if (print_immediate_flag) { + sheet = wb_control_cur_sheet (wbc); + sheet_print (WORKBOOK_CONTROL_GUI (wbc), sheet, FALSE, PRINT_ACTIVE_SHEET, print_immediate_flag); + } + /* If we were intentionally short circuited exit now */ if (!initial_workbook_open_complete && !immediate_exit_flag) { @@ -281,4 +295,5 @@ workbook_sheet_add (wb_control_workbook (wbc), NULL, FALSE); + handle_paint_events (); } diff -rbu2 gnumeric-1.0.4/src/print.c gnumeric-1.0.4-edit/src/print.c --- gnumeric-1.0.4/src/print.c Fri Dec 21 17:50:56 2001 +++ gnumeric-1.0.4-edit/src/print.c Wed Mar 13 14:02:35 2002 @@ -1078,5 +1078,6 @@ void sheet_print (WorkbookControlGUI *wbcg, Sheet *sheet, - gboolean preview, PrintRange default_range) + gboolean preview, PrintRange default_range, + int print_immediate_flag) { GnomePrinter *printer = NULL; @@ -1110,4 +1111,5 @@ gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT); + if (!print_immediate_flag) { switch (gnumeric_dialog_run (wbcg, GNOME_DIALOG(gpd))) { case GNOME_PRINT_PRINT: @@ -1122,4 +1124,6 @@ return; } + } + gnome_print_dialog_get_copies (gpd, &copies, &collate); printer = gnome_print_dialog_get_printer (gpd); diff -rbu2 gnumeric-1.0.4/src/print.h gnumeric-1.0.4-edit/src/print.h --- gnumeric-1.0.4/src/print.h Tue Oct 31 10:17:31 2000 +++ gnumeric-1.0.4-edit/src/print.h Wed Mar 13 14:03:42 2002 @@ -13,5 +13,6 @@ void sheet_print (WorkbookControlGUI *wbcg, Sheet *sheet, - gboolean preview, PrintRange default_range); + gboolean preview, PrintRange default_range, + int print_immediate_flag); #endif /* GNUMERIC_PRINT_H */ Only in gnumeric-1.0.4-edit/src/widgets: Makefile diff -rbu2 gnumeric-1.0.4/src/workbook-control-gui.c gnumeric-1.0.4-edit/src/workbook-control-gui.c --- gnumeric-1.0.4/src/workbook-control-gui.c Mon Jan 28 19:40:43 2002 +++ gnumeric-1.0.4-edit/src/workbook-control-gui.c Wed Mar 13 14:03:12 2002 @@ -262,5 +262,5 @@ wbcg_control_new (WorkbookControl *wbc, WorkbookView *wbv, Workbook *wb) { - return workbook_control_gui_new (wbv, wb); + return workbook_control_gui_new (wbv, wb, 0); } @@ -1343,5 +1343,5 @@ * for how many sheets to create by default */ - (void) workbook_control_gui_new (NULL, workbook_new_with_sheets (1)); + (void) workbook_control_gui_new (NULL, workbook_new_with_sheets (1), 0); } @@ -1476,5 +1476,5 @@ { Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg)); - sheet_print (wbcg, sheet, FALSE, PRINT_ACTIVE_SHEET); + sheet_print (wbcg, sheet, FALSE, PRINT_ACTIVE_SHEET, 0); } @@ -1483,5 +1483,5 @@ { Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg)); - sheet_print (wbcg, sheet, TRUE, PRINT_ACTIVE_SHEET); + sheet_print (wbcg, sheet, TRUE, PRINT_ACTIVE_SHEET, 0); } @@ -4180,5 +4180,6 @@ void workbook_control_gui_init (WorkbookControlGUI *wbcg, - WorkbookView *optional_view, Workbook *optional_wb) + WorkbookView *optional_view, Workbook *optional_wb, + int print_immediate_flag) { #ifdef ENABLE_BONOBO @@ -4356,4 +4357,6 @@ /* Postpone showing the GUI, so that we may resize it freely. */ + /* Do not show GUI if called with --print */ + if (!print_immediate_flag) gtk_idle_add ((GtkFunction) show_gui, wbcg); /* Postpone clipboard setup. For mysterious reasons, connecting @@ -4459,5 +4462,5 @@ WorkbookControl * -workbook_control_gui_new (WorkbookView *optional_view, Workbook *wb) +workbook_control_gui_new (WorkbookView *optional_view, Workbook *wb, int print_immediate_flag) { WorkbookControlGUI *wbcg; @@ -4466,5 +4469,5 @@ wbcg = gtk_type_new (workbook_control_gui_get_type ()); wbc = WORKBOOK_CONTROL (wbcg); - workbook_control_gui_init (wbcg, optional_view, wb); + workbook_control_gui_init (wbcg, optional_view, wb, print_immediate_flag); workbook_control_init_state (wbc); diff -rbu2 gnumeric-1.0.4/src/workbook-control-gui.h gnumeric-1.0.4-edit/src/workbook-control-gui.h --- gnumeric-1.0.4/src/workbook-control-gui.h Thu Nov 15 00:03:28 2001 +++ gnumeric-1.0.4-edit/src/workbook-control-gui.h Wed Mar 13 13:35:27 2002 @@ -12,8 +12,10 @@ GtkType workbook_control_gui_get_type (void); WorkbookControl *workbook_control_gui_new (WorkbookView *optional_view, - Workbook *optional_wb); + Workbook *optional_wb, + int print_immediate_flag); void workbook_control_gui_init (WorkbookControlGUI *wbcg, WorkbookView *optional_view, - Workbook *optional_wb); + Workbook *optional_wb, + int print_immediate_flag); GtkWindow *wb_control_gui_toplevel (WorkbookControlGUI *wbcg);