diff -r 2876353ea150 -r d251c7b2de54 mapeditor.cpp --- a/mapeditor.cpp Wed Sep 23 12:14:08 2009 +0000 +++ b/mapeditor.cpp Thu Oct 01 11:28:50 2009 +0000 @@ -64,6 +64,7 @@ pickingColor=false; drawingLink=false; copyingObj=false; + objectMoved=false; editingBO=NULL; movingObj=NULL; @@ -184,17 +185,20 @@ return mapScene; } -void MapEditor::scrollTo (const QModelIndex &index) +void MapEditor::scrollTo (const QModelIndex &index) //FIXME-1 problems with locating stuff in big maps { - //cout <<"ME::scrollTo aborted\n"; - //return; if (index.isValid()) { LinkableMapObj* lmo=NULL; TreeItem *ti= static_cast(index.internalPointer()); if (ti->getType()==TreeItem::Image ||ti->isBranchLikeType() ) lmo=((MapItem*)ti)->getLMO(); - if (lmo) setScrollBarPosTarget (lmo->getBBox() ); + if (lmo) + { + QRectF r=lmo->getBBox(); + cout << "ME::scrollTo "<getHeadingStd()<<" tL="<select (lmo); + if (foname=="system-url") { if (e->state() & Qt::ControlModifier) mainWindow->editOpenURLTab(); @@ -1124,14 +1139,16 @@ // Move the selected MapObj if ( lmosel && movingObj) { + objectMoved=true; // reset cursor if we are moving and don't copy if (mainWindow->getModMode()!=Main::ModModeCopy) setCursor (Qt::ArrowCursor); // To avoid jumping of the sceneView, only // show selection, if not tmp linked - if (!lmosel->hasParObjTmp()) + /* FIXME-2 if (!lmosel->hasParObjTmp()) model->emitShowSelection(); + */ // Now move the selection, but add relative position // (movingObj_start) where selection was chosen with @@ -1183,9 +1200,8 @@ } } else { // selection != a FloatObj - if (seli->depth()==0) //FIXME-1 also moved mapcenters could be linked, but not working so far + if (seli->depth()==0) { - // Move MapCenter // FIXME-1 scrolls way too much with shift pressed lmosel->move (p-movingObj_start); if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) { @@ -1373,7 +1389,7 @@ QString preSelStr=model->getSelectString(seli); copyingObj=false; - if (dsti) + if (dsti && objectMoved) { // We have a destination, relink to that @@ -1444,14 +1460,11 @@ if (settings.value("/animation/use",false).toBool() && seli->depth()>1) { lmosel->setRelPos(); // calc relPos first for starting point - QPointF dst=bi->getBranchObj()->getParObj()->getChildPos(); // FIXME-3 check getBO here... - // if (lmosel->getOrientation()==LinkableMapObj::LeftOfCenter) dst.setX (dst.x()+lmosel->width() ); model->startAnimation( (BranchObj*)lmosel, lmosel->getRelPos(), movingObj_orgRelPos -// QPointF (movingObj_orgPos.x() - dst.x(), movingObj_orgPos.y() - dst.y() ) ); } else model->reposition(); @@ -1461,9 +1474,8 @@ // Finally resize scene, if needed scene()->update(); movingObj=NULL; + objectMoved=false; - // Just make sure, that actions are still ok,e.g. the move branch up/down buttons... - // model->updateActions(); FIXME-3 neeeded? } else // maybe we moved View: set old cursor setCursor (Qt::ArrowCursor); @@ -1472,6 +1484,9 @@ void MapEditor::mouseDoubleClickEvent(QMouseEvent* e) { + if (debug) cout << "ME p="<pos())<isSelectionBlocked() ) { e->ignore(); @@ -1648,12 +1663,12 @@ do_reposition=true; } } - scrollTo (ix); if (ti->isBranchLikeType() || ti->getType()==TreeItem::Image) // Show link if needed ((MapItem*)ti)->getLMO()->updateVisibility(); } } + // FIXME-3 cout << "ME::updateSel doRepos="<reposition(); // Reduce rectangles