summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-03-22 17:29:31 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-03-22 17:37:50 +0000
commitbe9fbab855fe865828a141042a158bbb0c456a72 (patch)
tree8b5d41f3f0c622fd462b5ebfbb708912f22755a6 /src/ui/widget
parentSync upstream libUEMF (0.2.6) (diff)
downloadinkscape-be9fbab855fe865828a141042a158bbb0c456a72.tar.gz
inkscape-be9fbab855fe865828a141042a158bbb0c456a72.zip
Document Properties: General UI cleanup
Try to achieve consistent look and reasonable alignment. Account for some gtk3 changes and some minor code cleanup.
Diffstat (limited to 'src/ui/widget')
-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
6 files changed, 87 insertions, 92 deletions
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);