X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fselection.h;h=89f7100e3e6e854945219bf074ad7f4ff3388e4f;hb=f8873062b146028c07f55ad625d2767e45133c27;hp=21c5de187f0667ff4c0d82ab30f1093c4ff153c5;hpb=52cbe8d99669f843f8f75c51128e2748584dd03a;p=r2c2.git diff --git a/source/designer/selection.h b/source/designer/selection.h index 21c5de1..89f7100 100644 --- a/source/designer/selection.h +++ b/source/designer/selection.h @@ -3,24 +3,59 @@ #include #include -#include "3d/track.h" +#include "libr2c2/object.h" class Selection { public: sigc::signal signal_changed; - const std::set &get_tracks() const { return tracks; } - Marklin::Track *get_track() const; - unsigned size() const { return tracks.size(); } +private: + std::set objects; + +public: + const std::set &get_objects() const { return objects; } + R2C2::Object *get_object() const; + + template + std::set get_objects() const + { + std::set result; + for(std::set::const_iterator i=objects.begin(); i!=objects.end(); ++i) + if(T *to = dynamic_cast(*i)) + result.insert(to); + return result; + } + + template + T *get_object() const + { + for(std::set::const_iterator i=objects.begin(); i!=objects.end(); ++i) + if(T *to = dynamic_cast(*i)) + return to; + return 0; + } + + unsigned size() const { return objects.size(); } + bool empty() const { return objects.empty(); } + void clear(); - void add_track(Marklin::Track *); - void remove_track(Marklin::Track *); - void toggle_track(Marklin::Track *); + + template + void replace(Iter begin, Iter end) + { + objects.clear(); + objects.insert(begin, end); + signal_changed.emit(); + } + + void add_object(R2C2::Object *); + void remove_object(R2C2::Object *); + void toggle_object(R2C2::Object *); + void select_more(); void select_linked(); -private: - std::set tracks; + void select_blocks(); }; #endif