diff options
| author | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-04-01 06:19:32 +0000 |
|---|---|---|
| committer | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-04-02 08:55:59 +0000 |
| commit | 5929a0b1cdb9eeb176c7bbb84d3a8e30fdd38900 (patch) | |
| tree | 080ba96c2c79d58a755f1f6b9eb9bce45bbb17b4 /src/ui | |
| parent | Tidy UI for Object Properties/Attributes (diff) | |
| download | inkscape-5929a0b1cdb9eeb176c7bbb84d3a8e30fdd38900.tar.gz inkscape-5929a0b1cdb9eeb176c7bbb84d3a8e30fdd38900.zip | |
Realign and reorder guides UI
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/guides.cpp | 26 | ||||
| -rw-r--r-- | src/ui/widget/labelled.cpp | 22 | ||||
| -rw-r--r-- | src/ui/widget/scalar-unit.cpp | 7 |
3 files changed, 46 insertions, 9 deletions
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index cef214f5a..241448898 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -24,6 +24,8 @@ #include "message-context.h" #include "verbs.h" +#include "include/gtkmm_version.h" + #include "object/sp-guide.h" #include "object/sp-namedview.h" @@ -127,6 +129,7 @@ void GuidelinePropertiesDialog::_onOK() const auto c = _color.get_rgba(); unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257; //TODO: why 257? verify this! + // don't know why, but introduced: 761f7da58cd6d625b88c24eee6fae1b7fa3bfcdd _guide->set_color(r, g, b, true); @@ -172,13 +175,14 @@ void GuidelinePropertiesDialog::_response(gint response) void GuidelinePropertiesDialog::_setup() { set_title(_("Guideline")); add_button(_("_OK"), Gtk::RESPONSE_OK); - add_button(_("_Delete"), -12); add_button(_("_Duplicate"), -13); + add_button(_("_Delete"), -12); add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); _layout_table.set_column_spacing(4); + _layout_table.set_border_width(4); mainVBox->pack_start(_layout_table, false, false, 0); @@ -206,6 +210,11 @@ void GuidelinePropertiesDialog::_setup() { _color.set_halign(Gtk::ALIGN_FILL); _color.set_valign(Gtk::ALIGN_FILL); _color.set_hexpand(); +#if GTKMM_CHECK_VERSION(3,12,0) + _color.set_margin_end(6); +#else + _color.set_margin_right(6); +#endif _layout_table.attach(_color, 1, 3, 2, 1); // unitmenus @@ -237,6 +246,11 @@ void GuidelinePropertiesDialog::_setup() { _unit_menu.set_halign(Gtk::ALIGN_FILL); _unit_menu.set_valign(Gtk::ALIGN_FILL); +#if GTKMM_CHECK_VERSION(3,12,0) + _unit_menu.set_margin_end(6); +#else + _unit_menu.set_margin_right(6); +#endif _layout_table.attach(_unit_menu, 2, 4, 1, 1); // angle spinbutton @@ -253,12 +267,22 @@ void GuidelinePropertiesDialog::_setup() { _relative_toggle.set_halign(Gtk::ALIGN_FILL); _relative_toggle.set_valign(Gtk::ALIGN_FILL); _relative_toggle.set_hexpand(); +#if GTKMM_CHECK_VERSION(3,12,0) + _relative_toggle.set_margin_start(6); +#else + _relative_toggle.set_margin_left(6); +#endif _layout_table.attach(_relative_toggle, 1, 7, 2, 1); // locked radio button _locked_toggle.set_halign(Gtk::ALIGN_FILL); _locked_toggle.set_valign(Gtk::ALIGN_FILL); _locked_toggle.set_hexpand(); +#if GTKMM_CHECK_VERSION(3,12,0) + _locked_toggle.set_margin_start(6); +#else + _locked_toggle.set_margin_left(6); +#endif _layout_table.attach(_locked_toggle, 1, 8, 2, 1); _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 159669b24..83d2684aa 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -32,8 +32,18 @@ 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_SHRINK, 6); - pack_start(*Gtk::manage(_widget), Gtk::PACK_SHRINK, 6); + + set_spacing(6); + // Setting margins separately allows for more control over them +#if GTK_CHECK_VERSION(3,12,0) + set_margin_start(6); + set_margin_end(6); +#else + set_margin_left(6); + set_margin_right(6); +#endif + pack_start(*Gtk::manage(_label), Gtk::PACK_SHRINK); + pack_start(*Gtk::manage(_widget), Gtk::PACK_SHRINK); if (mnemonic) { _label->set_mnemonic_widget(*_widget); } @@ -82,11 +92,9 @@ bool Labelled::on_mnemonic_activate ( bool 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; - } + // should only have 2 children, but second child may not be _widget + child_property_pack_type(*get_children().back()) = expand ? Gtk::PACK_END + : Gtk::PACK_START; Gtk::HBox::set_hexpand(expand); } diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index d9acd375b..2b6d001a9 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -35,7 +35,12 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, _unit_menu = new UnitMenu(); g_assert(_unit_menu); _unit_menu->setUnitType(unit_type); - pack_start(*Gtk::manage(_unit_menu), false, false, 4); + + remove(*_widget); + Gtk::Box *widget_holder = new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 6); + widget_holder->pack_start(*_widget, Gtk::PACK_SHRINK); + widget_holder->pack_start(*Gtk::manage(_unit_menu), Gtk::PACK_SHRINK); + pack_start(*Gtk::manage(widget_holder), Gtk::PACK_SHRINK); } _unit_menu->signal_changed() .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); |
