From a230b9d6684f01ded46fd530ba0cc74ce9696e2d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 19 Feb 2015 21:53:20 +0100 Subject: Basic filleting using pointwise (bzr r13645.1.16) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 300 ------------------------ src/ui/dialog/lpe-fillet-chamfer-properties.h | 115 --------- 2 files changed, 415 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index b318933a7..e69de29bb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -1,300 +0,0 @@ -/** - * From the code of Liam P.White from his Power Stroke Knot dialog - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H -#include -#endif - -#include -#include "lpe-fillet-chamfer-properties.h" -#include -#include -#include -#include "inkscape.h" -#include "desktop.h" -#include "document.h" -#include "document-undo.h" -#include "layer-manager.h" -#include "message-stack.h" - -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" -#include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "util/units.h" -#include - -//#include "event-context.h" - -namespace Inkscape { -namespace UI { -namespace Dialogs { - -FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() - : _desktop(NULL), _knotpoint(NULL), _position_visible(false) -{ - Gtk::Box *mainVBox = get_vbox(); - mainVBox->set_homogeneous(false); - _layout_table.set_spacings(4); - _layout_table.resize(3, 3); - - // Layer name widgets - _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_label.set_label(_("Radius (pixels):")); - _fillet_chamfer_position_label.set_alignment(1.0, 0.5); - - _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL, - Gtk::FILL); - _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1, - Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _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_label.set_label(_("Chamfer subdivisions:")); - _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); - - _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL, - Gtk::FILL); - _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2, - Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _fillet_chamfer_type_fillet.set_label(_("Fillet")); - _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet")); - _fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_chamfer.set_label(_("Chamfer")); - _fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer")); - _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group); - - - mainVBox->pack_start(_layout_table, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4); - - // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); - _close_button.set_can_default(); - - _apply_button.set_use_underline(true); - _apply_button.set_can_default(); - - _close_button.signal_clicked() - .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)); - _apply_button.signal_clicked() - .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_apply)); - - signal_delete_event().connect(sigc::bind_return( - sigc::hide(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)), - true)); - - add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); - add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); - - _apply_button.grab_default(); - - show_all_children(); - - set_focus(_fillet_chamfer_position_numeric); -} - -FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() -{ - - _set_desktop(NULL); -} - -void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, Geom::Point knotpoint, - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring const * documentUnit) -{ - FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - - dialog->_set_desktop(desktop); - dialog->_set_unit(unit); - dialog->_set_use_distance(use_distance); - dialog->_set_aprox(aprox_radius); - 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")); - - dialog->set_modal(true); - desktop->setWindowTransient(dialog->gobj()); - dialog->property_destroy_with_parent() = true; - - dialog->show(); - dialog->present(); -} - -void FilletChamferPropertiesDialog::_apply() -{ - double d_width; - double d_pos = _fillet_chamfer_position_numeric.get_value(); - if (d_pos) { - if (_fillet_chamfer_type_fillet.get_active() == true) { - d_width = 1; - } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - d_width = 2; - } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 4000; - } else { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 3000; - } - if (_flexible) { - if (d_pos > 99.99999 || d_pos < 0) { - d_pos = 0; - } - d_pos = _index + (d_pos / 100); - } else { - 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)); - } - _close(); -} - -void FilletChamferPropertiesDialog::_close() -{ - _set_desktop(NULL); - destroy_(); - Glib::signal_idle().connect( - sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), - false - ) - ); -} - -bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/) -{ - return false; -} - -void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) -{ - if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) { - _apply(); - } -} - -void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) -{ - double position; - std::string distance_or_radius = std::string(_("Radius")); - if(aprox){ - distance_or_radius = std::string(_("Radius approximated")); - } - if(use_distance){ - distance_or_radius = std::string(_("Knot distance")); - } - if (knotpoint.x() > 0) { - double intpart; - position = modf(knotpoint[Geom::X], &intpart) * 100; - _flexible = true; - _index = intpart; - _fillet_chamfer_position_label.set_label(_("Position (%):")); - } else { - _flexible = false; - std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); - _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = knotpoint[Geom::X] * -1; - - position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); - } - _fillet_chamfer_position_numeric.set_value(position); - if (knotpoint.y() == 1) { - _fillet_chamfer_type_fillet.set_active(true); - } else if (knotpoint.y() == 2) { - _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); - _fillet_chamfer_type_chamfer.set_active(true); - } else if (knotpoint.y() >= 4000 && knotpoint.y() < 5000) { - _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 4000); - _fillet_chamfer_type_inverse_chamfer.set_active(true); - } -} - -void FilletChamferPropertiesDialog::_set_pt( - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt) -{ - _knotpoint = const_cast< - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity *>( - pt); -} - -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; -} - -void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) -{ - aprox = aprox_radius; -} - -void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) -{ - if (desktop) { - Inkscape::GC::anchor(desktop); - } - if (_desktop) { - Inkscape::GC::release(_desktop); - } - _desktop = desktop; -} - -} // namespace -} // namespace -} // namespace - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: -// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 -// : diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 3807e98c8..e69de29bb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -1,115 +0,0 @@ -/** - * - * From the code of Liam P.White from his Power Stroke Knot dialog - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H -#define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H - -#include <2geom/point.h> -#include -#include "live_effects/parameter/filletchamferpointarray.h" - -class SPDesktop; - -namespace Inkscape { -namespace UI { -namespace Dialogs { - -class FilletChamferPropertiesDialog : public Gtk::Dialog { -public: - FilletChamferPropertiesDialog(); - virtual ~FilletChamferPropertiesDialog(); - - Glib::ustring getName() const { - return "LayerPropertiesDialog"; - } - - static void showDialog(SPDesktop *desktop, Geom::Point knotpoint, - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring const * documentUnit); - -protected: - - SPDesktop *_desktop; - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity * - _knotpoint; - - Gtk::Label _fillet_chamfer_position_label; - Gtk::SpinButton _fillet_chamfer_position_numeric; - Gtk::RadioButton::Group _fillet_chamfer_type_group; - Gtk::RadioButton _fillet_chamfer_type_fillet; - Gtk::RadioButton _fillet_chamfer_type_inverse_fillet; - Gtk::RadioButton _fillet_chamfer_type_chamfer; - Gtk::RadioButton _fillet_chamfer_type_inverse_chamfer; - Gtk::Label _fillet_chamfer_chamfer_subdivisions_label; - Gtk::SpinButton _fillet_chamfer_chamfer_subdivisions; - - Gtk::Table _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; - return instance; - } - - void _set_desktop(SPDesktop *desktop); - void _set_pt(const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt); - 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 _set_knot_point(Geom::Point knotpoint); - void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); - - bool _handleKeyEvent(GdkEventKey *event); - void _handleButtonEvent(GdkEventButton *event); - - friend class Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity; - -private: - FilletChamferPropertiesDialog( - FilletChamferPropertiesDialog const &); // no copy - FilletChamferPropertiesDialog &operator=( - FilletChamferPropertiesDialog const &); // no assign -}; - -} // namespace -} // namespace -} // namespace - -#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: -// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 -// : -- cgit v1.2.3 From 1db09cce6114c1b2d95ac77b00672caad0447b29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 4 Mar 2015 23:42:59 +0100 Subject: All features done, only need piecewise update function (bzr r13645.1.33) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 313 ++++++++++++++++++++++++ src/ui/dialog/lpe-fillet-chamfer-properties.h | 118 +++++++++ 2 files changed, 431 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index e69de29bb..fe0deba57 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -0,0 +1,313 @@ +/** + * From the code of Liam P.White from his Power Stroke Knot dialog + * + * Released under GNU GPL. Read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H +#include +#endif + +#include +#include "lpe-fillet-chamfer-properties.h" +#include +#include +#include +#include "inkscape.h" +#include "desktop.h" +#include "document.h" +#include "document-undo.h" +#include "layer-manager.h" +#include "message-stack.h" + +#include "sp-object.h" +#include "sp-item.h" +#include "verbs.h" +#include "selection.h" +#include "selection-chemistry.h" +#include "ui/icon-names.h" +#include "ui/widget/imagetoggler.h" +#include "util/units.h" +#include + +//#include "event-context.h" + +namespace Inkscape { +namespace UI { +namespace Dialogs { + +FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() + : _desktop(NULL), _knotpoint(NULL), _position_visible(false) +{ + Gtk::Box *mainVBox = get_vbox(); + mainVBox->set_homogeneous(false); + _layout_table.set_spacings(4); + _layout_table.resize(3, 3); + + // Layer name widgets + _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_label.set_label(_("Radius (pixels):")); + _fillet_chamfer_position_label.set_alignment(1.0, 0.5); + + _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL, + Gtk::FILL); + _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1, + Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _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(1, 4294967295); + + _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); + _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); + + _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL, + Gtk::FILL); + _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2, + Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _fillet_chamfer_type_fillet.set_label(_("Fillet")); + _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet")); + _fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_chamfer.set_label(_("Chamfer")); + _fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer")); + _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group); + + + mainVBox->pack_start(_layout_table, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4); + + // Buttons + _close_button.set_use_stock(true); + _close_button.set_label(Gtk::Stock::CANCEL.id); + _close_button.set_can_default(); + + _apply_button.set_use_underline(true); + _apply_button.set_can_default(); + + _close_button.signal_clicked() + .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)); + _apply_button.signal_clicked() + .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_apply)); + + signal_delete_event().connect(sigc::bind_return( + sigc::hide(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)), + true)); + + add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); + add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); + + _apply_button.grab_default(); + + show_all_children(); + + set_focus(_fillet_chamfer_position_numeric); +} + +FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() +{ + + _set_desktop(NULL); +} + +void FilletChamferPropertiesDialog::showDialog( + SPDesktop *desktop, double ammount, + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt, + const gchar *unit, + bool use_distance, + bool aprox_radius, + Glib::ustring const * documentUnit, + Geom::Satellite satellite) +{ + FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); + + dialog->_set_desktop(desktop); + dialog->_set_unit(unit); + dialog->_set_use_distance(use_distance); + dialog->_set_aprox(aprox_radius); + dialog->_set_document_unit(documentUnit); + dialog->_set_ammount(ammount); + dialog->_set_satellite(satellite); + dialog->_set_pt(pt); + + dialog->set_title(_("Modify Fillet-Chamfer")); + dialog->_apply_button.set_label(_("_Modify")); + + dialog->set_modal(true); + desktop->setWindowTransient(dialog->gobj()); + dialog->property_destroy_with_parent() = true; + + dialog->show(); + dialog->present(); +} + +void FilletChamferPropertiesDialog::_apply() +{ + + double d_pos = _fillet_chamfer_position_numeric.get_value(); + if (d_pos >= 0) { + if (_fillet_chamfer_type_fillet.get_active() == true) { + _satellite.setSatelliteType(Geom::F); + } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { + _satellite.setSatelliteType(Geom::IF); + } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { + _satellite.setSatelliteType(Geom::IC); + } else { + _satellite.setSatelliteType(Geom::C); + } + if (_flexible) { + if (d_pos > 99.99999 || d_pos < 0) { + d_pos = 0; + } + d_pos = d_pos / 100; + } else { + d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); + } + _satellite.setAmmount( d_pos); + unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); + if(steps < 1){ + steps = 1; + } + _satellite.setSteps(steps); + _knotpoint->knot_set_offset(_satellite); + } + _close(); +} + +void FilletChamferPropertiesDialog::_close() +{ + _set_desktop(NULL); + destroy_(); + Glib::signal_idle().connect( + sigc::bind_return( + sigc::bind(sigc::ptr_fun(&::operator delete), this), + false + ) + ); +} + +bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/) +{ + return false; +} + +void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) +{ + if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) { + _apply(); + } +} + +void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) +{ + double position; + std::string distance_or_radius = std::string(_("Radius")); + if(aprox){ + distance_or_radius = std::string(_("Radius approximated")); + } + if(use_distance){ + distance_or_radius = std::string(_("Knot distance")); + } + if (satellite.getIsTime()) { + position = ammount * 100; + _flexible = true; + _fillet_chamfer_position_label.set_label(_("Position (%):")); + } else { + _flexible = false; + std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); + _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); + position = ammount; + position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); + } + _fillet_chamfer_position_numeric.set_value(position); + if (satellite.getSatelliteType() == Geom::F) { + _fillet_chamfer_type_fillet.set_active(true); + } else if (satellite.getSatelliteType() == Geom::IF) { + _fillet_chamfer_type_inverse_fillet.set_active(true); + } else if (satellite.getSatelliteType() == Geom::C) { + _fillet_chamfer_type_chamfer.set_active(true); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); + } else if (satellite.getSatelliteType() == Geom::IC) { + _fillet_chamfer_type_inverse_chamfer.set_active(true); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); + } + _satellite = satellite; +} + +void FilletChamferPropertiesDialog::_set_pt( + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt) +{ + _knotpoint = const_cast< + Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity *>( + pt); +} + +void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) +{ + unit = abbr; +} + +void FilletChamferPropertiesDialog::_set_ammount(double amm) +{ + ammount = amm; +} + + + + +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; +} + +void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) +{ + aprox = aprox_radius; +} + +void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) +{ + if (desktop) { + Inkscape::GC::anchor(desktop); + } + if (_desktop) { + Inkscape::GC::release(_desktop); + } + _desktop = desktop; +} + +} // namespace +} // namespace +} // namespace + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: +// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 +// : diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index e69de29bb..63215d17c 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -0,0 +1,118 @@ +/** + * + * From the code of Liam P.White from his Power Stroke Knot dialog + * + * Released under GNU GPL. Read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H +#define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H + +#include <2geom/point.h> +#include +#include "live_effects/parameter/satellitepairarray.h" + +class SPDesktop; + +namespace Inkscape { +namespace UI { +namespace Dialogs { + +class FilletChamferPropertiesDialog : public Gtk::Dialog { +public: + FilletChamferPropertiesDialog(); + virtual ~FilletChamferPropertiesDialog(); + + Glib::ustring getName() const { + return "LayerPropertiesDialog"; + } + + static void showDialog(SPDesktop *desktop, double ammount, + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt, + const gchar *unit, + bool use_distance, + bool aprox_radius, + Glib::ustring const * documentUnit, + Geom::Satellite satellite); + +protected: + + SPDesktop *_desktop; + Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity * + _knotpoint; + + Gtk::Label _fillet_chamfer_position_label; + Gtk::SpinButton _fillet_chamfer_position_numeric; + Gtk::RadioButton::Group _fillet_chamfer_type_group; + Gtk::RadioButton _fillet_chamfer_type_fillet; + Gtk::RadioButton _fillet_chamfer_type_inverse_fillet; + Gtk::RadioButton _fillet_chamfer_type_chamfer; + Gtk::RadioButton _fillet_chamfer_type_inverse_chamfer; + Gtk::Label _fillet_chamfer_chamfer_subdivisions_label; + Gtk::SpinButton _fillet_chamfer_chamfer_subdivisions; + + Gtk::Table _layout_table; + bool _position_visible; + + Gtk::Button _close_button; + Gtk::Button _apply_button; + + sigc::connection _destroy_connection; + + static FilletChamferPropertiesDialog &_instance() { + static FilletChamferPropertiesDialog instance; + return instance; + } + + void _set_desktop(SPDesktop *desktop); + void _set_pt(const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt); + 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; + Geom::Satellite _satellite; + const gchar *unit; + Glib::ustring const * document_unit; + bool use_distance; + double ammount; + bool aprox; + void _set_ammount(double ammount); + void _set_satellite(Geom::Satellite satellite); + void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + + bool _handleKeyEvent(GdkEventKey *event); + void _handleButtonEvent(GdkEventButton *event); + + friend class Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity; + +private: + FilletChamferPropertiesDialog( + FilletChamferPropertiesDialog const &); // no copy + FilletChamferPropertiesDialog &operator=( + FilletChamferPropertiesDialog const &); // no assign +}; + +} // namespace +} // namespace +} // namespace + +#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: +// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 +// : -- cgit v1.2.3 From 62ebac099d8fa013e34a773c0fe3aee56b5a5758 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 7 Mar 2015 13:55:16 +0100 Subject: finish helper paths and beter handle of fillet/chamfer overflow. Also make the satellitepairarray LPE parameter usable for other pointwise effects, not only to fillet chamfer (bzr r13645.1.35) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 20 ++++++++++---------- src/ui/dialog/lpe-fillet-chamfer-properties.h | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index fe0deba57..8a6cbadad 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -123,9 +123,9 @@ FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double ammount, + SPDesktop *desktop, double amount, const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt, + FilletChamferKnotHolderEntity *pt, const gchar *unit, bool use_distance, bool aprox_radius, @@ -139,7 +139,7 @@ void FilletChamferPropertiesDialog::showDialog( dialog->_set_use_distance(use_distance); dialog->_set_aprox(aprox_radius); dialog->_set_document_unit(documentUnit); - dialog->_set_ammount(ammount); + dialog->_set_amount(amount); dialog->_set_satellite(satellite); dialog->_set_pt(pt); @@ -176,7 +176,7 @@ void FilletChamferPropertiesDialog::_apply() } else { d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); } - _satellite.setAmmount( d_pos); + _satellite.setAmount( d_pos); unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; @@ -222,14 +222,14 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) distance_or_radius = std::string(_("Knot distance")); } if (satellite.getIsTime()) { - position = ammount * 100; + position = amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = ammount; + position = amount; position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); @@ -249,10 +249,10 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) void FilletChamferPropertiesDialog::_set_pt( const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt) + FilletChamferKnotHolderEntity *pt) { _knotpoint = const_cast< - Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity *>( + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity *>( pt); } @@ -261,9 +261,9 @@ void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) unit = abbr; } -void FilletChamferPropertiesDialog::_set_ammount(double amm) +void FilletChamferPropertiesDialog::_set_amount(double amm) { - ammount = amm; + amount = amm; } diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 63215d17c..6051b49d3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -27,9 +27,9 @@ public: return "LayerPropertiesDialog"; } - static void showDialog(SPDesktop *desktop, double ammount, + static void showDialog(SPDesktop *desktop, double amount, const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt, + FilletChamferKnotHolderEntity *pt, const gchar *unit, bool use_distance, bool aprox_radius, @@ -39,7 +39,7 @@ public: protected: SPDesktop *_desktop; - Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity * + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity * _knotpoint; Gtk::Label _fillet_chamfer_position_label; @@ -67,7 +67,7 @@ protected: void _set_desktop(SPDesktop *desktop); void _set_pt(const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt); + FilletChamferKnotHolderEntity *pt); void _set_unit(const gchar *abbr); void _set_document_unit(Glib::ustring const * abbr); void _set_use_distance(bool use_knot_distance); @@ -79,9 +79,9 @@ protected: const gchar *unit; Glib::ustring const * document_unit; bool use_distance; - double ammount; + double amount; bool aprox; - void _set_ammount(double ammount); + void _set_amount(double amount); void _set_satellite(Geom::Satellite satellite); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); @@ -89,7 +89,7 @@ protected: void _handleButtonEvent(GdkEventButton *event); friend class Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity; + FilletChamferKnotHolderEntity; private: FilletChamferPropertiesDialog( -- cgit v1.2.3 From 4c1951cc43deafcc0131ba6a0878b4f371651f68 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 8 Mar 2015 16:30:33 +0100 Subject: merged anf fixed from trunk (bzr r13645.1.39) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index d0f52775a..c6959b718 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -129,12 +129,8 @@ void FilletChamferPropertiesDialog::showDialog( const gchar *unit, bool use_distance, bool aprox_radius, -<<<<<<< TREE - Glib::ustring const * documentUnit, + Glib::ustring documentUnit, Geom::Satellite satellite) -======= - Glib::ustring documentUnit) ->>>>>>> MERGE-SOURCE { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); @@ -265,7 +261,6 @@ void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) unit = abbr; } -<<<<<<< TREE void FilletChamferPropertiesDialog::_set_amount(double amm) { amount = amm; @@ -274,10 +269,7 @@ void FilletChamferPropertiesDialog::_set_amount(double amm) -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr) -======= void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) ->>>>>>> MERGE-SOURCE { document_unit = abbr; } -- cgit v1.2.3 From aeffc3f474c1ce460b2c9f8340de283d5853a164 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 19 Mar 2015 19:26:22 +0100 Subject: fixing a boring bug in path manipulator (bzr r13645.1.43) --- src/ui/tool/path-manipulator.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index c8b986824..dbcde240a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1221,10 +1221,13 @@ int PathManipulator::BSplineGetSteps() const { LivePathEffect::LPEBSpline const *lpe_bsp = NULL; - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect const *thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } } } int steps = 0; @@ -1338,19 +1341,22 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) _spcurve->set_pathvector(pathv); if (alert_LPE) { /// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming? - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); - if(thisEffect){ - LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_pwr) { - lpe_pwr->adjustForNewPath(pathv); + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); + if(thisEffect){ + LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_pwr) { + lpe_pwr->adjustForNewPath(pathv); + } } - } - thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); + thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); + if(thisEffect){ + LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_fll) { + lpe_fll->adjustForNewPath(pathv); + } } } } -- cgit v1.2.3 From f3e7b51b1d2497cda7a66e13f4f50da145ece19c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 20 Mar 2015 00:14:47 +0100 Subject: Added delete nodes/satellites (bzr r13645.1.45) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index c6959b718..aa27a1414 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -233,16 +233,15 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) position = Inkscape::Util::Quantity::convert(position, document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); if (satellite.getSatelliteType() == Geom::F) { _fillet_chamfer_type_fillet.set_active(true); } else if (satellite.getSatelliteType() == Geom::IF) { _fillet_chamfer_type_inverse_fillet.set_active(true); } else if (satellite.getSatelliteType() == Geom::C) { _fillet_chamfer_type_chamfer.set_active(true); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); } else if (satellite.getSatelliteType() == Geom::IC) { _fillet_chamfer_type_inverse_chamfer.set_active(true); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); } _satellite = satellite; } -- cgit v1.2.3 From cfe5bd077cc29fd43385792435f687d468aca13f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 21 Mar 2015 10:55:27 +0100 Subject: fix bspline calls and atemp to fic a bug whith map (bzr r13645.1.46) --- src/ui/tool/node.cpp | 20 ++++++++++---------- src/ui/tool/path-manipulator.cpp | 6 +++--- src/ui/tool/path-manipulator.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index eeea47e4d..5cfc2a0ca 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -175,7 +175,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -192,7 +192,7 @@ void Handle::move(Geom::Point const &new_pos) setRelativePos(new_delta); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -218,7 +218,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); // moves the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -313,7 +313,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven //this function moves the handler and its oposite to the default proportion of defaultStartPower void Handle::handle_2button_press(){ - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,defaultStartPower)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),defaultStartPower)); _pm().update(); @@ -373,7 +373,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = result; // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" // by default in live BSpline - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this,this)*steps)/steps); @@ -423,7 +423,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } } //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position - if(_pm().isBSpline() && !held_shift(*event) && !held_control(*event)){ + if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } move(new_pos); // needed for correct update, even though it's redundant @@ -656,7 +656,7 @@ void Node::move(Geom::Point const &new_pos) _fixNeighbors(old_pos, new_pos); // move the affected handlers. First the node ones, later the adjoining ones. - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ @@ -709,7 +709,7 @@ void Node::transform(Geom::Affine const &m) _fixNeighbors(old_pos, position()); // move the involved handlers, first the node ones, later the adjoining ones - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ @@ -916,7 +916,7 @@ void Node::setType(NodeType type, bool update_handles) } /* in node type changes, about bspline traces, we can mantain them with noPower power in border mode, or we give them the default power in curve mode */ - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ double weight = noPower; if(_pm().BSplineHandlePosition(this->front()) != noPower ){ weight = defaultStartPower; @@ -1172,7 +1172,7 @@ void Node::_setState(State state) mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); //this shows the handlers when selecting the nodes - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ this->front()->setPosition(_pm().BSplineHandleReposition(this->front())); this->back()->setPosition(_pm().BSplineHandleReposition(this->back())); } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbcde240a..64eba3921 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -670,7 +670,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start = next; } // if we are removing, we readjust the handlers - if(isBSpline()){ + if(isBSpline(false)){ if(start.prev()){ start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),start.prev()->back())); } @@ -999,7 +999,7 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d // set new handle positions Node *n = new Node(_multi_path_manipulator._path_data.node_data, seg2[0]); - if(!isBSpline()){ + if(!isBSpline(false)){ n->back()->setPosition(seg1[2]); n->front()->setPosition(seg2[1]); n->setType(NODE_SMOOTH, false); @@ -1245,7 +1245,7 @@ bool PathManipulator::isBSpline(bool recalculate){ return _is_bspline; } -bool PathManipulator::isBSpline() const { +bool PathManipulator::isBSpline(false) const { return BSplineGetSteps() > 0; } diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 4d2bf4300..4badec569 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -107,7 +107,7 @@ private: void _createControlPointsFromGeometry(); - bool isBSpline(bool recalculate = false); + bool isBSpline(bool recalculate); bool isBSpline() const; double BSplineHandlePosition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL); -- cgit v1.2.3 From c1487f9dc277520b8734b7e80387b35c78d979ae Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 21 Mar 2015 22:24:37 +0100 Subject: Fixed bug whith maps (bzr r13645.1.49) --- src/ui/tool/multi-path-manipulator.h | 2 +- src/ui/tool/path-manipulator.cpp | 30 ++++++++++++++---------------- src/ui/tool/path-manipulator.h | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index cdbf34e9d..1bbcdd7ec 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -39,7 +39,7 @@ public: virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *event); bool empty() { return _mmap.empty(); } - unsigned size() { return _mmap.empty(); } + unsigned size() { return _mmap.size(); } void setItems(std::set const &); void clear() { _mmap.clear(); } void cleanup(); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 8b735f3e6..00e18dd3f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -11,6 +11,7 @@ */ #include "live_effects/lpe-powerstroke.h" +#include "live_effects/lpe-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" #include #include @@ -20,7 +21,7 @@ #include <2geom/bezier-curve.h> #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> -#include + #include "ui/tool/path-manipulator.h" #include "desktop.h" @@ -33,6 +34,7 @@ #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" + #include "sp-path.h" #include "helper/geom.h" #include "preferences.h" @@ -43,7 +45,7 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" -#include "live_effects/lpe-bspline.h" +#include namespace Inkscape { namespace UI { @@ -151,7 +153,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //Define if the path is BSpline on construction - isBSpline(true); + recalculateIsBSpline(); } PathManipulator::~PathManipulator() @@ -1238,22 +1240,18 @@ int PathManipulator::BSplineGetSteps() const { } // determines if the trace has bspline effect -bool PathManipulator::isBSpline(bool recalculate){ - if(recalculate){ - SPLPEItem * path = dynamic_cast(_path); - if (path){ - if(path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - _is_bspline = true; - return _is_bspline; - } +void PathManipulator::recalculateIsBSpline(){ + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + _is_bspline = true; + return; } } - } _is_bspline = false; - return _is_bspline; } bool PathManipulator::isBSpline() const { @@ -1325,7 +1323,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; //Refresh if is bspline some times -think on path change selection, this value get lost - isBSpline(true); + recalculateIsBSpline(); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 4badec569..6dc1c9d09 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -107,7 +107,7 @@ private: void _createControlPointsFromGeometry(); - bool isBSpline(bool recalculate); + void recalculateIsBSpline(); bool isBSpline() const; double BSplineHandlePosition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL); -- cgit v1.2.3 From 8bd246d8b59749e15de4d5d0d78e9b82fa8a601a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 Mar 2015 18:27:17 +0100 Subject: Fixed bug when deleting nodes (bzr r13645.1.51) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index aa27a1414..6875799f8 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -177,7 +177,7 @@ void FilletChamferPropertiesDialog::_apply() d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); } _satellite.setAmount( d_pos); - unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); + size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; } -- cgit v1.2.3 From edc48d93d2b528c20b9adb0f7d074c73c46f03eb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 27 Mar 2015 00:01:44 +0100 Subject: adding append mode (bzr r13645.1.54) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index d2bdd9384..ccf75dcde 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -34,7 +34,6 @@ #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" - #include "sp-path.h" #include "helper/geom.h" #include "preferences.h" -- cgit v1.2.3 From dff3aa428ff050c2cce501f646977ddad921feca Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 1 Apr 2015 04:13:16 +0200 Subject: Move 2Geom work to a intermediate positon -helper- Removed dependency to helper/geom.h Now use a simple vector, not a vector of pairs of size_t and Satellite Getters and setters on Satellite removed Update store parameter to a more friendly string, like powerstroke Todo: Documentation and Fix coding style. (bzr r13645.1.63) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 24 ++++++++++++------------ src/ui/dialog/lpe-fillet-chamfer-properties.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 6875799f8..443a48c13 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -160,13 +160,13 @@ void FilletChamferPropertiesDialog::_apply() double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - _satellite.setSatelliteType(Geom::F); + _satellite.satelliteType = Geom::F; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - _satellite.setSatelliteType(Geom::IF); + _satellite.satelliteType = Geom::IF; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - _satellite.setSatelliteType(Geom::IC); + _satellite.satelliteType = Geom::IC; } else { - _satellite.setSatelliteType(Geom::C); + _satellite.satelliteType = Geom::C; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { @@ -176,12 +176,12 @@ void FilletChamferPropertiesDialog::_apply() } else { d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); } - _satellite.setAmount( d_pos); + _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; } - _satellite.setSteps(steps); + _satellite.steps = steps; _knotpoint->knot_set_offset(_satellite); } _close(); @@ -221,7 +221,7 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) if(use_distance){ distance_or_radius = std::string(_("Knot distance")); } - if (satellite.getIsTime()) { + if (satellite.isTime) { position = amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); @@ -233,14 +233,14 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) position = Inkscape::Util::Quantity::convert(position, document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); - if (satellite.getSatelliteType() == Geom::F) { + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); + if (satellite.satelliteType == Geom::F) { _fillet_chamfer_type_fillet.set_active(true); - } else if (satellite.getSatelliteType() == Geom::IF) { + } else if (satellite.satelliteType == Geom::IF) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (satellite.getSatelliteType() == Geom::C) { + } else if (satellite.satelliteType == Geom::C) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (satellite.getSatelliteType() == Geom::IC) { + } else if (satellite.satelliteType == Geom::IC) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } _satellite = satellite; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 533f7af2a..1a40eea9b 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 -#include "live_effects/parameter/satellitepairarray.h" +#include "live_effects/parameter/satellitearray.h" class SPDesktop; -- cgit v1.2.3 From f3965759e52107c1cdcd8b7e248e5538fdaa11b6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 1 Apr 2015 17:54:35 +0200 Subject: Added documentation and fix to coding style. (bzr r13645.1.66) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 80 ++++++++++++------------- src/ui/dialog/lpe-fillet-chamfer-properties.h | 54 +++++++++-------- 2 files changed, 69 insertions(+), 65 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 443a48c13..2960f0d34 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -53,7 +53,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() _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_label.set_label(_("Radius (pixels):")); _fillet_chamfer_position_label.set_alignment(1.0, 0.5); @@ -65,7 +65,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() _fillet_chamfer_chamfer_subdivisions.set_increments(1,1); //todo: get tha max aloable infinity freeze the widget _fillet_chamfer_chamfer_subdivisions.set_range(1, 4294967295); - + _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); @@ -119,29 +119,29 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() { - _set_desktop(NULL); + _setDesktop(NULL); } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double amount, + SPDesktop *desktop, double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit, - Geom::Satellite satellite) + const gchar *_unit, + bool _use_distance, + bool _aprox_radius, + Glib::ustring _documentUnit, + Geom::Satellite _satellite) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - dialog->_set_desktop(desktop); - dialog->_set_unit(unit); - dialog->_set_use_distance(use_distance); - dialog->_set_aprox(aprox_radius); - dialog->_set_document_unit(documentUnit); - dialog->_set_amount(amount); - dialog->_set_satellite(satellite); - dialog->_set_pt(pt); + dialog->_setDesktop(desktop); + dialog->_setUnit(_unit); + dialog->_setUseDistance(_use_distance); + dialog->_setAprox(_aprox_radius); + dialog->_setDocumentUnit(_documentUnit); + dialog->_setAmount(_amount); + dialog->_setSatellite(_satellite); + dialog->_setPt(pt); dialog->set_title(_("Modify Fillet-Chamfer")); dialog->_apply_button.set_label(_("_Modify")); @@ -156,7 +156,7 @@ void FilletChamferPropertiesDialog::showDialog( void FilletChamferPropertiesDialog::_apply() { - + double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { @@ -174,11 +174,11 @@ void FilletChamferPropertiesDialog::_apply() } d_pos = d_pos / 100; } else { - d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); + d_pos = Inkscape::Util::Quantity::convert(d_pos, _unit, _document_unit); } _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); - if(steps < 1){ + if(steps < 1) { steps = 1; } _satellite.steps = steps; @@ -189,7 +189,7 @@ void FilletChamferPropertiesDialog::_apply() void FilletChamferPropertiesDialog::_close() { - _set_desktop(NULL); + _setDesktop(NULL); destroy_(); Glib::signal_idle().connect( sigc::bind_return( @@ -211,26 +211,26 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) +void FilletChamferPropertiesDialog::_setSatellite(Geom::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 (satellite.isTime) { - position = amount * 100; + position = _amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; - std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); + std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, _unit); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = amount; - position = Inkscape::Util::Quantity::convert(position, document_unit, unit); + position = _amount; + position = Inkscape::Util::Quantity::convert(position, _document_unit, _unit); } _fillet_chamfer_position_numeric.set_value(position); _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); @@ -246,7 +246,7 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) _satellite = satellite; } -void FilletChamferPropertiesDialog::_set_pt( +void FilletChamferPropertiesDialog::_setPt( const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt) { @@ -255,35 +255,35 @@ void FilletChamferPropertiesDialog::_set_pt( pt); } -void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) +void FilletChamferPropertiesDialog::_setUnit(const gchar *abbr) { - unit = abbr; + _unit = abbr; } -void FilletChamferPropertiesDialog::_set_amount(double amm) +void FilletChamferPropertiesDialog::_setAmount(double amm) { - amount = amm; + _amount = amm; } -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) +void FilletChamferPropertiesDialog::_setDocumentUnit(Glib::ustring abbr) { - document_unit = abbr; + _document_unit = abbr; } -void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) +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 1a40eea9b..51fc847c3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -23,18 +23,19 @@ public: FilletChamferPropertiesDialog(); virtual ~FilletChamferPropertiesDialog(); - Glib::ustring getName() const { + Glib::ustring getName() const + { return "LayerPropertiesDialog"; } - static void showDialog(SPDesktop *desktop, double amount, + static void showDialog(SPDesktop *desktop, double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit, - Geom::Satellite satellite); + const gchar *_unit, + bool _use_distance, + bool _aprox_radius, + Glib::ustring _documentUnit, + Geom::Satellite _satellite); protected: @@ -60,36 +61,39 @@ protected: 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:: + void _setDesktop(SPDesktop *desktop); + void _setPt(const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt); - void _set_unit(const gchar *abbr); - void _set_document_unit(Glib::ustring abbr); - void _set_use_distance(bool use_knot_distance); - void _set_aprox(bool aprox_radius); + void _setUnit(const gchar *abbr); + void _setDocumentUnit(Glib::ustring abbr); + void _setUseDistance(bool use_knot_distance); + void _setAprox(bool aprox_radius); + void _setAmount(double amount); + void _setSatellite(Geom::Satellite satellite); + void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + + bool _handleKeyEvent(GdkEventKey *event); + void _handleButtonEvent(GdkEventButton *event); + void _apply(); void _close(); bool _flexible; Geom::Satellite _satellite; - const gchar *unit; - Glib::ustring document_unit; - bool use_distance; - double amount; - bool aprox; - void _set_amount(double amount); - void _set_satellite(Geom::Satellite satellite); - void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + const gchar *_unit; + Glib::ustring _document_unit; + bool _use_distance; + double _amount; + bool _aprox; - bool _handleKeyEvent(GdkEventKey *event); - void _handleButtonEvent(GdkEventButton *event); friend class Inkscape::LivePathEffect:: - FilletChamferKnotHolderEntity; + FilletChamferKnotHolderEntity; private: FilletChamferPropertiesDialog( -- cgit v1.2.3 From 04218b26ae0a10bf9e64721fb0dd789f024afca5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 3 Apr 2015 16:10:46 +0200 Subject: Update pathinfo class to allow piecewise and pathvector as input. Add a method on pointwise to allow update if degenerated curves in new path, not noticed by piecewises (bzr r13645.1.72) --- src/ui/tool/multi-path-manipulator.cpp | 10 +++++----- src/ui/tool/path-manipulator.cpp | 7 ------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index f53cef5f4..8a8e4cb8a 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -330,20 +330,20 @@ void MultiPathManipulator::insertNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodes); - _done(_("Add nodes")); + _done(_("Add nodes"), true); } void MultiPathManipulator::insertNodesAtExtrema(ExtremumType extremum) { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodeAtExtremum, extremum); - _done(_("Add extremum nodes")); + _done(_("Add extremum nodes"), true); } void MultiPathManipulator::duplicateNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::duplicateNodes); - _done(_("Duplicate nodes")); + _done(_("Duplicate nodes"), true); } void MultiPathManipulator::joinNodes() @@ -483,10 +483,10 @@ void MultiPathManipulator::reverseSubpaths() { if (_selection.empty()) { invokeForAll(&PathManipulator::reverseSubpaths, false); - _done("Reverse subpaths"); + _done("Reverse subpaths", true); } else { invokeForAll(&PathManipulator::reverseSubpaths, true); - _done("Reverse selected subpaths"); + _done("Reverse selected subpaths", true); } } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbae69f2c..d50c3057b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1356,13 +1356,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) lpe_pwr->adjustForNewPath(pathv); } } - thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); - } - } } } -- cgit v1.2.3 From 6195a5fd157ff2681534aa90a279627e0048d4e1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 10 May 2015 00:37:31 +0200 Subject: fixing review (bzr r13645.1.87) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 4 ++-- src/ui/dialog/lpe-fillet-chamfer-properties.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index bc6557b19..2b49d1952 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -123,7 +123,7 @@ void FilletChamferPropertiesDialog::showDialog( FilletChamferKnotHolderEntity *pt, bool _use_distance, bool _aprox_radius, - Geom::Satellite _satellite) + Satellite _satellite) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); @@ -200,7 +200,7 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_setSatellite(Geom::Satellite satellite) +void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) { double position; std::string distance_or_radius = std::string(_("Radius")); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 53bb90b80..f982db286 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -33,7 +33,7 @@ public: FilletChamferKnotHolderEntity *pt, bool _use_distance, bool _aprox_radius, - Geom::Satellite _satellite); + Satellite _satellite); protected: @@ -71,7 +71,7 @@ protected: void _setUseDistance(bool use_knot_distance); void _setAprox(bool aprox_radius); void _setAmount(double amount); - void _setSatellite(Geom::Satellite satellite); + void _setSatellite(Satellite satellite); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); bool _handleKeyEvent(GdkEventKey *event); @@ -80,7 +80,7 @@ protected: void _apply(); void _close(); bool _flexible; - Geom::Satellite _satellite; + Satellite _satellite; bool _use_distance; double _amount; bool _aprox; -- cgit v1.2.3 From 870dbb0348163f55263eb9dca601d525d53a8d79 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 10 May 2015 13:40:31 +0200 Subject: Working on Krzysztof review. Seems to be all fixed. TODO: double check review and comment (bzr r13645.1.89) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 2b49d1952..f89668a4c 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -151,13 +151,13 @@ void FilletChamferPropertiesDialog::_apply() double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - _satellite.satelliteType = Geom::F; + _satellite.satellite_type = FILLET; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - _satellite.satelliteType = Geom::IF; + _satellite.satellite_type = INVERSE_FILLET; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - _satellite.satelliteType = Geom::IC; + _satellite.satellite_type = INVERSE_CHAMFER; } else { - _satellite.satelliteType = Geom::C; + _satellite.satellite_type = CHAMFER; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { @@ -210,7 +210,7 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) if(_use_distance) { distance_or_radius = std::string(_("Knot distance")); } - if (satellite.isTime) { + if (satellite.is_time) { position = _amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); @@ -222,13 +222,13 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) } _fillet_chamfer_position_numeric.set_value(position); _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); - if (satellite.satelliteType == Geom::F) { + if (satellite.satellite_type == FILLET) { _fillet_chamfer_type_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::IF) { + } else if (satellite.satellite_type == INVERSE_FILLET) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::C) { + } else if (satellite.satellite_type == CHAMFER) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (satellite.satelliteType == Geom::IC) { + } else if (satellite.satellite_type == INVERSE_CHAMFER) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } _satellite = satellite; -- cgit v1.2.3 From 07717a370b8efe6ddbb0c69d115bb063a2e7686a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 10 May 2016 23:16:49 +0200 Subject: Working with path updates (bzr r13645.1.130) --- src/ui/dialog/lpe-fillet-chamfer-properties.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index f982db286..105cafe68 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 -#include "live_effects/parameter/satellitearray.h" +#include "live_effects/parameter/satellitesarray.h" class SPDesktop; -- cgit v1.2.3 From 159439c26042b7c69aa9c33ce9484e4dfd00372a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 15 May 2016 11:48:51 +0200 Subject: Fixing pointwise (bzr r13645.1.137) --- src/ui/tool/multi-path-manipulator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 857f954ce..9ec6f733f 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -330,13 +330,13 @@ void MultiPathManipulator::insertNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodes); - _done(_("Add nodes"), true); + _done(_("Add nodes")); } void MultiPathManipulator::insertNodesAtExtrema(ExtremumType extremum) { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodeAtExtremum, extremum); - _done(_("Add extremum nodes"), true); + _done(_("Add extremum nodes")); } void MultiPathManipulator::insertNode(Geom::Point pt) @@ -351,7 +351,7 @@ void MultiPathManipulator::duplicateNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::duplicateNodes); - _done(_("Duplicate nodes"), true); + _done(_("Duplicate nodes")); } void MultiPathManipulator::joinNodes() @@ -491,10 +491,10 @@ void MultiPathManipulator::reverseSubpaths() { if (_selection.empty()) { invokeForAll(&PathManipulator::reverseSubpaths, false); - _done("Reverse subpaths", true); + _done("Reverse subpaths"); } else { invokeForAll(&PathManipulator::reverseSubpaths, true); - _done("Reverse selected subpaths", true); + _done("Reverse selected subpaths"); } } -- cgit v1.2.3 From 8d35486a82d04a28dc9f297147ad4666b34cde4a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 26 May 2016 19:37:15 +0200 Subject: Fixing pointwise (bzr r13645.1.143) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9d479432b..0d603ad1f 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 #include #include -- cgit v1.2.3 From 73f078b27b669c941651ecf14a3119ae491ccabf Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 13 Jun 2016 00:58:55 +0200 Subject: Fix 90% of tweenk review (bzr r13645.1.155) --- src/ui/tools/node-tool.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..60d4c807f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -292,15 +292,15 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints(); - std::vector selectedNodesPositions; - for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) { + Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); + std::vector selected_nodes_positions; + for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selectedNodesPositions.push_back(n->position()); + selected_nodes_positions.push_back(n->position()); } } - lpe->setSelectedNodePoints(selectedNodesPositions); + lpe->setSelectedNodePoints(selected_nodes_positions); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From c5f642fbd66ccb150d361d2861d0b1baa744dcba Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 15:07:51 +0200 Subject: Pre fixing selected points (bzr r13645.1.161) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 7 ++++--- src/ui/tools/node-tool.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index c86fc4a20..098a84edf 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -117,7 +117,8 @@ FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double _amount, + SPDesktop *desktop, + double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, bool _use_distance, @@ -243,9 +244,9 @@ void FilletChamferPropertiesDialog::_setPt( } -void FilletChamferPropertiesDialog::_setAmount(double amm) +void FilletChamferPropertiesDialog::_setAmount(double amount) { - _amount = amm; + _amount = amount; } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 60d4c807f..d02b8e6d3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -293,14 +293,14 @@ void NodeTool::update_helperpath () { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); - std::vector selected_nodes_positions; + std::vector selected_nodes_pos; for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selected_nodes_positions.push_back(n->position()); + selected_nodes_pos.push_back(n->position()); } } - lpe->setSelectedNodePoints(selected_nodes_positions); + lpe->setSelectedNodePoints(selected_nodes_pos); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 38a1a4d45114a681408e763c3afec79f0bc21940 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 18:53:51 +0200 Subject: fixing bug moving nodes (bzr r13645.1.162) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index d02b8e6d3..6a1feb760 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -300,7 +300,7 @@ void NodeTool::update_helperpath () { selected_nodes_pos.push_back(n->position()); } } - lpe->setSelectedNodePoints(selected_nodes_pos); + lpe->setSelectedNodes(selected_nodes_pos); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 6820ee49d69cd419c5e8d3c9de74b0552758c842 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 19 Jun 2016 00:58:42 +0200 Subject: Fixes when moves a path (bzr r13645.1.163) --- src/ui/tools/node-tool.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 6a1feb760..9bdc578c1 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -292,15 +292,16 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); - std::vector selected_nodes_pos; + Inkscape::UI::ControlPointSelection::Set &selection_nodes = this->_selected_nodes->allPoints(); + std::vector positions; + Geom::Affine affine = SP_ITEM(selection->singleItem())->i2dt_affine(); for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selected_nodes_pos.push_back(n->position()); + positions.push_back(n->position() * affine); } } - lpe->setSelectedNodes(selected_nodes_pos); + lpe->setSelectedNodes(positions); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 417ba16c9f42a5476045ca4f1825fff2fed518ba Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 19 Jun 2016 03:30:10 +0200 Subject: Organize doeffect function (bzr r13645.1.164) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 098a84edf..98b654640 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -167,7 +167,7 @@ void FilletChamferPropertiesDialog::_apply() } _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); - if(steps < 1) { + if (steps < 1) { steps = 1; } _satellite.steps = steps; @@ -204,10 +204,10 @@ 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 (satellite.is_time) { -- cgit v1.2.3 From d431044fc72f9b668dcfa5771f361f4d6088bdd7 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 22 Jan 2017 18:53:31 +0100 Subject: Update to new code in trunk (bzr r13645.1.166) --- src/ui/tools/node-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 94e684bc4..8561e234f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -297,9 +297,9 @@ void sp_update_helperpath() { Inkscape::UI::Node *n = dynamic_cast(*i); selectedNodesPositions.push_back(n->position()); } - lpe->setSelectedNodePoints(selectedNodesPositions); + lpe->setSelectedNodePos(selectedNodesPositions); lpe->setCurrentZoom(desktop->current_zoom()); - + SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); std::vector cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem())); -- cgit v1.2.3