7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 22:05:32 +00:00

Revert "Move some things starting from reporter to kicommon"

This reverts commit 3d893254e9
This commit is contained in:
Mark Roszko 2024-08-28 01:21:40 +00:00
parent 3d893254e9
commit c19aa8170b
19 changed files with 248 additions and 240 deletions

View File

@ -106,15 +106,10 @@ set( KICOMMON_SRCS
dialogs/dialog_migrate_settings_base.cpp
widgets/bitmap_button.cpp
widgets/html_window.cpp
widgets/kistatusbar.cpp
widgets/number_badge.cpp
widgets/progress_reporter_base.cpp
widgets/std_bitmap_button.cpp
widgets/ui_common.cpp
widgets/wx_html_report_panel.cpp
widgets/wx_html_report_panel_base.cpp
widgets/wx_infobar.cpp
database/database_lib_settings.cpp
@ -131,8 +126,6 @@ set( KICOMMON_SRCS
config_params.cpp
confirm.cpp
dialog_shim.cpp
dpi_scaling.cpp
dpi_scaling_common.cpp
dsnlexer.cpp
eda_pattern_match.cpp
eda_units.cpp
@ -158,7 +151,6 @@ set( KICOMMON_SRCS
page_info.cpp
paths.cpp
project.cpp
reporter.cpp
richio.cpp
search_stack.cpp
searchhelpfilefullpath.cpp
@ -396,12 +388,15 @@ set( COMMON_WIDGET_SRCS
widgets/grid_icon_text_helpers.cpp
widgets/grid_text_button_helpers.cpp
widgets/grid_text_helpers.cpp
widgets/html_window.cpp
widgets/indicator_icon.cpp
widgets/wx_infobar.cpp
widgets/layer_box_selector.cpp
widgets/layer_presentation.cpp
widgets/lib_tree.cpp
widgets/mathplot.cpp
widgets/msgpanel.cpp
widgets/number_badge.cpp
widgets/paged_dialog.cpp
widgets/properties_panel.cpp
widgets/search_pane.cpp
@ -423,6 +418,8 @@ set( COMMON_WIDGET_SRCS
widgets/wx_grid.cpp
widgets/wx_grid_autosizer.cpp
widgets/wx_html_report_box.cpp
widgets/wx_html_report_panel.cpp
widgets/wx_html_report_panel_base.cpp
widgets/wx_listbox.cpp
widgets/wx_panel.cpp
widgets/wx_progress_reporters.cpp
@ -533,6 +530,7 @@ set( COMMON_SRCS
board_printout.cpp
cli_progress_reporter.cpp
commit.cpp
dpi_scaling_common.cpp
draw_panel_gal.cpp
gal_display_options_common.cpp
gr_text.cpp
@ -569,6 +567,7 @@ set( COMMON_SRCS
rc_item.cpp
refdes_utils.cpp
render_settings.cpp
reporter.cpp
scintilla_tricks.cpp
status_popup.cpp
stroke_params.cpp

View File

@ -14,6 +14,7 @@ set( GAL_SRCS
../callback_gal.cpp
painter.cpp
cursors.cpp
dpi_scaling.cpp
gal_display_options.cpp
graphics_abstraction_layer.cpp
hidpi_gl_canvas.cpp

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dpi_scaling.h>
#include <gal/dpi_scaling.h>
double DPI_SCALING::GetMaxScaleFactor()

View File

@ -28,7 +28,7 @@
#include <wx/log.h>
#include <config_map.h>
#include <dpi_scaling.h>
#include <gal/dpi_scaling.h>
using namespace KIGFX;

View File

@ -26,7 +26,7 @@
#include <gal/hidpi_gl_canvas.h>
#include <dpi_scaling.h>
#include <gal/dpi_scaling.h>
HIDPI_GL_CANVAS::HIDPI_GL_CANVAS( const KIGFX::VC_SETTINGS& aSettings, wxWindow* aParent,

View File

@ -29,6 +29,7 @@
#include <reporter.h>
#include <string_utils.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_html_report_panel.h>
#include <wx/crt.h>
#include <wx/log.h>
#include <wx/textctrl.h>
@ -82,6 +83,42 @@ bool WX_STRING_REPORTER::HasMessage() const
}
REPORTER& WX_HTML_PANEL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity );
return *this;
}
REPORTER& WX_HTML_PANEL_REPORTER::ReportTail( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity, LOC_TAIL );
return *this;
}
REPORTER& WX_HTML_PANEL_REPORTER::ReportHead( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity, LOC_HEAD );
return *this;
}
bool WX_HTML_PANEL_REPORTER::HasMessage() const
{
return m_panel->Count( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) > 0;
}
REPORTER& NULL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
return *this;
@ -198,4 +235,59 @@ bool STATUSBAR_REPORTER::HasMessage() const
return !m_statusBar->GetStatusText( m_position ).IsEmpty();
return false;
}
}
INFOBAR_REPORTER::~INFOBAR_REPORTER()
{
}
REPORTER& INFOBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
m_message.reset( new wxString( aText ) );
m_severity = aSeverity;
m_messageSet = true;
return *this;
}
bool INFOBAR_REPORTER::HasMessage() const
{
return m_message && !m_message->IsEmpty();
}
void INFOBAR_REPORTER::Finalize()
{
// Don't do anything if no message was ever given
if( !m_infoBar || !m_messageSet )
return;
// Short circuit if the message is empty and it is already hidden
if( !HasMessage() && !m_infoBar->IsShownOnScreen() )
return;
int icon = wxICON_NONE;
switch( m_severity )
{
case RPT_SEVERITY_UNDEFINED: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_INFO: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_EXCLUSION: icon = wxICON_WARNING; break;
case RPT_SEVERITY_ACTION: icon = wxICON_WARNING; break;
case RPT_SEVERITY_WARNING: icon = wxICON_WARNING; break;
case RPT_SEVERITY_ERROR: icon = wxICON_ERROR; break;
case RPT_SEVERITY_IGNORE: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_DEBUG: icon = wxICON_INFORMATION; break;
}
if( m_message->EndsWith( wxS( "\n" ) ) )
*m_message = m_message->Left( m_message->Length() - 1 );
if( HasMessage() )
m_infoBar->QueueShowMessage( *m_message, icon );
else
m_infoBar->QueueDismiss();
}

View File

@ -460,39 +460,3 @@ void WX_HTML_REPORT_PANEL::SetShowSeverity( SEVERITY aSeverity, bool aValue )
default: m_checkBoxShowErrors->SetValue( aValue ); break;
}
}
REPORTER& WX_HTML_PANEL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity );
return *this;
}
REPORTER& WX_HTML_PANEL_REPORTER::ReportTail( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity, LOC_TAIL );
return *this;
}
REPORTER& WX_HTML_PANEL_REPORTER::ReportHead( const wxString& aText, SEVERITY aSeverity )
{
wxCHECK_MSG( m_panel != nullptr, *this,
wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
m_panel->Report( aText, aSeverity, LOC_HEAD );
return *this;
}
bool WX_HTML_PANEL_REPORTER::HasMessage() const
{
return m_panel->Count( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) > 0;
}

View File

@ -27,32 +27,6 @@
#include "wx_html_report_panel_base.h"
class WX_HTML_REPORT_PANEL;
/**
* A wrapper for reporting to a wx HTML window.
*/
class KICOMMON_API WX_HTML_PANEL_REPORTER : public REPORTER
{
public:
WX_HTML_PANEL_REPORTER( WX_HTML_REPORT_PANEL* aPanel ) : REPORTER(), m_panel( aPanel ) {}
virtual ~WX_HTML_PANEL_REPORTER() {}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
REPORTER& ReportTail( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
REPORTER& ReportHead( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
private:
WX_HTML_REPORT_PANEL* m_panel;
};
/**
* A widget for browsing a rich text error/status report. Used in numerous
* dialogs in eeschema and pcbnew. Provides error filtering functionality
@ -60,7 +34,7 @@ private:
*
* The messages are reported through a REPORTER object
*/
class KICOMMON_API WX_HTML_REPORT_PANEL : public WX_HTML_REPORT_PANEL_BASE
class WX_HTML_REPORT_PANEL : public WX_HTML_REPORT_PANEL_BASE
{
public:
WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -1,36 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="18"/>
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="cpp_class_decoration">KICOMMON_API; kicommon.h</property>
<property name="cpp_disconnect_events">1</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">0</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">wx_html_report_panel_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">WX_HTML_REPORT_PANEL_BASE</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces"></property>
<property name="python_skip_events">1</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@ -88,10 +86,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -157,10 +155,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -219,10 +217,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -295,10 +293,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -361,10 +359,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -434,10 +432,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -500,10 +498,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -573,10 +571,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -649,10 +647,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -725,10 +723,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -28,14 +28,13 @@
#include <wx/statbox.h>
#include <wx/panel.h>
#include "kicommon.h"
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class WX_HTML_REPORT_PANEL_BASE
///////////////////////////////////////////////////////////////////////////////
class KICOMMON_API WX_HTML_REPORT_PANEL_BASE : public wxPanel
class WX_HTML_REPORT_PANEL_BASE : public wxPanel
{
private:

View File

@ -404,53 +404,3 @@ void EDA_INFOBAR_PANEL::AddOtherItem( wxWindow* aOtherItem )
m_mainSizer->AddGrowableRow( 1, 1 );
m_mainSizer->Layout();
}
REPORTER& INFOBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
m_message.reset( new wxString( aText ) );
m_severity = aSeverity;
m_messageSet = true;
return *this;
}
bool INFOBAR_REPORTER::HasMessage() const
{
return m_message && !m_message->IsEmpty();
}
void INFOBAR_REPORTER::Finalize()
{
// Don't do anything if no message was ever given
if( !m_infoBar || !m_messageSet )
return;
// Short circuit if the message is empty and it is already hidden
if( !HasMessage() && !m_infoBar->IsShownOnScreen() )
return;
int icon = wxICON_NONE;
switch( m_severity )
{
case RPT_SEVERITY_UNDEFINED: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_INFO: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_EXCLUSION: icon = wxICON_WARNING; break;
case RPT_SEVERITY_ACTION: icon = wxICON_WARNING; break;
case RPT_SEVERITY_WARNING: icon = wxICON_WARNING; break;
case RPT_SEVERITY_ERROR: icon = wxICON_ERROR; break;
case RPT_SEVERITY_IGNORE: icon = wxICON_INFORMATION; break;
case RPT_SEVERITY_DEBUG: icon = wxICON_INFORMATION; break;
}
if( m_message->EndsWith( wxS( "\n" ) ) )
*m_message = m_message->Left( m_message->Length() - 1 );
if( HasMessage() )
m_infoBar->QueueShowMessage( *m_message, icon );
else
m_infoBar->QueueDismiss();
}

View File

@ -24,8 +24,7 @@
#ifndef DPI_SCALING_COMMON__H
#define DPI_SCALING_COMMON__H
#include <kicommon.h>
#include <dpi_scaling.h>
#include <gal/dpi_scaling.h>
class COMMON_SETTINGS;
class wxWindow;
@ -35,7 +34,7 @@ class wxWindow;
* scale to use for canvases. This has several sources and the availability of
* some of them are platform dependent.
*/
class KICOMMON_API DPI_SCALING_COMMON : public DPI_SCALING
class DPI_SCALING_COMMON : public DPI_SCALING
{
public:
/**

View File

@ -24,7 +24,7 @@
#ifndef DPI_SCALING__H
#define DPI_SCALING__H
#include <kicommon.h>
#include <gal/gal.h>
#include <wx/window.h>
/**
@ -32,7 +32,7 @@
* scale to use for canvases. This has several sources and the availability of
* some of them are platform dependent.
*/
class KICOMMON_API DPI_SCALING
class GAL_API DPI_SCALING
{
public:
/**

View File

@ -25,7 +25,7 @@
#define GAL_DISPLAY_OPTIONS_H__
#include <gal/gal.h>
#include <dpi_scaling.h>
#include <gal/dpi_scaling.h>
#include <core/observable.h>
class COMMON_SETTINGS;

View File

@ -29,7 +29,6 @@
#include <eda_units.h>
#include <widgets/report_severity.h>
#include <kicommon.h>
/**
* @file reporter.h
@ -68,7 +67,7 @@ class WX_INFOBAR;
* filtering is not made here.
*/
class KICOMMON_API REPORTER
class REPORTER
{
public:
/**
@ -135,7 +134,7 @@ public:
/**
* A wrapper for reporting to a wxTextCtrl object.
*/
class KICOMMON_API WX_TEXT_CTRL_REPORTER : public REPORTER
class WX_TEXT_CTRL_REPORTER : public REPORTER
{
public:
WX_TEXT_CTRL_REPORTER( wxTextCtrl* aTextCtrl ) :
@ -161,7 +160,7 @@ private:
/**
* A wrapper for reporting to a wxString object.
*/
class KICOMMON_API WX_STRING_REPORTER : public REPORTER
class WX_STRING_REPORTER : public REPORTER
{
public:
WX_STRING_REPORTER( wxString* aString ) :
@ -183,12 +182,44 @@ private:
};
/**
* A wrapper for reporting to a wx HTML window.
*/
class WX_HTML_PANEL_REPORTER : public REPORTER
{
public:
WX_HTML_PANEL_REPORTER( WX_HTML_REPORT_PANEL* aPanel ) :
REPORTER(),
m_panel( aPanel )
{
}
virtual ~WX_HTML_PANEL_REPORTER()
{
}
REPORTER& Report( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
REPORTER& ReportTail( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
REPORTER& ReportHead( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
private:
WX_HTML_REPORT_PANEL* m_panel;
};
/**
* A singleton reporter that reports to nowhere.
*
* Used as to simplify code by avoiding the reportee to check for a non-NULL reporter object.
*/
class KICOMMON_API NULL_REPORTER : public REPORTER
class NULL_REPORTER : public REPORTER
{
public:
NULL_REPORTER()
@ -211,7 +242,7 @@ public:
/**
* Reporter forwarding messages to stdout or stderr as appropriate
*/
class KICOMMON_API CLI_REPORTER : public REPORTER
class CLI_REPORTER : public REPORTER
{
public:
CLI_REPORTER()
@ -233,7 +264,7 @@ public:
/**
* Debug type reporter, forwarding messages to std::cout.
*/
class KICOMMON_API STDOUT_REPORTER : public REPORTER
class STDOUT_REPORTER : public REPORTER
{
public:
STDOUT_REPORTER()
@ -252,7 +283,7 @@ public:
};
class KICOMMON_API WXLOG_REPORTER : public REPORTER
class WXLOG_REPORTER : public REPORTER
{
public:
WXLOG_REPORTER()
@ -274,7 +305,7 @@ public:
/**
* A wrapper for reporting to a specific text location in a statusbar.
*/
class KICOMMON_API STATUSBAR_REPORTER : public REPORTER
class STATUSBAR_REPORTER : public REPORTER
{
public:
STATUSBAR_REPORTER( wxStatusBar* aStatusBar, int aPosition = 0 )
@ -293,4 +324,44 @@ private:
int m_position;
};
/**
* A wrapper for reporting to a #WX_INFOBAR UI element.
*
* The infobar is not updated until the @c Finalize() method is called. That method will
* queue either a show message or a dismiss event for the infobar - so this reporter is
* safe to use inside a paint event without causing an infinite paint event loop.
*
* No action is taken if no message is given to the reporter.
*/
class INFOBAR_REPORTER : public REPORTER
{
public:
INFOBAR_REPORTER( WX_INFOBAR* aInfoBar )
: REPORTER(),
m_messageSet( false ),
m_infoBar( aInfoBar ),
m_severity( RPT_SEVERITY_UNDEFINED )
{
}
virtual ~INFOBAR_REPORTER();
REPORTER& Report( const wxString& aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
/**
* Update the infobar with the reported text.
*/
void Finalize();
private:
bool m_messageSet;
WX_INFOBAR* m_infoBar;
std::unique_ptr<wxString> m_message;
SEVERITY m_severity;
};
#endif // _REPORTER_H_

View File

@ -25,13 +25,12 @@
#ifndef HTML_WINDOW_H
#define HTML_WINDOW_H
#include <kicommon.h>
#include <wx/html/htmlwin.h>
/**
* Add dark theme support to wxHtmlWindow.
*/
class KICOMMON_API HTML_WINDOW : public wxHtmlWindow
class HTML_WINDOW : public wxHtmlWindow
{
public:
HTML_WINDOW( wxWindow* aParent, wxWindowID aId = wxID_ANY,

View File

@ -27,7 +27,6 @@
#include <widgets/ui_common.h>
#include <wx/dcclient.h>
#include <wx/panel.h>
#include <kicommon.h>
/**
@ -36,7 +35,7 @@
* This badge will also automatically truncate the displayed number to the set maximum and display
* "+" at the end to represent it is truncated.
*/
class KICOMMON_API NUMBER_BADGE : public wxPanel
class NUMBER_BADGE : public wxPanel
{
public:
/**

View File

@ -28,7 +28,6 @@
#include <wx/timer.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <reporter.h>
class wxAuiManager;
@ -42,8 +41,8 @@ enum
};
wxDECLARE_EXPORTED_EVENT( KICOMMON_API, KIEVT_SHOW_INFOBAR, wxCommandEvent );
wxDECLARE_EXPORTED_EVENT( KICOMMON_API, KIEVT_DISMISS_INFOBAR, wxCommandEvent );
wxDECLARE_EVENT( KIEVT_SHOW_INFOBAR, wxCommandEvent );
wxDECLARE_EVENT( KIEVT_DISMISS_INFOBAR, wxCommandEvent );
/**
* A modified version of the wxInfoBar class that allows us to:
@ -72,7 +71,7 @@ wxDECLARE_EXPORTED_EVENT( KICOMMON_API, KIEVT_DISMISS_INFOBAR, wxCommandEvent );
* KIEVT_DISMISS_INFOBAR:
* An event that tells the infobar to hide itself.
*/
class KICOMMON_API WX_INFOBAR : public wxInfoBarGeneric
class WX_INFOBAR : public wxInfoBarGeneric
{
public:
/**
@ -276,7 +275,7 @@ protected:
* https://gitlab.com/kicad/code/kicad/-/issues/4501
*
*/
class KICOMMON_API EDA_INFOBAR_PANEL : public wxPanel
class EDA_INFOBAR_PANEL : public wxPanel
{
public:
EDA_INFOBAR_PANEL( wxWindow* aParent, wxWindowID aId = wxID_ANY,
@ -305,40 +304,4 @@ protected:
wxFlexGridSizer* m_mainSizer;
};
/**
* A wrapper for reporting to a #WX_INFOBAR UI element.
*
* The infobar is not updated until the @c Finalize() method is called. That method will
* queue either a show message or a dismiss event for the infobar - so this reporter is
* safe to use inside a paint event without causing an infinite paint event loop.
*
* No action is taken if no message is given to the reporter.
*/
class KICOMMON_API INFOBAR_REPORTER : public REPORTER
{
public:
INFOBAR_REPORTER( WX_INFOBAR* aInfoBar ) :
REPORTER(), m_messageSet( false ), m_infoBar( aInfoBar ),
m_severity( RPT_SEVERITY_UNDEFINED )
{
}
virtual ~INFOBAR_REPORTER() {};
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
bool HasMessage() const override;
/**
* Update the infobar with the reported text.
*/
void Finalize();
private:
bool m_messageSet;
WX_INFOBAR* m_infoBar;
std::unique_ptr<wxString> m_message;
SEVERITY m_severity;
};
#endif // INFOBAR_H_