Commit 26b11c20 authored by Michael Meeks's avatar Michael Meeks

'Fix' embeddable-grid so compiles with recent Bonobos,

rough cut of workbook -> sheet PrintInfo transition YMMV, more soon.
parent 538b0537
1999-09-12 Michael Meeks <michael@nuclecu.unam.mx>
* src/embeddable-grid.c (grid_view_activate): Hack to cope with new
private Bonobo plug, just emit a warning.
(grid_view_new): similarly hacked.
* src/eval.c: Include ranges.h
* src/selection.c (sheet_selection_first_range): Remove unused and
cryptic base_col / base_row.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort): remove base
stuff.
* src/workbook.c (print_setup_cmd, file_print_cmd),
(file_print_preview_cmd): New print stuff.
(deps_output): update to new first_range.
* src/print-preview.c (print_preview_new): More wb->sheet.
(sheet_destroyed): Renamed, (create_preview_canvas, render_page),
(preview_file_print_cmd, create_toplevel): wb->sheet.
include print.h (preview_file_print_cmd): Add active_sheet.
(create_toplevel): Update name calc + add preconditions.
* src/print-preview.h: update prototype + add _context proto.
* src/print.c (print_job_info_get): more wb->sheet.
(printjob_init_sheet): split out. (sheet_print_selection): implement.
* src/sheet.c (sheet_new, sheet_destroy): Add print info bits.
* src/workbook.c (workbook_do_destroy, workbook_init): Clean
print-info bits.
* src/dialogs/dialog-printer-setup.c (dialog_print_info_t):
convert workbook -> sheet (do_print_preview_cb, do_print_cb),
(dialog_print_info_new, dialog_printer_setup): ditto.
(do_setup_main_dialog): preconditions.
* src/dialogs/dialogs.h: Change prototype.
* src/print.c (workbook_print): Implemented PRINT_ACTIVE_SHEETS,
added default_range paramter: use for now; renamed (sheet_print)
(print_sheet): preconditions (sheet_print_selection): renamed.
* src/print.h (workbook_print): Move PrintRange enum here & re-name.
1999-09-11 Miguel de Icaza <miguel@gnu.org>
* src/workbook.c (workbook_delete_event): Fix the delete_event
......
......@@ -15,6 +15,7 @@ Michael:
* Implemented drop filename -> Bonobo component conversion,
* More intelligent workbook sizing.
* Fixed sheet tab focus / editing.
* Per sheet page setup / preview.
Miguel:
* Implemented Print Preview
......
1999-09-12 Michael Meeks <michael@nuclecu.unam.mx>
* src/embeddable-grid.c (grid_view_activate): Hack to cope with new
private Bonobo plug, just emit a warning.
(grid_view_new): similarly hacked.
* src/eval.c: Include ranges.h
* src/selection.c (sheet_selection_first_range): Remove unused and
cryptic base_col / base_row.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sort): remove base
stuff.
* src/workbook.c (print_setup_cmd, file_print_cmd),
(file_print_preview_cmd): New print stuff.
(deps_output): update to new first_range.
* src/print-preview.c (print_preview_new): More wb->sheet.
(sheet_destroyed): Renamed, (create_preview_canvas, render_page),
(preview_file_print_cmd, create_toplevel): wb->sheet.
include print.h (preview_file_print_cmd): Add active_sheet.
(create_toplevel): Update name calc + add preconditions.
* src/print-preview.h: update prototype + add _context proto.
* src/print.c (print_job_info_get): more wb->sheet.
(printjob_init_sheet): split out. (sheet_print_selection): implement.
* src/sheet.c (sheet_new, sheet_destroy): Add print info bits.
* src/workbook.c (workbook_do_destroy, workbook_init): Clean
print-info bits.
* src/dialogs/dialog-printer-setup.c (dialog_print_info_t):
convert workbook -> sheet (do_print_preview_cb, do_print_cb),
(dialog_print_info_new, dialog_printer_setup): ditto.
(do_setup_main_dialog): preconditions.
* src/dialogs/dialogs.h: Change prototype.
* src/print.c (workbook_print): Implemented PRINT_ACTIVE_SHEETS,
added default_range paramter: use for now; renamed (sheet_print)
(print_sheet): preconditions (sheet_print_selection): renamed.
* src/print.h (workbook_print): Move PrintRange enum here & re-name.
1999-09-11 Miguel de Icaza <miguel@gnu.org>
* src/workbook.c (workbook_delete_event): Fix the delete_event
......
......@@ -10,6 +10,7 @@
#include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "utils.h"
#include "ranges.h"
#include "eval.h"
#undef DEBUG_EVALUATION
......
......@@ -301,16 +301,16 @@ static void del_clause(GtkWidget * widget, SORT_FLOW * sf)
void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
{
int lp;
int base_col, base_row, start_col, start_row, end_col, end_row;
int start_col, start_row, end_col, end_row;
SORT_FLOW sort_flow;
g_return_if_fail(inwb);
g_return_if_fail(sheet);
g_return_if_fail(IS_SHEET(sheet));
if (!sheet_selection_first_range(sheet, &base_col, &base_row,
&start_col, &start_row,
&end_col, &end_row)){
if (!sheet_selection_first_range (sheet,
&start_col, &start_row,
&end_col, &end_row)){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
......
......@@ -43,7 +43,7 @@ typedef struct {
} PreviewInfo;
typedef struct {
Workbook *workbook;
Sheet *sheet;
GladeXML *gui;
PrintInformation *pi;
GtkWidget *dialog;
......@@ -710,14 +710,14 @@ static void
do_print_cb (GtkWidget *w, dialog_print_info_t *dpi)
{
fetch_settings (dpi);
workbook_print (dpi->workbook, FALSE);
sheet_print (dpi->sheet, FALSE, PRINT_ACTIVE_SHEET);
}
static void
do_print_preview_cb (GtkWidget *w, dialog_print_info_t *dpi)
{
fetch_settings (dpi);
workbook_print (dpi->workbook, TRUE);
sheet_print (dpi->sheet, TRUE, PRINT_ACTIVE_SHEET);
}
static void
......@@ -725,6 +725,10 @@ do_setup_main_dialog (dialog_print_info_t *dpi)
{
GtkWidget *notebook, *old_parent;
int i;
g_return_if_fail (dpi != NULL);
g_return_if_fail (dpi->sheet != NULL);
g_return_if_fail (dpi->sheet->workbook != NULL);
/*
* Moves the whole thing into a GnomeDialog, needed until
......@@ -735,7 +739,8 @@ do_setup_main_dialog (dialog_print_info_t *dpi)
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gnome_dialog_set_parent (GNOME_DIALOG (dpi->dialog), GTK_WINDOW (dpi->workbook->toplevel));
gnome_dialog_set_parent (GNOME_DIALOG (dpi->dialog),
GTK_WINDOW (dpi->sheet->workbook->toplevel));
gtk_window_set_policy (GTK_WINDOW (dpi->dialog), FALSE, TRUE, TRUE);
notebook = glade_xml_get_widget (dpi->gui, "print-setup-notebook");
......@@ -745,7 +750,7 @@ do_setup_main_dialog (dialog_print_info_t *dpi)
gtk_widget_queue_resize (notebook);
for (i = 1; i < 5; i++){
for (i = 1; i < 5; i++) {
GtkWidget *w;
char *print = g_strdup_printf ("print-%d", i);
char *preview = g_strdup_printf ("preview-%d", i);
......@@ -763,8 +768,7 @@ do_setup_main_dialog (dialog_print_info_t *dpi)
/*
* Hide non-functional buttons for now
*/
for (i = 1; i < 5; i++){
for (i = 1; i < 5; i++) {
char *options = g_strdup_printf ("options-%d", i);
GtkWidget *w;
......@@ -776,7 +780,7 @@ do_setup_main_dialog (dialog_print_info_t *dpi)
}
static dialog_print_info_t *
dialog_print_info_new (Workbook *wb)
dialog_print_info_new (Sheet *sheet)
{
dialog_print_info_t *dpi;
GladeXML *gui;
......@@ -788,9 +792,9 @@ dialog_print_info_new (Workbook *wb)
}
dpi = g_new0 (dialog_print_info_t, 1);
dpi->workbook = wb;
dpi->gui = gui;
dpi->pi = wb->print_info;
dpi->sheet = sheet;
dpi->gui = gui;
dpi->pi = sheet->print_info;
return dpi;
}
......@@ -926,12 +930,12 @@ dialog_print_info_destroy (dialog_print_info_t *dpi)
}
void
dialog_printer_setup (Workbook *wb)
dialog_printer_setup (Sheet *sheet)
{
dialog_print_info_t *dpi;
int v;
dpi = dialog_print_info_new (wb);
dpi = dialog_print_info_new (sheet);
if (!dpi)
return;
......
......@@ -77,21 +77,21 @@ typedef struct {
gboolean labels_flag;
} data_analysis_output_t;
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
void dialog_insert_cells (Workbook *wb, Sheet *sheet);
void dialog_delete_cells (Workbook *wb, Sheet *sheet);
void dialog_zoom (Workbook *wb, Sheet *sheet);
char *dialog_query_load_file (Workbook *wb);
void dialog_about (Workbook *wb);
void dialog_define_names (Workbook *wb);
void dialog_cell_comment (Workbook *wb, Cell *cell);
void dialog_cell_sort (Workbook *wb, Sheet *sheet);
char *dialog_function_wizard (Workbook *wb, FunctionDefinition *fd);
void dialog_goal_seek (Workbook *wb, Sheet *sheet);
void dialog_solver (Workbook *wb, Sheet *sheet);
void dialog_printer_setup (Workbook *wb);
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
void dialog_insert_cells (Workbook *wb, Sheet *sheet);
void dialog_delete_cells (Workbook *wb, Sheet *sheet);
void dialog_zoom (Workbook *wb, Sheet *sheet);
char *dialog_query_load_file (Workbook *wb);
void dialog_about (Workbook *wb);
void dialog_define_names (Workbook *wb);
void dialog_cell_comment (Workbook *wb, Cell *cell);
void dialog_cell_sort (Workbook *wb, Sheet *sheet);
char *dialog_function_wizard (Workbook *wb, FunctionDefinition *fd);
void dialog_goal_seek (Workbook *wb, Sheet *sheet);
void dialog_solver (Workbook *wb, Sheet *sheet);
void dialog_printer_setup (Sheet *sheet);
void dialog_summary_update (GtkWidget *w, SummaryInfo *sin);
FunctionDefinition *dialog_function_select (Workbook *wb);
......
......@@ -304,8 +304,9 @@ static void
grid_view_activate (GridView *grid_view)
{
/* FIXME: Do we need to do any more work here? */
gtk_signal_emit_by_name(GTK_OBJECT(grid_view->view.plug), "set_focus",
grid_view->sheet_view->sheet_view);
g_warning ("FIXME: plug is now private, can't set_focus");
/* gtk_signal_emit_by_name (GTK_OBJECT (grid_view->view.plug), "set_focus",
grid_view->sheet_view->sheet_view);*/
gnome_view_activate_notify(GNOME_VIEW(grid_view), TRUE);
}
......@@ -327,8 +328,10 @@ grid_view_new (EmbeddableGrid *eg)
grid_view->embeddable = eg;
grid_view->sheet_view = sheet_new_sheet_view (eg->sheet);
gtk_widget_show (grid_view->sheet_view);
gnome_view_construct (
GNOME_VIEW (grid_view), corba_grid_view, GTK_WIDGET (grid_view->sheet_view));
g_warning ("FIXME: view_construct API changed");
/* gnome_view_construct (
GNOME_VIEW (grid_view), corba_grid_view,
GTK_WIDGET (grid_view->sheet_view));*/
eg->views = g_list_prepend (eg->views, grid_view);
......
......@@ -10,6 +10,7 @@
#include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "utils.h"
#include "ranges.h"
#include "eval.h"
#undef DEBUG_EVALUATION
......
......@@ -98,7 +98,6 @@ typedef enum {
} HFRenderType;
typedef struct {
Workbook *wb;
Sheet *sheet;
int page;
int pages;
......
......@@ -4,7 +4,7 @@
* Author:
* Miguel de Icaza (miguel@gnu.org)
*
* Given the large memory usage of an entire workbook on
* Given the large memory usage of an entire sheet on
* a canvas, we have now taken a new approach: we keep in
* a GNOME Print Metafile each page. And we render this
* metafile into the printing context on page switch.
......@@ -24,8 +24,9 @@
#include "sheet-object.h"
#include "dialogs.h"
#include "main.h"
#include "print-preview.h"
#include "print.h"
#include "print-info.h"
#include "print-preview.h"
#include "cursors.h"
#include "pixmaps/zoom_in.xpm"
#include "pixmaps/zoom_out.xpm"
......@@ -43,7 +44,7 @@ typedef enum {
struct _PrintPreview {
GnomeApp *toplevel;
Workbook *workbook;
Sheet *sheet;
/*
* printing contexts:
......@@ -76,7 +77,7 @@ struct _PrintPreview {
double base_x, base_y;
/*
* Signal ID for the workbook destroy watcher
* Signal ID for the sheet destroy watcher
*/
guint destroy_id;
};
......@@ -98,7 +99,7 @@ render_page (PrintPreview *pp, int page)
/*
* Create the preview printing context
*/
paper = pp->workbook->print_info->paper;
paper = pp->sheet->print_info->paper;
paper_name = gnome_paper_name (paper);
pp->preview = gnome_print_preview_new (pp->canvas, paper_name);
......@@ -247,7 +248,7 @@ create_preview_canvas (PrintPreview *pp)
/*
* Create the preview printing context
*/
paper = pp->workbook->print_info->paper;
paper = pp->sheet->print_info->paper;
paper_name = gnome_paper_name (paper);
pp->preview = gnome_print_preview_new (pp->canvas, paper_name);
......@@ -308,7 +309,7 @@ create_preview_canvas (PrintPreview *pp)
static void
preview_destroyed (void *unused, PrintPreview *pp)
{
gtk_signal_disconnect (GTK_OBJECT (pp->workbook), pp->destroy_id);
gtk_signal_disconnect (GTK_OBJECT (pp->sheet), pp->destroy_id);
gtk_object_unref (GTK_OBJECT (pp->preview));
gtk_object_unref (GTK_OBJECT (pp->metafile));
g_free (pp->toolbar);
......@@ -324,7 +325,7 @@ preview_close_cmd (void *unused, PrintPreview *pp)
static void
preview_file_print_cmd (void *unused, PrintPreview *pp)
{
workbook_print (pp->workbook, FALSE);
sheet_print (pp->sheet, FALSE, PRINT_ACTIVE_SHEET);
}
static void
......@@ -459,26 +460,32 @@ static void
create_toplevel (PrintPreview *pp)
{
GtkWidget *toplevel;
char *name;
char *name, *txta, *txtb;
gint width, height;
const GnomePaper *paper;
name = g_strdup_printf (_("Preview for %s"),
pp->workbook->filename ?
pp->workbook->filename :
_("the workbook"));
g_return_if_fail (pp != NULL);
g_return_if_fail (pp->sheet != NULL);
g_return_if_fail (pp->sheet->workbook != NULL);
g_return_if_fail (pp->sheet->print_info != NULL);
txta = pp->sheet->name;
txtb = pp->sheet->workbook->filename;
name = g_strdup_printf (_("Preview for %s in %s"),
txta ? txta : _("the sheet"),
txtb ? txtb : _("the workbook"));
toplevel = gnome_app_new ("Gnumeric", name);
g_free (name);
paper = pp->workbook->print_info->paper;
width = gnome_paper_pswidth (paper) + PAGE_PAD * 3;
paper = pp->sheet->print_info->paper;
width = gnome_paper_pswidth (paper) + PAGE_PAD * 3;
height = gnome_paper_psheight (paper) + PAGE_PAD * 3;
if (width > gdk_screen_width ()-40)
width = gdk_screen_width ()-40;
if (width > gdk_screen_width () - 40)
width = gdk_screen_width () - 40;
if (height > gdk_screen_height ()-100)
height = gdk_screen_height ()-100;
if (height > gdk_screen_height () - 100)
height = gdk_screen_height () - 100;
gtk_widget_set_usize (toplevel, width, height);
gtk_window_set_policy (GTK_WINDOW (toplevel), TRUE, TRUE, FALSE);
......@@ -512,36 +519,36 @@ print_preview_context (PrintPreview *pp)
}
static void
workbook_destroyed (void *unused, PrintPreview *pp)
sheet_destroyed (void *unused, PrintPreview *pp)
{
gtk_object_destroy (GTK_OBJECT (pp->toplevel));
}
PrintPreview *
print_preview_new (Workbook *wb)
print_preview_new (Sheet *sheet)
{
PrintPreview *pp;
g_return_val_if_fail (wb != NULL, NULL);
g_return_val_if_fail (IS_WORKBOOK (wb), NULL);
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (IS_SHEET (sheet), NULL);
pp = g_new0 (PrintPreview, 1);
pp->workbook = wb;
pp->sheet = sheet;
create_toplevel (pp);
create_preview_canvas (pp);
pp->destroy_id = gtk_signal_connect (
GTK_OBJECT (pp->workbook), "destroy",
GTK_SIGNAL_FUNC (workbook_destroyed), pp);
GTK_OBJECT (pp->sheet), "destroy",
GTK_SIGNAL_FUNC (sheet_destroyed), pp);
{
static int warning_shown;
if (!warning_shown){
if (!warning_shown) {
gnumeric_notice (
wb,
sheet->workbook,
GNOME_MESSAGE_BOX_WARNING,
_("The Print Preview feature is being developed.\n"
"The results of the preview is not correct currently,\n"
......
......@@ -3,8 +3,9 @@
typedef struct _PrintPreview PrintPreview;
PrintPreview *print_preview_new (Workbook *wb);
PrintPreview *print_preview_new (Sheet *sheet);
GnomePrintContext *print_preview_get_print_context (PrintPreview *preview);
void print_preview_print_done (PrintPreview *pp);
GnomePrintContext *print_preview_context (PrintPreview *pp);
#endif /* GNUMERIC_PRINT_PREVIEW_H */
......@@ -4,7 +4,7 @@
* Author:
* Miguel de Icaza (miguel@gnu.org)
*
* Handles printing of Workbooks.
* Handles printing of Sheets.
*
*/
#include <config.h>
......@@ -19,6 +19,7 @@
#include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "sheet-object.h"
#include "selection.h"
#include "dialogs.h"
#include "main.h"
#include "file.h"
......@@ -31,12 +32,6 @@
#define MARGIN_X 1
#define MARGIN_Y 1
typedef enum {
PRINT_ALL,
PRINT_SELECTION,
PRINT_ACTIVE_SHEETS
} PrintRange;
typedef struct {
/*
* Part 1: The information the user configures on the Print Dialog
......@@ -62,7 +57,7 @@ typedef struct {
/*
* Part 3: Handy pointers
*/
Workbook *wb;
Sheet *sheet;
PrintInformation *pi;
GnomePrintContext *print_context;
......@@ -425,12 +420,6 @@ print_sheet_range (Sheet *sheet, int start_col, int start_row, int end_col, int
g_list_free (rows);
}
static void
workbook_print_selection (Workbook *wb, PrintJobInfo *pj)
{
}
static double
print_range_used_units (Sheet *sheet, gboolean compute_rows, PrintRepeatRange *range)
{
......@@ -447,16 +436,13 @@ print_range_used_units (Sheet *sheet, gboolean compute_rows, PrintRepeatRange *r
}
static void
print_sheet (gpointer key, gpointer value, gpointer user_data)
print_job_info_init_sheet (Sheet *sheet, PrintJobInfo *pj)
{
PrintJobInfo *pj = user_data;
Sheet *sheet = value;
/*
* This should be set in print_job_info_get, but we need
* to get access to one of the sheets
*/
if (pj->pi->print_titles){
if (pj->pi->print_titles) {
pj->titles_used_x = sheet->default_col_style.units;
pj->titles_used_y = sheet->default_row_style.units;
} else {
......@@ -470,21 +456,52 @@ print_sheet (gpointer key, gpointer value, gpointer user_data)
sheet, FALSE, &pj->pi->repeat_left);
pj->render_info->sheet = sheet;
}
static void
print_sheet (gpointer key, gpointer value, gpointer user_data)
{
PrintJobInfo *pj = user_data;
Sheet *sheet = value;
g_return_if_fail (pj != NULL);
g_return_if_fail (sheet != NULL);
print_job_info_init_sheet (sheet, pj);
print_sheet_range (sheet, 0, 0, sheet->max_col_used+1, sheet->max_row_used+1, pj);
}
static void
sheet_print_selection (Sheet *sheet, PrintJobInfo *pj)
{
int tlx, tly, brx, bry;
if (!sheet_selection_first_range (sheet, &tlx, &tly, &brx, &bry)) {
gnumeric_notice (
sheet->workbook, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
}
print_job_info_init_sheet (sheet, pj);
print_sheet_range (sheet, tlx, tly,
brx + 1, bry + 1, pj);
}
static void
workbook_print_all (Workbook *wb, PrintJobInfo *pj)
{
g_return_if_fail (wb != NULL);
g_hash_table_foreach (wb->sheets, print_sheet, pj);
}
static PrintJobInfo *
print_job_info_get (Workbook *wb)
print_job_info_get (Sheet *sheet)
{
PrintJobInfo *pj;
PrintMargins *pm = &wb->print_info->margins;
PrintMargins *pm = &sheet->print_info->margins;
int width, height;
pj = g_new0 (PrintJobInfo, 1);
......@@ -492,23 +509,23 @@ print_job_info_get (Workbook *wb)
/*
* Handy pointers
*/
pj->wb = wb;
pj->pi = wb->print_info;
pj->sheet = sheet;
pj->pi = sheet->print_info;
/*
* Values that should be entered in a dialog box
*/
pj->start_page = 0;
pj->end_page = -1;
pj->range = PRINT_ALL;
pj->range = PRINT_ALL_SHEETS;
pj->sorted_print = TRUE;
pj->n_copies = 1;
/* Precompute information */
width = gnome_paper_pswidth (pj->pi->paper);
width = gnome_paper_pswidth (pj->pi->paper);
height = gnome_paper_psheight (pj->pi->paper);
if (pj->pi->orientation == PRINT_ORIENT_HORIZONTAL){
if (pj->pi->orientation == PRINT_ORIENT_HORIZONTAL) {
pj->width = height;
pj->height = width;
} else {
......@@ -524,7 +541,7 @@ print_job_info_get (Workbook *wb)
* Setup render info
*/
pj->render_info = hf_render_info_new ();
pj->render_info->wb = wb;
pj->render_info->sheet = sheet;
pj->decoration_font = gnome_font_new ("Helvetica", 12);
......@@ -556,36 +573,36 @@ setup_rotation (PrintJobInfo *pj)
}
void
workbook_print (Workbook *wb, gboolean preview)
sheet_print (Sheet *sheet, gboolean preview,
PrintRange default_range)
{
GnomePrinter *printer = NULL;
PrintJobInfo *pj;
Sheet *sheet;
int loop, i;
g_return_if_fail (wb != NULL);
g_return_if_fail (sheet != NULL);
sheet = workbook_get_current_sheet (wb);
if (!preview){
if (!preview) {
/* FIXME: we need to whack a selection/active/entire
choice in here, with a default, for now force default */
printer = gnome_printer_dialog_new_modal ();
if (!printer)
return;
}
pj = print_job_info_get (wb);
pj = print_job_info_get (sheet);
pj->range = default_range; /* for now */
if (pj->sorted_print){
if (pj->sorted_print) {
loop = pj->n_copies;
pj->n_copies = 1;
} else {
} else
loop = 1;
}
if (preview){
if (preview) {
pj->n_copies = 1;
loop = 1;
pj->preview = print_preview_new (wb);
pj->preview = print_preview_new (sheet);
pj->print_context = print_preview_context (pj->preview);
} else {
pj->preview = NULL;
......@@ -593,21 +610,26 @@ workbook_print (Workbook *wb, gboolean preview)
printer, gnome_paper_name (pj->pi->paper));
}
if (pj->pi->orientation == PRINT_ORIENT_HORIZONTAL){
if (pj->pi->orientation == PRINT_ORIENT_HORIZONTAL)
setup_rotation (pj);
}
for (i = 0; i < loop; i++){
switch (pj->range){
case PRINT_SELECTION:
workbook_print_selection (wb, pj);
for (i = 0; i < loop; i++) {
switch (pj->range) {
case PRINT_ACTIVE_SHEET:
print_sheet (NULL, sheet, pj);
break;
case PRINT_ALL:
workbook_print_all (wb, pj);
case PRINT_ALL_SHEETS:
workbook_print_all (sheet->workbook, pj);
break;
case PRINT_SHEET_SELECTION:
sheet_print_selection (sheet, pj);
break;
case PRINT_ACTIVE_SHEETS:
default:
g_error ("mis-enumerated print type");
break;
}
}
......@@ -624,4 +646,3 @@ workbook_print (Workbook *wb, gboolean preview)
print_job_info_destroy (pj);
}
#ifndef GNUMERIC_PRINT_H
#define GNUMERIC_PRINT_H
void workbook_print (Workbook *wb, gboolean preview);