From c58c848684c4d1d58e59ca0d8112530bc451175c Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 27 Sep 2012 11:58:05 +0900 Subject: Fix for 171177 : Border in palette swatches (bzr r11706) --- src/ui/widget/panel.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 11 deletions(-) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index a1ae6a36d..1f945ada6 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -42,7 +42,8 @@ static const int PANEL_SETTING_SIZE = 0; static const int PANEL_SETTING_MODE = 1; static const int PANEL_SETTING_SHAPE = 2; static const int PANEL_SETTING_WRAP = 3; -static const int PANEL_SETTING_NEXTFREE = 4; +static const int PANEL_SETTING_BORDER = 4; +static const int PANEL_SETTING_NEXTFREE = 5; void Panel::prep() { @@ -93,7 +94,7 @@ void Panel::_init() Glib::ustring tmp("<"); _anchor = SP_ANCHOR_CENTER; - guint panel_size = 0, panel_mode = 0, panel_ratio = 100; + guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0; bool panel_wrap = 0; if (!_prefs_path.empty()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -101,6 +102,7 @@ void Panel::_init() panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE); panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10); panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 100, 0, 500 ); + panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 ); } _menu = new Gtk::Menu(); @@ -197,6 +199,42 @@ void Panel::_init() } } + { + Glib::ustring widthItemLabel(C_("Swatches", "Border")); + + //TRANSLATORS: Indicates border of colour swatches + const gchar *widthLabels[] = { + NC_("Swatches border", "None"), + NC_("Swatches border", "Solid"), + NC_("Swatches border", "Wide"), + }; + + Gtk::MenuItem *item = manage( new Gtk::MenuItem(widthItemLabel)); + Gtk::Menu *type_menu = manage(new Gtk::Menu()); + item->set_submenu(*type_menu); + _menu->append(*item); + + Gtk::RadioMenuItem::Group widthGroup; + + guint values[] = {0, 1, 2}; + guint hot_index = 0; + for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { + // Assume all values are in increasing order + if ( values[i] <= panel_border ) { + hot_index = i; + } + } + for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { + Glib::ustring _label(g_dpgettext2(NULL, "Swatches border", widthLabels[i])); + Gtk::RadioMenuItem *_item = manage(new Gtk::RadioMenuItem(widthGroup, _label)); + type_menu->append(*_item); + if ( i <= hot_index ) { + _item->set_active(true); + } + _item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_BORDER, values[i])); + } + } + { //TRANSLATORS: "Wrap" indicates how colour swatches are displayed Glib::ustring wrap_label(C_("Swatches","Wrap")); @@ -259,6 +297,7 @@ void Panel::_init() _bounceCall(PANEL_SETTING_MODE, panel_mode); _bounceCall(PANEL_SETTING_SHAPE, panel_ratio); _bounceCall(PANEL_SETTING_WRAP, panel_wrap); + _bounceCall(PANEL_SETTING_BORDER, panel_border); } void Panel::setLabel(Glib::ustring const &label) @@ -323,7 +362,7 @@ void Panel::present() void Panel::restorePanelPrefs() { - guint panel_size = 0, panel_mode = 0, panel_ratio = 100; + guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0; bool panel_wrap = 0; if (!_prefs_path.empty()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -331,11 +370,13 @@ void Panel::restorePanelPrefs() panel_size = prefs->getIntLimited(_prefs_path + "/panel_size", 1, 0, PREVIEW_SIZE_HUGE); panel_mode = prefs->getIntLimited(_prefs_path + "/panel_mode", 1, 0, 10); panel_ratio = prefs->getIntLimited(_prefs_path + "/panel_ratio", 000, 0, 500 ); + panel_border = prefs->getIntLimited(_prefs_path + "/panel_border", BORDER_NONE, 0, 2 ); } _bounceCall(PANEL_SETTING_SIZE, panel_size); _bounceCall(PANEL_SETTING_MODE, panel_mode); _bounceCall(PANEL_SETTING_SHAPE, panel_ratio); _bounceCall(PANEL_SETTING_WRAP, panel_wrap); + _bounceCall(PANEL_SETTING_BORDER, panel_border); } sigc::signal &Panel::signalResponse() @@ -360,30 +401,32 @@ void Panel::_bounceCall(int i, int j) if (_fillable) { ViewType curr_type = _fillable->getPreviewType(); guint curr_ratio = _fillable->getPreviewRatio(); + ::BorderStyle curr_border = _fillable->getPreviewBorder(); + switch (j) { case 0: { - _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type, curr_ratio); + _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type, curr_ratio, curr_border); } break; case 1: { - _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type, curr_ratio); + _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type, curr_ratio, curr_border); } break; case 2: { - _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type, curr_ratio); + _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type, curr_ratio, curr_border); } break; case 3: { - _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type, curr_ratio); + _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type, curr_ratio, curr_border); } break; case 4: { - _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type, curr_ratio); + _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type, curr_ratio, curr_border); } break; default: @@ -399,15 +442,16 @@ void Panel::_bounceCall(int i, int j) if (_fillable) { ::PreviewSize curr_size = _fillable->getPreviewSize(); guint curr_ratio = _fillable->getPreviewRatio(); + ::BorderStyle curr_border = _fillable->getPreviewBorder(); switch (j) { case 0: { - _fillable->setStyle(curr_size, VIEW_TYPE_LIST, curr_ratio); + _fillable->setStyle(curr_size, VIEW_TYPE_LIST, curr_ratio, curr_border); } break; case 1: { - _fillable->setStyle(curr_size, VIEW_TYPE_GRID, curr_ratio); + _fillable->setStyle(curr_size, VIEW_TYPE_GRID, curr_ratio, curr_border); } break; default: @@ -423,7 +467,40 @@ void Panel::_bounceCall(int i, int j) if ( _fillable ) { ViewType curr_type = _fillable->getPreviewType(); ::PreviewSize curr_size = _fillable->getPreviewSize(); - _fillable->setStyle(curr_size, curr_type, j); + ::BorderStyle curr_border = _fillable->getPreviewBorder(); + + _fillable->setStyle(curr_size, curr_type, j, curr_border); + } + break; + case PANEL_SETTING_BORDER: + if (!_prefs_path.empty()) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(_prefs_path + "/panel_border", j); + } + if ( _fillable ) { + ::PreviewSize curr_size = _fillable->getPreviewSize(); + ViewType curr_type = _fillable->getPreviewType(); + guint curr_ratio = _fillable->getPreviewRatio(); + + switch (j) { + case 0: + { + _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_NONE); + } + break; + case 1: + { + _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_SOLID); + } + break; + case 2: + { + _fillable->setStyle(curr_size, curr_type, curr_ratio, BORDER_WIDE); + } + break; + default: + break; + } } break; case PANEL_SETTING_WRAP: -- cgit v1.2.3 From 51a9de94671f1f7ee1cf2a57ef5dfde94b4a802b Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 30 Sep 2012 14:01:21 +0900 Subject: Fix for 1058470 : Trace Bitmap Live Preview (bzr r11716) --- src/ui/widget/panel.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 1f945ada6..42435f298 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -572,21 +572,21 @@ void Panel::_apply() g_warning("Apply button clicked for panel [Panel::_apply()]"); } -Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id) +Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(button_text); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id) +Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(stock_id); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -void Panel::_addResponseButton(Gtk::Button *button, int response_id) +void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_start) { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { @@ -597,6 +597,10 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id) _action_area->pack_end(*button); + if (pack_start) { + _action_area->set_child_secondary( *button , true); + } + if (response_id != 0) { // Re-emit clicked signals as response signals button->signal_clicked().connect(sigc::bind(_signal_response.make_slot(), response_id)); -- cgit v1.2.3 From c2901751674aaf09964bb3d2c0e08de5aefdcd2c Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 8 Oct 2012 20:52:24 +0900 Subject: Fix for 1060563 : Swatches : Sort the list of swatch names (bzr r11757) --- src/ui/widget/panel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 42435f298..dcf5956bf 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -560,6 +560,7 @@ void Panel::_regItem(Gtk::MenuItem* item, int group, int id) _menu->append(*item); item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &Panel::_bounceCall), group + PANEL_SETTING_NEXTFREE, id)); item->show(); + } void Panel::_handleAction(int /*set_id*/, int /*item_id*/) -- cgit v1.2.3 From ded9e1f5728b8fd32586e7d28c962526bba23d26 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 16 Dec 2012 12:49:16 +0000 Subject: GTK+ 3: Use orientable widgets (bzr r11959) --- src/ui/widget/panel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index dcf5956bf..48749fda2 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -591,7 +591,13 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { +#if WITH_GTKMM_3_0 + _action_area = new Gtk::ButtonBox(); + _action_area->set_layout(Gtk::BUTTONBOX_END); + _action_area->set_spacing(6); +#else _action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6); +#endif _action_area->set_border_width(4); pack_end(*_action_area, Gtk::PACK_SHRINK, 0); } -- cgit v1.2.3 From 0cdd007ebf8dcfbd39c1d36ab53f43617eb692df Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 25 Mar 2013 17:42:31 +0000 Subject: Workaround usage of deprecated glib symbols in 3rd party libraries Fixed bugs: - https://launchpad.net/bugs/1122774 (bzr r12243) --- src/ui/widget/panel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 48749fda2..7eb114d0a 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -15,8 +15,6 @@ # include #endif -#include - #include // for Gtk::RESPONSE_* #include #include @@ -24,6 +22,8 @@ #include #include +#include + #include #include "panel.h" -- cgit v1.2.3 From 3c82e8251460b21c8046a418a9fefb700db0a164 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 4 Jun 2013 01:52:40 -0700 Subject: Correct to compile against recent gtkmm, including updated macports versions. Fixes bug #1179338. Fixed bugs: - https://launchpad.net/bugs/1179338 (bzr r12346.1.1) --- src/ui/widget/panel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 7eb114d0a..732df4222 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -15,6 +15,8 @@ # include #endif +#include + #include // for Gtk::RESPONSE_* #include #include -- cgit v1.2.3 From 72d8e897c6b67e46b2a613c4743ef9c13de25059 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 6 Jun 2013 06:44:11 -0700 Subject: Added configure/ifdef guards to only bring in the needed #include if glibmm has it. (bzr r12353) --- src/ui/widget/panel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/widget/panel.cpp') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 732df4222..d60eeefe0 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -15,7 +15,9 @@ # include #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H #include +#endif #include // for Gtk::RESPONSE_* #include -- cgit v1.2.3