diff options
| author | Jabiertxof <jtx@jtx> | 2017-05-06 18:07:14 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-05-06 18:07:14 +0000 |
| commit | cb39bc5cd6fbecf0f045d58f30dd4288c590a46a (patch) | |
| tree | 9fbb940c15170a68e284dd8ca4a09f84eb8c311d /src/ui | |
| parent | LPE widget refactor. Improvement to not update on same value (diff) | |
| parent | Pre merge fixing (diff) | |
| download | inkscape-cb39bc5cd6fbecf0f045d58f30dd4288c590a46a.tar.gz inkscape-cb39bc5cd6fbecf0f045d58f30dd4288c590a46a.zip | |
Merge pathVectorSatellites
(bzr r15666)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 101 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.h | 48 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 8 |
3 files changed, 83 insertions, 74 deletions
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 0baf15e6b..82c6035d4 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -43,7 +43,6 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() //todo: get tha max aloable infinity freeze the widget _fillet_chamfer_position_numeric.set_range(0., SCALARPARAM_G_MAXDOUBLE); _fillet_chamfer_position_numeric.set_hexpand(); - _fillet_chamfer_position_label.set_label(_("Radius (pixels):")); _fillet_chamfer_position_label.set_alignment(1.0, 0.5); @@ -54,7 +53,6 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() //todo: get tha max aloable infinity freeze the widget _fillet_chamfer_chamfer_subdivisions.set_range(0, SCALARPARAM_G_MAXDOUBLE); _fillet_chamfer_chamfer_subdivisions.set_hexpand(); - _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); @@ -104,23 +102,26 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() { - _set_desktop(NULL); + _setDesktop(NULL); } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, Geom::Point knotpoint, + SPDesktop *desktop, + double _amount, const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - bool use_distance, - bool aprox_radius) + FilletChamferKnotHolderEntity *pt, + bool _use_distance, + bool _aprox_radius, + Satellite _satellite) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - dialog->_set_desktop(desktop); - dialog->_set_use_distance(use_distance); - dialog->_set_aprox(aprox_radius); - dialog->_set_knot_point(knotpoint); - dialog->_set_pt(pt); + dialog->_setDesktop(desktop); + dialog->_setUseDistance(_use_distance); + dialog->_setAprox(_aprox_radius); + dialog->_setAmount(_amount); + dialog->_setSatellite(_satellite); + dialog->_setPt(pt); dialog->set_title(_("Modify Fillet-Chamfer")); dialog->_apply_button.set_label(_("_Modify")); @@ -135,34 +136,38 @@ void FilletChamferPropertiesDialog::showDialog( void FilletChamferPropertiesDialog::_apply() { - double d_width; + double d_pos = _fillet_chamfer_position_numeric.get_value(); - if (d_pos) { + if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - d_width = 1; + _satellite.satellite_type = FILLET; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - d_width = 2; + _satellite.satellite_type = INVERSE_FILLET; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 4000; + _satellite.satellite_type = INVERSE_CHAMFER; } else { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 3000; + _satellite.satellite_type = CHAMFER; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { d_pos = 0; } - d_pos = _index + (d_pos / 100); - } else { - d_pos = d_pos * -1; + d_pos = d_pos / 100; + } + _satellite.amount = d_pos; + size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); + if (steps < 1) { + steps = 1; } - _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width)); + _satellite.steps = steps; + _knotpoint->knot_set_offset(_satellite); } _close(); } void FilletChamferPropertiesDialog::_close() { - _set_desktop(NULL); + _setDesktop(NULL); destroy_(); Glib::signal_idle().connect( sigc::bind_return( @@ -184,62 +189,68 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) +void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) { double position; std::string distance_or_radius = std::string(_("Radius")); - if(aprox){ + if (_aprox) { distance_or_radius = std::string(_("Radius approximated")); } - if(use_distance){ + if (_use_distance) { distance_or_radius = std::string(_("Knot distance")); } - if (knotpoint.x() > 0) { - double intpart; - position = modf(knotpoint[Geom::X], &intpart) * 100; + if (satellite.is_time) { + position = _amount * 100; _flexible = true; - _index = intpart; _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; std::string posConcat = Glib::ustring::compose (_("%1:"), distance_or_radius); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = knotpoint[Geom::X] * -1; + position = _amount; } _fillet_chamfer_position_numeric.set_value(position); - if (knotpoint.y() == 1) { + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); + if (satellite.satellite_type == FILLET) { _fillet_chamfer_type_fillet.set_active(true); - } else if (knotpoint.y() == 2) { + } else if (satellite.satellite_type == INVERSE_FILLET) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (knotpoint.y() >= 3000 && knotpoint.y() < 4000) { - _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 3000); + } else if (satellite.satellite_type == CHAMFER) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (knotpoint.y() >= 4000 && knotpoint.y() < 5000) { - _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 4000); + } else if (satellite.satellite_type == INVERSE_CHAMFER) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } + _satellite = satellite; } -void FilletChamferPropertiesDialog::_set_pt( +void FilletChamferPropertiesDialog::_setPt( const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt) + FilletChamferKnotHolderEntity *pt) { _knotpoint = const_cast< - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity *>( + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity *>( pt); } -void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) + +void FilletChamferPropertiesDialog::_setAmount(double amount) +{ + _amount = amount; +} + + + +void FilletChamferPropertiesDialog::_setUseDistance(bool use_knot_distance) { - use_distance = use_knot_distance; + _use_distance = use_knot_distance; } -void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) +void FilletChamferPropertiesDialog::_setAprox(bool _aprox_radius) { - aprox = aprox_radius; + _aprox = _aprox_radius; } -void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) +void FilletChamferPropertiesDialog::_setDesktop(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 c74e3f011..4021d6152 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -10,7 +10,7 @@ #include <2geom/point.h> #include <gtkmm.h> -#include "live_effects/parameter/filletchamferpointarray.h" +#include "live_effects/parameter/satellitesarray.h" class SPDesktop; @@ -23,20 +23,22 @@ public: FilletChamferPropertiesDialog(); virtual ~FilletChamferPropertiesDialog(); - Glib::ustring getName() const { + Glib::ustring getName() const + { return "LayerPropertiesDialog"; } - static void showDialog(SPDesktop *desktop, Geom::Point knotpoint, + static void showDialog(SPDesktop *desktop, double _amount, const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - bool use_distance, - bool aprox_radius); + FilletChamferKnotHolderEntity *pt, + bool _use_distance, + bool _aprox_radius, + Satellite _satellite); protected: SPDesktop *_desktop; - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity * + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity * _knotpoint; Gtk::Label _fillet_chamfer_position_label; @@ -51,36 +53,40 @@ protected: Gtk::Grid _layout_table; bool _position_visible; - double _index; Gtk::Button _close_button; Gtk::Button _apply_button; sigc::connection _destroy_connection; - static FilletChamferPropertiesDialog &_instance() { + static FilletChamferPropertiesDialog &_instance() + { static FilletChamferPropertiesDialog instance; return instance; } - void _set_desktop(SPDesktop *desktop); - void _set_pt(const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt); - void _set_use_distance(bool use_knot_distance); - void _set_aprox(bool aprox_radius); - void _apply(); - void _close(); - bool _flexible; - bool use_distance; - bool aprox; - void _set_knot_point(Geom::Point knotpoint); + void _setDesktop(SPDesktop *desktop); + void _setPt(const Inkscape::LivePathEffect:: + FilletChamferKnotHolderEntity *pt); + void _setUseDistance(bool use_knot_distance); + void _setAprox(bool aprox_radius); + void _setAmount(double amount); + void _setSatellite(Satellite satellite); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); bool _handleKeyEvent(GdkEventKey *event); void _handleButtonEvent(GdkEventButton *event); + void _apply(); + void _close(); + bool _flexible; + Satellite _satellite; + bool _use_distance; + double _amount; + bool _aprox; + friend class Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity; + FilletChamferKnotHolderEntity; private: FilletChamferPropertiesDialog( diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 5746a8f86..f2899dd01 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -12,7 +12,6 @@ #include "live_effects/lpe-powerstroke.h" #include "live_effects/lpe-bspline.h" -#include "live_effects/lpe-fillet-chamfer.h" #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> #include "ui/tool/path-manipulator.h" @@ -1364,13 +1363,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) lpe_pwr->adjustForNewPath(pathv); } } - this_effect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(this_effect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(this_effect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); - } - } } } |
