1.1 --- a/xml.cpp Tue Mar 14 14:27:04 2006 +0000
1.2 +++ b/xml.cpp Mon Apr 10 11:21:35 2006 +0000
1.3 @@ -13,7 +13,7 @@
1.4
1.5 static BranchObj *lastBranch;
1.6 static FloatObj *lastFloat;
1.7 -static LinkableMapObj *lastLMO;
1.8 +static OrnamentedObj *lastOO;
1.9
1.10 extern Settings settings;
1.11
1.12 @@ -388,13 +388,14 @@
1.13 .arg( exception.lineNumber() )
1.14 .arg( exception.columnNumber() );
1.15 // Try to read the bogus line
1.16 + errorProt+=QString("File is: %1\n").arg(inputFile);
1.17 QString s;
1.18 if (loadStringFromDisk (inputFile,s))
1.19 {
1.20 QStringList sl=QStringList::split ("\n",s);
1.21 int i=1;
1.22 QStringList::Iterator it = sl.begin();
1.23 - while (i<exception.lineNumber())
1.24 + while (i<exception.lineNumber()-1)
1.25 {
1.26 it++;
1.27 i++;
1.28 @@ -429,43 +430,8 @@
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 - {
1.39 - if (!a.value( "absPosY").isEmpty() )
1.40 - {
1.41 - x=a.value("absPosX").toInt (&okx, 10);
1.42 - y=a.value("absPosY").toInt (&oky, 10);
1.43 - if (okx && oky )
1.44 - lastBranch->move(x,y);
1.45 - else
1.46 - return false; // Couldn't read absPos
1.47 - }
1.48 - }
1.49 - if (!a.value( "relPosX").isEmpty() && loadMode==NewMap && branchDepth<9)
1.50 - {
1.51 - if (!a.value( "relPosY").isEmpty() )
1.52 - {
1.53 - float fx,fy;
1.54 - fx=a.value("relPosX").toFloat (&okx);
1.55 - fy=a.value("relPosY").toFloat (&oky);
1.56 - if (okx && oky )
1.57 - lastBranch->move2RelPos ((int)fx,(int)fy);
1.58 - else
1.59 - return false; // Couldn't read relPos
1.60 - }
1.61 - }
1.62 - if (!a.value( "url").isEmpty() )
1.63 - lastBranch->setURL (a.value ("url"));
1.64 - if (!a.value( "vymLink").isEmpty() )
1.65 - lastBranch->setVymLink (a.value ("vymLink"));
1.66 - if (!a.value( "hideInExport").isEmpty() )
1.67 - if (a.value("hideInExport")=="true")
1.68 - lastBranch->setHideInExport(true);
1.69 + lastOO=lastBranch;
1.70 + if (!readOOAttr(a)) return false;
1.71
1.72 if (!a.value( "scrolled").isEmpty() )
1.73 lastBranch->toggleScroll();
1.74 @@ -489,16 +455,38 @@
1.75 return true;
1.76 }
1.77
1.78 -bool mapBuilderHandler::readLinkAttr (const QXmlAttributes& a)
1.79 +bool mapBuilderHandler::readOOAttr (const QXmlAttributes& a)
1.80 {
1.81 - if (lastLMO)
1.82 + if (lastOO)
1.83 {
1.84 + bool okx,oky;
1.85 + int x,y;
1.86 + if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2)
1.87 + {
1.88 + if (!a.value( "absPosY").isEmpty() )
1.89 + {
1.90 + x=a.value("absPosX").toInt (&okx, 10);
1.91 + y=a.value("absPosY").toInt (&oky, 10);
1.92 + if (okx && oky )
1.93 + lastOO->move(x,y);
1.94 + else
1.95 + return false; // Couldn't read absPos
1.96 + }
1.97 + }
1.98 + if (!a.value( "url").isEmpty() )
1.99 + lastOO->setURL (a.value ("url"));
1.100 + if (!a.value( "vymLink").isEmpty() )
1.101 + lastOO->setVymLink (a.value ("vymLink"));
1.102 + if (!a.value( "hideInExport").isEmpty() )
1.103 + if (a.value("hideInExport")=="true")
1.104 + lastOO->setHideInExport(true);
1.105 +
1.106 if (!a.value( "hideLink").isEmpty())
1.107 {
1.108 if (a.value ("hideLink") =="true")
1.109 - lastLMO->setHideLinkUnselected(true);
1.110 + lastOO->setHideLinkUnselected(true);
1.111 else
1.112 - lastLMO->setHideLinkUnselected(false);
1.113 + lastOO->setHideLinkUnselected(false);
1.114 }
1.115 }
1.116 return true;
1.117 @@ -552,8 +540,10 @@
1.118
1.119 bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
1.120 {
1.121 - lastLMO=lastFloat;
1.122 + lastOO=lastFloat;
1.123
1.124 + //if (!readOOAttr(a)) return false;
1.125 +
1.126 if (!a.value( "useOrientation").isEmpty() )
1.127 {
1.128 if (a.value ("useOrientation") =="true")
1.129 @@ -576,8 +566,9 @@
1.130 }
1.131 if (!a.value( "floatExport").isEmpty() )
1.132 {
1.133 + // Only for compatibility. THis is not used since 1.7.11
1.134 if (a.value ("floatExport") =="true")
1.135 - lastFloat->setFloatExport (true);
1.136 + lastFloat->setFloatExport(true);
1.137 else
1.138 lastFloat->setFloatExport (false);
1.139 }
1.140 @@ -593,6 +584,7 @@
1.141 x=a.value("relPosX").toInt (&okx, 10);
1.142 y=a.value("relPosY").toInt (&oky, 10);
1.143 if (okx && oky)
1.144 +
1.145 lastFloat->setRelPos (QPoint (x,y) );
1.146 else
1.147 // Couldn't read relPos
1.148 @@ -600,7 +592,7 @@
1.149 }
1.150 }
1.151
1.152 - if (!readLinkAttr(a)) return false;
1.153 + if (!readOOAttr(a)) return false;
1.154
1.155 return true;
1.156 }