1.11.3 Better windows support
authorinsilmaril
Fri Nov 09 12:07:22 2007 +0000 (2007-11-09)
changeset 62522955004d512
parent 624 4ffc47ae27e4
child 626 96c8e6860e0c
1.11.3 Better windows support
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
noteobj.cpp
tex/vym.changelog
version.h
vym.pro
     1.1 --- a/main.cpp	Fri Nov 09 12:07:21 2007 +0000
     1.2 +++ b/main.cpp	Fri Nov 09 12:07:22 2007 +0000
     1.3 @@ -6,6 +6,11 @@
     1.4  #include "settings.h"
     1.5  #include "version.h"
     1.6  
     1.7 +#if defined(Q_OS_WIN32)
     1.8 +#define WIN32_LEAN_AND_MEAN
     1.9 +#include <windows.h>
    1.10 +#endif
    1.11 +
    1.12  // Global variables
    1.13  TextEditor *textEditor;			// used in Constr. of LinkableMapObj
    1.14  								// initialized in mainwindow
    1.15 @@ -21,6 +26,9 @@
    1.16  QDir vymBaseDir;				// Containing all styles, scripts, images, ...
    1.17  QDir lastImageDir;
    1.18  QDir lastFileDir;
    1.19 +#if defined(Q_OS_WIN32)
    1.20 +QDir vymInstallDir;
    1.21 +#endif
    1.22  QString iconPath;				// Pointing to icons used for toolbars
    1.23  QString flagsPath;				// Pointing to flags
    1.24  bool clipboardEmpty;			
    1.25 @@ -97,6 +105,27 @@
    1.26  		#if defined (Q_OS_MACX)
    1.27  			vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
    1.28  
    1.29 +        #elif defined (Q_OS_WIN32)
    1.30 +            QString basePath;
    1.31 +
    1.32 +            wchar_t wbuf[512];
    1.33 +            if (GetModuleFileName(NULL, wbuf, 512))
    1.34 +            {
    1.35 +                QString mfn(QString::fromWCharArray(wbuf));
    1.36 +                mfn.replace('\\', '/');
    1.37 +                if (mfn.endsWith("/bin/vym.exe", Qt::CaseInsensitive))
    1.38 +                {
    1.39 +                    mfn.chop(12);
    1.40 +                    basePath = mfn;
    1.41 +                }
    1.42 +            }
    1.43 +
    1.44 +            if (basePath.isEmpty())
    1.45 +                basePath = vymBaseDir.currentDirPath();
    1.46 +
    1.47 +            vymInstallDir.setPath(basePath);
    1.48 +            vymBaseDir.setPath(basePath + "/share/vym");
    1.49 +
    1.50  		#else
    1.51  			vymBaseDir.setPath ("/usr/share/vym");
    1.52  			if (!vymBaseDir.exists())
    1.53 @@ -137,7 +166,12 @@
    1.54  	textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
    1.55  
    1.56  	// Initialize mainwindow 
    1.57 +#if defined(Q_OS_WIN32)
    1.58 +    Main m(0, 0, (Qt::Window | Qt::MSWindowsOwnDC));
    1.59 +#else
    1.60      Main m;
    1.61 +#endif
    1.62 +
    1.63  	//m.resize(m.sizeHint());
    1.64  	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
    1.65  	m.show();
    1.66 @@ -178,4 +212,3 @@
    1.67  
    1.68      return app.exec();
    1.69  }
    1.70 -
     2.1 --- a/mainwindow.cpp	Fri Nov 09 12:07:21 2007 +0000
     2.2 +++ b/mainwindow.cpp	Fri Nov 09 12:07:22 2007 +0000
     2.3 @@ -68,6 +68,9 @@
     2.4  extern QDir vymBaseDir;
     2.5  extern QDir lastImageDir;
     2.6  extern QDir lastFileDir;
     2.7 +#if defined(Q_OS_WIN32)
     2.8 +extern QDir vymInstallDir;
     2.9 +#endif
    2.10  extern QString iconPath;
    2.11  extern QString flagsPath;
    2.12  
    2.13 @@ -79,9 +82,17 @@
    2.14  	setCaption ("VYM - View Your Mind");
    2.15  
    2.16  	// Load window settings
    2.17 -	resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize());
    2.18 -	move   (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
    2.19 -
    2.20 +#if defined(Q_OS_WIN32)
    2.21 +    if (settings.value("/mainwindow/geometry/maximized", false).toBool())
    2.22 +    {
    2.23 +        showMaximized();
    2.24 +    }
    2.25 +    else
    2.26 +#endif
    2.27 +    {
    2.28 +        resize (settings.value("/mainwindow/geometry/size", QSize (800,600)).toSize());
    2.29 +        move   (settings.value("/mainwindow/geometry/pos",  QPoint(300,100)).toPoint());
    2.30 +    }
    2.31  
    2.32  	// Sometimes we may need to remember old selections
    2.33  	prevSelection="";
    2.34 @@ -174,6 +185,8 @@
    2.35  		#else
    2.36  			#if defined(Q_OS_MACX)
    2.37  				s=settings.value (p,"/usr/bin/open").toString();
    2.38 +            #elif defined(Q_OS_WIN32)
    2.39 +                s=settings.value (p,"acrord32").toString();
    2.40  			#else
    2.41  				s=settings.value (p,"acroread").toString();
    2.42  			#endif
    2.43 @@ -216,8 +229,11 @@
    2.44  Main::~Main()
    2.45  {
    2.46  	// Save Settings
    2.47 -	settings.setValue ( "/mainwindow/geometry/size", size() );
    2.48 -	settings.setValue ( "/mainwindow/geometry/pos", pos() );
    2.49 +#if defined(Q_OS_WIN32)
    2.50 +    settings.setValue ("/mainwindow/geometry/maximized", isMaximized());
    2.51 +#endif
    2.52 +	settings.setValue ("/mainwindow/geometry/size", size());
    2.53 +	settings.setValue ("/mainwindow/geometry/pos", pos());
    2.54  	settings.setValue ("/mainwindow/state",saveState(0));
    2.55  
    2.56  	settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn());
    2.57 @@ -227,6 +243,7 @@
    2.58  
    2.59  	settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
    2.60  	settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() );
    2.61 +	settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
    2.62  	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
    2.63  	settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() );
    2.64  	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
    2.65 @@ -1389,6 +1406,14 @@
    2.66  	settingsMenu->addAction (a);
    2.67  	actionSettingsAutosaveTime=a;
    2.68  
    2.69 +    a = new QAction( tr( "Backup file","Settings action"), this);
    2.70 +    a->setStatusTip( tr( "Write backup file"));
    2.71 +	a->setToggleAction(true);
    2.72 +	a->setOn ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
    2.73 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) );
    2.74 +	settingsMenu->addAction (a);
    2.75 +	actionSettingsWriteBackupFile=a;
    2.76 +
    2.77  	settingsMenu->addSeparator();
    2.78  
    2.79      a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
    2.80 @@ -1812,7 +1837,7 @@
    2.81  
    2.82  		// Create temporary directory for packing
    2.83  		bool ok;
    2.84 -		QString tmpMapDir=makeTmpDir (ok,"vym-pack");
    2.85 +		QString tmpZipDir=makeTmpDir (ok,"vym-pack");
    2.86  		if (!ok)
    2.87  		{
    2.88  			QMessageBox::critical( 0, tr( "Critical Load Error" ),
    2.89 @@ -1821,7 +1846,7 @@
    2.90  		}
    2.91  
    2.92  		// Try to unzip file
    2.93 -		err=unzipDir (tmpMapDir,fn);
    2.94 +		err=unzipDir (tmpZipDir,fn);
    2.95  		if (err==nozip)
    2.96  		{
    2.97  			mapfile=fn;
    2.98 @@ -1833,22 +1858,22 @@
    2.99  			// Look for mapname.xml
   2.100  			mapfile= fn.left(fn.findRev(".",-1,true));
   2.101  			mapfile=mapfile.section( '/', -1 );
   2.102 -			QFile file( tmpMapDir + "/" + mapfile + ".xml");
   2.103 +			QFile file( tmpZipDir + "/" + mapfile + ".xml");
   2.104  			if (!file.exists() )
   2.105  			{
   2.106  				// mapname.xml does not exist, well, 
   2.107  				// maybe someone renamed the mapname.vym file...
   2.108  				// Try to find any .xml in the toplevel 
   2.109  				// directory of the .vym file
   2.110 -				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
   2.111 +				QStringList flist=QDir (tmpZipDir).entryList("*.xml");
   2.112  				if (flist.count()==1) 
   2.113  				{
   2.114  					// Only one entry, take this one
   2.115 -					mapfile=tmpMapDir + "/"+flist.first();
   2.116 +					mapfile=tmpZipDir + "/"+flist.first();
   2.117  				} else
   2.118  				{
   2.119  					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
   2.120 -						*it=tmpMapDir + "/" + *it;
   2.121 +						*it=tmpZipDir + "/" + *it;
   2.122  					// TODO Multiple entries, load all (but only the first one into this ME)
   2.123  					//mainWindow->fileLoadFromTmp (flist);
   2.124  					//returnCode=1;	// Silently forget this attempt to load
   2.125 @@ -1903,7 +1928,7 @@
   2.126  		}	
   2.127  
   2.128  		// Delete tmpDir
   2.129 -		removeDir (QDir(tmpMapDir));
   2.130 +		removeDir (QDir(tmpZipDir));
   2.131  	}
   2.132  	return err;
   2.133  }
   2.134 @@ -1976,7 +2001,7 @@
   2.135  void Main::fileSave(MapEditor *me, const SaveMode &savemode)
   2.136  {
   2.137  	// tmp dir for zipping 
   2.138 -	QString tmpMapDir;
   2.139 +	QString tmpZipDir;
   2.140  	
   2.141  	// Error codes
   2.142  	ErrorCode err=success;
   2.143 @@ -1992,13 +2017,6 @@
   2.144  		if ( !fn.isEmpty() ) 
   2.145  		{	
   2.146  			// We have a filepath, go on saving			
   2.147 -			// First remove existing file, we 
   2.148 -			// don't want to add to old zip archives
   2.149 -			QFile f(fn);
   2.150 -			if (f.exists() ) 
   2.151 -				if (!f.remove())
   2.152 -					QMessageBox::warning( 0, tr( "Save Error" ),
   2.153 -						fn+   tr("\ncould not be removed before saving"));
   2.154  
   2.155  			// Look, if we should zip the data:
   2.156  			if (!saveZipped)
   2.157 @@ -2033,11 +2051,33 @@
   2.158  				me->setZipped (saveZipped);
   2.159  			}
   2.160  
   2.161 +			// First backup existing file, we 
   2.162 +			// don't want to add to old zip archives
   2.163 +			QFile f(fn);
   2.164 +			if (f.exists())
   2.165 +            {
   2.166 +				if (actionSettingsWriteBackupFile->isOn())
   2.167 +				{
   2.168 +					QString bfn(fn + "~");
   2.169 +					QFile bf(bfn);
   2.170 +					if (bf.exists() && !bf.remove())
   2.171 +					{
   2.172 +						QMessageBox::warning(0, tr("Save Error"),
   2.173 +											 bfn + tr("\ncould not be removed before saving"));
   2.174 +					}
   2.175 +					else if (!f.rename(bfn))
   2.176 +					{
   2.177 +						QMessageBox::warning(0, tr("Save Error"),
   2.178 +											 fn + tr("\ncould not be renamed before saving"));
   2.179 +					}
   2.180 +				}
   2.181 +            }
   2.182 +
   2.183  			if (saveZipped)
   2.184  			{
   2.185  				// Create temporary directory for packing
   2.186  				bool ok;
   2.187 -				QString tmpMapDir=makeTmpDir (ok,"vym-zip");
   2.188 +				tmpZipDir=makeTmpDir (ok,"vym-zip");
   2.189  				if (!ok)
   2.190  				{
   2.191  					QMessageBox::critical( 0, tr( "Critical Load Error" ),
   2.192 @@ -2046,13 +2086,13 @@
   2.193  				}
   2.194  
   2.195  				safeFilePath=me->getFilePath();
   2.196 -				me->setFilePath (tmpMapDir+"/"+
   2.197 +				me->setFilePath (tmpZipDir+"/"+
   2.198  					me->getMapName()+ ".xml",
   2.199  					safeFilePath);
   2.200  				me->save (savemode);
   2.201  				me->setFilePath (safeFilePath);
   2.202  				
   2.203 -				zipDir (tmpMapDir,fn);
   2.204 +				zipDir (tmpZipDir,fn);
   2.205  			} // save zipped
   2.206  			else
   2.207  			{
   2.208 @@ -2074,9 +2114,9 @@
   2.209  		}
   2.210      }
   2.211  
   2.212 -	if (saveZipped && !tmpMapDir.isEmpty())
   2.213 +	if (saveZipped && !tmpZipDir.isEmpty())
   2.214  		// Delete tmpDir
   2.215 -		removeDir (QDir(tmpMapDir));
   2.216 +		removeDir (QDir(tmpZipDir));
   2.217  
   2.218  	if (err==success)
   2.219  	{
   2.220 @@ -2399,12 +2439,13 @@
   2.221  
   2.222  void Main::fileCloseMap()
   2.223  {
   2.224 -	if (currentMapEditor())
   2.225 +	MapEditor *me = currentMapEditor();
   2.226 +	if (me)
   2.227  	{
   2.228 -		if (currentMapEditor()->hasChanged())
   2.229 +		if (me->hasChanged())
   2.230  		{
   2.231  			QMessageBox mb( vymName,
   2.232 -				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
   2.233 +				tr("The map %1 has been modified but not saved yet. Do you want to").arg(me->getFileName()),
   2.234  				QMessageBox::Warning,
   2.235  				QMessageBox::Yes | QMessageBox::Default,
   2.236  				QMessageBox::No,
   2.237 @@ -2415,7 +2456,7 @@
   2.238  			{
   2.239  				case QMessageBox::Yes:
   2.240  					// save and close
   2.241 -					fileSave(currentMapEditor(), CompleteMap);
   2.242 +					fileSave(me, CompleteMap);
   2.243  					break;
   2.244  				case QMessageBox::No:
   2.245  				// close  without saving
   2.246 @@ -2425,11 +2466,12 @@
   2.247  				return;
   2.248  			}
   2.249  		} 
   2.250 -		currentMapEditor()->closeMap();
   2.251 -		tabWidget->removePage(currentMapEditor());
   2.252 +		me->closeMap();
   2.253 +		tabWidget->removePage(me);
   2.254  		if (tabWidget->count()==0)
   2.255  			actionFilePrint->setEnabled (false);
   2.256 -	}	
   2.257 +        delete me;
   2.258 +	}
   2.259  }
   2.260  
   2.261  void Main::filePrint()
   2.262 @@ -2708,7 +2750,7 @@
   2.263  		bool ok;
   2.264  		QString s=me->getHeading(ok,p);
   2.265  
   2.266 -#if defined(Q_OS_MACX)
   2.267 +#if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
   2.268  #else
   2.269  		if (ok && s!=lineedit->text())
   2.270  			me->setHeading(lineedit->text());
   2.271 @@ -2742,7 +2784,7 @@
   2.272  			if (ok)
   2.273  			{
   2.274  				me->setStateEditHeading (true);
   2.275 -#if defined(Q_OS_MACX)
   2.276 +#if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
   2.277  				p=me->mapToGlobal (p);
   2.278  				QDialog *d =new QDialog(NULL);
   2.279  				QLineEdit *le=new QLineEdit (d);
   2.280 @@ -2803,8 +2845,11 @@
   2.281  	*/
   2.282  }
   2.283  
   2.284 +#include "attributedialog.h"
   2.285  void Main::editAttribute()
   2.286  {
   2.287 +	AttributeDialog dia;
   2.288 +	dia.exec();
   2.289  	/*
   2.290  	if (currentMapEditor())
   2.291  	{
   2.292 @@ -3192,25 +3237,37 @@
   2.293  void Main::formatLinkStyleLine()
   2.294  {
   2.295  	if (currentMapEditor())
   2.296 +    {
   2.297  		currentMapEditor()->setMapLinkStyle("StyleLine");
   2.298 +        actionFormatLinkStyleLine->setOn(true);
   2.299 +    }
   2.300  }
   2.301  
   2.302  void Main::formatLinkStyleParabel()
   2.303  {
   2.304  	if (currentMapEditor())
   2.305 +    {
   2.306  		currentMapEditor()->setMapLinkStyle("StyleParabel");
   2.307 +        actionFormatLinkStyleParabel->setOn(true);
   2.308 +    }
   2.309  }
   2.310  
   2.311  void Main::formatLinkStylePolyLine()
   2.312  {
   2.313  	if (currentMapEditor())
   2.314 +    {
   2.315  		currentMapEditor()->setMapLinkStyle("StylePolyLine");
   2.316 +        actionFormatLinkStylePolyLine->setOn(true);
   2.317 +    }
   2.318  }
   2.319  
   2.320  void Main::formatLinkStylePolyParabel()
   2.321  {
   2.322  	if (currentMapEditor())
   2.323 +    {
   2.324  		currentMapEditor()->setMapLinkStyle("StylePolyParabel");
   2.325 +        actionFormatLinkStylePolyParabel->setOn(true);
   2.326 +    }
   2.327  }
   2.328  
   2.329  void Main::formatSelectBackColor()
   2.330 @@ -3328,8 +3385,7 @@
   2.331  
   2.332  void Main::settingsMacroDir()
   2.333  {
   2.334 -	QDir defdir=vymBaseDir;
   2.335 -	defdir.cd("macros");
   2.336 +	QDir defdir(vymBaseDir.path() + "/macros");
   2.337  	if (!defdir.exists())
   2.338  		defdir=vymBaseDir;
   2.339  	QDir dir=QFileDialog::getExistingDirectory (
   2.340 @@ -3338,7 +3394,7 @@
   2.341  		settings.value ("/macros/macroDir",defdir.path()).toString()
   2.342  	);
   2.343  	if (dir.exists())
   2.344 -		settings.setValue ("/macros/macroDir",dir.path());
   2.345 +		settings.setValue ("/macros/macroDir",dir.absolutePath());
   2.346  }
   2.347  
   2.348  void Main::settingsUndoLevels()
   2.349 @@ -3374,6 +3430,11 @@
   2.350      }	
   2.351  }
   2.352  
   2.353 +void Main::settingsWriteBackupFileToggle()
   2.354 +{
   2.355 +	settings.setValue ("/mapeditor/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
   2.356 +}
   2.357 +
   2.358  void Main::settingsToggleDelKey()
   2.359  {
   2.360  	if (actionSettingsUseDelKey->isOn())
   2.361 @@ -3763,12 +3824,14 @@
   2.362  	QDir docdir;
   2.363  	#if defined(Q_OS_MACX)
   2.364  		searchList << "./vym.app/Contents/Resources/doc";
   2.365 +    #elif defined(Q_OS_WIN32)
   2.366 +        searchList << vymInstallDir.path() + "/share/doc/packages/vym";
   2.367  	#else
   2.368  		#if defined(VYM_DOCDIR)
   2.369  			searchList << VYM_DOCDIR;
   2.370  		#endif
   2.371  		// default path in SUSE LINUX
   2.372 -		searchList <<"/usr/share/doc/packages/vym";
   2.373 +		searchList << "/usr/share/doc/packages/vym";
   2.374  	#endif
   2.375  
   2.376  	searchList << "doc";	// relative path for easy testing in tarball
   2.377 @@ -3780,14 +3843,14 @@
   2.378  	QFile docfile;
   2.379  	for (int i=0; i<searchList.count(); ++i)
   2.380  	{
   2.381 -		docfile.setFileName(QDir::convertSeparators(searchList.at(i)+"/"+docname));
   2.382 -		if (docfile.exists() )
   2.383 +		docfile.setFileName(searchList.at(i)+"/"+docname);
   2.384 +		if (docfile.exists())
   2.385  		{
   2.386  			found=true;
   2.387  			break;
   2.388  		}	
   2.389 -
   2.390  	}
   2.391 +
   2.392  	if (!found)
   2.393  	{
   2.394  		QMessageBox::critical(0, 
   2.395 @@ -3798,7 +3861,7 @@
   2.396  
   2.397  	QStringList args;
   2.398  	Process *pdfProc = new Process();
   2.399 -	args <<docfile.fileName();
   2.400 +    args << QDir::toNativeSeparators(docfile.fileName());
   2.401  
   2.402  	pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
   2.403  	if ( !pdfProc->waitForStarted() ) 
     3.1 --- a/mainwindow.h	Fri Nov 09 12:07:21 2007 +0000
     3.2 +++ b/mainwindow.h	Fri Nov 09 12:07:22 2007 +0000
     3.3 @@ -183,6 +183,7 @@
     3.4  	void settingsUndoLevels();
     3.5  	void settingsAutosaveToggle();
     3.6  	void settingsAutosaveTime();
     3.7 +	void settingsWriteBackupFileToggle();
     3.8  
     3.9  	void windowToggleNoteEditor();
    3.10  	void windowToggleHistory();
    3.11 @@ -328,6 +329,7 @@
    3.12  	QAction* actionSettingsUseHideExport;
    3.13  	QAction* actionSettingsAutosaveToggle;
    3.14  	QAction* actionSettingsAutosaveTime;
    3.15 +	QAction* actionSettingsWriteBackupFile;
    3.16  };
    3.17  
    3.18  
     4.1 --- a/mapeditor.cpp	Fri Nov 09 12:07:21 2007 +0000
     4.2 +++ b/mapeditor.cpp	Fri Nov 09 12:07:22 2007 +0000
     4.3 @@ -159,6 +159,10 @@
     4.4  {
     4.5  	//cout <<"Destructor MapEditor\n";
     4.6  	autosaveTimer->stop();
     4.7 +
     4.8 +	// tmpMapDir is in tmpVymDir, so it gets removed automagically when vym closes
     4.9 +	
    4.10 +	//removeDir(QDir(tmpMapDir));
    4.11  }
    4.12  
    4.13  MapCenterObj* MapEditor::getMapCenter()
    4.14 @@ -227,8 +231,8 @@
    4.15  void MapEditor::makeTmpDirs()
    4.16  {
    4.17  	// Create unique temporary directories
    4.18 -	tmpMapDir=QDir::convertSeparators (tmpVymDir+QString("/mapeditor-%1").arg(mapNum));
    4.19 -	histPath=QDir::convertSeparators (tmpMapDir+"/history");
    4.20 +	tmpMapDir = tmpVymDir+QString("/mapeditor-%1").arg(mapNum);
    4.21 +	histPath = tmpMapDir+"/history";
    4.22  	QDir d;
    4.23  	d.mkdir (tmpMapDir);
    4.24  }
    4.25 @@ -317,8 +321,8 @@
    4.26  
    4.27  QString MapEditor::getHistoryDir()
    4.28  {
    4.29 -	QString histName=QDir::convertSeparators (QString("history-%1").arg(curStep));
    4.30 -	return QDir::convertSeparators (tmpMapDir +"/"+histName);
    4.31 +	QString histName(QString("history-%1").arg(curStep));
    4.32 +	return (tmpMapDir+"/"+histName);
    4.33  }
    4.34  
    4.35  void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
    4.36 @@ -339,7 +343,7 @@
    4.37  	
    4.38  	QString backupXML="";
    4.39  	QString histDir=getHistoryDir();
    4.40 -	QString bakMapPath=QDir::convertSeparators(histDir+"/map.xml");
    4.41 +	QString bakMapPath=histDir+"/map.xml";
    4.42  
    4.43  	// Create histDir if not available
    4.44  	QDir d(histDir);
    4.45 @@ -363,7 +367,7 @@
    4.46  
    4.47  	if (!backupXML.isEmpty())
    4.48  		// Write XML Data to disk
    4.49 -		saveStringToDisk (QString(bakMapPath),backupXML);
    4.50 +		saveStringToDisk (bakMapPath,backupXML);
    4.51  
    4.52  	// We would have to save all actions in a tree, to keep track of 
    4.53  	// possible redos after a action. Possible, but we are too lazy: forget about redos.
    4.54 @@ -545,7 +549,7 @@
    4.55  		{
    4.56  			//s=parser.parString (ok,0);	// selection
    4.57  			t=parser.parString (ok,0);	// path to map
    4.58 -			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
    4.59 +			if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
    4.60  			addMapReplaceInt(selb->getSelectString(),t);	
    4.61  		}
    4.62  	/////////////////////////////////////////////////////////////////////
    4.63 @@ -563,7 +567,7 @@
    4.64  			{
    4.65  				t=parser.parString (ok,0);	// path to map
    4.66  				n=parser.parInt(ok,1);		// position
    4.67 -				if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
    4.68 +				if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
    4.69  				addMapInsertInt(t,n);	
    4.70  			}
    4.71  		}
    4.72 @@ -1952,8 +1956,8 @@
    4.73  		}
    4.74  
    4.75  		// Copy also to global clipboard, because we are at last step in history
    4.76 -		QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(curStep));
    4.77 -		QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
    4.78 +		QString bakMapName(QString("history-%1").arg(curStep));
    4.79 +		QString bakMapDir(tmpMapDir +"/"+bakMapName);
    4.80  		copyDir (bakMapDir,clipboardDir );
    4.81  
    4.82  		clipboardEmpty=false;
    4.83 @@ -1987,7 +1991,7 @@
    4.84  
    4.85  
    4.86  	// Find out current undo directory
    4.87 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
    4.88 +	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
    4.89  
    4.90  	if (debug)
    4.91  	{
    4.92 @@ -2063,7 +2067,7 @@
    4.93  			tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(vymVersion));
    4.94  
    4.95  	// Find out current undo directory
    4.96 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
    4.97 +	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
    4.98  
    4.99  	// select  object before undo
   4.100  	if (!undoSelection.isEmpty())
   4.101 @@ -2227,8 +2231,8 @@
   4.102  	if (redosAvail > 0 || n!=0)
   4.103  	{
   4.104  		// Use the "historical" buffer
   4.105 -		QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(n));
   4.106 -		QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
   4.107 +		QString bakMapName(QString("history-%1").arg(n));
   4.108 +		QString bakMapDir(tmpMapDir +"/"+bakMapName);
   4.109  		load (bakMapDir+"/"+clipboardFile,ImportAdd, VymMap);
   4.110  	} else
   4.111  		// Use the global buffer
   4.112 @@ -2278,17 +2282,21 @@
   4.113  	LinkableMapObj *sel=xelection.single();
   4.114  	if (sel)
   4.115  	{
   4.116 -		QString ps=qpointfToString (sel->getAbsPos());
   4.117 -		QString s=xelection.single()->getSelectString();
   4.118 -		saveState(
   4.119 -			s, "move "+ps, 
   4.120 -			s, "move "+qpointfToString (QPointF (x,y)), 
   4.121 -			QString("Move %1 to  %2").arg(getName(sel)).arg(ps));
   4.122 -		sel->move(x,y);
   4.123 -		mapCenter->reposition();
   4.124 -		xelection.update();
   4.125 +        QPointF ap(sel->getAbsPos());
   4.126 +        QPointF to(x, y);
   4.127 +        if (ap != to)
   4.128 +        {
   4.129 +            QString ps=qpointfToString(ap);
   4.130 +            QString s=xelection.single()->getSelectString();
   4.131 +            saveState(
   4.132 +                s, "move "+ps, 
   4.133 +                s, "move "+qpointfToString(to), 
   4.134 +                QString("Move %1 to %2").arg(getName(sel)).arg(ps));
   4.135 +            sel->move(x,y);
   4.136 +            mapCenter->reposition();
   4.137 +            xelection.update();
   4.138 +        }
   4.139  	}
   4.140 -
   4.141  }
   4.142  
   4.143  void MapEditor::moveRel (const double &x, const double &y)
   4.144 @@ -2296,16 +2304,21 @@
   4.145  	LinkableMapObj *sel=xelection.single();
   4.146  	if (sel)
   4.147  	{
   4.148 -		QString ps=qpointfToString (sel->getRelPos());
   4.149 -		QString s=sel->getSelectString();
   4.150 -		saveState(
   4.151 -			s, "moveRel "+ps, 
   4.152 -			s, "moveRel "+qpointfToString (QPointF (x,y)), 
   4.153 -			QString("Move %1 to relativ position %2").arg(getName(sel)).arg(ps));
   4.154 -		((OrnamentedObj*)sel)->move2RelPos (x,y);
   4.155 -		mapCenter->reposition();
   4.156 -		sel->updateLink();
   4.157 -		xelection.update();
   4.158 +        QPointF rp(sel->getRelPos());
   4.159 +        QPointF to(x, y);
   4.160 +        if (rp != to)
   4.161 +        {
   4.162 +            QString ps=qpointfToString (sel->getRelPos());
   4.163 +            QString s=sel->getSelectString();
   4.164 +            saveState(
   4.165 +                s, "moveRel "+ps, 
   4.166 +                s, "moveRel "+qpointfToString(to), 
   4.167 +                QString("Move %1 to relative position %2").arg(getName(sel)).arg(ps));
   4.168 +            ((OrnamentedObj*)sel)->move2RelPos (x,y);
   4.169 +            mapCenter->reposition();
   4.170 +            sel->updateLink();
   4.171 +            xelection.update();
   4.172 +        }
   4.173  	}
   4.174  }
   4.175  
   4.176 @@ -4452,7 +4465,7 @@
   4.177  						"moveRel "+pold,
   4.178  						fio,
   4.179  						"moveRel "+pnow,
   4.180 -						QString("Move %1 to relativ position %2").arg(getName(fio)).arg(pnow));
   4.181 +						QString("Move %1 to relative position %2").arg(getName(fio)).arg(pnow));
   4.182  					fio->getParObj()->requestReposition();
   4.183  					mapCenter->reposition();
   4.184  
   4.185 @@ -4596,7 +4609,7 @@
   4.186  				"moveRel "+pold,
   4.187  				fo,
   4.188  				"moveRel "+pnow,
   4.189 -				QString("Move %1 to relativ position %2").arg(getName(fo)).arg(pnow));
   4.190 +				QString("Move %1 to relative position %2").arg(getName(fo)).arg(pnow));
   4.191  
   4.192  			fo->getParObj()->requestReposition();
   4.193  			mapCenter->reposition();
   4.194 @@ -4613,16 +4626,19 @@
   4.195  		{	
   4.196  			// TODO: Check for problems if graphicsview is resized for 
   4.197  			// undo/redo...
   4.198 -		    QString pold=qpointfToString(movingObj_orgPos);
   4.199 -		    QString pnow=qpointfToString(mapCenter->getAbsPos());
   4.200 -			saveState(
   4.201 -				fo,
   4.202 -				"move "+pold,
   4.203 -				fo,
   4.204 -				"move "+pnow,
   4.205 -				QString("Move mapcenter %1 to position %2").arg(getName(mapCenter)).arg(pnow));
   4.206 +            if (movingObj_orgPos != mapCenter->getAbsPos())
   4.207 +            {
   4.208 +                QString pold=qpointfToString(movingObj_orgPos);
   4.209 +                QString pnow=qpointfToString(mapCenter->getAbsPos());
   4.210 +                saveState(
   4.211 +                    fo,
   4.212 +                    "move "+pold,
   4.213 +                    fo,
   4.214 +                    "move "+pnow,
   4.215 +                    QString("Move mapcenter %1 to position %2").arg(getName(mapCenter)).arg(pnow));
   4.216 +            }
   4.217  		}
   4.218 -		
   4.219 +
   4.220  		if (xelection.type() == Selection::Branch )
   4.221  		{	// A branch was moved
   4.222  			
   4.223 @@ -4683,12 +4699,15 @@
   4.224  					// Therefor reposition and then use string of old selection, too
   4.225  					mapCenter->reposition();
   4.226  
   4.227 -					QString ps=qpointfToString ( lmosel->getRelPos() );
   4.228 -					saveState(
   4.229 -						lmosel->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
   4.230 -						preSelStr, "moveRel "+ps, 
   4.231 -						QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps));
   4.232 -			
   4.233 +                    QPointF rp(lmosel->getRelPos());
   4.234 +                    if (rp != movingObj_orgRelPos)
   4.235 +                    {
   4.236 +                        QString ps=qpointfToString(rp);
   4.237 +                        saveState(
   4.238 +                            lmosel->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
   4.239 +                            preSelStr, "moveRel "+ps, 
   4.240 +                            QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps));
   4.241 +                    }
   4.242  				}
   4.243  			// Draw the original link, before selection was moved around
   4.244  			mapCenter->reposition();
   4.245 @@ -4788,7 +4807,7 @@
   4.246  						s=uris.at(i).toLocalFile();
   4.247  						if (!s.isEmpty()) 
   4.248  						{
   4.249 -						   QString file = QDir::convertSeparators(s);
   4.250 +						   QString file = QDir::fromNativeSeparators(s);
   4.251  						   heading = QFileInfo(file).baseName();
   4.252  						   files.append(file);
   4.253  						   if (file.endsWith(".vym", false))
     5.1 --- a/noteobj.cpp	Fri Nov 09 12:07:21 2007 +0000
     5.2 +++ b/noteobj.cpp	Fri Nov 09 12:07:22 2007 +0000
     5.3 @@ -168,7 +168,7 @@
     5.4  	// There are 2 <style> tags in one <li>, so we merge them here
     5.5  	int pos=0;
     5.6  	bool inbracket=false;
     5.7 -	int begin_bracket;
     5.8 +	int begin_bracket=0;
     5.9  	bool inquot=false;
    5.10  	QString n=note;
    5.11  	while (pos<n.length())
     6.1 --- a/tex/vym.changelog	Fri Nov 09 12:07:21 2007 +0000
     6.2 +++ b/tex/vym.changelog	Fri Nov 09 12:07:22 2007 +0000
     6.3 @@ -1,3 +1,9 @@
     6.4 +-------------------------------------------------------------------
     6.5 +Fri Nov  9 10:44:59 CET 2007 - uwedr@suse.de
     6.6 +
     6.7 +- Version: 1.11.3
     6.8 +- Feature: Added patches for better windows support by Andrew Ng
     6.9 +
    6.10  -------------------------------------------------------------------
    6.11  Tue Nov  6 22:36:38 CET 2007 - uwedr@suse.de
    6.12  
     7.1 --- a/version.h	Fri Nov 09 12:07:21 2007 +0000
     7.2 +++ b/version.h	Fri Nov 09 12:07:22 2007 +0000
     7.3 @@ -4,10 +4,10 @@
     7.4  #include <QString>
     7.5  
     7.6  #define __VYM_NAME "VYM"
     7.7 -#define __VYM_VERSION "1.11.2"
     7.8 +#define __VYM_VERSION "1.11.3"
     7.9  //#define __VYM_CODENAME "Codename: 1.10.0-RC-3"
    7.10  #define __VYM_CODENAME "Codename: development version"
    7.11 -#define __VYM_BUILD_DATE "2007-11-06"
    7.12 +#define __VYM_BUILD_DATE "2007-11-09"
    7.13  
    7.14  
    7.15  bool checkVersion(const QString &);
     8.1 --- a/vym.pro	Fri Nov 09 12:07:21 2007 +0000
     8.2 +++ b/vym.pro	Fri Nov 09 12:07:22 2007 +0000
     8.3 @@ -7,7 +7,7 @@
     8.4  # Manifest embedding was suggested by Qt docs somewhere...
     8.5  win32: CONFIG += embed_manifest_exe
     8.6  
     8.7 -# Without this, M_PI, and M_PI_2 won't be defined.
     8.8 +# Without this, M_PI, and M_PI_2 won`t be defined.
     8.9  win32:DEFINES *= _USE_MATH_DEFINES
    8.10  
    8.11  ICON =icons/vym.icns
    8.12 @@ -15,10 +15,12 @@
    8.13  QT += qt3support
    8.14  QT += network
    8.15  
    8.16 -HEADERS	+= \	
    8.17 +HEADERS	+= \
    8.18  	aboutdialog.h \
    8.19  	animpoint.h \
    8.20  	attribute.h \
    8.21 +	attributewidget.h \
    8.22 +	attributedialog.h \
    8.23  	branchobj.h \
    8.24  	branchpropwindow.h\
    8.25  	editxlinkdialog.h \
    8.26 @@ -67,6 +69,8 @@
    8.27  	aboutdialog.cpp \
    8.28  	animpoint.cpp \
    8.29  	attribute.cpp \
    8.30 +	attributewidget.cpp \
    8.31 +	attributedialog.cpp \
    8.32  	branchobj.cpp \
    8.33  	branchpropwindow.cpp \
    8.34  	editxlinkdialog.cpp \
    8.35 @@ -110,9 +114,11 @@
    8.36  	xmlobj.cpp \
    8.37  	xsltproc.cpp \
    8.38  	settings.cpp \
    8.39 -	warningdialog.cpp 
    8.40 +	warningdialog.cpp
    8.41  
    8.42  FORMS = \
    8.43 +	attributewidget.ui \
    8.44 +	attributedialog.ui \
    8.45  	branchpropwindow.ui \
    8.46  	exportxhtmldialog.ui \
    8.47  	extrainfodialog.ui \
    8.48 @@ -122,8 +128,14 @@
    8.49  	showtextdialog.ui \
    8.50  	warningdialog.ui
    8.51  
    8.52 +win32 {
    8.53 +	HEADERS += mkdtemp.h
    8.54 +	SOURCES += mkdtemp.cpp
    8.55 +	RC_FILE = vym.rc
    8.56 +}
    8.57 +
    8.58  #The following lines were inserted by qt3to4
    8.59 -QT += xml  
    8.60 +QT += xml
    8.61  
    8.62  TARGET  = vym
    8.63  
    8.64 @@ -163,7 +175,7 @@
    8.65  support.path = $${DATADIR}/vym
    8.66  INSTALLS += support 
    8.67  
    8.68 -doc.files = tex/vym.pdf
    8.69 +doc.files = doc/vym.pdf
    8.70  doc.path = $${DOCDIR}
    8.71  INSTALLS += doc
    8.72  DEFINES += VYM_DOCDIR=\\\"$${DOCDIR}\\\"
    8.73 @@ -171,4 +183,3 @@
    8.74  demo.files = demos/
    8.75  demo.path = $${DEMODIR}
    8.76  INSTALLS += demo
    8.77 -