14#include <glibmm/i18n.h>
29 Glib::Variant<Glib::ustring> s = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring> >(value);
31 std::vector<Glib::ustring> tokens = Glib::Regex::split_simple(
",", s.get());
32 if (tokens.size() != 2) {
33 show_output(
"action:transform_translate: requires two comma separated numbers");
40 dx = std::stod(tokens[0]);
41 dy = std::stod(tokens[1]);
43 show_output(
"action:transform-move: invalid arguments");
48 selection->
move(dx, dy);
57 auto scale = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
64 auto scale = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
73 auto scale = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
80 auto scale = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
88 auto angle = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
97 auto angle = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
104 auto angle = (Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(value)).get();
126 INKSCAPE_ICON(
"tool-pointer"));
132 Glib::Variant<int> i = Glib::VariantBase::cast_dynamic<Glib::Variant<int> >(value);
137const Glib::ustring
SECTION = NC_(
"Action Section",
"Transform");
142 {
"app.transform-translate", N_(
"Translate"),
SECTION, N_(
"Translate selected objects (dx,dy)")},
143 {
"app.transform-rotate", N_(
"Rotate"),
SECTION, N_(
"Rotate selected objects by degrees")},
144 {
"app.transform-scale", N_(
"Scale"),
SECTION, N_(
"Scale selected objects by scale factor")},
145 {
"app.transform-grow", N_(
"Grow/Shrink"),
SECTION, N_(
"Grow/shrink selected objects")},
146 {
"app.transform-grow-step", N_(
"Grow/Shrink Step"),
SECTION, N_(
"Grow/shrink selected objects by multiple of step value")},
147 {
"app.transform-grow-screen", N_(
"Grow/Shrink Screen"),
SECTION, N_(
"Grow/shrink selected objects relative to zoom level")},
148 {
"app.transform-rotate", N_(
"Rotate"),
SECTION, N_(
"Rotate selected objects")},
149 {
"app.transform-rotate-step", N_(
"Rotate Step"),
SECTION, N_(
"Rotate selected objects by multiple of step value")},
150 {
"app.transform-rotate-screen", N_(
"Rotate Screen"),
SECTION, N_(
"Rotate selected objects relative to zoom level")},
152 {
"app.transform-remove", N_(
"Remove Transforms"),
SECTION, N_(
"Remove any transforms from selected objects")},
153 {
"app.transform-reapply", N_(
"Reapply Transforms"),
SECTION, N_(
"Reapply the last transformation to the selection")},
154 {
"app.page-rotate", N_(
"Rotate Page 90°"),
SECTION, N_(
"Rotate page by 90-degree rotation steps")},
161 {
"app.transform-translate", N_(
"Enter two comma-separated numbers, e.g. 50,-2.5")},
162 {
"app.transform-rotate", N_(
"Enter angle (in degrees) for clockwise rotation")},
163 {
"app.transform-scale", N_(
"Enter scaling factor, e.g. 1.5")},
164 {
"app.transform-grow", N_(
"Enter positive or negative number to grow/shrink selection")},
165 {
"app.transform-grow-step", N_(
"Enter positive or negative number to grow or shrink selection relative to preference step value")},
166 {
"app.transform-grow-screen", N_(
"Enter positive or negative number to grow or shrink selection relative to zoom level")},
167 {
"app.page-rotate", N_(
"Enter number of 90-degree rotation steps")},
175 Glib::VariantType Bool( Glib::VARIANT_TYPE_BOOL);
176 Glib::VariantType Int( Glib::VARIANT_TYPE_INT32);
177 Glib::VariantType Double(Glib::VARIANT_TYPE_DOUBLE);
178 Glib::VariantType String(Glib::VARIANT_TYPE_STRING);
183 gapp->add_action_with_parameter(
"transform-translate", String, sigc::bind(sigc::ptr_fun(&
transform_translate), app));
184 gapp->add_action_with_parameter(
"transform-rotate", Double, sigc::bind(sigc::ptr_fun(&
transform_rotate), app));
185 gapp->add_action_with_parameter(
"transform-scale", Double, sigc::bind(sigc::ptr_fun(&
transform_scale), app));
186 gapp->add_action_with_parameter(
"transform-grow", Double, sigc::bind(sigc::ptr_fun(&
transform_grow), app));
187 gapp->add_action_with_parameter(
"transform-grow-step", Double, sigc::bind(sigc::ptr_fun(&
transform_grow_step), app));
188 gapp->add_action_with_parameter(
"transform-rotate", Double, sigc::bind(sigc::ptr_fun(&
transform_rotate), app));
189 gapp->add_action_with_parameter(
"transform-rotate-step", Double, sigc::bind(sigc::ptr_fun(&
transform_rotate_step), app));
190 gapp->add_action(
"transform-remove", sigc::bind(sigc::ptr_fun(&
transform_remove), app));
191 gapp->add_action(
"transform-reapply", sigc::bind(sigc::ptr_fun(&
transform_reapply), app));
192 gapp->add_action_with_parameter(
"page-rotate", Int, sigc::bind(sigc::ptr_fun(&
page_rotate), app));
202 Glib::VariantType Double(Glib::VARIANT_TYPE_DOUBLE);
204 win->add_action_with_parameter(
"transform-grow-screen", Double, sigc::bind(sigc::ptr_fun(&
transform_grow_screen), win));
205 win->add_action_with_parameter(
"transform-rotate-screen", Double, sigc::bind(sigc::ptr_fun(&
transform_rotate_screen), win));
void show_output(Glib::ustring const &data, bool const is_cerr)
void add_data(std::vector< std::vector< Glib::ustring > > &raw_data)
InkActionExtraData & get_action_extra_data()
Gio::Application * gio_app()
The Gio application instance, never NULL.
SPDocument * get_active_document()
InkActionHintData & get_action_hint_data()
Inkscape::Selection * get_active_selection()
SPDesktop * get_desktop()
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void maybeDone(SPDocument *document, const gchar *keyconst, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
void move(double dx, double dy)
void reapplyAffine()
Reapply the same transform again.
void rotatePage(int turns)
Rotate the selected page by the given number of 90 degree rotations.
Preference storage class.
static Preferences * get()
Access the singleton Preferences object.
int getInt(Glib::ustring const &pref_path, int def=0)
Retrieve an integer.
double getDoubleLimited(Glib::ustring const &pref_path, double def=0.0, double min=DBL_MIN, double max=DBL_MAX, Glib::ustring const &unit="")
Retrieve a limited floating point value.
void rotateAnchored(double angle_degrees, double zoom=1.0)
Rotate the selection, anchoring it against the center, or a selected anchor.
void scaleAnchored(double amount, bool fixed=true)
Scale the selection, anchoring it against the center, or a selected anchor.
double current_zoom() const
Inkscape::Selection * getSelection() const
Inkscape::PageManager & getPageManager()
Editable view implementation.
TODO: insert short description here.
Macro for icon names used in Inkscape.
Inkscape - An SVG editor.
Singleton class to access the preferences file in a convenient way.