[sword-svn] r150 - trunk/src/SwordReader_GUI

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sat Jul 12 15:41:20 MST 2008


Author: dtrotzjr
Date: 2008-07-12 15:41:20 -0700 (Sat, 12 Jul 2008)
New Revision: 150

Modified:
   trunk/src/SwordReader_GUI/SRBookChooser.cpp
   trunk/src/SwordReader_GUI/SRBookChooser.h
   trunk/src/SwordReader_GUI/SRNumberChooser.cpp
   trunk/src/SwordReader_GUI/SRNumberChooser.h
Log:
Added visual feedback about the book/chapter/verse being selected.

Modified: trunk/src/SwordReader_GUI/SRBookChooser.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRBookChooser.cpp	2008-07-12 18:05:26 UTC (rev 149)
+++ trunk/src/SwordReader_GUI/SRBookChooser.cpp	2008-07-12 22:41:20 UTC (rev 150)
@@ -332,6 +332,9 @@
 {
     TCHAR buf[16] = {0};
     INT found = BookAt(xPos, yPos);
+
+    m_fLButtonDown = FALSE;
+
     if(found == 0 && (m_nStartAt + MaxBooksPerScreen() <= m_nEndBook) ){
         m_nStartAt += MaxBooksPerScreen();
         RefreshWindow();
@@ -348,6 +351,30 @@
     }
     return TRUE;
 }
+
+BOOL SRBookChooser::OnLButtonDown(WORD fwKeys, INT xPos, INT yPos)
+{
+    INT found = BookAt(xPos, yPos);
+    m_fLButtonDown = TRUE;
+
+    if(found > 0){
+        m_nSelectedBook = found;
+        RefreshWindow();
+    }
+
+    return TRUE;
+}
+
+BOOL SRBookChooser::OnMouseMove(WORD fwKeys, INT xPos, INT yPos)
+{
+    INT found = BookAt(xPos, yPos);
+    if(found > 0 && m_nSelectedBook != found && m_fLButtonDown){
+        m_nSelectedBook = found;
+        RefreshWindow();
+    }
+    return TRUE;
+}
+
 void SRBookChooser::SetSelectedBook(INT nSelectedBook)
 {
     if(nSelectedBook < 0 || nSelectedBook > m_nEndBook)

Modified: trunk/src/SwordReader_GUI/SRBookChooser.h
===================================================================
--- trunk/src/SwordReader_GUI/SRBookChooser.h	2008-07-12 18:05:26 UTC (rev 149)
+++ trunk/src/SwordReader_GUI/SRBookChooser.h	2008-07-12 22:41:20 UTC (rev 150)
@@ -18,6 +18,8 @@
     BOOL Create(SRWnd *pParentWnd, RECT bounds);
 	BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
     BOOL OnLButtonUp(WORD fwKeys, INT xPos, INT yPos);
+    BOOL OnLButtonDown(WORD fwKeys, INT xPos, INT yPos);
+    BOOL OnMouseMove(WORD fwKeys, INT xPos, INT yPos);
 protected:
 	INT  BookAt(int x, int y);
 	void DrawButtons();
@@ -39,6 +41,7 @@
     WCString   *m_wcsBookNames;
     static BOOL s_fRegistered;
 	UINT        m_nLastChar;
+    BOOL        m_fLButtonDown;
 };
 
 #endif

Modified: trunk/src/SwordReader_GUI/SRNumberChooser.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRNumberChooser.cpp	2008-07-12 18:05:26 UTC (rev 149)
+++ trunk/src/SwordReader_GUI/SRNumberChooser.cpp	2008-07-12 22:41:20 UTC (rev 150)
@@ -322,6 +322,9 @@
 {
     TCHAR buf[16] = {0};
     INT found = NumberAt(xPos, yPos);
+    
+    m_fLButtonDown = FALSE;
+    
     if(found == 0 && (m_nStartAt + MaxNumbersPerScreen() <= m_nEndNumber) ){
         m_nStartAt += MaxNumbersPerScreen();
         RefreshWindow();
@@ -339,6 +342,29 @@
     return TRUE;
 }
 
+BOOL SRNumberChooser::OnLButtonDown(WORD fwKeys, INT xPos, INT yPos)
+{
+    INT found = NumberAt(xPos, yPos);
+    m_fLButtonDown = TRUE;
+
+    if(found > 0){
+        m_nSelectedNumber = found;
+        RefreshWindow();
+    }
+
+    return TRUE;
+}
+
+BOOL SRNumberChooser::OnMouseMove(WORD fwKeys, INT xPos, INT yPos)
+{
+    INT found = NumberAt(xPos, yPos);
+    if(found > 0 && m_nSelectedNumber != found && m_fLButtonDown){
+        m_nSelectedNumber = found;
+        RefreshWindow();
+    }
+    return TRUE;
+}
+
 void SRNumberChooser::SetSelectedNumber(INT nSelectedNumber)
 {
     if(nSelectedNumber < 0 || nSelectedNumber > m_nEndNumber)

Modified: trunk/src/SwordReader_GUI/SRNumberChooser.h
===================================================================
--- trunk/src/SwordReader_GUI/SRNumberChooser.h	2008-07-12 18:05:26 UTC (rev 149)
+++ trunk/src/SwordReader_GUI/SRNumberChooser.h	2008-07-12 22:41:20 UTC (rev 150)
@@ -20,6 +20,8 @@
     BOOL Create(SRWnd *pParentWnd, RECT bounds);
 	BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
 	BOOL OnLButtonUp(WORD fwKeys, INT xPos, INT yPos);
+	BOOL OnLButtonDown(WORD fwKeys, INT xPos, INT yPos);
+	BOOL OnMouseMove(WORD fwKeys, INT xPos, INT yPos);
 protected:
 	INT  NumberAt(int x, int y);
     INT  LeftEdge();
@@ -39,6 +41,7 @@
 	WCString    m_wcsPrompt;
     static BOOL s_fRegistered;
 	UINT        m_nLastChar;
+    BOOL        m_fLButtonDown;
 };
 
 #endif




More information about the sword-cvs mailing list