Horizontal scrollbar patch to test for win32

From: Jordi Mas <jmas_at_softcatala.org>
Date: Thu Jan 26 2006 - 19:32:10 CET

Hi folks,

On Win32 we are always getting the horizontal scrollbar does not matter if is
need it or not.

I put together a patch to fix this an to mimic the Linux behaviour. I'll like
someone else on Win32 to also try it before I commit it.

Thanks,

-- 
Jordi Mas i Hernāndez, HomePage http://www.softcatala.org/~jmas/
Bloc personal http://www.softcatala.org/~jmas/bloc/
Planeta Softcatalā: http://www.softcatala.org/planet/

Index: wp/ap/win/ap_Win32FrameImpl.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32FrameImpl.cpp,v
retrieving revision 1.48
diff -u -r1.48 ap_Win32FrameImpl.cpp
--- wp/ap/win/ap_Win32FrameImpl.cpp 26 Jan 2006 12:48:48 -0000 1.48
+++ wp/ap/win/ap_Win32FrameImpl.cpp 26 Jan 2006 18:26:27 -0000
@@ -512,8 +512,8 @@
         RECT r;
         GetClientRect(m_hwndDocument, &r);
         const UT_uint32 iWindowWidth = r.right - r.left;
- const UT_uint32 iWidth = pView->getGraphics()->tdu(pData->m_pDocLayout->getWidth());
-
+ const UT_uint32 iWidth = pView->getGraphics()->tdu(pData->m_pDocLayout->getWidth());
+ XAP_Frame::tZoomType tZoom = getFrame()->getZoomType();
         SCROLLINFO si = { 0 };
 
         si.cbSize = sizeof(si);
@@ -524,7 +524,33 @@
         si.nPage = iWindowWidth;
         SetScrollInfo(m_hWndHScroll, SB_CTL, &si, TRUE);
 
- pView->sendHorizontalScrollEvent(pView->getGraphics()->tlu(si.nPos),pView->getGraphics()->tlu(si.nMax-si.nPage));
+ pView->sendHorizontalScrollEvent(pView->getGraphics()->tlu(si.nPos),pView->getGraphics()->tlu(si.nMax-si.nPage));
+
+ // hide the horizontal scrollbar if the scroll range is such that the window can contain it all
+ // show it otherwise
+ // Hide the horizontal scrollbar if we've set to page width or fit to page.
+ // This stops a resizing race condition.
+ if (iWidth <= iWindowWidth || tZoom == XAP_Frame::z_PAGEWIDTH || tZoom == XAP_Frame::z_WHOLEPAGE)
+ {
+ if (IsWindowVisible (m_hWndHScroll)) {
+ RECT r;
+
+ ShowWindow(m_hWndHScroll, SW_HIDE);
+ GetClientRect(m_hwndContainer, &r);
+ _onSize(pData, r.right - r.left, r.bottom - r.top);
+ }
+ }
+ else
+ {
+ if (!IsWindowVisible (m_hWndHScroll)) {
+ RECT r;
+
+ ShowWindow(m_hWndHScroll, SW_NORMAL);
+ GetClientRect(m_hwndContainer, &r);
+ _onSize(pData, r.right - r.left, r.bottom - r.top);
+ }
+ }
+
 }
 
 void AP_Win32FrameImpl::_setYScrollRange(AP_FrameData * pData, AV_View *pView)
@@ -649,16 +675,20 @@
         UT_return_if_fail(m_hWndHScroll);
         UT_return_if_fail(m_hWndGripperHack);
 
- const int cyHScroll = GetSystemMetrics(SM_CYHSCROLL);
+ int cyHScroll = GetSystemMetrics(SM_CYHSCROLL);
         const int cxVScroll = GetSystemMetrics(SM_CXVSCROLL);
         int yTopRulerHeight = 0;
- int xLeftRulerWidth = 0;
-
- _getRulerSizes(pData, yTopRulerHeight, xLeftRulerWidth);
+ int xLeftRulerWidth = 0;
 
- MoveWindow(m_hWndVScroll, nWidth-cxVScroll, 0, cxVScroll, nHeight-cyHScroll, TRUE);
- MoveWindow(m_hWndHScroll, 0, nHeight-cyHScroll, nWidth - cxVScroll, cyHScroll, TRUE);
+ _getRulerSizes(pData, yTopRulerHeight, xLeftRulerWidth);
+
+ MoveWindow(m_hWndHScroll, 0, nHeight-cyHScroll, nWidth - cxVScroll, cyHScroll, TRUE);
+
+ if (IsWindowVisible (m_hWndHScroll) == FALSE)
+ cyHScroll = 0;
+
         MoveWindow(m_hWndGripperHack, nWidth-cxVScroll, nHeight-cyHScroll, cxVScroll, cyHScroll, TRUE);
+ MoveWindow(m_hWndVScroll, nWidth-cxVScroll, 0, cxVScroll, nHeight-cyHScroll, TRUE);
 
 
         if (m_hwndTopRuler)
Received on Thu Jan 26 19:35:09 2006

This archive was generated by hypermail 2.1.8 : Thu Jan 26 2006 - 19:35:10 CET