2 #include "texteditor.h"
4 #include "mainwindow.h"
6 extern TextEditor *textEditor;
7 extern Main *mainWindow;
8 extern FlagRowObj *standardFlagsDefault;
9 extern QAction *actionEditOpenURL;
12 /////////////////////////////////////////////////////////////////
14 /////////////////////////////////////////////////////////////////
16 BranchObj* BranchObj::itLast=NULL;
19 BranchObj::BranchObj () :OrnamentedObj()
21 // cout << "Const BranchObj ()\n";
27 BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c)
29 // cout << "Const BranchObj (c) called from MapCenterObj (c)\n";
34 BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
36 // cout << "Const BranchObj (c,p)\n";
39 depth=p->getDepth()+1;
41 // Calc angle to mapCenter if I am a mainbranch
42 // needed for reordering the mainbranches clockwise
44 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
45 (int)(y() - parObj->getChildPos().y() ) ) );
49 BranchObj::~BranchObj ()
51 // cout << "Destr BranchObj of "<<this<<endl;
52 // Check, if this branch was the last child to be deleted
53 // If so, unset the scrolled flags
55 BranchObj *po=(BranchObj*)(parObj);
59 bo=((BranchObj*)(parObj))->getLastBranch();
60 if (!bo) po->unScroll();
65 bool BranchObj::operator< ( const BranchObj & other )
67 return angle < other.angle;
70 bool BranchObj::operator== ( const BranchObj & other )
72 return angle == other.angle;
75 int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j)
77 // Make sure PtrList::find works
80 if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
86 void BranchObj::init ()
88 branch.setAutoDelete (false);
89 floatimage.setAutoDelete (true);
90 xlink.setAutoDelete (false);
95 absPos+=parObj->getChildPos();
98 lastSelectedBranch=-1;
109 void BranchObj::copy (BranchObj* other)
111 OrnamentedObj::copy(other);
115 for (b=other->branch.first(); b;b=other->branch.next() )
116 // Make deep copy of b
117 // Because addBranch again calls copy for the childs,
118 // Those will get a deep copy, too
122 for (fi=other->floatimage.first(); fi;fi=other->floatimage.next() )
125 scrolled=other->scrolled;
126 tmpUnscrolled=other->tmpUnscrolled;
127 setVisibility (other->visible);
130 vymLink=other->vymLink;
137 void BranchObj::clear()
140 while (!xlink.isEmpty())
141 deleteXLink (xlink.first() );
144 while (!branch.isEmpty())
147 branch.removeFirst();
152 int BranchObj::getNum()
155 return ((BranchObj*)(parObj))->getNum ((BranchObj*)(this));
160 int BranchObj::getNum(BranchObj *bo)
162 // keep current pointer in branch,
163 // otherwise save might fail
165 int ind=branch.findRef (bo);
170 int BranchObj::getFloatImageNum(FloatImageObj *fio)
172 return floatimage.findRef (fio);
175 int BranchObj::countBranches()
177 return branch.count();
180 int BranchObj::countFloatImages()
182 return floatimage.count();
185 int BranchObj::countXLinks()
187 return xlink.count();
190 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
192 // Temporary link to lmo
193 // m is position of mouse pointer
194 // offset 0: default 1: below lmo -1 above lmo (if possible)
197 BranchObj* o=(BranchObj*)(lmo);
201 // ignore mapcenter and mainbranch
202 if (lmo->getDepth()<2) off=0;
209 depth=parObj->getDepth()+1;
211 // setLinkStyle calls updateLink, only set it once
212 if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
214 // Move temporary to new position at destination
215 // Usually the positioning would be done by reposition(),
216 // but then also the destination branch would "Jump" around...
217 // Better just do it approximately
219 { // new parent is the mapcenter itself
221 QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
222 m.y() - o->getChildPos().y() ));
223 if (p.x()<0) p.setX( p.x()-bbox.width() );
230 // new parent is just a branch, link to it
231 QRect t=o->getBBoxSizeWithChilds();
232 if (o->getLastBranch())
233 y=t.y() + t.height() ;
240 // we want to link above lmo
241 y=o->y() - height() + 5;
243 // we want to link below lmo
244 // Bottom of sel should be 5 pixels above
245 // the bottom of the branch _below_ the target:
246 // Don't try to find that branch, guess 12 pixels
247 y=o->getChildPos().y() -height() + 12;
249 if (o->getOrientation()==OrientLeftOfCenter)
250 move ( o->getChildPos().x() - linkwidth, y );
252 move (o->getChildPos().x() + linkwidth, y );
255 // updateLink is called implicitly in move
256 reposition(); // FIXME shouldn't be this a request?
259 void BranchObj::unsetParObjTmp()
266 depth=parObj->getDepth()+1;
267 setLinkStyle (getDefLinkStyle() );
272 void BranchObj::unScroll()
274 if (tmpUnscrolled) resetTmpUnscroll();
275 if (scrolled) toggleScroll();
278 void BranchObj::toggleScroll()
284 systemFlags->deactivate("scrolledright");
285 for (bo=branch.first(); bo; bo=branch.next() )
287 bo->setVisibility(true);
292 systemFlags->activate("scrolledright");
293 for (bo=branch.first(); bo; bo=branch.next() )
295 bo->setVisibility(false);
300 move (absPos.x(), absPos.y() );
304 bool BranchObj::isScrolled()
309 bool BranchObj::hasScrolledParent(BranchObj *start)
311 // Calls parents recursivly to
312 // find out, if we are scrolled at all.
313 // But ignore myself, just look at parents.
315 if (this !=start && scrolled) return true;
317 BranchObj* bo=(BranchObj*)(parObj);
319 return bo->hasScrolledParent(start);
324 void BranchObj::tmpUnscroll()
326 // Unscroll parent (recursivly)
327 BranchObj* bo=(BranchObj*)(parObj);
328 if (bo) bo->tmpUnscroll();
334 systemFlags->activate("tmpUnscrolledright");
339 void BranchObj::resetTmpUnscroll()
341 // Unscroll parent (recursivly)
342 BranchObj* bo=(BranchObj*)(parObj);
344 bo->resetTmpUnscroll();
350 systemFlags->deactivate("tmpUnscrolledright");
355 void BranchObj::setVisibility(bool v, int toDepth)
357 if (depth <= toDepth)
359 frame->setVisibility(v);
360 heading->setVisibility(v);
361 systemFlags->setVisibility(v);
362 standardFlags->setVisibility(v);
363 LinkableMapObj::setVisibility (v);
365 if (!scrolled && (depth < toDepth))
367 // Now go recursivly through all childs
369 for (b=branch.first(); b;b=branch.next() )
370 b->setVisibility (v,toDepth);
372 for (fio=floatimage.first(); fio; fio=floatimage.next())
373 fio->setVisibility (v);
375 for (xlo=xlink.first(); xlo;xlo=xlink.next() )
376 xlo->setVisibility ();
378 } // depth <= toDepth
382 void BranchObj::setVisibility(bool v)
384 setVisibility (v,MAX_DEPTH);
388 void BranchObj::setLinkColor ()
390 // Overloaded from LinkableMapObj
391 // BranchObj can use color of heading
394 if (mapEditor->getLinkColorHint()==HeadingColor)
395 LinkableMapObj::setLinkColor (heading->getColor() );
397 LinkableMapObj::setLinkColor ();
400 void BranchObj::setColor (QColor col, bool colorChilds)
402 heading->setColor(col);
407 for (bo=branch.first(); bo; bo=branch.next() )
408 bo->setColor(col,colorChilds);
412 QColor BranchObj::getColor()
414 return heading->getColor();
417 BranchObj* BranchObj::first()
423 BranchObj* BranchObj::next()
426 BranchObj *bo=branch.first();
427 BranchObj *po=(BranchObj*)(parObj);
430 { // We are just beginning at the mapCenter
444 { // We come from above
447 // there are childs, go there
452 { // no childs, try to go up again
464 // can't go up, I am mapCenter
471 // Try to find last child, we came from, in my own childs
473 while (bo && searching)
475 if (itLast==bo) searching=false;
479 { // found lastLMO in my childs
482 // found a brother of lastLMO
498 // can't go up, I am mapCenter
505 // couldn't find last child, it must be a nephew of mine
509 // proceed with my first child
515 // or go back to my parents
526 // can't go up, I am mapCenter
533 BranchObj* BranchObj::getLastIterator()
538 void BranchObj::setLastIterator(BranchObj* it)
544 void BranchObj::move (double x, double y)
546 OrnamentedObj::move (x,y);
550 void BranchObj::move (QPoint p)
555 void BranchObj::moveBy (double x, double y)
557 OrnamentedObj::moveBy (x,y);
560 for (b=branch.first(); b;b=branch.next() )
564 void BranchObj::moveBy (QPoint p)
566 moveBy (p.x(), p.y());
570 void BranchObj::positionBBox()
572 // TODO testing (optimization)
574 QString h=getHeading();
576 cout << "BO::positionBBox("<<h<<")\n";
578 cout << "BO::positionBBox (noHeading)\n";
581 heading->positionBBox();
582 systemFlags->positionBBox();
583 standardFlags->positionBBox();
584 // It seems that setting x,y also affects width,height
585 int w_old=bbox.width();
586 int h_old=bbox.height();
587 bbox.setX (absPos.x() );
588 bbox.setY (absPos.y() );
589 bbox.setWidth(w_old);
590 bbox.setHeight(h_old);
595 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
597 // Update links to other branches
599 for (xlo=xlink.first(); xlo; xlo=xlink.next() )
603 void BranchObj::calcBBoxSize()
605 QSize heading_r=heading->getSize();
606 int heading_w=static_cast <int> (heading_r.width() );
607 int heading_h=static_cast <int> (heading_r.height() );
608 QSize sysflags_r=systemFlags->getSize();
609 int sysflags_h=sysflags_r.height();
610 int sysflags_w=sysflags_r.width();
611 QSize stanflags_r=standardFlags->getSize();
612 int stanflags_h=stanflags_r.height();
613 int stanflags_w=stanflags_r.width();
617 // set width to sum of all widths
618 w=heading_w + sysflags_w + stanflags_w;
619 // set height to maximum needed height
620 h=max (sysflags_h,stanflags_h);
623 w+=frame->getBorder();
624 h+=frame->getBorder();
625 bbox.setSize (QSize (w,h));
628 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
633 for (b=branch.first(); b; b=branch.next() )
635 lmo=b->findMapObj(p, excludeLMO);
636 if (lmo != NULL) return lmo;
640 if (inBBox (p) && (this != excludeLMO) && isVisibleObj() )
643 // Search float images
645 for (foi=floatimage.first(); foi; foi=floatimage.next() )
646 if (foi->inBBox(p) &&
647 (foi != excludeLMO) &&
648 foi->getParObj()!= excludeLMO &&
655 void BranchObj::setHeading(QString s)
657 heading->setText(s); // set new heading
658 calcBBoxSize(); // recalculate bbox
659 positionBBox(); // rearrange contents
663 void BranchObj::setURL(QString s)
667 systemFlags->activate("url");
669 systemFlags->deactivate("url");
670 calcBBoxSize(); // recalculate bbox
671 positionBBox(); // rearrange contents
675 QString BranchObj::getURL()
680 void BranchObj::setVymLink(QString s)
684 // We need the relative (from loading)
685 // or absolute path (from User event)
686 // and build the absolute path.
687 // Note: If we have relative, use path of
688 // current map to build absolute path
690 if (!d.path().startsWith ("/"))
692 QString p=mapEditor->getDestPath();
693 int i=p.findRev("/",-1);
694 d.setPath(p.left(i)+"/"+s);
698 systemFlags->activate("vymLink");
702 systemFlags->deactivate("vymLink");
705 calcBBoxSize(); // recalculate bbox
706 positionBBox(); // rearrange contents
710 QString BranchObj::getVymLink()
715 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
718 QString scrolledAttr;
720 scrolledAttr=attribut ("scrolled","yes");
725 if (depth<2) posAttr=
726 attribut("absPosX",QString().setNum(absPos.x(),10)) +
727 attribut("absPosY",QString().setNum(absPos.y(),10));
731 QString linkAttr=getLinkAttr();
735 urlAttr=attribut ("url",url);
738 if (!vymLink.isEmpty())
739 vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
742 if (frame->getFrameType()!=NoFrame)
743 frameAttr=attribut ("frameType",frame->getFrameTypeName());
747 // save area, if not scrolled
749 if (!((BranchObj*)(parObj))->isScrolled() )
752 attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
753 attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
754 attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
755 attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
760 s=beginElement ("branch" +scrolledAttr +posAttr +linkAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr );
764 s+=valueElement("heading", getHeading(),
765 attribut ("textColor",QColor(heading->getColor()).name()));
767 // save names of flags set
768 s+=standardFlags->saveToDir(tmpdir,prefix,0);
771 if (!note.isEmpty() )
776 for (bo=branch.first(); bo; bo=branch.next() )
777 s+=bo->saveToDir(tmpdir,prefix,offset);
781 for (fio=floatimage.first(); fio; fio=floatimage.next() )
782 s+=fio->saveToDir (tmpdir,prefix);
786 for (xlo=xlink.first(); xlo; xlo=xlink.next() )
790 s+=endElement ("branch");
794 void BranchObj::addXLink (XLinkObj *xlo)
800 void BranchObj::removeXLinkRef (XLinkObj *xlo)
805 void BranchObj::deleteXLink(XLinkObj *xlo)
808 if (!xlo->isUsed()) delete (xlo);
811 void BranchObj::deleteXLinkAt (int i)
813 XLinkObj *xlo=xlink.at(i);
815 if (!xlo->isUsed()) delete(xlo);
818 XLinkObj* BranchObj::XLinkAt (int i)
823 int BranchObj::countXLink()
825 return xlink.count();
828 BranchObj* BranchObj::XLinkTargetAt (int i)
831 return xlink.at(i)->otherBranch (this);
836 LinkableMapObj* BranchObj::addFloatImage ()
838 FloatImageObj *newfi=new FloatImageObj (canvas,this);
839 floatimage.append (newfi);
840 if (hasScrolledParent(this) )
841 newfi->setVisibility (false);
843 newfi->setVisibility(visible);
848 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
850 FloatImageObj *newfi=new FloatImageObj (canvas,this);
851 floatimage.append (newfi);
853 if (hasScrolledParent(this) )
854 newfi->setVisibility (false);
856 newfi->setVisibility(visible);
861 FloatImageObj* BranchObj::getFirstFloatImage ()
863 return floatimage.first();
866 FloatImageObj* BranchObj::getLastFloatImage ()
868 return floatimage.last();
871 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
873 return floatimage.at(i);
876 void BranchObj::removeFloatImage (FloatImageObj *fio)
878 floatimage.remove (fio);
882 void BranchObj::savePosInAngle ()
884 // Save position in angle
887 for (b=branch.first(); b; b=branch.next() )
894 void BranchObj::setDefAttr (BranchModification mod)
899 case 0: fontsize=16; break;
900 case 1: fontsize=12; break;
901 default: fontsize=10; break;
905 setLinkStyle(getDefLinkStyle());
906 QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
907 font.setPointSize(fontsize);
908 heading->setFont(font );
911 setColor (((BranchObj*)(parObj))->getColor(),false);
916 BranchObj* BranchObj::addBranch()
918 BranchObj* newbo=new BranchObj(canvas,this);
919 branch.append (newbo);
920 newbo->setParObj(this);
921 newbo->setDefAttr(NewBranch);
922 newbo->setHeading ("new");
924 newbo->setVisibility (false);
926 newbo->setVisibility(visible);
932 BranchObj* BranchObj::addBranch(BranchObj* bo)
934 BranchObj* newbo=new BranchObj(canvas,this);
935 branch.append (newbo);
937 newbo->setParObj(this);
938 newbo->setDefAttr(MovedBranch);
940 newbo->setVisibility (false);
942 newbo->setVisibility(bo->visible);
948 BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
951 bo->setParObj (this);
953 bo->setDefAttr(MovedBranch);
954 if (scrolled) tmpUnscroll();
955 setLastSelectedBranch (bo);
959 BranchObj* BranchObj::insertBranch(int pos)
962 // Add new bo and resort branches
963 BranchObj *newbo=addBranch ();
964 newbo->angle=pos-0.5;
969 BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
972 // Add new bo and resort branches
974 BranchObj *newbo=addBranch (bo);
979 BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
982 // Add new bo and resort branches
985 bo->setParObj (this);
987 bo->setDefAttr (MovedBranch);
988 if (scrolled) tmpUnscroll();
989 setLastSelectedBranch (bo);
994 void BranchObj::removeBranchHere(BranchObj* borem)
996 // This removes the branch bo from list, but
997 // inserts its childs at the place of bo
999 bo=borem->getLastBranch();
1000 int pos=borem->getNum();
1003 bo->moveBranchTo (this,pos+1);
1004 bo=borem->getLastBranch();
1006 removeBranch (borem);
1009 void BranchObj::removeChilds()
1014 void BranchObj::removeBranch(BranchObj* bo)
1016 // if bo is not in branch remove returns false, we
1019 if (branch.remove (bo))
1022 qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
1023 requestReposition();
1026 void BranchObj::removeBranchPtr(BranchObj* bo)
1029 requestReposition();
1032 void BranchObj::setLastSelectedBranch (BranchObj* bo)
1034 lastSelectedBranch=branch.find(bo);
1037 BranchObj* BranchObj::getLastSelectedBranch ()
1039 if (lastSelectedBranch>=0)
1041 BranchObj* bo=branch.at(lastSelectedBranch);
1044 return branch.first();
1047 BranchObj* BranchObj::getFirstBranch ()
1049 return branch.first();
1052 BranchObj* BranchObj::getLastBranch ()
1054 return branch.last();
1057 BranchObj* BranchObj::getBranchNum (const uint &i)
1059 return branch.at(i);
1063 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
1066 int i=branch.find(bo1);
1068 { // -1 if bo1 not found
1069 branch.at(i)->angle--;
1070 branch.at(i-1)->angle++;
1072 return branch.at(i-1);
1074 return branch.at(i);
1077 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
1080 int i=branch.find(bo1);
1085 branch.at(i)->angle++;
1086 branch.at(j)->angle--;
1088 return branch.at(j);
1090 return branch.at(i);
1093 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
1095 // Find current parent and
1096 // remove pointer to myself there
1097 if (!dst) return NULL;
1098 BranchObj *par=(BranchObj*)(parObj);
1100 par->removeBranchPtr (this);
1104 // Create new pointer to myself at dst
1105 if (pos<0||dst->getDepth()==0)
1107 // links myself as last branch at dst
1108 dst->addBranchPtr (this);
1113 // inserts me at pos in parent of dst
1116 BranchObj *bo=dst->insertBranchPtr (this,pos);
1117 bo->setDefAttr(MovedBranch);
1126 void BranchObj::alignRelativeTo (QPoint ref)
1129 if (!getHeading().isEmpty())
1130 cout << "BO::alignRelTo "<<getHeading()<<endl;
1132 cout << "BO::alignRelTo ???"<<endl;
1133 cout << " d="<<depth<<endl;
1135 int th = bboxTotal.height();
1137 // If I am the mapcenter or a mainbranch, reposition heading
1140 move (absPos.x(),absPos.y());
1143 // Calc angle to mapCenter if I am a mainbranch
1144 // needed for reordering the mainbranches clockwise
1146 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1147 (int)(y() - parObj->getChildPos().y() ) ) );
1152 // Align myself depending on orientation and parent, but
1153 // only if I am not the mainbranch or mapcenter itself
1154 switch (orientation)
1156 case OrientLeftOfCenter:
1157 move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
1159 case OrientRightOfCenter:
1160 move (ref.x(), ref.y() + (th-bbox.height())/2 );
1163 cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
1169 for (fio=floatimage.first(); fio; fio=floatimage.next() )
1172 if (scrolled) return;
1174 // Set reference point for alignment of childs
1176 if (orientation==OrientLeftOfCenter)
1177 ref2.setX(childPos.x() - linkwidth);
1179 ref2.setX(childPos.x() + linkwidth);
1182 ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
1184 ref2.setY(ref.y() );
1186 // Align the childs depending on reference point
1188 for (b=branch.first(); b; b=branch.next() )
1190 b->alignRelativeTo (ref2);
1191 ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
1196 void BranchObj::reposition()
1198 /* TODO testing only
1199 if (!getHeading().isEmpty())
1200 cout << "BO::reposition "<<getHeading()<<endl;
1202 cout << "BO::reposition ???"<<endl;
1206 // only calculate the sizes once. If the deepest LMO
1207 // changes its height,
1208 // all upper LMOs have to change, too.
1209 calcBBoxSizeWithChilds();
1210 alignRelativeTo ( QPoint (absPos.x(),
1211 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1215 // This is only important for moving branches:
1216 // For editing a branch it isn't called...
1217 alignRelativeTo ( QPoint (absPos.x(),
1218 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1223 QRect BranchObj::getTotalBBox()
1227 if (scrolled) return r;
1230 for (b=branch.first();b ;b=branch.next() )
1231 r=addBBox(b->getTotalBBox(),r);
1234 for (fio=floatimage.first();fio ;fio=floatimage.next() )
1235 r=addBBox(fio->getTotalBBox(),r);
1240 QRect BranchObj::getBBoxSizeWithChilds()
1245 void BranchObj::calcBBoxSizeWithChilds()
1247 // This is called only from reposition and
1248 // and only for mapcenter. So it won't be
1249 // called more than once for a single user
1252 // Calculate size of LMO including all childs (to align them later)
1254 bboxTotal.setX(bbox.x() );
1255 bboxTotal.setY(bbox.y() );
1257 // if branch is scrolled, ignore childs, but still consider floatimages
1260 bboxTotal.setWidth (bbox.width());
1261 bboxTotal.setHeight(bbox.height());
1267 // Now calculate recursivly
1269 // maximum of widths
1272 for (b=branch.first();b ;b=branch.next() )
1274 b->calcBBoxSizeWithChilds();
1275 br=b->getBBoxSizeWithChilds();
1276 r.setWidth( max (br.width(), r.width() ));
1277 r.setHeight(br.height() + r.height() );
1278 if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
1280 // Add myself and also
1281 // add width of link to sum if necessary
1282 if (branch.isEmpty())
1283 bboxTotal.setWidth (bbox.width() + r.width() );
1285 bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
1286 bboxTotal.setHeight(max (r.height(), bbox.height() ) );
1287 // frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1290 void BranchObj::select()
1292 // set Text in Editor
1293 textEditor->setText(note.getNote() );
1294 QString fnh=note.getFilenameHint();
1296 textEditor->setFilenameHint(note.getFilenameHint() );
1298 textEditor->setFilenameHint(getHeading() );
1299 textEditor->setFontHint (note.getFontHint() );
1301 LinkableMapObj::select();
1302 // Tell parent that I am selected now:
1303 BranchObj* po=(BranchObj*)(parObj);
1304 if (po) // TODO Try to get rid of this cast...
1305 po->setLastSelectedBranch(this);
1307 // temporary unscroll, if we have scrolled parents somewhere
1308 if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
1310 // Show URL and link in statusbar
1312 if (!url.isEmpty()) status+="URL: "+url+" ";
1313 if (!vymLink.isEmpty()) status+="Link: "+vymLink;
1314 if (!status.isEmpty()) mainWindow->statusMessage (status);
1317 standardFlags->updateToolbar();
1319 // Update Browserbutton
1321 actionEditOpenURL->setEnabled (true);
1323 actionEditOpenURL->setEnabled (false);
1325 // Update actions in mapeditor
1326 mapEditor->updateActions();
1329 void BranchObj::unselect()
1331 LinkableMapObj::unselect();
1332 // Delete any messages like vymLink in StatusBar
1333 mainWindow->statusMessage ("");
1335 // save note from editor and set flag
1336 // text is done by updateNoteFlag(), just save
1338 note.setFilenameHint (textEditor->getFilename());
1340 // reset temporary unscroll, if we have scrolled parents somewhere
1341 if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
1343 // Erase content of editor
1344 textEditor->setInactive();
1346 // unselect all buttons in toolbar
1347 standardFlagsDefault->updateToolbar();
1350 QString BranchObj::getSelectString()
1356 s= "bo:" + QString("%1").arg(getNum());
1358 s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());