[gnumeric] some code cleanup
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] some code cleanup
- Date: Mon, 21 Nov 2011 17:00:54 +0000 (UTC)
commit be05f08a79ab46e64bba9d970922272bb1dfa124
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon Nov 21 10:00:21 2011 -0700
some code cleanup
2011-11-21 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/print.c (compute_scale_fit_to): remove unsued variables
(compute_pages): remove arguments and chnge all callers
(gnm_begin_print_cb): just write the settings
ChangeLog | 6 ++++++
src/print.c | 49 +++++++++++++++----------------------------------
2 files changed, 21 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2cb82bd..1fc8920 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/print.c (compute_scale_fit_to): remove unsued variables
+ (compute_pages): remove arguments and chnge all callers
+ (gnm_begin_print_cb): just write the settings
+
2011-11-21 Morten Welinder <terra gnome org>
* src/print.c (gnm_print_sheet): Call gnm_end_print_cb in response
diff --git a/src/print.c b/src/print.c
index 8221ef7..122cc3f 100644
--- a/src/print.c
+++ b/src/print.c
@@ -784,7 +784,7 @@ compute_scale_fit_to (Sheet const *sheet,
gboolean repeat, gint repeat_start, gint repeat_end, GnmPageBreaks *pb)
{
double max_p, min_p;
- gint max_pages, min_pages;
+ gint max_pages;
double extent;
extent = get_distance_pts (sheet, start, end + 1);
@@ -826,9 +826,9 @@ compute_scale_fit_to (Sheet const *sheet,
if (min_p > max_percent)
min_p = max_percent;
- min_pages = paginate (NULL, sheet, start, end, usable/min_p - header,
- repeat, repeat_start, repeat_end,
- get_distance_pts, get_info, pb, FALSE);
+ paginate (NULL, sheet, start, end, usable/min_p - header,
+ repeat, repeat_start, repeat_end,
+ get_distance_pts, get_info, pb, FALSE);
/* And then we pick the middle until the percentage is within 0.1% of */
@@ -840,13 +840,10 @@ compute_scale_fit_to (Sheet const *sheet,
repeat, repeat_start, repeat_end,
get_distance_pts, get_info, pb, FALSE);
- if (cur_pages > pages) {
- max_pages = cur_pages;
+ if (cur_pages > pages)
max_p = cur_p;
- } else {
- min_pages = cur_pages;
+ else
min_p = cur_p;
- }
}
return min_p;
@@ -1069,15 +1066,15 @@ compute_sheet_pages (GtkPrintContext *context,
*/
static void
compute_pages (G_GNUC_UNUSED GtkPrintOperation *operation,
- PrintingInstance * pi,
- PrintRange pr,
- guint from,
- guint to)
+ PrintingInstance * pi)
{
Workbook *wb = pi->wb;
guint i;
guint n;
guint ct;
+ PrintRange pr = pi->pr;
+ guint from = pi->from;
+ guint to = pi->to;
switch (pr) {
case PRINT_SAVED_INFO:
@@ -1281,26 +1278,13 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
gpointer user_data)
{
PrintingInstance * pi = (PrintingInstance *) user_data;
- PrintRange pr;
- guint from, to;
- gboolean i_pb;
- GtkPrintSettings * settings;
if (gnm_debug_flag ("print"))
g_printerr ("begin-print\n");
- settings = gtk_print_operation_get_print_settings (operation);
-
- from = gtk_print_settings_get_int_with_default
- (settings, GNUMERIC_PRINT_SETTING_PRINT_FROM_SHEET_KEY, 1);
- to = gtk_print_settings_get_int_with_default
- (settings, GNUMERIC_PRINT_SETTING_PRINT_TO_SHEET_KEY, workbook_sheet_count (pi->wb));
- pr = gtk_print_settings_get_int_with_default
- (settings, GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY, PRINT_ACTIVE_SHEET);
- i_pb = (1 == gtk_print_settings_get_int_with_default
- (settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY, 1));
- if (from != pi->from || to != pi->to || pr != pi->pr) {
- /* g_warning ("Working around gtk+ bug 423484."); */
+ {
+ /* Working around gtk+ bug 423484. */
+ GtkPrintSettings *settings = gtk_print_operation_get_print_settings (operation);
gtk_print_settings_set_int
(settings, GNUMERIC_PRINT_SETTING_PRINT_FROM_SHEET_KEY,
pi->from);
@@ -1311,9 +1295,6 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
(settings, GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY, pi->pr);
gtk_print_settings_set_int
(settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY, pi->ignore_pb ? 1 : 0);
- from = pi->from;
- to = pi->to;
- pr = pi->pr;
}
if (NULL != pi->wbc && IS_WBC_GTK(pi->wbc)) {
@@ -1332,11 +1313,11 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
gtk_widget_show_all (pi->progress);
}
- compute_pages (operation, pi, pr, from, to);
+ compute_pages (operation, pi);
}
static void
-gnm_end_print_cb (GtkPrintOperation *operation,
+gnm_end_print_cb (G_GNUC_UNUSED GtkPrintOperation *operation,
G_GNUC_UNUSED GtkPrintContext *context,
G_GNUC_UNUSED gpointer user_data)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]