diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-05-09 15:50:08 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-05-09 15:50:08 +0000 |
| commit | 78cee203a59243dcabbf67499682ce720be6d1d6 (patch) | |
| tree | 6eb0b8096d802cf078d4a51815aaa6d8663102c0 /src | |
| parent | Fix potential crash in FontLister (diff) | |
| download | inkscape-78cee203a59243dcabbf67499682ce720be6d1d6.tar.gz inkscape-78cee203a59243dcabbf67499682ce720be6d1d6.zip | |
Remove documentUnits from live_effect/effect.cpp/h
Remove units from fillet-chamfer and roughen
(bzr r14136)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/effect.cpp | 3 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 7 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-roughen.cpp | 22 | ||||
| -rw-r--r-- | src/live_effects/lpe-roughen.h | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.cpp | 12 | ||||
| -rw-r--r-- | src/live_effects/parameter/filletchamferpointarray.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 22 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.h | 8 |
10 files changed, 8 insertions, 74 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1da364580..53097171b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -364,7 +364,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) lpeobj(lpeobject), concatenate_before_pwd2(false), sp_lpe_item(NULL), - defaultUnit("px"), current_zoom(1), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -454,7 +453,6 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/) void Effect::doOnApply_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast<SPLPEItem *>(lpeitem); - defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr; /*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve(); pathvector_before_effect = sp_curve->get_pathvector();*/ doOnApply(lpeitem); @@ -463,7 +461,6 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem) void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem) { sp_lpe_item = const_cast<SPLPEItem *>(lpeitem); - defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr; //printf("(SPLPEITEM*) %p\n", sp_lpe_item); SPShape * shape = dynamic_cast<SPShape *>(sp_lpe_item); if(shape){ diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index ac1f0b8dc..a6b5a13ea 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -159,7 +159,6 @@ protected: bool concatenate_before_pwd2; SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them. - Glib::ustring defaultUnit; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them. double current_zoom; std::vector<Geom::Point> selectedNodesPoints; SPCurve * sp_curve; diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index c8458b8cb..ca87c7be1 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -29,7 +29,6 @@ // for programmatically updating knots #include "ui/tools-switch.h" -#include <util/units.h> // TODO due to internal breakage in glibmm headers, this must be last: #include <glibmm/i18n.h> @@ -57,7 +56,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) : only_selected(_("Change only selected nodes"), _("Change only selected nodes"), "only_selected", &wr, this, false), flexible(_("Flexible radius size (%)"), _("Flexible radius size (%)"), "flexible", &wr, this, false), use_knot_distance(_("Use knots distance instead radius"), _("Use knots distance instead radius"), "use_knot_distance", &wr, this, false), - unit(_("Unit:"), _("Unit"), "unit", &wr, this), method(_("Method:"), _("Fillets methods"), "method", FMConverter, &wr, this, FM_AUTO), radius(_("Radius (unit or %):"), _("Radius, in unit or %"), "radius", &wr, this, 0.), chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "chamfer_steps", &wr, this, 0), @@ -65,7 +63,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) : helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 0) { registerParameter(&fillet_chamfer_values); - registerParameter(&unit); registerParameter(&method); registerParameter(&radius); registerParameter(&chamfer_steps); @@ -223,7 +220,7 @@ void LPEFilletChamfer::updateFillet() { double power = 0; if (!flexible) { - power = Inkscape::Util::Quantity::convert(radius, unit.get_abbreviation(), defaultUnit) * -1; + power = radius * -1; } else { power = radius; } @@ -444,9 +441,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) ->get_original_curve() : SP_SHAPE(lpeItem)->getCurve(); diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index fb06e804c..f8e03a399 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -66,7 +66,6 @@ private: BoolParam only_selected; BoolParam flexible; BoolParam use_knot_distance; - UnitParam unit; EnumParam<FilletMethod> method; ScalarParam radius; ScalarParam chamfer_steps; diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 9d1c3152b..c5e002351 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -20,7 +20,6 @@ #include "live_effects/parameter/parameter.h" #include "helper/geom.h" #include <glibmm/i18n.h> -#include <util/units.h> #include <cmath> namespace Inkscape { @@ -36,7 +35,6 @@ DMConverter(DivisionMethodData, DM_END); LPERoughen::LPERoughen(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - unit(_("Unit"), _("Unit"), "unit", &wr, this), method(_("Method"), _("Division method"), "method", DMConverter, &wr, this, DM_SEGMENTS), max_segment_size(_("Max. segment size"), _("Max. segment size"), @@ -54,7 +52,6 @@ LPERoughen::LPERoughen(LivePathEffectObject *lpeobject) shift_node_handles(_("Shift node handles"), _("Shift node handles"), "shift_node_handles", &wr, this, true) { - registerParameter(&unit); registerParameter(&method); registerParameter(&max_segment_size); registerParameter(&segments); @@ -98,14 +95,6 @@ Gtk::Widget *LPERoughen::newWidget() if ((*it)->widget_is_visible) { Parameter *param = *it; Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); - if (param->param_key == "unit") { - Gtk::Label *unit_label = Gtk::manage(new Gtk::Label( - Glib::ustring(_("<b>Roughen unit</b>")), Gtk::ALIGN_START)); - unit_label->set_use_markup(true); - vbox->pack_start(*unit_label, false, false, 2); - vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()), - Gtk::PACK_EXPAND_WIDGET); - } if (param->param_key == "method") { Gtk::Label *method_label = Gtk::manage(new Gtk::Label( Glib::ustring(_("<b>Add nodes</b> Subdivide each segment")), @@ -160,11 +149,8 @@ double LPERoughen::sign(double random_number) Geom::Point LPERoughen::randomize() { - Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units; - double displace_x_parsed = Inkscape::Util::Quantity::convert( - displace_x * global_randomize, unit.get_abbreviation(), svg_units->abbr); - double displace_y_parsed = Inkscape::Util::Quantity::convert( - displace_y * global_randomize, unit.get_abbreviation(), svg_units->abbr); + double displace_x_parsed = displace_x * global_randomize; + double displace_y_parsed = displace_y * global_randomize; Geom::Point output = Geom::Point(sign(displace_x_parsed), sign(displace_y_parsed)); return output; @@ -175,7 +161,6 @@ void LPERoughen::doEffect(SPCurve *curve) Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(curve->get_pathvector()); curve->reset(); - Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units; for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { if (path_it->empty()) @@ -220,8 +205,7 @@ void LPERoughen::doEffect(SPCurve *curve) } else { nCurve->lineto(point3); } - double length = Inkscape::Util::Quantity::convert( - curve_it1->length(0.001), svg_units->abbr, unit.get_abbreviation()); + double length = curve_it1->length(0.001); std::size_t splits = 0; if (method == DM_SEGMENTS) { splits = segments; diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h index ed9f06cf7..2b285cd40 100644 --- a/src/live_effects/lpe-roughen.h +++ b/src/live_effects/lpe-roughen.h @@ -17,7 +17,6 @@ #include "live_effects/parameter/parameter.h" #include "live_effects/parameter/path.h" #include "live_effects/parameter/bool.h" -#include "live_effects/parameter/unit.h" #include "live_effects/parameter/random.h" namespace Inkscape { @@ -45,7 +44,6 @@ public: virtual Gtk::Widget *newWidget(); private: - UnitParam unit; EnumParam<DivisionMethod> method; ScalarParam max_segment_size; ScalarParam segments; diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index f05f401e4..10ded4d9f 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -354,11 +354,6 @@ void FilletChamferPointArrayParam::set_pwd2( last_pwd2_normal = pwd2_normal_in; } -void FilletChamferPointArrayParam::set_document_unit(Glib::ustring value_document_unit) -{ - documentUnit = value_document_unit; -} - void FilletChamferPointArrayParam::set_helper_size(int hs) { helper_size = hs; @@ -374,11 +369,6 @@ void FilletChamferPointArrayParam::set_use_distance(bool use_knot_distance ) use_distance = use_knot_distance; } -void FilletChamferPointArrayParam::set_unit(const gchar *abbr) -{ - unit = abbr; -} - void FilletChamferPointArrayParam::updateCanvasIndicators() { std::vector<Point> ts = data(); @@ -812,7 +802,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, _pparam->documentUnit); + this->desktop, offset, this, _pparam->use_distance, aprox); } } diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h index 7849d5afb..9bfd86b41 100644 --- a/src/live_effects/parameter/filletchamferpointarray.h +++ b/src/live_effects/parameter/filletchamferpointarray.h @@ -53,8 +53,6 @@ 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 value_document_unit); - virtual void set_unit(const gchar *abbr); virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec); virtual bool providesKnotHolderEntities() const { @@ -89,8 +87,6 @@ private: int helper_size; int chamfer_steps; bool use_distance; - const gchar *unit; - Glib::ustring 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 f63b19e86..061055feb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -27,7 +27,6 @@ #include "selection-chemistry.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" -#include "util/units.h" #include <cmath> //#include "event-context.h" @@ -122,18 +121,14 @@ void FilletChamferPropertiesDialog::showDialog( SPDesktop *desktop, Geom::Point knotpoint, const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit) + bool aprox_radius) { 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); @@ -168,7 +163,6 @@ void FilletChamferPropertiesDialog::_apply() } 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)); @@ -218,11 +212,9 @@ void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) _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:"), distance_or_radius); _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) { @@ -247,16 +239,6 @@ void FilletChamferPropertiesDialog::_set_pt( pt); } -void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) -{ - unit = abbr; -} - -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) -{ - document_unit = abbr; -} - void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) { use_distance = use_knot_distance; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 870a1734f..99494bd63 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -30,10 +30,8 @@ public: static void showDialog(SPDesktop *desktop, Geom::Point knotpoint, const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit); + bool aprox_radius); protected: @@ -68,15 +66,11 @@ protected: 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 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 document_unit; bool use_distance; bool aprox; void _set_knot_point(Geom::Point knotpoint); |
