# HG changeset patch
# User insilmaril
# Date 1217921813 0
# Node ID 7ea31701156edf93d8b43d9d8614d9a36e870dc3
# Parent  cf14046909cd6de7e517856f43d726688ebb2638
Preview: Added QTreeView to mainwindow (not yet functional)

diff -r cf14046909cd -r 7ea31701156e mainwindow.cpp
--- a/mainwindow.cpp	Mon Aug 04 13:35:54 2008 +0000
+++ b/mainwindow.cpp	Tue Aug 05 07:36:53 2008 +0000
@@ -74,6 +74,7 @@
 extern QString iconPath;
 extern QString flagsPath;
 
+
 Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
     QMainWindow(parent,name,f)
 {
@@ -201,9 +202,6 @@
 	connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), 
 		this, SLOT( editorChanged( QWidget * ) ) );
 
-	lineedit=new QLineEdit (this);
-	lineedit->hide();
-
 	setCentralWidget(tabWidget);	
 
     setupFileActions();
@@ -1691,22 +1689,16 @@
 
 MapEditor* Main::currentMapEditor() const
 {
-	// FIXME currentMapEditor should return the latest used editor for a model, or NULL if no editor is open
-    if ( tabWidget->currentPage() &&
-	 tabWidget->currentPage()->inherits( "MapEditor" ) )
-		return (MapEditor*)tabWidget->currentPage();
+    if ( tabWidget->currentPage())
+		return tabModel.at(tabWidget->currentIndex())->getMapEditor();
     return NULL;	
 }
 
 VymModel* Main::currentModel() const
 {
-	// FIXME better get currentModel from a maintained list,
-	// just in case we allow other views in tabs later
-	MapEditor *me=currentMapEditor();
-	if (me) 
-		return me->getModel();
-	else
-		return NULL;
+    if ( tabWidget->currentPage())
+		return tabModel.at(tabWidget->currentIndex());
+    return NULL;	
 }
 
 
@@ -1714,12 +1706,9 @@
 {
 	// Unselect all possibly selected objects
 	// (Important to update note editor)
-	MapEditor *me;
 	for (int i=0;i<=tabWidget->count() -1;i++)
 	{
-		
-		me=(MapEditor*)tabWidget->page(i);
-		me->getModel()->unselect();
+		tabModel.at(i)->unselect();
 	}	
 	VymModel *m=currentModel();
 	if (m) m->reselect();
@@ -1728,18 +1717,43 @@
 	updateActions();
 }
 
+VymView *Main::createView (VymModel *model)
+{
+	VymView *vm=new VymView;
+
+	// Create TreeView
+	QTreeView *tv=new QTreeView;
+	tv->setModel (model->getTreeModel() );
+
+	// Create good old MapEditor
+	MapEditor* me=model->getMapEditor();
+	if (!me) me=new MapEditor (model);
+	//me->viewport()->setFocus();
+	me->setAntiAlias (actionViewToggleAntiAlias->isOn());
+	me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
+
+	vm->addWidget (tv);
+	vm->addWidget (me);
+
+	// Set geometry
+	QList <int> sizes;
+	sizes.append (150);
+	sizes.append (600);
+	vm->setSizes (sizes);
+
+	return vm;
+}
+
 void Main::fileNew()
 {
 	VymModel *m=new VymModel;
-	models.append (m);
+	tabModel.append (m);
 	MapEditor* me = new MapEditor (m);
 	me->setObjectName ("MapEditor");
-	QString fn="unnamed";
-	tabWidget->addTab (me,fn);
-	tabWidget->showPage(me);
-	me->viewport()->setFocus();
-	me->setAntiAlias (actionViewToggleAntiAlias->isOn());
-	me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
+
+	VymView *view=createView (m);
+	tabWidget->addTab (view,tr("unnamed","MainWindow: name for new and empty file"));
+	tabWidget->setCurrentIndex (tabModel.count() );
 	
 	// For the very first map we do not have flagrows yet...
 	m->select("mc:");
@@ -1748,25 +1762,14 @@
 void Main::fileNewCopy()
 {
 	QString fn="unnamed";
-	MapEditor* oldME =currentMapEditor();
-	if (oldME)
+	VymModel *srcModel=currentModel();
+	if (srcModel)
 	{
-		oldME->getModel()->copy();
-		VymModel *m=new VymModel;
-		models.append (m);
-		MapEditor* newME = new MapEditor ( m);
-		if (newME)
-		{
-			tabWidget->addTab (newME,fn);
-			tabWidget->showPage(newME);
-			newME->viewport()->setFocus();
-			newME->setAntiAlias (actionViewToggleAntiAlias->isOn());
-			newME->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
-			// For the very first map we do not have flagrows yet...
-			m->select("mc:");
-			m->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
-		}
-
+		srcModel->copy();
+		fileNew();
+		VymModel *dstModel=tabModel.last ();
+		dstModel->select("mc:");
+		dstModel->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
 	}
 }
 
@@ -1788,8 +1791,7 @@
 		int i=0;
 		while (i<=tabWidget->count() -1)
 		{
-			me=(MapEditor*)tabWidget->page(i);
-			if (me->getModel()->getFilePath() == fn)
+			if (tabModel.at(i)->getFilePath() == fn)
 			{
 				// Already there, ask for confirmation
 				QMessageBox mb( vymName,
@@ -1806,7 +1808,7 @@
 				switch( mb.exec() ) 
 				{
 					case QMessageBox::Yes:
-						// load anyway
+						// end loop and load anyway
 						i=tabWidget->count();
 						break;
 					case QMessageBox::Cancel:
@@ -1818,26 +1820,24 @@
 			i++;
 		}
 	}
-
+	
+	int tabIndex=tabWidget->currentPageIndex();
 
 	// Try to load map
     if ( !fn.isEmpty() )
 	{
 		me = currentMapEditor();
-		int tabIndex=tabWidget->currentPageIndex();
 		// Check first, if mapeditor exists
 		// If it is not default AND we want a new map, 
 		// create a new mapeditor in a new tab
 		if ( lmode==NewMap && (!me || !me->getModel()->isDefault() )  )
 		{
 			VymModel *m=new VymModel;
-			models.append (m);
-			me= new MapEditor ( m);
-			tabWidget->addTab (me,fn);
-			tabIndex=tabWidget->indexOf (me);
+			tabModel.append (m);
+			VymView *view=createView (m);
+			tabWidget->addTab (view,fn);
+			tabIndex=tabWidget->count()-1;
 			tabWidget->setCurrentPage (tabIndex);
-			me->setAntiAlias (actionViewToggleAntiAlias->isOn());
-			me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
 		}
 		
 		// Check, if file exists (important for creating new files
@@ -1858,7 +1858,7 @@
 				case QMessageBox::Yes:
 					// Create new map
 					currentMapEditor()->getModel()->setFilePath(fn);
-					tabWidget->setTabLabel (currentMapEditor(),
+					tabWidget->setTabText (tabIndex,
 						currentMapEditor()->getModel()->getFileName() );
 					statusBar()->message( "Created " + fn , statusbarTime );
 					return success;
@@ -1873,7 +1873,7 @@
 
 
 		//tabWidget->currentPage() won't be NULL here, because of above...
-		tabWidget->showPage(me);
+		tabWidget->setCurrentIndex (tabIndex);
 		me->viewport()->setFocus();
 
 		if (err!=aborted)
@@ -1900,7 +1900,7 @@
 			if (lmode==NewMap)
 			{
 				me->getModel()->setFilePath (fn);
-				tabWidget->changeTab(tabWidget->page(tabIndex), me->getModel()->getFileName());
+				tabWidget->setTabText (tabIndex, me->getModel()->getFileName());
 				if (!isInTmpDir (fn))
 				{
 					// Only append to lastMaps if not loaded from a tmpDir
@@ -1990,7 +1990,7 @@
 		// call fileSaveAs() now, this will call fileSave() 
 		// again.
 		// First switch to editor
-		tabWidget->setCurrentWidget (m->getMapEditor());
+		//FIXME needed???  tabWidget->setCurrentWidget (m->getMapEditor());
 		fileSaveAs(savemode);
 	}
 
@@ -2068,13 +2068,13 @@
 
 
 			// Save now
-			currentModel()->setFilePath(fn);
-			fileSave(currentModel(), savemode);
-
-			// Set name of tab
+			VymModel *m=currentModel();
+			m->setFilePath(fn);
+			fileSave(m, savemode);
+
+			// Set name of tab, assuming current tab is the one we just saved
 			if (savemode==CompleteMap)
-				tabWidget->setTabLabel (currentMapEditor(),
-					currentModel()->getFileName() );
+				tabWidget->setTabText (tabWidget->currentIndex(), m->getFileName() );
 			return;
 		} 
 	}
@@ -2342,7 +2342,8 @@
 			}
 		} 
 		me->close();
-		tabWidget->removePage(me);
+		tabModel.removeAt (tabWidget->currentIndex() );
+		tabWidget->removeTab (tabWidget->currentIndex() );
         delete me;	// FIXME if event was triggered _in_ ME this causes warning message
 		updateActions();
 	}
@@ -2357,15 +2358,11 @@
 void Main::fileExitVYM()
 {
 	// Check if one or more editors have changed
-	MapEditor *me;
 	int i;
-	for (i=0;i<=tabWidget->count() -1;i++)
+	for (i=0;i<=tabModel.count() -1;i++)
 	{
-		
-		me=(MapEditor*)tabWidget->page(i);
-
 		// If something changed, ask what to do
-		if (me->getModel()->hasChanged())
+		if (tabModel.at(i)->hasChanged())
 		{
 			tabWidget->setCurrentPage(i);
 			QMessageBox mb( vymName,
@@ -2740,11 +2737,9 @@
 		// compare path with already loaded maps
 		int index=-1;
 		int i;
-		MapEditor *me;
-		for (i=0;i<=tabWidget->count() -1;i++)
+		for (i=0;i<=tabModel.count() -1;i++)
 		{
-			me=(MapEditor*)tabWidget->page(i);
-			if (vl.at(j)==me->getModel()->getFilePath() )
+			if (vl.at(j)==tabModel.at(i)->getFilePath() )
 			{
 				index=i;
 				break;
@@ -2759,11 +2754,11 @@
 			else
 			{
 				fileLoad (vl.at(j), NewMap);
-				tabWidget->setCurrentPage (tabWidget->count()-1);	
+				tabWidget->setCurrentIndex (tabWidget->count()-1);	
 			}
 		} else
 			// Go to tab containing the map
-			tabWidget->setCurrentPage (index);	
+			tabWidget->setCurrentIndex (index);	
 	}
 }
 
@@ -2884,7 +2879,7 @@
 void Main::editAddMapCenter()
 {
 	VymModel *m=currentModel();
-	if (!lineedit->isVisible() && m)
+	if (m)
 	{
 		m->addMapCenter ();
 	}	
@@ -2893,7 +2888,7 @@
 void Main::editNewBranch()
 {
 	VymModel *m=currentModel();
-	if (!lineedit->isVisible() && m)
+	if (m)
 	{
 		BranchObj *bo=(BranchObj*)m->getSelection();
 		BranchObj *newbo=m->addNewBranch(0);
@@ -2920,7 +2915,7 @@
 void Main::editNewBranchBefore()
 {
 	VymModel *m=currentModel();
-	if (!lineedit->isVisible() &&  m)
+	if (m)
 	{
 		BranchObj *bo=(BranchObj*)m->getSelection();
 		BranchObj *newbo=m->addNewBranchBefore();
@@ -2942,7 +2937,7 @@
 void Main::editNewBranchAbove()
 {
 	VymModel *m=currentModel();
-	if (!lineedit->isVisible() &&  m)
+	if ( m)
 	{
 		BranchObj *bo=(BranchObj*)m->getSelection();
 		BranchObj *newbo=m->addNewBranch (-1);
@@ -2964,7 +2959,7 @@
 void Main::editNewBranchBelow()
 {
 	VymModel *m=currentModel();
-	if (!lineedit->isVisible() &&  m)
+	if (m)
 	{
 		BranchObj *bo=(BranchObj*)m->getSelection();
 		BranchObj *newbo=m->addNewBranch (1);
@@ -3372,10 +3367,10 @@
 {
 	bool b=actionViewToggleAntiAlias->isOn();
 	MapEditor *me;
-	for (int i=0;i<tabWidget->count();i++)
+	for (int i=0;i<tabModel.count();i++)
 	{
-		me=(MapEditor*)tabWidget->page(i);
-		me->setAntiAlias(b);
+		me=tabModel.at(i)->getMapEditor();
+		if (me) me->setAntiAlias(b);
 	}	
 
 }
@@ -3384,11 +3379,11 @@
 {
 	bool b=actionViewToggleSmoothPixmapTransform->isOn();
 	MapEditor *me;
-	for (int i=0;i<tabWidget->count();i++)
+	for (int i=0;i<tabModel.count();i++)
 	{
 		
-		me=(MapEditor*)tabWidget->page(i);
-		me->setSmoothPixmap(b);
+		me=tabModel.at(i)->getMapEditor();
+		if (me) me->setSmoothPixmap(b);
 	}	
 }
 
@@ -3679,14 +3674,14 @@
 
 void Main::windowNextEditor()
 {
-	if (tabWidget->currentPageIndex() < tabWidget->count())
-		tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
+	if (tabWidget->currentIndex() < tabWidget->count())
+		tabWidget->setCurrentIndex (tabWidget->currentIndex() +1);
 }
 
 void Main::windowPreviousEditor()
 {
-	if (tabWidget->currentPageIndex() >0)
-		tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
+	if (tabWidget->currentIndex() >0)
+		tabWidget->setCurrentIndex (tabWidget->currentIndex() -1);
 }
 
 void Main::standardFlagChanged()
diff -r cf14046909cd -r 7ea31701156e mainwindow.h
--- a/mainwindow.h	Mon Aug 04 13:35:54 2008 +0000
+++ b/mainwindow.h	Tue Aug 05 07:36:53 2008 +0000
@@ -12,6 +12,9 @@
 #include "simplescripteditor.h"
 #include "texteditor.h"
 
+class VymView : public QSplitter 
+{
+};
 
 class Main : public QMainWindow 
 {
@@ -31,6 +34,9 @@
 	void loadCmdLine();
 	void statusMessage (const QString &);
 
+private:
+	VymView* createView (VymModel*);
+
 public slots:
     void fileNew();
     void fileNewCopy();
@@ -232,9 +238,8 @@
 
 	QStringList imageTypes;
 
-	QList <VymModel*> models;
+	QList <VymModel*> tabModel;		//!< the corresponding model to a tab
 
-	QLineEdit *lineedit;	// to enter headings of branches
 	QString prevSelection;
 
 	HistoryWindow *historyWindow;
diff -r cf14046909cd -r 7ea31701156e treeitem.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/treeitem.cpp	Tue Aug 05 07:36:53 2008 +0000
@@ -0,0 +1,52 @@
+#include <QStringList>
+
+#include "treeitem.h"
+
+TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
+{
+    parentItem = parent;
+    itemData = data;
+}
+
+TreeItem::~TreeItem()
+{
+    qDeleteAll(childItems);
+}
+
+void TreeItem::appendChild(TreeItem *item)
+{
+    childItems.append(item);
+}
+
+TreeItem *TreeItem::child(int row)
+{
+    return childItems.value(row);
+}
+
+int TreeItem::childCount() const
+{
+    return childItems.count();
+}
+
+int TreeItem::columnCount() const
+{
+    return itemData.count();
+}
+
+QVariant TreeItem::data(int column) const
+{
+    return itemData.value(column);
+}
+
+TreeItem *TreeItem::parent()
+{
+    return parentItem;
+}
+
+int TreeItem::row() const
+{
+    if (parentItem)
+        return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
+
+    return 0;
+}
diff -r cf14046909cd -r 7ea31701156e treeitem.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/treeitem.h	Tue Aug 05 07:36:53 2008 +0000
@@ -0,0 +1,28 @@
+#ifndef TREEITEM_H
+#define TREEITEM_H
+
+#include <QList>
+#include <QVariant>
+
+class TreeItem
+{
+public:
+    TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
+    ~TreeItem();
+
+    void appendChild(TreeItem *child);
+
+    TreeItem *child(int row);
+    int childCount() const;
+    int columnCount() const;
+    QVariant data(int column) const;
+    int row() const;
+    TreeItem *parent();
+
+private:
+    QList<TreeItem*> childItems;
+    QList<QVariant> itemData;
+    TreeItem *parentItem;
+};
+
+#endif
diff -r cf14046909cd -r 7ea31701156e treemodel.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/treemodel.cpp	Tue Aug 05 07:36:53 2008 +0000
@@ -0,0 +1,130 @@
+#include <QtGui>
+
+#include "treeitem.h"
+#include "treemodel.h"
+
+TreeModel::TreeModel(QObject *parent)
+    : QAbstractItemModel(parent)
+{
+    QList<QVariant> rootData;
+    rootData << "Heading" << "Type" <<"Note";
+    rootItem = new TreeItem(rootData);
+    setupModelData(rootItem);
+}
+
+TreeModel::~TreeModel()
+{
+    delete rootItem;
+}
+
+int TreeModel::columnCount(const QModelIndex &parent) const
+{
+    if (parent.isValid())
+        return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
+    else
+        return rootItem->columnCount();
+}
+
+QVariant TreeModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid())
+        return QVariant();
+
+    if (role != Qt::DisplayRole)
+        return QVariant();
+
+    TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
+
+    return item->data(index.column());
+}
+
+Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return Qt::ItemIsEnabled;
+
+    return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
+                               int role) const
+{
+    if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+        return rootItem->data(section);
+
+    return QVariant();
+}
+
+QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
+            const
+{
+    TreeItem *parentItem;
+
+    if (!parent.isValid())
+        parentItem = rootItem;
+    else
+        parentItem = static_cast<TreeItem*>(parent.internalPointer());
+
+    TreeItem *childItem = parentItem->child(row);
+    if (childItem)
+        return createIndex(row, column, childItem);
+    else
+        return QModelIndex();
+}
+
+QModelIndex TreeModel::parent(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return QModelIndex();
+
+    TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
+    TreeItem *parentItem = childItem->parent();
+
+    if (parentItem == rootItem)
+        return QModelIndex();
+
+    return createIndex(parentItem->row(), 0, parentItem);
+}
+
+int TreeModel::rowCount(const QModelIndex &parent) const
+{
+    TreeItem *parentItem;
+
+    if (!parent.isValid())
+        parentItem = rootItem;
+    else
+        parentItem = static_cast<TreeItem*>(parent.internalPointer());
+
+    return parentItem->childCount();
+}
+
+void TreeModel::setupModelData(TreeItem *root)
+{
+	QList<QVariant> cData;
+
+	cData << "Center of map" << "MapCenter"<<"Data 1";
+	TreeItem *mco=new TreeItem (cData,root);
+	root->appendChild (mco);
+
+	cData.clear();
+	cData << "Main A" << "Branch"<<"Data 2";
+	TreeItem *bo=new TreeItem (cData,mco);
+	mco->appendChild (bo);
+	TreeItem *mainA=bo;
+
+	cData.clear();
+	cData << "Sub a" << "Branch"<<"Data";
+	bo=new TreeItem (cData,mainA);
+	mainA->appendChild (bo);
+
+	cData.clear();
+	cData << "Sub b" << "Branch"<<"Data";
+	bo=new TreeItem (cData,mainA);
+	mainA->appendChild (bo);
+
+	cData.clear();
+	cData << "Main B"<<"Branch" <<"Data 3";
+	mco->appendChild(new TreeItem(cData, mco));
+
+	//QModelIndex ix=index (0,0,QModelIndex() );
+}
diff -r cf14046909cd -r 7ea31701156e treemodel.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/treemodel.h	Tue Aug 05 07:36:53 2008 +0000
@@ -0,0 +1,34 @@
+#ifndef TREEMODEL_H
+#define TREEMODEL_H
+
+#include <QAbstractItemModel>
+#include <QModelIndex>
+#include <QVariant>
+
+class TreeItem;
+
+class TreeModel : public QAbstractItemModel
+{
+    Q_OBJECT
+
+public:
+    TreeModel(QObject *parent = 0);
+    ~TreeModel();
+
+    QVariant data(const QModelIndex &index, int role) const;
+    Qt::ItemFlags flags(const QModelIndex &index) const;
+    QVariant headerData(int section, Qt::Orientation orientation,
+                        int role = Qt::DisplayRole) const;
+    QModelIndex index(int row, int column,
+                      const QModelIndex &parent = QModelIndex()) const;
+    QModelIndex parent(const QModelIndex &index) const;
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+private:
+    void setupModelData(TreeItem *parent);
+
+    TreeItem *rootItem;
+};
+
+#endif
diff -r cf14046909cd -r 7ea31701156e version.h
--- a/version.h	Mon Aug 04 13:35:54 2008 +0000
+++ b/version.h	Tue Aug 05 07:36:53 2008 +0000
@@ -7,7 +7,7 @@
 #define __VYM_VERSION "1.13.0"
 //#define __VYM_CODENAME "Codename: RC-1"
 #define __VYM_CODENAME "Codename: development version"
-#define __VYM_BUILD_DATE "2008-07-18"
+#define __VYM_BUILD_DATE "2008-08-05"
 
 
 bool checkVersion(const QString &);
diff -r cf14046909cd -r 7ea31701156e vym.pro
--- a/vym.pro	Mon Aug 04 13:35:54 2008 +0000
+++ b/vym.pro	Tue Aug 05 07:36:53 2008 +0000
@@ -74,6 +74,8 @@
 	xmlobj.h\
 	xsltproc.h \
 	settings.h \
+	treeitem.h \
+	treemodel.h \
 	warningdialog.h
 
 SOURCES	+= \
@@ -119,6 +121,8 @@
 	showtextdialog.cpp \
 	simplescripteditor.cpp \
 	texteditor.cpp \
+	treeitem.cpp \
+	treemodel.cpp \
 	version.cpp \
 	vymmodel.cpp \
 	xlinkobj.cpp \
diff -r cf14046909cd -r 7ea31701156e vymmodel.cpp
--- a/vymmodel.cpp	Mon Aug 04 13:35:54 2008 +0000
+++ b/vymmodel.cpp	Tue Aug 05 07:36:53 2008 +0000
@@ -118,6 +118,9 @@
 	itFind=NULL;				
 	EOFind=false;
 
+	// TreeModel
+	treeModel=new TreeModel;
+
 	// animations
 	animationUse=settings.readBoolEntry("/animation/use",false);
 	animationTicks=settings.readNumEntry("/animation/ticks",10);
@@ -161,6 +164,11 @@
 	return mapEditor;
 }
 
+TreeModel* VymModel::getTreeModel()
+{
+	return treeModel;
+}
+
 bool VymModel::isRepositionBlocked()
 {
 	return blockReposition;
@@ -1486,6 +1494,7 @@
 	}
 }
 
+/* FIXME delete this
 QString VymModel::getHeading(bool &ok, QPoint &p)
 {
 	BranchObj *bo=selection.getBranch();
@@ -1498,7 +1507,7 @@
 	ok=false;
 	return QString();
 }
-
+*/
 
 void VymModel::setHeadingInt(const QString &s)
 {
diff -r cf14046909cd -r 7ea31701156e vymmodel.h
--- a/vymmodel.h	Mon Aug 04 13:35:54 2008 +0000
+++ b/vymmodel.h	Tue Aug 05 07:36:53 2008 +0000
@@ -9,6 +9,7 @@
 #include "mapeditor.h"
 #include "parser.h"
 #include "selection.h"
+#include "treemodel.h"
 #include "xmlobj.h"
 
 
@@ -38,6 +39,11 @@
 
 	MapEditor* getMapEditor();			// FIXME not necessary
 
+private:
+	TreeModel* treeModel;
+public:	
+	TreeModel* getTreeModel();
+
 	bool isRepositionBlocked();		//!< While load or undo there is no need to update graphicsview
 
 	void updateActions();			//!< Update buttons in mainwindow
@@ -238,7 +244,7 @@
 
 public:	
 	void setHeading(const QString &);		//!< Set heading of branch	
-	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
+//	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
 private:
 	void setHeadingInt(const QString &);