[gnumeric] Restore Gnumeric print range. [#649714]



commit d832fbcdae6774c39257654c702e6740885d9704
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun May 8 12:20:32 2011 -0600

    Restore Gnumeric print range. [#649714]
    
    2011-05-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/auto-format.c (do_af_suggest_list): use GNM_*_KILL_SWITCH_WARNING
    	* src/print.c (compute_pages): handle PRINT_SAVED_INFO
    	(gnm_print_sheet): ditto
    	* src/print.h (PrintRange): Since we are saving those numbers we
    	need to fix them. Add PRINT_SAVED_INFO = -1.
    	* src/wbc-gtk-actions.c (cb_file_print): don't force active sheet
    	printing
    
    2011-05-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-printer-setup.c (cb_do_print): do not force active sheet
    	printing

 ChangeLog                          |   10 ++++++++++
 NEWS                               |    1 +
 src/auto-format.c                  |    5 +++++
 src/dialogs/ChangeLog              |    5 +++++
 src/dialogs/dialog-printer-setup.c |    2 +-
 src/print.c                        |   16 ++++++++++++++++
 src/print.h                        |   15 ++++++++-------
 src/wbc-gtk-actions.c              |    2 +-
 8 files changed, 47 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1b01d16..99b68ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/auto-format.c (do_af_suggest_list): use GNM_*_KILL_SWITCH_WARNING
+	* src/print.c (compute_pages): handle PRINT_SAVED_INFO
+	(gnm_print_sheet): ditto
+	* src/print.h (PrintRange): Since we are saving those numbers we
+	need to fix them. Add PRINT_SAVED_INFO = -1.
+	* src/wbc-gtk-actions.c (cb_file_print): don't force active sheet
+	printing
+
 2011-05-07  Morten Welinder  <terra gnome org>
 
 	* src/sheet.c (sheet_colrow_optimize1): Take sheet extent into
diff --git a/NEWS b/NEWS
index 18bfc52..92a588b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
 	* Fix handling of argument names in docs. [#649592]
 	* Fix pdf docs. [#649591]
 	* Handle MS Works formula import. [#649406]
+	* Restore Gnumeric print range. [#649714]
 
 Morten:
 	* Fix problems with localized function docs.
diff --git a/src/auto-format.c b/src/auto-format.c
index 4408c0b..8eac113 100644
--- a/src/auto-format.c
+++ b/src/auto-format.c
@@ -14,6 +14,7 @@
 #include "gnumeric.h"
 #include "auto-format.h"
 
+#include "compilation.h"
 #include "func.h"
 #include "cell.h"
 #include "value.h"
@@ -247,6 +248,8 @@ do_af_suggest_list (int argc, GnmExprConstPtr const *argv,
 
 /* ------------------------------------------------------------------------- */
 
+GNM_BEGIN_KILL_SWITCH_WARNING
+
 GOFormat const *
 auto_style_format_suggest (GnmExprTop const *texpr, GnmEvalPos const *epos)
 {
@@ -288,3 +291,5 @@ auto_style_format_suggest (GnmExprTop const *texpr, GnmEvalPos const *epos)
 
 	return explicit;
 }
+
+GNM_END_KILL_SWITCH_WARNING
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index fc21c6f..1e3233c 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-printer-setup.c (cb_do_print): do not force active sheet
+	printing
+
 2011-05-06  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-function-select.c (describe_new_style): indicate varargs
diff --git a/src/dialogs/dialog-printer-setup.c b/src/dialogs/dialog-printer-setup.c
index c9d0a9b..db41710 100644
--- a/src/dialogs/dialog-printer-setup.c
+++ b/src/dialogs/dialog-printer-setup.c
@@ -2612,7 +2612,7 @@ cb_do_print (PrinterSetupState *state)
 	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
 
 	cb_do_print_ok (state);
-	gnm_print_sheet (wbc, sheet, FALSE, PRINT_ACTIVE_SHEET, NULL);
+	gnm_print_sheet (wbc, sheet, FALSE, PRINT_SAVED_INFO, NULL);
 }
 
 static void
diff --git a/src/print.c b/src/print.c
index f532151..4987838 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1075,6 +1075,8 @@ compute_pages (GtkPrintOperation *operation,
 	guint ct;
 
 	switch (pr) {
+	case PRINT_SAVED_INFO:
+		/* This should never happen. */
 	case PRINT_ACTIVE_SHEET:
 		compute_sheet_pages_add_sheet (pi, pi->sheet, FALSE, FALSE);
 		break;
@@ -1587,6 +1589,10 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
 	gchar *tmp_file_name = NULL;
 	int tmp_file_fd = -1;
 	gboolean preview_via_pdf = FALSE;
+	PrintRange pr_translator[] = {PRINT_ACTIVE_SHEET, PRINT_ALL_SHEETS,
+				      PRINT_ALL_SHEETS, PRINT_ACTIVE_SHEET,
+				      PRINT_SHEET_SELECTION, PRINT_ACTIVE_SHEET,
+				      PRINT_SHEET_SELECTION_IGNORE_PRINTAREA};
 
 #ifdef PREVIEW_VIA_PDF
 	preview_via_pdf = preview;
@@ -1603,6 +1609,16 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
 	pi->sheet = sheet;
 
 	settings = gnm_conf_get_print_settings ();
+	if (default_range == PRINT_SAVED_INFO) {
+		gint dr = gtk_print_settings_get_int_with_default
+			(settings,
+			 GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY,
+			 PRINT_ACTIVE_SHEET);
+		if (dr < 0 || dr >= (gint)G_N_ELEMENTS (pr_translator))
+			default_range = PRINT_ACTIVE_SHEET;
+		else 
+			default_range = pr_translator[dr];
+	}
 	gtk_print_settings_set_int (settings,
 				    GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY,
 				    default_range);
diff --git a/src/print.h b/src/print.h
index 8587766..87b06ae 100644
--- a/src/print.h
+++ b/src/print.h
@@ -14,13 +14,14 @@ G_BEGIN_DECLS
 #define GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY   "GnumericPrintIgnorePageBreaks"
 
 typedef enum {
-	PRINT_ACTIVE_SHEET,
-	PRINT_ALL_SHEETS,
-	PRINT_ALL_SHEETS_INCLUDING_HIDDEN,
-	PRINT_SHEET_RANGE,
-	PRINT_SHEET_SELECTION,
-	PRINT_IGNORE_PRINTAREA,
-	PRINT_SHEET_SELECTION_IGNORE_PRINTAREA
+	PRINT_SAVED_INFO = -1,
+	PRINT_ACTIVE_SHEET = 0,
+	PRINT_ALL_SHEETS = 1,
+	PRINT_ALL_SHEETS_INCLUDING_HIDDEN = 2,
+	PRINT_SHEET_RANGE = 3,
+	PRINT_SHEET_SELECTION = 4,
+	PRINT_IGNORE_PRINTAREA = 5,
+	PRINT_SHEET_SELECTION_IGNORE_PRINTAREA = 6
 } PrintRange;
 
 void gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 368f1b5..f40ac41 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -298,7 +298,7 @@ static GNM_ACTION_DEF (cb_file_print_area_clear_pagebreaks)
 static GNM_ACTION_DEF (cb_file_print)
 {
 	gnm_print_sheet (WORKBOOK_CONTROL (wbcg),
-		wbcg_cur_sheet (wbcg), FALSE, PRINT_ACTIVE_SHEET, NULL);
+		wbcg_cur_sheet (wbcg), FALSE, PRINT_SAVED_INFO, NULL);
 }
 
 static GNM_ACTION_DEF (cb_file_print_preview)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]