Removing branches and mapcenters works
authorinsilmaril
Tue, 31 Mar 2009 15:36:10 +0000
changeset 748edb78a44240b
parent 747 008e72977ab8
child 749 9ff332964015
Removing branches and mapcenters works
branchitem.cpp
branchobj.cpp
branchobj.h
mainwindow.cpp
version.h
vymmodel.cpp
     1.1 --- a/branchitem.cpp	Thu Mar 26 07:50:32 2009 +0000
     1.2 +++ b/branchitem.cpp	Tue Mar 31 15:36:10 2009 +0000
     1.3 @@ -18,7 +18,7 @@
     1.4  QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
     1.5  {
     1.6  	// Cloudy stuff can be hidden during exports
     1.7 -	if (hidden) return "";
     1.8 +	if (hidden) return QString();
     1.9  
    1.10      QString s,a;
    1.11  	BranchObj *bo=(BranchObj*)lmo;
     2.1 --- a/branchobj.cpp	Thu Mar 26 07:50:32 2009 +0000
     2.2 +++ b/branchobj.cpp	Tue Mar 31 15:36:10 2009 +0000
     2.3 @@ -56,7 +56,7 @@
     2.4  		model->stopAnimation (this);
     2.5  	}
     2.6  
     2.7 -	cout << "Destr BranchObj of "<<this<<endl;
     2.8 +	cout << "Destr BranchObj of "<<this<<" ("<<getHeading().toStdString()<<")"<<endl;
     2.9  	// Check, if this branch was the last child to be deleted
    2.10  	// If so, unset the scrolled flags
    2.11  
    2.12 @@ -1382,6 +1382,7 @@
    2.13  	bboxTotal.setHeight(max (r.height(),  bbox.height()));
    2.14  }
    2.15  
    2.16 +/*
    2.17  void BranchObj::select()	// FIXME-2 try to get rid of this in BO completely
    2.18  {
    2.19  	cout << "BO::select()\n";
    2.20 @@ -1402,7 +1403,7 @@
    2.21  	// temporary unscroll, if we have scrolled parents somewhere
    2.22  	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
    2.23  
    2.24 -	/* moved to vymmodel or vymview...
    2.25 +	//moved to vymmodel or vymview...
    2.26  	// Show URL and link in statusbar
    2.27  	QString status;
    2.28  	if (!url.isEmpty()) status+="URL: "+url+"  ";
    2.29 @@ -1414,20 +1415,20 @@
    2.30  
    2.31  	// Update actions
    2.32  	model->updateActions();
    2.33 +}
    2.34  	*/
    2.35 -}
    2.36  
    2.37 +/*
    2.38  void BranchObj::unselect()	//FIXME-3 should not be needed
    2.39  {
    2.40 +	cout << "BO::unselect()\n";
    2.41  	LinkableMapObj::unselect();
    2.42  	// Delete any messages like vymLink in StatusBar
    2.43  	mainWindow->statusMessage ("");		//this causes segfault, when MainWindow is already gone in global destructor on quitting vym
    2.44  
    2.45 -/*
    2.46  	// Save current note
    2.47  	if (isNoteInEditor) getNoteFromTextEditor();
    2.48  	isNoteInEditor=false;
    2.49 -*/	
    2.50  
    2.51  	// reset temporary unscroll, if we have scrolled parents somewhere
    2.52  	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
    2.53 @@ -1438,6 +1439,7 @@
    2.54  	// unselect all buttons in toolbar
    2.55  	standardFlagsDefault->updateToolbar();
    2.56  }
    2.57 +*/	
    2.58  
    2.59  QString BranchObj::getSelectString()
    2.60  {
     3.1 --- a/branchobj.h	Thu Mar 26 07:50:32 2009 +0000
     3.2 +++ b/branchobj.h	Tue Mar 31 15:36:10 2009 +0000
     3.3 @@ -118,8 +118,6 @@
     3.4  	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
     3.5  	virtual void calcBBoxSizeWithChildren();	// calc size of  BBox including children recursivly
     3.6  
     3.7 -    virtual void select();
     3.8 -    virtual void unselect();
     3.9  	virtual QString getSelectString();
    3.10  	virtual void setAnimation(const AnimPoint &ap);
    3.11  	virtual bool animate();
     4.1 --- a/mainwindow.cpp	Thu Mar 26 07:50:32 2009 +0000
     4.2 +++ b/mainwindow.cpp	Tue Mar 31 15:36:10 2009 +0000
     4.3 @@ -1,5 +1,6 @@
     4.4  #include "mainwindow.h"
     4.5  
     4.6 +#include <QtDBus/QtDBus>
     4.7  #include <QtGui>
     4.8  
     4.9  #include <iostream>
    4.10 @@ -2564,7 +2565,7 @@
    4.11  					urls.at(i);
    4.12  #endif
    4.13  				p->start ("dcop",args);
    4.14 -				//cout << qPrintable (args.join(" "))<<endl;
    4.15 +				if (debug) cout << "MainWindo::openURLs  args="<<args.join(" ").toStdString()<<endl;
    4.16  				if ( !p->waitForStarted() ) success=false;
    4.17  			}
    4.18  			if (!success)
    4.19 @@ -3483,6 +3484,7 @@
    4.20  void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
    4.21  {
    4.22  	//branchPropertyWindow->setModel (model ); //FIXME-1 this used to be called from BranchObj::select()
    4.23 +
    4.24  	if (model && model==currentModel() )
    4.25  	{
    4.26  		// NoteEditor
    4.27 @@ -3811,8 +3813,8 @@
    4.28  
    4.29  void Main::testFunction1()
    4.30  {
    4.31 -	if (!currentMapEditor()) return;
    4.32 -	currentMapEditor()->testFunction1();
    4.33 +	//if (!currentMapEditor()) return;
    4.34 +	//currentMapEditor()->testFunction1();
    4.35  	//editAttribute();
    4.36  }
    4.37  
     5.1 --- a/version.h	Thu Mar 26 07:50:32 2009 +0000
     5.2 +++ b/version.h	Tue Mar 31 15:36:10 2009 +0000
     5.3 @@ -7,7 +7,7 @@
     5.4  #define __VYM_VERSION "1.13.0"
     5.5  //#define __VYM_CODENAME "Codename: RC-1"
     5.6  #define __VYM_CODENAME "Codename: development version"
     5.7 -#define __VYM_BUILD_DATE "2009-03-26"
     5.8 +#define __VYM_BUILD_DATE "2009-03-31"
     5.9  
    5.10  
    5.11  bool checkVersion(const QString &);
     6.1 --- a/vymmodel.cpp	Thu Mar 26 07:50:32 2009 +0000
     6.2 +++ b/vymmodel.cpp	Tue Mar 31 15:36:10 2009 +0000
     6.3 @@ -2227,31 +2227,43 @@
     6.4  	if (!ix.isValid() ) return;
     6.5  
     6.6  	QModelIndex parentIndex=parent(ix);
     6.7 -	if (!parentIndex.isValid()) return;
     6.8 +/*
     6.9 +	if (!parentIndex.isValid()) 
    6.10 +	{
    6.11 +	cout << "VM::delete no valid parent ix\n";
    6.12 +	return;
    6.13 +	}
    6.14 +*/	
    6.15  	TreeItem *ti=bo->getTreeItem();
    6.16  	
    6.17 -	if (selectionType()==TreeItem::MapCenter)		//FIXME-1 VM still missing
    6.18 +	if (selectionType()==TreeItem::MapCenter)	
    6.19  	{
    6.20  	//	BranchObj* par=(BranchObj*)(bo->getParObj());
    6.21  		//selection.unselect();
    6.22  		/* FIXME-1 VM Note:  does saveStateRemovingPart work for MCO? (No parent!)
    6.23  		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
    6.24 -		*/
    6.25 -		/*
    6.26 +		*/	
    6.27 +		emit (layoutAboutToBeChanged() );
    6.28 +
    6.29 +		parentIndex=parent(index(ti));
    6.30 +		cout << "VM::delete  ti="<<ti<<"  row="<<ix.row()<<"  parIndex.valid="<<parentIndex.isValid()<<endl;
    6.31 +		int n=ix.row();
    6.32 +		beginRemoveRows (parentIndex,n,n);
    6.33 +		removeRows (n,1,parentIndex);
    6.34  		bo=removeMapCenter ((MapCenterObj*)bo);
    6.35 +		endRemoveRows();
    6.36  		if (bo) 
    6.37  		{
    6.38 -			selection.select (bo);
    6.39 +			select (bo);
    6.40  			ensureSelectionVisible();
    6.41 -			selection.update();
    6.42 +			ensureSelectionVisible();
    6.43 +			reposition();
    6.44  		}	
    6.45 -		reposition();
    6.46 -		return;
    6.47 -		*/
    6.48 +
    6.49 +		emit (layoutChanged() );
    6.50  	}
    6.51  	if (selectionType()==TreeItem::Branch)
    6.52  	{
    6.53 -		int n=ti->branchCount();
    6.54  
    6.55  		BranchObj* par=(BranchObj*)bo->getParObj();
    6.56  		unselect();
    6.57 @@ -2261,11 +2273,11 @@
    6.58  
    6.59  		cout << "VM::delete  ti="<<ti<<"  row="<<ix.row()<<endl;
    6.60  		parentIndex=parent(index(ti));
    6.61 -		cout << "            valid parentIndex="<<parentIndex.isValid()<<endl;
    6.62 +		int n=ix.row();
    6.63  		beginRemoveRows (parentIndex,n,n);
    6.64 -		removeRows (ix.row(),1,parentIndex);
    6.65 +		removeRows (n,1,parentIndex);
    6.66 +		par->removeBranch(bo);	// remove from BranchObj lists...
    6.67  		endRemoveRows();
    6.68 -		par->removeBranch(bo);
    6.69  		select (par);
    6.70  		ensureSelectionVisible();
    6.71  		reposition();
    6.72 @@ -2275,6 +2287,7 @@
    6.73  	}
    6.74  	FloatImageObj *fio=selection.getFloatImage(); 	//FIXME-1 VM still missing
    6.75  
    6.76 +/*
    6.77  	if (fio)
    6.78  	{
    6.79  		BranchObj* par=(BranchObj*)fio->getParObj();
    6.80 @@ -2291,6 +2304,7 @@
    6.81  		ensureSelectionVisible();
    6.82  		return;
    6.83  	}
    6.84 +	*/
    6.85  }
    6.86  
    6.87  void VymModel::deleteKeepChildren()		//FIXME-1 VM still missing