[sword-svn] r190 - in trunk/src/SwordReader_GUI: . SRFramework
dtrotzjr at crosswire.org
dtrotzjr at crosswire.org
Sat Jan 3 16:10:44 MST 2009
Author: dtrotzjr
Date: 2009-01-03 16:10:44 -0700 (Sat, 03 Jan 2009)
New Revision: 190
Modified:
trunk/src/SwordReader_GUI/SRFramework/SRComboBox.cpp
trunk/src/SwordReader_GUI/SRFramework/SRComboBox.h
trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp
trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h
trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
trunk/src/SwordReader_GUI/SRLexiView.cpp
trunk/src/SwordReader_GUI/SRLexiView.h
trunk/src/SwordReader_GUI/SRLexiWidget.cpp
trunk/src/SwordReader_GUI/SRLexiWidget.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/SRTabbedViews.cpp
trunk/src/SwordReader_GUI/SRTabbedViews.h
trunk/src/SwordReader_GUI/SwordReaderResource.h
Log:
Dictionary support is pretty much in place now. Dictionaries can be selected and an entry can be queried.
Modified: trunk/src/SwordReader_GUI/SRFramework/SRComboBox.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRComboBox.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRFramework/SRComboBox.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -102,4 +102,26 @@
BOOL SRComboBox::SetText(const WCString &text)
{
return ::SendMessage(m_hWnd, WM_SETTEXT, NULL, (LPARAM)text.w_str());
+}
+
+
+BOOL SRComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ INT a = 0;
+
+ switch(nChar)
+ {
+ case VK_UP:
+ break;
+ case VK_DOWN:
+ break;
+ case VK_LEFT:
+ break;
+ case VK_RIGHT:
+ break;
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
}
\ No newline at end of file
Modified: trunk/src/SwordReader_GUI/SRFramework/SRComboBox.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRComboBox.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRFramework/SRComboBox.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -9,21 +9,23 @@
public:
SRComboBox(VOID);
virtual ~SRComboBox(VOID);
- BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | WS_BORDER | CBS_DROPDOWN | WS_VSCROLL);
+
+ BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | WS_BORDER | CBS_DROPDOWN | WS_VSCROLL);
// 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 SetCurSel(INT nItemIndex);
- INT GetCurSel();
- BOOL SetText(const WCString &text);
- WCString GetItemAt(INT nItemIndex);
+ 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 SetCurSel(INT nItemIndex);
+ INT GetCurSel();
+ BOOL SetText(const WCString &text);
+ WCString GetItemAt(INT nItemIndex);
+ BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};
}
\ No newline at end of file
Modified: trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -3,6 +3,7 @@
SRMenu::SRMenu()
+:m_hMenu(NULL)
{
}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRFramework/SRTabCtrl.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -32,6 +32,7 @@
BOOL SetCurSel(INT nItem);
INT SetMinTabWidth(INT cx);
BOOL SetPadding(INT cx, INT cy);
+ virtual WCString GetWindowTitle() { return ""; }
};
Modified: trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -15,7 +15,7 @@
virtual ~SRWnd(void);
BOOL IshWnd(HWND hWnd) { return hWnd == m_hWnd; }
-
+ virtual WCString GetWindowTitle() { return ""; };
//! The actual call back function for this window.
/*! This only acts as a mediator between the callback function we really
want and the call back the Win API is expecting.
Modified: trunk/src/SwordReader_GUI/SRLexiView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiView.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRLexiView.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -12,6 +12,18 @@
}
+WCString SRLexiView::GetWindowTitle()
+{
+ wchar_t wverse[16] = {0};
+ wchar_t wchapt[16] = {0};
+ if(!m_fSwordInit)
+ return "";
+ WCString title =
+ WCString(m_pModule->Name());
+
+ return title;
+}
+
VOID SRLexiView::SetEntry(const WCString &entry)
{
StrKey newKey(entry.c_str());
Modified: trunk/src/SwordReader_GUI/SRLexiView.h
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiView.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRLexiView.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -24,6 +24,7 @@
BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
VOID Show();
+ WCString GetWindowTitle();
private:
VOID LoadTextView();
Modified: trunk/src/SwordReader_GUI/SRLexiWidget.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiWidget.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRLexiWidget.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -36,6 +36,13 @@
return TRUE;
}
+WCString SRLexiWidget::GetWindowTitle()
+{
+ if(m_viewLexi)
+ return m_viewLexi->GetWindowTitle();
+ return m_wcsWindowName;
+}
+
BOOL SRLexiWidget::Register()
{
// Register window class...
@@ -64,9 +71,11 @@
BOOL SRLexiWidget::Init()
{
- RECT lblRect = m_rect;
- RECT cmbRect = m_rect;
- RECT viewRect = m_rect;
+ RECT rectClient;
+ GetClientRect(m_hWnd, &rectClient);
+ RECT lblRect = rectClient;
+ RECT cmbRect = rectClient;
+ RECT viewRect = rectClient;
lblRect.top = 4;
lblRect.left = 4;
lblRect.right = 60;
@@ -220,7 +229,8 @@
FillDictEntries();
break;
case CBN_CLOSEUP:
- return FALSE;
+ m_pParentWnd->SetFocus();
+ break;
case CBN_SELENDOK:
m_wcsCurEntry = m_cmbDictEntry->GetText();
m_viewLexi->SetEntry(m_wcsCurEntry);
Modified: trunk/src/SwordReader_GUI/SRLexiWidget.h
===================================================================
--- trunk/src/SwordReader_GUI/SRLexiWidget.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRLexiWidget.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -27,6 +27,7 @@
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl);
BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+ WCString GetWindowTitle();
private:
static BOOL s_fRegistered;
SRComboBox *m_cmbDictEntry;
Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -247,6 +247,8 @@
return FALSE;
if(!m_menuBar || !m_menuBar->FillCommsSubMenu(m_modComms, m_tabViews->GetCommModule(), MENU_COMM_TRANS_START))
return FALSE;
+ if(!m_menuBar || !m_menuBar->FillDictsSubMenu(m_modDicts, m_tabViews->GetDictModule(), MENU_DICT_TRANS_START))
+ return FALSE;
// Gets the supported global options and fills the options sub menu.
if(!GetSupportedOptions())
@@ -262,6 +264,7 @@
{
INT nBiblesID = 0;
INT nCommsID = 0;
+ INT nDictsID = 0;
INT nOptsID = 0;
INT newValue = (INT)hWndCtl; // I am using this parameter in a strange way I know.
@@ -337,6 +340,7 @@
// Check the custom made menu items...
nBiblesID = wID - MENU_BIBLE_TRANS_START;
nCommsID = wID - MENU_COMM_TRANS_START;
+ nDictsID = wID - MENU_DICT_TRANS_START;
nOptsID = wID - MENU_OPTS_START;
if ((nBiblesID >= 0) && (nBiblesID < m_menuBar->GetTotalBibles())) {
SelectBibleModule(nBiblesID);
@@ -346,6 +350,10 @@
SelectCommModule(nCommsID);
m_menuBar->CheckCommsMenuItem(wID);
break;
+ }else if((nDictsID >= 0) && (nDictsID < m_menuBar->GetTotalDicts())){
+ SelectDictModule(nDictsID);
+ m_menuBar->CheckDictsMenuItem(wID);
+ break;
}else if((nOptsID >= 0) && (nOptsID < m_menuBar->GetTotalOptions())){
ToggleOption(wID);
}else{
@@ -462,6 +470,17 @@
UpdateWindowTitle();
}
+void SRMainFrame::SelectDictModule(INT nModIndex)
+{
+ /* TODO This needs to be reworked!!!! */
+ ModuleMap::iterator it = m_modDicts->begin();
+ for(int i = 0; i < nModIndex; i++)
+ it++;
+ m_tabViews->SetDictModule(it->second);
+ SaveOptions();
+ UpdateWindowTitle();
+}
+
BOOL SRMainFrame::GetSupportedOptions()
{
StringList optionNames = m_swmgr->getGlobalOptions();
Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -33,6 +33,7 @@
void SelectBibleModule(INT nModIndex);
void SelectCommModule(INT nModIndex);
+ void SelectDictModule(INT nModIndex);
BOOL GetSupportedOptions();
void ToggleOption(WORD wID);
Modified: trunk/src/SwordReader_GUI/SRMenuBar.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRMenuBar.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -30,24 +30,30 @@
}
m_menuMain = new SRMenu(GetSubMenu(5));
- // Create the translations menu
- m_menuBibles = new SRMenu();
- if(!m_menuBibles->CreatePopupMenu())
+ // Create the options menu
+ m_menuOpts = new SRMenu();
+ if(!m_menuOpts->CreatePopupMenu())
return FALSE;
- if(!m_menuMain->InsertMenu(*m_menuBibles,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Bibles"))
+ if(!m_menuMain->InsertMenu(*m_menuOpts,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Options"))
return FALSE;
+ // Create the translations menu
+ m_menuDicts = new SRMenu();
+ if(!m_menuDicts->CreatePopupMenu())
+ return FALSE;
+ if(!m_menuMain->InsertMenu(*m_menuDicts,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Dictionaries"))
+ 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())
+ m_menuBibles = new SRMenu();
+ if(!m_menuBibles->CreatePopupMenu())
return FALSE;
- if(!m_menuMain->InsertMenu(*m_menuOpts,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Options"))
+ if(!m_menuMain->InsertMenu(*m_menuBibles,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Bibles"))
return FALSE;
return TRUE;
@@ -57,7 +63,11 @@
{
int nCurID = nStartID;
m_nTotalBibles = 0;
- for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
+
+ if(!m_menuBibles)
+ return FALSE;
+
+ for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
m_menuBibles->AppendMenu(0, nCurID, i->first);
m_nTotalBibles++;
if(i->second == modCurr){
@@ -72,6 +82,10 @@
{
int nCurID = nStartID;
m_nTotalComms = 0;
+
+ if(!m_menuComms)
+ return FALSE;
+
for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
m_menuComms->AppendMenu(0, nCurID, i->first);
m_nTotalComms++;
@@ -83,6 +97,25 @@
return TRUE;
}
+BOOL SRMenuBar::FillDictsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID)
+{
+ int nCurID = nStartID;
+ m_nTotalDicts = 0;
+
+ if(!m_menuDicts)
+ return FALSE;
+
+ for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
+ m_menuDicts->AppendMenu(0, nCurID, i->first);
+ m_nTotalDicts++;
+ if(i->second == modCurr){
+ CheckDictsMenuItem(nCurID);
+ }
+ nCurID++;
+ }
+ return TRUE;
+}
+
BOOL SRMenuBar::FillOptionsSubMenu(SWBuf *bufOpts, bool *fOptsState, int nStartID, int nTotalOpts)
{
int nCurID = nStartID;
@@ -117,6 +150,14 @@
return TRUE;
}
+BOOL SRMenuBar::CheckDictsMenuItem(UINT nIDCheckItem)
+{
+ for (int nCurTrans = MENU_DICT_TRANS_START; nCurTrans < MENU_DICT_TRANS_START + m_nTotalDicts; nCurTrans++) {
+ m_menuDicts->CheckMenuItem(nCurTrans, (nIDCheckItem == nCurTrans ? MF_CHECKED : MF_UNCHECKED) );
+ }
+ return TRUE;
+}
+
BOOL SRMenuBar::CheckOptionsMenuItem(UINT nIDCheckItem, BOOL fChecked)
{
return m_menuOpts->CheckMenuItem(nIDCheckItem, (fChecked ? MF_CHECKED : MF_UNCHECKED));
Modified: trunk/src/SwordReader_GUI/SRMenuBar.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRMenuBar.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -16,12 +16,15 @@
BOOL Create(SRWnd* pWndParent, UINT nBarID);
BOOL FillBiblesSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
BOOL FillCommsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
+ BOOL FillDictsSubMenu(ModuleMap *texts, const SWModule *modCurr, int nStartID);
BOOL FillOptionsSubMenu(SWBuf *bufOpts, bool *fOptsState, int nStartID, int nTotalOpts);
BOOL CheckBiblesMenuItem(UINT nIDCheckItem);
BOOL CheckCommsMenuItem(UINT nIDCheckItem);
+ BOOL CheckDictsMenuItem(UINT nIDCheckItem);
BOOL CheckOptionsMenuItem(UINT nIDCheckItem, BOOL fChecked);
INT GetTotalBibles() { return m_nTotalBibles; }
INT GetTotalComms() { return m_nTotalComms; }
+ INT GetTotalDicts() { return m_nTotalDicts; }
INT GetTotalOptions() { return m_nTotalOpts; }
SRMenuBar(void);
virtual ~SRMenuBar(void);
@@ -29,8 +32,10 @@
SRMenu *m_menuMain;
SRMenu *m_menuBibles;
SRMenu *m_menuComms;
+ SRMenu *m_menuDicts;
SRMenu *m_menuOpts;
INT m_nTotalOpts;
INT m_nTotalBibles;
INT m_nTotalComms;
+ INT m_nTotalDicts;
};
Modified: trunk/src/SwordReader_GUI/SRTabbedViews.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.cpp 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.cpp 2009-01-03 23:10:44 UTC (rev 190)
@@ -355,12 +355,20 @@
WCString SRTabbedViews::GetCurrentWindowTitle()
{
- SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
+ SRWnd *view = GetCurrentView();
if(!view)
return "";
return view->GetWindowTitle();
}
+WCString SRTabbedViews::GetWindowTitle()
+{
+ SRWnd *view = GetCurrentView();
+ if(!view)
+ return "";
+ return view->GetWindowTitle();
+}
+
const SWModule *SRTabbedViews::GetCurrentModule()
{
SRModuleView *view = dynamic_cast<SRModuleView *>(GetCurrentView());
Modified: trunk/src/SwordReader_GUI/SRTabbedViews.h
===================================================================
--- trunk/src/SwordReader_GUI/SRTabbedViews.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SRTabbedViews.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -58,6 +58,8 @@
BOOL OnNotify(int idCtrl, LPNMHDR pnmh);
INT SwitchToCurrentView();
+
+ WCString GetWindowTitle();
private:
SRTabCtrl m_tabs;
BOOL InitTabs();
Modified: trunk/src/SwordReader_GUI/SwordReaderResource.h
===================================================================
--- trunk/src/SwordReader_GUI/SwordReaderResource.h 2009-01-03 20:07:04 UTC (rev 189)
+++ trunk/src/SwordReader_GUI/SwordReaderResource.h 2009-01-03 23:10:44 UTC (rev 190)
@@ -42,7 +42,8 @@
#define MENU_BIBLE_TRANS_START 0x1000
#define MENU_COMM_TRANS_START 0x2000
-#define MENU_OPTS_START 0x3000
+#define MENU_DICT_TRANS_START 0x3000
+#define MENU_OPTS_START 0x4000
#define WM_TXT_START WM_USER + 0x00F1
#define WM_TXT_END WM_USER + 0x00F2
More information about the sword-cvs
mailing list