]> git.tdb.fi Git - r2c2.git/blob - source/designer/designer.h
Add Id tags and copyright notices to files
[r2c2.git] / source / designer / designer.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef DESIGNER_H_
9 #define DESIGNER_H_
10
11 #include <string>
12 #include <msp/core/application.h>
13 #include <msp/gl/font.h>
14 #include <msp/time/timestamp.h>
15 #include "libmarklin/catalogue.h"
16 #include "libmarklin/layout.h"
17 #include "3d/layout.h"
18 #include "3d/track.h"
19
20 class Input;
21 class Manipulator;
22 class Measure;
23 class Selection;
24
25 class Designer: public Msp::Application
26 {
27 private:
28         enum Mode
29         {
30                 SELECT,
31                 CATALOGUE,
32                 MANIPULATE,
33                 MEASURE,
34                 INPUT
35         };
36
37         unsigned       screen_w;
38         unsigned       screen_h;
39         Msp::GL::Font  *font;
40         Marklin::Catalogue catalogue;
41         Marklin::Layout    *layout;
42         Marklin::Layout3D  *layout_3d;
43         Marklin::Layout    *cat_layout;
44         Marklin::Layout3D  *cat_layout_3d;
45         Selection      *selection;
46         Manipulator    *manipulator;
47         Measure        *measure;
48         Input          *input;
49         Mode           mode;
50         float          cam_yaw;
51         float          cam_pitch;
52         Marklin::Point cam_pos;
53         bool           shift;
54         int            move_x;
55         int            move_y;
56         int            zoom;
57         int            rotate;
58         int            pitch;
59         int            pointer_x;
60         int            pointer_y;
61         int            tooltip_x;
62         int            tooltip_y;
63         std::string    tooltip;
64         Msp::Time::TimeStamp tooltip_timeout;
65         Msp::Time::TimeStamp last_tick;
66
67 public:
68         Designer(int, char **);
69         ~Designer();
70
71         Marklin::Layout *get_layout() { return layout; }
72         Marklin::Layout3D *get_layout_3d() { return layout_3d; }
73         Msp::GL::Font   &get_font()   { return *font; }
74         int             main();
75         void            map_pointer_coords(int, int, float &, float &);
76 private:
77         void tick();
78         void key_press(unsigned, unsigned, wchar_t);
79         void key_release(unsigned, unsigned);
80         void button_press(int, int, float, float, unsigned);
81         void pointer_motion(int, int, float, float);
82         void project_3d();
83         void apply_camera();
84         void render();
85         Marklin::Track3D *pick_track(int, int);
86         void manipulation_status(const std::string &);
87         void manipulation_done(bool);
88         void measure_changed();
89         void measure_done();
90         void move_tooltip(int, int);
91         void save_accept();
92         void turnout_id_accept();
93         void sensor_id_accept();
94         void input_dismiss();
95
96         static Msp::Application::RegApp<Designer> reg;
97 };
98
99 #endif