# HG changeset patch
# User insilmaril
# Date 1259665575 0
# Node ID 82ebfc46233b133af8cebd3333b4704c0060d585
# Parent  62d4137bfb904ca64296727bb6ca23a1dc629fd1
Fixed undo of detach()

diff -r 62d4137bfb90 -r 82ebfc46233b mainwindow.cpp
--- a/mainwindow.cpp	Fri Nov 27 15:00:51 2009 +0000
+++ b/mainwindow.cpp	Tue Dec 01 11:06:15 2009 +0000
@@ -1125,7 +1125,7 @@
 	viewMenu->addAction (a);
 	connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
 
-	switchboard.print();
+	if (debug) switchboard.print();
 }
 
 // Mode Actions
@@ -2884,7 +2884,7 @@
 	}	
 }
 
-void Main::editNewBranchAbove()	// FIXME-1 can crash
+void Main::editNewBranchAbove()	
 {
 	VymModel *m=currentModel();
 	if ( m)
diff -r 62d4137bfb90 -r 82ebfc46233b mysortfilterproxymodel.cpp
--- a/mysortfilterproxymodel.cpp	Fri Nov 27 15:00:51 2009 +0000
+++ b/mysortfilterproxymodel.cpp	Tue Dec 01 11:06:15 2009 +0000
@@ -25,7 +25,7 @@
 }
 */
 
-bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-1 find a way to show _all_ rows which match, independent of parent
+bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-2 find a way to show _all_ rows which match, independent of parent
         const QModelIndex &sourceParent) const
 {
     QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
diff -r 62d4137bfb90 -r 82ebfc46233b tex/vym.changelog
--- a/tex/vym.changelog	Fri Nov 27 15:00:51 2009 +0000
+++ b/tex/vym.changelog	Tue Dec 01 11:06:15 2009 +0000
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Dec  1 12:03:42 CET 2009 - vym@insilmaril.de
+
+- Bugfix: Undo of detach
+
 -------------------------------------------------------------------
 Thu Nov 26 22:32:34 CET 2009 - vym@insilmaril.de
 
diff -r 62d4137bfb90 -r 82ebfc46233b version.h
--- a/version.h	Fri Nov 27 15:00:51 2009 +0000
+++ b/version.h	Tue Dec 01 11:06:15 2009 +0000
@@ -7,7 +7,7 @@
 #define __VYM_VERSION "1.13.0"
 //#define __VYM_CODENAME "Codename: RC-1"
 #define __VYM_CODENAME "Codename: development version, not for production!"
-#define __VYM_BUILD_DATE "2009-11-26"
+#define __VYM_BUILD_DATE "2009-12-01"
 
 
 bool checkVersion(const QString &);
diff -r 62d4137bfb90 -r 82ebfc46233b vymmodel.cpp
--- a/vymmodel.cpp	Fri Nov 27 15:00:51 2009 +0000
+++ b/vymmodel.cpp	Tue Dec 01 11:06:15 2009 +0000
@@ -237,7 +237,7 @@
 	// Build xml recursivly
 	if (!saveSel)
 		// Save all mapcenters as complete map, if saveSel not set
-		s+=saveTreeToDir(tmpdir,prefix,writeflags,offset);
+		s+=saveTreeToDir(tmpdir,prefix,offset);
 	else
 	{
 		switch (saveSel->getType())
@@ -276,7 +276,7 @@
 	return s;
 }
 
-QString VymModel::saveTreeToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)	// FIXME-4 verbose not needed (used to write icons)
+QString VymModel::saveTreeToDir (const QString &tmpdir,const QString &prefix, const QPointF &offset)
 {
     QString s;
 
@@ -2028,11 +2028,18 @@
 			for (int i=0; i<selbi->branchCount();++i)
 				selbi->getBranchNum(i)->getBranchObj()->setRelPos();
 		
-		//QString oldsel=getSelectString();
+		QString oldsel=getSelectString();
+		int n=selbi->num();
+		QPointF p;
+		BranchObj *bo=selbi->getBranchObj();
+		if (bo) p=bo->getAbsPos();
+		QString parsel=getSelectString(selbi->parent());
 		if ( relinkBranch (selbi,rootItem,-1) )
 			saveState (
-				selbi,QString("relink()"), //FIXME-1 add paramters when detaching
-				selbi,"detach ()",
+				getSelectString (selbi),
+				QString("relinkTo (\"%1\",%2,%3,%4)").arg(parsel).arg(n).arg(p.x()).arg(p.y()),
+				oldsel,
+				"detach ()",
 				QString("Detach %1").arg(getObjectName(selbi))
 			);
 	}
diff -r 62d4137bfb90 -r 82ebfc46233b vymmodel.h
--- a/vymmodel.h	Fri Nov 27 15:00:51 2009 +0000
+++ b/vymmodel.h	Tue Dec 01 11:06:15 2009 +0000
@@ -77,7 +77,7 @@
     QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel);
 
 	/*! Save all data in tree*/
-	QString saveTreeToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
+	QString saveTreeToDir (const QString&,const QString&,const QPointF&);// Save data recursivly to tempdir
 
 
 	/*! \brief Sets filepath, filename and mapname