diff options
Diffstat (limited to 'extensions/source/scanner')
-rw-r--r-- | extensions/source/scanner/grid.cxx | 46 | ||||
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 76 |
2 files changed, 61 insertions, 61 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 85f22fb017e7..110779c55080 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -523,32 +523,32 @@ void GridWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl bool GridWindow::MouseMove( const MouseEvent& rEvt ) { - if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != npos ) - { - Point aPoint( rEvt.GetPosPixel() ); + if( rEvt.GetButtons() != MOUSE_LEFT || m_nDragIndex == npos ) + return false; - if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1) - { - aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() ); - } - else - { - if(aPoint.X() < m_aGridArea.Left()) - aPoint.setX( m_aGridArea.Left() ); - else if(aPoint.X() > m_aGridArea.Right()) - aPoint.setX( m_aGridArea.Right() ); - } + Point aPoint( rEvt.GetPosPixel() ); + + if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1) + { + aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() ); + } + else + { + if(aPoint.X() < m_aGridArea.Left()) + aPoint.setX( m_aGridArea.Left() ); + else if(aPoint.X() > m_aGridArea.Right()) + aPoint.setX( m_aGridArea.Right() ); + } - if( aPoint.Y() < m_aGridArea.Top() ) - aPoint.setY( m_aGridArea.Top() ); - else if( aPoint.Y() > m_aGridArea.Bottom() ) - aPoint.setY( m_aGridArea.Bottom() ); + if( aPoint.Y() < m_aGridArea.Top() ) + aPoint.setY( m_aGridArea.Top() ); + else if( aPoint.Y() > m_aGridArea.Bottom() ) + aPoint.setY( m_aGridArea.Bottom() ); - if( aPoint != m_aHandles[m_nDragIndex].maPos ) - { - m_aHandles[m_nDragIndex].maPos = aPoint; - Invalidate( m_aGridArea ); - } + if( aPoint != m_aHandles[m_nDragIndex].maPos ) + { + m_aHandles[m_nDragIndex].maPos = aPoint; + Invalidate( m_aGridArea ); } return false; diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index e76575cd9bc9..8486195c93e6 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -1052,46 +1052,46 @@ void SaneDlg::EstablishButtonOption() bool ScanPreview::MouseMove(const MouseEvent& rMEvt) { - if( mbIsDragging ) + if( !mbIsDragging ) + return false; + + Point aMousePos = rMEvt.GetPosPixel(); + // move into valid area + Point aLogicPos = GetLogicPos( aMousePos ); + aMousePos = GetPixelPos( aLogicPos ); + switch( meDragDirection ) { - Point aMousePos = rMEvt.GetPosPixel(); - // move into valid area - Point aLogicPos = GetLogicPos( aMousePos ); - aMousePos = GetPixelPos( aLogicPos ); - switch( meDragDirection ) - { - case TopLeft: maTopLeft = aMousePos; break; - case Top: maTopLeft.setY( aMousePos.Y() ); break; - case TopRight: - maTopLeft.setY( aMousePos.Y() ); - maBottomRight.setX( aMousePos.X() ); - break; - case Right: maBottomRight.setX( aMousePos.X() ); break; - case BottomRight: maBottomRight = aMousePos; break; - case Bottom: maBottomRight.setY( aMousePos.Y() ); break; - case BottomLeft: - maTopLeft.setX( aMousePos.X() ); - maBottomRight.setY( aMousePos.Y() ); - break; - case Left: maTopLeft.setX( aMousePos.X() ); break; - default: break; - } - int nSwap; - if( maTopLeft.X() > maBottomRight.X() ) - { - nSwap = maTopLeft.X(); - maTopLeft.setX( maBottomRight.X() ); - maBottomRight.setX( nSwap ); - } - if( maTopLeft.Y() > maBottomRight.Y() ) - { - nSwap = maTopLeft.Y(); - maTopLeft.setY( maBottomRight.Y() ); - maBottomRight.setY( nSwap ); - } - Invalidate(); - mpParentDialog->UpdateScanArea(false); + case TopLeft: maTopLeft = aMousePos; break; + case Top: maTopLeft.setY( aMousePos.Y() ); break; + case TopRight: + maTopLeft.setY( aMousePos.Y() ); + maBottomRight.setX( aMousePos.X() ); + break; + case Right: maBottomRight.setX( aMousePos.X() ); break; + case BottomRight: maBottomRight = aMousePos; break; + case Bottom: maBottomRight.setY( aMousePos.Y() ); break; + case BottomLeft: + maTopLeft.setX( aMousePos.X() ); + maBottomRight.setY( aMousePos.Y() ); + break; + case Left: maTopLeft.setX( aMousePos.X() ); break; + default: break; + } + int nSwap; + if( maTopLeft.X() > maBottomRight.X() ) + { + nSwap = maTopLeft.X(); + maTopLeft.setX( maBottomRight.X() ); + maBottomRight.setX( nSwap ); + } + if( maTopLeft.Y() > maBottomRight.Y() ) + { + nSwap = maTopLeft.Y(); + maTopLeft.setY( maBottomRight.Y() ); + maBottomRight.setY( nSwap ); } + Invalidate(); + mpParentDialog->UpdateScanArea(false); return false; } |