Fixed broken xLink handling
authorinsilmaril
Tue, 04 Sep 2007 13:53:33 +0000
changeset 59697b9507f5e2b
parent 595 0bd62e09d061
child 597 61b05137cc6f
Fixed broken xLink handling
xml-vym.cpp
     1.1 --- a/xml-vym.cpp	Tue Sep 04 13:53:33 2007 +0000
     1.2 +++ b/xml-vym.cpp	Tue Sep 04 13:53:33 2007 +0000
     1.3 @@ -349,54 +349,6 @@
     1.4      return "the document is not in the VYM file format";
     1.5  }
     1.6  
     1.7 -/*
     1.8 -bool parseVYMHandler::fatalError( const QXmlParseException& exception ) 
     1.9 -{
    1.10 -    errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
    1.11 -    .arg( exception.message() )
    1.12 -    .arg( exception.lineNumber() )
    1.13 -    .arg( exception.columnNumber() );
    1.14 -	// Try to read the bogus line
    1.15 -	errorProt+=QString("File is: %1\n").arg(inputFile);
    1.16 -	QString s;
    1.17 -	if (loadStringFromDisk (inputFile,s))
    1.18 -	{
    1.19 -		QStringList sl=QStringList::split ("\n",s);
    1.20 -		int i=1;
    1.21 -		QStringList::Iterator it = sl.begin();
    1.22 -		while (i<exception.lineNumber()-1)
    1.23 -		{
    1.24 -			it++;
    1.25 -			i++;
    1.26 -		}
    1.27 -		s=*it;
    1.28 -		s.insert (exception.columnNumber()-1,"<ERROR>");
    1.29 -		errorProt+=s;
    1.30 -    }
    1.31 -    return QXmlDefaultHandler::fatalError( exception );
    1.32 -}
    1.33 -
    1.34 -void parseVYMHandler::setMapEditor (MapEditor* e)
    1.35 -{
    1.36 -    me=e;
    1.37 -	mc=me->getMapCenter();
    1.38 -}
    1.39 -
    1.40 -void parseVYMHandler::setTmpDir (QString tp)
    1.41 -{
    1.42 -	tmpDir=tp;
    1.43 -}
    1.44 -
    1.45 -void parseVYMHandler::setInputFile (QString f)
    1.46 -{
    1.47 -	inputFile=f;
    1.48 -}
    1.49 -
    1.50 -void parseVYMHandler::setLoadMode (const LoadMode &lm)
    1.51 -{
    1.52 -	loadMode=lm;
    1.53 -}
    1.54 -*/
    1.55  bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
    1.56  {
    1.57  	lastOO=lastBranch;
    1.58 @@ -572,7 +524,7 @@
    1.59  	}	
    1.60  	if (!a.value( "zPlane").isEmpty() ) 
    1.61  		lastFloat->setZValue (a.value("zPlane").toInt ());
    1.62 -    int x,y;
    1.63 +    float x,y;
    1.64      bool okx,oky;
    1.65  	if (!a.value( "relPosX").isEmpty() ) 
    1.66  	{
    1.67 @@ -584,7 +536,7 @@
    1.68  			if (okx && oky) 
    1.69  				
    1.70  				{
    1.71 -					lastFloat->setRelPos (QPoint (x,y) );
    1.72 +					lastFloat->setRelPos (QPointF (x,y) );
    1.73  					// make sure floats in mapcenter are repositioned to relative pos
    1.74  					if (mc==lastBranch) mc->positionContents();
    1.75  				}
    1.76 @@ -634,9 +586,9 @@
    1.77  				{
    1.78  					xlo->setEnd ((BranchObj*)(lmo));
    1.79  					xlo->activate();
    1.80 +					success=true;
    1.81  				}
    1.82  			}
    1.83 -			success=true; // Not all branches there yet, no error
    1.84  		}           
    1.85  	}	
    1.86  
    1.87 @@ -645,7 +597,7 @@
    1.88  	{ 
    1.89  		if (!a.value( "endID").isEmpty() ) 
    1.90  		{
    1.91 -			LinkableMapObj *lmo=mc->findID (a.value( "beginBranch"));
    1.92 +			LinkableMapObj *lmo=mc->findID (a.value( "beginID"));
    1.93  			if (lmo && typeid (*lmo)==typeid (BranchObj))
    1.94  			{
    1.95  				xlo->setBegin ((BranchObj*)lmo);
    1.96 @@ -654,13 +606,13 @@
    1.97  				{
    1.98  					xlo->setEnd ((BranchObj*)(lmo));
    1.99  					xlo->activate();
   1.100 +					success=true;
   1.101  				}
   1.102  			}
   1.103 -			success=true; // Not all branches there yet, no error
   1.104  		}           
   1.105  	}	
   1.106  	if (!success) delete (xlo);
   1.107 -	return success;
   1.108 +	return true;	// xLinks can only be established at the "end branch", return true
   1.109  }
   1.110  
   1.111  bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)