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 #define SP_TYPE_BOX3D_CONTEXT (sp_box3d_context_get_type ())
24 #define SP_BOX3D_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_BOX3D_CONTEXT, Box3DContext))
25 #define SP_BOX3D_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D_CONTEXT, Box3DContextClass))
26 #define SP_IS_BOX3D_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_BOX3D_CONTEXT))
27 #define SP_IS_BOX3D_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_CONTEXT))
29 class Box3DContext;
30 class Box3DContextClass;
32 struct Box3DContext : public SPEventContext {
33 SPItem *item;
34 Geom::Point center;
36 /**
37 * save three corners while dragging:
38 * 1) the starting point (already done by the event_context)
39 * 2) drag_ptB --> the opposite corner of the front face (before pressing shift)
40 * 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location
41 * if we are ctrl-dragging but is constrained to the perspective line from drag_ptC
42 * to the vanishing point Y otherwise)
43 */
44 Geom::Point drag_origin;
45 Geom::Point drag_ptB;
46 Geom::Point drag_ptC;
48 Proj::Pt3 drag_origin_proj;
49 Proj::Pt3 drag_ptB_proj;
50 Proj::Pt3 drag_ptC_proj;
52 bool ctrl_dragged; /* whether we are ctrl-dragging */
53 bool extruded; /* whether shift-dragging already occured (i.e. the box is already extruded) */
55 Box3D::VPDrag * _vpdrag;
57 sigc::connection sel_changed_connection;
59 Inkscape::MessageContext *_message_context;
60 };
62 struct Box3DContextClass {
63 SPEventContextClass parent_class;
64 };
66 /* Standard Gtk function */
68 GtkType sp_box3d_context_get_type (void);
70 void sp_box3d_context_update_lines(SPEventContext *ec);
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 :