From ae57812b967d6d67ecb223537216e98d055c170e Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 17 Feb 2014 13:53:01 -0500 Subject: scaling of viewBox on document unit change (Bug 1236257) Fixed bugs: - https://launchpad.net/bugs/1236257 (bzr r13034) --- src/ui/dialog/document-properties.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d324d2d1b..d344fb1d6 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1703,9 +1703,14 @@ void DocumentProperties::onDocUnitChange() repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox - Inkscape::Util::Quantity width = doc->getWidth(); - Inkscape::Util::Quantity height = doc->getHeight(); - doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + if (doc->getRoot()->viewBox_set) { + gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); + doc->setViewBox(doc->getRoot()->viewBox*Geom::Scale(scale)); + } else { + Inkscape::Util::Quantity width = doc->getWidth(); + Inkscape::Util::Quantity height = doc->getHeight(); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + } // TODO: Fix bug in nodes tool instead of switching away from it if (tools_active(getDesktop()) == TOOLS_NODES) { -- cgit v1.2.3 From b3dad97ff32d34dc38ce51ebbdc0e9555a9ce5e6 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 22 Feb 2014 16:37:43 -0500 Subject: offset of viewBox on document unit change (Bug 1280684) Fixed bugs: - https://launchpad.net/bugs/1280684 (bzr r13050) --- src/ui/dialog/document-properties.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d344fb1d6..0411c789c 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1734,8 +1734,14 @@ void DocumentProperties::onDocUnitChange() prefs->setBool("/options/transform/gradient", true); { ShapeEditor::blockSetItem(true); + gdouble viewscale = doc->getWidth().value("px")/doc->getRoot()->viewBox.width(); + if (doc->getHeight().value("px")/doc->getRoot()->viewBox.height() < viewscale) + viewscale = doc->getHeight().value("px")/doc->getRoot()->viewBox.height(); gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(-viewscale*doc->getRoot()->viewBox.min()[Geom::X] + + (doc->getWidth().value("px") - viewscale*doc->getRoot()->viewBox.width())/2, + viewscale*doc->getRoot()->viewBox.min()[Geom::Y] + + (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2)); ShapeEditor::blockSetItem(false); } prefs->setBool("/options/transform/stroke", transform_stroke); -- cgit v1.2.3 From e7a3f5b74d1f5a95390ee95b06371d184c1812f7 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 13 Mar 2014 05:45:38 +0100 Subject: Provide a toggle in the document properties to optionally turn off antialiasing for display and export. Fixes a nearly 10 year old bug #170356 Fixed bugs: - https://launchpad.net/bugs/170356 (bzr r13144) --- src/ui/dialog/document-properties.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0411c789c..ef7c9ee1d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -106,6 +106,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), @@ -239,7 +240,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con yoptions = Gtk::FILL|Gtk::EXPAND; } if (docum_prop_flag) { - if( i==(n-4) || i==(n-6) ) { + // this sets the padding for subordinate widgets on the "Page" page + if( i==(n-8) || i==(n-10) ) { #if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); arr[i+1]->set_margin_left(20); @@ -316,28 +318,28 @@ void DocumentProperties::build_page() Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("General")); - Gtk::Label* label_col = manage (new Gtk::Label); - label_col->set_markup (_("Color")); - Gtk::Label* label_bor = manage (new Gtk::Label); - label_bor->set_markup (_("Border")); Gtk::Label *label_for = manage (new Gtk::Label); label_for->set_markup (_("Page Size")); + Gtk::Label* label_dsp = manage (new Gtk::Label); + label_dsp->set_markup (_("Display")); _page_sizer.init(); Gtk::Widget *const widget_array[] = { label_gen, 0, 0, &_rum_deflt, - label_col, 0, - _rcp_bg._label, &_rcp_bg, + //label_col, 0, + //_rcp_bg._label, &_rcp_bg, 0, 0, label_for, 0, 0, &_page_sizer, 0, 0, - label_bor, 0, + label_dsp, 0, 0, &_rcb_canb, 0, &_rcb_bord, 0, &_rcb_shad, + 0, &_rcb_antialias, + _rcp_bg._label, &_rcp_bg, _rcp_bord._label, &_rcp_bord, }; @@ -1472,6 +1474,7 @@ void DocumentProperties::update() _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP); _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); + _rcb_antialias.setActive(nv->antialiasing); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); -- cgit v1.2.3 From 32ef25632164e5af8766a5364400b579edde4ebf Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 13 Mar 2014 23:37:07 +0100 Subject: Reimplement global aliasing toggle as a 'shape-rendering' property on the root element. (bzr r13146) --- src/ui/dialog/document-properties.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ef7c9ee1d..a31ab1a09 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -35,6 +35,7 @@ #include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" +#include "style.h" #include "svg/stringstream.h" #include "tools-switch.h" #include "ui/widget/color-picker.h" @@ -106,7 +107,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- - _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false), + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), @@ -1474,7 +1475,10 @@ void DocumentProperties::update() _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP); _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - _rcb_antialias.setActive(nv->antialiasing); + + SPRoot *root = dt->getDocument()->getRoot(); + _rcb_antialias.set_xml_target(root->getRepr(), dt->getDocument()); + _rcb_antialias.setActive(root->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); -- cgit v1.2.3 From 1a8f0cfdf29561e9929216e0d9d6db637ab31d54 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sun, 30 Mar 2014 23:43:02 +0200 Subject: Added "Gtk::" scope to "manage" function calls. (bzr r13236) --- src/ui/dialog/document-properties.cpp | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a31ab1a09..508fc52b1 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -297,7 +297,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); #endif } else { - Gtk::HBox *space = manage (new Gtk::HBox); + Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); #if WITH_GTKMM_3_0 @@ -317,11 +317,11 @@ void DocumentProperties::build_page() { _page_page->show(); - Gtk::Label* label_gen = manage (new Gtk::Label); + Gtk::Label* label_gen = Gtk::manage (new Gtk::Label); label_gen->set_markup (_("General")); - Gtk::Label *label_for = manage (new Gtk::Label); + Gtk::Label *label_for = Gtk::manage (new Gtk::Label); label_for->set_markup (_("Page Size")); - Gtk::Label* label_dsp = manage (new Gtk::Label); + Gtk::Label* label_dsp = Gtk::manage (new Gtk::Label); label_dsp->set_markup (_("Display")); _page_sizer.init(); @@ -356,7 +356,7 @@ void DocumentProperties::build_guides() { _page_guides->show(); - Gtk::Label *label_gui = manage (new Gtk::Label); + Gtk::Label *label_gui = Gtk::manage (new Gtk::Label); label_gui->set_markup (_("Guides")); Gtk::Widget *const widget_array[] = @@ -374,13 +374,13 @@ void DocumentProperties::build_snap() { _page_snap->show(); - Gtk::Label *label_o = manage (new Gtk::Label); + Gtk::Label *label_o = Gtk::manage (new Gtk::Label); label_o->set_markup (_("Snap to objects")); - Gtk::Label *label_gr = manage (new Gtk::Label); + Gtk::Label *label_gr = Gtk::manage (new Gtk::Label); label_gr->set_markup (_("Snap to grids")); - Gtk::Label *label_gu = manage (new Gtk::Label); + Gtk::Label *label_gu = Gtk::manage (new Gtk::Label); label_gu->set_markup (_("Snap to guides")); - Gtk::Label *label_m = manage (new Gtk::Label); + Gtk::Label *label_m = Gtk::manage (new Gtk::Label); label_m->set_markup (_("Miscellaneous")); Gtk::Widget *const array[] = @@ -607,9 +607,9 @@ void DocumentProperties::removeSelectedProfile(){ void DocumentProperties::build_cms() { _page_cms->show(); - Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_START)); + Gtk::Label *label_link= Gtk::manage (new Gtk::Label("", Gtk::ALIGN_START)); label_link->set_markup (_("Linked Color Profiles:")); - Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); + Gtk::Label *label_avail = Gtk::manage (new Gtk::Label("", Gtk::ALIGN_START)); label_avail->set_markup (_("Available Color Profiles:")); _link_btn.set_tooltip_text(_("Link Profile")); @@ -746,7 +746,7 @@ void DocumentProperties::build_scripting() //# External scripts tab _page_external_scripts->show(); - Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); + Gtk::Label *label_external= Gtk::manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("External script files:")); _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); @@ -835,7 +835,7 @@ void DocumentProperties::build_scripting() //# Embedded scripts tab _page_embedded_scripts->show(); - Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); + Gtk::Label *label_embedded= Gtk::manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded->set_markup (_("Embedded script files:")); _embed_new_btn.set_tooltip_text(_("New")); @@ -922,7 +922,7 @@ void DocumentProperties::build_scripting() // TODO restore? _EmbeddedScriptsList.set_fixed_height_mode(true); //# Set up the Embedded Scripts content box - Gtk::Label *label_embedded_content= manage (new Gtk::Label("", Gtk::ALIGN_START)); + Gtk::Label *label_embedded_content= Gtk::manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded_content->set_markup (_("Content:")); label_embedded_content->set_alignment(0.0); @@ -1001,7 +1001,7 @@ void DocumentProperties::build_metadata() _page_metadata1->show(); - Gtk::Label *label = manage (new Gtk::Label); + Gtk::Label *label = Gtk::manage (new Gtk::Label); label->set_markup (_("Dublin Core Entities")); label->set_alignment (0.0); @@ -1019,7 +1019,7 @@ void DocumentProperties::build_metadata() if ( entity->editable == RDF_EDIT_GENERIC ) { EntityEntry *w = EntityEntry::create (entity, _wr); _rdflist.push_back (w); - Gtk::HBox *space = manage (new Gtk::HBox); + Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); #if WITH_GTKMM_3_0 @@ -1040,15 +1040,15 @@ void DocumentProperties::build_metadata() } } - Gtk::Button *button_save = manage (new Gtk::Button(_("_Save as default"),1)); + Gtk::Button *button_save = Gtk::manage (new Gtk::Button(_("_Save as default"),1)); button_save->set_tooltip_text(_("Save this metadata as the default metadata")); - Gtk::Button *button_load = manage (new Gtk::Button(_("Use _default"),1)); + Gtk::Button *button_load = Gtk::manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); #if WITH_GTKMM_3_0 - Gtk::ButtonBox *box_buttons = manage (new Gtk::ButtonBox); + Gtk::ButtonBox *box_buttons = Gtk::manage (new Gtk::ButtonBox); #else - Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox); + Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox); #endif box_buttons->set_layout(Gtk::BUTTONBOX_END); @@ -1063,7 +1063,7 @@ void DocumentProperties::build_metadata() _page_metadata2->show(); row = 0; - Gtk::Label *llabel = manage (new Gtk::Label); + Gtk::Label *llabel = Gtk::manage (new Gtk::Label); llabel->set_markup (_("License")); llabel->set_alignment (0.0); @@ -1077,7 +1077,7 @@ void DocumentProperties::build_metadata() /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); - Gtk::HBox *space = manage (new Gtk::HBox); + Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); #if WITH_GTKMM_3_0 @@ -1545,12 +1545,12 @@ void DocumentProperties::update() Gtk::HBox& DocumentProperties::_createPageTabLabel(const Glib::ustring& label, const char *label_image) { - Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0)); + Gtk::HBox *_tab_label_box = Gtk::manage(new Gtk::HBox(false, 0)); _tab_label_box->set_spacing(4); _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION, label_image))); - Gtk::Label *_tab_label = manage(new Gtk::Label(label, true)); + Gtk::Label *_tab_label = Gtk::manage(new Gtk::Label(label, true)); _tab_label_box->pack_start(*_tab_label); _tab_label_box->show_all(); -- cgit v1.2.3 From 08692dea2a2b45f0358a70db8e7d08fd73c6e3e4 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 31 Mar 2014 11:10:00 +0100 Subject: Fix Gtkmm 3.8 build issues on systems with Gtk+ 3.10 (bzr r13242) --- src/ui/dialog/document-properties.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 508fc52b1..67e788e21 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -613,7 +613,7 @@ void DocumentProperties::build_cms() label_avail->set_markup (_("Available Color Profiles:")); _link_btn.set_tooltip_text(_("Link Profile")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _link_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_link = Gtk::manage(new Gtk::Image()); @@ -622,7 +622,7 @@ void DocumentProperties::build_cms() #endif _unlink_btn.set_tooltip_text(_("Unlink Profile")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _unlink_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_unlink = Gtk::manage(new Gtk::Image()); @@ -750,7 +750,7 @@ void DocumentProperties::build_scripting() label_external->set_markup (_("External script files:")); _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _external_add_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_ext_add = Gtk::manage(new Gtk::Image()); @@ -759,7 +759,7 @@ void DocumentProperties::build_scripting() #endif _external_remove_btn.set_tooltip_text(_("Remove")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _external_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_ext_rm = Gtk::manage(new Gtk::Image()); @@ -839,7 +839,7 @@ void DocumentProperties::build_scripting() label_embedded->set_markup (_("Embedded script files:")); _embed_new_btn.set_tooltip_text(_("New")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _embed_new_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_embed_new = Gtk::manage(new Gtk::Image()); @@ -848,7 +848,7 @@ void DocumentProperties::build_scripting() #endif _embed_remove_btn.set_tooltip_text(_("Remove")); -#if GTK_CHECK_VERSION(3,10,0) +#if WITH_GTKMM_3_10 _embed_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); #else Gtk::Image *image_embed_rm = Gtk::manage(new Gtk::Image()); -- cgit v1.2.3