763c152ae0aab3041cc1dffcd1ee27f69578a6b7
1 #ifndef __SP_3DBOX_CONTEXT_H__
2 #define __SP_3DBOX_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 "perspective3d.h"
22 struct SPKnotHolder;
24 #define SP_TYPE_3DBOX_CONTEXT (sp_3dbox_context_get_type ())
25 #define SP_3DBOX_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_3DBOX_CONTEXT, SP3DBoxContext))
26 #define SP_3DBOX_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_3DBOX_CONTEXT, SP3DBoxContextClass))
27 #define SP_IS_3DBOX_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_3DBOX_CONTEXT))
28 #define SP_IS_3DBOX_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_3DBOX_CONTEXT))
30 class SP3DBoxContext;
31 class SP3DBoxContextClass;
33 struct SP3DBoxContext : public SPEventContext {
34 SPItem *item;
35 NR::Point center;
37 gdouble rx; /* roundness radius (x direction) */
38 gdouble ry; /* roundness radius (y direction) */
40 /**
41 * save three corners while dragging:
42 * 1) the starting point (already done by the event_context)
43 * 2) drag_ptB --> the opposite corner of the front face (before pressing shift)
44 * 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location
45 * if we are ctrl-dragging but is constrained to the perspective line from drag_ptC
46 * to the vanishing point Y otherwise)
47 */
48 NR::Point drag_origin;
49 NR::Point drag_ptB;
50 NR::Point drag_ptC;
51 bool ctrl_dragged; /* whether we are ctrl-dragging */
52 bool extruded; /* whether shift-dragging already occured (i.e. the box is already extruded) */
54 /* temporary member until the precise behaviour is sorted out */
55 static guint number_of_handles;
57 sigc::connection sel_changed_connection;
59 Inkscape::MessageContext *_message_context;
60 };
62 struct SP3DBoxContextClass {
63 SPEventContextClass parent_class;
64 };
66 /* Standard Gtk function */
68 GtkType sp_3dbox_context_get_type (void);
70 #endif