Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
bool.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
4 *
5 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
6 */
7
8#include "bool.h"
9
10#include <glibmm/i18n.h>
11
12#include "live_effects/effect.h"
13#include "ui/icon-names.h"
16
17
18namespace Inkscape {
19
20namespace LivePathEffect {
21
22BoolParam::BoolParam( const Glib::ustring& label, const Glib::ustring& tip,
23 const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
24 Effect* effect, bool default_value)
25 : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value)
26{
27}
28
29BoolParam::~BoolParam() = default;
30
31void
36
37void
38BoolParam::param_update_default(bool const default_value)
39{
40 defvalue = default_value;
41}
42
43void
44BoolParam::param_update_default(const gchar * default_value)
45{
47}
48
49bool
50BoolParam::param_readSVGValue(const gchar * strvalue)
51{
53 return true; // not correct: if value is unacceptable, should return false!
54}
55
56Glib::ustring
58{
59 return value ? "true" : "false";
60}
61
62Glib::ustring
64{
65 return defvalue ? "true" : "false";
66}
67
68Gtk::Widget *
70{
72 auto const checkwdg = Gtk::make_managed<UI::Widget::RegisteredCheckButton>( param_label,
75 *param_wr,
76 false,
79 checkwdg->setActive(value);
80 checkwdg->setProgrammatically = false;
81 checkwdg->set_undo_parameters(_("Change bool parameter"), INKSCAPE_ICON("dialog-path-effects"));
82 return checkwdg;
83 } else {
84 return nullptr;
85 }
86}
87
88void
90{
91 if (value != newvalue) {
93 }
94 value = newvalue;
95}
96
97} /* namespace LivePathEffect */
98
99} /* namespace Inkscape */
100
101/*
102 Local Variables:
103 mode:c++
104 c-file-style:"stroustrup"
105 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
106 indent-tabs-mode:nil
107 fill-column:99
108 End:
109*/
110// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
bool param_readSVGValue(const gchar *strvalue) override
Definition bool.cpp:50
Glib::ustring param_getSVGValue() const override
Definition bool.cpp:57
Gtk::Widget * param_newWidget() override
Definition bool.cpp:69
BoolParam(const Glib::ustring &label, const Glib::ustring &tip, const Glib::ustring &key, Inkscape::UI::Widget::Registry *wr, Effect *effect, bool default_value=false)
Definition bool.cpp:22
void param_set_default() override
Definition bool.cpp:32
Glib::ustring param_getDefaultSVGValue() const override
Definition bool.cpp:63
void param_setValue(bool newvalue)
Definition bool.cpp:89
void param_update_default(bool const default_value)
Definition bool.cpp:38
Inkscape::XML::Node * getRepr()
Definition effect.cpp:1928
Inkscape::UI::Widget::Registry * param_wr
Definition parameter.h:99
Utility functions to convert ascii representations to numbers.
Macro for icon names used in Inkscape.
Glib::ustring label
bool read_bool(gchar const *value, bool default_value)
Definition converters.h:61
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key