summaryrefslogtreecommitdiffstats
path: root/src/svg-view.h
blob: 93f2b7dfd7b6c7d4ab7780c11900d41dfccdf8f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef SEEN_SP_SVG_VIEW_H
#define SEEN_SP_SVG_VIEW_H
/*
 * Authors:
 *   Lauris Kaplinski <lauris@kaplinski.com>
 *   Ralf Stephan <ralf@ark.in-berlin.de>
 *
 * Copyright (C) 2001-2002 Lauris Kaplinski
 * Copyright (C) 2001 Ximian, Inc.
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "ui/view/view.h"

struct SPCanvasGroup;
struct SPCanvasItem;

/**
 * Generic SVG view.
 */
class SPSVGView : public Inkscape::UI::View::View {
public:	
    unsigned int    _dkey;
    SPCanvasGroup  *_parent;
    SPCanvasItem   *_drawing;
    double          _hscale;     ///< horizontal scale
    double          _vscale;     ///< vertical scale
    bool            _rescale;    ///< whether to rescale automatically
    bool            _keepaspect;
    double          _width;
    double          _height;


    /**
     * Constructs new SPSVGView object and returns pointer to it.
     */
    SPSVGView(SPCanvasGroup* parent);

    ~SPSVGView() override;
        
    /**
     * Rescales SPSVGView to given proportions.
     */
    void setScale(double hscale, double vscale);
    
    /**
     * Rescales SPSVGView and keeps aspect ratio.
     */
    void setRescale(bool rescale, bool keepaspect, double width, double height);

    /**
     * Helper function that sets rescale ratio and emits resize event.
     */
    void doRescale(bool event);

    /**
     * Callback connected with set_document signal.
     */
    void setDocument(SPDocument *document) override;

    void mouseover() override;

    void mouseout() override;

    bool shutdown() override { return true; }

private:
    virtual void onPositionSet(double, double) {}
    void onResized(double, double) override {}
    void onRedrawRequested() override {}
    void onStatusMessage(Inkscape::MessageType /*type*/, gchar const */*message*/) override {}
    void onDocumentURISet(gchar const* /*uri*/) override {}

    /**
     * Callback connected with document_resized signal.
     */
    void onDocumentResized(double, double) override;
};

#endif // SEEN_SP_SVG_VIEW_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :