Code

Slightly more 'object-oriented' way to invoke item-specific conversion-to-guides...
[inkscape.git] / src / box3d.h
1 #ifndef __SP_BOX3D_H__
2 #define __SP_BOX3D_H__
4 /*
5  * SVG <box3d> implementation
6  *
7  * Authors:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Maximilian Albert <Anhalter42@gmx.de>
10  *
11  * Copyright (C) 2007      Authors
12  * Copyright (C) 1999-2002 Lauris Kaplinski
13  * Copyright (C) 2000-2001 Ximian, Inc.
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
18 #include "sp-item-group.h"
19 #include "proj_pt.h"
20 #include "axis-manip.h"
22 #define SP_TYPE_BOX3D            (box3d_get_type ())
23 #define SP_BOX3D(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_BOX3D, SPBox3D))
24 #define SP_BOX3D_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D, Box3DClass))
25 #define SP_IS_BOX3D(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D))
26 #define SP_IS_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D))
28 class Box3DSide;
29 class Persp3D;
30 class Persp3DReference;
32 struct SPBox3D : public SPGroup {
33     gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
35     gchar *persp_href;
36     Persp3DReference *persp_ref;
38     sigc::connection modified_connection;
40     Proj::Pt3 orig_corner0;
41     Proj::Pt3 orig_corner7;
43     Proj::Pt3 save_corner0;
44     Proj::Pt3 save_corner7;
46     Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging
48     gint my_counter; // for debugging only
49 };
51 struct SPBox3DClass {
52     SPGroupClass parent_class;
53 };
55 GType box3d_get_type (void);
57 void box3d_position_set (SPBox3D *box);
58 Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, guint id);
59 NR::Point box3d_get_corner_screen (SPBox3D const *box, guint id);
60 Proj::Pt3 box3d_get_proj_center (SPBox3D *box);
61 NR::Point box3d_get_center_screen (SPBox3D *box);
63 void box3d_set_corner (SPBox3D *box, guint id, NR::Point const &new_pos, Box3D::Axis movement, bool constrained);
64 void box3d_set_center (SPBox3D *box, NR::Point const &new_pos, NR::Point const &old_pos, Box3D::Axis movement, bool constrained);
65 void box3d_corners_for_PLs (const SPBox3D * box, Proj::Axis axis, NR::Point &corner1, NR::Point &corner2, NR::Point &corner3, NR::Point &corner4);
66 bool box3d_recompute_z_orders (SPBox3D *box);
67 void box3d_set_z_orders (SPBox3D *box);
69 int box3d_pt_lies_in_PL_sector (SPBox3D const *box, NR::Point const &pt, int id1, int id2, Box3D::Axis axis);
70 int box3d_VP_lies_in_PL_sector (SPBox3D const *box, Proj::Axis vpdir, int id1, int id2, Box3D::Axis axis);
72 /* ensures that the coordinates of corner0 and corner7 are in the correct order (to prevent everted boxes) */
73 void box3d_relabel_corners(SPBox3D *box);
75 void box3d_check_for_swapped_coords(SPBox3D *box);
77 void box3d_add_to_selection(SPBox3D *box);
78 void box3d_remove_from_selection(SPBox3D *box);
79 void box3d_mark_transformed(SPBox3D *box);
81 Persp3D *box3d_get_perspective(SPBox3D const *box);
82 void box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, bool recompute_corners = false);
84 SPGroup *box3d_convert_to_group(SPBox3D *box);
87 #endif /* __SP_BOX3D_H__ */
89 /*
90   Local Variables:
91   mode:c++
92   c-file-style:"stroustrup"
93   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
94   indent-tabs-mode:nil
95   fill-column:99
96   End:
97 */
98 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :