diff -r 5522d1da7e37 -r c585be63ec69 selection.cpp --- a/selection.cpp Tue Jan 23 11:50:53 2007 +0000 +++ b/selection.cpp Tue Mar 06 19:37:39 2007 +0000 @@ -23,15 +23,16 @@ void Selection::clear() { - selectList.clear(); + unselect(); lastSelectList.clear(); } bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet { - clear(); + if (!selectList.isEmpty()) unselect(); selectList.append (lmo); - return false; + lmo->select(); + return true; } bool Selection::select (const QString &s) // TODO no multiselections yet @@ -41,7 +42,7 @@ // Finally select the found object if (lmo) { - clear(); + unselect(); select (lmo); return true; } @@ -62,8 +63,13 @@ void Selection::unselect() { - lastSelectList=selectList; - selectList.clear(); + if (!selectList.isEmpty() ) + { + for (int i=0; i< selectList.count(); ++i) + selectList.at(i)->unselect(); + lastSelectList=selectList; + selectList.clear(); + } } bool Selection::isEmpty() @@ -88,6 +94,45 @@ return Undefined; } +LinkableMapObj* Selection::first() +{ + if (!selectList.isEmpty()) + return selectList.first(); + else + return NULL; +} + +LinkableMapObj* Selection::single() +{ + if (selectList.count() == 1) + return selectList.first(); + else + return NULL; +} + +BranchObj* Selection::getBranch() +{ + if (!selectList.isEmpty()) + { + LinkableMapObj *sel=selectList.first(); + if (typeid (*sel)==typeid (BranchObj) || + typeid (*sel)==typeid (MapCenterObj)) + return (BranchObj*)sel; + } + return NULL; +} + +FloatImageObj* Selection::getFloatImage() +{ + if (!selectList.isEmpty()) + { + LinkableMapObj *sel=selectList.first(); + if (typeid (*sel)==typeid (FloatImageObj)) + return (FloatImageObj*)sel; + } + return NULL; +} + QString Selection::getSelectString()// TODO no multiselections yet { if (selectList.count()==1)