# HG changeset patch # User insilmaril # Date 1136281481 0 # Node ID 728f51b71e7132fac2ddc0bffeb2c87f8b720c8a # Parent 3674e92366346bc4c4708db321d1bf0c49848c79 1.7.6 New features for floatimages and fixes diff -r 3674e9236634 -r 728f51b71e71 lang/vym_de.ts --- a/lang/vym_de.ts Tue Jan 03 09:44:41 2006 +0000 +++ b/lang/vym_de.ts Tue Jan 03 09:44:41 2006 +0000 @@ -548,7 +548,7 @@ Pick color Hint: You can pick a color from another branch and color using CTRL+Left Button - Farb übernehmen + Farbe übernehmen Tipp: Zum Kopieren einer Farbe kann man auch CTRL+linke Maustaste nehmen. diff -r 3674e9236634 -r 728f51b71e71 linkablemapobj.cpp --- a/linkablemapobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/linkablemapobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -94,6 +94,8 @@ hideLinkUnselected=false; + topPad=botPad=leftPad=rightPad=0; + // initialize frame frame = new FrameObj (canvas); @@ -133,6 +135,21 @@ return false; } +int LinkableMapObj::getTopPad() +{ + return topPad; +} + +int LinkableMapObj::getLeftPad() +{ + return leftPad; +} + +int LinkableMapObj::getRightPad() +{ + return rightPad; +} + LinkStyle LinkableMapObj::getDefLinkStyle () { if (!mapEditor) return StyleUndef; @@ -417,7 +434,7 @@ // orientation // childPos // parPos - // offset + // bottomlineY // drawing of the link itself @@ -432,10 +449,10 @@ switch (linkpos) { case LinkMiddle: - offset=bbox.height() /2; + bottomlineY=clickBox.top()+clickBox.height() /2; // draw link to middle (of frame) break; default : - offset=bbox.height()-1; // draw link to bottom of bbox + bottomlineY=clickBox.bottom()-1; // draw link to bottom of bbox break; } @@ -478,12 +495,12 @@ if (orientation==OrientLeftOfCenter ) { - childPos=QPoint (absPos.x(),absPos.y()+offset); - parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); + childPos=QPoint (absPos.x(),bottomlineY); + parPos=QPoint (absPos.x()+ bbox.width(), bottomlineY ); } else { - childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); - parPos=QPoint (absPos.x(),absPos.y()+offset); + childPos=QPoint (absPos.x()+ bbox.width(), bottomlineY ); + parPos=QPoint (absPos.x(),bottomlineY); } double p1x=parPos.x(); // Link is drawn from P1 to P2 @@ -715,9 +732,9 @@ void LinkableMapObj::setSelBox() { - selbox->setX (bbox.x() ); - selbox->setY (bbox.y() ); - selbox->setSize (bbox.width(), bbox.height() ); + selbox->setX (clickBox.x() ); + selbox->setY (clickBox.y() ); + selbox->setSize (clickBox.width(), clickBox.height() ); } void LinkableMapObj::select() @@ -767,13 +784,9 @@ QString LinkableMapObj::getLinkAttr () { - QString hideAttr; if (hideLinkUnselected) - // Since this is currently the - // only attribut and it is switched off by default - // don't write at all if it is missing - return attribut ("hideLinkUnselected","true"); + return attribut ("hideLink","true"); else - return ""; + return attribut ("hideLink","false"); } diff -r 3674e9236634 -r 728f51b71e71 linkablemapobj.h --- a/linkablemapobj.h Tue Jan 03 09:44:41 2006 +0000 +++ b/linkablemapobj.h Tue Jan 03 09:44:41 2006 +0000 @@ -34,6 +34,9 @@ virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around virtual void unsetParObjTmp(); // reuse original ParObj virtual bool hasParObjTmp(); + virtual int getTopPad(); + virtual int getLeftPad(); + virtual int getRightPad(); LinkStyle getDefLinkStyle(); void setLinkStyle(LinkStyle); LinkStyle getLinkStyle(); @@ -97,7 +100,7 @@ LinkableMapObj* childObj; LinkableMapObj* parObj; LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent - int offset; // vertical offset of dockpos to pos + int bottomlineY; // vertical offset of dockpos to pos int thickness_start; // for StylePoly* LinkStyle style; // Current style @@ -117,5 +120,8 @@ bool hideLinkUnselected; // to hide links if unselected QCanvasRectangle* selbox; FrameObj *frame; // frame around object + int topPad, botPad, + leftPad, rightPad; // padding within bbox + }; #endif diff -r 3674e9236634 -r 728f51b71e71 main.cpp --- a/main.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/main.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -46,6 +46,7 @@ QAction *actionEditURL; QAction *actionEditHeading2URL; QAction *actionEditBugzilla2URL; +QAction *actionEditFATE2URL; QAction *actionEditOpenVymLink; QAction *actionEditVymLink; QAction *actionEditDeleteVymLink; @@ -84,6 +85,8 @@ QAction *actionFormatFrameRectangle; QActionGroup *actionGroupFormatLinkStyles; +QAction *actionFormatIncludeImagesVer; +QAction *actionFormatIncludeImagesHor; QAction *actionFormatHideLinkUnselected; QAction *actionFormatLinkStyleLine; QAction *actionFormatLinkStyleParabel; diff -r 3674e9236634 -r 728f51b71e71 mainwindow.cpp --- a/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -12,13 +12,14 @@ #include #include #include -#include // for random seed +//#include // for random seed #include #include #include +#include "file.h" #include "misc.h" #include "version.h" #include "aboutdialog.h" @@ -104,6 +105,7 @@ extern QAction* actionEditURL; extern QAction* actionEditHeading2URL; extern QAction* actionEditBugzilla2URL; +extern QAction* actionEditFATE2URL; extern QAction *actionEditOpenVymLink; extern QAction *actionEditVymLink; extern QAction *actionEditDeleteVymLink; @@ -131,6 +133,8 @@ extern QAction* actionFormatLinkColorHint; extern QAction* actionFormatBackColor; extern QAction* actionFormatLinkColor; +extern QAction *actionFormatIncludeImagesVer; +extern QAction *actionFormatIncludeImagesHor; extern QActionGroup* actionGroupModModes; extern QAction* actionModModeColor; @@ -519,6 +523,11 @@ actionListBranches.append(a); actionEditBugzilla2URL=a; + a = new QAction( tr( "Create URL to FATE" ), QPixmap(), tr( "Create URL to FATE" ), 0, this, "FATE2url" ); + connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) ); + a->setEnabled (false); + actionListBranches.append(a); + actionEditFATE2URL=a; a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" ); connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) ); @@ -572,6 +581,7 @@ a->setEnabled (false); actionListBranches.append(a); #if defined (Q_OS_MACX) + // In OSX show different shortcut in menues, the keys work independtly always actionEditAddBranch=alt; #else actionEditAddBranch=a; @@ -583,6 +593,9 @@ a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchHere=a; + a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_A, this, "newBranchHere" ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) ); + actionListBranches.append(a); // Add branch above a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" ); @@ -590,6 +603,9 @@ a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchAbove=a; + a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_A, this, "newBranch" ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) ); + actionListBranches.append(a); // Add branch below a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" ); @@ -597,6 +613,9 @@ a->setEnabled (false); actionListBranches.append(a); actionEditAddBranchBelow=a; + a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_A, this, "newBranch" ); + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) ); + actionListBranches.append(a); // Import at selection (adding to selection) a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" ); @@ -729,6 +748,16 @@ connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) ); actionFormatFrameRectangle=a; + a = new QAction( tr ("Include top and bottom position of images into branch"), tr( "Include images vertically" ), 0, actionFormatIncludeImagesVer, "includeImagesVer" ); + a->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) ); + actionFormatIncludeImagesVer=a; + + a = new QAction( tr ("Include left and right position of images into branch"), tr( "Include images horizontally" ), 0, actionFormatIncludeImagesHor, "includeImagesHor" ); + a->setToggleAction(true); + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) ); + actionFormatIncludeImagesHor=a; + a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" ); a->setToggleAction(true); connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) ); @@ -1012,7 +1041,7 @@ menuBar()->insertItem( tr( "&Test" ), menu ); QAction *a; - a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); + a = new QAction( tr( "Call test function" ), QPixmap(), tr( "test flag" ), 0, this, "flag" ); connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) ); a->addTo( menu ); } @@ -1075,8 +1104,10 @@ actionEditURL->addTo ( branchContextMenu ); actionEditHeading2URL->addTo ( branchContextMenu ); if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) + { actionEditBugzilla2URL->addTo( branchContextMenu ); - + actionEditFATE2URL->addTo( branchContextMenu ); + } branchContextMenu->insertSeparator(); actionEditOpenVymLink->addTo ( branchContextMenu ); actionEditVymLink->addTo ( branchContextMenu ); @@ -1086,6 +1117,8 @@ actionGroupFormatFrameTypes->addTo( branchContextMenu ); branchContextMenu->insertSeparator(); + actionFormatIncludeImagesVer->addTo( branchContextMenu ); + actionFormatIncludeImagesHor->addTo( branchContextMenu ); actionFormatHideLinkUnselected->addTo( branchContextMenu ); // Context Menu for links in a branch menu @@ -1522,7 +1555,7 @@ me->setFilePath (fn_org); // Delete tmpDir - system ( "rm -rf "+tmpMapDir); + removeDir (QDir(tmpMapDir)); // Check for errors if (err==success) @@ -1662,42 +1695,7 @@ me->save (savemode); me->setFilePath (safeFilePath); - // zip the temporary directory - Process *zipProc=new Process (); - zipProc->clearArguments(); - zipProc->setWorkingDirectory (QDir(tmpMapDir)); - zipProc->addArgument ("zip"); - zipProc->addArgument ("-r"); - zipProc->addArgument (fn); - zipProc->addArgument ("."); - - if (!zipProc->start() ) - { - // zip could not be started - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("Couldn't start zip to compress data.")); - err=aborted; - } else - { - // zip could be started - zipProc->waitFinished(); - if (!zipProc->normalExit() ) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - tr("zip didn't exit normally")+ - "\n" + zipProc->getErrout()); - err=aborted; - } else - { - if (zipProc->exitStatus()>0) - { - QMessageBox::critical( 0, tr( "Critical Save Error" ), - QString("zip exit code: %1").arg(zipProc->exitStatus() )+ - "\n" + zipProc->getErrout() ); - err=aborted; - } - } - } // zip could be started + zipDir (tmpMapDir,fn); } // save zipped else { @@ -1720,7 +1718,7 @@ if (me->saveZipped()) { // Delete tmpDir - system ( "rm -rf "+ tmpMapDir ); + removeDir (QDir(tmpMapDir)); } if (err==success) @@ -2085,6 +2083,12 @@ currentMapEditor()->editBugzilla2URL(); } +void Main::editFATE2URL() +{ + if (currentMapEditor()) + currentMapEditor()->editFATE2URL(); +} + void Main::editOpenVymLink() { // Get current path to map @@ -2386,6 +2390,18 @@ currentMapEditor()->setFrame(Rectangle); } +void Main::formatIncludeImagesVer() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn()); +} + +void Main::formatIncludeImagesHor() +{ + if (currentMapEditor()) + currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn()); +} + void Main::formatHideLinkUnselected() { if (currentMapEditor()) @@ -2533,11 +2549,16 @@ docpath="doc/tex/vym.pdf"; if (!QFile (docpath).exists() ) { - QMessageBox::critical(0, - tr("Critcal error"), - tr("Couldn't find the documentation\n" - "vym.pdf in various places.")); - return; + // Try yet another one for Knoppix + docpath="/usr/share/doc/packages/vym/vym.pdf"; + if (!QFile (docpath).exists() ) + { + QMessageBox::critical(0, + tr("Critcal error"), + tr("Couldn't find the documentation\n" + "vym.pdf in various places.")); + return; + } } } } diff -r 3674e9236634 -r 728f51b71e71 mainwindow.h --- a/mainwindow.h Tue Jan 03 09:44:41 2006 +0000 +++ b/mainwindow.h Tue Jan 03 09:44:41 2006 +0000 @@ -12,10 +12,11 @@ #include #include +#include "file.h" +#include "findwindow.h" +#include "mapeditor.h" +#include "texteditor.h" #include "xml.h" -#include "texteditor.h" -#include "mapeditor.h" -#include "findwindow.h" class Main : public QMainWindow { @@ -90,6 +91,7 @@ void editURL(); void editHeading2URL(); void editBugzilla2URL(); + void editFATE2URL(); void editVymLink(); public slots: void editOpenVymLink(); @@ -137,6 +139,8 @@ void formatToggleLinkColorHint(); void formatFrameNone(); void formatFrameRectangle(); + void formatIncludeImagesVer(); + void formatIncludeImagesHor(); void formatHideLinkUnselected(); void viewZoomReset(); diff -r 3674e9236634 -r 728f51b71e71 mapeditor.cpp --- a/mapeditor.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/mapeditor.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -27,15 +27,15 @@ #include "version.h" #include "api.h" +#include "editxlinkdialog.h" +#include "exports.h" +#include "extrainfodialog.h" +#include "linkablemapobj.h" +#include "mainwindow.h" +#include "misc.h" +#include "settings.h" +#include "texteditor.h" #include "xml.h" -#include "texteditor.h" -#include "linkablemapobj.h" -#include "exports.h" -#include "misc.h" -#include "mainwindow.h" -#include "extrainfodialog.h" -#include "editxlinkdialog.h" -#include "settings.h" extern TextEditor *textEditor; @@ -61,6 +61,7 @@ extern QAction *actionEditURL; extern QAction *actionEditHeading2URL; extern QAction *actionEditBugzilla2URL; +extern QAction *actionEditFATE2URL; extern QAction *actionEditOpenVymLink; extern QAction *actionEditVymLink; extern QAction *actionEditDeleteVymLink; @@ -96,6 +97,8 @@ extern QAction *actionFormatFrameRectangle; extern QActionGroup *actionGroupFormatLinkStyles; +extern QAction *actionFormatIncludeImagesVer; +extern QAction *actionFormatIncludeImagesHor; extern QAction *actionFormatHideLinkUnselected; extern QAction *actionFormatLinkStyleLine; extern QAction *actionFormatLinkStyleParabel; @@ -147,7 +150,7 @@ mapCenter->setVisibility (true); mapCenter->setMapEditor (this); mapCenter->setHeading (tr("New Map","Heading of mapcenter in new map")); - mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->width()/2); + mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->height()/2); printer=NULL; @@ -312,7 +315,6 @@ mapCanvas->resize (cw,ch); if ( (dx!=0) || (dy!=0) ) { - cout << "ME:: canvas="<moveAllBy(dx,dy); mapCenter->reposition(); @@ -1060,7 +1062,7 @@ void MapEditor::exportASCII() { // TODO still experimental - Export ex; + ExportBase ex; ex.setMapCenter(mapCenter); QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)")); @@ -1082,7 +1084,7 @@ mb.setButtonText( QMessageBox::Yes, tr("Overwrite") ); mb.setButtonText( QMessageBox::No, tr("Cancel")); - Export ex; + ExportBase ex; switch( mb.exec() ) { case QMessageBox::Yes: @@ -1095,7 +1097,7 @@ } } ex.setPath (fd->selectedFile() ); - ex.exportMap(); + ex.exportXML(); } } @@ -1122,7 +1124,7 @@ mb.setButtonText( QMessageBox::Yes, tr("Overwrite") ); mb.setButtonText( QMessageBox::No, tr("Cancel")); - Export ex; + ExportLaTeX ex; switch( mb.exec() ) { case QMessageBox::Yes: @@ -1134,7 +1136,7 @@ break; } } - Export ex; + ExportLaTeX ex; ex.setPath (fd->selectedFile() ); ex.setMapCenter(mapCenter); ex.exportLaTeX(); @@ -1178,10 +1180,10 @@ } } */ - Export ex; + ExportOO ex; //ex.setPath (fd->selectedFile() ); ex.setMapCenter(mapCenter); - ex.exportOOPresentation(); + ex.exportPresentation(); // } } @@ -2357,6 +2359,19 @@ } } +void MapEditor::editFATE2URL() +{ + if (selection && (typeid(*selection) == typeid(BranchObj) || + typeid(*selection) == typeid(MapCenterObj)) ) + { + BranchObj *bo=(BranchObj*)selection; + QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading(); + saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")"); + bo->setURL (url); + updateActions(); + } +} + void MapEditor::editVymLink() { if (selection && (typeid(*selection) == typeid(BranchObj) || @@ -2588,8 +2603,12 @@ default: break; } + actionFormatIncludeImagesVer->setOn + ( ((BranchObj*)selection)->getIncludeImagesVer()); + actionFormatIncludeImagesHor->setOn + ( ((BranchObj*)selection)->getIncludeImagesHor()); actionFormatHideLinkUnselected->setOn - ( selection->getHideLinkUnselected()); + (selection->getHideLinkUnselected()); } if ( (typeid(*selection) == typeid(FloatImageObj)) ) { @@ -2876,6 +2895,24 @@ } } +void MapEditor::setIncludeImagesVer(bool b) +{ + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj)) ) + ((BranchObj*)selection)->setIncludeImagesVer(b); + mapCenter->reposition(); +} + +void MapEditor::setIncludeImagesHor(bool b) +{ + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj)) ) + ((BranchObj*)selection)->setIncludeImagesHor(b); + mapCenter->reposition(); +} + void MapEditor::setHideLinkUnselected (bool b) { if (selection && @@ -3009,7 +3046,7 @@ void MapEditor::testFunction() { cout << "MapEditor::testFunction() called\n"; - load (clipboardDir+"/part.xml",ImportAdd); + mapCenter->move(mapCenter->x(),mapCenter->y()); } void MapEditor::ensureSelectionVisible() @@ -3234,11 +3271,6 @@ { FloatObj *fo=(FloatObj*)selection; saveState("move "+qpointToString(movingObj_orgPos),fo->getSelectString() ); - if (fo->getLinkStyle()==StyleUndef) - { - fo->setLinkStyle(fo->getDefLinkStyle()); - fo->setLinkColor(fo->getParObj()->getLinkColor()); - } fo->move (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() ); fo->setRelPos(); fo->reposition(); @@ -3264,11 +3296,7 @@ selection=(LinkableMapObj*)(fio); selection->select(); movingObj=(MapObj*)(fio); - // setLinkStyle calls updateLink, only set it once - if (fio->getLinkStyle()!=fio->getDefLinkStyle() ) - fio->setLinkStyle (fio->getDefLinkStyle()); } - // TODO if (typeid(*selection) == typeid(FloatTextObj)) } } else // selection != a FloatObj { @@ -3291,9 +3319,9 @@ if (lmosel->getOrientation() == OrientLeftOfCenter) // Add width of bbox here, otherwise alignRelTo will cause jumping around lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), - p.y()-movingObj_start.y() ); + p.y()-movingObj_start.y() +lmosel->getTopPad() ); else - lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() ); + lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() -lmosel->getTopPad()); } // reposition subbranch lmosel->reposition(); @@ -3316,7 +3344,7 @@ } else { lmosel->unsetParObjTmp(); - /* + /* FIXME not needed anymore? if (lmo &&(lmo==selection)) // Could link to myself (happens sometimes...) lmosel->unsetParObjTmp(); @@ -3403,6 +3431,13 @@ // Have we been moving something? if ( selection && movingObj ) { + // Moved FloatObj? Maybe we need to reposition + if(typeid(*selection)==typeid (FloatImageObj)) + { + selection->getParObj()->requestReposition(); + mapCenter->reposition(); + } + // Check if we are over another branch, but ignore // any found LMOs, which are FloatObjs dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), diff -r 3674e9236634 -r 728f51b71e71 mapeditor.h --- a/mapeditor.h Tue Jan 03 09:44:41 2006 +0000 +++ b/mapeditor.h Tue Jan 03 09:44:41 2006 +0000 @@ -10,6 +10,7 @@ #include #include "mapcenterobj.h" +#include "file.h" #include "misc.h" class QNetworkOperation; @@ -125,6 +126,7 @@ void editURL(); // edit the URL void editHeading2URL(); // copy heading to URL void editBugzilla2URL(); // create URL to Bugzilla + void editFATE2URL(); // create URL to FATE void editVymLink(); // edit link to another map void deleteVymLink(); // delete link to another map QString getVymLink(); // return path to map @@ -152,6 +154,8 @@ void saveFloatImage (int); void toggleFloatExport(); void setFrame(const FrameType &); + void setIncludeImagesVer(bool); + void setIncludeImagesHor(bool); void setHideLinkUnselected (bool); bool getHideLinkUnselected (); private: diff -r 3674e9236634 -r 728f51b71e71 mapobj.cpp --- a/mapobj.cpp Tue Jan 03 09:44:41 2006 +0000 +++ b/mapobj.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -82,17 +82,22 @@ absPos.setX( xi); absPos.setY( yi); bbox.moveTopLeft(QPoint(xi,yi)); + clickBox.moveTopLeft(QPoint(xi,yi)); } void MapObj::moveBy (double x, double y) { + int ix=(int)x; + int iy=(int)y; move (x+absPos.x(),y+absPos.y() ); + bbox.moveBy (ix,iy); + clickBox.moveBy (ix,iy); } -bool MapObj::inBBox(QPoint p) +bool MapObj::inBox(const QPoint &p) { - if (p.x() >= bbox.left() && p.x() <= bbox.right() - && p.y() <= bbox.bottom() && p.y() >= bbox.top() ) + if (p.x() >= clickBox.left() && p.x() <= clickBox.right() + && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() ) return true; return false; } @@ -103,7 +108,9 @@ } QRect MapObj::addBBox(QRect r1, QRect r2) -{ +{ + // Find smallest QRect containing given rectangles + QRect n; // Set left border if (r1.left() <= r2.left() ) diff -r 3674e9236634 -r 728f51b71e71 mapobj.h --- a/mapobj.h Tue Jan 03 09:44:41 2006 +0000 +++ b/mapobj.h Tue Jan 03 09:44:41 2006 +0000 @@ -32,17 +32,18 @@ virtual QString getPos(); // Return position as string (x,y) virtual void move (double x,double y); // move to absolute Position virtual void moveBy (double x,double y); // move to relative Position - virtual bool inBBox(QPoint); // Check if Point is in bbox + virtual bool inBox(const QPoint&); // Check if Point is within clickbox virtual QRect getBBox(); // returns bounding box virtual QRect addBBox(QRect,QRect); // returns bbox which includes both boxes virtual QSize getSize(); // returns size of bounding box virtual bool isVisibleObj(); virtual void setVisibility(bool); + virtual void positionBBox()=0; + virtual void calcBBoxSize()=0; protected: QCanvas* canvas; QRect bbox; // bounding box of MO itself - virtual void positionBBox()=0; - virtual void calcBBoxSize()=0; + QRect clickBox; // area where mouseclicks are found QPoint absPos; // Position on canvas bool visible; };