From 9abd33133650d77714fccf09d0c9ff27c9b75a78 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 5 Jul 2012 22:39:08 +0100 Subject: Drop GTK+ 2.20 support. Fixed bugs: - https://launchpad.net/bugs/1020494 (bzr r11529) --- src/ui/widget/preferences-widget.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index a7b51d535..8ce7c63db 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -73,11 +73,7 @@ void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget & if (label != "") { Gtk::Label* label_widget; -#if WITH_GTKMM_2_22 label_widget = Gtk::manage(new Gtk::Label(label , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); -#else - label_widget = Gtk::manage(new Gtk::Label(label , Gtk::ALIGN_LEFT , Gtk::ALIGN_CENTER, true)); -#endif label_widget->set_mnemonic_widget(widget); if (indent) { @@ -107,11 +103,7 @@ void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget & if (suffix != "") { -#if WITH_GTKMM_2_22 Gtk::Label* suffix_widget = Gtk::manage(new Gtk::Label(suffix , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); -#else - Gtk::Label* suffix_widget = Gtk::manage(new Gtk::Label(suffix , Gtk::ALIGN_LEFT , Gtk::ALIGN_CENTER, true)); -#endif if (expand_widget) this->attach(*suffix_widget, 2, 3, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); else @@ -130,13 +122,9 @@ void DialogPage::add_group_header(Glib::ustring name) int row = this->property_n_rows(); if (name != "") { -#if WITH_GTKMM_2_22 Gtk::Label* label_widget = Gtk::manage(new Gtk::Label(Glib::ustring(/*"*/"") + name + Glib::ustring(""/*"*/) , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); -#else - Gtk::Label* label_widget = Gtk::manage(new Gtk::Label(Glib::ustring(/*"*/"") + name + - Glib::ustring(""/*"*/) , Gtk::ALIGN_LEFT , Gtk::ALIGN_CENTER, true)); -#endif + label_widget->set_use_markup(true); this->attach(*label_widget , 0, 4, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); if (row != 1) -- cgit v1.2.3 From 63a0b0f94e29ed91fb98b1b841cd698fd3e95cce Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 11 Sep 2012 09:14:11 +0900 Subject: Fix for 167181 : Gnome-HIG-2.0 conformant Preferences dialog - accel keys (bzr r11662) --- src/ui/widget/preferences-widget.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 8ce7c63db..07145f5f3 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -54,7 +54,7 @@ DialogPage::DialogPage() this->set_row_spacings(6); } -void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget &widget, Glib::ustring const &suffix, const Glib::ustring &tip, bool expand_widget) +void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget &widget, Glib::ustring const &suffix, const Glib::ustring &tip, bool expand_widget, Gtk::Widget *other_widget) { int start_col; int row = this->property_n_rows(); @@ -68,6 +68,10 @@ void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget & Gtk::HBox* hb = Gtk::manage(new Gtk::HBox()); hb->set_spacing(12); hb->pack_start(widget,false,false); + if (other_widget) { + hb->pack_start(*other_widget,false,false); + } + w = (Gtk::Widget*) hb; } if (label != "") @@ -468,6 +472,12 @@ ZoomCorrRulerSlider::on_unit_changed() { } } +bool ZoomCorrRulerSlider::on_mnemonic_activate ( bool group_cycling ) +{ + return _sb.mnemonic_activate ( group_cycling ); +} + + void ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, double upper, double step_increment, double page_increment, double default_value) @@ -539,6 +549,11 @@ PrefSlider::on_spinbutton_value_changed() } } +bool PrefSlider::on_mnemonic_activate ( bool group_cycling ) +{ + return _sb.mnemonic_activate ( group_cycling ); +} + void PrefSlider::init(Glib::ustring const &prefs_path, double lower, double upper, double step_increment, double page_increment, double default_value, int digits) @@ -674,6 +689,11 @@ void PrefEntryButtonHBox::onRelatedButtonClickedCallback() } } +bool PrefEntryButtonHBox::on_mnemonic_activate ( bool group_cycling ) +{ + return relatedEntry->mnemonic_activate ( group_cycling ); +} + void PrefEntryFileButtonHBox::init(Glib::ustring const &prefs_path, bool visibility) { @@ -806,6 +826,11 @@ void PrefEntryFileButtonHBox::onRelatedButtonClickedCallback() } } +bool PrefEntryFileButtonHBox::on_mnemonic_activate ( bool group_cycling ) +{ + return relatedEntry->mnemonic_activate ( group_cycling ); +} + void PrefFileButton::init(Glib::ustring const &prefs_path) { _prefs_path = prefs_path; -- cgit v1.2.3 From f02cd4f80de3b2d54d62958c3f4747908d43eecd Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 15 Nov 2012 11:19:41 +0000 Subject: cppcheck: Simple fixes for src/ui/widget (bzr r11873) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 07145f5f3..b793893c7 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -640,7 +640,7 @@ void PrefCombo::on_changed() if (this->get_visible()) //only take action if user changed value { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if(_values.size() > 0) + if(!_values.empty()) { prefs->setInt(_prefs_path, _values[this->get_active_row_number()]); } -- cgit v1.2.3 From 4af19c56cf90e31a0d800821e8daf7fb08108e94 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Nov 2012 10:33:19 +0000 Subject: Drop support for GTK+ < 2.24 Fixed bugs: - https://launchpad.net/bugs/1069024 (bzr r11907) --- src/ui/widget/preferences-widget.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b793893c7..e7e317d11 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -378,12 +378,7 @@ ZoomCorrRuler::redraw() { Glib::RefPtr window = get_window(); Cairo::RefPtr cr = window->create_cairo_context(); -#if WITH_GTKMM_2_24 int w = window->get_width(); -#else - int w, h; - window->get_size(w, h); -#endif _drawing_width = w - _border * 2; cr->set_source_rgb(1.0, 1.0, 1.0); @@ -597,11 +592,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _values.push_back(values[i]); if (value == values[i]) row = i; @@ -623,11 +614,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _ustr_values.push_back(values[i]); if (value == values[i]) row = i; -- cgit v1.2.3 From a05a3d77490e30b4410045e0e685f8da8628a302 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 28 Dec 2012 01:51:10 +0000 Subject: Implement GTK+ 3 drawing for zoom correction ruler in preferences dialog (bzr r11995) --- src/ui/widget/preferences-widget.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index e7e317d11..e5b062ec9 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -373,10 +373,27 @@ ZoomCorrRuler::draw_marks(Cairo::RefPtr cr, double dist, int maj } } -void -ZoomCorrRuler::redraw() { +#if !WITH_GTKMM_3_0 +bool +ZoomCorrRuler::on_expose_event(GdkEventExpose *event) { + bool result = false; + + if(get_is_drawable()) + { + Cairo::RefPtr cr = get_window()->create_cairo_context(); + cr->rectangle(event->area.x, event->area.y, + event->area.width, event->area.height); + cr->clip(); + result = on_draw(cr); + } + + return result; +} +#endif + +bool +ZoomCorrRuler::on_draw(const Cairo::RefPtr& cr) { Glib::RefPtr window = get_window(); - Cairo::RefPtr cr = window->create_cairo_context(); int w = window->get_width(); _drawing_width = w - _border * 2; @@ -415,14 +432,11 @@ ZoomCorrRuler::redraw() { draw_marks(cr, 1, 1); } cr->stroke(); -} -bool -ZoomCorrRuler::on_expose_event(GdkEventExpose */*event*/) { - this->redraw(); return true; } + void ZoomCorrRulerSlider::on_slider_value_changed() { @@ -432,7 +446,7 @@ ZoomCorrRulerSlider::on_slider_value_changed() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/options/zoomcorrection/value", _slider.get_value() / 100.0); _sb.set_value(_slider.get_value()); - _ruler.redraw(); + _ruler.queue_draw(); freeze = false; } } @@ -446,7 +460,7 @@ ZoomCorrRulerSlider::on_spinbutton_value_changed() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/options/zoomcorrection/value", _sb.get_value() / 100.0); _slider.set_value(_sb.get_value()); - _ruler.redraw(); + _ruler.queue_draw(); freeze = false; } } @@ -463,7 +477,7 @@ ZoomCorrRulerSlider::on_unit_changed() { double conv = _unit.getConversion(_unit.getUnitAbbr(), "px"); _ruler.set_unit_conversion(conv); if (_ruler.get_visible()) { - _ruler.redraw(); + _ruler.queue_draw(); } } -- cgit v1.2.3 From 909c15499d8bebfb484d05063ee3c3813b9bfe73 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 7 Mar 2013 22:41:53 +0000 Subject: Fix deprecated Gtkmm symbols in preferences widget (bzr r12178) --- src/ui/widget/preferences-widget.cpp | 239 +++++++++++++++++++++++------------ 1 file changed, 160 insertions(+), 79 deletions(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index e5b062ec9..314bf75bf 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include #include "preferences.h" #include "ui/widget/preferences-widget.h" @@ -49,90 +51,139 @@ namespace Widget { DialogPage::DialogPage() { - this->set_border_width(12); - this->set_col_spacings(12); - this->set_row_spacings(6); + set_border_width(12); + +#if WITH_GTKMM_3_0 + set_orientation(Gtk::ORIENTATION_VERTICAL); + set_column_spacing(12); + set_row_spacing(6); +#else + set_col_spacings(12); + set_row_spacings(6); +#endif } -void DialogPage::add_line(bool indent, Glib::ustring const &label, Gtk::Widget &widget, Glib::ustring const &suffix, const Glib::ustring &tip, bool expand_widget, Gtk::Widget *other_widget) +/** + * Add a widget to the bottom row of the dialog page + * + * \param[in] indent Whether the widget should be indented by one column + * \param[in] label The label text for the widget + * \param[in] widget The widget to add to the page + * \param[in] suffix Text for an optional label at the right of the widget + * \param[in] tip Tooltip text for the widget + * \param[in] expand_widget Whether to expand the widget horizontally + * \param[in] other_widget An optional additional widget to display at the right of the first one + */ +void DialogPage::add_line(bool indent, + Glib::ustring const &label, + Gtk::Widget &widget, + Glib::ustring const &suffix, + const Glib::ustring &tip, + bool expand_widget, + Gtk::Widget *other_widget) { - int start_col; - int row = this->property_n_rows(); - Gtk::Widget* w; - if (expand_widget) - { - w = &widget; - } - else - { - Gtk::HBox* hb = Gtk::manage(new Gtk::HBox()); - hb->set_spacing(12); - hb->pack_start(widget,false,false); - if (other_widget) { - hb->pack_start(*other_widget,false,false); - } - - w = (Gtk::Widget*) hb; - } + if (tip != "") + widget.set_tooltip_text (tip); + + Gtk::Alignment* label_alignment = Gtk::manage(new Gtk::Alignment()); + + Gtk::HBox* hb = Gtk::manage(new Gtk::HBox()); + hb->set_spacing(12); + hb->pack_start(widget, expand_widget, expand_widget); + + // Pack an additional widget into a box with the widget if desired + if (other_widget) + hb->pack_start(*other_widget, expand_widget, expand_widget); + + // Pack the widget into an alignment container so that it can + // be indented if desired + Gtk::Alignment* w_alignment = Gtk::manage(new Gtk::Alignment()); + w_alignment->add(*hb); + +#if WITH_GTKMM_3_0 + w_alignment->set_valign(Gtk::ALIGN_CENTER); +#else + guint row = property_n_rows(); +#endif + + // Add a label in the first column if provided if (label != "") { - Gtk::Label* label_widget; - label_widget = Gtk::manage(new Gtk::Label(label , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); + Gtk::Label* label_widget = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START, + Gtk::ALIGN_CENTER, true)); label_widget->set_mnemonic_widget(widget); + + // Pack the label into an alignment container so that we can indent it + // if necessary + label_alignment->add(*label_widget); + if (indent) - { - Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment()); - alignment->set_padding(0, 0, 12, 0); - alignment->add(*label_widget); - this->attach(*alignment , 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); - } - else - this->attach(*label_widget , 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); - start_col = 1; + label_alignment->set_padding(0, 0, 12, 0); + +#if WITH_GTKMM_3_0 + label_alignment->set_valign(Gtk::ALIGN_CENTER); + add(*label_alignment); + attach_next_to(*w_alignment, *label_alignment, Gtk::POS_RIGHT, 1, 1); +#else + attach(*label_alignment, 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); +#endif } - else - start_col = 0; - if (start_col == 0 && indent) //indent this widget + // Now add the widget to the bottom of the dialog +#if WITH_GTKMM_3_0 + if (label == "") { - Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment()); - alignment->set_padding(0, 0, 12, 0); - alignment->add(*w); - this->attach(*alignment, start_col, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions(), 0, 0); - } - else - { - this->attach(*w, start_col, 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions(), 0, 0); - } + if (indent) + w_alignment->set_padding(0, 0, 12, 0); + + add(*w_alignment); + + GValue width = G_VALUE_INIT; + g_value_init(&width, G_TYPE_INT); + g_value_set_int(&width, 2); + gtk_container_child_set_property(GTK_CONTAINER(gobj()), GTK_WIDGET(w_alignment->gobj()), "width", &width); + } +#else + // The widget should span two columns if there is no label + int w_col_span = 1; + if (label == "") + w_col_span = 2; + + attach(*w_alignment, 2 - w_col_span, 2, row, row + 1, + Gtk::FILL | Gtk::EXPAND, + Gtk::AttachOptions(), + 0, 0); +#endif + // Add a label on the right of the widget if desired if (suffix != "") { Gtk::Label* suffix_widget = Gtk::manage(new Gtk::Label(suffix , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); - if (expand_widget) - this->attach(*suffix_widget, 2, 3, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); - else - ((Gtk::HBox*)w)->pack_start(*suffix_widget,false,false); - } - - if (tip != "") - { - widget.set_tooltip_text (tip); + hb->pack_start(*suffix_widget,false,false); } } void DialogPage::add_group_header(Glib::ustring name) { - int row = this->property_n_rows(); if (name != "") { Gtk::Label* label_widget = Gtk::manage(new Gtk::Label(Glib::ustring(/*"*/"") + name + Glib::ustring(""/*"*/) , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); label_widget->set_use_markup(true); - this->attach(*label_widget , 0, 4, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); + +#if WITH_GTKMM_3_0 + label_widget->set_valign(Gtk::ALIGN_CENTER); + add(*label_widget); +// if (row != 1) + // set_row_spacing(row - 1, 18); +#else + int row = property_n_rows(); + attach(*label_widget , 0, 4, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); if (row != 1) - this->set_row_spacing(row - 1, 18); + set_row_spacing(row - 1, 18); +#endif } } @@ -444,8 +495,8 @@ ZoomCorrRulerSlider::on_slider_value_changed() { freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/options/zoomcorrection/value", _slider.get_value() / 100.0); - _sb.set_value(_slider.get_value()); + prefs->setDouble("/options/zoomcorrection/value", _slider->get_value() / 100.0); + _sb.set_value(_slider->get_value()); _ruler.queue_draw(); freeze = false; } @@ -459,7 +510,7 @@ ZoomCorrRulerSlider::on_spinbutton_value_changed() freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/options/zoomcorrection/value", _sb.get_value() / 100.0); - _slider.set_value(_sb.get_value()); + _slider->set_value(_sb.get_value()); _ruler.queue_draw(); freeze = false; } @@ -498,13 +549,19 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _ruler.set_size(ruler_width, ruler_height); - _slider.set_size_request(_ruler.width(), -1); - _slider.set_range (lower, upper); - _slider.set_increments (step_increment, page_increment); - _slider.set_value (value); - _slider.set_digits(2); +#if WITH_GTKMM_3_0 + _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); +#else + _slider = Gtk::manage(new Gtk::HScale()); +#endif + + _slider->set_size_request(_ruler.width(), -1); + _slider->set_range (lower, upper); + _slider->set_increments (step_increment, page_increment); + _slider->set_value (value); + _slider->set_digits(2); - _slider.signal_value_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_slider_value_changed)); + _slider->signal_value_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_slider_value_changed)); _sb.signal_value_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_spinbutton_value_changed)); _unit.signal_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_unit_changed)); @@ -518,18 +575,28 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _unit.set_data("sensitive", GINT_TO_POINTER(1)); _unit.setUnit(prefs->getString("/options/zoomcorrection/unit")); - Gtk::Table *table = Gtk::manage(new Gtk::Table()); Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); Gtk::Alignment *alignment2 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); alignment1->add(_sb); alignment2->add(_unit); - table->attach(_slider, 0, 1, 0, 1); +#if WITH_GTKMM_3_0 + Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + table->attach(*_slider, 0, 0, 1, 1); + alignment1->set_halign(Gtk::ALIGN_CENTER); + table->attach(*alignment1, 1, 0, 1, 1); + table->attach(_ruler, 0, 1, 1, 1); + alignment2->set_halign(Gtk::ALIGN_CENTER); + table->attach(*alignment2, 1, 1, 1, 1); +#else + Gtk::Table *table = Gtk::manage(new Gtk::Table()); + table->attach(*_slider, 0, 1, 0, 1); table->attach(*alignment1, 1, 2, 0, 1, static_cast(0)); table->attach(_ruler, 0, 1, 1, 2); table->attach(*alignment2, 1, 2, 1, 2, static_cast(0)); +#endif - this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); + pack_start(*table, Gtk::PACK_SHRINK); } void @@ -539,8 +606,8 @@ PrefSlider::on_slider_value_changed() { freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble(_prefs_path, _slider.get_value()); - _sb.set_value(_slider.get_value()); + prefs->setDouble(_prefs_path, _slider->get_value()); + _sb.set_value(_slider->get_value()); freeze = false; } } @@ -553,7 +620,7 @@ PrefSlider::on_spinbutton_value_changed() freeze = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(_prefs_path, _sb.get_value()); - _slider.set_value(_sb.get_value()); + _slider->set_value(_sb.get_value()); freeze = false; } } @@ -574,11 +641,17 @@ PrefSlider::init(Glib::ustring const &prefs_path, freeze = false; - _slider.set_range (lower, upper); - _slider.set_increments (step_increment, page_increment); - _slider.set_value (value); - _slider.set_digits(digits); - _slider.signal_value_changed().connect(sigc::mem_fun(*this, &PrefSlider::on_slider_value_changed)); +#if WITH_GTKMM_3_0 + _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); +#else + _slider = Gtk::manage(new Gtk::HScale()); +#endif + + _slider->set_range (lower, upper); + _slider->set_increments (step_increment, page_increment); + _slider->set_value (value); + _slider->set_digits(digits); + _slider->signal_value_changed().connect(sigc::mem_fun(*this, &PrefSlider::on_slider_value_changed)); _sb.signal_value_changed().connect(sigc::mem_fun(*this, &PrefSlider::on_spinbutton_value_changed)); _sb.set_range (lower, upper); @@ -586,12 +659,20 @@ PrefSlider::init(Glib::ustring const &prefs_path, _sb.set_value (value); _sb.set_digits(digits); - Gtk::Table *table = Gtk::manage(new Gtk::Table()); Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); alignment1->add(_sb); - table->attach(_slider, 0, 1, 0, 1); +#if WITH_GTKMM_3_0 + Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + _slider->set_hexpand(); + table->attach(*_slider, 0, 0, 1, 1); + alignment1->set_halign(Gtk::ALIGN_CENTER); + table->attach(*alignment1, 1, 0, 1, 1); +#else + Gtk::Table *table = Gtk::manage(new Gtk::Table()); + table->attach(*_slider, 0, 1, 0, 1); table->attach(*alignment1, 1, 2, 0, 1, static_cast(0)); +#endif this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); } -- cgit v1.2.3 From d2bba282171a9e2c70a624794650689ec4531047 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 26 Mar 2013 16:03:49 +0000 Subject: Fix Glibmm inclusions for Gtk+ 3 builds and implement a Gtk+ 3 compatible check for X11 backend Fixed bugs: - https://launchpad.net/bugs/1160252 - https://launchpad.net/bugs/1122774 (bzr r12247) --- src/ui/widget/preferences-widget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 314bf75bf..d32de6871 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -41,6 +41,8 @@ #include "selection-chemistry.h" #include "ui/dialog/filedialog.h" #include "xml/repr.h" + +#include #include using namespace Inkscape::UI::Widget; -- 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/preferences-widget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d32de6871..1881f1415 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -18,6 +18,8 @@ #include #endif +#include + #include #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/preferences-widget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 1881f1415..567f29f91 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -18,7 +18,9 @@ #include #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H #include +#endif #include #include -- cgit v1.2.3 From a970dc423d59ea844bdb1af48d5d9419a5e2a287 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 13 Oct 2013 00:24:05 +0200 Subject: Units: stop newing Unit objects. pass around pointers to "undeletable" Unit objects in the UnitTable. I think we should move to using indexed units, and pass around the index of the unit in the unittable, or smth like that... ? (bzr r12679) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 567f29f91..3ba00c083 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -354,7 +354,7 @@ void PrefSpinUnit::on_my_value_changed() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (getWidget()->get_visible()) //only take action if user changed value { - prefs->setDoubleUnit(_prefs_path, getValue(getUnit().abbr), getUnit().abbr); + prefs->setDoubleUnit(_prefs_path, getValue(getUnit()->abbr), getUnit()->abbr); } } -- cgit v1.2.3