? src/WIN32_1.3.9_i386_OBJ Index: src/af/xap/xp/xap_Frame.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/xp/xap_Frame.cpp,v retrieving revision 1.80 diff -u -5 -b -B -d -w -r1.80 xap_Frame.cpp --- src/af/xap/xp/xap_Frame.cpp 1 Feb 2002 00:17:07 -0000 1.80 +++ src/af/xap/xp/xap_Frame.cpp 14 Mar 2002 06:53:29 -0000 @@ -341,20 +341,33 @@ pApp->getPrefsValue(XAP_PREF_KEY_ZoomType, stTmp); if( UT_stricmp( stTmp.c_str(), "100" ) == 0 ) { m_zoomType = z_100; } + else if( UT_stricmp( stTmp.c_str(), "75" ) == 0 ) + { + m_zoomType = z_75; + } else if( UT_stricmp( stTmp.c_str(), "Width" ) == 0 ) { m_zoomType = z_PAGEWIDTH; } else if( UT_stricmp( stTmp.c_str(), "Page" ) == 0 ) { m_zoomType = z_WHOLEPAGE; } else { + UT_uint32 iZoom = atoi( stTmp.c_str() ); + + // TODO: are these limits defined somewhere? for now using apparent limits under Win32 + if ((iZoom <= 500) && (iZoom >= 10)) + { + setZoomType( z_PERCENT ); + setZoomPercentage( iZoom ); + } + else m_zoomType = z_100; } ////////////////////////////////////////////////////////////////// Index: src/wp/ap/win/ap_Win32Frame.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Frame.cpp,v retrieving revision 1.81 diff -u -5 -b -B -d -w -r1.81 ap_Win32Frame.cpp --- src/wp/ap/win/ap_Win32Frame.cpp 27 Feb 2002 16:53:28 -0000 1.81 +++ src/wp/ap/win/ap_Win32Frame.cpp 14 Mar 2002 06:53:58 -0000 @@ -148,18 +148,66 @@ return; } /*****************************************************************/ + +/* m_iZoom is only used by getZoomPercentage, and only when + the Frame has not yet created a GR_Graphics (==NULL) object, + otherwise the zoomPercentage specified by the GR_Graphics + object is used. setZoomPercentage may set both (m_iZoom + directly and the GR_Graphic object's zoom within _showDocument) + m_iZoom defaults to 100 if not explicitly set as this is + what it previously was always set to if _showDocument was + called without an iZoom parameter. + [Note zoom percentages only apply when zoomType == z_PERCENT] +*/ + void AP_Win32Frame::setZoomPercentage(UT_uint32 iZoom) { + m_iZoom = iZoom; _showDocument(iZoom); } UT_uint32 AP_Win32Frame::getZoomPercentage(void) { - return static_cast(m_pData)->m_pG->getZoomPercentage(); + register UT_uint32 iZoom; + switch (getZoomType()) + { + case z_200: + { + iZoom = 200; + break; + } + case z_100: + { + iZoom = 100; + break; + } + case z_75: + { + iZoom = 75; + break; + } + case z_PERCENT: + { + GR_Graphics * pG = (m_pData)?static_cast(m_pData)->m_pG : NULL; + if (pG == NULL) + iZoom = m_iZoom; + else + iZoom = pG->getZoomPercentage(); + break; + } + // TODO: what's the correct iZoom for z_PAGEWIDTH or z_WHOLEPAGE + default: + { + iZoom = 100; + break; + } + } + + return iZoom; } UT_Error AP_Win32Frame::_showDocument(UT_uint32 iZoom) { if (!m_pDoc) @@ -187,10 +235,12 @@ HWND hwnd = m_hwndDocument; pG = new GR_Win32Graphics(GetDC(hwnd), hwnd, getApp()); ENSUREP(pG); + // Note: if iZoom is nonzero we use its value, otherwise assume we should query for it + if (!iZoom) iZoom = getZoomPercentage(); pG->setZoomPercentage(iZoom); pDocLayout = new FL_DocLayout(static_cast(m_pDoc), pG); ENSUREP(pDocLayout); @@ -469,11 +519,12 @@ : XAP_Win32Frame(app), m_bMouseWheelTrack(false), m_bMouseActivateReceived(false), m_hWndHScroll(0), m_hWndVScroll(0), - m_hWndGripperHack(0) + m_hWndGripperHack(0), + m_iZoom(100) { m_hwndContainer = NULL; m_hwndTopRuler = NULL; m_hwndLeftRuler = NULL; m_hwndDocument = NULL; @@ -484,11 +535,12 @@ : XAP_Win32Frame(static_cast(f)), m_bMouseWheelTrack(false), m_bMouseActivateReceived(false), m_hWndHScroll(0), m_hWndVScroll(0), - m_hWndGripperHack(0) + m_hWndGripperHack(0), + m_iZoom(100) { m_hwndContainer = NULL; m_hwndTopRuler = NULL; m_hwndLeftRuler = NULL; m_hwndDocument = NULL; Index: src/wp/ap/win/ap_Win32Frame.h =================================================================== RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Frame.h,v retrieving revision 1.30 diff -u -5 -b -B -d -w -r1.30 ap_Win32Frame.h --- src/wp/ap/win/ap_Win32Frame.h 4 Feb 2002 00:20:44 -0000 1.30 +++ src/wp/ap/win/ap_Win32Frame.h 14 Mar 2002 06:53:58 -0000 @@ -71,11 +71,11 @@ void _getRulerSizes(int &yTopRulerHeight, int &xLeftRulerWidth); void _onSize(int nWidth, int nHeight); UT_Error _loadDocument(const char * szFilename, IEFileType ieft); virtual UT_Error _importDocument(const char * szFilename, int ieft, bool markClean); - UT_Error _showDocument(UT_uint32 iZoom=100); + UT_Error _showDocument(UT_uint32 iZoom=0); static void _scrollFuncX(void * pData, UT_sint32 xoff, UT_sint32 xlimit); static void _scrollFuncY(void * pData, UT_sint32 yoff, UT_sint32 ylimit); static LRESULT CALLBACK _ContainerWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK _LeftRulerWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); @@ -114,8 +114,9 @@ HWND m_hWndHScroll; HWND m_hWndVScroll; HWND m_hWndGripperHack; UT_sint32 m_startMouseWheelY; UT_sint32 m_startScrollPosition; + UT_uint32 m_iZoom; /* see note with get/setZoomPercentage(){...} */ }; #endif /* AP_WIN32FRAME_H */