]> git.tdb.fi Git - r2c2.git/blob - measure.h
fc675a6b9a859fed36250140b0715e284f6e093b
[r2c2.git] / measure.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef MEASURE_H_
9 #define MEASURE_H_
10
11 #include <sigc++/sigc++.h>
12
13 class Designer;
14
15 class Measure
16 {
17 private:
18         enum State
19         {
20                 NONE,
21                 STARTING,
22                 ACTIVE
23         };
24
25 public:
26         sigc::signal<void> signal_done;
27         sigc::signal<void> signal_changed;
28
29 private:
30         Designer &designer;
31         R2C2::Vector pointer;
32         R2C2::Vector spoint;
33         float sdir;
34         float par_dist;
35         float perp_dist;
36         float adiff;
37         State state;
38
39 public:
40         Measure(Designer &);
41         float get_parallel_distance() const { return par_dist; }
42         float get_perpendicular_distance() const { return perp_dist; }
43         float get_angle_difference() const { return adiff; }
44         void start();
45         void button_press(int, int, float, float, unsigned);
46         void pointer_motion(int, int, float, float);
47         void render();
48 private:
49         void snap_to_tracks(R2C2::Vector &, float &);
50 };
51
52 #endif