More fixes and sorting lexically backwards
authorinsilmaril
Wed, 10 Feb 2010 13:48:42 +0000
changeset 822c2ce9944148c
parent 821 4a84d7e444d8
child 823 0bba81dde1bc
More fixes and sorting lexically backwards
attributeitem.cpp
attributeitem.h
branchitem.cpp
branchitem.h
branchobj.cpp
branchobj.h
exports.cpp
exportxhtmldialog.cpp
icons/editsortback.png
mainwindow.cpp
mainwindow.h
mysortfilterproxymodel.cpp
tex/vym.changelog
treeeditor.cpp
treeitem.cpp
treeitem.h
version.h
vymmodel.cpp
vymmodel.h
vymview.cpp
xml-freemind.cpp
xml-vym.cpp
     1.1 --- a/attributeitem.cpp	Thu Jan 21 11:56:57 2010 +0000
     1.2 +++ b/attributeitem.cpp	Wed Feb 10 13:48:42 2010 +0000
     1.3 @@ -6,7 +6,7 @@
     1.4  
     1.5  extern bool debug;
     1.6  
     1.7 -AttributeItem::AttributeItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
     1.8 +AttributeItem::AttributeItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
     1.9  {
    1.10  	TreeItem::setType (Attribute);
    1.11  	//table=NULL;
     2.1 --- a/attributeitem.h	Thu Jan 21 11:56:57 2010 +0000
     2.2 +++ b/attributeitem.h	Wed Feb 10 13:48:42 2010 +0000
     2.3 @@ -4,13 +4,13 @@
     2.4  #include <QStringList>
     2.5  #include <QVariant>
     2.6  
     2.7 -#include "treeitem.h"
     2.8 +#include "branchitem.h"
     2.9  
    2.10  /*! \brief A key and a value 
    2.11      The data itself is stored in Attribute Definitions (AttributeDef). 
    2.12  	A list of these tables AttributeTable is maintained for every MapEditor.
    2.13  */
    2.14 -class AttributeItem:public TreeItem {
    2.15 +class AttributeItem:public BranchItem {
    2.16  
    2.17  enum Type {
    2.18  	Undefined,	//!< Undefined type
     3.1 --- a/branchitem.cpp	Thu Jan 21 11:56:57 2010 +0000
     3.2 +++ b/branchitem.cpp	Wed Feb 10 13:48:42 2010 +0000
     3.3 @@ -1,3 +1,4 @@
     3.4 +#include "attributeitem.h"
     3.5  #include "branchitem.h"
     3.6  #include "branchobj.h"
     3.7  #include "vymmodel.h"
     3.8 @@ -118,7 +119,7 @@
     3.9  		+getMapAttr()
    3.10  		+getGeneralAttr()
    3.11  		+scrolledAttr 
    3.12 -	//	+areaAttr	// FIXME-2
    3.13 +	//	+areaAttr	// FIXME-4 not needed anymore. Wait until end of 2010 before removing...
    3.14  		+idAttr 
    3.15  		+getIncludeImageAttr() 
    3.16  		);
    3.17 @@ -290,7 +291,7 @@
    3.18  	return result;
    3.19  }
    3.20  
    3.21 -void BranchItem::sortChildren()
    3.22 +void BranchItem::sortChildren(bool inverse)
    3.23  {
    3.24  	int childCount=branchCounter; 
    3.25  	int curChildIndex;
    3.26 @@ -298,15 +299,28 @@
    3.27  	do
    3.28  	{
    3.29  		madeChanges=false;
    3.30 -		for(curChildIndex=1;curChildIndex<childCount;curChildIndex++){
    3.31 -			BranchItem* curChild =getBranchNum(curChildIndex);
    3.32 -			BranchItem* prevChild=getBranchNum(curChildIndex-1);
    3.33 -			if(prevChild->getHeading().compare(curChild->getHeading())>0)
    3.34 +		if (inverse)
    3.35 +			for(curChildIndex=1;curChildIndex<childCount;curChildIndex++)
    3.36  			{
    3.37 -				model->moveUp(curChild);
    3.38 -				madeChanges=true;
    3.39 +				BranchItem* curChild =getBranchNum(curChildIndex);
    3.40 +				BranchItem* prevChild=getBranchNum(curChildIndex-1);
    3.41 +				if (prevChild->getHeading().compare(curChild->getHeading())<0)
    3.42 +				{
    3.43 +					model->moveUp (curChild);
    3.44 +					madeChanges=true;
    3.45 +				}	
    3.46 +			} 
    3.47 +		else
    3.48 +			for(curChildIndex=1;curChildIndex<childCount;curChildIndex++)
    3.49 +			{
    3.50 +				BranchItem* curChild =getBranchNum(curChildIndex);
    3.51 +				BranchItem* prevChild=getBranchNum(curChildIndex-1);
    3.52 +				if ( prevChild->getHeading().compare(curChild->getHeading())>0)
    3.53 +				{
    3.54 +					model->moveUp(curChild);
    3.55 +					madeChanges=true;
    3.56 +				}	
    3.57  			}
    3.58 -		}
    3.59  	}while(madeChanges);
    3.60  }
    3.61  
    3.62 @@ -387,7 +401,6 @@
    3.63  
    3.64  
    3.65  
    3.66 -
    3.67  TreeItem* BranchItem::findMapItem (QPointF p, TreeItem* excludeTI)
    3.68  {
    3.69  	// Search branches
    3.70 @@ -415,34 +428,24 @@
    3.71  			mo->isVisibleObj() 
    3.72  		) return ii;
    3.73  	}
    3.74 +
    3.75 +	// Search attributes
    3.76 +	AttributeItem *ai;
    3.77 +    for (int i=0; i<attributeCount(); ++i )
    3.78 +	{
    3.79 +		ai=getAttributeNum (i);
    3.80 +		LinkableMapObj *mo=ai->getLMO();
    3.81 +		if (mo && mo->isInClickBox(p) && 
    3.82 +			(ii != excludeTI) && 
    3.83 +			this!= excludeTI &&
    3.84 +			mo->isVisibleObj() 
    3.85 +		) return ai;
    3.86 +	}
    3.87 +
    3.88  	return NULL;
    3.89  }
    3.90 -/*
    3.91 -TreeItem* BranchItem::findID (QString sid)	//FIXME-3 move to TreeItem	//FIXME-4 search images
    3.92 -{
    3.93 -	// Search branches
    3.94 -    TreeItem *ti;
    3.95 -	for (int i=0; i<branchCount(); ++i)
    3.96 -    {	
    3.97 -		ti=getBranchNum(i)->findID (sid);
    3.98 -		if (ti != NULL) return ti;
    3.99 -    }
   3.100 -	
   3.101 -	// Search myself
   3.102 -	if (sid==objID) return this;
   3.103  
   3.104 -
   3.105 -	// Search float images 
   3.106 -    for (int i=0; i<floatimage.size(); ++i )
   3.107 -		if (floatimage.at(i)->inBox(p) && 
   3.108 -			(floatimage.at(i) != excludeLMO) && 
   3.109 -			floatimage.at(i)->getParObj()!= excludeLMO &&
   3.110 -			floatimage.at(i)->isVisibleObj() 
   3.111 -		) return floatimage.at(i);
   3.112 -    return NULL;
   3.113 -}
   3.114 -*/
   3.115 -void BranchItem::updateStyles()
   3.116 +void BranchItem::updateStyles(const bool &keepFrame)
   3.117  {
   3.118  	// FIXME-5 compare also MapItem::initLMO...
   3.119  
   3.120 @@ -452,7 +455,7 @@
   3.121  			lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
   3.122  		else
   3.123  			lmo->setParObj (NULL);
   3.124 -		((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch);
   3.125 +		((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch,keepFrame);
   3.126  	}
   3.127  }
   3.128  
     4.1 --- a/branchitem.h	Thu Jan 21 11:56:57 2010 +0000
     4.2 +++ b/branchitem.h	Wed Feb 10 13:48:42 2010 +0000
     4.3 @@ -35,7 +35,7 @@
     4.4  	virtual bool hasScrolledParent(BranchItem*);	// true, if any of the parents is scrolled
     4.5  	virtual bool tmpUnscroll();				// unscroll scrolled parents temporary e.g. during "find" process
     4.6  	virtual bool resetTmpUnscroll();		// scroll all tmp scrolled parents again e.g. when unselecting
     4.7 -	virtual void sortChildren();		//! Sort children 
     4.8 +	virtual void sortChildren(bool inverse=false);		//! Sort children 
     4.9  
    4.10  protected:
    4.11  	bool includeImagesVer;			//! include floatimages in bbox vertically
    4.12 @@ -58,11 +58,10 @@
    4.13  
    4.14  public:
    4.15  	TreeItem* findMapItem (QPointF p,TreeItem* excludeTI);	//! search map for branches or images. Ignore excludeTI, where search is started 
    4.16 -//	virtual TreeItem* findID (QString sid);	//! search map for object with ID string
    4.17  
    4.18 -	virtual void updateStyles ();			//! update related fonts, parObjects, links, ...
    4.19 +	virtual void updateStyles (const bool &keepFrame=false);		//! update related fonts, parObjects, links, ...
    4.20  	virtual BranchObj* getBranchObj();	
    4.21 -	virtual BranchObj* createMapObj(QGraphicsScene *scene);		//! Create classic object in GraphicsView
    4.22 +	virtual BranchObj* createMapObj(QGraphicsScene *scene);	//! Create classic object in GraphicsView
    4.23  };
    4.24  
    4.25  #endif
     5.1 --- a/branchobj.cpp	Thu Jan 21 11:56:57 2010 +0000
     5.2 +++ b/branchobj.cpp	Wed Feb 10 13:48:42 2010 +0000
     5.3 @@ -1,5 +1,6 @@
     5.4  #include "branchobj.h"
     5.5  
     5.6 +#include "attributeitem.h"
     5.7  #include "branchitem.h"
     5.8  #include "geometry.h"
     5.9  #include "mapeditor.h"
    5.10 @@ -439,26 +440,22 @@
    5.11  	if (changed) updateContentSize(); 
    5.12  }
    5.13  
    5.14 -void BranchObj::setDefAttr (BranchModification mod)
    5.15 +void BranchObj::setDefAttr (BranchModification mod, bool keepFrame)
    5.16  {
    5.17  	int fontsize;
    5.18  	switch (treeItem->depth())
    5.19  	{
    5.20  		case 0: 
    5.21  			fontsize=16; 
    5.22 -			setFrameType (FrameObj::Rectangle);
    5.23  			break;
    5.24  		case 1: 
    5.25  			fontsize=14; 
    5.26 -			setFrameType (FrameObj::NoFrame);
    5.27  			break;
    5.28  		case 2: 
    5.29  			fontsize=12; 
    5.30 -			setFrameType (FrameObj::NoFrame);
    5.31  			break;
    5.32  		default: 
    5.33  			fontsize=10; 
    5.34 -			setFrameType (FrameObj::NoFrame);
    5.35  			break;
    5.36  	}	
    5.37  	setLinkStyle(getDefLinkStyle(treeItem->parent() ));
    5.38 @@ -467,12 +464,20 @@
    5.39  	font.setPointSize(fontsize);
    5.40  	heading->setFont(font );
    5.41  
    5.42 +	if (mod==NewBranch && !keepFrame)
    5.43 +	if (treeItem->depth()==0)
    5.44 +		setFrameType (FrameObj::Rectangle);
    5.45 +	else	
    5.46 +		setFrameType (FrameObj::NoFrame);
    5.47 +
    5.48  	if (mod==NewBranch)
    5.49  		setColor (treeItem->getHeadingColor() );
    5.50  	else
    5.51 +	{
    5.52  		// Also set styles for children
    5.53  		for (int i=0; i<treeItem->branchCount(); ++i)
    5.54  			treeItem->getBranchObjNum(i)->setDefAttr(MovedBranch);
    5.55 +	}		
    5.56  	calcBBoxSize();
    5.57  }
    5.58  
    5.59 @@ -559,7 +564,21 @@
    5.60  	else	
    5.61  		ref2.setY(ref.y() );	
    5.62  
    5.63 -    // Align the children depending on reference point 
    5.64 +    // Align the attribute children depending on reference point 
    5.65 +	// on top like in TreeEditor
    5.66 +	for (int i=0; i<treeItem->attributeCount(); ++i)
    5.67 +    {	
    5.68 +		if (!treeItem->getAttributeNum(i)->isHidden())
    5.69 +		{
    5.70 +			BranchObj *bo=(BranchObj*)(treeItem->getAttributeNum(i)->getBranchObj());
    5.71 +			if (!bo) break;
    5.72 +			bo->alignRelativeTo (ref2,true);
    5.73 +
    5.74 +			// append next branch below current one
    5.75 +			ref2.setY(ref2.y() + bo->getBBoxSizeWithChildren().height() );
    5.76 +		}
    5.77 +    }
    5.78 +    // Align the branch children depending on reference point 
    5.79  	for (int i=0; i<treeItem->branchCount(); ++i)
    5.80      {	
    5.81  		if (!treeItem->getBranchNum(i)->isHidden())
    5.82 @@ -718,8 +737,22 @@
    5.83  	{
    5.84  		if (!bi->getBranchNum(i)->isHidden())
    5.85  		{
    5.86 -			bi->getBranchObjNum(i)->calcBBoxSizeWithChildren();
    5.87 -			br=bi->getBranchObjNum(i)->getBBoxSizeWithChildren();
    5.88 +			BranchObj *bo=bi->getBranchObjNum(i);
    5.89 +			bo->calcBBoxSizeWithChildren();
    5.90 +			br=bo->getBBoxSizeWithChildren();
    5.91 +			r.setWidth( max (br.width(), r.width() ));
    5.92 +			r.setHeight(br.height() + r.height() );
    5.93 +			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
    5.94 +			if (br.x()<bboxTotal.x()) bboxTotal.setX(br.x());
    5.95 +		}
    5.96 +	}
    5.97 +	for (int i=0; i<treeItem->attributeCount(); i++)
    5.98 +	{
    5.99 +		if (!bi->getAttributeNum(i)->isHidden())
   5.100 +		{
   5.101 +			BranchObj *bo=bi->getAttributeNum(i)->getBranchObj();
   5.102 +			bo->calcBBoxSizeWithChildren();
   5.103 +			br=bo->getBBoxSizeWithChildren();
   5.104  			r.setWidth( max (br.width(), r.width() ));
   5.105  			r.setHeight(br.height() + r.height() );
   5.106  			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
     6.1 --- a/branchobj.h	Thu Jan 21 11:56:57 2010 +0000
     6.2 +++ b/branchobj.h	Wed Feb 10 13:48:42 2010 +0000
     6.3 @@ -40,7 +40,7 @@
     6.4      virtual void updateData();	//! Update represantatio of heading, flags, etc.
     6.5  
     6.6  public:	
     6.7 -	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
     6.8 +	virtual void setDefAttr (BranchModification, bool keepFrame=false);	// set default attributes (frame, font, size, ...)
     6.9  
    6.10      virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
    6.11  	virtual void reposition();
     7.1 --- a/exports.cpp	Thu Jan 21 11:56:57 2010 +0000
     7.2 +++ b/exports.cpp	Wed Feb 10 13:48:42 2010 +0000
     7.3 @@ -607,7 +607,7 @@
     7.4  	ts<<" <link rel='stylesheet' id='css.stylesheet' href='vym.css' />\n";
     7.5  
     7.6  	// Include image
     7.7 -	ts<<"<center><img src=\"xxx.png\" usemap='#imagemap'></center>\n";
     7.8 +	ts<<"<center><img src=\""<<model->getMapName()<<".png\" usemap='#imagemap'></center>\n";
     7.9  
    7.10  
    7.11  	// Main loop over all mapcenters
     8.1 --- a/exportxhtmldialog.cpp	Thu Jan 21 11:56:57 2010 +0000
     8.2 +++ b/exportxhtmldialog.cpp	Wed Feb 10 13:48:42 2010 +0000
     8.3 @@ -273,6 +273,7 @@
     8.4  
     8.5  void ExportXHTMLDialog::doExport (const QString &mapname)
     8.6  {
     8.7 +
     8.8  	// Save options to settings file 
     8.9  	// (but don't save at destructor, which
    8.10  	// is called for "cancel", too)
    8.11 @@ -310,6 +311,12 @@
    8.12  			(filepath,"/export/xhtml/css",css);	
    8.13  	}
    8.14  
    8.15 +	if (!saveSettingsInMap)
    8.16 +		settings.clearLocal("/export/xhtml");
    8.17 +	else	
    8.18 +		settings.setLocalEntry 
    8.19 +			(filepath,"/export/xhtml/saveSettingsInMap","yes");
    8.20 +
    8.21  	// Provide a smaller URL-icon to improve Layout
    8.22  	QPixmap pm;
    8.23  	if (!pm.load(ipath,"PNG") )
    8.24 @@ -318,11 +325,6 @@
    8.25  		
    8.26  	if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
    8.27  		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
    8.28 -	if (!saveSettingsInMap)
    8.29 -		settings.clearLocal("/export/xhtml");
    8.30 -	else	
    8.31 -		settings.setLocalEntry 
    8.32 -			(filepath,"/export/xhtml/saveSettingsInMap","yes");
    8.33  
    8.34  	// Copy CSS file
    8.35  	QFile css_src (css);
     9.1 Binary file icons/editsortback.png has changed
    10.1 --- a/mainwindow.cpp	Thu Jan 21 11:56:57 2010 +0000
    10.2 +++ b/mainwindow.cpp	Wed Feb 10 13:48:42 2010 +0000
    10.3 @@ -312,7 +312,7 @@
    10.4  		progressDialog.setValue (v+progressDialog.value());
    10.5  }
    10.6  
    10.7 -void Main::removeProgressValue(int v)
    10.8 +void Main::removeProgressCounter()
    10.9  {
   10.10  	progressMax=0;
   10.11  	progressCounter--;
   10.12 @@ -691,6 +691,13 @@
   10.13  	editMenu->addAction (a);
   10.14  	actionSortChildren=a;
   10.15  
   10.16 +	a = new QAction( QPixmap(iconPath+"editsortback.png" ), tr( "Sort children backwards","Edit menu" ), this );
   10.17 +	connect( a, SIGNAL( activated() ), this, SLOT( editSortBackChildren() ) );
   10.18 +	a->setEnabled (true);
   10.19 +	a->addTo( tb );
   10.20 +	editMenu->addAction (a);
   10.21 +	actionSortBackChildren=a;
   10.22 +
   10.23  	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this);
   10.24  	alt->setShortcut ( Qt::Key_S );					// Scroll branch
   10.25  	alt->setStatusTip (tr( "Scroll branch" )); 
   10.26 @@ -2893,7 +2900,13 @@
   10.27  void Main::editSortChildren()
   10.28  {
   10.29  	VymModel *m=currentModel();
   10.30 -	if (m) m->sortChildren();
   10.31 +	if (m) m->sortChildren(false);
   10.32 +}
   10.33 +
   10.34 +void Main::editSortBackChildren()
   10.35 +{
   10.36 +	VymModel *m=currentModel();
   10.37 +	if (m) m->sortChildren(true);
   10.38  }
   10.39  
   10.40  void Main::editToggleScroll()
   10.41 @@ -3606,6 +3619,7 @@
   10.42  					actionMoveDown->setEnabled (false);
   10.43  
   10.44  				actionSortChildren->setEnabled (true);
   10.45 +				actionSortBackChildren->setEnabled (true);
   10.46  
   10.47  				actionToggleHideExport->setEnabled (true);	
   10.48  				actionToggleHideExport->setChecked (selbi->hideInExport() );	
   10.49 @@ -3657,6 +3671,7 @@
   10.50  			actionMoveDown->setEnabled (false);
   10.51  			actionFormatHideLinkUnselected->setEnabled (false);
   10.52  			actionSortChildren->setEnabled (false);
   10.53 +			actionSortBackChildren->setEnabled (false);
   10.54  			actionToggleHideExport->setEnabled (false);	
   10.55  		}	
   10.56  	} // m
   10.57 @@ -3741,6 +3756,35 @@
   10.58  
   10.59  void Main::testFunction1()
   10.60  {
   10.61 +
   10.62 +	Process p;
   10.63 +	QString script="test/sleep.sh";
   10.64 +	p.start (script);
   10.65 +	if (!p.waitForStarted())
   10.66 +	{
   10.67 +		cout <<"VM::getBugzillaData couldn't start "<<script.toStdString()<<endl;
   10.68 +		return;
   10.69 +	}	
   10.70 +	if (!p.waitForFinished())
   10.71 +	{
   10.72 +		cout <<"VM::getBugzillaData couldn't finish "<<script.toStdString()<<endl;
   10.73 +		return;
   10.74 +	}
   10.75 +	//QByteArray result=p.readAll();
   10.76 +	QString result=p.getStdout();
   10.77 +	while (result.endsWith("\n")) result.chop(1); 
   10.78 +	//cout << QString(result).toStdString()<<endl;
   10.79 +	QString err=p.getErrout();
   10.80 +	if (!err.isEmpty())
   10.81 +	{
   10.82 +		cout << "VM::getBugzillaData Error:\n";
   10.83 +		cout <<err.toStdString()<<endl;
   10.84 +	}
   10.85 +	else if (!result.isEmpty())
   10.86 +	{
   10.87 +		cout << "ok\n";
   10.88 +	}	
   10.89 +/*
   10.90  	int max=100000;
   10.91  	QProgressDialog p ("testprogress","cancel",0,max,this);
   10.92  	p.setWindowModality (Qt::WindowModal);
   10.93 @@ -3768,9 +3812,11 @@
   10.94  	p.setValue (max);
   10.95  	cout << "Done.\n";
   10.96  	return;
   10.97 -
   10.98 +*/
   10.99 +/*
  10.100  	if (!currentMapEditor()) return;
  10.101  	currentMapEditor()->testFunction1();
  10.102 +*/
  10.103  /*
  10.104  
  10.105  	VymModel *m=currentModel();
    11.1 --- a/mainwindow.h	Thu Jan 21 11:56:57 2010 +0000
    11.2 +++ b/mainwindow.h	Wed Feb 10 13:48:42 2010 +0000
    11.3 @@ -44,7 +44,7 @@
    11.4  	void setProgressMaximum (int max);
    11.5  	void addProgressValue (float v);
    11.6  	void setProgressCounter (int v);
    11.7 -	void removeProgressValue (int v);
    11.8 +	void removeProgressCounter();
    11.9  
   11.10  public slots:
   11.11      void fileNew();
   11.12 @@ -151,6 +151,7 @@
   11.13      void editMoveDown();	
   11.14      void editDetach();	
   11.15  	void editSortChildren();
   11.16 +	void editSortBackChildren();
   11.17      void editToggleScroll();
   11.18      void editExpandAll();
   11.19      void editExpandOneLevel();
   11.20 @@ -288,6 +289,7 @@
   11.21  	QAction *actionMoveDown;
   11.22  	QAction *actionDetach;
   11.23  	QAction *actionSortChildren;
   11.24 +	QAction *actionSortBackChildren;
   11.25  	QAction *actionToggleScroll;
   11.26  	QAction *actionExpandAll;
   11.27  	QAction *actionExpandOneLevel;
    12.1 --- a/mysortfilterproxymodel.cpp	Thu Jan 21 11:56:57 2010 +0000
    12.2 +++ b/mysortfilterproxymodel.cpp	Wed Feb 10 13:48:42 2010 +0000
    12.3 @@ -25,7 +25,7 @@
    12.4  }
    12.5  */
    12.6  
    12.7 -bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-2 find a way to show _all_ rows which match, independent of parent
    12.8 +bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-3 find a way to show _all_ rows which match, independent of parent
    12.9          const QModelIndex &sourceParent) const
   12.10  {
   12.11      QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
    13.1 --- a/tex/vym.changelog	Thu Jan 21 11:56:57 2010 +0000
    13.2 +++ b/tex/vym.changelog	Wed Feb 10 13:48:42 2010 +0000
    13.3 @@ -1,3 +1,13 @@
    13.4 +-------------------------------------------------------------------
    13.5 +Wed Feb 10 14:47:49 CET 2010 - vym@insilmaril.de
    13.6 +
    13.7 +- Feature: Sort lexically backwards
    13.8 +
    13.9 +-------------------------------------------------------------------
   13.10 +Tue Feb  9 10:26:23 CET 2010 - vym@insilmaril.de
   13.11 +
   13.12 +- Bugfix: Relinking now keeps frametype 
   13.13 +
   13.14  -------------------------------------------------------------------
   13.15  Thu Jan 21 09:22:08 CET 2010 - vym@insilmaril.de
   13.16  
    14.1 --- a/treeeditor.cpp	Thu Jan 21 11:56:57 2010 +0000
    14.2 +++ b/treeeditor.cpp	Wed Feb 10 13:48:42 2010 +0000
    14.3 @@ -67,7 +67,7 @@
    14.4  void TreeEditor::cursorUp()
    14.5  {
    14.6  	QModelIndex ix=getSelectedIndex();
    14.7 -	// FIXME-2 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix));
    14.8 +	// FIXME-3 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix));
    14.9  	ix=indexAbove (ix);
   14.10  	if (ix.isValid())
   14.11  		model->select (ix );
   14.12 @@ -76,7 +76,7 @@
   14.13  void TreeEditor::cursorDown()
   14.14  {
   14.15  	QModelIndex ix=getSelectedIndex();
   14.16 -	//FIXME-2 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix));
   14.17 +	//FIXME-3 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix));
   14.18  	ix=indexBelow (ix);
   14.19  	if (ix.isValid())
   14.20  		model->select (ix );
    15.1 --- a/treeitem.cpp	Thu Jan 21 11:56:57 2010 +0000
    15.2 +++ b/treeitem.cpp	Wed Feb 10 13:48:42 2010 +0000
    15.3 @@ -13,6 +13,8 @@
    15.4  
    15.5  extern FlagRow* standardFlagsMaster;
    15.6  
    15.7 +uint TreeItem::idLast=0;	// Create instance
    15.8 +
    15.9  TreeItem::TreeItem()
   15.10  {
   15.11  	cout << "Constr. TI  this="<<this<<endl;
   15.12 @@ -50,10 +52,14 @@
   15.13  {
   15.14  	model=NULL;
   15.15  
   15.16 +	// Reset ID  //FIXME-2 compare objID (string), so far only used for xLinks during load/save (Id=selString)
   15.17 +	idLast++;
   15.18 +	id=idLast;
   15.19 +
   15.20  	branchOffset=0;
   15.21  	branchCounter=0;
   15.22  
   15.23 -	imageOffset=0;
   15.24 + 	imageOffset=0;
   15.25  	imageCounter=0;
   15.26  
   15.27  	attributeCounter=0;
   15.28 @@ -69,9 +75,6 @@
   15.29  	hidden=false;
   15.30  	hideExport=false;
   15.31  
   15.32 -	// Reset ID
   15.33 -	objID="";
   15.34 -
   15.35  	standardFlags.setMasterRow (standardFlagsMaster);
   15.36  }
   15.37  
   15.38 @@ -510,14 +513,21 @@
   15.39  	}
   15.40  }
   15.41  
   15.42 -void TreeItem::setID (const QString &s)
   15.43 +uint TreeItem::getID()
   15.44  {
   15.45 -	objID=s;
   15.46 +	return id;
   15.47  }
   15.48  
   15.49 -QString TreeItem::getID()
   15.50 +TreeItem* TreeItem::findID (const uint &n)
   15.51  {
   15.52 -	return objID;
   15.53 +	if (n>=0 && n<childItems.count() )
   15.54 +	{
   15.55 +		for (int i=0;i<childItems.count(); i++)
   15.56 +			if (n==childItems.at(i)->id)
   15.57 +				return childItems.at(n);
   15.58 +	}
   15.59 +	else
   15.60 +		return NULL;
   15.61  }
   15.62  
   15.63  
    16.1 --- a/treeitem.h	Thu Jan 21 11:56:57 2010 +0000
    16.2 +++ b/treeitem.h	Wed Feb 10 13:48:42 2010 +0000
    16.3 @@ -135,12 +135,13 @@
    16.4  	virtual bool canMoveUp();
    16.5  
    16.6  protected:
    16.7 -	QString objID;					//! id set during load/save currently used for xLinks
    16.8 +	static uint idLast;			// the last used unique ID
    16.9 +	uint id;
   16.10  public:
   16.11 -	virtual void setID (const QString &s);
   16.12 -	virtual QString getID ();
   16.13 +	virtual uint getID ();
   16.14  
   16.15  	// Navigation and selection
   16.16 +	virtual TreeItem* findID (const uint &n);
   16.17  	virtual TreeItem* getChildNum(const int &n);
   16.18  	virtual BranchItem* getFirstBranch();
   16.19  	virtual BranchItem* getLastBranch();
   16.20 @@ -194,7 +195,6 @@
   16.21  
   16.22  	int xlinkOffset;
   16.23  	int xlinkCounter;
   16.24 -
   16.25  };
   16.26  
   16.27  #endif
    17.1 --- a/version.h	Thu Jan 21 11:56:57 2010 +0000
    17.2 +++ b/version.h	Wed Feb 10 13:48:42 2010 +0000
    17.3 @@ -7,7 +7,7 @@
    17.4  #define __VYM_VERSION "1.13.0"
    17.5  //#define __VYM_CODENAME "Codename: RC-1"
    17.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    17.7 -#define __VYM_BUILD_DATE "2010-01-21"
    17.8 +#define __VYM_BUILD_DATE "2010-02-10"
    17.9  
   17.10  
   17.11  bool checkVersion(const QString &);
    18.1 --- a/vymmodel.cpp	Thu Jan 21 11:56:57 2010 +0000
    18.2 +++ b/vymmodel.cpp	Wed Feb 10 13:48:42 2010 +0000
    18.3 @@ -143,9 +143,6 @@
    18.4  	// Network
    18.5  	netstate=Offline;
    18.6  
    18.7 -	// Create MapCenter
    18.8 -	//  addMapCenter();  FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene
    18.9 -
   18.10  	//Initialize DBUS object
   18.11  	adaptorModel=new AdaptorModel(this);	// Created and not deleted as documented in Qt
   18.12      if (!dbusConnection.registerObject (QString("/vymmodel_%1").arg(mapNum),this))
   18.13 @@ -1438,14 +1435,14 @@
   18.14  	return  ti;
   18.15  }
   18.16  
   18.17 -TreeItem* VymModel::findID (const QString &s)	//FIXME-4 Search also other types...
   18.18 +TreeItem* VymModel::findID (const uint &i)	//FIXME-3 Search also other types...
   18.19  {
   18.20  	BranchItem *cur=NULL;
   18.21  	BranchItem *prev=NULL;
   18.22  	nextBranch(cur,prev);
   18.23  	while (cur) 
   18.24  	{
   18.25 -		if (s==cur->getID() ) return cur;
   18.26 +		if (i==cur->getID() ) return cur;
   18.27  		nextBranch(cur,prev);
   18.28  	}
   18.29  	return NULL;
   18.30 @@ -1553,7 +1550,6 @@
   18.31  
   18.32  void VymModel::setNote(const QString &s)
   18.33  {
   18.34 -	cout << "VM::setNote\n";
   18.35  	TreeItem *selti=getSelectedItem();
   18.36  	if (selti) 
   18.37  	{
   18.38 @@ -1881,7 +1877,7 @@
   18.39  	}	
   18.40  }
   18.41  
   18.42 -void VymModel::setHideLinkUnselected (bool b)//FIXME-2
   18.43 +void VymModel::setHideLinkUnselected (bool b) // FIXME-2 Images still have visible link after load
   18.44  {
   18.45  	TreeItem *ti=getSelectedItem();
   18.46  	if (ti && (ti->getType()==TreeItem::Image ||ti->isBranchLikeType()))
   18.47 @@ -2023,7 +2019,7 @@
   18.48  	}
   18.49  }
   18.50  
   18.51 -bool VymModel::moveUp(BranchItem *bi)	//FIXME-2 crashes if trying to move MCO
   18.52 +bool VymModel::moveUp(BranchItem *bi)	
   18.53  {
   18.54  	if (bi && bi->canMoveUp()) 
   18.55  		return relinkBranch (bi,(BranchItem*)bi->parent(),bi->num()-1);
   18.56 @@ -2094,17 +2090,20 @@
   18.57  	}
   18.58  }
   18.59  
   18.60 -void VymModel::sortChildren()
   18.61 +void VymModel::sortChildren(bool inverse)
   18.62  {
   18.63  	BranchItem* selbi=getSelectedBranch();
   18.64  	if (selbi)
   18.65  	{
   18.66  		if(selbi->branchCount()>1)
   18.67  		{
   18.68 +			if (!inverse)
   18.69 +			{
   18.70  			saveStateChangingPart(
   18.71  				selbi,selbi, "sortChildren ()",
   18.72  				QString("Sort children of %1").arg(getObjectName(selbi)));
   18.73 -			selbi->sortChildren();
   18.74 +			}
   18.75 +			selbi->sortChildren(inverse);
   18.76  			reposition();
   18.77  			emitShowSelection();
   18.78  		}
   18.79 @@ -2221,6 +2220,7 @@
   18.80  
   18.81  		emit (layoutChanged() );
   18.82  
   18.83 +		ai->createMapObj(mapScene);		//FIXME-2 check that...
   18.84  		reposition();
   18.85  		return ai;
   18.86  	}
   18.87 @@ -2399,6 +2399,10 @@
   18.88  	{
   18.89  		unselect();
   18.90   
   18.91 +		// Do we need to update frame type?
   18.92 +		bool keepFrame=false;
   18.93 +		 
   18.94 +
   18.95  		emit (layoutAboutToBeChanged() );
   18.96  		BranchItem *branchpi=(BranchItem*)branch->parent();
   18.97  		// Remove at current position
   18.98 @@ -2432,7 +2436,7 @@
   18.99  			branch->setType(TreeItem::Branch);
  18.100  
  18.101  		// reset parObj, fonts, frame, etc in related LMO or other view-objects
  18.102 -		branch->updateStyles();
  18.103 +		branch->updateStyles(keepFrame);
  18.104  
  18.105  		emit (layoutChanged() );
  18.106  		reposition();	// both for moveUp/Down and relinking
  18.107 @@ -2937,19 +2941,9 @@
  18.108  				QString bugID=rx.cap(1);
  18.109  				cout << "VM::getBugzillaData bug="<<bugID.toStdString()<<endl;
  18.110  
  18.111 +				Process p;
  18.112 +				//QString script="test/sleep.sh";
  18.113  				QString script="test/vym-bug.pl";
  18.114 -				/*
  18.115 -				QProgressDialog progress2("Copying files...", "Abort Copy", 0, 40, mainWindow);
  18.116 -				progress2.setWindowModality(Qt::WindowModal);
  18.117 -				progress2.setValue (3);
  18.118 -				progress2.update();
  18.119 -				QProgressDialog progress ("Contacting Bugzilla...","empty",0,0);
  18.120 -				progress.setCancelButton (NULL);
  18.121 -				progress.setWindowModality(Qt::WindowModal);
  18.122 -				progress.show();
  18.123 -				progress.update();
  18.124 -*/
  18.125 -				Process p;
  18.126  				p.start (script,QStringList()<<bugID);
  18.127  				if (!p.waitForStarted())
  18.128  				{
  18.129 @@ -2959,10 +2953,8 @@
  18.130  				if (!p.waitForFinished())
  18.131  				{
  18.132  					cout <<"VM::getBugzillaData couldn't finish "<<script.toStdString()<<endl;
  18.133 -					//progress.hide();
  18.134  					return;
  18.135  				}
  18.136 -				//progress.hide();
  18.137  				//QByteArray result=p.readAll();
  18.138  				QString result=p.getStdout();
  18.139  				while (result.endsWith("\n")) result.chop(1); 
  18.140 @@ -4091,6 +4083,10 @@
  18.141  		} else if (parser.checkParCount(0))
  18.142  		{
  18.143  			sortChildren();
  18.144 +		} else if (parser.checkParCount(1))
  18.145 +		{
  18.146 +			b=parser.parBool(ok,0);
  18.147 +			if (ok) sortChildren(b);
  18.148  		}
  18.149  	/////////////////////////////////////////////////////////////////////
  18.150  	} else if (com=="toggleFlag")
  18.151 @@ -4223,8 +4219,8 @@
  18.152  	}
  18.153  
  18.154  	setExportMode (true);
  18.155 -	mapEditor->getScene()->update();		// FIXME-2 check this...
  18.156 -	QImage img (mapEditor->getImage());	//FIXME-2 calls getTotalBBox, but also in ExportHTML::doExport()
  18.157 +	mapEditor->getScene()->update();		// FIXME-3 check this...
  18.158 +	QImage img (mapEditor->getImage());	//FIXME-3 calls getTotalBBox, but also in ExportHTML::doExport()
  18.159  	img.save(fname, format);
  18.160  	setExportMode (false);
  18.161  }
  18.162 @@ -4317,24 +4313,23 @@
  18.163  	}
  18.164  }
  18.165  
  18.166 -void VymModel::exportHTML (const QString &dir, bool askForName)
  18.167 -{
  18.168 -	ExportXHTMLDialog dia(NULL);
  18.169 +void VymModel::exportHTML (const QString &dir, bool askForName)	//FIXME-2 own dialogue missing and also option to save settings in map
  18.170 +{
  18.171 +	ExportXHTMLDialog dia(NULL);	
  18.172  	dia.setFilePath (filePath );
  18.173  	dia.setMapName (mapName );
  18.174  	dia.readSettings();
  18.175  	if (dir!="") dia.setDir (dir);
  18.176 -
  18.177 +	QDir d;
  18.178  	bool ok=true;
  18.179  	
  18.180 -	/*
  18.181  	if (askForName)
  18.182  	{
  18.183  		if (dia.exec()!=QDialog::Accepted) 
  18.184  			ok=false;
  18.185  		else	
  18.186  		{
  18.187 -			QDir d (dia.getDir());
  18.188 +			d=dia.getDir();
  18.189  			// Check, if warnings should be used before overwriting
  18.190  			// the output directory
  18.191  			if (d.exists() && d.count()>0)
  18.192 @@ -4345,21 +4340,20 @@
  18.193  					"The directory %1 is not empty.\n"
  18.194  					"Do you risk to overwrite some of its contents?").arg(d.path() ));
  18.195  				warn.setCaption("Warning: Directory not empty");
  18.196 -				warn.setShowAgainName("mainwindow/overwrite-dir-xhtml");
  18.197 +				warn.setShowAgainName("mainwindow/export-XML-overwrite-dir");
  18.198  
  18.199  				if (warn.exec()!=QDialog::Accepted) ok=false;
  18.200  			}
  18.201  		}	
  18.202  	}
  18.203 -*/ 
  18.204 -	ok=true;
  18.205  	if (ok)
  18.206  	{
  18.207  		// Hide stuff during export, if settings want this
  18.208  		setExportMode (true);
  18.209  
  18.210  		ExportHTML ex (this);
  18.211 -		ex.setFile ("x/xxx.html");
  18.212 +		ex.setFile (d.path()+"/"+mapName+".html");
  18.213 +		cout << "VM::exportHTML  writing "<<ex.getFile().toStdString()<<endl;
  18.214  		ex.doExport();
  18.215  		setExportMode (false);
  18.216  
  18.217 @@ -4368,7 +4362,7 @@
  18.218  		//if (dia.hasChanged()) setChanged();
  18.219  
  18.220  		// Write image, too
  18.221 -		exportImage ("x/xxx.png",false,"PNG");
  18.222 +		exportImage (d.path()+"/"+mapName+".png",false,"PNG");
  18.223  
  18.224  	}
  18.225  }
  18.226 @@ -4604,8 +4598,7 @@
  18.227  	}
  18.228  }
  18.229  
  18.230 -void VymModel::selectMapBackgroundImage ()	// FIXME-2 move to ME
  18.231 -// FIXME-4 for using background image: view.setCacheMode(QGraphicsView::CacheBackground);
  18.232 +void VymModel::selectMapBackgroundImage ()	// FIXME-3 for using background image: view.setCacheMode(QGraphicsView::CacheBackground);  Also this belongs into ME
  18.233  {
  18.234  	Q3FileDialog *fd=new Q3FileDialog( NULL);
  18.235  	fd->setMode (Q3FileDialog::ExistingFile);
    19.1 --- a/vymmodel.h	Thu Jan 21 11:56:57 2010 +0000
    19.2 +++ b/vymmodel.h	Wed Feb 10 13:48:42 2010 +0000
    19.3 @@ -229,7 +229,7 @@
    19.4  	QGraphicsScene *getScene();
    19.5  
    19.6      TreeItem* findBySelectString (QString s);		
    19.7 -    TreeItem* findID (const QString &s);				// find MapObj by previously set ID
    19.8 +    TreeItem* findID (const uint &i);		// find MapObj by unique ID
    19.9  
   19.10  
   19.11  ////////////////////////////////////////////
   19.12 @@ -309,7 +309,7 @@
   19.13      bool moveDown(BranchItem *bi);	//!< Move branch down without saving state
   19.14      void moveDown();		//!< Move branch down
   19.15  	void detach();					//!< Detach branch and use as new mapcenter
   19.16 -	void sortChildren();	//!< Sort children lexically
   19.17 +	void sortChildren(bool inverse=false);	//!< Sort children lexically
   19.18  
   19.19  	// The create methods are used to quickly parse a XML file
   19.20  	BranchItem* createMapCenter();				//!< Create MapCenter 
    20.1 --- a/vymview.cpp	Thu Jan 21 11:56:57 2010 +0000
    20.2 +++ b/vymview.cpp	Wed Feb 10 13:48:42 2010 +0000
    20.3 @@ -28,7 +28,7 @@
    20.4  	treeEditor->setColumnWidth (0,150);
    20.5  	treeEditor->setAnimated (true);
    20.6  
    20.7 -	// FIXME-2 use proxySelModel=treeEditor->selectionModel();
    20.8 +	// FIXME-3 use proxySelModel=treeEditor->selectionModel();
    20.9  	selModel=new QItemSelectionModel (model);
   20.10  
   20.11  	//model->setSelectionModel (proxySelModel);
   20.12 @@ -162,7 +162,7 @@
   20.13  	if (newsel.indexes().count()>0)
   20.14  	{
   20.15  
   20.16 -	/* FIXME-2 use proxymodel
   20.17 +	/* FIXME-3 use proxymodel
   20.18  		proxySelModel->select (
   20.19  			treeEditor->getProxyModel()->mapSelectionFromSource (newsel),
   20.20  			QItemSelectionModel::ClearAndSelect );
   20.21 @@ -217,7 +217,7 @@
   20.22  	model->nextBranch(cur,prev);
   20.23  	while (cur) 
   20.24  	{
   20.25 -		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.26 +		// FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.27  		pix=model->index (cur);
   20.28  		d=cur->depth();
   20.29  		if (!treeEditor->isExpanded(pix) && d < level)
   20.30 @@ -231,7 +231,7 @@
   20.31  	model->nextBranch(cur,prev);
   20.32  	while (cur) 
   20.33  	{
   20.34 -		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.35 +		// FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.36  		pix=model->index (cur);
   20.37  		d=cur->depth();
   20.38  		if (!treeEditor->isExpanded(pix) && d <= level && cur->branchCount()>0)
   20.39 @@ -261,7 +261,7 @@
   20.40  	model->nextBranch(cur,prev);
   20.41  	while (cur) 
   20.42  	{
   20.43 -		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.44 +		// FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.45  		pix=model->index (cur);
   20.46  		d=cur->depth();
   20.47  		if (treeEditor->isExpanded(pix) && d > level)
   20.48 @@ -275,7 +275,7 @@
   20.49  	model->nextBranch(cur,prev);
   20.50  	while (cur) 
   20.51  	{
   20.52 -		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.53 +		// FIXME-3 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
   20.54  		pix=model->index (cur);
   20.55  		d=cur->depth();
   20.56  		if (treeEditor->isExpanded(pix) && d >= level)
    21.1 --- a/xml-freemind.cpp	Thu Jan 21 11:56:57 2010 +0000
    21.2 +++ b/xml-freemind.cpp	Wed Feb 10 13:48:42 2010 +0000
    21.3 @@ -12,7 +12,6 @@
    21.4  #include "version.h"
    21.5  
    21.6  //static FloatObj *lastFloat;
    21.7 -static OrnamentedObj *lastOO;
    21.8  
    21.9  extern Settings settings;
   21.10  extern QString vymVersion;
   21.11 @@ -258,7 +257,6 @@
   21.12  
   21.13  bool parseFreemindHandler::readNodeAttr (const QXmlAttributes& a)	//FIXME-3
   21.14  {
   21.15 -	//lastOO=lastBranch;
   21.16  	//lastBranchItem=(BranchItem*)(lastBranch->getTreeItem() );
   21.17  
   21.18  	if (a.value( "FOLDED")=="true" )
    22.1 --- a/xml-vym.cpp	Thu Jan 21 11:56:57 2010 +0000
    22.2 +++ b/xml-vym.cpp	Wed Feb 10 13:48:42 2010 +0000
    22.3 @@ -272,7 +272,7 @@
    22.4      switch ( state ) 
    22.5  	{
    22.6  		case StateMap:
    22.7 -			mainWindow->removeProgressValue (branchesTotal); //FIXME-2 let mainWindow handle this 
    22.8 +			mainWindow->removeProgressCounter(); 
    22.9  			break;
   22.10          case StateMapCenter: 
   22.11  			model->emitDataHasChanged (lastBranch);
   22.12 @@ -447,9 +447,6 @@
   22.13  					return false;   // Couldn't read absPos
   22.14  			}           
   22.15  		}           
   22.16 -		if (!a.value( "id").isEmpty() ) 
   22.17 -			lastMI->setID (a.value ("id"));		
   22.18 -			
   22.19  		if (!a.value( "url").isEmpty() ) 
   22.20  			lastMI->setURL (a.value ("url"));
   22.21  		if (!a.value( "vymLink").isEmpty() ) 
   22.22 @@ -555,8 +552,8 @@
   22.23  	{ 
   22.24  		if (!a.value( "endID").isEmpty() ) 
   22.25  		{
   22.26 -			TreeItem *beginBI=model->findID (a.value( "beginID"));
   22.27 -			TreeItem   *endBI=model->findID (a.value( "endID"));
   22.28 +			TreeItem *beginBI=model->findBySelectString (a.value( "beginID"));
   22.29 +			TreeItem   *endBI=model->findBySelectString (a.value( "endID"));
   22.30  			if (beginBI && endBI && beginBI->isBranchLikeType() && endBI->isBranchLikeType() )
   22.31  			{
   22.32  				XLinkItem *xli=model->createXLink (lastBranch,true);