[sword-svn] r166 - in trunk/src/SwordReader_GUI: . SRFramework

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sat Aug 2 17:52:26 MST 2008


Author: dtrotzjr
Date: 2008-08-02 17:52:25 -0700 (Sat, 02 Aug 2008)
New Revision: 166

Modified:
   trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRMainFrame.h
   trunk/src/SwordReader_GUI/SRModuleView.cpp
   trunk/src/SwordReader_GUI/SRTextView.cpp
   trunk/src/SwordReader_GUI/SRTextView.h
Log:
Fixed issue 0000004 where resizing the window from portrait to landscape mode not working. Fixed issue 0000025 where the last verse was not being pre-rendered and thus not showing.

Modified: trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp	2008-08-03 00:52:25 UTC (rev 166)
@@ -86,6 +86,10 @@
 
 void SRWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
 {
+    m_rect.top = y;
+    m_rect.left = x;
+    m_rect.right = x + nWidth;
+    m_rect.bottom = y + nHeight;
 	::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint); 
 }
 

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-08-03 00:52:25 UTC (rev 166)
@@ -128,6 +128,8 @@
 
     if(!SRFrame::Create(m_wcsClassName,m_wcsWindowName,WS_VISIBLE, bounds, NULL, NULL, m_hInstance))
         return FALSE;
+    // Since we used default we need to get the rect value.
+    GetClientRect(m_hWnd, &m_rect);
 
     return TRUE;
 }
@@ -341,6 +343,19 @@
 }
 
 
+BOOL SRMainFrame::OnSize(UINT nType, int cx, int cy) 
+{   
+    RECT newSize;
+    GetClientRect(m_hWnd, &newSize);
+    newSize.bottom -= m_menuBar->Height();
+    m_viewFind->MoveWindow(&newSize, TRUE);
+    m_viewBook->MoveWindow(&newSize, TRUE);
+    m_viewChapter->MoveWindow(&newSize, TRUE);
+    m_viewVerse->MoveWindow(&newSize, TRUE);
+    m_viewModules[m_nCurrentModule]->MoveWindow(&newSize, TRUE);
+    return TRUE;
+} 
+
 VOID SRMainFrame::SetBook(INT nBook)
 {
     m_viewModules[m_nCurrentModule]->SetBook(nBook);

Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h	2008-08-03 00:52:25 UTC (rev 166)
@@ -44,6 +44,7 @@
     // Do these belong here?... dctrotz
     static const WCString *GetBookNames() { return s_wcsBookNames; }
 
+    BOOL OnSize(UINT nType, int cx, int cy);
     BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
     VOID SetBook(INT nBook);
     VOID SetChapter(INT nChapter);

Modified: trunk/src/SwordReader_GUI/SRModuleView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-08-03 00:52:25 UTC (rev 166)
@@ -169,6 +169,8 @@
 
     if(!fInThread || !m_fAbortThread)
         RefreshWindow();
+    if(fInThread && !m_fAbortThread)
+        PreRenderBuff();
 
     if(done){
         ScrollToVerse(m_verse.Verse());

Modified: trunk/src/SwordReader_GUI/SRTextView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.cpp	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRTextView.cpp	2008-08-03 00:52:25 UTC (rev 166)
@@ -152,15 +152,17 @@
     return TRUE;
 }
 
-VOID SRTextView::MoveWindow(INT x, INT y, INT w, INT h)
+VOID SRTextView::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
 {
-    m_rect.top = x;
-    m_rect.bottom = x + h;
-    m_rect.left = y;
-    m_rect.right = y + w;
-    ::MoveWindow(m_hWnd, x, y, w, h, FALSE);
+    m_fPreRendered = false;
+    SRWnd::MoveWindow(x, y, nWidth, nHeight, TRUE);
 }
 
+VOID SRTextView::MoveWindow(LPCRECT lpRect,BOOL bRepaint)
+{
+    MoveWindow(lpRect->left, lpRect->top, lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, bRepaint);
+}
+
 BOOL SRTextView::OnMouseMove(WORD fwKeys, INT xPos, INT yPos)
 {
     this->DragScreenToPoint(yPos);
@@ -445,6 +447,12 @@
     m_fAppended = FALSE;
     m_dwWordIndex = 0;
 }
+VOID SRTextView::PreRenderBuff()
+{
+    HDC hdc = GetDC(m_hWnd);
+    PreRenderBuff(hdc);
+    ReleaseDC(m_hWnd, hdc);
+}
 VOID SRTextView::PreRenderBuff(HDC hdc)
 {
     SRTextWord   thisWord;

Modified: trunk/src/SwordReader_GUI/SRTextView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.h	2008-08-02 15:36:50 UTC (rev 165)
+++ trunk/src/SwordReader_GUI/SRTextView.h	2008-08-03 00:52:25 UTC (rev 166)
@@ -458,7 +458,10 @@
     VOID    Hide();
     //! Changes the position and or size of the window.
     //! Calls ::MoveWindow for the underlying window.
-    VOID    MoveWindow(INT x, INT y, INT w, INT h);
+    VOID MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE);
+    //! Changes the position and or size of the window.
+    //! Calls ::MoveWindow for the underlying window.
+    VOID MoveWindow(LPCRECT lpRect,BOOL bRepaint = TRUE);
     //! Clears the text from m_lpszBuff and removes the lines from m_BTLines.
     VOID    Clear();
     //! Redraws the window, including a pre-render stage if neccesarry. 
@@ -487,7 +490,7 @@
     // Private Methods
     //! Handles the WM_PAINT message for this window control. 
     /*! This is the heart and soul of this window control. Well in theory it 
-        is, except most of the real work is done in PreRenderBuff. This method 
+    is, except most of the real work is done in PreRenderBuff. This method 
         checks to see if the buffer has been pre-rendered, if not it calls 
         PreRenderBuff. Once it is established that the buffer has been 
         pre-rendered the method continues to actually render the text on 
@@ -686,6 +689,8 @@
         @param  hdc the current device context to base our "fake" drawing on.
      */
     VOID    PreRenderBuff(HDC hdc);
+    //! Like PreRenderBuff(HDC hdc) except this method gets the device context itself.
+    VOID    PreRenderBuff();
 
     VOID    ClearFontCache(HDC hdc);
 




More information about the sword-cvs mailing list