Inkscape
Vector Graphics Editor
|
A Gtk::Grid widget that contains rulers, scrollbars, buttons, and, of course, the canvas. More...
#include <canvas-grid.h>
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) |
Canvas * | GetCanvas () |
Inkscape::UI::Widget::Ruler * | GetHRuler () |
Inkscape::UI::Widget::Ruler * | GetVRuler () |
Gtk::Adjustment * | GetHAdj () |
Gtk::Adjustment * | GetVAdj () |
Gtk::ToggleButton * | GetGuideLock () |
Gtk::ToggleButton * | GetCmsAdjust () |
Gtk::CheckButton * | GetStickyZoom () |
Dialog::CommandPalette * | getCommandPalette () |
Inkscape::UI::Widget::TabsWidget * | getTabsWidget () |
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 |
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.
|
private |
Definition at line 71 of file canvas-grid.h.
|
strongprivate |
Enumerator | |
---|---|
vertical | |
horizontal |
Definition at line 181 of file canvas-grid.h.
Inkscape::UI::Widget::CanvasGrid::CanvasGrid | ( | SPDesktopWidget * | dtw | ) |
Definition at line 63 of file canvas-grid.cpp.
References _adjustmentChanged(), _box_observer, _builder_display_popup, _canvas_overlay, _canvas_stack, _cms_adjust, _command_palette, _dtw, _guide_lock, _hadj, _hruler, _hscrollbar, _notice, _popoverbin, _preview_accel, _quick_actions, _quick_preview_label, _quick_zoom_label, _rulerButtonPress(), _rulerButtonRelease(), _rulerMotion(), _subgrid, _tabs_widget, _update_preview_connection, _update_zoom_connection, _vadj, _vruler, _vscrollbar, _zoom_accel, Inkscape::Util::ActionAccel::connectModified(), Inkscape::UI::Widget::CanvasNotice::create(), Inkscape::UI::create_builder(), Inkscape::MessageContext::flash(), Inkscape::Preferences::get(), SPDesktopWidget::get_desktop(), Inkscape::Util::ActionAccel::getShortcutText(), SPDesktop::guidesMessageContext(), horizontal, ink_drag_setup(), Inkscape::NORMAL_MESSAGE, Inkscape::UI::Widget::PopoverBin::setChild(), SPDesktopWidget::sticky_zoom_toggled(), updateRulers(), Inkscape::UI::Controller::use_state(), and vertical.
|
overridedefault |
|
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().
|
private |
Definition at line 718 of file canvas-grid.cpp.
References _blink_lock_button_timeout, and _guide_lock.
Referenced by _createGuide().
|
private |
Definition at line 638 of file canvas-grid.cpp.
References _blinkLockButton(), _dtw, SPObject::appendChild(), SVGLength::computed, Inkscape::XML::Document::createElement(), desktop, SPDesktop::doc(), Inkscape::DocumentUndo::done(), SPDesktopWidget::get_desktop(), SPDesktop::getDocument(), SPDocument::getHeight(), SPNamedView::getLockGuides(), SPDesktop::getNamedView(), SPDocument::getReprDoc(), SPDocument::getRoot(), SPDesktop::is_yaxisdown(), origin, Inkscape::GC::release(), root, SPNamedView::setLockGuides(), Inkscape::Util::Quantity::value(), and SPDimensions::x.
Referenced by _rulerButtonRelease().
|
private |
Definition at line 489 of file canvas-grid.cpp.
References _active_guide, _canvas, _dtw, _normal, _ruler_ctrl_clicked, AXONOMETRIC, Geom::Point::cw(), desktop, SPDesktopWidget::get_desktop(), SPDesktop::getCanvasGuides(), SPNamedView::getFirstEnabledGrid(), SPNamedView::getGuideHiColor(), SPDesktop::getNamedView(), Geom::Point::normalized(), SPNamedView::setShowGuides(), Geom::Point::x(), Geom::Point::y(), and SPDesktop::yaxisdir().
Referenced by _rulerMotion().
|
private |
Definition at line 472 of file canvas-grid.cpp.
References _ruler_clicked, _ruler_ctrl_clicked, _ruler_drag_origin, _ruler_dragged, Geom::Point::floor(), and Inkscape::UI::Controller::has_flag().
Referenced by CanvasGrid().
|
private |
Definition at line 671 of file canvas-grid.cpp.
References _active_guide, _canvas, _createGuide(), _dtw, _normal, _ruler_clicked, _ruler_dragged, _rulerToCanvas(), Inkscape::UI::Widget::Canvas::canvas_to_world(), desktop, Inkscape::UI::Tools::ToolBase::discard_delayed_snap_event(), SPDesktopWidget::get_desktop(), SPDesktop::getNamedView(), SPDesktop::getTool(), horizontal, Inkscape::UI::Widget::ruler_snap_new_guide(), SPDesktop::set_coordinate_status(), SPNamedView::toggleShowGuides(), SPDesktop::w2d(), Geom::X, and Geom::Y.
Referenced by CanvasGrid().
|
private |
Definition at line 538 of file canvas-grid.cpp.
References _createGuideItem(), _ruler_clicked, _ruler_drag_origin, _ruler_dragged, _rulerToCanvas(), Inkscape::extinput_from_gdkevent(), floor(), Inkscape::Preferences::get(), horizontal, Geom::LInfty(), and rulerMotion().
Referenced by CanvasGrid().
|
private |
Definition at line 464 of file canvas-grid.cpp.
References _canvas, _hruler, _vruler, result, and Geom::Point::round().
Referenced by _rulerButtonRelease(), and _rulerMotion().
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().
|
inline |
Definition at line 95 of file canvas-grid.h.
References _canvas.
|
inline |
Definition at line 103 of file canvas-grid.h.
References _cms_adjust.
|
inline |
Definition at line 105 of file canvas-grid.h.
References _command_palette.
|
inline |
Definition at line 102 of file canvas-grid.h.
References _guide_lock.
|
inline |
Definition at line 100 of file canvas-grid.h.
References _hadj.
|
inline |
Definition at line 98 of file canvas-grid.h.
References _vruler.
Referenced by SPDesktopWidget::_updateUnit().
Gtk::CheckButton * Inkscape::UI::Widget::CanvasGrid::GetStickyZoom | ( | ) |
Definition at line 317 of file canvas-grid.cpp.
References _builder_display_popup.
Referenced by SPDesktopWidget::sticky_zoom_toggled(), and SPDesktopWidget::sticky_zoom_updated().
|
inline |
Definition at line 106 of file canvas-grid.h.
References _tabs_widget.
Referenced by SPDesktopWidget::addDesktop(), SPDesktopWidget::advanceTab(), SPDesktopWidget::desktopChangedDocument(), SPDesktopWidget::desktopChangedTitle(), SPDesktopWidget::removeDesktop(), and SPDesktopWidget::switchDesktop().
|
inline |
Definition at line 101 of file canvas-grid.h.
References _vadj.
|
inline |
Definition at line 99 of file canvas-grid.h.
References _hruler.
Referenced by SPDesktopWidget::_updateUnit().
|
overrideprivate |
Definition at line 255 of file canvas-grid.cpp.
References _dtw, _quick_actions, SPDesktopWidget::get_action_map(), map, Inkscape::NO_FILTERS, Inkscape::NORMAL, Inkscape::OUTLINE, Inkscape::OUTLINE_OVERLAY, and Inkscape::VISIBLE_HAIRLINES.
void Inkscape::UI::Widget::CanvasGrid::removeTab | ( | Canvas * | canvas | ) |
Definition at line 233 of file canvas-grid.cpp.
References _canvas_stack, and Inkscape::UI::Widget::Stack::remove().
Referenced by SPDesktopWidget::removeDesktop().
void Inkscape::UI::Widget::CanvasGrid::rulerMotion | ( | MotionEvent const & | event, |
bool | horiz | ||
) |
Definition at line 611 of file canvas-grid.cpp.
References _active_guide, _canvas, _dtw, _normal, Inkscape::UI::Widget::Canvas::canvas_to_world(), desktop, SPDesktopWidget::get_desktop(), SPDesktop::getTool(), Inkscape::UI::Tools::DelayedSnapEvent::GUIDE_HRULER, Inkscape::UI::Tools::DelayedSnapEvent::GUIDE_VRULER, Inkscape::CanvasEvent::modifiers, origin, Inkscape::MotionEvent::pos, Inkscape::UI::Widget::ruler_snap_new_guide(), SPDesktop::set_coordinate_status(), Inkscape::UI::Tools::ToolBase::snap_delay_handler(), and SPDesktop::w2d().
Referenced by _rulerMotion(), and Inkscape::UI::Tools::ToolBase::process_delayed_snap_event().
|
inline |
Definition at line 89 of file canvas-grid.h.
References _popoverbin, and Inkscape::UI::Widget::PopoverBin::setPopover().
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().
void Inkscape::UI::Widget::CanvasGrid::showNotice | ( | Glib::ustring const & | msg, |
int | timeout = 0 |
||
) |
Definition at line 436 of file canvas-grid.cpp.
References _notice, msg, Inkscape::UI::Widget::CanvasNotice::show(), and timeout.
Referenced by SPDesktopWidget::showNotice().
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().
void Inkscape::UI::Widget::CanvasGrid::ShowScrollbars | ( | bool | state = true | ) |
Definition at line 385 of file canvas-grid.cpp.
References _cms_adjust, _hscrollbar, _quick_actions, _show_scrollbars, and _vscrollbar.
Referenced by SPDesktopWidget::layoutWidgets(), and ToggleScrollbars().
|
overrideprivate |
Definition at line 453 of file canvas-grid.cpp.
References _height, _width, Inkscape::UI::Widget::height, updateRulers(), and width.
void Inkscape::UI::Widget::CanvasGrid::switchTab | ( | Canvas * | canvas | ) |
Definition at line 238 of file canvas-grid.cpp.
References _canvas, _canvas_stack, _hruler, _vruler, and Inkscape::UI::Widget::Stack::setActive().
Referenced by SPDesktopWidget::switchDesktop().
void Inkscape::UI::Widget::CanvasGrid::ToggleCommandPalette | ( | ) |
Definition at line 431 of file canvas-grid.cpp.
References _command_palette.
Referenced by SPDesktopWidget::toggle_command_palette().
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().
void Inkscape::UI::Widget::CanvasGrid::ToggleScrollbars | ( | ) |
Definition at line 397 of file canvas-grid.cpp.
References _show_scrollbars, Inkscape::Preferences::get(), and ShowScrollbars().
Referenced by SPDesktopWidget::toggle_scrollbars().
void Inkscape::UI::Widget::CanvasGrid::updateRulers | ( | ) |
Definition at line 323 of file canvas-grid.cpp.
References _canvas, _document, _dtw, _hruler, _page_modified_connection, _page_selected_connection, _sel_changed_connection, _sel_modified_connection, _vruler, Geom::GenericRect< C >::bottom(), SPDocument::connectModified(), SPDesktop::d2w(), desktop, Inkscape::UI::Widget::Canvas::get_affine(), Inkscape::UI::Widget::Canvas::get_area_world(), SPDesktopWidget::get_desktop(), SPDesktopWidget::get_dt2r(), Inkscape::UI::Widget::Canvas::get_pos(), SPDesktop::getDocument(), SPDocument::getPageManager(), SPDesktop::getSelection(), SPDesktop::is_yaxisdown(), Geom::GenericRect< C >::left(), Geom::GenericRect< C >::right(), Geom::GenericRect< C >::top(), and updateRulers().
Referenced by SPDesktopWidget::_updateUnit(), CanvasGrid(), SPDesktop::scroll_absolute(), SPDesktop::set_display_area(), size_allocate_vfunc(), SPDesktopWidget::switchDesktop(), and updateRulers().
void Inkscape::UI::Widget::CanvasGrid::updateScrollbars | ( | double | scale | ) |
Definition at line 743 of file canvas-grid.cpp.
References _canvas, _dtw, _hadj, _updating, _vadj, desktop, SPDesktop::doc(), Inkscape::Preferences::get(), Inkscape::UI::Widget::Canvas::get_area_world(), SPDesktopWidget::get_desktop(), SPDocument::preferredBounds(), scale, Inkscape::UI::Widget::set_adjustment(), and SPDesktop::yaxisdir().
Referenced by SPDesktop::scroll_absolute(), and SPDesktop::set_display_area().
|
private |
The guide being handled during a ruler event.
Definition at line 175 of file canvas-grid.h.
Referenced by _createGuideItem(), _rulerButtonRelease(), and rulerMotion().
|
private |
Definition at line 167 of file canvas-grid.h.
Referenced by _blinkLockButton().
|
private |
Definition at line 119 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 147 of file canvas-grid.h.
Referenced by CanvasGrid(), and GetStickyZoom().
|
private |
Definition at line 128 of file canvas-grid.h.
Referenced by _createGuideItem(), _rulerButtonRelease(), _rulerToCanvas(), GetCanvas(), rulerMotion(), switchTab(), updateRulers(), and updateScrollbars().
|
private |
Definition at line 131 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 133 of file canvas-grid.h.
Referenced by addTab(), CanvasGrid(), removeTab(), and switchTab().
|
private |
Definition at line 145 of file canvas-grid.h.
Referenced by CanvasGrid(), GetCmsAdjust(), and ShowScrollbars().
|
private |
Definition at line 129 of file canvas-grid.h.
Referenced by CanvasGrid(), getCommandPalette(), ShowCommandPalette(), and ToggleCommandPalette().
|
private |
Definition at line 155 of file canvas-grid.h.
Referenced by updateRulers().
|
private |
Definition at line 154 of file canvas-grid.h.
Referenced by _adjustmentChanged(), _createGuide(), _createGuideItem(), _rulerButtonRelease(), CanvasGrid(), on_realize(), rulerMotion(), updateRulers(), and updateScrollbars().
|
private |
Definition at line 144 of file canvas-grid.h.
Referenced by _blinkLockButton(), CanvasGrid(), GetGuideLock(), and ShowRulers().
|
private |
Definition at line 136 of file canvas-grid.h.
Referenced by _adjustmentChanged(), CanvasGrid(), GetHAdj(), and updateScrollbars().
|
private |
Definition at line 158 of file canvas-grid.h.
Referenced by size_allocate_vfunc().
|
private |
Definition at line 141 of file canvas-grid.h.
Referenced by _rulerToCanvas(), CanvasGrid(), GetVRuler(), ShowRulers(), switchTab(), and updateRulers().
|
private |
Definition at line 138 of file canvas-grid.h.
Referenced by CanvasGrid(), and ShowScrollbars().
|
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().
|
private |
Definition at line 130 of file canvas-grid.h.
Referenced by CanvasGrid(), and showNotice().
|
private |
Definition at line 164 of file canvas-grid.h.
Referenced by updateRulers().
|
private |
Definition at line 163 of file canvas-grid.h.
Referenced by updateRulers().
|
private |
Definition at line 127 of file canvas-grid.h.
Referenced by CanvasGrid(), and setPopover().
|
private |
Definition at line 124 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 146 of file canvas-grid.h.
Referenced by CanvasGrid(), on_realize(), and ShowScrollbars().
|
private |
Definition at line 122 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 123 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
True if the ruler has been clicked.
Definition at line 170 of file canvas-grid.h.
Referenced by _rulerButtonPress(), _rulerButtonRelease(), and _rulerMotion().
|
private |
Whether ctrl was held when the ruler was clicked.
Definition at line 172 of file canvas-grid.h.
Referenced by _createGuideItem(), and _rulerButtonPress().
|
private |
Position of start of drag.
Definition at line 173 of file canvas-grid.h.
Referenced by _rulerButtonPress(), and _rulerMotion().
|
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().
|
private |
Definition at line 165 of file canvas-grid.h.
Referenced by updateRulers().
|
private |
Definition at line 166 of file canvas-grid.h.
Referenced by updateRulers().
|
private |
Definition at line 151 of file canvas-grid.h.
Referenced by ShowRulers(), and ToggleRulers().
|
private |
Definition at line 150 of file canvas-grid.h.
Referenced by ShowScrollbars(), and ToggleScrollbars().
|
private |
Definition at line 132 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 134 of file canvas-grid.h.
Referenced by CanvasGrid(), and getTabsWidget().
|
private |
Definition at line 161 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 162 of file canvas-grid.h.
Referenced by CanvasGrid().
|
private |
Definition at line 191 of file canvas-grid.h.
Referenced by _adjustmentChanged(), and updateScrollbars().
|
private |
Definition at line 137 of file canvas-grid.h.
Referenced by _adjustmentChanged(), CanvasGrid(), GetVAdj(), and updateScrollbars().
|
private |
Definition at line 142 of file canvas-grid.h.
Referenced by _rulerToCanvas(), CanvasGrid(), GetHRuler(), ShowRulers(), switchTab(), and updateRulers().
|
private |
Definition at line 139 of file canvas-grid.h.
Referenced by CanvasGrid(), and ShowScrollbars().
|
private |
Definition at line 158 of file canvas-grid.h.
Referenced by size_allocate_vfunc().
|
private |
Definition at line 125 of file canvas-grid.h.
Referenced by CanvasGrid().