Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Widget::CanvasGrid Class Reference

A Gtk::Grid widget that contains rulers, scrollbars, buttons, and, of course, the canvas. More...

#include <canvas-grid.h>

Inheritance diagram for Inkscape::UI::Widget::CanvasGrid:

Public Member Functions

 CanvasGrid (SPDesktopWidget *dtw)
 
 ~CanvasGrid () override
 
void ShowScrollbars (bool state=true)
 
void ToggleScrollbars ()
 
void ShowRulers (bool state=true)
 
void ToggleRulers ()
 
void updateRulers ()
 
void ShowCommandPalette (bool state=true)
 
void ToggleCommandPalette ()
 
void showNotice (Glib::ustring const &msg, int timeout=0)
 
void setPopover (Gtk::Popover *popover)
 
void addTab (Canvas *canvas)
 
void removeTab (Canvas *canvas)
 
void switchTab (Canvas *canvas)
 
CanvasGetCanvas ()
 
Inkscape::UI::Widget::RulerGetHRuler ()
 
Inkscape::UI::Widget::RulerGetVRuler ()
 
Gtk::Adjustment * GetHAdj ()
 
Gtk::Adjustment * GetVAdj ()
 
Gtk::ToggleButton * GetGuideLock ()
 
Gtk::ToggleButton * GetCmsAdjust ()
 
Gtk::CheckButton * GetStickyZoom ()
 
Dialog::CommandPalettegetCommandPalette ()
 
Inkscape::UI::Widget::TabsWidgetgetTabsWidget ()
 
void rulerMotion (MotionEvent const &event, bool horiz)
 
void updateScrollbars (double scale)
 

Private Types

enum class  RulerOrientation { vertical , horizontal }
 
using parent_type = Gtk::Grid
 

Private Member Functions

void size_allocate_vfunc (int width, int height, int baseline) override
 
void on_realize () override
 
Geom::IntPoint _rulerToCanvas (bool horiz) const
 
void _createGuideItem (Geom::Point const &pos, bool horiz)
 
void _createGuide (Geom::Point origin, Geom::Point normal)
 
Gtk::EventSequenceState _rulerButtonPress (Gtk::GestureClick const &gesture, int n_press, double x, double y)
 
Gtk::EventSequenceState _rulerButtonRelease (Gtk::GestureClick const &gesture, int n_press, double x, double y, RulerOrientation orientation)
 
void _rulerMotion (Gtk::EventControllerMotion const &controller, double x, double y, RulerOrientation orientation)
 
void _blinkLockButton ()
 
void _adjustmentChanged ()
 

Private Attributes

PrefObserver _box_observer
 
Gtk::Label * _quick_preview_label = nullptr
 
Gtk::Label * _quick_zoom_label = nullptr
 
Inkscape::Util::ActionAccel _preview_accel {"tool.all.quick-preview"}
 
Inkscape::Util::ActionAccel _zoom_accel {"tool.all.quick-zoom"}
 
Inkscape::UI::Widget::PopoverBin _popoverbin
 
Inkscape::UI::Widget::Canvas_canvas = nullptr
 
std::unique_ptr< Dialog::CommandPalette_command_palette
 
CanvasNotice_notice
 
Gtk::Overlay _canvas_overlay
 
Gtk::Grid _subgrid
 
Inkscape::UI::Widget::Stack_canvas_stack
 
std::unique_ptr< Inkscape::UI::Widget::TabsWidget_tabs_widget
 
Glib::RefPtr< Gtk::Adjustment > _hadj
 
Glib::RefPtr< Gtk::Adjustment > _vadj
 
Gtk::Scrollbar _hscrollbar
 
Gtk::Scrollbar _vscrollbar
 
std::unique_ptr< Inkscape::UI::Widget::Ruler_hruler
 
std::unique_ptr< Inkscape::UI::Widget::Ruler_vruler
 
Gtk::ToggleButton _guide_lock
 
Gtk::ToggleButton _cms_adjust
 
Gtk::MenuButton _quick_actions
 
Glib::RefPtr< Gtk::Builder > _builder_display_popup
 
bool _show_scrollbars = true
 
bool _show_rulers = true
 
SPDesktopWidget_dtw
 
SPDocument_document = nullptr
 
int _width {}
 
int _height {}
 
sigc::scoped_connection _update_preview_connection
 
sigc::scoped_connection _update_zoom_connection
 
sigc::scoped_connection _page_selected_connection
 
sigc::scoped_connection _page_modified_connection
 
sigc::scoped_connection _sel_changed_connection
 
sigc::scoped_connection _sel_modified_connection
 
sigc::scoped_connection _blink_lock_button_timeout
 
bool _ruler_clicked = false
 True if the ruler has been clicked.
 
bool _ruler_dragged = false
 True if a drag on the ruler is occurring.
 
bool _ruler_ctrl_clicked = false
 Whether ctrl was held when the ruler was clicked.
 
Geom::IntPoint _ruler_drag_origin
 Position of start of drag.
 
Geom::Point _normal
 Normal to the guide currently being handled during ruler event.
 
CanvasItemPtr< CanvasItemGuideLine_active_guide
 The guide being handled during a ruler event.
 
bool _updating = false
 

Detailed Description

A Gtk::Grid widget that contains rulers, scrollbars, buttons, and, of course, the canvas.

Canvas has an overlay to let us put stuff on the canvas.

Definition at line 69 of file canvas-grid.h.

Member Typedef Documentation

◆ parent_type

Definition at line 71 of file canvas-grid.h.

Member Enumeration Documentation

◆ RulerOrientation

Enumerator
vertical 
horizontal 

Definition at line 181 of file canvas-grid.h.

Constructor & Destructor Documentation

◆ CanvasGrid()

◆ ~CanvasGrid()

Inkscape::UI::Widget::CanvasGrid::~CanvasGrid ( )
overridedefault

Member Function Documentation

◆ _adjustmentChanged()

void Inkscape::UI::Widget::CanvasGrid::_adjustmentChanged ( )
private

Definition at line 791 of file canvas-grid.cpp.

References _dtw, _hadj, _updating, _vadj, SPDesktopWidget::get_desktop(), and SPDesktop::scroll_absolute().

Referenced by CanvasGrid().

◆ _blinkLockButton()

void Inkscape::UI::Widget::CanvasGrid::_blinkLockButton ( )
private

Definition at line 718 of file canvas-grid.cpp.

References _blink_lock_button_timeout, and _guide_lock.

Referenced by _createGuide().

◆ _createGuide()

◆ _createGuideItem()

◆ _rulerButtonPress()

Gtk::EventSequenceState Inkscape::UI::Widget::CanvasGrid::_rulerButtonPress ( Gtk::GestureClick const &  gesture,
int  n_press,
double  x,
double  y 
)
private

◆ _rulerButtonRelease()

◆ _rulerMotion()

void Inkscape::UI::Widget::CanvasGrid::_rulerMotion ( Gtk::EventControllerMotion const &  controller,
double  x,
double  y,
RulerOrientation  orientation 
)
private

◆ _rulerToCanvas()

Geom::IntPoint Inkscape::UI::Widget::CanvasGrid::_rulerToCanvas ( bool  horiz) const
private

Definition at line 464 of file canvas-grid.cpp.

References _canvas, _hruler, _vruler, result, and Geom::Point::round().

Referenced by _rulerButtonRelease(), and _rulerMotion().

◆ addTab()

void Inkscape::UI::Widget::CanvasGrid::addTab ( Canvas canvas)

Definition at line 225 of file canvas-grid.cpp.

References _canvas_stack, and Inkscape::UI::Widget::Stack::add().

Referenced by SPDesktopWidget::addDesktop().

◆ GetCanvas()

Canvas * Inkscape::UI::Widget::CanvasGrid::GetCanvas ( )
inline

Definition at line 95 of file canvas-grid.h.

References _canvas.

◆ GetCmsAdjust()

Gtk::ToggleButton * Inkscape::UI::Widget::CanvasGrid::GetCmsAdjust ( )
inline

Definition at line 103 of file canvas-grid.h.

References _cms_adjust.

◆ getCommandPalette()

Dialog::CommandPalette * Inkscape::UI::Widget::CanvasGrid::getCommandPalette ( )
inline

Definition at line 105 of file canvas-grid.h.

References _command_palette.

◆ GetGuideLock()

Gtk::ToggleButton * Inkscape::UI::Widget::CanvasGrid::GetGuideLock ( )
inline

Definition at line 102 of file canvas-grid.h.

References _guide_lock.

◆ GetHAdj()

Gtk::Adjustment * Inkscape::UI::Widget::CanvasGrid::GetHAdj ( )
inline

Definition at line 100 of file canvas-grid.h.

References _hadj.

◆ GetHRuler()

Inkscape::UI::Widget::Ruler * Inkscape::UI::Widget::CanvasGrid::GetHRuler ( )
inline

Definition at line 98 of file canvas-grid.h.

References _vruler.

Referenced by SPDesktopWidget::_updateUnit().

◆ GetStickyZoom()

Gtk::CheckButton * Inkscape::UI::Widget::CanvasGrid::GetStickyZoom ( )

◆ getTabsWidget()

◆ GetVAdj()

Gtk::Adjustment * Inkscape::UI::Widget::CanvasGrid::GetVAdj ( )
inline

Definition at line 101 of file canvas-grid.h.

References _vadj.

◆ GetVRuler()

Inkscape::UI::Widget::Ruler * Inkscape::UI::Widget::CanvasGrid::GetVRuler ( )
inline

Definition at line 99 of file canvas-grid.h.

References _hruler.

Referenced by SPDesktopWidget::_updateUnit().

◆ on_realize()

void Inkscape::UI::Widget::CanvasGrid::on_realize ( )
overrideprivate

◆ removeTab()

void Inkscape::UI::Widget::CanvasGrid::removeTab ( Canvas canvas)

◆ rulerMotion()

◆ setPopover()

void Inkscape::UI::Widget::CanvasGrid::setPopover ( Gtk::Popover *  popover)
inline

Definition at line 89 of file canvas-grid.h.

References _popoverbin, and Inkscape::UI::Widget::PopoverBin::setPopover().

◆ ShowCommandPalette()

void Inkscape::UI::Widget::CanvasGrid::ShowCommandPalette ( bool  state = true)

Definition at line 442 of file canvas-grid.cpp.

References _command_palette.

Referenced by SPDesktopWidget::SPDesktopWidget().

◆ showNotice()

void Inkscape::UI::Widget::CanvasGrid::showNotice ( Glib::ustring const &  msg,
int  timeout = 0 
)

◆ ShowRulers()

void Inkscape::UI::Widget::CanvasGrid::ShowRulers ( bool  state = true)

Definition at line 409 of file canvas-grid.cpp.

References _guide_lock, _hruler, _show_rulers, and _vruler.

Referenced by SPDesktopWidget::layoutWidgets(), and ToggleRulers().

◆ ShowScrollbars()

void Inkscape::UI::Widget::CanvasGrid::ShowScrollbars ( bool  state = true)

◆ size_allocate_vfunc()

void Inkscape::UI::Widget::CanvasGrid::size_allocate_vfunc ( int  width,
int  height,
int  baseline 
)
overrideprivate

Definition at line 453 of file canvas-grid.cpp.

References _height, _width, Inkscape::UI::Widget::height, updateRulers(), and width.

◆ switchTab()

void Inkscape::UI::Widget::CanvasGrid::switchTab ( Canvas canvas)

◆ ToggleCommandPalette()

void Inkscape::UI::Widget::CanvasGrid::ToggleCommandPalette ( )

Definition at line 431 of file canvas-grid.cpp.

References _command_palette.

Referenced by SPDesktopWidget::toggle_command_palette().

◆ ToggleRulers()

void Inkscape::UI::Widget::CanvasGrid::ToggleRulers ( )

Definition at line 420 of file canvas-grid.cpp.

References _show_rulers, Inkscape::Preferences::get(), and ShowRulers().

Referenced by SPDesktopWidget::toggle_rulers().

◆ ToggleScrollbars()

void Inkscape::UI::Widget::CanvasGrid::ToggleScrollbars ( )

◆ updateRulers()

◆ updateScrollbars()

Member Data Documentation

◆ _active_guide

CanvasItemPtr<CanvasItemGuideLine> Inkscape::UI::Widget::CanvasGrid::_active_guide
private

The guide being handled during a ruler event.

Definition at line 175 of file canvas-grid.h.

Referenced by _createGuideItem(), _rulerButtonRelease(), and rulerMotion().

◆ _blink_lock_button_timeout

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_blink_lock_button_timeout
private

Definition at line 167 of file canvas-grid.h.

Referenced by _blinkLockButton().

◆ _box_observer

PrefObserver Inkscape::UI::Widget::CanvasGrid::_box_observer
private

Definition at line 119 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _builder_display_popup

Glib::RefPtr<Gtk::Builder> Inkscape::UI::Widget::CanvasGrid::_builder_display_popup
private

Definition at line 147 of file canvas-grid.h.

Referenced by CanvasGrid(), and GetStickyZoom().

◆ _canvas

Inkscape::UI::Widget::Canvas* Inkscape::UI::Widget::CanvasGrid::_canvas = nullptr
private

◆ _canvas_overlay

Gtk::Overlay Inkscape::UI::Widget::CanvasGrid::_canvas_overlay
private

Definition at line 131 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _canvas_stack

Inkscape::UI::Widget::Stack* Inkscape::UI::Widget::CanvasGrid::_canvas_stack
private

Definition at line 133 of file canvas-grid.h.

Referenced by addTab(), CanvasGrid(), removeTab(), and switchTab().

◆ _cms_adjust

Gtk::ToggleButton Inkscape::UI::Widget::CanvasGrid::_cms_adjust
private

Definition at line 145 of file canvas-grid.h.

Referenced by CanvasGrid(), GetCmsAdjust(), and ShowScrollbars().

◆ _command_palette

std::unique_ptr<Dialog::CommandPalette> Inkscape::UI::Widget::CanvasGrid::_command_palette
private

◆ _document

SPDocument* Inkscape::UI::Widget::CanvasGrid::_document = nullptr
private

Definition at line 155 of file canvas-grid.h.

Referenced by updateRulers().

◆ _dtw

SPDesktopWidget* Inkscape::UI::Widget::CanvasGrid::_dtw
private

◆ _guide_lock

Gtk::ToggleButton Inkscape::UI::Widget::CanvasGrid::_guide_lock
private

Definition at line 144 of file canvas-grid.h.

Referenced by _blinkLockButton(), CanvasGrid(), GetGuideLock(), and ShowRulers().

◆ _hadj

Glib::RefPtr<Gtk::Adjustment> Inkscape::UI::Widget::CanvasGrid::_hadj
private

Definition at line 136 of file canvas-grid.h.

Referenced by _adjustmentChanged(), CanvasGrid(), GetHAdj(), and updateScrollbars().

◆ _height

int Inkscape::UI::Widget::CanvasGrid::_height {}
private

Definition at line 158 of file canvas-grid.h.

Referenced by size_allocate_vfunc().

◆ _hruler

std::unique_ptr<Inkscape::UI::Widget::Ruler> Inkscape::UI::Widget::CanvasGrid::_hruler
private

◆ _hscrollbar

Gtk::Scrollbar Inkscape::UI::Widget::CanvasGrid::_hscrollbar
private

Definition at line 138 of file canvas-grid.h.

Referenced by CanvasGrid(), and ShowScrollbars().

◆ _normal

Geom::Point Inkscape::UI::Widget::CanvasGrid::_normal
private

Normal to the guide currently being handled during ruler event.

Definition at line 174 of file canvas-grid.h.

Referenced by _createGuideItem(), _rulerButtonRelease(), and rulerMotion().

◆ _notice

CanvasNotice* Inkscape::UI::Widget::CanvasGrid::_notice
private

Definition at line 130 of file canvas-grid.h.

Referenced by CanvasGrid(), and showNotice().

◆ _page_modified_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_page_modified_connection
private

Definition at line 164 of file canvas-grid.h.

Referenced by updateRulers().

◆ _page_selected_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_page_selected_connection
private

Definition at line 163 of file canvas-grid.h.

Referenced by updateRulers().

◆ _popoverbin

Inkscape::UI::Widget::PopoverBin Inkscape::UI::Widget::CanvasGrid::_popoverbin
private

Definition at line 127 of file canvas-grid.h.

Referenced by CanvasGrid(), and setPopover().

◆ _preview_accel

Inkscape::Util::ActionAccel Inkscape::UI::Widget::CanvasGrid::_preview_accel {"tool.all.quick-preview"}
private

Definition at line 124 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _quick_actions

Gtk::MenuButton Inkscape::UI::Widget::CanvasGrid::_quick_actions
private

Definition at line 146 of file canvas-grid.h.

Referenced by CanvasGrid(), on_realize(), and ShowScrollbars().

◆ _quick_preview_label

Gtk::Label* Inkscape::UI::Widget::CanvasGrid::_quick_preview_label = nullptr
private

Definition at line 122 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _quick_zoom_label

Gtk::Label* Inkscape::UI::Widget::CanvasGrid::_quick_zoom_label = nullptr
private

Definition at line 123 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _ruler_clicked

bool Inkscape::UI::Widget::CanvasGrid::_ruler_clicked = false
private

True if the ruler has been clicked.

Definition at line 170 of file canvas-grid.h.

Referenced by _rulerButtonPress(), _rulerButtonRelease(), and _rulerMotion().

◆ _ruler_ctrl_clicked

bool Inkscape::UI::Widget::CanvasGrid::_ruler_ctrl_clicked = false
private

Whether ctrl was held when the ruler was clicked.

Definition at line 172 of file canvas-grid.h.

Referenced by _createGuideItem(), and _rulerButtonPress().

◆ _ruler_drag_origin

Geom::IntPoint Inkscape::UI::Widget::CanvasGrid::_ruler_drag_origin
private

Position of start of drag.

Definition at line 173 of file canvas-grid.h.

Referenced by _rulerButtonPress(), and _rulerMotion().

◆ _ruler_dragged

bool Inkscape::UI::Widget::CanvasGrid::_ruler_dragged = false
private

True if a drag on the ruler is occurring.

Definition at line 171 of file canvas-grid.h.

Referenced by _rulerButtonPress(), _rulerButtonRelease(), and _rulerMotion().

◆ _sel_changed_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_sel_changed_connection
private

Definition at line 165 of file canvas-grid.h.

Referenced by updateRulers().

◆ _sel_modified_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_sel_modified_connection
private

Definition at line 166 of file canvas-grid.h.

Referenced by updateRulers().

◆ _show_rulers

bool Inkscape::UI::Widget::CanvasGrid::_show_rulers = true
private

Definition at line 151 of file canvas-grid.h.

Referenced by ShowRulers(), and ToggleRulers().

◆ _show_scrollbars

bool Inkscape::UI::Widget::CanvasGrid::_show_scrollbars = true
private

Definition at line 150 of file canvas-grid.h.

Referenced by ShowScrollbars(), and ToggleScrollbars().

◆ _subgrid

Gtk::Grid Inkscape::UI::Widget::CanvasGrid::_subgrid
private

Definition at line 132 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _tabs_widget

std::unique_ptr<Inkscape::UI::Widget::TabsWidget> Inkscape::UI::Widget::CanvasGrid::_tabs_widget
private

Definition at line 134 of file canvas-grid.h.

Referenced by CanvasGrid(), and getTabsWidget().

◆ _update_preview_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_update_preview_connection
private

Definition at line 161 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _update_zoom_connection

sigc::scoped_connection Inkscape::UI::Widget::CanvasGrid::_update_zoom_connection
private

Definition at line 162 of file canvas-grid.h.

Referenced by CanvasGrid().

◆ _updating

bool Inkscape::UI::Widget::CanvasGrid::_updating = false
private

Definition at line 191 of file canvas-grid.h.

Referenced by _adjustmentChanged(), and updateScrollbars().

◆ _vadj

Glib::RefPtr<Gtk::Adjustment> Inkscape::UI::Widget::CanvasGrid::_vadj
private

Definition at line 137 of file canvas-grid.h.

Referenced by _adjustmentChanged(), CanvasGrid(), GetVAdj(), and updateScrollbars().

◆ _vruler

std::unique_ptr<Inkscape::UI::Widget::Ruler> Inkscape::UI::Widget::CanvasGrid::_vruler
private

◆ _vscrollbar

Gtk::Scrollbar Inkscape::UI::Widget::CanvasGrid::_vscrollbar
private

Definition at line 139 of file canvas-grid.h.

Referenced by CanvasGrid(), and ShowScrollbars().

◆ _width

int Inkscape::UI::Widget::CanvasGrid::_width {}
private

Definition at line 158 of file canvas-grid.h.

Referenced by size_allocate_vfunc().

◆ _zoom_accel

Inkscape::Util::ActionAccel Inkscape::UI::Widget::CanvasGrid::_zoom_accel {"tool.all.quick-zoom"}
private

Definition at line 125 of file canvas-grid.h.

Referenced by CanvasGrid().


The documentation for this class was generated from the following files: