diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-04-30 22:04:12 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-04-30 22:04:12 +0000 |
| commit | bc19e10ccfe4010990d2a86cbae992f7825e2562 (patch) | |
| tree | c34501ae52633d8b9451734a951196ed1675e471 | |
| parent | emf import. use EMR_EXTSELECTCLIPRGN to cancel clipping (Bug 990083) (diff) | |
| download | inkscape-bc19e10ccfe4010990d2a86cbae992f7825e2562.tar.gz inkscape-bc19e10ccfe4010990d2a86cbae992f7825e2562.zip | |
gtkmm-3.0 changes for Gtk::Adjustment
(bzr r11308)
32 files changed, 406 insertions, 16 deletions
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 0a89c6661..e56b7afa8 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -71,8 +71,13 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) // Page number int num_pages = poppler_document_get_n_pages(_poppler_doc); +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj( Gtk::Adjustment::create(1, 1, num_pages, 1, 10, 0) ); + _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1)); +#else Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, num_pages, 1, 10, 0)); _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); +#endif _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page @@ -105,8 +110,13 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) _labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:"))); _labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance."))); +#if WITH_GTKMM_3_0 + _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10); + _fallbackPrecisionSlider = Gtk::manage(new Gtk::HScale(_fallbackPrecisionSlider_adj)); +#else _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10)); _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj)); +#endif _fallbackPrecisionSlider->set_value(2.0); _labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough"))); hbox6 = Gtk::manage(new class Gtk::HBox(false, 4)); diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index cc3ed975e..15235ee19 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -82,7 +82,11 @@ private: class Gtk::Label * _labelPrecision; class Gtk::Label * _labelPrecisionWarning; class Gtk::HScale * _fallbackPrecisionSlider; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj; +#else class Gtk::Adjustment *_fallbackPrecisionSlider_adj; +#endif class Gtk::Label * _labelPrecisionComment; class Gtk::HBox * hbox6; class Gtk::Label * _labelText; diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 8802ce2ba..47f91e7b2 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -85,9 +85,14 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); // Page number +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0); + _pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1)); +#else Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0)); _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); +#endif _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page @@ -121,8 +126,13 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:"))); _labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance."))); +#if WITH_GTKMM_3_0 + _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10); + _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(_fallbackPrecisionSlider_adj)); +#else _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10)); _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj)); +#endif _fallbackPrecisionSlider->set_value(2.0); _labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough"))); hbox6 = Gtk::manage(new class Gtk::HBox(false, 4)); diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 8334fd2f3..3b79e6f29 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -92,7 +92,11 @@ private: class Gtk::Label * _labelPrecision; class Gtk::Label * _labelPrecisionWarning; class Gtk::HScale * _fallbackPrecisionSlider; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj; +#else class Gtk::Adjustment *_fallbackPrecisionSlider_adj; +#endif class Gtk::Label * _labelPrecisionComment; class Gtk::HBox * hbox6; class Gtk::Label * _labelText; diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 0e1d1c22a..2f1c77d4e 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -184,17 +184,30 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod label->show(); hbox->pack_start(*label, true, true, _indent); +#if WITH_GTKMM_3_0 + ParamFloatAdjustment * pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); + Glib::RefPtr<Gtk::Adjustment> fadjust(pfa); +#else ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal)); +#endif if (_mode == FULL) { +#if WITH_GTKMM_3_0 + Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(fadjust)); +#else Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(*fadjust)); +#endif scale->set_draw_value(false); scale->set_size_request(200, -1); scale->show(); hbox->pack_start(*scale, false, false); } - + +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); +#else Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision)); +#endif spin->show(); hbox->pack_start(*spin, false, false); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 440693eb1..fe29f1230 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -165,17 +165,30 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal label->show(); hbox->pack_start(*label, true, true, _indent); +#if WITH_GTKMM_3_0 + ParamIntAdjustment * pia = new ParamIntAdjustment(this, doc, node, changeSignal); + Glib::RefPtr<Gtk::Adjustment> fadjust(pia); +#else ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node, changeSignal)); +#endif if (_mode == FULL) { +#if WITH_GTKMM_3_0 + Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(fadjust)); +#else Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(*fadjust)); +#endif scale->set_draw_value(false); scale->set_size_request(200, -1); scale->show(); hbox->pack_start(*scale, false, false); } - + +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0)); +#else Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0)); +#endif spin->show(); hbox->pack_start(*spin, false, false); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 7b7c66553..47ec03b30 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -95,7 +95,7 @@ CloneTiler::CloneTiler (void) : #if GTK_CHECK_VERSION(3,0,0) GtkWidget *mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); - gtk_box_new(GTK_BOX(mainbox), FALSE); + gtk_box_set_homogeneous(GTK_BOX(mainbox), FALSE); #else GtkWidget *mainbox = gtk_vbox_new(FALSE, 4); #endif @@ -803,7 +803,7 @@ CloneTiler::CloneTiler (void) : { #if GTK_CHECK_VERSION(3,0,0) GtkWidget *vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_new(GTK_BOX(vvb), FALSE); + gtk_box_set_homogeneous(GTK_BOX(vvb), FALSE); #else GtkWidget *vvb = gtk_vbox_new (FALSE, 0); #endif @@ -1003,11 +1003,19 @@ CloneTiler::CloneTiler (void) : g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb); { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment>a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0); +#endif int value = prefs->getInt(prefs_path + "jmax", 2); a->set_value (value); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); +#else Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0); +#endif sb->set_tooltip_text (_("How many rows in the tiling")); sb->set_width_chars (7); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); @@ -1025,11 +1033,19 @@ CloneTiler::CloneTiler (void) : } { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0); +#endif int value = prefs->getInt(prefs_path + "imax", 2); a->set_value (value); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); +#else Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0); +#endif sb->set_tooltip_text (_("How many columns in the tiling")); sb->set_width_chars (7); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); @@ -1057,7 +1073,11 @@ CloneTiler::CloneTiler (void) : { // Width spinbutton +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); +#endif sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a->gobj())); double value = prefs->getDouble(prefs_path + "fillwidth", 50.0); @@ -1065,7 +1085,11 @@ CloneTiler::CloneTiler (void) : gdouble const units = sp_pixels_get_units (value, unit); a->set_value (units); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(a, 1.0, 2); +#else Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 2); +#endif e->set_tooltip_text (_("Width of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); @@ -1083,7 +1107,11 @@ CloneTiler::CloneTiler (void) : { // Height spinbutton +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); +#endif sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a->gobj())); double value = prefs->getDouble(prefs_path + "fillheight", 50.0); @@ -1091,7 +1119,11 @@ CloneTiler::CloneTiler (void) : gdouble const units = sp_pixels_get_units (value, unit); a->set_value (units); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(a, 1.0, 2); +#else Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 2); +#endif e->set_tooltip_text (_("Height of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); @@ -2586,7 +2618,7 @@ GtkWidget * CloneTiler::clonetiler_new_tab(GtkWidget *nb, const gchar *label) GtkWidget *l = gtk_label_new_with_mnemonic (label); #if GTK_CHECK_VERSION(3,0,0) GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN); - gtk_box_new(GTK_BOX(vb), FALSE); + gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); #else GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); #endif @@ -2644,19 +2676,36 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do #endif { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a; + if (exponent) { + a = Gtk::Adjustment::create(1.0, lower, upper, 0.01, 0.05, 0); + } else { + a = Gtk::Adjustment::create(0.0, lower, upper, 0.1, 0.5, 0); + } +#else Gtk::Adjustment *a; if (exponent) { a = new Gtk::Adjustment (1.0, lower, upper, 0.01, 0.05, 0); } else { a = new Gtk::Adjustment (0.0, lower, upper, 0.1, 0.5, 0); } +#endif Inkscape::UI::Widget::SpinButton *sb; +#if WITH_GTKMM_3_0 + if (exponent) { + sb = new Inkscape::UI::Widget::SpinButton(a, 0.01, 2); + } else { + sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 1); + } +#else if (exponent) { sb = new Inkscape::UI::Widget::SpinButton (*a, 0.01, 2); } else { sb = new Inkscape::UI::Widget::SpinButton (*a, 0.1, 1); } +#endif sb->set_tooltip_text (tip); sb->set_width_chars (5); @@ -2717,7 +2766,7 @@ void CloneTiler::clonetiler_pick_to(GtkToggleButton *tb, gpointer data) void CloneTiler::clonetiler_reset_recursive(GtkWidget *w) { - if (w && GTK_IS_OBJECT(w)) { + if (w && G_IS_OBJECT(w)) { { int r = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(w), "zeroable")); if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index af5788ac6..e10668473 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -408,14 +408,27 @@ void Export::set_default_filename () { } +#if WITH_GTKMM_3_0 +Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, + float step, float page, GtkWidget *us, + Gtk::Table *t, int x, int y, + const Glib::ustring ll, const Glib::ustring lr, + int digits, unsigned int sensitive, + void (Export::*cb)() ) +#else Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, float step, float page, GtkWidget *us, Gtk::Table *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ) +#endif { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(val, min, max, step, page, 0); +#else Gtk::Adjustment *adj = new Gtk::Adjustment ( val, min, max, step, page, 0 ); +#endif if (us) { sp_unit_selector_add_adjustment ( SP_UNIT_SELECTOR (us), GTK_ADJUSTMENT (adj->gobj()) ); } @@ -431,7 +444,11 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl pos++; } +#if WITH_GTKMM_3_0 + Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); +#else Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); +#endif t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); sb->set_size_request (80, -1); sb->set_sensitive (sensitive); @@ -1288,7 +1305,11 @@ void Export::detectSize() { } /* sp_export_detect_size */ /// Called when area x0 value is changed +#if WITH_GTKMM_3_0 +void Export::areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj) +#else void Export::areaXChange (Gtk::Adjustment *adj) +#endif { float x0, x1, xdpi, width; @@ -1331,7 +1352,11 @@ void Export::areaXChange (Gtk::Adjustment *adj) } // end of sp_export_area_x_value_changed() /// Called when area y0 value is changed. +#if WITH_GTKMM_3_0 +void Export::areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj) +#else void Export::areaYChange (Gtk::Adjustment *adj) +#endif { float y0, y1, ydpi, height; @@ -1662,7 +1687,11 @@ void Export::setArea( double x0, double y0, double x1, double y1 ) * @param adj The adjustment widget * @param val What value to set it to. */ +#if WITH_GTKMM_3_0 +void Export::setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val ) +#else void Export::setValue( Gtk::Adjustment *adj, double val ) +#endif { if (adj) { adj->set_value(val); @@ -1680,7 +1709,11 @@ void Export::setValue( Gtk::Adjustment *adj, double val ) * @param adj The adjustment widget * @param val What the value should be in points. */ +#if WITH_GTKMM_3_0 +void Export::setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val) +#else void Export::setValuePx( Gtk::Adjustment *adj, double val) +#endif { const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj() ); @@ -1699,7 +1732,11 @@ void Export::setValuePx( Gtk::Adjustment *adj, double val) * * @return The value in the specified adjustment. */ +#if WITH_GTKMM_3_0 +float Export::getValue(Glib::RefPtr<Gtk::Adjustment>& adj) +#else float Export::getValue( Gtk::Adjustment *adj ) +#endif { if (!adj) { g_message("sp_export_value_get : adj is NULL"); @@ -1721,7 +1758,11 @@ float Export::getValue( Gtk::Adjustment *adj ) * * @return The value in the adjustment in points. */ +#if WITH_GTKMM_3_0 +float Export::getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj) +#else float Export::getValuePx( Gtk::Adjustment *adj ) +#endif { float value = getValue( adj); const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj()); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index eaab04762..5e421c66b 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -94,10 +94,17 @@ private: /* * Getter/setter style functions for the spinbuttons */ +#if WITH_GTKMM_3_0 + void setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val); + void setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val); + float getValue(Glib::RefPtr<Gtk::Adjustment>& adj); + float getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj); +#else void setValue (Gtk::Adjustment *adj, double val); void setValuePx (Gtk::Adjustment *adj, double val); float getValue (Gtk::Adjustment *adj); float getValuePx (Gtk::Adjustment *adj); +#endif /** * Helper function to create, style and pack spinbuttons for the export dialog. @@ -119,12 +126,22 @@ private: * @param sensitive Whether the spin button is sensitive or not * @param cb Callback for when this spin button is changed (optional) */ +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max, + float step, float page, GtkWidget *us, + Gtk::Table *t, int x, int y, + const Glib::ustring ll, const Glib::ustring lr, + int digits, unsigned int sensitive, + void (Export::*cb)() ); +#else Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max, float step, float page, GtkWidget *us, Gtk::Table *t, int x, int y, const Glib::ustring ll, const Glib::ustring lr, int digits, unsigned int sensitive, void (Export::*cb)() ); +#endif + /** * One of the area select radio buttons was pressed */ @@ -145,14 +162,22 @@ private: */ void onAreaX0Change() {areaXChange(x0_adj);} ; void onAreaX1Change() {areaXChange(x1_adj);} ; +#if WITH_GTKMM_3_0 + void areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj); +#else void areaXChange ( Gtk::Adjustment *adj); +#endif /** * Area Y value changed callback */ void onAreaY0Change() {areaYChange(y0_adj);} ; void onAreaY1Change() {areaYChange(y1_adj);} ; +#if WITH_GTKMM_3_0 + void areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj); +#else void areaYChange ( Gtk::Adjustment *adj); +#endif /** * Area width value changed callback @@ -261,6 +286,21 @@ private: Gtk::VBox area_box; Gtk::VBox singleexport_box; +#if WITH_GTKMM_3_0 + /* Custom size widgets */ + Glib::RefPtr<Gtk::Adjustment> x0_adj; + Glib::RefPtr<Gtk::Adjustment> x1_adj; + Glib::RefPtr<Gtk::Adjustment> y0_adj; + Glib::RefPtr<Gtk::Adjustment> y1_adj; + Glib::RefPtr<Gtk::Adjustment> width_adj; + Glib::RefPtr<Gtk::Adjustment> height_adj; + + /* Bitmap size widgets */ + Glib::RefPtr<Gtk::Adjustment> bmwidth_adj; + Glib::RefPtr<Gtk::Adjustment> bmheight_adj; + Glib::RefPtr<Gtk::Adjustment> xdpi_adj; + Glib::RefPtr<Gtk::Adjustment> ydpi_adj; +#else /* Custom size widgets */ Gtk::Adjustment *x0_adj; Gtk::Adjustment *x1_adj; @@ -274,6 +314,7 @@ private: Gtk::Adjustment *bmheight_adj; Gtk::Adjustment *xdpi_adj; Gtk::Adjustment *ydpi_adj; +#endif Gtk::VBox size_box; Gtk::Label* bm_label; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index a887c433f..4af328b49 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -2126,16 +2126,27 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr<Gdk::Dra bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout() { if(_autoscroll) { - Gtk::Adjustment& a = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); - double v; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); + double v = a->get_value() + _autoscroll; + + if(v < 0) + v = 0; + if(v > a->get_upper() - a->get_page_size()) + v = a->get_upper() - a->get_page_size(); - v = a.get_value() + _autoscroll; - if(v < 0) + a->set_value(v); +#else + Gtk::Adjustment& a = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); + double v = a.get_value() + _autoscroll; + + if(v < 0) v = 0; if(v > a.get_upper() - a.get_page_size()) v = a.get_upper() - a.get_page_size(); a.set_value(v); +#endif queue_draw(); } diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index fd9d71d6a..eb4790990 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -63,7 +63,11 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co _opacity_tag(Glib::ustring(history_prefix) + ":opacity"), _opacity_vbox(false, 0), _opacity_label(_("Opacity:")), +#if WITH_GTKMM_3_0 + _opacity_adjustment(Gtk::Adjustment::create(100.0, 0.0, 100.0, 1.0, 1.0, 0.0)), +#else _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0), +#endif _opacity_hscale(_opacity_adjustment), _opacity_spin_button(_opacity_adjustment, 0.01, 1), _fe_cb(flags), @@ -93,8 +97,13 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co _opacity_hbox.pack_start(_opacity_hscale, true, true, 0); _opacity_hbox.pack_start(_opacity_spin_button, false, false, 0); _opacity_hscale.set_draw_value(false); +#if WITH_GTKMM_3_0 + _opacity_adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged)); + _opacity_label.set_mnemonic_widget(_opacity_hscale); +#else _opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged)); _opacity_label.set_mnemonic_widget(_opacity_hscale); +#endif /* SizeGroup keeps the blur and opacity labels aligned in Fill & Stroke dlg */ GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -216,7 +225,11 @@ ObjectCompositeSettings::_opacityValueChanged() SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream os; +#if WITH_GTKMM_3_0 + os << CLAMP (_opacity_adjustment->get_value() / 100, 0.0, 1.0); +#else os << CLAMP (_opacity_adjustment.get_value() / 100, 0.0, 1.0); +#endif sp_repr_css_set_property (css, "opacity", os.str().c_str()); _subject->setCSS(css); @@ -259,7 +272,11 @@ ObjectCompositeSettings::_subjectChanged() { case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently case QUERY_STYLE_MULTIPLE_SAME: _opacity_hbox.set_sensitive(true); +#if WITH_GTKMM_3_0 + _opacity_adjustment->set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value)); +#else _opacity_adjustment.set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value)); +#endif break; } diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index d05839a03..9f9b336eb 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -47,7 +47,11 @@ private: Gtk::VBox _opacity_vbox; Gtk::HBox _opacity_hbox; Gtk::Label _opacity_label; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _opacity_adjustment; +#else Gtk::Adjustment _opacity_adjustment; +#endif Gtk::HScale _opacity_hscale; Inkscape::UI::Widget::SpinButton _opacity_spin_button; diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 385b60122..6aa6196bb 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -53,7 +53,11 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, } Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h index 1d91549d6..15f1a80fb 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -82,7 +82,11 @@ public: */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index e8c84a780..0a646b6fb 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -47,7 +47,11 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, } Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/random.h b/src/ui/widget/random.h index cb8c223dc..dc2b457c2 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -75,7 +75,11 @@ public: */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index cc051599c..9bbcc80f9 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -43,7 +43,11 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, } Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -137,7 +141,11 @@ void Scalar::update() void Scalar::addSlider() { +#if WITH_GTKMM_3_0 + Gtk::HScale *scale = new Gtk::HScale(static_cast<SpinButton*>(_widget)->get_adjustment()); +#else Gtk::HScale *scale = new Gtk::HScale( * static_cast<SpinButton*>(_widget)->get_adjustment() ); +#endif scale->set_draw_value(false); add (*manage (scale)); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 19ccb7ae0..86d7aee28 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -73,7 +73,11 @@ public: */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> &adjust, +#else Gtk::Adjustment &adjust, +#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index d26005317..a60e3cc31 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -14,6 +14,7 @@ #endif #include "selected-style.h" +#include <gtkmm/separatormenuitem.h> #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -129,7 +130,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _stroke_flag_place (), _opacity_place (), +#if WITH_GTKMM_3_0 + _opacity_adjustment(Gtk::Adjustment::create(100, 0.0, 100, 1.0, 10.0)), +#else _opacity_adjustment (100, 0.0, 100, 1.0, 10.0), +#endif _opacity_sb (0.02, 0), _stroke (), @@ -1041,7 +1046,11 @@ SelectedStyle::update() if (_opacity_blocked) break; _opacity_blocked = true; _opacity_sb.set_sensitive(true); +#if WITH_GTKMM_3_0 + _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100); +#else _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query->opacity.value) * 100); +#endif _opacity_blocked = false; break; } @@ -1141,7 +1150,11 @@ void SelectedStyle::on_opacity_changed () { _opacity_blocked = true; SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream os; +#if WITH_GTKMM_3_0 + os << CLAMP ((_opacity_adjustment->get_value() / 100), 0.0, 1.0); +#else os << CLAMP ((_opacity_adjustment.get_value() / 100), 0.0, 1.0); +#endif sp_repr_css_set_property (css, "opacity", os.str().c_str()); // FIXME: workaround for GTK breakage: display interruptibility sometimes results in GTK // sending multiple value-changed events. As if when Inkscape interrupts redraw for main loop diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 76a6a1595..542983b53 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -136,7 +136,11 @@ protected: Gtk::EventBox _stroke_flag_place; Gtk::EventBox _opacity_place; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _opacity_adjustment; +#else Gtk::Adjustment _opacity_adjustment; +#endif Inkscape::UI::Widget::SpinButton _opacity_sb; Gtk::Label _na[2]; diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 3e85f845e..97ae18e20 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -10,6 +10,7 @@ #include <glib.h> #include <glibmm/i18n.h> +#include <glibmm/stringutils.h> #include "spin-slider.h" @@ -19,7 +20,12 @@ namespace Widget { SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc, double climb_rate, int digits, const SPAttributeEnum a, const char* tip_text) - : AttrWidget(a, value), _adjustment(value, lower, upper, step_inc), + : AttrWidget(a, value), +#if WITH_GTKMM_3_0 + _adjustment(Gtk::Adjustment::create(value, lower, upper, step_inc)), +#else + _adjustment(value, lower, upper, step_inc), +#endif _scale(_adjustment), _spin(_adjustment, climb_rate, digits) { signal_value_changed().connect(signal_attr_changed().make_slot()); @@ -38,7 +44,11 @@ SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc Glib::ustring SpinSlider::get_as_attribute() const { +#if WITH_GTKMM_3_0 + const double val = _adjustment->get_value(); +#else const double val = _adjustment.get_value(); +#endif if(_spin.get_digits() == 0) return Glib::Ascii::dtostr((int)val); @@ -49,32 +59,59 @@ Glib::ustring SpinSlider::get_as_attribute() const void SpinSlider::set_from_attribute(SPObject* o) { const gchar* val = attribute_value(o); +#if WITH_GTKMM_3_0 + if(val) + _adjustment->set_value(Glib::Ascii::strtod(val)); + else + _adjustment->set_value(get_default()->as_double()); +#else if(val) _adjustment.set_value(Glib::Ascii::strtod(val)); else _adjustment.set_value(get_default()->as_double()); +#endif } Glib::SignalProxy0<void> SpinSlider::signal_value_changed() { +#if WITH_GTKMM_3_0 + return _adjustment->signal_value_changed(); +#else return _adjustment.signal_value_changed(); +#endif } double SpinSlider::get_value() const { +#if WITH_GTKMM_3_0 + return _adjustment->get_value(); +#else return _adjustment.get_value(); +#endif } void SpinSlider::set_value(const double val) { +#if WITH_GTKMM_3_0 + _adjustment->set_value(val); +#else _adjustment.set_value(val); +#endif } +#if WITH_GTKMM_3_0 +const Glib::RefPtr<Gtk::Adjustment> SpinSlider::get_adjustment() const +#else const Gtk::Adjustment& SpinSlider::get_adjustment() const +#endif { return _adjustment; } +#if WITH_GTKMM_3_0 +Glib::RefPtr<Gtk::Adjustment> SpinSlider::get_adjustment() +#else Gtk::Adjustment& SpinSlider::get_adjustment() +#endif { return _adjustment; } @@ -112,9 +149,15 @@ DualSpinSlider::DualSpinSlider(double value, double lower, double upper, double { signal_value_changed().connect(signal_attr_changed().make_slot()); +#if WITH_GTKMM_3_0 + _s1.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); + _s2.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); + _s1.get_adjustment()->signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); +#else _s1.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); _s2.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); _s1.get_adjustment().signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); +#endif _link.signal_toggled().connect(sigc::mem_fun(*this, &DualSpinSlider::link_toggled)); Gtk::VBox* vb = Gtk::manage(new Gtk::VBox); @@ -151,8 +194,13 @@ void DualSpinSlider::set_from_attribute(SPObject* o) _link.set_active(toks[1] == 0); +#if WITH_GTKMM_3_0 + _s1.get_adjustment()->set_value(v1); + _s2.get_adjustment()->set_value(v2); +#else _s1.get_adjustment().set_value(v1); _s2.get_adjustment().set_value(v2); +#endif g_strfreev(toks); } diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index 5078c1092..f4a62107b 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -38,8 +38,13 @@ public: double get_value() const; void set_value(const double); +#if WITH_GTKMM_3_0 + const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const; + Glib::RefPtr<Gtk::Adjustment> get_adjustment(); +#else const Gtk::Adjustment& get_adjustment() const; Gtk::Adjustment& get_adjustment(); +#endif const Gtk::HScale& get_scale() const; Gtk::HScale& get_scale(); @@ -50,7 +55,11 @@ public: // Change the SpinSlider into a SpinButton with AttrWidget support) void remove_scale(); private: +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _adjustment; +#else Gtk::Adjustment _adjustment; +#endif Gtk::HScale _scale; Inkscape::UI::Widget::SpinButton _spin; }; diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index b7764d979..57c48369e 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -33,7 +33,11 @@ public: { connect_signals(); }; +#if GTK_CHECK_VERSION(3,0,0) + explicit SpinButton(Glib::RefPtr<Gtk::Adjustment>& adjustment, double climb_rate = 0.0, guint digits = 0) +#else explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) +#endif : Gtk::SpinButton(adjustment, climb_rate, digits), _unit_menu(NULL) { diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index be710f5e5..16558f0ee 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -113,7 +113,11 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la void ToleranceSlider::setValue (double val) { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> adj = _hscale->get_adjustment(); +#else Gtk::Adjustment *adj = _hscale->get_adjustment(); +#endif adj->set_lower (1.0); adj->set_upper (51.0); diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp index 579449744..aea1beb17 100644 --- a/src/ui/widget/zoom-status.cpp +++ b/src/ui/widget/zoom-status.cpp @@ -23,7 +23,11 @@ namespace UI { namespace Widget { ZoomStatus::ZoomStatus() +#if WITH_GTKMM_3_0 + : _adj(Gtk::Adjustment::create(0.0, -1.0, 1.0, 0.1, 0.1)) +#else : _adj(0.0, -1.0, 1.0, 0.1, 0.1) +#endif { _dt = 0; _upd_f = false; @@ -43,11 +47,19 @@ ZoomStatus::init(SPDesktop *dt) { _dt = dt; property_digits() = 4; +#if WITH_GTKMM_3_0 + _adj->set_value(0.0); + _adj->set_lower(log(SP_DESKTOP_ZOOM_MIN)/log(2.0)); + _adj->set_upper(log(SP_DESKTOP_ZOOM_MAX)/log(2.0)); + _adj->set_step_increment(0.1); + _adj->set_page_increment(0.1); +#else _adj.set_value(0.0); _adj.set_lower(log(SP_DESKTOP_ZOOM_MIN)/log(2.0)); _adj.set_upper(log(SP_DESKTOP_ZOOM_MAX)/log(2.0)); _adj.set_step_increment(0.1); _adj.set_page_increment(0.1); +#endif set_adjustment(_adj); } diff --git a/src/ui/widget/zoom-status.h b/src/ui/widget/zoom-status.h index b9373589f..8f710300a 100644 --- a/src/ui/widget/zoom-status.h +++ b/src/ui/widget/zoom-status.h @@ -9,6 +9,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include <gtkmm/adjustment.h> #include "ui/widget/spinbutton.h" @@ -32,7 +36,11 @@ public: void update(); protected: +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _adj; +#else Gtk::Adjustment _adj; +#endif SPDesktop *_dt; bool _upd_f; diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index 7f36b91f5..901d3b68c 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -61,9 +61,17 @@ SPDashSelector::SPDashSelector() this->pack_start(dash_combo, false, false, 0); +#if WITH_GTKMM_3_0 + offset = Gtk::Adjustment::create(0.0, 0.0, 10.0, 0.1, 1.0, 0.0); +#else offset = new Gtk::Adjustment(0.0, 0.0, 10.0, 0.1, 1.0, 0.0); +#endif offset->signal_value_changed().connect(sigc::mem_fun(*this, &SPDashSelector::offset_value_changed)); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(offset, 0.1, 2); +#else Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(*offset, 0.1, 2); +#endif sb->set_tooltip_text(_("Pattern offset")); sp_dialog_defocus_on_enter_cpp(sb); sb->show(); @@ -84,7 +92,9 @@ SPDashSelector::SPDashSelector() SPDashSelector::~SPDashSelector() { // FIXME: for some reason this doesn't get called; does the call to manage() in // sp_stroke_style_line_widget_new() not processed correctly? +#if !WITH_GTKMM_3_0 delete offset; +#endif } void SPDashSelector::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) { diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h index 875d8e9d5..0a572f4de 100644 --- a/src/widgets/dash-selector.h +++ b/src/widgets/dash-selector.h @@ -77,7 +77,11 @@ private: Gtk::ComboBox dash_combo; Gtk::CellRendererPixbuf image_renderer; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> offset; +#else Gtk::Adjustment *offset; +#endif static gchar const *const _prefs_path; int preview_width; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 996f116e2..71f7b8c17 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -334,7 +334,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) /* Main table */ #if GTK_CHECK_VERSION(3,0,0) dtw->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_new(GTK_BOX(dtw->vbox), FALSE); + gtk_box_set_homogeneous(GTK_BOX(dtw->vbox), FALSE); #else dtw->vbox = gtk_vbox_new (FALSE, 0); #endif @@ -413,13 +413,17 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) /* Horizontal scrollbar */ dtw->hadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0); +#if GTK_CHECK_VERSION(3,0,0) + dtw->hscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (dtw->hadj)); +#else dtw->hscrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (dtw->hadj)); +#endif gtk_table_attach (GTK_TABLE (canvas_tbl), dtw->hscrollbar, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_SHRINK), 0, 0); /* Vertical scrollbar and the sticky zoom button */ #if GTK_CHECK_VERSION(3,0,0) dtw->vscrollbar_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_new(GTK_BOX(dtw->vscrollbar_box), FALSE); + gtk_box_set_homogeneous(GTK_BOX(dtw->vscrollbar_box), FALSE); #else dtw->vscrollbar_box = gtk_vbox_new (FALSE, 0); #endif @@ -432,7 +436,11 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw); dtw->vadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0); +#if GTK_CHECK_VERSION(3,0,0) + dtw->vscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(dtw->vadj)); +#else dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj)); +#endif gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0); gtk_table_attach (GTK_TABLE (canvas_tbl), dtw->vscrollbar_box, 2, 3, 0, 2, (GtkAttachOptions)(GTK_SHRINK), (GtkAttachOptions)(GTK_FILL), 0, 0); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index e23d4f84b..4378bc19d 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -270,7 +270,12 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits ) { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> adj = Glib::wrap(adjustment, true); + Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits); +#else Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits); +#endif inkSpinner = Gtk::manage( inkSpinner ); GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() ); return widget; diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index db378ef4d..90bd62847 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -296,7 +296,6 @@ Gtk::Container *sp_stroke_style_line_widget_new(void) GtkWidget *us_old, *spw_old; Gtk::Container *spw; Gtk::Table *t; - Gtk::Adjustment *a; Inkscape::UI::Widget::SpinButton *sb; Gtk::RadioButton *tb; Gtk::HBox *f, *hb; @@ -328,9 +327,15 @@ Gtk::Container *sp_stroke_style_line_widget_new(void) // with it, the two remaining calls of stroke_average_width, allowing us to get rid of that // function in desktop-style. - a = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0); +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0); + spw->set_data("width", &a); + sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 3); +#else + Gtk::Adjustment *a = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0); spw->set_data("width", a); sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 3); +#endif sb->set_tooltip_text(_("Stroke width")); sb->show(); spw_label(t, C_("Stroke width", "_Width:"), 0, i, sb); @@ -404,10 +409,16 @@ Gtk::Container *sp_stroke_style_line_widget_new(void) hb = spw_hbox(t, 3, 1, i); +#if WITH_GTKMM_3_0 + a = Gtk::Adjustment::create(4.0, 0.0, 100.0, 0.1, 10.0, 0.0); + spw->set_data("miterlimit", &a); + sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 2); +#else a = new Gtk::Adjustment(4.0, 0.0, 100.0, 0.1, 10.0, 0.0); spw->set_data("miterlimit", a); - sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 2); +#endif + sb->set_tooltip_text(_("Maximum length of the miter (in units of stroke width)")); sb->show(); spw_label(t, _("Miter _limit:"), 0, i, sb); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 7d73c042b..0ecea3766 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1119,7 +1119,12 @@ GtkWidget *ToolboxFactory::createSnapToolbox() static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits ) { +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> adj = Glib::wrap(adjustment, true); + Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits); +#else Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits); +#endif inkSpinner = Gtk::manage( inkSpinner ); GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() ); return widget; |
