X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fselection.cpp;h=855b41cc5e91538d0b4ab062c961af94ff4b5677;hb=c06f3dde10411cd34aae026d8bf22b7771bdc3e0;hp=5f71e8b68a5b6be56d72cb2d73f878689807e7d2;hpb=38fb8d56efde037a71c46a58bda314655e68ab6c;p=r2c2.git diff --git a/source/designer/selection.cpp b/source/designer/selection.cpp index 5f71e8b..855b41c 100644 --- a/source/designer/selection.cpp +++ b/source/designer/selection.cpp @@ -1,15 +1,9 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #include +#include "libr2c2/block.h" #include "selection.h" using namespace std; -using namespace Marklin; +using namespace R2C2; using namespace Msp; Track *Selection::get_track() const @@ -94,3 +88,21 @@ void Selection::select_linked() if(changed) signal_changed.emit(); } + +void Selection::select_blocks() +{ + bool changed = false; + for(set::iterator i=tracks.begin(); i!=tracks.end(); ++i) + { + const set &btracks = (*i)->get_block().get_tracks(); + for(set::iterator j=btracks.begin(); j!=btracks.end(); ++j) + if(!tracks.count(*j)) + { + tracks.insert(*j); + changed = true; + } + } + + if(changed) + signal_changed.emit(); +}