add above/below
authorinsilmaril
Fri, 01 May 2009 10:30:29 +0000
changeset 7638c028a5d9083
parent 762 ffb95cd03156
child 764 d0f944a540a1
add above/below
branchitem.cpp
flagobj.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
tex/vym.tex
treeitem.cpp
treeitem.h
version.h
vymmodel.cpp
vymmodel.h
vymview.cpp
vymview.h
xml-freemind.cpp
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Thu Apr 30 11:52:49 2009 +0000
     1.2 +++ b/branchitem.cpp	Fri May 01 10:30:29 2009 +0000
     1.3 @@ -204,29 +204,36 @@
     1.4  
     1.5  void BranchItem::toggleScroll()
     1.6  {
     1.7 +	BranchItem *bi=getFirstBranch();
     1.8 +
     1.9 +	BranchObj *bo=NULL;
    1.10  	if (scrolled)
    1.11  	{
    1.12  		scrolled=false;
    1.13  		//FIXME-1 systemFlags->deactivate("scrolledright");
    1.14 -		/*
    1.15 -		for (int i=0; i<branch.size(); ++i)
    1.16 -			branch.at(i)->setVisibility(true);
    1.17 -		*/	
    1.18 +		while (bi)
    1.19 +		{
    1.20 +			bo=(BranchObj*)(bi->getLMO());
    1.21 +			if (bo) bo->setVisibility(true);
    1.22 +			bi=getNextBranch(bi);
    1.23 +		}
    1.24  	} else
    1.25  	{
    1.26  		scrolled=true;
    1.27 -		/*
    1.28  		//FIXME-1 systemFlags->activate("scrolledright");
    1.29 -		for (int i=0; i<branch.size(); ++i)
    1.30 -			branch.at(i)->setVisibility(false);
    1.31 -		*/	
    1.32 +		while (bi)
    1.33 +		{
    1.34 +			bo=(BranchObj*)(bi->getLMO());
    1.35 +			if (bo) bo->setVisibility(false);
    1.36 +			bi=getNextBranch(bi);
    1.37 +		}
    1.38  	}
    1.39 -	/*	
    1.40 -	calcBBoxSize();
    1.41 -	positionBBox();	
    1.42 -	move (absPos.x(), absPos.y() );
    1.43 -	forceReposition();
    1.44 -	*/
    1.45 +	if (bo)
    1.46 +	{
    1.47 +		bo->calcBBoxSize();
    1.48 +		bo->positionBBox();	
    1.49 +		bo->forceReposition();
    1.50 +	}
    1.51  }
    1.52  
    1.53  bool BranchItem::isScrolled()
     2.1 --- a/flagobj.cpp	Thu Apr 30 11:52:49 2009 +0000
     2.2 +++ b/flagobj.cpp	Fri May 01 10:30:29 2009 +0000
     2.3 @@ -174,8 +174,6 @@
     2.4  	if (visible) 
     2.5  	{
     2.6  		icon->setVisibility (true);
     2.7 -		//icon->setPos (100,100);
     2.8 -		//icon->setPos (rand()%100,rand()%130);
     2.9  		calcBBoxSize();
    2.10  	}	
    2.11  }
    2.12 @@ -216,14 +214,11 @@
    2.13  void FlagObj::calcBBoxSize()
    2.14  {
    2.15  	if (visible && state)
    2.16 -	{
    2.17  		bbox.setSize (	QSizeF(
    2.18  			icon->boundingRect().width(), 
    2.19  			icon->boundingRect().height() ) );
    2.20 -	} else
    2.21 -	{
    2.22 +	else
    2.23  		bbox.setSize (QSizeF(0,0));
    2.24 -	}
    2.25  	clickBox.setSize (bbox.size());
    2.26  }
    2.27  
     3.1 --- a/mainwindow.cpp	Thu Apr 30 11:52:49 2009 +0000
     3.2 +++ b/mainwindow.cpp	Fri May 01 10:30:29 2009 +0000
     3.3 @@ -689,11 +689,6 @@
     3.4  	editMenu->addAction (a);
     3.5  	actionSortChildren=a;
     3.6  
     3.7 -	a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ),this);
     3.8 -	a->setShortcut ( Qt::Key_ScrollLock );
     3.9 -	a->setStatusTip (tr( "Scroll branch" ) );
    3.10 -    connect( a, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
    3.11 -
    3.12  	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this);
    3.13  	alt->setShortcut ( Qt::Key_S );					// Scroll branch
    3.14  	alt->setStatusTip (tr( "Scroll branch" )); 
    3.15 @@ -712,6 +707,19 @@
    3.16  	addAction (alt);
    3.17  	actionListBranches.append(actionToggleScroll);
    3.18  	
    3.19 +	a = new QAction( QPixmap(), tr( "Expand all branches","Edit menu" ), this);
    3.20 +	a->setShortcut ( Qt::SHIFT + Qt::Key_X );		// Expand all branches 
    3.21 +	a->setStatusTip (tr( "Expand all branches" )); 
    3.22 +    connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) );
    3.23 +	actionExpandAll=a;
    3.24 +	actionExpandAll->setEnabled (false);
    3.25 +	actionExpandAll->setToggleAction(false);
    3.26 +    //tb->addAction (actionExpandAll);
    3.27 +    editMenu->addAction ( actionExpandAll);
    3.28 +	addAction (a);
    3.29 +	actionListBranches.append(actionExpandAll);
    3.30 +
    3.31 +
    3.32      a = new QAction( tr( "Unscroll children","Edit menu" ), this);
    3.33  	a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" ));
    3.34  	editMenu->addAction (a);
    3.35 @@ -1773,7 +1781,6 @@
    3.36  VymView *Main::createView (VymModel *model)
    3.37  {
    3.38  	VymView *vm=new VymView (model);
    3.39 -
    3.40  	return vm;
    3.41  }
    3.42  
    3.43 @@ -1784,8 +1791,7 @@
    3.44  	//MapEditor* me = new MapEditor (m);
    3.45  	//me->setObjectName ("MapEditor");
    3.46  
    3.47 -	VymView *view=createView (m);
    3.48 -	tabWidget->addTab (view,tr("unnamed","MainWindow: name for new and empty file"));
    3.49 +	tabWidget->addTab (createView (m),tr("unnamed","MainWindow: name for new and empty file"));
    3.50  	tabWidget->setCurrentIndex (tabModel.count() );
    3.51  	
    3.52  	// For the very first map we do not have flagrows yet...
    3.53 @@ -1867,8 +1873,7 @@
    3.54  		{
    3.55  			vm=new VymModel;
    3.56  			tabModel.append (vm);
    3.57 -			VymView *view=createView (vm);
    3.58 -			tabWidget->addTab (view,fn);
    3.59 +			tabWidget->addTab (createView (vm),fn);
    3.60  			tabIndex=tabWidget->count()-1;
    3.61  			tabWidget->setCurrentPage (tabIndex);
    3.62  		}
    3.63 @@ -2928,6 +2933,12 @@
    3.64  	if (m) m->toggleScroll();
    3.65  }
    3.66  
    3.67 +void Main::editExpandAll()
    3.68 +{
    3.69 +	VymModel *m=currentModel();
    3.70 +	if (m) m->emitExpandAll();
    3.71 +}
    3.72 +
    3.73  void Main::editUnscrollChildren()
    3.74  {
    3.75  	VymModel *m=currentModel();
    3.76 @@ -2995,7 +3006,7 @@
    3.77  	VymModel *m=currentModel();
    3.78  	if ( m)
    3.79  	{
    3.80 -		BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranch (-1);
    3.81 +		BranchItem *bi=m->addNewBranch (-1);
    3.82  
    3.83  
    3.84  		if (bi) 
    3.85 @@ -3017,7 +3028,7 @@
    3.86  	VymModel *m=currentModel();
    3.87  	if (m)
    3.88  	{
    3.89 -		BranchItem *bi=m->createBranch();//FIXME-1 *newbo=m->addNewBranch (1);
    3.90 +		BranchItem *bi=m->addNewBranch (1);
    3.91  
    3.92  		if (bi) 
    3.93  			m->select (bi);
    3.94 @@ -3286,7 +3297,7 @@
    3.95  void Main::viewCenter()
    3.96  {
    3.97  	VymModel *m=currentModel();
    3.98 -	if (m) m->ensureSelectionVisible();
    3.99 +	if (m) m->emitShowSelection();
   3.100  }
   3.101  
   3.102  void Main::networkStartServer()
     4.1 --- a/mainwindow.h	Thu Apr 30 11:52:49 2009 +0000
     4.2 +++ b/mainwindow.h	Fri May 01 10:30:29 2009 +0000
     4.3 @@ -147,6 +147,7 @@
     4.4      void editMoveDown();	
     4.5  	void editSortChildren();
     4.6      void editToggleScroll();
     4.7 +    void editExpandAll();
     4.8      void editUnscrollChildren();
     4.9      void editAddMapCenter();
    4.10      void editNewBranch();
    4.11 @@ -287,6 +288,7 @@
    4.12  	QAction *actionMoveDown;
    4.13  	QAction *actionSortChildren;
    4.14  	QAction *actionToggleScroll;
    4.15 +	QAction *actionExpandAll;
    4.16  	QAction* actionOpenURL;
    4.17  	QAction* actionOpenURLTab;
    4.18  	QAction* actionOpenMultipleURLTabs;
     5.1 --- a/mapeditor.cpp	Thu Apr 30 11:52:49 2009 +0000
     5.2 +++ b/mapeditor.cpp	Fri May 01 10:30:29 2009 +0000
     5.3 @@ -662,9 +662,9 @@
     5.4  			setCursor (Qt::ArrowCursor);
     5.5  
     5.6  		// To avoid jumping of the sceneView, only 
     5.7 -		// ensureSelectionVisible, if not tmp linked
     5.8 +		// show selection, if not tmp linked
     5.9  		if (!lmosel->hasParObjTmp())
    5.10 -			model->ensureSelectionVisible ();
    5.11 +			model->emitShowSelection();
    5.12  		
    5.13  		// Now move the selection, but add relative position 
    5.14  		// (movingObj_start) where selection was chosen with 
     6.1 --- a/tex/vym.tex	Thu Apr 30 11:52:49 2009 +0000
     6.2 +++ b/tex/vym.tex	Fri May 01 10:30:29 2009 +0000
     6.3 @@ -368,7 +368,7 @@
     6.4  
     6.5  To scroll or unscroll a branch and its children,
     6.6  \begin{itemize}
     6.7 -	\item press either the \key{Scroll Lock} key or the \key{S}
     6.8 +	\item press the \key{S}
     6.9  	\item press the middle-mouse button or
    6.10  	\item choose the scroll icon from the toolbar.
    6.11  \end{itemize}
     7.1 --- a/treeitem.cpp	Thu Apr 30 11:52:49 2009 +0000
     7.2 +++ b/treeitem.cpp	Fri May 01 10:30:29 2009 +0000
     7.3 @@ -52,6 +52,9 @@
     7.4  	branchCounter=0;
     7.5  	lastSelectedBranchNum=-1;
     7.6  
     7.7 +	imageOffset=0;
     7.8 +	imageCounter=0;
     7.9 +
    7.10  	note.setNote(""); 
    7.11  	// note.setFontHint (textEditor->getFontHintDefault() );	//FIXME-2
    7.12  	// isNoteInEditor=false;
    7.13 @@ -198,7 +201,7 @@
    7.14  		case Undefined: return -1;
    7.15  		case MapCenter: return parentItem->childItems.indexOf (this) - branchOffset;
    7.16  		case Branch: return parentItem->childItems.indexOf (this) - branchOffset;
    7.17 -		case Image: return -1; // FIXME-2
    7.18 +		case Image: return parentItem->childItems.indexOf (this) - imageOffset;
    7.19  		default: return -1;
    7.20  	}
    7.21  }
    7.22 @@ -209,9 +212,9 @@
    7.23  	switch (item->getType())
    7.24  	{
    7.25  		case Undefined: return -1;
    7.26 -		case MapCenter: return childItems.indexOf (this) - branchOffset;
    7.27 -		case Branch: return childItems.indexOf (this) - branchOffset;
    7.28 -		case Image: return -1; // FIXME-2
    7.29 +		case MapCenter: return childItems.indexOf (item) - branchOffset;
    7.30 +		case Branch: return childItems.indexOf (item) - branchOffset;
    7.31 +		case Image: return parentItem->childItems.indexOf (item) - imageOffset;
    7.32  		default: return -1;
    7.33  	}
    7.34  }
    7.35 @@ -351,6 +354,16 @@
    7.36  		return NULL;
    7.37  }
    7.38  
    7.39 +BranchItem* TreeItem::getNextBranch(BranchItem *currentBranch)
    7.40 +{
    7.41 +	if (!currentBranch) return NULL;
    7.42 +	int n=num (currentBranch)+1;
    7.43 +	if (n<branchCounter)
    7.44 +		return getBranchNum (branchOffset + n);
    7.45 +	else
    7.46 +		return NULL;
    7.47 +}
    7.48 +
    7.49  
    7.50  BranchItem* TreeItem::getBranchNum(const int &n)
    7.51  {
     8.1 --- a/treeitem.h	Thu Apr 30 11:52:49 2009 +0000
     8.2 +++ b/treeitem.h	Fri May 01 10:30:29 2009 +0000
     8.3 @@ -94,6 +94,11 @@
     8.4  	virtual TreeItem* getChildNum(const int &n);
     8.5  	virtual BranchItem* getFirstBranch();
     8.6  	virtual BranchItem* getLastBranch();
     8.7 +
     8.8 +	/*! Get next branch after current branch. Return NULL if there is no
     8.9 +	    next branch */
    8.10 +	virtual BranchItem* getNextBranch(BranchItem* currentBranch);
    8.11 +
    8.12  	virtual BranchItem* getBranchNum(const int &n);
    8.13  	virtual BranchObj* getBranchObjNum(const int &n);
    8.14  	virtual void setLastSelectedBranch();		//! Set myself as last selected in parent
    8.15 @@ -118,6 +123,9 @@
    8.16  	int branchCounter;
    8.17  	int lastSelectedBranchNum;
    8.18  
    8.19 +	int imageOffset;
    8.20 +	int imageCounter;
    8.21 +
    8.22  	bool hideExport;//! Hide this item in export
    8.23  	bool hidden;	//! Hidden in export if true
    8.24  };
     9.1 --- a/version.h	Thu Apr 30 11:52:49 2009 +0000
     9.2 +++ b/version.h	Fri May 01 10:30:29 2009 +0000
     9.3 @@ -7,7 +7,7 @@
     9.4  #define __VYM_VERSION "1.13.0"
     9.5  //#define __VYM_CODENAME "Codename: RC-1"
     9.6  #define __VYM_CODENAME "Codename: development version, not for production!"
     9.7 -#define __VYM_BUILD_DATE "2009-04-29"
     9.8 +#define __VYM_BUILD_DATE "2009-05-01"
     9.9  
    9.10  
    9.11  bool checkVersion(const QString &);
    10.1 --- a/vymmodel.cpp	Thu Apr 30 11:52:49 2009 +0000
    10.2 +++ b/vymmodel.cpp	Fri May 01 10:30:29 2009 +0000
    10.3 @@ -1186,7 +1186,7 @@
    10.4  	mainWindow->updateHistory (undoSet);
    10.5  	updateActions();
    10.6  	selection.update();
    10.7 -	ensureSelectionVisible();
    10.8 +	emitShowSelection();
    10.9  }
   10.10  
   10.11  bool VymModel::isUndoAvailable()
   10.12 @@ -1521,7 +1521,7 @@
   10.13  
   10.14  		reposition();
   10.15  //		selection.update();	//FIXME-4
   10.16 -		ensureSelectionVisible();
   10.17 +		emitShowSelection();
   10.18  	}
   10.19  }
   10.20  
   10.21 @@ -1554,7 +1554,7 @@
   10.22  				if (getSelectedBranch()!=itFind) 
   10.23  				{
   10.24  					select(itFind);
   10.25 -					ensureSelectionVisible();
   10.26 +					emitShowSelection();
   10.27  				}
   10.28  				*/
   10.29  				if (textEditor->findText(s,flags)) 
   10.30 @@ -1615,7 +1615,7 @@
   10.31  		updateActions();
   10.32  		reposition();
   10.33  		selection.update();
   10.34 -		ensureSelectionVisible();
   10.35 +		emitShowSelection();
   10.36  	}
   10.37  */
   10.38  }	
   10.39 @@ -1969,7 +1969,7 @@
   10.40  		reposition();
   10.41  		//FIXME-3 VM needed? scene()->update();
   10.42  		selection.update();
   10.43 -		ensureSelectionVisible();
   10.44 +		emitShowSelection();
   10.45  	}
   10.46  	*/
   10.47  }
   10.48 @@ -1988,7 +1988,7 @@
   10.49  		reposition();
   10.50  		//FIXME-3 VM needed? scene()->update();
   10.51  		selection.update();
   10.52 -		ensureSelectionVisible();
   10.53 +		emitShowSelection();
   10.54  	}	
   10.55  */	
   10.56  }
   10.57 @@ -2004,7 +2004,7 @@
   10.58  			saveStateChangingPart(bo,bo, "sortChildren ()",QString("Sort children of %1").arg(getObjectName(bo)));
   10.59  			bo->sortChildren();
   10.60  			reposition();
   10.61 -			ensureSelectionVisible();
   10.62 +			emitShowSelection();
   10.63  		}
   10.64  	}
   10.65  */
   10.66 @@ -2055,7 +2055,7 @@
   10.67  	MapCenterItem *mci=addMapCenter (contextPos);
   10.68  	//FIXME-3 selection.select (mco);
   10.69  	updateActions();
   10.70 -	ensureSelectionVisible();
   10.71 +	emitShowSelection();
   10.72  	saveState (
   10.73  		mci,
   10.74  		"delete()",
   10.75 @@ -2120,52 +2120,59 @@
   10.76  	// -2		add branch to selection 
   10.77  	// -1		insert in children of parent below selection 
   10.78  	// 0..n		insert in children of parent at pos
   10.79 -	BranchObj *newbo=NULL;
   10.80 -	BranchObj *bo=getSelectedBranchObj();	//FIXME-2
   10.81 -	BranchItem *bi=getSelectedBranchItem();
   10.82 -	if (bo)
   10.83 +	BranchItem *selbi=getSelectedBranchItem();
   10.84 +	if (selbi)
   10.85  	{
   10.86 +		// Create TreeItem
   10.87 +		QList<QVariant> cData;
   10.88 +		cData << "new" << "undef"<<"undef";
   10.89 +
   10.90 +		BranchItem *parbi;
   10.91 +		QModelIndex parix;
   10.92 +		int n;
   10.93 +		BranchItem *newbi=new BranchItem (cData);	
   10.94 +		newbi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
   10.95 +
   10.96 +		emit (layoutAboutToBeChanged() );
   10.97 +
   10.98  		if (num==-2)
   10.99  		{
  10.100 -			// Create TreeItem
  10.101 -			QList<QVariant> cData;
  10.102 -			cData << "new" << "undef"<<"undef";
  10.103 -
  10.104 -			BranchItem *parbi=bi;
  10.105 -			QModelIndex parix=index(parbi);
  10.106 -			int n=parbi->childCount();
  10.107 -
  10.108 -			emit (layoutAboutToBeChanged() );
  10.109 -			beginInsertRows (parix,n,n+1);	//FIXME-1 check if n is correct: should be index below _last_ branch...
  10.110 -			bi=new BranchItem (cData);	
  10.111 -			bi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
  10.112 -
  10.113 -			parbi->appendChild (bi);	
  10.114 +			parbi=selbi;
  10.115 +			parix=index(parbi);
  10.116 +			n=parbi->childCount();
  10.117 +			cout <<"n="<<n<<endl;
  10.118 +			beginInsertRows (parix,n,n+1);	
  10.119 +			parbi->appendChild (newbi);	
  10.120  			endInsertRows ();
  10.121 -			emit (newChildObject (parix));
  10.122 -			emit (layoutChanged() );
  10.123 -
  10.124 -			// save scroll state. If scrolled, automatically select
  10.125 -			// new branch in order to tmp unscroll parent...
  10.126 -			newbo=bi->createMapObj(mapScene);
  10.127 -			select (bi);
  10.128  		}else if (num==-1)
  10.129  		{
  10.130 -		/*
  10.131 -			num=bi->num()+1;
  10.132 -			bo=(BranchObj*)bo->getParObj();
  10.133 -			if (bo) newbo=bo->insertBranch(num);	//FIXME-1 VM still missing 
  10.134 -		*/	
  10.135 +			// insert below selection
  10.136 +			parbi=(BranchItem*)selbi->parent();
  10.137 +			parix=index(parbi);
  10.138 +			n=selbi->childNumber()+1;
  10.139 +			beginInsertRows (parix,n,n);	
  10.140 +			parbi->insertBranch(n,newbi);	
  10.141 +			endInsertRows ();
  10.142  		}else if (num==-3)
  10.143  		{
  10.144 -		/*
  10.145 -			num=bi->num();
  10.146 -			bo=(BranchObj*)bo->getParObj();
  10.147 -			if (bo) newbo=bo->insertBranch(num);	//FIXME-1 VM still missing
  10.148 -		*/	
  10.149 +			// insert above selection
  10.150 +			parbi=(BranchItem*)selbi->parent();
  10.151 +			parix=index(parbi);
  10.152 +			n=selbi->childNumber();
  10.153 +			beginInsertRows (parix,n,n);	
  10.154 +			parbi->insertBranch(n,newbi);	
  10.155 +			endInsertRows ();
  10.156  		}
  10.157 +		emit (newChildObject (parix));
  10.158 +		emit (layoutChanged() );
  10.159 +
  10.160 +		// save scroll state. If scrolled, automatically select
  10.161 +		// new branch in order to tmp unscroll parent...
  10.162 +		newbi->createMapObj(mapScene);
  10.163 +		select (newbi);
  10.164 +		return newbi;
  10.165  	}	
  10.166 -	return bi;
  10.167 +	return NULL;
  10.168  }	
  10.169  
  10.170  BranchItem* VymModel::addNewBranch(int pos)
  10.171 @@ -2179,7 +2186,7 @@
  10.172  
  10.173  	if (selbi)
  10.174  	{
  10.175 -		// FIXME-2 VM  do we still need this in model? setCursor (Qt::ArrowCursor);
  10.176 +		// FIXME-3 VM  do we still need this in model? setCursor (Qt::ArrowCursor);
  10.177  
  10.178  		newbi=addNewBranchInt (pos-2);
  10.179  
  10.180 @@ -2295,7 +2302,7 @@
  10.181  		removeRows (n,1,parentIndex);
  10.182  		endRemoveRows();
  10.183  		select (pi);
  10.184 -		ensureSelectionVisible();
  10.185 +		emitShowSelection();
  10.186  		reposition();
  10.187  
  10.188  		emit (layoutChanged() );
  10.189 @@ -2317,7 +2324,7 @@
  10.190  		par->removeFloatImage(fio);
  10.191  		select (par);
  10.192  		reposition();
  10.193 -		ensureSelectionVisible();
  10.194 +		emitShowSelection();
  10.195  		return;
  10.196  	}
  10.197  	*/
  10.198 @@ -2400,8 +2407,7 @@
  10.199  		);
  10.200  		*/
  10.201  		bi->toggleScroll();
  10.202 -		//selection.update();
  10.203 -		// FIXME-3 VM needed? scene()->update();
  10.204 +		mapScene->update(); //Needed for _quick_ update
  10.205  		return true;
  10.206  	}	
  10.207  	return false;
  10.208 @@ -2411,7 +2417,7 @@
  10.209  {
  10.210  	if (bi)
  10.211  	{
  10.212 -		if (bi->isScrolled()) return false;
  10.213 +		if (!bi->isScrolled()) return false;
  10.214  		if (bi->branchCount()==0) return false;
  10.215  		if (bi->depth()==0) return false;
  10.216  
  10.217 @@ -2428,8 +2434,7 @@
  10.218  		);
  10.219  		*/
  10.220  		bi->toggleScroll();
  10.221 -		// selection.update();
  10.222 -		// FIXME-3 VM needed? scene()->update();
  10.223 +		mapScene->update();	// Needed for _quick_ update
  10.224  		return true;
  10.225  	}	
  10.226  	return false;
  10.227 @@ -2447,7 +2452,7 @@
  10.228  	}
  10.229  }
  10.230  
  10.231 -void VymModel::unscrollChildren() 	// FIXME-1	first, next moved to vymmodel
  10.232 +void VymModel::unscrollChildren() 	// FIXME-2	first, next moved to vymmodel
  10.233  
  10.234  {
  10.235  /*
  10.236 @@ -2464,6 +2469,11 @@
  10.237  */	
  10.238  }
  10.239  
  10.240 +void VymModel::emitExpandAll()
  10.241 +{
  10.242 +	emit (expandAll() );
  10.243 +}
  10.244 +
  10.245  void VymModel::addFloatImage (const QPixmap &img) //FIXME-2
  10.246  {
  10.247  /*
  10.248 @@ -2660,7 +2670,7 @@
  10.249  		reposition();
  10.250  		updateActions();
  10.251  		//selection.update();
  10.252 -		ensureSelectionVisible();
  10.253 +		emitShowSelection();
  10.254  	}
  10.255  }
  10.256  
  10.257 @@ -2725,7 +2735,7 @@
  10.258  		if (bo) 
  10.259  		{
  10.260  			selection.select(bo);
  10.261 -			ensureSelectionVisible();
  10.262 +			emitShowSelection();
  10.263  		}
  10.264  	}
  10.265  	*/
  10.266 @@ -4517,7 +4527,7 @@
  10.267  void VymModel::updateSelection(const QItemSelection &newsel)
  10.268  {
  10.269  	emit (selectionChanged(newsel,newsel));	// needed e.g. to update geometry in editor
  10.270 -	ensureSelectionVisible();
  10.271 +	emitShowSelection();
  10.272  	sendSelection();
  10.273  }
  10.274  
  10.275 @@ -4642,10 +4652,10 @@
  10.276  	selection.reselect();
  10.277  }	
  10.278  
  10.279 -void VymModel::ensureSelectionVisible()		//FIXME-3 needed? in vymmodel.h commented...
  10.280 -{
  10.281 -	LinkableMapObj *lmo=getSelectedLMO();
  10.282 -	if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() );
  10.283 +void VymModel::emitShowSelection()	
  10.284 +{
  10.285 +	if (!blockReposition)
  10.286 +		emit (showSelection() );
  10.287  }
  10.288  
  10.289  void VymModel::emitNoteHasChanged (TreeItem *ti)
  10.290 @@ -4909,7 +4919,7 @@
  10.291  		if (ti2) {
  10.292  			select(ti2);
  10.293  			selection.update();
  10.294 -			ensureSelectionVisible();
  10.295 +			emitShowSelection();
  10.296  			sendSelection();
  10.297  		}
  10.298  	}		
  10.299 @@ -4926,7 +4936,7 @@
  10.300  		if (ti2) {
  10.301  			select(ti2);
  10.302  			selection.update();
  10.303 -			ensureSelectionVisible();
  10.304 +			emitShowSelection();
  10.305  			sendSelection();
  10.306  		}
  10.307  	}		
  10.308 @@ -4952,7 +4962,7 @@
  10.309  		if (!par) return;
  10.310  		select(par);
  10.311  		selection.update();
  10.312 -		ensureSelectionVisible();
  10.313 +		emitShowSelection();
  10.314  		sendSelection();
  10.315  	}		
  10.316  }
    11.1 --- a/vymmodel.h	Thu Apr 30 11:52:49 2009 +0000
    11.2 +++ b/vymmodel.h	Fri May 01 10:30:29 2009 +0000
    11.3 @@ -329,6 +329,11 @@
    11.4      void toggleScroll();
    11.5      void unscrollChildren();
    11.6  
    11.7 +	void emitExpandAll();
    11.8 +signals:	
    11.9 +	void expandAll();
   11.10 +
   11.11 +public:	
   11.12      void addFloatImage(const QPixmap &img);
   11.13  
   11.14      void colorBranch(QColor);
   11.15 @@ -416,8 +421,6 @@
   11.16  	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
   11.17  	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
   11.18  
   11.19 -	//void ensureSelectionVisible();		//!< Show selection in all views
   11.20 -
   11.21  	void emitNoteHasChanged (TreeItem *ti);
   11.22  	void emitDataHasChanged (TreeItem *ti);
   11.23  
   11.24 @@ -545,12 +548,14 @@
   11.25  
   11.26  	bool select ();							// select by using common QItemSlectionModel
   11.27  	bool select (const QString &);			// Select by string
   11.28 -	bool select (LinkableMapObj *lmo);		// Select by pointer to LMO
   11.29 +	bool select (LinkableMapObj *lmo);		// Select by pointer tog LMO
   11.30  	bool select (TreeItem *ti );			// Select by point to TreeItem
   11.31  	void unselect();
   11.32  	void reselect();
   11.33  
   11.34 -	void ensureSelectionVisible();			//!< Show selection in all views
   11.35 +	void emitShowSelection();				//!< Show selection in all views
   11.36 +signals:
   11.37 +	void showSelection();
   11.38  
   11.39  //	void selectInt(LinkableMapObj*);	//FIXME-4
   11.40  
    12.1 --- a/vymview.cpp	Thu Apr 30 11:52:49 2009 +0000
    12.2 +++ b/vymview.cpp	Fri May 01 10:30:29 2009 +0000
    12.3 @@ -3,6 +3,7 @@
    12.4  #include <iostream>
    12.5  using namespace std;
    12.6  
    12.7 +#include "linkablemapobj.h"
    12.8  #include "mainwindow.h"
    12.9  #include "mapeditor.h"
   12.10  
   12.11 @@ -58,6 +59,14 @@
   12.12  		model, SIGNAL (noteHasChanged(QModelIndex) ),
   12.13  		mainWindow, SLOT (updateNoteEditor (QModelIndex) ) );
   12.14  		
   12.15 +	connect (
   12.16 +		model, SIGNAL (expandAll() ),
   12.17 +		this, SLOT (expandAll () ) );
   12.18 +		
   12.19 +	connect (
   12.20 +		model, SIGNAL (showSelection() ),
   12.21 +		this, SLOT (showSelection() ) );
   12.22 +		
   12.23  
   12.24  	//mapEditor->viewport()->setFocus();	//FIXmapEditor-3 needed?
   12.25  	mapEditor->setAntiAlias (mainWindow->isAliased());
   12.26 @@ -105,3 +114,21 @@
   12.27  	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-3 maybe connect VymModel <-> MainWindow directly?
   12.28  }
   12.29  
   12.30 +void VymView::expandAll()
   12.31 +{
   12.32 +	treeview->expandAll();
   12.33 +}
   12.34 +
   12.35 +void VymView::showSelection()
   12.36 +{
   12.37 +	treeview->scrollTo(
   12.38 +		model->getSelectedIndex(), 
   12.39 +		//QAbstractItemView::PositionAtCenter   
   12.40 +		QAbstractItemView::EnsureVisible
   12.41 +	);
   12.42 +
   12.43 +	LinkableMapObj* lmo=model->getSelectedLMO();
   12.44 +	if (lmo)
   12.45 +		mapEditor->ensureVisible(lmo->getBBox() );
   12.46 +}
   12.47 +
    13.1 --- a/vymview.h	Thu Apr 30 11:52:49 2009 +0000
    13.2 +++ b/vymview.h	Fri May 01 10:30:29 2009 +0000
    13.3 @@ -19,6 +19,8 @@
    13.4  public slots:
    13.5  	void updateChilds (QModelIndex ix);
    13.6  	void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
    13.7 +	void expandAll ();
    13.8 +	void showSelection ();
    13.9  
   13.10  private:
   13.11  	VymModel *model;
    14.1 --- a/xml-freemind.cpp	Thu Apr 30 11:52:49 2009 +0000
    14.2 +++ b/xml-freemind.cpp	Fri May 01 10:30:29 2009 +0000
    14.3 @@ -261,12 +261,12 @@
    14.4  
    14.5  bool parseFreemindHandler::readNodeAttr (const QXmlAttributes& a)	//FIXME-3
    14.6  {
    14.7 -/*
    14.8 -	lastOO=lastBranch;
    14.9 -	lastBranchItem=(BranchItem*)(lastBranch->getTreeItem() );
   14.10 +	//lastOO=lastBranch;
   14.11 +	//lastBranchItem=(BranchItem*)(lastBranch->getTreeItem() );
   14.12  
   14.13  	if (a.value( "FOLDED")=="true" )
   14.14  		lastBranchItem->toggleScroll();
   14.15 +/*
   14.16  	if (!a.value( "TEXT").isEmpty() )
   14.17  		lastBranch->setHeading (a.value ("TEXT"));
   14.18  
    15.1 --- a/xml-vym.cpp	Thu Apr 30 11:52:49 2009 +0000
    15.2 +++ b/xml-vym.cpp	Fri May 01 10:30:29 2009 +0000
    15.3 @@ -229,8 +229,7 @@
    15.4  	} else if ( eName == "branch" && state == StateMapCenter) 
    15.5  	{
    15.6  		state=StateBranch;
    15.7 -		model->createBranch();
    15.8 -		lastBranchItem=model->getSelectedBranchItem();
    15.9 +		lastBranchItem=model->createBranch();
   15.10  		readBranchAttr (atts);
   15.11  	} else if ( eName == "htmlnote" && state == StateBranch) 
   15.12  	{
   15.13 @@ -250,8 +249,7 @@
   15.14  		if (!readXLinkAttr (atts)) return false;
   15.15      } else if ( eName == "branch" && state == StateBranch ) 
   15.16  	{
   15.17 -		model->createBranch();
   15.18 -		lastBranchItem=model->getSelectedBranchItem();
   15.19 +		lastBranchItem=model->createBranch();
   15.20  		readBranchAttr (atts);
   15.21      } else if ( eName == "html" && state == StateHtmlNote ) 
   15.22  	{
   15.23 @@ -353,14 +351,12 @@
   15.24  {
   15.25  	branchesCurrent++;
   15.26  	mainWindow->setProgressValue (branchesCurrent);
   15.27 -	//lastOO=lastBranch;
   15.28 -	//lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
   15.29  
   15.30  	if (!readOOAttr(a)) return false;
   15.31 -/*
   15.32  
   15.33  	if (!a.value( "scrolled").isEmpty() )
   15.34  		lastBranchItem->toggleScroll();
   15.35 +/*
   15.36  	if (!a.value( "frameType").isEmpty() ) 
   15.37  		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   15.38