mapcenterobj.cpp
changeset 169 aa48c7b52549
parent 166 325958acb69b
child 181 bd530b01f77f
     1.1 --- a/mapcenterobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.2 +++ b/mapcenterobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.3 @@ -46,13 +46,11 @@
     1.4  void MapCenterObj::move (double x, double y)
     1.5  {
     1.6  	BranchObj::move(x,y);
     1.7 -	positionBBox();
     1.8  }
     1.9  
    1.10  void MapCenterObj::moveBy (double x, double y)
    1.11  {
    1.12 -	//BranchObj::moveBy(x,y);
    1.13 -	move (x+absPos.x(),y+absPos.y() );
    1.14 +	BranchObj::moveBy(x,y);
    1.15  	positionBBox();
    1.16  }
    1.17  
    1.18 @@ -77,9 +75,8 @@
    1.19  void MapCenterObj::updateLink()
    1.20  {
    1.21  	// set childPos to middle of MapCenterObj
    1.22 -	childPos=QPoint(
    1.23 -		absPos.x() + QSize(getSize() ).width()/2, 
    1.24 -		absPos.y() + QSize(getSize() ).height()/2);
    1.25 +	childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
    1.26 +	childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
    1.27  	parPos=childPos;		
    1.28  	BranchObj *b;
    1.29  	for (b=branch.first(); b; b=branch.next() )
    1.30 @@ -95,19 +92,15 @@
    1.31  	for (bo=branch.first(); bo; bo=branch.next() )
    1.32  	{	
    1.33  		lmo = bo->findMapObj(p, excludeLMO);
    1.34 -		
    1.35 -		if (lmo!= NULL) 
    1.36 -		{
    1.37 -			return lmo;
    1.38 -		}	
    1.39 +		if (lmo!= NULL) return lmo;
    1.40  	}
    1.41  	// is p in MapCenter?
    1.42 -	if (inBBox (p) && (this != excludeLMO) ) return this;
    1.43 +	if (inBox (p) && (this != excludeLMO) ) return this;
    1.44  
    1.45  	// Search float images
    1.46  	FloatImageObj *foi;
    1.47  	for (foi=floatimage.first(); foi; foi=floatimage.next() )
    1.48 -		if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
    1.49 +		if (foi->inBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
    1.50  
    1.51  	// nothing found
    1.52  	return NULL;
    1.53 @@ -124,9 +117,29 @@
    1.54  		attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
    1.55  		attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
    1.56  	
    1.57 +	// Providing an ID for a branch makes export to XHTML easier
    1.58 +	QString idAttr;
    1.59 +	if (countXLinks()>0)
    1.60 +		idAttr=attribut ("id",getSelectString());
    1.61 +	else
    1.62 +		idAttr="";
    1.63 +
    1.64 +	QString linkAttr=getLinkAttr();
    1.65 +
    1.66 +	QString urlAttr;
    1.67 +	if (!url.isEmpty())
    1.68 +		urlAttr=attribut ("url",url);
    1.69 +	QString vymLinkAttr;
    1.70 +	if (!vymLink.isEmpty())
    1.71 +		vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
    1.72 +
    1.73      s=beginElement ("mapcenter" 
    1.74  		+attribut("absPosX",QString().setNum(absPos.x(),10))
    1.75  		+attribut("absPosY",QString().setNum(absPos.y(),10))
    1.76 +		+vymLinkAttr
    1.77 +		+urlAttr
    1.78 +		+linkAttr
    1.79 +		+idAttr
    1.80  		+attribut("frameType",frame->getFrameTypeName()) 
    1.81  		+areaAttr 
    1.82  		);