diff -r 6e4b586aa88a -r 25e634a7e1dc xml-vym.cpp
--- a/xml-vym.cpp Wed Jun 03 20:37:17 2009 +0000
+++ b/xml-vym.cpp Mon Jun 08 11:36:56 2009 +0000
@@ -13,8 +13,8 @@
#include "mainwindow.h"
#include "version.h"
-static FloatObj *lastFloat;
-static OrnamentedObj *lastOO;
+static ImageItem *lastImageItem;
+static MapItem *lastMI;
extern Main *mainWindow;
extern Settings settings;
@@ -54,7 +54,7 @@
{
// Create mapCenter
model->clear();
- lastBranchItem=NULL;
+ lastBranch=NULL;
if (!atts.value( "author").isEmpty() )
model->setAuthor(atts.value( "author" ) );
@@ -140,7 +140,7 @@
{
// Really use the found mapcenter as MCO in a new map
- lastBranchItem=(BranchItem*)model->createMapCenter();
+ lastBranch=model->createMapCenter();
} else
{
// Treat the found mapcenter as a branch
@@ -148,10 +148,10 @@
BranchItem *bi=model->getSelectedBranchItem();
if (bi)
{
- lastBranchItem=bi;
+ lastBranch=bi;
if (loadMode==ImportAdd)
{
- lastBranchItem=model->createBranch(lastBranchItem);
+ lastBranch=model->createBranch(lastBranch);
} //else
//FIXME-3 lastBranch->clear();
} else
@@ -170,7 +170,7 @@
if (!atts.value( "textColor").isEmpty() )
{
col.setNamedColor(atts.value("textColor"));
- lastBranchItem->setHeadingColor(col );
+ lastBranch->setHeadingColor(col );
}
} else if ( eName == "note" &&
(state == StateMapCenter ||state==StateBranch))
@@ -184,10 +184,9 @@
} else if ( eName == "floatimage" &&
(state == StateMapCenter ||state==StateBranch))
{
- state=StateFloatImage;
- //FIXME-2 lastBranch->addFloatImage();
- //FIXME-2 lastFloat=lastBranch->getLastFloatImage();
- if (!readFloatImageAttr(atts)) return false;
+ state=StateImage;
+ lastImage=model->createImage(lastBranch);
+ if (!readImageAttr(atts)) return false;
} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap)
{
// This is used in vymparts, which have no mapcenter!
@@ -205,29 +204,28 @@
}
if (ti && ti->isBranchLikeType() )
{
- lastBranchItem=(BranchItem*)ti;
+ lastBranch=(BranchItem*)ti;
if (eName=="branch")
{
state=StateBranch;
if (loadMode==ImportAdd)
{
- lastBranchItem=model->createBranch(lastBranchItem);
+ lastBranch=model->createBranch(lastBranch);
} else
//FIXME-2 lastBranch->clear();
readBranchAttr (atts);
} else if (eName=="floatimage")
{
- state=StateFloatImage;
- //FIXME-2 lastBranch->addFloatImage();
- //FIXME-2 lastFloat=lastBranch->getLastFloatImage();
- if (!readFloatImageAttr(atts)) return false;
+ state=StateImage;
+ lastImage=model->createImage (lastBranch);
+ if (!readImageAttr(atts)) return false;
} else return false;
} else return false;
} else if ( eName == "branch" && state == StateMapCenter)
{
state=StateBranch;
- lastBranchItem=model->createBranch(lastBranchItem);
+ lastBranch=model->createBranch(lastBranch);
readBranchAttr (atts);
} else if ( eName == "htmlnote" && state == StateBranch)
{
@@ -247,7 +245,7 @@
if (!readXLinkAttr (atts)) return false;
} else if ( eName == "branch" && state == StateBranch )
{
- lastBranchItem=model->createBranch(lastBranchItem);
+ lastBranch=model->createBranch(lastBranch);
readBranchAttr (atts);
} else if ( eName == "html" && state == StateHtmlNote )
{
@@ -282,15 +280,15 @@
break;
case StateMapCenter:
model->selectParent();
- model->emitDataHasChanged (lastBranchItem);
- lastBranchItem=(BranchItem*)(lastBranchItem->parent());
- lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch
+ model->emitDataHasChanged (lastBranch);
+ lastBranch=(BranchItem*)(lastBranch->parent());
+ lastBranch->setLastSelectedBranch (0); // Reset last selected to first child branch
break;
case StateBranch:
model->selectParent();
- model->emitDataHasChanged (lastBranchItem);
- lastBranchItem=(BranchItem*)(lastBranchItem->parent());
- lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch
+ model->emitDataHasChanged (lastBranch);
+ lastBranch=(BranchItem*)(lastBranch->parent());
+ lastBranch->setLastSelectedBranch (0); // Reset last selected to first child branch
break;
case StateHtml:
htmldata+=""+eName+">";
@@ -299,7 +297,7 @@
state=StateHtmlNote;
htmldata.replace ("
","
");
no.setNote (htmldata);
- lastBranchItem->setNoteObj (no);
+ lastBranch->setNoteObj (no);
}
break;
default:
@@ -327,19 +325,19 @@
case StateMapSetting:break;
case StateMapCenter: break;
case StateNote:
- lastBranchItem->setNote(ch_simplified);
+ lastBranch->setNote(ch_simplified);
break;
case StateBranch: break;
case StateStandardFlag:
- lastBranchItem->activateStandardFlag(ch_simplified);
+ lastBranch->activateStandardFlag(ch_simplified);
break;
- case StateFloatImage: break;
+ case StateImage: break;
case StateHtmlNote: break;
case StateHtml:
htmldata+=ch_org;
break;
case StateHeading:
- lastBranchItem->setHeading(ch_simplified);
+ lastBranch->setHeading(ch_simplified);
break;
default:
return false;
@@ -356,10 +354,12 @@
{
mainWindow->setProgressValue (branchesCurrent++);
+ lastMI=lastBranch;
+
if (!readOOAttr(a)) return false;
if (!a.value( "scrolled").isEmpty() )
- lastBranchItem->toggleScroll();
+ lastBranch->toggleScroll();
/*
if (!a.value( "frameType").isEmpty() )
lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
@@ -386,7 +386,7 @@
{
bool ok;
int x;
- if (lastOO)
+ /* FIXME-2 if (lastOO)
{
if (!a.value( "frameType").isEmpty() )
lastOO->setFrameType (a.value("frameType"));
@@ -405,12 +405,13 @@
if (ok) lastOO->setFrameBorderWidth(x);
}
}
+ */
return true;
}
bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
{
- if (lastBranchItem)
+ if (lastMI)
{
bool okx,oky;
float x,y;
@@ -421,7 +422,7 @@
x=a.value("relPosX").toFloat (&okx);
y=a.value("relPosY").toFloat (&oky);
if (okx && oky )
- lastBranchItem->setRelPos (QPointF(x,y));
+ lastBranch->setRelPos (QPointF(x,y));
else
return false; // Couldn't read relPos
}
@@ -433,21 +434,21 @@
x=a.value("absPosX").toFloat (&okx);
y=a.value("absPosY").toFloat (&oky);
if (okx && oky )
- lastBranchItem->setAbsPos (QPointF(x,y));
+ lastBranch->setAbsPos (QPointF(x,y));
else
return false; // Couldn't read absPos
}
}
//if (!a.value( "id").isEmpty() )
- // lastBranchItem->setID (a.value ("id"));
+ // lastBranch->setID (a.value ("id"));
if (!a.value( "url").isEmpty() )
- lastBranchItem->setURL (a.value ("url"));
+ lastBranch->setURL (a.value ("url"));
if (!a.value( "vymLink").isEmpty() )
- lastBranchItem->setVymLink (a.value ("vymLink"));
+ lastBranch->setVymLink (a.value ("vymLink"));
if (!a.value( "hideInExport").isEmpty() )
if (a.value("hideInExport")=="true")
- lastBranchItem->setHideInExport(true);
+ lastBranch->setHideInExport(true);
/* FIXME-2
if (!a.value( "hideLink").isEmpty())
@@ -490,46 +491,39 @@
}
if (!a.value( "fonthint").isEmpty() )
no.setFontHint(a.value ("fonthint") );
- lastBranchItem->setNoteObj(no);
+ lastBranch->setNoteObj(no);
return true;
}
-bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
+bool parseVYMHandler::readImageAttr (const QXmlAttributes& a)
{
- lastOO=lastFloat;
+ lastMI=lastImage;
//if (!readOOAttr(a)) return false;
- if (!a.value( "useOrientation").isEmpty() )
+ /* FIXME-1 if (!a.value( "useOrientation").isEmpty() )
{
if (a.value ("useOrientation") =="true")
- lastFloat->setUseOrientation (true);
+ lastImage->setUseOrientation (true);
else
- lastFloat->setUseOrientation (false);
+ lastImage->setUseOrientation (false);
}
+ */
if (!a.value( "href").isEmpty() )
{
- // Load FloatImage
- if (!lastFloat->load (parseHREF(a.value ("href") ) ))
+ // Load Image
+ if (!lastImage->load (parseHREF(a.value ("href") ) ))
{
QMessageBox::warning( 0, "Warning: " ,
- "Couldn't load float image\n"+parseHREF(a.value ("href") ));
- //FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
- lastFloat=NULL;
+ "Couldn't load image\n"+parseHREF(a.value ("href") ));
+ //FIXME-0 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
+ lastImage=NULL;
return true;
}
}
- if (!a.value( "floatExport").isEmpty() )
- {
- // Only for compatibility. THis is not used since 1.7.11
- if (a.value ("floatExport") =="true")
- lastFloat->setFloatExport(true);
- else
- lastFloat->setFloatExport (false);
- }
if (!a.value( "zPlane").isEmpty() )
- lastFloat->setZValue (a.value("zPlane").toInt ());
+ lastImage->setZValue (a.value("zPlane").toInt ());
float x,y;
bool okx,oky;
if (!a.value( "relPosX").isEmpty() )
@@ -542,9 +536,9 @@
if (okx && oky)
{
- lastFloat->setRelPos (QPointF (x,y) );
+ lastImage->setRelPos (QPointF (x,y) );
// make sure floats in mapcenter are repositioned to relative pos
- //FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
+ //FIXME-0 if (lastBranch->depth()==0) lastBranch->positionContents();
}
else
// Couldn't read relPos
@@ -554,9 +548,9 @@
if (!readOOAttr(a)) return false;
- if (!a.value ("orgName").isEmpty() )
+ if (!a.value ("originalName").isEmpty() )
{
- ((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
+ lastImage->setOriginalFilename (a.value("originalName"));
}
return true;
}