diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-06 19:05:52 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2017-07-06 19:05:52 +0000 |
| commit | b676ea2474b68e17c83dc33ebde3bc36b106c661 (patch) | |
| tree | b03b6c5f5bcbefb48a7e882f6c97894f63821d9a | |
| parent | Gtkmm deprecation fixes (diff) | |
| download | inkscape-b676ea2474b68e17c83dc33ebde3bc36b106c661.tar.gz inkscape-b676ea2474b68e17c83dc33ebde3bc36b106c661.zip | |
Gtkmm deprecation fixes
| -rw-r--r-- | src/extension/internal/cdr-input.cpp | 1 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 1 | ||||
| -rw-r--r-- | src/extension/internal/vsd-input.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/extension-editor.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/glyphs.cpp | 22 | ||||
| -rw-r--r-- | src/ui/dialog/icon-preview.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 14 | ||||
| -rw-r--r-- | src/ui/dialog/new-from-template.cpp | 16 | ||||
| -rw-r--r-- | src/ui/dialog/template-widget.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/anchor-selector.cpp | 4 | ||||
| -rw-r--r-- | src/ui/widget/anchor-selector.h | 4 | ||||
| -rw-r--r-- | src/ui/widget/object-composite-settings.h | 1 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.cpp | 72 |
13 files changed, 70 insertions, 87 deletions
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index b94408b36..2b6714908 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -40,7 +40,6 @@ typedef libcdr::CDRStringVector RVNGStringVector; #endif -#include <gtkmm/alignment.h> #include <gtkmm/grid.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 2ee713085..844d16c17 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -31,7 +31,6 @@ #include <poppler/glib/poppler-page.h> #endif -#include <gtkmm/alignment.h> #include <gtkmm/checkbutton.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/drawingarea.h> diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index c1cfb5cc6..0d7a467f0 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -40,7 +40,6 @@ typedef libvisio::VSDStringVector RVNGStringVector; #endif -#include <gtkmm/alignment.h> #include <gtkmm/spinbutton.h> #include "extension/system.h" diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 84840f22d..248f4f67f 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -19,7 +19,6 @@ #include <glibmm/i18n.h> #include <gtkmm/frame.h> -#include <gtkmm/alignment.h> #include <gtkmm/notebook.h> #include "verbs.h" diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 9c1236ca9..f858a4d55 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -12,7 +12,6 @@ #include "glyphs.h" #include <glibmm/i18n.h> -#include <gtkmm/alignment.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/grid.h> #include <gtkmm/iconview.h> @@ -356,7 +355,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : table->attach( *Gtk::manage(label), 0, row, 1, 1); - scriptCombo = new Gtk::ComboBoxText(); + scriptCombo = Gtk::manage(new Gtk::ComboBoxText()); for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) { scriptCombo->append(it->second); @@ -365,11 +364,11 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : scriptCombo->set_active_text(getScriptToName()[G_UNICODE_SCRIPT_INVALID_CODE]); sigc::connection conn = scriptCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild)); instanceConns.push_back(conn); - Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0)); - align->add(*Gtk::manage(scriptCombo)); - align->set_hexpand(); - table->attach( *align, 1, row, 1, 1); + scriptCombo->set_halign(Gtk::ALIGN_START); + scriptCombo->set_valign(Gtk::ALIGN_START); + scriptCombo->set_hexpand(); + table->attach(*scriptCombo, 1, row, 1, 1); } row++; @@ -380,7 +379,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : auto label = new Gtk::Label(_("Range: ")); table->attach( *Gtk::manage(label), 0, row, 1, 1); - rangeCombo = new Gtk::ComboBoxText(); + rangeCombo = Gtk::manage(new Gtk::ComboBoxText()); for ( std::vector<NamedRange>::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { rangeCombo->append(it->second); } @@ -388,10 +387,11 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : rangeCombo->set_active_text(getRanges()[1].second); sigc::connection conn = rangeCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild)); instanceConns.push_back(conn); - Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); - align->add(*Gtk::manage(rangeCombo)); - align->set_hexpand(); - table->attach( *Gtk::manage(align), 1, row, 1, 1); + + rangeCombo->set_halign(Gtk::ALIGN_START); + rangeCombo->set_valign(Gtk::ALIGN_START); + rangeCombo->set_hexpand(); + table->attach(*rangeCombo, 1, row, 1, 1); } row++; diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 7b1e531b4..991139aa8 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -24,7 +24,6 @@ #include <glibmm/timer.h> #include <glibmm/main.h> -#include <gtkmm/alignment.h> #include <gtkmm/checkbutton.h> #include <gtkmm/frame.h> #include "ui/widget/frame.h" @@ -197,12 +196,11 @@ IconPreviewPanel::IconPreviewPanel() : buttons[i]->signal_clicked().connect( sigc::bind<int>( sigc::mem_fun(*this, &IconPreviewPanel::on_button_clicked), i) ); - - Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(0.5, 0.5, 0, 0)); - align->add(*buttons[i]); + buttons[i]->set_halign(Gtk::ALIGN_CENTER); + buttons[i]->set_valign(Gtk::ALIGN_CENTER); if ( !pack || ( (avail == 0) && (previous == 0) ) ) { - verts->pack_end(*align, Gtk::PACK_SHRINK); + verts->pack_end(*(buttons[i]), Gtk::PACK_SHRINK); previous = sizes[i]; avail = sizes[i]; } else { @@ -219,12 +217,12 @@ IconPreviewPanel::IconPreviewPanel() : avail = previous; verts->pack_end(*horiz, Gtk::PACK_SHRINK); } - horiz->pack_start(*align, Gtk::PACK_EXPAND_WIDGET); + horiz->pack_start(*(buttons[i]), Gtk::PACK_EXPAND_WIDGET); avail -= sizes[i]; avail -= pad; // a little extra for padding } else { horiz = 0; - verts->pack_end(*align, Gtk::PACK_SHRINK); + verts->pack_end(*(buttons[i]), Gtk::PACK_SHRINK); } } } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d946bac82..5ebad0746 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -22,7 +22,6 @@ #include <glibmm/miscutils.h> #include <glibmm/markup.h> #include <gtkmm/main.h> -#include <gtkmm/alignment.h> #include "preferences.h" #include "verbs.h" @@ -85,7 +84,7 @@ InkscapePreferences::InkscapePreferences() delete sb; //Main HBox - Gtk::HBox* hbox_list_page = Gtk::manage(new Gtk::HBox()); + auto hbox_list_page = Gtk::manage(new Gtk::Box()); hbox_list_page->set_border_width(12); hbox_list_page->set_spacing(12); _getContents()->add(*hbox_list_page); @@ -107,7 +106,7 @@ InkscapePreferences::InkscapePreferences() page_list_selection->set_mode(Gtk::SELECTION_BROWSE); //Pages - Gtk::VBox* vbox_page = Gtk::manage(new Gtk::VBox()); + auto vbox_page = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); Gtk::Frame* title_frame = Gtk::manage(new Gtk::Frame()); Gtk::ScrolledWindow* pageScroller = Gtk::manage(new Gtk::ScrolledWindow()); @@ -266,12 +265,11 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const _("Apply the style you last set on an object")); PrefRadioButton* own = Gtk::manage( new PrefRadioButton); - Gtk::HBox* hb = Gtk::manage( new Gtk::HBox); - Gtk::Alignment* align = Gtk::manage( new Gtk::Alignment); + auto hb = Gtk::manage( new Gtk::Box); own->init ( _("This tool's own style:"), prefs_path + "/usecurrent", 0, false, current); - align->set(0,0,0,0); - align->add(*own); - hb->add(*align); + own->set_halign(Gtk::ALIGN_START); + own->set_valign(Gtk::ALIGN_START); + hb->add(*own); p.set_tip( *own, _("Each tool may store its own style to apply to the newly created objects. Use the button below to set it.")); p.add_line( true, "", *hb, "", ""); diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 2b33fd54d..ab46a55da 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -15,9 +15,6 @@ #include "new-from-template.h" #include "file.h" -#include <gtkmm/alignment.h> - - namespace Inkscape { namespace UI { @@ -32,13 +29,16 @@ NewFromTemplate::NewFromTemplate() get_content_area()->pack_start(*_main_widget); - Gtk::Alignment *align; - align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); + _create_template_button.set_halign(Gtk::ALIGN_END); + _create_template_button.set_valign(Gtk::ALIGN_END); - get_content_area()->pack_end(*align, Gtk::PACK_SHRINK); +#if WITH_GTKMM_3_12 + _create_template_button.set_margin_end(15); +#else + _create_template_button.set_margin_right(15); +#endif - align->set_padding(0, 0, 0, 15); - align->add(_create_template_button); + get_content_area()->pack_end(_create_template_button, Gtk::PACK_SHRINK); _create_template_button.signal_clicked().connect( sigc::mem_fun(*this, &NewFromTemplate::_createFromTemplate)); diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index 3b7fbe88c..8aeaa4046 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -11,7 +11,6 @@ #include "template-widget.h" #include <glibmm/miscutils.h> -#include <gtkmm/alignment.h> #include <gtkmm/messagedialog.h> #include "desktop.h" @@ -42,10 +41,9 @@ TemplateWidget::TemplateWidget() _short_description_label.set_line_wrap(true); - Gtk::Alignment *align; - align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); - pack_end(*align, Gtk::PACK_SHRINK); - align->add(_more_info_button); + _more_info_button.set_halign(Gtk::ALIGN_END); + _more_info_button.set_valign(Gtk::ALIGN_CENTER); + pack_end(_more_info_button, Gtk::PACK_SHRINK); pack_end(_short_description_label, Gtk::PACK_SHRINK, 5); diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index ddc25775d..52768b7f1 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -28,9 +28,9 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b } AnchorSelector::AnchorSelector() - : Gtk::Alignment(0.5, 0, 0, 0), - _container() + : _container() { + set_halign(Gtk::ALIGN_CENTER); setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); setupButton(INKSCAPE_ICON("boundingbox_top_right"), _buttons[2]); diff --git a/src/ui/widget/anchor-selector.h b/src/ui/widget/anchor-selector.h index 96331fae3..e756e9aa0 100644 --- a/src/ui/widget/anchor-selector.h +++ b/src/ui/widget/anchor-selector.h @@ -14,7 +14,7 @@ #include "config.h" #endif -#include <gtkmm/alignment.h> +#include <gtkmm/bin.h> #include <gtkmm/togglebutton.h> #include <gtkmm/grid.h> @@ -22,7 +22,7 @@ namespace Inkscape { namespace UI { namespace Widget { -class AnchorSelector : public Gtk::Alignment +class AnchorSelector : public Gtk::Bin { private: Gtk::ToggleButton _buttons[9]; diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index ae16564e1..d7525093f 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -12,7 +12,6 @@ */ #include <gtkmm/box.h> -#include <gtkmm/alignment.h> #include <gtkmm/adjustment.h> #include <gtkmm/label.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b2cebcaa6..2981316c0 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -16,7 +16,6 @@ #include <gtkmm/box.h> #include <gtkmm/frame.h> -#include <gtkmm/alignment.h> #include <gtkmm/scale.h> #include <gtkmm/table.h> @@ -77,9 +76,7 @@ void DialogPage::add_line(bool indent, if (tip != "") widget.set_tooltip_text (tip); - Gtk::Alignment* label_alignment = Gtk::manage(new Gtk::Alignment()); - - Gtk::HBox* hb = Gtk::manage(new Gtk::HBox()); + auto hb = Gtk::manage(new Gtk::Box()); hb->set_spacing(12); hb->pack_start(widget, expand_widget, expand_widget); @@ -87,11 +84,7 @@ void DialogPage::add_line(bool indent, 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); - w_alignment->set_valign(Gtk::ALIGN_CENTER); + hb->set_valign(Gtk::ALIGN_CENTER); // Add a label in the first column if provided if (label != "") @@ -100,30 +93,36 @@ void DialogPage::add_line(bool indent, 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) - label_alignment->set_padding(0, 0, 12, 0); + if (indent) { +#if WITH_GTKMM_3_12 + label_widget->set_margin_start(12); +#else + label_widget->set_margin_left(12); +#endif + } - label_alignment->set_valign(Gtk::ALIGN_CENTER); - add(*label_alignment); - attach_next_to(*w_alignment, *label_alignment, Gtk::POS_RIGHT, 1, 1); + label_widget->set_valign(Gtk::ALIGN_CENTER); + add(*label_widget); + attach_next_to(*hb, *label_widget, Gtk::POS_RIGHT, 1, 1); } // Now add the widget to the bottom of the dialog if (label == "") { - if (indent) - w_alignment->set_padding(0, 0, 12, 0); + if (indent) { +#if WITH_GTKMM_3_12 + hb->set_margin_start(12); +#else + hb->set_margin_left(12); +#endif + } - add(*w_alignment); + add(*hb); 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); + gtk_container_child_set_property(GTK_CONTAINER(gobj()), GTK_WIDGET(hb->gobj()), "width", &width); } // Add a label on the right of the widget if desired @@ -505,24 +504,21 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _sb.set_increments (step_increment, 0); _sb.set_value (value); _sb.set_digits(2); + _sb.set_halign(Gtk::ALIGN_CENTER); + _sb.set_valign(Gtk::ALIGN_END); _unit.set_data("sensitive", GINT_TO_POINTER(0)); _unit.setUnitType(UNIT_TYPE_LINEAR); _unit.set_data("sensitive", GINT_TO_POINTER(1)); _unit.setUnit(prefs->getString("/options/zoomcorrection/unit")); - - 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); + _unit.set_halign(Gtk::ALIGN_CENTER); + _unit.set_valign(Gtk::ALIGN_END); auto 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); + table->attach(*_slider, 0, 0, 1, 1); + table->attach(_sb, 1, 0, 1, 1); + table->attach(_ruler, 0, 1, 1, 1); + table->attach(_unit, 1, 1, 1, 1); pack_start(*table, Gtk::PACK_SHRINK); } @@ -582,15 +578,13 @@ PrefSlider::init(Glib::ustring const &prefs_path, _sb.set_increments (step_increment, 0); _sb.set_value (value); _sb.set_digits(digits); - - Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); - alignment1->add(_sb); + _sb.set_halign(Gtk::ALIGN_CENTER); + _sb.set_valign(Gtk::ALIGN_END); auto 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); + table->attach(*_slider, 0, 0, 1, 1); + table->attach(_sb, 1, 0, 1, 1); this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); } |
