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

106

 

1111

Measur Line r.15035

-

PasteBin

Lines
2184
Words
6980
Size
77,6 KB
Created
Typ
text/plain
General Public License v2 (GPLv2)
Please log in to leave a comment!