Inkscape
Vector Graphics Editor
|
A light-weight widget containing an Inkscape canvas for rendering an SVG. More...
#include <svg-view-widget.h>
Public Member Functions | |
SVGViewWidget (SPDocument *document=nullptr) | |
~SVGViewWidget () override | |
void | setDocument (SPDocument *document) |
void | setResize (int width, int height) |
![]() | |
Bin (Gtk::Widget *child=nullptr) | |
Bin (BaseObjectType *cobject, Glib::RefPtr< Gtk::Builder > const &) | |
Gtk::Widget * | get_child () |
Gets the child widget, or nullptr if none. | |
Gtk::Widget const * | get_child () const |
Gets the child widget, or nullptr if none. | |
void | set_child (Gtk::Widget *child) |
Sets (parents) the child widget, or unsets (unparents) it if child is null. | |
void | set_child (Gtk::Widget &child) |
Convenience function: Sets (parents) the child widget. | |
void | unset_child () |
Convenience function: Unsets (unparents) the child widget. | |
template<typename F > | |
sigc::connection | connectBeforeResize (F &&slot) |
Register a handler to run immediately before a resize operation. | |
template<typename F > | |
sigc::connection | connectAfterResize (F &&slot) |
Register a handler to run immediately after a resize operation. | |
Protected Member Functions | |
void | on_size_allocate (int width, int height, int baseline) override |
![]() | |
void | measure_vfunc (Gtk::Orientation orientation, int for_size, int &min, int &nat, int &min_baseline, int &nat_baseline) const override |
Private Member Functions | |
bool | event (CanvasEvent const &event, DrawingItem *drawing_item) |
Callback connected with drawing_event. | |
void | doRescale () |
Helper function that sets rescale ratio. | |
Private Attributes | |
std::unique_ptr< UI::Widget::Canvas > | _canvas |
bool | _clicking = false |
SPDocument * | _document = nullptr |
unsigned | _dkey = 0 |
CanvasItemGroup * | _parent = nullptr |
CanvasItemDrawing * | _drawing = nullptr |
double | _hscale = 1.0 |
Horizontal scale. | |
double | _vscale = 1.0 |
Vertical scale. | |
bool | _rescale = true |
Whether to rescale automatically. | |
bool | _keepaspect = true |
double | _width = 0.0 |
double | _height = 0.0 |
A light-weight widget containing an Inkscape canvas for rendering an SVG.
Definition at line 42 of file svg-view-widget.h.
Inkscape::UI::View::SVGViewWidget::SVGViewWidget | ( | SPDocument * | document = nullptr | ) |
Definition at line 42 of file svg-view-widget.cpp.
References _canvas, _drawing, Inkscape::CanvasItemDrawing::connect_drawing_event(), event(), Inkscape::CanvasItemDrawing::get_drawing(), Inkscape::UI::Widget::Bin::set_child(), Inkscape::UI::set_expand(), Inkscape::Drawing::setCursorTolerance(), and setDocument().
|
override |
Definition at line 58 of file svg-view-widget.cpp.
References setDocument().
|
private |
Helper function that sets rescale ratio.
Definition at line 165 of file svg-view-widget.cpp.
References _canvas, _document, _drawing, _height, _hscale, _keepaspect, _rescale, _vscale, _width, SPDocument::getHeight(), SPDocument::getWidth(), and Inkscape::Util::Quantity::value().
Referenced by on_size_allocate(), and setDocument().
|
private |
Callback connected with drawing_event.
Results in a cursor change over links, and allows clicking them.
Definition at line 127 of file svg-view-widget.cpp.
References _clicking, event(), Inkscape::DrawingItem::getItem(), and Inkscape::inspect_event().
Referenced by event(), and SVGViewWidget().
|
overrideprotectedvirtual |
Reimplemented from Inkscape::UI::Widget::Bin.
Definition at line 107 of file svg-view-widget.cpp.
References _document, _height, _width, doRescale(), height, and width.
void Inkscape::UI::View::SVGViewWidget::setDocument | ( | SPDocument * | document | ) |
Definition at line 74 of file svg-view-widget.cpp.
References _dkey, _document, _drawing, doRescale(), Inkscape::CanvasItemDrawing::get_drawing(), SPDocument::getRoot(), SPItem::invoke_hide(), SPItem::invoke_show(), Inkscape::DrawingItem::prependChild(), Inkscape::Drawing::root(), and Inkscape::UI::View::set_layer_modes().
Referenced by Inkscape::Extension::Internal::RvngImportDialog::_setPreviewPage(), InkviewWindow::show_document(), SVGViewWidget(), and ~SVGViewWidget().
void Inkscape::UI::View::SVGViewWidget::setResize | ( | int | width, |
int | height | ||
) |
Definition at line 100 of file svg-view-widget.cpp.
Referenced by Inkscape::Extension::Internal::RvngImportDialog::RvngImportDialog().
|
private |
Definition at line 55 of file svg-view-widget.h.
Referenced by doRescale(), and SVGViewWidget().
|
private |
Definition at line 56 of file svg-view-widget.h.
Referenced by event().
|
private |
Definition at line 59 of file svg-view-widget.h.
Referenced by setDocument().
|
private |
Definition at line 58 of file svg-view-widget.h.
Referenced by doRescale(), on_size_allocate(), and setDocument().
|
private |
Definition at line 61 of file svg-view-widget.h.
Referenced by doRescale(), setDocument(), and SVGViewWidget().
|
private |
Definition at line 67 of file svg-view-widget.h.
Referenced by doRescale(), and on_size_allocate().
|
private |
|
private |
Definition at line 65 of file svg-view-widget.h.
Referenced by doRescale().
|
private |
Definition at line 60 of file svg-view-widget.h.
|
private |
Whether to rescale automatically.
Definition at line 64 of file svg-view-widget.h.
Referenced by doRescale().
|
private |
|
private |
Definition at line 66 of file svg-view-widget.h.
Referenced by doRescale(), and on_size_allocate().