summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/document-metadata.cpp2
-rw-r--r--src/ui/dialog/document-properties.cpp249
-rw-r--r--src/ui/widget/labelled.cpp16
-rw-r--r--src/ui/widget/labelled.h2
-rw-r--r--src/ui/widget/notebook-page.cpp7
-rw-r--r--src/ui/widget/page-sizer.cpp149
-rw-r--r--src/ui/widget/page-sizer.h3
-rw-r--r--src/ui/widget/registered-widget.h2
8 files changed, 203 insertions, 227 deletions
diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp
index c93572a1a..56a75b7d2 100644
--- a/src/ui/dialog/document-metadata.cpp
+++ b/src/ui/dialog/document-metadata.cpp
@@ -102,6 +102,7 @@ DocumentMetadata::~DocumentMetadata()
delete it;
}
+// TODO: This duplicates code in document-properties.cpp
void
DocumentMetadata::build_metadata()
{
@@ -129,6 +130,7 @@ DocumentMetadata::build_metadata()
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1.attach(*space, 0, row, 1, 1);
+ w->_label.set_halign(Gtk::ALIGN_START);
w->_label.set_valign(Gtk::ALIGN_CENTER);
_page_metadata1.attach(w->_label, 1, row, 1, 1);
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 6828602ee..622334b97 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -89,68 +89,68 @@ DocumentProperties& DocumentProperties::getInstance()
}
DocumentProperties::DocumentProperties()
- : UI::Widget::Panel("/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
- _page_page(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))),
- _page_guides(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_snap(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_cms(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_scripting(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_external_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_embedded_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
- _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
+ : UI::Widget::Panel("/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW)
+ , _page_page(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true)))
+ , _page_guides(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _page_snap(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _page_cms(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _page_scripting(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _page_external_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _page_embedded_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1)))
+ , _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, nullptr, nullptr, nullptr, "crispEdges"),
- _rcb_checkerboard(_("Checkerboard background"), _("If set, use a colored checkerboard for the canvas background"), "inkscape:pagecheckerboard", _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),
- _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the canvas background. Note: opacity is ignored except when exporting to bitmap."), "pagecolor", "inkscape:pageopacity", _wr),
- _rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr),
- _rum_deflt(_("Display _units:"), "inkscape:document-units", _wr),
- _page_sizer(_wr),
+ , _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, nullptr, nullptr, nullptr, "crispEdges")
+ , _rcb_checkerboard(_("Checkerboard background"), _("If set, use a colored checkerboard for the canvas background"), "inkscape:pagecheckerboard", _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)
+ , _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the canvas background. Note: opacity is ignored except when exporting to bitmap."), "pagecolor", "inkscape:pageopacity", _wr)
+ , _rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr)
+ , _rum_deflt(_("Display _units:"), "inkscape:document-units", _wr)
+ , _page_sizer(_wr)
//---------------------------------------------------------------
- //General snap options
- _rcb_sgui(_("Show _guides"), _("Show or hide guides"), "showguides", _wr),
- _rcb_lgui(_("Lock all guides"), _("Toggle lock of all guides in the document"), "inkscape:lockguides", _wr),
- _rcp_gui(_("Guide co_lor:"), _("Guideline color"), _("Color of guidelines"), "guidecolor", "guideopacity", _wr),
- _rcp_hgui(_("_Highlight color:"), _("Highlighted guideline color"), _("Color of a guideline when it is under mouse"), "guidehicolor", "guidehiopacity", _wr),
- _create_guides_btn(_("Create guides around the page")),
- _delete_guides_btn(_("Delete all guides")),
+ //General snap options
+ , _rcb_sgui(_("Show _guides"), _("Show or hide guides"), "showguides", _wr)
+ , _rcb_lgui(_("Lock all guides"), _("Toggle lock of all guides in the document"), "inkscape:lockguides", _wr)
+ , _rcp_gui(_("Guide co_lor:"), _("Guideline color"), _("Color of guidelines"), "guidecolor", "guideopacity", _wr)
+ , _rcp_hgui(_("_Highlight color:"), _("Highlighted guideline color"), _("Color of a guideline when it is under mouse"), "guidehicolor", "guidehiopacity", _wr)
+ , _create_guides_btn(_("Create guides around the page"))
+ , _delete_guides_btn(_("Delete all guides"))
//---------------------------------------------------------------
- _rsu_sno(_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"),
- _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"),
- _("If set, objects only snap to another object when it's within the range specified below"),
- "objecttolerance", _wr),
+ , _rsu_sno(_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"),
+ _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"),
+ _("If set, objects only snap to another object when it's within the range specified below"),
+ "objecttolerance", _wr)
//Options for snapping to grids
- _rsu_sn(_("Snap d_istance"), _("Snap only when c_loser than:"), _("Always snap"),
- _("Snapping distance, in screen pixels, for snapping to grid"), _("Always snap to grids, regardless of the distance"),
- _("If set, objects only snap to a grid line when it's within the range specified below"),
- "gridtolerance", _wr),
+ , _rsu_sn(_("Snap d_istance"), _("Snap only when c_loser than:"), _("Always snap"),
+ _("Snapping distance, in screen pixels, for snapping to grid"), _("Always snap to grids, regardless of the distance"),
+ _("If set, objects only snap to a grid line when it's within the range specified below"),
+ "gridtolerance", _wr)
//Options for snapping to guides
- _rsu_gusn(_("Snap dist_ance"), _("Snap only when close_r than:"), _("Always snap"),
+ , _rsu_gusn(_("Snap dist_ance"), _("Snap only when close_r than:"), _("Always snap"),
_("Snapping distance, in screen pixels, for snapping to guides"), _("Always snap to guides, regardless of the distance"),
_("If set, objects only snap to a guide when it's within the range specified below"),
- "guidetolerance", _wr),
+ "guidetolerance", _wr)
//---------------------------------------------------------------
- _rcb_snclp(_("Snap to clip paths"), _("When snapping to paths, then also try snapping to clip paths"), "inkscape:snap-path-clip", _wr),
- _rcb_snmsk(_("Snap to mask paths"), _("When snapping to paths, then also try snapping to mask paths"), "inkscape:snap-path-mask", _wr),
- _rcb_perp(_("Snap perpendicularly"), _("When snapping to paths or guides, then also try snapping perpendicularly"), "inkscape:snap-perpendicular", _wr),
- _rcb_tang(_("Snap tangentially"), _("When snapping to paths or guides, then also try snapping tangentially"), "inkscape:snap-tangential", _wr),
+ , _rcb_snclp(_("Snap to clip paths"), _("When snapping to paths, then also try snapping to clip paths"), "inkscape:snap-path-clip", _wr)
+ , _rcb_snmsk(_("Snap to mask paths"), _("When snapping to paths, then also try snapping to mask paths"), "inkscape:snap-path-mask", _wr)
+ , _rcb_perp(_("Snap perpendicularly"), _("When snapping to paths or guides, then also try snapping perpendicularly"), "inkscape:snap-perpendicular", _wr)
+ , _rcb_tang(_("Snap tangentially"), _("When snapping to paths or guides, then also try snapping tangentially"), "inkscape:snap-tangential", _wr)
//---------------------------------------------------------------
- _grids_label_crea("", Gtk::ALIGN_START),
- _grids_button_new(C_("Grid", "_New"), _("Create new grid.")),
- _grids_button_remove(C_("Grid", "_Remove"), _("Remove selected grid.")),
- _grids_label_def("", Gtk::ALIGN_START)
+ , _grids_label_crea("", Gtk::ALIGN_START)
+ , _grids_button_new(C_("Grid", "_New"), _("Create new grid."))
+ , _grids_button_remove(C_("Grid", "_Remove"), _("Remove selected grid."))
+ , _grids_label_def("", Gtk::ALIGN_START)
{
_getContents()->set_spacing (4);
_getContents()->pack_start(_notebook, true, true);
_notebook.append_page(*_page_page, _("Page"));
_notebook.append_page(*_page_guides, _("Guides"));
- _notebook.append_page(_grids_vbox, _("Grids"));
+ _notebook.append_page(_grids_vbox, _("Grids"));
_notebook.append_page(*_page_snap, _("Snap"));
- _notebook.append_page(*_page_cms, _("Color"));
+ _notebook.append_page(*_page_cms, _("Color"));
_notebook.append_page(*_page_scripting, _("Scripting"));
_notebook.append_page(*_page_metadata1, _("Metadata"));
_notebook.append_page(*_page_metadata2, _("License"));
@@ -211,9 +211,9 @@ DocumentProperties::~DocumentProperties()
* widget in columns 2-3; (non-0, 0) means label in columns 1-3; and
* (non-0, non-0) means two widgets in columns 2 and 3.
*/
-inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0, bool indent = false)
+void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n)
{
- for (unsigned i = 0, r = start; i < n; i += 2) {
+ for (unsigned i = 0, r = 0; i < n; i += 2) {
if (arr[i] && arr[i+1]) {
arr[i]->set_hexpand();
arr[i+1]->set_hexpand();
@@ -228,44 +228,14 @@ inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned cons
// only the PageSizer in Document Properties|Page should be stretched vertically
yoptions = Gtk::FILL|Gtk::EXPAND;
}
- if (docum_prop_flag) {
- // this sets the padding for subordinate widgets on the "Page" page
- if( indent && (i==(n-6) || i==(n-4) || i==(n-2)) ) {
- arr[i+1]->set_hexpand();
-#if GTKMM_CHECK_VERSION(3,12,0)
- arr[i+1]->set_margin_start(20);
- arr[i+1]->set_margin_end(20);
-#else
- arr[i+1]->set_margin_left(20);
- arr[i+1]->set_margin_right(20);
-#endif
-
- if (yoptions & Gtk::EXPAND)
- arr[i+1]->set_vexpand();
- else
- arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
+ arr[i+1]->set_hexpand();
- table.attach(*arr[i+1], 1, r, 2, 1);
- } else {
- arr[i+1]->set_hexpand();
+ if (yoptions & Gtk::EXPAND)
+ arr[i+1]->set_vexpand();
+ else
+ arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
- if (yoptions & Gtk::EXPAND)
- arr[i+1]->set_vexpand();
- else
- arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
-
- table.attach(*arr[i+1], 1, r, 2, 1);
- }
- } else {
- arr[i+1]->set_hexpand();
-
- if (yoptions & Gtk::EXPAND)
- arr[i+1]->set_vexpand();
- else
- arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
-
- table.attach(*arr[i+1], 1, r, 2, 1);
- }
+ table.attach(*arr[i+1], 1, r, 2, 1);
} else if (arr[i]) {
Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*arr[i]);
@@ -307,48 +277,50 @@ void DocumentProperties::build_page()
_page_sizer.init();
+ _rcb_doc_props_left.set_border_width(4);
+ _rcb_doc_props_left.set_row_spacing(4);
+ _rcb_doc_props_left.set_column_spacing(4);
+ _rcb_doc_props_right.set_border_width(4);
+ _rcb_doc_props_right.set_row_spacing(4);
+ _rcb_doc_props_right.set_column_spacing(4);
+
Gtk::Widget *const widget_array[] =
{
label_gen, nullptr,
- nullptr, &_rum_deflt,
- //label_col, 0,
- //_rcp_bg._label, &_rcp_bg,
- nullptr, nullptr,
+ nullptr, &_rum_deflt,
+ nullptr, nullptr,
label_for, nullptr,
- nullptr, &_page_sizer,
- nullptr, nullptr,
+ nullptr, &_page_sizer,
+ nullptr, nullptr,
&_rcb_doc_props_left, &_rcb_doc_props_right,
};
+ attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array));
- attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1);
Gtk::Widget *const widget_array_left[] =
{
- label_bkg, nullptr,
- nullptr, &_rcb_checkerboard,
- nullptr, &_rcp_bg,
- label_dsp, nullptr,
- nullptr, &_rcb_antialias,
+ label_bkg, nullptr,
+ nullptr, &_rcb_checkerboard,
+ nullptr, &_rcp_bg,
+ label_dsp, nullptr,
+ nullptr, &_rcb_antialias,
};
+ attach_all(_rcb_doc_props_left, widget_array_left, G_N_ELEMENTS(widget_array_left));
- attach_all(_rcb_doc_props_left, widget_array_left, G_N_ELEMENTS(widget_array_left),0,1);
Gtk::Widget *const widget_array_right[] =
{
- label_bdr, nullptr,
- nullptr, &_rcb_canb,
- nullptr, &_rcb_bord,
- nullptr, &_rcb_shad,
- nullptr, &_rcp_bord,
+ label_bdr, nullptr,
+ nullptr, &_rcb_canb,
+ nullptr, &_rcb_bord,
+ nullptr, &_rcb_shad,
+ nullptr, &_rcp_bord,
};
-
- attach_all(_rcb_doc_props_right, widget_array_right, G_N_ELEMENTS(widget_array_right),0,1, true);
+ attach_all(_rcb_doc_props_right, widget_array_right, G_N_ELEMENTS(widget_array_right));
std::list<Gtk::Widget*> _slaveList;
_slaveList.push_back(&_rcb_bord);
_slaveList.push_back(&_rcb_shad);
_slaveList.push_back(&_rcp_bord);
_rcb_canb.setSlaveWidgets(_slaveList);
-
- attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1);
}
void DocumentProperties::build_guides()
@@ -358,18 +330,25 @@ void DocumentProperties::build_guides()
Gtk::Label *label_gui = Gtk::manage (new Gtk::Label);
label_gui->set_markup (_("<b>Guides</b>"));
+ _rcp_gui.set_hexpand();
+ _rcp_hgui.set_hexpand();
+ _rcb_sgui.set_hexpand();
+ auto inner = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 4));
+ inner->add(_rcb_sgui);
+ inner->add(_rcb_lgui);
+ inner->add(_rcp_gui);
+ inner->add(_rcp_hgui);
+ auto spacer = Gtk::manage(new Gtk::Label());
Gtk::Widget *const widget_array[] =
{
- label_gui, nullptr,
- nullptr, &_rcb_sgui,
- nullptr, &_rcb_lgui,
- nullptr, &_rcp_gui,
- nullptr, &_rcp_hgui,
- nullptr, &_create_guides_btn,
- nullptr, &_delete_guides_btn
+ label_gui, nullptr,
+ inner, spacer,
+ nullptr, nullptr,
+ nullptr, &_create_guides_btn,
+ nullptr, &_delete_guides_btn
};
-
attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array));
+ inner->set_hexpand(false);
_create_guides_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::create_guides_around_page));
_delete_guides_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::delete_all_guides));
@@ -388,24 +367,25 @@ void DocumentProperties::build_snap()
Gtk::Label *label_m = Gtk::manage (new Gtk::Label);
label_m->set_markup (_("<b>Miscellaneous</b>"));
+ auto spacer = Gtk::manage(new Gtk::Label());
+
Gtk::Widget *const array[] =
{
- label_o, nullptr,
- nullptr, _rsu_sno._vbox,
- nullptr, &_rcb_snclp,
- nullptr, &_rcb_snmsk,
- nullptr, nullptr,
- label_gr, nullptr,
- nullptr, _rsu_sn._vbox,
- nullptr, nullptr,
- label_gu, nullptr,
- nullptr, _rsu_gusn._vbox,
- nullptr, nullptr,
- label_m, nullptr,
- nullptr, &_rcb_perp,
- nullptr, &_rcb_tang
+ label_o, nullptr,
+ nullptr, _rsu_sno._vbox,
+ &_rcb_snclp, spacer,
+ nullptr, &_rcb_snmsk,
+ nullptr, nullptr,
+ label_gr, nullptr,
+ nullptr, _rsu_sn._vbox,
+ nullptr, nullptr,
+ label_gu, nullptr,
+ nullptr, _rsu_gusn._vbox,
+ nullptr, nullptr,
+ label_m, nullptr,
+ nullptr, &_rcb_perp,
+ nullptr, &_rcb_tang
};
-
attach_all(_page_snap->table(), array, G_N_ELEMENTS(array));
}
@@ -707,7 +687,6 @@ void DocumentProperties::build_cms()
_unlink_btn.set_tooltip_text(_("Unlink Profile"));
docprops_style_button(_unlink_btn, INKSCAPE_ICON("list-remove"));
- _page_cms->set_spacing(4);
gint row = 0;
label_link->set_hexpand();
@@ -801,9 +780,8 @@ void DocumentProperties::build_cms()
void DocumentProperties::build_scripting()
{
_page_scripting->show();
-
- _page_scripting->set_spacing (4);
- _page_scripting->pack_start(_scripting_notebook, true, true);
+
+ _page_scripting->table().attach(_scripting_notebook, 0, 0);
_scripting_notebook.append_page(*_page_external_scripts, _("External scripts"));
_scripting_notebook.append_page(*_page_embedded_scripts, _("Embedded scripts"));
@@ -819,7 +797,6 @@ void DocumentProperties::build_scripting()
_external_remove_btn.set_tooltip_text(_("Remove"));
docprops_style_button(_external_remove_btn, INKSCAPE_ICON("list-remove"));
- _page_external_scripts->set_spacing(4);
gint row = 0;
label_external->set_hexpand();
@@ -888,7 +865,6 @@ void DocumentProperties::build_scripting()
_embed_button_box.add(_embed_new_btn);
_embed_button_box.add(_embed_remove_btn);
- _page_embedded_scripts->set_spacing(4);
row = 0;
label_embedded->set_hexpand();
@@ -990,6 +966,7 @@ void DocumentProperties::build_scripting()
onExternalScriptSelectRow();
}
+// TODO: This duplicates code in document-metadata.cpp
void DocumentProperties::build_metadata()
{
using Inkscape::UI::Widget::EntityEntry;
@@ -1014,6 +991,7 @@ void DocumentProperties::build_metadata()
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1->table().attach(*space, 0, row, 1, 1);
+ w->_label.set_halign(Gtk::ALIGN_START);
w->_label.set_valign(Gtk::ALIGN_CENTER);
_page_metadata1->table().attach(w->_label, 1, row, 1, 1);
@@ -1402,6 +1380,7 @@ void DocumentProperties::build_gridspage()
_grids_space.set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
+ _grids_vbox.set_border_width(4);
_grids_vbox.set_spacing(4);
_grids_vbox.pack_start(_grids_label_crea, false, false);
_grids_vbox.pack_start(_grids_hbox_crea, false, false);
diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp
index dfbc01ddd..159669b24 100644
--- a/src/ui/widget/labelled.cpp
+++ b/src/ui/widget/labelled.cpp
@@ -24,7 +24,7 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip,
Glib::ustring const &icon,
bool mnemonic)
: _widget(widget),
- _label(new Gtk::Label(label, Gtk::ALIGN_END, Gtk::ALIGN_CENTER, mnemonic)),
+ _label(new Gtk::Label(label, Gtk::ALIGN_START, Gtk::ALIGN_CENTER, mnemonic)),
_suffix(new Gtk::Label(suffix, Gtk::ALIGN_START))
{
g_assert(g_utf8_validate(icon.c_str(), -1, nullptr));
@@ -32,7 +32,7 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip,
_icon = Gtk::manage(sp_get_icon_image(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR));
pack_start(*_icon, Gtk::PACK_SHRINK);
}
- pack_start(*Gtk::manage(_label), Gtk::PACK_EXPAND_WIDGET, 6);
+ pack_start(*Gtk::manage(_label), Gtk::PACK_SHRINK, 6);
pack_start(*Gtk::manage(_widget), Gtk::PACK_SHRINK, 6);
if (mnemonic) {
_label->set_mnemonic_widget(*_widget);
@@ -79,6 +79,18 @@ bool Labelled::on_mnemonic_activate ( bool group_cycling )
return _widget->mnemonic_activate ( group_cycling );
}
+void
+Labelled::set_hexpand(bool expand)
+{
+ if (expand) {
+ child_property_pack_type(*_widget) = Gtk::PACK_END;
+ } else {
+ child_property_pack_type(*_widget) = Gtk::PACK_START;
+ }
+
+ Gtk::HBox::set_hexpand(expand);
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h
index 01fe86072..4620b1ac7 100644
--- a/src/ui/widget/labelled.h
+++ b/src/ui/widget/labelled.h
@@ -58,6 +58,8 @@ public:
void setLabelText(const Glib::ustring &str);
void setTooltipText(const Glib::ustring &tooltip);
+ void set_hexpand(bool expand = true);
+
private:
bool on_mnemonic_activate( bool group_cycling ) override;
diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp
index 894b290fe..a189d7826 100644
--- a/src/ui/widget/notebook-page.cpp
+++ b/src/ui/widget/notebook-page.cpp
@@ -22,10 +22,11 @@ NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, gu
:_table(Gtk::manage(new Gtk::Grid()))
{
set_name("NotebookPage");
- set_border_width(2);
+ set_border_width(4);
+ set_spacing(4);
- _table->set_row_spacing(2);
- _table->set_column_spacing(2);
+ _table->set_row_spacing(4);
+ _table->set_column_spacing(4);
pack_start(*_table, expand, fill, padding);
}
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index df6af9626..5a7a2edb2 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -46,7 +46,7 @@ PageSizer::PageSizer(Registry & _wr)
_dimensionHeight( _("_Height:"), _("Height of paper"), "height", _dimensionUnits, _wr ),
_marginLock( _("Loc_k margins"), _("Lock margins"), "lock-margins", _wr, false, nullptr, nullptr),
_lock_icon(),
- _marginTop( _("T_op margin:"), _("Top margin"), "fit-margin-top", _wr ),
+ _marginTop( _("T_op:"), _("Top margin"), "fit-margin-top", _wr ),
_marginLeft( _("L_eft:"), _("Left margin"), "fit-margin-left", _wr),
_marginRight( _("Ri_ght:"), _("Right margin"), "fit-margin-right", _wr),
_marginBottom( _("Botto_m:"), _("Bottom margin"), "fit-margin-bottom", _wr),
@@ -71,18 +71,18 @@ PageSizer::PageSizer(Registry & _wr)
_marginBottom.setDigits(5);
_scaleX.setDigits(5);
_scaleY.setDigits(5);
- _viewboxX.setDigits(2);
- _viewboxY.setDigits(2);
- _viewboxW.setDigits(2);
- _viewboxH.setDigits(2);
+ _viewboxX.setDigits(5);
+ _viewboxY.setDigits(5);
+ _viewboxW.setDigits(5);
+ _viewboxH.setDigits(5);
_dimensionWidth.setRange( 0.00001, 10000000 );
_dimensionHeight.setRange( 0.00001, 10000000 );
_scaleX.setRange( 0.00001, 100000 );
_scaleY.setRange( 0.00001, 100000 );
- _viewboxX.setRange( -100000, 100000 );
- _viewboxY.setRange( -100000, 100000 );
- _viewboxW.setRange( 0.01, 200000 );
- _viewboxH.setRange( 0.01, 200000 );
+ _viewboxX.setRange( -10000000, 10000000 );
+ _viewboxY.setRange( -10000000, 10000000 );
+ _viewboxW.setRange( 0.00001, 10000000 );
+ _viewboxH.setRange( 0.00001, 10000000 );
_scaleY.set_sensitive (false); // We only want to display Y scale.
@@ -112,10 +112,10 @@ PageSizer::PageSizer(Registry & _wr)
g_warning("%s", _("Failed to create the page file."));
}
}
-
+
gchar *content = nullptr;
if (g_file_get_contents(path, &content, nullptr, nullptr)) {
-
+
gchar **lines = g_strsplit_set(content, "\n", 0);
for (int i = 0; lines && lines[i]; ++i) {
@@ -170,7 +170,7 @@ PageSizer::PageSizer(Registry & _wr)
_dimensionUnits.setUnit(nv->display_units->abbr);
}
_wr.setUpdating (false);
-
+
//## Set up custom size frame
_customFrame.set_label(_("Custom size"));
@@ -178,126 +178,103 @@ PageSizer::PageSizer(Registry & _wr)
_customFrame.add(_customDimTable);
_customDimTable.set_border_width(4);
-
_customDimTable.set_row_spacing(4);
_customDimTable.set_column_spacing(4);
- _dimensionWidth.set_hexpand();
- _dimensionWidth.set_vexpand();
+ _dimensionHeight.set_halign(Gtk::ALIGN_CENTER);
+ _dimensionUnits.set_halign(Gtk::ALIGN_END);
_customDimTable.attach(_dimensionWidth, 0, 0, 1, 1);
+ _customDimTable.attach(_dimensionHeight, 1, 0, 1, 1);
+ _customDimTable.attach(_dimensionUnits, 2, 0, 1, 1);
- _dimensionUnits.set_hexpand();
- _dimensionUnits.set_vexpand();
- _customDimTable.attach(_dimensionUnits, 1, 0, 1, 1);
+ _customDimTable.attach(_fitPageMarginExpander, 0, 1, 3, 1);
- _dimensionHeight.set_hexpand();
- _dimensionHeight.set_vexpand();
- _customDimTable.attach(_dimensionHeight, 0, 1, 1, 1);
-
- _fitPageMarginExpander.set_hexpand();
- _fitPageMarginExpander.set_vexpand();
- _customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1);
-
_dimTabOrderList.clear();
_dimTabOrderList.push_back(&_dimensionWidth);
_dimTabOrderList.push_back(&_dimensionHeight);
_dimTabOrderList.push_back(&_dimensionUnits);
_dimTabOrderList.push_back(&_fitPageMarginExpander);
- _customDimTable.set_focus_chain(_dimTabOrderList);
+ _customDimTable.set_focus_chain(_dimTabOrderList);
//## Set up fit page expander
_fitPageMarginExpander.set_use_underline();
_fitPageMarginExpander.set_label(_("Resi_ze page to content..."));
_fitPageMarginExpander.add(_marginTable);
-
- //## Set up margin settings
+
_marginTable.set_border_width(4);
_marginTable.set_row_spacing(4);
_marginTable.set_column_spacing(4);
- _marginTop.set_halign(Gtk::ALIGN_CENTER);
- _marginTop.set_hexpand();
- _marginTop.set_vexpand();
-
- _marginTable.attach(_marginTop, 0, 0, 3, 1);
-
- _marginLeft.set_halign(Gtk::ALIGN_CENTER);
- _marginLeft.set_hexpand();
- _marginLeft.set_vexpand();
- _marginTable.attach(_marginLeft, 0, 1, 1, 1);
-
- _marginLock.set_active(false);
- _marginLock.set_halign(Gtk::ALIGN_CENTER);
- _marginLock.set_hexpand();
- _marginLock.set_vexpand();
+ //### margin label and lock button
+ _marginLabel.set_markup(Glib::ustring("<b><i>") + _("Margins") + "</i></b>");
+ _marginLabel.set_halign(Gtk::ALIGN_CENTER);
- //_lock_icon = new Gtk::Image();
- _lock_icon.set_halign(Gtk::ALIGN_CENTER);
- _lock_icon.set_valign(Gtk::ALIGN_START);
_lock_icon.set_from_icon_name("object-unlocked", Gtk::ICON_SIZE_LARGE_TOOLBAR);
- _lock_icon.show();
+ _lock_icon.show();
+ _marginLock.set_active(false);
_marginLock.add(_lock_icon);
- _marginTable.attach(_marginLock, 1, 1, 1, 1);
-
- _marginRight.set_halign(Gtk::ALIGN_CENTER);
- _marginRight.set_hexpand();
- _marginRight.set_vexpand();
- _marginTable.attach(_marginRight, 2, 1, 1, 1);
-
+ _marginBox.set_spacing(4);
+ _marginBox.add(_marginLabel);
+ _marginBox.add(_marginLock);
+ _marginBox.set_halign(Gtk::ALIGN_CENTER);
+ _marginTable.attach(_marginBox, 1, 1, 1, 1);
+
+ //### margins
+ _marginTop.set_halign(Gtk::ALIGN_CENTER);
+ _marginLeft.set_halign(Gtk::ALIGN_START);
+ _marginRight.set_halign(Gtk::ALIGN_END);
_marginBottom.set_halign(Gtk::ALIGN_CENTER);
- _marginBottom.set_hexpand();
- _marginBottom.set_vexpand();
- _marginTable.attach(_marginBottom, 0, 2, 3, 1);
- _fitPageButton.set_halign(Gtk::ALIGN_CENTER);
- _fitPageButton.set_hexpand();
- _fitPageButton.set_vexpand();
- _marginTable.attach(_fitPageButton, 0, 3, 3, 1);
-
+ _marginTable.attach(_marginTop, 0, 0, 3, 1);
+ _marginTable.attach(_marginLeft, 0, 1, 1, 1);
+ _marginTable.attach(_marginRight, 2, 1, 1, 1);
+ _marginTable.attach(_marginBottom, 0, 2, 3, 1);
+
+ //### fit page to drawing button
_fitPageButton.set_use_underline();
_fitPageButton.set_label(_("_Resize page to drawing or selection (Ctrl+Shift+R)"));
_fitPageButton.set_tooltip_text(_("Resize the page to fit the current selection, or the entire drawing if there is no selection"));
+ _fitPageButton.set_hexpand();
+ _fitPageButton.set_halign(Gtk::ALIGN_CENTER);
+ _marginTable.attach(_fitPageButton, 0, 3, 3, 1);
+
+
+ //## Set up scale frame
_scaleFrame.set_label(_("Scale"));
pack_start (_scaleFrame, false, false, 0);
_scaleFrame.add(_scaleTable);
_scaleTable.set_border_width(4);
-
_scaleTable.set_row_spacing(4);
_scaleTable.set_column_spacing(4);
- _scaleTable.attach(_scaleX, 0, 0, 1, 1);
- _scaleTable.attach(_scaleY, 1, 0, 1, 1);
+ _scaleTable.attach(_scaleX, 0, 0, 1, 1);
+ _scaleTable.attach(_scaleY, 1, 0, 1, 1);
+ _scaleTable.attach(_scaleLabel, 2, 0, 1, 1);
- _scaleTable.attach(_scaleLabel, 2, 0, 1, 1);
_viewboxExpander.set_hexpand();
- _viewboxExpander.set_vexpand();
- _scaleTable.attach(_viewboxExpander, 0, 2, 2, 1);
+ _scaleTable.attach(_viewboxExpander, 0, 2, 3, 1);
_viewboxExpander.set_use_underline();
_viewboxExpander.set_label(_("_Viewbox..."));
_viewboxExpander.add(_viewboxTable);
- _viewboxTable.set_row_spacing(2);
- _viewboxTable.set_column_spacing(2);
+ _viewboxTable.set_border_width(4);
+ _viewboxTable.set_row_spacing(4);
+ _viewboxTable.set_column_spacing(4);
- _viewboxX.set_hexpand();
- _viewboxX.set_vexpand();
+ _viewboxX.set_halign(Gtk::ALIGN_END);
+ _viewboxY.set_halign(Gtk::ALIGN_END);
+ _viewboxW.set_halign(Gtk::ALIGN_END);
+ _viewboxH.set_halign(Gtk::ALIGN_END);
+ _viewboxSpacer.set_hexpand();
_viewboxTable.attach(_viewboxX, 0, 0, 1, 1);
-
- _viewboxY.set_hexpand();
- _viewboxY.set_vexpand();
_viewboxTable.attach(_viewboxY, 1, 0, 1, 1);
-
- _viewboxW.set_hexpand();
- _viewboxW.set_vexpand();
_viewboxTable.attach(_viewboxW, 0, 1, 1, 1);
-
- _viewboxH.set_hexpand();
- _viewboxH.set_vexpand();
_viewboxTable.attach(_viewboxH, 1, 1, 1, 1);
+ _viewboxTable.attach(_viewboxSpacer, 2, 0, 3, 1);
_wr.setUpdating (true);
updateScaleUI();
@@ -416,7 +393,7 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool
* Updates the scalar widgets for the fit margins. (Just changes the value
* of the ui widgets to match the xml).
*/
-void
+void
PageSizer::updateFitMarginsUI(Inkscape::XML::Node *nv_repr)
{
if (!_lockMarginUpdate) {
@@ -494,7 +471,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing()
SPDocument *doc;
SPNamedView *nv;
Inkscape::XML::Node *nv_repr;
-
+
if ((doc = SP_ACTIVE_DESKTOP->getDocument())
&& (nv = sp_document_namedview(doc, nullptr))
&& (nv_repr = nv->getRepr())) {
@@ -654,7 +631,7 @@ PageSizer::updateScaleUI()
_viewboxW.setValue( viewBox.width() );
_viewboxH.setValue( viewBox.height() );
}
-
+
} else {
// Should never happen
std::cerr << "PageSizer::updateScaleUI(): No active desktop." << std::endl;
@@ -780,7 +757,7 @@ PageSizer::on_margin_lock_changed()
void
PageSizer::on_margin_changed(RegisteredScalar* widg)
{
- double value = widg->getValue();
+ double value = widg->getValue();
if (_widgetRegistry->isUpdating()) return;
if (_marginLock.get_active() && !_lockMarginUpdate) {
_lockMarginUpdate = true;
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index 1d1d605d6..54ffb9c73 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -230,6 +230,8 @@ protected:
Gtk::Expander _fitPageMarginExpander;
Gtk::Grid _marginTable;
+ Gtk::Box _marginBox;
+ Gtk::Label _marginLabel;
RegisteredToggleButton _marginLock;
Gtk::Image _lock_icon;
RegisteredScalar _marginTop;
@@ -256,6 +258,7 @@ protected:
RegisteredScalar _viewboxY;
RegisteredScalar _viewboxW;
RegisteredScalar _viewboxH;
+ Gtk::Box _viewboxSpacer;
bool _lockViewboxUpdate;
//callback
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index 84b850312..c651435f8 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -149,7 +149,7 @@ private:
class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> {
public:
~RegisteredCheckButton() override;
- RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *active_str = "true", char const *inactive_str = "false");
+ RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=false, Inkscape::XML::Node* repr_in=nullptr, SPDocument *doc_in=nullptr, char const *active_str = "true", char const *inactive_str = "false");
void setActive (bool);