X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fmanipulator.h;h=7b3836649d5cfd5a1a6e7c15fea920bde2b6399c;hb=03a22611772265b539f826f1f8bc482e71ca4a99;hp=d8c3986a6161db02dd1bea7a84bd44a8e09d6841;hpb=f8a7788cee0261babfc4c804a58515aad6dfbc3d;p=r2c2.git diff --git a/source/designer/manipulator.h b/source/designer/manipulator.h index d8c3986..7b38366 100644 --- a/source/designer/manipulator.h +++ b/source/designer/manipulator.h @@ -1,88 +1,40 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef MANIPULATOR_H_ #define MANIPULATOR_H_ -#include +#include +#include +#include "libr2c2/object.h" +#include "tool.h" -class Designer; class Selection; -class Manipulator +class Manipulator: public Tool { -private: - enum Mode +protected: + struct MObject { - NONE, - MOVE, - ROTATE, - ELEVATE, - EXTEND - }; + R2C2::Object *object; + R2C2::Vector original_position; + R2C2::Angle original_rotation; - struct MTrack - { - R2C2::Track *track; - R2C2::Vector pos; - float rot; - - MTrack(R2C2::Track *); - }; - - struct TrackOrder - { - R2C2::Track *track; - bool rev; - - TrackOrder(R2C2::Track *t, bool r): track(t), rev(r) { } + MObject(R2C2::Object *); }; public: - sigc::signal signal_status; sigc::signal signal_done; -private: - Designer &designer; - Msp::Graphics::EventSource &event_source; - Selection &selection; - std::vector tracks; - R2C2::Vector center; +protected: + typedef std::vector ObjectArray; - R2C2::Vector gpointer; - int pointer_y; - Mode mode; - R2C2::Vector move_origin; - float angle; - float rot_origin; - int elev_origin; - std::set neighbors; - std::vector extend_tracks; + ObjectArray objects; + R2C2::Vector center; public: - Manipulator(Designer &, Msp::Graphics::EventSource &, Selection &); + Manipulator(Designer &, Msp::Input::Keyboard &, Msp::Input::Mouse &, const std::set &); + virtual ~Manipulator(); - void start_move(); - void start_rotate(); - void start_elevate(); - bool start_extend(); - void duplicate(); - void flatten(); - void even_slope(bool =false); - void connect(); - void cancel(); private: - void button_press(int, int, unsigned, unsigned); - void pointer_motion(int, int); - void selection_changed(); - void update_tracks(); - void update_neighbors(); - void set_slope(TrackOrder &, float, float); - std::vector create_straight(const R2C2::Vector &, float, float, float); + virtual void finish(); }; #endif