summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter/text.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-07-31 14:02:08 +0000
committerjabiertxof <info@marker.es>2016-07-31 14:02:08 +0000
commit6ac79a669ea08356806bd130d1426871473b0b71 (patch)
treee387fe9478afaa1205261a16fbeaab9c73663a60 /src/live_effects/parameter/text.cpp
parentFull rewrite on working mode now no linked paths necesary (diff)
downloadinkscape-6ac79a669ea08356806bd130d1426871473b0b71.tar.gz
inkscape-6ac79a669ea08356806bd130d1426871473b0b71.zip
Add options to fit on DIN
(bzr r15017.1.16)
Diffstat (limited to 'src/live_effects/parameter/text.cpp')
-rw-r--r--src/live_effects/parameter/text.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 234a6174d..e51cf93ab 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -31,7 +31,8 @@ TextParam::TextParam( const Glib::ustring& label, const Glib::ustring& tip,
Effect* effect, const Glib::ustring default_value )
: Parameter(label, tip, key, wr, effect),
value(default_value),
- defvalue(default_value)
+ defvalue(default_value),
+ _hide_canvas_text(false)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP; // FIXME: we shouldn't use this!
canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), "");
@@ -46,9 +47,24 @@ TextParam::param_set_default()
}
void
+TextParam::param_update_default(Glib::ustring default_value)
+{
+ defvalue = default_value;
+}
+
+void
+TextParam::param_hide_canvas_text()
+{
+ _hide_canvas_text = true;
+ sp_canvastext_set_text (canvas_text,"");
+}
+
+void
TextParam::setPos(Geom::Point pos)
{
- sp_canvastext_set_coords (canvas_text, pos);
+ if (!_hide_canvas_text) {
+ sp_canvastext_set_coords (canvas_text, pos);
+ }
}
void
@@ -63,9 +79,10 @@ TextParam::setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
Point dir = unit_vector(derivative(pwd2_reparam).valueAt(t_reparam));
Point n = -rot90(dir);
double angle = Geom::angle_between(dir, Point(1,0));
-
- sp_canvastext_set_coords(canvas_text, pos + n * length);
- sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle));
+ if (!_hide_canvas_text) {
+ sp_canvastext_set_coords(canvas_text, pos + n * length);
+ sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle));
+ }
}
void
@@ -73,7 +90,9 @@ TextParam::setAnchor(double x_value, double y_value)
{
anchor_x = x_value;
anchor_y = y_value;
- sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y);
+ if (!_hide_canvas_text) {
+ sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y);
+ }
}
bool
@@ -107,8 +126,9 @@ void
TextParam::param_setValue(const Glib::ustring newvalue)
{
value = newvalue;
-
- sp_canvastext_set_text (canvas_text, newvalue.c_str());
+ if (!_hide_canvas_text) {
+ sp_canvastext_set_text (canvas_text, newvalue.c_str());
+ }
}
} /* namespace LivePathEffect */