From a4fe4b6a26856d349dc264b1276343e06267a48a Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 13 May 2016 13:24:18 +0200 Subject: [PATCH] Current character category display added to character selector --- ZRCola/ZRCola.fbp | 91 ++++++++++++++++++++++++++++++++++++++++ ZRCola/zrcolachrslct.cpp | 11 +++++ ZRCola/zrcolagui.cpp | 3 ++ ZRCola/zrcolagui.h | 1 + 4 files changed, 106 insertions(+) diff --git a/ZRCola/ZRCola.fbp b/ZRCola/ZRCola.fbp index f4f46ef..54db9f1 100644 --- a/ZRCola/ZRCola.fbp +++ b/ZRCola/ZRCola.fbp @@ -3306,6 +3306,97 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_category + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_CENTRE|wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ZRCola/zrcolachrslct.cpp b/ZRCola/zrcolachrslct.cpp index 0aa3741..2cb3436 100644 --- a/ZRCola/zrcolachrslct.cpp +++ b/ZRCola/zrcolachrslct.cpp @@ -77,9 +77,20 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event) if (app->m_chr_db.idxChr.find(*chr, start)) { const ZRCola::character_db::character &chr = app->m_chr_db.idxChr[start]; m_description->SetValue(wxString(chr.data, chr.desc_len)); + { + char cc[sizeof(ZRCola::chrcat_db::chrcat)] = {}; + ((ZRCola::chrcat_db::chrcat*)cc)->id = chr.cat; + size_t start; + if (app->m_cc_db.idxChrCat.find(*((ZRCola::chrcat_db::chrcat*)cc), start)) { + const ZRCola::chrcat_db::chrcat &cat = app->m_cc_db.idxChrCat[start]; + m_category->SetValue(wxGetTranslation(wxString(cat.name, cat.name_len), wxT("ZRCola-zrcdb"))); + } else + m_category->SetValue(wxEmptyString); + } m_gridRelated->SetCharacters(wxString(chr.data + chr.desc_len, chr.rel_len)); } else { m_description->SetValue(wxEmptyString); + m_category->SetValue(wxEmptyString); m_gridRelated->ClearGrid(); } m_gridRelated->Scroll(0, 0); diff --git a/ZRCola/zrcolagui.cpp b/ZRCola/zrcolagui.cpp index 69f1488..9ee16b6 100644 --- a/ZRCola/zrcolagui.cpp +++ b/ZRCola/zrcolagui.cpp @@ -552,6 +552,9 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id, m_description = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_READONLY ); sbSizerPreview->Add( m_description, 1, wxALL|wxEXPAND, 5 ); + m_category = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_READONLY ); + sbSizerPreview->Add( m_category, 0, wxALL|wxEXPAND, 5 ); + bSizerRight->Add( sbSizerPreview, 70, wxALL|wxEXPAND, 5 ); diff --git a/ZRCola/zrcolagui.h b/ZRCola/zrcolagui.h index 9729d94..d08a6fb 100644 --- a/ZRCola/zrcolagui.h +++ b/ZRCola/zrcolagui.h @@ -194,6 +194,7 @@ class wxZRColaCharSelectBase : public wxDialog wxTextCtrl* m_unicode; wxGrid* m_gridPreview; wxTextCtrl* m_description; + wxTextCtrl* m_category; wxZRColaCharGrid* m_gridRelated; wxStdDialogButtonSizer* m_sdbSizerButtons; wxButton* m_sdbSizerButtonsOK;