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 // TODO This should be done in TextObj later
99 QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
100 heading->setFont(font );
102 lastSelectedBranch=-1;
113 void BranchObj::copy (BranchObj* other)
115 OrnamentedObj::copy(other);
119 for (b=other->branch.first(); b;b=other->branch.next() )
120 // Make deep copy of b
121 // Because addBranch again calls copy for the childs,
122 // Those will get a deep copy, too
126 for (fi=other->floatimage.first(); fi;fi=other->floatimage.next() )
129 scrolled=other->scrolled;
130 tmpUnscrolled=other->tmpUnscrolled;
131 setVisibility (other->visible);
134 vymLink=other->vymLink;
141 void BranchObj::clear()
144 while (!xlink.isEmpty())
145 deleteXLink (xlink.first() );
148 while (!branch.isEmpty())
151 branch.removeFirst();
156 int BranchObj::getNum()
159 return ((BranchObj*)(parObj))->getNum ((BranchObj*)(this));
164 int BranchObj::getNum(BranchObj *bo)
166 // keep current pointer in branch,
167 // otherwise save might fail
169 int ind=branch.findRef (bo);
174 int BranchObj::getFloatImageNum(FloatImageObj *fio)
176 return floatimage.findRef (fio);
179 int BranchObj::countBranches()
181 return branch.count();
184 int BranchObj::countFloatImages()
186 return floatimage.count();
189 int BranchObj::countXLinks()
191 return xlink.count();
194 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
196 // Temporary link to lmo
197 // m is position of mouse pointer
198 // offset 0: default 1: below lmo -1 above lmo (if possible)
201 BranchObj* o=(BranchObj*)(lmo);
205 // ignore mapcenter and mainbranch
206 if (lmo->getDepth()<2) off=0;
216 // parObj=o->getParObj();
218 // parObj=o->getParObj();
223 depth=parObj->getDepth()+1;
225 // setLinkStyle calls updateLink, only set it once
226 if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
228 // Move temporary to new position at destination
229 // Usually the positioning would be done by reposition(),
230 // but then also the destination branch would "Jump" around...
231 // Better just do it approximately
233 { // new parent is the mapcenter itself
235 QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
236 m.y() - o->getChildPos().y() ));
237 if (p.x()<0) p.setX( p.x()-bbox.width() );
244 // new parent is just a branch, link to it
245 QRect t=o->getBBoxSizeWithChilds();
246 if (o->getLastBranch())
247 y=t.y() + t.height() ;
254 // we want to link above lmo
255 y=o->y() - height() + 5;
257 // we want to link below lmo
258 // Bottom of sel should be 5 pixels above
259 // the bottom of the branch _below_ the target:
260 // Don't try to find that branch, guess 12 pixels
261 y=o->getChildPos().y() -height() + 12;
263 if (o->getOrientation()==OrientLeftOfCenter)
264 move ( o->getChildPos().x() - linkwidth, y );
266 move (o->getChildPos().x() + linkwidth, y );
269 // updateLink is called implicitly in move
270 reposition(); // FIXME shouldn't be this a request?
273 void BranchObj::unsetParObjTmp()
280 depth=parObj->getDepth()+1;
281 setLinkStyle (getDefLinkStyle() );
286 void BranchObj::unScroll()
288 if (tmpUnscrolled) resetTmpUnscroll();
289 if (scrolled) toggleScroll();
292 void BranchObj::toggleScroll()
298 systemFlags->deactivate("scrolledright");
299 for (bo=branch.first(); bo; bo=branch.next() )
301 bo->setVisibility(true);
306 systemFlags->activate("scrolledright");
307 for (bo=branch.first(); bo; bo=branch.next() )
309 bo->setVisibility(false);
314 move (absPos.x(), absPos.y() );
318 bool BranchObj::isScrolled()
323 bool BranchObj::hasScrolledParent(BranchObj *start)
325 // Calls parents recursivly to
326 // find out, if we are scrolled at all.
327 // But ignore myself, just look at parents.
329 if (this !=start && scrolled) return true;
331 BranchObj* bo=(BranchObj*)(parObj);
333 return bo->hasScrolledParent(start);
338 void BranchObj::tmpUnscroll()
340 // Unscroll parent (recursivly)
341 BranchObj* bo=(BranchObj*)(parObj);
342 if (bo) bo->tmpUnscroll();
348 systemFlags->activate("tmpUnscrolledright");
353 void BranchObj::resetTmpUnscroll()
355 // Unscroll parent (recursivly)
356 BranchObj* bo=(BranchObj*)(parObj);
358 bo->resetTmpUnscroll();
364 systemFlags->deactivate("tmpUnscrolledright");
369 void BranchObj::setVisibility(bool v, int toDepth)
371 if (depth <= toDepth)
373 frame->setVisibility(v);
374 heading->setVisibility(v);
375 systemFlags->setVisibility(v);
376 standardFlags->setVisibility(v);
377 LinkableMapObj::setVisibility (v);
379 if (!scrolled && (depth < toDepth))
381 // Now go recursivly through all childs
383 for (b=branch.first(); b;b=branch.next() )
384 b->setVisibility (v,toDepth);
386 for (fio=floatimage.first(); fio; fio=floatimage.next())
387 fio->setVisibility (v);
389 for (xlo=xlink.first(); xlo;xlo=xlink.next() )
390 xlo->setVisibility ();
392 } // depth <= toDepth
396 void BranchObj::setVisibility(bool v)
398 setVisibility (v,MAX_DEPTH);
402 void BranchObj::setLinkColor ()
404 // Overloaded from LinkableMapObj
405 // BranchObj can use color of heading
407 if (mapEditor->getLinkColorHint()==HeadingColor)
408 LinkableMapObj::setLinkColor (heading->getColor() );
410 LinkableMapObj::setLinkColor ();
413 void BranchObj::setColor (QColor col, bool colorChilds)
415 heading->setColor(col);
420 for (bo=branch.first(); bo; bo=branch.next() )
421 bo->setColor(col,colorChilds);
426 BranchObj* BranchObj::first()
432 BranchObj* BranchObj::next()
435 BranchObj *bo=branch.first();
436 BranchObj *po=(BranchObj*)(parObj);
439 { // We are just beginning at the mapCenter
453 { // We come from above
456 // there are childs, go there
461 { // no childs, try to go up again
473 // can't go up, I am mapCenter
480 // Try to find last child, we came from, in my own childs
482 while (bo && searching)
484 if (itLast==bo) searching=false;
488 { // found lastLMO in my childs
491 // found a brother of lastLMO
507 // can't go up, I am mapCenter
514 // couldn't find last child, it must be a nephew of mine
518 // proceed with my first child
524 // or go back to my parents
535 // can't go up, I am mapCenter
542 BranchObj* BranchObj::getLastIterator()
547 void BranchObj::setLastIterator(BranchObj* it)
553 void BranchObj::move (double x, double y)
555 OrnamentedObj::move (x,y);
559 void BranchObj::move (QPoint p)
564 void BranchObj::moveBy (double x, double y)
566 OrnamentedObj::moveBy (x,y);
569 for (b=branch.first(); b;b=branch.next() )
573 void BranchObj::moveBy (QPoint p)
575 moveBy (p.x(), p.y());
579 void BranchObj::positionBBox()
581 // FIXME testing (optimization)
583 QString h=getHeading();
585 cout << "BO::positionBBox("<<h<<")\n";
587 cout << "BO::positionBBox (noHeading)\n";
590 heading->positionBBox();
591 systemFlags->positionBBox();
592 standardFlags->positionBBox();
593 // It seems that setting x,y also affects width,height
594 int w_old=bbox.width();
595 int h_old=bbox.height();
596 bbox.setX (absPos.x() );
597 bbox.setY (absPos.y() );
598 bbox.setWidth(w_old);
599 bbox.setHeight(h_old);
604 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
606 // Update links to other branches
608 for (xlo=xlink.first(); xlo; xlo=xlink.next() )
612 void BranchObj::calcBBoxSize()
614 QSize heading_r=heading->getSize();
615 int heading_w=static_cast <int> (heading_r.width() );
616 int heading_h=static_cast <int> (heading_r.height() );
617 QSize sysflags_r=systemFlags->getSize();
618 int sysflags_h=sysflags_r.height();
619 int sysflags_w=sysflags_r.width();
620 QSize stanflags_r=standardFlags->getSize();
621 int stanflags_h=stanflags_r.height();
622 int stanflags_w=stanflags_r.width();
626 // set width to sum of all widths
627 w=heading_w + sysflags_w + stanflags_w;
628 // set height to maximum needed height
629 h=max (sysflags_h,stanflags_h);
632 w+=frame->getBorder();
633 h+=frame->getBorder();
634 bbox.setSize (QSize (w,h));
637 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
642 for (b=branch.first(); b; b=branch.next() )
644 lmo=b->findMapObj(p, excludeLMO);
645 if (lmo != NULL) return lmo;
649 if (inBBox (p) && (this != excludeLMO) && isVisibleObj() )
652 // Search float images
654 for (foi=floatimage.first(); foi; foi=floatimage.next() )
655 if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
660 void BranchObj::setHeading(QString s)
662 // Adjusting font size
663 QFont font=heading->getFont();
665 font.setPointSize(16);
668 font.setPointSize(10);
670 font.setPointSize(12);
671 heading->setFont(font);
672 heading->setText(s); // set new heading
673 calcBBoxSize(); // recalculate bbox
674 positionBBox(); // rearrange contents
678 void BranchObj::setURL(QString s)
682 systemFlags->activate("url");
684 systemFlags->deactivate("url");
685 calcBBoxSize(); // recalculate bbox
686 positionBBox(); // rearrange contents
690 QString BranchObj::getURL()
695 void BranchObj::setVymLink(QString s)
699 // We need the relative (from loading)
700 // or absolute path (from User event)
701 // and build the absolute path.
702 // Note: If we have relative, use path of
703 // current map to build absolute path
705 if (!d.path().startsWith ("/"))
707 QString p=mapEditor->getDestPath();
708 int i=p.findRev("/",-1);
709 d.setPath(p.left(i)+"/"+s);
713 systemFlags->activate("vymLink");
717 systemFlags->deactivate("vymLink");
720 calcBBoxSize(); // recalculate bbox
721 positionBBox(); // rearrange contents
725 QString BranchObj::getVymLink()
730 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
733 QString scrolledAttr;
735 scrolledAttr=attribut ("scrolled","yes");
740 if (depth<2) posAttr=
741 attribut("absPosX",QString().setNum(absPos.x(),10)) +
742 attribut("absPosY",QString().setNum(absPos.y(),10));
748 urlAttr=attribut ("url",url);
751 if (!vymLink.isEmpty())
752 vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
755 if (frame->getFrameType()!=NoFrame)
756 frameAttr=attribut ("frameType",frame->getFrameTypeName());
760 // save area, if not scrolled
762 if (!((BranchObj*)(parObj))->isScrolled() )
765 attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
766 attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
767 attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
768 attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
773 s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr );
777 s=s+valueElement("heading", getHeading(),
778 attribut ("textColor",QColor(heading->getColor()).name()));
780 // save names of flags set
781 s+=standardFlags->saveToDir(tmpdir,prefix,0);
784 if (!note.isEmpty() )
789 for (bo=branch.first(); bo; bo=branch.next() )
790 s+=bo->saveToDir(tmpdir,prefix,offset);
794 for (fio=floatimage.first(); fio; fio=floatimage.next() )
795 s+=fio->saveToDir (tmpdir,prefix);
799 for (xlo=xlink.first(); xlo; xlo=xlink.next() )
803 s+=endElement ("branch");
807 void BranchObj::addXLink (XLinkObj *xlo)
813 void BranchObj::removeXLinkRef (XLinkObj *xlo)
818 void BranchObj::deleteXLink(XLinkObj *xlo)
821 if (!xlo->isUsed()) delete (xlo);
824 void BranchObj::deleteXLinkAt (int i)
826 XLinkObj *xlo=xlink.at(i);
828 if (!xlo->isUsed()) delete(xlo);
831 int BranchObj::countXLink()
833 return xlink.count();
836 BranchObj* BranchObj::XLinkTargetAt (int i)
839 return xlink.at(i)->otherBranch (this);
844 LinkableMapObj* BranchObj::addFloatImage ()
846 FloatImageObj *newfi=new FloatImageObj (canvas,this);
847 floatimage.append (newfi);
848 if (hasScrolledParent(this) )
849 newfi->setVisibility (false);
851 newfi->setVisibility(visible);
856 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
858 FloatImageObj *newfi=new FloatImageObj (canvas,this);
859 floatimage.append (newfi);
861 if (hasScrolledParent(this) )
862 newfi->setVisibility (false);
864 newfi->setVisibility(visible);
869 FloatImageObj* BranchObj::getFirstFloatImage ()
871 return floatimage.first();
874 FloatImageObj* BranchObj::getLastFloatImage ()
876 return floatimage.last();
879 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
881 return floatimage.at(i);
884 void BranchObj::removeFloatImage (FloatImageObj *fio)
886 floatimage.remove (fio);
890 void BranchObj::savePosInAngle ()
892 // Save position in angle
895 for (b=branch.first(); b; b=branch.next() )
902 BranchObj* BranchObj::addBranch()
904 BranchObj* newbo=new BranchObj(canvas,this);
905 branch.append (newbo);
906 newbo->setParObj(this);
907 newbo->setColor(getColor(),false);
908 newbo->setLinkColor();
909 newbo->setHeading ("new");
910 newbo->setLinkStyle (newbo->getDefLinkStyle());
912 newbo->setVisibility (false);
914 newbo->setVisibility(visible);
920 BranchObj* BranchObj::addBranch(BranchObj* bo)
922 BranchObj* newbo=new BranchObj(canvas,this);
923 branch.append (newbo);
925 newbo->setParObj(this);
926 newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth
927 newbo->setLinkStyle (newbo->getDefLinkStyle());
929 newbo->setVisibility (false);
931 newbo->setVisibility(bo->visible);
937 BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
940 bo->setParObj (this);
942 bo->setLinkStyle (bo->getDefLinkStyle() );
943 if (scrolled) tmpUnscroll();
944 setLastSelectedBranch (bo);
948 BranchObj* BranchObj::insertBranch(int pos)
951 // Add new bo and resort branches
952 BranchObj *newbo=addBranch ();
953 newbo->angle=pos-0.5;
958 BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
961 // Add new bo and resort branches
963 BranchObj *newbo=addBranch (bo);
968 BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
971 // Add new bo and resort branches
974 bo->setParObj (this);
976 bo->setLinkStyle (bo->getDefLinkStyle() );
977 if (scrolled) tmpUnscroll();
978 setLastSelectedBranch (bo);
983 void BranchObj::removeBranch(BranchObj* bo)
985 // if bo is not in branch remove returns false, we
988 if (branch.remove (bo))
991 qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
995 void BranchObj::removeBranchPtr(BranchObj* bo)
1001 void BranchObj::setLastSelectedBranch (BranchObj* bo)
1003 lastSelectedBranch=branch.find(bo);
1006 BranchObj* BranchObj::getLastSelectedBranch ()
1008 if (lastSelectedBranch>=0)
1010 BranchObj* bo=branch.at(lastSelectedBranch);
1013 return branch.first();
1016 BranchObj* BranchObj::getFirstBranch ()
1018 return branch.first();
1021 BranchObj* BranchObj::getLastBranch ()
1023 return branch.last();
1026 BranchObj* BranchObj::getBranchNum (const uint &i)
1028 return branch.at(i);
1032 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
1035 int i=branch.find(bo1);
1037 { // -1 if bo1 not found
1038 branch.at(i)->angle--;
1039 branch.at(i-1)->angle++;
1041 return branch.at(i-1);
1043 return branch.at(i);
1046 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
1049 int i=branch.find(bo1);
1054 branch.at(i)->angle++;
1055 branch.at(j)->angle--;
1057 return branch.at(j);
1059 return branch.at(i);
1062 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
1064 // Find current parent and
1065 // remove pointer to myself there
1067 if (!dst) return NULL;
1069 BranchObj *par=(BranchObj*)(parObj);
1071 par->removeBranchPtr (this);
1075 if (pos<0 || dst->getDepth()==1)
1077 // links adds myself as last branch at dst
1078 dst->addBranchPtr (this);
1082 // inserts me at pos in parent of dst
1083 par=(BranchObj*)(dst->getParObj());
1085 return par->insertBranchPtr (this,pos);
1091 void BranchObj::alignRelativeTo (QPoint ref)
1094 if (!getHeading().isEmpty())
1095 cout << "BO::alignRelTo "<<getHeading()<<endl;
1097 cout << "BO::alignRelTo ???"<<endl;
1098 cout << " d="<<depth<<endl;
1100 int th = bboxTotal.height();
1102 // If I am the mapcenter or a mainbranch, reposition heading
1105 move (absPos.x(),absPos.y());
1108 // Calc angle to mapCenter if I am a mainbranch
1109 // needed for reordering the mainbranches clockwise
1111 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1112 (int)(y() - parObj->getChildPos().y() ) ) );
1117 // Align myself depending on orientation and parent, but
1118 // only if I am not the mainbranch or mapcenter itself
1119 switch (orientation)
1121 case OrientLeftOfCenter:
1122 move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
1124 case OrientRightOfCenter:
1125 move (ref.x(), ref.y() + (th-bbox.height())/2 );
1128 cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
1134 for (fio=floatimage.first(); fio; fio=floatimage.next() )
1137 if (scrolled) return;
1139 // Set reference point for alignment of childs
1141 if (orientation==OrientLeftOfCenter)
1142 ref2.setX(childPos.x() - linkwidth);
1144 ref2.setX(childPos.x() + linkwidth);
1147 ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
1149 ref2.setY(ref.y() );
1151 // Align the childs depending on reference point
1153 for (b=branch.first(); b; b=branch.next() )
1155 b->alignRelativeTo (ref2);
1156 ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
1161 void BranchObj::reposition()
1164 if (!getHeading().isEmpty())
1165 cout << "BO::reposition "<<getHeading()<<endl;
1167 cout << "BO::reposition ???"<<endl;
1171 // only calculate the sizes once. If the deepest LMO
1172 // changes its height,
1173 // all upper LMOs have to change, too.
1174 calcBBoxSizeWithChilds();
1175 alignRelativeTo ( QPoint (absPos.x(),
1176 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1180 // This is only important for moving branches:
1181 // For editing a branch it isn't called...
1182 alignRelativeTo ( QPoint (absPos.x(),
1183 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1188 QRect BranchObj::getTotalBBox()
1192 if (scrolled) return r;
1195 for (b=branch.first();b ;b=branch.next() )
1196 r=addBBox(b->getTotalBBox(),r);
1199 for (fio=floatimage.first();fio ;fio=floatimage.next() )
1200 r=addBBox(fio->getTotalBBox(),r);
1205 QRect BranchObj::getBBoxSizeWithChilds()
1210 void BranchObj::calcBBoxSizeWithChilds()
1212 // This is called only from reposition and
1213 // and only for mapcenter. So it won't be
1214 // called more than once for a single user
1217 // Calculate size of LMO including all childs (to align them later)
1219 bboxTotal.setX(bbox.x() );
1220 bboxTotal.setY(bbox.y() );
1222 // if branch is scrolled, ignore childs, but still consider floatimages
1225 bboxTotal.setWidth (bbox.width());
1226 bboxTotal.setHeight(bbox.height());
1232 // Now calculate recursivly
1234 // maximum of widths
1237 for (b=branch.first();b ;b=branch.next() )
1239 b->calcBBoxSizeWithChilds();
1240 br=b->getBBoxSizeWithChilds();
1241 r.setWidth( max (br.width(), r.width() ));
1242 r.setHeight(br.height() + r.height() );
1243 if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
1245 // Add myself and also
1246 // add width of link to sum if necessary
1247 if (branch.isEmpty())
1248 bboxTotal.setWidth (bbox.width() + r.width() );
1250 bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
1251 bboxTotal.setHeight(max (r.height(), bbox.height() ) );
1252 // frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1255 void BranchObj::select()
1257 LinkableMapObj::select();
1258 // Tell parent that I am selected now:
1259 BranchObj* po=(BranchObj*)(parObj);
1260 if (po) // TODO Try to get rid of this cast...
1261 po->setLastSelectedBranch(this);
1263 // temporary unscroll, if we have scrolled parents somewhere
1264 if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
1266 // set Text in Editor
1267 textEditor->setText(note.getNote() );
1268 textEditor->setFilename(note.getFilenameHint() );
1269 textEditor->setFontHint (note.getFontHint() );
1270 connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) );
1271 connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) );
1273 // Show URL and link in statusbar
1275 if (!url.isEmpty()) status+="URL: "+url+" ";
1276 if (!vymLink.isEmpty()) status+="Link: "+vymLink;
1277 if (!status.isEmpty()) mainWindow->statusMessage (status);
1280 standardFlags->updateToolBar();
1282 // Update Browserbutton
1284 actionEditOpenURL->setEnabled (true);
1286 actionEditOpenURL->setEnabled (false);
1288 // Update actions in mapeditor
1289 mapEditor->updateActions();
1292 void BranchObj::unselect()
1294 LinkableMapObj::unselect();
1295 // Delete any messages like vymLink in StatusBar
1296 mainWindow->statusMessage ("");
1298 // save note from editor and set flag
1299 // text is done by updateNoteFlag(), just save
1301 note.setFilenameHint (textEditor->getFilename());
1303 // reset temporary unscroll, if we have scrolled parents somewhere
1304 if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
1306 // Disconnect textEditor from this LMO
1307 disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
1308 disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 );
1310 // Erase content of editor
1311 textEditor->setInactive();
1313 // unselect all buttons in toolbar
1314 standardFlagsDefault->updateToolBar();
1317 QString BranchObj::getSelectString()
1323 s= "bo:" + QString("%1").arg(getNum());
1325 s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());