page-sizer.cpp revision 200dc6f1e980354866c2ed5fc9ce277475fe37a0
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/** \file
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Paper-size widget and helper functions
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Authors:
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * bulia byak <buliabyak@users.sf.net>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Lauris Kaplinski <lauris@kaplinski.com>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Jon Phillips <jon@rejon.org>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Copyright (C) 2000 - 2005 Authors
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Released under GNU GPL. Read the file 'COPYING' for more information
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#ifdef HAVE_CONFIG_H
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# include <config.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#endif
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <cmath>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <gtkmm.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc//#include <gtkmm/optionmenu.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc//#include <gtkmm/frame.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc//#include <gtkmm/table.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "ui/widget/button.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "ui/widget/scalar-unit.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "helper/units.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "inkscape.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "verbs.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "desktop-handles.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "document.h"
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan#include "desktop.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "page-sizer.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include "helper/action.h"
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcusing std::pair;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcnamespace Inkscape {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcnamespace UI {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcnamespace Widget {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /** \note
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * The ISO page sizes in the table below differ from ghostscript's idea of page sizes (by
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * less than 1pt). Being off by <1pt should be OK for most purposes, but may cause fuzziness
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * (antialiasing) problems when printing to 72dpi or 144dpi printers or bitmap files due to
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * postscript's different coordinate system (y=0 meaning bottom of page in postscript and top
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * of page in SVG). I haven't looked into whether this does in fact cause fuzziness, I merely
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * note the possibility. Rounding done by extension/internal/ps.cpp (e.g. floor/ceil calls)
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * will also affect whether fuzziness occurs.
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan *
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * The remainder of this comment discusses the origin of the numbers used for ISO page sizes in
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * this table and in ghostscript.
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan *
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * The versions here, in mm, are the official sizes according to
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * <a href="http://en.wikipedia.org/wiki/Paper_sizes">http://en.wikipedia.org/wiki/Paper_sizes</a>
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * at 2005-01-25. (The ISO entries in the below table
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * were produced mechanically from the table on that page.)
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan *
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * (The rule seems to be that A0, B0, ..., D0. sizes are rounded to the nearest number of mm
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * from the "theoretical size" (i.e. 1000 * sqrt(2) or pow(2.0, .25) or the like), whereas
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * going from e.g. A0 to A1 always take the floor of halving -- which by chance coincides
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * exactly with flooring the "theoretical size" for n != 0 instead of the rounding to nearest
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * done for n==0.)
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan *
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * Ghostscript paper sizes are given in gs_statd.ps according to gs(1). gs_statd.ps always
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * uses an integer number of pt: sometimes gs_statd.ps rounds to nearest (e.g. a1), sometimes
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * floors (e.g. a10), sometimes ceils (e.g. a8).
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan *
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * I'm not sure how ghostscript's gs_statd.ps was calculated: it isn't just rounding the
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * "theoretical size" of each page to pt (see a0), nor is it rounding the a0 size times an
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * appropriate power of two (see a1). Possibly it was prepared manually, with a human applying
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * inconsistent rounding rules when converting from mm to pt.
127ac1c2b792d87fda08d45d8b25e5ffe9293b3efei feng - Sun Microsystems - Beijing China */
127ac1c2b792d87fda08d45d8b25e5ffe9293b3efei feng - Sun Microsystems - Beijing China /** \todo
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan * Should we include the JIS B series (used in Japan)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * (JIS B0 is sometimes called JB0, and similarly for JB1 etc)?
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Should we exclude B7--B10 and A7--10 to make the list smaller ?
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Should we include any of the ISO C, D and E series (see below) ?
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcstruct PaperSizeRec {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc char const * const name;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double const smaller;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double const larger;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPUnitId const unit;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc};
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcstatic PaperSizeRec const inkscape_papers[] = {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A4", 210, 297, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "US Letter", 8.5, 11, SP_UNIT_IN },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "US Legal", 8.5, 14, SP_UNIT_IN },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "US Executive", 7.25, 10.5, SP_UNIT_IN },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A0", 841, 1189, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A1", 594, 841, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A2", 420, 594, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A3", 297, 420, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A5", 148, 210, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A6", 105, 148, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A7", 74, 105, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A8", 52, 74, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A9", 37, 52, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "A10", 26, 37, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B0", 1000, 1414, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B1", 707, 1000, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B2", 500, 707, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B3", 353, 500, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B4", 250, 353, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B5", 176, 250, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B6", 125, 176, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B7", 88, 125, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B8", 62, 88, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B9", 44, 62, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "B10", 31, 44, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#if 0 /* Whether to include or exclude these depends on how big we mind our page size menu
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc becoming. C series is used for envelopes; don't know what D and E series are used for. */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C0", 917, 1297, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C1", 648, 917, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C2", 458, 648, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C3", 324, 458, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C4", 229, 324, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C5", 162, 229, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C6", 114, 162, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C7", 81, 114, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C8", 57, 81, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C9", 40, 57, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "C10", 28, 40, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D1", 545, 771, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D2", 385, 545, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D3", 272, 385, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D4", 192, 272, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D5", 136, 192, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D6", 96, 136, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "D7", 68, 96, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "E3", 400, 560, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "E4", 280, 400, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "E5", 200, 280, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "E6", 140, 200, SP_UNIT_MM },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#endif
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "CSE", 462, 649, SP_UNIT_PT },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "US #10 Envelope", 4.125, 9.5, SP_UNIT_IN }, // TODO: Select landscape by default.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc /* See http://www.hbp.com/content/PCR_envelopes.cfm for a much larger list of US envelope
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sizes. */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "DL Envelope", 110, 220, SP_UNIT_MM }, // TODO: Select landscape by default.
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan { "Ledger/Tabloid", 11, 17, SP_UNIT_IN },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc /* Note that `Folio' (used in QPrinter/KPrinter) is deliberately absent from this list, as it
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc means different sizes to different people: different people may expect the width to be
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan either 8, 8.25 or 8.5 inches, and the height to be either 13 or 13.5 inches, even
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc restricting our interpretation to foolscap folio. If you wish to introduce a folio-like
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc page size to the list, then please consider using a name more specific than just `Folio' or
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc `Foolscap Folio'. */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "Banner 468x60", 60, 468, SP_UNIT_PX }, // TODO: Select landscape by default.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "Icon 16x16", 16, 16, SP_UNIT_PX },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { "Icon 32x32", 32, 32, SP_UNIT_PX },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc { NULL, 0, 0, SP_UNIT_PX },
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc};
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc//===================================================
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcstatic const SPUnit _px_unit = sp_unit_get_by_id (SP_UNIT_PX);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/*
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcclass SizeMenuItem : public Gtk::MenuItem {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcpublic:
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SizeMenuItem (PaperSizeRec const * paper, PageSizer * widget)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc : Gtk::MenuItem (paper ? paper->name : _("Custom")),
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paper(paper),
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _parent(widget)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc {}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcprotected:
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc PaperSizeRec const * _paper;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc PageSizer *_parent;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc void on_activate();
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan};
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini VaradhanSizeMenuItem::on_activate()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (_parent == 0) // handle Custom entry
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double w = _paper->smaller, h = _paper->larger;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPUnit const &src_unit = sp_unit_get_by_id (_paper->unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_convert_distance (&w, &src_unit, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_convert_distance (&h, &src_unit, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (_parent->_landscape)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _parent->setDim (h, w);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc else
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _parent->setDim (w, h);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc*/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc//---------------------------------------------------
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::PageSizer()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc: Gtk::VBox(false,4)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::HBox *hbox_size = manage (new Gtk::HBox (false, 4));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc pack_start (*hbox_size, false, false, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::Label *label_size = manage (new Gtk::Label (_("P_age size:"), 1.0, 0.5));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc label_size->set_use_underline();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc hbox_size->pack_start (*label_size, false, false, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc label_size->set_mnemonic_widget (_paperSizeList);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc hbox_size->pack_start (_paperSizeList, true, true, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc //# Set up the Paper Size combo box
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc for (PaperSizeRec const *p = inkscape_papers; p->name; p++)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Glib::ustring name = p->name;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc PaperSize paper(name, p->smaller, p->larger, p->unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc paperSizeTable[name] = paper;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paperSizeList.append_text(name);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::~PageSizer()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paper_size_list_connection.disconnect();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portrait_connection.disconnect();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscape_connection.disconnect();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedw_connection.disconnect();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedh_connection.disconnect();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::init (Registry& reg)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::HBox *hbox_ori = manage (new Gtk::HBox);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc pack_start (*hbox_ori, false, false, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::Label *label_ori = manage (new Gtk::Label (_("Page orientation:"), 0.0, 0.5));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc hbox_ori->pack_start (*label_ori, false, false, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscapeButton.set_label(_("_Landscape"));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscapeButton.set_active(true);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::RadioButton::Group group = _landscapeButton.get_group();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc hbox_ori->pack_end (_landscapeButton, false, false, 5);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portraitButton.set_label(_("_Portrait"));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portraitButton.set_active(true);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc hbox_ori->pack_end (_portraitButton, false, false, 5);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portraitButton.set_group (group);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portraitButton.set_active (true);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc /* Custom paper frame */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::Frame *frame = manage (new Gtk::Frame(_("Custom size")));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc pack_start (*frame, false, false, 0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::Table *table = manage (new Gtk::Table (5, 2, false));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->set_border_width (4);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->set_row_spacings (4);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->set_col_spacings (4);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Inkscape::UI::Widget::Button* fit_canv =
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc manage(new Inkscape::UI::Widget::Button(_("_Fit page to selection"),
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _("Resize the page to fit the current selection, or the entire drawing if there is no selection")));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc // prevent fit_canv from expanding
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Gtk::Alignment *fit_canv_cont = manage(new Gtk::Alignment(1.0,0.5,0.0,0.0));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc fit_canv_cont->add(*fit_canv);
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan frame->add (*table);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _wr = &reg;
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan _rum.init (_("U_nits:"), "units", *_wr);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _rusw.init (_("_Width:"), _("Width of paper"), "width", _rum, *_wr);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _rush.init (_("_Height:"), _("Height of paper"), "height", _rum, *_wr);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->attach (*_rum._label, 0,1,0,1, Gtk::FILL|Gtk::EXPAND,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (Gtk::AttachOptions)0,0,0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->attach (*_rum._sel, 1,2,0,1, Gtk::FILL|Gtk::EXPAND,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (Gtk::AttachOptions)0,0,0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->attach (*_rusw.getSU(), 0,2,1,2, Gtk::FILL|Gtk::EXPAND,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (Gtk::AttachOptions)0,0,0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->attach (*_rush.getSU(), 0,2,2,3, Gtk::FILL|Gtk::EXPAND,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (Gtk::AttachOptions)0,0,0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc table->attach (*fit_canv_cont, 0,2,3,4, Gtk::FILL|Gtk::EXPAND,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (Gtk::AttachOptions)0,0,0);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paper_size_list_connection = _paperSizeList.signal_changed().connect (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun (*this, &PageSizer::on_paper_size_list_changed));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscape_connection = _landscapeButton.signal_toggled().connect (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun (*this, &PageSizer::on_landscape));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portrait_connection = _portraitButton.signal_toggled().connect (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun (*this, &PageSizer::on_portrait));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedw_connection = _rusw.getSU()->signal_value_changed().connect (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun (*this, &PageSizer::on_value_changed));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedh_connection = _rush.getSU()->signal_value_changed().connect (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun (*this, &PageSizer::on_value_changed));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc fit_canv->signal_clicked().connect(
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sigc::mem_fun(*this, &PageSizer::fire_fit_canvas_to_selection_or_drawing));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc show_all_children();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Set document dimensions (if not called by Doc prop's update()) and
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * set the PageSizer's widgets and text entries accordingly. This is
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * somewhat slow, is there something done too often invisibly?
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * \param w, h given in px
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::setDim (double w, double h, bool changeList)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan static bool _called = false;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (_called)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _called = true;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paper_size_list_connection.block();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscape_connection.block();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portrait_connection.block();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedw_connection.block();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedh_connection.block();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (SP_ACTIVE_DESKTOP && !_wr->isUpdating()) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_document_set_width (doc, w, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_document_set_height (doc, h, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_document_done (doc, SP_VERB_NONE,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc /* TODO: annotate */ "page-sizer.cpp:301");
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscape = w>h;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _landscapeButton.set_active(_landscape ? true : false);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portraitButton.set_active (_landscape ? false : true);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (changeList)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paperSizeList.set_active (find_paper_size (w, h));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Unit const& unit = _rum._sel->getUnit();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _rusw.setValue (w / unit.factor);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _rush.setValue (h / unit.factor);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _paper_size_list_connection.unblock();
3a1a8936dac0ebe7e956fa122b0b0d15e62d4108zf _landscape_connection.unblock();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _portrait_connection.unblock();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedw_connection.unblock();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _changedh_connection.unblock();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _called = false;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * Returns an index into inkscape_papers of a paper of the specified
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc * size (specified in px), or -1 if there's no such paper.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc */
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcint
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::find_paper_size (double w, double h) const
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double smaller = w;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double larger = h;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if ( h < w ) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc smaller = h; larger = w;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc g_return_val_if_fail(smaller <= larger, -1);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc int index = 0;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc std::map<Glib::ustring, PaperSize>::const_iterator iter;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc for (iter = paperSizeTable.begin() ; iter != paperSizeTable.end() ; iter++) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc PaperSize paper = iter->second;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPUnit const &i_unit = sp_unit_get_by_id(paper.unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double smallX = sp_units_get_pixels(paper.smaller, i_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double largeX = sp_units_get_pixels(paper.larger, i_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc g_return_val_if_fail(smallX <= largeX, -1);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if ((std::abs(smaller - smallX) <= 0.1) &&
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc (std::abs(larger - largeX) <= 0.1) )
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return index;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc index++;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return -1;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::fire_fit_canvas_to_selection_or_drawing() {
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan SPDesktop *dt = SP_ACTIVE_DESKTOP;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (!dt) return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING );
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan if (verb) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPAction *action = verb->get_action(dt);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (action) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_action_perform(action, NULL);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::on_paper_size_list_changed()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Glib::ustring name = _paperSizeList.get_active_text();
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc std::map<Glib::ustring, PaperSize>::const_iterator iter =
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc paperSizeTable.find(name);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (iter == paperSizeTable.end()) {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc g_warning("paper size '%s' not found in table", name.c_str());
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc }
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc PaperSize paper = iter->second;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double w = paper.smaller;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double h = paper.larger;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc SPUnit const &src_unit = sp_unit_get_by_id (paper.unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_convert_distance (&w, &src_unit, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc sp_convert_distance (&h, &src_unit, &_px_unit);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (_landscape)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc setDim (h, w, false);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc else
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc setDim (w, h, false);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhanvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::on_portrait()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan if (!_portraitButton.get_active())
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double w = _rusw.getSU()->getValue ("px");
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double h = _rush.getSU()->getValue ("px");
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (h<w)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc setDim (h, w);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::on_landscape()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (!_landscapeButton.get_active())
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double w = _rusw.getSU()->getValue ("px");
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc double h = _rush.getSU()->getValue ("px");
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (w<h)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc setDim (h, w);
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcvoid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcPageSizer::on_value_changed()
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc{
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc if (_wr->isUpdating()) return;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc setDim (_rusw.getSU()->getValue("px"),
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc _rush.getSU()->getValue("px"));
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc}
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} // namespace Widget
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} // namespace UI
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} // namespace Inkscape
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/*
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Local Variables:
19d332fefbc61327bb6187d0eb818629f3b52c6ffei feng - Sun Microsystems - Beijing China mode:c++
19d332fefbc61327bb6187d0eb818629f3b52c6ffei feng - Sun Microsystems - Beijing China c-file-style:"stroustrup"
19d332fefbc61327bb6187d0eb818629f3b52c6ffei feng - Sun Microsystems - Beijing China c-file-offsets:((innamespace . 0)(inline-open . 0))
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan indent-tabs-mode:nil
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc fill-column:99
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc End:
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc*/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc