summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Scholzen 'DASPRiD <mail@dasprids.de>2015-05-25 18:19:16 +0000
committer~suv <suv-sf@users.sourceforge.net>2015-05-25 18:19:16 +0000
commitb8cee2c3e14b2bf5b8f4bb56836ee17c31fd5147 (patch)
tree7b17cd30329742d521ab5eb29e79de6ce627810b /src
parentFix crash in import of PDF via Poppler/Cairo with relative path. (diff)
parentUse sane constant for min and max values in LPE dialogs (diff)
downloadinkscape-b8cee2c3e14b2bf5b8f4bb56836ee17c31fd5147.tar.gz
inkscape-b8cee2c3e14b2bf5b8f4bb56836ee17c31fd5147.zip
Fix locale number handling on powerstroke dialog (bug #1457172)
Fixed bugs: - https://launchpad.net/bugs/1457172 (bzr r14173)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/parameter/parameter.cpp7
-rw-r--r--src/live_effects/parameter/parameter.h7
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp5
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.cpp20
-rw-r--r--src/ui/dialog/lpe-powerstroke-properties.h14
5 files changed, 25 insertions, 28 deletions
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index beb750404..527bc06fe 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -42,13 +42,6 @@ Parameter::param_write_to_repr(const char * svgd)
param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
}
-// In gtk2, this wasn't an issue; we could toss around
-// G_MAXDOUBLE and not worry about size allocations. But
-// in gtk3, it is an issue: it allocates widget size for the maxmium
-// value you pass to it, leading to some insane lengths.
-// If you need this to be more, please be conservative about it.
-const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile.
-
void Parameter::write_to_SVG(void)
{
gchar * str = param_getSVGValue();
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 2e6cae49f..cc2c4f3d6 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -13,6 +13,13 @@
#include <2geom/forward.h>
#include <2geom/pathvector.h>
+// In gtk2, this wasn't an issue; we could toss around
+// G_MAXDOUBLE and not worry about size allocations. But
+// in gtk3, it is an issue: it allocates widget size for the maxmium
+// value you pass to it, leading to some insane lengths.
+// If you need this to be more, please be conservative about it.
+const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile.
+
class KnotHolder;
class SPLPEItem;
class SPDesktop;
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
index 061055feb..5ccee103c 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
@@ -27,6 +27,7 @@
#include "selection-chemistry.h"
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
+#include "live_effects/parameter/parameter.h"
#include <cmath>
//#include "event-context.h"
@@ -47,7 +48,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
_fillet_chamfer_position_numeric.set_digits(4);
_fillet_chamfer_position_numeric.set_increments(1,1);
//todo: get tha max aloable infinity freeze the widget
- _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.);
+ _fillet_chamfer_position_numeric.set_range(0., SCALARPARAM_G_MAXDOUBLE);
_fillet_chamfer_position_label.set_label(_("Radius (pixels):"));
_fillet_chamfer_position_label.set_alignment(1.0, 0.5);
@@ -59,7 +60,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
_fillet_chamfer_chamfer_subdivisions.set_digits(0);
_fillet_chamfer_chamfer_subdivisions.set_increments(1,1);
//todo: get tha max aloable infinity freeze the widget
- _fillet_chamfer_chamfer_subdivisions.set_range(0, 999999999999999999.0);
+ _fillet_chamfer_chamfer_subdivisions.set_range(0, SCALARPARAM_G_MAXDOUBLE);
_fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:"));
_fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5);
diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp
index 0cf3e9706..cfc972547 100644
--- a/src/ui/dialog/lpe-powerstroke-properties.cpp
+++ b/src/ui/dialog/lpe-powerstroke-properties.cpp
@@ -36,6 +36,7 @@
#include "selection-chemistry.h"
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
+#include "live_effects/parameter/parameter.h"
//#include "event-context.h"
namespace Inkscape {
@@ -52,10 +53,16 @@ PowerstrokePropertiesDialog::PowerstrokePropertiesDialog()
// Layer name widgets
_powerstroke_position_entry.set_activates_default(true);
+ _powerstroke_position_entry.set_digits(4);
+ _powerstroke_position_entry.set_increments(1,1);
+ _powerstroke_position_entry.set_range(-SCALARPARAM_G_MAXDOUBLE, SCALARPARAM_G_MAXDOUBLE);
_powerstroke_position_label.set_label(_("Position:"));
_powerstroke_position_label.set_alignment(1.0, 0.5);
_powerstroke_width_entry.set_activates_default(true);
+ _powerstroke_width_entry.set_digits(4);
+ _powerstroke_width_entry.set_increments(1,1);
+ _powerstroke_width_entry.set_range(-SCALARPARAM_G_MAXDOUBLE, SCALARPARAM_G_MAXDOUBLE);
_powerstroke_width_label.set_label(_("Width:"));
_powerstroke_width_label.set_alignment(1.0, 0.5);
@@ -126,12 +133,9 @@ void PowerstrokePropertiesDialog::showDialog(SPDesktop *desktop, Geom::Point kno
void
PowerstrokePropertiesDialog::_apply()
{
- std::istringstream i_pos(_powerstroke_position_entry.get_text());
- std::istringstream i_width(_powerstroke_width_entry.get_text());
- double d_pos, d_width;
- if ((i_pos >> d_pos) && i_width >> d_width) {
- _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width));
- }
+ double d_pos = _powerstroke_position_entry.get_value();
+ double d_width = _powerstroke_width_entry.get_value();
+ _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width));
_close();
}
@@ -171,8 +175,8 @@ void PowerstrokePropertiesDialog::_handleButtonEvent(GdkEventButton* event)
void PowerstrokePropertiesDialog::_setKnotPoint(Geom::Point knotpoint)
{
- _powerstroke_position_entry.set_text(boost::lexical_cast<std::string>(knotpoint.x()));
- _powerstroke_width_entry.set_text(boost::lexical_cast<std::string>(knotpoint.y()));
+ _powerstroke_position_entry.set_value(knotpoint.x());
+ _powerstroke_width_entry.set_value(knotpoint.y());
}
void PowerstrokePropertiesDialog::_setPt(const Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity *pt)
diff --git a/src/ui/dialog/lpe-powerstroke-properties.h b/src/ui/dialog/lpe-powerstroke-properties.h
index c53eac0d9..1e4c1df5b 100644
--- a/src/ui/dialog/lpe-powerstroke-properties.h
+++ b/src/ui/dialog/lpe-powerstroke-properties.h
@@ -13,15 +13,7 @@
#define INKSCAPE_DIALOG_POWERSTROKE_PROPERTIES_H
#include <2geom/point.h>
-#include <gtkmm/dialog.h>
-#include <gtkmm/entry.h>
-#include <gtkmm/label.h>
-#include <gtkmm/table.h>
-#include <gtkmm/combobox.h>
-#include <gtkmm/liststore.h>
-#include <gtkmm/treeview.h>
-#include <gtkmm/treestore.h>
-#include <gtkmm/scrolledwindow.h>
+#include <gtkmm.h>
#include "live_effects/parameter/powerstrokepointarray.h"
class SPDesktop;
@@ -45,9 +37,9 @@ protected:
Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity *_knotpoint;
Gtk::Label _powerstroke_position_label;
- Gtk::Entry _powerstroke_position_entry;
+ Gtk::SpinButton _powerstroke_position_entry;
Gtk::Label _powerstroke_width_label;
- Gtk::Entry _powerstroke_width_entry;
+ Gtk::SpinButton _powerstroke_width_entry;
Gtk::Table _layout_table;
bool _position_visible;