# HG changeset patch
# User insilmaril
# Date 1158233898 0
# Node ID 3a58c9ef4a18c71513d35abdb99711661f1a6035
# Parent  a40af6315ac6cc5ee05ec8118be4b6167883f23a
1.8.57 - more changes in history window, Note Editor is QT4 now

diff -r a40af6315ac6 -r 3a58c9ef4a18 demos/todo.vym
Binary file demos/todo.vym has changed
diff -r a40af6315ac6 -r 3a58c9ef4a18 historywindow.cpp
--- a/historywindow.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/historywindow.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -10,13 +10,13 @@
 	
 	QTableWidgetItem *item;
 
-	item= new QTableWidgetItem(tr("Action"));
+	item= new QTableWidgetItem(tr("Action","Table with actions"));
 	ui.historyTable->setHorizontalHeaderItem(0, item);
 	
-	item= new QTableWidgetItem(tr("Comment"));
+	item= new QTableWidgetItem(tr("Comment","Table with actions"));
 	ui.historyTable->setHorizontalHeaderItem(1, item);
 	
-	item= new QTableWidgetItem(tr("Undo action"));
+	item= new QTableWidgetItem(tr("Undo action","Table with actions"));
 	ui.historyTable->setHorizontalHeaderItem(2, item);
 
 	ui.historyTable->setSelectionBehavior (QAbstractItemView::SelectRows);
@@ -27,6 +27,17 @@
 }
 
 
+void HistoryWindow::clearRow(int row)
+{
+	QTableWidgetItem *it;
+	it=ui.historyTable->item (row,0);
+	if (it) it->setText ("");
+	it=ui.historyTable->item (row,1);
+	if (it) it->setText ("");
+	it=ui.historyTable->item (row,2);
+	if (it) it->setText ("");
+}
+
 void HistoryWindow::updateRow(int row, int step, SimpleSettings &set)
 {
 	QTableWidgetItem *item;
@@ -63,7 +74,7 @@
 	else	
 		ui.redoButton->setEnabled (true);
 
-	// Update table
+	// Update undos in table
 	for (i=undosAvail; i>0; i--)
 	{
 		updateRow (r,s,set);
@@ -83,20 +94,24 @@
 			ui.historyTable->setItem(undosAvail, i, item);
 		}
 	}
-	item=new QTableWidgetItem(" - " +tr("Current state","current bar in history hwindow")+ " - ");
+	item=new QTableWidgetItem(" - " +tr("Current state","Current bar in history hwindow")+ " - ");
 	item->setBackgroundColor (c);
 	ui.historyTable->setItem(undosAvail, 1, item);
 
 
+	// Update Redos in table
 	s=curStep;
 	s++; if (s>stepsTotal) s=1;
-
 	for (i=1;i<= redosAvail; i++)
 	{
 		updateRow (undosAvail+i,s,set);
 		s++; if (s>stepsTotal) s=1;
 	}
 
+	// Delete the rest
+	for (i=undosAvail+redosAvail+1;i<= stepsTotal; i++)
+		clearRow (i);
+
 	ui.historyTable->resizeColumnsToContents();
 }
 
diff -r a40af6315ac6 -r 3a58c9ef4a18 historywindow.h
--- a/historywindow.h	Thu Sep 14 11:38:17 2006 +0000
+++ b/historywindow.h	Thu Sep 14 11:38:18 2006 +0000
@@ -1,7 +1,6 @@
 #ifndef HISTORYWINDOW_H
 #define HISTORYWINDOW_H
 
-//#include "mapeditor.h"
 #include "settings.h"
 #include "ui_historywindow.h"
 
@@ -25,6 +24,7 @@
 	void select();
 
 private:
+	void clearRow (int);
 	void updateRow (int, int, SimpleSettings &);
 	Ui::HistoryWindow ui;
 	MapEditor *mapEditor;
diff -r a40af6315ac6 -r 3a58c9ef4a18 linkablemapobj.cpp
--- a/linkablemapobj.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/linkablemapobj.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -154,10 +154,8 @@
 {
 	if (parObj)
 	{	
-		relPos=getRelPos();
-
+		getRelPos();
 		parObj->calcBBoxSize();
-		parObj->requestReposition();
 	}	
 }
 
@@ -165,8 +163,9 @@
 {
 	relPos=p;
 	if (parObj)
-	{	parObj->calcBBoxSize();
-		parObj->requestReposition();
+	{		
+		parObj->calcBBoxSize();
+		requestReposition();
 	}	
 }
 
@@ -468,6 +467,31 @@
 	}	
 }
 
+void LinkableMapObj::setOrientation()
+{
+	LinkOrient orientOld=orientation;
+
+	if (!parObj) 
+	{
+		orientation=OrientUndef;
+		return;
+	}
+		
+    // Set orientation, first look for orientation of parent
+    if (parObj->getOrientation() != OrientUndef ) 
+		// use the orientation of the parent:
+		orientation=parObj->getOrientation();
+    else
+    {
+		// calc orientation depending on position rel to parent
+		if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
+			orientation=OrientLeftOfCenter; 
+		else
+			orientation=OrientRightOfCenter;
+    }
+	if (orientOld!=orientation) requestReposition();
+}
+
 void LinkableMapObj::updateLink()
 {
     // needs:
@@ -511,21 +535,11 @@
 		p2y=QPoint( parObj->getParPos() ).y();
 	} 
 
+
+
+	setDockPos(); // Call overloaded method
+/* FIXME not needed?
 	LinkOrient orientOld=orientation;
-
-    // Set orientation, first look for orientation of parent
-    if (parObj->getOrientation() != OrientUndef ) 
-		// use the orientation of the parent:
-		orientation=parObj->getOrientation();
-    else
-    {
-		// calc orientation depending on position rel to mapCenter
-		if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
-			orientation=OrientLeftOfCenter; 
-		else
-			orientation=OrientRightOfCenter;
-    }
-
 	if ((orientation!=orientOld) && (orientOld!= OrientUndef))
 	{
 		// Orientation just changed. Reorient this subbranch, because move is called
@@ -534,10 +548,11 @@
 		//
 		// Also possible: called in BranchObj::init(), then orientOld==OrientUndef,
 		// no need to reposition now
+		cout <<"Trying to reorientate...   orient="<<orientation<<endl;
 		reposition();
 	}
 	
-	setDockPos();
+*/
 
 	double p1x=parPos.x();	// Link is drawn from P1 to P2
 	double p1y=parPos.y();
@@ -657,11 +672,6 @@
 	return lmo;
 }
 
-void LinkableMapObj::setDockPos()
-{
-	cout <<"LMO::setDockPos()\n";
-}
-
 QPoint LinkableMapObj::getChildPos()
 {
     return childPos;
@@ -709,14 +719,19 @@
                     (int)( + 150*sin (a)));
 }
 
+/*
 void LinkableMapObj::alignRelativeTo (QPoint ref)
 {
-	// FIXME testing, seems not to be used right now...
-	cout << "LMO::alignRelTo   ref="<<ref<<endl;
+	// Overloaded, only called for BO, FIO, ...
+	// FIXME not needed?
 }
+*/
 
 void LinkableMapObj::reposition()
 {
+	// FIXME not needed? Is overloaded in BranchObj...
+	/*
+	cout << "LMO::reposition\n";
 	if (depth==0)
 	{
 		// only calculate the sizes once. If the deepest LMO changes its height,
@@ -729,9 +744,11 @@
 	{
 		// This is only important for moving branches:
 		// For editing a branch it isn't called...
+		cout << "  reposition to abs "<<absPos<<endl;
 	    alignRelativeTo ( QPoint (absPos.x(),
 							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
 	}
+	*/
 }
 
 void LinkableMapObj::requestReposition()
diff -r a40af6315ac6 -r 3a58c9ef4a18 linkablemapobj.h
--- a/linkablemapobj.h	Thu Sep 14 11:38:17 2006 +0000
+++ b/linkablemapobj.h	Thu Sep 14 11:38:18 2006 +0000
@@ -63,13 +63,14 @@
 	virtual void setFrameType (const FrameType &);
 	virtual void setFrameType (const QString &);
 	virtual void setVisibility (bool);
+	virtual void setOrientation();
     virtual void updateLink();				// update parPos and childPos
 											// depending on pos
 											// redraw link with given style
     LinkableMapObj* getChildObj();			// returns pointer to fromObj
     LinkableMapObj* getParObj();			// returns pointer to toObj
     virtual LinkableMapObj* findObjBySelect(QString s);	// find obj by selectstring
-	virtual void setDockPos();				// sets childPos and parPos
+	virtual void setDockPos()=0;				// sets childPos and parPos
     QPoint getChildPos();					// returns pos where childs dock
     QPoint getParPos();						// returns pos where parents dock
     LinkOrient getOrientation();			// get orientation
@@ -78,7 +79,7 @@
 	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);
 	virtual QPoint getRandPos();			// make randomised position
 
-    virtual void alignRelativeTo(const QPoint );
+    //virtual void alignRelativeTo(const QPoint );
 	virtual void reposition();
 	virtual void requestReposition();		// do reposition after next user event
 	virtual void forceReposition();			// to force a reposition now (outside
diff -r a40af6315ac6 -r 3a58c9ef4a18 mainwindow.cpp
--- a/mainwindow.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/mainwindow.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -3215,9 +3215,7 @@
 
 void Main::testFunction()
 {
-	HistoryWindow hw;
-	hw.exec();
-	//currentMapEditor()->testFunction();
+	currentMapEditor()->testFunction();
 }
 
 void Main::helpDoc()
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapcenterobj.cpp
--- a/mapcenterobj.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/mapcenterobj.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -65,8 +65,8 @@
 
 void MapCenterObj::moveAllBy (double dx, double dy)
 {
-	// Move myself
-	moveBy(dx,dy);
+	// Move myself and childs
+	BranchObj::moveBy(dx,dy);
 }
 
 void MapCenterObj::updateLink()
@@ -80,6 +80,24 @@
 		b->updateLink();
 }
 
+void MapCenterObj::updateRelPositions()
+{
+	if (repositionRequest) unsetAllRepositionRequests();
+
+	// update relative Positions of branches and floats
+	BranchObj *b;
+	for (b=branch.first(); b; b=branch.next() ) 
+	{
+		b->setRelPos();
+		b->setOrientation();
+	}
+	
+	FloatObj *fo;
+	for (fo=floatimage.first(); fo; fo=floatimage.next() ) fo->setRelPos();
+
+	if (repositionRequest) reposition();
+}
+
 LinkableMapObj* MapCenterObj::findMapObj(QPoint p, LinkableMapObj *excludeLMO)
 	{
 	BranchObj *bo;
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapcenterobj.h
--- a/mapcenterobj.h	Thu Sep 14 11:38:17 2006 +0000
+++ b/mapcenterobj.h	Thu Sep 14 11:38:18 2006 +0000
@@ -21,6 +21,7 @@
     virtual void moveAll   (double,double);
     virtual void moveAllBy (double,double);
     virtual void updateLink();
+    virtual void updateRelPositions();
     LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
 	virtual QString saveToDir (const QString&,const QString&,int, const QPoint&);// Save data recursivly to tempdir
 	void setVersion(const  QString &);
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapeditor.cpp
--- a/mapeditor.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/mapeditor.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -209,7 +209,7 @@
 	fileName=tr("unnamed");
 	mapName="";
 
-	stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",5);
+	stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",50);
 	undoSet.setEntry ("/history/stepsTotal",QString::number(stepsTotal));
 	
 	// Initialize find routine
@@ -546,7 +546,7 @@
 
 	/* TODO remove after testing
 	*/
-	cout << "ME::saveState()  begin"<<endl;
+	cout << "ME::saveState()  "<<endl;
 	
 	setChanged();
 
@@ -559,7 +559,8 @@
 	if (curStep>stepsTotal) curStep=1;
 	
 	QString backupXML;
-	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
+	QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(curStep));
+	QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
 	QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
 
 	// Create bakMapDir if not available
@@ -589,7 +590,13 @@
 		// Write XML Data to disk
 		saveStringToDisk (QString(bakMapPath),backupXML);
 
+	// We would have to save all actions in a tree, to keep track of 
+	// possible redos after a action. Too complex, forget about redos.
+	redosAvail=0;
+
+	// Write the current state to disk
 	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
+	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
 	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 	undoSet.setEntry (QString("/history/step-%1/undoCommand").arg(curStep),undoCommand);
 	undoSet.setEntry (QString("/history/step-%1/undoSelection").arg(curStep),undoSelection);
@@ -771,6 +778,8 @@
 		{
 			s=api.parString (ok,0);	// undo selection
 			t=api.parString (ok,1);	// backup dir
+			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
+			cout <<t.ascii()<<endl;
 			undoXML(s,t);	
 		}
 	} else if (com=="select")
@@ -1429,16 +1438,19 @@
 {
 	// Restore variables
 	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
+	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
+
+	cout << "ME::goto "<<i<<endl;
 	
-	if (i<0) return;
-
-	// Clicking above current steps let's us undo things
+	if (i<0) i=undosAvail+redosAvail;
+
+	// Clicking above current step makes us undo things
 	if (i<undosAvail) 
 	{	
 		for (int j=0; j<undosAvail-i; j++) undo();
 		return;
 	}	
-	// Clicking below current steps let's us rendo things
+	// Clicking below current step makes us redo things
 	if (i>undosAvail) 
 		for (int j=undosAvail; j<i; j++) redo();
 
@@ -1542,7 +1554,9 @@
 
 void MapEditor::moveRel (const int &x, const int &y)
 {
-	if (selection)
+	if (selection && (typeid(*selection) == typeid(BranchObj) ||
+				      typeid(*selection) == typeid(MapCenterObj) ||
+					  typeid(*selection) == typeid (FloatImageObj))) 
 	{
 		QString ps=qpointToString (selection->getRelPos());
 		QString s=selection->getSelectString();
@@ -1550,7 +1564,7 @@
 			s, "moveRel "+ps, 
 			s, "moveRel "+qpointToString (QPoint (x,y)), 
 			QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
-		selection->setRelPos (QPoint(x,y));
+		((OrnamentedObj*)selection)->move2RelPos (x,y);
 		mapCenter->reposition();
 		adjustCanvasSize();
 	}
@@ -3217,7 +3231,6 @@
 
 void MapEditor::editXLink(int i)
 {
-	qDebug ("ko.");  //FIXME Huh?
 	if (selection && 
 		(typeid(*selection) == typeid(BranchObj)) || 
 		(typeid(*selection) == typeid(MapCenterObj))  )
@@ -3247,42 +3260,18 @@
 {
 	cout << "MapEditor::testFunction() called\n";
 
-/*
-	bool ok;
-	QString text = QInputDialog::getText(
-		this, 
-		tr("QInputDialog::getText()"),
-		 tr("User name:"), QLineEdit::Normal,
-		 QDir::home().dirName(), &ok, Qt::FramelessWindowHint);
-*/
-
-	QDialog *d =new QDialog(NULL);
-	QLineEdit *le=new QLineEdit (d);
-//	d->setModal (true);
-	d->setWindowFlags (Qt::FramelessWindowHint);
-	le->setFocus();
-	le->setText ("Foo");
-	le->selectAll();
-	connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
-	d->exec();
-	qWarning( le->text());
-	return;
-	
-
-
-/*
 	WarningDialog dia;
-	dia.setCancelButton (true);
+	dia.showCancelButton (true);
 	dia.setText("This is a longer \nWarning");
+	/*
 	dia.setCaption("Warning: Flux problem");
 	dia.setShowAgainName("/warnings/mapeditor");
-	dia.setWindowFlags (Qt::FramelessWindowHint);
+	*/
 	if (dia.exec()==QDialog::Accepted)
 		cout << "accepted!\n";
 	else	
 		cout << "canceled!\n";
 	return;
-*/
 
 /* Hide hidden stuff temporary, maybe add this as regular function somewhere
 	if (hidemode==HideNone)
@@ -3541,7 +3530,7 @@
 
 			// Relink float to new mapcenter or branch, if shift is pressed	
 			// Only relink, if selection really has a new parent
-			if ( (e->state() & Qt::ShiftModifier) && lmo &&
+			if ( (e->modifiers()==Qt::ShiftModifier) && lmo &&
 				( (typeid(*lmo)==typeid(BranchObj)) ||
 				  (typeid(*lmo)==typeid(MapCenterObj)) ) &&
 				( lmo != fo->getParObj())  
@@ -3563,24 +3552,26 @@
 					movingObj=(MapObj*)(fio);
 				}	
 			}
-		} else	// selection != a FloatObj
-		{
+		} else	
+		{	// selection != a FloatObj
 			if (lmosel->getDepth()==0)
 			{
-				if (e->state() == Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
-					// If mapCenter is moved, move all the rest by default, too.
+				// Move MapCenter
+				if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
 					mapCenter->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 				else	
 					mapCenter->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
+				mapCenter->updateRelPositions();	
 			} else
 			{	
 				if (lmosel->getDepth()==1)
 				{
-					// depth==1, mainbranch
+					// Move mainbranch
 					lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
+					lmosel->setRelPos();
 				} else
 				{
-					// depth>1
+					// Move ordinary branch
 					if (lmosel->getOrientation() == OrientLeftOfCenter)
 						// Add width of bbox here, otherwise alignRelTo will cause jumping around
 						lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), 
@@ -3590,19 +3581,18 @@
 				} 
 				// reposition subbranch
 				lmosel->reposition();	
-				//ensureSelectionVisible();
 
 				if (lmo && (lmo!=selection) &&  
 					(typeid(*lmo) == typeid(BranchObj) ||
 					(typeid(*lmo) == typeid(MapCenterObj) )
 					) )
 				{
-					if (e->state() & Qt::ControlModifier)
+					if (e->modifiers()==Qt::ControlModifier)
 					{
 						// Special case: CTRL to link below lmo
 						lmosel->setParObjTmp (lmo,p,+1);
 					}
-					else if (e->state() & Qt::ShiftModifier)
+					else if (e->modifiers()==Qt::ShiftModifier)
 						lmosel->setParObjTmp (lmo,p,-1);
 					else
 						lmosel->setParObjTmp (lmo,p,0);
@@ -3688,9 +3678,9 @@
     // Have we been moving something?
     if ( selection && movingObj ) 
     {	
-		// Moved FloatObj? Maybe we need to reposition
 		if(typeid(*selection)==typeid (FloatImageObj))
 		{
+			// Moved FloatObj. Maybe we need to reposition
 			FloatImageObj *fo=(FloatImageObj*)selection;
 		    QString pold=qpointToString(movingObj_orgRelPos);
 		    QString pnow=qpointToString(fo->getRelPos());
@@ -3699,6 +3689,7 @@
 				"moveRel "+pnow,
 				QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
 
+			// FIXME Why calling parObj here?
 			selection->getParObj()->requestReposition();
 			mapCenter->reposition();
 		}	
@@ -3711,9 +3702,14 @@
 		if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj))) 
 			dst=NULL;
 		
-		// Now check, if we have been moving a branch 
+		if (typeid(*selection) == typeid(MapCenterObj)  )
+		{	// The MapCenter was moved
+			cout << "FIXME missing savestate...\n";	
+		}
+		
 		if (typeid(*selection) == typeid(BranchObj)  )
-		{
+		{	// A branch was moved
+			
 			// save the position in case we link to mapcenter
 			QPoint savePos=QPoint (selection->x(),selection->y() );
 
diff -r a40af6315ac6 -r 3a58c9ef4a18 ornamentedobj.cpp
--- a/ornamentedobj.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/ornamentedobj.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -160,6 +160,11 @@
 void OrnamentedObj::move2RelPos(double x, double y)
 {
 	setRelPos (QPoint((int)x,(int)y));
+	if (parObj)
+	{
+		QPoint p=parObj->getChildPos();
+		move (p.x()+x, p.y() +y);
+	}
 }
 
 void OrnamentedObj::move2RelPos(QPoint p)
@@ -355,14 +360,16 @@
 {
 	QString posAttr;
 
-	if (useRelPos)
-		posAttr=attribut("relPosX",QString().setNum(relPos.x(),10)) +
-                attribut("relPosY",QString().setNum(relPos.y(),10)); 
+	if (depth==0)
+		posAttr=		
+			attribut("absPosX",QString().setNum(absPos.x(),10)) +
+			attribut("absPosY",QString().setNum(absPos.y(),10)); 
 	else
 	{
-		if (depth==0 || depth==1) posAttr=
-			attribut("absPosX",QString().setNum(absPos.x(),10)) +
-			attribut("absPosY",QString().setNum(absPos.y(),10)); 
+		if (depth==1)
+			posAttr=
+				attribut("relPosX",QString().setNum(relPos.x(),10)) +
+				attribut("relPosY",QString().setNum(relPos.y(),10)); 
 		else
 			posAttr="";
 	}	
diff -r a40af6315ac6 -r 3a58c9ef4a18 tex/vym.changelog
--- a/tex/vym.changelog	Thu Sep 14 11:38:17 2006 +0000
+++ b/tex/vym.changelog	Thu Sep 14 11:38:18 2006 +0000
@@ -1,8 +1,17 @@
 -------------------------------------------------------------------
-Wed Sep  8 14:43:09 CEST 2006 - uwedr
+Thu Sep 14 12:01:28 CEST 2006 - uwedr
+
+- Version: 1.8.57
+- Feature: Note Editor completly based on QT4 now.
+
+-------------------------------------------------------------------
+Wed Sep  13 16:43:09 CEST 2006 - uwedr
 
 - Version: 1.8.56
-- Feature: New History window, started to port designer stuff to QT4
+- Feature: New History window, All designer elements ported to QT4
+- Bugfix: No more hopping around of floats, when canvas is resized 
+          (by using relative positions for mainbranches. This might 
+		  confuse parsing 1.8.56 documents with vym <= 1.8.1
 
 -------------------------------------------------------------------
 Wed Sep  6 09:48:12 CEST 2006 - uwedr
diff -r a40af6315ac6 -r 3a58c9ef4a18 texteditor.cpp
--- a/texteditor.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/texteditor.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -41,9 +41,7 @@
     printer = new QPrinter( QPrinter::HighResolution );
 	printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
 
-	// Editor (use MyTextEdit to wrap verticalAlignmentChanged to 
-	//         int argument. see header file)
-    e = new MyTextEdit( this, "editor" );
+    e = new QTextEdit( this);
     e->setFocus();
 	e->setTextFormat(Qt::RichText);		// default
 	e->setTabStopWidth (20);		// unit is pixel
@@ -51,9 +49,15 @@
 	e->setAutoFillBackground (true);
 	connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
     setCentralWidget( e );
-    statusBar()->message( "Ready", statusbarTime);
+    statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
 	setCaption(__VYM " - " +tr ("Note Editor"));
 
+
+	connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
+            this, SLOT(formatChanged(const QTextCharFormat &)));
+
+
+
 	// Toolbars
 	setupFileActions();
 	setupEditActions();
@@ -92,6 +96,9 @@
 	}	
 	filenameHint="";
 
+	// Restore position of toolbars
+	restoreState (settings.value("/noteeditor/state",0).toByteArray());
+
 	// Save settings in vymrc
 	settings.setValue("/mainwindow/printerName",printer->printerName());
 }
@@ -103,6 +110,7 @@
 	// Save Settings
 	settings.setValue( "/noteeditor/geometry/size", size() );
 	settings.setValue( "/noteeditor/geometry/pos", pos() );
+	settings.setValue ("/noteeditor/state",saveState(0));
 	
 	settings.setValue( "/noteeditor/showWithMain",showWithMain());
 
@@ -114,6 +122,8 @@
 	settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
 	settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
 	settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
+
+
 }
 
 bool TextEditor::isEmpty()
@@ -165,12 +175,12 @@
 		if (fn.isEmpty() )
 		{
 			filename="";
-			statusBar()->message( "No filename available for this note.", statusbarTime );
+			statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
 		}	
 		else
 		{
 			filename=fn;
-			statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
+			statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
 		}	
 }
 
@@ -304,23 +314,6 @@
 	tb->addAction (a);
 	actionEditDeleteAll=a;
 
-	a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
-	/* TODO not needed any longer? remove also from docu...
-	a->setStatusTip(tr( "Convert paragraphs to linebreaks" )); 
-	a->setShortcut( Qt::ALT + Qt::Key_P );
-    connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
-	editMenu->addAction (a);
-	*/
-	actionEditConvertPar=a;
-
-	a = new QAction( QPixmap(), tr( "&Join lines" ), this);
-	/* TODO not needed any longer? remove also from docu...
-	a->setStatusTip(tr( "Join all lines of a paragraph" ) ); 
-	a->setShortcut(Qt::ALT + Qt::Key_J );
-    connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
-	editMenu->addAction (a);
-	*/
-	actionEditJoinLines=a;
 }
 
 void TextEditor::setupFormatActions()
@@ -339,7 +332,6 @@
 	tb->addAction (a);
 	actionFormatUseFixedFont=a;
 
-//    comboFont = new QComboBox( true, tb );
     comboFont = new QComboBox;
 	tb->addWidget (comboFont);
     QFontDatabase fontDB;
@@ -395,9 +387,28 @@
     actionTextUnderline=a;
     formatMenu->addSeparator();
 
+    QActionGroup *grp2 = new QActionGroup( this );
+    grp2->setExclusive(true);
+    a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
+	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
+    a->setToggleAction( true );
+	tb->addAction (a);
+	formatMenu->addAction (a);
+    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
+    actionAlignSubScript=a;
+
+    a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2  );
+	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
+    a->setToggleAction( true );
+	tb->addAction (a);
+	formatMenu->addAction (a);
+    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
+    actionAlignSuperScript=a;
     QActionGroup *grp = new QActionGroup( this );
     connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
 
+    formatMenu->addSeparator();
+
     a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
 	a->setShortcut( Qt::CTRL+Qt::Key_L );
     a->setToggleAction( true );
@@ -423,31 +434,13 @@
 	formatMenu->addAction (a);
     actionAlignJustify=a;
 
-    QActionGroup *grp2 = new QActionGroup( this );
-    grp2->setExclusive(true);
-    a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
-	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
-    a->setToggleAction( true );
-	tb->addAction (a);
-	formatMenu->addAction (a);
-    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
-    actionAlignSubScript=a;
 
-    a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2  );
-	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
-    a->setToggleAction( true );
-	tb->addAction (a);
-	formatMenu->addAction (a);
-    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
-    actionAlignSuperScript=a;
-
-    formatMenu->addSeparator();
     
+		 /* FIXME
     connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
 	     this, SLOT( fontChanged( const QFont & ) ) );
     connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
 	     this, SLOT( colorChanged( const QColor & ) ) );
-		 /*
     connect( e, SIGNAL( currentAlignmentChanged( int ) ),
 	     this, SLOT( alignmentChanged( int ) ) );
     connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
@@ -648,84 +641,6 @@
     statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
 }
 
-void TextEditor::textConvertPar()
-{
-	// In X11 a copy&paste generates paragraphs, 
-	// which is not always wanted
-	// This function replaces paragraphs by linebreaks.
-
-	QString t;
-	t=e->text();
-	QRegExp re("<p.*>");
-	re.setMinimal(true);
-	t.replace (re,"");
-	t.replace ("</p>","<br />");
-	e->setText(t);
-
-	/* TODO QT3 use seletion ()
-	int parFrom, parTo, indFrom, indTo;
-	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
-	if (parFrom>-1)
-		t=e->selectedText();
-	else
-		t=e->text();
-
-	QRegExp re("<p.*>");
-	re.setMinimal(true);
-	t.replace (re,"");
-	t.replace ("</p>","<br />");
-	if (parFrom>-1)
-	{
-		e->setCursorPosition (parFrom,indFrom);
-		e->cut();
-		// Tried to simply insert the changed text with
-		// e->insert (t,(uint)(QTextEdit::RemoveSelected));
-		// but then the html would be quoted. So I use the ugly
-		// way: insert a marker, replace it in whole text of QTextEdit
-		QString marker="R3PlAcEMeL4teR!";
-		e->insert (marker);
-		e->setText (e->text().replace(marker,t));
-	} else
-		e->setText(t);
-	*/	
-}
-
-void TextEditor::textJoinLines()
-{
-/* TODO  QT3
-	int parFrom, parTo, indFrom, indTo;
-	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
-	QString t;
-	if (parFrom>-1)
-		t=e->selectedText();
-	else
-		t=e->text();
-	// In addition to textConvertPar it is sometimes
-	// useful to join all lines of a paragraph
-	QRegExp re("</p>\n+<p>(?!</p>)");
-	re.setMinimal(true);
-	t.replace (re," ");
-
-	// Above we may have introduced new " " at beginning of a
-	// paragraph - remove it.
-	re.setPattern("<p> ");
-	t.replace (re,"<p>");
-	if (parFrom>-1)
-	{
-		e->setCursorPosition (parFrom,indFrom);
-		e->cut();
-		// Tried to simply insert the changed text with
-		// e->insert (t,(uint)(QTextEdit::RemoveSelected));
-		// but then the html would be quoted. So I use the ugly
-		// way: insert a marker, replace it in whole text of QTextEdit
-		QString marker="R3PlAcEMeL4teR!";
-		e->insert (marker);
-		e->setText (e->text().replace(marker,t));
-	} else
-		e->setText(t);
-*/		
-}
-
 void TextEditor::textExportAsASCII()
 {
 	QString text = NoteObj (e->text()).getNoteASCII();
@@ -857,8 +772,7 @@
 void TextEditor::textColor()
 {
     QColor col = QColorDialog::getColor( e->color(), this );
-    if ( !col.isValid() )
-	return;
+    if ( !col.isValid() ) return;
     e->setColor( col );
     QPixmap pix( 16, 16 );
     pix.fill( Qt::black );
@@ -868,35 +782,36 @@
 void TextEditor::textAlign( QAction *a )
 {
     if ( a == actionAlignLeft )
-	e->setAlignment( Qt::AlignLeft );
+		e->setAlignment( Qt::AlignLeft );
     else if ( a == actionAlignCenter )
-	e->setAlignment( Qt::AlignHCenter );
+		e->setAlignment( Qt::AlignHCenter );
     else if ( a == actionAlignRight )
-	e->setAlignment( Qt::AlignRight );
+		e->setAlignment( Qt::AlignRight );
     else if ( a == actionAlignJustify )
-	e->setAlignment( Qt::AlignJustify );
+		e->setAlignment( Qt::AlignJustify );
 }
 
 void TextEditor::textVAlign()
 {
-/* FIXME QT3 alignment
+	QTextCharFormat format;
+
     if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
-	e->setVerticalAlignment( QTextEdit::AlignSuperScript);
+		format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
     } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
-	e->setVerticalAlignment( QTextEdit::AlignSubScript);
+		format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
     } else {
-	e->setVerticalAlignment( QTextEdit::AlignNormal);
+		format.setVerticalAlignment(QTextCharFormat::AlignNormal);
     }
-*/	
+	e->mergeCurrentCharFormat(format);
 }
 
 
 void TextEditor::fontChanged( const QFont &f )
 {
-/*
-    comboFont->lineEdit()->setText( f.family() );
-    comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
-*/	
+	int i=comboFont->findText(f.family());
+    if (i>=0) comboFont->setCurrentIndex (i);
+	i=comboSize->findText(QString::number(f.pointSize()));
+	if (i>=0) comboSize->setCurrentIndex(i);
     actionTextBold->setOn( f.bold() );
     actionTextItalic->setOn( f.italic() );
     actionTextUnderline->setOn( f.underline() );
@@ -909,32 +824,40 @@
     actionTextColor->setIconSet( pix );
 }
 
+void TextEditor::formatChanged( const QTextCharFormat &f )
+{
+	fontChanged(f.font());
+    colorChanged(f.foreground().color());
+    alignmentChanged(e->alignment());
+	verticalAlignmentChanged (f.verticalAlignment());
+}
+
 void TextEditor::alignmentChanged( int a )
 {
     if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
-	actionAlignLeft->setOn( true );
+		actionAlignLeft->setOn( true );
     else if ( ( a & Qt::AlignHCenter ) )
-	actionAlignCenter->setOn( true );
+		actionAlignCenter->setOn( true );
     else if ( ( a & Qt::AlignRight ) )
-	actionAlignRight->setOn( true );
+		actionAlignRight->setOn( true );
     else if ( ( a & Qt::AlignJustify ) )
-	actionAlignJustify->setOn( true );
+		actionAlignJustify->setOn( true );
 }
 
-void TextEditor::verticalAlignmentChanged(int a) 
+void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
 {
-	/* FIXME QT3 alignment
-    if (a == QTextEdit::AlignSuperScript ) {
-	actionAlignSuperScript->setOn(true);
-	actionAlignSubScript->setOn(false);
-    } else if (a == QTextEdit::AlignSubScript ) {
-	actionAlignSuperScript->setOn(false);
-	actionAlignSubScript->setOn(true);
-    } else {
-	actionAlignSuperScript->setOn(false);
-	actionAlignSubScript->setOn(false);
-    }
-	*/
+	actionAlignSubScript->setOn (false);
+	actionAlignSuperScript->setOn (false);
+	switch (a)
+	{
+		case QTextCharFormat::AlignSuperScript: 
+			actionAlignSuperScript->setOn (true);
+			break;
+		case QTextCharFormat::AlignSubScript:
+			actionAlignSubScript->setOn (true);
+			break;
+		default: ;	
+	}
 }
 
 
@@ -951,8 +874,6 @@
 	actionEditCut->setEnabled(true);
 	actionEditPaste->setEnabled(true);
 	actionEditDeleteAll->setEnabled(true);
-	actionEditConvertPar->setEnabled(true);
-	actionEditJoinLines->setEnabled(true);
 	actionFormatUseFixedFont->setEnabled(true);
 }
 
@@ -968,8 +889,6 @@
 	actionEditCut->setEnabled(false);
 	actionEditPaste->setEnabled(false);
 	actionEditDeleteAll->setEnabled(false);
-	actionEditConvertPar->setEnabled(false);
-	actionEditJoinLines->setEnabled(false);
 	actionFormatUseFixedFont->setEnabled(false);
 }
 
diff -r a40af6315ac6 -r 3a58c9ef4a18 texteditor.h
--- a/texteditor.h	Thu Sep 14 11:38:17 2006 +0000
+++ b/texteditor.h	Thu Sep 14 11:38:18 2006 +0000
@@ -56,8 +56,6 @@
     void textLoad();
     void textSaveAs();
     void textSave();
-	void textConvertPar();
-	void textJoinLines();
 	void textExportAsASCII();
     void textPrint();
 	void textEditUndo();
@@ -74,15 +72,16 @@
 	void textVAlign();
     void fontChanged( const QFont &f );
     void colorChanged( const QColor &c );
+	void formatChanged (const QTextCharFormat &f);
     void alignmentChanged( int a );
-    void verticalAlignmentChanged(int a);
+    void verticalAlignmentChanged(QTextCharFormat::VerticalAlignment);
 	void enableActions();
 	void disableActions();
 	void setState (EditorState);
 
 private:
     QPrinter *printer;
-    MyTextEdit *e;
+    QTextEdit *e;
 	QPoint lastPos;			// save last position of window
     QString filename;
     QString filenameHint;
@@ -95,9 +94,7 @@
 
 	QFont varFont;
 	QFont fixedFont;
-    QComboBox
-	*comboFont,
-	*comboSize;
+    QComboBox *comboFont, *comboSize;
 	
 	QAction *actionFileLoad,
 	*actionFileSave,
@@ -109,8 +106,6 @@
 	*actionEditCut,
 	*actionEditPaste,
 	*actionEditDeleteAll,
-	*actionEditConvertPar,
-	*actionEditJoinLines,
 	*actionFormatUseFixedFont,
 	*actionSettingsVarFont,
 	*actionSettingsFixedFont,
@@ -119,47 +114,12 @@
 	*actionTextUnderline,
 	*actionTextItalic,
 	*actionTextColor,
+	*actionAlignSubScript,
+	*actionAlignSuperScript,
 	*actionAlignLeft,
 	*actionAlignCenter,
 	*actionAlignRight,
-	*actionAlignJustify,
-	*actionAlignSubScript,
-	*actionAlignSuperScript;
-};
-
-/* FIXME Wraps currentVerticalAlignmentChanged(VerticalAlignment)
- * to currentVerticalAlignmentChanged(int) 
- * this way the signal can be used without use of the internal 
- * VerticalAlignment enum of QTextEdit 
- * If VerticalAlignment has been a global like the normal alignment there
- * have been no problems!
- */
- 
-class MyTextEdit : public QTextEdit 
-{
-    Q_OBJECT;
- public:
-    MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) 
-	{
-	/*
-		connect(
-			this, SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)), 
-			this, SLOT(verticalAlignmentChanged(VerticalAlignment)));
-	*/		
-    }
-//    int verticalAlignment() const { return m_verticalAlignment; } 
- signals:
-//    void currentVerticalAlignmentChanged(int a);
- public slots:
- /*
-    void verticalAlignmentChanged(VerticalAlignment a) 
-	{
-		m_verticalAlignment = a;
-		emit currentVerticalAlignmentChanged((int)a);
-    }
-*/	
- private: 
-//	 int m_verticalAlignment;
+	*actionAlignJustify;
 };
 
 #endif
diff -r a40af6315ac6 -r 3a58c9ef4a18 version.h
--- a/version.h	Thu Sep 14 11:38:17 2006 +0000
+++ b/version.h	Thu Sep 14 11:38:18 2006 +0000
@@ -2,7 +2,7 @@
 #define VERSION_H
 
 #define __VYM "VYM"
-#define __VYM_VERSION "1.8.55"
-#define __BUILD_DATE "September 8, 2006"
+#define __VYM_VERSION "1.8.57"
+#define __BUILD_DATE "September 14, 2006"
 
 #endif
diff -r a40af6315ac6 -r 3a58c9ef4a18 vym.pro
--- a/vym.pro	Thu Sep 14 11:38:17 2006 +0000
+++ b/vym.pro	Thu Sep 14 11:38:18 2006 +0000
@@ -4,11 +4,15 @@
 CONFIG	+= qt warn_on release
 QT += qt3support
 
-HEADERS	+= aboutdialog.h \
+HEADERS	+= \	
+	aboutdialog.h \
 	api.h \
 	branchobj.h \
+	editxlinkdialog.h \
 	exportoofiledialog.h \
+	exportxhtmldialog.h\
 	exports.h \
+	extrainfodialog.h \
 	file.h \
 	findwindow.h \
 	flagobj.h \
@@ -28,6 +32,7 @@
 	mapobj.h \
 	misc.h \
 	noteobj.h \
+	options.h \
 	ornamentedobj.h \
 	process.h \
 	showtextdialog.h\
@@ -37,13 +42,17 @@
 	xml.h \
 	xsltproc.h \
 	settings.h \
-	options.h
+	warningdialog.h
 
-SOURCES	+= aboutdialog.cpp \
+SOURCES	+= \
+	aboutdialog.cpp \
 	api.cpp \
 	branchobj.cpp \
+	editxlinkdialog.cpp \
 	exportoofiledialog.cpp \
 	exports.cpp \
+	exportxhtmldialog.cpp \
+	extrainfodialog.cpp \
 	file.cpp \
 	findwindow.cpp \
 	flagobj.cpp \
@@ -64,6 +73,7 @@
 	mapobj.cpp \
 	misc.cpp \
 	noteobj.cpp \
+	options.cpp \
 	ornamentedobj.cpp \
 	process.cpp \
 	showtextdialog.cpp \
@@ -72,20 +82,18 @@
 	xml.cpp \
 	xsltproc.cpp \
 	settings.cpp \
-	options.cpp
+	warningdialog.cpp 
 
-#The following line was inserted by qt3to4, use "FORMS" later
-FORMS3	= exportxhtmldialog.ui \
+FORMS = \
+	exportxhtmldialog.ui \
 	extrainfodialog.ui \
 	editxlinkdialog.ui \
+	historywindow.ui \
+	showtextdialog.ui \
 	warningdialog.ui
 
-FORMS = historywindow.ui \
-	showtextdialog.ui
-
 #The following lines were inserted by qt3to4
 QT += xml  
-CONFIG += uic3
 
 TARGET  = vym
 TRANSLATIONS += lang/vym_de.ts
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/warningdialog.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -0,0 +1,45 @@
+#include "warningdialog.h"
+
+extern QString iconPath;
+
+WarningDialog::WarningDialog(QWidget* parent):QDialog (parent)
+{
+    ui.setupUi(this);
+	//FIXME proper icon needed
+	ui.okButton->setText(tr("Proceed"));
+	/*
+	ui.warningSign->setPixmap (QPixmap(iconPath + "icons/vym.png"));
+	ui.showAgainBox->setText (tr("Show this message again"));
+	*/
+	useShowAgain=false;
+	ui.showAgainBox->hide();
+}
+
+void WarningDialog::showCancelButton (bool b)
+{
+	if (b)
+	{
+		ui.cancelButton->show();
+		ui.cancelButton->setText(tr("Cancel"));
+	} else
+		ui.cancelButton->hide();
+}
+
+void WarningDialog::setShowAgainName (const QString &s)
+{
+/*
+	showAgainName=s;
+	useShowAgain=true;
+	ui.showAgainBox->show();
+*/	
+}
+
+void WarningDialog::setText (const QString &s)
+{
+	ui.warningTE->setText(s);
+}
+
+void WarningDialog::setCaption(const QString &s)
+{
+	setCaption("VYM - "+s);
+}
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/warningdialog.h	Thu Sep 14 11:38:18 2006 +0000
@@ -0,0 +1,27 @@
+#ifndef WARNINGDIALOG_H
+#define WARNINGDIALOG_H
+
+#include "ui_warningdialog.h"
+
+class WarningDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    WarningDialog(QWidget* parent = 0);
+
+public slots:
+    virtual void showCancelButton( bool b );
+    virtual void setShowAgainName( const QString & s );
+    virtual void setText( const QString & s );
+    virtual void setCaption( const QString & s );
+
+private:
+    void init();
+    bool useShowAgain;
+    QString showAgainName;
+	Ui::WarningDialog ui;
+
+};
+
+#endif // WARNINGDIALOG_H
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.ui
--- a/warningdialog.ui	Thu Sep 14 11:38:17 2006 +0000
+++ b/warningdialog.ui	Thu Sep 14 11:38:18 2006 +0000
@@ -1,231 +1,140 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>WarningDialog</class>
-<widget class="QDialog">
-    <property name="name">
-        <cstring>WarningDialog</cstring>
-    </property>
-    <property name="geometry">
-        <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>350</width>
-            <height>181</height>
-        </rect>
-    </property>
-    <property name="caption">
-        <string>VYM - Warning : Foo...</string>
-    </property>
-    <vbox>
-        <property name="name">
-            <cstring>unnamed</cstring>
-        </property>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout6</cstring>
-            </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>warningSign</cstring>
-                    </property>
-                    <property name="scaledContents">
-                        <bool>true</bool>
-                    </property>
-                </widget>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>textLabel</cstring>
-                    </property>
-                    <property name="text">
-                        <string>textLabel</string>
-                    </property>
-                </widget>
-                <spacer>
-                    <property name="name">
-                        <cstring>spacer6</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>160</width>
-                            <height>31</height>
-                        </size>
-                    </property>
-                </spacer>
-            </hbox>
-        </widget>
-        <spacer>
-            <property name="name">
-                <cstring>spacer7</cstring>
-            </property>
-            <property name="orientation">
-                <enum>Vertical</enum>
-            </property>
-            <property name="sizeType">
-                <enum>Expanding</enum>
-            </property>
-            <property name="sizeHint">
-                <size>
-                    <width>21</width>
-                    <height>20</height>
-                </size>
-            </property>
-        </spacer>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout4</cstring>
-            </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <spacer>
-                    <property name="name">
-                        <cstring>spacer3</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>61</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
-                <widget class="QCheckBox">
-                    <property name="name">
-                        <cstring>showAgainBox</cstring>
-                    </property>
-                    <property name="text">
-                        <string>showAgainBox</string>
-                    </property>
-                    <property name="checked">
-                        <bool>true</bool>
-                    </property>
-                </widget>
-                <spacer>
-                    <property name="name">
-                        <cstring>spacer4</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>51</width>
-                            <height>21</height>
-                        </size>
-                    </property>
-                </spacer>
-            </hbox>
-        </widget>
-        <spacer>
-            <property name="name">
-                <cstring>spacer5</cstring>
-            </property>
-            <property name="orientation">
-                <enum>Vertical</enum>
-            </property>
-            <property name="sizeType">
-                <enum>Expanding</enum>
-            </property>
-            <property name="sizeHint">
-                <size>
-                    <width>21</width>
-                    <height>20</height>
-                </size>
-            </property>
-        </spacer>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout3</cstring>
-            </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <spacer>
-                    <property name="name">
-                        <cstring>spacer2</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>161</width>
-                            <height>31</height>
-                        </size>
-                    </property>
-                </spacer>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>cancelButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Cancel</string>
-                    </property>
-                </widget>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>okButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Ok</string>
-                    </property>
-                </widget>
-            </hbox>
-        </widget>
-    </vbox>
-</widget>
-<connections>
-    <connection>
-        <sender>okButton</sender>
-        <signal>clicked()</signal>
-        <receiver>WarningDialog</receiver>
-        <slot>accept()</slot>
-    </connection>
-    <connection>
-        <sender>cancelButton</sender>
-        <signal>clicked()</signal>
-        <receiver>WarningDialog</receiver>
-        <slot>reject()</slot>
-    </connection>
-</connections>
-<includes>
-    <include location="local" impldecl="in implementation">warningdialog.ui.h</include>
-</includes>
-<variables>
-    <variable>bool useShowAgain;</variable>
-    <variable>QString showAgainName;</variable>
-</variables>
-<slots>
-    <slot>setCancelButton( bool b )</slot>
-    <slot>setShowAgainName( const QString &amp; s )</slot>
-    <slot>setText( const QString &amp; s )</slot>
-    <slot>setCaption( const QString &amp; s )</slot>
-</slots>
-<functions>
-    <function access="private" specifier="non virtual">init()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>WarningDialog</class>
+ <widget class="QDialog" name="WarningDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>543</width>
+    <height>264</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>VYM - Warning : Foo...</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <widget class="QTextEdit" name="warningTE" />
+   </item>
+   <item>
+    <widget class="QLabel" name="warningSign" >
+     <property name="text" >
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>512</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QCheckBox" name="showAgainBox" >
+       <property name="text" >
+        <string>showAgainBox</string>
+       </property>
+       <property name="checked" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>73</width>
+         <height>31</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelButton" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>Ok</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>cancelButton</sender>
+   <signal>clicked()</signal>
+   <receiver>WarningDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>131</x>
+     <y>244</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>266</x>
+     <y>135</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>okButton</sender>
+   <signal>clicked()</signal>
+   <receiver>WarningDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>222</x>
+     <y>244</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>266</x>
+     <y>135</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.ui.h
--- a/warningdialog.ui.h	Thu Sep 14 11:38:17 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-//Added by qt3to4:
-#include <QPixmap>
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-void WarningDialog::init()
-{
-	warningSign->setPixmap (QPixmap("icons/vym.png"));
-	setCancelButton (false);
-	okButton->setText(tr("Proceed"));
-	showAgainBox->setText (tr("Show this message again"));
-	useShowAgain=false;
-	showAgainBox->hide();
-}
-
-void WarningDialog::setCancelButton (bool b)
-{
-	if (b)
-	{
-		cancelButton->show();
-		cancelButton->setText(tr("Cancel"));
-	} else
-		cancelButton->hide();
-}
-
-void WarningDialog::setShowAgainName (const QString &s)
-{
-	showAgainName=s;
-	useShowAgain=true;
-	showAgainBox->show();
-}
-
-void WarningDialog::setText (const QString &s)
-{
-	textLabel->setText(s);
-}
-
-void WarningDialog::setCaption(const QString &s)
-{
-	QDialog::setCaption("VYM - "+s);
-}
diff -r a40af6315ac6 -r 3a58c9ef4a18 xml.cpp
--- a/xml.cpp	Thu Sep 14 11:38:17 2006 +0000
+++ b/xml.cpp	Thu Sep 14 11:38:18 2006 +0000
@@ -463,6 +463,21 @@
 	{
 		bool okx,oky;
 		int x,y;
+		if (!a.value( "relPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
+		{
+			if (!a.value( "relPosY").isEmpty() ) 
+			{
+				x=a.value("relPosX").toInt (&okx, 10);
+				y=a.value("relPosY").toInt (&oky, 10);
+				if (okx && oky  )
+				{
+					lastOO->setUseRelPos (true);
+					lastOO->move2RelPos (x,y);
+				}	
+				else
+					return false;   // Couldn't read relPos
+			}           
+		}           
 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
 		{
 			if (!a.value( "absPosY").isEmpty() )