xml.cpp
changeset 160 72cc3873306a
parent 106 4083860dd82e
child 166 325958acb69b
     1.1 --- a/xml.cpp	Thu Sep 01 15:35:18 2005 +0000
     1.2 +++ b/xml.cpp	Mon Sep 05 11:56:31 2005 +0000
     1.3 @@ -13,6 +13,7 @@
     1.4  
     1.5  static BranchObj *lastBranch;
     1.6  static FloatObj *lastFloat;
     1.7 +static LinkableMapObj *lastLMO;
     1.8  
     1.9  extern Settings settings;
    1.10  
    1.11 @@ -139,7 +140,7 @@
    1.12  			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
    1.13  			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
    1.14  			{
    1.15 -				lastBranch=(BranchObj*)(lmo);
    1.16 +				lastBranch=(BranchObj*)lmo;
    1.17  				if (loadMode==ImportAdd)
    1.18  				{
    1.19  					lastBranch->addBranch();
    1.20 @@ -197,6 +198,7 @@
    1.21  			{
    1.22  				lastBranch->addBranch();
    1.23  				lastBranch=lastBranch->getLastBranch();
    1.24 +				
    1.25  			} else
    1.26  				lastBranch->clear();
    1.27  		} else
    1.28 @@ -398,6 +400,9 @@
    1.29  
    1.30  bool mapBuilderHandler::readBranchAttr (const QXmlAttributes& a)
    1.31  {
    1.32 +	lastLMO=lastBranch;
    1.33 +	if (!readLinkAttr(a)) return false;
    1.34 +
    1.35  	bool okx,oky;
    1.36  	int x,y;
    1.37  	if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
    1.38 @@ -423,6 +428,16 @@
    1.39  	return true;	
    1.40  }
    1.41  
    1.42 +bool mapBuilderHandler::readLinkAttr (const QXmlAttributes& a)
    1.43 +{
    1.44 +	if (!a.value( "hideLinkUnselected").isEmpty()) 
    1.45 +	{
    1.46 +		if (a.value ("hideLinkUnselected") =="true")
    1.47 +			if (lastLMO) lastLMO->setHideLinkUnselected(true);
    1.48 +	}	
    1.49 +	return true;	
    1.50 +}
    1.51 +
    1.52  bool mapBuilderHandler::readNoteAttr (const QXmlAttributes& a)
    1.53  {	// only for backward compatibility (<1.4.6). Use htmlnote now.
    1.54  	no.clear();
    1.55 @@ -471,6 +486,9 @@
    1.56  
    1.57  bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
    1.58  {
    1.59 +	lastLMO=lastFloat;
    1.60 +	if (!readLinkAttr(a)) return false;
    1.61 +	
    1.62  	if (!a.value( "useOrientation").isEmpty() ) 
    1.63  	{
    1.64  		if (a.value ("useOrientation") =="true")