Code

First stage of draggable vanishing points (no snapping/unsnapping yet)
[inkscape.git] / src / box3d-context.h
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     /**
38      * save three corners while dragging:
39      * 1) the starting point (already done by the event_context)
40      * 2) drag_ptB --> the opposite corner of the front face (before pressing shift)
41      * 3) drag_ptC --> the "extruded corner" (which coincides with the mouse pointer location
42      *    if we are ctrl-dragging but is constrained to the perspective line from drag_ptC
43      *    to the vanishing point Y otherwise)
44      */
45     NR::Point drag_origin;
46     NR::Point drag_ptB;
47     NR::Point drag_ptC;
48     bool ctrl_dragged; /* whether we are ctrl-dragging */
49     bool extruded; /* whether shift-dragging already occured (i.e. the box is already extruded) */
51     Box3D::VPDrag * _vpdrag;
53     /* temporary member until the precise behaviour is sorted out */
54     static guint number_of_handles;
56         sigc::connection sel_changed_connection;
58         Inkscape::MessageContext *_message_context;
59 };
61 struct SP3DBoxContextClass {
62         SPEventContextClass parent_class;
63 };
65 /* Standard Gtk function */
67 GtkType sp_3dbox_context_get_type (void);
69 #endif