1.1 --- a/vymmodel.cpp Mon Mar 23 09:06:51 2009 +0000
1.2 +++ b/vymmodel.cpp Thu Mar 26 07:49:17 2009 +0000
1.3 @@ -53,6 +53,7 @@
1.4 {
1.5 // cout << "Const VymModel\n";
1.6 init();
1.7 + rootItem->setModel (this);
1.8 }
1.9
1.10
1.11 @@ -69,22 +70,22 @@
1.12 selModel->clearSelection();
1.13
1.14 // Remove stuff
1.15 - while (!mapCenters.isEmpty()) // FIXME VM needs to be in treemodel only...
1.16 + while (!mapCenters.isEmpty()) // FIXME-2 VM needs to be in treemodel only...
1.17 delete mapCenters.takeFirst();
1.18
1.19 QModelIndex ri=index(rootItem);
1.20 - //removeRows (0, rowCount(ri),ri); // FIXME here should be at least a beginRemoveRows...
1.21 + //removeRows (0, rowCount(ri),ri); // FIXME-2 here should be at least a beginRemoveRows...
1.22 }
1.23
1.24 void VymModel::init ()
1.25 {
1.26 // We should have at least one map center to start with
1.27 - // addMapCenter(); FIXME VM create this in MapEditor as long as model is part of that
1.28 + // addMapCenter(); FIXME-2 VM create this in MapEditor as long as model is part of that
1.29
1.30 // No MapEditor yet
1.31 mapEditor=NULL;
1.32
1.33 - // Also no scene yet (should not be needed anyway) FIXME VM
1.34 + // Also no scene yet (should not be needed anyway) FIXME-3 VM
1.35 mapScene=NULL;
1.36
1.37 // History
1.38 @@ -150,7 +151,7 @@
1.39 netstate=Offline;
1.40
1.41 // Create MapCenter
1.42 - // addMapCenter(); FIXME VM create this in MapEditor until BO and MCO are independent of scene
1.43 + // addMapCenter(); FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene
1.44
1.45 }
1.46
1.47 @@ -164,7 +165,7 @@
1.48 }
1.49
1.50
1.51 -MapEditor* VymModel::getMapEditor() // FIXME VM better return favourite editor here
1.52 +MapEditor* VymModel::getMapEditor() // FIXME-2 VM better return favourite editor here
1.53 {
1.54 return mapEditor;
1.55 }
1.56 @@ -174,7 +175,7 @@
1.57 return blockReposition;
1.58 }
1.59
1.60 -void VymModel::updateActions() // FIXME maybe don't update if blockReposition is set
1.61 +void VymModel::updateActions() // FIXME-2 maybe don't update if blockReposition is set
1.62 {
1.63 cout << "VymModel::updateActions \n";
1.64 // Tell mainwindow to update states of actions
1.65 @@ -233,12 +234,12 @@
1.66 s+=xml.beginElement("vymmap",mapAttr);
1.67 xml.incIndent();
1.68
1.69 - // Find the used flags while traversing the tree // FIXME this can be done local to vymmodel maybe...
1.70 + // Find the used flags while traversing the tree // FIXME-2 this can be done local to vymmodel maybe...
1.71 standardFlagsDefault->resetUsedCounter();
1.72
1.73 // Reset the counters before saving
1.74 // TODO constr. of FIO creates lots of objects, better do this in some other way...
1.75 - FloatImageObj (mapScene).resetSaveCounter();// FIXME this can be done local to vymmodel maybe...
1.76 + FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
1.77
1.78 // Build xml recursivly
1.79 if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
1.80 @@ -350,7 +351,7 @@
1.81 if (lmode==NewMap)
1.82 {
1.83 selModel->clearSelection();
1.84 - // FIXME VM not needed??? model->setMapEditor(this);
1.85 + // FIXME-2 VM not needed??? model->setMapEditor(this);
1.86 // (map state is set later at end of load...)
1.87 } else
1.88 {
1.89 @@ -464,7 +465,7 @@
1.90 file.close();
1.91 if ( ok )
1.92 {
1.93 - reposition(); // FIXME VM reposition the view instead...
1.94 + reposition(); // FIXME-2 VM reposition the view instead...
1.95 selection.update();
1.96 if (lmode==NewMap)
1.97 {
1.98 @@ -889,7 +890,7 @@
1.99 {
1.100 importDirInt (fd->selectedFile() );
1.101 reposition();
1.102 - //FIXME VM needed? scene()->update();
1.103 + //FIXME-3 VM needed? scene()->update();
1.104 }
1.105 }
1.106 }
1.107 @@ -932,7 +933,7 @@
1.108 QDateTime tmod=QFileInfo (filePath).lastModified();
1.109 if (tmod>fileChangedTime)
1.110 {
1.111 - // FIXME VM switch to current mapeditor and finish lineedits...
1.112 + // FIXME-2 VM switch to current mapeditor and finish lineedits...
1.113 QMessageBox mb( vymName,
1.114 tr("The file of the map on disk has changed:\n\n"
1.115 " %1\n\nDo you want to reload that map with the new file?").arg(filePath),
1.116 @@ -1200,7 +1201,7 @@
1.117
1.118 void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
1.119 {
1.120 - sendData(redoCom); //FIXME testing
1.121 + sendData(redoCom); //FIXME-3 testing
1.122
1.123 // Main saveState
1.124
1.125 @@ -1463,7 +1464,7 @@
1.126 return QDate::currentDate().toString ("yyyy-MM-dd");
1.127 }
1.128
1.129 -int VymModel::countBranches() // FIXME Optimize this: use internal counter instead of going through whole map each time...
1.130 +int VymModel::countBranches() // FIXME-2 Optimize this: use internal counter instead of going through whole map each time...
1.131 {
1.132 int c=0;
1.133 TreeItem *cur=NULL;
1.134 @@ -1491,15 +1492,15 @@
1.135 "setHeading (\""+s+"\")",
1.136 QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) );
1.137 sel->setHeading(s );
1.138 - /* FIXME testing only
1.139 + /* FIXME-3 testing only
1.140 */
1.141 TreeItem *ti=getSelectedItem();
1.142 if (ti)
1.143 {
1.144 ti->setHeading (s);
1.145 - //FIXME VM ix is wrong ModelIndex below, ix2 is (hopefully) correct:
1.146 + //FIXME-3 VM ix is wrong ModelIndex below, ix2 is (hopefully) correct:
1.147 //QModelIndex ix=index( ti->row(), ti->column(), index (0,0,QModelIndex()) );
1.148 - //FIXME VM testing only cout <<"VM::setHeading s="<<s.toStdString()<<" ti="<<ti<<" r,c=("<<ti->row()<<","<<ti->column()<<")"<<endl;
1.149 + //FIXME-3 VM testing only cout <<"VM::setHeading s="<<s.toStdString()<<" ti="<<ti<<" r,c=("<<ti->row()<<","<<ti->column()<<")"<<endl;
1.150 QModelIndex ix2=index (ti);
1.151 emit (dataChanged ( ix2,ix2));
1.152 }
1.153 @@ -1585,8 +1586,7 @@
1.154
1.155 void VymModel::setScene (QGraphicsScene *s)
1.156 {
1.157 - cout << "VM::setscene scene="<<s<<endl;
1.158 - mapScene=s; // FIXME VM should not be necessary anymore, move all occurences to MapEditor
1.159 + mapScene=s; // FIXME-2 VM should not be necessary anymore, move all occurences to MapEditor
1.160 //init(); // Here we have a mapScene set,
1.161 // which is (still) needed to create MapCenters
1.162 }
1.163 @@ -1621,8 +1621,10 @@
1.164 return "";
1.165 }
1.166
1.167 -QStringList VymModel::getURLs()
1.168 -{
1.169 +QStringList VymModel::getURLs() // FIXME-1 first, next moved to vymmodel
1.170 +{
1.171 + return QStringList();
1.172 + /*
1.173 QStringList urls;
1.174 BranchObj *bo=getSelectedBranch();
1.175 if (bo)
1.176 @@ -1635,6 +1637,7 @@
1.177 }
1.178 }
1.179 return urls;
1.180 + */
1.181 }
1.182
1.183 void VymModel::linkFloatImageTo(const QString &dstString)
1.184 @@ -1824,7 +1827,7 @@
1.185 updateActions();
1.186 reposition();
1.187 selection.update();
1.188 - // FIXME VM needed? scene()->update();
1.189 + // FIXME-3 VM needed? scene()->update();
1.190 }
1.191 }
1.192
1.193 @@ -1929,7 +1932,7 @@
1.194 BranchObj *obo=par->moveBranchUp (bo); // bo will be the one below selection
1.195 saveState (getSelectString(bo),"moveBranchDown ()",getSelectString(obo),"moveBranchUp ()",QString("Move up %1").arg(getObjectName(bo)));
1.196 reposition();
1.197 - //FIXME VM needed? scene()->update();
1.198 + //FIXME-3 VM needed? scene()->update();
1.199 selection.update();
1.200 ensureSelectionVisible();
1.201 }
1.202 @@ -1946,7 +1949,7 @@
1.203 BranchObj *obo=par->moveBranchDown(bo); // bo will be the one above selection
1.204 saveState(getSelectString(bo),"moveBranchUp ()",getSelectString(obo),"moveBranchDown ()",QString("Move down %1").arg(getObjectName(bo)));
1.205 reposition();
1.206 - //FIXME VM needed? scene()->update();
1.207 + //FIXME-3 VM needed? scene()->update();
1.208 selection.update();
1.209 ensureSelectionVisible();
1.210 }
1.211 @@ -1984,7 +1987,7 @@
1.212 BranchObj *bo=getSelectedBranch();
1.213 if (bo)
1.214 {
1.215 - FloatImageObj *newfio=bo->addFloatImage(); // FIXME VM Old model, merge with below
1.216 + FloatImageObj *newfio=bo->addFloatImage(); // FIXME-1 VM Old model, merge with below
1.217
1.218 // Create TreeItem
1.219 QList<QVariant> cData;
1.220 @@ -1998,7 +2001,7 @@
1.221 if (newfio)
1.222 {
1.223 newfio->setTreeItem (ti);
1.224 - select (newfio); // FIXME VM really needed here?
1.225 + select (newfio); // FIXME-2 VM really needed here?
1.226 return ti;
1.227 }
1.228 }
1.229 @@ -2008,8 +2011,7 @@
1.230 MapCenterObj* VymModel::addMapCenter ()
1.231 {
1.232 MapCenterObj *mco=addMapCenter (contextPos);
1.233 - cout <<"VM::addMCO () mapScene="<<mapScene<<endl;
1.234 - //FIXME selection.select (mco);
1.235 + //FIXME-3 selection.select (mco);
1.236 updateActions();
1.237 ensureSelectionVisible();
1.238 saveState (
1.239 @@ -2025,7 +2027,7 @@
1.240 MapCenterObj* VymModel::addMapCenter(QPointF absPos)
1.241 {
1.242 MapCenterObj *mapCenter = new MapCenterObj(mapScene,this);
1.243 - mapCenter->setMapEditor(mapEditor); //FIXME VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
1.244 + mapCenter->setMapEditor(mapEditor); //FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
1.245 mapCenter->move (absPos);
1.246 mapCenter->setVisibility (true);
1.247 mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
1.248 @@ -2035,7 +2037,6 @@
1.249 QModelIndex parix=index(rootItem);
1.250
1.251 int n=rootItem->branchCount();
1.252 - cout << "VM::addMapCenter n="<<n<<endl;
1.253
1.254 emit (layoutAboutToBeChanged() );
1.255 beginInsertRows (parix,n,n+1);
1.256 @@ -2126,19 +2127,19 @@
1.257 if (newbo)
1.258 {
1.259 newbo->setTreeItem (ti);
1.260 - select (newbo); // FIXME VM really needed here?
1.261 + select (newbo); // FIXME-2 VM really needed here?
1.262 }
1.263
1.264 }else if (num==-1)
1.265 {
1.266 num=bo->getNum()+1;
1.267 bo=(BranchObj*)bo->getParObj();
1.268 - if (bo) newbo=bo->insertBranch(num); //FIXME VM still missing
1.269 + if (bo) newbo=bo->insertBranch(num); //FIXME-1 VM still missing
1.270 }else if (num==-3)
1.271 {
1.272 num=bo->getNum();
1.273 bo=(BranchObj*)bo->getParObj();
1.274 - if (bo) newbo=bo->insertBranch(num); //FIXME VM still missing
1.275 + if (bo) newbo=bo->insertBranch(num); //FIXME-1 VM still missing
1.276 }
1.277 }
1.278 return newbo;
1.279 @@ -2155,7 +2156,7 @@
1.280
1.281 if (bo)
1.282 {
1.283 - // FIXME VM do we still need this in model? setCursor (Qt::ArrowCursor);
1.284 + // FIXME-1 VM do we still need this in model? setCursor (Qt::ArrowCursor);
1.285
1.286 newbo=addNewBranchInt (pos-2);
1.287
1.288 @@ -2169,7 +2170,7 @@
1.289 QString ("Add new branch to %1").arg(getObjectName(bo)));
1.290
1.291 reposition();
1.292 - // selection.update(); FIXME
1.293 + // selection.update(); FIXME-3
1.294 latestSelectionString=getSelectString(newbo);
1.295 // In Network mode, the client needs to know where the new branch is,
1.296 // so we have to pass on this information via saveState.
1.297 @@ -2197,7 +2198,7 @@
1.298 BranchObj *parbo=(BranchObj*)(bo->getParObj());
1.299
1.300 // add below selection
1.301 - newbo=parbo->insertBranch(bo->getNum()+1); //FIXME VM still missing
1.302 + newbo=parbo->insertBranch(bo->getNum()+1); //FIXME-1 VM still missing
1.303
1.304 if (newbo)
1.305 {
1.306 @@ -2210,7 +2211,7 @@
1.307 QString ("Add branch before %1").arg(getObjectName(bo)));
1.308
1.309 reposition();
1.310 - // selection.update(); FIXME
1.311 + // selection.update(); FIXME-3
1.312 }
1.313 }
1.314 latestSelectionString=selection.getSelectString();
1.315 @@ -2219,7 +2220,7 @@
1.316
1.317 void VymModel::deleteSelection()
1.318 {
1.319 - BranchObj *bo = getSelectedBranch(); // FIXME VM should not be necessary
1.320 + BranchObj *bo = getSelectedBranch(); // FIXME-2 VM should not be necessary
1.321 if (!bo) return;
1.322
1.323 QModelIndex ix=getSelectedIndex();
1.324 @@ -2229,11 +2230,11 @@
1.325 if (!parentIndex.isValid()) return;
1.326 TreeItem *ti=bo->getTreeItem();
1.327
1.328 - if (selectionType()==TreeItem::MapCenter) //FIXME VM still missing
1.329 + if (selectionType()==TreeItem::MapCenter) //FIXME-1 VM still missing
1.330 {
1.331 // BranchObj* par=(BranchObj*)(bo->getParObj());
1.332 //selection.unselect();
1.333 - /* FIXME VM Note: does saveStateRemovingPart work for MCO? (No parent!)
1.334 + /* FIXME-1 VM Note: does saveStateRemovingPart work for MCO? (No parent!)
1.335 saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
1.336 */
1.337 /*
1.338 @@ -2272,7 +2273,7 @@
1.339 emit (layoutChanged() );
1.340 return;
1.341 }
1.342 - FloatImageObj *fio=selection.getFloatImage(); //FIXME VM still missing
1.343 + FloatImageObj *fio=selection.getFloatImage(); //FIXME-1 VM still missing
1.344
1.345 if (fio)
1.346 {
1.347 @@ -2292,7 +2293,7 @@
1.348 }
1.349 }
1.350
1.351 -void VymModel::deleteKeepChildren() //FIXME VM still missing
1.352 +void VymModel::deleteKeepChildren() //FIXME-1 VM still missing
1.353
1.354 {
1.355 BranchObj *bo=getSelectedBranch();
1.356 @@ -2329,7 +2330,7 @@
1.357 }
1.358 }
1.359
1.360 -void VymModel::deleteChildren() //FIXME VM still missing
1.361 +void VymModel::deleteChildren() //FIXME-1 VM still missing
1.362
1.363 {
1.364 BranchObj *bo=getSelectedBranch();
1.365 @@ -2366,7 +2367,7 @@
1.366 );
1.367 bo->toggleScroll();
1.368 selection.update();
1.369 - // FIXME VM needed? scene()->update();
1.370 + // FIXME-3 VM needed? scene()->update();
1.371 return true;
1.372 }
1.373 return false;
1.374 @@ -2391,7 +2392,7 @@
1.375 );
1.376 bo->toggleScroll();
1.377 selection.update();
1.378 - // FIXME VM needed? scene()->update();
1.379 + // FIXME-3 VM needed? scene()->update();
1.380 return true;
1.381 }
1.382 return false;
1.383 @@ -2409,8 +2410,10 @@
1.384 }
1.385 }
1.386
1.387 -void VymModel::unscrollChildren()
1.388 -{
1.389 +void VymModel::unscrollChildren() // FIXME-1 first, next moved to vymmodel
1.390 +
1.391 +{
1.392 +/*
1.393 BranchObj *bo=getSelectedBranch();
1.394 if (bo)
1.395 {
1.396 @@ -2421,7 +2424,9 @@
1.397 bo=bo->next();
1.398 }
1.399 }
1.400 +*/
1.401 }
1.402 +
1.403 void VymModel::addFloatImage (const QPixmap &img)
1.404 {
1.405 BranchObj *bo=getSelectedBranch();
1.406 @@ -2434,7 +2439,7 @@
1.407 saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy dropped image to clipboard",fio );
1.408 saveState (fio,"delete ()", bo,QString("paste(%1)").arg(curStep),"Pasting dropped image");
1.409 reposition();
1.410 - // FIXME VM needed? scene()->update();
1.411 + // FIXME-3 VM needed? scene()->update();
1.412 }
1.413 }
1.414
1.415 @@ -2585,7 +2590,7 @@
1.416 "setVymLink (\""+fd->selectedFile()+"\")",
1.417 QString("Set vymlink of %1 to %2").arg(getObjectName(bo)).arg(fd->selectedFile())
1.418 );
1.419 - setVymLink (fd->selectedFile() ); // FIXME ok?
1.420 + setVymLink (fd->selectedFile() ); // FIXME-2 ok?
1.421 }
1.422 }
1.423 }
1.424 @@ -2619,7 +2624,7 @@
1.425 bo->setVymLink ("" );
1.426 updateActions();
1.427 reposition();
1.428 - // FIXME VM needed? scene()->update();
1.429 + // FIXME-3 VM needed? scene()->update();
1.430 }
1.431 }
1.432
1.433 @@ -2633,8 +2638,10 @@
1.434
1.435 }
1.436
1.437 -QStringList VymModel::getVymLinks()
1.438 -{
1.439 +QStringList VymModel::getVymLinks() // FIXME-1 first, next moved to vymmodel
1.440 +{
1.441 + return QStringList();
1.442 +/*
1.443 QStringList links;
1.444 BranchObj *bo=getSelectedBranch();
1.445 if (bo)
1.446 @@ -2647,6 +2654,7 @@
1.447 }
1.448 }
1.449 return links;
1.450 +*/
1.451 }
1.452
1.453
1.454 @@ -2664,7 +2672,7 @@
1.455 }
1.456 }
1.457
1.458 -void VymModel::editXLink(int i) // FIXME VM missing saveState
1.459 +void VymModel::editXLink(int i) // FIXME-1 VM missing saveState
1.460 {
1.461 BranchObj *bo=getSelectedBranch();
1.462 if (bo)
1.463 @@ -2850,7 +2858,7 @@
1.464 parser.setError (Aborted,"Type of selection is not a branch");
1.465 } else if (parser.checkParCount(0))
1.466 {
1.467 - //FIXME missing action for copy
1.468 + //FIXME-1 missing action for copy
1.469 }
1.470 /////////////////////////////////////////////////////////////////////
1.471 } else if (com=="cut")
1.472 @@ -3629,7 +3637,7 @@
1.473 // Any errors?
1.474 if (parser.errorLevel()==NoError)
1.475 {
1.476 - // setChanged(); FIXME should not be called e.g. for export?!
1.477 + // setChanged(); FIXME-2 should not be called e.g. for export?!
1.478 reposition();
1.479 }
1.480 else
1.481 @@ -3839,12 +3847,15 @@
1.482 void VymModel::updateNoteFlag()
1.483 {
1.484 setChanged();
1.485 + cout << "VM::updateNoteFlag()\n";
1.486 + /* FIXME-1 modify note flag
1.487 BranchObj *bo=getSelectedBranch();
1.488 if (bo)
1.489 {
1.490 bo->updateNoteFlag();
1.491 mainWindow->updateActions();
1.492 }
1.493 + */
1.494 }
1.495
1.496 void VymModel::updateRelPositions()
1.497 @@ -4066,7 +4077,7 @@
1.498 }
1.499 }
1.500
1.501 -void VymModel::selectMapBackgroundImage () // FIXME move to ME
1.502 +void VymModel::selectMapBackgroundImage () // FIXME-2 move to ME
1.503 {
1.504 Q3FileDialog *fd=new Q3FileDialog( NULL);
1.505 fd->setMode (Q3FileDialog::ExistingFile);
1.506 @@ -4087,7 +4098,7 @@
1.507 }
1.508 }
1.509
1.510 -void VymModel::setMapBackgroundImage (const QString &fn) //FIXME missing savestate
1.511 +void VymModel::setMapBackgroundImage (const QString &fn) //FIXME-2 missing savestate
1.512 {
1.513 QColor oldcol=mapScene->backgroundBrush().color();
1.514 /*
1.515 @@ -4103,7 +4114,7 @@
1.516 mapScene->setBackgroundBrush(brush);
1.517 }
1.518
1.519 -void VymModel::selectMapBackgroundColor() // FIXME move to ME
1.520 +void VymModel::selectMapBackgroundColor() // FIXME-1 move to ME
1.521 {
1.522 QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), NULL);
1.523 if ( !col.isValid() ) return;
1.524 @@ -4111,7 +4122,7 @@
1.525 }
1.526
1.527
1.528 -void VymModel::setMapBackgroundColor(QColor col) // FIXME move to ME
1.529 +void VymModel::setMapBackgroundColor(QColor col) // FIXME-1 move to ME
1.530 {
1.531 QColor oldcol=mapScene->backgroundBrush().color();
1.532 saveState(
1.533 @@ -4121,38 +4132,38 @@
1.534 mapScene->setBackgroundBrush(col);
1.535 }
1.536
1.537 -QColor VymModel::getMapBackgroundColor() // FIXME move to ME
1.538 +QColor VymModel::getMapBackgroundColor() // FIXME-1 move to ME
1.539 {
1.540 return mapScene->backgroundBrush().color();
1.541 }
1.542
1.543
1.544 -LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME move to ME
1.545 +LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME-1 move to ME
1.546 {
1.547 return linkcolorhint;
1.548 }
1.549
1.550 -QColor VymModel::getMapDefLinkColor() // FIXME move to ME
1.551 +QColor VymModel::getMapDefLinkColor() // FIXME-1 move to ME
1.552 {
1.553 return defLinkColor;
1.554 }
1.555
1.556 -void VymModel::setMapDefXLinkColor(QColor col) // FIXME move to ME
1.557 +void VymModel::setMapDefXLinkColor(QColor col) // FIXME-1 move to ME
1.558 {
1.559 defXLinkColor=col;
1.560 }
1.561
1.562 -QColor VymModel::getMapDefXLinkColor() // FIXME move to ME
1.563 +QColor VymModel::getMapDefXLinkColor() // FIXME-1 move to ME
1.564 {
1.565 return defXLinkColor;
1.566 }
1.567
1.568 -void VymModel::setMapDefXLinkWidth (int w) // FIXME move to ME
1.569 +void VymModel::setMapDefXLinkWidth (int w) // FIXME-1 move to ME
1.570 {
1.571 defXLinkWidth=w;
1.572 }
1.573
1.574 -int VymModel::getMapDefXLinkWidth() // FIXME move to ME
1.575 +int VymModel::getMapDefXLinkWidth() // FIXME-1 move to ME
1.576 {
1.577 return defXLinkWidth;
1.578 }
1.579 @@ -4276,7 +4287,7 @@
1.580 if (!tcpServer->listen(QHostAddress::Any,port)) {
1.581 QMessageBox::critical(NULL, "vym server",
1.582 QString("Unable to start the server: %1.").arg(tcpServer->errorString()));
1.583 - //FIXME needed? we are no widget any longer... close();
1.584 + //FIXME-3 needed? we are no widget any longer... close();
1.585 return;
1.586 }
1.587 connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient()));
1.588 @@ -4415,11 +4426,18 @@
1.589 mapEditor->setSelectionColor (col);
1.590 }
1.591
1.592 -void VymModel::updateSelection()
1.593 -{
1.594 - QItemSelection newsel=selModel->selection();
1.595 - updateSelection (newsel);
1.596 +/*
1.597 +void VymModel::changeSelection (const QItemSelection &newsel,const QItemSelection &oldsel)
1.598 +{
1.599 + cout << "VymModel::changeSelection (";
1.600 + if (!newsel.indexes().isEmpty() )
1.601 + cout << getItem(newsel.indexes().first() )->getHeading().toStdString();
1.602 + cout << ",";
1.603 + if (!oldsel.indexes().isEmpty() )
1.604 + cout << getItem(oldsel.indexes().first() )->getHeading().toStdString();
1.605 + cout << ")\n";
1.606 }
1.607 +*/
1.608
1.609 void VymModel::updateSelection(const QItemSelection &newsel)
1.610 {
1.611 @@ -4428,6 +4446,12 @@
1.612 sendSelection();
1.613 }
1.614
1.615 +void VymModel::updateSelection()
1.616 +{
1.617 + QItemSelection newsel=selModel->selection();
1.618 + updateSelection (newsel);
1.619 +}
1.620 +
1.621 void VymModel::setSelectionColor(QColor col)
1.622 {
1.623 if ( !col.isValid() ) return;
1.624 @@ -4450,7 +4474,7 @@
1.625 for (int i=0;i<mapCenters.count(); i++)
1.626 mapCenters.at(i)->setHideTmp (mode);
1.627 reposition();
1.628 - // FIXME needed? scene()->update();
1.629 + // FIXME-3 needed? scene()->update();
1.630 }
1.631
1.632
1.633 @@ -4469,7 +4493,6 @@
1.634 void VymModel::setSelectionModel (QItemSelectionModel *sm)
1.635 {
1.636 selModel=sm;
1.637 - cout << "VM::setSelModel selModel="<<selModel<<endl;
1.638 }
1.639
1.640 QItemSelectionModel* VymModel::getSelectionModel()
1.641 @@ -4529,7 +4552,7 @@
1.642 QModelIndex ix=index(ti);
1.643 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
1.644 ti->setLastSelectedBranch();
1.645 - //updateSelection(oldsel); //FIXME needed?
1.646 + //updateSelection(oldsel); //FIXME-3 needed?
1.647 return true;
1.648 }
1.649 return false;
1.650 @@ -4545,11 +4568,16 @@
1.651 selection.reselect();
1.652 }
1.653
1.654 -void VymModel::ensureSelectionVisible()
1.655 +void VymModel::ensureSelectionVisible() //FIXME-3 needed? in vymmodel.h commented...
1.656 {
1.657 LinkableMapObj *lmo=getSelectedLMO();
1.658 if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() );
1.659 -
1.660 +}
1.661 +
1.662 +void VymModel::emitContentHasChanged (TreeItem *ti)
1.663 +{
1.664 + QModelIndex ix=index(ti);
1.665 + emit (contentHasChanged (ix) );
1.666 }
1.667
1.668 void VymModel::selectInt (LinkableMapObj *lmo)
1.669 @@ -4557,7 +4585,7 @@
1.670 if (selection.select(lmo))
1.671 {
1.672 //selection.update();
1.673 - sendSelection (); // FIXME VM use signal
1.674 + sendSelection (); // FIXME-4 VM use signal
1.675 }
1.676 }
1.677
1.678 @@ -4947,10 +4975,11 @@
1.679
1.680 TreeItem* VymModel::getSelectedItem()
1.681 {
1.682 - // FIXME this may not only be branch, but also float etc...
1.683 - BranchObj* bo=getSelectedBranch();
1.684 - if (bo) return bo->getTreeItem(); // FIXME VM get directly from treemodl
1.685 - return NULL;
1.686 + QModelIndexList list=selModel->selectedIndexes();
1.687 + if (!list.isEmpty() )
1.688 + return getItem (list.first() );
1.689 + else
1.690 + return NULL;
1.691 }
1.692
1.693 QModelIndex VymModel::getSelectedIndex()
1.694 @@ -4976,7 +5005,7 @@
1.695 return QString();
1.696 }
1.697
1.698 -QString VymModel::getSelectString (LinkableMapObj *lmo) // FIXME VM needs to use TreeModel
1.699 +QString VymModel::getSelectString (LinkableMapObj *lmo) // FIXME-2 VM needs to use TreeModel
1.700 {
1.701 QString s;
1.702 if (!lmo) return s;