diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 924b2d154a..9428530d20 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -106,10 +106,15 @@ 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 @@ -126,6 +131,8 @@ 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 @@ -151,6 +158,7 @@ set( KICOMMON_SRCS page_info.cpp paths.cpp project.cpp + reporter.cpp richio.cpp search_stack.cpp searchhelpfilefullpath.cpp @@ -388,15 +396,12 @@ 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 @@ -418,8 +423,6 @@ 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 @@ -530,7 +533,6 @@ 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 @@ -567,7 +569,6 @@ set( COMMON_SRCS rc_item.cpp refdes_utils.cpp render_settings.cpp - reporter.cpp scintilla_tricks.cpp status_popup.cpp stroke_params.cpp diff --git a/common/gal/dpi_scaling.cpp b/common/dpi_scaling.cpp similarity index 98% rename from common/gal/dpi_scaling.cpp rename to common/dpi_scaling.cpp index 33ca63d8bc..fca8b0b9c4 100644 --- a/common/gal/dpi_scaling.cpp +++ b/common/dpi_scaling.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <gal/dpi_scaling.h> +#include <dpi_scaling.h> double DPI_SCALING::GetMaxScaleFactor() diff --git a/common/gal/CMakeLists.txt b/common/gal/CMakeLists.txt index 0dd1cbea65..0bc540f83f 100644 --- a/common/gal/CMakeLists.txt +++ b/common/gal/CMakeLists.txt @@ -14,7 +14,6 @@ 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 diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp index af2daedd88..da2304fd15 100644 --- a/common/gal/gal_display_options.cpp +++ b/common/gal/gal_display_options.cpp @@ -28,7 +28,7 @@ #include <wx/log.h> #include <config_map.h> -#include <gal/dpi_scaling.h> +#include <dpi_scaling.h> using namespace KIGFX; diff --git a/common/gal/hidpi_gl_canvas.cpp b/common/gal/hidpi_gl_canvas.cpp index cc1223791e..93ad375a1c 100644 --- a/common/gal/hidpi_gl_canvas.cpp +++ b/common/gal/hidpi_gl_canvas.cpp @@ -26,7 +26,7 @@ #include <gal/hidpi_gl_canvas.h> -#include <gal/dpi_scaling.h> +#include <dpi_scaling.h> HIDPI_GL_CANVAS::HIDPI_GL_CANVAS( const KIGFX::VC_SETTINGS& aSettings, wxWindow* aParent, diff --git a/common/reporter.cpp b/common/reporter.cpp index 3eac94fe2a..859d06597e 100644 --- a/common/reporter.cpp +++ b/common/reporter.cpp @@ -29,7 +29,6 @@ #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> @@ -83,42 +82,6 @@ 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; @@ -235,59 +198,4 @@ 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(); -} +} \ No newline at end of file diff --git a/common/widgets/wx_html_report_panel.cpp b/common/widgets/wx_html_report_panel.cpp index 752f28a9ce..ebdd223649 100644 --- a/common/widgets/wx_html_report_panel.cpp +++ b/common/widgets/wx_html_report_panel.cpp @@ -460,3 +460,39 @@ 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; +} \ No newline at end of file diff --git a/common/widgets/wx_html_report_panel.h b/common/widgets/wx_html_report_panel.h index e4c7b3c3d6..0532551fc3 100644 --- a/common/widgets/wx_html_report_panel.h +++ b/common/widgets/wx_html_report_panel.h @@ -27,6 +27,32 @@ #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 @@ -34,7 +60,7 @@ * * The messages are reported through a REPORTER object */ -class WX_HTML_REPORT_PANEL : public WX_HTML_REPORT_PANEL_BASE +class KICOMMON_API WX_HTML_REPORT_PANEL : public WX_HTML_REPORT_PANEL_BASE { public: WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY, diff --git a/common/widgets/wx_html_report_panel_base.cpp b/common/widgets/wx_html_report_panel_base.cpp index 7b5b8cc396..bbb324658e 100644 --- a/common/widgets/wx_html_report_panel_base.cpp +++ b/common/widgets/wx_html_report_panel_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/common/widgets/wx_html_report_panel_base.fbp b/common/widgets/wx_html_report_panel_base.fbp index 256a76240c..cd26174c53 100644 --- a/common/widgets/wx_html_report_panel_base.fbp +++ b/common/widgets/wx_html_report_panel_base.fbp @@ -1,34 +1,36 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <wxFormBuilder_Project> - <FileVersion major="1" minor="17"/> + <FileVersion major="1" minor="18"/> <object class="Project" expanded="true"> - <property name="class_decoration"></property> <property name="code_generation">C++</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="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="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="precompiled_header"></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="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> @@ -86,10 +88,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -155,10 +157,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -217,10 +219,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -293,10 +295,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -359,10 +361,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -432,10 +434,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -498,10 +500,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -571,10 +573,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -647,10 +649,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="best_size"></property> <property name="bg"></property> <property name="caption"></property> @@ -723,10 +725,10 @@ <property name="LeftDockable">1</property> <property name="RightDockable">1</property> <property name="TopDockable">1</property> - <property name="aui_layer"></property> + <property name="aui_layer">0</property> <property name="aui_name"></property> - <property name="aui_position"></property> - <property name="aui_row"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> <property name="auth_needed">0</property> <property name="best_size"></property> <property name="bg"></property> diff --git a/common/widgets/wx_html_report_panel_base.h b/common/widgets/wx_html_report_panel_base.h index aaa62a7785..2d31ebd667 100644 --- a/common/widgets/wx_html_report_panel_base.h +++ b/common/widgets/wx_html_report_panel_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -28,13 +28,14 @@ #include <wx/statbox.h> #include <wx/panel.h> -/////////////////////////////////////////////////////////////////////////// +#include "kicommon.h" +/////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// /// Class WX_HTML_REPORT_PANEL_BASE /////////////////////////////////////////////////////////////////////////////// -class WX_HTML_REPORT_PANEL_BASE : public wxPanel +class KICOMMON_API WX_HTML_REPORT_PANEL_BASE : public wxPanel { private: diff --git a/common/widgets/wx_infobar.cpp b/common/widgets/wx_infobar.cpp index 5ae8a2828f..b419d96392 100644 --- a/common/widgets/wx_infobar.cpp +++ b/common/widgets/wx_infobar.cpp @@ -404,3 +404,53 @@ 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(); +} diff --git a/include/gal/dpi_scaling.h b/include/dpi_scaling.h similarity index 98% rename from include/gal/dpi_scaling.h rename to include/dpi_scaling.h index 0228f39b3b..0d6470fd7b 100644 --- a/include/gal/dpi_scaling.h +++ b/include/dpi_scaling.h @@ -24,7 +24,7 @@ #ifndef DPI_SCALING__H #define DPI_SCALING__H -#include <gal/gal.h> +#include <kicommon.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 GAL_API DPI_SCALING +class KICOMMON_API DPI_SCALING { public: /** diff --git a/include/dpi_scaling_common.h b/include/dpi_scaling_common.h index 204c003ca8..9aad7e275e 100644 --- a/include/dpi_scaling_common.h +++ b/include/dpi_scaling_common.h @@ -24,7 +24,8 @@ #ifndef DPI_SCALING_COMMON__H #define DPI_SCALING_COMMON__H -#include <gal/dpi_scaling.h> +#include <kicommon.h> +#include <dpi_scaling.h> class COMMON_SETTINGS; class wxWindow; @@ -34,7 +35,7 @@ class wxWindow; * scale to use for canvases. This has several sources and the availability of * some of them are platform dependent. */ -class DPI_SCALING_COMMON : public DPI_SCALING +class KICOMMON_API DPI_SCALING_COMMON : public DPI_SCALING { public: /** diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h index bf509e8369..05d2cc4908 100644 --- a/include/gal/gal_display_options.h +++ b/include/gal/gal_display_options.h @@ -25,7 +25,7 @@ #define GAL_DISPLAY_OPTIONS_H__ #include <gal/gal.h> -#include <gal/dpi_scaling.h> +#include <dpi_scaling.h> #include <core/observable.h> class COMMON_SETTINGS; diff --git a/include/reporter.h b/include/reporter.h index 60515f5812..588078b90a 100644 --- a/include/reporter.h +++ b/include/reporter.h @@ -29,6 +29,7 @@ #include <eda_units.h> #include <widgets/report_severity.h> +#include <kicommon.h> /** * @file reporter.h @@ -67,7 +68,7 @@ class WX_INFOBAR; * filtering is not made here. */ -class REPORTER +class KICOMMON_API REPORTER { public: /** @@ -134,7 +135,7 @@ public: /** * A wrapper for reporting to a wxTextCtrl object. */ -class WX_TEXT_CTRL_REPORTER : public REPORTER +class KICOMMON_API WX_TEXT_CTRL_REPORTER : public REPORTER { public: WX_TEXT_CTRL_REPORTER( wxTextCtrl* aTextCtrl ) : @@ -160,7 +161,7 @@ private: /** * A wrapper for reporting to a wxString object. */ -class WX_STRING_REPORTER : public REPORTER +class KICOMMON_API WX_STRING_REPORTER : public REPORTER { public: WX_STRING_REPORTER( wxString* aString ) : @@ -182,44 +183,12 @@ 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 NULL_REPORTER : public REPORTER +class KICOMMON_API NULL_REPORTER : public REPORTER { public: NULL_REPORTER() @@ -242,7 +211,7 @@ public: /** * Reporter forwarding messages to stdout or stderr as appropriate */ -class CLI_REPORTER : public REPORTER +class KICOMMON_API CLI_REPORTER : public REPORTER { public: CLI_REPORTER() @@ -264,7 +233,7 @@ public: /** * Debug type reporter, forwarding messages to std::cout. */ -class STDOUT_REPORTER : public REPORTER +class KICOMMON_API STDOUT_REPORTER : public REPORTER { public: STDOUT_REPORTER() @@ -283,7 +252,7 @@ public: }; -class WXLOG_REPORTER : public REPORTER +class KICOMMON_API WXLOG_REPORTER : public REPORTER { public: WXLOG_REPORTER() @@ -305,7 +274,7 @@ public: /** * A wrapper for reporting to a specific text location in a statusbar. */ -class STATUSBAR_REPORTER : public REPORTER +class KICOMMON_API STATUSBAR_REPORTER : public REPORTER { public: STATUSBAR_REPORTER( wxStatusBar* aStatusBar, int aPosition = 0 ) @@ -324,44 +293,4 @@ 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_ diff --git a/include/widgets/html_window.h b/include/widgets/html_window.h index a179423b01..3e39a91cf1 100644 --- a/include/widgets/html_window.h +++ b/include/widgets/html_window.h @@ -25,12 +25,13 @@ #ifndef HTML_WINDOW_H #define HTML_WINDOW_H +#include <kicommon.h> #include <wx/html/htmlwin.h> /** * Add dark theme support to wxHtmlWindow. */ -class HTML_WINDOW : public wxHtmlWindow +class KICOMMON_API HTML_WINDOW : public wxHtmlWindow { public: HTML_WINDOW( wxWindow* aParent, wxWindowID aId = wxID_ANY, diff --git a/include/widgets/number_badge.h b/include/widgets/number_badge.h index a193fb433b..bb5500c94c 100644 --- a/include/widgets/number_badge.h +++ b/include/widgets/number_badge.h @@ -27,6 +27,7 @@ #include <widgets/ui_common.h> #include <wx/dcclient.h> #include <wx/panel.h> +#include <kicommon.h> /** @@ -35,7 +36,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 NUMBER_BADGE : public wxPanel +class KICOMMON_API NUMBER_BADGE : public wxPanel { public: /** diff --git a/include/widgets/wx_infobar.h b/include/widgets/wx_infobar.h index d330b33542..1e46b6e819 100644 --- a/include/widgets/wx_infobar.h +++ b/include/widgets/wx_infobar.h @@ -28,6 +28,7 @@ #include <wx/timer.h> #include <wx/panel.h> #include <wx/sizer.h> +#include <reporter.h> class wxAuiManager; @@ -41,8 +42,8 @@ enum }; -wxDECLARE_EVENT( KIEVT_SHOW_INFOBAR, wxCommandEvent ); -wxDECLARE_EVENT( KIEVT_DISMISS_INFOBAR, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( KICOMMON_API, KIEVT_SHOW_INFOBAR, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( KICOMMON_API, KIEVT_DISMISS_INFOBAR, wxCommandEvent ); /** * A modified version of the wxInfoBar class that allows us to: @@ -71,7 +72,7 @@ wxDECLARE_EVENT( KIEVT_DISMISS_INFOBAR, wxCommandEvent ); * KIEVT_DISMISS_INFOBAR: * An event that tells the infobar to hide itself. */ -class WX_INFOBAR : public wxInfoBarGeneric +class KICOMMON_API WX_INFOBAR : public wxInfoBarGeneric { public: /** @@ -275,7 +276,7 @@ protected: * https://gitlab.com/kicad/code/kicad/-/issues/4501 * */ -class EDA_INFOBAR_PANEL : public wxPanel +class KICOMMON_API EDA_INFOBAR_PANEL : public wxPanel { public: EDA_INFOBAR_PANEL( wxWindow* aParent, wxWindowID aId = wxID_ANY, @@ -304,4 +305,40 @@ 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_