[sword-svn] r118 - in trunk/src/SwordReader_GUI: . SRFramework
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Tue Apr 15 21:25:19 MST 2008
Author: dtrotzjr
Date: 2008-04-15 21:25:18 -0700 (Tue, 15 Apr 2008)
New Revision: 118
Added:
trunk/src/SwordReader_GUI/SRMenuBar.cpp
trunk/src/SwordReader_GUI/SRMenuBar.h
Modified:
trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp
trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h
trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp
trunk/src/SwordReader_GUI/SRMainFrame.cpp
trunk/src/SwordReader_GUI/SRMainFrame.h
trunk/src/SwordReader_GUI/SRReaderApp.h
trunk/src/SwordReader_GUI/SwordReaderResource.h
trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
More Restructuring.
Modified: trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp 2008-04-16 04:25:18 UTC (rev 118)
@@ -7,8 +7,6 @@
SRCommandBar::~SRCommandBar(void)
{
- if(m_menu)
- delete m_menu;
}
BOOL SRCommandBar::Create(SRWnd* pWndParent, UINT nBarID)
Modified: trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h 2008-04-16 04:25:18 UTC (rev 118)
@@ -21,7 +21,6 @@
void RedrawMenu();
protected:
HWND m_hWndCB;
- SRMenu *m_menu;
};
}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRFramework/SRMenu.cpp 2008-04-16 04:25:18 UTC (rev 118)
@@ -47,3 +47,4 @@
}
+
Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-04-16 04:25:18 UTC (rev 118)
@@ -1,16 +1,25 @@
#include "SRMainFrame.h"
+#include <markupfiltmgr.h>
+using namespace sword;
+
+namespace sword {
+ char *SWBuf::nullStr = "";
+}
+
SRMainFrame::SRMainFrame()
{
m_wcsClassName = "SRMainFrame";
m_wcsWindowName = "SwordReader";
m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+ m_swmgr = new SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
}
SRMainFrame::~SRMainFrame()
{
-
+ if(m_swmgr)
+ delete m_swmgr;
}
BOOL SRMainFrame::Register()
@@ -52,8 +61,10 @@
CreateCommandBar();
- view_rect.bottom -= m_cmdBar->Height();
+ InitSword();
+ view_rect.bottom -= m_menuBar->Height();
+
m_viewText = new SRTextView();
if(!m_viewText->Create(this, view_rect))
return FALSE;
@@ -66,30 +77,51 @@
BOOL SRMainFrame::CreateCommandBar()
{
- m_cmdBar = new SRCommandBar();
- if(!m_cmdBar->Create(this, IDM_MENU))
+ m_menuBar = new SRMenuBar();
+ if(!m_menuBar->Create(this, IDM_MENU))
return FALSE;
- m_menuMain = new SRMenu(m_cmdBar->GetSubMenu(5));
- // Create the translations menu
- m_menuTrans = new SRMenu();
- if(!m_menuTrans->CreatePopupMenu())
- return FALSE;
- if(!m_menuMain->InsertMenu(*m_menuTrans,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Translations"))
- return FALSE;
- // Create the options menu
- m_menuOpts = new SRMenu();
- if(!m_menuOpts->CreatePopupMenu())
- return FALSE;
- if(!m_menuMain->InsertMenu(*m_menuOpts,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Options"))
- return FALSE;
+ m_menuBar->RedrawMenu();
+ m_menuBar->Show();
- m_cmdBar->RedrawMenu();
- m_cmdBar->Show();
-
return TRUE;
}
BOOL SRMainFrame::UpdateWindow()
{
return m_viewText->UpdateWindow();
}
+
+BOOL SRMainFrame::InitSword()
+{
+ m_modTexts = new ModuleMap();
+
+ sword::ModMap::iterator it;
+ sword::SWModule* curMod = 0;
+
+ for (it = m_swmgr->Modules.begin(); it != m_swmgr->Modules.end(); it++) {
+ curMod = (*it).second;
+ if (!strcmp(curMod->Type(), "Biblical Texts")) {
+ (*m_modTexts)[curMod->Name()] = curMod;
+ }
+ if (!strcmp(curMod->Type(), "Commentaries")) {
+ (*m_modTexts)[curMod->Name()] = curMod;
+ }
+ if (curMod->getConfig().has("Feature", "GreekDef")) {
+ m_modGreekLex = curMod;
+ }
+ if (curMod->getConfig().has("Feature", "GreekParse")) {
+ m_modGreekMorph = curMod;
+ }
+ if (curMod->getConfig().has("Feature", "HebrewDef")) {
+ m_modHebrewLex = curMod;
+ }
+ if (curMod->getConfig().has("Feature", "HebrewParse")) {
+ m_modHebrewMorph = curMod;
+ }
+ }
+
+ if(!m_menuBar || !m_menuBar->FillTranslationsSubMenu(m_modTexts,MENU_TRANS_START))
+ return FALSE;
+
+ return TRUE;
+}
Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h 2008-04-16 04:25:18 UTC (rev 118)
@@ -1,15 +1,20 @@
#pragma once
+#include <swmgr.h>
+#include <swmodule.h>
#include "resource.h"
+#include "SwordReaderResource.h"
#include "SRFramework/SRFrame.h"
#include "SRFramework/SRCommandBar.h"
#include "SRFramework/SRCommandBar.h"
#include "SRFramework/SRMenu.h"
#include "SRTextView.h"
+#include "SRMenuBar.h"
// The one and only command bar.
#define SR_COMMAND_BAR_ID 0x0001
using namespace SRFramework;
+using namespace sword;
class SRMainFrame : public SRFrame
{
@@ -21,10 +26,14 @@
BOOL Create();
BOOL UpdateWindow();
BOOL CreateCommandBar();
+ BOOL InitSword();
private:
- SRCommandBar *m_cmdBar;
+ SRMenuBar *m_menuBar;
SRTextView *m_viewText;
- SRMenu *m_menuMain;
- SRMenu *m_menuTrans;
- SRMenu *m_menuOpts;
+ SWMgr *m_swmgr;
+ ModuleMap *m_modTexts;
+ SWModule *m_modGreekLex;
+ SWModule *m_modGreekMorph;
+ SWModule *m_modHebrewLex;
+ SWModule *m_modHebrewMorph;
};
Added: trunk/src/SwordReader_GUI/SRMenuBar.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.cpp (rev 0)
+++ trunk/src/SwordReader_GUI/SRMenuBar.cpp 2008-04-16 04:25:18 UTC (rev 118)
@@ -0,0 +1,43 @@
+#include "SRMenuBar.h"
+using namespace SRFramework;
+
+SRMenuBar::SRMenuBar(void)
+{
+}
+
+SRMenuBar::~SRMenuBar(void)
+{
+}
+
+
+BOOL SRMenuBar::Create(SRWnd* pWndParent, UINT nBarID)
+{
+ if(!SRCommandBar::Create(pWndParent, nBarID)){
+ return FALSE;
+ }
+ m_menuMain = new SRMenu(GetSubMenu(5));
+
+ // Create the translations menu
+ m_menuTrans = new SRMenu();
+ if(!m_menuTrans->CreatePopupMenu())
+ return FALSE;
+ if(!m_menuMain->InsertMenu(*m_menuTrans,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Translations"))
+ return FALSE;
+ // Create the options menu
+ m_menuOpts = new SRMenu();
+ if(!m_menuOpts->CreatePopupMenu())
+ return FALSE;
+ if(!m_menuMain->InsertMenu(*m_menuOpts,0, MF_BYPOSITION | MF_POPUP | MF_STRING, "Options"))
+ return FALSE;
+
+ return TRUE;
+}
+
+BOOL SRMenuBar::FillTranslationsSubMenu(ModuleMap *texts, int nStartID)
+{
+ int nCurID = nStartID;
+ for (ModuleMap::iterator i = texts->begin(); i != texts->end(); i++) {
+ m_menuTrans->AppendMenu(0, nCurID++, i->first);
+ }
+ return TRUE;
+}
\ No newline at end of file
Added: trunk/src/SwordReader_GUI/SRMenuBar.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMenuBar.h (rev 0)
+++ trunk/src/SwordReader_GUI/SRMenuBar.h 2008-04-16 04:25:18 UTC (rev 118)
@@ -0,0 +1,20 @@
+#pragma once
+#include "SRFramework\SRWnd.h"
+#include "SRFramework\SRCommandBar.h"
+#include "SwordReaderResource.h"
+
+using namespace SRFramework;
+
+class SRMenuBar :
+ public SRFramework::SRCommandBar
+{
+public:
+ BOOL Create(SRWnd* pWndParent, UINT nBarID);
+ BOOL FillTranslationsSubMenu(ModuleMap *texts, int nStartID);
+ SRMenuBar(void);
+ virtual ~SRMenuBar(void);
+private:
+ SRMenu *m_menuMain;
+ SRMenu *m_menuTrans;
+ SRMenu *m_menuOpts;
+};
Modified: trunk/src/SwordReader_GUI/SRReaderApp.h
===================================================================
--- trunk/src/SwordReader_GUI/SRReaderApp.h 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SRReaderApp.h 2008-04-16 04:25:18 UTC (rev 118)
@@ -1,11 +1,9 @@
#pragma once
#include <swconfig.h>
-#include "SimpleNavigator.h"
#include "SRFramework/SRApp.h"
#include "SRMainFrame.h"
-//#include "ApplicationInterface.h"
-//#include "swordce.h"
+using namespace sword;
using namespace SRFramework;
class SRReaderApp : SRApp
Modified: trunk/src/SwordReader_GUI/SwordReaderResource.h
===================================================================
--- trunk/src/SwordReader_GUI/SwordReaderResource.h 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SwordReaderResource.h 2008-04-16 04:25:18 UTC (rev 118)
@@ -1,6 +1,20 @@
#ifndef _SWORDREADERRESOURCE_H_
#define _SWORDREADERRESOURCE_H_
+#include <map>
+#include <swmodule.h>
+struct ltstr
+{
+ bool operator()(const char* s1, const char* s2) const
+ {
+ return strcmp(s1, s2) < 0;
+ }
+};
+
+typedef std::map<const char*, sword::SWModule*, ltstr> ModuleMap;
+
+#define MENU_TRANS_START 0x1000
+#define MENU_OPTS_START 0x2000
#define WM_TXT_START WM_USER + 0x00F1
#define WM_TXT_END WM_USER + 0x00F2
Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj 2008-04-14 03:16:21 UTC (rev 117)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj 2008-04-16 04:25:18 UTC (rev 118)
@@ -646,6 +646,10 @@
>
</File>
<File
+ RelativePath=".\SRMenuBar.cpp"
+ >
+ </File>
+ <File
RelativePath=".\SRReaderApp.cpp"
>
</File>
@@ -699,6 +703,10 @@
>
</File>
<File
+ RelativePath=".\SRMenuBar.h"
+ >
+ </File>
+ <File
RelativePath=".\SRReaderApp.h"
>
</File>
More information about the sword-cvs
mailing list