More code hygiene.

This commit is contained in:
Jeff Young 2020-03-25 18:06:18 +00:00
parent ba36fc0009
commit 6e27904791
3 changed files with 22 additions and 39 deletions

View File

@ -44,14 +44,6 @@
#include <wx/timer.h>
#include <wx/utils.h>
#define SYM_CHOOSER_HSASH wxT( "SymbolChooserHSashPosition" )
#define SYM_CHOOSER_VSASH wxT( "SymbolChooserVSashPosition" )
#define SYM_CHOOSER_WIDTH_KEY wxT( "SymbolChooserWidth" )
#define SYM_CHOOSER_HEIGHT_KEY wxT( "SymbolChooserHeight" )
#define SYM_CHOOSER_KEEP_SYM_KEY wxT( "SymbolChooserKeepSymbol" )
#define SYM_CHOOSER_USE_UNITS_KEY wxT( "SymbolChooserUseUnits" )
std::mutex DIALOG_CHOOSE_COMPONENT::g_Mutex;
@ -61,11 +53,14 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
bool aShowFootprints, bool aAllowBrowser )
: DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
m_symbol_preview( nullptr ),
m_browser_button( nullptr ),
m_hsplitter( nullptr ),
m_vsplitter( nullptr ),
m_fp_sel_ctrl( nullptr ),
m_fp_preview( nullptr ),
m_keepSymbol( nullptr ),
m_useUnits( nullptr ),
m_tree( nullptr ),
m_details( nullptr ),
m_parent( aParent ),
@ -232,11 +227,11 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
{
auto panel = new wxPanel( aParent );
auto sizer = new wxBoxSizer( wxVERTICAL );
wxPanel* panel = new wxPanel( aParent );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = m_parent->GetCanvas()->GetBackend();
m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(),
m_parent->GetCanvas()->GetBackend() );
m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(), backend );
m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
if( m_show_footprints )
@ -267,12 +262,12 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
m_keepSymbol = new wxCheckBox( panel, 1000, _("Multi-Symbol Placement"), wxDefaultPosition,
wxDefaultSize, wxALIGN_RIGHT );
wxDefaultSize, wxALIGN_RIGHT );
m_keepSymbol->SetValue( cfg->m_SymChooserPanel.keep_symbol );
m_keepSymbol->SetToolTip( _( "Place multiple copies of the symbol." ) );
m_useUnits = new wxCheckBox( panel, 1000, _("Place all units"), wxDefaultPosition,
wxDefaultSize, wxALIGN_RIGHT );
wxDefaultSize, wxALIGN_RIGHT );
m_useUnits->SetValue( cfg->m_SymChooserPanel.place_all_units );
m_useUnits->SetToolTip( _( "Sequentially place all units of the symbol." ) );
@ -469,13 +464,12 @@ void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent )
{
m_fp_override = aEvent.GetString();
m_field_edits.erase(
std::remove_if( m_field_edits.begin(), m_field_edits.end(),
[]( std::pair<int, wxString> const& i )
{
return i.first == FOOTPRINT;
} ),
m_field_edits.end() );
m_field_edits.erase( std::remove_if( m_field_edits.begin(), m_field_edits.end(),
[]( std::pair<int, wxString> const& i )
{
return i.first == FOOTPRINT;
} ),
m_field_edits.end() );
m_field_edits.emplace_back( std::make_pair( FOOTPRINT, m_fp_override ) );

View File

@ -23,28 +23,20 @@
#include <bitmaps.h>
#include <class_libentry.h>
#include <common.h>
#include <confirm.h>
#include <dialog_helpers.h>
#include <dialog_text_entry.h>
#include <eeschema_settings.h>
#include <fctsys.h>
#include <general.h>
#include <kiface_i.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <lib_manager.h>
#include <math/util.h> // for KiROUND
#include <pgm_base.h>
#include <sch_component.h>
#include <sch_item.h>
#include <symbol_lib_table.h>
#include <widgets/grid_text_button_helpers.h>
#include <widgets/wx_grid.h>
#ifdef KICAD_SPICE
#include <dialog_spice_model.h>
#include <netlist_exporter_pspice.h>
#endif /* KICAD_SPICE */
#include <dialog_edit_component_in_lib.h>
@ -417,8 +409,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event )
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
m_grid->ProcessTableMessage( msg );
m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
m_grid->SetGridCursor( m_fields->size() - 1, 0 );
m_grid->MakeCellVisible( (int) m_fields->size() - 1, 0 );
m_grid->SetGridCursor( (int) m_fields->size() - 1, 0 );
m_grid->EnableCellEditControl();
m_grid->ShowCellEditControl();
@ -509,7 +501,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditSpiceModel( wxCommandEvent& event )
if( dialog.ShowModal() != wxID_OK )
return;
diff = m_fields->size() - diff;
diff = (int) m_fields->size() - diff;
if( diff > 0 )
{
@ -561,7 +553,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddFootprintFilter( wxCommandEvent& eve
// duplicate filters do no harm, so don't be a nanny.
m_FootprintFilterListBox->Append( filterLine );
m_FootprintFilterListBox->SetSelection( m_FootprintFilterListBox->GetCount() - 1 );
m_FootprintFilterListBox->SetSelection( (int) m_FootprintFilterListBox->GetCount() - 1 );
}

View File

@ -26,7 +26,6 @@
#include <wx/tooltip.h>
#include <confirm.h>
#include <grid_tricks.h>
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pgm_base.h>
@ -40,12 +39,10 @@
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <sch_reference_list.h>
#include <sch_validators.h>
#include <symbol_lib_table.h>
#ifdef KICAD_SPICE
#include <dialog_spice_model.h>
#include <netlist_exporter_pspice.h>
#endif /* KICAD_SPICE */
@ -288,7 +285,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnEditSpiceModel( wxCommandEvent& event
if( dialog.ShowModal() != wxID_OK )
return;
diff = m_fields->size() - diff;
diff = (int) m_fields->size() - diff;
if( diff > 0 )
{
@ -548,8 +545,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
m_grid->ProcessTableMessage( msg );
m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
m_grid->SetGridCursor( m_fields->size() - 1, 0 );
m_grid->MakeCellVisible( (int) m_fields->size() - 1, 0 );
m_grid->SetGridCursor( (int) m_fields->size() - 1, 0 );
m_grid->EnableCellEditControl();
m_grid->ShowCellEditControl();