1.1 --- a/xml-vym.cpp Thu Apr 02 09:57:47 2009 +0000
1.2 +++ b/xml-vym.cpp Tue Apr 07 16:15:53 2009 +0000
1.3 @@ -54,7 +54,6 @@
1.4 {
1.5 // Create mapCenter
1.6 model->clear();
1.7 - lastBranch=NULL;
1.8 lastBranchItem=NULL;
1.9
1.10 if (!atts.value( "author").isEmpty() )
1.11 @@ -141,23 +140,21 @@
1.12 {
1.13 // Really use the found mapcenter as MCO in a new map
1.14
1.15 - model->createMapCenter();
1.16 - lastBranch=model->getSelectedBranch();
1.17 + lastBranchItem=(BranchItem*)model->createMapCenter();
1.18 } else
1.19 {
1.20 // Treat the found mapcenter as a branch
1.21 // in an existing map
1.22 - LinkableMapObj* lmo=model->getSelectedLMO();
1.23 - if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
1.24 - || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
1.25 + BranchItem *bi=model->getSelectedBranchItem();
1.26 + if (bi)
1.27 {
1.28 - lastBranch=(BranchObj*)lmo;
1.29 + lastBranchItem=bi;
1.30 if (loadMode==ImportAdd)
1.31 {
1.32 model->createBranch();
1.33 - lastBranch=model->getSelectedBranch();
1.34 - } else
1.35 - lastBranch->clear();
1.36 + lastBranchItem=model->getSelectedBranchItem();
1.37 + } //else
1.38 + //FIXME-3 lastBranch->clear();
1.39 } else
1.40 return false;
1.41 }
1.42 @@ -174,7 +171,7 @@
1.43 if (!atts.value( "textColor").isEmpty() )
1.44 {
1.45 col.setNamedColor(atts.value("textColor"));
1.46 - lastBranch->setColor(col );
1.47 + //FIXME-2 lastBranch->setColor(col );
1.48 }
1.49 } else if ( eName == "note" &&
1.50 (state == StateMapCenter ||state==StateBranch))
1.51 @@ -189,15 +186,15 @@
1.52 (state == StateMapCenter ||state==StateBranch))
1.53 {
1.54 state=StateFloatImage;
1.55 - lastBranch->addFloatImage();
1.56 - lastFloat=lastBranch->getLastFloatImage();
1.57 + //FIXME-2lastBranch->addFloatImage();
1.58 + //FIXME-2lastFloat=lastBranch->getLastFloatImage();
1.59 if (!readFloatImageAttr(atts)) return false;
1.60 } else if ( (eName == "branch"||eName=="floatimage") && state == StateMap)
1.61 {
1.62 // This is used in vymparts, which have no mapcenter!
1.63 isVymPart=true;
1.64 - LinkableMapObj* lmo=model->getSelectedLMO();
1.65 - if (!lmo)
1.66 + TreeItem *ti=model->getSelectedItem();
1.67 + if (!ti)
1.68 {
1.69 // If a vym part is _loaded_ (not imported),
1.70 // selection==lmo==NULL
1.71 @@ -207,26 +204,25 @@
1.72 // Do we really have no MCO when loading?????
1.73 cout << "xml-vym aborted\n";
1.74 }
1.75 - if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
1.76 - || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
1.77 + if (ti && ti->isBranchLikeType() )
1.78 {
1.79 - lastBranch=(BranchObj*)(lmo);
1.80 + lastBranchItem=(BranchItem*)ti;
1.81 if (eName=="branch")
1.82 {
1.83 state=StateBranch;
1.84 if (loadMode==ImportAdd)
1.85 {
1.86 model->createBranch();
1.87 - lastBranch=model->getSelectedBranch();
1.88 + lastBranchItem=model->getSelectedBranchItem();
1.89
1.90 } else
1.91 - lastBranch->clear();
1.92 + //FIXME-2 lastBranch->clear();
1.93 readBranchAttr (atts);
1.94 } else if (eName=="floatimage")
1.95 {
1.96 state=StateFloatImage;
1.97 - lastBranch->addFloatImage();
1.98 - lastFloat=lastBranch->getLastFloatImage();
1.99 + //FIXME-2 lastBranch->addFloatImage();
1.100 + //FIXME-2 lastFloat=lastBranch->getLastFloatImage();
1.101 if (!readFloatImageAttr(atts)) return false;
1.102 } else return false;
1.103 } else return false;
1.104 @@ -234,7 +230,7 @@
1.105 {
1.106 state=StateBranch;
1.107 model->createBranch();
1.108 - lastBranch=model->getSelectedBranch();
1.109 + lastBranchItem=model->getSelectedBranchItem();
1.110 readBranchAttr (atts);
1.111 } else if ( eName == "htmlnote" && state == StateBranch)
1.112 {
1.113 @@ -255,7 +251,7 @@
1.114 } else if ( eName == "branch" && state == StateBranch )
1.115 {
1.116 model->createBranch();
1.117 - lastBranch=model->getSelectedBranch();
1.118 + lastBranchItem=model->getSelectedBranchItem();
1.119 readBranchAttr (atts);
1.120 } else if ( eName == "html" && state == StateHtmlNote )
1.121 {
1.122 @@ -290,7 +286,7 @@
1.123 break;
1.124 case StateBranch:
1.125 model->selectParent();
1.126 - lastBranch=model->getSelectedBranch();
1.127 + lastBranchItem=model->getSelectedBranchItem();
1.128 break;
1.129 case StateHtml:
1.130 htmldata+="</"+eName+">";
1.131 @@ -299,7 +295,7 @@
1.132 state=StateHtmlNote;
1.133 htmldata.replace ("<br></br>","<br />");
1.134 no.setNote (htmldata);
1.135 - lastBranch->getTreeItem()->setNoteObj (no);
1.136 + lastBranchItem->setNoteObj (no);
1.137 }
1.138 break;
1.139 default:
1.140 @@ -327,11 +323,11 @@
1.141 case StateMapSetting:break;
1.142 case StateMapCenter: break;
1.143 case StateNote:
1.144 - lastBranch->getTreeItem()->setNote(ch_simplified);
1.145 + lastBranchItem->setNote(ch_simplified);
1.146 break;
1.147 case StateBranch: break;
1.148 case StateStandardFlag:
1.149 - lastBranch->activateStandardFlag(ch_simplified);
1.150 + //FIXME-2 lastBranchItem->activateStandardFlag(ch_simplified);
1.151 break;
1.152 case StateFloatImage: break;
1.153 case StateHtmlNote: break;
1.154 @@ -352,13 +348,14 @@
1.155 return "the document is not in the VYM file format";
1.156 }
1.157
1.158 -bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
1.159 +bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a) //FIXME-2
1.160 {
1.161 branchesCurrent++;
1.162 mainWindow->setProgressValue (branchesCurrent);
1.163 - lastOO=lastBranch;
1.164 - lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
1.165 + //lastOO=lastBranch;
1.166 + //lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
1.167
1.168 +/*
1.169 if (!readOOAttr(a)) return false;
1.170
1.171 if (!a.value( "scrolled").isEmpty() )
1.172 @@ -380,6 +377,7 @@
1.173 else
1.174 lastBranch->setIncludeImagesHor(false);
1.175 }
1.176 +*/
1.177 return true;
1.178 }
1.179
1.180 @@ -450,7 +448,7 @@
1.181 lastOO->setVymLink (a.value ("vymLink"));
1.182 if (!a.value( "hideInExport").isEmpty() )
1.183 if (a.value("hideInExport")=="true")
1.184 - lastOO->setHideInExport(true);
1.185 + lastOO->getTreeItem()->setHideInExport(true);
1.186
1.187 if (!a.value( "hideLink").isEmpty())
1.188 {
1.189 @@ -491,7 +489,7 @@
1.190 }
1.191 if (!a.value( "fonthint").isEmpty() )
1.192 no.setFontHint(a.value ("fonthint") );
1.193 - lastBranch->getTreeItem()->setNoteObj(no);
1.194 + lastBranchItem->setNoteObj(no);
1.195 return true;
1.196 }
1.197
1.198 @@ -515,7 +513,7 @@
1.199 {
1.200 QMessageBox::warning( 0, "Warning: " ,
1.201 "Couldn't load float image\n"+parseHREF(a.value ("href") ));
1.202 - lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
1.203 + //FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
1.204 lastFloat=NULL;
1.205 return true;
1.206 }
1.207 @@ -545,7 +543,7 @@
1.208 {
1.209 lastFloat->setRelPos (QPointF (x,y) );
1.210 // make sure floats in mapcenter are repositioned to relative pos
1.211 - if (lastBranch->getDepth()==0) lastBranch->positionContents();
1.212 + //FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
1.213 }
1.214 else
1.215 // Couldn't read relPos