diff -r 462d39502273 -r cf14046909cd vymmodel.cpp --- a/vymmodel.cpp Wed Jul 16 11:56:44 2008 +0000 +++ b/vymmodel.cpp Mon Aug 04 13:35:54 2008 +0000 @@ -156,14 +156,7 @@ } -void VymModel::setMapEditor(MapEditor *me) -{ - mapEditor=me; - for (int i=0; isetMapEditor(mapEditor); -} - -MapEditor* VymModel::getMapEditor() +MapEditor* VymModel::getMapEditor() // FIXME better return favourite editor here { return mapEditor; } @@ -1962,7 +1955,7 @@ MapCenterObj* VymModel::addMapCenter () { - MapCenterObj *mco=addMapCenter (QPointF(0,0)); + MapCenterObj *mco=addMapCenter (contextPos); selection.select (mco); updateActions(); ensureSelectionVisible(); @@ -1970,11 +1963,8 @@ mco, "delete()", NULL, - // FIXME how to position LineEdit without contextMenuPos ? - // QString ("addMapCenter (%1,%2)").arg (contextMenuPos.x()).arg(contextMenuPos.y()), - // QString ("Adding MapCenter to (%1,%2").arg (contextMenuPos.x()).arg(contextMenuPos.y()) - QString ("addMapCenter (%1,%2)").arg (0).arg(0), - QString ("Adding MapCenter to (%1,%2").arg (0).arg(0) + QString ("addMapCenter (%1,%2)").arg (contextPos.x()).arg(contextPos.y()), + QString ("Adding MapCenter to (%1,%2)").arg (contextPos.x()).arg(contextPos.y()) ); return mco; } @@ -1990,7 +1980,7 @@ return mapCenter; } -MapCenterObj *VymModel::removeMapCenter(MapCenterObj* mco) +MapCenterObj* VymModel::removeMapCenter(MapCenterObj* mco) { int i=mapCenters.indexOf (mco); if (i>=0) @@ -2002,6 +1992,15 @@ return NULL; } +MapCenterObj* VymModel::getLastMapCenter() +{ + if (mapCenters.size()>0) + return mapCenters.last(); + else + return NULL; + +} + BranchObj* VymModel::addNewBranchInt(int num) { @@ -3674,12 +3673,26 @@ // View related ////////////////////////////////////////////// -void VymModel::registerEditor(QWidget *) +void VymModel::registerEditor(QWidget *me) { + mapEditor=(MapEditor*)me; + for (int i=0; isetMapEditor(mapEditor); } void VymModel::unregisterEditor(QWidget *) { + mapEditor=NULL; +} + +void VymModel::setContextPos(QPointF p) +{ + contextPos=p; +} + +void VymModel::unsetContextPos() +{ + contextPos=QPointF(); } void VymModel::updateNoteFlag() @@ -4043,13 +4056,12 @@ } mapEditor->updateSelection(); mapScene->update(); - animationTimer->start(); + if (!animObjList.isEmpty()) animationTimer->start(); } -void VymModel::startAnimation(const QPointF &start, const QPointF &dest) +void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest) { - BranchObj *bo=getSelectedBranch(); if (bo && bo->getDepth()>0) { AnimPoint ap;