#include "SRLexiView.h" SRLexiView::SRLexiView(BOOL fIsSubWindow) :SRTextView(fIsSubWindow) ,m_pModule(NULL) ,m_fSwordInit(FALSE) { } SRLexiView::~SRLexiView() { } WCString SRLexiView::GetWindowTitle() { wchar_t wverse[16] = {0}; wchar_t wchapt[16] = {0}; if(!m_fSwordInit || !m_pModule) return ""; WCString title = WCString(m_pModule->Name()); return title; } const SWKey &SRLexiView::GetKey() { if(!m_pModule) return m_keyDummy; return *m_pModule->getKey(); } VOID SRLexiView::SetEntry(const WCString &entry) { StrKey newKey(entry.c_str()); SWKey *oldKey = m_pModule->getKey(); if(!oldKey || (*oldKey) == newKey) return; m_pModule->setKey(newKey); m_fEntryChanged = TRUE; LoadTextView(); } VOID SRLexiView::SetKey(const StrKey &key) { SWKey *oldKey = NULL; if(!m_pModule) return; oldKey = m_pModule->getKey(); if(!oldKey || (*oldKey) == key) return; StrKey newKey(key); m_pModule->SetKey(newKey); m_fEntryChanged = TRUE; LoadTextView(); } VOID SRLexiView::SetModule(SWModule *pModule) { if(m_pModule == pModule) return; m_pModule = pModule; m_pModule->setKey(""); m_fEntryChanged = TRUE; LoadTextView(); } VOID SRLexiView::LoadTextView() { WCString buf = "
"; WCString tmp = ""; if(!m_pModule){ buf += "No Lexicon/Dictionary selected; nothing to load."; Clear(); AddText(buf.w_str(), buf.length()); return; } if(!m_fSwordInit || !m_fEntryChanged) return; tmp = (TCHAR *)m_pModule->RenderText(); if(tmp.length() == 0){ tmp = "The current lexicon module ("; tmp += m_pModule->Name(); tmp += ") does not have an entry for given string"; }else{ buf += ""; buf += m_pModule->KeyText(); buf += ":