diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-11-09 23:50:46 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-11-09 23:50:46 +0000 |
| commit | 05a8ca8653fefcdc59e3ee1d1416829ec2712c8f (patch) | |
| tree | 5d7f4a26ccae7463b72801bdcfa9e48c4a98b664 /src | |
| parent | improve regex from DPI Switcher (diff) | |
| download | inkscape-05a8ca8653fefcdc59e3ee1d1416829ec2712c8f.tar.gz inkscape-05a8ca8653fefcdc59e3ee1d1416829ec2712c8f.zip | |
fix a bug pointed by su_v in fillet chamfer dialog, about units
(bzr r13697)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/effect.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.cpp | 7 | ||||
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 34 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.h | 13 |
6 files changed, 38 insertions, 20 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index fbdc78f8a..ca3b29b66 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -416,7 +416,6 @@ Effect::isNodePointSelected(Geom::Point const &nodePoint) const for (std::vector<Geom::Point>::const_iterator i = selectedNodesPoints.begin(); i != selectedNodesPoints.end(); ++i) { Geom::Point p = *i; - std::cout << p << "p\n"; p[Geom::X] = Inkscape::Util::Quantity::convert(p[Geom::X], "px", *defaultUnit); p[Geom::Y] = Inkscape::Util::Quantity::convert(p[Geom::Y], "px", *defaultUnit); if (Geom::are_near(p, nodePoint, 0.01)) { diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index c491ea858..c89bfbd37 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -416,6 +416,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } else { fillet_chamfer_values.set_helper_size(helper_size); } + fillet_chamfer_values.set_document_unit(defaultUnit); fillet_chamfer_values.set_use_distance(use_knot_distance); fillet_chamfer_values.set_unit(unit.get_abbreviation()); SPCurve *c = SP_IS_PATH(lpeItem) ? static_cast<SPPath const *>(lpeItem) diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index 31d996ad0..cf9ef3132 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -354,6 +354,11 @@ void FilletChamferPointArrayParam::set_pwd2( last_pwd2_normal = pwd2_normal_in; } +void FilletChamferPointArrayParam::set_document_unit(Glib::ustring const * value_document_unit) +{ + documentUnit = value_document_unit; +} + void FilletChamferPointArrayParam::set_helper_size(int hs) { helper_size = hs; @@ -819,7 +824,7 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state) bool aprox = (A[0].degreesOfFreedom() != 2 || B[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false; Geom::Point offset = Geom::Point(xModified, _pparam->_vector.at(_index).y()); Inkscape::UI::Dialogs::FilletChamferPropertiesDialog::showDialog( - this->desktop, offset, this, _pparam->unit, _pparam->use_distance, aprox); + this->desktop, offset, this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit); } } diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h index 1dd31d6d4..6e5cce353 100644 --- a/src/live_effects/parameter/filletchamferpointarray.h +++ b/src/live_effects/parameter/filletchamferpointarray.h @@ -53,6 +53,7 @@ public: virtual void set_helper_size(int hs); virtual void set_use_distance(bool use_knot_distance); virtual void set_chamfer_steps(int value_chamfer_steps); + virtual void set_document_unit(Glib::ustring const * value_document_unit); virtual void set_unit(const gchar *abbr); virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec); @@ -89,6 +90,7 @@ private: int chamfer_steps; bool use_distance; const gchar *unit; + Glib::ustring const * documentUnit; Geom::PathVector hp; Geom::Piecewise<Geom::D2<Geom::SBasis> > last_pwd2; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index fa909924d..e9d69b464 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -116,7 +116,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() { - _setDesktop(NULL); + _set_desktop(NULL); } void FilletChamferPropertiesDialog::showDialog( @@ -125,16 +125,18 @@ void FilletChamferPropertiesDialog::showDialog( FilletChamferPointArrayParamKnotHolderEntity *pt, const gchar *unit, bool use_distance, - bool aprox_radius) + bool aprox_radius, + Glib::ustring const * documentUnit) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - dialog->_setDesktop(desktop); - dialog->_setUnit(unit); + dialog->_set_desktop(desktop); + dialog->_set_unit(unit); dialog->_set_use_distance(use_distance); dialog->_set_aprox(aprox_radius); - dialog->_setKnotPoint(knotpoint); - dialog->_setPt(pt); + dialog->_set_document_unit(documentUnit); + dialog->_set_knot_point(knotpoint); + dialog->_set_pt(pt); dialog->set_title(_("Modify Fillet-Chamfer")); dialog->_apply_button.set_label(_("_Modify")); @@ -165,7 +167,7 @@ void FilletChamferPropertiesDialog::_apply() } d_pos = _index + (d_pos / 100); } else { - d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, "px"); + d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); d_pos = d_pos * -1; } _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width)); @@ -175,7 +177,7 @@ void FilletChamferPropertiesDialog::_apply() void FilletChamferPropertiesDialog::_close() { - _setDesktop(NULL); + _set_desktop(NULL); destroy_(); Glib::signal_idle().connect( sigc::bind_return( @@ -197,7 +199,7 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint) +void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) { double position; std::string distance_or_radius = std::string(_("Radius ")); @@ -219,7 +221,8 @@ void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint) std::string(_("(")) + std::string(unit) + std::string(")"); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); position = knotpoint[Geom::X] * -1; - position = Inkscape::Util::Quantity::convert(position, "px", unit); + + position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); if (knotpoint.y() == 1) { @@ -231,7 +234,7 @@ void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint) } } -void FilletChamferPropertiesDialog::_setPt( +void FilletChamferPropertiesDialog::_set_pt( const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt) { @@ -240,11 +243,16 @@ void FilletChamferPropertiesDialog::_setPt( pt); } -void FilletChamferPropertiesDialog::_setUnit(const gchar *abbr) +void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) { unit = abbr; } +void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr) +{ + document_unit = abbr; +} + void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) { use_distance = use_knot_distance; @@ -255,7 +263,7 @@ void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) aprox = aprox_radius; } -void FilletChamferPropertiesDialog::_setDesktop(SPDesktop *desktop) +void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) { if (desktop) { Inkscape::GC::anchor(desktop); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index deae0cee0..ec87addc5 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -32,7 +32,8 @@ public: FilletChamferPointArrayParamKnotHolderEntity *pt, const gchar *unit, bool use_distance, - bool aprox_radius); + bool aprox_radius, + Glib::ustring const * documentUnit); protected: @@ -63,19 +64,21 @@ protected: return instance; } - void _setDesktop(SPDesktop *desktop); - void _setPt(const Inkscape::LivePathEffect:: + void _set_desktop(SPDesktop *desktop); + void _set_pt(const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt); - void _setUnit(const gchar *abbr); + void _set_unit(const gchar *abbr); + void _set_document_unit(Glib::ustring const * abbr); void _set_use_distance(bool use_knot_distance); void _set_aprox(bool aprox_radius); void _apply(); void _close(); bool _flexible; const gchar *unit; + Glib::ustring const * document_unit; bool use_distance; bool aprox; - void _setKnotPoint(Geom::Point knotpoint); + void _set_knot_point(Geom::Point knotpoint); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); bool _handleKeyEvent(GdkEventKey *event); |
