15#include <glibmm/i18n.h>
42 if (prefs->
getBool(
"/options/pathoperationsunlink/value",
true)) {
47 bool scale_stroke = prefs->
getBool(
"/options/transform/stroke",
true);
48 prefs->
setBool(
"/options/transform/stroke",
true);
51 std::vector<SPItem *> my_items(
items().begin(),
items().
end());
53 for (
auto item : my_items) {
66 prefs->
setBool(
"/options/transform/stroke", scale_stroke);
72 if (did && !skip_undo) {
74 }
else if (!did && !skip_undo) {
90 double threshold = prefs->
getDouble(
"/options/simplifythreshold/value", 0.003);
91 bool justCoalesce = prefs->
getBool(
"/options/simplifyjustcoalesce/value",
false);
94 static gint64 previous_time = 0;
95 static gdouble multiply = 1.0;
98 gint64 current_time = g_get_monotonic_time();
101 if (previous_time > 0 && current_time - previous_time < 500000) {
105 threshold *= multiply;
113 previous_time = current_time;
121 if (!selectionBbox) {
122 std::cerr <<
"ObjectSet::: selection has no visual bounding box!" << std::endl;
125 double size = L2(selectionBbox->dimensions());
127 int pathsSimplified = 0;
128 std::vector<SPItem *> my_items(
items().begin(),
items().
end());
129 for (
auto item : my_items) {
133 if (pathsSimplified > 0 && !skip_undo) {
139 if (pathsSimplified > 0) {
146 return (pathsSimplified > 0);
Utility functions related to parsing and validation of XML attributes.
Axis-aligned rectangle that can be empty.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void cancel(SPDocument *document)
MessageId flash(MessageType type, char const *message)
Temporarily pushes a message onto the stack.
MessageId flashF(MessageType type, char const *format,...) G_GNUC_PRINTF(3
temporarily pushes a message onto the stack using printf-like formatting
SPDesktop * desktop()
Returns the desktop the selection is bound to.
SPItemRange items()
Returns a range of selected SPItems.
bool add(SPObject *object, bool nosignal=false)
Add an SPObject to the set of selected objects.
bool strokesToPaths(bool legacy=false, bool skip_undo=false)
bool isEmpty()
Returns true if no items are selected.
int size()
Returns size of the selection.
SPDocument * document()
Returns the document the selection is bound to.
bool unlinkRecursive(const bool skip_undo=false, const bool force=false, const bool silent=false)
Recursively unlink any clones present in the current selection, including clones which are used to cl...
bool simplifyPaths(bool skip_undo=false)
Geom::OptRect visualBounds() const
Preference storage class.
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
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 setBool(Glib::ustring const &pref_path, bool value)
Set a Boolean value.
Interface for refcounted XML nodes.
Inkscape::MessageStack * messageStack() const
void clearWaitingCursor()
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Editable view implementation.
TODO: insert short description here.
Macro for icon names used in Inkscape.
Raw stack of active status messages.
Inkscape::XML::Node * item_to_paths(SPItem *item, bool legacy, SPItem *context)
Replace item by path objects (a.k.a.
Two related object to path operations:
int path_simplify(SPItem *item, float threshold, bool justCoalesce, double size)
Simplify paths (reduce node count).
Singleton class to access the preferences file in a convenient way.