[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kspread (silent)
From:       Stefan Nikolaus <stefan.nikolaus () kdemail ! net>
Date:       2006-08-19 15:27:45
Message-ID: 1156001265.359048.26601.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 574621 by nikolaus:

Cleanup	Rename Canvas::cellsInArea() to Canvas::viewToCellCoordinates().
SVN_SILENT


 M  +12 -17    Canvas.cpp  
 M  +2 -2      Canvas.h  


--- trunk/koffice/kspread/Canvas.cpp #574620:574621
@@ -881,9 +881,8 @@
     if ( ( obj = getObject( p, sheet ) ) && obj->isSelected() )
     {
       KoRect const bound = obj->geometry();
-      QRect zoomedBound = doc()->zoomRectOld( KoRect(bound.left(), bound.top(),
-      bound.width(),
-      bound.height() ) );
+      QRect zoomedBound = doc()->zoomRectOld( KoRect( bound.left(), bound.top(),
+                                                      bound.width(), bound.height() \
                ) );
       zoomedBound.translate( (int)(-xOffset() * doc()->zoomedResolutionX() ), \
(int)(-yOffset() * doc()->zoomedResolutionY() ));  setCursor( obj->getCursor( p, \
d->modType, zoomedBound ) );  return;
@@ -3930,28 +3929,26 @@
   d->view->hBorderWidget()->equalizeColumn(size);
 }
 
-QRect Canvas::cellsInArea( const QRect area ) const
+QRect Canvas::viewToCellCoordinates( const QRectF& viewRegion ) const
 {
   register Sheet * const sheet = activeSheet();
   if (!sheet)
     return QRect();
 
-  KoRect unzoomedRect = d->view->doc()->unzoomRectOld( area );
-  unzoomedRect.moveBy( (int)xOffset(), (int)yOffset() );
+  const QRectF unzoomedRect = doc()->viewToDocument( viewRegion ).translated( \
xOffset(), yOffset() );  
-  	double tmp;
-  	int left_col = sheet->leftColumn( unzoomedRect.left(), tmp );
-  	int right_col = sheet->rightColumn( unzoomedRect.right() );
-  	int top_row = sheet->topRow( unzoomedRect.top(), tmp );
-  	int bottom_row = sheet->bottomRow( unzoomedRect.bottom() );
+  double tmp;
+  const int left = sheet->leftColumn( unzoomedRect.left(), tmp );
+  const int right = sheet->rightColumn( unzoomedRect.right() );
+  const int top = sheet->topRow( unzoomedRect.top(), tmp );
+  const int bottom = sheet->bottomRow( unzoomedRect.bottom() );
 
-  	return QRect( left_col, top_row,
-                right_col - left_col + 1, bottom_row - top_row + 1 );
+  return QRect( left, top, right - left + 1, bottom - top + 1 );
 }
 
 QRect Canvas::visibleCells() const
 {
-  return cellsInArea( QRect( 0, 0, width(), height() ) );
+  return viewToCellCoordinates( QRectF( 0, 0, width(), height() ) );
 }
 
 
@@ -3970,7 +3967,6 @@
   QPainter painter(this);
 
   //Save clip region
-  QRegion rgnComplete( painter.clipRegion() );
   QMatrix matrix;
   if ( d->view )
   {
@@ -4114,7 +4110,6 @@
 
   //restore clip region with children area
   painter.restore();
-  //painter.setClipRegion( rgnComplete );
 }
 
 
@@ -4184,7 +4179,7 @@
 	   canvasRelativeGeometry.translate( (int)( -xOffset()*doc()->zoomedResolutionX() ) \
,  (int)( -yOffset() * doc()->zoomedResolutionY()) );
 
-	   const QRect cellsUnderObject=cellsInArea( canvasRelativeGeometry );
+	   const QRect cellsUnderObject = viewToCellCoordinates( canvasRelativeGeometry );
 	   bool redraw=false;
 
       Region paintDirtyList = sheet->paintDirtyData();
--- trunk/koffice/kspread/Canvas.h #574620:574621
@@ -470,11 +470,11 @@
 
     /**
      * Returns the range of cells which appear in the specified area of the Canvas \
                widget
-     * For example, cellsInArea( QRect(0,0,width(),height()) ) returns a range \
containing all visible cells +     * For example, viewToCellCoordinates( \
                QRect(0,0,width(),height()) ) returns a range containing all visible \
                cells
      *
      * @param area The area (in pixels) on the Canvas widget
      */
-    QRect cellsInArea( const QRect area ) const;
+    QRect viewToCellCoordinates( const QRectF& area ) const;
 
     /**
      * Paints the children


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic