From b6c589d017483131f599764f65b1c48f950d6c61 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sat, 4 May 2019 17:42:32 +0200 Subject: Styling fixes and remove a crash --- src/ui/widget/ink-flow-box.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index d102ceb6c..c753a41da 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -28,6 +28,7 @@ InkFlowBox::InkFlowBox(const gchar *name) _flowbox.set_activate_on_single_click(true); Gtk::ToggleButton *tbutton = new Gtk::ToggleButton("", false); tbutton->set_always_show_image(true); + _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; -- cgit v1.2.3 From 1dcbdd9b9d6f1db457878515fe041bf360ead042 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 29 May 2019 15:44:16 +0200 Subject: Add CSS and remove XML toggler button --- src/ui/widget/ink-flow-box.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index c753a41da..5b108ebb6 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -30,7 +30,7 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_always_show_image(true); _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); + tbutton->set_active(true);// commented for furter use prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; if (tbutton->get_active()) { iconname = "object-locked"; @@ -38,8 +38,8 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_image(*sp_get_icon_image(iconname, Gtk::ICON_SIZE_MENU)); tbutton->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &InkFlowBox::on_global_toggle), tbutton)); - _controller.pack_start(*tbutton); - tbutton->show(); + //_controller.pack_start(*tbutton); + //tbutton->show(); showing = 0; sensitive = true; } -- cgit v1.2.3 From 4ee33795749b46cd4e0b8c84ab336b7cb8d18faa Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 29 May 2019 15:46:40 +0200 Subject: fix coding style --- src/ui/widget/ink-flow-box.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index 5b108ebb6..6b2530429 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -30,7 +30,8 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_always_show_image(true); _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - tbutton->set_active(true);// commented for furter use prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); + tbutton->set_active(true); // commented for furter use prefs->getBool(Glib::ustring("/dialogs/") + get_name() + + // Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; if (tbutton->get_active()) { iconname = "object-locked"; @@ -39,7 +40,7 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &InkFlowBox::on_global_toggle), tbutton)); //_controller.pack_start(*tbutton); - //tbutton->show(); + // tbutton->show(); showing = 0; sensitive = true; } -- cgit v1.2.3 From dbc354261d4cdb3f8431d15a45c092ed608ad246 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 29 May 2019 15:56:34 +0200 Subject: Remove lock button from XML dialog --- src/ui/widget/ink-flow-box.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index 6b2530429..728d720a3 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -30,8 +30,10 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_always_show_image(true); _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - tbutton->set_active(true); // commented for furter use prefs->getBool(Glib::ustring("/dialogs/") + get_name() + - // Glib::ustring("/flowbox/lock"), true)); + prefs->setBool(Glib::ustring("/dialogs/") + get_name() + + Glib::ustring("/flowbox/lock"), false); + tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + + Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; if (tbutton->get_active()) { iconname = "object-locked"; @@ -39,8 +41,9 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_image(*sp_get_icon_image(iconname, Gtk::ICON_SIZE_MENU)); tbutton->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &InkFlowBox::on_global_toggle), tbutton)); - //_controller.pack_start(*tbutton); - // tbutton->show(); + _controller.pack_start(*tbutton); + tbutton->hide(); + tbutton->set_no_show_all(true); showing = 0; sensitive = true; } -- cgit v1.2.3 From e8cc89a8433af94c38db86f765565e912cc878c7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 2 Jun 2019 12:20:33 +0200 Subject: Fixing coding style --- src/ui/widget/ink-flow-box.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp index 728d720a3..8485dd932 100644 --- a/src/ui/widget/ink-flow-box.cpp +++ b/src/ui/widget/ink-flow-box.cpp @@ -30,10 +30,8 @@ InkFlowBox::InkFlowBox(const gchar *name) tbutton->set_always_show_image(true); _flowbox.set_selection_mode(Gtk::SelectionMode::SELECTION_NONE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(Glib::ustring("/dialogs/") + get_name() + - Glib::ustring("/flowbox/lock"), false); - tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + - Glib::ustring("/flowbox/lock"), true)); + prefs->setBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), false); + tbutton->set_active(prefs->getBool(Glib::ustring("/dialogs/") + get_name() + Glib::ustring("/flowbox/lock"), true)); Glib::ustring iconname = "object-unlocked"; if (tbutton->get_active()) { iconname = "object-locked"; -- cgit v1.2.3 From aa524ec6b3e87ba1fadb6b293802fdd7b36646a4 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 5 Jun 2019 20:45:28 +0200 Subject: Use a flowbox when there are more than two options for font feature settings. Improves display of options. --- src/ui/widget/font-variants.cpp | 95 ++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 40 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index b4f991863..b81f809b2 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -35,12 +35,31 @@ namespace Widget { { Gtk::Label* table_name = Gtk::manage (new Gtk::Label()); table_name->set_markup ("\"" + name + "\" "); + grid.attach (*table_name, 0, row, 1, 1); + Gtk::FlowBox* flow_box = nullptr; + Gtk::ScrolledWindow* scrolled_window = nullptr; + if (options > 2) { + // If there are more than 2 option, pack them into a flowbox instead of directly putting them in the grid. + // Some fonts might have a table with many options (Bungee Hairline table 'ornm' has 113 entries). + flow_box = Gtk::manage (new Gtk::FlowBox()); + flow_box->set_selection_mode(); // Turn off selection + flow_box->set_homogeneous(); + flow_box->set_max_children_per_line (100); // Override default value + flow_box->set_min_children_per_line (10); // Override default value + + // We pack this into a scrollbar... otherwise the minimum height is set to what is required to fit all + // flow box children into the flow box when the flow box has minimum width. (Crazy if you ask me!) + scrolled_window = Gtk::manage (new Gtk::ScrolledWindow()); + scrolled_window->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + scrolled_window->add(*flow_box); + } + Gtk::RadioButton::Group group; for (int i = 0; i < options; ++i) { - int col = i%10; // Some fonts might have a table with many options (Bungee Hairline table 'ornm' has 113 entries). - if (i > 10 && col == 0) row++; + + // Create radio button and create or add to button group. Gtk::RadioButton* button = Gtk::manage (new Gtk::RadioButton()); if (i == 0) { group = button->get_group(); @@ -48,9 +67,9 @@ namespace Widget { button->set_group (group); } button->signal_clicked().connect ( sigc::mem_fun(*parent, &FontVariants::feature_callback) ); - grid.attach (*button, 2*col+1, row, 1, 1); buttons.push_back (button); + // Create label. Gtk::Label* label = Gtk::manage (new Gtk::Label()); // Restrict label width (some fonts have lots of alternatives). @@ -58,6 +77,7 @@ namespace Widget { label->set_line_wrap_mode( Pango::WRAP_WORD_CHAR ); label->set_ellipsize( Pango::ELLIPSIZE_END ); label->set_lines(3); + label->set_hexpand(); Glib::ustring markup; markup += "