]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.h
Rename the project to R²C²
[r2c2.git] / source / designer / designer.h
index 6e4e78d0e71fa7d8b3a1f4e9f1b1ebc2f59ea0ce..9fc2961ddd01ba7ba08da0858e16584100509e5d 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
-This file is part of the MSP Märklin suite
-Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+This file is part of R²C²
+Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -10,17 +10,29 @@ Distributed under the GPL
 
 #include <string>
 #include <msp/core/application.h>
+#include <msp/gbase/simplewindow.h>
+#include <msp/gl/camera.h>
 #include <msp/gl/font.h>
+#include <msp/gl/light.h>
+#include <msp/gl/lighting.h>
+#include <msp/gl/object.h>
+#include <msp/gl/pipeline.h>
+#include <msp/gltk/label.h>
+#include <msp/gltk/resources.h>
+#include <msp/gltk/root.h>
 #include <msp/time/timestamp.h>
-#include "libmarklin/catalogue.h"
-#include "libmarklin/layout.h"
+#include "libr2c2/catalogue.h"
+#include "libr2c2/layout.h"
 #include "3d/layout.h"
+#include "3d/overlay.h"
 #include "3d/track.h"
+#include "cameracontroller.h"
+#include "manipulator.h"
+#include "measure.h"
+#include "selection.h"
+#include "trackwrap.h"
 
-class Input;
-class Manipulator;
-class Measure;
-class Selection;
+class Toolbar;
 
 class Designer: public Msp::Application
 {
@@ -30,70 +42,90 @@ private:
                SELECT,
                CATALOGUE,
                MANIPULATE,
-               MEASURE,
-               INPUT
+               MANIPULATE_DONE,
+               MEASURE
        };
 
-       unsigned       screen_w;
-       unsigned       screen_h;
-       Msp::GL::Font  *font;
-       Marklin::Catalogue catalogue;
-       Marklin::Layout    *layout;
-       Marklin::Layout3D  *layout_3d;
-       Marklin::Layout    *cat_layout;
-       Marklin::Layout3D  *cat_layout_3d;
-       Selection      *selection;
-       Manipulator    *manipulator;
-       Measure        *measure;
-       Input          *input;
-       Mode           mode;
-       float          cam_yaw;
-       float          cam_pitch;
-       Marklin::Point cam_pos;
-       bool           shift;
-       int            move_x;
-       int            move_y;
-       int            zoom;
-       int            rotate;
-       int            pitch;
-       int            pointer_x;
-       int            pointer_y;
-       int            tooltip_x;
-       int            tooltip_y;
-       std::string    tooltip;
-       Msp::Time::TimeStamp tooltip_timeout;
+       Msp::Graphics::SimpleGLWindow window;
+       Msp::GLtk::Resources ui_res;
+       Msp::GLtk::Root root;
+
+       Toolbar *toolbar;
+       Msp::GLtk::Label *lbl_status;
+
+       R2C2::Catalogue catalogue;
+       R2C2::Layout3D *cat_layout_3d;
+       std::string filename;
+       R2C2::Layout *layout;
+       R2C2::Layout3D *layout_3d;
+       R2C2::Overlay3D *overlay;
+       Msp::GL::Object *base_object;
+       R2C2::Route *cur_route;
+       std::list<R2C2::Track *> new_tracks;
+       Msp::GL::Pipeline *pipeline;
+       Msp::GL::Camera camera;
+       Msp::GL::Lighting lighting;
+       Msp::GL::Light light;
+
+       Mode mode;
+       Selection selection;
+       Manipulator manipulator;
+       Measure measure;
+       CameraController camera_ctl;
+       TrackWrap track_wrap;
+
        Msp::Time::TimeStamp last_tick;
 
+       static Msp::Application::RegApp<Designer> reg;
+
 public:
        Designer(int, char **);
        ~Designer();
 
-       Marklin::Layout *get_layout() { return layout; }
-       Marklin::Layout3D *get_layout_3d() { return layout_3d; }
-       Msp::GL::Font   &get_font()   { return *font; }
-       int             main();
-       void            map_pointer_coords(int, int, float &, float &);
+       int main();
+       void save();
+       void quit();
+
+       const R2C2::Catalogue &get_catalogue() const { return catalogue; }
+       R2C2::Layout &get_layout() { return *layout; }
+       R2C2::Layout3D &get_layout_3d() { return *layout_3d; }
+       const CameraController &get_camera_controller() const { return camera_ctl; }
+       const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
+       Msp::GLtk::Root &get_root() { return root; }
+
+       void new_track();
+       void set_turnout_id();
+       void set_sensor_id();
+       void rename_route();
+       void svg_export();
+
+       void edit_route(R2C2::Route *);
+       R2C2::Route *get_current_route() const { return cur_route; }
+       void add_selection_to_route();
+
+       R2C2::Point map_pointer_to_ground(int, int);
 private:
        void tick();
        void key_press(unsigned, unsigned, wchar_t);
-       void key_release(unsigned, unsigned);
-       void button_press(int, int, float, float, unsigned);
-       void pointer_motion(int, int, float, float);
-       void project_3d();
+       void button_press(int, int, unsigned, unsigned);
+       void pointer_motion(int, int);
        void apply_camera();
        void render();
-       Marklin::Track3D *pick_track(int, int);
+       void track_added(R2C2::Track &);
+       void track_removed(R2C2::Track &);
+       R2C2::Track3D *pick_track(int, int);
+       void update_track_icon(R2C2::Track3D &);
+       void selection_changed();
        void manipulation_status(const std::string &);
        void manipulation_done(bool);
        void measure_changed();
        void measure_done();
-       void move_tooltip(int, int);
-       void save_accept();
-       void turnout_id_accept();
-       void sensor_id_accept();
-       void input_dismiss();
-
-       static Msp::Application::RegApp<Designer> reg;
+       void turnout_id_accept(const std::string &);
+       void sensor_id_accept(const std::string &);
+       void route_name_accept(const std::string &);
+       void svg_export_accept(const std::string &);
+       std::string tooltip(int, int);
+       void show_route(const R2C2::Route *);
 };
 
 #endif