Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
originalpath.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) Johan Engelen 2012 <j.b.c.engelen@alumnus.utwente.nl>
4 *
5 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
6 */
7
9
10#include <glibmm/i18n.h>
11#include <gtkmm/box.h>
12#include <gtkmm/button.h>
13#include <gtkmm/image.h>
14#include <gtkmm/label.h>
15
16#include "desktop.h"
17#include "display/curve.h"
18#include "inkscape.h"
19#include "live_effects/effect.h"
21#include "object/sp-shape.h"
22#include "object/sp-text.h"
23#include "object/uri.h"
24#include "selection.h"
25#include "ui/icon-names.h"
26#include "ui/pack.h"
27
28namespace Inkscape {
29namespace LivePathEffect {
30
31OriginalPathParam::OriginalPathParam( const Glib::ustring& label, const Glib::ustring& tip,
32 const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
33 Effect* effect)
34 : PathParam(label, tip, key, wr, effect, "")
35{
36 oncanvas_editable = false;
37 _from_original_d = false;
38}
39
40Gtk::Widget *
42{
43 auto const _widget = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
44
45 { // Label
46 auto const pLabel = Gtk::make_managed<Gtk::Label>(param_label);
47 UI::pack_start(*_widget, *pLabel, true, true);
48 pLabel->set_tooltip_text(param_tooltip);
49 }
50
51 { // Paste path to link button
52 auto const pIcon = Gtk::make_managed<Gtk::Image>();
53 pIcon->set_from_icon_name("edit-clone");
54 auto const pButton = Gtk::make_managed<Gtk::Button>();
55 pButton->set_has_frame(false);
56 pButton->set_child(*pIcon);
57 pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathParam::on_link_button_click));
58 UI::pack_start(*_widget, *pButton, true, true);
59 pButton->set_tooltip_text(_("Link to path in clipboard"));
60 }
61
62 { // Select original button
63 auto const pIcon = Gtk::make_managed<Gtk::Image>();
64 pIcon->set_from_icon_name("edit-select-original");
65 auto const pButton = Gtk::make_managed<Gtk::Button>();
66 pButton->set_has_frame(false);
67 pButton->set_child(*pIcon);
68 pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathParam::on_select_original_button_click));
69 UI::pack_start(*_widget, *pButton, true, true);
70 pButton->set_tooltip_text(_("Select original"));
71 }
72
73 return _widget;
74}
75
76void
78{
79 SPDesktop *desktop = SP_ACTIVE_DESKTOP;
81 if (desktop == nullptr || original == nullptr) {
82 return;
83 }
85 selection->clear();
86 selection->set(original);
87 param_effect->getLPEObj()->requestModified(SP_OBJECT_MODIFIED_FLAG);
88}
89
90} /* namespace LivePathEffect */
91} /* namespace Inkscape */
92
93/*
94 Local Variables:
95 mode:c++
96 c-file-style:"stroustrup"
97 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
98 indent-tabs-mode:nil
99 fill-column:99
100 End:
101*/
102// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
LivePathEffectObject * getLPEObj()
Definition effect.h:150
OriginalPathParam(const Glib::ustring &label, const Glib::ustring &tip, const Glib::ustring &key, Inkscape::UI::Widget::Registry *wr, Effect *effect)
void clear()
Unselects all selected objects.
The set of selected SPObjects for a given document and layer model.
Definition selection.h:80
void set(XML::Node *repr)
Set the selection to an XML node's SPObject.
Definition selection.h:118
To do: update description of desktop.
Definition desktop.h:149
Inkscape::Selection * getSelection() const
Definition desktop.h:188
Base class for visual SVG elements.
Definition sp-item.h:109
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
Editable view implementation.
Macro for icon names used in Inkscape.
std::string original
Glib::ustring label
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
Definition pack.cpp:141
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.
SPDesktop * desktop