14#include <glibmm/i18n.h>
58 if (
auto const *
const tool = dt->
getTool();
64 if (
auto const zoom_to = freehand_base.red_curve_get_last_point()) {
87 rotate_inc *= M_PI/180.0;
167 show_output(
"canvas_zoom: unhandled action value!");
175 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
180 if (prefs->
getDouble(
"/options/zoomcorrection/shown",
true)) {
181 dt->zoom_realworld(dt->current_center(), d.get());
183 dt->zoom_absolute(dt->current_center(), d.get(),
false);
191 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
201 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
210 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
220 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
229 auto d = Glib::VariantBase::cast_dynamic<Glib::Variant<double> >(value);
241 auto action = win->lookup_action(
"canvas-rotate-lock");
243 show_output(
"canvas_rotate_lock: action missing!");
247 auto saction = std::dynamic_pointer_cast<Gio::SimpleAction>(action);
249 show_output(
"canvas_rotate_lock: action not SimpleAction!");
254 saction->get_state(state);
256 saction->change_state(state);
260 pref->
setBool(
"/options/rotationlock", state);
266const Glib::ustring
SECTION = NC_(
"Action Section",
"Canvas Geometry");
271 {
"win.canvas-zoom-in", N_(
"Zoom In"),
SECTION, N_(
"Zoom in") },
272 {
"win.canvas-zoom-out", N_(
"Zoom Out"),
SECTION, N_(
"Zoom out") },
273 {
"win.canvas-zoom-1-1", N_(
"Zoom 1:1"),
SECTION, N_(
"Zoom to 1:1") },
274 {
"win.canvas-zoom-1-2", N_(
"Zoom 1:2"),
SECTION, N_(
"Zoom to 1:2") },
275 {
"win.canvas-zoom-2-1", N_(
"Zoom 2:1"),
SECTION, N_(
"Zoom to 2:1") },
276 {
"win.canvas-zoom-selection", N_(
"Zoom Selection"),
SECTION, N_(
"Zoom to fit selection in window") },
277 {
"win.canvas-zoom-drawing", N_(
"Zoom Drawing"),
SECTION, N_(
"Zoom to fit drawing in window") },
278 {
"win.canvas-zoom-page", N_(
"Zoom Page"),
SECTION, N_(
"Zoom to fit page in window") },
279 {
"win.canvas-zoom-page-width", N_(
"Zoom Page Width"),
SECTION, N_(
"Zoom to fit page width in window") },
280 {
"win.canvas-zoom-center-page", N_(
"Zoom Center Page"),
SECTION, N_(
"Center page in window") },
281 {
"win.canvas-zoom-prev", N_(
"Zoom Prev"),
SECTION, N_(
"Go back to previous zoom (from the history of zooms)")},
282 {
"win.canvas-zoom-next", N_(
"Zoom Next"),
SECTION, N_(
"Go to next zoom (from the history of zooms)")},
284 {
"win.canvas-rotate-cw", N_(
"Rotate Clockwise"),
SECTION, N_(
"Rotate canvas clockwise") },
285 {
"win.canvas-rotate-ccw", N_(
"Rotate Counter-CW"),
SECTION, N_(
"Rotate canvas counter-clockwise") },
286 {
"win.canvas-rotate-reset", N_(
"Reset Rotation"),
SECTION, N_(
"Reset canvas rotation") },
288 {
"win.canvas-flip-horizontal", N_(
"Flip Horizontal"),
SECTION, N_(
"Flip canvas horizontally") },
289 {
"win.canvas-flip-vertical", N_(
"Flip Vertical"),
SECTION, N_(
"Flip canvas vertically") },
290 {
"win.canvas-flip-reset", N_(
"Reset Flipping"),
SECTION, N_(
"Reset canvas flipping") },
292 {
"win.canvas-zoom-absolute", N_(
"Zoom Absolute"),
SECTION, N_(
"Zoom to an absolute value") },
293 {
"win.canvas-zoom-relative", N_(
"Zoom Relative"),
SECTION, N_(
"Zoom by a relative amount") },
295 {
"win.canvas-rotate-absolute-radians", N_(
"Rotate Absolute (Radians)"),
SECTION, N_(
"Rotate to an absolute value (radians)") },
296 {
"win.canvas-rotate-relative-radians", N_(
"Rotate Relative (Radians)"),
SECTION, N_(
"Rotate by a relative amount (radians)") },
297 {
"win.canvas-rotate-absolute-degrees", N_(
"Rotate Absolute (Degrees)"),
SECTION, N_(
"Rotate to an absolute value (degrees)") },
298 {
"win.canvas-rotate-relative-degrees", N_(
"Rotate Relative (Degrees)"),
SECTION, N_(
"Rotate by a relative amount (degrees)") },
300 {
"win.canvas-rotate-lock", N_(
"Lock Rotation"),
SECTION, N_(
"Lock canvas rotation") },
309 bool rotate_lock = prefs->getBool(
"/options/rotationlock");
311 Glib::VariantType Double(Glib::VARIANT_TYPE_DOUBLE);
335 win->add_action_with_parameter(
"canvas-zoom-absolute", Double, sigc::bind(sigc::ptr_fun(&
canvas_zoom_absolute), win));
336 win->add_action_with_parameter(
"canvas-zoom-relative", Double, sigc::bind(sigc::ptr_fun(&
canvas_zoom_relative), win));
343 win->add_action_bool(
"canvas-rotate-lock",sigc::bind(sigc::ptr_fun(&
canvas_rotate_lock), win), rotate_lock);
348 show_output(
"add_actions_canvas_transform: no app!");
358 bool rotate_lock = prefs->getBool(
"/options/rotationlock");
void show_output(Glib::ustring const &data, bool const is_cerr)
Various trigoniometric helper functions.
CPoint midpoint() const
Get the point in the geometric center of the rectangle.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
static InkscapeApplication * instance()
Singleton instance.
SPDesktop * get_desktop()
void zoomToSelectedPage(SPDesktop *desktop, bool width_only=false)
void centerToSelectedPage(SPDesktop *desktop)
Preference storage class.
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.
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.
To do: update description of desktop.
Inkscape::UI::Widget::Canvas * getCanvas() const
SPDocument * getDocument() const
void rotate_relative_center_point(Geom::Point const &c, double rotate)
Rotate aligning the point 'c' to the center of desktop window.
void flip_relative_center_point(Geom::Point const &c, CanvasFlip flip)
Flip direction, aligning the point 'c' to the center of desktop window.
void set_rotation_lock(bool lock)
void rotate_absolute_center_point(Geom::Point const &c, double rotate)
Set new rotation, aligning the point 'c' to the center of desktop window.
void prev_transform()
Revert back to previous transform if possible.
void zoom_realworld(Geom::Point const &c, double ratio)
Zoom in to an absolute realworld ratio, e.g.
Inkscape::UI::Tools::ToolBase * getTool() const
void zoom_selection()
Zoom to selection.
void flip_absolute_center_point(Geom::Point const &c, CanvasFlip flip)
Set new flip direction, aligning the point 'c' to the center of desktop window.
void zoom_relative(Geom::Point const &c, double zoom, bool keep_point=true)
Zoom in or out relatively to the current zoom.
void next_transform()
Set transform to next in list.
void zoom_drawing()
Zoom to whole drawing.
Geom::Affine const & w2d() const
Transformation from window to desktop coordinates (zoom/rotate).
Typed SVG document implementation.
Inkscape::PageManager & getPageManager()
Editable view implementation.
Inkscape - An SVG editor.