diff -r 914f330b6aa8 -r 25a77484ec72 mapeditor.cpp --- a/mapeditor.cpp Thu Apr 02 09:57:47 2009 +0000 +++ b/mapeditor.cpp Tue Apr 07 16:15:53 2009 +0000 @@ -252,11 +252,12 @@ void MapEditor::toggleStandardFlag(QString f) { - BranchObj *bo=model->getSelectedBranch(); - if (bo) + BranchItem *bi=model->getSelectedBranchItem(); + if (bi) { QString u,r; - if (bo->isSetStandardFlag(f)) + /* FIXME-2 isSetStandardFlag needs to be ported + if (bi->isSetStandardFlag(f)) { r="unsetFlag"; u="setFlag"; @@ -266,13 +267,14 @@ u="unsetFlag"; r="setFlag"; } + */ model->saveState( - bo, + bi, QString("%1 (\"%2\")").arg(u).arg(f), - bo, + bi, QString("%1 (\"%2\")").arg(r).arg(f), - QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bo))); - bo->toggleStandardFlag (f,mainWindow->useFlagGroups()); + QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bi))); + // FIXME-2 bi->toggleStandardFlag (f,mainWindow->useFlagGroups()); model->updateSelection(); // geometry has changed } } @@ -292,7 +294,7 @@ cout << "*** " <getHeading().toStdString()<getSelectedBranch(); + //BranchObj *bo=model->getSelectedBranchObj(); //if (bo) model->moveAway (bo); //if (bo) bo->setLinkStyle (LinkableMapObj::Line); @@ -367,12 +369,13 @@ editHeadingFinished(); return; } - BranchObj *bo=model->getSelectedBranch(); - if (bo) + BranchObj *bo=model->getSelectedBranchObj(); + BranchItem *bi=model->getSelectedBranchItem(); + if (bo) //FIXME-3 { model->setSelectionBlocked(true); - lineEdit->setText (bo->getHeading()); + lineEdit->setText (bi->getHeading()); QPoint p = mapTo (this,bo->getAbsPos().toPoint() ); lineEdit->setGeometry(p.x(),p.y(),230,25); lineEdit->selectAll(); @@ -412,7 +415,7 @@ model->select(lmo); } // Context Menu - if (model->getSelectedBranch() ) + if (model->getSelectedBranchObj() ) { // Context Menu on branch or mapcenter //FIXME-3 model->updateActions(); needed? @@ -533,7 +536,7 @@ if (lmo) bo_begin=(BranchObj*)(lmo); else - bo_begin=model->getSelectedBranch(); + bo_begin=model->getSelectedBranchObj(); if (bo_begin) { drawingLink=true; @@ -674,9 +677,9 @@ QString pold=qpointfToString(movingObj_orgRelPos); QString pnow=qpointfToString(fio->getRelPos()); model->saveState( - fio, + fio->getTreeItem(), // FIXME-3 "moveRel "+pold, - fio, + fio->getTreeItem(), "moveRel "+pnow, QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow)); fio->getParObj()->requestReposition(); @@ -719,7 +722,7 @@ } // Maybe we can relink temporary? - if (lmo && (lmo!=lmosel) && model->getSelectedBranch() && + if (lmo && (lmo!=lmosel) && model->getSelectedBranchObj() && (typeid(*lmo)==typeid(BranchObj) || typeid(*lmo)==typeid(MapCenterObj)) ) @@ -821,9 +824,9 @@ QString pold=qpointfToString(movingObj_orgRelPos); QString pnow=qpointfToString(fo->getRelPos()); model->saveState( - fo, + fo->getTreeItem(), // FIXME-3 "moveRel "+pold, - fo, + fo->getTreeItem(), // FIXME-3 "moveRel "+pnow, QString("Move %1 to relative position %2").arg(model->getObjectName(fo)).arg(pnow)); @@ -838,19 +841,20 @@ if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj))) dst=NULL; - BranchObj *bo=model->getSelectedBranch(); - if (bo && bo->getDepth()==0) + BranchItem *bi=model->getSelectedBranchItem(); + if (bi && bi->depth()==0) { - if (movingObj_orgPos != bo->getAbsPos()) + if (movingObj_orgPos != bi->getBranchObj()->getAbsPos()) // FIXME-3 check getBO here... { QString pold=qpointfToString(movingObj_orgPos); - QString pnow=qpointfToString(bo->getAbsPos()); + QString pnow=qpointfToString(bi->getBranchObj()->getAbsPos()); // FIXME-3 check getBO here... + model->saveState( - bo, + bi, "move "+pold, - bo, + bi, "move "+pnow, - QString("Move mapcenter %1 to position %2").arg(model->getObjectName(bo)).arg(pnow)); + QString("Move mapcenter %1 to position %2").arg(model->getObjectName(bi)).arg(pnow)); } } @@ -871,7 +875,7 @@ { // We have a destination, relink to that - BranchObj* bsel=model->getSelectedBranch(); + BranchObj* bsel=model->getSelectedBranchObj(); TreeItem * tisel=model->getSelectedItem(); BranchObj* bdst=(BranchObj*)dst; TreeItem* tidst=dst->getTreeItem(); @@ -938,7 +942,7 @@ if (settings.value("/animation/use",false).toBool() && lmosel->getDepth()>1) { lmosel->setRelPos(); // calc relPos first for starting point - QPointF dst=bo->getParObj()->getChildPos(); + QPointF dst=bi->getBranchObj()->getParObj()->getChildPos(); // FIXME-3 check getBO here... // if (lmosel->getOrientation()==LinkableMapObj::LeftOfCenter) dst.setX (dst.x()+lmosel->width() ); model->startAnimation( @@ -1012,8 +1016,8 @@ void MapEditor::dropEvent(QDropEvent *event) { - BranchObj *sel=model->getSelectedBranch(); - if (sel) + BranchItem *selbi=model->getSelectedBranchItem(); + if (selbi) { if (debug) foreach (QString format,event->mimeData()->formats()) @@ -1034,15 +1038,16 @@ QStringList files; QString s; QString heading; - BranchObj *bo; + BranchItem *bi; for (int i=0; iaddBranch(); - if (bo) + bi=model->createBranch(); + if (bi) { + /* FIXME-2 s=uris.at(i).toLocalFile(); if (!s.isEmpty()) { @@ -1050,18 +1055,20 @@ heading = QFileInfo(file).baseName(); files.append(file); if (file.endsWith(".vym", false)) - bo->setVymLink(file); + bi->setVymLink(file); else - bo->setURL(uris.at(i).toString()); + bi->setURL(uris.at(i).toString()); } else { bo->setURL(uris.at(i).toString()); } + */ if (!heading.isEmpty()) - bo->setHeading(heading); + bi->setHeading(heading); else - bo->setHeading(uris.at(i).toString()); + bi->setHeading(uris.at(i).toString()); + } } } @@ -1112,18 +1119,22 @@ } } -void MapEditor::updateCurrent (const QModelIndex &,const QModelIndex &) //FIXME-3 not used? +void MapEditor::updateData (const QModelIndex &sel) { + TreeItem *ti= static_cast(sel.internalPointer()); /* testing + cout << "ME::updateData\n"; - cout << "ME::updateCurrent\n"; - - TreeItem *item = static_cast(newsel.internalPointer()); - LinkableMapObj *lmo=item->getLMO(); - cout << " lmo="<