Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
registered-widget.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Authors:
4 * Johan Engelen <j.b.c.engelen@utwente.nl>
5 * bulia byak <buliabyak@users.sf.net>
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 * Lauris Kaplinski <lauris@kaplinski.com>
8 * Jon Phillips <jon@rejon.org>
9 * Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
10 * Abhishek Sharma
11 *
12 * Copyright (C) 2000 - 2007 Authors
13 *
14 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
15 */
16
17#include "registered-widget.h"
18
19#include <glibmm/i18n.h>
20#include <gtkmm/image.h>
21#include <gtkmm/label.h>
22#include <giomm/themedicon.h>
23
24#include "object/sp-root.h"
25#include "svg/stringstream.h"
26#include "util/safe-printf.h"
27
28namespace Inkscape::UI::Widget {
29
30/*#########################################
31 * Registered CHECKBUTTON
32 */
33
34RegisteredCheckButton::RegisteredCheckButton(Glib::ustring const &label, Glib::ustring const &tip,
35 Glib::ustring const &key, Registry &wr, bool right,
36 Inkscape::XML::Node * const repr_in, SPDocument * const doc_in,
37 char const * const active_str, char const * const inactive_str)
38 : RegisteredWidget<Gtk::CheckButton>()
39 , _active_str(active_str)
40 , _inactive_str(inactive_str)
41{
42 init_parent(key, wr, repr_in, doc_in);
43
44 setProgrammatically = false;
45
46 set_tooltip_text(tip);
47
48 auto const l = Gtk::make_managed<Gtk::Label>();
49 l->set_markup(label);
50 l->set_use_underline(true);
51 set_child(*l);
52
53 set_halign(right ? Gtk::Align::END : Gtk::Align::START);
54 set_valign(Gtk::Align::CENTER);
55}
56
57void
59{
61
62 set_active(b);
63
64 // The subordinate button is greyed out if the main button is unchecked
65 for (auto const subordinate: _subordinate_widgets) {
66 subordinate->set_sensitive(b);
67 }
68
69 setProgrammatically = false;
70}
71
72void
74{
76 setProgrammatically = false;
77 return;
78 }
79
80 if (_wr->isUpdating())
81 return;
82
83 _wr->setUpdating(true);
84
85 auto const active = get_active();
86
88
89 // The subordinate button is greyed out if the main button is unchecked
90 for (auto const subordinate: _subordinate_widgets) {
91 subordinate->set_sensitive(active);
92 }
93
94 _wr->setUpdating(false);
95}
96
97/*#########################################
98 * Registered TOGGLEBUTTON
99 */
100
102 Glib::ustring const &label,
103 Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, bool right,
104 Inkscape::XML::Node * const repr_in, SPDocument * const doc_in,
105 char const * const icon_active, char const * const icon_inactive)
106: RegisteredWidget<Gtk::ToggleButton>(label),
107 _on_icon(icon_active), _off_icon(icon_inactive)
108{
109 init_parent(key, wr, repr_in, doc_in);
110
111 setProgrammatically = false;
112
113 set_tooltip_text(tip);
114
115 set_halign(right ? Gtk::Align::END : Gtk::Align::START);
116 set_valign(Gtk::Align::CENTER);
117
118 if (!_on_icon.empty()) {
119 set_child(*Gtk::make_managed<Gtk::Image>(Gio::ThemedIcon::create(_on_icon)));
120 }
121
122 if (!_on_icon.empty() && !_off_icon.empty()) {
123 property_active().signal_changed().connect([this](){
124 set_child(*Gtk::make_managed<Gtk::Image>(Gio::ThemedIcon::create(get_active() ? _on_icon : _off_icon)));
125 });
126 }
127}
128
129void
131{
132 setProgrammatically = true;
133
134 set_active(b);
135
136 //The subordinate button is greyed out if the main button is untoggled
137 for (auto const subordinate: _subordinate_widgets) {
138 subordinate->set_sensitive(b);
139 }
140
141 setProgrammatically = false;
142}
143
144void
146{
148 setProgrammatically = false;
149 return;
150 }
151
152 if (_wr->isUpdating())
153 return;
154
155 _wr->setUpdating(true);
156
157 auto const active = get_active();
158 write_to_xml(active ? "true" : "false");
159
160 //The subordinate button is greyed out if the main button is untoggled
161 for (auto const subordinate: _subordinate_widgets) {
162 subordinate->set_sensitive(active);
163 }
164
165 _wr->setUpdating(false);
166}
167
168RegisteredSwitchButton::RegisteredSwitchButton(Glib::ustring const &label, Glib::ustring const &tip,
169 Glib::ustring const &key, Registry &wr, bool right,
170 Inkscape::XML::Node *repr_in, SPDocument *doc_in)
171: RegisteredWidget<Gtk::Switch>() {
172
173 init_parent(key, wr, repr_in, doc_in);
174
175 set_tooltip_text(tip);
176 add_css_class("small");
177 set_halign(right ? Gtk::Align::END : Gtk::Align::START);
178 set_valign(Gtk::Align::CENTER);
179
180 property_state().signal_changed().connect([this](){
182 setProgrammatically = false;
183 return;
184 }
185
186 if (_wr->isUpdating())
187 return;
188
189 _wr->setUpdating(true);
190
191 auto const active = get_active();
192 write_to_xml(active ? "true" : "false");
193
194 //The subordinate button is greyed out if the main button is untoggled
195 for (auto const subordinate: _subordinate_widgets) {
196 subordinate->set_sensitive(active);
197 }
198
199 _wr->setUpdating(false);
200 });
201}
202
203/*#########################################
204 * Registered UNITMENU
205 */
206
207RegisteredUnitMenu::RegisteredUnitMenu(Glib::ustring const &label, Glib::ustring const &key,
208 Registry &wr,
209 Inkscape::XML::Node * const repr_in, SPDocument * const doc_in)
210 : RegisteredWidget<Labelled>{label, Glib::ustring{} /*tooltip*/, new UnitMenu()}
211{
212 init_parent(key, wr, repr_in, doc_in);
213
214 getUnitMenu()->setUnitType(UNIT_TYPE_LINEAR);
215 if (doc_in) {
216 // select document's unit as a starting point, so registered scalars using this instance
217 // will have a chance to establish appropriate steps for their spin buttons, based on correct display unit
218 if (auto units = doc_in->getDisplayUnit()) {
219 getUnitMenu()->setUnit(units->abbr);
220 }
221 }
222 _changed_connection = getUnitMenu()->signal_changed().connect(sigc::mem_fun (*this, &RegisteredUnitMenu::on_changed));
223}
224
225void
227{
228 getUnitMenu()->setUnit(unit);
229}
230
231void
233{
234 if (_wr->isUpdating())
235 return;
236
238 os << getUnitMenu()->getUnitAbbr();
239
240 _wr->setUpdating(true);
241
242 write_to_xml(os.str().c_str());
243
244 _wr->setUpdating(false);
245}
246
247/*#########################################
248 * Registered SCALARUNIT
249 */
250
251RegisteredScalarUnit::RegisteredScalarUnit(Glib::ustring const &label, Glib::ustring const &tip,
252 Glib::ustring const &key,
254 Inkscape::XML::Node * const repr_in, SPDocument * const doc_in,
255 RSU_UserUnits const user_units)
256 : RegisteredWidget<ScalarUnit>(label, tip, UNIT_TYPE_LINEAR, Glib::ustring{}, rum.getUnitMenu()),
257 _um(nullptr)
258{
259 init_parent(key, wr, repr_in, doc_in);
260
261 setProgrammatically = false;
262
263 initScalar(-1e6, 1e6);
265 setDigits(2);
266 _um = rum.getUnitMenu();
267 _user_units = user_units;
269}
270
271void
273{
275 setProgrammatically = false;
276 return;
277 }
278
279 if (_wr->isUpdating())
280 return;
281
282 _wr->setUpdating(true);
283
285 if (_user_units != RSU_none) {
286 // Output length in 'user units', taking into account scale in 'x' or 'y'.
287 double scale = 1.0;
288 if (doc) {
289 SPRoot *root = doc->getRoot();
290 if (root->viewBox_set) {
291 // check to see if scaling is uniform
292 if(Geom::are_near((root->viewBox.width() * root->height.computed) / (root->width.computed * root->viewBox.height()), 1.0, Geom::EPSILON)) {
293 scale = (root->viewBox.width() / root->width.computed + root->viewBox.height() / root->height.computed)/2.0;
294 } else if (_user_units == RSU_x) {
295 scale = root->viewBox.width() / root->width.computed;
296 } else {
297 scale = root->viewBox.height() / root->height.computed;
298 }
299 }
300 }
301 os << getValue("px") * scale;
302 } else {
303 // Output using unit identifiers.
304 os << getValue("");
305 if (_um)
306 os << _um->getUnitAbbr();
307 }
308
309 write_to_xml(os.str().c_str());
310 _wr->setUpdating(false);
311}
312
313/*#########################################
314 * Registered SCALAR
315 */
316
317RegisteredScalar::RegisteredScalar(Glib::ustring const &label, Glib::ustring const &tip,
318 Glib::ustring const &key, Registry &wr,
319 Inkscape::XML::Node * const repr_in,
320 SPDocument * const doc_in)
322{
323 init_parent(key, wr, repr_in, doc_in);
324
325 setProgrammatically = false;
326 setRange(-1e6, 1e6);
327 setDigits(2);
328 setIncrements(0.1, 1.0);
330}
331
332void
334{
336 setProgrammatically = false;
337 return;
338 }
339 if (_wr->isUpdating()) {
340 return;
341 }
342 _wr->setUpdating(true);
343
345 //Force exact 0 if decimals over to 6
346 double val = getValue() < 1e-6 && getValue() > -1e-6?0.0:getValue();
347 os << val;
348
349 //TODO: Test is ok remove this sensitives
350 //also removed in registered text and in registered random
351 //set_sensitive(false);
352
353 write_to_xml(os.str().c_str());
354
355 //set_sensitive(true);
356
357 _wr->setUpdating(false);
358}
359
360/*#########################################
361 * Registered TEXT
362 */
363
364RegisteredText::RegisteredText(Glib::ustring const &label, Glib::ustring const &tip,
365 Glib::ustring const &key, Registry &wr,
366 Inkscape::XML::Node * const repr_in, SPDocument * const doc_in)
368{
369 init_parent(key, wr, repr_in, doc_in);
370
371 setProgrammatically = false;
372 _activate_connection = signal_activate().connect (sigc::mem_fun (*this, &RegisteredText::on_activate));
373}
374
375void
377{
379 setProgrammatically = false;
380 return;
381 }
382
383 if (_wr->isUpdating()) {
384 return;
385 }
386 _wr->setUpdating(true);
387 Glib::ustring str(getText());
389 os << str;
390 write_to_xml(os.str().c_str());
391 _wr->setUpdating(false);
392}
393
394/*#########################################
395 * Registered COLORPICKER
396 */
397
399 Glib::ustring const &title,
400 Glib::ustring const &tip,
401 Glib::ustring const &ckey,
402 Glib::ustring const &akey,
403 Registry &wr,
404 Inkscape::XML::Node *repr_in,
405 SPDocument *doc_in)
406 : RegisteredWidget<LabelledColorPicker>{label, title, tip, Colors::Color(0x000000ff), true}
407{
408 init_parent("", wr, repr_in, doc_in);
409
410 _ckey = ckey;
411 _akey = akey;
412 _changed_connection = connectChanged(sigc::mem_fun(*this, &RegisteredColorPicker::on_changed));
413}
414
415void
420
421void
426
427void
429{
430 if (_wr->isUpdating())
431 return;
432
433 _wr->setUpdating(true);
434
435 // Use local repr here. When repr is specified, use that one, but
436 // if repr==NULL, get the repr of namedview of active desktop.
437 Inkscape::XML::Node *local_repr = repr;
438 SPDocument *local_doc = doc;
439 if (!local_repr) {
440 SPDesktop *dt = _wr->desktop();
441 if (!dt) {
442 _wr->setUpdating(false);
443 return;
444 }
445 local_repr = dt->getNamedView()->getRepr();
446 local_doc = dt->getDocument();
447 }
448 bool alpha = _akey == _ckey + "_opacity_LPE"; //For LPE parameter we want stored with alpha
449 auto c = color.toString(alpha);
450
451 {
452 DocumentUndo::ScopedInsensitive _no_undo(local_doc);
453 local_repr->setAttribute(_ckey, c);
454 local_repr->setAttributeCssDouble(_akey.c_str(), color.getOpacity());
455 }
456 local_doc->setModifiedSinceSave();
457 DocumentUndo::done(local_doc, "registered-widget.cpp: RegisteredColorPicker::on_changed", ""); // TODO Fix description.
458
459 _wr->setUpdating(false);
460}
461
462/*#########################################
463 * Registered INTEGER
464 */
465
466RegisteredInteger::RegisteredInteger(Glib::ustring const &label, Glib::ustring const &tip,
467 Glib::ustring const &key, Registry &wr,
468 Inkscape::XML::Node *repr_in, SPDocument *doc_in)
469 : RegisteredWidget<Scalar>{label, tip, 0u},
470 setProgrammatically(false)
471{
472 init_parent(key, wr, repr_in, doc_in);
473
474 setRange(0, 1e6);
475 setDigits(0);
476 setIncrements(1, 10);
477
478 _changed_connection = signal_value_changed().connect(sigc::mem_fun(*this, &RegisteredInteger::on_value_changed));
479}
480
481void
483{
485 setProgrammatically = false;
486 return;
487 }
488
489 if (_wr->isUpdating())
490 return;
491
492 _wr->setUpdating(true);
493
495 os << getValue();
496 write_to_xml(os.str().c_str());
497
498 _wr->setUpdating(false);
499}
500
501/*#########################################
502 * Registered TRANSFORMEDPOINT
503 */
504
505RegisteredTransformedPoint::RegisteredTransformedPoint(Glib::ustring const &label, Glib::ustring const &tip,
506 Glib::ustring const &key, Registry &wr,
507 Inkscape::XML::Node * const repr_in,
508 SPDocument * const doc_in)
510 to_svg(Geom::identity())
511{
512 init_parent(key, wr, repr_in, doc_in);
513
514 setRange(-1e6, 1e6);
515 setDigits(2);
516 setIncrements(0.1, 1.0);
519}
520
521void
523{
524 Geom::Point new_p = p * to_svg.inverse();
525 Point::setValue(new_p); // the Point widget should display things in canvas coordinates
526}
527
528void
530{
531 // check if matrix is singular / has inverse
532 if (!canvas_to_svg.isSingular()) {
533 to_svg = canvas_to_svg;
534 } else {
535 // set back to default
537 }
538}
539
540void
542{
543 if (setProgrammatically()) {
545 return;
546 }
547
548 if (_wr->isUpdating())
549 return;
550
551 _wr->setUpdating(true);
552
553 Geom::Point pos = getValue() * to_svg;
554
556 os << pos;
557
558 write_to_xml(os.str().c_str());
559
560 _wr->setUpdating(false);
561}
562
563/*#########################################
564 * Registered TRANSFORMEDPOINT
565 */
566
567RegisteredVector::RegisteredVector(Glib::ustring const &label, Glib::ustring const &tip,
568 Glib::ustring const &key, Registry &wr,
569 Inkscape::XML::Node * const repr_in,
570 SPDocument * const doc_in)
572 _polar_coords(false)
573{
574 init_parent(key, wr, repr_in, doc_in);
575
576 setRange(-1e6, 1e6);
577 setDigits(2);
578 setIncrements(0.1, 1.0);
581}
582
583void
585{
586 if (!_polar_coords) {
587 Point::setValue(p);
588 } else {
589 Geom::Point polar;
590 polar[Geom::X] = atan2(p) *180/M_PI;
591 polar[Geom::Y] = p.length();
592 Point::setValue(polar);
593 }
594}
595
596void
602
603void RegisteredVector::setPolarCoords(bool polar_coords)
604{
605 _polar_coords = polar_coords;
606 if (polar_coords) {
607 xwidget.getLabel()->set_text(_("Angle:"));
608 ywidget.getLabel()->set_text(_("Distance:"));
609 } else {
610 xwidget.getLabel()->set_text(_("X:"));
611 ywidget.getLabel()->set_text(_("Y:"));
612 }
613}
614
615void
617{
618 if (setProgrammatically()) {
620 return;
621 }
622
623 if (_wr->isUpdating())
624 return;
625
626 _wr->setUpdating(true);
627
629 Geom::Point vector = getValue();
630 if (_polar_coords) {
631 vector = Geom::Point::polar(vector[Geom::X]*M_PI/180, vector[Geom::Y]);
632 }
633
635 os << origin << " , " << vector;
636
637 write_to_xml(os.str().c_str());
638
639 _wr->setUpdating(false);
640}
641
642/*#########################################
643 * Registered RANDOM
644 */
645
646RegisteredRandom::RegisteredRandom(Glib::ustring const &label, Glib::ustring const &tip,
647 Glib::ustring const &key, Registry &wr,
648 Inkscape::XML::Node * const repr_in,
649 SPDocument * const doc_in)
651{
652 init_parent(key, wr, repr_in, doc_in);
653
654 setProgrammatically = false;
655 setRange(-1e6, 1e6);
656 setDigits(2);
657 setIncrements(0.1, 1.0);
660}
661
662void
663RegisteredRandom::setValue(double val, long startseed)
664{
665 Scalar::setValue(val);
667}
668
669void
671{
673 setProgrammatically = false;
674 return;
675 }
676
677 if (_wr->isUpdating()) {
678 return;
679 }
680 _wr->setUpdating(true);
681
683 //Force exact 0 if decimals over to 6
684 double val = getValue() < 1e-6 && getValue() > -1e-6?0.0:getValue();
685 os << val << ';' << getStartSeed();
686 write_to_xml(os.str().c_str());
687 _wr->setUpdating(false);
688}
689
690/*#########################################
691 * Registered FONT-BUTTON
692 */
693
694RegisteredFontButton::RegisteredFontButton(Glib::ustring const &label, Glib::ustring const &tip,
695 Glib::ustring const &key, Registry &wr,
696 Inkscape::XML::Node * const repr_in,
697 SPDocument * const doc_in)
699{
700 init_parent(key, wr, repr_in, doc_in);
702}
703
704void
705RegisteredFontButton::setValue(Glib::ustring fontspec)
706{
707 FontButton::setValue(fontspec);
708}
709
710void
712{
713
714 if (_wr->isUpdating())
715 return;
716
717 _wr->setUpdating(true);
718
720 os << getValue();
721 write_to_xml(os.str().c_str());
722
723 _wr->setUpdating(false);
724}
725
726} // namespace Inkscape::UI::Widget
727
728/*
729 Local Variables:
730 mode:c++
731 c-file-style:"stroustrup"
732 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
733 indent-tabs-mode:nil
734 fill-column:99
735 End:
736*/
737// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
double scale
Definition aa.cpp:228
Point origin
Definition aa.cpp:227
3x3 matrix representing an affine transformation.
Definition affine.h:70
bool isSingular(Coord eps=EPSILON) const
Check whether this matrix is singular.
Definition affine.cpp:377
Affine inverse() const
Compute the inverse matrix.
Definition affine.cpp:388
Two-dimensional point that doubles as a vector.
Definition point.h:66
Coord length() const
Compute the distance from origin.
Definition point.h:118
std::string toString(bool opacity=true) const
Format the color as a css string and return it.
Definition color.cpp:106
double getOpacity() const
Get the opacity in this color, if it's stored.
Definition color.cpp:407
RAII-style mechanism for creating a temporary undo-insensitive context.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
std::string str() const
A labelled font button for entering font values.
Definition font-button.h:24
Glib::ustring getValue() const
void setValue(Glib::ustring const &fontspec)
Glib::SignalProxy< void()> signal_font_value_changed()
Signal raised when the font button's value changes.
void setColor(Colors::Color const &color)
Adds a label with optional icon to another widget.
Definition labelled.h:31
Gtk::Label const * getLabel() const
Definition labelled.h:51
A labelled text box, with spin buttons and optional icon, for entering arbitrary coordinate values.
Definition point.h:34
Glib::SignalProxy< void()> signal_y_value_changed()
Definition point.cpp:149
Geom::Point getValue() const
Definition point.cpp:88
void setDigits(unsigned digits)
Sets the precision to be displayed by the spin button.
Definition point.cpp:103
Glib::SignalProxy< void()> signal_x_value_changed()
Signal raised when the spin button's value changes.
Definition point.cpp:144
void setRange(double min, double max)
Sets the minimum and maximum range allowed for the spin button.
Definition point.cpp:115
bool setProgrammatically()
Check 'setProgrammatically' of both scalar widgets.
Definition point.cpp:133
void setIncrements(double step, double page)
Sets the step and page increments for the spin button.
Definition point.cpp:109
A labelled text box, with spin buttons and optional icon, for entering arbitrary number values.
Definition random.h:26
long getStartSeed() const
Gets the startseed.
Definition random.cpp:54
void setStartSeed(long newseed)
Sets the startseed number.
Definition random.cpp:59
sigc::signal< void()> signal_reseeded
Definition random.h:90
RegisteredCheckButton(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, bool right=false, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr, char const *active_str="true", char const *inactive_str="false")
std::vector< Gtk::Widget * > _subordinate_widgets
RegisteredColorPicker(Glib::ustring const &label, Glib::ustring const &title, Glib::ustring const &tip, Glib::ustring const &ckey, Glib::ustring const &akey, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
RegisteredFontButton(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
RegisteredInteger(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
sigc::scoped_connection _value_changed_connection
RegisteredRandom(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
void setValue(double val, long startseed)
RegisteredScalarUnit(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, RegisteredUnitMenu &rum, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr, RSU_UserUnits user_units=RSU_none)
sigc::scoped_connection _value_changed_connection
RegisteredScalar(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
std::vector< Gtk::Widget * > _subordinate_widgets
RegisteredSwitchButton(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, bool right=true, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
RegisteredText(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
sigc::scoped_connection _activate_connection
RegisteredToggleButton(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, bool right=true, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr, char const *icon_active="", char const *icon_inactive="")
std::vector< Gtk::Widget * > _subordinate_widgets
void setTransform(Geom::Affine const &canvas_to_svg)
RegisteredTransformedPoint(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
RegisteredUnitMenu(Glib::ustring const &label, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
void setPolarCoords(bool polar_coords=true)
Changes the widgets text to polar coordinates.
sigc::scoped_connection _value_x_changed_connection
RegisteredVector(Glib::ustring const &label, Glib::ustring const &tip, Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr)
sigc::scoped_connection _value_y_changed_connection
void init_parent(Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *const repr_in, SPDocument *const doc_in)
SPDesktop * desktop() const
Definition registry.h:27
A labelled text box, with spin buttons and optional icon, for entering the values of various unit typ...
Definition scalar-unit.h:35
bool setUnit(Glib::ustring const &units)
Sets the unit for the ScalarUnit widget.
void initScalar(double min_value, double max_value)
Initializes the scalar based on the settings in _unit_menu.
A labelled text box, with spin buttons and optional icon, for entering arbitrary number values.
Definition scalar.h:34
void setIncrements(double step, double page)
Sets the step and page increments for the spin button.
Definition scalar.cpp:123
Glib::SignalProxy< void()> signal_value_changed()
Signal raised when the spin button's value changes.
Definition scalar.cpp:159
void setDigits(unsigned digits)
Sets the precision to be displayed by the spin button.
Definition scalar.cpp:94
void setRange(double min, double max)
Sets the minimum and maximum range allowed for the spin button.
Definition scalar.cpp:128
void setValue(double value, bool setProg=true)
Sets the value of the spin button.
Definition scalar.cpp:133
bool setProgrammatically
true if the value was set by setValue, not changed by the user; if a callback checks it,...
Definition scalar.h:180
double getValue() const
Get the value in the spin_button.
Definition scalar.cpp:83
A labelled text box, with optional icon, for entering arbitrary number values.
Definition text.h:27
Glib::SignalProxy< void()> signal_activate()
Signal raised when the spin button's value changes.
Definition text.cpp:37
Glib::ustring const getText() const
Get the text in the entry.
Definition text.cpp:26
A drop down menu for choosing unit types.
Definition unit-menu.h:31
bool setUnit(Glib::ustring const &unit)
Sets the dropdown widget to the given unit abbreviation.
Definition unit-menu.cpp:75
Glib::ustring getUnitAbbr() const
Returns the abbreviated unit name of the selected unit.
Definition unit-menu.cpp:92
Interface for refcounted XML nodes.
Definition node.h:80
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
Definition node.cpp:25
bool setAttributeCssDouble(Util::const_char_ptr key, double val)
Set a property attribute to val [slightly rounded], in the format required for CSS properties: in par...
Definition node.cpp:102
To do: update description of desktop.
Definition desktop.h:149
SPDocument * getDocument() const
Definition desktop.h:189
SPNamedView * getNamedView() const
Definition desktop.h:191
Typed SVG document implementation.
Definition document.h:103
SPRoot * getRoot()
Returns our SPRoot.
Definition document.h:202
void setModifiedSinceSave(bool const modified=true)
Indicate to the user if the document has been modified since the last save by displaying a "*" in fro...
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
<svg> element
Definition sp-root.h:33
RootCluster root
double c[8][4]
constexpr Coord EPSILON
Default "acceptably small" value.
Definition coord.h:84
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
Glib::ustring label
Various utility functions.
Definition affine.h:22
Affine identity()
Create an identity matrix.
Definition affine.h:210
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
Definition desktop.h:50
Custom widgets.
Definition desktop.h:126
static cairo_user_data_key_t key
SPRoot: SVG <svg> implementation.
TODO: insert short description here.