# HG changeset patch # User insilmaril # Date 1121788669 0 # Node ID 30cd58b70d0235c2b615b03cc6400537064e77a6 # Parent 9b9c7e8b9147b60a36faa52fb011878066e9e5b4 undoCommand also for moving floatimage diff -r 9b9c7e8b9147 -r 30cd58b70d02 demos/todo.vym Binary file demos/todo.vym has changed diff -r 9b9c7e8b9147 -r 30cd58b70d02 mapeditor.cpp --- a/mapeditor.cpp Tue Jul 19 14:44:30 2005 +0000 +++ b/mapeditor.cpp Tue Jul 19 15:57:49 2005 +0000 @@ -631,14 +631,13 @@ else if (com=="move") { if (api.checkParamCount(2) && - selection && - typeid(*selection) == typeid(BranchObj) ) + selection ) { x=api.parInt (ok,0); if (ok) { y=api.parInt (ok,1); - if (ok) ((BranchObj*)(selection))->move (x,y); + if (ok) move (x,y); } } } @@ -1432,6 +1431,14 @@ adjustCanvasSize(); } +void MapEditor::move(const int &x, const int &y) +{ + // FIXME no saveState, because this is only internal at undo so far + if (selection) selection->move(x,y); + if (typeid(*selection) == typeid(FloatImageObj)) + ((FloatImageObj*)(selection))->setRelPos(); +} + void MapEditor::moveBranchUp() { // Finish open lineEdits @@ -1474,21 +1481,6 @@ } } -void MapEditor::linkBranchToPos (LinkableMapObj *dst, const int &pos, const QPoint &p) -{ - // FIXME no saveState, because this is only internal at undo so far - if (selection && typeid(*selection) == typeid(BranchObj) ) - { - if (dst && typeid(*dst) == typeid(BranchObj) ) - ((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1); - if (dst && typeid(*dst) == typeid(MapCenterObj) ) - { - ((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1); - ((BranchObj*)(selection))->move (p); - } - } -} - void MapEditor::editHeading() { // Finish open lineEdits @@ -2943,8 +2935,6 @@ } } -#include "api.h" - void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; @@ -3174,7 +3164,7 @@ if (typeid(*selection) == typeid(FloatImageObj)) { setChanged(); - saveState(); + saveState("move "+qpointToString(movingObj_orgPos)); FloatObj *fo=(FloatObj*)(selection); if (fo->getLinkStyle()==StyleUndef) { @@ -3396,7 +3386,6 @@ bs->moveBranchTo ((BranchObj*)(dst),-1); if (dst->getDepth()==0) bs->move (savePos); - cout << "ME::release start was: "<