summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-04-30 22:04:12 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-04-30 22:04:12 +0000
commitbc19e10ccfe4010990d2a86cbae992f7825e2562 (patch)
treec34501ae52633d8b9451734a951196ed1675e471 /src/ui
parentemf import. use EMR_EXTSELECTCLIPRGN to cancel clipping (Bug 990083) (diff)
downloadinkscape-bc19e10ccfe4010990d2a86cbae992f7825e2562.tar.gz
inkscape-bc19e10ccfe4010990d2a86cbae992f7825e2562.zip
gtkmm-3.0 changes for Gtk::Adjustment
(bzr r11308)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/clonetiler.cpp57
-rw-r--r--src/ui/dialog/export.cpp41
-rw-r--r--src/ui/dialog/export.h41
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp19
-rw-r--r--src/ui/widget/object-composite-settings.cpp17
-rw-r--r--src/ui/widget/object-composite-settings.h4
-rw-r--r--src/ui/widget/point.cpp4
-rw-r--r--src/ui/widget/point.h4
-rw-r--r--src/ui/widget/random.cpp4
-rw-r--r--src/ui/widget/random.h4
-rw-r--r--src/ui/widget/scalar.cpp8
-rw-r--r--src/ui/widget/scalar.h4
-rw-r--r--src/ui/widget/selected-style.cpp13
-rw-r--r--src/ui/widget/selected-style.h4
-rw-r--r--src/ui/widget/spin-slider.cpp50
-rw-r--r--src/ui/widget/spin-slider.h9
-rw-r--r--src/ui/widget/spinbutton.h4
-rw-r--r--src/ui/widget/tolerance-slider.cpp4
-rw-r--r--src/ui/widget/zoom-status.cpp12
-rw-r--r--src/ui/widget/zoom-status.h8
20 files changed, 302 insertions, 9 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();
}
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;