# HG changeset patch
# User insilmaril
# Date 1194610042 0
# Node ID 22955004d512f699740afad33d122412315027da
# Parent  4ffc47ae27e428a05eb4d0c523820d9ecaa015fd
1.11.3 Better windows support

diff -r 4ffc47ae27e4 -r 22955004d512 main.cpp
--- a/main.cpp	Fri Nov 09 12:07:21 2007 +0000
+++ b/main.cpp	Fri Nov 09 12:07:22 2007 +0000
@@ -6,6 +6,11 @@
 #include "settings.h"
 #include "version.h"
 
+#if defined(Q_OS_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
 // Global variables
 TextEditor *textEditor;			// used in Constr. of LinkableMapObj
 								// initialized in mainwindow
@@ -21,6 +26,9 @@
 QDir vymBaseDir;				// Containing all styles, scripts, images, ...
 QDir lastImageDir;
 QDir lastFileDir;
+#if defined(Q_OS_WIN32)
+QDir vymInstallDir;
+#endif
 QString iconPath;				// Pointing to icons used for toolbars
 QString flagsPath;				// Pointing to flags
 bool clipboardEmpty;			
@@ -97,6 +105,27 @@
 		#if defined (Q_OS_MACX)
 			vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
 
+        #elif defined (Q_OS_WIN32)
+            QString basePath;
+
+            wchar_t wbuf[512];
+            if (GetModuleFileName(NULL, wbuf, 512))
+            {
+                QString mfn(QString::fromWCharArray(wbuf));
+                mfn.replace('\\', '/');
+                if (mfn.endsWith("/bin/vym.exe", Qt::CaseInsensitive))
+                {
+                    mfn.chop(12);
+                    basePath = mfn;
+                }
+            }
+
+            if (basePath.isEmpty())
+                basePath = vymBaseDir.currentDirPath();
+
+            vymInstallDir.setPath(basePath);
+            vymBaseDir.setPath(basePath + "/share/vym");
+
 		#else
 			vymBaseDir.setPath ("/usr/share/vym");
 			if (!vymBaseDir.exists())
@@ -137,7 +166,12 @@
 	textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
 
 	// Initialize mainwindow 
+#if defined(Q_OS_WIN32)
+    Main m(0, 0, (Qt::Window | Qt::MSWindowsOwnDC));
+#else
     Main m;
+#endif
+
 	//m.resize(m.sizeHint());
 	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
 	m.show();
@@ -178,4 +212,3 @@
 
     return app.exec();
 }
-
diff -r 4ffc47ae27e4 -r 22955004d512 mainwindow.cpp
--- a/mainwindow.cpp	Fri Nov 09 12:07:21 2007 +0000
+++ b/mainwindow.cpp	Fri Nov 09 12:07:22 2007 +0000
@@ -68,6 +68,9 @@
 extern QDir vymBaseDir;
 extern QDir lastImageDir;
 extern QDir lastFileDir;
+#if defined(Q_OS_WIN32)
+extern QDir vymInstallDir;
+#endif
 extern QString iconPath;
 extern QString flagsPath;
 
@@ -79,9 +82,17 @@
 	setCaption ("VYM - View Your Mind");
 
 	// Load window settings
-	resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize());
-	move   (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
-
+#if defined(Q_OS_WIN32)
+    if (settings.value("/mainwindow/geometry/maximized", false).toBool())
+    {
+        showMaximized();
+    }
+    else
+#endif
+    {
+        resize (settings.value("/mainwindow/geometry/size", QSize (800,600)).toSize());
+        move   (settings.value("/mainwindow/geometry/pos",  QPoint(300,100)).toPoint());
+    }
 
 	// Sometimes we may need to remember old selections
 	prevSelection="";
@@ -174,6 +185,8 @@
 		#else
 			#if defined(Q_OS_MACX)
 				s=settings.value (p,"/usr/bin/open").toString();
+            #elif defined(Q_OS_WIN32)
+                s=settings.value (p,"acrord32").toString();
 			#else
 				s=settings.value (p,"acroread").toString();
 			#endif
@@ -216,8 +229,11 @@
 Main::~Main()
 {
 	// Save Settings
-	settings.setValue ( "/mainwindow/geometry/size", size() );
-	settings.setValue ( "/mainwindow/geometry/pos", pos() );
+#if defined(Q_OS_WIN32)
+    settings.setValue ("/mainwindow/geometry/maximized", isMaximized());
+#endif
+	settings.setValue ("/mainwindow/geometry/size", size());
+	settings.setValue ("/mainwindow/geometry/pos", pos());
 	settings.setValue ("/mainwindow/state",saveState(0));
 
 	settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn());
@@ -227,6 +243,7 @@
 
 	settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
 	settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() );
+	settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
 	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
 	settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() );
 	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
@@ -1389,6 +1406,14 @@
 	settingsMenu->addAction (a);
 	actionSettingsAutosaveTime=a;
 
+    a = new QAction( tr( "Backup file","Settings action"), this);
+    a->setStatusTip( tr( "Write backup file"));
+	a->setToggleAction(true);
+	a->setOn ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
+    connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) );
+	settingsMenu->addAction (a);
+	actionSettingsWriteBackupFile=a;
+
 	settingsMenu->addSeparator();
 
     a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
@@ -1812,7 +1837,7 @@
 
 		// Create temporary directory for packing
 		bool ok;
-		QString tmpMapDir=makeTmpDir (ok,"vym-pack");
+		QString tmpZipDir=makeTmpDir (ok,"vym-pack");
 		if (!ok)
 		{
 			QMessageBox::critical( 0, tr( "Critical Load Error" ),
@@ -1821,7 +1846,7 @@
 		}
 
 		// Try to unzip file
-		err=unzipDir (tmpMapDir,fn);
+		err=unzipDir (tmpZipDir,fn);
 		if (err==nozip)
 		{
 			mapfile=fn;
@@ -1833,22 +1858,22 @@
 			// Look for mapname.xml
 			mapfile= fn.left(fn.findRev(".",-1,true));
 			mapfile=mapfile.section( '/', -1 );
-			QFile file( tmpMapDir + "/" + mapfile + ".xml");
+			QFile file( tmpZipDir + "/" + mapfile + ".xml");
 			if (!file.exists() )
 			{
 				// mapname.xml does not exist, well, 
 				// maybe someone renamed the mapname.vym file...
 				// Try to find any .xml in the toplevel 
 				// directory of the .vym file
-				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
+				QStringList flist=QDir (tmpZipDir).entryList("*.xml");
 				if (flist.count()==1) 
 				{
 					// Only one entry, take this one
-					mapfile=tmpMapDir + "/"+flist.first();
+					mapfile=tmpZipDir + "/"+flist.first();
 				} else
 				{
 					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
-						*it=tmpMapDir + "/" + *it;
+						*it=tmpZipDir + "/" + *it;
 					// TODO Multiple entries, load all (but only the first one into this ME)
 					//mainWindow->fileLoadFromTmp (flist);
 					//returnCode=1;	// Silently forget this attempt to load
@@ -1903,7 +1928,7 @@
 		}	
 
 		// Delete tmpDir
-		removeDir (QDir(tmpMapDir));
+		removeDir (QDir(tmpZipDir));
 	}
 	return err;
 }
@@ -1976,7 +2001,7 @@
 void Main::fileSave(MapEditor *me, const SaveMode &savemode)
 {
 	// tmp dir for zipping 
-	QString tmpMapDir;
+	QString tmpZipDir;
 	
 	// Error codes
 	ErrorCode err=success;
@@ -1992,13 +2017,6 @@
 		if ( !fn.isEmpty() ) 
 		{	
 			// We have a filepath, go on saving			
-			// First remove existing file, we 
-			// don't want to add to old zip archives
-			QFile f(fn);
-			if (f.exists() ) 
-				if (!f.remove())
-					QMessageBox::warning( 0, tr( "Save Error" ),
-						fn+   tr("\ncould not be removed before saving"));
 
 			// Look, if we should zip the data:
 			if (!saveZipped)
@@ -2033,11 +2051,33 @@
 				me->setZipped (saveZipped);
 			}
 
+			// First backup existing file, we 
+			// don't want to add to old zip archives
+			QFile f(fn);
+			if (f.exists())
+            {
+				if (actionSettingsWriteBackupFile->isOn())
+				{
+					QString bfn(fn + "~");
+					QFile bf(bfn);
+					if (bf.exists() && !bf.remove())
+					{
+						QMessageBox::warning(0, tr("Save Error"),
+											 bfn + tr("\ncould not be removed before saving"));
+					}
+					else if (!f.rename(bfn))
+					{
+						QMessageBox::warning(0, tr("Save Error"),
+											 fn + tr("\ncould not be renamed before saving"));
+					}
+				}
+            }
+
 			if (saveZipped)
 			{
 				// Create temporary directory for packing
 				bool ok;
-				QString tmpMapDir=makeTmpDir (ok,"vym-zip");
+				tmpZipDir=makeTmpDir (ok,"vym-zip");
 				if (!ok)
 				{
 					QMessageBox::critical( 0, tr( "Critical Load Error" ),
@@ -2046,13 +2086,13 @@
 				}
 
 				safeFilePath=me->getFilePath();
-				me->setFilePath (tmpMapDir+"/"+
+				me->setFilePath (tmpZipDir+"/"+
 					me->getMapName()+ ".xml",
 					safeFilePath);
 				me->save (savemode);
 				me->setFilePath (safeFilePath);
 				
-				zipDir (tmpMapDir,fn);
+				zipDir (tmpZipDir,fn);
 			} // save zipped
 			else
 			{
@@ -2074,9 +2114,9 @@
 		}
     }
 
-	if (saveZipped && !tmpMapDir.isEmpty())
+	if (saveZipped && !tmpZipDir.isEmpty())
 		// Delete tmpDir
-		removeDir (QDir(tmpMapDir));
+		removeDir (QDir(tmpZipDir));
 
 	if (err==success)
 	{
@@ -2399,12 +2439,13 @@
 
 void Main::fileCloseMap()
 {
-	if (currentMapEditor())
+	MapEditor *me = currentMapEditor();
+	if (me)
 	{
-		if (currentMapEditor()->hasChanged())
+		if (me->hasChanged())
 		{
 			QMessageBox mb( vymName,
-				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
+				tr("The map %1 has been modified but not saved yet. Do you want to").arg(me->getFileName()),
 				QMessageBox::Warning,
 				QMessageBox::Yes | QMessageBox::Default,
 				QMessageBox::No,
@@ -2415,7 +2456,7 @@
 			{
 				case QMessageBox::Yes:
 					// save and close
-					fileSave(currentMapEditor(), CompleteMap);
+					fileSave(me, CompleteMap);
 					break;
 				case QMessageBox::No:
 				// close  without saving
@@ -2425,11 +2466,12 @@
 				return;
 			}
 		} 
-		currentMapEditor()->closeMap();
-		tabWidget->removePage(currentMapEditor());
+		me->closeMap();
+		tabWidget->removePage(me);
 		if (tabWidget->count()==0)
 			actionFilePrint->setEnabled (false);
-	}	
+        delete me;
+	}
 }
 
 void Main::filePrint()
@@ -2708,7 +2750,7 @@
 		bool ok;
 		QString s=me->getHeading(ok,p);
 
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
 #else
 		if (ok && s!=lineedit->text())
 			me->setHeading(lineedit->text());
@@ -2742,7 +2784,7 @@
 			if (ok)
 			{
 				me->setStateEditHeading (true);
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
 				p=me->mapToGlobal (p);
 				QDialog *d =new QDialog(NULL);
 				QLineEdit *le=new QLineEdit (d);
@@ -2803,8 +2845,11 @@
 	*/
 }
 
+#include "attributedialog.h"
 void Main::editAttribute()
 {
+	AttributeDialog dia;
+	dia.exec();
 	/*
 	if (currentMapEditor())
 	{
@@ -3192,25 +3237,37 @@
 void Main::formatLinkStyleLine()
 {
 	if (currentMapEditor())
+    {
 		currentMapEditor()->setMapLinkStyle("StyleLine");
+        actionFormatLinkStyleLine->setOn(true);
+    }
 }
 
 void Main::formatLinkStyleParabel()
 {
 	if (currentMapEditor())
+    {
 		currentMapEditor()->setMapLinkStyle("StyleParabel");
+        actionFormatLinkStyleParabel->setOn(true);
+    }
 }
 
 void Main::formatLinkStylePolyLine()
 {
 	if (currentMapEditor())
+    {
 		currentMapEditor()->setMapLinkStyle("StylePolyLine");
+        actionFormatLinkStylePolyLine->setOn(true);
+    }
 }
 
 void Main::formatLinkStylePolyParabel()
 {
 	if (currentMapEditor())
+    {
 		currentMapEditor()->setMapLinkStyle("StylePolyParabel");
+        actionFormatLinkStylePolyParabel->setOn(true);
+    }
 }
 
 void Main::formatSelectBackColor()
@@ -3328,8 +3385,7 @@
 
 void Main::settingsMacroDir()
 {
-	QDir defdir=vymBaseDir;
-	defdir.cd("macros");
+	QDir defdir(vymBaseDir.path() + "/macros");
 	if (!defdir.exists())
 		defdir=vymBaseDir;
 	QDir dir=QFileDialog::getExistingDirectory (
@@ -3338,7 +3394,7 @@
 		settings.value ("/macros/macroDir",defdir.path()).toString()
 	);
 	if (dir.exists())
-		settings.setValue ("/macros/macroDir",dir.path());
+		settings.setValue ("/macros/macroDir",dir.absolutePath());
 }
 
 void Main::settingsUndoLevels()
@@ -3374,6 +3430,11 @@
     }	
 }
 
+void Main::settingsWriteBackupFileToggle()
+{
+	settings.setValue ("/mapeditor/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
+}
+
 void Main::settingsToggleDelKey()
 {
 	if (actionSettingsUseDelKey->isOn())
@@ -3763,12 +3824,14 @@
 	QDir docdir;
 	#if defined(Q_OS_MACX)
 		searchList << "./vym.app/Contents/Resources/doc";
+    #elif defined(Q_OS_WIN32)
+        searchList << vymInstallDir.path() + "/share/doc/packages/vym";
 	#else
 		#if defined(VYM_DOCDIR)
 			searchList << VYM_DOCDIR;
 		#endif
 		// default path in SUSE LINUX
-		searchList <<"/usr/share/doc/packages/vym";
+		searchList << "/usr/share/doc/packages/vym";
 	#endif
 
 	searchList << "doc";	// relative path for easy testing in tarball
@@ -3780,14 +3843,14 @@
 	QFile docfile;
 	for (int i=0; i<searchList.count(); ++i)
 	{
-		docfile.setFileName(QDir::convertSeparators(searchList.at(i)+"/"+docname));
-		if (docfile.exists() )
+		docfile.setFileName(searchList.at(i)+"/"+docname);
+		if (docfile.exists())
 		{
 			found=true;
 			break;
 		}	
-
 	}
+
 	if (!found)
 	{
 		QMessageBox::critical(0, 
@@ -3798,7 +3861,7 @@
 
 	QStringList args;
 	Process *pdfProc = new Process();
-	args <<docfile.fileName();
+    args << QDir::toNativeSeparators(docfile.fileName());
 
 	pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
 	if ( !pdfProc->waitForStarted() ) 
diff -r 4ffc47ae27e4 -r 22955004d512 mainwindow.h
--- a/mainwindow.h	Fri Nov 09 12:07:21 2007 +0000
+++ b/mainwindow.h	Fri Nov 09 12:07:22 2007 +0000
@@ -183,6 +183,7 @@
 	void settingsUndoLevels();
 	void settingsAutosaveToggle();
 	void settingsAutosaveTime();
+	void settingsWriteBackupFileToggle();
 
 	void windowToggleNoteEditor();
 	void windowToggleHistory();
@@ -328,6 +329,7 @@
 	QAction* actionSettingsUseHideExport;
 	QAction* actionSettingsAutosaveToggle;
 	QAction* actionSettingsAutosaveTime;
+	QAction* actionSettingsWriteBackupFile;
 };
 
 
diff -r 4ffc47ae27e4 -r 22955004d512 mapeditor.cpp
--- a/mapeditor.cpp	Fri Nov 09 12:07:21 2007 +0000
+++ b/mapeditor.cpp	Fri Nov 09 12:07:22 2007 +0000
@@ -159,6 +159,10 @@
 {
 	//cout <<"Destructor MapEditor\n";
 	autosaveTimer->stop();
+
+	// tmpMapDir is in tmpVymDir, so it gets removed automagically when vym closes
+	
+	//removeDir(QDir(tmpMapDir));
 }
 
 MapCenterObj* MapEditor::getMapCenter()
@@ -227,8 +231,8 @@
 void MapEditor::makeTmpDirs()
 {
 	// Create unique temporary directories
-	tmpMapDir=QDir::convertSeparators (tmpVymDir+QString("/mapeditor-%1").arg(mapNum));
-	histPath=QDir::convertSeparators (tmpMapDir+"/history");
+	tmpMapDir = tmpVymDir+QString("/mapeditor-%1").arg(mapNum);
+	histPath = tmpMapDir+"/history";
 	QDir d;
 	d.mkdir (tmpMapDir);
 }
@@ -317,8 +321,8 @@
 
 QString MapEditor::getHistoryDir()
 {
-	QString histName=QDir::convertSeparators (QString("history-%1").arg(curStep));
-	return QDir::convertSeparators (tmpMapDir +"/"+histName);
+	QString histName(QString("history-%1").arg(curStep));
+	return (tmpMapDir+"/"+histName);
 }
 
 void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
@@ -339,7 +343,7 @@
 	
 	QString backupXML="";
 	QString histDir=getHistoryDir();
-	QString bakMapPath=QDir::convertSeparators(histDir+"/map.xml");
+	QString bakMapPath=histDir+"/map.xml";
 
 	// Create histDir if not available
 	QDir d(histDir);
@@ -363,7 +367,7 @@
 
 	if (!backupXML.isEmpty())
 		// Write XML Data to disk
-		saveStringToDisk (QString(bakMapPath),backupXML);
+		saveStringToDisk (bakMapPath,backupXML);
 
 	// We would have to save all actions in a tree, to keep track of 
 	// possible redos after a action. Possible, but we are too lazy: forget about redos.
@@ -545,7 +549,7 @@
 		{
 			//s=parser.parString (ok,0);	// selection
 			t=parser.parString (ok,0);	// path to map
-			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
+			if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
 			addMapReplaceInt(selb->getSelectString(),t);	
 		}
 	/////////////////////////////////////////////////////////////////////
@@ -563,7 +567,7 @@
 			{
 				t=parser.parString (ok,0);	// path to map
 				n=parser.parInt(ok,1);		// position
-				if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
+				if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
 				addMapInsertInt(t,n);	
 			}
 		}
@@ -1952,8 +1956,8 @@
 		}
 
 		// Copy also to global clipboard, because we are at last step in history
-		QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(curStep));
-		QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
+		QString bakMapName(QString("history-%1").arg(curStep));
+		QString bakMapDir(tmpMapDir +"/"+bakMapName);
 		copyDir (bakMapDir,clipboardDir );
 
 		clipboardEmpty=false;
@@ -1987,7 +1991,7 @@
 
 
 	// Find out current undo directory
-	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
+	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
 
 	if (debug)
 	{
@@ -2063,7 +2067,7 @@
 			tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(vymVersion));
 
 	// Find out current undo directory
-	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
+	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
 
 	// select  object before undo
 	if (!undoSelection.isEmpty())
@@ -2227,8 +2231,8 @@
 	if (redosAvail > 0 || n!=0)
 	{
 		// Use the "historical" buffer
-		QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(n));
-		QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
+		QString bakMapName(QString("history-%1").arg(n));
+		QString bakMapDir(tmpMapDir +"/"+bakMapName);
 		load (bakMapDir+"/"+clipboardFile,ImportAdd, VymMap);
 	} else
 		// Use the global buffer
@@ -2278,17 +2282,21 @@
 	LinkableMapObj *sel=xelection.single();
 	if (sel)
 	{
-		QString ps=qpointfToString (sel->getAbsPos());
-		QString s=xelection.single()->getSelectString();
-		saveState(
-			s, "move "+ps, 
-			s, "move "+qpointfToString (QPointF (x,y)), 
-			QString("Move %1 to  %2").arg(getName(sel)).arg(ps));
-		sel->move(x,y);
-		mapCenter->reposition();
-		xelection.update();
+        QPointF ap(sel->getAbsPos());
+        QPointF to(x, y);
+        if (ap != to)
+        {
+            QString ps=qpointfToString(ap);
+            QString s=xelection.single()->getSelectString();
+            saveState(
+                s, "move "+ps, 
+                s, "move "+qpointfToString(to), 
+                QString("Move %1 to %2").arg(getName(sel)).arg(ps));
+            sel->move(x,y);
+            mapCenter->reposition();
+            xelection.update();
+        }
 	}
-
 }
 
 void MapEditor::moveRel (const double &x, const double &y)
@@ -2296,16 +2304,21 @@
 	LinkableMapObj *sel=xelection.single();
 	if (sel)
 	{
-		QString ps=qpointfToString (sel->getRelPos());
-		QString s=sel->getSelectString();
-		saveState(
-			s, "moveRel "+ps, 
-			s, "moveRel "+qpointfToString (QPointF (x,y)), 
-			QString("Move %1 to relativ position %2").arg(getName(sel)).arg(ps));
-		((OrnamentedObj*)sel)->move2RelPos (x,y);
-		mapCenter->reposition();
-		sel->updateLink();
-		xelection.update();
+        QPointF rp(sel->getRelPos());
+        QPointF to(x, y);
+        if (rp != to)
+        {
+            QString ps=qpointfToString (sel->getRelPos());
+            QString s=sel->getSelectString();
+            saveState(
+                s, "moveRel "+ps, 
+                s, "moveRel "+qpointfToString(to), 
+                QString("Move %1 to relative position %2").arg(getName(sel)).arg(ps));
+            ((OrnamentedObj*)sel)->move2RelPos (x,y);
+            mapCenter->reposition();
+            sel->updateLink();
+            xelection.update();
+        }
 	}
 }
 
@@ -4452,7 +4465,7 @@
 						"moveRel "+pold,
 						fio,
 						"moveRel "+pnow,
-						QString("Move %1 to relativ position %2").arg(getName(fio)).arg(pnow));
+						QString("Move %1 to relative position %2").arg(getName(fio)).arg(pnow));
 					fio->getParObj()->requestReposition();
 					mapCenter->reposition();
 
@@ -4596,7 +4609,7 @@
 				"moveRel "+pold,
 				fo,
 				"moveRel "+pnow,
-				QString("Move %1 to relativ position %2").arg(getName(fo)).arg(pnow));
+				QString("Move %1 to relative position %2").arg(getName(fo)).arg(pnow));
 
 			fo->getParObj()->requestReposition();
 			mapCenter->reposition();
@@ -4613,16 +4626,19 @@
 		{	
 			// TODO: Check for problems if graphicsview is resized for 
 			// undo/redo...
-		    QString pold=qpointfToString(movingObj_orgPos);
-		    QString pnow=qpointfToString(mapCenter->getAbsPos());
-			saveState(
-				fo,
-				"move "+pold,
-				fo,
-				"move "+pnow,
-				QString("Move mapcenter %1 to position %2").arg(getName(mapCenter)).arg(pnow));
+            if (movingObj_orgPos != mapCenter->getAbsPos())
+            {
+                QString pold=qpointfToString(movingObj_orgPos);
+                QString pnow=qpointfToString(mapCenter->getAbsPos());
+                saveState(
+                    fo,
+                    "move "+pold,
+                    fo,
+                    "move "+pnow,
+                    QString("Move mapcenter %1 to position %2").arg(getName(mapCenter)).arg(pnow));
+            }
 		}
-		
+
 		if (xelection.type() == Selection::Branch )
 		{	// A branch was moved
 			
@@ -4683,12 +4699,15 @@
 					// Therefor reposition and then use string of old selection, too
 					mapCenter->reposition();
 
-					QString ps=qpointfToString ( lmosel->getRelPos() );
-					saveState(
-						lmosel->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
-						preSelStr, "moveRel "+ps, 
-						QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps));
-			
+                    QPointF rp(lmosel->getRelPos());
+                    if (rp != movingObj_orgRelPos)
+                    {
+                        QString ps=qpointfToString(rp);
+                        saveState(
+                            lmosel->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
+                            preSelStr, "moveRel "+ps, 
+                            QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps));
+                    }
 				}
 			// Draw the original link, before selection was moved around
 			mapCenter->reposition();
@@ -4788,7 +4807,7 @@
 						s=uris.at(i).toLocalFile();
 						if (!s.isEmpty()) 
 						{
-						   QString file = QDir::convertSeparators(s);
+						   QString file = QDir::fromNativeSeparators(s);
 						   heading = QFileInfo(file).baseName();
 						   files.append(file);
 						   if (file.endsWith(".vym", false))
diff -r 4ffc47ae27e4 -r 22955004d512 noteobj.cpp
--- a/noteobj.cpp	Fri Nov 09 12:07:21 2007 +0000
+++ b/noteobj.cpp	Fri Nov 09 12:07:22 2007 +0000
@@ -168,7 +168,7 @@
 	// There are 2 <style> tags in one <li>, so we merge them here
 	int pos=0;
 	bool inbracket=false;
-	int begin_bracket;
+	int begin_bracket=0;
 	bool inquot=false;
 	QString n=note;
 	while (pos<n.length())
diff -r 4ffc47ae27e4 -r 22955004d512 tex/vym.changelog
--- a/tex/vym.changelog	Fri Nov 09 12:07:21 2007 +0000
+++ b/tex/vym.changelog	Fri Nov 09 12:07:22 2007 +0000
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Fri Nov  9 10:44:59 CET 2007 - uwedr@suse.de
+
+- Version: 1.11.3
+- Feature: Added patches for better windows support by Andrew Ng
+
 -------------------------------------------------------------------
 Tue Nov  6 22:36:38 CET 2007 - uwedr@suse.de
 
diff -r 4ffc47ae27e4 -r 22955004d512 version.h
--- a/version.h	Fri Nov 09 12:07:21 2007 +0000
+++ b/version.h	Fri Nov 09 12:07:22 2007 +0000
@@ -4,10 +4,10 @@
 #include <QString>
 
 #define __VYM_NAME "VYM"
-#define __VYM_VERSION "1.11.2"
+#define __VYM_VERSION "1.11.3"
 //#define __VYM_CODENAME "Codename: 1.10.0-RC-3"
 #define __VYM_CODENAME "Codename: development version"
-#define __VYM_BUILD_DATE "2007-11-06"
+#define __VYM_BUILD_DATE "2007-11-09"
 
 
 bool checkVersion(const QString &);
diff -r 4ffc47ae27e4 -r 22955004d512 vym.pro
--- a/vym.pro	Fri Nov 09 12:07:21 2007 +0000
+++ b/vym.pro	Fri Nov 09 12:07:22 2007 +0000
@@ -7,7 +7,7 @@
 # Manifest embedding was suggested by Qt docs somewhere...
 win32: CONFIG += embed_manifest_exe
 
-# Without this, M_PI, and M_PI_2 won't be defined.
+# Without this, M_PI, and M_PI_2 won`t be defined.
 win32:DEFINES *= _USE_MATH_DEFINES
 
 ICON =icons/vym.icns
@@ -15,10 +15,12 @@
 QT += qt3support
 QT += network
 
-HEADERS	+= \	
+HEADERS	+= \
 	aboutdialog.h \
 	animpoint.h \
 	attribute.h \
+	attributewidget.h \
+	attributedialog.h \
 	branchobj.h \
 	branchpropwindow.h\
 	editxlinkdialog.h \
@@ -67,6 +69,8 @@
 	aboutdialog.cpp \
 	animpoint.cpp \
 	attribute.cpp \
+	attributewidget.cpp \
+	attributedialog.cpp \
 	branchobj.cpp \
 	branchpropwindow.cpp \
 	editxlinkdialog.cpp \
@@ -110,9 +114,11 @@
 	xmlobj.cpp \
 	xsltproc.cpp \
 	settings.cpp \
-	warningdialog.cpp 
+	warningdialog.cpp
 
 FORMS = \
+	attributewidget.ui \
+	attributedialog.ui \
 	branchpropwindow.ui \
 	exportxhtmldialog.ui \
 	extrainfodialog.ui \
@@ -122,8 +128,14 @@
 	showtextdialog.ui \
 	warningdialog.ui
 
+win32 {
+	HEADERS += mkdtemp.h
+	SOURCES += mkdtemp.cpp
+	RC_FILE = vym.rc
+}
+
 #The following lines were inserted by qt3to4
-QT += xml  
+QT += xml
 
 TARGET  = vym
 
@@ -163,7 +175,7 @@
 support.path = $${DATADIR}/vym
 INSTALLS += support 
 
-doc.files = tex/vym.pdf
+doc.files = doc/vym.pdf
 doc.path = $${DOCDIR}
 INSTALLS += doc
 DEFINES += VYM_DOCDIR=\\\"$${DOCDIR}\\\"
@@ -171,4 +183,3 @@
 demo.files = demos/
 demo.path = $${DEMODIR}
 INSTALLS += demo
-