31#include <glibmm/i18n.h>
32#include <gtkmm/adjustment.h>
33#include <gtkmm/togglebutton.h>
72 { 0, _(
"(no width)")},
73 { 1, _(
"(hairline)")},
77 { 15, _(
"(default)")},
82 {100, _(
"(broad stroke)")}
86 {-100, _(
"(speed blows up stroke)")},
89 { -10, _(
"(slight widening)")},
90 { 0, _(
"(constant width)")},
91 { 10, _(
"(slight thinning, default)")},
94 { 100, _(
"(speed deflates stroke)")}
98 { 0, _(
"(blunt caps, default)")},
99 {0.3, _(
"(slightly bulging)")},
102 {1.4, _(
"(approximately round)")},
103 {5.0, _(
"(long protruding caps)")}
107 { 0, _(
"(smooth line)")},
108 { 10, _(
"(slight tremor)")},
109 { 20, _(
"(noticeable tremor)")},
112 {100, _(
"(maximum tremor)")}
116 { 0, _(
"(no inertia)")},
117 { 2, _(
"(slight smoothing, default)")},
118 { 10, _(
"(noticeable lagging)")},
121 {100, _(
"(maximum inertia)")}
127 auto &btn =
dynamic_cast<Gtk::ToggleButton &
>(
item);
128 btn.set_active(btn_index == eraser_mode);
137 _split_btn.set_active(prefs->getBool(
"/tools/eraser/break_apart",
false));
153 auto const path =
"/tools/eraser/" +
name;
156 auto adj = btn.get_adjustment();
158 adj->signal_value_changed().connect(sigc::mem_fun(*
this, value_changed_mem_fun));
172 if (
mode == EraserToolMode::DELETE) {
174 }
else if (
mode == EraserToolMode::CUT) {
176 }
else if (
mode == EraserToolMode::CLIP) {
207 bool const visibility = eraser_mode !=
_modeAsInt(EraserToolMode::DELETE);
209 constexpr int visible_children_count = 2;
213 for (
auto child : children) {
214 if (child_index++ < visible_children_count) {
218 child->set_visible(visibility);
static bool getUndoSensitive(SPDocument const *document)
double getDouble(Glib::ustring const &pref_path, double def=0.0, Glib::ustring const &unit="")
Retrieve a floating point value.
static Preferences * get()
Access the singleton Preferences object.
void setDouble(Glib::ustring const &pref_path, double value)
Set a floating point value.
void setInt(Glib::ustring const &pref_path, int value)
Set an integer value.
void setBool(Glib::ustring const &pref_path, bool value)
Set a Boolean value.
SPDocument * getDocument() const
Editable view implementation.
TODO: insert short description here.
std::vector< Gtk::Widget * > get_children(Gtk::Widget &widget)
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling().
W & get_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id)
Gtk::Widget * for_each_child(Gtk::Widget &widget, Func &&func, bool const plus_self=false, bool const recurse=false, int const level=0)
Call Func with a reference to each child of parent, until it returns _break.
W & get_derived_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id, Args &&... args)
Glib::RefPtr< Gtk::Builder > create_builder(const char *filename)
Glib::RefPtr< Gtk::Builder > builder