From bd77ef25e9161acb007323f851ba77e106036939 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 1 Jul 2013 23:40:52 -0400 Subject: Ported "ui/widget/page-sizer.cpp" and "document.cpp" to "Util::Unit" class. (bzr r12380.1.4) --- src/ui/widget/page-sizer.cpp | 159 +++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 81 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index fa3f8e3a1..cceb3f600 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -36,7 +36,7 @@ #include "document.h" #include "desktop.h" #include "helper/action.h" -#include "helper/units.h" +#include "util/units.h" #include "inkscape.h" #include "sp-namedview.h" #include "sp-root.h" @@ -46,6 +46,8 @@ #include "xml/node.h" #include "xml/repr.h" +static Inkscape::Util::UnitTable unit_table; + using std::pair; namespace Inkscape { @@ -95,7 +97,7 @@ struct PaperSizeRec { char const * const name; //name double const smaller; //lesser dimension double const larger; //greater dimension - SPUnitId const unit; //units + Inkscape::Util::Unit const unit; //units }; // list of page formats that should be in landscape automatically @@ -113,31 +115,31 @@ fill_landscape_papers() { } static PaperSizeRec const inkscape_papers[] = { - { "A4", 210, 297, SP_UNIT_MM }, - { "US Letter", 8.5, 11, SP_UNIT_IN }, - { "US Legal", 8.5, 14, SP_UNIT_IN }, - { "US Executive", 7.25, 10.5, SP_UNIT_IN }, - { "A0", 841, 1189, SP_UNIT_MM }, - { "A1", 594, 841, SP_UNIT_MM }, - { "A2", 420, 594, SP_UNIT_MM }, - { "A3", 297, 420, SP_UNIT_MM }, - { "A5", 148, 210, SP_UNIT_MM }, - { "A6", 105, 148, SP_UNIT_MM }, - { "A7", 74, 105, SP_UNIT_MM }, - { "A8", 52, 74, SP_UNIT_MM }, - { "A9", 37, 52, SP_UNIT_MM }, - { "A10", 26, 37, SP_UNIT_MM }, - { "B0", 1000, 1414, SP_UNIT_MM }, - { "B1", 707, 1000, SP_UNIT_MM }, - { "B2", 500, 707, SP_UNIT_MM }, - { "B3", 353, 500, SP_UNIT_MM }, - { "B4", 250, 353, SP_UNIT_MM }, - { "B5", 176, 250, SP_UNIT_MM }, - { "B6", 125, 176, SP_UNIT_MM }, - { "B7", 88, 125, SP_UNIT_MM }, - { "B8", 62, 88, SP_UNIT_MM }, - { "B9", 44, 62, SP_UNIT_MM }, - { "B10", 31, 44, SP_UNIT_MM }, + { "A4", 210, 297, unit_table.getUnit("mm") }, + { "US Letter", 8.5, 11, unit_table.getUnit("in") }, + { "US Legal", 8.5, 14, unit_table.getUnit("in") }, + { "US Executive", 7.25, 10.5, unit_table.getUnit("in") }, + { "A0", 841, 1189, unit_table.getUnit("mm") }, + { "A1", 594, 841, unit_table.getUnit("mm") }, + { "A2", 420, 594, unit_table.getUnit("mm") }, + { "A3", 297, 420, unit_table.getUnit("mm") }, + { "A5", 148, 210, unit_table.getUnit("mm") }, + { "A6", 105, 148, unit_table.getUnit("mm") }, + { "A7", 74, 105, unit_table.getUnit("mm") }, + { "A8", 52, 74, unit_table.getUnit("mm") }, + { "A9", 37, 52, unit_table.getUnit("mm") }, + { "A10", 26, 37, unit_table.getUnit("mm") }, + { "B0", 1000, 1414, unit_table.getUnit("mm") }, + { "B1", 707, 1000, unit_table.getUnit("mm") }, + { "B2", 500, 707, unit_table.getUnit("mm") }, + { "B3", 353, 500, unit_table.getUnit("mm") }, + { "B4", 250, 353, unit_table.getUnit("mm") }, + { "B5", 176, 250, unit_table.getUnit("mm") }, + { "B6", 125, 176, unit_table.getUnit("mm") }, + { "B7", 88, 125, unit_table.getUnit("mm") }, + { "B8", 62, 88, unit_table.getUnit("mm") }, + { "B9", 44, 62, unit_table.getUnit("mm") }, + { "B10", 31, 44, unit_table.getUnit("mm") }, @@ -149,63 +151,63 @@ static PaperSizeRec const inkscape_papers[] = { don't know what D and E series are used for. */ - { "C0", 917, 1297, SP_UNIT_MM }, - { "C1", 648, 917, SP_UNIT_MM }, - { "C2", 458, 648, SP_UNIT_MM }, - { "C3", 324, 458, SP_UNIT_MM }, - { "C4", 229, 324, SP_UNIT_MM }, - { "C5", 162, 229, SP_UNIT_MM }, - { "C6", 114, 162, SP_UNIT_MM }, - { "C7", 81, 114, SP_UNIT_MM }, - { "C8", 57, 81, SP_UNIT_MM }, - { "C9", 40, 57, SP_UNIT_MM }, - { "C10", 28, 40, SP_UNIT_MM }, - { "D1", 545, 771, SP_UNIT_MM }, - { "D2", 385, 545, SP_UNIT_MM }, - { "D3", 272, 385, SP_UNIT_MM }, - { "D4", 192, 272, SP_UNIT_MM }, - { "D5", 136, 192, SP_UNIT_MM }, - { "D6", 96, 136, SP_UNIT_MM }, - { "D7", 68, 96, SP_UNIT_MM }, - { "E3", 400, 560, SP_UNIT_MM }, - { "E4", 280, 400, SP_UNIT_MM }, - { "E5", 200, 280, SP_UNIT_MM }, - { "E6", 140, 200, SP_UNIT_MM }, + { "C0", 917, 1297, unit_table.getUnit("mm") }, + { "C1", 648, 917, unit_table.getUnit("mm") }, + { "C2", 458, 648, unit_table.getUnit("mm") }, + { "C3", 324, 458, unit_table.getUnit("mm") }, + { "C4", 229, 324, unit_table.getUnit("mm") }, + { "C5", 162, 229, unit_table.getUnit("mm") }, + { "C6", 114, 162, unit_table.getUnit("mm") }, + { "C7", 81, 114, unit_table.getUnit("mm") }, + { "C8", 57, 81, unit_table.getUnit("mm") }, + { "C9", 40, 57, unit_table.getUnit("mm") }, + { "C10", 28, 40, unit_table.getUnit("mm") }, + { "D1", 545, 771, unit_table.getUnit("mm") }, + { "D2", 385, 545, unit_table.getUnit("mm") }, + { "D3", 272, 385, unit_table.getUnit("mm") }, + { "D4", 192, 272, unit_table.getUnit("mm") }, + { "D5", 136, 192, unit_table.getUnit("mm") }, + { "D6", 96, 136, unit_table.getUnit("mm") }, + { "D7", 68, 96, unit_table.getUnit("mm") }, + { "E3", 400, 560, unit_table.getUnit("mm") }, + { "E4", 280, 400, unit_table.getUnit("mm") }, + { "E5", 200, 280, unit_table.getUnit("mm") }, + { "E6", 140, 200, unit_table.getUnit("mm") }, //#endif - { "CSE", 462, 649, SP_UNIT_PT }, - { "US #10 Envelope", 4.125, 9.5, SP_UNIT_IN }, + { "CSE", 462, 649, unit_table.getUnit("pt") }, + { "US #10 Envelope", 4.125, 9.5, unit_table.getUnit("in") }, /* See http://www.hbp.com/content/PCR_envelopes.cfm for a much larger list of US envelope sizes. */ - { "DL Envelope", 110, 220, SP_UNIT_MM }, - { "Ledger/Tabloid", 11, 17, SP_UNIT_IN }, + { "DL Envelope", 110, 220, unit_table.getUnit("mm") }, + { "Ledger/Tabloid", 11, 17, unit_table.getUnit("in") }, /* Note that `Folio' (used in QPrinter/KPrinter) is deliberately absent from this list, as it means different sizes to different people: different people may expect the width to be either 8, 8.25 or 8.5 inches, and the height to be either 13 or 13.5 inches, even restricting our interpretation to foolscap folio. If you wish to introduce a folio-like page size to the list, then please consider using a name more specific than just `Folio' or `Foolscap Folio'. */ - { "Banner 468x60", 60, 468, SP_UNIT_PX }, - { "Icon 16x16", 16, 16, SP_UNIT_PX }, - { "Icon 32x32", 32, 32, SP_UNIT_PX }, - { "Icon 48x48", 48, 48, SP_UNIT_PX }, + { "Banner 468x60", 60, 468, unit_table.getUnit("px") }, + { "Icon 16x16", 16, 16, unit_table.getUnit("px") }, + { "Icon 32x32", 32, 32, unit_table.getUnit("px") }, + { "Icon 48x48", 48, 48, unit_table.getUnit("px") }, /* business cards */ - { "Business Card (ISO 7810)", 53.98, 85.60, SP_UNIT_MM }, - { "Business Card (US)", 2, 3.5, SP_UNIT_IN }, - { "Business Card (Europe)", 55, 85, SP_UNIT_MM }, - { "Business Card (Aus/NZ)", 55, 90, SP_UNIT_MM }, + { "Business Card (ISO 7810)", 53.98, 85.60, unit_table.getUnit("mm") }, + { "Business Card (US)", 2, 3.5, unit_table.getUnit("in") }, + { "Business Card (Europe)", 55, 85, unit_table.getUnit("mm") }, + { "Business Card (Aus/NZ)", 55, 90, unit_table.getUnit("mm") }, // Start Arch Series List - { "Arch A", 9, 12, SP_UNIT_IN }, // 229 x 305 mm - { "Arch B", 12, 18, SP_UNIT_IN }, // 305 x 457 mm - { "Arch C", 18, 24, SP_UNIT_IN }, // 457 x 610 mm - { "Arch D", 24, 36, SP_UNIT_IN }, // 610 x 914 mm - { "Arch E", 36, 48, SP_UNIT_IN }, // 914 x 1219 mm - { "Arch E1", 30, 42, SP_UNIT_IN }, // 762 x 1067 mm + { "Arch A", 9, 12, unit_table.getUnit("in") }, // 229 x 305 mm + { "Arch B", 12, 18, unit_table.getUnit("in") }, // 305 x 457 mm + { "Arch C", 18, 24, unit_table.getUnit("in") }, // 457 x 610 mm + { "Arch D", 24, 36, unit_table.getUnit("in") }, // 610 x 914 mm + { "Arch E", 36, 48, unit_table.getUnit("in") }, // 914 x 1219 mm + { "Arch E1", 30, 42, unit_table.getUnit("in") }, // 762 x 1067 mm /* * The above list of Arch sizes were taken from the following site: @@ -216,7 +218,7 @@ static PaperSizeRec const inkscape_papers[] = { * September 2009 - DAK */ - { NULL, 0, 0, SP_UNIT_PX }, + { NULL, 0, 0, unit_table.getUnit("px") }, }; @@ -226,7 +228,7 @@ static PaperSizeRec const inkscape_papers[] = { //######################################################################## //The default unit for this widget and its calculations -static const SPUnit _px_unit = sp_unit_get_by_id (SP_UNIT_PX); +static Inkscape::Util::Unit _px_unit = unit_table.getUnit("px"); /** @@ -279,12 +281,7 @@ PageSizer::PageSizer(Registry & _wr) char formatBuf[80]; snprintf(formatBuf, 79, "%0.1f x %0.1f", p->smaller, p->larger); Glib::ustring desc = formatBuf; - if (p->unit == SP_UNIT_IN) - desc.append(" in"); - else if (p->unit == SP_UNIT_MM) - desc.append(" mm"); - else if (p->unit == SP_UNIT_PX) - desc.append(" px"); + desc.append(" " + p->unit.abbr); PaperSize paper(name, p->smaller, p->larger, p->unit); _paperSizeTable[name] = paper; Gtk::TreeModel::Row row = *(_paperSizeListStore->append()); @@ -568,9 +565,9 @@ PageSizer::find_paper_size (double w, double h) const for (iter = _paperSizeTable.begin() ; iter != _paperSizeTable.end() ; ++iter) { PaperSize paper = iter->second; - SPUnit const &i_unit = sp_unit_get_by_id(paper.unit); - double smallX = sp_units_get_pixels(paper.smaller, i_unit); - double largeX = sp_units_get_pixels(paper.larger, i_unit); + Inkscape::Util::Unit const &i_unit = paper.unit; + double smallX = Inkscape::Util::Quantity::convert(paper.smaller, &i_unit, &_px_unit); + double largeX = Inkscape::Util::Quantity::convert(paper.larger, &i_unit, &_px_unit); g_return_val_if_fail(smallX <= largeX, _paperSizeListStore->children().end()); @@ -661,9 +658,9 @@ PageSizer::on_paper_size_list_changed() _landscape = _landscapeButton.get_active(); } - SPUnit const &src_unit = sp_unit_get_by_id (paper.unit); - sp_convert_distance (&w, &src_unit, &_px_unit); - sp_convert_distance (&h, &src_unit, &_px_unit); + Inkscape::Util::Unit const &src_unit = paper.unit; + w = Inkscape::Util::Quantity::convert(w, &src_unit, &_px_unit); + h = Inkscape::Util::Quantity::convert(h, &src_unit, &_px_unit); if (_landscape) setDim (h, w, false); -- cgit v1.2.3 From d04405f745da587b2a3ccca8d2ca7bf49edf2d4d Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 6 Jul 2013 11:01:59 -0400 Subject: Switch setWidth and setHeight to use Quantity and switch to forward declaration of Inkscape::Util::Quantity in document.h. (bzr r12380.1.7) --- src/ui/widget/page-sizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index cceb3f600..884f9ea0a 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -480,8 +480,8 @@ PageSizer::setDim (double w, double h, bool changeList) if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = doc->getHeight(); - doc->setWidth (w, &_px_unit); - doc->setHeight (h, &_px_unit); + doc->setWidth (Inkscape::Util::Quantity(w, &_px_unit)); + doc->setHeight (Inkscape::Util::Quantity(h, &_px_unit)); // The origin for the user is in the lower left corner; this point should remain stationary when // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); -- cgit v1.2.3 From 9dc7b786c9ef31060012ea4ae13a8188548b4f62 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 9 Jul 2013 16:42:04 -0400 Subject: Ported sp-namedview.cpp (todo: fix a bunch of things). (bzr r12380.1.8) --- src/ui/widget/page-sizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 884f9ea0a..14e280f6d 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -316,9 +316,9 @@ PageSizer::PageSizer(Registry & _wr) SPNamedView *nv = sp_desktop_namedview(dt); _wr.setUpdating (true); if (nv->units) { - _dimensionUnits.setUnit(nv->units); + //_dimensionUnits.setUnit(nv->units); } else if (nv->doc_units) { - _dimensionUnits.setUnit(nv->doc_units); + //_dimensionUnits.setUnit(nv->doc_units); } _wr.setUpdating (false); -- cgit v1.2.3 From 3772fc428950b2b946a1bd7c7c97e06219c3165f Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 18 Jul 2013 17:21:24 -0400 Subject: Switch unit functions from using pointer arguements to reference arguements. (bzr r12380.1.28) --- src/ui/widget/page-sizer.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 73b75090b..f6392cfd8 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -228,10 +228,6 @@ static PaperSizeRec const inkscape_papers[] = { //# P A G E S I Z E R //######################################################################## -//The default unit for this widget and its calculations -static Inkscape::Util::Unit _px_unit = unit_table.getUnit("px"); - - /** * Constructor */ @@ -481,8 +477,8 @@ PageSizer::setDim (double w, double h, bool changeList) if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = doc->getHeight(); - doc->setWidth (Inkscape::Util::Quantity(w, &_px_unit)); - doc->setHeight (Inkscape::Util::Quantity(h, &_px_unit)); + doc->setWidth (Inkscape::Util::Quantity(w, "px")); + doc->setHeight (Inkscape::Util::Quantity(h, "px")); // The origin for the user is in the lower left corner; this point should remain stationary when // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); @@ -567,8 +563,8 @@ PageSizer::find_paper_size (double w, double h) const iter != _paperSizeTable.end() ; ++iter) { PaperSize paper = iter->second; Inkscape::Util::Unit const &i_unit = paper.unit; - double smallX = Inkscape::Util::Quantity::convert(paper.smaller, &i_unit, &_px_unit); - double largeX = Inkscape::Util::Quantity::convert(paper.larger, &i_unit, &_px_unit); + double smallX = Inkscape::Util::Quantity::convert(paper.smaller, i_unit, "px"); + double largeX = Inkscape::Util::Quantity::convert(paper.larger, i_unit, "px"); g_return_val_if_fail(smallX <= largeX, _paperSizeListStore->children().end()); @@ -659,9 +655,8 @@ PageSizer::on_paper_size_list_changed() _landscape = _landscapeButton.get_active(); } - Inkscape::Util::Unit const &src_unit = paper.unit; - w = Inkscape::Util::Quantity::convert(w, &src_unit, &_px_unit); - h = Inkscape::Util::Quantity::convert(h, &src_unit, &_px_unit); + w = Inkscape::Util::Quantity::convert(w, paper.unit, "px"); + h = Inkscape::Util::Quantity::convert(h, paper.unit, "px"); if (_landscape) setDim (h, w, false); -- cgit v1.2.3 From 7aab446af9e2eb34ce50c8ef0ec58710fac49396 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 29 Jul 2013 22:51:28 -0400 Subject: Cleanup. (bzr r12380.1.52) --- src/ui/widget/page-sizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index f6392cfd8..b15ab2823 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -313,9 +313,9 @@ PageSizer::PageSizer(Registry & _wr) SPNamedView *nv = sp_desktop_namedview(dt); _wr.setUpdating (true); if (nv->units) { - //_dimensionUnits.setUnit(nv->units); + _dimensionUnits.setUnit(nv->units->abbr); } else if (nv->doc_units) { - //_dimensionUnits.setUnit(nv->doc_units); + _dimensionUnits.setUnit(nv->doc_units->abbr); } _wr.setUpdating (false); -- cgit v1.2.3 From 6ae6c0bea96eef09907091279e0678aa5f83102d Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 4 Aug 2013 18:01:18 -0400 Subject: Switched to global UnitTable. (bzr r12380.1.62) --- src/ui/widget/page-sizer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index b15ab2823..d912fd9d3 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -47,9 +47,8 @@ #include "xml/node.h" #include "xml/repr.h" -static Inkscape::Util::UnitTable unit_table; - using std::pair; +using Inkscape::Util::unit_table; namespace Inkscape { namespace UI { -- cgit v1.2.3 From 0ec2d349388ad6a4e0c35039b2f5c09cccadc6b0 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 6 Aug 2013 14:44:23 -0400 Subject: Fixed bug in page sizer. (bzr r12380.1.63) --- src/ui/widget/page-sizer.cpp | 138 +++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'src/ui/widget/page-sizer.cpp') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index d912fd9d3..8287452d7 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -97,7 +97,7 @@ struct PaperSizeRec { char const * const name; //name double const smaller; //lesser dimension double const larger; //greater dimension - Inkscape::Util::Unit const unit; //units + Glib::ustring const unit; //units }; // list of page formats that should be in landscape automatically @@ -115,31 +115,31 @@ fill_landscape_papers() { } static PaperSizeRec const inkscape_papers[] = { - { "A4", 210, 297, unit_table.getUnit("mm") }, - { "US Letter", 8.5, 11, unit_table.getUnit("in") }, - { "US Legal", 8.5, 14, unit_table.getUnit("in") }, - { "US Executive", 7.25, 10.5, unit_table.getUnit("in") }, - { "A0", 841, 1189, unit_table.getUnit("mm") }, - { "A1", 594, 841, unit_table.getUnit("mm") }, - { "A2", 420, 594, unit_table.getUnit("mm") }, - { "A3", 297, 420, unit_table.getUnit("mm") }, - { "A5", 148, 210, unit_table.getUnit("mm") }, - { "A6", 105, 148, unit_table.getUnit("mm") }, - { "A7", 74, 105, unit_table.getUnit("mm") }, - { "A8", 52, 74, unit_table.getUnit("mm") }, - { "A9", 37, 52, unit_table.getUnit("mm") }, - { "A10", 26, 37, unit_table.getUnit("mm") }, - { "B0", 1000, 1414, unit_table.getUnit("mm") }, - { "B1", 707, 1000, unit_table.getUnit("mm") }, - { "B2", 500, 707, unit_table.getUnit("mm") }, - { "B3", 353, 500, unit_table.getUnit("mm") }, - { "B4", 250, 353, unit_table.getUnit("mm") }, - { "B5", 176, 250, unit_table.getUnit("mm") }, - { "B6", 125, 176, unit_table.getUnit("mm") }, - { "B7", 88, 125, unit_table.getUnit("mm") }, - { "B8", 62, 88, unit_table.getUnit("mm") }, - { "B9", 44, 62, unit_table.getUnit("mm") }, - { "B10", 31, 44, unit_table.getUnit("mm") }, + { "A4", 210, 297, "mm" }, + { "US Letter", 8.5, 11, "in" }, + { "US Legal", 8.5, 14, "in" }, + { "US Executive", 7.25, 10.5, "in" }, + { "A0", 841, 1189, "mm" }, + { "A1", 594, 841, "mm" }, + { "A2", 420, 594, "mm" }, + { "A3", 297, 420, "mm" }, + { "A5", 148, 210, "mm" }, + { "A6", 105, 148, "mm" }, + { "A7", 74, 105, "mm" }, + { "A8", 52, 74, "mm" }, + { "A9", 37, 52, "mm" }, + { "A10", 26, 37, "mm" }, + { "B0", 1000, 1414, "mm" }, + { "B1", 707, 1000, "mm" }, + { "B2", 500, 707, "mm" }, + { "B3", 353, 500, "mm" }, + { "B4", 250, 353, "mm" }, + { "B5", 176, 250, "mm" }, + { "B6", 125, 176, "mm" }, + { "B7", 88, 125, "mm" }, + { "B8", 62, 88, "mm" }, + { "B9", 44, 62, "mm" }, + { "B10", 31, 44, "mm" }, @@ -151,63 +151,63 @@ static PaperSizeRec const inkscape_papers[] = { don't know what D and E series are used for. */ - { "C0", 917, 1297, unit_table.getUnit("mm") }, - { "C1", 648, 917, unit_table.getUnit("mm") }, - { "C2", 458, 648, unit_table.getUnit("mm") }, - { "C3", 324, 458, unit_table.getUnit("mm") }, - { "C4", 229, 324, unit_table.getUnit("mm") }, - { "C5", 162, 229, unit_table.getUnit("mm") }, - { "C6", 114, 162, unit_table.getUnit("mm") }, - { "C7", 81, 114, unit_table.getUnit("mm") }, - { "C8", 57, 81, unit_table.getUnit("mm") }, - { "C9", 40, 57, unit_table.getUnit("mm") }, - { "C10", 28, 40, unit_table.getUnit("mm") }, - { "D1", 545, 771, unit_table.getUnit("mm") }, - { "D2", 385, 545, unit_table.getUnit("mm") }, - { "D3", 272, 385, unit_table.getUnit("mm") }, - { "D4", 192, 272, unit_table.getUnit("mm") }, - { "D5", 136, 192, unit_table.getUnit("mm") }, - { "D6", 96, 136, unit_table.getUnit("mm") }, - { "D7", 68, 96, unit_table.getUnit("mm") }, - { "E3", 400, 560, unit_table.getUnit("mm") }, - { "E4", 280, 400, unit_table.getUnit("mm") }, - { "E5", 200, 280, unit_table.getUnit("mm") }, - { "E6", 140, 200, unit_table.getUnit("mm") }, + { "C0", 917, 1297, "mm" }, + { "C1", 648, 917, "mm" }, + { "C2", 458, 648, "mm" }, + { "C3", 324, 458, "mm" }, + { "C4", 229, 324, "mm" }, + { "C5", 162, 229, "mm" }, + { "C6", 114, 162, "mm" }, + { "C7", 81, 114, "mm" }, + { "C8", 57, 81, "mm" }, + { "C9", 40, 57, "mm" }, + { "C10", 28, 40, "mm" }, + { "D1", 545, 771, "mm" }, + { "D2", 385, 545, "mm" }, + { "D3", 272, 385, "mm" }, + { "D4", 192, 272, "mm" }, + { "D5", 136, 192, "mm" }, + { "D6", 96, 136, "mm" }, + { "D7", 68, 96, "mm" }, + { "E3", 400, 560, "mm" }, + { "E4", 280, 400, "mm" }, + { "E5", 200, 280, "mm" }, + { "E6", 140, 200, "mm" }, //#endif - { "CSE", 462, 649, unit_table.getUnit("pt") }, - { "US #10 Envelope", 4.125, 9.5, unit_table.getUnit("in") }, + { "CSE", 462, 649, "pt" }, + { "US #10 Envelope", 4.125, 9.5, "in" }, /* See http://www.hbp.com/content/PCR_envelopes.cfm for a much larger list of US envelope sizes. */ - { "DL Envelope", 110, 220, unit_table.getUnit("mm") }, - { "Ledger/Tabloid", 11, 17, unit_table.getUnit("in") }, + { "DL Envelope", 110, 220, "mm" }, + { "Ledger/Tabloid", 11, 17, "in" }, /* Note that `Folio' (used in QPrinter/KPrinter) is deliberately absent from this list, as it means different sizes to different people: different people may expect the width to be either 8, 8.25 or 8.5 inches, and the height to be either 13 or 13.5 inches, even restricting our interpretation to foolscap folio. If you wish to introduce a folio-like page size to the list, then please consider using a name more specific than just `Folio' or `Foolscap Folio'. */ - { "Banner 468x60", 60, 468, unit_table.getUnit("px") }, - { "Icon 16x16", 16, 16, unit_table.getUnit("px") }, - { "Icon 32x32", 32, 32, unit_table.getUnit("px") }, - { "Icon 48x48", 48, 48, unit_table.getUnit("px") }, + { "Banner 468x60", 60, 468, "px" }, + { "Icon 16x16", 16, 16, "px" }, + { "Icon 32x32", 32, 32, "px" }, + { "Icon 48x48", 48, 48, "px" }, /* business cards */ - { "Business Card (ISO 7810)", 53.98, 85.60, unit_table.getUnit("mm") }, - { "Business Card (US)", 2, 3.5, unit_table.getUnit("in") }, - { "Business Card (Europe)", 55, 85, unit_table.getUnit("mm") }, - { "Business Card (Aus/NZ)", 55, 90, unit_table.getUnit("mm") }, + { "Business Card (ISO 7810)", 53.98, 85.60, "mm" }, + { "Business Card (US)", 2, 3.5, "in" }, + { "Business Card (Europe)", 55, 85, "mm" }, + { "Business Card (Aus/NZ)", 55, 90, "mm" }, // Start Arch Series List - { "Arch A", 9, 12, unit_table.getUnit("in") }, // 229 x 305 mm - { "Arch B", 12, 18, unit_table.getUnit("in") }, // 305 x 457 mm - { "Arch C", 18, 24, unit_table.getUnit("in") }, // 457 x 610 mm - { "Arch D", 24, 36, unit_table.getUnit("in") }, // 610 x 914 mm - { "Arch E", 36, 48, unit_table.getUnit("in") }, // 914 x 1219 mm - { "Arch E1", 30, 42, unit_table.getUnit("in") }, // 762 x 1067 mm + { "Arch A", 9, 12, "in" }, // 229 x 305 mm + { "Arch B", 12, 18, "in" }, // 305 x 457 mm + { "Arch C", 18, 24, "in" }, // 457 x 610 mm + { "Arch D", 24, 36, "in" }, // 610 x 914 mm + { "Arch E", 36, 48, "in" }, // 914 x 1219 mm + { "Arch E1", 30, 42, "in" }, // 762 x 1067 mm /* * The above list of Arch sizes were taken from the following site: @@ -218,7 +218,7 @@ static PaperSizeRec const inkscape_papers[] = { * September 2009 - DAK */ - { NULL, 0, 0, unit_table.getUnit("px") }, + { NULL, 0, 0, "px" }, }; @@ -277,8 +277,8 @@ PageSizer::PageSizer(Registry & _wr) char formatBuf[80]; snprintf(formatBuf, 79, "%0.1f x %0.1f", p->smaller, p->larger); Glib::ustring desc = formatBuf; - desc.append(" " + p->unit.abbr); - PaperSize paper(name, p->smaller, p->larger, p->unit); + desc.append(" " + p->unit); + PaperSize paper(name, p->smaller, p->larger, unit_table.getUnit(p->unit)); _paperSizeTable[name] = paper; Gtk::TreeModel::Row row = *(_paperSizeListStore->append()); row[_paperSizeListColumns.nameColumn] = name; -- cgit v1.2.3