# HG changeset patch # User insilmaril # Date 1122970334 0 # Node ID 1b52ff19aad5f6993571ba808cf90972a38e703f # Parent 0683c8e87fac70f19af75c9af8adb391c714143c Bugfix: Now correct always correct size of heading diff -r 0683c8e87fac -r 1b52ff19aad5 branchobj.cpp --- a/branchobj.cpp Mon Aug 01 20:45:55 2005 +0000 +++ b/branchobj.cpp Tue Aug 02 08:12:14 2005 +0000 @@ -95,10 +95,6 @@ absPos+=parObj->getChildPos(); } - // TODO This should be done in TextObj later - QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0"); - heading->setFont(font ); - lastSelectedBranch=-1; setChildObj(this); @@ -661,23 +657,14 @@ return NULL; } -int BranchObj::getDefHeadingSize() -{ - if (depth==0) - return 16; - else - if (depth==1) - return 12; - else - return 10; -} - void BranchObj::setHeading(QString s) { + /*FIXME // Adjusting font size QFont font=heading->getFont(); font.setPointSize(getDefHeadingSize() ); heading->setFont(font); + */ heading->setText(s); // set new heading calcBBoxSize(); // recalculate bbox positionBBox(); // rearrange contents @@ -913,15 +900,35 @@ } } +void BranchObj::setDefAttr (BranchModification mod) +{ + int fontsize; + switch (depth) + { + case 0: fontsize=16; break; + case 1: fontsize=12; break; + default: fontsize=10; break; + } + + setLinkColor (); + setLinkStyle(getDefLinkStyle()); + QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0"); + font.setPointSize(fontsize); + heading->setFont(font ); + + if (mod==NewBranch) + setColor (((BranchObj*)(parObj))->getColor(),false); + + calcBBoxSize(); +} + BranchObj* BranchObj::addBranch() { BranchObj* newbo=new BranchObj(canvas,this); branch.append (newbo); newbo->setParObj(this); - newbo->setColor(getColor(),false); - newbo->setLinkColor(); + newbo->setDefAttr(NewBranch); newbo->setHeading ("new"); - newbo->setLinkStyle (newbo->getDefLinkStyle()); if (scrolled) newbo->setVisibility (false); else @@ -937,8 +944,7 @@ branch.append (newbo); newbo->copy(bo); newbo->setParObj(this); - newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth - newbo->setLinkStyle (newbo->getDefLinkStyle()); + newbo->setDefAttr(NewBranch); if (scrolled) newbo->setVisibility (false); else @@ -953,7 +959,7 @@ branch.append (bo); bo->setParObj (this); bo->depth=depth+1; - bo->setLinkStyle (bo->getDefLinkStyle() ); + bo->setDefAttr(MovedBranch); if (scrolled) tmpUnscroll(); setLastSelectedBranch (bo); return bo; @@ -987,7 +993,7 @@ branch.append (bo); bo->setParObj (this); bo->depth=depth+1; - bo->setLinkStyle (bo->getDefLinkStyle() ); + bo->setDefAttr (MovedBranch); if (scrolled) tmpUnscroll(); setLastSelectedBranch (bo); branch.sort(); @@ -1116,7 +1122,7 @@ if (par) { BranchObj *bo=dst->insertBranchPtr (this,pos); - bo->setHeading (bo->getHeading()); + bo->setDefAttr(MovedBranch); return bo; } else diff -r 0683c8e87fac -r 1b52ff19aad5 branchobj.h --- a/branchobj.h Mon Aug 01 20:45:55 2005 +0000 +++ b/branchobj.h Tue Aug 02 08:12:14 2005 +0000 @@ -11,6 +11,8 @@ virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j); }; +enum BranchModification {NewBranch, MovedBranch}; + ///////////////////////////////////////////////////////////////////////////// class BranchObj:public OrnamentedObj { public: @@ -58,7 +60,6 @@ virtual void positionBBox(); virtual void calcBBoxSize(); virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj - virtual int getDefHeadingSize(); virtual void setHeading (QString); virtual void setURL (QString); virtual QString getURL (); @@ -66,8 +67,8 @@ virtual QString getVymLink (); virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir virtual void addXLink (XLinkObj*); - virtual void removeXLinkRef (XLinkObj*); // Remove ref in list - virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj + virtual void removeXLinkRef (XLinkObj*);// Remove ref in list + virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj virtual void deleteXLinkAt (int); // remove references and delete XLinkObj virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj virtual int countXLink (); @@ -79,7 +80,8 @@ virtual FloatImageObj* getLastFloatImage(); virtual FloatImageObj* getFloatImageNum(const uint &); protected: - virtual void savePosInAngle(); // write pos in angle for resorting + virtual void savePosInAngle(); // write pos in angle for resorting + virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...) public: virtual BranchObj* addBranch(); virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj diff -r 0683c8e87fac -r 1b52ff19aad5 demos/todo.vym Binary file demos/todo.vym has changed diff -r 0683c8e87fac -r 1b52ff19aad5 tex/vym.changelog --- a/tex/vym.changelog Mon Aug 01 20:45:55 2005 +0000 +++ b/tex/vym.changelog Tue Aug 02 08:12:14 2005 +0000 @@ -1,5 +1,11 @@ ------------------------------------------------------------------- -Mon Aug 1 22:40:29 CEST 2005 +Tue Aug 2 09:59:24 CEST 2005 - uwedr + +- Bugfix: Heading sizes now correct after moving e.g. mainbranch to + a branch + +------------------------------------------------------------------- +Mon Aug 1 22:40:29 CEST 2005 - jhilmer - Bugfix: Problems with closing of note editor when text was modified. - Feature: Added subscript and superscript to note editor diff -r 0683c8e87fac -r 1b52ff19aad5 version.h --- a/version.h Mon Aug 01 20:45:55 2005 +0000 +++ b/version.h Tue Aug 02 08:12:14 2005 +0000 @@ -2,6 +2,6 @@ #define VERSION_H #define __VYM_VERSION__ "1.7.3" -#define __BUILD_DATE__ "August 1, 2005" +#define __BUILD_DATE__ "August 2, 2005" #endif