diff -r 9eb7767c2dfa -r 608f976aa7bb mapcenterobj.cpp --- a/mapcenterobj.cpp Sun Jan 30 12:58:47 2005 +0000 +++ b/mapcenterobj.cpp Tue Jun 06 14:58:11 2006 +0000 @@ -13,7 +13,7 @@ init(); } -MapCenterObj::MapCenterObj(QCanvas* c) : BranchObj (c) +MapCenterObj::MapCenterObj(Q3Canvas* c) : BranchObj (c) { // cout << "Const MapCenterObj canvas="<width()/2, canvas->height()/2); // FIXME this should be done in TextObj later... - QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0"); - heading->setFont(font); - - branch.setAutoDelete (TRUE); - floatimage.setAutoDelete (TRUE); - - move (absPos.x(), absPos.y() ); + //QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0"); + //heading->setFont(font); depth=0; - - scrolled=false; - tmpUnscrolled=false; + setDefAttr(MovedBranch); frame->setFrameType (Rectangle); } @@ -54,13 +46,11 @@ void MapCenterObj::move (double x, double y) { BranchObj::move(x,y); - positionBBox(); } void MapCenterObj::moveBy (double x, double y) { BranchObj::moveBy(x,y); - positionBBox(); } void MapCenterObj::moveAll (double x, double y) @@ -77,16 +67,13 @@ { // Move myself moveBy(dx,dy); - - positionBBox(); } void MapCenterObj::updateLink() { // set childPos to middle of MapCenterObj - childPos=QPoint( - absPos.x() + QSize(getSize() ).width()/2, - absPos.y() + QSize(getSize() ).height()/2); + childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 ); + childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 ); parPos=childPos; BranchObj *b; for (b=branch.first(); b; b=branch.next() ) @@ -102,19 +89,15 @@ for (bo=branch.first(); bo; bo=branch.next() ) { lmo = bo->findMapObj(p, excludeLMO); - - if (lmo!= NULL) - { - return lmo; - } + if (lmo!= NULL) return lmo; } // is p in MapCenter? - if (inBBox (p) && (this != excludeLMO) ) return this; + if (inBox (p) && (this != excludeLMO) ) return this; // Search float images FloatImageObj *foi; for (foi=floatimage.first(); foi; foi=floatimage.next() ) - if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi; + if (foi->inBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi; // nothing found return NULL; @@ -131,13 +114,21 @@ attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) + attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10)); + // Providing an ID for a branch makes export to XHTML easier + QString idAttr; + if (countXLinks()>0) + idAttr=attribut ("id",getSelectString()); + else + idAttr=""; + + QString linkAttr=getLinkAttr(); + s=beginElement ("mapcenter" - +attribut("absPosX",QString().setNum(absPos.x(),10)) - +attribut("absPosY",QString().setNum(absPos.y(),10)) + +getOrnAttr() +attribut("frameType",frame->getFrameTypeName()) +areaAttr - ); - + +idAttr + +getIncludeImageAttr() ); incIndent(); if (heading->getColor()!=QColor("black")) a=attribut ("textColor",QColor(heading->getColor()).name() ); @@ -149,23 +140,25 @@ s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose); s=s+valueElement("heading", getHeading(),a); - // Reset the counters before saving - FloatImageObj (canvas).resetSaveCounter(); - // add link to file in s if (!note.isEmpty() ) s+=note.saveToDir(); - // Save FloatImages - FloatImageObj *fio; - for (fio=floatimage.first(); fio; fio=floatimage.next() ) - s+=fio->saveToDir (tmpdir,prefix); - // Save branches BranchObj *bo; for (bo=branch.first(); bo; bo=branch.next() ) s+=bo->saveToDir(tmpdir,prefix, offset); + // Save FloatImages + FloatImageObj *fio; + for (fio=floatimage.first(); fio; fio=floatimage.next() ) + s+=fio->saveToDir (tmpdir,prefix,offset); + + // Save XLinks + XLinkObj *xlo; + for (xlo=xlink.first(); xlo; xlo=xlink.next() ) + s+=xlo->saveToDir(); + decIndent(); s+=endElement ("mapcenter"); return s; @@ -184,9 +177,9 @@ QString s2=version.section (".",1,1); QString s3=version.section (".",2,2); bool ok; - int vv1 =QString(__VYM_VERSION__).section (".",0,0).toInt(&ok,10); - int vv2 =QString(__VYM_VERSION__).section (".",1,1).toInt(&ok,10); - int vv3 =QString(__VYM_VERSION__).section (".",2,2).toInt(&ok,10); + int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10); + int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10); + int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10); int mv1=0; int mv2=0; int mv3=0; @@ -233,3 +226,4 @@ { return QDate::currentDate().toString ("yyyy-MM-dd"); } +