# HG changeset patch
# User insilmaril
# Date 1127391263 0
# Node ID d442a66e91212332cdd4ec9d1ed0e661377aa185
# Parent  30b22f7bd009c3acaa761de1f47c40f67e32b590
new way to handle tmpdir, minor changes

diff -r 30b22f7bd009 -r d442a66e9121 branchobj.cpp
--- a/branchobj.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/branchobj.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -201,19 +201,9 @@
 	// ignore mapcenter and mainbranch
 	if (lmo->getDepth()<2) off=0;
 	if (off==0)
-	{
 		link2ParPos=false;
-	//	parObj=o;
-	}	
 	else
-	{	
 		link2ParPos=true;
-	//	if (off>0)
-	//		parObj=o->getParObj();
-	//	else	
-	//		parObj=o->getParObj();
-	//	parObj=o;
-	}		
 	parObj=o;
 
 	depth=parObj->getDepth()+1;
@@ -400,10 +390,11 @@
 	// Overloaded from LinkableMapObj
 	// BranchObj can use color of heading
 
-	if (mapEditor->getLinkColorHint()==HeadingColor)
-		LinkableMapObj::setLinkColor (heading->getColor() );
-	else	
-		LinkableMapObj::setLinkColor ();
+	if (mapEditor)
+		if (mapEditor->getLinkColorHint()==HeadingColor)
+			LinkableMapObj::setLinkColor (heading->getColor() );
+		else	
+			LinkableMapObj::setLinkColor ();
 }
 
 void BranchObj::setColor (QColor col, bool colorChilds)
@@ -578,7 +569,7 @@
 
 void BranchObj::positionBBox()
 {
-	// FIXME testing (optimization)
+	// TODO testing (optimization)
 	/*
 	QString h=getHeading();
 	if (!h.isEmpty())
@@ -663,12 +654,6 @@
 
 void BranchObj::setHeading(QString s)
 {
-	/*FIXME
-    // Adjusting font size
-    QFont font=heading->getFont();
-	font.setPointSize(getDefHeadingSize() );
-    heading->setFont(font);
-	*/
     heading->setText(s);	// set new heading
 	calcBBoxSize();			// recalculate bbox
     positionBBox();			// rearrange contents
@@ -1140,7 +1125,7 @@
 
 void BranchObj::alignRelativeTo (QPoint ref)
 {
-/* FIXME testing
+/* TODO testing
 	if (!getHeading().isEmpty())
 		cout << "BO::alignRelTo "<<getHeading()<<endl;
 	else	
@@ -1210,7 +1195,7 @@
 
 void BranchObj::reposition()
 {	
-/* FIXME testing
+/* TODO testing only
 	if (!getHeading().isEmpty())
 		cout << "BO::reposition  "<<getHeading()<<endl;
 	else	
diff -r 30b22f7bd009 -r d442a66e9121 lang/vym_de.ts
--- a/lang/vym_de.ts	Mon Sep 12 19:52:51 2005 +0000
+++ b/lang/vym_de.ts	Thu Sep 22 12:14:23 2005 +0000
@@ -798,7 +798,7 @@
     </message>
     <message>
         <source>Couldn&apos;t save</source>
-        <translation type="obsolete">Diese Datei konnte nicht gespeichert werden:</translation>
+        <translation>Diese Datei konnte nicht gespeichert werden:</translation>
     </message>
     <message>
         <source>Saved </source>
@@ -1269,18 +1269,6 @@
         <source>Set application to open external links...</source>
         <translation>Anwendung zum Öffnen externer Verweise...</translation>
     </message>
-    <message>
-        <source>Hide link</source>
-        <translation>Link nicht anzeigen</translation>
-    </message>
-    <message>
-        <source>Hide link if object is not selected</source>
-        <translation>Link nicht anzeigen, falls Objekt nicht selektiert ist</translation>
-    </message>
-    <message>
-        <source>Couldn&apos;t save %1</source>
-        <translation>Konnte %1 nicht speichern</translation>
-    </message>
 </context>
 <context>
     <name>MapEditor</name>
@@ -1671,7 +1659,7 @@
     </message>
     <message>
         <source>The file %1 exists already. Do you want to overwrite it?</source>
-        <translation type="obsolete">Die Datei %1 gibt es bereits.
+        <translation>Die Datei %1 gibt es bereits.
 Wollen Sie sie überschreiben?</translation>
     </message>
     <message>
diff -r 30b22f7bd009 -r d442a66e9121 lang/vym_en.ts
--- a/lang/vym_en.ts	Mon Sep 12 19:52:51 2005 +0000
+++ b/lang/vym_en.ts	Thu Sep 22 12:14:23 2005 +0000
@@ -860,6 +860,10 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Couldn&apos;t save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Export XML to directory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1044,18 +1048,6 @@
         <source>Set application to open external links...</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Hide link</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Hide link if object is not selected</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Couldn&apos;t save %1</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>MapEditor</name>
@@ -1267,6 +1259,10 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>The file %1 exists already. Do you want to overwrite it?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Cannot find the directory %1</source>
         <translation type="unfinished"></translation>
     </message>
diff -r 30b22f7bd009 -r d442a66e9121 lang/vym_es.ts
--- a/lang/vym_es.ts	Mon Sep 12 19:52:51 2005 +0000
+++ b/lang/vym_es.ts	Thu Sep 22 12:14:23 2005 +0000
@@ -939,7 +939,7 @@
     </message>
     <message>
         <source>Couldn&apos;t save</source>
-        <translation type="obsolete">No pudo guardar</translation>
+        <translation>No pudo guardar</translation>
     </message>
     <message>
         <source>The file </source>
@@ -1159,18 +1159,6 @@
         <source>Set application to open external links...</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Hide link</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Hide link if object is not selected</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Couldn&apos;t save %1</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>MapEditor</name>
@@ -1422,6 +1410,10 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>The file %1 exists already. Do you want to overwrite it?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Cannot find the directory %1</source>
         <translation type="unfinished"></translation>
     </message>
diff -r 30b22f7bd009 -r d442a66e9121 linkablemapobj.cpp
--- a/linkablemapobj.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/linkablemapobj.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -62,6 +62,7 @@
 void LinkableMapObj::init ()
 {
     depth=-1;	
+	mapEditor=NULL;
     childObj=NULL;
     parObj=NULL;
     parObjTmpBuf=NULL;
@@ -126,8 +127,16 @@
 {
 }
 
+bool LinkableMapObj::hasParObjTmp()
+{
+	if (parObjTmpBuf) return true;
+	return false;
+}
+
 LinkStyle LinkableMapObj::getDefLinkStyle ()
 {
+	if (!mapEditor) return StyleUndef;
+
 	LinkStyle ls=mapEditor->getLinkStyle();
 	switch (ls)
 	{
@@ -204,8 +213,7 @@
 				else
 					p->hide();
 				pa0.resize (3);
-				// TODO
-				// a bit awkward: draw the lines additionally to polygon, to avoid
+				// TODO a bit awkward: draw the lines additionally to polygon, to avoid
 				// missing pixels, when polygon is extremly flat
 				l = new QCanvasLine(canvas);
 				l->setPen( QPen(linkcolor, 1) );
@@ -227,8 +235,7 @@
 				pa1.resize (arcsegs+1);
 				pa2.resize (arcsegs+1);
 
-				// TODO
-				// a bit awkward: draw the lines additionally 
+				// TODO a bit awkward: draw the lines additionally 
 				// to polygon, to avoid missing pixels, 
 				// if polygon is extremly flat
 				for (i=0;i<arcsegs;i++)
@@ -247,12 +254,7 @@
 			default: 
 				break;	
 		}	
-		// FIXME updateLink is usually called (multiple times) later:
-		//updateLink();
-	} else
-	{
-		qWarning ("Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n");
-	}
+	} 
 }
 
 LinkStyle LinkableMapObj::getLinkStyle()
@@ -287,7 +289,8 @@
 {
 	// Overloaded in BranchObj and childs
 	// here only set default color
-	setLinkColor (mapEditor->getDefLinkColor());
+	if (mapEditor)
+		setLinkColor (mapEditor->getDefLinkColor());
 }
 
 void LinkableMapObj::setLinkColor(QColor col)
@@ -650,8 +653,8 @@
 
 void LinkableMapObj::alignRelativeTo (QPoint ref)
 {
+	// TODO testing, seems not to be used right now...
 	cout << "LMO::alignRelTo   ref="<<ref<<endl;
-	//FIXME 
 }
 
 void LinkableMapObj::reposition()
diff -r 30b22f7bd009 -r d442a66e9121 linkablemapobj.h
--- a/linkablemapobj.h	Mon Sep 12 19:52:51 2005 +0000
+++ b/linkablemapobj.h	Thu Sep 22 12:14:23 2005 +0000
@@ -33,6 +33,7 @@
     virtual void setParObj (LinkableMapObj*);
     virtual void setParObjTmp (LinkableMapObj*,QPoint,int);	// Only for moving Obj around
 	virtual void unsetParObjTmp();						// reuse original ParObj
+	virtual bool hasParObjTmp();
 	LinkStyle getDefLinkStyle();
     void setLinkStyle(LinkStyle);            
 	LinkStyle getLinkStyle();
diff -r 30b22f7bd009 -r d442a66e9121 main.cpp
--- a/main.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/main.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -21,6 +21,7 @@
 								// initialized in mainwindow
 
 Main *mainWindow;				// used in BranchObj::select()								
+QString tmpVymDir;				// All temp files go there, created in mainwindow
 MapEditor *clipboardME;			
 FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
 FlagRowObj *standardFlagsDefault;
diff -r 30b22f7bd009 -r d442a66e9121 mainwindow.cpp
--- a/mainwindow.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/mainwindow.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -60,6 +60,7 @@
 
 extern TextEditor *textEditor;
 extern Main *mainWindow;
+extern QString tmpVymDir;
 extern int statusbarTime;
 extern MapEditor *clipboardME;
 extern FlagRowObj* standardFlagsDefault;
@@ -168,6 +169,11 @@
 	        settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
 
 
+	// Create unique temporary directory
+	tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
+
+	// TODO Create direcctory for clipboard
+
 	// Set random seed (random used for object IDs)
     QTime t = QTime::currentTime();		// set random seed
     srand( t.hour()*12+t.minute()*60+t.second()*60 );
@@ -236,7 +242,6 @@
 	connect (findWindow, SIGNAL( somethingChanged() ), 
 		this, SLOT(editFindChanged() ) );	
 
-	// FIXME testing
 	// Connect TextEditor, so that we can update flags if text changes
 	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
 
@@ -277,6 +282,9 @@
 
 	// To make the texteditor save its settings, call the destructor
 	delete (textEditor);
+
+	// Remove temporary directory
+	removeDir (QDir(tmpVymDir));
 }
 
 void Main::loadCmdLine()
@@ -1329,7 +1337,7 @@
 						{
 							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
 								*it=tmpMapDir + "/" + *it;
-							// FIXME Multiple entries, load all (but only the first one into this ME)
+							// TODO Multiple entries, load all (but only the first one into this ME)
 							//mainWindow->fileLoadFromTmp (flist);
 							//returnCode=1;	// Silently forget this attempt to load
 							qWarning ("MainWindow::load (fn)  multimap found...");
diff -r 30b22f7bd009 -r d442a66e9121 mapcenterobj.cpp
--- a/mapcenterobj.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/mapcenterobj.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -27,7 +27,6 @@
 void MapCenterObj::clear() 
 {
 	BranchObj::clear();
-    init();
 }
 
 void MapCenterObj::init () 
@@ -37,10 +36,11 @@
     absPos=QPoint (canvas->width()/2, canvas->height()/2);
 
 	// FIXME this should be done in TextObj later...
-	QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
-	heading->setFont(font);
+	//QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
+	//heading->setFont(font);
+	depth=0;
+	setDefAttr(MovedBranch);
 
-	depth=0;
 
 	frame->setFrameType (Rectangle);
 	move (absPos.x(), absPos.y() );
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 "<<this<<endl;
+	mapNum++;
 
     viewport()->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="<<undosTotal<<endl;
 	cout << "    undosAvail="<<undosAvail<<endl;
@@ -1554,8 +1549,6 @@
 	parseAtom (undoCommand);
 	mapCenter->reposition();
 
-	//mapChanged=false;  FIXME  still needed???
-
 	//if (!redoSelection.isEmpty())
 	//	select (redoSelection);
 
@@ -1701,7 +1694,7 @@
 
 void MapEditor::move(const int &x, const int &y)
 {
-	// FIXME  no saveState, because this is only internal at undo so far
+	// TODO 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();
@@ -1824,7 +1817,7 @@
 		 (typeid(*selection) == typeid(BranchObj) || 
 		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 	{
-		saveState(selection);	//FIXME undoCommand
+		saveState(selection);	//TODO undoCommand
 
 		BranchObj* bo1 = (BranchObj*) selection;
 		bool wasScrolled=false;
@@ -1942,7 +1935,7 @@
 			saveState(selection->getParObj());
 		else
 			// Mainbranch, save whole map
-			// FIXME Better would be to insert mainbranch again at pos
+			// TODO Better would be to insert mainbranch again at pos
 			// But undoCommand is missing right now
 			saveState();
 		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
@@ -2428,7 +2421,7 @@
 		if (typeid(*selection) == typeid(BranchObj) ||
 			typeid(*selection) == typeid(MapCenterObj))
 		{
-			saveState(selection);	//FIXME undoCommand
+			saveState(selection);	//TODO undoCommand
 			BranchObj *bo=(BranchObj*)selection;
 			bo->setColor(actColor, false); // color links, color childs
 		}    
@@ -2454,7 +2447,7 @@
 {
 	if (selection)
 	{
-		saveState(selection);// FIXME undoCommand	
+		saveState(selection);// TODO undoCommand	
 		((BranchObj*)selection)->toggleStandardFlag (f,actionSettingsUseFlagGroups);
 	}	
 }
@@ -2658,7 +2651,7 @@
 		if (bo->getDepth()==1)
 			saveState();
 		else	
-			saveState(selection->getParObj());	// FIXME undoCommand
+			saveState(selection->getParObj());	// TODO undoCommand
 		QString sel=selection->getSelectString();
 		unselect();
 		par->removeBranchHere(bo);
@@ -2715,7 +2708,7 @@
 	// Finally show dialog
 	if (dia.exec() == QDialog::Accepted)
 	{
-		saveState();	//FIXME undoCommand
+		saveState();	//TODO undoCommand
 		mapCenter->setAuthor (dia.getAuthor() );
 		mapCenter->setComment (dia.getComment() );
 	}
@@ -2882,7 +2875,7 @@
 {
 	linkstyle=ls;
 
-	saveState();	// FIXME undoCommand
+	saveState();	// TODO undoCommand
 	BranchObj *bo;
 	bo=mapCenter->first();
 	bo=bo->next();
@@ -2976,7 +2969,7 @@
 	QColor col = QColorDialog::getColor( defLinkColor, this );
 	if ( !col.isValid() ) return;
 	setLinkColor( col );
-	saveState();	//FIXME undoCommand
+	saveState();	//TODO undoCommand
 
 }
 
@@ -3030,7 +3023,7 @@
 			QString fn=fd->selectedFile();
 			lastImageDir=fn.left(fn.findRev ("/"));
 			bo->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; i<length ; i++)
@@ -3897,7 +3889,7 @@
 
 		if (update) 
 		{
-			saveState();	//FIXME undo Command
+			saveState();	//TODO undo Command
 			mapCenter->reposition();
 			adjustCanvasSize();
 			canvas()->update();
diff -r 30b22f7bd009 -r d442a66e9121 mapeditor.h
--- a/mapeditor.h	Mon Sep 12 19:52:51 2005 +0000
+++ b/mapeditor.h	Thu Sep 22 12:14:23 2005 +0000
@@ -216,6 +216,7 @@
 	bool printFooter;			// Print footer below map
 
 	bool zipped;				// should map be zipped
+static	int mapNum;				// unique number for Editor
 	QString fileName;			// short name of file (for tab)
 	QString filePath;			// path to file which will be saved
 	QString fileDir;			// dir where file is saved
diff -r 30b22f7bd009 -r d442a66e9121 misc.cpp
--- a/misc.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/misc.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -2,6 +2,7 @@
 
 #include <qregexp.h>
 #include <qpoint.h>
+#include <stdlib.h>
 
 #include "misc.h"
 
@@ -123,8 +124,29 @@
 	return d;
 }
 
+QString makeUniqueDir (QString s)
+{
+	char *p;
+	int bytes=s.length();
+	p=(char*) malloc (bytes+1);
+	int i;
+	for (i=0;i<bytes;i++)
+		p[i]=s.at(i).latin1();
+	p[bytes]=0;	
+	QString r=mkdtemp (p);
+	free (p);
+	return r;
+}
+
 void removeDir(QDir d)
 {
+	if (d.path().left(4)!="/tmp")
+	{
+		// FIXME testing
+		qWarning ("misc.cpp::removeDir should remove "+d.path()+" - aborted.");
+		return;
+	}
+
 	// Traverse directories
 	d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
 	const QFileInfoList *dirlist = d.entryInfoList();
diff -r 30b22f7bd009 -r d442a66e9121 misc.h
--- a/misc.h	Mon Sep 12 19:52:51 2005 +0000
+++ b/misc.h	Thu Sep 22 12:14:23 2005 +0000
@@ -17,6 +17,7 @@
 QPoint normalise (const QPoint &);
 QString maskPath (QString );
 QString convertToRel (const QString &,const QString &);
+QString makeUniqueDir (QString);
 void removeDir(QDir);
 QString quotemeta(const QString&);	
 int max (int,int);
diff -r 30b22f7bd009 -r d442a66e9121 settings.cpp
--- a/settings.cpp	Mon Sep 12 19:52:51 2005 +0000
+++ b/settings.cpp	Thu Sep 22 12:14:23 2005 +0000
@@ -126,6 +126,7 @@
 					*itv=value;
 				else
 					*itv="";
+				*itv=value;
 				return;
 			}
 			itk++;
diff -r 30b22f7bd009 -r d442a66e9121 version.h
--- a/version.h	Mon Sep 12 19:52:51 2005 +0000
+++ b/version.h	Thu Sep 22 12:14:23 2005 +0000
@@ -2,6 +2,6 @@
 #define VERSION_H
 
 #define __VYM_VERSION__ "1.7.5"
-#define __BUILD_DATE__ "September 12, 2005"
+#define __BUILD_DATE__ "September 22, 2005"
 
 #endif