~centralelyon2010/inkscape/imagelinks2

9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
1
#ifndef SEEN_SP_BOX3D_H
2
#define SEEN_SP_BOX3D_H
3084 by cilix42
First (very limited) version of the 3D box tool; allows for drawing of new boxes in a fixed perspective without any live interaction.
3
4
/*
5
 * SVG <box3d> implementation
6
 *
7
 * Authors:
8
 *   Lauris Kaplinski <lauris@kaplinski.com>
9
 *   Maximilian Albert <Anhalter42@gmx.de>
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
10
 *   Abhishek Sharma
3084 by cilix42
First (very limited) version of the 3D box tool; allows for drawing of new boxes in a fixed perspective without any live interaction.
11
 *
12
 * Copyright (C) 2007      Authors
13
 * Copyright (C) 1999-2002 Lauris Kaplinski
14
 * Copyright (C) 2000-2001 Ximian, Inc.
15
 *
16
 * Released under GNU GPL, read the file 'COPYING' for more information
17
 */
18
19
#include "sp-item-group.h"
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
20
#include "proj_pt.h"
21
#include "axis-manip.h"
22
23
#define SP_TYPE_BOX3D            (box3d_get_type ())
24
#define SP_BOX3D(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_BOX3D, SPBox3D))
25
#define SP_BOX3D_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D, Box3DClass))
26
#define SP_IS_BOX3D(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D))
27
#define SP_IS_BOX3D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D))
28
29
class Box3DSide;
30
class Persp3D;
31
class Persp3DReference;
32
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
33
class SPBox3D : public SPGroup {
34
public:
3587 by cilix42
Various small cleanups
35
    gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
3388 by cilix42
Write/read perspectives to/from SVG; store ratios of the distances from corners to VPs (preparation for dragging)
36
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
37
    gchar *persp_href;
38
    Persp3DReference *persp_ref;
39
40
    Proj::Pt3 orig_corner0;
41
    Proj::Pt3 orig_corner7;
42
43
    Proj::Pt3 save_corner0;
44
    Proj::Pt3 save_corner7;
45
4306 by cilix42
Don't show boxes as everted (i.e., always show the same sides) during initial drag, regardless of the mouse pointer position.
46
    Box3D::Axis swapped; // to indicate which coordinates are swapped during dragging
47
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
48
    gint my_counter; // for debugging only
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
49
50
    /**
51
     * Create a SPBox3D and append it to the parent.
52
     */
53
    static SPBox3D * createBox3D(SPItem * parent);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
54
};
55
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
56
class SPBox3DClass {
57
public:
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
58
    SPGroupClass parent_class;
59
};
60
61
GType box3d_get_type (void);
62
63
void box3d_position_set (SPBox3D *box);
64
Proj::Pt3 box3d_get_proj_corner (SPBox3D const *box, guint id);
6837 by cilix42
More NR::Point ==> Geom::Point
65
Geom::Point box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords = true);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
66
Proj::Pt3 box3d_get_proj_center (SPBox3D *box);
6837 by cilix42
More NR::Point ==> Geom::Point
67
Geom::Point box3d_get_center_screen (SPBox3D *box);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
68
6837 by cilix42
More NR::Point ==> Geom::Point
69
void box3d_set_corner (SPBox3D *box, guint id, Geom::Point const &new_pos, Box3D::Axis movement, bool constrained);
70
void box3d_set_center (SPBox3D *box, Geom::Point const &new_pos, Geom::Point const &old_pos, Box3D::Axis movement, bool constrained);
71
void box3d_corners_for_PLs (const SPBox3D * box, Proj::Axis axis, Geom::Point &corner1, Geom::Point &corner2, Geom::Point &corner3, Geom::Point &corner4);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
72
bool box3d_recompute_z_orders (SPBox3D *box);
73
void box3d_set_z_orders (SPBox3D *box);
74
6837 by cilix42
More NR::Point ==> Geom::Point
75
int box3d_pt_lies_in_PL_sector (SPBox3D const *box, Geom::Point const &pt, int id1, int id2, Box3D::Axis axis);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
76
int box3d_VP_lies_in_PL_sector (SPBox3D const *box, Proj::Axis vpdir, int id1, int id2, Box3D::Axis axis);
77
78
void box3d_relabel_corners(SPBox3D *box);
4306 by cilix42
Don't show boxes as everted (i.e., always show the same sides) during initial drag, regardless of the mouse pointer position.
79
void box3d_check_for_swapped_coords(SPBox3D *box);
80
5122 by cilix42
Make grouped 3D boxes work correctly when transformed (fixes: LP 188991)
81
std::list<SPBox3D *> box3d_extract_boxes(SPObject *obj);
82
4291 by cilix42
Bug fix: prevent perspectives from being transformed more than once (by keeping track of selected boxes and their transformations).
83
Persp3D *box3d_get_perspective(SPBox3D const *box);
4311 by cilix42
Recompute box corners relative to new perspective when merging persps (to prevent boxes from jumping randomly)
84
void box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, bool recompute_corners = false);
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
85
5232 by cilix42
Fix passing wrong pointer type when using the tweak tool on 3D boxes
86
SPGroup *box3d_convert_to_group(SPBox3D *box);
4462 by cilix42
Add possibility to convert objects (only rectangles and 3D boxes currently) to guidelines. Also see corresponding post on the mailing list; in particular, feel free to revert it if this is inappropriate during Frost phase.
87
4439 by cilix42
Convert 3D boxes to ordinary groups before tweaking, ungrouping or applying 'convert to path' (closes LP #179693 and #176646).
88
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
89
#endif // SEEN_SP_BOX3D_H
4224 by cilix42
Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history.
90
91
/*
92
  Local Variables:
93
  mode:c++
94
  c-file-style:"stroustrup"
95
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96
  indent-tabs-mode:nil
97
  fill-column:99
98
  End:
99
*/
9020 by JazzyNico
Code refactoring and merging with trunk (revision 10599).
100
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :