Code clean-up
This commit is contained in:
parent
affe7b06a2
commit
38a77ca51b
@ -31,7 +31,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) : wxZRColaCharacterCatalogPanelBase(parent)
|
wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) : wxZRColaCharacterCatalogPanelBase(parent)
|
||||||
{
|
{
|
||||||
std::fstream dat((LPCTSTR)((ZRColaApp*)wxTheApp)->GetDatabaseFilePath(), std::ios_base::in | std::ios_base::binary);
|
std::fstream dat((LPCTSTR)dynamic_cast<ZRColaApp*>(wxTheApp)->GetDatabaseFilePath(), std::ios_base::in | std::ios_base::binary);
|
||||||
if (dat.good()) {
|
if (dat.good()) {
|
||||||
if (stdex::idrec::find<ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dat, ZRCOLA_DB_ID, sizeof(ZRCola::recordid_t))) {
|
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;
|
ZRCola::recordsize_t size;
|
||||||
@ -96,7 +96,7 @@ void wxZRColaCharacterCatalogPanel::OnChoice(wxCommandEvent& event)
|
|||||||
|
|
||||||
void wxZRColaCharacterCatalogPanel::OnGridClick(wxGridEvent& event)
|
void wxZRColaCharacterCatalogPanel::OnGridClick(wxGridEvent& event)
|
||||||
{
|
{
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
if (app->m_mainWnd) {
|
if (app->m_mainWnd) {
|
||||||
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(event.GetRow(), event.GetCol()));
|
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(event.GetRow(), event.GetCol()));
|
||||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||||
@ -111,7 +111,7 @@ void wxZRColaCharacterCatalogPanel::OnGridKeyDown(wxKeyEvent& event)
|
|||||||
switch (event.GetKeyCode()) {
|
switch (event.GetKeyCode()) {
|
||||||
case WXK_RETURN:
|
case WXK_RETURN:
|
||||||
case WXK_NUMPAD_ENTER:
|
case WXK_NUMPAD_ENTER:
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
if (app->m_mainWnd) {
|
if (app->m_mainWnd) {
|
||||||
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(m_grid->GetCursorRow(), m_grid->GetCursorColumn()));
|
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(m_grid->GetCursorRow(), m_grid->GetCursorColumn()));
|
||||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||||
@ -137,7 +137,7 @@ void wxZRColaCharacterCatalogPanel::OnShowAll(wxCommandEvent& event)
|
|||||||
|
|
||||||
void wxZRColaCharacterCatalogPanel::OnFocusDecomposed(wxCommandEvent& event)
|
void wxZRColaCharacterCatalogPanel::OnFocusDecomposed(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
if (app->m_mainWnd) {
|
if (app->m_mainWnd) {
|
||||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ wxString wxPersistentZRColaCharacterCatalogPanel::GetKind() const
|
|||||||
|
|
||||||
void wxPersistentZRColaCharacterCatalogPanel::Save() const
|
void wxPersistentZRColaCharacterCatalogPanel::Save() const
|
||||||
{
|
{
|
||||||
const wxZRColaCharacterCatalogPanel * const wnd = static_cast<const wxZRColaCharacterCatalogPanel*>(GetWindow());
|
auto wnd = static_cast<const wxZRColaCharacterCatalogPanel*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
|
||||||
SaveValue(wxT("charGroup"), wnd->m_cg_id);
|
SaveValue(wxT("charGroup"), wnd->m_cg_id);
|
||||||
SaveValue(wxT("showAll" ), wnd->m_show_all->GetValue());
|
SaveValue(wxT("showAll" ), wnd->m_show_all->GetValue());
|
||||||
@ -202,8 +202,7 @@ void wxPersistentZRColaCharacterCatalogPanel::Save() const
|
|||||||
|
|
||||||
bool wxPersistentZRColaCharacterCatalogPanel::Restore()
|
bool wxPersistentZRColaCharacterCatalogPanel::Restore()
|
||||||
{
|
{
|
||||||
wxZRColaCharacterCatalogPanel * const wnd = static_cast<wxZRColaCharacterCatalogPanel*>(GetWindow());
|
auto wnd = dynamic_cast<wxZRColaCharacterCatalogPanel*>(GetWindow());
|
||||||
|
|
||||||
bool update = false;
|
bool update = false;
|
||||||
|
|
||||||
// Restore selected character group.
|
// Restore selected character group.
|
||||||
|
@ -97,7 +97,7 @@ wxString wxZRColaCharGrid::GetToolTipText(int idx)
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG(idx < (int)m_chars.Length(), wxT("index out of bounds"));
|
wxASSERT_MSG(idx < (int)m_chars.Length(), wxT("index out of bounds"));
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
|
|
||||||
// See if this character has a key sequence registered.
|
// See if this character has a key sequence registered.
|
||||||
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
|
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
|
||||||
|
@ -80,7 +80,7 @@ void wxPersistentZRColaCharRequest::Save() const
|
|||||||
{
|
{
|
||||||
wxPersistentDialog::Save();
|
wxPersistentDialog::Save();
|
||||||
|
|
||||||
const wxZRColaCharRequest * const wnd = static_cast<const wxZRColaCharRequest*>(GetWindow());
|
auto wnd = static_cast<const wxZRColaCharRequest*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
|
||||||
SaveValue(wxT("character"), wnd->m_character->GetValue());
|
SaveValue(wxT("character"), wnd->m_character->GetValue());
|
||||||
SaveValue(wxT("context"), wnd->m_context->GetValue());
|
SaveValue(wxT("context"), wnd->m_context->GetValue());
|
||||||
@ -89,7 +89,7 @@ void wxPersistentZRColaCharRequest::Save() const
|
|||||||
|
|
||||||
bool wxPersistentZRColaCharRequest::Restore()
|
bool wxPersistentZRColaCharRequest::Restore()
|
||||||
{
|
{
|
||||||
wxZRColaCharRequest * const wnd = static_cast<wxZRColaCharRequest*>(GetWindow());
|
auto wnd = dynamic_cast<wxZRColaCharRequest*>(GetWindow());
|
||||||
|
|
||||||
wxString str;
|
wxString str;
|
||||||
if (RestoreValue(wxT("character"), &str))
|
if (RestoreValue(wxT("character"), &str))
|
||||||
|
@ -41,7 +41,7 @@ wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
|
|||||||
m_unicode->SetValidator(wxHexValidator<wchar_t>(&m_char, wxNUM_VAL_DEFAULT, 4));
|
m_unicode->SetValidator(wxHexValidator<wchar_t>(&m_char, wxNUM_VAL_DEFAULT, 4));
|
||||||
|
|
||||||
// Fill categories.
|
// Fill categories.
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||||
const auto &cc = app->m_cc_db.idxRnk[i];
|
const auto &cc = app->m_cc_db.idxRnk[i];
|
||||||
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name, cc.name_len), wxT("ZRCola-zrcdb")), i);
|
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name, cc.name_len), wxT("ZRCola-zrcdb")), i);
|
||||||
@ -74,7 +74,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
|||||||
|
|
||||||
if (m_unicodeChanged) {
|
if (m_unicodeChanged) {
|
||||||
if (m_unicode->GetValidator()->TransferFromWindow()) {
|
if (m_unicode->GetValidator()->TransferFromWindow()) {
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
|
|
||||||
m_gridPreview->SetCellValue(wxString(1, m_char), 0, 0);
|
m_gridPreview->SetCellValue(wxString(1, m_char), 0, 0);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
|||||||
|
|
||||||
wxString val(m_search->GetValue());
|
wxString val(m_search->GetValue());
|
||||||
if (!val.IsEmpty()) {
|
if (!val.IsEmpty()) {
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
|
|
||||||
m_searchThread = new SearchThread(this);
|
m_searchThread = new SearchThread(this);
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ void wxZRColaCharSelect::OnCategoriesAll(wxHyperlinkEvent& event)
|
|||||||
{
|
{
|
||||||
event.StopPropagation();
|
event.StopPropagation();
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||||
m_categories->Check(i, true);
|
m_categories->Check(i, true);
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ void wxZRColaCharSelect::OnCategoriesNone(wxHyperlinkEvent& event)
|
|||||||
{
|
{
|
||||||
event.StopPropagation();
|
event.StopPropagation();
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||||
m_categories->Check(i, false);
|
m_categories->Check(i, false);
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ void wxZRColaCharSelect::OnCategoriesInvert(wxHyperlinkEvent& event)
|
|||||||
{
|
{
|
||||||
event.StopPropagation();
|
event.StopPropagation();
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||||
m_categories->Check(i, !m_categories->IsChecked(i));
|
m_categories->Check(i, !m_categories->IsChecked(i));
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ void wxZRColaCharSelect::OnOKButtonClick(wxCommandEvent& event)
|
|||||||
void wxZRColaCharSelect::ResetResults()
|
void wxZRColaCharSelect::ResetResults()
|
||||||
{
|
{
|
||||||
// Fill the results.
|
// Fill the results.
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
size_t i, n = app->m_chr_db.idxChr.size();
|
size_t i, n = app->m_chr_db.idxChr.size();
|
||||||
wxString val;
|
wxString val;
|
||||||
val.reserve(n);
|
val.reserve(n);
|
||||||
@ -500,7 +500,7 @@ wxZRColaCharSelect::SearchThread::SearchThread(wxZRColaCharSelect *parent) :
|
|||||||
|
|
||||||
wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
|
wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
|
||||||
{
|
{
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
std::map<wchar_t, ZRCola::charrank_t> hits;
|
std::map<wchar_t, ZRCola::charrank_t> hits;
|
||||||
|
|
||||||
if (TestDestroy()) return (wxThread::ExitCode)1;
|
if (TestDestroy()) return (wxThread::ExitCode)1;
|
||||||
@ -580,11 +580,11 @@ void wxPersistentZRColaCharSelect::Save() const
|
|||||||
{
|
{
|
||||||
wxPersistentDialog::Save();
|
wxPersistentDialog::Save();
|
||||||
|
|
||||||
const wxZRColaCharSelect * const wnd = static_cast<const wxZRColaCharSelect*>(GetWindow());
|
auto wnd = static_cast<const wxZRColaCharSelect*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
|
|
||||||
SaveValue(wxT("recentChars"), wnd->m_gridRecent->GetCharacters());
|
SaveValue(wxT("recentChars"), wnd->m_gridRecent->GetCharacters());
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||||
const auto &cc = app->m_cc_db.idxRnk[i];
|
const auto &cc = app->m_cc_db.idxRnk[i];
|
||||||
wxString name(wxT("category"));
|
wxString name(wxT("category"));
|
||||||
@ -598,13 +598,13 @@ void wxPersistentZRColaCharSelect::Save() const
|
|||||||
|
|
||||||
bool wxPersistentZRColaCharSelect::Restore()
|
bool wxPersistentZRColaCharSelect::Restore()
|
||||||
{
|
{
|
||||||
wxZRColaCharSelect * const wnd = static_cast<wxZRColaCharSelect*>(GetWindow());
|
auto wnd = dynamic_cast<wxZRColaCharSelect*>(GetWindow());
|
||||||
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
|
|
||||||
wxString recent;
|
wxString recent;
|
||||||
if (RestoreValue(wxT("recentChars"), &recent))
|
if (RestoreValue(wxT("recentChars"), &recent))
|
||||||
wnd->m_gridRecent->SetCharacters(recent);
|
wnd->m_gridRecent->SetCharacters(recent);
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
|
||||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||||
const auto &cc = app->m_cc_db.idxRnk[i];
|
const auto &cc = app->m_cc_db.idxRnk[i];
|
||||||
wxString name(wxT("category"));
|
wxString name(wxT("category"));
|
||||||
|
@ -86,14 +86,15 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
|||||||
if (m_decomposedChanged) {
|
if (m_decomposedChanged) {
|
||||||
m_timerSave.Stop();
|
m_timerSave.Stop();
|
||||||
|
|
||||||
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
wxString src;
|
wxString src;
|
||||||
size_t len = GetValue(m_decomposed, src);
|
size_t len = GetValue(m_decomposed, src);
|
||||||
|
|
||||||
std::wstring norm;
|
std::wstring norm;
|
||||||
((ZRColaApp*)wxTheApp)->m_t_db.Decompose(src.data(), len, norm, &m_mapping1);
|
app->m_t_db.Decompose(src.data(), len, norm, &m_mapping1);
|
||||||
|
|
||||||
std::wstring dst;
|
std::wstring dst;
|
||||||
((ZRColaApp*)wxTheApp)->m_t_db.Compose(norm.data(), norm.size(), dst, &m_mapping2);
|
app->m_t_db.Compose(norm.data(), norm.size(), dst, &m_mapping2);
|
||||||
|
|
||||||
m_decomposed->GetSelection(&m_selDecomposed.first, &m_selDecomposed.second);
|
m_decomposed->GetSelection(&m_selDecomposed.first, &m_selDecomposed.second);
|
||||||
|
|
||||||
@ -115,7 +116,7 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
|||||||
wxString src;
|
wxString src;
|
||||||
size_t len = GetValue(m_composed, src);
|
size_t len = GetValue(m_composed, src);
|
||||||
|
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
std::wstring dst;
|
std::wstring dst;
|
||||||
wxZRColaFrame *mainWnd = dynamic_cast<wxZRColaFrame*>(wxGetActiveWindow());
|
wxZRColaFrame *mainWnd = dynamic_cast<wxZRColaFrame*>(wxGetActiveWindow());
|
||||||
if (mainWnd)
|
if (mainWnd)
|
||||||
@ -382,7 +383,7 @@ wxString wxPersistentZRColaComposerPanel::GetKind() const
|
|||||||
|
|
||||||
void wxPersistentZRColaComposerPanel::Save() const
|
void wxPersistentZRColaComposerPanel::Save() const
|
||||||
{
|
{
|
||||||
const wxZRColaComposerPanel * const wnd = static_cast<const wxZRColaComposerPanel*>(GetWindow());
|
auto const wnd = static_cast<const wxZRColaComposerPanel*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
|
||||||
SaveValue(wxT("splitDecomposed"), wnd->m_splitterDecomposed->GetSashPosition());
|
SaveValue(wxT("splitDecomposed"), wnd->m_splitterDecomposed->GetSashPosition());
|
||||||
SaveValue(wxT("splitComposed" ), wnd->m_splitterComposed ->GetSashPosition());
|
SaveValue(wxT("splitComposed" ), wnd->m_splitterComposed ->GetSashPosition());
|
||||||
@ -391,7 +392,7 @@ void wxPersistentZRColaComposerPanel::Save() const
|
|||||||
|
|
||||||
bool wxPersistentZRColaComposerPanel::Restore()
|
bool wxPersistentZRColaComposerPanel::Restore()
|
||||||
{
|
{
|
||||||
wxZRColaComposerPanel * const wnd = static_cast<wxZRColaComposerPanel*>(GetWindow());
|
auto wnd = dynamic_cast<wxZRColaComposerPanel*>(GetWindow());
|
||||||
|
|
||||||
int sashVal;
|
int sashVal;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ void wxZRColaFrame::OnHelpShortcuts(wxCommandEvent& event)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Search and try to launch local PDF copy.
|
// Search and try to launch local PDF copy.
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
pdf_path = app->GetDatabasePath();
|
pdf_path = app->GetDatabasePath();
|
||||||
pdf_path += _T("ZRCola_keyboard.pdf");
|
pdf_path += _T("ZRCola_keyboard.pdf");
|
||||||
if (wxFileExists(pdf_path) &&
|
if (wxFileExists(pdf_path) &&
|
||||||
@ -549,23 +549,21 @@ wxPersistentZRColaFrame::wxPersistentZRColaFrame(wxZRColaFrame *wnd) : wxPersist
|
|||||||
|
|
||||||
void wxPersistentZRColaFrame::Save() const
|
void wxPersistentZRColaFrame::Save() const
|
||||||
{
|
{
|
||||||
const wxZRColaFrame * const wnd = static_cast<const wxZRColaFrame*>(GetWindow());
|
wxPersistentTLW::Save();
|
||||||
|
|
||||||
|
auto wnd = static_cast<const wxZRColaFrame*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
|
||||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
||||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Save();
|
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Save();
|
||||||
|
|
||||||
wxPersistentTLW::Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxPersistentZRColaFrame::Restore()
|
bool wxPersistentZRColaFrame::Restore()
|
||||||
{
|
{
|
||||||
const bool r = wxPersistentTLW::Restore();
|
auto wnd = dynamic_cast<wxZRColaFrame*>(GetWindow());
|
||||||
|
|
||||||
wxZRColaFrame * const wnd = static_cast<wxZRColaFrame*>(GetWindow());
|
|
||||||
|
|
||||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Restore();
|
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Restore();
|
||||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
||||||
|
|
||||||
return r;
|
return wxPersistentTLW::Restore();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
|||||||
if (e.GetKeyCode() == WXK_INSERT) {
|
if (e.GetKeyCode() == WXK_INSERT) {
|
||||||
// Insert key has been pressed.
|
// Insert key has been pressed.
|
||||||
m_is_insert = true;
|
m_is_insert = true;
|
||||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||||
if (pFrame && pFrame->GetStatusBar())
|
if (pFrame && pFrame->GetStatusBar())
|
||||||
pFrame->SetStatusText(_("INS key is pressed. Type the Unicode code of desired character now (up to four hexadecimal digits: 0-9, A-F), then release INS."));
|
pFrame->SetStatusText(_("INS key is pressed. Type the Unicode code of desired character now (up to four hexadecimal digits: 0-9, A-F), then release INS."));
|
||||||
} else if (m_is_insert) {
|
} else if (m_is_insert) {
|
||||||
@ -49,7 +49,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
|||||||
if (WXK_NUMPAD0 <= key && key <= WXK_NUMPAD9)
|
if (WXK_NUMPAD0 <= key && key <= WXK_NUMPAD9)
|
||||||
chr = '0' + (key - WXK_NUMPAD0);
|
chr = '0' + (key - WXK_NUMPAD0);
|
||||||
}
|
}
|
||||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||||
if (('0' <= chr && chr <= '9' || 'A' <= chr && chr <= 'F') && m_insert_seq.size() < 4) {
|
if (('0' <= chr && chr <= '9' || 'A' <= chr && chr <= 'F') && m_insert_seq.size() < 4) {
|
||||||
// A hex-digit pressed. Save it.
|
// A hex-digit pressed. Save it.
|
||||||
m_insert_seq.push_back((char)chr);
|
m_insert_seq.push_back((char)chr);
|
||||||
@ -73,7 +73,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
ZRCola::keyseq_db::indexKey::size_type start;
|
ZRCola::keyseq_db::indexKey::size_type start;
|
||||||
bool found;
|
bool found;
|
||||||
wxFrame *pFrame = wxDynamicCast(app->m_mainWnd, wxFrame);
|
wxFrame *pFrame = wxDynamicCast(app->m_mainWnd, wxFrame);
|
||||||
@ -143,7 +143,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
|||||||
wxKeyEvent &e = (wxKeyEvent&)event;
|
wxKeyEvent &e = (wxKeyEvent&)event;
|
||||||
if (m_is_insert && e.GetKeyCode() == WXK_INSERT) {
|
if (m_is_insert && e.GetKeyCode() == WXK_INSERT) {
|
||||||
// Insert key has been depressed.
|
// Insert key has been depressed.
|
||||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||||
if (pFrame && pFrame->GetStatusBar())
|
if (pFrame && pFrame->GetStatusBar())
|
||||||
pFrame->SetStatusText(wxEmptyString);
|
pFrame->SetStatusText(wxEmptyString);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
|
|||||||
m_lang(ZRCola::langid_t::blank),
|
m_lang(ZRCola::langid_t::blank),
|
||||||
wxZRColaSettingsBase(parent)
|
wxZRColaSettingsBase(parent)
|
||||||
{
|
{
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
m_languages->Clear();
|
m_languages->Clear();
|
||||||
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
|
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
|
||||||
const auto &lang = app->m_lang_db.idxLng[i];
|
const auto &lang = app->m_lang_db.idxLng[i];
|
||||||
@ -57,7 +57,7 @@ void wxZRColaSettings::OnInitDialog(wxInitDialogEvent& event)
|
|||||||
m_languages->Enable(!m_lang_auto);
|
m_languages->Enable(!m_lang_auto);
|
||||||
(m_lang_auto ? m_langAuto : m_langManual)->SetValue(true);
|
(m_lang_auto ? m_langAuto : m_langManual)->SetValue(true);
|
||||||
|
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
char l[sizeof(ZRCola::language_db::language)] = {};
|
char l[sizeof(ZRCola::language_db::language)] = {};
|
||||||
((ZRCola::language_db::language*)l)->id = m_lang;
|
((ZRCola::language_db::language*)l)->id = m_lang;
|
||||||
ZRCola::language_db::indexLang::size_type start;
|
ZRCola::language_db::indexLang::size_type start;
|
||||||
@ -121,7 +121,7 @@ void wxZRColaSettings::OnApplyButtonClick(wxCommandEvent& event)
|
|||||||
} else {
|
} else {
|
||||||
m_lang_auto = false;
|
m_lang_auto = false;
|
||||||
|
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
const auto &lang = app->m_lang_db.idxLng[m_languages->GetSelection()];
|
const auto &lang = app->m_lang_db.idxLng[m_languages->GetSelection()];
|
||||||
|
|
||||||
if (m_lang != lang.id) {
|
if (m_lang != lang.id) {
|
||||||
@ -155,7 +155,7 @@ void wxPersistentZRColaSettings::Save() const
|
|||||||
{
|
{
|
||||||
wxPersistentDialog::Save();
|
wxPersistentDialog::Save();
|
||||||
|
|
||||||
const wxZRColaSettings * const wnd = static_cast<const wxZRColaSettings*>(GetWindow());
|
auto wnd = static_cast<const wxZRColaSettings*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||||
|
|
||||||
SaveValue(wxT("langAuto"), wnd->m_lang_auto);
|
SaveValue(wxT("langAuto"), wnd->m_lang_auto);
|
||||||
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang.data, _countof(wnd->m_lang.data)));
|
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang.data, _countof(wnd->m_lang.data)));
|
||||||
@ -164,9 +164,8 @@ void wxPersistentZRColaSettings::Save() const
|
|||||||
|
|
||||||
bool wxPersistentZRColaSettings::Restore()
|
bool wxPersistentZRColaSettings::Restore()
|
||||||
{
|
{
|
||||||
wxZRColaSettings * const wnd = static_cast<wxZRColaSettings*>(GetWindow());
|
auto wnd = dynamic_cast<wxZRColaSettings*>(GetWindow());
|
||||||
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
|
||||||
wxString lang;
|
wxString lang;
|
||||||
|
|
||||||
// Restore automatic language detection setting first.
|
// Restore automatic language detection setting first.
|
||||||
|
@ -40,7 +40,7 @@ wxZRColaUpdater::wxZRColaUpdater(wxWindow* parent) :
|
|||||||
//Connect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this);
|
//Connect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this);
|
||||||
|
|
||||||
// Prepare Updater.
|
// Prepare Updater.
|
||||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||||
m_updater = new wxUpdCheckThread(app->m_locale.GetCanonicalName(), this);
|
m_updater = new wxUpdCheckThread(app->m_locale.GetCanonicalName(), this);
|
||||||
//if (m_updater->Run() != wxTHREAD_NO_ERROR) {
|
//if (m_updater->Run() != wxTHREAD_NO_ERROR) {
|
||||||
// wxFAIL_MSG(wxT("Can't create the thread!"));
|
// wxFAIL_MSG(wxT("Can't create the thread!"));
|
||||||
@ -95,7 +95,7 @@ void wxZRColaUpdater::OnUpdate(wxCommandEvent& event)
|
|||||||
m_updater->LaunchUpdate();
|
m_updater->LaunchUpdate();
|
||||||
|
|
||||||
Close(true);
|
Close(true);
|
||||||
((ZRColaApp*)wxTheApp)->m_mainWnd->Close();
|
dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1c7092347c1306d55cfc2b800c669dcfeb5c449b
|
Subproject commit cc090e89eb56e99382966e8f26c609e96d33bb9a
|
@ -1 +1 @@
|
|||||||
Subproject commit f989cacd170a496919927d7fab26357dc3af2168
|
Subproject commit 3e96043e8843a4aa16ebbcd3577061ef438bafac
|
Loading…
x
Reference in New Issue
Block a user