27#ifndef INKSCAPE_DESKTOP_H
28#define INKSCAPE_DESKTOP_H
36#include <glibmm/refptr.h>
37#include <glibmm/ustring.h>
39#include <gdkmm/toplevel.h>
40#include <sigc++/signal.h>
46#include <sigc++/scoped_connection.h>
64 template<
typename T_iterator>
66 for (; first != last; ++first)
67 if (*first)
return true;
79 template<
typename T_iterator>
81 for (; first != last; ++first)
82 if (*first)
return *first;
108class CanvasItemCatchall;
109class CanvasItemDrawing;
110class CanvasItemGroup;
111class CanvasItemRotate;
176 std::unique_ptr<Inkscape::UI::Tools::ToolBase>
_tool;
184 std::unique_ptr<Inkscape::UI::Widget::Canvas>
canvas;
307 void setTool(std::string
const &toolName);
312 std::vector<SPItem*>
getItemsAtPoints(std::vector<Geom::Point> ps,
bool all_layers =
true,
bool topmost_only =
true,
size_t limit = 0,
bool active_only =
true)
const;
431 void onWindowStateChanged(Gdk::Toplevel::State changed, Gdk::Toplevel::State new_toplevel_state);
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Coord descrim() const
Calculate the descriminant.
Affine inverse() const
Compute the inverse matrix.
Two-dimensional point with integer coordinates.
Paralellogram, representing a linear transformation of a rectangle.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Rotation around the origin.
Provides a class that can contain active TemporaryItems on a desktop.
Provides a class to put a canvasitem temporarily on-canvas.
SVG drawing item for display.
A convenience class for working with MessageStacks.
A class which holds a stack of displayed messages.
The set of selected SPObjects for a given document and layer model.
Group of selected control points.
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned contain...
void addScale(Geom::Scale scale)
Geom::Rotate const & getRotation() const
void setRotate(Geom::Rotate rotate)
Geom::Affine const & w2d() const
bool isFlipped(CanvasFlip flip)
void addFlip(CanvasFlip flip)
void setOffset(Geom::Point offset)
void setScale(Geom::Scale scale)
void addRotate(Geom::Rotate rotate)
Geom::Point const & getOffset()
void setRotate(double rotate)
void addOffset(Geom::Point offset)
void setFlip(CanvasFlip flip)
Geom::Affine const & d2w() const
void addRotate(double rotate)
To do: update description of desktop.
Inkscape::CanvasItemGroup * _canvas_group_grids
Grids.
Inkscape::UI::Widget::Canvas * getCanvas() const
unsigned interaction_disabled_counter
double current_zoom() const
Inkscape::CanvasItemGroup * getCanvasGuides() const
sigc::signal< void(SPDesktop *)> _destroy_signal
Geom::Point current_center() const
void setTool(std::string const &toolName)
Replaces the currently active tool with a new one.
Geom::Parallelogram get_display_area() const
Return canvas viewbox in desktop coordinates.
std::unique_ptr< Inkscape::Display::TemporaryItemList > _temporary_item_list
void toggleToolbar(char const *toolbar_name)
Inkscape::CanvasItemGroup * getCanvasControls() const
void emit_control_point_selected(Inkscape::UI::ControlPointSelection *selection)
sigc::connection connectDocumentReplaced(F &&slot)
SPDocument * getDocument() const
void focusMode(bool mode=true)
Changes whether the user is in focus mode or not.
std::vector< SPItem * > getItemsAtPoints(std::vector< Geom::Point > ps, bool all_layers=true, bool topmost_only=true, size_t limit=0, bool active_only=true) const
void emit_text_cursor_moved(Inkscape::UI::Tools::TextTool *tool)
Inkscape::Display::TemporaryItem * add_temporary_canvasitem(Inkscape::CanvasItem *item, int lifetime_msecs, bool move_to_bottom=true)
One should not keep a reference to the SPCanvasItem, the temporary item code will delete the object f...
void setRenderMode(Inkscape::RenderMode mode)
bool _focusMode
Whether we're focused working or general working.
bool itemIsHidden(SPItem const *item) const
void zoom_grab_focus()
Tell widget to let zoom widget grab keyboard focus.
Inkscape::CanvasItemGroup * _canvas_group_drawing
SVG Drawing.
void rotate_relative_center_point(Geom::Point const &c, double rotate)
Rotate aligning the point 'c' to the center of desktop window.
void setToolboxFocusTo(char const *label)
std::list< DesktopAffine > transforms_past
std::optional< double > _begin_zoom
InkscapeWindow const * getInkscapeWindow() const
void flip_relative_center_point(Geom::Point const &c, CanvasFlip flip)
Flip direction, aligning the point 'c' to the center of desktop window.
Inkscape::CanvasItemGroup * getCanvasSketch() const
void set_display_area(bool log=true)
Does all the dirty work in setting the display area.
bool is_darktheme() const
Geom::Point doc2dt(Geom::Point const &p) const
Inkscape::MessageStack * messageStack() const
Inkscape::CanvasItemGroup * getCanvasTemp() const
sigc::connection connectQueryStyle(F &&slot)
DesktopAffine _quick_zoom_affine
The transform of the screen before quick zoom.
Inkscape::CanvasItemCatchall * _canvas_catchall
The bottom item for unclaimed events.
bool quick_zoomed() const
Returns whether the desktop is in quick zoom mode or not.
SPCSSAttr * current
Current style.
void handle_y_axis_flip(double yshift)
Geom::Affine const & dt2doc() const
Geom::Affine const & d2w() const
Transformation from desktop to window coordinates.
sigc::scoped_connection _message_changed_connection
void rotate_relative_keep_point(Geom::Point const &c, double rotate)
Rotate keeping the point 'c' fixed in the desktop window.
void on_zoom_scale(double scale)
Geom::Point point() const
Returns the mouse point in desktop coordinates; if mouse is outside the canvas, returns the center of...
bool isWithinViewport(SPItem const *item) const
True if desktop viewport intersects item's bbox.
void zoom_quick(bool enable=true)
Performs a quick zoom into what the user is working on.
SPDesktop & operator=(SPDesktop &&)=delete
bool drawing_handler(Inkscape::CanvasEvent const &event, Inkscape::DrawingItem *item)
Calls event handler of current event context.
Inkscape::CanvasItemCatchall * getCanvasCatchall() const
Inkscape::CanvasItemGroup * _canvas_group_guides
Guide lines.
void scroll_relative_in_svg_coords(double dx, double dy)
Scroll canvas by specific coordinate amount in svg coordinates.
Inkscape::CanvasItemGroup * getCanvasGrids() const
void set_rotation_lock(bool lock)
SPItem * getItemAtPoint(Geom::Point const &p, bool into_groups, SPItem *upto=nullptr) const
Gtk::Widget * get_toolbar_by_name(Glib::ustring const &name)
void scroll_relative(Geom::Point const &delta)
Scroll canvas by specific coordinate amount (window coordinates).
void rotate_grab_focus()
Tell widget to let rotate widget grab keyboard focus.
SPDesktop(SPDesktop &&)=delete
SPItem * getItemFromListAtPointBottom(std::vector< SPItem * > const &list, Geom::Point const &p) const
std::unique_ptr< Inkscape::MessageStack > _message_stack
void flip_absolute_keep_point(Geom::Point const &c, CanvasFlip flip)
Set new flip direction, keeping the point 'c' fixed in the desktop window.
Inkscape::MessageContext * tipsMessageContext() const
std::unique_ptr< Inkscape::Selection > _selection
current selection; will never generally be NULL
void rotate_absolute_center_point(Geom::Point const &c, double rotate)
Set new rotation, aligning the point 'c' to the center of desktop window.
std::unique_ptr< Inkscape::UI::Tools::ToolBase > _tool
sigc::scoped_connection _reconstruction_finish_connection
void showInfoDialog(Glib::ustring const &message)
void flip_relative_keep_point(Geom::Point const &c, CanvasFlip flip)
Flip direction, keeping the point 'c' fixed in the desktop window.
sigc::signal< void(SPDesktop *, Inkscape::UI::Tools::ToolBase *)> _event_context_changed_signal
Inkscape::Display::SnapIndicator * getSnapIndicator() const
bool isToolboxButtonActive(char const *id) const
bool is_fullscreen() const
void prev_transform()
Revert back to previous transform if possible.
std::unique_ptr< Inkscape::Display::SnapIndicator > _snapindicator
SPNamedView * getNamedView() const
void zoom_realworld(Geom::Point const &c, double ratio)
Zoom in to an absolute realworld ratio, e.g.
Inkscape::CanvasItemDrawing * getCanvasDrawing() const
bool _overlays_visible
Whether the overlays are temporarily hidden.
void quick_preview(bool activate)
SPDesktopWidget * getDesktopWidget() const
sigc::connection connect_gradient_stop_selected(sigc::slot< void(SPStop *)> const &slot)
GrPointType gr_point_type
void setWindowSize(Geom::IntPoint const &size)
void set_display_center(Geom::Rect const &a)
Centre Rect, without zooming.
std::unique_ptr< Inkscape::MessageContext > _tips_message_context
Inkscape::UI::Dialog::DialogContainer * getContainer()
void change_document(SPDocument *document)
Make desktop switch documents.
SPItem * getGroupAtPoint(Geom::Point const &p) const
Inkscape::Selection * getSelection() const
sigc::scoped_connection _reconstruction_start_connection
Inkscape::CanvasItemGroup * _canvas_group_pages_bg
Page background.
SPDesktopWidget * _widget
void remove_temporary_canvasitem(Inkscape::Display::TemporaryItem *tempitem)
It is perfectly safe to call this function while the object has already been deleted due to a timeout...
Inkscape::PaintTarget gr_fill_or_stroke
sigc::connection connectDestroy(F &&slot)
void on_zoom_end(Gdk::EventSequence *sequence)
DesktopAffine _current_affine
sigc::connection connect_text_cursor_moved(sigc::slot< void(Inkscape::UI::Tools::TextTool *)> const &slot)
sigc::signal< void(SPDesktop *, SPDocument *)> _document_replaced_signal
bool get_rotation_lock() const
Geom::Rotate const & current_rotation() const
sigc::signal< void(double)> signal_zoom_changed
Emitted when the zoom factor changes (not emitted when scrolling).
Inkscape::UI::Tools::ToolBase * getTool() const
std::unique_ptr< Inkscape::LayerManager > _layer_manager
void rotate_absolute_keep_point(Geom::Point const &c, double rotate)
Set new rotation, keeping the point 'c' fixed in the desktop window.
sigc::scoped_connection _schedule_zoom_from_document_connection
sigc::connection connect_control_point_selected(sigc::slot< void(Inkscape::UI::ControlPointSelection *)> const &slot)
void set_coordinate_status(Geom::Point const &p)
Sets the coordinate status to a given point.
Inkscape::MessageContext * guidesMessageContext() const
Inkscape::CanvasItemGroup * _canvas_group_pages_fg
Page border + shadow.
sigc::connection connectSetStyle(F &&slot)
bool isWaitingCursor() const
void clearWaitingCursor()
void applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text)
Apply the desktop's current style or the tool style to the object.
void zoom_selection()
Zoom to selection.
bool scroll_to_point(Geom::Point const &s_dt, double autoscrollspeed=0)
Scroll screen so as to keep point 'p' visible in window.
void setWindowTransient(Gtk::Window &window, int transient_policy=1)
sigc::signal< void(Inkscape::UI::ControlPointSelection *)> _control_point_selected
sigc::signal< bool(SPCSSAttr const *, bool)>::accumulated< StopOnTrue > _set_style_signal
void emit_gradient_stop_selected(SPStop *stop)
Geom::IntPoint getWindowSize() const
Inkscape::CanvasItemGroup * getCanvasPagesFg() const
Glib::ustring _reconstruction_old_layer_id
bool _saved_guides_visible
Remembers guides' visibility when hiding overlays.
bool is_maximized() const
sigc::connection _saved_or_modified_conn
bool is_flipped(CanvasFlip flip)
sigc::signal< void(Inkscape::UI::Tools::TextTool *)> _text_cursor_moved
std::unique_ptr< Inkscape::UI::Widget::Canvas > canvas
std::unique_ptr< Inkscape::Display::TranslucencyGroup > _translucency_group
std::unique_ptr< Inkscape::MessageContext > _guides_message_context
Inkscape::CanvasItemDrawing * _canvas_drawing
The actual SVG drawing (a.k.a. arena).
SPDesktop(SPDesktop const &)=delete
Inkscape::CanvasItemGroup * _canvas_group_controls
Handles, knots, nodes, etc.
Geom::Point w2d(Geom::Point const &p) const
void setDesktopWidget(SPDesktopWidget *dtw)
Inkscape::CanvasItemGroup * getCanvasPagesBg() const
sigc::scoped_connection _message_idle_connection
bool is_yaxisdown() const
void schedule_zoom_from_document()
Schedule the zoom/view settings from the document to be applied to the desktop just after the canvas ...
bool _quick_zoom_enabled
Signifies that currently we're in quick zoom mode.
void clear_transform_history()
Clear transform lists.
sigc::signal< int(SPStyle *, int)>::accumulated< StopOnNonZero > _query_style_signal
void showNotice(Glib::ustring const &msg, int timeout=0)
sigc::scoped_connection _y_axis_flipped
void reconstruction_finish()
Called when document rebuild is finished.
void reconstruction_start()
Called when document is starting to be rebuilt.
void setToolboxAdjustmentValue(char const *id, double val)
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.
sigc::signal< void(SPStop *)> _gradient_stop_selected
bool is_focusMode() const
Checks to see if the user is working in focused mode.
SPDesktop & operator=(SPDesktop const &)=delete
void zoom_relative(Geom::Point const &c, double zoom, bool keep_point=true)
Zoom in or out relatively to the current zoom.
Inkscape::LayerManager const & layerManager() const
Inkscape::LayerManager & layerManager()
Geom::Point d2w(Geom::Point const &p) const
void scroll_absolute(Geom::Point const &point)
Scroll canvas by to a particular point (window coordinates).
void set_display_width(Geom::Rect const &a, Geom::Coord border)
Set display area in only the width dimension.
void setDocument(SPDocument *doc)
Associate document with desktop.
Inkscape::Display::TranslucencyGroup & getTranslucencyGroup() const
void zoom_absolute(Geom::Point const &c, double zoom, bool keep_point=true)
Zoom to the given absolute zoom level.
void setColorMode(Inkscape::ColorMode mode)
Inkscape::CanvasItemGroup * _canvas_group_sketch
Temporary items before becoming permanent.
Geom::Affine const & doc2dt() const
std::list< DesktopAffine > transforms_future
void next_transform()
Set transform to next in list.
sigc::connection connectEventContextChanged(F &&slot)
void setTempHideOverlays(bool hide)
Shows or hides the on-canvas overlays and controls, such as grids, guides, manipulation handles,...
bool warnDialog(Glib::ustring const &text)
void toggleCommandPalette()
void onStatusMessage(Inkscape::MessageType type, char const *message)
Inkscape::CanvasItemGroup * _canvas_group_temp
Temporary items that self-destruct.
void zoom_drawing()
Zoom to whole drawing.
sigc::connection _document_uri_set_connection
Geom::Point dt2doc(Geom::Point const &p) const
void onWindowStateChanged(Gdk::Toplevel::State changed, Gdk::Toplevel::State new_toplevel_state)
onWindowStateChanged
void on_zoom_begin(Gdk::EventSequence *sequence)
Geom::Affine const & w2d() const
Transformation from window to desktop coordinates (zoom/rotate).
void activate_guides(bool activate)
Set activate status of current desktop's named view.
Typed SVG document implementation.
Base class for visual SVG elements.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
sigc::scoped_connection timeout
constexpr double SP_DESKTOP_ZOOM_MIN
constexpr double SP_DESKTOP_ZOOM_MAX
double Coord
Floating point type used to store coordinates.
Raw stack of active status messages.
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
Helper class to stream background task notifications as a series of messages.
MessageType
A hint about the meaning of a message; is it an ordinary message, a message advising the user of some...
Piecewise< SBasis > log(Interval in)
TODO: insert short description here.
Abstract base class for events.
Iterates until nonzero or returns 0.
result_type operator()(T_iterator first, T_iterator last) const
Iterates until true or returns false.
result_type operator()(T_iterator first, T_iterator last) const
static void activate(GApplication *app, gpointer)