Code

Display CMS adjustment per-desktop view
[inkscape.git] / src / perspective3d.h
index 43b0ca3d3776fb56c0ad7eeb603292a6d1d69671..caf503e0daf45d5d609a0b131d83bd9fda4f5606 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "vanishing-point.h"
 #include "svg/stringstream.h"
+#include <glib.h>
 
 class SP3DBox;
 
@@ -23,29 +24,39 @@ class PerspectiveLine;
 
 class Perspective3D {
 public:
-    Perspective3D(VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z);
+    Perspective3D(VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z, SPDocument *document);
     Perspective3D(Perspective3D &other);
     ~Perspective3D();
 
-    bool operator== (Perspective3D const &other);
+    bool operator== (Perspective3D const &other) const;
 
+    bool has_vanishing_point (VanishingPoint *vp);
     VanishingPoint *get_vanishing_point (Box3D::Axis const dir);
+    Axis get_axis_of_VP (VanishingPoint *vp);
     void set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt);
     void set_vanishing_point (Box3D::Axis const dir, gdouble pt_x, gdouble pt_y, gdouble dir_x, gdouble dir_y, VPState st);
+    void set_infinite_direction (Box3D::Axis axis, NR::Point const dir);
+    void rotate (Box3D::Axis const dir, double const angle, bool const alt_pressed = false);
     void add_box (SP3DBox *box);
     void remove_box (const SP3DBox *box);
-    bool has_box (const SP3DBox *box);
+    bool has_box (const SP3DBox *box) const;
+    inline guint number_of_boxes () { return g_slist_length (boxes); }
     void reshape_boxes (Box3D::Axis axes);
+    void toggle_boxes (Box3D::Axis axes); // update the shape of boxes after a VP's state was toggled
     void update_box_reprs ();
+    void update_z_orders ();
+
+    NR::Point direction (NR::Point pt, Box3D::Axis axis);
+
+    /* convenience functions for interaction with dragging machinery: */
+    bool all_boxes_occur_in_list (GSList *boxes_to_do);
+    GSList * boxes_occurring_in_list (GSList * list_of_boxes);
+
+    void absorb (Perspective3D *other); // swallow the other perspective if both coincide
 
     static gint counter; // for testing only
     gint my_counter; // for testing only
 
-    static GSList * perspectives; // All existing 3D perspectives
-    static void add_perspective (Box3D::Perspective3D * const persp);
-    static void remove_perspective (Box3D::Perspective3D * const persp);
-    static Box3D::Perspective3D * find_perspective (Box3D::Perspective3D * const persp); // find an existing perspective whose VPs are equal to those of persp
-
     static void print_debugging_info();
     static Perspective3D * current_perspective;
 
@@ -54,10 +65,9 @@ private:
     VanishingPoint *vp_y;
     VanishingPoint *vp_z;
     GSList * boxes; // holds a list of boxes sharing this specific perspective
+    SPDocument * document;
 };
 
-Perspective3D * get_persp_of_box (const SP3DBox *box);
-
 NR::Point perspective_intersection (NR::Point pt1, Box3D::Axis dir1, NR::Point pt2, Box3D::Axis dir2, Perspective3D *persp);
 NR::Point perspective_line_snap (NR::Point pt, Box3D::Axis dir, NR::Point ext_pt, Perspective3D *persp);