deleting works - partially.
authorinsilmaril
Mon Jan 05 16:31:38 2009 +0000 (2009-01-05)
changeset 732b77b56f707f1
parent 731 c8b1a3564c74
child 733 143202d76b80
deleting works - partially.
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
selection.cpp
selection.h
version.h
vymmodel.cpp
vymview.cpp
     1.1 --- a/mainwindow.cpp	Wed Dec 10 13:10:35 2008 +0000
     1.2 +++ b/mainwindow.cpp	Mon Jan 05 16:31:38 2009 +0000
     1.3 @@ -3355,6 +3355,16 @@
     1.4  
     1.5  }
     1.6  
     1.7 +bool Main::isAliased()
     1.8 +{
     1.9 +	return actionViewToggleAntiAlias->isOn();
    1.10 +}
    1.11 +
    1.12 +bool Main::hasSmoothPixmapTransform()
    1.13 +{
    1.14 +	return actionViewToggleSmoothPixmapTransform->isOn();
    1.15 +}
    1.16 +
    1.17  void Main::windowToggleSmoothPixmap()
    1.18  {
    1.19  	bool b=actionViewToggleSmoothPixmapTransform->isOn();
     2.1 --- a/mainwindow.h	Wed Dec 10 13:10:35 2008 +0000
     2.2 +++ b/mainwindow.h	Mon Jan 05 16:31:38 2009 +0000
     2.3 @@ -197,6 +197,10 @@
     2.4  	void windowToggleProperty();
     2.5  	void updateHistory(SimpleSettings &);
     2.6  	void windowToggleAntiAlias();
     2.7 +public:
     2.8 +	bool isAliased();
     2.9 +	bool hasSmoothPixmapTransform();
    2.10 +public slots:
    2.11  	void windowToggleSmoothPixmap();
    2.12  	void updateNoteFlag();
    2.13  	void updateSatellites(VymModel*);
     3.1 --- a/mapeditor.cpp	Wed Dec 10 13:10:35 2008 +0000
     3.2 +++ b/mapeditor.cpp	Mon Jan 05 16:31:38 2009 +0000
     3.3 @@ -90,7 +90,6 @@
     3.4      connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
     3.5  
     3.6  	// Selections
     3.7 -	selModel=vm->getSelectionModel();
     3.8  	selectionColor =QColor (255,255,0);
     3.9  	
    3.10  
    3.11 @@ -550,11 +549,11 @@
    3.12  		cout << "  ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
    3.13  		//QModelIndex ix=model->index( ti->row(), ti->column(), model->index (0,0,QModelIndex()) );
    3.14  		QModelIndex ix=model->index(ti);
    3.15 -		selModel->select (ix,QItemSelectionModel::ClearAndSelect  );
    3.16 +		model->getSelectionModel()->select (ix,QItemSelectionModel::ClearAndSelect  );
    3.17  		/*
    3.18 -		if (selModel->hasSelection() ) 
    3.19 +		if (model->getSelectionModel()->hasSelection() ) 
    3.20  		{
    3.21 -			QModelIndex ixsel=selModel->selectedIndexes().first();
    3.22 +			QModelIndex ixsel=model->getSelectionModel()->selectedIndexes().first();
    3.23  			TreeItem *tisel= static_cast<TreeItem*>(ixsel.internalPointer());
    3.24  	;
    3.25  			cout << "  ti="<<ti<<"  tisel="<<tisel<<endl;
    3.26 @@ -736,9 +735,9 @@
    3.27  				lmosel->reposition();	
    3.28  			} // depth>0
    3.29  
    3.30 -			//model->updateSelection();// FIXME needed? 
    3.31 -			//updateSelectionGeometry();
    3.32 -			updateSelection(selModel->selection(), selModel->selection() );
    3.33 +			QItemSelection sel=model->getSelectionModel()->selection();
    3.34 +			updateSelection(sel,sel);
    3.35 +
    3.36  		} // no FloatImageObj
    3.37  
    3.38  		scene()->update();
    3.39 @@ -1066,23 +1065,6 @@
    3.40  
    3.41  void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &)
    3.42  {
    3.43 -	cout << "ME::updateSelection\n";
    3.44 -
    3.45 -
    3.46 -	if (newsel.isEmpty() )
    3.47 -	{
    3.48 -		cout << "   newsel=empty!\n";
    3.49 -		return;
    3.50 -	}	
    3.51 -	QModelIndex index=newsel.indexes().first();	// TODO no multiselections yet
    3.52 -
    3.53 -	TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
    3.54 -	LinkableMapObj *lmo=ti->getLMO();
    3.55 -	cout << "   newsel.count="<<newsel.indexes().count()<<"  lmo="<<lmo<<endl;
    3.56 -	cout << "   h="<<((BranchObj*)lmo)->getHeading().toStdString()<<endl;
    3.57 -	cout << "   ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
    3.58 -
    3.59 -
    3.60  	// Reduce rectangles
    3.61  	while (newsel.indexes().count() < selboxList.count() )
    3.62  		delete selboxList.takeFirst();
    3.63 @@ -1103,6 +1085,10 @@
    3.64  	// Reposition rectangles
    3.65  	int i=0;
    3.66  	QRectF bbox;
    3.67 +	QModelIndex index;
    3.68 +
    3.69 +	TreeItem *ti;
    3.70 +	LinkableMapObj *lmo;
    3.71  	foreach (sb,selboxList)
    3.72  	{
    3.73  		index=newsel.indexes().at(i);
    3.74 @@ -1120,10 +1106,11 @@
    3.75  
    3.76  void MapEditor::updateCurrent (const QModelIndex &newsel,const QModelIndex &)
    3.77  {
    3.78 +
    3.79 +/* FIXME testing
    3.80 +
    3.81  	cout << "ME::updateCurrent\n";
    3.82  
    3.83 -/*
    3.84 -
    3.85  	TreeItem *item = static_cast<TreeItem*>(newsel.internalPointer());
    3.86  	LinkableMapObj *lmo=item->getLMO();
    3.87  	cout << "  lmo="<<lmo<<endl;
    3.88 @@ -1132,20 +1119,11 @@
    3.89  
    3.90  }
    3.91  
    3.92 -void MapEditor::updateSelectionGeometry()	// FIXME VM only called from VM::animate...
    3.93 -{
    3.94 -	cout << "ME::updateSelectionGeometry\n";
    3.95 -
    3.96 -	// Tell selection to update geometries
    3.97 -	updateSelection(selModel->selection(), selModel->selection() );
    3.98 -	//model->updateSelection();
    3.99 -}
   3.100 -
   3.101 -
   3.102  void MapEditor::setSelectionColor (QColor col)
   3.103  {
   3.104  	selectionColor=col;
   3.105 -	updateSelectionGeometry();
   3.106 +	QItemSelection sel=model->getSelectionModel()->selection();
   3.107 +	updateSelection(sel,sel);
   3.108  }
   3.109  
   3.110  QColor MapEditor::getSelectionColor ()
     4.1 --- a/mapeditor.h	Wed Dec 10 13:10:35 2008 +0000
     4.2 +++ b/mapeditor.h	Mon Jan 05 16:31:38 2009 +0000
     4.3 @@ -96,7 +96,6 @@
     4.4  	void selectionChanged(const QItemSelection &, const QItemSelection &);
     4.5  
     4.6  private:	
     4.7 -    QItemSelectionModel* selModel;	// we treat MapEditor as View here...
     4.8  	QList <QGraphicsRectItem*> selboxList;
     4.9  	QColor selectionColor;
    4.10  
    4.11 @@ -104,7 +103,6 @@
    4.12  	void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
    4.13  	void updateCurrent (const QModelIndex&,const QModelIndex&); // update selection
    4.14  public:
    4.15 -	void updateSelectionGeometry();	// update geometry of selection
    4.16  	void setSelectionColor (QColor c);
    4.17  	QColor getSelectionColor ();
    4.18  
     5.1 --- a/selection.cpp	Wed Dec 10 13:10:35 2008 +0000
     5.2 +++ b/selection.cpp	Mon Jan 05 16:31:38 2009 +0000
     5.3 @@ -21,7 +21,6 @@
     5.4  void Selection::setModel (VymModel *m)
     5.5  {
     5.6  	model=m;
     5.7 -	selModel=model->getSelectionModel();
     5.8  }
     5.9  
    5.10  void Selection::copy(const Selection &other)
    5.11 @@ -188,7 +187,7 @@
    5.12  
    5.13  QModelIndex Selection::getBranchIndex()
    5.14  {
    5.15 -	return selModel->selectedIndexes().first();	// TODO no multiselections yet
    5.16 +	return model->getSelectionModel()->selectedIndexes().first();	// TODO no multiselections yet
    5.17  
    5.18  }
    5.19  
     6.1 --- a/selection.h	Wed Dec 10 13:10:35 2008 +0000
     6.2 +++ b/selection.h	Mon Jan 05 16:31:38 2009 +0000
     6.3 @@ -50,8 +50,6 @@
     6.4  
     6.5  	VymModel *model;
     6.6  
     6.7 -	QItemSelectionModel *selModel;	//!< QSelectionModel is shared across views and initialized in setModel
     6.8 -
     6.9  	QColor color;
    6.10  	bool blocked;					//!< if true, no new selection possible
    6.11  };
     7.1 --- a/version.h	Wed Dec 10 13:10:35 2008 +0000
     7.2 +++ b/version.h	Mon Jan 05 16:31:38 2009 +0000
     7.3 @@ -7,7 +7,7 @@
     7.4  #define __VYM_VERSION "1.13.0"
     7.5  //#define __VYM_CODENAME "Codename: RC-1"
     7.6  #define __VYM_CODENAME "Codename: development version"
     7.7 -#define __VYM_BUILD_DATE "2008-12-01"
     7.8 +#define __VYM_BUILD_DATE "2008-12-10"
     7.9  
    7.10  
    7.11  bool checkVersion(const QString &);
     8.1 --- a/vymmodel.cpp	Wed Dec 10 13:10:35 2008 +0000
     8.2 +++ b/vymmodel.cpp	Mon Jan 05 16:31:38 2009 +0000
     8.3 @@ -28,7 +28,6 @@
     8.4  
     8.5  extern TextEditor *textEditor;
     8.6  
     8.7 -
     8.8  extern QString clipboardDir;
     8.9  extern QString clipboardFile;
    8.10  extern bool clipboardEmpty;
    8.11 @@ -2197,10 +2196,6 @@
    8.12  	if (bo && selection.type()==Selection::Branch)
    8.13  	{
    8.14  		QModelIndex ix=selection.getBranchIndex();
    8.15 -		if (ix.isValid())
    8.16 -		{
    8.17 -			cout << "VM::deleteSelection\n";
    8.18 -		}
    8.19  
    8.20  		BranchObj* par=(BranchObj*)bo->getParObj();
    8.21  		selection.unselect();
    8.22 @@ -4145,7 +4140,6 @@
    8.23  		bo->reposition();
    8.24  		i++;
    8.25  	} 
    8.26 -	cout << "VM::animate\n";
    8.27  	emit (selectionChanged(selModel->selection(), selModel->selection()) );
    8.28  	mapScene->update();
    8.29  	if (!animObjList.isEmpty()) animationTimer->start();
     9.1 --- a/vymview.cpp	Wed Dec 10 13:10:35 2008 +0000
     9.2 +++ b/vymview.cpp	Mon Jan 05 16:31:38 2009 +0000
     9.3 @@ -2,8 +2,12 @@
     9.4  
     9.5  #include <iostream>
     9.6  
     9.7 +#include "mainwindow.h"
     9.8  #include "mapeditor.h"
     9.9  
    9.10 +extern Main *mainWindow;
    9.11 +
    9.12 +
    9.13  VymView::VymView(VymModel *model)
    9.14  {
    9.15  	// Create TreeView
    9.16 @@ -34,8 +38,8 @@
    9.17  		me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
    9.18  
    9.19  	//me->viewport()->setFocus();
    9.20 -	//FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn());
    9.21 -	//FIXME me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
    9.22 +	me->setAntiAlias (mainWindow->isAliased());
    9.23 +	me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform());
    9.24  
    9.25  	addWidget (treeview);
    9.26  	addWidget (me);