7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 18:51:40 +00:00

More NULL expunging.

This commit is contained in:
Wayne Stambaugh 2021-07-16 16:13:26 -04:00
parent d1c9572bcc
commit cb72da294a
119 changed files with 1305 additions and 1307 deletions
bitmap2component
cvpcb
eeschema
bus-wire-junction.cppbus_alias.hcomponent_references_lister.cpp
dialogs
ee_collectors.cppee_collectors.heeschema.cppeeschema_config.cpperc.cpplib_arc.cpplib_bezier.cpplib_field.cpplib_polyline.cpplib_rectangle.cpplib_symbol.cpplib_symbol.hlib_text.cpp
netlist_exporters
project_rescue.cppproject_rescue.hsch_base_frame.cppsch_base_frame.hsch_bitmap.cppsch_bitmap.hsch_bus_entry.cppsch_edit_frame.cppsch_field.cppsch_field.hsch_io_mgr.cppsch_junction.cppsch_line.cppsch_no_connect.cppsch_plugin.cpp
sch_plugins
sch_reference_list.hsch_screen.cppsch_sheet.cppsch_sheet_pin.cppsch_sheet_pin.hsch_symbol.cppsch_symbol.hsch_text.cppsch_validators.h
sim
symbol_editor
symbol_lib_table.hsymbol_library.hsymbol_viewer_frame.cpp
tools
transform.cpp
widgets
gerbview

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -439,7 +439,7 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
m_NB_Image = m_Greyscale_Image;
Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
m_buttonExportFile->Enable( true );
m_buttonExportClipboard->Enable( true );
@ -526,7 +526,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
}
@ -555,7 +555,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
{
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
// just rescale the other dpi
// just re-scale the other dpi
double ratio = new_size / m_outputSizeX.GetOutputSize();
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
}
@ -671,6 +671,7 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
{
m_exportToClipboard = false;
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
@ -681,6 +682,7 @@ void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
{
m_exportToClipboard = true;
// choices of m_rbOutputFormat are expected to be in same order as
// OUTPUT_FMT_ID. See bitmap2component.h
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
@ -691,7 +693,7 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
wxLogNull doNotLog; // disable logging of failed clipboard actions
// Write buffer to the clipboard
if (wxTheClipboard->Open())
if( wxTheClipboard->Open() )
{
// This data objects are held by the clipboard,
// so do not delete them in the app.
@ -700,7 +702,9 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
wxTheClipboard->Close();
}
else
{
wxMessageBox( _( "Unable to export to the Clipboard") );
}
}
@ -749,7 +753,7 @@ void BM2CMP_FRAME::OnExportLogo()
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@ -789,7 +793,7 @@ void BM2CMP_FRAME::exportPostScriptFormat()
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@ -828,7 +832,7 @@ void BM2CMP_FRAME::exportEeschemaFormat()
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@ -867,7 +871,7 @@ void BM2CMP_FRAME::exportPcbnewFormat()
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
if( outfile == nullptr )
{
wxString msg;
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
@ -917,7 +921,7 @@ void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
BITMAPCONV_INFO converter( aOutput );
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
m_outputSizeY.GetOutputDPI(), modLayer );
m_outputSizeY.GetOutputDPI(), modLayer );
if( !converter.GetErrorMessages().empty() )
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -30,15 +30,14 @@
#include <settings/settings_manager.h>
//-----<KIFACE>-----------------------------------------------------------------
namespace BMP2CMP {
static struct IFACE : public KIFACE_I
{
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
int aCtlBits = 0 ) override
{
InitSettings( new BITMAP2CMP_SETTINGS );
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
@ -46,19 +45,18 @@ static struct IFACE : public KIFACE_I
}
/**
* Function IfaceOrAddress
* return a pointer to the requested object. The safest way to use this
* is to retrieve a pointer to a static instance of an interface, similar to
* how the KIFACE interface is exported. But if you know what you are doing
* use it to retrieve anything you want.
* Return a pointer to the requested object.
*
* The safest way to use this is to retrieve a pointer to a static instance of an interface,
* similar to how the KIFACE interface is exported. But if you know what you are doing use
* it to retrieve anything you want.
*
* @param aDataId identifies which object you want the address of.
*
* @return void* - and must be cast into the know type.
* @return the object which must be cast into the known type.
*/
void* IfaceOrAddress( int aDataId ) override
{
return NULL;
return nullptr;
}
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
@ -73,6 +71,7 @@ using namespace BMP2CMP;
static PGM_BASE* process;
KIFACE_I& Kiface()
{
return kiface;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2019 jean-pierre.charras
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -43,10 +43,11 @@
/* free a potrace bitmap */
static void bm_free( potrace_bitmap_t* bm )
{
if( bm != NULL )
if( bm != nullptr )
{
free( bm->map );
}
free( bm );
}
@ -66,14 +67,13 @@ BITMAPCONV_INFO::BITMAPCONV_INFO( std::string& aData ):
m_PixmapHeight = 0;
m_ScaleX = 1.0;
m_ScaleY = 1.0;
m_Paths = NULL;
m_Paths = nullptr;
m_CmpName = "LOGO";
}
int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y,
BMP2CMP_MOD_LAYER aModLayer )
int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap, OUTPUT_FMT_ID aFormat,
int aDpi_X, int aDpi_Y, BMP2CMP_MOD_LAYER aModLayer )
{
potrace_param_t* param;
potrace_state_t* st;
@ -103,6 +103,7 @@ int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
{
potrace_state_free( st );
}
potrace_param_free( param );
char msg[256];
@ -128,6 +129,7 @@ int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
m_Format = POSTSCRIPT_FMT;
m_ScaleX = 1.0; // the conversion scale
m_ScaleY = m_ScaleX;
// output vector data, e.g. as a rudimentary EPS file (mainly for tests)
createOutputData();
break;
@ -161,7 +163,7 @@ int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
const char* BITMAPCONV_INFO::getBoardLayerName( BMP2CMP_MOD_LAYER aChoice )
{
const char * layerName = "F.SilkS";
const char* layerName = "F.SilkS";
switch( aChoice )
{
@ -210,10 +212,10 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName )
sprintf( strbuf, "(attr board_only exclude_from_pos_files exclude_from_bom)\n");
m_Data += strbuf;
sprintf( strbuf, " (fp_text reference \"G***\" (at 0 0) (layer %s)\n"
" (effects (font (thickness 0.3)))\n )\n", aBrdLayerName );
" (effects (font (thickness 0.3)))\n )\n", aBrdLayerName );
m_Data += strbuf;
sprintf( strbuf, " (fp_text value \"%s\" (at 0.75 0) (layer %s) hide\n"
" (effects (font (thickness 0.3)))\n )\n", m_CmpName.c_str(), aBrdLayerName );
" (effects (font (thickness 0.3)))\n )\n", m_CmpName.c_str(), aBrdLayerName );
m_Data += strbuf;
break;
@ -226,8 +228,7 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName )
m_Data += strbuf;
sprintf( strbuf, "#\n# %s\n", m_CmpName.c_str() );
m_Data += strbuf;
sprintf( strbuf, "# pixmap size w = %d, h = %d\n#\n",
m_PixmapWidth, m_PixmapHeight );
sprintf( strbuf, "# pixmap size w = %d, h = %d\n#\n", m_PixmapWidth, m_PixmapHeight );
m_Data += strbuf;
// print reference and value
@ -270,7 +271,7 @@ void BITMAPCONV_INFO::outputDataEnd()
}
void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char* aBrdLayerName )
void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN& aPolygon, const char* aBrdLayerName )
{
// write one polygon to output file.
// coordinates are expected in target unit.
@ -287,15 +288,14 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
{
case POSTSCRIPT_FMT:
offsetY = (int)( m_PixmapHeight * m_ScaleY );
sprintf( strbuf, "newpath\n%d %d moveto\n",
startpoint.x, offsetY - startpoint.y );
sprintf( strbuf, "newpath\n%d %d moveto\n", startpoint.x, offsetY - startpoint.y );
m_Data += strbuf;
jj = 0;
for( ii = 1; ii < aPolygon.PointCount(); ii++ )
{
currpoint = aPolygon.CPoint( ii );
sprintf( strbuf, " %d %d lineto",
currpoint.x, offsetY - currpoint.y );
sprintf( strbuf, " %d %d lineto", currpoint.x, offsetY - currpoint.y );
m_Data += strbuf;
if( jj++ > 6 )
@ -314,12 +314,13 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
m_Data += " (fp_poly (pts";
jj = 0;
for( ii = 0; ii < aPolygon.PointCount(); ii++ )
{
currpoint = aPolygon.CPoint( ii );
sprintf( strbuf, " (xy %f %f)",
( currpoint.x - offsetX ) / PCB_IU_PER_MM,
( currpoint.y - offsetY ) / PCB_IU_PER_MM );
( currpoint.x - offsetX ) / PCB_IU_PER_MM,
( currpoint.y - offsetY ) / PCB_IU_PER_MM );
m_Data += strbuf;
if( jj++ > 6 )
@ -329,6 +330,7 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
}
}
// No need to close polygon
m_Data += " )";
sprintf( strbuf, "(layer %s) (width %f)\n )\n", aBrdLayerName, width );
m_Data += strbuf;
@ -337,14 +339,16 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
case KICAD_LOGO:
m_Data += " (pts";
// Internal units = micron, file unit = mm
jj = 0;
for( ii = 0; ii < aPolygon.PointCount(); ii++ )
{
currpoint = aPolygon.CPoint( ii );
sprintf( strbuf, " (xy %.3f %.3f)",
( currpoint.x - offsetX ) / PL_IU_PER_MM,
( currpoint.y - offsetY ) / PL_IU_PER_MM );
( currpoint.x - offsetX ) / PL_IU_PER_MM,
( currpoint.y - offsetY ) / PL_IU_PER_MM );
m_Data += strbuf;
if( jj++ > 4 )
@ -353,6 +357,7 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
m_Data += "\n ";
}
}
// Close polygon
sprintf( strbuf, " (xy %.3f %.3f) )\n",
( startpoint.x - offsetX ) / PL_IU_PER_MM,
@ -364,20 +369,18 @@ void BITMAPCONV_INFO::outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const char*
// The polygon outline thickness is fixed here to 1 mil, the minimal
// value in Eeschema (0 means use default thickness for graphics)
#define EE_LINE_THICKNESS 1
sprintf( strbuf, "P %d 0 0 %d",
(int) aPolygon.PointCount() + 1, EE_LINE_THICKNESS );
sprintf( strbuf, "P %d 0 0 %d", (int) aPolygon.PointCount() + 1, EE_LINE_THICKNESS );
m_Data += strbuf;
for( ii = 0; ii < aPolygon.PointCount(); ii++ )
{
currpoint = aPolygon.CPoint( ii );
sprintf( strbuf, " %d %d",
currpoint.x - offsetX, currpoint.y - offsetY );
sprintf( strbuf, " %d %d", currpoint.x - offsetX, currpoint.y - offsetY );
m_Data += strbuf;
}
// Close polygon
sprintf( strbuf, " %d %d",
startpoint.x - offsetX, startpoint.y - offsetY );
sprintf( strbuf, " %d %d", startpoint.x - offsetX, startpoint.y - offsetY );
m_Data += strbuf;
m_Data += " F\n";
@ -417,12 +420,13 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
m_errors += "No path in black and white image: no outline created\n";
}
while( paths != NULL )
while( paths != nullptr )
{
int cnt = paths->curve.n;
int* tag = paths->curve.tag;
c = paths->curve.c;
potrace_dpoint_t startpoint = c[cnt - 1][2];
for( int i = 0; i < cnt; i++ )
{
switch( tag[i] )
@ -457,6 +461,7 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
{
// Add current hole in polyset_holes
polyset_holes.NewOutline();
for( unsigned int i = 0; i < cornersBuffer.size(); i++ )
{
polyset_holes.Append( int( cornersBuffer[i].x * m_ScaleX ),
@ -466,9 +471,8 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
cornersBuffer.clear();
/* at the end of a group of a positive path and its negative children, fill.
*/
if( paths->next == NULL || paths->next->sign == '+' )
// at the end of a group of a positive path and its negative children, fill.
if( paths->next == nullptr || paths->next->sign == '+' )
{
polyset_areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_holes.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
@ -491,6 +495,7 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
polyset_holes.RemoveAllContours();
main_outline = true;
}
paths = paths->next;
}
@ -500,15 +505,17 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
// a helper function to calculate a square value
inline double square( double x )
{
return x*x;
return x * x;
}
// a helper function to calculate a cube value
inline double cube( double x )
{
return x*x*x;
return x * x * x;
}
/* render a Bezier curve. */
void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
potrace_dpoint_t p1,

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -45,10 +45,10 @@
#define QUOTE '\''
/*
* read the string between quotes and put it in aTarget
* put text in aTarget
* return a pointer to the last read char (the second quote if OK)
/**
* Read the string between quotes.
*
* @return a the quoted string.
*/
wxString GetQuotedText( wxString& text )
{
@ -76,7 +76,6 @@ bool sortListbyCmpValue( const FOOTPRINT_EQUIVALENCE& ref, const FOOTPRINT_EQUIV
}
// read the .equ files and populate the list of equivalents
int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
wxString* aErrorMessages )
{
@ -118,7 +117,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
file = wxFopen( tmp, wxT( "rt" ) );
if( file == NULL )
if( file == nullptr )
{
error_count++;
@ -135,7 +134,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
continue;
}
while( GetLine( file, line, NULL, sizeof( line ) ) != NULL )
while( GetLine( file, line, nullptr, sizeof( line ) ) != nullptr )
{
if( *line == 0 )
continue;

View File

@ -49,26 +49,26 @@ static struct IFACE : public KIFACE_I
void OnKifaceEnd() override;
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
int aCtlBits = 0 ) override
{
switch( aClassId )
{
case FRAME_CVPCB: return new CVPCB_MAINFRAME( aKiway, aParent );
case FRAME_CVPCB_DISPLAY: return new DISPLAY_FOOTPRINTS_FRAME( aKiway, aParent );
default: return NULL;
default: return nullptr;
}
}
/**
* Function IfaceOrAddress
* return a pointer to the requested object. The safest way to use this
* is to retrieve a pointer to a static instance of an interface, similar to
* how the KIFACE interface is exported. But if you know what you are doing
* use it to retrieve anything you want.
* Return a pointer to the requested object.
*
* The safest way to use this is to retrieve a pointer to a static instance of an interface,
* similar to how the KIFACE interface is exported. But if you know what you are doing use
* it to retrieve anything you want.
*
* @param aDataId identifies which object you want the address of.
*
* @return void* - and must be cast into the know type.
* @return the object requested and must be cast into the known type.
*/
void* IfaceOrAddress( int aDataId ) override
{
@ -133,18 +133,18 @@ PGM_BASE* PgmOrNull()
/// the fallback table for multiple projects).
FP_LIB_TABLE GFootprintTable;
/// The global footprint info table. This is performance-intensive to build so we
/// keep a hash-stamped global version. Any deviation from the request vs. stored
/// hash will result in it being rebuilt.
FOOTPRINT_LIST_IMPL GFootprintList;
//!!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
//!!!!!!!!!!!!!!! This code is obsolete because of the merge into Pcbnew, don't bother with it.
// A short lived implementation. cvpcb will get combine into pcbnew shortly, so
// A short lived implementation. cvpcb will get combine into Pcbnew shortly, so
// we skip setting KICAD6_FOOTPRINT_DIR here for now. User should set the environment
// variable.
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{
// This is process level, not project level, initialization of the DSO.
@ -171,15 +171,15 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
if( !FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ) )
{
DisplayInfoMessage( NULL, _( "You have run CvPcb for the first time using the "
"new footprint library table method for finding "
"footprints.\nCvPcb has either copied the default "
"table or created an empty table in your home "
"folder.\nYou must first configure the library "
"table to include all footprint libraries not "
"included with KiCad.\nSee the \"Footprint Library "
"Table\" section of the CvPcb documentation for "
"more information." ) );
DisplayInfoMessage( nullptr, _( "You have run CvPcb for the first time using the "
"new footprint library table method for finding "
"footprints.\nCvPcb has either copied the default "
"table or created an empty table in your home "
"folder.\nYou must first configure the library "
"table to include all footprint libraries not "
"included with KiCad.\nSee the \"Footprint Library "
"Table\" section of the CvPcb documentation for "
"more information." ) );
}
}
catch( const IO_ERROR& ioe )
@ -193,6 +193,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
return true;
}
void IFACE::OnKifaceEnd()
{
end_common();

View File

@ -64,14 +64,14 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{
m_symbolsListBox = NULL;
m_footprintListBox = NULL;
m_librariesListBox = NULL;
m_mainToolBar = NULL;
m_symbolsListBox = nullptr;
m_footprintListBox = nullptr;
m_librariesListBox = nullptr;
m_mainToolBar = nullptr;
m_modified = false;
m_skipComponentSelect = false;
m_filteringOptions = FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST;
m_tcFilterString = NULL;
m_tcFilterString = nullptr;
m_FootprintsList = FOOTPRINT_LIST::GetInstance( Kiway() );
m_initialized = false;
m_aboutTitle = "CvPcb";
@ -512,7 +512,7 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
if( symbol == NULL )
if( symbol == nullptr )
return;
LIB_ID fpid = aAssociation.GetNewFootprint();
@ -594,7 +594,7 @@ void CVPCB_MAINFRAME::refreshAfterSymbolSearch( COMPONENT* aSymbol )
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
m_auimgr.Update(); // (could be not the case when starting CvPcb)
if( aSymbol == NULL )
if( aSymbol == nullptr )
{
DisplayStatus();
return;
@ -825,7 +825,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
if ( selection < 0 ) // Nothing selected
return;
if( m_netlist.GetComponent( selection ) == NULL )
if( m_netlist.GetComponent( selection ) == nullptr )
return;
// Now highlight the selected symbol:
@ -878,13 +878,13 @@ void CVPCB_MAINFRAME::BuildFootprintsListBox()
{
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_footprintListBox == NULL )
if( m_footprintListBox == nullptr )
{
m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST );
m_footprintListBox->SetFont( KIUI::GetMonospacedUIFont() );
}
m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL, wxEmptyString,
m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, nullptr, wxEmptyString,
FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
DisplayStatus();
}
@ -896,7 +896,7 @@ void CVPCB_MAINFRAME::BuildSymbolsListBox()
COMPONENT* symbol;
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_symbolsListBox == NULL )
if( m_symbolsListBox == nullptr )
{
m_symbolsListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST );
m_symbolsListBox->SetFont( KIUI::GetMonospacedUIFont() );
@ -930,7 +930,7 @@ void CVPCB_MAINFRAME::BuildLibrariesListBox()
{
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_librariesListBox == NULL )
if( m_librariesListBox == nullptr )
{
m_librariesListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST );
m_librariesListBox->SetFont( KIUI::GetMonospacedUIFont() );
@ -959,7 +959,7 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
if( selection >= 0 && selection < (int) m_netlist.GetCount() )
return m_netlist.GetComponent( selection );
return NULL;
return nullptr;
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2007-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -50,8 +50,8 @@
#include <display_footprints_frame.h>
#include <tools/cvpcb_actions.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_editor_conditions.h> // Shared conditions with other pcbnew frames
#include <tools/pcb_viewer_tools.h> // shared tools with other pcbnew frames
#include <tools/pcb_editor_conditions.h> // Shared conditions with other Pcbnew frames
#include <tools/pcb_viewer_tools.h> // shared tools with other Pcbnew frames
#include <tools/cvpcb_fpviewer_selection_tool.h>
#include <widgets/infobar.h>
#include <wx/choice.h>
@ -182,7 +182,7 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
GetCanvas()->SetEvtHandlerEnabled( false );
delete GetScreen();
SetScreen( NULL ); // Be sure there is no double deletion
SetScreen( nullptr ); // Be sure there is no double deletion
}
@ -197,9 +197,12 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool, CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::zoomTool,
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool,
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool,
CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
@ -216,10 +219,12 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
};
mgr->SetConditions( PCB_ACTIONS::zoomFootprintAutomatically, CHECK( autoZoomCond ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::showPadNumbers,
CHECK( cond.PadNumbersDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::graphicsOutlines, CHECK( !cond.GraphicsFillDisplay() ) );
mgr->SetConditions( PCB_ACTIONS::graphicsOutlines,
CHECK( !cond.GraphicsFillDisplay() ) );
#undef CHECK
}
@ -296,7 +301,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
m_mainToolBar->Add( ACTIONS::zoomTool,
ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this );
@ -323,8 +329,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
m_mainToolBar->UpdateControlWidth( ID_ON_GRID_SELECT );
m_mainToolBar->UpdateControlWidth( ID_ON_ZOOM_SELECT );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_mainToolBar->Realize();
}
@ -392,7 +397,7 @@ COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
REPORTER& aReporter )
{
FOOTPRINT* footprint = NULL;
FOOTPRINT* footprint = nullptr;
LIB_ID fpid;
if( fpid.Parse( aFootprintName ) >= 0 )
@ -400,7 +405,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ),
aFootprintName ),
RPT_SEVERITY_ERROR );
return NULL;
return nullptr;
}
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
@ -415,7 +420,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
libNickname ),
RPT_SEVERITY_ERROR );
return NULL;
return nullptr;
}
// See if the footprint requested is in the library
@ -423,7 +428,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
{
aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
RPT_SEVERITY_ERROR );
return NULL;
return nullptr;
}
try
@ -436,7 +441,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.What() );
return NULL;
return nullptr;
}
if( footprint )
@ -448,7 +453,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
RPT_SEVERITY_ERROR );
return NULL;
return nullptr;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -31,14 +31,9 @@
#include <wx/dcclient.h>
/******************************************************************************
* Basic class (from wxListView) to display symbol and footprint lists
* Not directly used: the 2 list boxes actually used are derived from it
******************************************************************************/
ITEMS_LISTBOX_BASE::ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
const wxPoint& aLocation, const wxSize& aSize,
long aStyle) :
long aStyle ) :
wxListView( aParent, aId, aLocation, aSize, LISTBOX_STYLE | aStyle ),
columnWidth( 0 )
{
@ -72,11 +67,6 @@ void ITEMS_LISTBOX_BASE::UpdateWidth( int aLine )
}
/*
* Calculate the width of the given line, and increase the column width
* if needed. This is effectively the wxListCtrl code for autosizing.
* NB. it relies on the caller checking the given line number is valid.
*/
void ITEMS_LISTBOX_BASE::UpdateLineWidth( unsigned aLine )
{
wxClientDC dc( this );
@ -84,7 +74,7 @@ void ITEMS_LISTBOX_BASE::UpdateLineWidth( unsigned aLine )
int newWidth = 10; // Value of AUTOSIZE_COL_MARGIN from wxWidgets source.
dc.SetFont( GetFont() );
dc.GetTextExtent( GetItemText( aLine, 0 ) + " ", &w, NULL );
dc.GetTextExtent( GetItemText( aLine, 0 ) + " ", &w, nullptr );
newWidth += w;
if( newWidth > columnWidth )
@ -95,16 +85,12 @@ void ITEMS_LISTBOX_BASE::UpdateLineWidth( unsigned aLine )
}
/*
* Return an index for the selected item
*/
int ITEMS_LISTBOX_BASE::GetSelection()
{
return GetFirstSelected();
}
/* Removes all selection in list
*/
void ITEMS_LISTBOX_BASE::DeselectAll()
{
for( int i = 0; i < GetItemCount(); i++ )

View File

@ -35,6 +35,9 @@ class FOOTPRINT_LIST;
#define LISTBOX_STYLE ( wxBORDER_NONE | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
wxVSCROLL | wxHSCROLL )
/**
* Base class to display symbol and footprint lists.
*/
class ITEMS_LISTBOX_BASE : public wxListView
{
public:
@ -48,10 +51,10 @@ public:
* @return the index of the selected item in lists allowing only one item selected
* and the index of the first selected item in lists allowing many selection
*/
int GetSelection();
int GetSelection();
/**
* Removes all selection in lists which can have more than one item selected
* Remove all selection in lists which can have more than one item selected.
*/
void DeselectAll();
@ -67,6 +70,11 @@ public:
void UpdateWidth( int aLine = -1 );
private:
/**
* Calculate the width of the given line, and increase the column width
* if needed. This is effectively the wxListCtrl code for autosizing.
* NB. it relies on the caller checking the given line number is valid.
*/
void UpdateLineWidth( unsigned aLine );
int columnWidth;
@ -154,7 +162,7 @@ public:
/**
* Called on a key press.
*
* Call default handler for some special keys, and for "ascii" keys, select the first
* Call default handler for some special keys, and for "ASCII" keys, select the first
* footprint that the name starts by the letter.
*
* This is the default behavior of a listbox, but because we use virtual lists, the
@ -199,7 +207,7 @@ public:
/**
* Called on a key press.
*
* Call default handler for some special keys, and for "ascii" keys, select the first
* Call default handler for some special keys, and for "ASCII" keys, select the first
* component that the name starts by the letter.
*
* This is the default behavior of a listbox, but because we use virtual lists, the

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -34,9 +34,13 @@
#include <fp_conflict_assignment_selector.h>
/// Return true if the resultant LIB_ID has a certain nickname. The guess
/// is only made if this footprint resides in only one library.
/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches
/**
* Return true if the resultant LIB_ID has a certain nickname.
*
* The guess is only made if this footprint resides in only one library.
*
* @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches.
*/
static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
{
if( aFootprintId->GetLibNickname().size() )
@ -83,7 +87,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
ReadSchematicNetlist( aNetlist );
if( m_symbolsListBox == NULL )
if( m_symbolsListBox == nullptr )
return false;
wxSafeYield();
@ -182,7 +186,9 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
dlg.ShowModal();
#else
dlg.Fit();
dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working.
// Modeless lets user watch while fixing the problems, but its not working.
dlg.Show( true );
#endif
}
}
@ -195,7 +201,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
if( component->GetFPID().IsLegacy() )
{
component->SetFPID( LIB_ID() /* empty */ );
component->SetFPID( LIB_ID() );
m_modified = true;
}
}
@ -239,7 +245,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
if( dlg.ShowModal() == wxID_OK )
{
// Update the fp selection:
for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
{

View File

@ -333,7 +333,7 @@ bool SCH_EDIT_FRAME::BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen )
SCH_LINE* wire = static_cast<SCH_LINE*>( item );
if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), aPoint )
&& !wire->IsEndPoint( aPoint ) )
&& !wire->IsEndPoint( aPoint ) )
{
wires.push_back( wire );
}
@ -341,7 +341,7 @@ bool SCH_EDIT_FRAME::BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen )
}
for( SCH_LINE* wire : wires )
brokenSegments |= BreakSegment( wire, aPoint, NULL, aScreen );
brokenSegments |= BreakSegment( wire, aPoint, nullptr, aScreen );
return brokenSegments;
}
@ -438,7 +438,6 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
SaveCopyInUndoList( undoList, UNDO_REDO::DELETED, aAppend );
for( SCH_LINE* line : lines )
{
if( line->GetEditFlags() & STRUCT_DELETED )

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software; you can redistribute it and/or
@ -32,7 +33,7 @@ class SCH_SCREEN;
class BUS_ALIAS
{
public:
BUS_ALIAS( SCH_SCREEN* aParent = NULL );
BUS_ALIAS( SCH_SCREEN* aParent = nullptr );
~BUS_ALIAS();

View File

@ -310,6 +310,7 @@ wxString buildFullReference( const SCH_REFERENCE& aItem, int aUnitNumber = -1 )
return fullref;
}
void SCH_REFERENCE_LIST::ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditionalReferences )
{
SplitReferences();
@ -348,7 +349,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
// The algorithm tries to allocate the new reference to symbols having the same
// old reference.
// This algo works fine as long as the previous annotation has no duplicates.
// But when a hierarchy is reannotated with this option, the previous anotation can
// But when a hierarchy is reannotated with this option, the previous annotation can
// have duplicate references, and obviously we must fix these duplicate.
// therefore do not try to allocate a full reference more than once when trying
// to keep this order of multi units.
@ -402,7 +403,8 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
continue;
// Check whether this symbol is in aLockedUnitMap.
SCH_REFERENCE_LIST* lockedList = NULL;
SCH_REFERENCE_LIST* lockedList = nullptr;
for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : aLockedUnitMap )
{
unsigned n_refs = pair.second.GetCount();
@ -417,7 +419,9 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
break;
}
}
if( lockedList != NULL ) break;
if( lockedList != nullptr )
break;
}
if( ( flatList[first].CompareRef( ref_unit ) != 0 )
@ -469,7 +473,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
// If this symbol is in aLockedUnitMap, copy the annotation to all
// symbols that are not it
if( lockedList != NULL )
if( lockedList != nullptr )
{
unsigned n_refs = lockedList->GetCount();
@ -583,7 +587,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
SortByRefAndValue();
// Spiit reference designators into name (prefix) and number: IC1 becomes IC, and 1.
// Split reference designators into name (prefix) and number: IC1 becomes IC, and 1.
SplitReferences();
// count not yet annotated items or annotation error.
@ -608,9 +612,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
else
{
msg.Printf( _( "Item not annotated: %s%s\n" ),
flatList[ii].GetRef(),
tmp );
msg.Printf( _( "Item not annotated: %s%s\n" ), flatList[ii].GetRef(), tmp );
}
aHandler( ERCE_UNANNOTATED, msg, &flatList[ii], nullptr );
@ -672,9 +674,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
else
{
msg.Printf( _( "Duplicate items %s%s\n" ),
flatList[ii].GetRef(),
tmp );
msg.Printf( _( "Duplicate items %s%s\n" ), flatList[ii].GetRef(), tmp );
}
aHandler( ERCE_DUPLICATE_REFERENCE, msg, &flatList[ii], &flatList[ii+1] );
@ -702,9 +702,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
else
{
msg.Printf( _( "Duplicate items %s%s\n" ),
flatList[ii].GetRef(),
tmp );
msg.Printf( _( "Duplicate items %s%s\n" ), flatList[ii].GetRef(), tmp );
}
aHandler( ERCE_DUPLICATE_REFERENCE, msg, &flatList[ii], &flatList[ii+1] );
@ -738,7 +736,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
const SCH_SHEET_PATH& aSheetPath )
{
wxASSERT( aSymbol != NULL );
wxASSERT( aSymbol != nullptr );
m_rootSymbol = aSymbol;
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software: you can redistribute it and/or modify it
@ -104,8 +105,8 @@ DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER( SCH_EDIT_FRAME* aParent )
wxDefaultPosition, wxDefaultSize,
wxALIGN_LEFT );
m_signal_edit = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_signal_edit = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_PROCESS_ENTER );
auto right_button_sizer = new wxBoxSizer( wxHORIZONTAL );
@ -146,31 +147,31 @@ DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER( SCH_EDIT_FRAME* aParent )
Bind( wxEVT_INIT_DIALOG, &DIALOG_BUS_MANAGER::OnInitDialog, this );
m_bus_list_view->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED,
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectBus ), NULL, this );
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectBus ), nullptr, this );
m_bus_list_view->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED,
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectBus ), NULL, this );
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectBus ), nullptr, this );
m_signal_list_view->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED,
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectSignal ), NULL, this );
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectSignal ), nullptr, this );
m_signal_list_view->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED,
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectSignal ), NULL, this );
wxListEventHandler( DIALOG_BUS_MANAGER::OnSelectSignal ), nullptr, this );
m_btn_add_bus->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddBus ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddBus ), nullptr, this );
m_btn_rename_bus->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRenameBus ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRenameBus ), nullptr, this );
m_btn_remove_bus->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRemoveBus ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRemoveBus ), nullptr, this );
m_signal_edit->Connect( wxEVT_TEXT_ENTER,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddSignal ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddSignal ), nullptr, this );
m_btn_add_signal->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddSignal ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddSignal ), nullptr, this );
m_btn_rename_signal->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRenameSignal ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRenameSignal ), nullptr, this );
m_btn_remove_signal->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRemoveSignal ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnRemoveSignal ), nullptr, this );
m_bus_edit->Connect( wxEVT_TEXT_ENTER,
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddBus ), NULL, this );
wxCommandEventHandler( DIALOG_BUS_MANAGER::OnAddBus ), nullptr, this );
// Set initial UI state
@ -204,7 +205,7 @@ bool DIALOG_BUS_MANAGER::TransferDataToWindow()
std::vector< std::shared_ptr<BUS_ALIAS> > original_aliases;
// collect aliases from each open sheet
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
{
std::unordered_set<std::shared_ptr<BUS_ALIAS>> sheet_aliases = screen->GetBusAliases();
original_aliases.insert( original_aliases.end(), sheet_aliases.begin(),
@ -298,7 +299,7 @@ void DIALOG_BUS_MANAGER::OnSelectBus( wxListEvent& event )
}
else
{
m_active_alias = NULL;
m_active_alias = nullptr;
m_bus_edit->Clear();
m_signal_edit->Clear();
m_signal_list_view->DeleteAllItems();
@ -402,7 +403,7 @@ void DIALOG_BUS_MANAGER::OnRemoveBus( wxCommandEvent& aEvent )
m_aliases.erase( m_aliases.begin() + i );
m_bus_edit->Clear();
m_active_alias = NULL;
m_active_alias = nullptr;
auto evt = wxListEvent( wxEVT_COMMAND_LIST_ITEM_DESELECTED );
OnSelectBus( evt );

View File

@ -96,7 +96,7 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
m_hsplitter = new wxSplitterWindow( m_vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxSP_LIVE_UPDATE | wxSP_NOBORDER | wxSP_3DSASH );
//Avoid the splitter window being assigned as the Parent to additional windows
// Avoid the splitter window being assigned as the parent to additional windows.
m_vsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
@ -219,7 +219,7 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
if( m_details )
{
m_details->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ),
NULL, this );
nullptr, this );
}
}
@ -250,7 +250,8 @@ DIALOG_CHOOSE_SYMBOL::~DIALOG_CHOOSE_SYMBOL()
if( m_details )
{
m_details->Disconnect( wxEVT_CHAR_HOOK,
wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), NULL, this );
wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), nullptr,
this );
}
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )

View File

@ -475,7 +475,7 @@ SCH_EDIT_FRAME* DIALOG_EDIT_SYMBOLS_LIBID::GetParent()
void DIALOG_EDIT_SYMBOLS_LIBID::AddRowToGrid( bool aMarkRow, const wxString& aReferences,
const wxString& aStrLibId )
const wxString& aStrLibId )
{
int row = m_grid->GetNumberRows();
@ -634,8 +634,9 @@ void DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton( wxCommandEvent& event )
m_grid->GetCellValue( grid_row_idx, COL_CURR_LIBID ) );
wxSingleChoiceDialog dlg ( this, msg,
wxString::Format( _( "Candidates count %d " ), libIdCandidateCount ),
candidateSymbNames );
wxString::Format( _( "Candidates count %d " ),
libIdCandidateCount ),
candidateSymbNames );
if( dlg.ShowModal() == wxID_OK )
m_grid->SetCellValue( grid_row_idx, COL_NEW_LIBID, dlg.GetStringSelection() );
@ -649,7 +650,9 @@ void DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton( wxCommandEvent& event )
(unsigned) m_OrphansRowIndexes.size() - fixesCount ) );
}
else
{
wxMessageBox( wxString::Format( _( "All %u link(s) resolved" ), fixesCount ) );
}
}
@ -658,7 +661,7 @@ bool DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser( int aRow )
#if 0
// Use dialog symbol selector to choose a symbol
SCH_BASE_FRAME::HISTORY_LIST dummy;
SCH_BASE_FRAME::PICKED_SYMBOL sel = m_frame->SelectComponentFromLibrary( NULL, dummy, true,
SCH_BASE_FRAME::PICKED_SYMBOL sel = m_frame->SelectComponentFromLibrary( nullptr, dummy, true,
0, 0, false );
#else
// Use library viewer to choose a symbol
@ -671,7 +674,7 @@ bool DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser( int aRow )
if( !current.IsEmpty() )
preselected.Parse( current, true );
PICKED_SYMBOL sel = GetParent()->PickSymbolFromLibBrowser( this, NULL, preselected, 0, 0 );
PICKED_SYMBOL sel = GetParent()->PickSymbolFromLibBrowser( this, nullptr, preselected, 0, 0 );
#endif
if( sel.LibId.empty() ) // command aborted
@ -764,7 +767,7 @@ bool DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow()
false, /* update ref */
false, /* update other fields */
false, /* reset ref */
true /* reset other fields */ );
true /* reset other fields */ );
}
}
}
@ -829,8 +832,8 @@ bool InvokeDialogEditSymbolsLibId( SCH_EDIT_FRAME* aCaller )
// quasimodal mode for the quasimodal frame support to work. So don't use
// the QUASIMODAL macros here.
DIALOG_EDIT_SYMBOLS_LIBID dlg( aCaller );
// DO NOT use ShowModal() here, otherwise the library browser will not work
// properly.
// DO NOT use ShowModal() here, otherwise the library browser will not work properly.
dlg.ShowQuasiModal();
return dlg.IsSchematicModified();

View File

@ -103,7 +103,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
// wxFormBuilder doesn't include this event...
m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging ),
NULL, this );
nullptr, this );
if( m_lastLayout != DIALOG_LIB_SYMBOL_PROPERTIES::NONE )
{
@ -137,7 +137,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::~DIALOG_LIB_SYMBOL_PROPERTIES()
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging ),
NULL, this );
nullptr, this );
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
@ -171,7 +171,8 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
m_DescCtrl->ChangeValue( m_libEntry->GetDescription() );
m_KeywordCtrl->ChangeValue( m_libEntry->GetKeyWords() );
m_SelNumberOfUnits->SetValue( m_libEntry->GetUnitCount() );
m_OptionPartsInterchangeable->SetValue( !m_libEntry->UnitsLocked() || m_libEntry->GetUnitCount() == 1 );
m_OptionPartsInterchangeable->SetValue( !m_libEntry->UnitsLocked() ||
m_libEntry->GetUnitCount() == 1 );
m_AsConvertButt->SetValue( m_libEntry->HasConversion() );
m_OptionPower->SetValue( m_libEntry->IsPower() );
m_excludeFromBomCheckBox->SetValue( !m_libEntry->GetIncludeInBom() );
@ -563,7 +564,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveDown( wxCommandEvent& event )
m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
}
else
{
wxBell();
}
}
@ -596,7 +599,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
}
void DIALOG_LIB_SYMBOL_PROPERTIES::OnFilterDClick( wxMouseEvent& event)
void DIALOG_LIB_SYMBOL_PROPERTIES::OnFilterDClick( wxMouseEvent& event )
{
int idx = m_FootprintFilterListBox->HitTest( event.GetPosition() );
wxCommandEvent dummy;

View File

@ -217,9 +217,9 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& ti
{
m_IdNetType = id_NetType;
m_pageNetFmtName = title;
m_CommandStringCtrl = NULL;
m_TitleStringCtrl = NULL;
m_AdjustPassiveValues = NULL;
m_CommandStringCtrl = nullptr;
m_TitleStringCtrl = nullptr;
m_AdjustPassiveValues = nullptr;
wxString netfmtName = static_cast<NETLIST_DIALOG*>( parent->GetParent() )->m_DefaultNetFmtName;
@ -254,7 +254,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
m_DefaultNetFmtName = settings.m_NetFormatName;
for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
page = NULL;
page = nullptr;
// Add notebook pages:
m_PanelNetType[PANELPCBNEW] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "KiCad" ),
@ -334,7 +334,7 @@ void NETLIST_DIALOG::InstallPageSpice()
wxStaticText* spice_label = new wxStaticText( page, -1, _( "External simulator command:" ) );
spice_label->SetToolTip( _( "Enter the command line to run spice\n"
"Usually <path to spice binary> %I\n"
"%I will be replaced by the actual spice netlist name") );
"%I will be replaced by the actual spice netlist name" ) );
page->m_LowBoxSizer->Add( spice_label, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
page->m_CommandStringCtrl = new wxTextCtrl( page, -1, simulatorCommand,
@ -415,7 +415,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
{
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( currPage == NULL )
if( currPage == nullptr )
return;
m_DefaultNetFmtName = currPage->GetPageNetFmtName();
@ -496,7 +496,7 @@ bool NETLIST_DIALOG::TransferDataFromWindow()
wxString fullname = fn.GetFullName();
wxString path = fn.GetPath();
// fullname does not and should not include the path, per wx docs.
// full name does not and should not include the path, per wx docs.
wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
@ -578,7 +578,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup()
{
NETLIST_PAGE_DIALOG* currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if( currPage == NULL )
if( currPage == nullptr )
break;
wxString title = currPage->m_TitleStringCtrl->GetValue();
@ -626,7 +626,7 @@ void NETLIST_DIALOG::OnAddGenerator( wxCommandEvent& event )
netTypeId = PANELCUSTOMBASE + ii;
currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
if( currPage == NULL )
if( currPage == nullptr )
break;
if( currPage->GetPageNetFmtName() == title )

View File

@ -37,6 +37,7 @@
#include <wx/print.h>
#include <wx/printdlg.h>
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{
public:
@ -70,7 +71,7 @@ public:
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) :
wxPrintout( aTitle )
{
wxASSERT( aParent != NULL );
wxASSERT( aParent != nullptr );
m_parent = aParent;
}
@ -336,6 +337,7 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow()
m_parent->GetPageSetupData() = printer.GetPrintDialogData().GetPrintData();
}
}
Pgm().m_Printing = false;
return true;
@ -349,7 +351,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
wxT( "Cannot print invalid page number." ) );
wxCHECK_MSG( sheetList[ page - 1].LastScreen() != NULL, false,
wxCHECK_MSG( sheetList[ page - 1].LastScreen() != nullptr, false,
wxT( "Cannot print page with NULL screen." ) );
wxString msg;

View File

@ -81,7 +81,8 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
// Connect Events
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED,
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), NULL, this );
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), nullptr,
this );
if( Prj().IsReadOnly() )
{
@ -96,7 +97,8 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
DIALOG_SCHEMATIC_SETUP::~DIALOG_SCHEMATIC_SETUP()
{
m_treebook->Disconnect( wxEVT_TREEBOOK_PAGE_CHANGED,
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), NULL, this );
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), nullptr,
this );
}

View File

@ -247,21 +247,19 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
switch( m_pasType->GetSelection() )
{
case 0: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_RESISTOR; break;
case 1: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_CAPACITOR; break;
case 2: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_INDUCTOR; break;
case 0: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_RESISTOR; break;
case 1: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_CAPACITOR; break;
case 2: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_INDUCTOR; break;
default:
wxASSERT_MSG( false, "Unhandled passive type" );
return false;
break;
default:
wxASSERT_MSG( false, "Unhandled passive type" );
return false;
break;
}
m_fieldsTmp[SF_MODEL] = m_pasValue->GetValue();
}
// Model
else if( page == m_model )
else if( page == m_model ) // Model
{
if( !m_model->Validate() )
return false;
@ -656,7 +654,7 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
}
bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget )
{
wxString acdc, trans;
wxWindow* page = m_powerNotebook->GetCurrentPage();
@ -677,7 +675,7 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
}
catch( ... )
{
DisplayError( NULL, wxT( "Invalid DC value" ) );
DisplayError( this, wxT( "Invalid DC value" ) );
return false;
}
@ -695,7 +693,7 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
}
catch( ... )
{
DisplayError( NULL, wxT( "Invalid AC magnitude or phase" ) );
DisplayError( this, wxT( "Invalid AC magnitude or phase" ) );
return false;
}
@ -839,6 +837,7 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath )
{
//First, expand env vars, if any
wxString libname = ExpandEnvVarSubstitutions( aFilePath, &Prj() );
// Make path absolute, especially if it is relative to the project path
libname = Prj().AbsolutePath( libname );
@ -848,7 +847,7 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath )
bool in_subckt = false; // flag indicating that the parser is inside a .subckt section
if( !filePath.Exists() )
return;
return;
// Display the library contents
wxWindowUpdateLocker updateLock( this );
@ -889,7 +888,6 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath )
if( type != SP_UNKNOWN )
m_models.emplace( name, MODEL( line_nr, type ) );
}
else if( token == ".subckt" )
{
wxASSERT( !in_subckt );
@ -902,7 +900,6 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath )
m_models.emplace( name, MODEL( line_nr, SP_SUBCKT ) );
}
else if( token == ".ends" )
{
wxASSERT( in_subckt );
@ -944,9 +941,10 @@ SCH_FIELD& DIALOG_SPICE_MODEL::getSchField( int aFieldType )
NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) aFieldType );
auto fieldIt = std::find_if( m_schfields->begin(), m_schfields->end(),
[&]( const SCH_FIELD& f ) {
return f.GetName() == spiceField;
} );
[&]( const SCH_FIELD& f )
{
return f.GetName() == spiceField;
} );
// Found one, so return it
if( fieldIt != m_schfields->end() )
@ -1014,6 +1012,7 @@ void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event )
{
//First, expand env vars, if any, in lib path
wxString libname = ExpandEnvVarSubstitutions( m_modelLibrary->GetValue(), &Prj() );
// Make path absolute, especially if it is relative to the project path
libname = Prj().AbsolutePath( libname );
@ -1024,7 +1023,7 @@ void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event )
wxString wildcards = SpiceLibraryFileWildcard() + "|" + AllFilesWildcard();
wxFileDialog openDlg( this, _( "Select library" ), searchPath, "", wildcards,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( openDlg.ShowModal() == wxID_CANCEL )
return;

View File

@ -62,7 +62,7 @@ private:
* @param aTarget is the destination for the generated string.
* @return True if the string was saved successfully.
*/
bool generatePowerSource( wxString& aTarget ) const;
bool generatePowerSource( wxString& aTarget );
/**
* Load a list of components (.model and .subckt) from a spice library file and add them to

View File

@ -101,8 +101,10 @@ protected:
if( event.GetId() == MYID_SELECT_FOOTPRINT )
{
// pick a footprint using the footprint picker.
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD );
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true, m_dlg );
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
FOOTPRINT_FIELD );
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true,
m_dlg );
if( frame->ShowModal( &fpid, m_dlg ) )
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
@ -111,7 +113,8 @@ protected:
}
else if (event.GetId() == MYID_SHOW_DATASHEET )
{
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET_FIELD );
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
DATASHEET_FIELD );
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
}
else
@ -816,7 +819,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
// Connect Events
m_grid->Connect( wxEVT_GRID_COL_SORT,
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColSort ), NULL, this );
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColSort ), nullptr, this );
}
@ -824,7 +827,8 @@ DIALOG_SYMBOL_FIELDS_TABLE::~DIALOG_SYMBOL_FIELDS_TABLE()
{
// Disconnect Events
m_grid->Disconnect( wxEVT_GRID_COL_SORT,
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColSort ), NULL, this );
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColSort ), nullptr,
this );
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
@ -934,10 +938,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::AddField( const wxString& aDisplayName,
}
/**
* Constructs the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all
* field names in use.
*/
void DIALOG_SYMBOL_FIELDS_TABLE::LoadFieldNames()
{
std::set<wxString> userFieldNames;

View File

@ -46,6 +46,11 @@ public:
private:
void AddField( const wxString& displayName, const wxString& aCanonicalName, bool defaultShow,
bool defaultSortBy );
/**
* Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all
* field names in use.
*/
void LoadFieldNames();
void OnColSort( wxGridEvent& aEvent );

View File

@ -121,7 +121,7 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
}
createProjectSymbolLibTable( m_messagePanel->Reporter() );
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
Prj().SchSymbolLibTable();
remapSymbolsToLibTable( m_messagePanel->Reporter() );
@ -133,7 +133,7 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
// Reload the cache symbol library.
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, NULL );
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
Prj().SchLibs();
Raise();
@ -283,7 +283,7 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
{
wxCHECK_MSG( aSymbol != NULL, false, "Null pointer passed to remapSymbolToLibTable." );
wxCHECK_MSG( aSymbol != nullptr, false, "Null pointer passed to remapSymbolToLibTable." );
wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,
"Cannot remap symbol that is already mapped." );
wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,

Some files were not shown because too many files have changed in this diff Show More