# HG changeset patch
# User insilmaril
# Date 1231173098 0
# Node ID b77b56f707f11ca57b0fb73520bae19ecfc393d4
# Parent  c8b1a3564c74cc379a3746ae2249578d3bbb41b5
deleting works - partially.

diff -r c8b1a3564c74 -r b77b56f707f1 mainwindow.cpp
--- a/mainwindow.cpp	Wed Dec 10 13:10:35 2008 +0000
+++ b/mainwindow.cpp	Mon Jan 05 16:31:38 2009 +0000
@@ -3355,6 +3355,16 @@
 
 }
 
+bool Main::isAliased()
+{
+	return actionViewToggleAntiAlias->isOn();
+}
+
+bool Main::hasSmoothPixmapTransform()
+{
+	return actionViewToggleSmoothPixmapTransform->isOn();
+}
+
 void Main::windowToggleSmoothPixmap()
 {
 	bool b=actionViewToggleSmoothPixmapTransform->isOn();
diff -r c8b1a3564c74 -r b77b56f707f1 mainwindow.h
--- a/mainwindow.h	Wed Dec 10 13:10:35 2008 +0000
+++ b/mainwindow.h	Mon Jan 05 16:31:38 2009 +0000
@@ -197,6 +197,10 @@
 	void windowToggleProperty();
 	void updateHistory(SimpleSettings &);
 	void windowToggleAntiAlias();
+public:
+	bool isAliased();
+	bool hasSmoothPixmapTransform();
+public slots:
 	void windowToggleSmoothPixmap();
 	void updateNoteFlag();
 	void updateSatellites(VymModel*);
diff -r c8b1a3564c74 -r b77b56f707f1 mapeditor.cpp
--- a/mapeditor.cpp	Wed Dec 10 13:10:35 2008 +0000
+++ b/mapeditor.cpp	Mon Jan 05 16:31:38 2009 +0000
@@ -90,7 +90,6 @@
     connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
 
 	// Selections
-	selModel=vm->getSelectionModel();
 	selectionColor =QColor (255,255,0);
 	
 
@@ -550,11 +549,11 @@
 		cout << "  ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
 		//QModelIndex ix=model->index( ti->row(), ti->column(), model->index (0,0,QModelIndex()) );
 		QModelIndex ix=model->index(ti);
-		selModel->select (ix,QItemSelectionModel::ClearAndSelect  );
+		model->getSelectionModel()->select (ix,QItemSelectionModel::ClearAndSelect  );
 		/*
-		if (selModel->hasSelection() ) 
+		if (model->getSelectionModel()->hasSelection() ) 
 		{
-			QModelIndex ixsel=selModel->selectedIndexes().first();
+			QModelIndex ixsel=model->getSelectionModel()->selectedIndexes().first();
 			TreeItem *tisel= static_cast<TreeItem*>(ixsel.internalPointer());
 	;
 			cout << "  ti="<<ti<<"  tisel="<<tisel<<endl;
@@ -736,9 +735,9 @@
 				lmosel->reposition();	
 			} // depth>0
 
-			//model->updateSelection();// FIXME needed? 
-			//updateSelectionGeometry();
-			updateSelection(selModel->selection(), selModel->selection() );
+			QItemSelection sel=model->getSelectionModel()->selection();
+			updateSelection(sel,sel);
+
 		} // no FloatImageObj
 
 		scene()->update();
@@ -1066,23 +1065,6 @@
 
 void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &)
 {
-	cout << "ME::updateSelection\n";
-
-
-	if (newsel.isEmpty() )
-	{
-		cout << "   newsel=empty!\n";
-		return;
-	}	
-	QModelIndex index=newsel.indexes().first();	// TODO no multiselections yet
-
-	TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
-	LinkableMapObj *lmo=ti->getLMO();
-	cout << "   newsel.count="<<newsel.indexes().count()<<"  lmo="<<lmo<<endl;
-	cout << "   h="<<((BranchObj*)lmo)->getHeading().toStdString()<<endl;
-	cout << "   ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
-
-
 	// Reduce rectangles
 	while (newsel.indexes().count() < selboxList.count() )
 		delete selboxList.takeFirst();
@@ -1103,6 +1085,10 @@
 	// Reposition rectangles
 	int i=0;
 	QRectF bbox;
+	QModelIndex index;
+
+	TreeItem *ti;
+	LinkableMapObj *lmo;
 	foreach (sb,selboxList)
 	{
 		index=newsel.indexes().at(i);
@@ -1120,10 +1106,11 @@
 
 void MapEditor::updateCurrent (const QModelIndex &newsel,const QModelIndex &)
 {
+
+/* FIXME testing
+
 	cout << "ME::updateCurrent\n";
 
-/*
-
 	TreeItem *item = static_cast<TreeItem*>(newsel.internalPointer());
 	LinkableMapObj *lmo=item->getLMO();
 	cout << "  lmo="<<lmo<<endl;
@@ -1132,20 +1119,11 @@
 
 }
 
-void MapEditor::updateSelectionGeometry()	// FIXME VM only called from VM::animate...
-{
-	cout << "ME::updateSelectionGeometry\n";
-
-	// Tell selection to update geometries
-	updateSelection(selModel->selection(), selModel->selection() );
-	//model->updateSelection();
-}
-
-
 void MapEditor::setSelectionColor (QColor col)
 {
 	selectionColor=col;
-	updateSelectionGeometry();
+	QItemSelection sel=model->getSelectionModel()->selection();
+	updateSelection(sel,sel);
 }
 
 QColor MapEditor::getSelectionColor ()
diff -r c8b1a3564c74 -r b77b56f707f1 mapeditor.h
--- a/mapeditor.h	Wed Dec 10 13:10:35 2008 +0000
+++ b/mapeditor.h	Mon Jan 05 16:31:38 2009 +0000
@@ -96,7 +96,6 @@
 	void selectionChanged(const QItemSelection &, const QItemSelection &);
 
 private:	
-    QItemSelectionModel* selModel;	// we treat MapEditor as View here...
 	QList <QGraphicsRectItem*> selboxList;
 	QColor selectionColor;
 
@@ -104,7 +103,6 @@
 	void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
 	void updateCurrent (const QModelIndex&,const QModelIndex&); // update selection
 public:
-	void updateSelectionGeometry();	// update geometry of selection
 	void setSelectionColor (QColor c);
 	QColor getSelectionColor ();
 
diff -r c8b1a3564c74 -r b77b56f707f1 selection.cpp
--- a/selection.cpp	Wed Dec 10 13:10:35 2008 +0000
+++ b/selection.cpp	Mon Jan 05 16:31:38 2009 +0000
@@ -21,7 +21,6 @@
 void Selection::setModel (VymModel *m)
 {
 	model=m;
-	selModel=model->getSelectionModel();
 }
 
 void Selection::copy(const Selection &other)
@@ -188,7 +187,7 @@
 
 QModelIndex Selection::getBranchIndex()
 {
-	return selModel->selectedIndexes().first();	// TODO no multiselections yet
+	return model->getSelectionModel()->selectedIndexes().first();	// TODO no multiselections yet
 
 }
 
diff -r c8b1a3564c74 -r b77b56f707f1 selection.h
--- a/selection.h	Wed Dec 10 13:10:35 2008 +0000
+++ b/selection.h	Mon Jan 05 16:31:38 2009 +0000
@@ -50,8 +50,6 @@
 
 	VymModel *model;
 
-	QItemSelectionModel *selModel;	//!< QSelectionModel is shared across views and initialized in setModel
-
 	QColor color;
 	bool blocked;					//!< if true, no new selection possible
 };
diff -r c8b1a3564c74 -r b77b56f707f1 version.h
--- a/version.h	Wed Dec 10 13:10:35 2008 +0000
+++ b/version.h	Mon Jan 05 16:31:38 2009 +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-12-01"
+#define __VYM_BUILD_DATE "2008-12-10"
 
 
 bool checkVersion(const QString &);
diff -r c8b1a3564c74 -r b77b56f707f1 vymmodel.cpp
--- a/vymmodel.cpp	Wed Dec 10 13:10:35 2008 +0000
+++ b/vymmodel.cpp	Mon Jan 05 16:31:38 2009 +0000
@@ -28,7 +28,6 @@
 
 extern TextEditor *textEditor;
 
-
 extern QString clipboardDir;
 extern QString clipboardFile;
 extern bool clipboardEmpty;
@@ -2197,10 +2196,6 @@
 	if (bo && selection.type()==Selection::Branch)
 	{
 		QModelIndex ix=selection.getBranchIndex();
-		if (ix.isValid())
-		{
-			cout << "VM::deleteSelection\n";
-		}
 
 		BranchObj* par=(BranchObj*)bo->getParObj();
 		selection.unselect();
@@ -4145,7 +4140,6 @@
 		bo->reposition();
 		i++;
 	} 
-	cout << "VM::animate\n";
 	emit (selectionChanged(selModel->selection(), selModel->selection()) );
 	mapScene->update();
 	if (!animObjList.isEmpty()) animationTimer->start();
diff -r c8b1a3564c74 -r b77b56f707f1 vymview.cpp
--- a/vymview.cpp	Wed Dec 10 13:10:35 2008 +0000
+++ b/vymview.cpp	Mon Jan 05 16:31:38 2009 +0000
@@ -2,8 +2,12 @@
 
 #include <iostream>
 
+#include "mainwindow.h"
 #include "mapeditor.h"
 
+extern Main *mainWindow;
+
+
 VymView::VymView(VymModel *model)
 {
 	// Create TreeView
@@ -34,8 +38,8 @@
 		me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
 
 	//me->viewport()->setFocus();
-	//FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());
-	//FIXME me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
+	me->setAntiAlias (mainWindow->isAliased());
+	me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
 
 	addWidget (treeview);
 	addWidget (me);