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 link.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 (!link.isEmpty())
145 deleteLink (link.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 return branch.findRef (bo);
169 int BranchObj::getFloatImageNum(FloatImageObj *fio)
171 return floatimage.findRef (fio);
174 int BranchObj::countBranches()
176 return branch.count();
179 int BranchObj::countFloatImages()
181 return floatimage.count();
184 int BranchObj::countLinks()
189 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
191 // Temporary link to lmo
192 // m is position of mouse pointer
193 // offset 0: default 1: below lmo -1 above lmo (if possible)
196 BranchObj* o=(BranchObj*)(lmo);
200 // ignore mapcenter and mainbranch
201 if (lmo->getDepth()<2) off=0;
211 // parObj=o->getParObj();
213 // parObj=o->getParObj();
218 depth=parObj->getDepth()+1;
220 // setLinkStyle calls updateLink, only set it once
221 if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
223 // Move temporary to new position at destination
224 // Usually the positioning would be done by reposition(),
225 // but then also the destination branch would "Jump" around...
226 // Better just do it approximately
228 { // new parent is the mapcenter itself
230 QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
231 m.y() - o->getChildPos().y() ));
232 if (p.x()<0) p.setX( p.x()-bbox.width() );
239 // new parent is just a branch, link to it
240 QRect t=o->getBBoxSizeWithChilds();
241 if (o->getLastBranch())
242 y=t.y() + t.height() ;
249 // we want to link above lmo
250 y=o->y() - height() + 5;
252 // we want to link below lmo
253 // Bottom of sel should be 5 pixels above
254 // the bottom of the branch _below_ the target:
255 // Don't try to find that branch, guess 12 pixels
256 y=o->getChildPos().y() -height() + 12;
258 if (o->getOrientation()==OrientLeftOfCenter)
259 move ( o->getChildPos().x() - linkwidth, y );
261 move (o->getChildPos().x() + linkwidth, y );
264 // updateLink is called implicitly in move
265 reposition(); // FIXME shouldn't be this a request?
268 void BranchObj::unsetParObjTmp()
275 depth=parObj->getDepth()+1;
276 setLinkStyle (getDefLinkStyle() );
281 void BranchObj::unScroll()
283 if (tmpUnscrolled) resetTmpUnscroll();
284 if (scrolled) toggleScroll();
287 void BranchObj::toggleScroll()
293 systemFlags->deactivate("scrolledright");
294 for (bo=branch.first(); bo; bo=branch.next() )
296 bo->setVisibility(true);
301 systemFlags->activate("scrolledright");
302 for (bo=branch.first(); bo; bo=branch.next() )
304 bo->setVisibility(false);
309 move (absPos.x(), absPos.y() );
313 bool BranchObj::isScrolled()
318 bool BranchObj::hasScrolledParent(BranchObj *start)
320 // Calls parents recursivly to
321 // find out, if we are scrolled at all.
322 // But ignore myself, just look at parents.
324 if (this !=start && scrolled) return true;
326 BranchObj* bo=(BranchObj*)(parObj);
328 return bo->hasScrolledParent(start);
333 void BranchObj::tmpUnscroll()
335 // Unscroll parent (recursivly)
336 BranchObj* bo=(BranchObj*)(parObj);
337 if (bo) bo->tmpUnscroll();
343 systemFlags->activate("tmpUnscrolledright");
348 void BranchObj::resetTmpUnscroll()
350 // Unscroll parent (recursivly)
351 BranchObj* bo=(BranchObj*)(parObj);
353 bo->resetTmpUnscroll();
359 systemFlags->deactivate("tmpUnscrolledright");
364 void BranchObj::setVisibility(bool v, int toDepth)
366 if (depth <= toDepth)
368 frame->setVisibility(v);
369 heading->setVisibility(v);
370 systemFlags->setVisibility(v);
371 standardFlags->setVisibility(v);
372 LinkableMapObj::setVisibility (v);
374 if (!scrolled && (depth < toDepth))
376 // Now go recursivly through all childs
378 for (b=branch.first(); b;b=branch.next() )
379 b->setVisibility (v,toDepth);
381 for (fio=floatimage.first(); fio; fio=floatimage.next())
382 fio->setVisibility (v);
384 for (lo=link.first(); lo;lo=link.next() )
385 lo->setVisibility ();
387 } // depth <= toDepth
391 void BranchObj::setVisibility(bool v)
393 setVisibility (v,MAX_DEPTH);
397 void BranchObj::setLinkColor ()
399 // Overloaded from LinkableMapObj
400 // BranchObj can use color of heading
402 if (mapEditor->getLinkColorHint()==HeadingColor)
403 LinkableMapObj::setLinkColor (heading->getColor() );
405 LinkableMapObj::setLinkColor ();
408 void BranchObj::setColor (QColor col, bool colorChilds)
410 heading->setColor(col);
415 for (bo=branch.first(); bo; bo=branch.next() )
416 bo->setColor(col,colorChilds);
421 BranchObj* BranchObj::first()
427 BranchObj* BranchObj::next()
430 BranchObj *bo=branch.first();
431 BranchObj *po=(BranchObj*)(parObj);
434 { // We are just beginning at the mapCenter
448 { // We come from above
451 // there are childs, go there
456 { // no childs, try to go up again
468 // can't go up, I am mapCenter
475 // Try to find last child, we came from, in my own childs
477 while (bo && searching)
479 if (itLast==bo) searching=false;
483 { // found lastLMO in my childs
486 // found a brother of lastLMO
502 // can't go up, I am mapCenter
509 // couldn't find last child, it must be a nephew of mine
513 // proceed with my first child
519 // or go back to my parents
530 // can't go up, I am mapCenter
537 BranchObj* BranchObj::getLastIterator()
542 void BranchObj::setLastIterator(BranchObj* it)
548 void BranchObj::move (double x, double y)
550 OrnamentedObj::move (x,y);
554 void BranchObj::move (QPoint p)
559 void BranchObj::moveBy (double x, double y)
561 OrnamentedObj::moveBy (x,y);
564 for (b=branch.first(); b;b=branch.next() )
568 void BranchObj::moveBy (QPoint p)
570 moveBy (p.x(), p.y());
574 void BranchObj::positionBBox()
576 // FIXME testing (optimization)
578 QString h=getHeading();
580 cout << "BO::positionBBox("<<h<<")\n";
582 cout << "BO::positionBBox (noHeading)\n";
585 heading->positionBBox();
586 systemFlags->positionBBox();
587 standardFlags->positionBBox();
588 // It seems that setting x,y also affects width,height
589 int w_old=bbox.width();
590 int h_old=bbox.height();
591 bbox.setX (absPos.x() );
592 bbox.setY (absPos.y() );
593 bbox.setWidth(w_old);
594 bbox.setHeight(h_old);
599 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
601 // Update links to other branches
603 for (l=link.first(); l; l=link.next() )
607 void BranchObj::calcBBoxSize()
609 QSize heading_r=heading->getSize();
610 int heading_w=static_cast <int> (heading_r.width() );
611 int heading_h=static_cast <int> (heading_r.height() );
612 QSize sysflags_r=systemFlags->getSize();
613 int sysflags_h=sysflags_r.height();
614 int sysflags_w=sysflags_r.width();
615 QSize stanflags_r=standardFlags->getSize();
616 int stanflags_h=stanflags_r.height();
617 int stanflags_w=stanflags_r.width();
621 // set width to sum of all widths
622 w=heading_w + sysflags_w + stanflags_w;
623 // set height to maximum needed height
624 h=max (sysflags_h,stanflags_h);
627 w+=frame->getBorder();
628 h+=frame->getBorder();
629 bbox.setSize (QSize (w,h));
632 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
637 for (b=branch.first(); b; b=branch.next() )
639 lmo=b->findMapObj(p, excludeLMO);
640 if (lmo != NULL) return lmo;
644 if (inBBox (p) && (this != excludeLMO) && isVisibleObj() )
647 // Search float images
649 for (foi=floatimage.first(); foi; foi=floatimage.next() )
650 if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
655 void BranchObj::setHeading(QString s)
657 // Adjusting font size
658 QFont font=heading->getFont();
660 font.setPointSize(16);
663 font.setPointSize(10);
665 font.setPointSize(12);
666 heading->setFont(font);
667 heading->setText(s); // set new heading
668 calcBBoxSize(); // recalculate bbox
669 positionBBox(); // rearrange contents
673 void BranchObj::setURL(QString s)
677 systemFlags->activate("url");
679 systemFlags->deactivate("url");
680 calcBBoxSize(); // recalculate bbox
681 positionBBox(); // rearrange contents
685 QString BranchObj::getURL()
690 void BranchObj::setVymLink(QString s)
694 // We need the relative (from loading)
695 // or absolute path (from User event)
696 // and build the absolute path.
697 // Note: If we have relative, use path of
698 // current map to build absolute path
700 if (!d.path().startsWith ("/"))
702 QString p=mapEditor->getDestPath();
703 int i=p.findRev("/",-1);
704 d.setPath(p.left(i)+"/"+s);
708 systemFlags->activate("vymLink");
712 systemFlags->deactivate("vymLink");
715 calcBBoxSize(); // recalculate bbox
716 positionBBox(); // rearrange contents
720 QString BranchObj::getVymLink()
725 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
728 QString scrolledAttr;
730 scrolledAttr=attribut ("scrolled","yes");
735 if (depth<2) posAttr=
736 attribut("absPosX",QString().setNum(absPos.x(),10)) +
737 attribut("absPosY",QString().setNum(absPos.y(),10));
743 urlAttr=attribut ("url",url);
746 if (!vymLink.isEmpty())
747 vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
750 if (frame->getFrameType()!=NoFrame)
751 frameAttr=attribut ("frameType",frame->getFrameTypeName());
755 // save area, if not scrolled
757 if (!((BranchObj*)(parObj))->isScrolled() )
760 attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
761 attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
762 attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
763 attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
768 s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr );
772 s=s+valueElement("heading", getHeading(),
773 attribut ("textColor",QColor(heading->getColor()).name()));
775 // save names of flags set
776 s+=standardFlags->saveToDir(tmpdir,prefix,0);
779 if (!note.isEmpty() )
784 for (bo=branch.first(); bo; bo=branch.next() )
785 s+=bo->saveToDir(tmpdir,prefix,offset);
790 for (fio=floatimage.first(); fio; fio=floatimage.next() )
791 s+=fio->saveToDir (tmpdir,prefix);
793 s+=endElement ("branch");
797 void BranchObj::addLink (LinkObj *lo)
803 void BranchObj::removeLinkRef (LinkObj *lo)
808 void BranchObj::deleteLink(LinkObj *lo)
811 if (!lo->isUsed()) delete (lo);
814 void BranchObj::deleteLinkAt (int i)
816 LinkObj *lo=link.at(i);
824 int BranchObj::countLink()
829 BranchObj* BranchObj::linkTargetAt (int i)
832 return link.at(i)->otherBranch (this);
837 LinkableMapObj* BranchObj::addFloatImage ()
839 FloatImageObj *newfi=new FloatImageObj (canvas,this);
840 floatimage.append (newfi);
841 if (hasScrolledParent(this) )
842 newfi->setVisibility (false);
844 newfi->setVisibility(visible);
849 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
851 FloatImageObj *newfi=new FloatImageObj (canvas,this);
852 floatimage.append (newfi);
854 if (hasScrolledParent(this) )
855 newfi->setVisibility (false);
857 newfi->setVisibility(visible);
862 FloatImageObj* BranchObj::getFirstFloatImage ()
864 return floatimage.first();
867 FloatImageObj* BranchObj::getLastFloatImage ()
869 return floatimage.last();
872 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
874 return floatimage.at(i);
877 void BranchObj::removeFloatImage (FloatImageObj *fio)
879 floatimage.remove (fio);
883 void BranchObj::savePosInAngle ()
885 // Save position in angle
888 for (b=branch.first(); b; b=branch.next() )
895 BranchObj* BranchObj::addBranch()
897 BranchObj* newbo=new BranchObj(canvas,this);
898 branch.append (newbo);
899 newbo->setParObj(this);
900 newbo->setColor(getColor(),false);
901 newbo->setLinkColor();
902 newbo->setHeading ("new");
903 newbo->setLinkStyle (newbo->getDefLinkStyle());
905 newbo->setVisibility (false);
907 newbo->setVisibility(visible);
913 BranchObj* BranchObj::addBranch(BranchObj* bo)
915 BranchObj* newbo=new BranchObj(canvas,this);
916 branch.append (newbo);
918 newbo->setParObj(this);
919 newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth
920 newbo->setLinkStyle (newbo->getDefLinkStyle());
922 newbo->setVisibility (false);
924 newbo->setVisibility(bo->visible);
930 BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
933 bo->setParObj (this);
935 bo->setLinkStyle (bo->getDefLinkStyle() );
936 if (scrolled) tmpUnscroll();
937 setLastSelectedBranch (bo);
941 BranchObj* BranchObj::insertBranch(int pos)
944 // Add new bo and resort branches
945 BranchObj *newbo=addBranch ();
946 newbo->angle=pos-0.5;
951 BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
954 // Add new bo and resort branches
956 BranchObj *newbo=addBranch (bo);
961 BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
964 // Add new bo and resort branches
967 bo->setParObj (this);
969 bo->setLinkStyle (bo->getDefLinkStyle() );
970 if (scrolled) tmpUnscroll();
971 setLastSelectedBranch (bo);
976 void BranchObj::removeBranch(BranchObj* bo)
978 // if bo is not in branch remove returns false, we
981 if (branch.remove (bo))
984 qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
988 void BranchObj::removeBranchPtr(BranchObj* bo)
994 void BranchObj::setLastSelectedBranch (BranchObj* bo)
996 lastSelectedBranch=branch.find(bo);
999 BranchObj* BranchObj::getLastSelectedBranch ()
1001 if (lastSelectedBranch>=0)
1003 BranchObj* bo=branch.at(lastSelectedBranch);
1006 return branch.first();
1009 BranchObj* BranchObj::getFirstBranch ()
1011 return branch.first();
1014 BranchObj* BranchObj::getLastBranch ()
1016 return branch.last();
1019 BranchObj* BranchObj::getBranchNum (const uint &i)
1021 return branch.at(i);
1025 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
1028 int i=branch.find(bo1);
1030 { // -1 if bo1 not found
1031 branch.at(i)->angle--;
1032 branch.at(i-1)->angle++;
1034 return branch.at(i-1);
1036 return branch.at(i);
1039 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
1042 int i=branch.find(bo1);
1047 branch.at(i)->angle++;
1048 branch.at(j)->angle--;
1050 return branch.at(j);
1052 return branch.at(i);
1055 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
1057 // Find current parent and
1058 // remove pointer to myself there
1060 if (!dst) return NULL;
1062 BranchObj *par=(BranchObj*)(parObj);
1064 par->removeBranchPtr (this);
1068 if (pos<0 || dst->getDepth()==1)
1070 // links adds myself as last branch at dst
1071 dst->addBranchPtr (this);
1075 // inserts me at pos in parent of dst
1076 par=(BranchObj*)(dst->getParObj());
1078 return par->insertBranchPtr (this,pos);
1084 void BranchObj::alignRelativeTo (QPoint ref)
1087 if (!getHeading().isEmpty())
1088 cout << "BO::alignRelTo "<<getHeading()<<endl;
1090 cout << "BO::alignRelTo ???"<<endl;
1091 cout << " d="<<depth<<endl;
1093 int th = bboxTotal.height();
1095 // If I am the mapcenter or a mainbranch, reposition heading
1098 move (absPos.x(),absPos.y());
1101 // Calc angle to mapCenter if I am a mainbranch
1102 // needed for reordering the mainbranches clockwise
1104 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1105 (int)(y() - parObj->getChildPos().y() ) ) );
1110 // Align myself depending on orientation and parent, but
1111 // only if I am not the mainbranch or mapcenter itself
1112 switch (orientation)
1114 case OrientLeftOfCenter:
1115 move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
1117 case OrientRightOfCenter:
1118 move (ref.x(), ref.y() + (th-bbox.height())/2 );
1121 cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
1127 for (fio=floatimage.first(); fio; fio=floatimage.next() )
1130 if (scrolled) return;
1132 // Set reference point for alignment of childs
1134 if (orientation==OrientLeftOfCenter)
1135 ref2.setX(childPos.x() - linkwidth);
1137 ref2.setX(childPos.x() + linkwidth);
1140 ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
1142 ref2.setY(ref.y() );
1144 // Align the childs depending on reference point
1146 for (b=branch.first(); b; b=branch.next() )
1148 b->alignRelativeTo (ref2);
1149 ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
1154 void BranchObj::reposition()
1157 if (!getHeading().isEmpty())
1158 cout << "BO::reposition "<<getHeading()<<endl;
1160 cout << "BO::reposition ???"<<endl;
1164 // only calculate the sizes once. If the deepest LMO
1165 // changes its height,
1166 // all upper LMOs have to change, too.
1167 calcBBoxSizeWithChilds();
1168 alignRelativeTo ( QPoint (absPos.x(),
1169 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1173 // This is only important for moving branches:
1174 // For editing a branch it isn't called...
1175 alignRelativeTo ( QPoint (absPos.x(),
1176 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1181 QRect BranchObj::getTotalBBox()
1185 if (scrolled) return r;
1188 for (b=branch.first();b ;b=branch.next() )
1189 r=addBBox(b->getTotalBBox(),r);
1192 for (fio=floatimage.first();fio ;fio=floatimage.next() )
1193 r=addBBox(fio->getTotalBBox(),r);
1198 QRect BranchObj::getBBoxSizeWithChilds()
1203 void BranchObj::calcBBoxSizeWithChilds()
1205 // This is called only from reposition and
1206 // and only for mapcenter. So it won't be
1207 // called more than once for a single user
1210 // Calculate size of LMO including all childs (to align them later)
1212 bboxTotal.setX(bbox.x() );
1213 bboxTotal.setY(bbox.y() );
1215 // if branch is scrolled, ignore childs, but still consider floatimages
1218 bboxTotal.setWidth (bbox.width());
1219 bboxTotal.setHeight(bbox.height());
1225 // Now calculate recursivly
1227 // maximum of widths
1230 for (b=branch.first();b ;b=branch.next() )
1232 b->calcBBoxSizeWithChilds();
1233 br=b->getBBoxSizeWithChilds();
1234 r.setWidth( max (br.width(), r.width() ));
1235 r.setHeight(br.height() + r.height() );
1236 if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
1238 // Add myself and also
1239 // add width of link to sum if necessary
1240 if (branch.isEmpty())
1241 bboxTotal.setWidth (bbox.width() + r.width() );
1243 bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
1244 bboxTotal.setHeight(max (r.height(), bbox.height() ) );
1245 // frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1248 void BranchObj::select()
1250 LinkableMapObj::select();
1251 // Tell parent that I am selected now:
1252 BranchObj* po=(BranchObj*)(parObj);
1253 if (po) // TODO Try to get rid of this cast...
1254 po->setLastSelectedBranch(this);
1256 // temporary unscroll, if we have scrolled parents somewhere
1257 if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
1259 // set Text in Editor
1260 textEditor->setText(note.getNote() );
1261 textEditor->setFilename(note.getFilenameHint() );
1262 textEditor->setFontHint (note.getFontHint() );
1263 connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) );
1264 connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) );
1266 // Show URL and link in statusbar
1268 if (!url.isEmpty()) status+="URL: "+url+" ";
1269 if (!vymLink.isEmpty()) status+="Link: "+vymLink;
1270 if (!status.isEmpty()) mainWindow->statusMessage (status);
1273 standardFlags->updateToolBar();
1275 // Update Browserbutton
1277 actionEditOpenURL->setEnabled (true);
1279 actionEditOpenURL->setEnabled (false);
1281 // Update actions in mapeditor
1282 mapEditor->updateActions();
1285 void BranchObj::unselect()
1287 LinkableMapObj::unselect();
1288 // Delete any messages like vymLink in StatusBar
1289 mainWindow->statusMessage ("");
1291 // save note from editor and set flag
1292 // text is done by updateNoteFlag(), just save
1294 note.setFilenameHint (textEditor->getFilename());
1296 // reset temporary unscroll, if we have scrolled parents somewhere
1297 if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
1299 // Disconnect textEditor from this LMO
1300 disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
1301 disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 );
1303 // Erase content of editor
1304 textEditor->setInactive();
1306 // unselect all buttons in toolbar
1307 standardFlagsDefault->updateToolBar();
1310 QString BranchObj::getSelectString()
1315 if (parObj->getDepth()==0)
1316 s= "bo:" + QString("%1").arg(getNum());
1318 s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());