Hello, I tried to fix the following three issues: - A drawing bug in the rulers - Incorrect display of the position in the statusbar - A drawing bug when selecting objects. The first issue is a drawing bug in the rulers. When you move the mouse pointer over one of the rulers, the postion line is not removed. So, after a while, you can end up with an unreadable ruler. To solve this, I forward the events of the rulers to the canvas So, if I move the mouse over one of the rulers, the position line is updated too. The second issue is the inccorect display of the mouse position, in the statusbar. For this I would have liked to use VCanvas::toContents, but that's a very weird function, as it flips the Y axis 180° in the point it returns, so if you move the mouse up, the y position increases while it should decrease (as the top of the page is the 0 position), and when you move the mouse down, the y position decreases. Changing the behaviour of VCanvas::toContents breaks a lot more than it fixes. I guess the ruler update() functions can be removed or put in an if(releaseEvent) { ... } if the performance is suffering from those functions, but I didn't observe performance loss. The last issue was a bit more complex. If you start Karbon with a new drawing, and you can view the complete "white page" in the canvas: Scroll the canvas down with the scrollbar (scroll the scrollbar up), then select the left upper corner of the "white page" for example, you'll probably see the top of the white page being "copied" on top of itself. If nobody objects I'll commit the patch saturday. The patch: Index: karbon_view.cc =================================================================== --- karbon_view.cc (revision 414394) +++ karbon_view.cc (working copy) @@ -169,6 +169,9 @@ m_horizRuler->show(); m_vertRuler->show(); + m_horizRuler->installEventFilter(m_canvas); + m_vertRuler->installEventFilter(m_canvas); + // set up factory m_painterFactory = new VPainterFactory; m_painterFactory->setPainter( canvasWidget()->pixmap(), width(), height() ); @@ -968,21 +971,24 @@ bool KarbonView::mouseEvent( QMouseEvent* event, const KoPoint &p ) { - if( event->type() == QEvent::Enter ) - { - QMouseEvent* mouseEvent = static_cast( event ); - m_horizRuler->setMousePos( mouseEvent->pos().x(), mouseEvent->pos().y() ); - m_vertRuler->setMousePos( mouseEvent->pos().x(), mouseEvent->pos().y() ); - m_horizRuler->update(); - m_vertRuler->update(); - } - else if( event->type() == QEvent::MouseMove ) - { - QMouseEvent* mouseEvent = static_cast( event ); - m_horizRuler->setMousePos( mouseEvent->pos().x(), mouseEvent->pos().y() ); - m_vertRuler->setMousePos( mouseEvent->pos().x(), mouseEvent->pos().y() ); - m_cursorCoords->setText( QString( "%1, %2" ).arg( p.x(), 0, 'f', 2 ).arg( p.y(), 0, 'f', 2 ) ); - } + int mx = event->pos().x(); + int my = event->pos().y(); + + m_horizRuler->setMousePos( mx, my ); + m_vertRuler->setMousePos( mx, my ); + + m_horizRuler->update(); + m_vertRuler->update(); + + KoPoint xy; + xy.setX((mx + canvasWidget()->contentsX() - canvasWidget()->pageOffsetX())/zoom()); + xy.setY((my + canvasWidget()->contentsY() - canvasWidget()->pageOffsetY())/zoom()); + + xy.setX(KoUnit::toUserValue(xy.x(), part()->unit())); + xy.setY(KoUnit::toUserValue(xy.y(), part()->unit())); + + m_cursorCoords->setText( QString( "%1, %2" ).arg(KGlobal::_locale->formatNumber(xy.x(), 2)).arg(KGlobal::_locale->formatNumber(xy.y(), 2)) ); + part()->toolController()->setActiveView( this ); if( part()->toolController() ) return part()->toolController()->mouseEvent( event, p ); Index: widgets/vcanvas.cc =================================================================== --- widgets/vcanvas.cc (revision 414394) +++ widgets/vcanvas.cc (working copy) @@ -342,21 +342,9 @@ /// repaints just a rect area (no scrolling) void -VCanvas::repaintAll( const KoRect & ) +VCanvas::repaintAll( const KoRect &r ) { - //if( m_view->layersDocker() ) -// m_view->layersDocker()->updatePreviews(); - VPainter *p = m_view->painterFactory()->painter(); - KoRect rect = KoRect::fromQRect( this->rect() ); - p->blit( rect ); - - // draw handle: - VQPainter qpainter( p->device() ); - setYMirroring( &qpainter ); - qpainter.setZoomFactor( m_view->zoom() ); - m_part->document().selection()->draw( &qpainter, m_view->zoom() ); - - bitBlt( viewport(), QPoint( int( rect.x() ), int( rect.y() ) ), p->device(), rect.toQRect() ); + drawDocument( 0, r ); } _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel