ZRCola.zrcdb loading added
This commit is contained in:
parent
81e88a82e4
commit
ce89d26373
@ -7,7 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\libZRCola\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\stdex\include;..\lib\libZRCola\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
@ -30,5 +30,8 @@
|
|||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wxex/common.h>
|
#include <wxex/common.h>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <stdex/idrec.h>
|
||||||
|
@ -42,3 +42,6 @@ public:
|
|||||||
/// - false otherwise
|
/// - false otherwise
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxDECLARE_APP(ZRColaApp);
|
||||||
|
@ -30,6 +30,30 @@ wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
|||||||
m_selComposed(0, 0),
|
m_selComposed(0, 0),
|
||||||
wxZRColaComposerPanelBase(parent)
|
wxZRColaComposerPanelBase(parent)
|
||||||
{
|
{
|
||||||
|
wxString sPath(wxPathOnly(wxTheApp->argv[0]));
|
||||||
|
sPath << wxT("\\..\\data\\ZRCola.zrcdb"); // TODO: Make database file configurable
|
||||||
|
|
||||||
|
std::fstream dat((LPCTSTR)sPath, std::ios_base::in | std::ios_base::binary);
|
||||||
|
if (dat.good()) {
|
||||||
|
if (stdex::idrec::find<ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dat, ZRCOLA_DB_ID, sizeof(ZRCola::recordid_t))) {
|
||||||
|
ZRCola::recordsize_t size;
|
||||||
|
dat.read((char*)&size, sizeof(ZRCola::recordsize_t));
|
||||||
|
if (dat.good()) {
|
||||||
|
ZRCola::translation_rec r_rec(m_t_db);
|
||||||
|
if (r_rec.find(dat, size)) {
|
||||||
|
dat >> r_rec;
|
||||||
|
if (!dat.good()) {
|
||||||
|
wxFAIL_MSG(wxT("Error reading translation data from ZRCola.zrcdb."));
|
||||||
|
m_t_db. comp_index.clear();
|
||||||
|
m_t_db.decomp_index.clear();
|
||||||
|
m_t_db. data.clear();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
wxFAIL_MSG(wxT("ZRCola.zrcdb has no translation data."));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
wxFAIL_MSG(wxT("ZRCola.zrcdb is not a valid ZRCola database."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ protected:
|
|||||||
virtual void OnComposedText(wxCommandEvent& event);
|
virtual void OnComposedText(wxCommandEvent& event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ZRCola::translation_db m_t_db; ///< Translation database
|
||||||
bool m_progress; ///< Boolean flag to avoid recursive updates of composed and decomposed text controls
|
bool m_progress; ///< Boolean flag to avoid recursive updates of composed and decomposed text controls
|
||||||
ZRCola::mapping_vector m_mapping; ///< Character index mapping vector between composed and decomposed text
|
ZRCola::mapping_vector m_mapping; ///< Character index mapping vector between composed and decomposed text
|
||||||
std::pair<long, long>
|
std::pair<long, long>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 32391e55a37dd6f56577f6b761fbe8589f858095
|
Subproject commit f5a2b04caa11c846a5414d5c10934723e53aa84b
|
Loading…
x
Reference in New Issue
Block a user