[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kviewshell
From: Wilfried Huss <Wilfried.Huss () gmx ! at>
Date: 2005-04-13 15:19:32
Message-ID: 20050413151932.E8246492 () office ! kde ! org
[Download RAW message or body]
CVS commit by whuss:
Don't loose the current position in the document, if the zoomlevel is changed.
M +13 -2 centeringScrollview.cpp 1.39
M +3 -2 centeringScrollview.h 1.28
M +1 -1 kmultipage.cpp 1.73
--- kdegraphics/kviewshell/centeringScrollview.cpp #1.38:1.39
@@ -260,5 +260,5 @@ void CenteringScrollview::setFullScreenM
}
-void CenteringScrollview::layoutPages()
+void CenteringScrollview::layoutPages(bool zoomChanged)
{
// Paranoid safety check
@@ -342,8 +342,19 @@ void CenteringScrollview::layoutPages()
centeringTop = ( newViewportSize.height() - totalHeight)/2;
- // Re-draw the viewport background so that old shadows are removed
+ // Resize the viewport
if (((Q_UINT32)contentsWidth() != totalWidth) || ((Q_UINT32)contentsHeight() != \
totalHeight)) + {
+ // Calculate the point in the coordinates of the contents which is currently at \
the center of the viewport. + QPoint midPoint = QPoint(visibleWidth() / 2 + \
contentsX(), visibleHeight() / 2 + contentsY()); + double midPointRatioX = \
(double)(midPoint.x()) / contentsWidth(); + double midPointRatioY = \
(double)(midPoint.y()) / contentsHeight(); +
resizeContents(totalWidth,totalHeight);
+ // If the zoom changed recenter the former midPoint
+ if (zoomChanged)
+ center((int)(contentsWidth() * midPointRatioX), (int)(contentsHeight() * \
midPointRatioY)); + }
+
// Finally, calculate the left and top coordinates of each row and
// column, respectively
--- kdegraphics/kviewshell/centeringScrollview.h #1.27:1.28
@@ -85,6 +85,7 @@ public slots:
void slotShowScrollbars(bool);
- /** Set layout of the page widgets according to the current viewmode and \
zoomlevel. */
- void layoutPages();
+ /** Set layout of the page widgets according to the current viewmode and \
zoomlevel. + Set zoomChanged = true if the the layout needs updateing because \
the zoomlevel has changed. */ + void layoutPages(bool zoomChanged = false);
signals:
--- kdegraphics/kviewshell/kmultipage.cpp #1.72:1.73
@@ -738,5 +738,5 @@ void KMultiPage::repaintAllVisibleWidget
// widgets.
if (everResized == true)
- scrollView()->layoutPages();
+ scrollView()->layoutPages(true);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic