19#include <glibmm/i18n.h>
21#include <gtkmm/notebook.h>
28#include <pangomm/fontdescription.h>
61namespace LivePathEffect {
73 unit(_(
"Unit"), _(
"Unit of measurement"),
"unit", &wr, this,
"mm"),
74 orientation(_(
"Orientation"), _(
"Orientation of the line and labels"),
"orientation",
OMConverter, &wr, this,
OM_PARALLEL, false),
75 coloropacity(_(
"Color and opacity"), _(
"Set color and opacity of the dimensions"),
"coloropacity", &wr, this, Colors::
Color(0x000000ff)),
76 fontbutton(_(
"Font"), _(
"Select font for labels"),
"fontbutton", &wr, this),
77 precision(_(
"Precision"), _(
"Number of digits after the decimal point"),
"precision", &wr, this, 2),
78 fix_overlaps(_(
"Merge overlaps °"), _(
"Minimum angle at which overlapping dimension lines are merged into one, use 180° to disable merging"),
"fix_overlaps", &wr, this, 0),
79 position(_(
"Position"), _(
"Distance of dimension line from the path"),
"position", &wr, this, 5),
80 text_top_bottom(_(
"Label position"), _(
"Distance of the labels from the dimension line"),
"text_top_bottom", &wr, this, 0),
81 helpline_distance(_(
"Help line distance"), _(
"Distance of the perpendicular lines from the path"),
"helpline_distance", &wr, this, 0.0),
82 helpline_overlap(_(
"Help line elongation"), _(
"Distance of the perpendicular lines' ends from the dimension line"),
"helpline_overlap", &wr, this, 2.0),
83 line_width(_(
"Line width"), _(
"Dimension line width in mm. DIN standard: 0.25 or 0.35 mm"),
"line_width", &wr, this, 0.25),
84 scale(_(
"Scale"), _(
"Scaling factor"),
"scale", &wr, this, 1.0),
87 format(_(
"Label format"), _(
"Label text format, available variables: {measure}, {unit}"),
"format", &wr, this,
"{measure}{unit}"),
88 blacklist(_(
"Blacklist segments"), _(
"Comma-separated list of indices of segments that should not be measured. You can use another LPE with different parameters to measure these."),
"blacklist", &wr, this,
""),
89 whitelist(_(
"Invert blacklist"), _(
"Use the blacklist as whitelist"),
"whitelist", &wr, this, false),
90 showindex(_(
"Show segment index"), _(
"Display the index of the segments in the text label for easier blacklisting"),
"showindex", &wr, this, false),
91 arrows_outside(_(
"Arrows outside"), _(
"Draw arrows pointing in the opposite direction outside the dimension line"),
"arrows_outside", &wr, this, false),
92 flip_side(_(
"Flip side"), _(
"Draw dimension lines and labels on the other side of the path"),
"flip_side", &wr, this, false),
93 scale_sensitive(_(
"Scale sensitive"), _(
"When the path is grouped and the group is then scaled, adjust the dimensions."),
"scale_sensitive", &wr, this, true),
94 local_locale(_(
"Localize number format"), _(
"Use localized number formatting, e.g. '1,0' instead of '1.0' with German locale"),
"local_locale", &wr, this, true),
95 rotate_anotation(_(
"Rotate labels"), _(
"Labels are parallel to the dimension line"),
"rotate_anotation", &wr, this, true),
96 hide_back(_(
"Hide line under label"), _(
"Hide the dimension line where the label overlaps it"),
"hide_back", &wr, this, true),
97 hide_arrows(_(
"Hide arrows"), _(
"Don't show any arrows"),
"hide_arrows", &wr, this, false),
99 smallx100(_(
"Multiply values < 1"), _(
"Multiply values smaller than 1 by 100 and leave out the unit"),
"smallx100", &wr, this, false),
100 linked_items(_(
"Linked objects:"), _(
"Objects whose nodes are projected onto the path and generate new measurements"),
"linked_items", &wr, this, true),
101 distance_projection(_(
"Distance"), _(
"Distance of the dimension lines from the outermost node (mm)"),
"distance_projection", &wr, this, 20.0),
102 angle_projection(_(
"Angle of projection"), _(
"Angle of projection in 90° steps"),
"angle_projection", &wr, this, 0.0),
103 active_projection(_(
"Activate projection"), _(
"Activate projection mode"),
"active_projection", &wr, this, false),
104 avoid_overlapping(_(
"Avoid label overlap"), _(
"Rotate labels if the segment is shorter than the label"),
"avoid_overlapping", &wr, this, true),
105 onbbox(_(
"Measure bounding box"), _(
"Add measurements for the geometrical bounding box"),
"onbbox", &wr, this, false),
106 bboxonly(_(
"Only bounding box"), _(
"Measure only the geometrical bounding box"),
"bboxonly", &wr, this, false),
107 centers(_(
"Add object center"), _(
"Add the projected object center"),
"centers", &wr, this, false),
108 maxmin(_(
"Only max and min"), _(
"Compute only max/min projection values"),
"maxmin", &wr, this, false),
109 helpdata(_(
"Help"), _(
"Measure segments help"),
"helpdata", &wr, this,
"",
"")
150 Glib::ustring format_value = prefs->
getString(
"/live_effects/measure-line/format");
151 if(format_value.empty()){
152 format_value =
"{measure}{unit}";
169 scale.
param_set_range(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
190 locale_base = strdup(setlocale(LC_NUMERIC,
nullptr));
202 auto const vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL);
204 auto const vbox0 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 2);
205 vbox0->set_margin(5);
207 auto const vbox1 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 2);
208 vbox1->set_margin(5);
210 auto const vbox2 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 2);
211 vbox2->set_margin(5);
214 auto const vbox3 = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 2);
215 vbox3->set_margin(5);
217 std::vector<Parameter *>::iterator it =
param_vector.begin();
219 if ((*it)->widget_is_visible) {
224 if ( param->
param_key ==
"linked_items") {
226 }
else if (param->
param_key ==
"active_projection" ||
227 param->
param_key ==
"distance_projection" ||
228 param->
param_key ==
"angle_projection" ||
235 }
else if (param->
param_key ==
"precision" ||
246 }
else if (param->
param_key ==
"helpdata") {
253 widg->set_tooltip_markup(*tip);
255 widg->set_tooltip_text(
"");
256 widg->set_has_tooltip(
false);
264 auto const notebook = Gtk::make_managed<Gtk::Notebook>();
265 notebook->append_page (*vbox0, Glib::ustring(_(
"General")));
266 notebook->append_page (*vbox1, Glib::ustring(_(
"Projection")));
267 notebook->append_page (*vbox2, Glib::ustring(_(
"Options")));
268 notebook->append_page (*vbox3, Glib::ustring(_(
"Help")));
278 if(!
page->get_parent()->in_destruction()) {
315 Glib::ustring classarrow = itemid;
317 classarrow += lpobjid;
318 classarrow +=
" measure-arrow-marker";
328 if (std::strcmp(
mode.c_str(),
"ArrowDIN-start") == 0) {
329 arrow_path->
setAttribute(
"d",
"M -8,0 8,-2.11 8,2.11 z");
330 }
else if (std::strcmp(
mode.c_str(),
"ArrowDIN-end") == 0) {
331 arrow_path->
setAttribute(
"d",
"M 8,0 -8,2.11 -8,-2.11 z");
332 }
else if (std::strcmp(
mode.c_str(),
"ArrowDINout-start") == 0) {
333 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");
335 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");
337 Glib::ustring classarrowpath = itemid;
338 classarrowpath +=
" ";
339 classarrowpath += lpobjid;
340 classarrowpath +=
" measure-arrow";
342 Glib::ustring arrowpath =
mode + Glib::ustring(
"_path");
345 arrow->
addChild(arrow_path,
nullptr);
364 Glib::ustring
id = Glib::ustring(
"text-on-");
383 Glib::ustring classlabel = itemid;
385 classlabel += lpobjid;
386 classlabel +=
" measure-label";
392 Glib::ustring classlabel = itemid;
394 classlabel += lpobjid;
395 classlabel +=
" measure-label";
417 std::stringstream font_size;
418 setlocale (LC_NUMERIC,
"C");
438 setlocale (LC_NUMERIC,
"");
440 setlocale (LC_NUMERIC,
"C");
442 gchar length_str[64];
454 size_t s = label_value.find(Glib::ustring(
"{measure}"),0);
455 if(s < label_value.length()) {
456 label_value.replace(s, 9, length_str);
459 s = label_value.find(Glib::ustring(
"{unit}"),0);
460 if(s < label_value.length()) {
462 label_value.replace(s, 6,
"");
472 label_value = Glib::ustring(_(
"Non Uniform Scale"));
476 auto text = cast<SPText>(elemref);
478 text->rebuildLayout();
487 std::string transform;
490 angle = std::fmod(angle, 2*M_PI);
491 if (angle < 0) angle += 2*M_PI;
492 if (angle >= rad_from_deg(90) && angle < rad_from_deg(270)) {
493 angle = std::fmod(angle + rad_from_deg(180), 2*M_PI);
494 if (angle < 0) angle += 2*M_PI;
512 Glib::ustring
id =
name;
540 line_path.
start(
end + Point::polar(angle, k));
556 Glib::ustring classlinedim = itemid;
558 classlinedim += lpobjid;
559 classlinedim +=
" measure-DIM-line measure-line";
562 Glib::ustring classlinehelper = itemid;
563 classlinehelper +=
" ";
564 classlinehelper += lpobjid;
565 classlinehelper +=
" measure-helper-line measure-line";
576 style =
"display:none;";
582 style +=
"marker-start:url(#ArrowDINout-start);marker-end:url(#ArrowDINout-end);";
584 style +=
"marker-start:url(#ArrowDIN-start);marker-end:url(#ArrowDIN-end);";
590 std::stringstream stroke_w;
591 setlocale (LC_NUMERIC,
"C");
598 stroke_w << stroke_width;
600 style +=
"stroke-width:";
601 style += stroke_w.str();
619 if (!is<SPShape>(lpeitem)) {
620 g_warning(
"LPE measure line can only be applied to shapes (not groups).");
622 item->removeCurrentPathEffect(
false);
630 for (
unsigned i = 0; i <
root->childCount(); ++i) {
631 if (Glib::ustring(
root->nthChild(i)->name()) ==
"svg:style") {
633 for (
unsigned j = 0; j < styleNode->
childCount(); ++j) {
638 if (textNode ==
nullptr) {
640 std::cerr <<
"LPEMeasureSegments::doOnApply(): No text node!" << std::endl;
648 if (styleNode ==
nullptr) {
659 Glib::ustring styleContent = Glib::ustring(textNode->
content());
660 if (styleContent.find(
".measure-arrow\n{\n") == std::string::npos) {
661 styleContent = styleContent + Glib::ustring(
"\n.measure-arrow") + Glib::ustring(
"\n{\n}");
662 styleContent = styleContent + Glib::ustring(
"\n.measure-label") + Glib::ustring(
"\n{\n\n}");
663 styleContent = styleContent + Glib::ustring(
"\n.measure-line") + Glib::ustring(
"\n{\n}");
674 size_t s = listsegments.find(std::to_string(i) + std::string(
","), 0);
675 if (s != std::string::npos) {
695 bool ccw_toggle =
cross(p1 - p2, p3 - p2) < 0;
697 if (Geom::deg_from_rad(angle) < fix_overlaps ||
698 Geom::deg_from_rad(angle) > 180 ||
699 ((ccw_toggle && flip_side) || (!ccw_toggle && !flip_side)))
709 std::vector< Point >
result;
710 for (
auto &
node : nodes) {
712 result.push_back(point * transform);
720 std::vector< Point > current_nodes;
728 std::vector<SPItem*>
const item_list = group->
item_list();
729 for (
auto sub_item : item_list) {
730 std::vector< Point > nodes =
transformNodes(
getNodes(sub_item, sub_item->transform, onbbox, centers, bboxonly, angle_projection), transform);
731 current_nodes.insert(current_nodes.end(), nodes.begin(), nodes.end());
733 }
else if (shape && !bboxonly) {
736 current_nodes =
transformNodes(
c->get_pathvector().nodes(), transform);
738 }
else if ((text || flowtext) && !bboxonly) {
743 if (iter == iter_next) {
749 if (
curve.is_empty()) {
752 std::vector< Point > letter_nodes =
transformNodes(
curve.get_pathvector().nodes(), transform);
753 current_nodes.insert(current_nodes.end(),letter_nodes.begin(),letter_nodes.end());
761 if (onbbox || centers) {
763 if (bbox && onbbox) {
764 current_nodes.push_back((*bbox).corner(0) * transform);
765 current_nodes.push_back((*bbox).corner(2) * transform);
771 current_nodes.push_back((*bbox).corner(1) * transform);
772 current_nodes.push_back((*bbox).corner(3) * transform);
776 if (bbox && centers) {
777 current_nodes.push_back((*bbox).midpoint() * transform);
780 return current_nodes;
785 Glib::ustring
id = Glib::ustring(prefix);
793 dest = *
curve->first_point();
818 auto msg = Glib::ustring(_(
"<b><big>General</big></b>\n"
819 "Display and position dimension lines and labels\n\n"
820 "<b><big>Projection</big></b>\n"
821 "Show a line with measurements based on the selected items\n\n"
822 "<b><big>Options</big></b>\n"
823 "Options for color, precision, label formatting and display\n\n"
824 "<b><big>Tips</big></b>\n"
825 "<b><i>Custom styling:</i></b> To further customize the styles, "
826 "use the XML editor to find out the class or ID, then use the "
827 "Style dialog to apply a new style.\n"
828 "<b><i>Blacklists:</i></b> allow to hide some segments or projection steps.\n"
829 "<b><i>Multiple Measure LPEs:</i></b> In the same object, in conjunction with blacklists,"
830 "this allows for labels and measurements with different orientations or additional projections.\n"
831 "<b><i>Set Defaults:</i></b> For every LPE, default values can be set at the bottom."));
836 msg = Glib::ustring(_(
"<b><big>IMPORTANT</big></b>\n"
837 "This LPE was added in an older version.\n"
838 "The LPE will be kept, but we recommend you remove and re-add it for better results.\n")) +
msg;
856 if (lpereference && lpereference.get()->isAttached() && lpereference.get()->getObject() !=
nullptr) {
867 bool fontsizechanged =
false;
873 std::vector< Point > nodes;
884 nodes.insert(nodes.end(),current_nodes.begin(), current_nodes.end());
891 for (
auto & iter : satellites) {
893 if (iter && iter->isAttached() && iter->getActive() && (obj = iter->getObject()) && is<SPItem>(obj)) {
894 auto item = cast<SPItem>(obj);
902 nodes.insert(nodes.end(),current_nodes.begin(), current_nodes.end());
907 double maxdistance = -std::numeric_limits<double>::max();
908 std::vector<double>
result;
909 for (
auto &
node : nodes) {
911 if (point[
Geom::X] > maxdistance) {
926 bool started =
false;
928 for (
auto & iter :
result) {
955 auto shape = cast<SPShape>(splpeitem);
958 bool colorchanged =
false;
959 if (opacity !=
color) {
963 bool unitchanged =
false;
970 Pango::FontDescription fontdesc(fontdesc_ustring);
971 double newfontsize = fontdesc.get_size() / (double)Pango::SCALE;
978 fontsizechanged =
true;
988 pathvector *= affinetransform;
991 if (format_str.empty()) {
996 double start_angle_cross = 0;
997 double end_angle_cross = 0;
999 bool previous_fix_overlaps =
true;
1000 for (
size_t i = 0; i < pathvector.
size(); i++) {
1001 size_t count = pathvector[i].size_default();
1002 if (!pathvector[i].empty() && pathvector[i].closed()) {
1003 const Geom::Curve &closingline = pathvector[i].back_closed();
1005 count = pathvector[i].size_open();
1008 for (
size_t j = 0; j < count; j++) {
1012 if (j == 0 && pathvector[i].closed()) {
1013 prev = pathvector.
pointAt(pathvector[i].
size() - 1);
1014 }
else if (j != 0) {
1015 prev = pathvector[i].
pointAt(j - 1);
1020 if (pathvector[i].closed() && pathvector[i].
size() == j+1){
1022 next = pathvector[i].
pointAt(1);
1023 }
else if (pathvector[i].
size() > j + 1) {
1024 next = pathvector[i].
pointAt(j+2);
1027 std::string listsegments(blacklist_str.raw() +
",");
1028 listsegments.erase(std::remove(listsegments.begin(), listsegments.end(),
' '), listsegments.end());
1034 Glib::ustring infoline_on_start =
"infoline-on-start-";
1036 infoline_on_start +=
"-";
1037 infoline_on_start += lpobjid;
1039 Glib::ustring infoline_on_end =
"infoline-on-end-";
1041 infoline_on_end +=
"-";
1042 infoline_on_end += lpobjid;
1044 Glib::ustring infoline =
"infoline-";
1047 infoline += lpobjid;
1049 Glib::ustring texton =
"text-on-";
1053 items.push_back(infoline_on_start);
1054 items.push_back(infoline_on_end);
1055 items.push_back(infoline);
1056 items.push_back(texton);
1059 items.emplace_back(
"ArrowDINout-start");
1060 items.emplace_back(
"ArrowDINout-end");
1062 items.emplace_back(
"ArrowDIN-start");
1063 items.emplace_back(
"ArrowDIN-end");
1067 fix_overlaps_degree == 180) &&
1069 !this->
refresh_widgets && !colorchanged && !unitchanged && !fontsizechanged &&
1085 std::swap(hstart,hend);
1099 std::swap(hstart,hend);
1105 }
else if (fix_overlaps_degree != 180) {
1108 start_angle_cross = 0;
1112 end_angle_cross = 0;
1118 createLine(pos, pos, Glib::ustring(
"infoline-on-start-"),
counter,
true,
true,
true);
1119 createLine(pos, pos, Glib::ustring(
"infoline-on-end-"),
counter,
true,
true,
true);
1126 angle = std::fmod(angle + rad_from_deg(180), 2*M_PI);
1127 if (angle < 0) angle += 2*M_PI;
1129 Geom::Coord angle_cross = std::fmod(angle + rad_from_deg(90), 2*M_PI);
1130 if (angle_cross < 0) angle_cross += 2*M_PI;
1131 angle = std::fmod(angle, 2*M_PI);
1132 if (angle < 0) angle += 2*M_PI;
1133 double turn = Geom::rad_from_deg(-90);
1135 end_angle_cross *= -1;
1136 start_angle_cross *= -1;
1139 double position_turned_start =
position /
sin(start_angle_cross/2.0);
1141 if (fix_overlaps_degree != 180 &&
1142 start_angle_cross != 0 &&
1143 position_turned_start <
length &&
1144 previous_fix_overlaps)
1146 hstart = hstart - Point::polar(angle_cross - (start_angle_cross/2.0) - turn, position_turned_start);
1148 hstart = hstart - Point::polar(angle_cross,
position);
1151 double position_turned_end =
position /
sin(end_angle_cross/2.0);
1153 if (fix_overlaps_degree != 180 &&
1154 end_angle_cross != 0 &&
1155 position_turned_end <
length &&
1156 position_turned_end < endlength)
1158 hend = hend - Point::polar(angle_cross + (end_angle_cross/2.0) + turn, position_turned_end);
1159 previous_fix_overlaps =
true;
1161 hend = hend - Point::polar(angle_cross,
position);
1162 previous_fix_overlaps =
false;
1175 if (angle >= rad_from_deg(90) && angle < rad_from_deg(270)) {
1180 double parents_scale = (parentaffinetransform.
expansionX() + parentaffinetransform.
expansionY()) / 2.0;
1187 angle += Geom::rad_from_deg(90);
1189 pos = pos - Point::polar(angle_cross,
position);
1210 hstart = hstart + Point::polar(angle,
arrow_gap);
1211 hend = hend - Point::polar(angle,
arrow_gap );
1214 createLine(hstart, hend, Glib::ustring(
"infoline-"),
counter,
true,
false,
true);
1216 createLine(hstart, hend, Glib::ustring(
"infoline-"),
counter,
true,
true,
true);
1221 createLine(pos, pos, Glib::ustring(
"infoline-on-start-"),
counter,
true,
true,
true);
1222 createLine(pos, pos, Glib::ustring(
"infoline-on-end-"),
counter,
true,
true,
true);
1231 createLine(pos, pos, Glib::ustring(
"infoline-on-start-"),
counter,
true,
true,
true);
1232 createLine(pos, pos, Glib::ustring(
"infoline-on-end-"),
counter,
true,
true,
true);
1276 for (
auto id :
items) {
1280 auto item = cast<SPItem>(elemref);
1282 Glib::ustring css_str;
1283 switch (lpe_action){
1308 css->removeAttribute(
"display");
Cartesian point / 2D vector and related operations.
3x3 affine transformation matrix.
Various trigoniometric helper functions.
3x3 matrix representing an affine transformation.
bool preservesAngles(Coord eps=EPSILON) const
Check whether the transformation preserves angles between lines.
Coord expansionX() const
Calculates the amount of x-scaling imparted by the Affine.
Affine inverse() const
Compute the inverse matrix.
Coord expansionY() const
Calculates the amount of y-scaling imparted by the Affine.
Abstract continuous curve on a plane defined on [0,1].
virtual Point initialPoint() const =0
Retrieve the start of the curve.
virtual Point finalPoint() const =0
Retrieve the end of the curve.
C width() const
Get the horizontal extent of the rectangle.
Axis-aligned rectangle that can be empty.
size_type size() const
Get the number of paths in the vector.
void push_back(Path const &path)
Append a path at the end.
Point pointAt(Coord t) const
void clear()
Remove all paths from the vector.
size_type curveCount() const
Get the total number of curves in the vector.
Sequence of contiguous curves, aka spline.
void clear()
Remove all curves from the path.
void setInitial(Point const &p)
void appendNew(Args &&... args)
Append a new curve to the path.
void start(Point const &p)
Two-dimensional point that doubles as a vector.
Straight ray from a specific point to infinity.
Rotation around the origin.
Translate inverse() const
Get the inverse translation.
std::string toString(bool opacity=true) const
Format the color as a css string and return it.
double getOpacity() const
Get the opacity in this color, if it's stored.
RAII-style mechanism for creating a temporary undo-insensitive context.
This class enumerates fonts using libnrtype into reusable data stores and allows for random access to...
void fill_css(SPCSSAttr *css, Glib::ustring fontspec={})
Fill css using given fontspec (doesn't need to be member function).
static Inkscape::FontLister * get_instance()
std::vector< StorageType > const & data() const
std::optional< Colors::Color > get_value() const
std::vector< Parameter * > param_vector
void registerParameter(Parameter *param)
friend class LPEMeasureSegments
LivePathEffectObject * lpeobj
bool isOnClipboard()
The lpe is on clipboard.
LivePathEffectObject * getLPEObj()
void param_setValue(Glib::ustring newvalue, bool write=false)
Glib::ustring param_getSVGValue() const override
ScalarParam helpline_overlap
EnumParam< OrientationMethod > orientation
ScalarParam helpline_distance
void on_my_switch_page(Gtk::Widget *page, guint page_number)
bool isWhitelist(size_t i, std::string listsegments, bool whitelist)
BoolParam rotate_anotation
void createArrowMarker(Glib::ustring mode)
std::vector< Glib::ustring > items
bool prev_active_projection
void processObjects(LPEAction lpe_action) override
BoolParam avoid_overlapping
void doBeforeEffect(SPLPEItem const *lpeitem) override
Is performed each time before the effect is updated.
void createTextLabel(Geom::Point &pos, size_t counter, double length, Geom::Coord angle, bool remove, bool valid)
void doOnRemove(SPLPEItem const *) override
FontButtonParam fontbutton
BoolParam active_projection
BoolParam scale_sensitive
ColorPickerParam coloropacity
void doOnVisibilityToggled(SPLPEItem const *) override
ScalarParam distance_projection
void doOnApply(SPLPEItem const *lpeitem) override
Is performed a single time when the effect is freshly applied to a path.
ScalarParam angle_projection
gchar const * locale_base
void createLine(Geom::Point start, Geom::Point end, Glib::ustring name, size_t counter, bool main, bool remove, bool arrows=false)
size_t prevsatellitecount
SatelliteArrayParam linked_items
ScalarParam text_top_bottom
bool doOnOpen(SPLPEItem const *lpeitem) override
Is performed on load document or revert If the item is fixed legacy return true.
Gtk::Widget * newWidget() override
This creates a managed widget.
void param_update_default(const gchar *default_value) override
Glib::ustring const * param_getTooltip() const
void connect_selection_changed()
virtual Gtk::Widget * param_newWidget()=0
void param_set_digits(unsigned digits)
void param_set_range(double min, double max)
void param_set_increments(double step, double page)
void param_make_integer(bool yes=true)
void param_hide_canvas_text()
void param_setValue(Glib::ustring newvalue)
void param_update_default(const gchar *default_value) override
Glib::ustring param_getSVGValue() const override
const gchar * get_abbreviation() const
Preference storage class.
Glib::ustring getString(Glib::ustring const &pref_path, Glib::ustring const &def="")
Retrieve an UTF-8 string.
static Preferences * get()
Access the singleton Preferences object.
Holds a position within the glyph output of Layout.
SPCurve convertToCurves(iterator const &from_glyph, iterator const &to_glyph) const
Convert the specified range of characters into their bezier outlines.
iterator begin() const
Returns an iterator pointing at the first glyph of the flowed output.
Simplified management of enumerations of svg items with UI labels.
static double convert(double from_dist, Unit const *from, Unit const *to)
Convert distances.
Interface for refcounted XML nodes.
virtual void addChild(Node *child, Node *after)=0
Insert another node as a child of this node.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual Node * nthChild(unsigned index)=0
Get the child of this node with a given index.
virtual Node * firstChild()=0
Get the first child of this node.
virtual void setContent(char const *value)=0
Set the content of a text or comment node.
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
void removeAttribute(Inkscape::Util::const_char_ptr key)
Remove an attribute of this node.
virtual char const * content() const =0
Get the content of a text or comment node.
virtual unsigned childCount() const =0
Get the number of children of this node.
virtual NodeType type() const =0
Get the type of the node.
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
Wrapper around a Geom::PathVector object.
Typed SVG document implementation.
SPRoot * getRoot()
Returns our SPRoot.
SPObject * getObjectById(std::string const &id) const
Inkscape::XML::Node * getReprRoot()
SPDefs * getDefs()
Return the main defs object for the document.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Geom::Scale getDocumentScale(bool computed=true) const
Returns document scale as defined by width/height (in pixels) and viewBox (real world to user-units).
Inkscape::Util::Unit const * getDisplayUnit()
guaranteed not to return nullptr
std::vector< SPItem * > item_list()
Base class for visual SVG elements.
void moveTo(SPItem *target, bool intoafter)
Move this SPItem into or after another SPItem in the doc.
Geom::OptRect geometricBounds(Geom::Affine const &transform=Geom::identity()) const
Get item's geometric bounding box in this item's coordinate system.
void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv=nullptr, bool compensate=true)
Set a new transform on an object.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
char const * getId() const
Returns the objects current ID string.
void deleteObject(bool propagate, bool propagate_descendants)
Deletes an object, unparenting it from its parent.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
SPObject * appendChildRepr(Inkscape::XML::Node *repr)
Append repr as child of this object.
Base class for shapes, including <path> element.
SPCurve const * curve() const
Return a borrowed pointer to the curve (if any exists) or NULL if there is no curve.
std::shared_ptr< Css const > css
TODO: insert short description here.
constexpr Coord infinity()
Get a value representing infinity.
double Coord
Floating point type used to store coordinates.
Geom::PathVector pathv_to_linear_and_cubic_beziers(Geom::PathVector const &pathv)
Specific geometry functions for Inkscape, not provided my lib2geom.
Inkscape::XML::Node * node
Various utility functions.
Coord length(LineSegment const &seg)
SBasisN< n > inverse(SBasisN< n > a, int k)
Angle distance(Angle const &a, Angle const &b)
double angle_between(Line const &l1, Line const &l2)
Piecewise< SBasis > cross(Piecewise< D2< SBasis > > const &a, Piecewise< D2< SBasis > > const &b)
SBasisN< n > sin(LinearN< n > bo, int k)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
Point middle_point(LineSegment const &_segment)
static R & release(R &r)
Decrements the reference count of a anchored object.
std::vector< Point > getNodes(SPItem *item, Geom::Affine transform, bool onbbox, bool centers, bool bboxonly, double angle_projection)
static const Util::EnumDataConverter< OrientationMethod > OMConverter(OrientationMethodData, OM_END)
double getAngle(Geom::Point p1, Geom::Point p2, Geom::Point p3, bool flip_side, double fix_overlaps)
static void extractFirstPoint(Geom::Point &dest, const Glib::ustring &lpobjid, const char *const prefix, const gint idx, SPDocument *const document)
std::vector< Point > transformNodes(std::vector< Point > nodes, Geom::Affine transform)
static const Util::EnumData< OrientationMethod > OrientationMethodData[]
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
@ TEXT_NODE
Text node, e.g. "Some text" in <group>Some text</group> is represented by a text node.
Glib::ustring format_classic(T const &... args)
Helper class to stream background task notifications as a series of messages.
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.
Singleton class to access the preferences file in a convenient way.
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str)
Write a style attribute string from a list of properties stored in an SPCSAttr object.
void sp_repr_css_change(Node *repr, SPCSSAttr *css, gchar const *attr)
Creates a new SPCSAttr with the values filled from a repr, merges in properties from the given SPCSAt...
void sp_repr_css_set_property_double(SPCSSAttr *css, gchar const *name, double value)
Set a style property to a new float value (e.g.
void sp_repr_css_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
void sp_repr_css_set_property_string(SPCSSAttr *css, char const *name, std::string const &value)
Set a style property to a standard string.
void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name)
Set a style property to "inkscape:unset".
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
void sp_repr_css_attr_add_from_string(SPCSSAttr *css, gchar const *p)
Use libcroco to parse a string for CSS properties and then merge them into an existing SPCSSAttr.
void remove(std::vector< T > &vec, T const &val)
TODO: insert short description here.
SPCSSAttr - interface for CSS Attributes.
TODO: insert short description here.
Geom::Affine i2anc_affine(SPObject const *object, SPObject const *ancestor)
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
void sp_lpe_item_update_patheffect(SPLPEItem *lpeitem, bool wholetree, bool write, bool with_satellites)
Calls any registered handlers for the update_patheffect action.
void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable)
SPRoot: SVG <svg> implementation.
Simplified management of enumerations of svg items with UI labels.
Interface for XML documents.
virtual Node * createTextNode(char const *content)=0
virtual Node * createElement(char const *name)=0
std::string sp_svg_transform_write(Geom::Affine const &transform)
static void sp_svg_write_path(Inkscape::SVG::PathString &str, Geom::Path const &p, bool normalize=false)
TODO: insert short description here.
Inkscape::Text::Layout const * te_get_layout(SPItem const *item)