1.1 --- a/selection.cpp Wed Oct 29 17:42:34 2008 +0000
1.2 +++ b/selection.cpp Tue Nov 04 12:09:10 2008 +0000
1.3 @@ -11,7 +11,6 @@
1.4
1.5 Selection::Selection()
1.6 {
1.7 - color= QColor(255,255,0);
1.8 blocked=false;
1.9 }
1.10
1.11 @@ -22,7 +21,7 @@
1.12 void Selection::setModel (VymModel *m)
1.13 {
1.14 model=m;
1.15 - scene=model->getScene();
1.16 + selModel=model->getSelectionModel();
1.17 }
1.18
1.19 void Selection::copy(const Selection &other)
1.20 @@ -37,36 +36,28 @@
1.21 lastSelectList.clear();
1.22 }
1.23
1.24 -void Selection::update() // FIXME this needs to be adapted to several views
1.25 +void Selection::update() // TODO this needs to be adapted to several views
1.26 {
1.27 QRectF bbox;
1.28 - int w=0;
1.29 + //int w=0;
1.30 for (int i=0; i< selectList.count(); ++i)
1.31 {
1.32 bbox=selectList.at(i)->getBBox();
1.33 + /* FIXME VM move to MapEditor
1.34 selboxList.at(i)->setRect (
1.35 bbox.x()-w,bbox.y()-w,
1.36 bbox.width()+2*w, bbox.height()+2*w);
1.37 selboxList.at(i)->setPen (color);
1.38 selboxList.at(i)->setBrush (color);
1.39 + */
1.40 }
1.41 }
1.42
1.43 -void Selection::setColor (QColor col)
1.44 -{
1.45 - color=col;
1.46 - update();
1.47 -}
1.48 -
1.49 -QColor Selection::getColor ()
1.50 -{
1.51 - return color;
1.52 -}
1.53 -
1.54 bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet
1.55 {
1.56 if (!selectList.isEmpty()) unselect();
1.57 selectList.append (lmo);
1.58 + /* FIXME VM move to ME
1.59 QGraphicsRectItem *sb = scene->addRect(
1.60 QRectF(0,0,0,0),
1.61 QPen(color),
1.62 @@ -74,6 +65,7 @@
1.63 sb->setZValue(Z_SELBOX);
1.64 sb->show();
1.65 selboxList.append (sb);
1.66 + */
1.67 lmo->select();
1.68 update();
1.69 mainWindow->updateSatellites (model);
1.70 @@ -114,8 +106,10 @@
1.71 selectList.at(i)->unselect();
1.72 lastSelectList=selectList;
1.73 selectList.clear();
1.74 - while (!selboxList.isEmpty() )
1.75 + /* FIXME VM move to ME
1.76 + while (!selboxList.isEmpty() )
1.77 delete selboxList.takeFirst();
1.78 + */
1.79
1.80 }
1.81 }
1.82 @@ -188,10 +182,16 @@
1.83 TreeItem* Selection::getBranchItem()
1.84 {
1.85 BranchObj* bo=getBranch();
1.86 - if (bo) return bo->getTreeItem();
1.87 + if (bo) return bo->getTreeItem(); // FIXME VM get directly from treemodl
1.88 return NULL;
1.89 }
1.90
1.91 +QModelIndex Selection::getBranchIndex()
1.92 +{
1.93 + return selModel->selectedIndexes().first(); // TODO no multiselections yet
1.94 +
1.95 +}
1.96 +
1.97 FloatImageObj* Selection::getFloatImage()
1.98 {
1.99 if (!selectList.isEmpty())