1.1 --- a/vymmodel.cpp Wed May 20 15:40:14 2009 +0000
1.2 +++ b/vymmodel.cpp Tue May 26 11:24:51 2009 +0000
1.3 @@ -5,7 +5,6 @@
1.4
1.5 #include "treeitem.h"
1.6 #include "branchitem.h"
1.7 -#include "mapcenteritem.h"
1.8 #include "editxlinkdialog.h"
1.9 #include "exports.h"
1.10 #include "exportxhtmldialog.h"
1.11 @@ -15,8 +14,6 @@
1.12 #include "mapcenterobj.h"
1.13 #include "misc.h"
1.14 #include "parser.h"
1.15 -#include "selection.h"
1.16 -
1.17
1.18 #include "warningdialog.h"
1.19 #include "xml-freemind.h"
1.20 @@ -121,6 +118,7 @@
1.21
1.22 // selections
1.23 selModel=NULL;
1.24 + selectionBlocked=false;
1.25
1.26 // find routine
1.27 findCurrent=NULL;
1.28 @@ -245,9 +243,9 @@
1.29 s+=saveTreeToDir(tmpdir,prefix,writeflags,offset);
1.30 else
1.31 {
1.32 - if (saveSel->getType()==TreeItem::Branch)
1.33 + if (saveSel->isBranchLikeType())
1.34 // Save Subtree
1.35 - s+=saveSel->saveToDir(tmpdir,prefix,offset);
1.36 + s+=((BranchItem*)saveSel)->saveToDir(tmpdir,prefix,offset);
1.37 //FIXME-2 else if (saveSel->getType()==TreeItem::Image)
1.38 // Save image
1.39 //s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
1.40 @@ -272,7 +270,7 @@
1.41 QString s;
1.42
1.43 for (int i=0; i<rootItem->branchCount(); i++)
1.44 - s+=((MapCenterItem*)rootItem->getBranchNum(i))->saveToDir (tmpdir,prefix,offset);
1.45 + s+=rootItem->getBranchNum(i)->saveToDir (tmpdir,prefix,offset);
1.46 return s;
1.47 }
1.48
1.49 @@ -465,7 +463,7 @@
1.50 if ( ok )
1.51 {
1.52 reposition(); // FIXME-2 VM reposition the view instead...
1.53 - selection.update();
1.54 + updateSelection();
1.55 if (lmode==NewMap)
1.56 {
1.57 mapDefault=false;
1.58 @@ -585,7 +583,7 @@
1.59 makeSubDirs (fileDir);
1.60
1.61 QString saveFile;
1.62 - if (savemode==CompleteMap || selection.isEmpty())
1.63 + if (savemode==CompleteMap || selModel->selection().isEmpty())
1.64 {
1.65 // Save complete map
1.66 saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
1.67 @@ -770,7 +768,8 @@
1.68
1.69 void VymModel::saveFloatImage ()
1.70 {
1.71 - FloatImageObj *fio=selection.getFloatImage();
1.72 + //FIXME-1 FloatImageObj *fio=selection.getFloatImage();
1.73 + FloatImageObj *fio=NULL;
1.74 if (fio)
1.75 {
1.76 QFileDialog *fd=new QFileDialog( NULL);
1.77 @@ -998,15 +997,15 @@
1.78 QString s;
1.79 if (!lmo) return QString("Error: NULL has no name!");
1.80
1.81 - if ((typeid(*lmo) == typeid(BranchObj) ||
1.82 - typeid(*lmo) == typeid(MapCenterObj)))
1.83 + TreeItem *ti=lmo->getTreeItem();
1.84 + if (ti->isBranchLikeType() )
1.85 {
1.86
1.87 s=lmo->getTreeItem()->getHeading();
1.88 if (s=="") s="unnamed";
1.89 return QString("branch (%1)").arg(s);
1.90 }
1.91 - if ((typeid(*lmo) == typeid(FloatImageObj) ))
1.92 + if (ti->getType()==TreeItem::Image)
1.93 return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
1.94 return QString("Unknown type has no name!");
1.95 }
1.96 @@ -1180,8 +1179,7 @@
1.97
1.98 mainWindow->updateHistory (undoSet);
1.99 updateActions();
1.100 - selection.update();
1.101 - emitShowSelection();
1.102 + updateSelection();
1.103 }
1.104
1.105 bool VymModel::isUndoAvailable()
1.106 @@ -1487,12 +1485,11 @@
1.107 int c=0;
1.108 BranchItem *cur=NULL;
1.109 BranchItem *prev=NULL;
1.110 - int d;
1.111 - next(cur,prev,d);
1.112 + next(cur,prev);
1.113 while (cur)
1.114 {
1.115 c++;
1.116 - next(cur,prev,d);
1.117 + next(cur,prev);
1.118 }
1.119 return c;
1.120 }
1.121 @@ -1512,14 +1509,12 @@
1.122 emitDataHasChanged ( selbi); //FIXME-3 maybe emit signal from TreeItem?
1.123
1.124 reposition();
1.125 -// selection.update(); //FIXME-4
1.126 updateSelection();
1.127 }
1.128 }
1.129
1.130 BranchItem* VymModel::findText (QString s, bool cs)
1.131 {
1.132 - int d=0;
1.133 QTextDocument::FindFlags flags=0;
1.134 if (cs) flags=QTextDocument::FindCaseSensitively;
1.135
1.136 @@ -1530,7 +1525,7 @@
1.137 EOFind=false;
1.138 findCurrent=NULL;
1.139 findPrevious=NULL;
1.140 - next (findCurrent,findPrevious,d);
1.141 + next (findCurrent,findPrevious);
1.142 }
1.143 bool searching=true;
1.144 bool foundNote=false;
1.145 @@ -1564,7 +1559,7 @@
1.146 }
1.147 if (!foundNote)
1.148 {
1.149 - if (!next(findCurrent,findPrevious,d) )
1.150 + if (!next(findCurrent,findPrevious) )
1.151 EOFind=true;
1.152 }
1.153 //cout <<"still searching... "<<qPrintable( itFind->getHeading())<<endl;
1.154 @@ -1621,21 +1616,21 @@
1.155 QStringList VymModel::getURLs()
1.156 {
1.157 QStringList urls;
1.158 - BranchItem *cur=getSelectedBranchItem();
1.159 + BranchItem *selbi=getSelectedBranchItem();
1.160 + BranchItem *cur=selbi;
1.161 BranchItem *prev=NULL;
1.162 - int d=0;
1.163 - next (cur,prev,d);
1.164 while (cur)
1.165 {
1.166 if (!cur->getURL().isEmpty()) urls.append( cur->getURL());
1.167 - cur=next (cur,prev,d);
1.168 + cur=next (cur,prev,selbi);
1.169 }
1.170 return urls;
1.171 }
1.172
1.173 -void VymModel::linkFloatImageTo(const QString &dstString) // FIXME-2
1.174 -{
1.175 - FloatImageObj *fio=selection.getFloatImage();
1.176 +void VymModel::linkFloatImageTo(const QString &dstString) // FIXME-1
1.177 +{
1.178 + //FIXME-1 FloatImageObj *fio=selection.getFloatImage();
1.179 + FloatImageObj *fio=NULL;
1.180 if (fio)
1.181 {
1.182 TreeItem *dst=findBySelectString (dstString);
1.183 @@ -1645,7 +1640,7 @@
1.184 QString parString=getSelectString(dstPar);
1.185 QString fioPreSelectString=getSelectString(fio);
1.186 QString fioPreParentSelectString=getSelectString (fio->getParObj());
1.187 - // FIXME-2 ((BranchObj*)dst)->addFloatImage (fio);
1.188 + // FIXME-1 ((BranchObj*)dst)->addFloatImage (fio);
1.189 unselect();
1.190 // ((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
1.191 fio=((BranchObj*)dst)->getLastFloatImage();
1.192 @@ -1834,7 +1829,7 @@
1.193 );
1.194 updateActions();
1.195 reposition();
1.196 - // selection.update();
1.197 + // updateSelection();
1.198 // FIXME-3 VM needed? scene()->update();
1.199 }
1.200 }
1.201 @@ -1962,11 +1957,11 @@
1.202 */
1.203 }
1.204
1.205 -MapCenterItem* VymModel::createMapCenter()
1.206 -{
1.207 - MapCenterItem *mci=addMapCenter (QPointF (0,0) );
1.208 - select (mci);
1.209 - return mci;
1.210 +BranchItem* VymModel::createMapCenter()
1.211 +{
1.212 + BranchItem *newbi=addMapCenter (QPointF (0,0) );
1.213 + select (newbi);
1.214 + return newbi;
1.215 }
1.216
1.217 BranchItem* VymModel::createBranch()
1.218 @@ -1978,8 +1973,9 @@
1.219 return NULL;
1.220 }
1.221
1.222 -TreeItem* VymModel::createImage() //FIXME-2
1.223 -{
1.224 +TreeItem* VymModel::createImage() //FIXME-1
1.225 +{
1.226 + return NULL;
1.227 /*
1.228 BranchObj *bo=getSelectedBranch();
1.229 if (bo)
1.230 @@ -2002,26 +1998,25 @@
1.231 return ti;
1.232 }
1.233 }
1.234 - return NULL;
1.235 */
1.236 }
1.237
1.238 -MapCenterItem* VymModel::addMapCenter ()
1.239 -{
1.240 - MapCenterItem *mci=addMapCenter (contextPos);
1.241 +BranchItem* VymModel::addMapCenter ()
1.242 +{
1.243 + BranchItem *bi=addMapCenter (contextPos);
1.244 updateActions();
1.245 emitShowSelection();
1.246 saveState (
1.247 - mci,
1.248 + bi,
1.249 "delete()",
1.250 NULL,
1.251 QString ("addMapCenter (%1,%2)").arg (contextPos.x()).arg(contextPos.y()),
1.252 QString ("Adding MapCenter to (%1,%2)").arg (contextPos.x()).arg(contextPos.y())
1.253 );
1.254 - return mci;
1.255 + return bi;
1.256 }
1.257
1.258 -MapCenterItem* VymModel::addMapCenter(QPointF absPos)
1.259 +BranchItem* VymModel::addMapCenter(QPointF absPos) //FIXME-2 absPos not used in context menu?!
1.260 {
1.261
1.262 // Create TreeItem
1.263 @@ -2034,17 +2029,17 @@
1.264
1.265 QList<QVariant> cData;
1.266 cData << "VM:addMapCenter" << "undef"<<"undef";
1.267 - MapCenterItem *mci=new MapCenterItem (cData);
1.268 - mci->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
1.269 - rootItem->appendChild (mci);
1.270 + BranchItem *newbi=new BranchItem (cData);
1.271 + newbi->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
1.272 + rootItem->appendChild (newbi);
1.273
1.274 endInsertRows();
1.275 emit (layoutChanged() );
1.276
1.277 // Create MapObj
1.278 - BranchObj *newbo=mci->createMapObj(mapScene);
1.279 + newbi->createMapObj(mapScene);
1.280
1.281 - return mci;
1.282 + return newbi;
1.283 }
1.284
1.285 BranchItem* VymModel::addNewBranchInt(BranchItem *dst,int num) //FIXME-4 simplify...
1.286 @@ -2121,7 +2116,7 @@
1.287 QString ("Add new branch to %1").arg(getObjectName(selbi)));
1.288
1.289 reposition();
1.290 - // selection.update(); FIXME-3
1.291 + // updateSelection(); FIXME-3
1.292 latestAddedItem=newbi;
1.293 // In Network mode, the client needs to know where the new branch is,
1.294 // so we have to pass on this information via saveState.
1.295 @@ -2161,7 +2156,7 @@
1.296 QString ("Add branch before %1").arg(getObjectName(selbi)));
1.297
1.298 // FIXME-3 needed? reposition();
1.299 - // selection.update(); FIXME-3
1.300 + // updateSelection(); FIXME-3
1.301 }
1.302 }
1.303 //FIXME-3 needed? latestSelectionString=selection.getSelectString();
1.304 @@ -2172,6 +2167,10 @@
1.305 {
1.306 if (branch && dst)
1.307 {
1.308 + if (branch->depth()==0)
1.309 + {
1.310 + cout <<"VM::relinkBranch d=0 for "<<branch->getHeadingStd()<<endl;
1.311 + }
1.312 emit (layoutAboutToBeChanged() );
1.313 BranchItem *branchpi=(BranchItem*)branch->parent();
1.314 // Remove at current position
1.315 @@ -2191,7 +2190,9 @@
1.316 dst->insertBranch (pos,branch);
1.317 endInsertRows();
1.318
1.319 - branch->getLMO()->setParObj(dst->getLMO()); //FIXME-5 update parObj in View
1.320 + // reset parObj, fonts, frame, etc in related LMO or other view-objects
1.321 + branch->updateStyles();
1.322 +
1.323 emit (layoutChanged() );
1.324 reposition(); // both for moveUp/Down and relinking
1.325 select (branch);
1.326 @@ -2449,49 +2450,50 @@
1.327 }
1.328
1.329
1.330 -void VymModel::colorBranch (QColor c) //FIXME-2
1.331 -{
1.332 -/*
1.333 - BranchObj *bo=getSelectedBranch();
1.334 - if (bo)
1.335 +void VymModel::colorBranch (QColor c)
1.336 +{
1.337 + BranchItem *selbi=getSelectedBranchItem();
1.338 + if (selbi)
1.339 {
1.340 saveState(
1.341 - bo,
1.342 - QString ("colorBranch (\"%1\")").arg(bo->getColor().name()),
1.343 - bo,
1.344 + selbi,
1.345 + QString ("colorBranch (\"%1\")").arg(selbi->getHeadingColor().name()),
1.346 + selbi,
1.347 QString ("colorBranch (\"%1\")").arg(c.name()),
1.348 - QString("Set color of %1 to %2").arg(getObjectName(bo)).arg(c.name())
1.349 + QString("Set color of %1 to %2").arg(getObjectName(selbi)).arg(c.name())
1.350 );
1.351 - bo->setColor(c); // color branch
1.352 + selbi->setHeadingColor(c); // color branch
1.353 }
1.354 -*/
1.355 }
1.356
1.357 -void VymModel::colorSubtree (QColor c) //FIXME-2
1.358 -{
1.359 -/*
1.360 - BranchObj *bo=getSelectedBranch();
1.361 - if (bo)
1.362 +void VymModel::colorSubtree (QColor c)
1.363 +{
1.364 + BranchItem *selbi=getSelectedBranchItem();
1.365 + if (selbi)
1.366 {
1.367 saveStateChangingPart(
1.368 - bo,
1.369 - bo,
1.370 + selbi,
1.371 + selbi,
1.372 QString ("colorSubtree (\"%1\")").arg(c.name()),
1.373 - QString ("Set color of %1 and children to %2").arg(getObjectName(bo)).arg(c.name())
1.374 + QString ("Set color of %1 and children to %2").arg(getObjectName(selbi)).arg(c.name())
1.375 );
1.376 - bo->setColorSubtree (c); // color links, color children
1.377 + BranchItem *prev=NULL;
1.378 + BranchItem *cur=selbi;
1.379 + while (cur)
1.380 + {
1.381 + cur->setHeadingColor(c); // color links, color children
1.382 + cur=next (cur,prev,selbi);
1.383 + }
1.384 +
1.385 }
1.386 -*/
1.387 }
1.388
1.389 -QColor VymModel::getCurrentHeadingColor() //FIXME-2
1.390 -{
1.391 -/*
1.392 - BranchObj *bo=getSelectedBranch();
1.393 - if (bo) return bo->getColor();
1.394 -
1.395 +QColor VymModel::getCurrentHeadingColor()
1.396 +{
1.397 + BranchItem *selbi=getSelectedBranchItem();
1.398 + if (selbi) return selbi->getHeadingColor();
1.399 +
1.400 QMessageBox::warning(0,"Warning","Can't get color of heading,\nthere's no branch selected");
1.401 - */
1.402 return Qt::black;
1.403 }
1.404
1.405 @@ -2615,8 +2617,7 @@
1.406 bi->setVymLink(s);
1.407 reposition();
1.408 updateActions();
1.409 - //selection.update();
1.410 - emitShowSelection();
1.411 + //updateSelection();
1.412 }
1.413 }
1.414
1.415 @@ -2651,14 +2652,13 @@
1.416 QStringList VymModel::getVymLinks()
1.417 {
1.418 QStringList links;
1.419 - BranchItem *cur=getSelectedBranchItem();
1.420 + BranchItem *selbi=getSelectedBranchItem();
1.421 + BranchItem *cur=selbi;
1.422 BranchItem *prev=NULL;
1.423 - int d=0;
1.424 - next (cur,prev,d);
1.425 while (cur)
1.426 {
1.427 if (!cur->getVymLink().isEmpty()) links.append( cur->getVymLink());
1.428 - cur=next (cur,prev,d);
1.429 + cur=next (cur,prev,selbi);
1.430 }
1.431 return links;
1.432 }
1.433 @@ -3027,16 +3027,16 @@
1.434 LinkableMapObj *dst=findObjBySelect (s);
1.435 if (dst)
1.436 {
1.437 - if (typeid(*dst) == typeid(BranchObj) )
1.438 + if (typid(*dst) == typid(BranchObj) )
1.439 {
1.440 // Get number in parent
1.441 n=parser.parInt (ok,1);
1.442 if (ok)
1.443 {
1.444 selb->linkTo ((BranchObj*)(dst),n);
1.445 - selection.update();
1.446 + updateSelection();
1.447 }
1.448 - } else if (typeid(*dst) == typeid(MapCenterObj) )
1.449 + } else if (typid(*dst) == typid(MapCenterObj) )
1.450 {
1.451 selb->linkTo ((BranchObj*)(dst),-1);
1.452 // Get coordinates of mainbranch
1.453 @@ -3047,7 +3047,7 @@
1.454 if (ok)
1.455 {
1.456 selbi->move (x,y);
1.457 - selection.update();
1.458 + updateSelection();
1.459 }
1.460 }
1.461 }
1.462 @@ -3062,8 +3062,8 @@
1.463 LinkableMapObj *dst=findObjBySelect (s);
1.464 if (dst)
1.465 {
1.466 - if (typeid(*dst) == typeid(BranchObj) ||
1.467 - typeid(*dst) == typeid(MapCenterObj))
1.468 + if (typid(*dst) == typid(BranchObj) ||
1.469 + typid(*dst) == typid(MapCenterObj))
1.470 linkFloatImageTo (getSelectString(dst));
1.471 } else
1.472 parser.setError (Aborted,"Destination is not a branch");
1.473 @@ -3236,7 +3236,8 @@
1.474 /////////////////////////////////////////////////////////////////////
1.475 } else if (com=="saveImage")
1.476 {
1.477 - FloatImageObj *fio=selection.getFloatImage();
1.478 + //FIXME-2 FloatImageObj *fio=selection.getFloatImage();
1.479 + FloatImageObj* fio=NULL;
1.480 if (!fio)
1.481 {
1.482 parser.setError (Aborted,"Type of selection is not an image");
1.483 @@ -3879,9 +3880,10 @@
1.484 rootItem->getBranchObjNum(i)->reposition(); // for positioning heading
1.485 }
1.486
1.487 +/*
1.488 QPolygonF VymModel::shape(BranchObj *bo) //FIXME-4
1.489 {
1.490 -/*
1.491 + return QPolygonF ();
1.492 // Creating (arbitrary) shapes
1.493
1.494 QPolygonF p;
1.495 @@ -3911,9 +3913,10 @@
1.496 <<rb.bottomLeft()
1.497 <<QPointF (rb.bottomRight().x(), ra.bottomRight().y() ) ;
1.498 return p;
1.499 - */
1.500 }
1.501 -
1.502 +*/
1.503 +
1.504 +/*
1.505 void VymModel::moveAway(LinkableMapObj *lmo) //FIXME-5
1.506 {
1.507 // Autolayout:
1.508 @@ -3921,7 +3924,6 @@
1.509 // Move all branches and MapCenters away from lmo
1.510 // to avoid collisions
1.511
1.512 - /*
1.513 QPolygonF pA;
1.514 QPolygonF pB;
1.515
1.516 @@ -3941,8 +3943,8 @@
1.517 <<r.willIntersect
1.518 <<" minT="<<r.minTranslation<<endl<<endl;
1.519 }
1.520 - */
1.521 }
1.522 +*/
1.523
1.524 QPixmap VymModel::getPixmap()
1.525 {
1.526 @@ -3953,14 +3955,14 @@
1.527 pp.setRenderHints(mapEditor->renderHints());
1.528
1.529 // Don't print the visualisation of selection
1.530 - selection.unselect();
1.531 + unselect();
1.532
1.533 mapScene->render ( &pp,
1.534 QRectF(0,0,mapRect.width()+2,mapRect.height()+2),
1.535 QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() ));
1.536
1.537 // Restore selection
1.538 - selection.reselect();
1.539 + reselect();
1.540
1.541 return pix;
1.542 }
1.543 @@ -4007,14 +4009,13 @@
1.544
1.545 BranchItem *cur=NULL;
1.546 BranchItem *prev=NULL;
1.547 - int d=0;
1.548 BranchObj *bo;
1.549 - next (cur,prev,d);
1.550 + next (cur,prev);
1.551 while (cur)
1.552 {
1.553 bo=(BranchObj*)(cur->getLMO() );
1.554 bo->setLinkStyle(bo->getDefLinkStyle());
1.555 - cur=next(cur,prev,d);
1.556 + cur=next(cur,prev);
1.557 }
1.558 reposition();
1.559 }
1.560 @@ -4036,14 +4037,13 @@
1.561 defLinkColor=col;
1.562 BranchItem *cur=NULL;
1.563 BranchItem *prev=NULL;
1.564 - int d=0;
1.565 BranchObj *bo;
1.566 - cur=next(cur,prev,d);
1.567 + cur=next(cur,prev);
1.568 while (cur)
1.569 {
1.570 bo=(BranchObj*)(cur->getLMO() );
1.571 bo->setLinkColor();
1.572 - next(cur,prev,d);
1.573 + next(cur,prev);
1.574 }
1.575 updateActions();
1.576 }
1.577 @@ -4053,14 +4053,13 @@
1.578 // called from setMapLinkColorHint(lch) or at end of parse
1.579 BranchItem *cur=NULL;
1.580 BranchItem *prev=NULL;
1.581 - int d=0;
1.582 BranchObj *bo;
1.583 - cur=next(cur,prev,d);
1.584 + cur=next(cur,prev);
1.585 while (cur)
1.586 {
1.587 bo=(BranchObj*)(cur->getLMO() );
1.588 bo->setLinkColor();
1.589 - cur=next(cur,prev,d);
1.590 + cur=next(cur,prev);
1.591 }
1.592 }
1.593
1.594 @@ -4078,14 +4077,13 @@
1.595 linkcolorhint=LinkableMapObj::HeadingColor;
1.596 BranchItem *cur=NULL;
1.597 BranchItem *prev=NULL;
1.598 - int d=0;
1.599 BranchObj *bo;
1.600 - cur=next(cur,prev,d);
1.601 + cur=next(cur,prev);
1.602 while (cur)
1.603 {
1.604 bo=(BranchObj*)(cur->getLMO() );
1.605 bo->setLinkColor();
1.606 - next(cur,prev,d);
1.607 + next(cur,prev);
1.608 }
1.609 }
1.610
1.611 @@ -4203,7 +4201,7 @@
1.612 QString("Move %1 to %2").arg(getObjectName(bo)).arg(ps));
1.613 bo->move(x,y);
1.614 reposition();
1.615 - selection.update();
1.616 + updateSelection();
1.617 }
1.618 }
1.619 */
1.620 @@ -4234,7 +4232,7 @@
1.621 ((OrnamentedObj*)bo)->move2RelPos (x,y);
1.622 reposition();
1.623 bo->updateLink();
1.624 - selection.update();
1.625 + updateSelection();
1.626 }
1.627 }
1.628 */
1.629 @@ -4294,7 +4292,7 @@
1.630 void VymModel::sendSelection()
1.631 {
1.632 if (netstate!=Server) return;
1.633 - sendData (QString("select (\"%1\")").arg(selection.getSelectString()) );
1.634 + sendData (QString("select (\"%1\")").arg(getSelectString()) );
1.635 }
1.636
1.637 void VymModel::newServer()
1.638 @@ -4522,15 +4520,12 @@
1.639
1.640 void VymModel::setSelectionBlocked (bool b)
1.641 {
1.642 - if (b)
1.643 - selection.block();
1.644 - else
1.645 - selection.unblock();
1.646 + selectionBlocked=b;
1.647 }
1.648
1.649 bool VymModel::isSelectionBlocked()
1.650 {
1.651 - return selection.isBlocked();
1.652 + return selectionBlocked;
1.653 }
1.654
1.655 bool VymModel::select ()
1.656 @@ -4582,12 +4577,13 @@
1.657
1.658 void VymModel::unselect()
1.659 {
1.660 + lastSelectString=getSelectString();
1.661 selModel->clearSelection();
1.662 }
1.663
1.664 void VymModel::reselect()
1.665 {
1.666 - selection.reselect();
1.667 + select (lastSelectString);
1.668 }
1.669
1.670 void VymModel::emitShowSelection()
1.671 @@ -4614,8 +4610,7 @@
1.672 {
1.673 if (selection.select(lmo))
1.674 {
1.675 - //selection.update();
1.676 - sendSelection (); // FIXME-4 VM use signal
1.677 + //updateSelection();
1.678 }
1.679 }
1.680
1.681 @@ -4623,8 +4618,7 @@
1.682 {
1.683 if (selection.select(lmo))
1.684 {
1.685 - //selection.update();
1.686 - sendSelection (); // FIXME-4 VM use signal
1.687 + //updateSelection();
1.688 }
1.689 }
1.690 */
1.691 @@ -4747,8 +4741,6 @@
1.692
1.693 void VymModel::selectUpperBranch()
1.694 {
1.695 - if (selection.isBlocked() ) return;
1.696 -
1.697 BranchItem *bi=getSelectedBranchItem();
1.698 if (bi && bi->isBranchLikeType())
1.699 selectAboveBranchInt();
1.700 @@ -4756,8 +4748,6 @@
1.701
1.702 void VymModel::selectLowerBranch()
1.703 {
1.704 - if (selection.isBlocked() ) return;
1.705 -
1.706 BranchItem *bi=getSelectedBranchItem();
1.707 if (bi && bi->isBranchLikeType())
1.708 selectBelowBranchInt();
1.709 @@ -4766,8 +4756,6 @@
1.710
1.711 void VymModel::selectLeftBranch()
1.712 {
1.713 - if (selection.isBlocked() ) return;
1.714 -
1.715 QItemSelection oldsel=selModel->selection();
1.716
1.717 BranchItem* par;
1.718 @@ -4806,8 +4794,6 @@
1.719
1.720 void VymModel::selectRightBranch()
1.721 {
1.722 - if (selection.isBlocked() ) return;
1.723 -
1.724 QItemSelection oldsel=selModel->selection();
1.725
1.726 BranchItem* par;
1.727 @@ -4854,9 +4840,7 @@
1.728 TreeItem *ti2=par->getFirstBranch();
1.729 if (ti2) {
1.730 select(ti2);
1.731 - selection.update();
1.732 - emitShowSelection();
1.733 - sendSelection();
1.734 + updateSelection();
1.735 }
1.736 }
1.737 }
1.738 @@ -4871,9 +4855,7 @@
1.739 TreeItem *ti2=par->getLastBranch();
1.740 if (ti2) {
1.741 select(ti2);
1.742 - selection.update();
1.743 - emitShowSelection();
1.744 - sendSelection();
1.745 + updateSelection();
1.746 }
1.747 }
1.748 }
1.749 @@ -4897,9 +4879,7 @@
1.750 par=ti->parent();
1.751 if (!par) return;
1.752 select(par);
1.753 - selection.update();
1.754 - emitShowSelection();
1.755 - sendSelection();
1.756 + updateSelection();
1.757 }
1.758 }
1.759
1.760 @@ -4969,7 +4949,8 @@
1.761
1.762 FloatImageObj* VymModel::getSelectedFloatImage()
1.763 {
1.764 - return selection.getFloatImage();
1.765 + //FIXME-2 return selection.getFloatImage();
1.766 + return NULL;
1.767 }
1.768
1.769 QString VymModel::getSelectString ()