1. === modified file 'po/POTFILES.in'
  2. --- po/POTFILES.in 2016-05-30 12:34:46 +0000
  3. +++ po/POTFILES.in 2016-07-30 14:50:37 +0000
  4. @@ -154,6 +154,7 @@
  5. src/live_effects/lpe-rough-hatches.cpp
  6. src/live_effects/lpe-roughen.cpp
  7. src/live_effects/lpe-ruler.cpp
  8. +src/live_effects/lpe-measure-line.cpp
  9. src/live_effects/lpe-show_handles.cpp
  10. src/live_effects/lpe-simplify.cpp
  11. src/live_effects/lpe-sketch.cpp
  12. @@ -171,6 +172,7 @@
  13. src/live_effects/parameter/powerstrokepointarray.cpp
  14. src/live_effects/parameter/random.cpp
  15. src/live_effects/parameter/text.cpp
  16. +src/live_effects/parameter/fontbutton.cpp
  17. src/live_effects/parameter/togglebutton.cpp
  18. src/live_effects/parameter/transformedpoint.cpp
  19. src/live_effects/parameter/unit.cpp
  20. === modified file 'src/live_effects/CMakeLists.txt'
  21. --- src/live_effects/CMakeLists.txt 2015-07-24 19:53:33 +0000
  22. +++ src/live_effects/CMakeLists.txt 2016-07-29 21:22:57 +0000
  23. @@ -27,6 +27,7 @@
  24. lpe-lattice.cpp
  25. lpe-lattice2.cpp
  26. lpe-line_segment.cpp
  27. + lpe-measure-line.cpp
  28. lpe-mirror_symmetry.cpp
  29. lpe-offset.cpp
  30. lpe-parallel.cpp
  31. @@ -68,6 +69,7 @@
  32. parameter/powerstrokepointarray.cpp
  33. parameter/random.cpp
  34. parameter/text.cpp
  35. + parameter/fontbutton.cpp
  36. parameter/togglebutton.cpp
  37. parameter/transformedpoint.cpp
  38. parameter/unit.cpp
  39. @@ -105,6 +107,7 @@
  40. lpe-lattice.h
  41. lpe-lattice2.h
  42. lpe-line_segment.h
  43. + lpe-measure-line.h
  44. lpe-mirror_symmetry.h
  45. lpe-offset.h
  46. lpe-parallel.h
  47. @@ -148,6 +151,7 @@
  48. parameter/powerstrokepointarray.h
  49. parameter/random.h
  50. parameter/text.h
  51. + parameter/fontbutton.h
  52. parameter/togglebutton.h
  53. parameter/transformedpoint.h
  54. parameter/unit.h
  55. === modified file 'src/live_effects/Makefile_insert'
  56. --- src/live_effects/Makefile_insert 2015-07-24 19:53:33 +0000
  57. +++ src/live_effects/Makefile_insert 2016-07-21 18:04:54 +0000
  58. @@ -70,6 +70,8 @@
  59. live_effects/lpe-perspective_path.h \
  60. live_effects/lpe-perspective-envelope.cpp \
  61. live_effects/lpe-perspective-envelope.h \
  62. + live_effects/lpe-measure-line.cpp \
  63. + live_effects/lpe-measure-line.h \
  64. live_effects/lpe-mirror_symmetry.cpp \
  65. live_effects/lpe-mirror_symmetry.h \
  66. live_effects/lpe-circle_3pts.cpp \
  67. === modified file 'src/live_effects/effect-enum.h'
  68. --- src/live_effects/effect-enum.h 2015-01-27 22:09:47 +0000
  69. +++ src/live_effects/effect-enum.h 2016-07-21 18:55:39 +0000
  70. @@ -36,6 +36,7 @@
  71. CONSTRUCT_GRID,
  72. PERP_BISECTOR,
  73. TANGENT_TO_CURVE,
  74. + MEASURE_LINE,
  75. MIRROR_SYMMETRY,
  76. CIRCLE_3PTS,
  77. TRANSFORM_2PTS,
  78. === modified file 'src/live_effects/effect.cpp'
  79. --- src/live_effects/effect.cpp 2016-07-28 11:26:17 +0000
  80. +++ src/live_effects/effect.cpp 2016-07-30 16:41:13 +0000
  81. @@ -40,6 +40,7 @@
  82. #include "live_effects/lpe-lattice2.h"
  83. #include "live_effects/lpe-lattice.h"
  84. #include "live_effects/lpe-line_segment.h"
  85. +#include "live_effects/lpe-measure-line.h"
  86. #include "live_effects/lpe-mirror_symmetry.h"
  87. #include "live_effects/lpe-offset.h"
  88. #include "live_effects/lpe-parallel.h"
  89. @@ -151,6 +152,8 @@
  90. {FILL_BETWEEN_MANY, N_("Fill between many"), "fill_between_many"},
  91. {ELLIPSE_5PTS, N_("Ellipse by 5 points"), "ellipse_5pts"},
  92. {BOUNDING_BOX, N_("Bounding Box"), "bounding_box"},
  93. +/* 9.93 */
  94. + {MEASURE_LINE, N_("Measure Line"), "measure-line"},
  95. };
  96. const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData));
  97. @@ -319,6 +322,9 @@
  98. case TRANSFORM_2PTS:
  99. neweffect = static_cast<Effect*> ( new LPETransform2Pts(lpeobj) );
  100. break;
  101. + case MEASURE_LINE:
  102. + neweffect = static_cast<Effect*> ( new LPEMeasureLine(lpeobj) );
  103. + break;
  104. default:
  105. g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr);
  106. neweffect = NULL;
  107. @@ -364,6 +370,7 @@
  108. concatenate_before_pwd2(false),
  109. sp_lpe_item(NULL),
  110. current_zoom(1),
  111. + upd_params(true),
  112. sp_curve(NULL),
  113. provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden
  114. is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden
  115. @@ -447,7 +454,9 @@
  116. void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/)
  117. {
  118. }
  119. -
  120. +void Effect::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
  121. +{
  122. +}
  123. //secret impl methods (shhhh!)
  124. void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
  125. {
  126. @@ -691,7 +700,7 @@
  127. ++it;
  128. }
  129. -
  130. + upd_params = false;
  131. return dynamic_cast<Gtk::Widget *>(vbox);
  132. }
  133. === modified file 'src/live_effects/effect.h'
  134. --- src/live_effects/effect.h 2016-03-14 16:47:47 +0000
  135. +++ src/live_effects/effect.h 2016-07-30 16:40:47 +0000
  136. @@ -66,7 +66,7 @@
  137. virtual void doAfterEffect (SPLPEItem const* lpeitem);
  138. virtual void doOnRemove (SPLPEItem const* lpeitem);
  139. -
  140. + virtual void doOnVisibilityToggled(SPLPEItem const* lpeitem);
  141. void writeParamsToSVG();
  142. virtual void acceptParamPath (SPPath const* param_path);
  143. @@ -122,6 +122,7 @@
  144. void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
  145. bool apply_to_clippath_and_mask;
  146. + bool upd_params;
  147. protected:
  148. Effect(LivePathEffectObject *lpeobject);
  149. === modified file 'src/live_effects/lpe-ellipse_5pts.cpp'
  150. --- src/live_effects/lpe-ellipse_5pts.cpp 2016-07-28 11:26:17 +0000
  151. +++ src/live_effects/lpe-ellipse_5pts.cpp 2016-07-29 09:29:42 +0000
  152. @@ -171,7 +171,7 @@
  153. // figure out if we have a slice, guarding against rounding errors
  154. - Path p(Geom::Point(cos(0), sin(0)));
  155. + Geom::Path p(Geom::Point(cos(0), sin(0)));
  156. double end = 2 * M_PI;
  157. for (s = 0; s < end; s += M_PI_2) {
  158. === modified file 'src/live_effects/lpe-extrude.cpp'
  159. --- src/live_effects/lpe-extrude.cpp 2016-07-28 11:26:17 +0000
  160. +++ src/live_effects/lpe-extrude.cpp 2016-07-29 09:50:56 +0000
  161. @@ -66,7 +66,7 @@
  162. using namespace Geom;
  163. // generate connecting lines (the 'sides' of the extrusion)
  164. - Path path(Point(0.,0.));
  165. + Geom::Path path(Point(0.,0.));
  166. path.appendNew<Geom::LineSegment>( extrude_vector.getVector() );
  167. Piecewise<D2<SBasis> > connector = path.toPwSb();
  168. === modified file 'src/live_effects/lpe-knot.cpp'
  169. --- src/live_effects/lpe-knot.cpp 2016-07-28 11:26:17 +0000
  170. +++ src/live_effects/lpe-knot.cpp 2016-07-29 09:52:43 +0000
  171. @@ -101,7 +101,7 @@
  172. Affine mat = from_basis( T, N, pt_and_dir[0] );
  173. mat = mat.inverse();
  174. - Path p = patha * mat;
  175. + Geom::Path p = patha * mat;
  176. std::vector<double> times;
  177. @@ -484,7 +484,7 @@
  178. // std::cout<<"fusing first and last component\n";
  179. ++beg_comp;
  180. --end_comp;
  181. - Path first = gpaths[i0].portion(dom.back());
  182. + Geom::Path first = gpaths[i0].portion(dom.back());
  183. //FIXME: stitching should not be necessary (?!?)
  184. first.setStitching(true);
  185. first.append(gpaths[i0].portion(dom.front()));
  186. === added file 'src/live_effects/lpe-measure-line.cpp'
  187. --- src/live_effects/lpe-measure-line.cpp 1970-01-01 00:00:00 +0000
  188. +++ src/live_effects/lpe-measure-line.cpp 2016-07-31 17:30:48 +0000
  189. @@ -0,0 +1,597 @@
  190. +/*
  191. + * Author(s):
  192. + * Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
  193. + * Some code and ideas migrated from dimensioning.py by
  194. + * Johannes B. Rutzmoser, johannes.rutzmoser (at) googlemail (dot) com
  195. + * Copyright (C) 2014 Author(s)
  196. +
  197. + * Released under GNU GPL, read the file 'COPYING' for more information
  198. + */
  199. +#include "live_effects/lpe-measure-line.h"
  200. +#include <pangomm/fontdescription.h>
  201. +#include <libnrtype/font-lister.h>
  202. +#include "inkscape.h"
  203. +#include "xml/node.h"
  204. +#include "uri.h"
  205. +#include "uri-references.h"
  206. +#include "preferences.h"
  207. +#include "util/units.h"
  208. +#include "svg/svg-length.h"
  209. +#include "svg/svg-color.h"
  210. +#include "svg/svg.h"
  211. +#include "display/curve.h"
  212. +#include <2geom/affine.h>
  213. +#include "style.h"
  214. +#include "sp-root.h"
  215. +#include "sp-defs.h"
  216. +#include "sp-item.h"
  217. +#include "sp-shape.h"
  218. +#include "sp-path.h"
  219. +#include "desktop.h"
  220. +#include "document.h"
  221. +#include <iomanip>
  222. +
  223. +// TODO due to internal breakage in glibmm headers, this must be last:
  224. +#include <glibmm/i18n.h>
  225. +
  226. +using namespace Geom;
  227. +namespace Inkscape {
  228. +namespace LivePathEffect {
  229. +
  230. +static const Util::EnumData<OrientationMethod> OrientationMethodData[] = {
  231. + { OM_HORIZONTAL, N_("Horizontal"), "horizontal" },
  232. + { OM_VERTICAL, N_("Vertical"), "vertical" },
  233. + { OM_PARALLEL, N_("Parallel"), "parallel" }
  234. +};
  235. +static const Util::EnumDataConverter<OrientationMethod> OMConverter(OrientationMethodData, OM_END);
  236. +
  237. +LPEMeasureLine::LPEMeasureLine(LivePathEffectObject *lpeobject) :
  238. + Effect(lpeobject),
  239. + fontbutton(_("Font*"), _("Font Selector"), "fontbutton", &wr, this),
  240. + orientation(_("Orientation"), _("Orientation method"), "orientation", OMConverter, &wr, this, OM_PARALLEL, false),
  241. + curve_linked(_("Curve on origin"), _("Curve on origin, set 0 to start/end"), "curve_linked", &wr, this, 1),
  242. + scale(_("Scale*"), _("Scaling factor"), "scale", &wr, this, 1.0),
  243. + precision(_("Precision*"), _("Precision"), "precision", &wr, this, 2),
  244. + position(_("Positon*"), _("Positon"), "position", &wr, this, 5),
  245. + text_distance(_("Text distance*"), _("Text distance"), "text_distance", &wr, this, 12),
  246. + helpline_distance(_("Helpline distance*"), _("Helpline distance"), "helpline_distance", &wr, this, 0.0),
  247. + helpline_overlap(_("Helpline overlap*"), _("Helpline overlap"), "helpline_overlap", &wr, this, 2.0),
  248. + unit(_("Unit*"), _("Unit"), "unit", &wr, this, "px"),
  249. + format(_("Format*"), _("Format the number ex:measure+ +unit"), "format", &wr, this, "measure+unit"),
  250. + arrows_outside(_("Arrows outside"), _("Arrows outside"), "arrows_outside", &wr, this, false),
  251. + flip_side(_("Flip side*"), _("Flip side"), "flip_side", &wr, this, false),
  252. + scale_insensitive(_("Scale insensitive*"), _("Scale insensitive to transforms in element, parents..."), "scale_insensitive", &wr, this, true),
  253. + local_locale(_("Local Number Format*"), _("Local number format"), "local_locale", &wr, this, true),
  254. + line_group_05(_("Line Group 0.5*"), _("Line Group 0.5, from 0.7"), "line_group_05", &wr, this, true),
  255. + rotate_anotation(_("Rotate Anotation*"), _("Rotate Anotation"), "rotate_anotation", &wr, this, true)
  256. +{
  257. + registerParameter(&fontbutton);
  258. + registerParameter(&orientation);
  259. + registerParameter(&curve_linked);
  260. + registerParameter(&scale);
  261. + registerParameter(&precision);
  262. + registerParameter(&position);
  263. + registerParameter(&text_distance);
  264. + registerParameter(&helpline_distance);
  265. + registerParameter(&helpline_overlap);
  266. + registerParameter(&unit);
  267. + registerParameter(&format);
  268. + registerParameter(&arrows_outside);
  269. + registerParameter(&flip_side);
  270. + registerParameter(&scale_insensitive);
  271. + registerParameter(&local_locale);
  272. + registerParameter(&line_group_05);
  273. + registerParameter(&rotate_anotation);
  274. + Inkscape::Preferences *prefs = Inkscape::Preferences::get();
  275. + fontbutton.param_update_default(prefs->getString("/live_effects/measure-line/fontbutton"));
  276. + scale.param_update_default(prefs->getDouble("/live_effects/measure-line/scale", 1.0));
  277. + precision.param_update_default(prefs->getInt("/live_effects/measure-line/precision", 2));
  278. + position.param_update_default(prefs->getDouble("/live_effects/measure-line/position", 10.0));
  279. + text_distance.param_update_default(prefs->getDouble("/live_effects/measure-line/text_distance", 5.0));
  280. + helpline_distance.param_update_default(prefs->getDouble("/live_effects/measure-line/helpline_distance", 0.0));
  281. + helpline_overlap.param_update_default(prefs->getDouble("/live_effects/measure-line/helpline_overlap", 0.0));
  282. + unit.param_update_default(prefs->getString("/live_effects/measure-line/unit"));
  283. + format.param_update_default(prefs->getString("/live_effects/measure-line/format"));
  284. + flip_side.param_update_default(prefs->getBool("/live_effects/measure-line/flip_side"));
  285. + scale_insensitive.param_update_default(prefs->getBool("/live_effects/measure-line/scale_insensitive"));
  286. + local_locale.param_update_default(prefs->getBool("/live_effects/measure-line/local_locale"));
  287. + line_group_05.param_update_default(prefs->getBool("/live_effects/measure-line/line_group_05"));
  288. + rotate_anotation.param_update_default(prefs->getBool("/live_effects/measure-line/rotate_anotation"));
  289. + format.param_hide_canvas_text();
  290. + precision.param_set_range(0, 100);
  291. + precision.param_set_increments(1, 1);
  292. + precision.param_set_digits(0);
  293. + precision.param_make_integer(true);
  294. + curve_linked.param_set_range(0, 999);
  295. + curve_linked.param_set_increments(1, 1);
  296. + curve_linked.param_set_digits(0);
  297. + curve_linked.param_make_integer(true);
  298. + precision.param_make_integer(true);
  299. + position.param_set_range(-999999.0, 999999.0);
  300. + position.param_set_increments(1, 1);
  301. + position.param_set_digits(2);
  302. + text_distance.param_set_range(-999999.0, 999999.0);
  303. + text_distance.param_set_increments(1, 1);
  304. + text_distance.param_set_digits(2);
  305. + helpline_distance.param_set_range(-999999.0, 999999.0);
  306. + helpline_distance.param_set_increments(1, 1);
  307. + helpline_distance.param_set_digits(2);
  308. + helpline_overlap.param_set_range(-999999.0, 999999.0);
  309. + helpline_overlap.param_set_increments(1, 1);
  310. + helpline_overlap.param_set_digits(2);
  311. +}
  312. +
  313. +LPEMeasureLine::~LPEMeasureLine() {}
  314. +
  315. +void
  316. +LPEMeasureLine::doOnApply(SPLPEItem const* lpeitem)
  317. +{
  318. + if (!SP_IS_SHAPE(lpeitem)) {
  319. + g_warning("LPE measure line can only be applied to shapes (not groups).");
  320. + SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
  321. + item->removeCurrentPathEffect(false);
  322. + }
  323. +}
  324. +
  325. +void
  326. +LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
  327. +{
  328. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  329. + Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + (Glib::ustring)"text-on-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  330. + Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
  331. + SVGElemRef->attach(SVGElem_uri);
  332. + SPObject *elemref = NULL;
  333. + Inkscape::XML::Node *rtext = NULL;
  334. + if (elemref = SVGElemRef->getObject()) {
  335. + rtext = elemref->getRepr();
  336. + if (!this->isVisible()) {
  337. + rtext->setAttribute("style", "display:none");
  338. + } else {
  339. + rtext->setAttribute("style", NULL);
  340. + }
  341. + }
  342. + }
  343. +}
  344. +
  345. +void
  346. +LPEMeasureLine::createArrowMarker(Glib::ustring mode)
  347. +{
  348. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  349. + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
  350. + Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + mode).c_str());
  351. + Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
  352. + SVGElemRef->attach(SVGElem_uri);
  353. + SPObject *elemref = NULL;
  354. + Inkscape::XML::Node *arrow = NULL;
  355. + if (!(elemref = SVGElemRef->getObject())) {
  356. + arrow = xml_doc->createElement("svg:marker");
  357. + arrow->setAttribute("id", mode.c_str());
  358. + arrow->setAttribute("inkscape:stockid", mode.c_str());
  359. + arrow->setAttribute("orient", "auto");
  360. + arrow->setAttribute("refX", "0.0");
  361. + arrow->setAttribute("refY", "0.0");
  362. + arrow->setAttribute("style", "overflow:visible");
  363. + /* Create <path> */
  364. + Inkscape::XML::Node *arrow_path = xml_doc->createElement("svg:path");
  365. + if (mode == (Glib::ustring)"ArrowDIN-start") {
  366. + arrow_path->setAttribute("d", "M -8,0 8,-2.11 8,2.11 z");
  367. + } else if (mode == (Glib::ustring)"ArrowDIN-end") {
  368. + arrow_path->setAttribute("d", "M 8,0 -8,2.11 -8,-2.11 z");
  369. + } else if (mode == (Glib::ustring)"ArrowDINout-start") {
  370. + arrow_path->setAttribute("d", "M 0,0 -16,2.11 -16,0.5 -26,0.5 -26,-0.5 -16,-0.5 -16,-2.11 z");
  371. + } else {
  372. + arrow_path->setAttribute("d", "M 0,0 16,2.11 16,0.5 26,0.5 26,-0.5 16,-0.5 16,-2.11 z");
  373. + }
  374. + arrow_path->setAttribute("id", (mode + (Glib::ustring)"_path").c_str());
  375. + arrow_path->setAttribute("style", "fill:#000000;stroke:none");
  376. + arrow->addChild(arrow_path, NULL);
  377. + Inkscape::GC::release(arrow_path);
  378. + SPObject * arrow_obj = SP_OBJECT(desktop->getDocument()->getDefs()->appendChildRepr(arrow));
  379. + Inkscape::GC::release(arrow);
  380. + }
  381. + }
  382. +}
  383. +
  384. +void
  385. +LPEMeasureLine::createTextLabel(Geom::Point pos, double length, Geom::Coord angle, double fontsize, bool remove)
  386. +{
  387. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  388. + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
  389. + Inkscape::XML::Node *rtext = NULL;
  390. + double doc_w = desktop->getDocument()->getRoot()->width.value;
  391. + Geom::Scale scale = desktop->getDocument()->getDocumentScale();
  392. + SPNamedView *nv = desktop->getNamedView();
  393. + Glib::ustring display_unit = nv->display_units->abbr;
  394. + if (display_unit.empty()) {
  395. + display_unit = "px";
  396. + }
  397. + //only check constrain viewbox on X
  398. + doc_scale = Inkscape::Util::Quantity::convert( scale[Geom::X], "px", nv->display_units );
  399. + if( doc_scale > 0 ) {
  400. + doc_scale= 1.0/doc_scale;
  401. + } else {
  402. + doc_scale = 1.0;
  403. + }
  404. + Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + (Glib::ustring)"text-on-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  405. + Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
  406. + SVGElemRef->attach(SVGElem_uri);
  407. + SPObject *elemref = NULL;
  408. + Inkscape::XML::Node *rtspan = NULL;
  409. + if (elemref = SVGElemRef->getObject()) {
  410. + if (remove) {
  411. + elemref->deleteObject();
  412. + return;
  413. + }
  414. + rtext = elemref->getRepr();
  415. + sp_repr_set_svg_double(rtext, "x", pos[Geom::X]);
  416. + sp_repr_set_svg_double(rtext, "y", pos[Geom::Y]);
  417. + } else {
  418. + if (remove) {
  419. + return;
  420. + }
  421. + rtext = xml_doc->createElement("svg:text");
  422. + rtext->setAttribute("xml:space", "preserve");
  423. + rtext->setAttribute("id", ( (Glib::ustring)"text-on-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  424. + sp_repr_set_svg_double(rtext, "x", pos[Geom::X]);
  425. + sp_repr_set_svg_double(rtext, "y", pos[Geom::Y]);
  426. + rtspan = xml_doc->createElement("svg:tspan");
  427. + rtspan->setAttribute("sodipodi:role", "line");
  428. + }
  429. + gchar * transform;
  430. + if (rotate_anotation) {
  431. + Geom::Affine affine = Geom::Affine(Geom::Translate(pos).inverse());
  432. + angle = std::fmod(angle, 2*M_PI);
  433. + if (angle < 0) angle += 2*M_PI;
  434. + if (angle >= rad_from_deg(90) && angle < rad_from_deg(270)) {
  435. + angle = std::fmod(angle + rad_from_deg(180), 2*M_PI);
  436. + if (angle < 0) angle += 2*M_PI;
  437. + }
  438. + affine *= Geom::Rotate(angle);
  439. + affine *= Geom::Translate(pos);
  440. + transform = sp_svg_transform_write(affine);
  441. + } else {
  442. + transform = NULL;
  443. + }
  444. + rtext->setAttribute("transform", transform);
  445. + SPCSSAttr *css = sp_repr_css_attr_new();
  446. + Inkscape::FontLister *fontlister = Inkscape::FontLister::get_instance();
  447. + fontlister->fill_css( css, (Glib::ustring)fontbutton.param_getSVGValue() );
  448. + std::stringstream font_size;
  449. + font_size.imbue(std::locale::classic());
  450. + font_size << fontsize << "pt";
  451. + sp_repr_css_set_property (css, "font-size", font_size.str().c_str());
  452. + sp_repr_css_set_property (css, "line-height", "125%");
  453. + sp_repr_css_set_property (css, "letter-spacing", "0");
  454. + sp_repr_css_set_property (css, "word-spacing", "0");
  455. + sp_repr_css_set_property (css, "text-align", "center");
  456. + sp_repr_css_set_property (css, "text-anchor", "middle");
  457. + sp_repr_css_set_property (css, "fill", "#000000");
  458. + sp_repr_css_set_property (css, "fill-opacity", "1");
  459. + sp_repr_css_set_property (css, "stroke", "none");
  460. + Glib::ustring css_str;
  461. + sp_repr_css_write_string(css,css_str);
  462. + if (!rtspan) {
  463. + rtspan = rtext->firstChild();
  464. + }
  465. + rtspan->setAttribute("style", css_str.c_str());
  466. + sp_repr_css_attr_unref (css);
  467. + if (!elemref) {
  468. + rtext->addChild(rtspan, NULL);
  469. + Inkscape::GC::release(rtspan);
  470. + }
  471. + length = Inkscape::Util::Quantity::convert(length / doc_scale, display_unit.c_str(), unit.get_abbreviation());
  472. + std::stringstream length_str;
  473. + length_str.precision(precision);
  474. + length_str.setf(std::ios::fixed, std::ios::floatfield);
  475. + if (local_locale) {
  476. + length_str.imbue(std::locale(""));
  477. + } else {
  478. + length_str.imbue(std::locale::classic());
  479. + }
  480. + length_str << std::fixed << length;
  481. + length_str << unit.get_abbreviation();
  482. + Inkscape::XML::Node *rstring = NULL;
  483. + if (!elemref) {
  484. + rstring = xml_doc->createTextNode(length_str.str().c_str());
  485. + rtspan->addChild(rstring, NULL);
  486. + Inkscape::GC::release(rstring);
  487. + } else {
  488. + rstring = rtspan->firstChild();
  489. + rstring->setContent(length_str.str().c_str());
  490. + }
  491. + SPObject * text_obj = NULL;
  492. + if (!elemref) {
  493. + text_obj = SP_OBJECT(desktop->currentLayer()->appendChildRepr(rtext));
  494. + Inkscape::GC::release(rtext);
  495. + }
  496. + }
  497. +}
  498. +
  499. +void
  500. +LPEMeasureLine::createLine(Geom::Point start,Geom::Point end, Glib::ustring id, bool main, bool remove)
  501. +{
  502. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  503. + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
  504. + Inkscape::URI SVGElem_uri(((Glib::ustring)"#" + id).c_str());
  505. + Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
  506. + SVGElemRef->attach(SVGElem_uri);
  507. + SPObject *elemref = NULL;
  508. + Inkscape::XML::Node *line = NULL;
  509. + if (!main) {
  510. + Geom::Ray ray(start, end);
  511. + Geom::Coord angle = ray.angle();
  512. + start = start + Point::polar(angle, helpline_distance );
  513. + end = end + Point::polar(angle, helpline_overlap );
  514. + }
  515. + Geom::Path line_path;
  516. + line_path.start(start);
  517. + line_path.appendNew<Geom::LineSegment>(end);
  518. + Geom::PathVector line_pathv;
  519. + line_pathv.push_back(line_path);
  520. + gchar * line_str = sp_svg_write_path( line_pathv );
  521. + line_pathv.clear();
  522. + if (elemref = SVGElemRef->getObject()) {
  523. + if (remove) {
  524. + elemref->deleteObject();
  525. + return;
  526. + }
  527. + line = elemref->getRepr();
  528. + line->setAttribute("d" , line_str);
  529. + } else {
  530. + if (remove) {
  531. + return;
  532. + }
  533. + line = xml_doc->createElement("svg:path");
  534. + line->setAttribute("id", id.c_str());
  535. + line->setAttribute("d" , line_str);
  536. + }
  537. + Glib::ustring style = (Glib::ustring)"stroke:#000000;fill:none;";
  538. + if (main) {
  539. + line->setAttribute("inkscape:label", "dinline");
  540. + if (arrows_outside) {
  541. + style = style + (Glib::ustring)"marker-start:url(#ArrowDINout-start);marker-end:url(#ArrowDINout-end);";
  542. + } else {
  543. + style = style + (Glib::ustring)"marker-start:url(#ArrowDIN-start);marker-end:url(#ArrowDIN-end);";
  544. + }
  545. + } else {
  546. + line->setAttribute("inkscape:label", "dinhelpline");
  547. + }
  548. + std::stringstream stroke_w;
  549. + stroke_w.imbue(std::locale::classic());
  550. + if (line_group_05) {
  551. + double stroke_width = Inkscape::Util::Quantity::convert(0.25 / doc_scale, "mm", display_unit.c_str());
  552. + stroke_w << stroke_width;
  553. + style = style + (Glib::ustring)"stroke-width:" + (Glib::ustring)stroke_w.str();
  554. + } else {
  555. + double stroke_width = Inkscape::Util::Quantity::convert(0.35 / doc_scale, "mm", display_unit.c_str());
  556. + stroke_w << stroke_width;
  557. + style = style + (Glib::ustring)"stroke-width:" + (Glib::ustring)stroke_w.str();
  558. + }
  559. + line->setAttribute("style", style.c_str());
  560. + SPObject * line_obj = NULL;
  561. + if (!elemref) {
  562. + line_obj = SP_OBJECT(desktop->currentLayer()->appendChildRepr(line));
  563. + Inkscape::GC::release(line);
  564. + }
  565. + }
  566. +}
  567. +
  568. +void
  569. +LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
  570. +{
  571. + SPLPEItem * splpeitem = const_cast<SPLPEItem *>(lpeitem);
  572. + SPPath *sp_path = dynamic_cast<SPPath *>(splpeitem);
  573. + if (sp_path) {
  574. + Geom::PathVector pathvector = sp_path->get_original_curve()->get_pathvector();
  575. + if (arrows_outside) {
  576. + createArrowMarker((Glib::ustring)"ArrowDINout-start");
  577. + createArrowMarker((Glib::ustring)"ArrowDINout-end");
  578. + } else {
  579. + createArrowMarker((Glib::ustring)"ArrowDIN-start");
  580. + createArrowMarker((Glib::ustring)"ArrowDIN-end");
  581. + }
  582. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  583. + size_t ncurves = pathvector.curveCount();
  584. + curve_linked.param_set_range(0, ncurves);
  585. + Geom::Point start = pathvector.initialPoint();
  586. + Geom::Point end = pathvector.finalPoint();
  587. + if (curve_linked) { //!0
  588. + start = pathvector.pointAt(curve_linked -1);
  589. + end = pathvector.pointAt(curve_linked);
  590. + }
  591. + Geom::Point hstart = start;
  592. + Geom::Point hend = end;
  593. + bool remove = false;
  594. + if (Geom::are_near(hstart, hend)) {
  595. + remove = true;
  596. + }
  597. + if (orientation == OM_VERTICAL) {
  598. + Coord xpos = std::max(hstart[Geom::X],hend[Geom::X]);
  599. + if (flip_side) {
  600. + xpos = std::min(hstart[Geom::X],hend[Geom::X]);
  601. + }
  602. + hstart[Geom::X] = xpos;
  603. + hend[Geom::X] = xpos;
  604. + if (hstart[Geom::Y] > hend[Geom::Y]) {
  605. + swap(hstart,hend);
  606. + swap(start,end);
  607. + }
  608. + if (Geom::are_near(hstart[Geom::Y], hend[Geom::Y])) {
  609. + remove = true;
  610. + }
  611. + }
  612. + if (orientation == OM_HORIZONTAL) {
  613. + Coord ypos = std::max(hstart[Geom::Y],hend[Geom::Y]);
  614. + if (flip_side) {
  615. + ypos = std::min(hstart[Geom::Y],hend[Geom::Y]);
  616. + }
  617. + hstart[Geom::Y] = ypos;
  618. + hend[Geom::Y] = ypos;
  619. + if (hstart[Geom::X] < hend[Geom::X]) {
  620. + swap(hstart,hend);
  621. + swap(start,end);
  622. + }
  623. + if (Geom::are_near(hstart[Geom::X], hend[Geom::X])) {
  624. + remove = true;
  625. + }
  626. + }
  627. + double length = Geom::distance(hstart,hend) * scale;
  628. + Geom::Point pos = Geom::middle_point(hstart,hend);
  629. + Geom::Ray ray(hstart,hend);
  630. + Geom::Coord angle = ray.angle();
  631. + if (flip_side) {
  632. + angle = std::fmod(angle + rad_from_deg(180), 2*M_PI);
  633. + if (angle < 0) angle += 2*M_PI;
  634. + }
  635. + //We get the font size to offset the text to the middle
  636. + Pango::FontDescription fontdesc((Glib::ustring)fontbutton.param_getSVGValue());
  637. + double fontsize = fontdesc.get_size()/Pango::SCALE;
  638. + fontsize *= desktop->doc()->getRoot()->c2p.inverse().expansionX();
  639. + Geom::Coord angle_cross = std::fmod(angle + rad_from_deg(90), 2*M_PI);
  640. + if (angle_cross < 0) angle_cross += 2*M_PI;
  641. + angle = std::fmod(angle, 2*M_PI);
  642. + if (angle < 0) angle += 2*M_PI;
  643. + if (angle >= rad_from_deg(90) && angle < rad_from_deg(270)) {
  644. + pos = pos - Point::polar(angle_cross, (position - text_distance) + fontsize/2.0);
  645. + } else {
  646. + pos = pos - Point::polar(angle_cross, (position + text_distance) - fontsize/2.0);
  647. + }
  648. + if (!scale_insensitive) {
  649. + Geom::Affine affinetransform = i2anc_affine(SP_OBJECT(lpeitem), SP_OBJECT(desktop->doc()->getRoot()));
  650. + length *= (affinetransform.expansionX() + affinetransform.expansionY()) / 2.0;
  651. + }
  652. + createTextLabel(pos, length, angle, fontsize, remove);
  653. + //LINE
  654. + double arrow_gap = 8 * Inkscape::Util::Quantity::convert(0.35 / doc_scale, "mm", display_unit.c_str());
  655. + if (line_group_05) {
  656. + arrow_gap = 8 * Inkscape::Util::Quantity::convert(0.25 / doc_scale, "mm", display_unit.c_str());
  657. + }
  658. + if (flip_side) {
  659. + arrow_gap *= -1;
  660. + }
  661. + angle_cross = std::fmod(angle + rad_from_deg(90), 2*M_PI);
  662. + if (angle_cross < 0) angle_cross += 2*M_PI;
  663. + hstart = hstart - Point::polar(angle_cross, position);
  664. + Glib::ustring id = (Glib::ustring)"infoline-on-start-" + (Glib::ustring)this->getRepr()->attribute("id");
  665. + createLine(start, hstart, id, false, remove);
  666. + hend = hend - Point::polar(angle_cross, position);
  667. + id = (Glib::ustring)"infoline-on-end-" + (Glib::ustring)this->getRepr()->attribute("id");
  668. + createLine(end, hend, id, false, remove);
  669. + if (!arrows_outside) {
  670. + hstart = hstart + Point::polar(angle, arrow_gap);
  671. + hend = hend - Point::polar(angle, arrow_gap );
  672. + }
  673. + id = (Glib::ustring)"infoline-" + (Glib::ustring)this->getRepr()->attribute("id");
  674. + createLine(hstart, hend, id, true, remove);
  675. + }
  676. + }
  677. +}
  678. +
  679. +void LPEMeasureLine::doOnRemove (SPLPEItem const* lpeitem)
  680. +{
  681. + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) {
  682. + SPLPEItem * splpeitem = const_cast<SPLPEItem *>(lpeitem);
  683. + Inkscape::URI SVGElem_uri(( (Glib::ustring)"text-on-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  684. + Inkscape::URIReference* SVGElemRef = new Inkscape::URIReference(desktop->doc());
  685. + SVGElemRef->attach(SVGElem_uri);
  686. + SPObject *elemref = NULL;
  687. + if (elemref = SVGElemRef->getObject()) {
  688. + elemref->deleteObject();
  689. + }
  690. + Inkscape::URI SVGElem_uri2(( (Glib::ustring)"infoline-on-end-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  691. + SVGElemRef->attach(SVGElem_uri2);
  692. + elemref = NULL;
  693. + if (elemref = SVGElemRef->getObject()) {
  694. + elemref->deleteObject();
  695. + }
  696. + Inkscape::URI SVGElem_uri3(( (Glib::ustring)"infoline-on-start-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  697. + SVGElemRef->attach(SVGElem_uri3);
  698. + elemref = NULL;
  699. + if (elemref = SVGElemRef->getObject()) {
  700. + elemref->deleteObject();
  701. + }
  702. + Inkscape::URI SVGElem_uri4(( (Glib::ustring)"infoline-" + (Glib::ustring)this->getRepr()->attribute("id")).c_str());
  703. + SVGElemRef->attach(SVGElem_uri4);
  704. + elemref = NULL;
  705. + if (elemref = SVGElemRef->getObject()) {
  706. + elemref->deleteObject();
  707. + }
  708. + }
  709. +}
  710. +
  711. +Gtk::Widget *LPEMeasureLine::newWidget()
  712. +{
  713. + // use manage here, because after deletion of Effect object, others might
  714. + // still be pointing to this widget.
  715. + Gtk::VBox *vbox = Gtk::manage(new Gtk::VBox(Effect::newWidget()));
  716. +
  717. + vbox->set_border_width(5);
  718. + vbox->set_homogeneous(false);
  719. + vbox->set_spacing(2);
  720. +
  721. + std::vector<Parameter *>::iterator it = param_vector.begin();
  722. + Gtk::HBox * button1 = Gtk::manage(new Gtk::HBox(true,0));
  723. + while (it != param_vector.end()) {
  724. + if ((*it)->widget_is_visible) {
  725. + Parameter *param = *it;
  726. + Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
  727. + Glib::ustring *tip = param->param_getTooltip();
  728. + if (widg) {
  729. + vbox->pack_start(*widg, true, true, 2);
  730. + if (tip) {
  731. + widg->set_tooltip_text(*tip);
  732. + } else {
  733. + widg->set_tooltip_text("");
  734. + widg->set_has_tooltip(false);
  735. + }
  736. + }
  737. + }
  738. +
  739. + ++it;
  740. + }
  741. + Gtk::Button *save_default = Gtk::manage(new Gtk::Button(Glib::ustring(_("Save '*' as default"))));
  742. + save_default->signal_clicked().connect(sigc::mem_fun(*this, &LPEMeasureLine::saveDefault));
  743. + button1->pack_start(*save_default, true, true, 2);
  744. + vbox->pack_start(*button1, true, true, 2);
  745. + return dynamic_cast<Gtk::Widget *>(vbox);
  746. +}
  747. +
  748. +Geom::PathVector
  749. +LPEMeasureLine::doEffect_path(Geom::PathVector const &path_in)
  750. +{
  751. + return path_in;
  752. +}
  753. +
  754. +void
  755. +LPEMeasureLine::saveDefault()
  756. +{
  757. + Inkscape::Preferences *prefs = Inkscape::Preferences::get();
  758. + prefs->setString("/live_effects/measure-line/fontbutton", (Glib::ustring)fontbutton.param_getSVGValue());
  759. + prefs->setDouble("/live_effects/measure-line/scale", scale);
  760. + prefs->setInt("/live_effects/measure-line/precision", precision);
  761. + prefs->setDouble("/live_effects/measure-line/position", position);
  762. + prefs->setDouble("/live_effects/measure-line/text_distance", text_distance);
  763. + prefs->setDouble("/live_effects/measure-line/helpline_distance", helpline_distance);
  764. + prefs->setDouble("/live_effects/measure-line/helpline_overlap", helpline_overlap);
  765. + prefs->setString("/live_effects/measure-line/unit", (Glib::ustring)unit.get_abbreviation());
  766. + prefs->setString("/live_effects/measure-line/format", (Glib::ustring)format.param_getSVGValue());
  767. + prefs->setBool("/live_effects/measure-line/flip_side", flip_side);
  768. + prefs->setBool("/live_effects/measure-line/scale_insensitive", scale_insensitive);
  769. + prefs->setBool("/live_effects/measure-line/local_locale", local_locale);
  770. + prefs->setBool("/live_effects/measure-line/line_group_05", line_group_05);
  771. + prefs->setBool("/live_effects/measure-line/rotate_anotation", rotate_anotation);
  772. +}
  773. +
  774. +}; //namespace LivePathEffect
  775. +}; /* namespace Inkscape */
  776. +
  777. +/*
  778. + Local Variables:
  779. + mode:c++
  780. + c-file-style:"stroustrup"
  781. + c-file-offset:((innamespace . 0)(inline-open . 0)(case-label . +))
  782. + indent-tabs-mode:nil
  783. + fill-column:99
  784. + End:
  785. +*/
  786. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
  787. === added file 'src/live_effects/lpe-measure-line.h'
  788. --- src/live_effects/lpe-measure-line.h 1970-01-01 00:00:00 +0000
  789. +++ src/live_effects/lpe-measure-line.h 2016-07-31 14:37:23 +0000
  790. @@ -0,0 +1,89 @@
  791. +#ifndef INKSCAPE_LPE_MEASURE_LINE_H
  792. +#define INKSCAPE_LPE_MEASURE_LINE_H
  793. +
  794. +/*
  795. + * Author(s):
  796. + * Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
  797. + *
  798. + * Copyright (C) 2014 Author(s)
  799. + *
  800. + * Released under GNU GPL, read the file 'COPYING' for more information
  801. + */
  802. +
  803. +#include "live_effects/effect.h"
  804. +#include "live_effects/parameter/enum.h"
  805. +#include "live_effects/parameter/fontbutton.h"
  806. +#include "live_effects/parameter/text.h"
  807. +#include "live_effects/parameter/unit.h"
  808. +#include "live_effects/parameter/bool.h"
  809. +#include "live_effects/parameter/originalpath.h"
  810. +#include <libnrtype/font-lister.h>
  811. +#include <2geom/angle.h>
  812. +#include <2geom/ray.h>
  813. +#include <2geom/point.h>
  814. +
  815. +namespace Inkscape {
  816. +namespace LivePathEffect {
  817. +
  818. +enum OrientationMethod {
  819. + OM_HORIZONTAL,
  820. + OM_VERTICAL,
  821. + OM_PARALLEL,
  822. + OM_END
  823. +};
  824. +
  825. +class LPEMeasureLine : public Effect {
  826. +public:
  827. + LPEMeasureLine(LivePathEffectObject *lpeobject);
  828. + virtual ~LPEMeasureLine();
  829. + virtual void doBeforeEffect (SPLPEItem const* lpeitem);
  830. + virtual void doOnApply(SPLPEItem const* lpeitem);
  831. + virtual void doOnRemove (SPLPEItem const* lpeitem);
  832. + virtual void doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/);
  833. + virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in);
  834. + void createLine(Geom::Point start,Geom::Point end,Glib::ustring id, bool main, bool remove);
  835. + void createTextLabel(Geom::Point pos, double length, Geom::Coord angle, double fontsize, bool remove);
  836. + void createArrowMarker(Glib::ustring mode);
  837. + void saveDefault();
  838. + virtual Gtk::Widget *newWidget();
  839. +private:
  840. + FontButtonParam fontbutton;
  841. + EnumParam<OrientationMethod> orientation;
  842. + ScalarParam curve_linked;
  843. + ScalarParam scale;
  844. + ScalarParam precision;
  845. + ScalarParam position;
  846. + ScalarParam text_distance;
  847. + ScalarParam helpline_distance;
  848. + ScalarParam helpline_overlap;
  849. + UnitParam unit;
  850. + TextParam format;
  851. + BoolParam arrows_outside;
  852. + BoolParam flip_side;
  853. + BoolParam scale_insensitive;
  854. + BoolParam local_locale;
  855. + BoolParam line_group_05;
  856. + BoolParam rotate_anotation;
  857. + Glib::ustring display_unit;
  858. + double doc_scale;
  859. +/* Geom::Affine affine_over;*/
  860. + LPEMeasureLine(const LPEMeasureLine &);
  861. + LPEMeasureLine &operator=(const LPEMeasureLine &);
  862. +
  863. +};
  864. +
  865. +} //namespace LivePathEffect
  866. +} //namespace Inkscape
  867. +
  868. +#endif
  869. +
  870. +/*
  871. + Local Variables:
  872. + mode:c++
  873. + c-file-style:"stroustrup"
  874. + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  875. + indent-tabs-mode:nil
  876. + fill-column:99
  877. + End:
  878. +*/
  879. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
  880. === modified file 'src/live_effects/lpe-transform_2pts.cpp'
  881. --- src/live_effects/lpe-transform_2pts.cpp 2016-07-28 11:26:17 +0000
  882. +++ src/live_effects/lpe-transform_2pts.cpp 2016-07-24 16:00:12 +0000
  883. @@ -90,7 +90,6 @@
  884. {
  885. using namespace Geom;
  886. original_bbox(lpeitem);
  887. -
  888. point_a = Point(boundingbox_X.min(), boundingbox_Y.middle());
  889. point_b = Point(boundingbox_X.max(), boundingbox_Y.middle());
  890. SPLPEItem * splpeitem = const_cast<SPLPEItem *>(lpeitem);
  891. === modified file 'src/live_effects/parameter/Makefile_insert'
  892. --- src/live_effects/parameter/Makefile_insert 2015-03-02 01:29:50 +0000
  893. +++ src/live_effects/parameter/Makefile_insert 2016-07-29 21:24:09 +0000
  894. @@ -11,6 +11,8 @@
  895. live_effects/parameter/random.h \
  896. live_effects/parameter/point.cpp \
  897. live_effects/parameter/point.h \
  898. + live_effects/parameter/fontbutton.cpp \
  899. + live_effects/parameter/fontbutton.h \
  900. live_effects/parameter/enum.h \
  901. live_effects/parameter/path-reference.cpp \
  902. live_effects/parameter/path-reference.h \
  903. === modified file 'src/live_effects/parameter/bool.cpp'
  904. --- src/live_effects/parameter/bool.cpp 2015-10-18 19:13:13 +0000
  905. +++ src/live_effects/parameter/bool.cpp 2016-07-24 23:27:14 +0000
  906. @@ -36,6 +36,12 @@
  907. param_setValue(defvalue);
  908. }
  909. +void
  910. +BoolParam::param_update_default(bool const default_value)
  911. +{
  912. + defvalue = default_value;
  913. +}
  914. +
  915. bool
  916. BoolParam::param_readSVGValue(const gchar * strvalue)
  917. {
  918. === modified file 'src/live_effects/parameter/bool.h'
  919. --- src/live_effects/parameter/bool.h 2015-10-18 19:13:13 +0000
  920. +++ src/live_effects/parameter/bool.h 2016-07-24 23:26:29 +0000
  921. @@ -36,7 +36,7 @@
  922. void param_setValue(bool newvalue);
  923. virtual void param_set_default();
  924. -
  925. + void param_update_default(bool const default_value);
  926. bool get_value() const { return value; };
  927. inline operator bool() const { return value; };
  928. === modified file 'src/live_effects/parameter/enum.h'
  929. --- src/live_effects/parameter/enum.h 2014-03-27 01:33:44 +0000
  930. +++ src/live_effects/parameter/enum.h 2016-07-29 18:13:50 +0000
  931. @@ -27,12 +27,14 @@
  932. const Util::EnumDataConverter<E>& c,
  933. Inkscape::UI::Widget::Registry* wr,
  934. Effect* effect,
  935. - E default_value)
  936. + E default_value,
  937. + bool sort = true)
  938. : Parameter(label, tip, key, wr, effect)
  939. {
  940. enumdataconv = &c;
  941. defvalue = default_value;
  942. value = defvalue;
  943. + sorted = sort;
  944. };
  945. virtual ~EnumParam() { };
  946. @@ -40,12 +42,11 @@
  947. virtual Gtk::Widget * param_newWidget() {
  948. Inkscape::UI::Widget::RegisteredEnum<E> *regenum = Gtk::manage (
  949. new Inkscape::UI::Widget::RegisteredEnum<E>( param_label, param_tooltip,
  950. - param_key, *enumdataconv, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) );
  951. + param_key, *enumdataconv, *param_wr, param_effect->getRepr(), param_effect->getSPDoc(), sorted ) );
  952. regenum->set_active_by_id(value);
  953. regenum->combobox()->setProgrammatically = false;
  954. regenum->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change enumeration parameter"));
  955. -
  956. return dynamic_cast<Gtk::Widget *> (regenum);
  957. };
  958. @@ -86,6 +87,7 @@
  959. E value;
  960. E defvalue;
  961. + bool sorted;
  962. const Util::EnumDataConverter<E> * enumdataconv;
  963. };
  964. === added file 'src/live_effects/parameter/fontbutton.cpp'
  965. --- src/live_effects/parameter/fontbutton.cpp 1970-01-01 00:00:00 +0000
  966. +++ src/live_effects/parameter/fontbutton.cpp 2016-07-29 21:26:48 +0000
  967. @@ -0,0 +1,92 @@
  968. +/*
  969. + * Authors:
  970. + *
  971. + * Released under GNU GPL, read the file 'COPYING' for more information
  972. + */
  973. +
  974. +
  975. +#include "ui/widget/registered-widget.h"
  976. +#include "live_effects/parameter/fontbutton.h"
  977. +#include "live_effects/effect.h"
  978. +#include "ui/widget/font-button.h"
  979. +#include "svg/svg.h"
  980. +#include "svg/stringstream.h"
  981. +#include "verbs.h"
  982. +
  983. +#include <glibmm/i18n.h>
  984. +
  985. +namespace Inkscape {
  986. +
  987. +namespace LivePathEffect {
  988. +
  989. +FontButtonParam::FontButtonParam( const Glib::ustring& label, const Glib::ustring& tip,
  990. + const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
  991. + Effect* effect, const Glib::ustring default_value )
  992. + : Parameter(label, tip, key, wr, effect),
  993. + value(default_value),
  994. + defvalue(default_value)
  995. +{
  996. +}
  997. +
  998. +void
  999. +FontButtonParam::param_set_default()
  1000. +{
  1001. + param_setValue(defvalue);
  1002. +}
  1003. +void
  1004. +FontButtonParam::param_update_default(const Glib::ustring default_value){
  1005. + defvalue = default_value;
  1006. +}
  1007. +
  1008. +bool
  1009. +FontButtonParam::param_readSVGValue(const gchar * strvalue)
  1010. +{
  1011. + Inkscape::SVGOStringStream os;
  1012. + os << strvalue;
  1013. + param_setValue((Glib::ustring)os.str());
  1014. + return true;
  1015. +}
  1016. +
  1017. +gchar *
  1018. +FontButtonParam::param_getSVGValue() const
  1019. +{
  1020. + return g_strdup(value.c_str());
  1021. +}
  1022. +
  1023. +Gtk::Widget *
  1024. +FontButtonParam::param_newWidget()
  1025. +{
  1026. + Inkscape::UI::Widget::RegisteredFontButton * fontbuttonwdg = Gtk::manage(
  1027. + new Inkscape::UI::Widget::RegisteredFontButton( param_label,
  1028. + param_tooltip,
  1029. + param_key,
  1030. + *param_wr,
  1031. + param_effect->getRepr(),
  1032. + param_effect->getSPDoc() ) );
  1033. + Glib::ustring fontspec = param_getSVGValue();
  1034. + fontbuttonwdg->setValue( fontspec);
  1035. + fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter"));
  1036. + param_effect->upd_params = false;
  1037. + return dynamic_cast<Gtk::Widget *> (fontbuttonwdg);
  1038. +}
  1039. +
  1040. +void
  1041. +FontButtonParam::param_setValue(const Glib::ustring newvalue)
  1042. +{
  1043. + value = newvalue;
  1044. +}
  1045. +
  1046. +} /* namespace LivePathEffect */
  1047. +
  1048. +} /* namespace Inkscape */
  1049. +
  1050. +/*
  1051. + Local Variables:
  1052. + mode:c++
  1053. + c-file-style:"stroustrup"
  1054. + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  1055. + indent-tabs-mode:nil
  1056. + fill-column:99
  1057. + End:
  1058. +*/
  1059. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
  1060. === added file 'src/live_effects/parameter/fontbutton.h'
  1061. --- src/live_effects/parameter/fontbutton.h 1970-01-01 00:00:00 +0000
  1062. +++ src/live_effects/parameter/fontbutton.h 2016-07-29 20:44:37 +0000
  1063. @@ -0,0 +1,62 @@
  1064. +#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_FONT_H
  1065. +#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_FONT_H
  1066. +
  1067. +/*
  1068. + * Inkscape::LivePathEffectParameters
  1069. + *
  1070. + * Authors:
  1071. + * Released under GNU GPL, read the file 'COPYING' for more information
  1072. + */
  1073. +#include <glib.h>
  1074. +#include <gtkmm.h>
  1075. +#include "live_effects/parameter/parameter.h"
  1076. +
  1077. +namespace Inkscape {
  1078. +
  1079. +namespace LivePathEffect {
  1080. +
  1081. +class FontButtonParam : public Parameter {
  1082. +public:
  1083. + FontButtonParam( const Glib::ustring& label,
  1084. + const Glib::ustring& tip,
  1085. + const Glib::ustring& key,
  1086. + Inkscape::UI::Widget::Registry* wr,
  1087. + Effect* effect,
  1088. + const Glib::ustring default_value = "");
  1089. + virtual ~FontButtonParam() {}
  1090. +
  1091. + virtual Gtk::Widget * param_newWidget();
  1092. + virtual bool param_readSVGValue(const gchar * strvalue);
  1093. + void param_update_default(const Glib::ustring defvalue);
  1094. + virtual gchar * param_getSVGValue() const;
  1095. +
  1096. + void param_setValue(const Glib::ustring newvalue);
  1097. +
  1098. + virtual void param_set_default();
  1099. +
  1100. + const Glib::ustring get_value() const { return defvalue; };
  1101. +
  1102. +private:
  1103. + FontButtonParam(const FontButtonParam&);
  1104. + FontButtonParam& operator=(const FontButtonParam&);
  1105. + Glib::ustring value;
  1106. + Glib::ustring defvalue;
  1107. +
  1108. +};
  1109. +
  1110. +} //namespace LivePathEffect
  1111. +
  1112. +} //namespace Inkscape
  1113. +
  1114. +#endif
  1115. +
  1116. +/*
  1117. + Local Variables:
  1118. + mode:c++
  1119. + c-file-style:"stroustrup"
  1120. + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  1121. + indent-tabs-mode:nil
  1122. + fill-column:99
  1123. + End:
  1124. +*/
  1125. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
  1126. === modified file 'src/live_effects/parameter/parameter.cpp'
  1127. --- src/live_effects/parameter/parameter.cpp 2015-10-18 19:13:13 +0000
  1128. +++ src/live_effects/parameter/parameter.cpp 2016-07-30 16:08:21 +0000
  1129. @@ -4,11 +4,9 @@
  1130. * Released under GNU GPL, read the file 'COPYING' for more information
  1131. */
  1132. -#include "ui/widget/registered-widget.h"
  1133. -#include <glibmm/i18n.h>
  1134. +#include "live_effects/effect.h"
  1135. #include "live_effects/parameter/parameter.h"
  1136. -#include "live_effects/effect.h"
  1137. #include "svg/svg.h"
  1138. #include "xml/repr.h"
  1139. @@ -16,6 +14,8 @@
  1140. #include "verbs.h"
  1141. +#include <glibmm/i18n.h>
  1142. +
  1143. #define noLPEREALPARAM_DEBUG
  1144. namespace Inkscape {
  1145. @@ -101,9 +101,16 @@
  1146. param_set_value(defvalue);
  1147. }
  1148. +void
  1149. +ScalarParam::param_update_default(gdouble default_value)
  1150. +{
  1151. + defvalue = default_value;
  1152. +}
  1153. +
  1154. void
  1155. ScalarParam::param_set_value(gdouble val)
  1156. {
  1157. + param_effect->upd_params = true;
  1158. value = val;
  1159. if (integer)
  1160. value = round(value);
  1161. @@ -121,7 +128,7 @@
  1162. // Once again, in gtk2, this is not a problem. But in gtk3,
  1163. // widgets get allocated the amount of size they ask for,
  1164. // leading to excessively long widgets.
  1165. -
  1166. + param_effect->upd_params = true;
  1167. if (min >= -SCALARPARAM_G_MAXDOUBLE) {
  1168. this->min = min;
  1169. } else {
  1170. @@ -130,15 +137,15 @@
  1171. if (max <= SCALARPARAM_G_MAXDOUBLE) {
  1172. this->max = max;
  1173. } else {
  1174. - this->max = SCALARPARAM_G_MAXDOUBLE;
  1175. + this->max = SCALARPARAM_G_MAXDOUBLE;
  1176. }
  1177. -
  1178. param_set_value(value); // reset value to see whether it is in ranges
  1179. }
  1180. void
  1181. ScalarParam::param_make_integer(bool yes)
  1182. {
  1183. + param_effect->upd_params = true;
  1184. integer = yes;
  1185. digits = 0;
  1186. inc_step = 1;
  1187. @@ -169,6 +176,7 @@
  1188. if(!overwrite_widget){
  1189. rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));
  1190. }
  1191. + param_effect->upd_params = false;
  1192. return dynamic_cast<Gtk::Widget *> (rsu);
  1193. } else {
  1194. return NULL;
  1195. @@ -178,12 +186,14 @@
  1196. void
  1197. ScalarParam::param_set_digits(unsigned digits)
  1198. {
  1199. + param_effect->upd_params = true;
  1200. this->digits = digits;
  1201. }
  1202. void
  1203. ScalarParam::param_set_increments(double step, double page)
  1204. {
  1205. + param_effect->upd_params = true;
  1206. inc_step = step;
  1207. inc_page = page;
  1208. }
  1209. === modified file 'src/live_effects/parameter/parameter.h'
  1210. --- src/live_effects/parameter/parameter.h 2015-10-18 19:13:13 +0000
  1211. +++ src/live_effects/parameter/parameter.h 2016-07-30 16:05:28 +0000
  1212. @@ -12,6 +12,7 @@
  1213. #include <glibmm/ustring.h>
  1214. #include <2geom/forward.h>
  1215. #include <2geom/pathvector.h>
  1216. +#include "ui/widget/registered-widget.h"
  1217. // In gtk2, this wasn't an issue; we could toss around
  1218. // G_MAXDOUBLE and not worry about size allocations. But
  1219. @@ -110,12 +111,12 @@
  1220. virtual gchar * param_getSVGValue() const;
  1221. virtual void param_set_default();
  1222. + void param_update_default(gdouble default_value);
  1223. void param_set_value(gdouble val);
  1224. void param_make_integer(bool yes = true);
  1225. void param_set_range(gdouble min, gdouble max);
  1226. void param_set_digits(unsigned digits);
  1227. void param_set_increments(double step, double page);
  1228. -
  1229. void addSlider(bool add_slider_widget) { add_slider = add_slider_widget; };
  1230. void param_overwrite_widget(bool overwrite_widget);
  1231. === modified file 'src/live_effects/parameter/point.cpp'
  1232. --- src/live_effects/parameter/point.cpp 2016-01-17 19:18:53 +0000
  1233. +++ src/live_effects/parameter/point.cpp 2016-07-29 09:36:40 +0000
  1234. @@ -4,7 +4,6 @@
  1235. * Released under GNU GPL, read the file 'COPYING' for more information
  1236. */
  1237. -#include "ui/widget/registered-widget.h"
  1238. #include "live_effects/parameter/point.h"
  1239. #include "live_effects/effect.h"
  1240. #include "svg/svg.h"
  1241. @@ -30,7 +29,8 @@
  1242. : Parameter(label, tip, key, wr, effect),
  1243. defvalue(default_value),
  1244. liveupdate(live_update),
  1245. - knoth(NULL)
  1246. + knoth(NULL),
  1247. + _pointwdg(NULL)
  1248. {
  1249. knot_shape = SP_KNOT_SHAPE_DIAMOND;
  1250. knot_mode = SP_KNOT_MODE_XOR;
  1251. @@ -62,9 +62,9 @@
  1252. }
  1253. void
  1254. -PointParam::param_update_default(Geom::Point newpoint)
  1255. +PointParam::param_update_default(const Geom::Point default_point)
  1256. {
  1257. - defvalue = newpoint;
  1258. + defvalue = default_point;
  1259. }
  1260. void
  1261. @@ -81,6 +81,9 @@
  1262. if(knoth && liveupdate){
  1263. knoth->update_knots();
  1264. }
  1265. + if (_pointwdg) {
  1266. + _pointwdg->setValue( newpoint );
  1267. + }
  1268. }
  1269. bool
  1270. @@ -116,7 +119,7 @@
  1271. Gtk::Widget *
  1272. PointParam::param_newWidget()
  1273. {
  1274. - Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage(
  1275. + _pointwdg = Gtk::manage(
  1276. new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label,
  1277. param_tooltip,
  1278. param_key,
  1279. @@ -126,15 +129,15 @@
  1280. // TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP)
  1281. SPDesktop *desktop = SP_ACTIVE_DESKTOP;
  1282. Geom::Affine transf = desktop->doc2dt();
  1283. - pointwdg->setTransform(transf);
  1284. - pointwdg->setValue( *this );
  1285. - pointwdg->clearProgrammatically();
  1286. - pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
  1287. + _pointwdg->setTransform(transf);
  1288. + _pointwdg->setValue( *this );
  1289. + _pointwdg->clearProgrammatically();
  1290. + _pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
  1291. Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
  1292. - static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true);
  1293. + static_cast<Gtk::HBox*>(hbox)->pack_start(*_pointwdg, true, true);
  1294. static_cast<Gtk::HBox*>(hbox)->show_all_children();
  1295. -
  1296. + param_effect->upd_params = false;
  1297. return dynamic_cast<Gtk::Widget *> (hbox);
  1298. }
  1299. @@ -191,13 +194,13 @@
  1300. PointParamKnotHolderEntity::knot_click(guint state)
  1301. {
  1302. if (state & GDK_CONTROL_MASK) {
  1303. - if (state & GDK_MOD1_MASK) {
  1304. - this->pparam->param_set_default();
  1305. - SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item);
  1306. - if(splpeitem){
  1307. - sp_lpe_item_update_patheffect(splpeitem, false, false);
  1308. - }
  1309. + if (state & GDK_MOD1_MASK) {
  1310. + this->pparam->param_set_default();
  1311. + SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item);
  1312. + if(splpeitem){
  1313. + sp_lpe_item_update_patheffect(splpeitem, false, false);
  1314. }
  1315. + }
  1316. }
  1317. }
  1318. === modified file 'src/live_effects/parameter/point.h'
  1319. --- src/live_effects/parameter/point.h 2016-01-17 19:18:53 +0000
  1320. +++ src/live_effects/parameter/point.h 2016-07-29 09:28:12 +0000
  1321. @@ -11,7 +11,7 @@
  1322. #include <glib.h>
  1323. #include <2geom/point.h>
  1324. -
  1325. +#include "ui/widget/registered-widget.h"
  1326. #include "live_effects/parameter/parameter.h"
  1327. #include "knot-holder-entity.h"
  1328. @@ -43,7 +43,7 @@
  1329. void param_set_default();
  1330. Geom::Point param_get_default() const;
  1331. void param_set_liveupdate(bool live_update);
  1332. - void param_update_default(Geom::Point newpoint);
  1333. + void param_update_default(const Geom::Point default_point);
  1334. virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
  1335. void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
  1336. @@ -62,6 +62,7 @@
  1337. SPKnotModeType knot_mode;
  1338. guint32 knot_color;
  1339. gchar *handle_tip;
  1340. + Inkscape::UI::Widget::RegisteredTransformedPoint * _pointwdg;
  1341. };
  1342. === modified file 'src/live_effects/parameter/text.cpp'
  1343. --- src/live_effects/parameter/text.cpp 2014-12-21 21:58:32 +0000
  1344. +++ src/live_effects/parameter/text.cpp 2016-07-31 02:24:26 +0000
  1345. @@ -31,7 +31,8 @@
  1346. Effect* effect, const Glib::ustring default_value )
  1347. : Parameter(label, tip, key, wr, effect),
  1348. value(default_value),
  1349. - defvalue(default_value)
  1350. + defvalue(default_value),
  1351. + _hide_canvas_text(false)
  1352. {
  1353. SPDesktop *desktop = SP_ACTIVE_DESKTOP; // FIXME: we shouldn't use this!
  1354. canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), "");
  1355. @@ -46,9 +47,24 @@
  1356. }
  1357. void
  1358. +TextParam::param_update_default(Glib::ustring default_value)
  1359. +{
  1360. + defvalue = default_value;
  1361. +}
  1362. +
  1363. +void
  1364. +TextParam::param_hide_canvas_text()
  1365. +{
  1366. + _hide_canvas_text = true;
  1367. + sp_canvastext_set_text (canvas_text,"");
  1368. +}
  1369. +
  1370. +void
  1371. TextParam::setPos(Geom::Point pos)
  1372. {
  1373. - sp_canvastext_set_coords (canvas_text, pos);
  1374. + if (!_hide_canvas_text) {
  1375. + sp_canvastext_set_coords (canvas_text, pos);
  1376. + }
  1377. }
  1378. void
  1379. @@ -63,9 +79,10 @@
  1380. Point dir = unit_vector(derivative(pwd2_reparam).valueAt(t_reparam));
  1381. Point n = -rot90(dir);
  1382. double angle = Geom::angle_between(dir, Point(1,0));
  1383. -
  1384. - sp_canvastext_set_coords(canvas_text, pos + n * length);
  1385. - sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle));
  1386. + if (!_hide_canvas_text) {
  1387. + sp_canvastext_set_coords(canvas_text, pos + n * length);
  1388. + sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle));
  1389. + }
  1390. }
  1391. void
  1392. @@ -73,7 +90,9 @@
  1393. {
  1394. anchor_x = x_value;
  1395. anchor_y = y_value;
  1396. - sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y);
  1397. + if (!_hide_canvas_text) {
  1398. + sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y);
  1399. + }
  1400. }
  1401. bool
  1402. @@ -107,8 +126,9 @@
  1403. TextParam::param_setValue(const Glib::ustring newvalue)
  1404. {
  1405. value = newvalue;
  1406. -
  1407. - sp_canvastext_set_text (canvas_text, newvalue.c_str());
  1408. + if (!_hide_canvas_text) {
  1409. + sp_canvastext_set_text (canvas_text, newvalue.c_str());
  1410. + }
  1411. }
  1412. } /* namespace LivePathEffect */
  1413. === modified file 'src/live_effects/parameter/text.h'
  1414. --- src/live_effects/parameter/text.h 2014-03-27 01:33:44 +0000
  1415. +++ src/live_effects/parameter/text.h 2016-07-31 02:24:55 +0000
  1416. @@ -40,7 +40,9 @@
  1417. virtual gchar * param_getSVGValue() const;
  1418. void param_setValue(const Glib::ustring newvalue);
  1419. + void param_hide_canvas_text();
  1420. virtual void param_set_default();
  1421. + void param_update_default(Glib::ustring default_value);
  1422. void setPos(Geom::Point pos);
  1423. void setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
  1424. const double t, const double length, bool use_curvature = false);
  1425. @@ -53,7 +55,7 @@
  1426. TextParam& operator=(const TextParam&);
  1427. double anchor_x;
  1428. double anchor_y;
  1429. -
  1430. + bool _hide_canvas_text;
  1431. Glib::ustring value;
  1432. Glib::ustring defvalue;
  1433. === modified file 'src/live_effects/parameter/togglebutton.cpp'
  1434. --- src/live_effects/parameter/togglebutton.cpp 2016-07-24 15:05:29 +0000
  1435. +++ src/live_effects/parameter/togglebutton.cpp 2016-07-24 16:53:55 +0000
  1436. @@ -12,6 +12,7 @@
  1437. #include "live_effects/effect.h"
  1438. #include "svg/svg.h"
  1439. #include "svg/stringstream.h"
  1440. +#include "selection.h"
  1441. #include "widgets/icon.h"
  1442. #include "inkscape.h"
  1443. #include "verbs.h"
  1444. @@ -108,13 +109,14 @@
  1445. }else{
  1446. gtk_box_pack_start (GTK_BOX(box_button), label_button, false, false, 1);
  1447. }
  1448. +
  1449. checkwdg->add(*Gtk::manage(Glib::wrap(box_button)));
  1450. checkwdg->setActive(value);
  1451. checkwdg->setProgrammatically = false;
  1452. checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter"));
  1453. _toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled));
  1454. -
  1455. + param_effect->upd_params = false;
  1456. return checkwdg;
  1457. }
  1458. @@ -161,6 +163,12 @@
  1459. void
  1460. ToggleButtonParam::toggled() {
  1461. + //Force redraw for update widgets
  1462. + param_effect->upd_params = true;
  1463. + if (SP_ACTIVE_DESKTOP) {
  1464. + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
  1465. + selection ->emitModified();
  1466. + }
  1467. _signal_toggled.emit();
  1468. }
  1469. === modified file 'src/live_effects/parameter/unit.cpp'
  1470. --- src/live_effects/parameter/unit.cpp 2014-03-27 01:33:44 +0000
  1471. +++ src/live_effects/parameter/unit.cpp 2016-07-24 23:34:35 +0000
  1472. @@ -54,6 +54,12 @@
  1473. param_set_value(*defunit);
  1474. }
  1475. +void
  1476. +UnitParam::param_update_default(const Glib::ustring default_unit)
  1477. +{
  1478. + defunit = unit_table.getUnit(default_unit);
  1479. +}
  1480. +
  1481. void
  1482. UnitParam::param_set_value(Inkscape::Util::Unit const &val)
  1483. {
  1484. === modified file 'src/live_effects/parameter/unit.h'
  1485. --- src/live_effects/parameter/unit.h 2014-03-27 01:33:44 +0000
  1486. +++ src/live_effects/parameter/unit.h 2016-07-24 23:34:56 +0000
  1487. @@ -33,6 +33,7 @@
  1488. virtual gchar * param_getSVGValue() const;
  1489. virtual void param_set_default();
  1490. void param_set_value(Inkscape::Util::Unit const &val);
  1491. + void param_update_default(const Glib::ustring default_unit);
  1492. const gchar *get_abbreviation() const;
  1493. virtual Gtk::Widget * param_newWidget();
  1494. === modified file 'src/selection.cpp'
  1495. --- src/selection.cpp 2016-07-28 11:26:17 +0000
  1496. +++ src/selection.cpp 2016-07-24 16:00:12 +0000
  1497. @@ -282,6 +282,11 @@
  1498. _emitChanged();
  1499. }
  1500. +void Selection::emitModified()
  1501. +{
  1502. + _emitChanged();
  1503. +}
  1504. +
  1505. std::vector<SPObject*> const &Selection::list() {
  1506. if(!_objs_vector.empty())
  1507. return _objs_vector;
  1508. === modified file 'src/selection.h'
  1509. --- src/selection.h 2016-07-28 11:26:17 +0000
  1510. +++ src/selection.h 2016-07-24 16:00:12 +0000
  1511. @@ -192,6 +192,11 @@
  1512. void clear();
  1513. /**
  1514. + * Emmit modified signal
  1515. + */
  1516. + void emitModified();
  1517. +
  1518. + /**
  1519. * Returns true if no items are selected.
  1520. */
  1521. bool isEmpty() const { return _objs.empty(); }
  1522. === modified file 'src/ui/CMakeLists.txt'
  1523. --- src/ui/CMakeLists.txt 2016-02-07 15:49:01 +0000
  1524. +++ src/ui/CMakeLists.txt 2016-07-29 21:24:51 +0000
  1525. @@ -128,6 +128,7 @@
  1526. widget/entity-entry.cpp
  1527. widget/entry.cpp
  1528. widget/filter-effect-chooser.cpp
  1529. + widget/font-button.cpp
  1530. widget/font-variants.cpp
  1531. widget/frame.cpp
  1532. widget/gimpcolorwheel.c
  1533. @@ -312,6 +313,7 @@
  1534. widget/entity-entry.h
  1535. widget/entry.h
  1536. widget/filter-effect-chooser.h
  1537. + widget/font-button.h
  1538. widget/font-variants.h
  1539. widget/frame.h
  1540. widget/gimpspinscale.h
  1541. === modified file 'src/ui/dialog/livepatheffect-editor.cpp'
  1542. --- src/ui/dialog/livepatheffect-editor.cpp 2016-07-28 11:26:17 +0000
  1543. +++ src/ui/dialog/livepatheffect-editor.cpp 2016-07-30 17:02:04 +0000
  1544. @@ -61,7 +61,7 @@
  1545. {
  1546. LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
  1547. lpeeditor->lpe_list_locked = false;
  1548. - lpeeditor->onSelectionChanged(selection);
  1549. + lpeeditor->onSelectionChanged(selection, true);
  1550. }
  1551. static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
  1552. @@ -98,7 +98,8 @@
  1553. button_up(),
  1554. button_down(),
  1555. current_desktop(NULL),
  1556. - current_lpeitem(NULL)
  1557. + current_lpeitem(NULL),
  1558. + current_lperef(NULL)
  1559. {
  1560. Gtk::Box *contents = _getContents();
  1561. contents->set_spacing(4);
  1562. @@ -206,6 +207,10 @@
  1563. void
  1564. LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
  1565. {
  1566. + if ( ! effect.upd_params ) {
  1567. + return;
  1568. + }
  1569. +
  1570. if (effectwidget) {
  1571. effectcontrol_vbox.remove(*effectwidget);
  1572. delete effectwidget;
  1573. @@ -265,9 +270,8 @@
  1574. button_down.set_sensitive(sensitive);
  1575. }
  1576. -
  1577. void
  1578. -LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
  1579. +LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params)
  1580. {
  1581. if (lpe_list_locked) {
  1582. // this was triggered by selecting a row in the list, so skip reloading
  1583. @@ -291,6 +295,9 @@
  1584. if ( lpeitem->hasPathEffect() ) {
  1585. Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE();
  1586. if (lpe) {
  1587. + if (upd_params) {
  1588. + lpe->upd_params = true;
  1589. + }
  1590. showParams(*lpe);
  1591. lpe_list_locked = true;
  1592. selectInList(lpe);
  1593. @@ -494,6 +501,12 @@
  1594. SPItem *item = sel->singleItem();
  1595. SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
  1596. if ( lpeitem ) {
  1597. + if (current_lperef && current_lperef->lpeobject) {
  1598. + LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe();
  1599. + if (effect) {
  1600. + effect->upd_params = true;
  1601. + }
  1602. + }
  1603. lpeitem->removeCurrentPathEffect(false);
  1604. DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
  1605. @@ -548,11 +561,17 @@
  1606. Gtk::TreeModel::iterator it = sel->get_selected();
  1607. LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef];
  1608. - if (lperef && current_lpeitem) {
  1609. + if (lperef && current_lpeitem && current_lperef != lperef) {
  1610. + //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened
  1611. if (lperef->lpeobject->get_lpe()) {
  1612. lpe_list_locked = true; // prevent reload of the list which would lose selection
  1613. current_lpeitem->setCurrentPathEffect(lperef);
  1614. - showParams(*lperef->lpeobject->get_lpe());
  1615. + current_lperef = lperef;
  1616. + LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe();
  1617. + if (effect) {
  1618. + effect->upd_params = true;
  1619. + showParams(*effect);
  1620. + }
  1621. }
  1622. }
  1623. }
  1624. @@ -570,6 +589,14 @@
  1625. /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack.
  1626. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */
  1627. lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false");
  1628. + Inkscape::Selection *sel = _getSelection();
  1629. + if ( sel && !sel->isEmpty() ) {
  1630. + SPItem *item = sel->singleItem();
  1631. + SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
  1632. + if ( lpeitem ) {
  1633. + lpeobjref->lpeobject->get_lpe()->doOnVisibilityToggled(lpeitem);
  1634. + }
  1635. + }
  1636. DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
  1637. newValue ? _("Activate path effect") : _("Deactivate path effect"));
  1638. }
  1639. === modified file 'src/ui/dialog/livepatheffect-editor.h'
  1640. --- src/ui/dialog/livepatheffect-editor.h 2014-03-27 01:33:44 +0000
  1641. +++ src/ui/dialog/livepatheffect-editor.h 2016-07-24 16:00:12 +0000
  1642. @@ -45,7 +45,8 @@
  1643. static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); }
  1644. - void onSelectionChanged(Inkscape::Selection *sel);
  1645. + void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false);
  1646. + void onSelectionModified(Inkscape::Selection *sel);
  1647. virtual void on_effect_selection_changed();
  1648. void setDesktop(SPDesktop *desktop);
  1649. @@ -126,6 +127,8 @@
  1650. SPLPEItem * current_lpeitem;
  1651. + LivePathEffect::LPEObjectReference * current_lperef;
  1652. +
  1653. friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data);
  1654. LivePathEffectEditor(LivePathEffectEditor const &d);
  1655. === modified file 'src/ui/widget/Makefile_insert'
  1656. --- src/ui/widget/Makefile_insert 2015-05-17 09:20:36 +0000
  1657. +++ src/ui/widget/Makefile_insert 2016-07-29 21:25:30 +0000
  1658. @@ -33,6 +33,8 @@
  1659. ui/widget/entry.h \
  1660. ui/widget/filter-effect-chooser.h \
  1661. ui/widget/filter-effect-chooser.cpp \
  1662. + ui/widget/font-button.h \
  1663. + ui/widget/font-button.cpp \
  1664. ui/widget/font-variants.h \
  1665. ui/widget/font-variants.cpp \
  1666. ui/widget/gimpspinscale.c \
  1667. === modified file 'src/ui/widget/combo-enums.h'
  1668. --- src/ui/widget/combo-enums.h 2012-02-15 11:19:00 +0000
  1669. +++ src/ui/widget/combo-enums.h 2016-07-29 18:13:37 +0000
  1670. @@ -16,7 +16,6 @@
  1671. #include <gtkmm/liststore.h>
  1672. #include "attr-widget.h"
  1673. #include "util/enums.h"
  1674. -
  1675. #include <glibmm/i18n.h>
  1676. namespace Inkscape {
  1677. @@ -190,9 +189,11 @@
  1678. const Util::EnumDataConverter<E>& c,
  1679. Glib::ustring const &suffix = "",
  1680. Glib::ustring const &icon = "",
  1681. - bool mnemonic = true)
  1682. - : Labelled(label, tooltip, new ComboBoxEnum<E>(c), suffix, icon, mnemonic)
  1683. - { }
  1684. + bool mnemonic = true,
  1685. + bool sorted = true)
  1686. + : Labelled(label, tooltip, new ComboBoxEnum<E>(c, SP_ATTR_INVALID, sorted), suffix, icon, mnemonic)
  1687. + {
  1688. + }
  1689. ComboBoxEnum<E>* getCombobox() {
  1690. return static_cast< ComboBoxEnum<E>* > (_widget);
  1691. === added file 'src/ui/widget/font-button.cpp'
  1692. --- src/ui/widget/font-button.cpp 1970-01-01 00:00:00 +0000
  1693. +++ src/ui/widget/font-button.cpp 2016-07-30 00:01:38 +0000
  1694. @@ -0,0 +1,58 @@
  1695. +/*
  1696. + *
  1697. + * Released under GNU GPL. Read the file 'COPYING' for more information.
  1698. + */
  1699. +
  1700. +#ifdef HAVE_CONFIG_H
  1701. +# include <config.h>
  1702. +#endif
  1703. +
  1704. +#include "font-button.h"
  1705. +#include <glibmm/i18n.h>
  1706. +
  1707. +namespace Inkscape {
  1708. +namespace UI {
  1709. +namespace Widget {
  1710. +
  1711. +FontButton::FontButton(Glib::ustring const &label, Glib::ustring const &tooltip,
  1712. + Glib::ustring const &suffix,
  1713. + Glib::ustring const &icon,
  1714. + bool mnemonic)
  1715. + : Labelled(label, tooltip, new Gtk::FontButton("Sans 10"), suffix, icon, mnemonic)
  1716. +{
  1717. +}
  1718. +
  1719. +Glib::ustring FontButton::getValue() const
  1720. +{
  1721. + g_assert(_widget != NULL);
  1722. + return static_cast<Gtk::FontButton*>(_widget)->get_font_name();
  1723. +}
  1724. +
  1725. +
  1726. +void FontButton::setValue (Glib::ustring fontspec)
  1727. +{
  1728. + g_assert(_widget != NULL);
  1729. + static_cast<Gtk::FontButton*>(_widget)->set_font_name(fontspec);
  1730. +}
  1731. +
  1732. +Glib::SignalProxy0<void> FontButton::signal_font_value_changed()
  1733. +{
  1734. + g_assert(_widget != NULL);
  1735. + return static_cast<Gtk::FontButton*>(_widget)->signal_font_set();
  1736. +}
  1737. +
  1738. +
  1739. +} // namespace Widget
  1740. +} // namespace UI
  1741. +} // namespace Inkscape
  1742. +
  1743. +/*
  1744. + Local Variables:
  1745. + mode:c++
  1746. + c-file-style:"stroustrup"
  1747. + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  1748. + indent-tabs-mode:nil
  1749. + fill-column:99
  1750. + End:
  1751. +*/
  1752. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
  1753. === added file 'src/ui/widget/font-button.h'
  1754. --- src/ui/widget/font-button.h 1970-01-01 00:00:00 +0000
  1755. +++ src/ui/widget/font-button.h 2016-07-29 22:58:22 +0000
  1756. @@ -0,0 +1,63 @@
  1757. +/*
  1758. + *
  1759. + * Copyright (C) 2007 Author
  1760. + *
  1761. + * Released under GNU GPL. Read the file 'COPYING' for more information.
  1762. + */
  1763. +
  1764. +#ifndef INKSCAPE_UI_WIDGET_FONT_BUTTON_H
  1765. +#define INKSCAPE_UI_WIDGET_FONT_BUTTON_H
  1766. +
  1767. +#include <gtkmm.h>
  1768. +#include "labelled.h"
  1769. +
  1770. +namespace Inkscape {
  1771. +namespace UI {
  1772. +namespace Widget {
  1773. +
  1774. +/**
  1775. + * A labelled font button for entering font values
  1776. + */
  1777. +class FontButton : public Labelled
  1778. +{
  1779. +public:
  1780. + /**
  1781. + * Construct a FontButton Widget.
  1782. + *
  1783. + * @param label Label.
  1784. + * @param suffix Suffix, placed after the widget (defaults to "").
  1785. + * @param icon Icon filename, placed before the label (defaults to "").
  1786. + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label
  1787. + * indicates the next character should be used for the
  1788. + * mnemonic accelerator key (defaults to false).
  1789. + */
  1790. + FontButton( Glib::ustring const &label,
  1791. + Glib::ustring const &tooltip,
  1792. + Glib::ustring const &suffix = "",
  1793. + Glib::ustring const &icon = "",
  1794. + bool mnemonic = true);
  1795. +
  1796. + Glib::ustring getValue() const;
  1797. + void setValue (Glib::ustring fontspec);
  1798. + /**
  1799. + * Signal raised when the font button's value changes.
  1800. + */
  1801. + Glib::SignalProxy0<void> signal_font_value_changed();
  1802. +};
  1803. +
  1804. +} // namespace Widget
  1805. +} // namespace UI
  1806. +} // namespace Inkscape
  1807. +
  1808. +#endif // INKSCAPE_UI_WIDGET_RANDOM_H
  1809. +
  1810. +/*
  1811. + Local Variables:
  1812. + mode:c++
  1813. + c-file-style:"stroustrup"
  1814. + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  1815. + indent-tabs-mode:nil
  1816. + fill-column:99
  1817. + End:
  1818. +*/
  1819. +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
  1820. === modified file 'src/ui/widget/registered-enums.h'
  1821. --- src/ui/widget/registered-enums.h 2011-10-25 07:45:35 +0000
  1822. +++ src/ui/widget/registered-enums.h 2016-07-29 18:13:43 +0000
  1823. @@ -33,11 +33,11 @@
  1824. const Util::EnumDataConverter<E>& c,
  1825. Registry& wr,
  1826. Inkscape::XML::Node* repr_in = NULL,
  1827. - SPDocument *doc_in = NULL )
  1828. - : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c)
  1829. + SPDocument *doc_in = NULL,
  1830. + bool sorted = true )
  1831. + : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c, (const Glib::ustring &)"", (const Glib::ustring &)"", true, sorted)
  1832. {
  1833. RegisteredWidget< LabelledComboBoxEnum<E> >::init_parent(key, wr, repr_in, doc_in);
  1834. -
  1835. _changed_connection = combobox()->signal_changed().connect (sigc::mem_fun (*this, &RegisteredEnum::on_changed));
  1836. }
  1837. === modified file 'src/ui/widget/registered-widget.cpp'
  1838. --- src/ui/widget/registered-widget.cpp 2016-07-28 11:26:17 +0000
  1839. +++ src/ui/widget/registered-widget.cpp 2016-07-31 02:52:27 +0000
  1840. @@ -25,6 +25,7 @@
  1841. #include "ui/widget/scalar-unit.h"
  1842. #include "ui/widget/point.h"
  1843. #include "ui/widget/random.h"
  1844. +#include "ui/widget/font-button.h"
  1845. #include "widgets/spinbutton-events.h"
  1846. #include "xml/repr.h"
  1847. @@ -297,7 +298,6 @@
  1848. setProgrammatically = false;
  1849. return;
  1850. }
  1851. -
  1852. if (_wr->isUpdating()) {
  1853. return;
  1854. }
  1855. @@ -803,6 +803,47 @@
  1856. _wr->setUpdating (false);
  1857. }
  1858. +/*#########################################
  1859. + * Registered FONT-BUTTON
  1860. + */
  1861. +
  1862. +RegisteredFontButton::~RegisteredFontButton()
  1863. +{
  1864. + _signal_font_set.disconnect();
  1865. +}
  1866. +
  1867. +RegisteredFontButton::RegisteredFontButton ( const Glib::ustring& label, const Glib::ustring& tip,
  1868. + const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in,
  1869. + SPDocument* doc_in )
  1870. + : RegisteredWidget<FontButton>(label, tip)
  1871. +{
  1872. + init_parent(key, wr, repr_in, doc_in);
  1873. + _signal_font_set = signal_font_value_changed().connect (sigc::mem_fun (*this, &RegisteredFontButton::on_value_changed));
  1874. +}
  1875. +
  1876. +void
  1877. +RegisteredFontButton::setValue (Glib::ustring fontspec)
  1878. +{
  1879. + FontButton::setValue(fontspec);
  1880. +}
  1881. +
  1882. +void
  1883. +RegisteredFontButton::on_value_changed()
  1884. +{
  1885. +
  1886. + if (_wr->isUpdating())
  1887. + return;
  1888. +
  1889. + _wr->setUpdating (true);
  1890. +
  1891. + Inkscape::SVGOStringStream os;
  1892. + os << getValue();
  1893. +
  1894. + write_to_xml(os.str().c_str());
  1895. +
  1896. + _wr->setUpdating (false);
  1897. +}
  1898. +
  1899. } // namespace Dialog
  1900. } // namespace UI
  1901. } // namespace Inkscape
  1902. === modified file 'src/ui/widget/registered-widget.h'
  1903. --- src/ui/widget/registered-widget.h 2016-07-24 15:05:29 +0000
  1904. +++ src/ui/widget/registered-widget.h 2016-07-29 22:45:14 +0000
  1905. @@ -22,6 +22,7 @@
  1906. #include "ui/widget/text.h"
  1907. #include "ui/widget/random.h"
  1908. #include "ui/widget/unit-menu.h"
  1909. +#include "ui/widget/font-button.h"
  1910. #include "ui/widget/color-picker.h"
  1911. #include "inkscape.h"
  1912. @@ -77,6 +78,8 @@
  1913. RegisteredWidget( A& a, B& b, C c, D d ): W( a, b, c, d ) { construct(); }
  1914. template< typename A, typename B, typename C, typename D, typename E , typename F>
  1915. RegisteredWidget( A& a, B& b, C c, D& d, E& e, F* f): W( a, b, c, d, e, f) { construct(); }
  1916. + template< typename A, typename B, typename C, typename D, typename E , typename F, typename G>
  1917. + RegisteredWidget( A& a, B& b, C& c, D& d, E& e, F f, G& g): W( a, b, c, d, e, f, g) { construct(); }
  1918. virtual ~RegisteredWidget() {};
  1919. @@ -418,6 +421,23 @@
  1920. void on_value_changed();
  1921. };
  1922. +class RegisteredFontButton : public RegisteredWidget<FontButton> {
  1923. +public:
  1924. + virtual ~RegisteredFontButton();
  1925. + RegisteredFontButton ( const Glib::ustring& label,
  1926. + const Glib::ustring& tip,
  1927. + const Glib::ustring& key,
  1928. + Registry& wr,
  1929. + Inkscape::XML::Node* repr_in = NULL,
  1930. + SPDocument *doc_in = NULL);
  1931. +
  1932. + void setValue (Glib::ustring fontspec);
  1933. +
  1934. +protected:
  1935. + sigc::connection _signal_font_set;
  1936. + void on_value_changed();
  1937. +};
  1938. +
  1939. } // namespace Widget
  1940. } // namespace UI
  1941. } // namespace Inkscape
  1942. === modified file 'src/ui/widget/scalar.cpp'
  1943. --- src/ui/widget/scalar.cpp 2014-03-27 01:33:44 +0000
  1944. +++ src/ui/widget/scalar.cpp 2016-07-30 15:23:12 +0000
  1945. @@ -126,10 +126,12 @@
  1946. static_cast<SpinButton*>(_widget)->set_range(min, max);
  1947. }
  1948. -void Scalar::setValue(double value)
  1949. +void Scalar::setValue(double value, bool setProg)
  1950. {
  1951. g_assert(_widget != NULL);
  1952. - setProgrammatically = true; // callback is supposed to reset back, if it cares
  1953. + if (setProg) {
  1954. + setProgrammatically = true; // callback is supposed to reset back, if it cares
  1955. + }
  1956. static_cast<SpinButton*>(_widget)->set_value(value);
  1957. }
  1958. === modified file 'src/ui/widget/scalar.h'
  1959. --- src/ui/widget/scalar.h 2012-04-30 22:04:12 +0000
  1960. +++ src/ui/widget/scalar.h 2016-07-30 15:23:27 +0000
  1961. @@ -139,7 +139,7 @@
  1962. /**
  1963. * Sets the value of the spin button.
  1964. */
  1965. - void setValue(double value);
  1966. + void setValue(double value, bool setProg = true);
  1967. /**
  1968. * Manually forces an update of the spin button.
  1969. === modified file 'src/widgets/font-selector.cpp'
  1970. --- src/widgets/font-selector.cpp 2016-07-28 11:26:17 +0000
  1971. +++ src/widgets/font-selector.cpp 2016-07-22 19:59:31 +0000
  1972. @@ -19,9 +19,6 @@
  1973. # include "config.h"
  1974. #endif
  1975. -#include <libnrtype/font-lister.h>
  1976. -#include <libnrtype/font-instance.h>
  1977. -
  1978. #include <2geom/transforms.h>
  1979. #include <gtk/gtk.h>
  1980. @@ -34,29 +31,7 @@
  1981. /* SPFontSelector */
  1982. -struct SPFontSelector
  1983. -{
  1984. -#if GTK_CHECK_VERSION(3,0,0)
  1985. - GtkBox hbox;
  1986. -#else
  1987. - GtkHBox hbox;
  1988. -#endif
  1989. -
  1990. - unsigned int block_emit : 1;
  1991. -
  1992. - GtkWidget *family;
  1993. - GtkWidget *style;
  1994. - GtkWidget *size;
  1995. -
  1996. - GtkWidget *family_treeview;
  1997. - GtkWidget *style_treeview;
  1998. -
  1999. - NRNameList families;
  2000. - NRStyleList styles;
  2001. - gfloat fontsize;
  2002. - bool fontsize_dirty;
  2003. - Glib::ustring *fontspec;
  2004. -};
  2005. +
  2006. struct SPFontSelectorClass
  2007. @@ -274,6 +249,7 @@
  2008. if (fsel->fontspec) {
  2009. delete fsel->fontspec;
  2010. + fsel->fontspec = 0;
  2011. }
  2012. if (fsel->families.length > 0) {
  2013. === modified file 'src/widgets/font-selector.h'
  2014. --- src/widgets/font-selector.h 2014-08-18 20:19:55 +0000
  2015. +++ src/widgets/font-selector.h 2016-07-22 19:59:29 +0000
  2016. @@ -15,10 +15,33 @@
  2017. *
  2018. * Released under GNU GPL, read the file 'COPYING' for more information
  2019. */
  2020. -
  2021. +#include <libnrtype/font-lister.h>
  2022. +#include <libnrtype/font-instance.h>
  2023. #include <glib.h>
  2024. -struct SPFontSelector;
  2025. +struct SPFontSelector
  2026. +{
  2027. +#if GTK_CHECK_VERSION(3,0,0)
  2028. + GtkBox hbox;
  2029. +#else
  2030. + GtkHBox hbox;
  2031. +#endif
  2032. +
  2033. + unsigned int block_emit : 1;
  2034. +
  2035. + GtkWidget *family;
  2036. + GtkWidget *style;
  2037. + GtkWidget *size;
  2038. +
  2039. + GtkWidget *family_treeview;
  2040. + GtkWidget *style_treeview;
  2041. +
  2042. + NRNameList families;
  2043. + NRStyleList styles;
  2044. + gfloat fontsize;
  2045. + bool fontsize_dirty;
  2046. + Glib::ustring *fontspec;
  2047. +};
  2048. #define SP_TYPE_FONT_SELECTOR (sp_font_selector_get_type ())
  2049. #define SP_FONT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_FONT_SELECTOR, SPFontSelector))
  1. More ...
 
 

101

 

832

Measure LIne LPE DIFF V.1507

-

PasteBin

Lignes
2185
Mots
7012
Taille
77,7 Kio
Créé le
Type
text/plain
General Public License v2 (GPLv2)
Connectez-vous pour ajouter un commentaire !