summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-09-22 03:27:14 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-09-22 03:27:14 +0000
commit7c0506c103c881790a2e347e2a68aecdf8935d5c (patch)
tree46a54b7626bbf984e2f18cbcf364d180a8c5c6d0 /src
parentFix for 1014988 : Add gimp spin scale widget (diff)
downloadinkscape-7c0506c103c881790a2e347e2a68aecdf8935d5c.tar.gz
inkscape-7c0506c103c881790a2e347e2a68aecdf8935d5c.zip
Fix for 1014988 : Converts slide widgets to new spin-scale widget
(bzr r11691)
Diffstat (limited to 'src')
-rw-r--r--src/ege-adjustment-action.cpp10
-rw-r--r--src/extension/param/float.cpp25
-rw-r--r--src/extension/param/int.cpp25
-rw-r--r--src/ui/dialog/document-properties.cpp18
-rw-r--r--src/ui/dialog/fill-and-stroke.cpp2
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp88
-rw-r--r--src/ui/dialog/filter-effects-dialog.h1
-rw-r--r--src/ui/widget/filter-effect-chooser.cpp15
-rw-r--r--src/ui/widget/filter-effect-chooser.h8
-rw-r--r--src/ui/widget/object-composite-settings.cpp58
-rw-r--r--src/ui/widget/object-composite-settings.h12
-rw-r--r--src/ui/widget/spin-slider.cpp2
12 files changed, 110 insertions, 154 deletions
diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp
index 7881498b9..cf179478d 100644
--- a/src/ege-adjustment-action.cpp
+++ b/src/ege-adjustment-action.cpp
@@ -47,6 +47,7 @@
#include "icon-size.h"
#include "ege-adjustment-action.h"
+#include "ui/widget/gimpspinscale.h"
static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass );
@@ -835,15 +836,8 @@ static GtkWidget* create_tool_item( GtkAction* action )
if ( act->private_data->appearanceMode == APPEARANCE_FULL ) {
/* Slider */
- gchar *leakyForNow = g_value_dup_string( &value );
-#if GTK_CHECK_VERSION(3,0,0)
- spinbutton = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, act->private_data->adj);
-#else
- spinbutton = gtk_hscale_new( act->private_data->adj);
-#endif
+ spinbutton = gimp_spin_scale_new (act->private_data->adj, g_value_get_string( &value ), 0);
gtk_widget_set_size_request(spinbutton, 100, -1);
- gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 );
- g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow );
} else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) {
spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 );
diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp
index b9ffe68d2..81508f6c0 100644
--- a/src/extension/param/float.cpp
+++ b/src/extension/param/float.cpp
@@ -14,6 +14,7 @@
#include <gtkmm/box.h>
#include <gtkmm/scale.h>
#include "ui/widget/spinbutton.h"
+#include "ui/widget/spin-scale.h"
#include "xml/node.h"
#include "extension/extension.h"
@@ -175,9 +176,6 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
}
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
- label->show();
- hbox->pack_start(*label, true, true, _indent);
#if WITH_GTKMM_3_0
ParamFloatAdjustment * pfa = new ParamFloatAdjustment(this, doc, node, changeSignal);
@@ -187,24 +185,27 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
#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);
+
+ UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision);
+ scale->set_size_request(400, -1);
scale->show();
hbox->pack_start(*scale, false, false);
+
}
+ else if (_mode == MINIMAL) {
+
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
+ label->show();
+ hbox->pack_start(*label, true, true, _indent);
#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);
+ spin->show();
+ hbox->pack_start(*spin, false, false);
+ }
hbox->show();
diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp
index 7cb930f50..c286018fd 100644
--- a/src/extension/param/int.cpp
+++ b/src/extension/param/int.cpp
@@ -14,6 +14,7 @@
#include <gtkmm/box.h>
#include <gtkmm/scale.h>
#include "ui/widget/spinbutton.h"
+#include "ui/widget/spin-scale.h"
#include "xml/node.h"
#include "extension/extension.h"
@@ -156,9 +157,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
}
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
- label->show();
- hbox->pack_start(*label, true, true, _indent);
+
#if WITH_GTKMM_3_0
ParamIntAdjustment * pia = new ParamIntAdjustment(this, doc, node, changeSignal);
@@ -168,24 +167,26 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
#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);
+
+ UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0);
+ scale->set_size_request(400, -1);
scale->show();
hbox->pack_start(*scale, false, false);
}
+ else if (_mode == MINIMAL) {
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
+ label->show();
+ hbox->pack_start(*label, true, true, _indent);
+
#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);
+ spin->show();
+ hbox->pack_start(*spin, false, false);
+ }
hbox->show();
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index c7be0877d..7bd1b81c0 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -959,16 +959,18 @@ void DocumentProperties::removeEmbeddedScript(){
const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
- if (id == obj->getId()){
+ if (current->data && SP_IS_OBJECT(current->data)) {
+ SPObject* obj = SP_OBJECT(current->data);
+ if (id == obj->getId()){
- //XML Tree being used directly here while it shouldn't be.
- Inkscape::XML::Node *repr = obj->getRepr();
- if (repr){
- sp_repr_unparent(repr);
+ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node *repr = obj->getRepr();
+ if (repr){
+ sp_repr_unparent(repr);
- // inform the document, so we can undo
- DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script"));
+ // inform the document, so we can undo
+ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script"));
+ }
}
}
current = g_slist_next(current);
diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp
index 74c19fea7..c7efd3bf2 100644
--- a/src/ui/dialog/fill-and-stroke.cpp
+++ b/src/ui/dialog/fill-and-stroke.cpp
@@ -63,7 +63,7 @@ FillAndStroke::FillAndStroke()
_layoutPageStrokePaint();
_layoutPageStrokeStyle();
- contents->pack_start(_composite_settings, false, false, 0);
+ contents->pack_start(_composite_settings, true, true, 0);
show_all_children();
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 317cb2773..c3c44f6c3 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -78,8 +78,8 @@ namespace Dialog {
using Inkscape::UI::Widget::AttrWidget;
using Inkscape::UI::Widget::ComboBoxEnum;
-using Inkscape::UI::Widget::DualSpinSlider;
-using Inkscape::UI::Widget::SpinSlider;
+using Inkscape::UI::Widget::DualSpinScale;
+using Inkscape::UI::Widget::SpinScale;
// Returns the number of inputs available for the filter primitive type
@@ -484,8 +484,8 @@ public:
: AttrWidget(SP_ATTR_VALUES),
// TRANSLATORS: this dialog is accessible via menu Filters - Filter editor
_matrix(SP_ATTR_VALUES, _("This matrix determines a linear transform on color space. Each line affects one of the color components. Each column determines how much of each color component from the input is passed to the output. The last column does not depend on input colors, so can be used to adjust a constant component value.")),
- _saturation(0, 0, 1, 0.1, 0.01, 2, SP_ATTR_VALUES),
- _angle(0, 0, 360, 0.1, 0.01, 1, SP_ATTR_VALUES),
+ _saturation("", 0, 0, 1, 0.1, 0.01, 2, SP_ATTR_VALUES),
+ _angle("", 0, 0, 360, 0.1, 0.01, 1, SP_ATTR_VALUES),
_label(_("None"), Gtk::ALIGN_START),
_use_stored(false),
_saturation_store(0),
@@ -567,8 +567,8 @@ private:
}
MatrixAttr _matrix;
- SpinSlider _saturation;
- SpinSlider _angle;
+ SpinScale _saturation;
+ SpinScale _angle;
Gtk::Label _label;
// Store separate values for the different color modes
@@ -808,22 +808,22 @@ public:
return cmv;
}
- // SpinSlider
- SpinSlider* add_spinslider(double def, const SPAttributeEnum attr, const Glib::ustring& label,
+ // SpinScale
+ SpinScale* add_spinscale(double def, const SPAttributeEnum attr, const Glib::ustring& label,
const double lo, const double hi, const double step_inc, const double climb, const int digits, char* tip_text = NULL)
{
- SpinSlider* spinslider = new SpinSlider(def, lo, hi, step_inc, climb, digits, attr, tip_text);
+ SpinScale* spinslider = new SpinScale("", def, lo, hi, step_inc, climb, digits, attr, tip_text);
add_widget(spinslider, label);
add_attr_widget(spinslider);
return spinslider;
}
- // DualSpinSlider
- DualSpinSlider* add_dualspinslider(const SPAttributeEnum attr, const Glib::ustring& label,
+ // DualSpinScale
+ DualSpinScale* add_dualspinscale(const SPAttributeEnum attr, const Glib::ustring& label,
const double lo, const double hi, const double step_inc,
const double climb, const int digits, char* tip_text1 = NULL, char* tip_text2 = NULL)
{
- DualSpinSlider* dss = new DualSpinSlider(lo, lo, hi, step_inc, climb, digits, attr, tip_text1, tip_text2);
+ DualSpinScale* dss = new DualSpinScale("", "", lo, lo, hi, step_inc, climb, digits, attr, tip_text1, tip_text2);
add_widget(dss, label);
add_attr_widget(dss);
return dss;
@@ -971,8 +971,8 @@ public:
// FIXME: these range values are complete crap
_settings.type(LIGHT_DISTANT);
- _settings.add_spinslider(0, SP_ATTR_AZIMUTH, _("Azimuth"), 0, 360, 1, 1, 0, _("Direction angle for the light source on the XY plane, in degrees"));
- _settings.add_spinslider(0, SP_ATTR_ELEVATION, _("Elevation"), 0, 360, 1, 1, 0, _("Direction angle for the light source on the YZ plane, in degrees"));
+ _settings.add_spinscale(0, SP_ATTR_AZIMUTH, _("Azimuth"), 0, 360, 1, 1, 0, _("Direction angle for the light source on the XY plane, in degrees"));
+ _settings.add_spinscale(0, SP_ATTR_ELEVATION, _("Elevation"), 0, 360, 1, 1, 0, _("Direction angle for the light source on the YZ plane, in degrees"));
_settings.type(LIGHT_POINT);
_settings.add_multispinbutton(/*default x:*/ (double) 0, /*default y:*/ (double) 0, /*default z:*/ (double) 0, SP_ATTR_X, SP_ATTR_Y, SP_ATTR_Z, _("Location:"), -99999, 99999, 1, 100, 0, _("X coordinate"), _("Y coordinate"), _("Z coordinate"));
@@ -982,9 +982,9 @@ public:
_settings.add_multispinbutton(/*default x:*/ (double) 0, /*default y:*/ (double) 0, /*default z:*/ (double) 0,
SP_ATTR_POINTSATX, SP_ATTR_POINTSATY, SP_ATTR_POINTSATZ,
_("Points At"), -99999, 99999, 1, 100, 0, _("X coordinate"), _("Y coordinate"), _("Z coordinate"));
- _settings.add_spinslider(1, SP_ATTR_SPECULAREXPONENT, _("Specular Exponent"), 1, 100, 1, 1, 0, _("Exponent value controlling the focus for the light source"));
+ _settings.add_spinscale(1, SP_ATTR_SPECULAREXPONENT, _("Specular Exponent"), 1, 100, 1, 1, 0, _("Exponent value controlling the focus for the light source"));
//TODO: here I have used 100 degrees as default value. But spec says that if not specified, no limiting cone is applied. So, there should be a way for the user to set a "no limiting cone" option.
- _settings.add_spinslider(100, SP_ATTR_LIMITINGCONEANGLE, _("Cone Angle"), 1, 100, 1, 1, 0, _("This is the angle between the spot light axis (i.e. the axis between the light source and the point to which it is pointing at) and the spot light cone. No light is projected outside this cone."));
+ _settings.add_spinscale(100, SP_ATTR_LIMITINGCONEANGLE, _("Cone Angle"), 1, 100, 1, 1, 0, _("This is the angle between the spot light axis (i.e. the axis between the light source and the point to which it is pointing at) and the spot light cone. No light is projected outside this cone."));
}
Gtk::VBox& get_box()
@@ -2331,7 +2331,7 @@ void FilterEffectsDialog::show_all_vfunc()
void FilterEffectsDialog::init_settings_widgets()
{
- // TODO: Find better range/climb-rate/digits values for the SpinSliders,
+ // TODO: Find better range/climb-rate/digits values for the SpinScales,
// most of the current values are complete guesses!
_empty_settings.set_sensitive(false);
@@ -2358,18 +2358,18 @@ void FilterEffectsDialog::init_settings_widgets()
/*
//TRANSLATORS: for info on "Slope" and "Intercept", see http://id.mind.net/~zona/mmts/functionInstitute/linearFunctions/lsif.html
_settings->add_combo(COMPONENTTRANSFER_TYPE_IDENTITY, SP_ATTR_TYPE, _("Type"), ComponentTransferTypeConverter);
- _ct_slope = _settings->add_spinslider(1, SP_ATTR_SLOPE, _("Slope"), -10, 10, 0.1, 0.01, 2);
- _ct_intercept = _settings->add_spinslider(0, SP_ATTR_INTERCEPT, _("Intercept"), -10, 10, 0.1, 0.01, 2);
- _ct_amplitude = _settings->add_spinslider(1, SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 10, 0.1, 0.01, 2);
- _ct_exponent = _settings->add_spinslider(1, SP_ATTR_EXPONENT, _("Exponent"), 0, 10, 0.1, 0.01, 2);
- _ct_offset = _settings->add_spinslider(0, SP_ATTR_OFFSET, _("Offset"), -10, 10, 0.1, 0.01, 2);*/
+ _ct_slope = _settings->add_spinscale(1, SP_ATTR_SLOPE, _("Slope"), -10, 10, 0.1, 0.01, 2);
+ _ct_intercept = _settings->add_spinscale(0, SP_ATTR_INTERCEPT, _("Intercept"), -10, 10, 0.1, 0.01, 2);
+ _ct_amplitude = _settings->add_spinscale(1, SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 10, 0.1, 0.01, 2);
+ _ct_exponent = _settings->add_spinscale(1, SP_ATTR_EXPONENT, _("Exponent"), 0, 10, 0.1, 0.01, 2);
+ _ct_offset = _settings->add_spinscale(0, SP_ATTR_OFFSET, _("Offset"), -10, 10, 0.1, 0.01, 2);*/
_settings->type(NR_FILTER_COMPOSITE);
_settings->add_combo(COMPOSITE_OVER, SP_ATTR_OPERATOR, _("Operator:"), CompositeOperatorConverter);
- _k1 = _settings->add_spinslider(0, SP_ATTR_K1, _("K1:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
- _k2 = _settings->add_spinslider(0, SP_ATTR_K2, _("K2:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
- _k3 = _settings->add_spinslider(0, SP_ATTR_K3, _("K3:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
- _k4 = _settings->add_spinslider(0, SP_ATTR_K4, _("K4:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
+ _k1 = _settings->add_spinscale(0, SP_ATTR_K1, _("K1:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
+ _k2 = _settings->add_spinscale(0, SP_ATTR_K2, _("K2:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
+ _k3 = _settings->add_spinscale(0, SP_ATTR_K3, _("K3:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
+ _k4 = _settings->add_spinscale(0, SP_ATTR_K4, _("K4:"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
_settings->type(NR_FILTER_CONVOLVEMATRIX);
_convolve_order = _settings->add_dualspinbutton((char*)"3", SP_ATTR_ORDER, _("Size:"), 1, 5, 1, 1, 0, _("width of the convolve matrix"), _("height of the convolve matrix"));
@@ -2377,50 +2377,50 @@ void FilterEffectsDialog::init_settings_widgets()
//TRANSLATORS: for info on "Kernel", see http://en.wikipedia.org/wiki/Kernel_(matrix)
_convolve_matrix = _settings->add_matrix(SP_ATTR_KERNELMATRIX, _("Kernel:"), _("This matrix describes the convolve operation that is applied to the input image in order to calculate the pixel colors at the output. Different arrangements of values in this matrix result in various possible visual effects. An identity matrix would lead to a motion blur effect (parallel to the matrix diagonal) while a matrix filled with a constant non-zero value would lead to a common blur effect."));
_convolve_order->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::convolve_order_changed));
- _settings->add_spinslider(0, SP_ATTR_DIVISOR, _("Divisor:"), 0, 1000, 1, 0.1, 2, _("After applying the kernelMatrix to the input image to yield a number, that number is divided by divisor to yield the final destination color value. A divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result."));
- _settings->add_spinslider(0, SP_ATTR_BIAS, _("Bias:"), -10, 10, 1, 0.01, 1, _("This value is added to each component. This is useful to define a constant value as the zero response of the filter."));
+ _settings->add_spinscale(0, SP_ATTR_DIVISOR, _("Divisor:"), 0, 1000, 1, 0.1, 2, _("After applying the kernelMatrix to the input image to yield a number, that number is divided by divisor to yield the final destination color value. A divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result."));
+ _settings->add_spinscale(0, SP_ATTR_BIAS, _("Bias:"), -10, 10, 1, 0.01, 1, _("This value is added to each component. This is useful to define a constant value as the zero response of the filter."));
_settings->add_combo(CONVOLVEMATRIX_EDGEMODE_DUPLICATE, SP_ATTR_EDGEMODE, _("Edge Mode:"), ConvolveMatrixEdgeModeConverter, _("Determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image."));
_settings->add_checkbutton(false, SP_ATTR_PRESERVEALPHA, _("Preserve Alpha"), "true", "false", _("If set, the alpha channel won't be altered by this filter primitive."));
_settings->type(NR_FILTER_DIFFUSELIGHTING);
_settings->add_color(/*default: white*/ 0xffffffff, SP_PROP_LIGHTING_COLOR, _("Diffuse Color:"), _("Defines the color of the light source"));
- _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.01, 0.001, 3, _("This value amplifies the heights of the bump map defined by the input alpha channel"));
- _settings->add_spinslider(1, SP_ATTR_DIFFUSECONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model."));
- _settings->add_dualspinslider(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1);
+ _settings->add_spinscale(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.01, 0.001, 3, _("This value amplifies the heights of the bump map defined by the input alpha channel"));
+ _settings->add_spinscale(1, SP_ATTR_DIFFUSECONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model."));
+ _settings->add_dualspinscale(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1);
_settings->add_lightsource();
_settings->type(NR_FILTER_DISPLACEMENTMAP);
- _settings->add_spinslider(0, SP_ATTR_SCALE, _("Scale:"), 0, 100, 1, 0.01, 1, _("This defines the intensity of the displacement effect."));
+ _settings->add_spinscale(0, SP_ATTR_SCALE, _("Scale:"), 0, 100, 1, 0.01, 1, _("This defines the intensity of the displacement effect."));
_settings->add_combo(DISPLACEMENTMAP_CHANNEL_ALPHA, SP_ATTR_XCHANNELSELECTOR, _("X displacement:"), DisplacementMapChannelConverter, _("Color component that controls the displacement in the X direction"));
_settings->add_combo(DISPLACEMENTMAP_CHANNEL_ALPHA, SP_ATTR_YCHANNELSELECTOR, _("Y displacement:"), DisplacementMapChannelConverter, _("Color component that controls the displacement in the Y direction"));
_settings->type(NR_FILTER_FLOOD);
_settings->add_color(/*default: black*/ 0, SP_PROP_FLOOD_COLOR, _("Flood Color:"), _("The whole filter region will be filled with this color."));
- _settings->add_spinslider(1, SP_PROP_FLOOD_OPACITY, _("Opacity:"), 0, 1, 0.1, 0.01, 2);
+ _settings->add_spinscale(1, SP_PROP_FLOOD_OPACITY, _("Opacity:"), 0, 1, 0.1, 0.01, 2);
_settings->type(NR_FILTER_GAUSSIANBLUR);
- _settings->add_dualspinslider(SP_ATTR_STDDEVIATION, _("Standard Deviation:"), 0.01, 100, 1, 0.01, 1, _("The standard deviation for the blur operation."));
+ _settings->add_dualspinscale(SP_ATTR_STDDEVIATION, _("Standard Deviation:"), 0.01, 100, 1, 0.01, 1, _("The standard deviation for the blur operation."));
_settings->type(NR_FILTER_MERGE);
_settings->add_no_params();
_settings->type(NR_FILTER_MORPHOLOGY);
_settings->add_combo(MORPHOLOGY_OPERATOR_ERODE, SP_ATTR_OPERATOR, _("Operator:"), MorphologyOperatorConverter, _("Erode: performs \"thinning\" of input image.\nDilate: performs \"fattenning\" of input image."));
- _settings->add_dualspinslider(SP_ATTR_RADIUS, _("Radius:"), 0, 100, 1, 0.01, 1);
+ _settings->add_dualspinscale(SP_ATTR_RADIUS, _("Radius:"), 0, 100, 1, 0.01, 1);
_settings->type(NR_FILTER_IMAGE);
_settings->add_fileorelement(SP_ATTR_XLINK_HREF, _("Source of Image:"));
_settings->type(NR_FILTER_OFFSET);
- _settings->add_spinslider(0, SP_ATTR_DX, _("Delta X:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted to the right"));
- _settings->add_spinslider(0, SP_ATTR_DY, _("Delta Y:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted downwards"));
+ _settings->add_spinscale(0, SP_ATTR_DX, _("Delta X:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted to the right"));
+ _settings->add_spinscale(0, SP_ATTR_DY, _("Delta Y:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted downwards"));
_settings->type(NR_FILTER_SPECULARLIGHTING);
_settings->add_color(/*default: white*/ 0xffffffff, SP_PROP_LIGHTING_COLOR, _("Specular Color:"), _("Defines the color of the light source"));
- _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.1, 0.01, 2, _("This value amplifies the heights of the bump map defined by the input alpha channel"));
- _settings->add_spinslider(1, SP_ATTR_SPECULARCONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model."));
- _settings->add_spinslider(1, SP_ATTR_SPECULAREXPONENT, _("Exponent:"), 1, 50, 1, 0.01, 1, _("Exponent for specular term, larger is more \"shiny\"."));
- _settings->add_dualspinslider(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1);
+ _settings->add_spinscale(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.1, 0.01, 2, _("This value amplifies the heights of the bump map defined by the input alpha channel"));
+ _settings->add_spinscale(1, SP_ATTR_SPECULARCONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model."));
+ _settings->add_spinscale(1, SP_ATTR_SPECULAREXPONENT, _("Exponent:"), 1, 50, 1, 0.01, 1, _("Exponent for specular term, larger is more \"shiny\"."));
+ _settings->add_dualspinscale(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1);
_settings->add_lightsource();
_settings->type(NR_FILTER_TILE);
@@ -2429,9 +2429,9 @@ void FilterEffectsDialog::init_settings_widgets()
_settings->type(NR_FILTER_TURBULENCE);
// _settings->add_checkbutton(false, SP_ATTR_STITCHTILES, _("Stitch Tiles"), "stitch", "noStitch");
_settings->add_combo(TURBULENCE_TURBULENCE, SP_ATTR_TYPE, _("Type:"), TurbulenceTypeConverter, _("Indicates whether the filter primitive should perform a noise or turbulence function."));
- _settings->add_dualspinslider(SP_ATTR_BASEFREQUENCY, _("Base Frequency:"), 0, 1, 0.001, 0.01, 3);
- _settings->add_spinslider(1, SP_ATTR_NUMOCTAVES, _("Octaves:"), 1, 10, 1, 1, 0);
- _settings->add_spinslider(0, SP_ATTR_SEED, _("Seed:"), 0, 1000, 1, 1, 0, _("The starting number for the pseudo random number generator."));
+ _settings->add_dualspinscale(SP_ATTR_BASEFREQUENCY, _("Base Frequency:"), 0, 1, 0.001, 0.01, 3);
+ _settings->add_spinscale(1, SP_ATTR_NUMOCTAVES, _("Octaves:"), 1, 10, 1, 1, 0);
+ _settings->add_spinscale(0, SP_ATTR_SEED, _("Seed:"), 0, 1000, 1, 1, 0, _("The starting number for the pseudo random number generator."));
}
void FilterEffectsDialog::add_primitive()
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index 38811354e..acdeecb71 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -20,6 +20,7 @@
#include "sp-filter.h"
#include "ui/widget/combo-enums.h"
#include "ui/widget/spin-slider.h"
+#include "ui/widget/spin-scale.h"
#include "xml/helper-observer.h"
#include "ui/dialog/desktop-tracker.h"
diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp
index 8d6bcf60f..65706a9dc 100644
--- a/src/ui/widget/filter-effect-chooser.cpp
+++ b/src/ui/widget/filter-effect-chooser.cpp
@@ -22,12 +22,9 @@ namespace UI {
namespace Widget {
SimpleFilterModifier::SimpleFilterModifier(int flags)
- : _hb_blur(false, 0),
- _lb_blend(_("Blend mode:")),
- _lb_blur(_("_Blur:")),
- _lb_blur_unit(_("%")),
+ : _lb_blend(_("Blend mode:")),
_blend(BlendModeConverter, SP_ATTR_INVALID, false),
- _blur(0, 0, 100, 1, 0.01, 1)
+ _blur(_("Blur (%)"), 0, 0, 100, 1, 0.01, 1)
{
_flags = flags;
@@ -37,11 +34,7 @@ SimpleFilterModifier::SimpleFilterModifier(int flags)
_hb_blend.pack_start(_blend);
}
if (flags & BLUR) {
- add(_hb_blur);
- _lb_blur.set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
- _hb_blur.pack_start(_lb_blur, false, false, 0);
- _hb_blur.pack_start(_blur, true, true, 0);
- _hb_blur.pack_start(_lb_blur_unit, false, false, 3);
+ add(_blur);
}
show_all_children();
@@ -49,8 +42,6 @@ SimpleFilterModifier::SimpleFilterModifier(int flags)
_hb_blend.set_spacing(12);
_lb_blend.set_use_underline();
_lb_blend.set_mnemonic_widget(_blend);
- _lb_blur.set_use_underline();
- _lb_blur.set_mnemonic_widget(_blur.get_scale());
_blend.signal_changed().connect(signal_blend_blur_changed());
_blur.signal_value_changed().connect(signal_blend_blur_changed());
}
diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h
index 6afb6c180..ae3ec07c4 100644
--- a/src/ui/widget/filter-effect-chooser.h
+++ b/src/ui/widget/filter-effect-chooser.h
@@ -18,6 +18,7 @@
#include "combo-enums.h"
#include "filter-enums.h"
#include "spin-slider.h"
+#include "spin-scale.h"
namespace Inkscape {
namespace UI {
@@ -45,17 +46,14 @@ public:
double get_blur_value() const;
void set_blur_value(const double);
void set_blur_sensitive(const bool);
- Gtk::Label *get_blur_label() { return &_lb_blur; };
-
private:
int _flags;
Gtk::HBox _hb_blend;
- Gtk::HBox _hb_blur;
- Gtk::Label _lb_blend, _lb_blur, _lb_blur_unit;
+ Gtk::Label _lb_blend;
ComboBoxEnum<Inkscape::Filters::FilterBlendMode> _blend;
- SpinSlider _blur;
+ SpinScale _blur;
sigc::signal<void> _signal_blend_blur_changed;
};
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 1cb384501..2789676ea 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -16,6 +16,7 @@
#include <glibmm/i18n.h>
+#include "desktop.h"
#include "desktop-handles.h"
#include "desktop-style.h"
#include "document.h"
@@ -32,6 +33,7 @@
#include "ui/icon-names.h"
#include "display/sp-canvas.h"
#include "ui/widget/style-subject.h"
+#include "ui/widget/gimpspinscale.h"
namespace Inkscape {
namespace UI {
@@ -62,50 +64,34 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co
_blur_tag(Glib::ustring(history_prefix) + ":blur"),
_opacity_tag(Glib::ustring(history_prefix) + ":opacity"),
_opacity_vbox(false, 0),
- _opacity_label(_("Opacity:")),
- _opacity_label_unit(_("%")),
-#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),
+ _opacity_scale(_("Opacity (%)"), 100.0, 0.0, 100.0, 1.0, 1.0, 1),
_fe_cb(flags),
_fe_vbox(false, 0),
- _fe_alignment(1, 1, 1, 1),
_blocked(false)
{
// Filter Effects
pack_start(_fe_vbox, false, false, 2);
- _fe_alignment.set_padding(0, 0, 4, 0);
- _fe_alignment.add(_fe_cb);
- _fe_vbox.pack_start(_fe_alignment, false, false, 0);
+ _fe_vbox.pack_start(_fe_cb, false, false, 0);
_fe_cb.signal_blend_blur_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_blendBlurValueChanged));
// Opacity
pack_start(_opacity_vbox, false, false, 2);
- _opacity_label.set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER);
- _opacity_hbox.pack_start(_opacity_label, false, false, 3);
- //_opacity_vbox.pack_start(_opacity_label_box, false, false, 0);
- _opacity_vbox.pack_start(_opacity_hbox, false, false, 0);
- _opacity_hbox.pack_start(_opacity_hscale, true, true, 0);
- _opacity_hbox.pack_start(_opacity_spin_button, false, false, 0);
- _opacity_hbox.pack_start(_opacity_label_unit, false, false, 3);
- _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
+ _opacity_vbox.pack_start(_opacity_scale);
+
+ _opacity_scale.set_appearance("compact");
+
+ _opacity_scale.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged));
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ _opacity_scale.set_focuswidget(GTK_WIDGET(desktop->canvas));
/* SizeGroup keeps the blur and opacity labels aligned in Fill & Stroke dlg */
+/*
GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget(labels, (GtkWidget *) _opacity_label.gobj());
gtk_size_group_add_widget(labels, (GtkWidget *) _fe_cb.get_blur_label()->gobj());
+*/
show_all_children();
@@ -223,11 +209,7 @@ 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
+ os << CLAMP (_opacity_scale.get_adjustment()->get_value() / 100, 0.0, 1.0);
sp_repr_css_set_property (css, "opacity", os.str().c_str());
_subject->setCSS(css);
@@ -263,18 +245,14 @@ ObjectCompositeSettings::_subjectChanged() {
switch (result) {
case QUERY_STYLE_NOTHING:
- _opacity_hbox.set_sensitive(false);
+ _opacity_vbox.set_sensitive(false);
// gtk_widget_set_sensitive (opa, FALSE);
break;
case QUERY_STYLE_SINGLE:
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
+ _opacity_vbox.set_sensitive(true);
+ _opacity_scale.get_adjustment()->set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value));
break;
}
diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h
index 32da626d6..d3a208525 100644
--- a/src/ui/widget/object-composite-settings.h
+++ b/src/ui/widget/object-composite-settings.h
@@ -45,22 +45,12 @@ private:
Glib::ustring _opacity_tag;
Gtk::VBox _opacity_vbox;
- Gtk::HBox _opacity_hbox;
- Gtk::Label _opacity_label;
- Gtk::Label _opacity_label_unit;
-#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;
+ Inkscape::UI::Widget::SpinScale _opacity_scale;
StyleSubject *_subject;
SimpleFilterModifier _fe_cb;
Gtk::VBox _fe_vbox;
- Gtk::Alignment _fe_alignment;
bool _blocked;
gulong _desktop_activated;
diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp
index 97ae18e20..323b1209c 100644
--- a/src/ui/widget/spin-slider.cpp
+++ b/src/ui/widget/spin-slider.cpp
@@ -186,7 +186,7 @@ void DualSpinSlider::set_from_attribute(SPObject* o)
gchar** toks = g_strsplit(val, " ", 2);
if(toks) {
- double v1, v2;
+ double v1 = 0.0, v2 = 0.0;
if(toks[0])
v1 = v2 = Glib::Ascii::strtod(toks[0]);
if(toks[1])