treeitem.cpp
changeset 753 25a77484ec72
parent 750 ff3b01ce0960
child 754 db0ec4bcf416
     1.1 --- a/treeitem.cpp	Thu Apr 02 09:57:47 2009 +0000
     1.2 +++ b/treeitem.cpp	Tue Apr 07 16:15:53 2009 +0000
     1.3 @@ -24,6 +24,8 @@
     1.4  	note.setNote(""); 
     1.5  	// note.setFontHint (textEditor->getFontHintDefault() );	//FIXME-2
     1.6  	// isNoteInEditor=false;
     1.7 +
     1.8 +	hidden=false;
     1.9  }
    1.10  
    1.11  TreeItem::~TreeItem()
    1.12 @@ -39,11 +41,12 @@
    1.13  
    1.14  
    1.15  /*
    1.16 -void TreeItem::copy (OrnamentedObj* other)	//FIXME-2
    1.17 +void TreeItem::copy (OrnamentedObj* other)	//FIXME-2	probably need deep copy of branches and data!
    1.18  
    1.19  {
    1.20  	note.copy (other->note);
    1.21  	model=other->model;
    1.22 +	hideExport=other->hideExport;
    1.23  }
    1.24  */
    1.25  
    1.26 @@ -186,17 +189,22 @@
    1.27  	itemData[0]=s;
    1.28  }
    1.29  
    1.30 -QString TreeItem::getHeading ()
    1.31 +QString TreeItem::getHeading () const
    1.32  {
    1.33  	return itemData[0].toString();
    1.34  }
    1.35  
    1.36 +std::string TreeItem::headingStd () const
    1.37 +{
    1.38 +	return itemData[0].toString().toStdString();
    1.39 +}
    1.40 +
    1.41  void TreeItem::setNote(const QString s)
    1.42  {
    1.43  	note.setNote(s);
    1.44  	// updateNoteFlag();  FIXME-2 needed?
    1.45  	if (model) 
    1.46 -		model->emitContentHasChanged (this);
    1.47 +		model->emitNoteHasChanged (this);
    1.48  }
    1.49  
    1.50  void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor)
    1.51 @@ -204,7 +212,7 @@
    1.52  	note=n;
    1.53  	// updateNoteFlag();  FIXME-2 needed?
    1.54  	if (model && updateNoteEditor)	
    1.55 -		model->emitContentHasChanged (this);
    1.56 +		model->emitNoteHasChanged (this);
    1.57  }
    1.58  
    1.59  QString TreeItem::getNote()
    1.60 @@ -243,6 +251,12 @@
    1.61  	return type;
    1.62  }
    1.63  
    1.64 +bool TreeItem::isBranchLikeType() const
    1.65 +{
    1.66 +	if (type==Branch ||type==MapCenter) return true;
    1.67 +	return false;
    1.68 +}
    1.69 +
    1.70  QString TreeItem::getTypeName()
    1.71  {
    1.72  	switch (type)
    1.73 @@ -308,6 +322,94 @@
    1.74  	return getBranchNum (lastSelectedBranchNum);
    1.75  }
    1.76  
    1.77 +
    1.78 +void TreeItem::setHideTmp (HideTmpMode mode)
    1.79 +{
    1.80 +	if (isBranchLikeType() )
    1.81 +		((BranchItem*)this)->updateVisibility();
    1.82 +		/*
    1.83 +	if (type==Image)
    1.84 +		//updateVisibility();
    1.85 +	*/
    1.86 +
    1.87 +/*
    1.88 +
    1.89 +		if (mode==HideExport && (hideExport || hasHiddenExportParent() ) )
    1.90 +		{
    1.91 +			// Hide stuff according to hideExport flag and parents
    1.92 +			//setVisibility (false);
    1.93 +			updateVisibility();
    1.94 +			//FIXME-2 hidden=true;
    1.95 +		}else
    1.96 +		{
    1.97 +			// Do not hide, but still take care of scrolled status
    1.98 +			
    1.99 +
   1.100 +			XXXXXXXX treeItem should be THIS
   1.101 +
   1.102 +			move visible to TreeItem???
   1.103 +
   1.104 +			BranchObj now has updateContents
   1.105 +
   1.106 +			maybe also start "bool TreeItem::branchlikeType"
   1.107 +
   1.108 +
   1.109 +
   1.110 +			if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
   1.111 +				setVisibility (false);
   1.112 +			else
   1.113 +				setVisibility (true);
   1.114 +			//FIXME-2 hidden=false;
   1.115 +		}	
   1.116 +
   1.117 +*/
   1.118 +		// And take care of my children
   1.119 +		for (int i=0; i<branchCount(); ++i)
   1.120 +			getBranchNum(i)->setHideTmp (mode);
   1.121 +}
   1.122 +
   1.123 +bool TreeItem::hasHiddenExportParent()
   1.124 +{
   1.125 +	// Calls parents recursivly to
   1.126 +	// find out, if we or parents are temp. hidden
   1.127 +
   1.128 +	if (hidden || hideExport) return true;
   1.129 +
   1.130 +	if (parentItem) 
   1.131 +		return parentItem->hasHiddenExportParent();
   1.132 +	else
   1.133 +		return false;
   1.134 +}
   1.135 +
   1.136 +
   1.137 +void TreeItem::setHideInExport(bool b) 
   1.138 +{
   1.139 +	if (isBranchLikeType() )
   1.140 +	{
   1.141 +		hideExport=b;
   1.142 +		/* FIXME-1 call setVis and updateContentsSize...
   1.143 +		if (b)
   1.144 +			systemFlags->activate("hideInExport");
   1.145 +		else	
   1.146 +			systemFlags->deactivate("hideInExport");
   1.147 +		calcBBoxSize();
   1.148 +		positionBBox();
   1.149 +		requestReposition();	
   1.150 +		*/
   1.151 +	}
   1.152 +}	
   1.153 +
   1.154 +bool TreeItem::hideInExport()
   1.155 +{
   1.156 +	return hideExport;
   1.157 +}	
   1.158 +
   1.159 +bool TreeItem::isHidden()
   1.160 +{
   1.161 +	return hidden;
   1.162 +}	
   1.163 +
   1.164 +
   1.165  LinkableMapObj* TreeItem::getLMO()	// FIXME-3  VM should be unnecessary in the end
   1.166  {
   1.167  	return lmo;