summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/document-properties.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
-rw-r--r--src/ui/dialog/document-properties.cpp100
1 files changed, 59 insertions, 41 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index d324d2d1b..67e788e21 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,6 +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"), "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),
@@ -239,7 +241,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);
@@ -294,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
@@ -314,30 +317,30 @@ 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 (_("<b>General</b>"));
- Gtk::Label* label_col = manage (new Gtk::Label);
- label_col->set_markup (_("<b>Color</b>"));
- Gtk::Label* label_bor = manage (new Gtk::Label);
- label_bor->set_markup (_("<b>Border</b>"));
- Gtk::Label *label_for = manage (new Gtk::Label);
+ Gtk::Label *label_for = Gtk::manage (new Gtk::Label);
label_for->set_markup (_("<b>Page Size</b>"));
+ Gtk::Label* label_dsp = Gtk::manage (new Gtk::Label);
+ label_dsp->set_markup (_("<b>Display</b>"));
_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,
};
@@ -353,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 (_("<b>Guides</b>"));
Gtk::Widget *const widget_array[] =
@@ -371,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 (_("<b>Snap to objects</b>"));
- Gtk::Label *label_gr = manage (new Gtk::Label);
+ Gtk::Label *label_gr = Gtk::manage (new Gtk::Label);
label_gr->set_markup (_("<b>Snap to grids</b>"));
- Gtk::Label *label_gu = manage (new Gtk::Label);
+ Gtk::Label *label_gu = Gtk::manage (new Gtk::Label);
label_gu->set_markup (_("<b>Snap to guides</b>"));
- Gtk::Label *label_m = manage (new Gtk::Label);
+ Gtk::Label *label_m = Gtk::manage (new Gtk::Label);
label_m->set_markup (_("<b>Miscellaneous</b>"));
Gtk::Widget *const array[] =
@@ -604,13 +607,13 @@ 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 (_("<b>Linked Color Profiles:</b>"));
- 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 (_("<b>Available Color Profiles:</b>"));
_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());
@@ -619,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());
@@ -743,11 +746,11 @@ 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 (_("<b>External script files:</b>"));
_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());
@@ -756,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());
@@ -832,11 +835,11 @@ 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 (_("<b>Embedded script files:</b>"));
_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());
@@ -845,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());
@@ -919,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 (_("<b>Content:</b>"));
label_embedded_content->set_alignment(0.0);
@@ -998,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 (_("<b>Dublin Core Entities</b>"));
label->set_alignment (0.0);
@@ -1016,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
@@ -1037,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);
@@ -1060,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 (_("<b>License</b>"));
llabel->set_alignment (0.0);
@@ -1074,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
@@ -1473,6 +1476,10 @@ void DocumentProperties::update()
_rcp_bord.setRgba32 (nv->bordercolor);
_rcb_shad.setActive (nv->showpageshadow);
+ 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);
}
@@ -1538,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();
@@ -1703,9 +1710,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) {
@@ -1729,8 +1741,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);