void RosegardenScrollView::viewportMouseDoubleClickEvent(QMouseEvent* e) { QMouseEvent ce(e->type(), viewportToContents(e->pos()), e->globalPos(), e->button(), e->buttons(), e->modifiers()); contentsMouseDoubleClickEvent(&ce); if (!ce.isAccepted()) e->ignore(); }
void DrawZone::contentsMousePressEvent(QMouseEvent* e) { if ( ! imageMapEditor->isReadWrite()) return; drawStart=e->pos(); // Check if it's on picture if not // move it to the picture's border if (!imageRect.contains(drawStart)) { if (drawStart.x()>imageRect.right()) drawStart.setX(imageRect.right()); if (drawStart.x()<imageRect.left()) drawStart.setX(imageRect.left()); if (drawStart.y()>imageRect.bottom()) drawStart.setY(imageRect.bottom()); if (drawStart.y()<imageRect.top()) drawStart.setY(imageRect.top()); } // Translate it to picture coordinates drawStart-=imageRect.topLeft(); QPoint zoomedPoint = drawStart; drawStart=translateFromZoom(drawStart); delete oldArea; oldArea=0L; if (currentArea) { oldArea=currentArea->clone(); } if ( currentAction==None ) { if (e->button()==RightButton) { if ( (currentArea=imageMapEditor->onArea(drawStart)) ) { if ( ! currentArea->isSelected()) { imageMapEditor->deselectAll(); imageMapEditor->select(currentArea); } currentArea=imageMapEditor->selected(); } imageMapEditor->slotShowMainPopupMenu(e->globalPos()); } else if (e->button()==MidButton) { contentsMouseDoubleClickEvent(e); } else // LeftClick on selectionpoint if ((currentArea=imageMapEditor->selected()) && (currentSelectionPoint=currentArea->onSelectionPoint(zoomedPoint,_zoom))) { oldArea=currentArea->clone(); if ( (imageMapEditor->currentToolType() == KImageMapEditor::RemovePoint) && (imageMapEditor->selected()->selectionPoints()->count()>3) ) { currentAction=RemovePoint; } else { currentAction=MoveSelectionPoint; currentArea->setMoving(true); } } else // leftclick not on selectionpoint but on area if ((currentArea=imageMapEditor->onArea(drawStart))) { if ( imageMapEditor->currentToolType() == KImageMapEditor::AddPoint ) { currentAction=AddPoint; viewport()->setCursor(AddPointCursor); oldArea=currentArea->clone(); } else { currentAction=MoveArea; viewport()->setCursor(sizeAllCursor); if ( currentArea->isSelected() ) { if ( (e->state() & ControlButton) ) imageMapEditor->deselect(currentArea); } else { if ( (e->state() & ControlButton) ) imageMapEditor->select( currentArea ); else { imageMapEditor->deselectAll(); imageMapEditor->select( currentArea ); } } currentArea = imageMapEditor->selected(); currentArea->setMoving(true); oldArea=currentArea->clone(); } } else // leftclick on the background if ( (imageMapEditor->currentToolType()==KImageMapEditor::Rectangle) || (imageMapEditor->currentToolType()==KImageMapEditor::Circle) || (imageMapEditor->currentToolType()==KImageMapEditor::Polygon) || (imageMapEditor->currentToolType()==KImageMapEditor::Freehand)) { currentArea=AreaCreator::create(imageMapEditor->currentToolType()); currentArea->setRect(QRect(drawStart,drawStart)); currentArea->setSelected(false); imageMapEditor->deselectAll(); switch (imageMapEditor->currentToolType()) { case KImageMapEditor::Rectangle : currentAction=DrawRectangle; break; case KImageMapEditor::Circle : currentAction=DrawCircle; break; case KImageMapEditor::Polygon : currentAction=DrawPolygon; currentArea->addCoord(drawStart); currentSelectionPoint=currentArea->selectionPoints()->last(); break; case KImageMapEditor::Freehand : currentAction=DrawFreehand; //currentArea->addCoord(drawStart); currentArea->setFinished(false); break; default: break; } } else // leftclicked with the arrow at an areafree position if (imageMapEditor->currentToolType()==KImageMapEditor::Selection) { currentArea=0L; imageMapEditor->deselectAll(); // Start drawing a selection rectangle currentAction=DoSelect; oldSelectionRect = imageRect; } } else if ( currentAction==DrawPolygon) { } QRect r; if (oldArea) r=oldArea->selectionRect(); if (currentArea) { r= r | currentArea->selectionRect(); repaintContents(translateToZoom(r),false); } }