# HG changeset patch # User insilmaril # Date 1136281481 0 # Node ID 309609406650ee7f9f4b5cf3779c87f5acb27c33 # Parent fbb8c8560551618002e2a6f23ad2b92ca4194d9e 1.7.6 New features for floatimages and fixes diff -r fbb8c8560551 -r 309609406650 flagrowobj.cpp --- a/flagrowobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/flagrowobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -86,8 +86,8 @@ void FlagRowObj::positionBBox() { - bbox.setX (absPos.x() ); - bbox.setY (absPos.y() ); + bbox.moveTopLeft(absPos ); + clickBox.moveTopLeft(absPos ); } void FlagRowObj::calcBBoxSize() @@ -104,15 +104,19 @@ if (size.height() > boxsize.height() ) boxsize.setHeight(size.height() ); } - bbox.setSize (QSize(boxsize.width(), boxsize.height() )); + bbox.setSize (boxsize); + clickBox.setSize (boxsize); } QString FlagRowObj::getFlagName (const QPoint &p) { - if (!inBBox (p)) return ""; + if (!inBox (p)) return ""; FlagObj *fo; for (fo=flag.first();fo; fo=flag.next() ) - if (fo->inBBox (p)) return fo->getName(); + { + cout << " "<getName()<inBox (p)) return fo->getName(); + } return ""; @@ -178,7 +182,6 @@ fo->activate(); fo->setVisibility (visible); calcBBoxSize(); - positionBBox(); } else qWarning ("FlagRowObj ("+name+")::activate ("+foname+") failed - could not find it in parentRow"); } diff -r fbb8c8560551 -r 309609406650 floatimageobj.cpp --- a/floatimageobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/floatimageobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -6,7 +6,7 @@ // FloatImageObj ///////////////////////////////////////////////////////////////// -int FloatImageObj::counter=0; // make instance +uint FloatImageObj::saveCounter=0; // make instance FloatImageObj::FloatImageObj ():FloatObj() @@ -43,6 +43,7 @@ icon->move (absPos.x(), absPos.y() ); icon->setVisibility (true); bbox.setSize (QSize(icon->size().width(), icon->size().height())); + clickBox.setSize (QSize(icon->size().width(), icon->size().height())); filename=""; originalFilename="no original name available"; filetype=""; @@ -53,7 +54,9 @@ { FloatObj::copy (other); icon->copy (other->icon); + filetype=other->filetype; filename=other->filename; + originalFilename=other->originalFilename; saveInMap=other->saveInMap; positionBBox(); } @@ -73,6 +76,7 @@ { icon->load(pixmap); bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8)); + clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8)); positionBBox(); filetype="PNG"; filename="noname.png"; @@ -130,7 +134,7 @@ void FloatImageObj::positionBBox() { - // TODO + clickBox=bbox; } void FloatImageObj::calcBBoxSize() @@ -140,12 +144,14 @@ QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint &p) { - counter++; + saveCounter++; QString posAttr= attribut("relPosX",QString().setNum(relPos.x(),10)) + attribut("relPosY",QString().setNum(relPos.y(),10)); + QString linkAttr=getLinkAttr(); + QString useOrientAttr; if (useOrientation) useOrientAttr=attribut ("useOrientation","true"); @@ -172,13 +178,14 @@ if (filetype=="GIF") filetype="PNG"; - url="images/"+prefix+"image-" + QString().number(counter,10) + "." +filetype; + url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype; // And really save the image icon->save (tmpdir + "/" + url, filetype); return singleElement ("floatimage", posAttr + + linkAttr + useOrientAttr + saveInMapAttr + exportAttr + @@ -189,7 +196,7 @@ void FloatImageObj::resetSaveCounter() { - counter=0; + saveCounter=0; } diff -r fbb8c8560551 -r 309609406650 floatimageobj.h --- a/floatimageobj.h Tue Jan 03 09:44:41 2006 +0000 +++ b/floatimageobj.h Tue Jan 03 09:44:41 2006 +0000 @@ -36,7 +36,7 @@ protected: ImageObj *icon; bool saveInMap; - static int counter; // numerate the files during saveToDir + static uint saveCounter; // numerate the files during saveToDir QString filetype; QString filename; QString originalFilename; diff -r fbb8c8560551 -r 309609406650 floatobj.cpp --- a/floatobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/floatobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -66,11 +66,25 @@ else relPos.setX (absPos.x() - parObj->x() ); relPos.setY (absPos.y() - parObj->y() ); + if (parObj) + { + parObj->calcBBoxSize(); + parObj->requestReposition(); + } } void FloatObj::setRelPos(const QPoint &p) { relPos=p; + if (parObj) + { parObj->calcBBoxSize(); + parObj->requestReposition(); + } +} + +QPoint FloatObj::getRelPos () +{ + return relPos; } void FloatObj::setZ(const int &i) @@ -141,12 +155,7 @@ void FloatObj::select() { LinkableMapObj::select(); - // Temporary draw the link while FO is selected - if (style==StyleUndef) - { - setLinkStyle(getDefLinkStyle()); - setLinkColor(parObj->getLinkColor()); - } + setLinkColor(parObj->getLinkColor()); // Update FloatExport switch in context menu if (floatExport) @@ -160,6 +169,5 @@ void FloatObj::unselect() { LinkableMapObj::unselect(); - setLinkStyle (StyleUndef); } diff -r fbb8c8560551 -r 309609406650 floatobj.h --- a/floatobj.h Tue Jan 03 09:44:41 2006 +0000 +++ b/floatobj.h Tue Jan 03 09:44:41 2006 +0000 @@ -15,6 +15,7 @@ virtual bool load (const QString&)=0; virtual void setRelPos(); // set relPos to current parentPos virtual void setRelPos(const QPoint&); + virtual QPoint getRelPos(); virtual void setZ(const int&); // set zPlane virtual int z(); virtual void setUseOrientation (const bool &); diff -r fbb8c8560551 -r 309609406650 headingobj.cpp --- a/headingobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/headingobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -40,8 +40,10 @@ void HeadingObj::move(double x, double y) { MapObj::move(x,y); + int h; // height of a textline int ho; // offset of height while drawing all lines + if (textline.first() ) h=textline.first()->boundingRect().height(); else @@ -185,6 +187,7 @@ } } setVisibility (visible); + move (absPos.x(),absPos.y()); calcBBoxSize(); }