diff -r 30b22f7bd009 -r d442a66e9121 mapeditor.cpp --- a/mapeditor.cpp Mon Sep 12 19:52:51 2005 +0000 +++ b/mapeditor.cpp Thu Sep 22 12:14:23 2005 +0000 @@ -62,6 +62,7 @@ extern TextEditor *textEditor; extern int statusbarTime; extern Main *mainWindow; +extern QString tmpVymDir; extern FlagRowObj *systemFlagsDefault; extern FlagRowObj *standardFlagsDefault; extern MapEditor *clipboardME; @@ -139,6 +140,7 @@ extern Settings settings; +int MapEditor::mapNum=0; // make instance /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// @@ -147,6 +149,7 @@ QCanvasView(parent,name,f), urlOperator(0), imageBuffer(0) { //cout << "Constructor ME "<setAcceptDrops(true); @@ -355,8 +358,7 @@ fileName="unnamed"; mapName=""; - - undosTotal=15; + undosTotal=settings.readNumEntry("/vym/mapeditor/undoLevels",50); undosAvail=0; undoNum=0; @@ -389,7 +391,6 @@ } //cout <<"Destructor MapEditor\n"; - if (isInteractive) delTmpDirs(); // Save Settings //settings.writeEntry( "/vym/mapeditor/editmode/autoselect", ); @@ -484,15 +485,9 @@ void MapEditor::makeTmpDirs() { // Create unique temporary directories - char tmpdir[]="/tmp/vym-XXXXXX"; - // TODO set permissions and maybe use QT method for portability - tmpMapDir=mkdtemp(tmpdir); - QString bakMapDir; - for (int i=undosTotal;i>0;i--) - { - bakMapDir=tmpMapDir+QString("/undo-%1").arg(i); - makeSubDirs(bakMapDir); - } + tmpMapDir=tmpVymDir+QString("/mapeditor-%1").arg(mapNum); + QDir d; + d.mkdir (tmpMapDir,true); } void MapEditor::delTmpDirs() @@ -639,8 +634,12 @@ QString backupXML; QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum)); - QString bakMapPath=bakMapDir+"/map.xml"; - + QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml"); + + // Create bakMapDir if not available + QDir d(bakMapDir); + if (!d.exists()) + makeSubDirs (bakMapDir); // Save current selection QString redoSelection=""; @@ -1222,7 +1221,7 @@ void MapEditor::exportASCII() { - // FIXME still experimental + // TODO still experimental Export ex; ex.setMapCenter(mapCenter); @@ -1264,7 +1263,7 @@ void MapEditor::exportLaTeX() { - // FIXME still experimental + // TODO still experimental QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (LaTex)")); fd->addFilter ("TEX (*.tex)"); fd->setCaption("VYM - Export (LaTex) (still experimental)"); @@ -1306,7 +1305,7 @@ void MapEditor::exportOOPresentation() { - // FIXME still experimental + // TODO still experimental /* QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (Open Office 1.3.x Presentation)")); fd->addFilter ("Open Office 1.3.x presentation (*.sxi)"); @@ -1416,9 +1415,7 @@ // repositioning makes testing nicer, // but is not needed usually: if (clipboardME->isVisible()) - { clipboardME->getMapCenter()->reposition(); - } else clipboardME->hide(); } @@ -1491,8 +1488,6 @@ parseAtom (undoCommand); mapCenter->reposition(); - //mapChanged=false; FIXME still needed??? - //if (!redoSelection.isEmpty()) // select (redoSelection); @@ -1538,7 +1533,7 @@ if (!undoSelection.isEmpty()) select (undoSelection); -/* TODO remove testing +/* TODO testing cout << "ME::undo() begin\n"; cout << " undosTotal="<addFloatImage(); - // FIXME check if load was successful + // TODO check if load was successful bo->getLastFloatImage()->load(fn); bo->getLastFloatImage()->setOriginalFilename(fn); mapCenter->reposition(); @@ -3240,7 +3233,7 @@ } if (dia.deleteXLink()) ((BranchObj*)selection)->deleteXLinkAt(i); - saveState(); //FIXME undoCommand + saveState(); //TODO undoCommand } } } @@ -3249,12 +3242,8 @@ void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; - if (selection && - (typeid(*selection) == typeid(BranchObj)) ) - { - QString s=((BranchObj*)selection)->getHeading(); - parseAtom(s); - } + QDir d("/fasl"); + removeDir (d); } void MapEditor::ensureSelectionVisible() @@ -3458,7 +3447,10 @@ // Move the selected MapObj if ( selection && movingObj) { - ensureSelectionVisible (); + // To avoid jumping of the CanvasView, only + // ensureSelectionVisible, if not tmp linked + if (!selection->hasParObjTmp()) + ensureSelectionVisible (); // Now move the selection, but add relative position // (movingObj_start) where selection was chosen with @@ -3633,7 +3625,7 @@ tmpXLink->setEnd ( ((BranchObj*)(dst)) ); tmpXLink->updateXLink(); tmpXLink->activate(); - saveState(); //FIXME undoCommand + saveState(); //TODO undoCommand } else { delete(tmpXLink); @@ -3787,7 +3779,7 @@ bool isUnicode16(const QByteArray &d) { - // FIXME: make more precise check for unicode 16. + // TODO: make more precise check for unicode 16. // Guess unicode16 if any of second bytes are zero unsigned int length = max(0,d.size()-2)/2; for (unsigned int i = 0; ireposition(); adjustCanvasSize(); canvas()->update();