-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2011 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#ifndef DESIGNER_H_
#define DESIGNER_H_
#include <string>
#include <msp/core/application.h>
-#include <msp/gbase/simplewindow.h>
+#include <msp/graphics/simplewindow.h>
#include <msp/gl/camera.h>
#include <msp/gl/font.h>
#include <msp/gl/light.h>
#include <msp/gl/object.h>
#include <msp/gl/pipeline.h>
#include <msp/gltk/label.h>
+#include <msp/gltk/layout.h>
#include <msp/gltk/resources.h>
#include <msp/gltk/root.h>
#include <msp/time/timestamp.h>
#include "manipulator.h"
#include "measure.h"
#include "selection.h"
-#include "trackwrap.h"
+#include "selectionwrap.h"
class Toolbar;
-class Designer: public Msp::Application
+class Designer: public Msp::RegisteredApplication<Designer>
{
private:
enum Mode
{
- SELECT,
CATALOGUE,
- MANIPULATE,
- MANIPULATE_DONE,
- MEASURE
+ TOOL
};
Msp::Graphics::SimpleGLWindow window;
+ Msp::Input::Keyboard keyboard;
+ Msp::Input::Mouse mouse;
Msp::GLtk::Resources ui_res;
Msp::GLtk::Root root;
+ Msp::GLtk::Layout *root_layout;
std::vector<Toolbar *> toolbars;
Msp::GLtk::Label *lbl_status;
Msp::GL::Object *base_object;
R2C2::Route *cur_route;
R2C2::Zone *cur_zone;
- std::list<R2C2::Track *> new_tracks;
+ std::list<R2C2::Path3D *> highlight_paths;
Mode mode;
Selection selection;
- Manipulator manipulator;
- Measure measure;
+ SelectionWrap sel_wrap;
+ Tool *cur_tool;
+ unsigned keep_status;
CameraController *camera_ctl;
- TrackWrap *track_wrap;
Msp::Time::TimeStamp last_tick;
- static Msp::Application::RegApp<Designer> reg;
-
public:
Designer(int, char **);
~Designer();
const R2C2::Catalogue &get_catalogue() const { return catalogue; }
R2C2::Layout &get_layout() { return *layout; }
R2C2::Layout3D &get_layout_3d() { return *layout_3d; }
+ const R2C2::View3D &get_view() const { return *main_view; }
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 erase_tracks();
- void track_properties();
+ void new_object();
+ void erase_objects();
+ void object_properties();
void extend_track();
void connect_tracks();
void flatten_tracks();
R2C2::Zone *get_current_zone() const { return cur_zone; }
void add_selection_to_zone();
- R2C2::Vector map_pointer_to_ground(int, int);
+ R2C2::Vector map_pointer_to_ground(const R2C2::Vector &);
private:
void tick();
- void key_press(unsigned, unsigned, wchar_t);
- void button_press(int, int, unsigned, unsigned);
- void pointer_motion(int, int);
+ void key_press(unsigned);
+ template<typename T>
+ T *use_tool_with_selected_objects();
+ template<typename T>
+ T *use_tool();
+ void use_tool(Tool *);
+ void use_select_tool();
+ void button_press(unsigned);
void apply_camera();
void render();
- void track_added(R2C2::Track &);
- void track_removed(R2C2::Track &);
- R2C2::Track *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 arrange_toolbars();
- void track_properties_response(int);
+ R2C2::Object *pick_object(const R2C2::Vector &);
+ void update_object_icon(R2C2::Object &);
+ void tool_status(const std::string &);
+ void object_properties_response(int);
void route_name_accept(const std::string &);
void svg_export_accept(const std::string &);
std::string tooltip(int, int);