Bugfix: Now correct always correct size of heading
authorinsilmaril
Tue, 02 Aug 2005 08:12:14 +0000
changeset 1461b52ff19aad5
parent 145 0683c8e87fac
child 147 40de292411b6
Bugfix: Now correct always correct size of heading
branchobj.cpp
branchobj.h
demos/todo.vym
tex/vym.changelog
version.h
     1.1 --- a/branchobj.cpp	Mon Aug 01 20:45:55 2005 +0000
     1.2 +++ b/branchobj.cpp	Tue Aug 02 08:12:14 2005 +0000
     1.3 @@ -95,10 +95,6 @@
     1.4  		absPos+=parObj->getChildPos();
     1.5  	}
     1.6  
     1.7 -    // TODO This should be done in TextObj later
     1.8 -    QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
     1.9 -    heading->setFont(font );
    1.10 -
    1.11      lastSelectedBranch=-1;
    1.12  
    1.13      setChildObj(this);
    1.14 @@ -661,23 +657,14 @@
    1.15      return NULL;
    1.16  }
    1.17  
    1.18 -int BranchObj::getDefHeadingSize()
    1.19 -{
    1.20 -	if (depth==0)
    1.21 -		return 16;
    1.22 -	else	
    1.23 -		if (depth==1) 
    1.24 -			return 12;
    1.25 -		else
    1.26 -			return 10;
    1.27 -}
    1.28 -
    1.29  void BranchObj::setHeading(QString s)
    1.30  {
    1.31 +	/*FIXME
    1.32      // Adjusting font size
    1.33      QFont font=heading->getFont();
    1.34  	font.setPointSize(getDefHeadingSize() );
    1.35      heading->setFont(font);
    1.36 +	*/
    1.37      heading->setText(s);	// set new heading
    1.38  	calcBBoxSize();			// recalculate bbox
    1.39      positionBBox();			// rearrange contents
    1.40 @@ -913,15 +900,35 @@
    1.41  	}
    1.42  }
    1.43  
    1.44 +void BranchObj::setDefAttr (BranchModification mod)
    1.45 +{
    1.46 +	int fontsize;
    1.47 +	switch (depth)
    1.48 +	{
    1.49 +		case 0: fontsize=16; break;
    1.50 +		case 1: fontsize=12; break;
    1.51 +		default: fontsize=10; break;
    1.52 +	}	
    1.53 +
    1.54 +	setLinkColor ();
    1.55 +	setLinkStyle(getDefLinkStyle());
    1.56 +	QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
    1.57 +	font.setPointSize(fontsize);
    1.58 +	heading->setFont(font );
    1.59 +
    1.60 +	if (mod==NewBranch)
    1.61 +		setColor (((BranchObj*)(parObj))->getColor(),false);
    1.62 +	
    1.63 +	calcBBoxSize();
    1.64 +}
    1.65 +
    1.66  BranchObj* BranchObj::addBranch()
    1.67  {
    1.68      BranchObj* newbo=new BranchObj(canvas,this);
    1.69      branch.append (newbo);
    1.70      newbo->setParObj(this);
    1.71 -    newbo->setColor(getColor(),false);	
    1.72 -    newbo->setLinkColor();	
    1.73 +	newbo->setDefAttr(NewBranch);
    1.74      newbo->setHeading ("new");
    1.75 -	newbo->setLinkStyle (newbo->getDefLinkStyle());
    1.76  	if (scrolled)
    1.77  		newbo->setVisibility (false);
    1.78  	else	
    1.79 @@ -937,8 +944,7 @@
    1.80      branch.append (newbo);
    1.81      newbo->copy(bo);
    1.82      newbo->setParObj(this);
    1.83 -	newbo->setHeading (newbo->getHeading());	// adjust fontsize to depth
    1.84 -	newbo->setLinkStyle (newbo->getDefLinkStyle());
    1.85 +	newbo->setDefAttr(NewBranch);
    1.86  	if (scrolled)
    1.87  		newbo->setVisibility (false);
    1.88  	else	
    1.89 @@ -953,7 +959,7 @@
    1.90  	branch.append (bo);
    1.91  	bo->setParObj (this);
    1.92  	bo->depth=depth+1;
    1.93 -	bo->setLinkStyle (bo->getDefLinkStyle() );
    1.94 +	bo->setDefAttr(MovedBranch);
    1.95  	if (scrolled) tmpUnscroll();
    1.96  	setLastSelectedBranch (bo);
    1.97  	return bo;
    1.98 @@ -987,7 +993,7 @@
    1.99  	branch.append (bo);
   1.100  	bo->setParObj (this);
   1.101  	bo->depth=depth+1;
   1.102 -	bo->setLinkStyle (bo->getDefLinkStyle() );
   1.103 +	bo->setDefAttr (MovedBranch);
   1.104  	if (scrolled) tmpUnscroll();
   1.105  	setLastSelectedBranch (bo);
   1.106  	branch.sort();
   1.107 @@ -1116,7 +1122,7 @@
   1.108  		if (par)
   1.109  		{
   1.110  			BranchObj *bo=dst->insertBranchPtr (this,pos);
   1.111 -			bo->setHeading (bo->getHeading());
   1.112 +			bo->setDefAttr(MovedBranch);
   1.113  			return bo;
   1.114  
   1.115  		} else
     2.1 --- a/branchobj.h	Mon Aug 01 20:45:55 2005 +0000
     2.2 +++ b/branchobj.h	Tue Aug 02 08:12:14 2005 +0000
     2.3 @@ -11,6 +11,8 @@
     2.4  	virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
     2.5  };
     2.6  
     2.7 +enum BranchModification {NewBranch, MovedBranch};
     2.8 +
     2.9  /////////////////////////////////////////////////////////////////////////////
    2.10  class BranchObj:public OrnamentedObj {
    2.11  public:
    2.12 @@ -58,7 +60,6 @@
    2.13      virtual void positionBBox();
    2.14      virtual void calcBBoxSize();
    2.15      virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    2.16 -    virtual int getDefHeadingSize();
    2.17      virtual void setHeading (QString);
    2.18      virtual void setURL (QString);
    2.19      virtual QString getURL ();
    2.20 @@ -66,8 +67,8 @@
    2.21      virtual QString getVymLink ();
    2.22  	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    2.23  	virtual void addXLink (XLinkObj*);
    2.24 -	virtual void removeXLinkRef (XLinkObj*);	// Remove ref in list
    2.25 -	virtual void deleteXLink (XLinkObj*);		// remove references and delete XLinkObj 
    2.26 +	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    2.27 +	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    2.28  	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    2.29  	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    2.30  	virtual int countXLink ();
    2.31 @@ -79,7 +80,8 @@
    2.32      virtual FloatImageObj* getLastFloatImage();
    2.33  	virtual FloatImageObj* getFloatImageNum(const uint &);
    2.34  protected:	
    2.35 -	virtual void savePosInAngle();			// write pos in angle for resorting			
    2.36 +	virtual void savePosInAngle();					// write pos in angle for resorting			
    2.37 +	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    2.38  public:	
    2.39      virtual BranchObj* addBranch();
    2.40      virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/tex/vym.changelog	Mon Aug 01 20:45:55 2005 +0000
     4.2 +++ b/tex/vym.changelog	Tue Aug 02 08:12:14 2005 +0000
     4.3 @@ -1,5 +1,11 @@
     4.4  -------------------------------------------------------------------
     4.5 -Mon Aug  1 22:40:29 CEST 2005 
     4.6 +Tue Aug  2 09:59:24 CEST 2005 - uwedr
     4.7 +
     4.8 +-  Bugfix: Heading sizes now correct after moving e.g. mainbranch to 
     4.9 +   a branch
    4.10 +
    4.11 +-------------------------------------------------------------------
    4.12 +Mon Aug  1 22:40:29 CEST 2005 - jhilmer
    4.13  
    4.14  - Bugfix: Problems with closing of note editor when text was modified.
    4.15  - Feature: Added subscript and superscript to note editor
     5.1 --- a/version.h	Mon Aug 01 20:45:55 2005 +0000
     5.2 +++ b/version.h	Tue Aug 02 08:12:14 2005 +0000
     5.3 @@ -2,6 +2,6 @@
     5.4  #define VERSION_H
     5.5  
     5.6  #define __VYM_VERSION__ "1.7.3"
     5.7 -#define __BUILD_DATE__ "August 1, 2005"
     5.8 +#define __BUILD_DATE__ "August 2, 2005"
     5.9  
    5.10  #endif