summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-04-19 06:14:35 +0000
committerJon A. Cruz <jon@joncruz.org>2011-04-19 06:14:35 +0000
commit84766315ff4f59563bc8e6e100b6fc1d435df6f7 (patch)
tree356f15b57275349155e9c80a1b4323619be5645e /src/widgets
parentdxf import. add support for longer cubic NURB (Bug 685707) (diff)
downloadinkscape-84766315ff4f59563bc8e6e100b6fc1d435df6f7.tar.gz
inkscape-84766315ff4f59563bc8e6e100b6fc1d435df6f7.zip
Restore modularity to adjustment action.
(bzr r10184)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/select-toolbar.cpp17
-rw-r--r--src/widgets/toolbox.cpp15
2 files changed, 32 insertions, 0 deletions
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index 89253983b..e08b4ac61 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -23,6 +23,7 @@
#include "widgets/spw-utilities.h"
#include "widgets/widget-sizes.h"
#include "widgets/spinbutton-events.h"
+#include "ui/widget/spinbutton.h"
#include "widgets/icon.h"
#include "widgets/sp-widget.h"
@@ -255,6 +256,16 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
}
+static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits )
+{
+ Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
+ inkSpinner = Gtk::manage( inkSpinner );
+ GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() );
+ return widget;
+}
+
+// TODO create_adjustment_action appears to be a rogue tile copy from toolbox.cpp. Resolve it to be unified:
+
static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
gchar const *label,
gchar const *shortLabel,
@@ -266,6 +277,12 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
gchar const *tooltip,
gboolean altx )
{
+ static bool init = false;
+ if ( !init ) {
+ init = true;
+ ege_adjustment_action_set_compact_tool_factory( createCustomSlider );
+ }
+
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, lower, 1e6, SPIN_STEP, SPIN_PAGE_STEP, 0 ) );
if (tracker) {
tracker->addAdjustment(adj);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index fe87bc4e2..8496ec0d0 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -100,6 +100,7 @@
#include "../verbs.h"
#include "../widgets/button.h"
#include "../widgets/spinbutton-events.h"
+#include "ui/widget/spinbutton.h"
#include "../widgets/spw-utilities.h"
#include "../widgets/widget-sizes.h"
#include "../xml/attribute-record.h"
@@ -1052,6 +1053,14 @@ GtkWidget *ToolboxFactory::createSnapToolbox()
return toolboxNewCommon( tb, BAR_SNAP, GTK_POS_LEFT );
}
+static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits )
+{
+ Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
+ inkSpinner = Gtk::manage( inkSpinner );
+ GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() );
+ return widget;
+}
+
static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
gchar const *label, gchar const *shortLabel, gchar const *tooltip,
Glib::ustring const &path, gdouble def,
@@ -1064,6 +1073,12 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name,
void (*callback)(GtkAdjustment *, GObject *),
gdouble climb = 0.1, guint digits = 3, double factor = 1.0 )
{
+ static bool init = false;
+ if ( !init ) {
+ init = true;
+ ege_adjustment_action_set_compact_tool_factory( createCustomSlider );
+ }
+
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( prefs->getDouble(path, def) * factor,
lower, upper, step, page, 0 ) );