Skip to content

Commit

Permalink
Add log window
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed Oct 9, 2024
1 parent 1bbe107 commit 88a5cd4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/gui/i18napp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ void I18NFrame::InitControls()
new wxDataViewColumn(_(L"Summary"), tr, 4, FromDIP(200), wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE));

m_editor = new wxStyledTextCtrl(splitter);
wxNotebook* tabstrip =
new wxNotebook(splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM);

m_editor = new wxStyledTextCtrl(tabstrip);
m_editor->StyleClearAll();
const wxFont font{ wxFontInfo().Family(wxFONTFAMILY_MODERN) };
for (auto i = 0; i < wxSTC_STYLE_LASTPREDEFINED; ++i)
Expand Down Expand Up @@ -287,7 +290,18 @@ void I18NFrame::InitControls()

m_editor->CallTipUseStyle(40);

splitter->SplitHorizontally(m_resultsDataView, m_editor, FromDIP(-300));
m_logWindow = new wxTextCtrl(tabstrip, wxID_ANY, wxString{}, wxDefaultPosition, wxDefaultSize,
wxTE_RICH2 | wxTE_READONLY | wxTE_MULTILINE | wxBORDER_THEME);
if (wxSystemSettings::GetAppearance().IsDark())
{
m_logWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_BACKGROUND));
m_logWindow->SetForegroundColour(wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_BTNTEXT));
}

tabstrip->InsertPage(0, m_editor, _("Edit"));
tabstrip->InsertPage(1, m_logWindow, _("Log"), false);

splitter->SplitHorizontally(m_resultsDataView, tabstrip, FromDIP(-300));
mainSizer->Add(splitter, wxSizerFlags{ 1 }.Expand());

SetSizer(mainSizer);
Expand Down Expand Up @@ -920,6 +934,9 @@ void I18NFrame::Process()
m_projectBar->EnableButton(XRCID("ID_IGNORE_SELECTED"), true);
m_editBar->EnableButton(XRCID("ID_EXPAND_ALL"), true);
m_editBar->EnableButton(XRCID("ID_COLLAPSE_ALL"), true);

m_logWindow->AppendText(i18n_check::format_summary(cpp, rc, po).str());
m_logWindow->AppendText(L"\n");
}

//------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/gui/i18napp.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <wx/filename.h>
#include <wx/fontenum.h>
#include <wx/itemattr.h>
#include <wx/notebook.h>
#include <wx/numformatter.h>
#include <wx/progdlg.h>
#include <wx/ribbon/bar.h>
Expand All @@ -34,6 +35,7 @@
#include <wx/splitter.h>
#include <wx/stc/stc.h>
#include <wx/stdpaths.h>
#include <wx/textctrl.h>
#include <wx/tokenzr.h>
#include <wx/wx.h>
#include <wx/xml/xml.h>
Expand Down Expand Up @@ -117,6 +119,7 @@ class I18NFrame : public wxFrame
wxRibbonButtonBar* m_projectBar{ nullptr };
wxRibbonButtonBar* m_editBar{ nullptr };
wxStyledTextCtrl* m_editor{ nullptr };
wxTextCtrl* m_logWindow{ nullptr };
wxString m_activeSourceFile;
bool m_promptForFileSave{ true };

Expand Down

0 comments on commit 88a5cd4

Please sign in to comment.