mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 18:35:32 +00:00
Move some things starting from reporter to kicommon
This commit is contained in:
parent
d2b36cc38d
commit
89a3b7baa5
@ -106,10 +106,14 @@ 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
|
||||
|
||||
database/database_lib_settings.cpp
|
||||
|
||||
@ -126,6 +130,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 +157,7 @@ set( KICOMMON_SRCS
|
||||
page_info.cpp
|
||||
paths.cpp
|
||||
project.cpp
|
||||
reporter.cpp
|
||||
richio.cpp
|
||||
search_stack.cpp
|
||||
searchhelpfilefullpath.cpp
|
||||
@ -388,7 +395,6 @@ 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
|
||||
@ -396,7 +402,6 @@ set( COMMON_WIDGET_SRCS
|
||||
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
|
||||
@ -531,7 +534,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
|
||||
@ -568,7 +570,6 @@ set( COMMON_SRCS
|
||||
rc_item.cpp
|
||||
refdes_utils.cpp
|
||||
render_settings.cpp
|
||||
reporter.cpp
|
||||
scintilla_tricks.cpp
|
||||
status_popup.cpp
|
||||
stroke_params.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()
|
@ -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
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <wx/log.h>
|
||||
|
||||
#include <config_map.h>
|
||||
#include <gal/dpi_scaling.h>
|
||||
#include <dpi_scaling.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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,
|
||||
|
@ -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!
|
||||
|
@ -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>
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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:
|
||||
/**
|
@ -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:
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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_
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
/**
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <wx/timer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <reporter.h>
|
||||
|
||||
|
||||
class wxAuiManager;
|
||||
@ -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 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_
|
||||
|
Loading…
Reference in New Issue
Block a user