diff -r b7447adddc9a -r 5522d1da7e37 selection.cpp --- a/selection.cpp Wed Jan 10 13:26:12 2007 +0000 +++ b/selection.cpp Tue Jan 23 11:50:53 2007 +0000 @@ -18,21 +18,23 @@ { mapCenter=other.mapCenter; selectList=other.selectList; + lastSelectList=other.lastSelectList; } void Selection::clear() { selectList.clear(); + lastSelectList.clear(); } -bool Selection::select(LinkableMapObj *lmo) +bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet { clear(); selectList.append (lmo); return false; } -bool Selection::select (const QString &s) +bool Selection::select (const QString &s) // TODO no multiselections yet { LinkableMapObj *lmo=mapCenter->findObjBySelect(s); @@ -47,9 +49,21 @@ } +bool Selection::reselect () // TODO no multiselections yet +{ + if (!lastSelectList.isEmpty()) + { + select (lastSelectList.first()); + return true; + } + return false; + +} + void Selection::unselect() { - clear(); + lastSelectList=selectList; + selectList.clear(); } bool Selection::isEmpty() @@ -62,9 +76,20 @@ return selectList.count(); } -QString Selection::getSelectString() +SelectionType Selection::type() // TODO no multiselections yet { - // TODO multiselection (maybe separated by ";") + if (!selectList.isEmpty()) + { + LinkableMapObj *sel=selectList.first(); + if (typeid (*sel)==typeid (BranchObj)) return Branch; + if (typeid (*sel)==typeid (MapCenterObj)) return MapCenter; + if (typeid (*sel)==typeid (FloatImageObj)) return FloatImage; + } + return Undefined; +} + +QString Selection::getSelectString()// TODO no multiselections yet +{ if (selectList.count()==1) return selectList.first()->getSelectString(); else