Code

Fundamentally reworked version of the 3D box tool (among many other things, this...
[inkscape.git] / src / box3d-context.h
1 #ifndef __SP_BOX3D_CONTEXT_H__
2 #define __SP_BOX3D_CONTEXT_H__
4 /*
5  * 3D box drawing context
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 2000 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  * Copyright (C) 2002 Lauris Kaplinski
13  * Copyright (C) 2007 Maximilian Albert <Anhalter42@gmx.de>
14  *
15  * Released under GNU GPL
16  */
18 #include <sigc++/sigc++.h>
19 #include "event-context.h"
20 #include "proj_pt.h"
21 #include "vanishing-point.h"
23 struct SPKnotHolder;
25 #define SP_TYPE_BOX3D_CONTEXT            (sp_box3d_context_get_type ())
26 #define SP_BOX3D_CONTEXT(obj)            (GTK_CHECK_CAST ((obj), SP_TYPE_BOX3D_CONTEXT, Box3DContext))
27 #define SP_BOX3D_CONTEXT_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D_CONTEXT, Box3DContextClass))
28 #define SP_IS_BOX3D_CONTEXT(obj)         (GTK_CHECK_TYPE ((obj), SP_TYPE_BOX3D_CONTEXT))
29 #define SP_IS_BOX3D_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_CONTEXT))
31 class Box3DContext;
32 class Box3DContextClass;
34 struct Box3DContext : public SPEventContext {
35     SPItem *item;
36     NR::Point center;
38     /**
39      * save three corners while dragging:
40      * 1) the starting point (already done by the event_context)
41      * 2) drag_ptB --> the opposite corner of the front face (before pressing shift)
42      * 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location
43      *    if we are ctrl-dragging but is constrained to the perspective line from drag_ptC
44      *    to the vanishing point Y otherwise)
45      */
46     NR::Point drag_origin;
47     NR::Point drag_ptB;
48     NR::Point drag_ptC;
50     Proj::Pt3 drag_origin_proj;
51     Proj::Pt3 drag_ptB_proj;
52     Proj::Pt3 drag_ptC_proj;
54     bool ctrl_dragged; /* whether we are ctrl-dragging */
55     bool extruded; /* whether shift-dragging already occured (i.e. the box is already extruded) */
57     Box3D::VPDrag * _vpdrag;
59     sigc::connection sel_changed_connection;
61     Inkscape::MessageContext *_message_context;
62 };
64 struct Box3DContextClass {
65     SPEventContextClass parent_class;
66 };
68 /* Standard Gtk function */
70 GtkType sp_box3d_context_get_type (void);
72 #endif /* __SP_BOX3D_CONTEXT_H__ */
74 /*
75   Local Variables:
76   mode:c++
77   c-file-style:"stroustrup"
78   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
79   indent-tabs-mode:nil
80   fill-column:99
81   End:
82 */
83 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :