X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fmanipulator.cpp;h=e690c1d43aa34bf242361a0e485d49117a4b4574;hb=c0c5a34d1056eabdebd350da3534e24c902c0dac;hp=09d32fd8bfdeb782aff9d514c449528a234b012d;hpb=47341c72a70e6cf9d8e963705a50197bbc20a87d;p=r2c2.git diff --git a/source/designer/manipulator.cpp b/source/designer/manipulator.cpp index 09d32fd..e690c1d 100644 --- a/source/designer/manipulator.cpp +++ b/source/designer/manipulator.cpp @@ -19,23 +19,14 @@ using namespace std; using namespace Marklin; using namespace Msp; -Manipulator::Manipulator(Designer &d): +Manipulator::Manipulator(Designer &d, Selection &s): designer(d), - selection(0), + selection(s), wrap_rot(0), mode(NONE), angle(0) -{ } - -void Manipulator::set_selection(Selection *s) { - selection_changed_conn.disconnect(); - - selection = s; - if(selection) - selection_changed_conn = selection->signal_changed.connect(sigc::mem_fun(this, &Manipulator::selection_changed)); - - selection_changed(); + selection.signal_changed.connect(sigc::mem_fun(this, &Manipulator::selection_changed)); } void Manipulator::start_move() @@ -81,10 +72,10 @@ void Manipulator::duplicate() new_tracks.push_back(track); } - selection->clear(); + selection.clear(); for(list::iterator i=new_tracks.begin(); i!=new_tracks.end(); ++i) { - selection->add_track(*i); + selection.add_track(*i); for(list::iterator j=i; j!=new_tracks.end(); ++j) if(j!=i) (*i)->snap_to(**j, true); @@ -372,11 +363,8 @@ void Manipulator::selection_changed() cancel(); tracks.clear(); - if(selection) - { - const set &stracks = selection->get_tracks(); - tracks.insert(tracks.end(), stracks.begin(), stracks.end()); - } + const set &stracks = selection.get_tracks(); + tracks.insert(tracks.end(), stracks.begin(), stracks.end()); update_neighbors(); update_wrap();