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 /src/ui/dialog | |
| 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)
Diffstat (limited to 'src/ui/dialog')
| -rw-r--r-- | src/ui/dialog/clonetiler.cpp | 57 | ||||
| -rw-r--r-- | src/ui/dialog/export.cpp | 41 | ||||
| -rw-r--r-- | src/ui/dialog/export.h | 41 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.cpp | 19 |
4 files changed, 150 insertions, 8 deletions
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(); } |
