[sword-svn] r175 - in trunk/src/SwordReader_GUI: . SRFramework
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Sun Sep 7 22:46:39 MST 2008
Author: dtrotzjr
Date: 2008-09-07 22:46:38 -0700 (Sun, 07 Sep 2008)
New Revision: 175
Modified:
trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.cpp
trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h
trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
trunk/src/SwordReader_GUI/SRMainFrame.cpp
trunk/src/SwordReader_GUI/SRMainFrame.h
trunk/src/SwordReader_GUI/SRMenuBar.cpp
trunk/src/SwordReader_GUI/SRMenuBar.h
trunk/src/SwordReader_GUI/SRModuleView.cpp
trunk/src/SwordReader_GUI/SRModuleView.h
trunk/src/SwordReader_GUI/SRTabbedViews.cpp
trunk/src/SwordReader_GUI/SRTabbedViews.h
trunk/src/SwordReader_GUI/SRTextView.cpp
trunk/src/SwordReader_GUI/SwordReaderResource.h
Log:
Significant progress on the tabbed displays. Still more work to do though.
Modified: trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -21,14 +21,14 @@
}
-BOOL SRTabCtrl::Create(SRWnd *pParentWnd, RECT bounds)
+BOOL SRTabCtrl::Create(SRWnd *pParentWnd, RECT bounds, DWORD dwStyle)
{
if(!Register())
return FALSE;
- if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName,WS_CHILD | WS_VISIBLE, bounds, pParentWnd, NULL, m_hInstance))
+ if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, NULL, m_hInstance))
return FALSE;
-
+
return TRUE;
}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -9,7 +9,7 @@
public:
SRTabCtrl(VOID);
virtual ~SRTabCtrl(VOID);
- BOOL Create(SRWnd *pParentWnd, RECT bounds);
+ BOOL Create(SRWnd *pParentWnd, RECT bounds, DWORD dwStyle = WS_CHILD | WS_VISIBLE);
// Does not need to be registered the call to InitCommonControlsEx
// does that for us.
BOOL Register() { return TRUE; }
Modified: trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -187,7 +187,8 @@
virtual LRESULT OnQuit(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) { return OnQuit((INT)wParam); }
virtual BOOL OnQuit(INT nExitCode) { return FALSE; }
-
+
+ virtual const SRWnd *GetParentWindow() const { return m_pParentWnd; }
protected:
virtual BOOL Register() = 0;
Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -149,6 +149,7 @@
if(!m_tabViews || !m_tabViews->Create(this, view_rect))
return FALSE;
m_tabViews->Init();
+ this->SetFocus();
InitSword();
@@ -216,6 +217,7 @@
}
if (!strcmp(curMod->Type(), "Commentaries")) {
(*m_modComms)[curMod->Name()] = curMod;
+
}
if (curMod->getConfig().has("Feature", "GreekDef")) {
m_modGreekLex = curMod;
@@ -233,8 +235,10 @@
// TODO We need to deal with commentaries, dict, devos, etc...
- if(!m_menuBar || !m_menuBar->FillTranslationsSubMenu(m_modBibles, m_tabViews->GetBibleModule(), MENU_TRANS_START))
+ if(!m_menuBar || !m_menuBar->FillBiblesSubMenu(m_modBibles, m_tabViews->GetBibleModule(), MENU_BIBLE_TRANS_START))
return FALSE;
+ if(!m_menuBar || !m_menuBar->FillCommsSubMenu(m_modComms, m_tabViews->GetCommModule(), MENU_COMM_TRANS_START))
+ return FALSE;
// Gets the supported global options and fills the options sub menu.
if(!GetSupportedOptions())
@@ -248,7 +252,8 @@
BOOL SRMainFrame::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl)
{
- INT nTransID = 0;
+ INT nBiblesID = 0;
+ INT nCommsID = 0;
INT nOptsID = 0;
INT newValue = (INT)hWndCtl; // I am using this parameter in a strange way I know.
@@ -325,12 +330,17 @@
break;
default:
// Check the custom made menu items...
- nTransID = wID - MENU_TRANS_START;
+ nBiblesID = wID - MENU_BIBLE_TRANS_START;
+ nCommsID = wID - MENU_COMM_TRANS_START;
nOptsID = wID - MENU_OPTS_START;
- if ((nTransID >= 0) && (nTransID < m_menuBar->GetTotalTranslations())) {
- SelectModule(nTransID);
- m_menuBar->CheckTranslationsMenuItem(wID);
+ if ((nBiblesID >= 0) && (nBiblesID < m_menuBar->GetTotalBibles())) {
+ SelectBibleModule(nBiblesID);
+ m_menuBar->CheckBiblesMenuItem(wID);
break;
+ }else if((nCommsID >= 0) && (nCommsID < m_menuBar->GetTotalComms())){
+ SelectCommModule(nCommsID);
+ m_menuBar->CheckCommsMenuItem(wID);
+ break;
}else if((nOptsID >= 0) && (nOptsID < m_menuBar->GetTotalOptions())){
ToggleOption(wID);
}else{
@@ -398,17 +408,28 @@
return fRetVal;
}
-void SRMainFrame::SelectModule(INT nModIndex)
+void SRMainFrame::SelectBibleModule(INT nModIndex)
{
/* TODO This needs to be reworked!!!! */
ModuleMap::iterator it = m_modBibles->begin();
for(int i = 0; i < nModIndex; i++)
it++;
- m_tabViews->SetCurrentModule(it->second);
+ m_tabViews->SetBibleModule(it->second);
SaveOptions();
UpdateWindowTitle();
}
+void SRMainFrame::SelectCommModule(INT nModIndex)
+{
+ /* TODO This needs to be reworked!!!! */
+ ModuleMap::iterator it = m_modComms->begin();
+ for(int i = 0; i < nModIndex; i++)
+ it++;
+ m_tabViews->SetCommModule(it->second);
+ SaveOptions();
+ UpdateWindowTitle();
+}
+
BOOL SRMainFrame::GetSupportedOptions()
{
StringList optionNames = m_swmgr->getGlobalOptions();
@@ -478,7 +499,8 @@
VOID SRMainFrame::LoadOptions()
{
SWBuf val;
- sword::SWModule* textMod = NULL;
+ sword::SWModule* bibleMod = NULL;
+ sword::SWModule* commMod = NULL;
sword::VerseKey* verse = NULL;
INT nCurID = 0;
@@ -488,16 +510,22 @@
m_menuBar->CheckOptionsMenuItem(i + MENU_OPTS_START, (val == "On" ? TRUE : FALSE));
}
- textMod = m_swmgr->getModule((*m_confOptions)["History"].getWithDefault("LastVersion", "KJV"));
- if(!textMod){
- textMod = m_modBibles->begin()->second;
+ bibleMod = m_swmgr->getModule((*m_confOptions)["History"].getWithDefault("LastBibleVersion", "KJV"));
+ if(!bibleMod){
+ bibleMod = m_modBibles->begin()->second;
}
- m_tabViews->SetBibleModule(textMod);
+ m_tabViews->SetBibleModule(bibleMod);
+
+ commMod = m_swmgr->getModule((*m_confOptions)["History"].getWithDefault("LastCommVersion", "MHC"));
+ if(!commMod){
+ commMod = m_modComms->begin()->second;
+ }
+ m_tabViews->SetCommModule(commMod);
/*REM
nCurID = MENU_TRANS_START;
for (ModuleMap::iterator it = m_modTexts->begin(); it != m_modTexts->end(); it++) {
if(it->second == m_viewModules[m_nCurrentModule]->GetModule()){
- m_menuBar->CheckTranslationsMenuItem(nCurID);
+ m_menuBar->CheckBiblesMenuItem(nCurID);
break;
}
nCurID++;
@@ -505,7 +533,8 @@
*/
verse = new VerseKey((*m_confOptions)["History"].getWithDefault("LastPassage", "Gen 1:1"));
- m_tabViews->SetCurrentKey(*verse);
+ m_tabViews->SetBibleKey(*verse);
+ m_tabViews->SetCommKey(*verse);
delete verse;
}
@@ -518,4 +547,10 @@
void SRMainFrame::UpdateWindowTitle()
{
SetWindowText(m_hWnd,m_tabViews->GetCurrentWindowTitle().w_str());
+}
+
+
+void SRMainFrame::SetFocus(){
+ SRWnd::SetFocus();
+ UpdateWindowTitle();
}
\ No newline at end of file
Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -31,10 +31,12 @@
BOOL CreateCommandBar();
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
- void SelectModule(INT nModIndex);
+ void SelectBibleModule(INT nModIndex);
+ void SelectCommModule(INT nModIndex);
BOOL GetSupportedOptions();
void ToggleOption(WORD wID);
+ void SetFocus();
void UpdateWindowTitle();
void SetWindowTitle(const WCString &wcsTitle);
Modified: trunk/src/SwordReader_GUI/SRMenuBar.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRMenuBar.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -3,7 +3,7 @@
SRMenuBar::SRMenuBar(void)
:m_menuMain(NULL)
-,m_menuTrans(NULL)
+,m_menuBibles(NULL)
,m_menuOpts(NULL)
,m_nTotalOpts(0)
{
@@ -14,8 +14,10 @@
{
if(m_menuMain)
delete m_menuMain;
- if(m_menuTrans)
- delete m_menuTrans;
+ if(m_menuBibles)
+ delete m_menuBibles;
+ if(m_menuComms)
+ delete m_menuComms;
if(m_menuOpts)
delete m_menuOpts;
}
@@ -29,11 +31,18 @@
m_menuMain = new SRMenu(GetSubMenu(5));
// Create the translations menu
- m_menuTrans = new SRMenu();
- if(!m_menuTrans->CreatePopupMenu())
+ m_menuBibles = new SRMenu();
+ if(!m_menuBibles->CreatePopupMenu())
return FALSE;
- if(!m_menuMain->InsertMenu(*m_menuTrans,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Translations"))
+ if(!m_menuMain->InsertMenu(*m_menuBibles,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Bibles"))
return FALSE;
+
+ m_menuComms = new SRMenu();
+ if(!m_menuComms->CreatePopupMenu())
+ return FALSE;
+ if(!m_menuMain->InsertMenu(*m_menuComms,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Commentaries"))
+ return FALSE;
+
// Create the options menu
m_menuOpts = new SRMenu();
if(!m_menuOpts->CreatePopupMenu())
@@ -44,21 +53,36 @@
return TRUE;
}
-BOOL SRMenuBar::FillTranslationsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID)
+BOOL SRMenuBar::FillBiblesSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID)
{
int nCurID = nStartID;
- m_nTotalTrans = 0;
+ m_nTotalBibles = 0;
for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
- m_menuTrans->AppendMenu(0, nCurID, i->first);
- m_nTotalTrans++;
+ m_menuBibles->AppendMenu(0, nCurID, i->first);
+ m_nTotalBibles++;
if(i->second == modCurr){
- CheckTranslationsMenuItem(nCurID);
+ CheckBiblesMenuItem(nCurID);
}
nCurID++;
}
return TRUE;
}
+BOOL SRMenuBar::FillCommsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID)
+{
+ int nCurID = nStartID;
+ m_nTotalComms = 0;
+ for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
+ m_menuComms->AppendMenu(0, nCurID, i->first);
+ m_nTotalComms++;
+ if(i->second == modCurr){
+ CheckCommsMenuItem(nCurID);
+ }
+ nCurID++;
+ }
+ return TRUE;
+}
+
BOOL SRMenuBar::FillOptionsSubMenu(SWBuf *bufOpts, bool *fOptsState, int nStartID, int nTotalOpts)
{
int nCurID = nStartID;
@@ -77,14 +101,21 @@
}
-BOOL SRMenuBar::CheckTranslationsMenuItem(UINT nIDCheckItem)
+BOOL SRMenuBar::CheckBiblesMenuItem(UINT nIDCheckItem)
{
- for (int nCurTrans = MENU_TRANS_START; nCurTrans < MENU_TRANS_START + m_nTotalTrans; nCurTrans++) {
- m_menuTrans->CheckMenuItem(nCurTrans, (nIDCheckItem == nCurTrans ? MF_CHECKED : MF_UNCHECKED) );
+ for (int nCurTrans = MENU_BIBLE_TRANS_START; nCurTrans < MENU_BIBLE_TRANS_START + m_nTotalBibles; nCurTrans++) {
+ m_menuBibles->CheckMenuItem(nCurTrans, (nIDCheckItem == nCurTrans ? MF_CHECKED : MF_UNCHECKED) );
}
return TRUE;
}
+BOOL SRMenuBar::CheckCommsMenuItem(UINT nIDCheckItem)
+{
+ for (int nCurTrans = MENU_COMM_TRANS_START; nCurTrans < MENU_COMM_TRANS_START + m_nTotalComms; nCurTrans++) {
+ m_menuComms->CheckMenuItem(nCurTrans, (nIDCheckItem == nCurTrans ? MF_CHECKED : MF_UNCHECKED) );
+ }
+ return TRUE;
+}
BOOL SRMenuBar::CheckOptionsMenuItem(UINT nIDCheckItem, BOOL fChecked)
{
Modified: trunk/src/SwordReader_GUI/SRMenuBar.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRMenuBar.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -14,18 +14,23 @@
{
public:
BOOL Create(SRWnd* pWndParent, UINT nBarID);
- BOOL FillTranslationsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
+ BOOL FillBiblesSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
+ BOOL FillCommsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
BOOL FillOptionsSubMenu(SWBuf *bufOpts, bool *fOptsState, int nStartID, int nTotalOpts);
- BOOL CheckTranslationsMenuItem(UINT nIDCheckItem);
+ BOOL CheckBiblesMenuItem(UINT nIDCheckItem);
+ BOOL CheckCommsMenuItem(UINT nIDCheckItem);
BOOL CheckOptionsMenuItem(UINT nIDCheckItem, BOOL fChecked);
- INT GetTotalTranslations() { return m_nTotalTrans; }
+ INT GetTotalBibles() { return m_nTotalBibles; }
+ INT GetTotalComms() { return m_nTotalComms; }
INT GetTotalOptions() { return m_nTotalOpts; }
SRMenuBar(void);
virtual ~SRMenuBar(void);
private:
SRMenu *m_menuMain;
- SRMenu *m_menuTrans;
+ SRMenu *m_menuBibles;
+ SRMenu *m_menuComms;
SRMenu *m_menuOpts;
INT m_nTotalOpts;
- INT m_nTotalTrans;
+ INT m_nTotalBibles;
+ INT m_nTotalComms;
};
Modified: trunk/src/SwordReader_GUI/SRModuleView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -21,13 +21,14 @@
return 0;
}
-SRModuleView::SRModuleView(void)
+SRModuleView::SRModuleView(SRViewType viewType)
: SRTextView()
, m_pModule(NULL)
, m_fChapterChanged(FALSE)
, m_fSwordInit(FALSE)
, m_fThreadRunning(FALSE)
, m_fAbortThread(FALSE)
+, m_viewType(viewType)
{
}
@@ -137,7 +138,8 @@
if(!m_fChapterChanged)
return;
Clear();
- keyCur.Verse(1);
+ if(m_viewType == BibleView)
+ keyCur.Verse(1);
}else{
m_fChapterChanged = false;
keyCur.Verse(m_nLoadedTill + 1);
@@ -157,6 +159,12 @@
m_pModule->SetKey(keyCur);
int pvHeading = 0;
text = (TCHAR *)m_pModule->RenderText();
+ if(m_viewType == CommView && text.length() == 0){
+ text = "<b>This commentary (";
+ text += m_pModule->Name();
+ text += ") does not have an entry for this verse.</b>";
+ }
+
s = "";
do {
sprintf(strNum, "%i", pvHeading++);
@@ -171,21 +179,30 @@
}
else break;
} while (!fInThread || !m_fAbortThread);
- if(text.c_str()[0] == '¶')
- s += "<br><br>";
- s += GetVerseHeader(keyCur);
- s += text + " ";
+ if(m_viewType == BibleView){
+ if(text.c_str()[0] == '¶')
+ s += "<br><br>";
+ s += GetVerseHeader(keyCur);
+ s += text + " ";
+ }else if(m_viewType == CommView){
+ s += GetVerseHeader(keyCur) + "<br>";
+ s += text;
+ }
AddText(s.w_str(), s.length());
-
- if (keyCur.Verse() == keyCur.getVerseMax() ){
- done = TRUE;
+ if(m_viewType == BibleView){
+ if (keyCur.Verse() == keyCur.getVerseMax() ){
+ done = TRUE;
+ break;
+ }else if(!fInThread && CurrentPageFilled()){
+ done = FALSE;
+ break;
+ }else if(fInThread){
+ DrawLoadingProgress(keyCur);
+ }
+ }else if(m_viewType == CommView){
+ done = TRUE;
break;
- }else if(!fInThread && CurrentPageFilled()){
- done = FALSE;
- break;
- }else if(fInThread){
- DrawLoadingProgress(keyCur);
}
keyCur.increment(1);
}
@@ -323,21 +340,38 @@
//UpdateWindowTitle();
break;
case VK_LEFT:
- if(m_verse.Verse() > 1){
- m_verse.Verse(1);
- ScrollToVerse(1);
- }else{
- m_verse.decrement(1);
- m_verse.Verse(1);
- m_fChapterChanged = true;
- LoadTextView();
+ if(m_viewType == BibleView){
+ if(m_verse.Verse() > 1){
+ m_verse.Verse(1);
+ ScrollToVerse(1);
+ }else{
+ m_verse.decrement(1);
+ m_verse.Verse(1);
+ m_fChapterChanged = true;
+ LoadTextView();
+ }
+ }else if(m_viewType == CommView){
+ if(-m_nTop > (m_rect.bottom - m_rect.top)){
+ ScrollToPosition(0,FALSE);
+ }else{
+ m_verse.decrement(1);
+ m_fChapterChanged = true;
+ LoadTextView();
+ }
}
//UpdateWindowTitle();
break;
case VK_RIGHT:
- m_verse.Chapter(m_verse.Chapter() + 1);
- m_fChapterChanged = true;
- LoadTextView();
+
+ if(m_viewType == BibleView){
+ m_verse.Chapter(m_verse.Chapter() + 1);
+ m_fChapterChanged = true;
+ LoadTextView();
+ }else if(m_viewType == CommView){
+ m_verse.increment(1);
+ m_fChapterChanged = true;
+ LoadTextView();
+ }
break;
default:
return FALSE;
@@ -350,9 +384,10 @@
{
wchar_t wverse[16] = {0};
wchar_t wchapt[16] = {0};
+ if(!m_fSwordInit)
+ return "";
+ EnterCriticalSection(&m_csLoadText);
- EnterCriticalSection(&m_csLoadText);
-
WCString title =
WCString(m_pModule->Name()) + " " +
SRMainFrame::GetBookNames()[(m_verse.Book() - 1) + BIBLE_OT_BOOKS*(m_verse.Testament() - 1)] + WCString(" ") +
Modified: trunk/src/SwordReader_GUI/SRModuleView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRModuleView.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -6,11 +6,13 @@
using namespace sword;
using namespace SRFramework;
+enum SRViewType { BibleView, CommView, DictView };
+
class SRModuleView :
public SRTextView
{
public:
- SRModuleView(void);
+ SRModuleView(SRViewType viewType);
virtual ~SRModuleView(void);
VOID SetModule(SWModule *pModule);
@@ -47,6 +49,7 @@
DWORD m_dwLoadTextThreadID;
BOOL m_fThreadRunning;
BOOL m_fAbortThread;
+ SRViewType m_viewType;
friend DWORD WINAPI LoadTextThread(LPVOID arg);
};
Modified: trunk/src/SwordReader_GUI/SRTabbedViews.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -15,6 +15,8 @@
{
if(m_viewBible)
delete m_viewBible;
+ if(m_viewComm)
+ delete m_viewComm;
}
BOOL SRTabbedViews::Create(SRWnd *pParentWnd, RECT bounds)
@@ -72,25 +74,40 @@
{
RECT tab_rect;
RECT views_rect = m_rect;
- m_viewBible = new SRModuleView();
+ m_viewBible = new SRModuleView(BibleView);
if(!m_viewBible || !m_viewBible->Create(this, m_rect))
return FALSE;
+ m_viewBible->Show();
+ m_viewComm = new SRModuleView(CommView);
+ if(!m_viewComm || !m_viewComm->Create(this, m_rect))
+ return FALSE;
+ m_viewComm->Hide();
+
// Create the tab control
- if(!m_tabs.Create(this, m_rect))
+ if(!m_tabs.Create(this, m_rect, WS_CHILD | WS_VISIBLE | TCS_BOTTOM | TCS_FOCUSNEVER))
return FALSE;
if(!InitTabs())
return FALSE;
+
// Adjust the windows for the tabs...
m_tabs.GetItemRect(0, &tab_rect);
- m_tabs.MoveWindow(m_rect.left,m_rect.top,m_rect.right - m_rect.left, tab_rect.bottom - tab_rect.top, TRUE);
-
- views_rect.top += tab_rect.bottom - tab_rect.top;
- //views_rect.bottom -= tab_rect.bottom - tab_rect.top;
+ tab_rect.bottom += 2;
+ if(0){ // Tabs on top... soon to be an option...
+ m_tabs.MoveWindow(m_rect.left,m_rect.top,m_rect.right - m_rect.left, tab_rect.bottom - tab_rect.top, TRUE);
+ }else{
+ m_tabs.MoveWindow(m_rect.left,m_rect.bottom - (tab_rect.bottom - tab_rect.top),m_rect.right - m_rect.left, tab_rect.bottom - tab_rect.top, TRUE);
+ }
+
+ if(0){ // Same as above
+ views_rect.top += (tab_rect.bottom - tab_rect.top);
+ }else{
+ views_rect.bottom -= (tab_rect.bottom - tab_rect.top);
+ }
+
m_viewBible->MoveWindow(&views_rect, TRUE);
+ m_viewComm->MoveWindow(&views_rect, TRUE);
- m_viewBible->Show();
-
return TRUE;
}
@@ -117,9 +134,20 @@
m_viewBible->SetModule(pModule);
}
+const SWModule *SRTabbedViews::GetCommModule()
+{
+ return m_viewComm->GetModule();
+}
+
+VOID SRTabbedViews::SetCommModule(SWModule *pModule)
+{
+ m_viewComm->SetModule(pModule);
+}
+
VOID SRTabbedViews::SetSwordReady()
{
m_viewBible->SetSwordReady();
+ m_viewComm->SetSwordReady();
/* ... */
}
@@ -131,7 +159,7 @@
case SR_TAB_BIBLE:
return m_viewBible;
case SR_TAB_COMM:
- return NULL;
+ return m_viewComm;
case SR_TAB_DICT:
return NULL;
default:
@@ -277,4 +305,48 @@
if(!view)
return;
view->SetKey(verse);
+}
+
+VOID SRTabbedViews::SetBibleKey(const VerseKey &verse)
+{
+ m_viewBible->SetKey(verse);
+}
+
+VOID SRTabbedViews::SetCommKey(const VerseKey &verse)
+{
+ m_viewComm->SetKey(verse);
+}
+
+BOOL SRTabbedViews::OnNotify(int idCtrl, LPNMHDR pnmh)
+{
+ UINT test = TCN_SELCHANGE;
+ switch(pnmh->code)
+ {
+ case TCN_SELCHANGE:
+ SwitchToCurrentView();
+ break;
+ default:
+ return FALSE;
+ }
+ m_pParentWnd->SetFocus(); // Give focus back to the parent.
+ return TRUE;
+}
+
+VOID SRTabbedViews::SwitchToCurrentView()
+{
+ switch(m_tabs.GetCurSel())
+ {
+ case SR_TAB_BIBLE:
+ m_viewBible->Show();
+ m_viewComm->Hide();
+ break;
+ case SR_TAB_COMM:
+ m_viewComm->Show();
+ m_viewBible->Hide();
+ break;
+ case SR_TAB_DICT:
+ m_viewBible->Hide();
+ m_viewComm->Hide();
+ break;
+ }
}
\ No newline at end of file
Modified: trunk/src/SwordReader_GUI/SRTabbedViews.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -22,7 +22,11 @@
BOOL Init();
BOOL UpdateWindow();
const SWModule *GetBibleModule();
+ const SWModule *GetCommModule();
VOID SetBibleModule(SWModule *pModule);
+ VOID SetBibleKey(const VerseKey &verse);
+ VOID SetCommModule(SWModule *pModule);
+ VOID SetCommKey(const VerseKey &verse);
const SWModule *GetCurrentModule();
VOID SetSwordReady();
VOID RefreshScreen(BOOL fReloadText);
@@ -43,6 +47,8 @@
void MoveWindow(LPCRECT lpRect,BOOL bRepaint = TRUE);
BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+ BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
+ VOID SwitchToCurrentView();
private:
BOOL InitTabs();
BOOL InitViews();
@@ -51,4 +57,5 @@
static BOOL s_fRegistered;
SRModuleView *m_viewBible;
+ SRModuleView *m_viewComm;
};
Modified: trunk/src/SwordReader_GUI/SRTextView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.cpp 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SRTextView.cpp 2008-09-08 05:46:38 UTC (rev 175)
@@ -843,7 +843,8 @@
POINT pt;
RECT rectUpdateRect;
INT nDragDist = 0;
- RECT rectScroll = m_rect;
+ RECT rectScroll;
+ GetClientRect(m_hWnd, &rectScroll);
rectScroll.bottom -= m_wStatusBarHeight;
if(m_fDragging){
@@ -879,7 +880,8 @@
RECT rectUpdateRect;
BOOL fDone = FALSE;
INT nDirection = m_nRollVelocity > 0 ? 1 : -1;
- RECT rectScroll = m_rect;
+ RECT rectScroll;
+ GetClientRect(m_hWnd, &rectScroll);
rectScroll.bottom -= m_wStatusBarHeight;
while(!fDone && nDirection*m_nRollVelocity > 0){
@@ -910,7 +912,7 @@
VOID SRTextView::SendVerseChangedMessage()
{
- ::SendMessage(m_pParentWnd->GetWindowHandle(),WM_COMMAND, (SR_MSRC_TEXT << 16) | SR_SETVERSE, GetVerseNum());
+ ::SendMessage(m_pParentWnd->GetParentWindow()->GetWindowHandle(),WM_COMMAND, (SR_MSRC_TEXT << 16) | SR_SETVERSE, GetVerseNum());
}
VOID SRTextView::ScrollFullPage(INT nDirection)
@@ -923,7 +925,7 @@
INT nRollBy = rectClientRect.bottom - rectClientRect.top;
INT nCalcDist = 0;
CONST INT UPPER_SB = 15; // Upper bound on the scrolling per iteration.
- RECT rectScroll = m_rect;
+ RECT rectScroll = rectClientRect;
rectScroll.bottom -= m_wStatusBarHeight;
nDirection = (nDirection > 0) ? 1 : -1;
@@ -957,7 +959,8 @@
POINT pt;
RECT rectUpdateRect;
INT nDragDist = 0;
- RECT rectScroll = m_rect;
+ RECT rectScroll;
+ GetClientRect(m_hWnd, &rectScroll);
rectScroll.bottom -= m_wStatusBarHeight;
if( yPos >= 0){
Modified: trunk/src/SwordReader_GUI/SwordReaderResource.h
===================================================================
--- trunk/src/SwordReader_GUI/SwordReaderResource.h 2008-09-07 04:46:06 UTC (rev 174)
+++ trunk/src/SwordReader_GUI/SwordReaderResource.h 2008-09-08 05:46:38 UTC (rev 175)
@@ -40,8 +40,9 @@
-#define MENU_TRANS_START 0x1000
-#define MENU_OPTS_START 0x2000
+#define MENU_BIBLE_TRANS_START 0x1000
+#define MENU_COMM_TRANS_START 0x2000
+#define MENU_OPTS_START 0x3000
#define WM_TXT_START WM_USER + 0x00F1
#define WM_TXT_END WM_USER + 0x00F2
More information about the sword-cvs
mailing list