1.1 --- a/selection.cpp Thu Jan 15 00:52:35 2009 +0000
1.2 +++ b/selection.cpp Tue Jan 20 15:23:16 2009 +0000
1.3 @@ -1,4 +1,6 @@
1.4 #include <typeinfo>
1.5 +#include <iostream>
1.6 +using namespace std;
1.7
1.8 #include "selection.h"
1.9
1.10 @@ -12,6 +14,7 @@
1.11 Selection::Selection()
1.12 {
1.13 blocked=false;
1.14 + model=NULL;
1.15 }
1.16
1.17 Selection::~Selection()
1.18 @@ -23,20 +26,7 @@
1.19 model=m;
1.20 }
1.21
1.22 -void Selection::copy(const Selection &other)
1.23 -{
1.24 - selectList=other.selectList;
1.25 - lastSelectList=other.lastSelectList;
1.26 -}
1.27 -
1.28 -void Selection::clear()
1.29 -{
1.30 - unselect();
1.31 - lastSelectList.clear();
1.32 -}
1.33 -
1.34 -
1.35 -void Selection::update() // FIXME VM emit signal in VM instead
1.36 +void Selection::update() // FIXME VM emit signal in VM instead and get rid of this
1.37 {
1.38 /*
1.39 QRectF bbox;
1.40 @@ -54,25 +44,23 @@
1.41 }
1.42 bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet
1.43 {
1.44 + return model->select (lmo);
1.45 + /*
1.46 if (!selectList.isEmpty()) unselect();
1.47 selectList.append (lmo);
1.48 - /* FIXME VM move to ME
1.49 - QGraphicsRectItem *sb = scene->addRect(
1.50 - QRectF(0,0,0,0),
1.51 - QPen(color),
1.52 - color);
1.53 - sb->setZValue(Z_SELBOX);
1.54 - sb->show();
1.55 - selboxList.append (sb);
1.56 - */
1.57 lmo->select();
1.58 update();
1.59 mainWindow->updateSatellites (model);
1.60 + cout << "Sel::select lmo e\n";
1.61 return true;
1.62 + */
1.63 }
1.64
1.65 bool Selection::select (const QString &s) // TODO no multiselections yet
1.66 {
1.67 + return model->select (s);
1.68 + /*
1.69 + cout << "Sel::select s=\n";
1.70 LinkableMapObj *lmo=model->findObjBySelect(s);
1.71
1.72 // Finally select the found object
1.73 @@ -83,7 +71,7 @@
1.74 return true;
1.75 }
1.76 return false;
1.77 -
1.78 + */
1.79 }
1.80
1.81 bool Selection::reselect () // TODO no multiselections yet
1.82 @@ -99,18 +87,20 @@
1.83
1.84 void Selection::unselect()
1.85 {
1.86 + model->unselect();
1.87 + /*
1.88 + cout << "Sel::unselect\n";
1.89 if (!selectList.isEmpty() )
1.90 {
1.91 for (int i=0; i< selectList.count(); ++i)
1.92 selectList.at(i)->unselect();
1.93 lastSelectList=selectList;
1.94 selectList.clear();
1.95 - /* FIXME VM move to ME
1.96 - while (!selboxList.isEmpty() )
1.97 - delete selboxList.takeFirst();
1.98 + // FIXME VM move to ME
1.99 + //while (!selboxList.isEmpty() )
1.100 + // delete selboxList.takeFirst();
1.101 + }
1.102 */
1.103 -
1.104 - }
1.105 }
1.106
1.107 bool Selection::isBlocked()
1.108 @@ -133,11 +123,14 @@
1.109 return selectList.isEmpty();
1.110 }
1.111
1.112 +/*
1.113 uint Selection::count()
1.114 {
1.115 return selectList.count();
1.116 }
1.117 +*/
1.118
1.119 +/*
1.120 Selection::Type Selection::type() // TODO no multiselections yet
1.121 {
1.122 if (!selectList.isEmpty())
1.123 @@ -149,7 +142,9 @@
1.124 }
1.125 return Undefined;
1.126 }
1.127 +*/
1.128
1.129 +/*
1.130 LinkableMapObj* Selection::first()
1.131 {
1.132 if (!selectList.isEmpty())
1.133 @@ -166,18 +161,6 @@
1.134 return NULL;
1.135 }
1.136
1.137 -BranchObj* Selection::getBranch()
1.138 -{
1.139 - if (!selectList.isEmpty())
1.140 - {
1.141 - LinkableMapObj *sel=selectList.first();
1.142 - if (typeid (*sel)==typeid (BranchObj) ||
1.143 - typeid (*sel)==typeid (MapCenterObj))
1.144 - return (BranchObj*)sel;
1.145 - }
1.146 - return NULL;
1.147 -}
1.148 -
1.149 TreeItem* Selection::getBranchItem()
1.150 {
1.151 BranchObj* bo=getBranch();
1.152 @@ -190,6 +173,7 @@
1.153 return model->getSelectionModel()->selectedIndexes().first(); // TODO no multiselections yet
1.154
1.155 }
1.156 +*/
1.157
1.158 FloatImageObj* Selection::getFloatImage()
1.159 {