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

101

 

859

Measure LIne LPE DIFF V.15033

-

PasteBin

Lignes
2161
Mots
6863
Taille
76,4 Kio
Créé le
Type
text/plain
General Public License v2 (GPLv2)
Connectez-vous pour ajouter un commentaire !