# HG changeset patch # User insilmaril # Date 1188914013 0 # Node ID 97b9507f5e2b6c6f30ca40c5c02bdd41b1d05d44 # Parent 0bd62e09d06133eaf6ba6c97f2f1526912985597 Fixed broken xLink handling diff -r 0bd62e09d061 -r 97b9507f5e2b xml-vym.cpp --- a/xml-vym.cpp Tue Sep 04 13:53:33 2007 +0000 +++ b/xml-vym.cpp Tue Sep 04 13:53:33 2007 +0000 @@ -349,54 +349,6 @@ return "the document is not in the VYM file format"; } -/* -bool parseVYMHandler::fatalError( const QXmlParseException& exception ) -{ - errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n") - .arg( exception.message() ) - .arg( exception.lineNumber() ) - .arg( exception.columnNumber() ); - // Try to read the bogus line - errorProt+=QString("File is: %1\n").arg(inputFile); - QString s; - if (loadStringFromDisk (inputFile,s)) - { - QStringList sl=QStringList::split ("\n",s); - int i=1; - QStringList::Iterator it = sl.begin(); - while (i"); - errorProt+=s; - } - return QXmlDefaultHandler::fatalError( exception ); -} - -void parseVYMHandler::setMapEditor (MapEditor* e) -{ - me=e; - mc=me->getMapCenter(); -} - -void parseVYMHandler::setTmpDir (QString tp) -{ - tmpDir=tp; -} - -void parseVYMHandler::setInputFile (QString f) -{ - inputFile=f; -} - -void parseVYMHandler::setLoadMode (const LoadMode &lm) -{ - loadMode=lm; -} -*/ bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a) { lastOO=lastBranch; @@ -572,7 +524,7 @@ } if (!a.value( "zPlane").isEmpty() ) lastFloat->setZValue (a.value("zPlane").toInt ()); - int x,y; + float x,y; bool okx,oky; if (!a.value( "relPosX").isEmpty() ) { @@ -584,7 +536,7 @@ if (okx && oky) { - lastFloat->setRelPos (QPoint (x,y) ); + lastFloat->setRelPos (QPointF (x,y) ); // make sure floats in mapcenter are repositioned to relative pos if (mc==lastBranch) mc->positionContents(); } @@ -634,9 +586,9 @@ { xlo->setEnd ((BranchObj*)(lmo)); xlo->activate(); + success=true; } } - success=true; // Not all branches there yet, no error } } @@ -645,7 +597,7 @@ { if (!a.value( "endID").isEmpty() ) { - LinkableMapObj *lmo=mc->findID (a.value( "beginBranch")); + LinkableMapObj *lmo=mc->findID (a.value( "beginID")); if (lmo && typeid (*lmo)==typeid (BranchObj)) { xlo->setBegin ((BranchObj*)lmo); @@ -654,13 +606,13 @@ { xlo->setEnd ((BranchObj*)(lmo)); xlo->activate(); + success=true; } } - success=true; // Not all branches there yet, no error } } if (!success) delete (xlo); - return success; + return true; // xLinks can only be established at the "end branch", return true } bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)