1.8.61 various fixes, see changelog
authorinsilmaril
Thu, 14 Dec 2006 17:01:44 +0000
changeset 411910ba9fab728
parent 410 ceb4532eae34
child 412 8059b6aa74d7
1.8.61 various fixes, see changelog
branchobj.cpp
branchobj.h
demos/todo.vym
flagrowobj.cpp
floatimageobj.cpp
linkablemapobj.cpp
mapcenterobj.cpp
mapeditor.cpp
tex/vym.changelog
version.h
     1.1 --- a/branchobj.cpp	Fri Dec 08 20:18:58 2006 +0000
     1.2 +++ b/branchobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     1.3 @@ -8,19 +8,6 @@
     1.4  extern FlagRowObj *standardFlagsDefault;
     1.5  
     1.6  
     1.7 -/* FIXME not needed any longer in QT4
     1.8 -int BranchObjPointrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
     1.9 -{
    1.10 -	// Make sure PtrList::find works
    1.11 -	if (i==j) return 0;
    1.12 -
    1.13 -	if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
    1.14 -		return 1;
    1.15 -	else
    1.16 -		return -1;
    1.17 -}
    1.18 -*/
    1.19 -
    1.20  /////////////////////////////////////////////////////////////////
    1.21  // BranchObj
    1.22  /////////////////////////////////////////////////////////////////
    1.23 @@ -138,6 +125,14 @@
    1.24  		delete branch.takeFirst();
    1.25  }
    1.26  
    1.27 +bool isAbove (BranchObj* a, BranchObj *b)
    1.28 +{
    1.29 +	if (a->angle < b->angle)
    1.30 +		return true;
    1.31 +	else	
    1.32 +		return false;
    1.33 +}
    1.34 +
    1.35  int BranchObj::getNum()
    1.36  {
    1.37  	if (parObj)
    1.38 @@ -962,11 +957,10 @@
    1.39  void BranchObj::removeFloatImage (FloatImageObj *fio)
    1.40  {
    1.41  	int i=floatimage.indexOf (fio);
    1.42 -	if (i!=-1) floatimage.takeAt (i);
    1.43 +	if (i>-1) delete (floatimage.takeAt (i));
    1.44  	calcBBoxSize();
    1.45  	positionBBox();
    1.46  	requestReposition();
    1.47 -	// FIMXE undo needed
    1.48  }
    1.49  
    1.50  void BranchObj::savePosInAngle ()
    1.51 @@ -1047,7 +1041,7 @@
    1.52  	// Add new bo and resort branches
    1.53  	BranchObj *newbo=addBranch ();
    1.54  	newbo->angle=pos-0.5;
    1.55 -	//FIXME   branch.sort();
    1.56 +	qSort (branch.begin(),branch.end(), isAbove);
    1.57  	return newbo;
    1.58  }
    1.59  
    1.60 @@ -1057,7 +1051,7 @@
    1.61  	// Add new bo and resort branches
    1.62  	bo->angle=pos-0.5;
    1.63  	BranchObj *newbo=addBranch (bo);
    1.64 -	//FIXME   branch.sort();
    1.65 +	qSort (branch.begin(),branch.end(), isAbove);
    1.66  	return newbo;
    1.67  }
    1.68  
    1.69 @@ -1072,7 +1066,7 @@
    1.70  	bo->setDefAttr (MovedBranch);
    1.71  	if (scrolled) tmpUnscroll();
    1.72  	setLastSelectedBranch (bo);
    1.73 -	//FIXME branch.sort();
    1.74 +	qSort (branch.begin(),branch.end(), isAbove);
    1.75  	return bo;
    1.76  }
    1.77  
    1.78 @@ -1176,7 +1170,7 @@
    1.79  	{	// -1 if bo1 not found 
    1.80  		branch.at(i)->angle--;
    1.81  		branch.at(i-1)->angle++;
    1.82 -		//FIXME branch.sort();
    1.83 +		qSort (branch.begin(),branch.end(), isAbove);
    1.84  		return branch.at(i);
    1.85  	} else
    1.86  		return NULL;
    1.87 @@ -1202,7 +1196,7 @@
    1.88  		j = i+1;
    1.89  		branch.at(i)->angle++;
    1.90  		branch.at(j)->angle--;
    1.91 -		//FIXME branch.sort();
    1.92 +		qSort (branch.begin(),branch.end(), isAbove);
    1.93  		return branch.at(i);
    1.94  	} else
    1.95  		return NULL;
    1.96 @@ -1345,7 +1339,7 @@
    1.97  
    1.98  	    alignRelativeTo ( QPointF (absPos.x(),
    1.99  			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
   1.100 -		//FIXME branch.sort();	
   1.101 +		qSort (branch.begin(),branch.end(), isAbove);
   1.102  		positionBBox();	// Reposition bbox and contents
   1.103  	} else
   1.104  	{
     2.1 --- a/branchobj.h	Fri Dec 08 20:18:58 2006 +0000
     2.2 +++ b/branchobj.h	Thu Dec 14 17:01:44 2006 +0000
     2.3 @@ -10,6 +10,8 @@
     2.4  enum BranchModification {NewBranch, MovedBranch};
     2.5  enum HideTmpMode {HideNone, HideExport};
     2.6  
     2.7 +bool isAbove(BranchObj*,BranchObj*);
     2.8 +
     2.9  /////////////////////////////////////////////////////////////////////////////
    2.10  class BranchObj:public OrnamentedObj {
    2.11  public:
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/flagrowobj.cpp	Fri Dec 08 20:18:58 2006 +0000
     4.2 +++ b/flagrowobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     4.3 @@ -228,9 +228,9 @@
     4.4  			for (int i=0; i<flag.size(); ++i)
     4.5  				if (g==flag.at(i)->getGroup() && keepfo!=flag.at(i)) 
     4.6  				{
     4.7 -					flag.remove(flag.at(i));
     4.8 -					//FIXME also delete flags
     4.9 -					//and better only delete flags that are really set
    4.10 +					FlagObj *fo=flag.at(i);
    4.11 +					flag.remove (fo);
    4.12 +					delete (fo);
    4.13  				}	
    4.14  		}		
    4.15  	}	
     5.1 --- a/floatimageobj.cpp	Fri Dec 08 20:18:58 2006 +0000
     5.2 +++ b/floatimageobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     5.3 @@ -35,7 +35,7 @@
     5.4  
     5.5  FloatImageObj::~FloatImageObj ()
     5.6  {
     5.7 -//	cout << "Destr FloatImageObj "<<this<<"\n";
     5.8 +	cout << "Destr FloatImageObj "<<this<<"\n";
     5.9  	delete(icon);
    5.10  }
    5.11  
    5.12 @@ -219,13 +219,13 @@
    5.13  
    5.14  QRectF FloatImageObj::getBBoxSizeWithChilds()
    5.15  {
    5.16 -	//FIXME  abstract in linkablemapobj.h, not calculated
    5.17 +	//TODO abstract in linkablemapobj.h, not calculated
    5.18  	return bboxTotal;
    5.19  }
    5.20  
    5.21  void FloatImageObj::calcBBoxSizeWithChilds()
    5.22  {
    5.23 -	//FIXME  abstract in linkablemapobj.h
    5.24 +	//TODO abstract in linkablemapobj.h
    5.25  }
    5.26  
    5.27  QString FloatImageObj::getSelectString()
     6.1 --- a/linkablemapobj.cpp	Fri Dec 08 20:18:58 2006 +0000
     6.2 +++ b/linkablemapobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     6.3 @@ -72,7 +72,7 @@
     6.4  	linkpos=LinkBottom;
     6.5      arcsegs=13;
     6.6      
     6.7 -// FIXME instead of linkcolor pen.color() could be used	
     6.8 +// FIXME instead of linkcolor pen.color() could be used	all around
     6.9  	pen.setWidth (1);
    6.10  	pen.setColor (linkcolor);
    6.11  	pen.setCapStyle ( Qt::RoundCap );
    6.12 @@ -639,36 +639,8 @@
    6.13                      (int)( + 150*sin (a)));
    6.14  }
    6.15  
    6.16 -/*
    6.17 -void LinkableMapObj::alignRelativeTo (QPointF ref)
    6.18 -{
    6.19 -	// Overloaded, only called for BO, FIO, ...
    6.20 -	// FIXME not needed?
    6.21 -}
    6.22 -*/
    6.23 -
    6.24  void LinkableMapObj::reposition()
    6.25  {
    6.26 -	cout << "LMO::reposition\n";
    6.27 -	// FIXME LMO::reposition not needed? Is overloaded in BranchObj...
    6.28 -	/*
    6.29 -	if (depth==0)
    6.30 -	{
    6.31 -		// only calculate the sizes once. If the deepest LMO changes its height,
    6.32 -		// all upper LMOs have to change, too.
    6.33 -		calcBBoxSizeWithChilds();
    6.34 -
    6.35 -	    alignRelativeTo ( QPointF (absPos.x(),
    6.36 -							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
    6.37 -	} else
    6.38 -	{
    6.39 -		// This is only important for moving branches:
    6.40 -		// For editing a branch it isn't called...
    6.41 -		cout << "  reposition to abs "<<absPos<<endl;
    6.42 -	    alignRelativeTo ( QPointF (absPos.x(),
    6.43 -							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
    6.44 -	}
    6.45 -	*/
    6.46  }
    6.47  
    6.48  void LinkableMapObj::requestReposition()
    6.49 @@ -718,7 +690,6 @@
    6.50  	setSelBox();
    6.51      selected=true;
    6.52      selbox->show();
    6.53 -// FIXME not needed?	
    6.54  	setVisibility (visible);
    6.55  }
    6.56  
     7.1 --- a/mapcenterobj.cpp	Fri Dec 08 20:18:58 2006 +0000
     7.2 +++ b/mapcenterobj.cpp	Thu Dec 14 17:01:44 2006 +0000
     7.3 @@ -33,7 +33,7 @@
     7.4  	BranchObj::init();
     7.5      orientation=OrientUndef;
     7.6  
     7.7 -	// FIXME this should be done in TextObj later...
     7.8 +	// TODO this should be done in TextObj later...
     7.9  	//QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
    7.10  	//heading->setFont(font);
    7.11  	depth=0;
     8.1 --- a/mapeditor.cpp	Fri Dec 08 20:18:58 2006 +0000
     8.2 +++ b/mapeditor.cpp	Thu Dec 14 17:01:44 2006 +0000
     8.3 @@ -72,7 +72,7 @@
     8.4  
     8.5      setScene (mapScene);
     8.6  	
     8.7 -    /* FIXME not needed in QT4? 
     8.8 +    /* FIXME scrollview handles not needed in QT4? 
     8.9  	// Maybe check QAbstractScrollArea...
    8.10  	// Always show scroll bars (automatic would flicker sometimes)
    8.11  	setVScrollBarMode ( QScrollView::AlwaysOn );
    8.12 @@ -173,7 +173,7 @@
    8.13  void MapEditor::adjustCanvasSize()
    8.14  {
    8.15  
    8.16 -/* FIXME QT4 probably not needed any longer!
    8.17 +/* FIXME QT4 adjustcanvassize probably not needed any longer!
    8.18  
    8.19  	// To adjust the scene to map, viewport size and position, we have to
    8.20  	// do some coordinate magic...
    8.21 @@ -335,11 +335,6 @@
    8.22  		else if ( typeid(*saveSel) == typeid(FloatImageObj) )
    8.23  			// Save image
    8.24  			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
    8.25 -			
    8.26 -		else if (selection && typeid(*selection)==typeid(BranchObj))
    8.27 -			// Save selected branch is saved from mainwindow		//FIXME maybe use "subtree" above?
    8.28 -			// FIXME is this possible at all? BO is already above...
    8.29 -			s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
    8.30  	}
    8.31  
    8.32  	// Save local settings
    8.33 @@ -1226,10 +1221,9 @@
    8.34  		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
    8.35  
    8.36  		QRectF mapRect=totalBBox;
    8.37 -/* FIXME todo for QT4
    8.38 -		Q3CanvasRectangle *frame=NULL;
    8.39 -		Q3CanvasText *footerFN=NULL;
    8.40 -		Q3CanvasText *footerDate=NULL;
    8.41 +		QGraphicsRectItem *frame=NULL;
    8.42 +		QGraphicsTextItem *footerFN=NULL;
    8.43 +		QGraphicsTextItem *footerDate=NULL;
    8.44  		if (printFrame || printFooter)
    8.45  		{
    8.46  			
    8.47 @@ -1238,10 +1232,8 @@
    8.48  				// Print frame around map
    8.49  				mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
    8.50  					totalBBox.width()+20, totalBBox.height()+20);
    8.51 -				frame=new Q3CanvasRectangle (mapRect,mapScene);
    8.52 -				frame->setBrush (QColor(Qt::white));
    8.53 -				frame->setPen (QColor(Qt::black));
    8.54 -				frame->setZ(0);
    8.55 +				frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::red));
    8.56 +				frame->setZValue(0);
    8.57  				frame->show();    
    8.58  			}		
    8.59  			// TODO remove after testing 
    8.60 @@ -1256,26 +1248,23 @@
    8.61  				// Print footer below map
    8.62  				QFont font;		
    8.63  				font.setPointSize(10);
    8.64 -				footerFN=new Q3CanvasText (mapScene);
    8.65 -				footerFN->setText ("VYM - " + fileName);
    8.66 -				footerFN->setFont(font);
    8.67 -				footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
    8.68 -				footerFN->setZ(Z_TEXT);
    8.69 +				footerFN=mapScene->addText ("VYM - " + fileName,font);
    8.70 +				footerFN->setPos (mapRect.x(), mapRect.y() + mapRect.height() );
    8.71 +				footerFN->setZValue (Z_TEXT);
    8.72  				footerFN->show();    
    8.73 -				footerDate=new Q3CanvasText (mapScene);
    8.74 -				footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
    8.75 -				footerDate->setFont(font);
    8.76 -				footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
    8.77 -				footerDate->setZ(Z_TEXT);
    8.78 +				footerDate=mapScene->addText (QDate::currentDate().toString(Qt::TextDate),font);
    8.79 +				footerDate->setPos(mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
    8.80 +				footerDate->setZValue(Z_TEXT);
    8.81  				footerDate->show();    
    8.82  			}
    8.83 -			pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
    8.84 +			//pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
    8.85  		}	else	
    8.86  		{
    8.87 -			pp.setWindow (mapRect);
    8.88 +			//pp.setWindow (mapRect);
    8.89 +			//pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
    8.90  		}	
    8.91 -*/
    8.92 -
    8.93 +
    8.94 +/*
    8.95  		if (mapAspect>=paperAspect)
    8.96  		{
    8.97  			// Fit horizontally to paper width
    8.98 @@ -1285,8 +1274,11 @@
    8.99  			// Fit vertically to paper height
   8.100  			pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height());	
   8.101  		}	
   8.102 -
   8.103 -		mapScene->render(&pp);	// draw scene to printer
   8.104 +*/
   8.105 +		QRect viewport=rect();
   8.106 +		render (&pp, QRect(),QRect());
   8.107 +
   8.108 +		//mapScene->render(&pp);	// draw scene to printer
   8.109  
   8.110  /*
   8.111  		// Delete Frame and footer
   8.112 @@ -1295,8 +1287,8 @@
   8.113  			delete (footerFN);
   8.114  			delete (footerDate);
   8.115  		}	
   8.116 -		if (frame)  delete (frame);
   8.117  */		
   8.118 +//		if (frame)  delete (frame);
   8.119  
   8.120  		// Restore selection
   8.121  		if (oldselection) 
   8.122 @@ -1322,7 +1314,7 @@
   8.123  
   8.124  QPixmap MapEditor::getPixmap()
   8.125  {
   8.126 -/* FIXME not ported yet to QT4
   8.127 +/* FIXME getPixmap not ported yet to QT4
   8.128  	QRectF mapRect=mapCenter->getTotalBBox();
   8.129  	QPixmap pix (mapRect.size());
   8.130  	QPainter pp (&pix);
   8.131 @@ -2216,13 +2208,14 @@
   8.132  
   8.133  		s=s.left (s.length() -num.length());
   8.134  
   8.135 +		int n=num.toInt()-1;
   8.136 +		
   8.137  		// Go to next lmo
   8.138 -		num=QString ("%1").arg(num.toUInt()-1);
   8.139 -
   8.140 +		num=QString ("%1").arg(n);
   8.141  		s=s+num;
   8.142  		
   8.143  		// Try to select this one
   8.144 -		if (select (s)) return;
   8.145 +		if (n>=0 && select (s)) return;
   8.146  
   8.147  		// We have no direct precessor, 
   8.148  		// try to decrease the parental number in order to
   8.149 @@ -2244,15 +2237,15 @@
   8.150  			if (d>1)
   8.151  			{
   8.152  				// decrease number of parent
   8.153 -				num=QString ("%1").arg(num.toUInt()-1);
   8.154 +				num=QString ("%1").arg(num.toInt()-1);
   8.155  				s=s.section (",",0,d-2) + ","+ typ+num;
   8.156  			} else
   8.157  			{
   8.158  				// Special case, look at orientation
   8.159  				if (selection->getOrientation()==OrientRightOfCenter)
   8.160 -					num=QString ("%1").arg(num.toUInt()-1);
   8.161 +					num=QString ("%1").arg(num.toInt()-1);
   8.162  				else	
   8.163 -					num=QString ("%1").arg(num.toUInt()+1);
   8.164 +					num=QString ("%1").arg(num.toInt()+1);
   8.165  				s=typ+num;
   8.166  			}	
   8.167  
   8.168 @@ -2627,7 +2620,7 @@
   8.169  {
   8.170  	// transform to sceneView Coord:
   8.171  	QPointF p=matrix().map(movingCenter);
   8.172 -	//FIXME not ported yet to QT4 (center ist TextStream there)
   8.173 +	//FIXME setViewCenter not ported yet to QT4 (center ist TextStream there)
   8.174  	//center ( p.x(), p.y());
   8.175  }
   8.176  
   8.177 @@ -3565,7 +3558,7 @@
   8.178  
   8.179  void MapEditor::keyPressEvent(QKeyEvent* e)
   8.180  {
   8.181 -	if (e->modifiers() && Qt::ControlModifier)
   8.182 +	if (e->modifiers() & Qt::ControlModifier)
   8.183  	{
   8.184  		switch (mainWindow->getModMode())
   8.185  		{
   8.186 @@ -3587,7 +3580,7 @@
   8.187  
   8.188  void MapEditor::keyReleaseEvent(QKeyEvent* e)
   8.189  {
   8.190 -	if (!(e->modifiers() && Qt::ControlModifier))
   8.191 +	if (!(e->modifiers() & Qt::ControlModifier))
   8.192  		setCursor (Qt::ArrowCursor);
   8.193  }
   8.194  
   8.195 @@ -3843,8 +3836,7 @@
   8.196  	}	 
   8.197  	
   8.198      // Move sceneView 
   8.199 -    //if (!movingObj && !pickingColor &&!drawingLink && e->button() == Qt::LeftButton ) 
   8.200 -    if (e->buttons() == Qt::LeftButton ) 
   8.201 +    if (!movingObj && !pickingColor &&!drawingLink && e->buttons() == Qt::LeftButton ) 
   8.202  	{
   8.203  		QPointF p=e->globalPos();
   8.204  		movingVec.setX(-p.x() + movingObj_start.x() );
     9.1 --- a/tex/vym.changelog	Fri Dec 08 20:18:58 2006 +0000
     9.2 +++ b/tex/vym.changelog	Thu Dec 14 17:01:44 2006 +0000
     9.3 @@ -1,3 +1,9 @@
     9.4 +-------------------------------------------------------------------
     9.5 +Mon Dec 11 12:31:46 CET 2006 - uwedr
     9.6 +
     9.7 +- Version: 1.8.61
     9.8 +- Bugfix: move up/down to next subtree is working again
     9.9 +
    9.10  -------------------------------------------------------------------
    9.11  Mon Dec  6 22:48:07 CET 2006 - uwe
    9.12  
    10.1 --- a/version.h	Fri Dec 08 20:18:58 2006 +0000
    10.2 +++ b/version.h	Thu Dec 14 17:01:44 2006 +0000
    10.3 @@ -4,8 +4,8 @@
    10.4  #include <QString>
    10.5  
    10.6  #define __VYM_NAME "VYM"
    10.7 -#define __VYM_VERSION "1.8.61"
    10.8 -#define __VYM_BUILD_DATE "December 8, 2006"
    10.9 +#define __VYM_VERSION "1.8.62"
   10.10 +#define __VYM_BUILD_DATE "December 11, 2006"
   10.11  
   10.12  
   10.13  bool checkVersion(const QString &);