/******************************************************************** This file is part of the abs 0.907 distribution. abs is a spreadsheet with graphical user interface. Copyright (C) 1998-2001 André Bertin (Andre.Bertin@ping.be) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version if in the same spirit as version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Concact: abs@pi.be http://home.pi.be/bertin/abs.shtml *********************************************************************/ #include "printdialog.h" #include "inputbox.h" #include "entrypop.h" #include "main.h" #include "button.h" #include "print.h" Widget tofile, center, portrait; Widget sel, wks, wkb; Widget adjust, reduce; Entry_Pop *destpop, *magnifpop, *copiespop, *paperpop, *nbvpages, *nbhpages; Entry_Pop *topmarginpop, *bmarginpop, *lmarginpop, *rmarginpop; static char *printpane[] = { "Print", "Page", "Margin", "Top/Bottom", "Worksheet", }; void X11m_print () { display_prompt (td3, gettop ()); } void doprint () { printparam.print2file = getcheck (tofile); printparam.destination = entrypop_gettext (destpop); if (getcheck (portrait)) printparam.orientation = PORTRAIT; else printparam.orientation = LANDSCAPE; if (getcheck (center)) printparam.center = CENTER; else printparam.center = FLUSH_TOP_LEFT; printparam.what = PSEL; if (getcheck (wks)) printparam.what = PWKS; else if (getcheck (wkb)) printparam.orientation = PWKB; if (getcheck (reduce)) printparam.magnification = entrypop_getvalue (magnifpop); else { printparam.magnification = 0; printparam.nbvpages = entrypop_getvalue (nbvpages); printparam.nbhpages = entrypop_getvalue (nbhpages); } printparam.copies = entrypop_getvalue (copiespop); printparam.papertype = entrypop_gettext (paperpop); printparam.xshift = 0; printparam.yshift = 0; printparam.tm = entrypop_getvalue (topmarginpop); printparam.rm = entrypop_getvalue (rmarginpop); printparam.lm = entrypop_getvalue (lmarginpop); printparam.bm = entrypop_getvalue (bmarginpop); printparam.multiplepage = 0; printparam.filename = NULL; if (printparam.print2file) printparam.filename = inputbox ("File name:", "Print to File", "output.ps"); printfile (printparam); } void initprintdial () { } int make_print_dial () { Widget landscape; Widget flushtl; Widget base; int x, y; td3 = CreateThumbDialog (gettop (), XtNumber (printpane), printpane, doprint, initprintdial); base = get_base (td3); addpanechild (td3, 0, CreateLabel (base, "Destination:", 20, 55, 60, 20)); destpop = newentrypop (base, "printerpop", popdown, 200, 20); w_n = 0; w_rel (NULL, 100, 55); w_set (destpop->baseform); addpanechild (td3, 0, destpop->baseform); entrypop_add_item (destpop, "ghostview preview"); entrypop_add_item (destpop, "postscript format file"); entrypop_add_item (destpop, "xfig preview"); entrypop_add_item (destpop, "fig format file"); entrypop_init_val (destpop, "ghostview preview"); addpanechild (td3, 0, CreateLabel (base, "Output File", 20, 90, 100, 20)); w_n = 0; w_rel (NULL, 120, 90); tofile = (Widget) make_check (base, "to file", NULL, (caddr_t) td3); w_set (tofile); setcheck (tofile, 0); addpanechild (td3, 0, tofile); addpanechild (td3, 0, CreateLabel (base, "Print", 20, 120, 100, 20)); addpanechild (td3, 0, CreateLabel (base, "Selection", 50, 145, 80, 20)); sel = (Widget) make_radio (base, "selection", NULL, NULL, NULL); w_n = 0; w_rel (NULL, 20, 145); XtSetValues (sel, w_args, w_n); addpanechild (td3, 0, sel); addpanechild (td3, 0, CreateLabel (base, "Worksheet", 50, 165, 80, 20)); wks = (Widget) make_radio (base, "worksheet", sel, NULL, NULL); w_n = 0; w_rel (NULL, 20, 165); XtSetValues (wks, w_args, w_n); addpanechild (td3, 0, wks); addpanechild (td3, 0, CreateLabel (base, "Workbook", 50, 185, 80, 20)); wkb = (Widget) make_radio (base, "workbook", sel, NULL, NULL); w_n = 0; w_rel (NULL, 20, 185); XtSetValues (wkb, w_args, w_n); addpanechild (td3, 0, wkb); addpanechild (td3, 0, CreateLabel (base, "Number of copies:", 175, 145, 120, 20)); copiespop = newentrypop (base, "copiespop", roll, 50, 20); entrypop_setrange (copiespop, 1, 1, 1, 32000); w_n = 0; w_rel (NULL, 305, 145); w_set (copiespop->baseform); addpanechild (td3, 0, copiespop->baseform); addpanechild (td3, 1, CreateLabel (base, "Orientation", 20, 35, 80, 20)); addpanechild (td3, 1, CreateLabel (base, "Portrait", 50, 55, 80, 20)); portrait = (Widget) make_radio (base, "portrait", NULL, NULL, NULL); w_n = 0; w_rel (NULL, 30, 55); XtSetValues (portrait, w_args, w_n); addpanechild (td3, 1, portrait); addpanechild (td3, 1, CreateLabel (base, "Landscape", 150, 55, 80, 20)); landscape = (Widget) make_radio (base, "landscape", portrait, NULL, NULL); w_n = 0; w_rel (NULL, 130, 55); XtSetValues (landscape, w_args, w_n); addpanechild (td3, 1, landscape); addpanechild (td3, 1, CreateLabel (base, "Scale", 20, 85, 80, 20)); reduce = (Widget) make_radio (base, "reduce", NULL, NULL, NULL); w_n = 0; w_rel (NULL, 30, 110); XtSetValues (reduce, w_args, w_n); addpanechild (td3, 1, reduce); addpanechild (td3, 1, CreateLabel (base, "Reduce/enlarge to:", 50, 110, 140, 20)); magnifpop = newentrypop (base, "scalepop", roll, 25, 20); entrypop_setrange (magnifpop, 100, 5, 1, 4000); w_n = 0; w_rel (NULL, 185, 110); w_set (magnifpop->baseform); addpanechild (td3, 1, magnifpop->baseform); addpanechild (td3, 1, CreateLabel (base, "% of the normal size", 230, 110, 150, 20)); adjust = (Widget) make_radio (base, "adjust", reduce, NULL, NULL); w_n = 0; w_rel (NULL, 30, 140); XtSetValues (adjust, w_args, w_n); addpanechild (td3, 1, adjust); addpanechild (td3, 1, CreateLabel (base, "Adjust to:", 50, 140, 80, 20)); nbvpages = newentrypop (base, "nbvpages", roll, 18, 20); entrypop_setrange (nbvpages, 1, 1, 1, 100); w_n = 0; w_rel (NULL, 125, 140); w_set (nbvpages->baseform); addpanechild (td3, 1, nbvpages->baseform); addpanechild (td3, 1, CreateLabel (base, "page(s) in width &", 152, 140, 140, 20)); nbhpages = newentrypop (base, "nbhpages", roll, 18, 20); entrypop_setrange (nbhpages, 1, 1, 1, 100); w_n = 0; w_rel (NULL, 285, 140); w_set (nbhpages->baseform); addpanechild (td3, 1, nbhpages->baseform); addpanechild (td3, 1, CreateLabel (base, "in height", 315, 140, 80, 20)); addpanechild (td3, 1, CreateLabel (base, "Paper size:", 20, 180, 80, 20)); paperpop = newentrypop (base, "papersize", popdown, 200, 20); entrypop_add_item (paperpop, "A0 (84.1cm x 118.9cm)"); entrypop_add_item (paperpop, "A1 (59.4cm x 84.1cm)"); entrypop_add_item (paperpop, "A2 (42 cm x 59.4cm)"); entrypop_add_item (paperpop, "A3 (29.7cm x 42 cm)"); entrypop_add_item (paperpop, "A4 (21cm x 29.7cm)"); entrypop_add_item (paperpop, "B5 (18.2cm x 25.7cm)"); entrypop_add_item (paperpop, "Ledger (11\" x 17\")"); entrypop_add_item (paperpop, "Legal (11\" x 14\")"); entrypop_add_item (paperpop, "Letter (8.5\" x 11\")"); entrypop_init_val (paperpop, "A4 (21cm x 29.7cm)"); w_n = 0; w_rel (NULL, 120, 180); w_set (paperpop->baseform); addpanechild (td3, 1, paperpop->baseform); addpanechild (td3, 2, CreateLabel (base, "Position", 20, 35, 80, 20)); addpanechild (td3, 2, CreateLabel (base, "Center on page", 50, 70, 130, 20)); center = (Widget) make_radio (base, "center", NULL, NULL, NULL); w_n = 0; w_rel (NULL, 30, 70); XtSetValues (center, w_args, w_n); addpanechild (td3, 2, center); addpanechild (td3, 2, CreateLabel (base, "Flush top/left", 250, 70, 120, 20)); flushtl = (Widget) make_radio (base, "flush", center, NULL, NULL); w_n = 0; w_rel (NULL, 230, 70); XtSetValues (flushtl, w_args, w_n); addpanechild (td3, 2, flushtl); x = 125; y = 110; addpanechild (td3, 2, CreateLabel (base, "Top:", x, y, 60, 20)); topmarginpop = newentrypop (base, "topmarginpop", roll, 35, 20); entrypop_setrange (topmarginpop, 1.0, .1, 0, 1000); w_n = 0; w_rel (NULL, x + 50, y); w_set (topmarginpop->baseform); addpanechild (td3, 2, topmarginpop->baseform); addpanechild (td3, 2, CreateLabel (base, "cm", x + 100, y, 60, 20)); x = 25; y = 140; addpanechild (td3, 2, CreateLabel (base, "Left:", x, y, 60, 20)); lmarginpop = newentrypop (base, "lmarginpop", roll, 35, 20); entrypop_setrange (lmarginpop, 1.0, .1, 0, 1000); w_n = 0; w_rel (NULL, x + 50, y); w_set (lmarginpop->baseform); addpanechild (td3, 2, lmarginpop->baseform); addpanechild (td3, 2, CreateLabel (base, "cm", x + 100, y, 60, 20)); x = 225; y = 140; addpanechild (td3, 2, CreateLabel (base, "Right:", x, y, 60, 20)); rmarginpop = newentrypop (base, "rmarginpop", roll, 35, 20); entrypop_setrange (rmarginpop, 1.0, .1, 0, 1000); w_n = 0; w_rel (NULL, x + 50, y); w_set (rmarginpop->baseform); addpanechild (td3, 2, rmarginpop->baseform); addpanechild (td3, 2, CreateLabel (base, "cm", x + 100, y, 60, 20)); x = 125; y = 170; addpanechild (td3, 2, CreateLabel (base, "Bottom:", x, y, 60, 20)); bmarginpop = newentrypop (base, "bmarginpop", roll, 35, 20); entrypop_setrange (bmarginpop, 1.0, .1, 0, 1000); w_n = 0; w_rel (NULL, x + 50, y); w_set (bmarginpop->baseform); addpanechild (td3, 2, bmarginpop->baseform); addpanechild (td3, 2, CreateLabel (base, "cm", x + 100, y, 60, 20)); activepane (td3, 0); return 0; }