branchitem.cpp
changeset 776 25e634a7e1dc
parent 775 6e4b586aa88a
child 777 8acac4fade1b
     1.1 --- a/branchitem.cpp	Wed Jun 03 20:37:17 2009 +0000
     1.2 +++ b/branchitem.cpp	Mon Jun 08 11:36:56 2009 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  
     1.5  using namespace std;
     1.6  
     1.7 -BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
     1.8 +BranchItem::BranchItem(const QList<QVariant> &data, MapItem *parent):MapItem (data,parent)
     1.9  {
    1.10  	//cout << "Constr. BranchItem\n";
    1.11  
    1.12 @@ -18,7 +18,7 @@
    1.13  
    1.14  BranchItem::~BranchItem()
    1.15  {
    1.16 -	//cout << "Destr. BranchItem "<<getHeadingStd()<<endl;
    1.17 +	cout << "Destr. BranchItem "<<getHeadingStd()<<endl;
    1.18  	if (lmo) 
    1.19  	{
    1.20  		delete lmo;
    1.21 @@ -94,7 +94,6 @@
    1.22  
    1.23      s=beginElement (elementName
    1.24  		+getAttr()
    1.25 -	//	+getOrnXMLAttr() 
    1.26  		+scrolledAttr 
    1.27  	//	+areaAttr 
    1.28  	//	+idAttr 
    1.29 @@ -115,11 +114,9 @@
    1.30  	// save names of flags set
    1.31  	s+=standardFlags.saveToDir(tmpdir,prefix,0);
    1.32  	
    1.33 -/*	
    1.34 -	// Save FloatImages
    1.35 -	for (int i=0; i<floatimage.size(); ++i)
    1.36 -		s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
    1.37 -*/
    1.38 +	// Save Images
    1.39 +	for (int i=0; i<imageCount(); ++i)
    1.40 +		s+=getImageNum(i)->saveToDir (tmpdir,prefix);
    1.41  
    1.42  	// save note
    1.43  	if (!note.isEmpty() )
    1.44 @@ -310,15 +307,19 @@
    1.45      if (getBranchObj()->isInClickBox (p) && (this != excludeTI) && getBranchObj()->isVisibleObj() ) 
    1.46  		return this;
    1.47  
    1.48 -/* FIXME-2 // Search float images
    1.49 -    for (int i=0; i<floatimage.size(); ++i )
    1.50 -		if (floatimage.at(i)->isInClickBox(p) && 
    1.51 -			(floatimage.at(i) != excludeTI) && 
    1.52 -			floatimage.at(i)->getParObj()!= excludeTI &&
    1.53 -			floatimage.at(i)->isVisibleObj() 
    1.54 -		) return floatimage.at(i)->getTreeItem();
    1.55 -*/
    1.56 -    return NULL;
    1.57 +	// Search images
    1.58 +	ImageItem *ii;
    1.59 +    for (int i=0; i<imageCount(); ++i )
    1.60 +	{
    1.61 +		ii=getImageNum (i);
    1.62 +		LinkableMapObj *mo=ii->getLMO();
    1.63 +		if (mo && mo->isInClickBox(p) && 
    1.64 +			(ii != excludeTI) && 
    1.65 +			this!= excludeTI &&
    1.66 +			mo->isVisibleObj() 
    1.67 +		) return ii;
    1.68 +	}
    1.69 +	return NULL;
    1.70  }
    1.71  
    1.72  TreeItem* BranchItem::findID (QString sid)
    1.73 @@ -353,7 +354,7 @@
    1.74  
    1.75  	if (lmo)
    1.76  	{
    1.77 -		lmo->setParObj (parentItem->getLMO() );
    1.78 +		lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
    1.79  	}
    1.80  }
    1.81  
    1.82 @@ -375,9 +376,9 @@
    1.83  		newbo->setFrameType (FrameObj::Rectangle);
    1.84  	} else
    1.85  	{
    1.86 -		newbo->setParObj(parentItem->getLMO() );
    1.87 +		newbo->setParObj( ((MapItem*)parentItem)->getLMO() );
    1.88  		// Set visibility depending on parents
    1.89 -		if (((BranchItem*)parentItem)->scrolled || !parentItem->getLMO()->isVisibleObj() )
    1.90 +		if (((BranchItem*)parentItem)->scrolled || !((MapItem*)parentItem)->getLMO()->isVisibleObj() )
    1.91  			newbo->setVisibility (false);
    1.92  	}
    1.93  	newbo->setDefAttr(BranchObj::NewBranch);