1.1 --- a/vymmodel.cpp Wed Jul 16 11:56:44 2008 +0000
1.2 +++ b/vymmodel.cpp Mon Aug 04 10:43:06 2008 +0000
1.3 @@ -156,14 +156,7 @@
1.4 }
1.5
1.6
1.7 -void VymModel::setMapEditor(MapEditor *me)
1.8 -{
1.9 - mapEditor=me;
1.10 - for (int i=0; i<mapCenters.count(); i++)
1.11 - mapCenters.at(i)->setMapEditor(mapEditor);
1.12 -}
1.13 -
1.14 -MapEditor* VymModel::getMapEditor()
1.15 +MapEditor* VymModel::getMapEditor() // FIXME better return favourite editor here
1.16 {
1.17 return mapEditor;
1.18 }
1.19 @@ -1962,7 +1955,7 @@
1.20
1.21 MapCenterObj* VymModel::addMapCenter ()
1.22 {
1.23 - MapCenterObj *mco=addMapCenter (QPointF(0,0));
1.24 + MapCenterObj *mco=addMapCenter (contextPos);
1.25 selection.select (mco);
1.26 updateActions();
1.27 ensureSelectionVisible();
1.28 @@ -1970,11 +1963,8 @@
1.29 mco,
1.30 "delete()",
1.31 NULL,
1.32 - // FIXME how to position LineEdit without contextMenuPos ?
1.33 - // QString ("addMapCenter (%1,%2)").arg (contextMenuPos.x()).arg(contextMenuPos.y()),
1.34 - // QString ("Adding MapCenter to (%1,%2").arg (contextMenuPos.x()).arg(contextMenuPos.y())
1.35 - QString ("addMapCenter (%1,%2)").arg (0).arg(0),
1.36 - QString ("Adding MapCenter to (%1,%2").arg (0).arg(0)
1.37 + QString ("addMapCenter (%1,%2)").arg (contextPos.x()).arg(contextPos.y()),
1.38 + QString ("Adding MapCenter to (%1,%2)").arg (contextPos.x()).arg(contextPos.y())
1.39 );
1.40 return mco;
1.41 }
1.42 @@ -1990,7 +1980,7 @@
1.43 return mapCenter;
1.44 }
1.45
1.46 -MapCenterObj *VymModel::removeMapCenter(MapCenterObj* mco)
1.47 +MapCenterObj* VymModel::removeMapCenter(MapCenterObj* mco)
1.48 {
1.49 int i=mapCenters.indexOf (mco);
1.50 if (i>=0)
1.51 @@ -2002,6 +1992,15 @@
1.52 return NULL;
1.53 }
1.54
1.55 +MapCenterObj* VymModel::getLastMapCenter()
1.56 +{
1.57 + if (mapCenters.size()>0)
1.58 + return mapCenters.last();
1.59 + else
1.60 + return NULL;
1.61 +
1.62 +}
1.63 +
1.64
1.65 BranchObj* VymModel::addNewBranchInt(int num)
1.66 {
1.67 @@ -3674,12 +3673,26 @@
1.68 // View related
1.69 //////////////////////////////////////////////
1.70
1.71 -void VymModel::registerEditor(QWidget *)
1.72 +void VymModel::registerEditor(QWidget *me)
1.73 {
1.74 + mapEditor=(MapEditor*)me;
1.75 + for (int i=0; i<mapCenters.count(); i++)
1.76 + mapCenters.at(i)->setMapEditor(mapEditor);
1.77 }
1.78
1.79 void VymModel::unregisterEditor(QWidget *)
1.80 {
1.81 + mapEditor=NULL;
1.82 +}
1.83 +
1.84 +void VymModel::setContextPos(QPointF p)
1.85 +{
1.86 + contextPos=p;
1.87 +}
1.88 +
1.89 +void VymModel::unsetContextPos()
1.90 +{
1.91 + contextPos=QPointF();
1.92 }
1.93
1.94 void VymModel::updateNoteFlag()
1.95 @@ -4043,13 +4056,12 @@
1.96 }
1.97 mapEditor->updateSelection();
1.98 mapScene->update();
1.99 - animationTimer->start();
1.100 + if (!animObjList.isEmpty()) animationTimer->start();
1.101 }
1.102
1.103
1.104 -void VymModel::startAnimation(const QPointF &start, const QPointF &dest)
1.105 +void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest)
1.106 {
1.107 - BranchObj *bo=getSelectedBranch();
1.108 if (bo && bo->getDepth()>0)
1.109 {
1.110 AnimPoint ap;