diff -r 914f330b6aa8 -r 25a77484ec72 treeitem.cpp --- a/treeitem.cpp Thu Apr 02 09:57:47 2009 +0000 +++ b/treeitem.cpp Tue Apr 07 16:15:53 2009 +0000 @@ -24,6 +24,8 @@ note.setNote(""); // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2 // isNoteInEditor=false; + + hidden=false; } TreeItem::~TreeItem() @@ -39,11 +41,12 @@ /* -void TreeItem::copy (OrnamentedObj* other) //FIXME-2 +void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data! { note.copy (other->note); model=other->model; + hideExport=other->hideExport; } */ @@ -186,17 +189,22 @@ itemData[0]=s; } -QString TreeItem::getHeading () +QString TreeItem::getHeading () const { return itemData[0].toString(); } +std::string TreeItem::headingStd () const +{ + return itemData[0].toString().toStdString(); +} + void TreeItem::setNote(const QString s) { note.setNote(s); // updateNoteFlag(); FIXME-2 needed? if (model) - model->emitContentHasChanged (this); + model->emitNoteHasChanged (this); } void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) @@ -204,7 +212,7 @@ note=n; // updateNoteFlag(); FIXME-2 needed? if (model && updateNoteEditor) - model->emitContentHasChanged (this); + model->emitNoteHasChanged (this); } QString TreeItem::getNote() @@ -243,6 +251,12 @@ return type; } +bool TreeItem::isBranchLikeType() const +{ + if (type==Branch ||type==MapCenter) return true; + return false; +} + QString TreeItem::getTypeName() { switch (type) @@ -308,6 +322,94 @@ return getBranchNum (lastSelectedBranchNum); } + +void TreeItem::setHideTmp (HideTmpMode mode) +{ + if (isBranchLikeType() ) + ((BranchItem*)this)->updateVisibility(); + /* + if (type==Image) + //updateVisibility(); + */ + +/* + + if (mode==HideExport && (hideExport || hasHiddenExportParent() ) ) + { + // Hide stuff according to hideExport flag and parents + //setVisibility (false); + updateVisibility(); + //FIXME-2 hidden=true; + }else + { + // Do not hide, but still take care of scrolled status + + + XXXXXXXX treeItem should be THIS + + move visible to TreeItem??? + + BranchObj now has updateContents + + maybe also start "bool TreeItem::branchlikeType" + + + + if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem)) + setVisibility (false); + else + setVisibility (true); + //FIXME-2 hidden=false; + } + +*/ + // And take care of my children + for (int i=0; isetHideTmp (mode); +} + +bool TreeItem::hasHiddenExportParent() +{ + // Calls parents recursivly to + // find out, if we or parents are temp. hidden + + if (hidden || hideExport) return true; + + if (parentItem) + return parentItem->hasHiddenExportParent(); + else + return false; +} + + +void TreeItem::setHideInExport(bool b) +{ + if (isBranchLikeType() ) + { + hideExport=b; + /* FIXME-1 call setVis and updateContentsSize... + if (b) + systemFlags->activate("hideInExport"); + else + systemFlags->deactivate("hideInExport"); + calcBBoxSize(); + positionBBox(); + requestReposition(); + */ + } +} + +bool TreeItem::hideInExport() +{ + return hideExport; +} + +bool TreeItem::isHidden() +{ + return hidden; +} + + LinkableMapObj* TreeItem::getLMO() // FIXME-3 VM should be unnecessary in the end { return lmo;