30#include <giomm/simpleactiongroup.h>
31#include <glibmm/i18n.h>
32#include <gtkmm/adjustment.h>
34#include <gtkmm/button.h>
35#include <gtkmm/image.h>
36#include <gtkmm/menubutton.h>
37#include <gtkmm/togglebutton.h>
38#include <sigc++/functors/mem_fun.h>
75 , _show_transform_handles_btn{&
get_widget<
Gtk::ToggleButton>(
builder,
"_show_transform_handles_btn")}
76 , _object_edit_mask_path_btn{&
get_widget<
Gtk::ToggleButton>(
builder,
"_object_edit_mask_path_btn")}
77 , _object_edit_clip_path_btn{&
get_widget<
Gtk::ToggleButton>(
builder,
"_object_edit_clip_path_btn")}
88 auto unit_menu =
_tracker->create_tool_item(_(
"Units"), (
""));
89 get_widget<Gtk::Box>(
builder,
"unit_menu_box").append(*unit_menu);
94 char const *button_id;
98 static constexpr ButtonMapping button_mapping[] = {
113 for (
auto const &button_info : button_mapping) {
114 get_widget<Gtk::Button>(
builder, button_info.button_id)
116 .connect(sigc::mem_fun(*
this, button_info.callback));
133 "/tools/nodes/show_transform_handles"));
143 "/tools/nodes/edit_clipping_paths"));
180 auto adj = btn.get_adjustment();
184 _tracker->addAdjustment(adj->gobj());
193 auto const actions = Gio::SimpleActionGroup::create();
198 insert_action_group(
"node-toolbar", actions);
211 auto const unit =
_tracker->getActiveUnit();
214 double val = Quantity::convert(adj->get_value(), unit,
"px");
215 auto pwb = nt->_selected_nodes->pointwiseBounds();
216 auto fsp = nt->_selected_nodes->firstSelectedPoint();
220 double delta = val / pwb->diameter();
223 auto center = fsp ? *fsp : pwb->midpoint();
224 nt->_multipath->scale(center, {
delta,
delta});
227 }
else if (nt && !nt->_selected_nodes->empty()) {
230 double oldval = pwb->midpoint()[d];
240 delta[d] = val - oldval;
241 nt->_multipath->move(
delta);
247 if (
auto lpeitem = cast<SPLPEItem>(selection->
singleItem())) {
273 auto const unit =
_tracker->getActiveUnit();
275 if (!selected_nodes || selected_nodes->
empty()) {
284 Geom::Coord oldx = Quantity::convert(adj_x->get_value(), unit,
"px");
285 Geom::Coord oldy = Quantity::convert(adj_y->get_value(), unit,
"px");
291 mid *= pm.getSelectedPageAffine().inverse();
294 if (oldx != mid.
x()) {
295 adj_x->set_value(Quantity::convert(mid.
x(),
"px", unit));
297 if (oldy != mid.
y()) {
298 adj_y->set_value(Quantity::convert(mid.
y(),
"px", unit));
302 if (selected_nodes->
size() == 2) {
306 Geom::Coord oldl = Quantity::convert(adj_l->get_value(), unit,
"px");
309 if (oldl != length) {
310 adj_l->set_value(Quantity::convert(length,
"px", unit));
320 nt->_multipath->insertNodes();
347 nt->_multipath->insertNodesAtExtrema(extrema);
358 nt->_multipath->insertNodesAtExtrema(extrema);
373 nt->_multipath->joinNodes();
380 nt->_multipath->breakNodes();
387 nt->_multipath->deleteSegments();
395 nt->_multipath->joinSegments();
CPoint corner(unsigned i) const
Return the n-th corner of the rectangle.
Two-dimensional point that doubles as a vector.
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
SPItem * singleItem()
Returns a single selected item.
Geom::Rect getSelectedPageRect() const
Returns the selected page rect, OR the viewbox rect.
static Preferences * get()
Access the singleton Preferences object.
void setBool(Glib::ustring const &pref_path, bool value)
Set a Boolean value.
The set of selected SPObjects for a given document and layer model.
sigc::connection connectChanged(sigc::slot< void(Selection *)> slot)
Connects a slot to be notified of selection changes.
sigc::connection connectModified(sigc::slot< void(Selection *, unsigned)> slot)
Connects a slot to be notified of selected object modifications.
Group of selected control points.
Geom::OptRect pointwiseBounds()
Get the bounds of the selection.
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::Selection * getSelection() const
Inkscape::UI::Tools::ToolBase * getTool() const
sigc::connection connect_control_point_selected(sigc::slot< void(Inkscape::UI::ControlPointSelection *)> const &slot)
bool is_yaxisdown() const
bool get_origin_follows_page()
Inkscape::PageManager & getPageManager()
Control point selection - stores a set of control points and applies transformations to them.
Editable view implementation.
TODO: insert short description here.
double Coord
Floating point type used to store coordinates.
Multi path manipulator - a tool component that edits multiple paths at once.
W & get_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id)
@ NODE_CUSP
Cusp node - no handle constraints.
@ NODE_SYMMETRIC
Symmetric node - handles must be colinear and of equal length.
@ NODE_AUTO
Auto node - handles adjusted automatically based on neighboring nodes.
@ NODE_SMOOTH
Smooth node - handles must be colinear.
W & get_derived_widget(const Glib::RefPtr< Gtk::Builder > &builder, const char *id, Args &&... args)
Glib::RefPtr< Gtk::Builder > create_builder(const char *filename)
@ SEGMENT_STRAIGHT
Straight linear segment.
@ SEGMENT_CUBIC_BEZIER
Bezier curve with two control points.
Miscellaneous supporting code.
Glib::RefPtr< Gtk::Builder > builder