diff -r 914f330b6aa8 -r 25a77484ec72 xml-vym.cpp
--- a/xml-vym.cpp Thu Apr 02 09:57:47 2009 +0000
+++ b/xml-vym.cpp Tue Apr 07 16:15:53 2009 +0000
@@ -54,7 +54,6 @@
{
// Create mapCenter
model->clear();
- lastBranch=NULL;
lastBranchItem=NULL;
if (!atts.value( "author").isEmpty() )
@@ -141,23 +140,21 @@
{
// Really use the found mapcenter as MCO in a new map
- model->createMapCenter();
- lastBranch=model->getSelectedBranch();
+ lastBranchItem=(BranchItem*)model->createMapCenter();
} else
{
// Treat the found mapcenter as a branch
// in an existing map
- LinkableMapObj* lmo=model->getSelectedLMO();
- if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
- || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
+ BranchItem *bi=model->getSelectedBranchItem();
+ if (bi)
{
- lastBranch=(BranchObj*)lmo;
+ lastBranchItem=bi;
if (loadMode==ImportAdd)
{
model->createBranch();
- lastBranch=model->getSelectedBranch();
- } else
- lastBranch->clear();
+ lastBranchItem=model->getSelectedBranchItem();
+ } //else
+ //FIXME-3 lastBranch->clear();
} else
return false;
}
@@ -174,7 +171,7 @@
if (!atts.value( "textColor").isEmpty() )
{
col.setNamedColor(atts.value("textColor"));
- lastBranch->setColor(col );
+ //FIXME-2 lastBranch->setColor(col );
}
} else if ( eName == "note" &&
(state == StateMapCenter ||state==StateBranch))
@@ -189,15 +186,15 @@
(state == StateMapCenter ||state==StateBranch))
{
state=StateFloatImage;
- lastBranch->addFloatImage();
- lastFloat=lastBranch->getLastFloatImage();
+ //FIXME-2lastBranch->addFloatImage();
+ //FIXME-2lastFloat=lastBranch->getLastFloatImage();
if (!readFloatImageAttr(atts)) return false;
} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap)
{
// This is used in vymparts, which have no mapcenter!
isVymPart=true;
- LinkableMapObj* lmo=model->getSelectedLMO();
- if (!lmo)
+ TreeItem *ti=model->getSelectedItem();
+ if (!ti)
{
// If a vym part is _loaded_ (not imported),
// selection==lmo==NULL
@@ -207,26 +204,25 @@
// Do we really have no MCO when loading?????
cout << "xml-vym aborted\n";
}
- if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
- || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
+ if (ti && ti->isBranchLikeType() )
{
- lastBranch=(BranchObj*)(lmo);
+ lastBranchItem=(BranchItem*)ti;
if (eName=="branch")
{
state=StateBranch;
if (loadMode==ImportAdd)
{
model->createBranch();
- lastBranch=model->getSelectedBranch();
+ lastBranchItem=model->getSelectedBranchItem();
} else
- lastBranch->clear();
+ //FIXME-2 lastBranch->clear();
readBranchAttr (atts);
} else if (eName=="floatimage")
{
state=StateFloatImage;
- lastBranch->addFloatImage();
- lastFloat=lastBranch->getLastFloatImage();
+ //FIXME-2 lastBranch->addFloatImage();
+ //FIXME-2 lastFloat=lastBranch->getLastFloatImage();
if (!readFloatImageAttr(atts)) return false;
} else return false;
} else return false;
@@ -234,7 +230,7 @@
{
state=StateBranch;
model->createBranch();
- lastBranch=model->getSelectedBranch();
+ lastBranchItem=model->getSelectedBranchItem();
readBranchAttr (atts);
} else if ( eName == "htmlnote" && state == StateBranch)
{
@@ -255,7 +251,7 @@
} else if ( eName == "branch" && state == StateBranch )
{
model->createBranch();
- lastBranch=model->getSelectedBranch();
+ lastBranchItem=model->getSelectedBranchItem();
readBranchAttr (atts);
} else if ( eName == "html" && state == StateHtmlNote )
{
@@ -290,7 +286,7 @@
break;
case StateBranch:
model->selectParent();
- lastBranch=model->getSelectedBranch();
+ lastBranchItem=model->getSelectedBranchItem();
break;
case StateHtml:
htmldata+=""+eName+">";
@@ -299,7 +295,7 @@
state=StateHtmlNote;
htmldata.replace ("
","
");
no.setNote (htmldata);
- lastBranch->getTreeItem()->setNoteObj (no);
+ lastBranchItem->setNoteObj (no);
}
break;
default:
@@ -327,11 +323,11 @@
case StateMapSetting:break;
case StateMapCenter: break;
case StateNote:
- lastBranch->getTreeItem()->setNote(ch_simplified);
+ lastBranchItem->setNote(ch_simplified);
break;
case StateBranch: break;
case StateStandardFlag:
- lastBranch->activateStandardFlag(ch_simplified);
+ //FIXME-2 lastBranchItem->activateStandardFlag(ch_simplified);
break;
case StateFloatImage: break;
case StateHtmlNote: break;
@@ -352,13 +348,14 @@
return "the document is not in the VYM file format";
}
-bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
+bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a) //FIXME-2
{
branchesCurrent++;
mainWindow->setProgressValue (branchesCurrent);
- lastOO=lastBranch;
- lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
+ //lastOO=lastBranch;
+ //lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
+/*
if (!readOOAttr(a)) return false;
if (!a.value( "scrolled").isEmpty() )
@@ -380,6 +377,7 @@
else
lastBranch->setIncludeImagesHor(false);
}
+*/
return true;
}
@@ -450,7 +448,7 @@
lastOO->setVymLink (a.value ("vymLink"));
if (!a.value( "hideInExport").isEmpty() )
if (a.value("hideInExport")=="true")
- lastOO->setHideInExport(true);
+ lastOO->getTreeItem()->setHideInExport(true);
if (!a.value( "hideLink").isEmpty())
{
@@ -491,7 +489,7 @@
}
if (!a.value( "fonthint").isEmpty() )
no.setFontHint(a.value ("fonthint") );
- lastBranch->getTreeItem()->setNoteObj(no);
+ lastBranchItem->setNoteObj(no);
return true;
}
@@ -515,7 +513,7 @@
{
QMessageBox::warning( 0, "Warning: " ,
"Couldn't load float image\n"+parseHREF(a.value ("href") ));
- lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
+ //FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
lastFloat=NULL;
return true;
}
@@ -545,7 +543,7 @@
{
lastFloat->setRelPos (QPointF (x,y) );
// make sure floats in mapcenter are repositioned to relative pos
- if (lastBranch->getDepth()==0) lastBranch->positionContents();
+ //FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
}
else
// Couldn't read relPos