[sword-svn] r180 - in trunk/src: Dll1 SwordReader_GUI SwordReader_GUI/SRFramework

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sun Sep 21 16:35:15 MST 2008


Author: dtrotzjr
Date: 2008-09-21 16:35:14 -0700 (Sun, 21 Sep 2008)
New Revision: 180

Added:
   trunk/src/SwordReader_GUI/SRFramework/SRButton.cpp
   trunk/src/SwordReader_GUI/SRFramework/SRButton.h
   trunk/src/SwordReader_GUI/SRFramework/SREdit.cpp
   trunk/src/SwordReader_GUI/SRFramework/SREdit.h
   trunk/src/SwordReader_GUI/SRFramework/SRListBox.cpp
   trunk/src/SwordReader_GUI/SRFramework/SRListBox.h
   trunk/src/SwordReader_GUI/SRFramework/SRProgress.cpp
   trunk/src/SwordReader_GUI/SRFramework/SRProgress.h
Modified:
   trunk/src/Dll1/Dll1.vcproj
   trunk/src/SwordReader_GUI/Main.cpp
   trunk/src/SwordReader_GUI/SRFind.cpp
   trunk/src/SwordReader_GUI/SRFind.h
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRMainFrame.h
   trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
Wrapped up more of the WinCE API (See ticket #0000016) in SRFramework classes. Added 4 new classes SRButton, SREdit, SRProgress, SRListBox. The functionality is limited to the current needs of SwordReader. Just need SRRadioButton and then the Find form will rely solely on SRFramework and not on the WinCE API.

Modified: trunk/src/Dll1/Dll1.vcproj
===================================================================
--- trunk/src/Dll1/Dll1.vcproj	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/Dll1/Dll1.vcproj	2008-09-21 23:35:14 UTC (rev 180)
@@ -196,8 +196,8 @@
 				IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/sword.pdb"
-				StackReserveSize="65536"
-				StackCommitSize="4096"
+				StackReserveSize="131072"
+				StackCommitSize="8192"
 				EntryPointSymbol="_DllMainCRTStartup"
 				BaseAddress="0x00100000"
 				ImportLibrary="$(PlatformName)\$(ConfigurationName)/sword.lib"

Modified: trunk/src/SwordReader_GUI/Main.cpp
===================================================================
--- trunk/src/SwordReader_GUI/Main.cpp	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/Main.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -9,6 +9,7 @@
 					LPTSTR    lpCmdLine,
 					int       nCmdShow)
 {
+    
     SRReaderApp app(hInstance);
 
 	HCURSOR hOldCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));

Modified: trunk/src/SwordReader_GUI/SRFind.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.cpp	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/SRFind.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -16,16 +16,16 @@
 }
 
 SRFind::SRFind()
-:m_hEdtQuery(NULL)
-,m_hBtnSearch(NULL)
+:m_pEdtQuery(NULL)
+,m_pButtonSearch(NULL)
 ,m_hRadRangeBible(NULL)
 ,m_hRadRangeTestament(NULL)
 ,m_hRadRangeBook(NULL)
 ,m_hRadMethodMultiword(NULL)
 ,m_hRadMethodExactphrase(NULL)
-,m_hLstResults(NULL)
-,m_hProgressBar(NULL)
-,m_hBtnGoTo(NULL)
+,m_pListBoxResults(NULL)
+,m_pProgressBar(NULL)
+,m_pButtonGoTo(NULL)
 ,m_textPreview(NULL)
 ,m_wMethodMode(SR_FIND_METHOD_MWORD)
 ,m_wRangeMode(SR_FIND_RANGE_BIBLE)
@@ -43,7 +43,7 @@
 
 VOID SRFind::SetProgress(INT nPercent)
 {
-    ::SendMessage(m_hProgressBar, PBM_SETPOS, nPercent, 0);
+    m_pProgressBar->SetPosition(nPercent);
 }
 
 VOID SRFind::AddResult(WCString &wcsVerse)
@@ -62,9 +62,7 @@
 
     
 	m_verseResults.push_back(*verse);
-    //(*m_modCurText)->SetKey(verse);
-    //WCString verseString = (*m_modCurText)->StripText();
-    ::SendMessage (m_hLstResults, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)wcsReference.w_str());
+    m_pListBoxResults->AddItem(wcsReference);
     delete verse;
 }
 
@@ -117,7 +115,7 @@
 
 VOID SRFind::ShowPreview()
 {
-    int pos = ::SendMessage(m_hLstResults, LB_GETCURSEL, 0, 0);
+    int pos = m_pListBoxResults->GetCurSel();
     if(pos == LB_ERR)
         return;
     VerseKey keyPreview = m_verseResults[pos];
@@ -131,7 +129,7 @@
 
 VOID SRFind::GoToVerse()
 {
-    int pos = ::SendMessage(m_hLstResults, LB_GETCURSEL, 0, 0);
+    int pos = m_pListBoxResults->GetCurSel();
     if(pos == LB_ERR)
         return;
     ::SendMessage(m_pParentWnd->GetWindowHandle(), WM_COMMAND, SR_SETVERSEKEY,(LPARAM)&m_verseResults[pos]);
@@ -158,22 +156,16 @@
 LRESULT SRFind::OnCreate(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
 {
     m_hWnd = hWnd;
+    RECT nullRECT = {0,0,0,0};
+    m_pEdtQuery = new SREdit();
+    if(!m_pEdtQuery || !m_pEdtQuery->Create(this, nullRECT, IDC_EDT_QUERY))
+        return FALSE;
+    m_pEdtQuery->Show();
 
-	m_hEdtQuery = CreateWindow(_T("edit"), NULL, 
-		WS_CHILD | ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP | WS_BORDER,
-		0,0,0,0,
-        hWnd,	NULL, SRApp::GetInstanceHandle(), NULL);
-    if(!m_hEdtQuery)
+    m_pButtonSearch = new SRButton();
+    if(!m_pButtonSearch || !m_pButtonSearch->Create(this, "Search", nullRECT, IDC_BTN_SEARCH))
         return FALSE;
-    ShowWindow(m_hEdtQuery, SW_SHOW);
-    	
-    m_hBtnSearch = CreateWindow(_T("button"), L"Search", 
-		WS_CHILD | BS_PUSHBUTTON, 
-		0,0,0,0,
-        hWnd, (HMENU)(IDC_BTN_SEARCH), SRApp::GetInstanceHandle(), NULL);
-    if(!m_hBtnSearch)
-        return FALSE;
-    ShowWindow(m_hBtnSearch, SW_SHOW);
+    m_pButtonSearch->Show();
 
 	// Radio Buttons
 	m_hRadRangeBible = CreateWindow(_T("button"), L"Whole bible", 
@@ -220,31 +212,21 @@
         return FALSE;
     ShowWindow(m_hRadMethodExactphrase, SW_SHOW);
 
-
-    m_hLstResults = CreateWindow(_T("listbox"),NULL,
-		WS_CHILD | WS_VSCROLL | LBS_DISABLENOSCROLL | LBS_NOTIFY | WS_BORDER | LBS_NOINTEGRALHEIGHT,
-		0,0,0,0, 
-		hWnd, (HMENU)(IDC_LST_RESULTS), SRApp::GetInstanceHandle(), NULL); //bottom row of screen
-    if(!m_hLstResults)
+    m_pListBoxResults = new SRListBox();
+    if(!m_pListBoxResults || !m_pListBoxResults->Create(this, nullRECT, IDC_LST_RESULTS))
         return FALSE;
-    ShowWindow(m_hLstResults, SW_SHOW);
-
-	m_hProgressBar = CreateWindow(PROGRESS_CLASS, L"",
-		WS_CHILD | WS_BORDER | PBS_SMOOTH,
-		0,0,0,0,
-		hWnd, NULL, SRApp::GetInstanceHandle(), NULL);
-    if(!m_hProgressBar)
+    m_pListBoxResults->Show();
+    
+    m_pProgressBar = new SRProgress();
+    if(!m_pProgressBar || !m_pProgressBar->Create(this, nullRECT))
+        return false;
+    m_pProgressBar->Show();
+    
+    m_pButtonGoTo = new SRButton();
+    if(!m_pButtonGoTo || !m_pButtonGoTo->Create(this, "Go to", nullRECT, IDC_BTN_GOTO))
         return FALSE;
-    ShowWindow(m_hProgressBar, SW_SHOW);
+    m_pButtonGoTo->Show();
 
-	m_hBtnGoTo = CreateWindow(_T("button"), L"Go to", 
-		WS_CHILD | BS_PUSHBUTTON, 
-		0,0,0,0,
-		hWnd, (HMENU)(IDC_BTN_GOTO), SRApp::GetInstanceHandle(), NULL);
-    if(!m_hBtnGoTo)
-        return FALSE;
-    ShowWindow(m_hBtnGoTo, SW_SHOW);
-
     m_textPreview = new SRTextView();
 
     RECT tmpRect = {0,0,0,0};
@@ -283,16 +265,16 @@
 	int prevW = width - (margin + listW + pad + margin);
 	int progW = width - (margin + listW + pad + pad + gotoBtnW + margin);
 
-    ::MoveWindow(m_hEdtQuery,col0, row0, queryW, btnH,TRUE);
-    ::MoveWindow(m_hBtnSearch,col0 + queryW + pad, row0, searchBtnW, btnH,TRUE);
+    m_pEdtQuery->MoveWindow(col0,row0,queryW, btnH, TRUE);
+    m_pButtonSearch->MoveWindow(col0 + queryW + pad, row0, searchBtnW, btnH, TRUE);
     ::MoveWindow(m_hRadRangeBible,col0,row1,textW,btnH,TRUE);
     ::MoveWindow(m_hRadRangeTestament,col0,row2,textW,btnH,TRUE);
     ::MoveWindow(m_hRadRangeBook,col0,row3,textW,btnH,TRUE);
     ::MoveWindow(m_hRadMethodMultiword,col1,row1,textW,btnH,TRUE);
     ::MoveWindow(m_hRadMethodExactphrase,col1,row2,textW,btnH,TRUE);
-	::MoveWindow(m_hLstResults,margin,row4,listW,listH,TRUE);
-	::MoveWindow(m_hProgressBar,col0 + listW + pad,row4,progW,btnH,TRUE);
-	::MoveWindow(m_hBtnGoTo,col0 + listW + pad + progW + pad,row4, gotoBtnW,btnH,TRUE);
+    m_pListBoxResults->MoveWindow(margin, row4, listW, listH, TRUE);
+	m_pProgressBar->MoveWindow(col0 + listW + pad,row4,progW,btnH,TRUE);
+    m_pButtonGoTo->MoveWindow(col0 + listW + pad + progW + pad,row4, gotoBtnW,btnH,TRUE);
     m_textPreview->MoveWindow(margin + listW + pad,row5,prevW,prevH);
 }
 
@@ -334,12 +316,6 @@
 
 VOID SRFind::Search()
 {
-    TCHAR *strQuery = NULL;
-    INT nQueryLen = ::SendMessage(m_hEdtQuery, WM_GETTEXTLENGTH, NULL, NULL) + 1;
-    strQuery = new TCHAR[nQueryLen];
-    ::SendMessage(m_hEdtQuery,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery);
-    strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded
-	
     // Clone is a bit dangerous, it creates a new SWKey which has to be deleted
     // thus you cannot simply pass the cloned object to the constructor of
     // a VerseKey object.
@@ -370,7 +346,7 @@
 	VerseKey verses(from,to);
 	sword::ListKey results;
 
-    results = m_modCurText->search(WCString(strQuery).c_str(), 
+    results = m_modCurText->search(m_pEdtQuery->GetText().c_str(), 
         (m_wMethodMode == SR_FIND_METHOD_MWORD) ? -2: -1,
         2, &verses, 0, setPercentCB, (void*)this);
     SetProgress(100);
@@ -380,14 +356,13 @@
 		AddResult(WCString(results.getText()));
 	}
 
-    delete [] strQuery;
 }
 
 VOID SRFind::ClearForm()
 {
     WCString wcsPreview = "preview";
     SetProgress(0);
-    ::SendMessage (m_hLstResults, LB_RESETCONTENT,0,0);
+    m_pListBoxResults->Clear();
     m_textPreview->Clear();
     m_textPreview->AddText(wcsPreview.w_str(), wcsPreview.length());
 	m_verseResults.clear();

Modified: trunk/src/SwordReader_GUI/SRFind.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.h	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/SRFind.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -1,6 +1,10 @@
 #ifndef _SRFIND_H_
 #define _SRFIND_H_
 #include "SRFramework/SRWnd.h"
+#include "SRFramework/SREdit.h"
+#include "SRFramework/SRButton.h"
+#include "SRFramework/SRListBox.h"
+#include "SRFramework/SRProgress.h"
 #include <vector>
 #include <swmodule.h>
 #include <versekey.h>
@@ -57,16 +61,16 @@
     VOID SetContext(VerseKey verse, const SWModule *pModule);
 private:
     static BOOL s_fRegistered;
-    HWND m_hEdtQuery;
-    HWND m_hBtnSearch;
+    SREdit      *m_pEdtQuery;
+    SRListBox   *m_pListBoxResults;
+    SRButton    *m_pButtonSearch;
+    SRButton    *m_pButtonGoTo;
+    SRProgress  *m_pProgressBar;
     HWND m_hRadRangeBible;
     HWND m_hRadRangeTestament;
     HWND m_hRadRangeBook;
     HWND m_hRadMethodMultiword;
     HWND m_hRadMethodExactphrase;
-    HWND m_hLstResults;
-    HWND m_hProgressBar;
-    HWND m_hBtnGoTo;
     SRTextView *m_textPreview;
     WORD m_wRangeMode;
     WORD m_wMethodMode;

Added: trunk/src/SwordReader_GUI/SRFramework/SRButton.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRButton.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRButton.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,47 @@
+#include "SRButton.h"
+#include "SRApp.h"
+#include <commctrl.h>
+
+using namespace SRFramework;
+
+
+SRButton::SRButton(void)
+{
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+	InitCtrlEx.dwICC  = ICC_TAB_CLASSES;
+	InitCommonControlsEx(&InitCtrlEx);
+
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+    m_wcsClassName = "button";
+    m_wcsWindowName = "";
+}
+
+SRButton::~SRButton(void)
+{
+
+}
+
+BOOL SRButton::Create(SRWnd *pParentWnd, const WCString &wcsLabel, RECT bounds, INT nChildID, DWORD dwStyle)
+{
+    if(!Register())
+        return FALSE;
+    m_wcsWindowName = wcsLabel;
+    if(!SRWnd::Create(m_wcsClassName, m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance))
+        return FALSE;
+    
+    return TRUE;
+}
+
+WCString SRButton::GetText()
+{
+    TCHAR *strQuery = NULL;
+    INT nQueryLen = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, NULL, NULL) + 1;
+    strQuery = new TCHAR[nQueryLen];
+    ::SendMessage(m_hWnd,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery);
+    strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded
+    return strQuery;
+}
+
+

Added: trunk/src/SwordReader_GUI/SRFramework/SRButton.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRButton.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRButton.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,19 @@
+#pragma once
+#include "SRWnd.h"
+#include <commctrl.h>
+
+namespace SRFramework{
+
+    class SRButton : public SRFramework::SRWnd
+    {
+    public:
+        SRButton(VOID);
+        virtual ~SRButton(VOID);
+        BOOL Create(SRWnd *pParentWnd, const WCString &wcsLabel, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | BS_PUSHBUTTON);
+        // Does not need to be registered the call to InitCommonControlsEx 
+        // does that for us. 
+        BOOL Register() { return TRUE; } 
+        WCString GetText();
+    };
+
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRFramework/SREdit.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SREdit.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SREdit.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,46 @@
+#include "SREdit.h"
+#include "SRApp.h"
+#include <commctrl.h>
+
+using namespace SRFramework;
+
+
+SREdit::SREdit(void)
+{
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+	InitCtrlEx.dwICC  = ICC_TAB_CLASSES;
+	InitCommonControlsEx(&InitCtrlEx);
+
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+    m_wcsClassName = "edit";
+    m_wcsWindowName = "";
+}
+
+SREdit::~SREdit(void)
+{
+
+}
+
+BOOL SREdit::Create(SRWnd *pParentWnd, RECT bounds, INT nChildID, DWORD dwStyle)
+{
+    if(!Register())
+        return FALSE;
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance))
+        return FALSE;
+    
+    return TRUE;
+}
+
+WCString SREdit::GetText()
+{
+    TCHAR *strQuery = NULL;
+    INT nQueryLen = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, NULL, NULL) + 1;
+    strQuery = new TCHAR[nQueryLen];
+    ::SendMessage(m_hWnd,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery);
+    strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded
+    return strQuery;
+}
+
+

Added: trunk/src/SwordReader_GUI/SRFramework/SREdit.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SREdit.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SREdit.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,19 @@
+#pragma once
+#include "SRWnd.h"
+#include <commctrl.h>
+
+namespace SRFramework{
+
+    class SREdit : public SRFramework::SRWnd
+    {
+    public:
+        SREdit(VOID);
+        virtual ~SREdit(VOID);
+        BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP | WS_BORDER);
+        // Does not need to be registered the call to InitCommonControlsEx 
+        // does that for us. 
+        BOOL Register() { return TRUE; } 
+        WCString GetText();
+    };
+
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRFramework/SRListBox.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRListBox.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRListBox.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,79 @@
+#include "SRListBox.h"
+#include "SRApp.h"
+#include <commctrl.h>
+
+using namespace SRFramework;
+
+
+SRListBox::SRListBox(void)
+{
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+	InitCtrlEx.dwICC  = ICC_TAB_CLASSES;
+	InitCommonControlsEx(&InitCtrlEx);
+
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+    m_wcsClassName = "listbox";
+    m_wcsWindowName = "";
+}
+
+SRListBox::~SRListBox(void)
+{
+
+}
+
+BOOL SRListBox::Create(SRWnd *pParentWnd, RECT bounds, INT nChildID, DWORD dwStyle)
+{
+    if(!Register())
+        return FALSE;
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance))
+        return FALSE;
+    
+    return TRUE;
+}
+
+WCString SRListBox::GetText()
+{
+    TCHAR *strQuery = NULL;
+    INT nQueryLen = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, NULL, NULL) + 1;
+    strQuery = new TCHAR[nQueryLen];
+    ::SendMessage(m_hWnd,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery);
+    strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded
+    return strQuery;
+}
+
+VOID SRListBox::Clear()
+{
+    ::SendMessage (m_hWnd, LB_RESETCONTENT,0,0);
+}
+
+INT SRListBox::AddItem(const WCString &wcsItem)
+{
+    return ::SendMessage (m_hWnd, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)wcsItem.w_str());
+}
+
+INT SRListBox::InsertItem(INT nItemIndex, const WCString &wcsItem)
+{
+    return ::SendMessage (m_hWnd, LB_INSERTSTRING, nItemIndex, (LPARAM)(LPCTSTR)wcsItem.w_str());
+}
+
+INT SRListBox::DeleteItem(INT nItemIndex)
+{
+    return ::SendMessage (m_hWnd, LB_DELETESTRING, nItemIndex, NULL);
+}
+        
+INT SRListBox::FindItem(const WCString &wcsItem)
+{
+    return ::SendMessage (m_hWnd, LB_FINDSTRING, 0, (LPARAM)(LPCTSTR)wcsItem.w_str());
+}
+
+INT SRListBox::SelectItem(const WCString &wcsItem)
+{
+    return ::SendMessage (m_hWnd, LB_FINDSTRING, 0, (LPARAM)(LPCTSTR)wcsItem.w_str());
+}
+
+INT SRListBox::GetCurSel()
+{
+    return ::SendMessage (m_hWnd, LB_GETCURSEL, 0,0);
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRFramework/SRListBox.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRListBox.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRListBox.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,26 @@
+#pragma once
+#include "SRWnd.h"
+#include <commctrl.h>
+
+namespace SRFramework{
+
+    class SRListBox : public SRFramework::SRWnd
+    {
+    public:
+        SRListBox(VOID);
+        virtual ~SRListBox(VOID);
+        BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | WS_VSCROLL | LBS_DISABLENOSCROLL | LBS_NOTIFY | WS_BORDER | LBS_NOINTEGRALHEIGHT);
+        // Does not need to be registered the call to InitCommonControlsEx 
+        // does that for us. 
+        BOOL Register() { return TRUE; } 
+        WCString GetText();
+        VOID Clear();
+        INT AddItem(const WCString &wcsItem);
+        INT InsertItem(INT nItemIndex, const WCString &wcsItem);
+        INT DeleteItem(INT nItemIndex);
+        INT FindItem(const WCString &wcsItem);
+        INT SelectItem(const WCString &wcsItem);
+        INT GetCurSel();
+    };
+
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRFramework/SRProgress.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRProgress.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRProgress.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,39 @@
+#include "SRProgress.h"
+#include "SRApp.h"
+#include <commctrl.h>
+
+using namespace SRFramework;
+
+
+SRProgress::SRProgress(void)
+{
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+	InitCtrlEx.dwICC  = ICC_TAB_CLASSES;
+	InitCommonControlsEx(&InitCtrlEx);
+
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+    m_wcsClassName = PROGRESS_CLASS;
+    m_wcsWindowName = "";
+}
+
+SRProgress::~SRProgress(void)
+{
+
+}
+
+BOOL SRProgress::Create(SRWnd *pParentWnd, RECT bounds, INT nChildID, DWORD dwStyle)
+{
+    if(!Register())
+        return FALSE;
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance))
+        return FALSE;
+    
+    return TRUE;
+}
+
+INT SRProgress::SetPosition(INT nNewPos)
+{
+    return ::SendMessage(m_hWnd, PBM_SETPOS, nNewPos, 0);
+}
\ No newline at end of file

Added: trunk/src/SwordReader_GUI/SRFramework/SRProgress.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRProgress.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRProgress.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -0,0 +1,19 @@
+#pragma once
+#include "SRWnd.h"
+#include <commctrl.h>
+
+namespace SRFramework{
+
+    class SRProgress : public SRFramework::SRWnd
+    {
+    public:
+        SRProgress(VOID);
+        virtual ~SRProgress(VOID);
+        BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | WS_BORDER | PBS_SMOOTH);
+        // Does not need to be registered the call to InitCommonControlsEx 
+        // does that for us. 
+        BOOL Register() { return TRUE; } 
+        INT SetPosition(INT nNewPos);
+    };
+
+}
\ No newline at end of file

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-09-21 23:35:14 UTC (rev 180)
@@ -327,10 +327,7 @@
             SetVerse(newValue, wNotifyCode == SR_MSRC_CHOOSER);
             break;
         case SR_SETVERSEKEY:
-            /*REM
-            m_viewModules[m_nCurrentModule]->SetKey(*reinterpret_cast<VerseKey*>(hWndCtl));
-            */
-            UpdateWindowTitle();
+            SetVerseKey(*reinterpret_cast<VerseKey*>(hWndCtl));
             break;
         default:
             // Check the custom made menu items...
@@ -410,6 +407,13 @@
     UpdateWindowTitle();
 }
 
+VOID SRMainFrame::SetVerseKey(VerseKey verse)
+{
+    m_tabViews->SetCurrentKey(verse);
+    SaveOptions();
+    UpdateWindowTitle();
+}
+
 BOOL SRMainFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
 {
     BOOL fRetVal = m_tabViews->OnKeyDown(nChar, nRepCnt, nFlags);

Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h	2008-09-21 23:35:14 UTC (rev 180)
@@ -51,6 +51,7 @@
     VOID SetBook(INT nBook);
     VOID SetChapter(INT nChapter);
     VOID SetVerse(INT nVerse, BOOL fScroll);
+    VOID SetVerseKey(VerseKey verse);
     VOID SaveOptions();
     VOID LoadOptions();
 private:

Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-09-13 16:31:31 UTC (rev 179)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-09-21 23:35:14 UTC (rev 180)
@@ -616,8 +616,8 @@
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
 				GenerateMapFile="true"
-				StackReserveSize="65536"
-				StackCommitSize="4096"
+				StackReserveSize="131072"
+				StackCommitSize="8192"
 				EntryPointSymbol="WinMainCRTStartup"
 				BaseAddress="0x00010000"
 			/>
@@ -909,18 +909,34 @@
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRButton.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRCommandBar.cpp"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SREdit.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRFrame.cpp"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRListBox.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRMenu.cpp"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRProgress.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRTabCtrl.cpp"
 					>
 				</File>
@@ -994,18 +1010,34 @@
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRButton.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRCommandBar.h"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SREdit.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRFrame.h"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRListBox.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRMenu.h"
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRProgress.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRTabCtrl.h"
 					>
 				</File>




More information about the sword-cvs mailing list