33#include <wx/textctrl.h>
34#include <wx/statusbr.h>
35#include <wx/tokenzr.h>
36#include <wx/weakref.h>
62 if( statusBar && !statusBar->IsBeingDeleted() )
85 wxT(
"No wxTextCtrl object defined in WX_TEXT_CTRL_REPORTER." ) );
103 std::lock_guard lock(
m_mutex );
112 std::lock_guard lock(
m_mutex );
121 std::lock_guard lock(
m_mutex );
130 std::lock_guard lock(
m_mutex );
138 std::lock_guard lock(
m_mutex );
146 std::lock_guard lock(
m_mutex );
148 return m_reporter.HasMessageOfSeverity( aSeverityMask );
154 std::lock_guard lock(
m_mutex );
181 static REPORTER* s_nullReporter =
nullptr;
183 if( !s_nullReporter )
186 return *s_nullReporter;
198 FILE* target = stdout;
203 if( aMsg.EndsWith( wxS(
"\n" ) ) )
204 wxFprintf( target, aMsg );
206 wxFprintf( target, aMsg + wxS(
"\n" ) );
220 return s_cliReporter;
240 std::cout << aMsg << std::endl;
248 static REPORTER* s_stdoutReporter =
nullptr;
250 if( !s_stdoutReporter )
253 return *s_stdoutReporter;
281 static REPORTER* s_wxLogReporter =
nullptr;
284 if( !s_wxLogReporter )
287 return *s_wxLogReporter;
300 target->
Report( aMsg, aSeverity );
311 return s_loadInfoReporter;
374 kiStatusBar->SetEllipsedTextField( aText,
m_position );
383 const wxString& aSource ) :
398 if( !statusBar || aText.IsEmpty() )
401 std::vector<LOAD_MESSAGE> messages;
402 wxStringTokenizer tokenizer( aText, wxS(
"\n" ), wxTOKEN_STRTOK );
405 while( tokenizer.HasMoreTokens() )
408 message.
message = tokenizer.GetNextToken();
410 messages.emplace_back( std::move( message ) );
413 if( messages.empty() )
418 messages.emplace_back( std::move( message ) );
REPORTER & Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static CLI_REPORTER & GetInstance()
~FONTCONFIG_REPORTER_SCOPE()
FONTCONFIG_REPORTER_SCOPE(REPORTER *aReporter)
REPORTER * m_previousReporter
void AddWarningMessages(const wxString &aSource, const wxString &aMessages)
Add warning/error messages (not thread-safe, use the std::vector<LOAD_MESSAGE> variant from other thr...
LOAD_INFO_REPORTER_SCOPE(REPORTER *aReporter)
~LOAD_INFO_REPORTER_SCOPE()
LOAD_INFO_REPORTER & m_reporter
REPORTER * m_previousReporter
REPORTER * GetRedirectTarget() const
REPORTER * m_redirectTarget
static LOAD_INFO_REPORTER & GetInstance()
void SetRedirectTarget(REPORTER *aReporter)
REPORTER & Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static REPORTER & GetInstance()
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
REPORTER * m_redirectTarget
REPORTER & Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
wxStatusBar * m_statusBar
wxWeakRef< KISTATUSBAR > m_statusBar
KISTATUSBAR * GetStatusBar() const
STATUSBAR_WARNING_REPORTER_IMPL(KISTATUSBAR *aStatusBar, const wxString &aSource)
STATUSBAR_WARNING_REPORTER(KISTATUSBAR *aStatusBar, const wxString &aSource)
~STATUSBAR_WARNING_REPORTER() override
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
std::shared_ptr< STATUSBAR_WARNING_REPORTER_IMPL > m_impl
REPORTER & Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static REPORTER & GetInstance()
bool HasMessage() const override
Returns true if any messages were reported.
REPORTER & ReportHead(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Places the report at the beginning of the list for objects that support ordering.
EDA_UNITS GetUnits() const override
bool HasMessageOfSeverity(int aSeverityMask) const override
Returns true if the reporter has one or more messages matching the specified severity mask.
REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Places the report at the end of the list, for objects that support report ordering.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
REPORTER & Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static REPORTER & GetInstance()
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
const wxString & GetMessages() const
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static void SetReporter(REPORTER *aReporter)
Set the reporter to use for reporting font substitution warnings.
static const wxChar traceReporter[]
Flag to enable reporter debugging output.
This file contains miscellaneous commonly used macros and functions.
static std::mutex g_logReporterMutex
wxString From_UTF8(const char *cstring)
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.