More NULL expunging.
This commit is contained in:
parent
d1c9572bcc
commit
cb72da294a
|
@ -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" ) );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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++ )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++ )
|
||||
{
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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() ) )
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -215,8 +215,8 @@ bool EE_COLLECTOR::IsCorner() const
|
|||
if( GetCount() != 2 )
|
||||
return false;
|
||||
|
||||
bool is_busentry0 = ( dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_list[0] ) != NULL);
|
||||
bool is_busentry1 = ( dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_list[1] ) != NULL);
|
||||
bool is_busentry0 = ( dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_list[0] ) != nullptr );
|
||||
bool is_busentry1 = ( dynamic_cast<SCH_BUS_ENTRY_BASE*>( m_list[1] ) != nullptr );
|
||||
|
||||
if(( m_list[0]->Type() == SCH_LINE_T) && ( m_list[1]->Type() == SCH_LINE_T) )
|
||||
return ( ( SCH_LINE* ) m_list[0])->GetLayer() == ( ( SCH_LINE* ) m_list[1])->GetLayer();
|
||||
|
|
|
@ -36,9 +36,6 @@ class SCH_SHEET_PATH;
|
|||
class SCH_SYMBOL;
|
||||
|
||||
|
||||
/**
|
||||
* EE_COLLECTOR
|
||||
*/
|
||||
class EE_COLLECTOR : public COLLECTOR
|
||||
{
|
||||
public:
|
||||
|
@ -68,7 +65,7 @@ public:
|
|||
if( (unsigned)aIndex < (unsigned)GetCount() )
|
||||
return (SCH_ITEM*) m_list[ aIndex ];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SEARCH_RESULT Inspect( EDA_ITEM* aItem, void* aTestData ) override;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include <connection_graph.h>
|
||||
|
||||
// The main sheet of the project
|
||||
SCH_SHEET* g_RootSheet = NULL;
|
||||
SCH_SHEET* g_RootSheet = nullptr;
|
||||
|
||||
// a transform matrix, to display symbols in lib editor
|
||||
TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 );
|
||||
|
@ -123,7 +123,8 @@ 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 )
|
||||
{
|
||||
|
@ -167,17 +168,19 @@ static struct IFACE : public KIFACE_I
|
|||
return nullptr;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
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 know type.
|
||||
*/
|
||||
void* IfaceOrAddress( int aDataId ) override
|
||||
{
|
||||
|
@ -186,11 +189,11 @@ static struct IFACE : public KIFACE_I
|
|||
case KIFACE_NETLIST_SCHEMATIC:
|
||||
return (void*) generateSchematicNetlist;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SaveFileAs
|
||||
* Saving a file under a different name is delegated to the various KIFACEs because
|
||||
* the project doesn't know the internal format of the various files (which may have
|
||||
* paths in them that need updating).
|
||||
|
@ -247,7 +250,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
|||
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG fpDialog( NULL );
|
||||
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG fpDialog( nullptr );
|
||||
|
||||
fpDialog.ShowModal();
|
||||
}
|
||||
|
@ -271,7 +274,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
|||
"Please edit this global symbol library table in Preferences menu."
|
||||
);
|
||||
|
||||
DisplayErrorMessage( NULL, msg, ioe.What() );
|
||||
DisplayErrorMessage( nullptr, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,6 +287,7 @@ void IFACE::OnKifaceEnd()
|
|||
end_common();
|
||||
}
|
||||
|
||||
|
||||
static void traverseSEXPR( SEXPR::SEXPR* aNode,
|
||||
const std::function<void( SEXPR::SEXPR* )>& aVisitor )
|
||||
{
|
||||
|
@ -311,8 +315,10 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
|
||||
destFile.SetPath( destPath );
|
||||
|
||||
if( ext == LegacySchematicFileExtension || ext == LegacySchematicFileExtension + BackupFileSuffix ||
|
||||
ext == KiCadSchematicFileExtension || ext == KiCadSchematicFileExtension + BackupFileSuffix )
|
||||
if( ext == LegacySchematicFileExtension ||
|
||||
ext == LegacySchematicFileExtension + BackupFileSuffix ||
|
||||
ext == KiCadSchematicFileExtension ||
|
||||
ext == KiCadSchematicFileExtension + BackupFileSuffix )
|
||||
{
|
||||
if( destFile.GetName() == aProjectName )
|
||||
destFile.SetName( aNewProjectName );
|
||||
|
@ -416,7 +422,8 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
wxString uri = row.GetFullURI();
|
||||
|
||||
uri.Replace( "/" + aProjectName + "-cache.lib", "/" + aNewProjectName + "-cache.lib" );
|
||||
uri.Replace( "/" + aProjectName + "-rescue.lib", "/" + aNewProjectName + "-rescue.lib" );
|
||||
uri.Replace( "/" + aProjectName + "-rescue.lib", "/" + aNewProjectName +
|
||||
"-rescue.lib" );
|
||||
uri.Replace( "/" + aProjectName + ".lib", "/" + aNewProjectName + ".lib" );
|
||||
|
||||
row.SetFullURI( uri );
|
||||
|
|
|
@ -139,7 +139,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
|
|||
|
||||
void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
// For now, axes are forced off in eeschema even if turned on in config
|
||||
// For now, axes are forced off in Eeschema even if turned on in config
|
||||
eeconfig()->m_Window.grid.axes_enabled = false;
|
||||
|
||||
SCH_BASE_FRAME::LoadSettings( eeconfig() );
|
||||
|
@ -270,7 +270,7 @@ SYMBOL_LIB_TABLE* PROJECT::SchSymbolLibTable()
|
|||
wxString msg;
|
||||
msg.Printf( _( "Error loading the symbol library table '%s'." ),
|
||||
fn.GetFullPath() );
|
||||
DisplayErrorMessage( NULL, msg, ioe.What() );
|
||||
DisplayErrorMessage( nullptr, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ int ERC_TESTER::TestConflictingBusAliases()
|
|||
SCH_SCREENS screens( m_schematic->Root() );
|
||||
std::vector< std::shared_ptr<BUS_ALIAS> > aliases;
|
||||
|
||||
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> > screen_aliases = screen->GetBusAliases();
|
||||
|
||||
|
@ -682,7 +682,7 @@ int ERC_TESTER::TestLibSymbolIssues()
|
|||
|
||||
SCH_SCREENS screens( m_schematic->Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||
{
|
||||
std::vector<SCH_MARKER*> markers;
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ void LIB_ARC::MirrorHorizontal( const wxPoint& aCenter )
|
|||
std::swap( m_t1, m_t2 );
|
||||
m_t1 = 1800 - m_t1;
|
||||
m_t2 = 1800 - m_t2;
|
||||
|
||||
if( m_t1 > 3600 || m_t2 > 3600 )
|
||||
{
|
||||
m_t1 -= 3600;
|
||||
|
@ -201,6 +202,7 @@ void LIB_ARC::MirrorHorizontal( const wxPoint& aCenter )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_ARC::MirrorVertical( const wxPoint& aCenter )
|
||||
{
|
||||
m_Pos.y -= aCenter.y;
|
||||
|
@ -216,6 +218,7 @@ void LIB_ARC::MirrorVertical( const wxPoint& aCenter )
|
|||
std::swap( m_t1, m_t2 );
|
||||
m_t1 = - m_t1;
|
||||
m_t2 = - m_t2;
|
||||
|
||||
if( m_t1 > 3600 || m_t2 > 3600 )
|
||||
{
|
||||
m_t1 -= 3600;
|
||||
|
@ -228,6 +231,7 @@ void LIB_ARC::MirrorVertical( const wxPoint& aCenter )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
{
|
||||
int rot_angle = aRotateCCW ? -900 : 900;
|
||||
|
@ -236,6 +240,7 @@ void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
|||
RotatePoint( &m_ArcEnd, aCenter, rot_angle );
|
||||
m_t1 -= rot_angle;
|
||||
m_t2 -= rot_angle;
|
||||
|
||||
if( m_t1 > 3600 || m_t2 > 3600 )
|
||||
{
|
||||
m_t1 -= 3600;
|
||||
|
@ -249,11 +254,10 @@ void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
|||
}
|
||||
|
||||
|
||||
|
||||
void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
int t1 = m_t1;
|
||||
int t2 = m_t2;
|
||||
|
@ -541,7 +545,7 @@ void LIB_ARC::CalcRadiusAngles()
|
|||
|
||||
m_Radius = KiROUND( EuclideanNorm( centerStartVector ) );
|
||||
|
||||
// Angles in eeschema are still integers
|
||||
// Angles in Eeschema are still integers
|
||||
m_t1 = KiROUND( ArcTangente( centerStartVector.y, centerStartVector.x ) );
|
||||
m_t2 = KiROUND( ArcTangente( centerEndVector.y, centerEndVector.x ) );
|
||||
|
||||
|
@ -550,18 +554,18 @@ void LIB_ARC::CalcRadiusAngles()
|
|||
|
||||
// Restrict angle to less than 180 to avoid PBS display mirror Trace because it is
|
||||
// assumed that the arc is less than 180 deg to find orientation after rotate or mirror.
|
||||
if( (m_t2 - m_t1) > 1800 )
|
||||
if( ( m_t2 - m_t1 ) > 1800 )
|
||||
m_t2 -= 3600;
|
||||
else if( (m_t2 - m_t1) <= -1800 )
|
||||
else if( ( m_t2 - m_t1 ) <= -1800 )
|
||||
m_t2 += 3600;
|
||||
|
||||
while( (m_t2 - m_t1) >= 1800 )
|
||||
while( ( m_t2 - m_t1 ) >= 1800 )
|
||||
{
|
||||
m_t2--;
|
||||
m_t1++;
|
||||
}
|
||||
|
||||
while( (m_t1 - m_t2) >= 1800 )
|
||||
while( ( m_t1 - m_t2 ) >= 1800 )
|
||||
{
|
||||
m_t2++;
|
||||
m_t1--;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
|
@ -97,6 +97,7 @@ void LIB_BEZIER::MoveTo( const wxPoint& aPosition )
|
|||
Offset( aPosition - m_PolyPoints[ 0 ] );
|
||||
}
|
||||
|
||||
|
||||
const wxPoint LIB_BEZIER::GetOffset() const
|
||||
{
|
||||
if ( !m_PolyPoints.size() )
|
||||
|
@ -105,6 +106,7 @@ const wxPoint LIB_BEZIER::GetOffset() const
|
|||
return m_PolyPoints[0];
|
||||
}
|
||||
|
||||
|
||||
void LIB_BEZIER::MirrorHorizontal( const wxPoint& aCenter )
|
||||
{
|
||||
size_t i, imax = m_PolyPoints.size();
|
||||
|
@ -126,6 +128,7 @@ void LIB_BEZIER::MirrorHorizontal( const wxPoint& aCenter )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_BEZIER::MirrorVertical( const wxPoint& aCenter )
|
||||
{
|
||||
size_t i, imax = m_PolyPoints.size();
|
||||
|
@ -147,6 +150,7 @@ void LIB_BEZIER::MirrorVertical( const wxPoint& aCenter )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_BEZIER::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
{
|
||||
int rot_angle = aRotateCCW ? -900 : 900;
|
||||
|
@ -162,7 +166,7 @@ void LIB_BEZIER::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
|||
void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
static std::vector< wxPoint > cornerList;
|
||||
cornerList.clear();
|
||||
|
|
|
@ -48,14 +48,14 @@ LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int idfield ) :
|
|||
|
||||
|
||||
LIB_FIELD::LIB_FIELD( int idfield ) :
|
||||
LIB_ITEM( LIB_FIELD_T, NULL )
|
||||
LIB_ITEM( LIB_FIELD_T, nullptr )
|
||||
{
|
||||
Init( idfield );
|
||||
}
|
||||
|
||||
|
||||
LIB_FIELD::LIB_FIELD( int aID, const wxString& aName ) :
|
||||
LIB_ITEM( LIB_FIELD_T, NULL )
|
||||
LIB_ITEM( LIB_FIELD_T, nullptr )
|
||||
{
|
||||
Init( aID );
|
||||
m_name = aName;
|
||||
|
@ -402,9 +402,7 @@ void LIB_FIELD::SetName( const wxString& aName )
|
|||
|
||||
wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'",
|
||||
GetName(),
|
||||
ShortenedShownText() );
|
||||
return wxString::Format( "%s '%s'", GetName(), ShortenedShownText() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void LIB_POLYLINE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
|||
void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
static std::vector< wxPoint > cornerList;
|
||||
cornerList.clear();
|
||||
|
@ -348,8 +348,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aLi
|
|||
|
||||
wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Polyline, %d points" ),
|
||||
int( m_PolyPoints.size() ) );
|
||||
return wxString::Format( _( "Polyline, %d points" ), int( m_PolyPoints.size() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void LIB_RECTANGLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
|||
void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
wxPoint end = aTransform.TransformCoordinate( m_End ) + aOffset;
|
||||
|
|
|
@ -530,7 +530,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
}
|
||||
else if( drawItem.Type() == LIB_FIELD_T )
|
||||
{
|
||||
drawItem.Print( aSettings, aOffset, (void*) NULL, aOpts.transform );
|
||||
drawItem.Print( aSettings, aOffset, (void*) nullptr, aOpts.transform );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
bool fill = aPlotter->GetColorMode();
|
||||
|
@ -590,7 +590,7 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint
|
|||
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||
const wxPoint& aOffset, const TRANSFORM& aTransform )
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
|
||||
bool fill = aPlotter->GetColorMode();
|
||||
|
@ -626,7 +626,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
|||
|
||||
void LIB_SYMBOL::RemoveDrawItem( LIB_ITEM* aItem )
|
||||
{
|
||||
wxASSERT( aItem != NULL );
|
||||
wxASSERT( aItem != nullptr );
|
||||
|
||||
// none of the MANDATORY_FIELDS may be removed in RAM, but they may be
|
||||
// omitted when saving to disk.
|
||||
|
@ -663,7 +663,7 @@ void LIB_SYMBOL::AddDrawItem( LIB_ITEM* aItem, bool aSort )
|
|||
|
||||
LIB_ITEM* LIB_SYMBOL::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
|
||||
{
|
||||
if( aItem == NULL )
|
||||
if( aItem == nullptr )
|
||||
{
|
||||
LIB_ITEMS_CONTAINER::ITERATOR it1 = m_drawings.begin( aType );
|
||||
|
||||
|
@ -686,7 +686,7 @@ LIB_ITEM* LIB_SYMBOL::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
|
|||
return &( *it );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -731,7 +731,7 @@ LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aConvert )
|
|||
return pinList[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -946,7 +946,7 @@ LIB_FIELD* LIB_SYMBOL::GetFieldById( int aId ) const
|
|||
return field;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -958,7 +958,7 @@ LIB_FIELD* LIB_SYMBOL::FindField( const wxString& aFieldName )
|
|||
return static_cast<LIB_FIELD*>( &item );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -970,14 +970,14 @@ const LIB_FIELD* LIB_SYMBOL::FindField( const wxString& aFieldName ) const
|
|||
return static_cast<const LIB_FIELD*>( &item );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
LIB_FIELD& LIB_SYMBOL::GetValueField()
|
||||
{
|
||||
LIB_FIELD* field = GetFieldById( VALUE_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
wxASSERT( field != nullptr );
|
||||
return *field;
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ LIB_FIELD& LIB_SYMBOL::GetValueField()
|
|||
LIB_FIELD& LIB_SYMBOL::GetReferenceField()
|
||||
{
|
||||
LIB_FIELD* field = GetFieldById( REFERENCE_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
wxASSERT( field != nullptr );
|
||||
return *field;
|
||||
}
|
||||
|
||||
|
@ -993,7 +993,7 @@ LIB_FIELD& LIB_SYMBOL::GetReferenceField()
|
|||
LIB_FIELD& LIB_SYMBOL::GetFootprintField()
|
||||
{
|
||||
LIB_FIELD* field = GetFieldById( FOOTPRINT_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
wxASSERT( field != nullptr );
|
||||
return *field;
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ LIB_FIELD& LIB_SYMBOL::GetFootprintField()
|
|||
LIB_FIELD& LIB_SYMBOL::GetDatasheetField()
|
||||
{
|
||||
LIB_FIELD* field = GetFieldById( DATASHEET_FIELD );
|
||||
wxASSERT( field != NULL );
|
||||
wxASSERT( field != nullptr );
|
||||
return *field;
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert,
|
|||
return &item;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
|
||||
SYMBOL_LIB* aLibrary = nullptr );
|
||||
|
||||
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = NULL );
|
||||
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr );
|
||||
|
||||
virtual ~LIB_SYMBOL();
|
||||
|
||||
|
@ -354,7 +354,7 @@ public:
|
|||
* if TYPE_NOT_INIT search for all items types
|
||||
* @return - The next drawing object in the list if found, otherwise NULL.
|
||||
*/
|
||||
LIB_ITEM* GetNextDrawItem( const LIB_ITEM* aItem = NULL, KICAD_T aType = TYPE_NOT_INIT );
|
||||
LIB_ITEM* GetNextDrawItem( const LIB_ITEM* aItem = nullptr, KICAD_T aType = TYPE_NOT_INIT );
|
||||
|
||||
size_t GetPinCount() const { return m_drawings.size( LIB_PIN_T ); }
|
||||
|
||||
|
@ -369,7 +369,7 @@ public:
|
|||
* first pin in the draw object list.
|
||||
* @return - The next pin object in the list if found, otherwise NULL.
|
||||
*/
|
||||
LIB_PIN* GetNextPin( LIB_PIN* aItem = NULL )
|
||||
LIB_PIN* GetNextPin( LIB_PIN* aItem = nullptr )
|
||||
{
|
||||
return (LIB_PIN*) GetNextDrawItem( (LIB_ITEM*) aItem, LIB_PIN_T );
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW )
|
|||
void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( plotter != NULL );
|
||||
wxASSERT( plotter != nullptr );
|
||||
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis
|
||||
|
|
|
@ -41,13 +41,13 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
{
|
||||
(void)aNetlistOptions; //unused
|
||||
int ret = 0;
|
||||
FILE* f = NULL;
|
||||
FILE* f = nullptr;
|
||||
|
||||
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL )
|
||||
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Failed to create file '%s'." ), aOutFileName );
|
||||
DisplayError( NULL, msg );
|
||||
DisplayError( nullptr, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2020 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,10 +31,7 @@
|
|||
#include <connection_graph.h>
|
||||
#include "netlist_exporter_kicad.h"
|
||||
|
||||
/**
|
||||
* Generate the KiCad netlist format supported by Pcbnew. It is basically the XML netlist
|
||||
* just formatted slightly different.
|
||||
*/
|
||||
|
||||
bool NETLIST_EXPORTER_KICAD::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
|
||||
{
|
||||
try
|
||||
|
@ -45,7 +42,7 @@ bool NETLIST_EXPORTER_KICAD::WriteNetlist( const wxString& aOutFileName, unsigne
|
|||
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( NULL, ioe.What() );
|
||||
DisplayError( nullptr, ioe.What() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ public:
|
|||
|
||||
/**
|
||||
* Write netlist to \a aOutFileName.
|
||||
*
|
||||
* Generate the KiCad netlist format supported by Pcbnew. It is basically the XML netlist
|
||||
* just formatted slightly different.
|
||||
*/
|
||||
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
|
||||
|
||||
|
|
|
@ -40,18 +40,18 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
unsigned aNetlistOptions )
|
||||
{
|
||||
(void)aNetlistOptions; //unused
|
||||
FILE* f = NULL;
|
||||
FILE* f = nullptr;
|
||||
wxString field;
|
||||
wxString footprint;
|
||||
int ret = 0; // zero now, OR in the sign bit on error
|
||||
wxString netName;
|
||||
|
||||
|
||||
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL )
|
||||
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Failed to create file '%s'." ), aOutFileName );
|
||||
DisplayError( NULL, msg );
|
||||
DisplayError( nullptr, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
|
|||
*/
|
||||
static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached )
|
||||
{
|
||||
LIB_SYMBOL *symbol = NULL;
|
||||
LIB_SYMBOL *symbol = nullptr;
|
||||
wxString new_name = LIB_ID::FixIllegalChars( aName, false );
|
||||
|
||||
for( SYMBOL_LIB& each_lib : *aLibs )
|
||||
|
@ -233,8 +233,8 @@ RESCUE_CACHE_CANDIDATE::RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName,
|
|||
|
||||
RESCUE_CACHE_CANDIDATE::RESCUE_CACHE_CANDIDATE()
|
||||
{
|
||||
m_cache_candidate = NULL;
|
||||
m_lib_candidate = NULL;
|
||||
m_cache_candidate = nullptr;
|
||||
m_lib_candidate = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,8 +359,8 @@ RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
|
|||
|
||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE()
|
||||
{
|
||||
m_cache_candidate = NULL;
|
||||
m_lib_candidate = NULL;
|
||||
m_cache_candidate = nullptr;
|
||||
m_lib_candidate = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -729,7 +729,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
boost::ptr_vector<SYMBOL_LIB> libsSave;
|
||||
libsSave.transfer( libsSave.end(), libs->begin(), libs->end(), *libs );
|
||||
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, NULL );
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
|
||||
libs = new SYMBOL_LIBS();
|
||||
|
||||
|
@ -843,7 +843,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
}
|
||||
|
||||
// Relaod the symbol library table.
|
||||
m_prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
m_prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
|
||||
// This can only happen if the symbol library table file was corrupted on write.
|
||||
if( !m_prj->SchSymbolLibTable() )
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
* Get the part that can be loaded from the project cache, if possible, or
|
||||
* else NULL.
|
||||
*/
|
||||
virtual LIB_SYMBOL* GetCacheCandidate() const { return NULL; }
|
||||
virtual LIB_SYMBOL* GetCacheCandidate() const { return nullptr; }
|
||||
|
||||
/**
|
||||
* Get the part the would be loaded from the libraries, if possible, or else
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
RESCUE_CASE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
||||
LIB_SYMBOL* aLibCandidate, int aUnit = 0, int aConvert = 0 );
|
||||
|
||||
RESCUE_CASE_CANDIDATE() { m_lib_candidate = NULL; }
|
||||
RESCUE_CASE_CANDIDATE() { m_lib_candidate = nullptr; }
|
||||
|
||||
virtual wxString GetActionDescription() const override;
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
|||
LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||
bool aShowErrorMsg )
|
||||
{
|
||||
SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||
SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : nullptr;
|
||||
|
||||
return SchGetLibSymbol( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class SYMBOL_EDITOR_SETTINGS;
|
|||
* @return The symbol found in the library or NULL if the symbol was not found.
|
||||
*/
|
||||
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
|
||||
SYMBOL_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
|
||||
SYMBOL_LIB* aCacheLib = nullptr, wxWindow* aParent = nullptr,
|
||||
bool aShowErrorMsg = false );
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
|
||||
SCH_BITMAP::SCH_BITMAP( const wxPoint& pos ) :
|
||||
SCH_ITEM( NULL, SCH_BITMAP_T )
|
||||
SCH_ITEM( nullptr, SCH_BITMAP_T )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_layer = LAYER_NOTES; // used only to draw/plot a rectangle,
|
||||
|
@ -95,8 +95,8 @@ EDA_ITEM* SCH_BITMAP::Clone() const
|
|||
void SCH_BITMAP::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( aItem->Type() == SCH_BITMAP_T,
|
||||
wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ),
|
||||
aItem->GetClass() ) );
|
||||
wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ),
|
||||
aItem->GetClass() ) );
|
||||
|
||||
SCH_BITMAP* item = (SCH_BITMAP*) aItem;
|
||||
std::swap( m_pos, item->m_pos );
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
BITMAP_BASE* GetImage() const
|
||||
{
|
||||
wxCHECK_MSG( m_image != NULL, NULL, "Invalid SCH_BITMAP init, m_image is NULL." );
|
||||
wxCHECK_MSG( m_image != nullptr, nullptr, "Invalid SCH_BITMAP init, m_image is NULL." );
|
||||
return m_image;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
|
||||
SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool aFlipY ) :
|
||||
SCH_ITEM( NULL, aType )
|
||||
SCH_ITEM( nullptr, aType )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_size.x = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
|
||||
|
|
|
@ -95,8 +95,6 @@ static void add_search_paths( SEARCH_STACK* aDst, const SEARCH_STACK& aSrc, int
|
|||
}
|
||||
|
||||
|
||||
//-----<SCH "data on demand" functions>-------------------------------------------
|
||||
|
||||
SEARCH_STACK* PROJECT::SchSearchS()
|
||||
{
|
||||
SEARCH_STACK* ss = (SEARCH_STACK*) GetElem( PROJECT::ELEM_SCH_SEARCH_STACK );
|
||||
|
@ -190,8 +188,6 @@ SYMBOL_LIBS* PROJECT::SchLibs()
|
|||
return libs;
|
||||
}
|
||||
|
||||
//-----</SCH "data on demand" functions>------------------------------------------
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, EDA_DRAW_FRAME::OnSockRequestServer )
|
||||
|
@ -326,7 +322,7 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
|||
|
||||
delete m_item_to_repeat; // we own the cloned object, see this->SaveCopyForRepeatItem()
|
||||
|
||||
SetScreen( NULL );
|
||||
SetScreen( nullptr );
|
||||
|
||||
delete m_schematic;
|
||||
m_schematic = nullptr;
|
||||
|
@ -393,7 +389,8 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
|
||||
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
||||
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
||||
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
|
||||
mgr->SetConditions( ACTIONS::millimetersUnits,
|
||||
CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
|
||||
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
||||
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
|
||||
|
||||
|
@ -410,11 +407,14 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( hasElements ) );
|
||||
mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( hasElements ) );
|
||||
|
||||
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::zoomTool,
|
||||
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::selectionTool,
|
||||
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||
|
||||
if( SCRIPTING::IsWxAvailable() )
|
||||
mgr->SetConditions( EE_ACTIONS::showPythonConsole, CHECK( cond.ScriptingConsoleVisible() ) );
|
||||
mgr->SetConditions( EE_ACTIONS::showPythonConsole,
|
||||
CHECK( cond.ScriptingConsoleVisible() ) );
|
||||
|
||||
auto showHiddenPinsCond =
|
||||
[this] ( const SELECTION& )
|
||||
|
@ -486,6 +486,7 @@ void SCH_EDIT_FRAME::SaveCopyForRepeatItem( const SCH_ITEM* aItem )
|
|||
delete m_item_to_repeat;
|
||||
|
||||
m_item_to_repeat = (SCH_ITEM*) aItem->Clone();
|
||||
|
||||
// Clone() preserves the flags, we want 'em cleared.
|
||||
m_item_to_repeat->ClearFlags();
|
||||
}
|
||||
|
@ -518,7 +519,7 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount()
|
|||
sheet_number++; // Not found, increment before this current path
|
||||
}
|
||||
|
||||
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
||||
for( screen = s_list.GetFirst(); screen != nullptr; screen = s_list.GetNext() )
|
||||
screen->SetPageCount( sheet_count );
|
||||
|
||||
GetCurrentSheet().SetVirtualPageNumber( sheet_number );
|
||||
|
@ -569,7 +570,7 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
m_schematic->Root().AddInstance( rootSheetPath.Path() );
|
||||
m_schematic->Root().SetPageNumber( rootSheetPath, wxT( "1" ) );
|
||||
|
||||
if( GetScreen() == NULL )
|
||||
if( GetScreen() == nullptr )
|
||||
{
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
|
||||
SetScreen( screen );
|
||||
|
@ -695,7 +696,7 @@ void SCH_EDIT_FRAME::doCloseWindow()
|
|||
SCH_SCREENS screens( Schematic().Root() );
|
||||
wxFileName fn;
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||
{
|
||||
fn = Prj().AbsolutePath( screen->GetFileName() );
|
||||
|
||||
|
@ -1165,7 +1166,7 @@ static void inheritNetclass( const SCH_SHEET_PATH& aSheetPath, SCH_TEXT* aItem )
|
|||
void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItem,
|
||||
bool aUndoAppend )
|
||||
{
|
||||
wxCHECK_RET( aItem != NULL, wxT( "Cannot add null item to list." ) );
|
||||
wxCHECK_RET( aItem != nullptr, wxT( "Cannot add null item to list." ) );
|
||||
|
||||
SCH_SHEET* parentSheet = nullptr;
|
||||
SCH_SYMBOL* parentSymbol = nullptr;
|
||||
|
@ -1356,7 +1357,7 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
|
|||
std::vector<wxString> pageNumbers;
|
||||
|
||||
/* Iterate over screens */
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||
{
|
||||
pageNumbers.clear();
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
|
|||
|
||||
void SCH_FIELD::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_FIELD_T),
|
||||
wxCHECK_RET( ( aItem != nullptr ) && ( aItem->Type() == SCH_FIELD_T ),
|
||||
wxT( "Cannot swap field data with invalid item." ) );
|
||||
|
||||
SCH_FIELD* item = (SCH_FIELD*) aItem;
|
||||
|
@ -474,9 +474,7 @@ void SCH_FIELD::Rotate( const wxPoint& aCenter )
|
|||
|
||||
wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'",
|
||||
GetName(),
|
||||
ShortenedShownText() );
|
||||
return wxString::Format( "%s '%s'", GetName(), ShortenedShownText() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
|
||||
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = nullptr ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* Copyright (C) 2016-2020 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2016-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
|
@ -123,7 +123,7 @@ const wxString SCH_IO_MGR::GetFileExtension( SCH_FILE_T aFileType )
|
|||
wxString ext = wxEmptyString;
|
||||
SCH_PLUGIN* plugin = FindPlugin( aFileType );
|
||||
|
||||
if( plugin != NULL )
|
||||
if( plugin != nullptr )
|
||||
{
|
||||
ext = plugin->GetFileExtension();
|
||||
ReleasePlugin( plugin );
|
||||
|
@ -138,7 +138,7 @@ const wxString SCH_IO_MGR::GetLibraryFileExtension( SCH_FILE_T aFileType )
|
|||
wxString ext = wxEmptyString;
|
||||
SCH_PLUGIN* plugin = FindPlugin( aFileType );
|
||||
|
||||
if( plugin != NULL )
|
||||
if( plugin != nullptr )
|
||||
{
|
||||
ext = plugin->GetLibraryFileExtension();
|
||||
ReleasePlugin( plugin );
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
|
||||
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) :
|
||||
SCH_ITEM( NULL, SCH_JUNCTION_T )
|
||||
SCH_ITEM( nullptr, SCH_JUNCTION_T )
|
||||
{
|
||||
m_pos = aPosition;
|
||||
m_color = COLOR4D::UNSPECIFIED;
|
||||
|
@ -57,7 +57,7 @@ EDA_ITEM* SCH_JUNCTION::Clone() const
|
|||
|
||||
void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_JUNCTION_T),
|
||||
wxCHECK_RET( ( aItem != nullptr ) && ( aItem->Type() == SCH_JUNCTION_T ),
|
||||
wxT( "Cannot swap junction data with invalid item." ) );
|
||||
|
||||
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
|
||||
|
@ -119,7 +119,8 @@ void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs
|
|||
|
||||
SHAPE_CIRCLE circle = getEffectiveShape();
|
||||
|
||||
GRFilledCircle( NULL, DC, (wxPoint) circle.GetCenter() + aOffset, circle.GetRadius(), color );
|
||||
GRFilledCircle( nullptr, DC, (wxPoint) circle.GetCenter() + aOffset, circle.GetRadius(),
|
||||
color );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <board_item.h>
|
||||
|
||||
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||
SCH_ITEM( NULL, SCH_LINE_T )
|
||||
SCH_ITEM( nullptr, SCH_LINE_T )
|
||||
{
|
||||
m_start = pos;
|
||||
m_end = pos;
|
||||
|
@ -439,7 +439,7 @@ int SCH_LINE::GetReverseAngleFrom( const wxPoint& aPoint ) const
|
|||
|
||||
bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const
|
||||
{
|
||||
wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
|
||||
wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
|
||||
wxT( "Cannot test line segment for overlap." ) );
|
||||
|
||||
wxPoint firstSeg = m_end - m_start;
|
||||
|
@ -460,7 +460,7 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh
|
|||
return lhs.x < rhs.x;
|
||||
};
|
||||
|
||||
wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, NULL,
|
||||
wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, nullptr,
|
||||
wxT( "Cannot test line segment for overlap." ) );
|
||||
|
||||
if( this == aLine || GetLayer() != aLine->GetLayer() )
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
|
||||
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
|
||||
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
|
||||
SCH_ITEM( nullptr, SCH_NO_CONNECT_T )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_size = Mils2iu( DEFAULT_NOCONNECT_SIZE ); ///< No-connect symbol size.
|
||||
|
@ -56,7 +56,7 @@ EDA_ITEM* SCH_NO_CONNECT::Clone() const
|
|||
|
||||
void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_NO_CONNECT_T),
|
||||
wxCHECK_RET( ( aItem != nullptr ) && ( aItem->Type() == SCH_NO_CONNECT_T ),
|
||||
wxT( "Cannot swap no connect data with invalid item." ) );
|
||||
|
||||
SCH_NO_CONNECT* item = (SCH_NO_CONNECT*)aItem;
|
||||
|
@ -144,6 +144,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
|
|||
return m_pos == aPosition;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||
{
|
||||
int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
|
@ -52,7 +52,7 @@ SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
|||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||
{
|
||||
not_implemented( this, __FUNCTION__ );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ LIB_SYMBOL* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString
|
|||
{
|
||||
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
||||
not_implemented( this, __FUNCTION__ );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ wxFileName SCH_ALTIUM_PLUGIN::getLibFileName()
|
|||
SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||
{
|
||||
wxASSERT( !aFileName || aSchematic != NULL );
|
||||
wxASSERT( !aFileName || aSchematic != nullptr );
|
||||
|
||||
wxFileName fileName( aFileName );
|
||||
fileName.SetExt( KiCadSchematicFileExtension );
|
||||
|
@ -197,7 +197,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
|
|||
|
||||
SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
|
||||
wxCHECK_MSG( libTable, NULL, "Could not load symbol lib table." );
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
||||
|
||||
|
@ -224,7 +224,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
|
|||
}
|
||||
|
||||
// Reload the symbol library table.
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
m_schematic->Prj().SchSymbolLibTable();
|
||||
}
|
||||
|
||||
|
@ -579,9 +579,10 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int aIndex,
|
|||
SCH_SYMBOL* symbol = new SCH_SYMBOL();
|
||||
|
||||
symbol->SetPosition( elem.location + m_sheetOffset );
|
||||
//component->SetOrientation( elem.orientation ); // TODO: keep it simple for now, and only set position
|
||||
|
||||
// TODO: keep it simple for now, and only set position.
|
||||
//component->SetOrientation( elem.orientation );
|
||||
symbol->SetLibId( libId );
|
||||
//component->SetLibSymbol( ksymbol ); // this has to be done after parsing the LIB_SYMBOL!
|
||||
|
||||
symbol->SetUnit( elem.currentpartid );
|
||||
|
||||
|
@ -651,6 +652,7 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
|
|||
|
||||
// TODO: position can be sometimes off a little bit!
|
||||
pin->SetPosition( GetRelativePosition( pinLocation + m_sheetOffset, symbol ) );
|
||||
|
||||
// TODO: the following fix is even worse for now?
|
||||
// pin->SetPosition( GetRelativePosition( elem.kicadLocation, symbol ) );
|
||||
|
||||
|
@ -920,7 +922,7 @@ void SCH_ALTIUM_PLUGIN::ParseNote( const std::map<wxString, wxString>& aProperti
|
|||
|
||||
// TODO: set border and background color once KiCad supports them.
|
||||
|
||||
// TODO: need some sort of propety system for storing author....
|
||||
// TODO: need some sort of property system for storing author....
|
||||
|
||||
size_t fontId = static_cast<int>( elem.fontId );
|
||||
|
||||
|
@ -969,7 +971,7 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
|
|||
}
|
||||
else
|
||||
{
|
||||
// simulate bezier using line segments
|
||||
// simulate Bezier using line segments
|
||||
std::vector<wxPoint> bezierPoints;
|
||||
std::vector<wxPoint> polyPoints;
|
||||
|
||||
|
@ -1031,7 +1033,7 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
|
|||
}
|
||||
else
|
||||
{
|
||||
// bezier always has maximum of 4 control points
|
||||
// Bezier always has maximum of 4 control points
|
||||
LIB_BEZIER* bezier = new LIB_BEZIER( libSymbolIt->second );
|
||||
libSymbolIt->second->AddDrawItem( bezier );
|
||||
|
||||
|
@ -1236,6 +1238,7 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
|
|||
return;
|
||||
|
||||
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
|
||||
|
||||
// TODO: misses rounded edges
|
||||
LIB_RECTANGLE* rect = new LIB_RECTANGLE( libSymbolIt->second );
|
||||
libSymbolIt->second->AddDrawItem( rect );
|
||||
|
@ -1776,7 +1779,8 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
|||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||
pin->SetVisible( false );
|
||||
|
||||
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( libSymbol, elem.style, m_reporter );
|
||||
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( libSymbol, elem.style,
|
||||
m_reporter );
|
||||
|
||||
libSymbol->GetValueField().SetPosition( valueFieldPos );
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
(double) maxDesignSizekicad / SCH_IU_PER_MM ) );
|
||||
}
|
||||
|
||||
// Assume the centre at 0,0 since we are going to be translating the design afterwards anyway
|
||||
// Assume the center at 0,0 since we are going to be translating the design afterwards anyway
|
||||
m_designCenter = { 0, 0 };
|
||||
|
||||
m_schematic = aSchematic;
|
||||
|
@ -124,7 +124,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
}
|
||||
|
||||
|
||||
// For all sheets, centre all elements and re calculate the page size:
|
||||
// For all sheets, center all elements and re calculate the page size:
|
||||
for( std::pair<LAYER_ID, SCH_SHEET*> sheetPair : m_sheetMap )
|
||||
{
|
||||
SCH_SHEET* sheet = sheetPair.second;
|
||||
|
@ -196,7 +196,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
// Set the new sheet size.
|
||||
sheet->GetScreen()->SetPageSettings( pageInfo );
|
||||
|
||||
|
||||
wxSize pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
|
||||
wxPoint itemsCentre = sheetBoundingBox.Centre();
|
||||
|
@ -428,7 +427,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
|||
}
|
||||
|
||||
LIB_SYMBOL* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
|
||||
sym.ScaleRatioDenominator );
|
||||
sym.ScaleRatioDenominator );
|
||||
|
||||
double symOrientDeciDeg = 0.0;
|
||||
SCH_SYMBOL* symbol = loadSchematicSymbol( sym, *scaledPart, symOrientDeciDeg );
|
||||
|
@ -854,7 +853,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
m_sheetMap.at( bus.LayerID )->GetScreen()->Append( label );
|
||||
}
|
||||
|
||||
|
||||
for( std::pair<NETELEMENT_ID, NET_SCH::DANGLER> danglerPair : net.Danglers )
|
||||
{
|
||||
NET_SCH::DANGLER dangler = danglerPair.second;
|
||||
|
@ -868,7 +866,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
|
||||
}
|
||||
|
||||
|
||||
for( NET_SCH::CONNECTION_SCH conn : net.Connections )
|
||||
{
|
||||
if( conn.LayerID == wxT( "NO_SHEET" ) )
|
||||
|
@ -952,8 +949,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
|||
}
|
||||
else
|
||||
{
|
||||
// The block terminal is either inside or on the shape edge. Lets use the
|
||||
// first interection point
|
||||
// The block terminal is either inside or on the shape edge. Lets use
|
||||
// the first intersection point.
|
||||
VECTOR2I intsctPt = wireToSheetIntersects.at( 0 ).p;
|
||||
int intsctIndx = wireChain.FindSegment( intsctPt );
|
||||
wxASSERT_MSG( intsctIndx != -1, "Can't find intersecting segment" );
|
||||
|
@ -1112,7 +1109,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols()
|
|||
FIGURE fig = figPair.second;
|
||||
|
||||
loadFigure( fig, docSym.LayerID, LAYER_NOTES, moveVector, rotationAngle, scalingFactor,
|
||||
centreOfTransform, mirrorInvert );
|
||||
centreOfTransform, mirrorInvert );
|
||||
}
|
||||
|
||||
for( std::pair<TEXT_ID, TEXT> textPair : docSymDef.Texts )
|
||||
|
@ -1463,7 +1460,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
|||
};
|
||||
|
||||
// Load all attributes in the Part Definition
|
||||
for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attr : aCadstarPart->Definition.AttributeValues )
|
||||
for( std::pair<ATTRIBUTE_ID,
|
||||
ATTRIBUTE_VALUE> attr : aCadstarPart->Definition.AttributeValues )
|
||||
{
|
||||
ATTRIBUTE_VALUE attrVal = attr.second;
|
||||
loadLibraryField( attrVal );
|
||||
|
@ -1949,7 +1947,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
|
|||
else
|
||||
arcAngleDeciDeg = NormalizeAngleNeg( arcAngleDeciDeg );
|
||||
|
||||
SHAPE_ARC tempArc( VECTOR2I(centerPoint), VECTOR2I(startPoint), arcAngleDeciDeg / 10.0 );
|
||||
SHAPE_ARC tempArc( VECTOR2I(centerPoint), VECTOR2I(startPoint),
|
||||
arcAngleDeciDeg / 10.0 );
|
||||
SHAPE_LINE_CHAIN arcSegments = tempArc.ConvertToPolyline( Millimeter2iu( 0.1 ) );
|
||||
|
||||
// Load the arc as a series of piece-wise segments
|
||||
|
@ -1959,17 +1958,17 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
|
|||
wxPoint segStart = (wxPoint) arcSegments.Segment( jj ).A;
|
||||
wxPoint segEnd = (wxPoint) arcSegments.Segment( jj ).B;
|
||||
|
||||
loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID,
|
||||
aCadstarSheetID, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
|
||||
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||
loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID, aCadstarSheetID,
|
||||
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
|
||||
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VERTEX_TYPE::POINT:
|
||||
loadGraphicStaightSegment( startPoint, endPoint, aCadstarLineCodeID, aCadstarSheetID,
|
||||
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
|
||||
aTransformCentre, aMirrorInvert );
|
||||
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
|
||||
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1988,14 +1987,14 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure,
|
|||
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert )
|
||||
{
|
||||
loadShapeVertices( aCadstarFigure.Shape.Vertices, aCadstarFigure.LineCodeID,
|
||||
aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
|
||||
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||
aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector,
|
||||
aRotationAngleDeciDeg, aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||
|
||||
for( CUTOUT cutout : aCadstarFigure.Shape.Cutouts )
|
||||
{
|
||||
loadShapeVertices( cutout.Vertices, aCadstarFigure.LineCodeID, aCadstarSheetIDOverride,
|
||||
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
|
||||
aTransformCentre, aMirrorInvert );
|
||||
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
|
||||
aTransformCentre, aMirrorInvert );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2039,7 +2038,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
|
|||
wxString pageNumStr = wxString::Format( "%d", getSheetNumber( aCadstarSheetID ) );
|
||||
sheet->SetPageNumber( instance, pageNumStr );
|
||||
|
||||
sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
m_sheetMap.insert( { aCadstarSheetID, sheet } );
|
||||
|
||||
|
@ -2047,8 +2046,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
|
|||
}
|
||||
|
||||
|
||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(
|
||||
LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet )
|
||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID,
|
||||
const SCH_SHEET_PATH& aSheet )
|
||||
{
|
||||
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) != m_sheetMap.end(), ,
|
||||
"FIXME! Parent sheet should be loaded before attempting to load subsheets" );
|
||||
|
@ -2227,6 +2226,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::SYMDEF_ID CADSTAR_SCH_ARCHIVE_LOADER::getSymDefFromN
|
|||
return SYMDEF_ID();
|
||||
}
|
||||
|
||||
|
||||
bool CADSTAR_SCH_ARCHIVE_LOADER::isAttributeVisible( const ATTRIBUTE_ID& aCadstarAttributeID )
|
||||
{
|
||||
// Use CADSTAR visibility settings to determine if an attribute is visible
|
||||
|
@ -2253,7 +2253,7 @@ PLOT_DASH_TYPE CADSTAR_SCH_ARCHIVE_LOADER::getLineStyle( const LINECODE_ID& aCad
|
|||
{
|
||||
wxCHECK( Assignments.Codedefs.LineCodes.find( aCadstarLineCodeID )
|
||||
!= Assignments.Codedefs.LineCodes.end(),
|
||||
PLOT_DASH_TYPE::SOLID );
|
||||
PLOT_DASH_TYPE::SOLID );
|
||||
|
||||
// clang-format off
|
||||
switch( Assignments.Codedefs.LineCodes.at( aCadstarLineCodeID ).Style )
|
||||
|
@ -2276,7 +2276,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::TEXTCODE CADSTAR_SCH_ARCHIVE_LOADER::getTextCode(
|
|||
{
|
||||
wxCHECK( Assignments.Codedefs.TextCodes.find( aCadstarTextCodeID )
|
||||
!= Assignments.Codedefs.TextCodes.end(),
|
||||
TEXTCODE() );
|
||||
TEXTCODE() );
|
||||
|
||||
return Assignments.Codedefs.TextCodes.at( aCadstarTextCodeID );
|
||||
}
|
||||
|
@ -2286,7 +2286,7 @@ wxString CADSTAR_SCH_ARCHIVE_LOADER::getAttributeName( const ATTRIBUTE_ID& aCads
|
|||
{
|
||||
wxCHECK( Assignments.Codedefs.AttributeNames.find( aCadstarAttributeID )
|
||||
!= Assignments.Codedefs.AttributeNames.end(),
|
||||
wxEmptyString );
|
||||
wxEmptyString );
|
||||
|
||||
return Assignments.Codedefs.AttributeNames.at( aCadstarAttributeID ).Name;
|
||||
}
|
||||
|
@ -2306,7 +2306,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::ROUTECODE CADSTAR_SCH_ARCHIVE_LOADER::getRouteCode(
|
|||
{
|
||||
wxCHECK( Assignments.Codedefs.RouteCodes.find( aCadstarRouteCodeID )
|
||||
!= Assignments.Codedefs.RouteCodes.end(),
|
||||
ROUTECODE() );
|
||||
ROUTECODE() );
|
||||
|
||||
return Assignments.Codedefs.RouteCodes.at( aCadstarRouteCodeID );
|
||||
}
|
||||
|
@ -2356,8 +2356,8 @@ int CADSTAR_SCH_ARCHIVE_LOADER::getKiCadUnitNumberFromGate( const GATE_ID& aCads
|
|||
}
|
||||
|
||||
|
||||
LABEL_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle(
|
||||
const long long& aCadstarOrientation, bool aMirror )
|
||||
LABEL_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const long long& aCadstarOrientation,
|
||||
bool aMirror )
|
||||
{
|
||||
double orientationDeciDegree = getAngleTenthDegree( aCadstarOrientation );
|
||||
LABEL_SPIN_STYLE spinStyle = getSpinStyleDeciDeg( orientationDeciDegree );
|
||||
|
@ -2402,14 +2402,17 @@ CADSTAR_SCH_ARCHIVE_LOADER::mirrorX( const ALIGNMENT& aCadstarAlignment )
|
|||
case ALIGNMENT::BOTTOMLEFT: return ALIGNMENT::BOTTOMRIGHT;
|
||||
case ALIGNMENT::CENTERLEFT: return ALIGNMENT::CENTERRIGHT;
|
||||
case ALIGNMENT::TOPLEFT: return ALIGNMENT::TOPRIGHT;
|
||||
|
||||
//Change right to left:
|
||||
case ALIGNMENT::BOTTOMRIGHT: return ALIGNMENT::BOTTOMLEFT;
|
||||
case ALIGNMENT::CENTERRIGHT: return ALIGNMENT::CENTERLEFT;
|
||||
case ALIGNMENT::TOPRIGHT: return ALIGNMENT::TOPLEFT;
|
||||
|
||||
// Center alignment does not mirror:
|
||||
case ALIGNMENT::BOTTOMCENTER:
|
||||
case ALIGNMENT::CENTERCENTER:
|
||||
case ALIGNMENT::TOPCENTER: return aCadstarAlignment;
|
||||
|
||||
// Shouldn't be here
|
||||
default: wxFAIL_MSG( "Unknown Cadstar Alignment" ); return aCadstarAlignment;
|
||||
}
|
||||
|
@ -2431,6 +2434,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::rotate180( const ALIGNMENT& aCadstarAlignment )
|
|||
case ALIGNMENT::CENTERLEFT: return ALIGNMENT::CENTERRIGHT;
|
||||
case ALIGNMENT::CENTERCENTER: return ALIGNMENT::CENTERCENTER;
|
||||
case ALIGNMENT::CENTERRIGHT: return ALIGNMENT::CENTERLEFT;
|
||||
|
||||
// Shouldn't be here
|
||||
default: wxFAIL_MSG( "Unknown Cadstar Alignment" ); return aCadstarAlignment;
|
||||
}
|
||||
|
@ -2444,9 +2448,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
|
|||
const long long aCadstarOrientAngle,
|
||||
bool aMirrored )
|
||||
{
|
||||
// Justification ignored for now as not supported in eeschema, but leaving this code in
|
||||
// Justification ignored for now as not supported in Eeschema, but leaving this code in
|
||||
// place for future upgrades.
|
||||
// TODO update this when eeschema supports justification independent of anchor position.
|
||||
// TODO update this when Eeschema supports justification independent of anchor position.
|
||||
|
||||
TEXTCODE textCode = getTextCode( aCadstarTextCodeID );
|
||||
int textHeight = KiROUND( (double) getKiCadLength( textCode.Height ) * TXT_HEIGHT_RATIO );
|
||||
|
@ -2613,6 +2617,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_TEXT* CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText( const TEXT& aCadstarTextElement )
|
||||
{
|
||||
SCH_TEXT* kiTxt = new SCH_TEXT();
|
||||
|
@ -2802,8 +2807,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int
|
|||
}
|
||||
|
||||
|
||||
std::pair<wxPoint, wxSize>
|
||||
CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad(
|
||||
std::pair<wxPoint, wxSize> CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad(
|
||||
const FIGURE& aCadstarFigure )
|
||||
{
|
||||
wxPoint upperLeft( Assignments.Settings.DesignLimit.x, 0 );
|
||||
|
@ -2862,8 +2866,8 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( wxPoint aCadstarPoint )
|
|||
}
|
||||
|
||||
|
||||
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint(
|
||||
wxPoint aCadstarPoint, wxPoint aCadstarCentre )
|
||||
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( wxPoint aCadstarPoint,
|
||||
wxPoint aCadstarCentre )
|
||||
{
|
||||
wxPoint retval;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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 as published by the
|
||||
|
@ -38,8 +38,6 @@ class SCH_SCREEN;
|
|||
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_PLUGIN
|
||||
{
|
||||
public:
|
||||
//-----<PUBLIC SCH_PLUGIN API>-------------------------------------------------
|
||||
|
||||
const wxString GetName() const override;
|
||||
|
||||
void SetReporter( REPORTER* aReporter ) override { m_reporter = aReporter; }
|
||||
|
@ -51,45 +49,11 @@ public:
|
|||
int GetModifyHash() const override;
|
||||
|
||||
SCH_SHEET* Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||
SCH_SHEET* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL ) override;
|
||||
SCH_SHEET* aAppendToMe = nullptr,
|
||||
const PROPERTIES* aProperties = nullptr ) override;
|
||||
|
||||
bool CheckHeader( const wxString& aFileName ) override;
|
||||
|
||||
|
||||
// unimplemented functions. Will trigger a not_implemented IO error.
|
||||
//void SaveLibrary( const wxString& aFileName, const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//void CreateSymbolLib( const wxString& aLibraryPath,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
// bool DeleteSymbolLib( const wxString& aLibraryPath,
|
||||
// const PROPERTIES* aProperties = NULL ) override;
|
||||
|
||||
//bool IsSymbolLibWritable( const wxString& aLibraryPath ) override;
|
||||
|
||||
//void SymbolLibOptions( PROPERTIES* aListToAppendTo ) const override;
|
||||
|
||||
//-----</PUBLIC SCH_PLUGIN API>------------------------------------------------
|
||||
|
||||
|
||||
CADSTAR_SCH_ARCHIVE_PLUGIN()
|
||||
{
|
||||
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||
|
|
|
@ -408,7 +408,7 @@ void SCH_EAGLE_PLUGIN::checkpoint()
|
|||
/ std::max( 1U, m_totalCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
THROW_IO_ERROR( ( "Open canceled by user." ) );
|
||||
|
||||
m_lastProgressCount = m_doneCount;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
|||
m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
THROW_IO_ERROR( ( "Open canceled by user." ) );
|
||||
}
|
||||
|
||||
// Load the document
|
||||
|
@ -469,7 +469,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
|||
|
||||
SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
|
||||
wxCHECK_MSG( libTable, NULL, "Could not load symbol lib table." );
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
||||
m_properties = std::make_unique<PROPERTIES>();
|
||||
|
@ -498,7 +498,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
|||
}
|
||||
|
||||
// Reload the symbol library table.
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
m_schematic->Prj().SchSymbolLibTable();
|
||||
}
|
||||
|
||||
|
@ -1382,7 +1382,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
if( attributeNode->GetName() == "attribute" )
|
||||
{
|
||||
auto attr = EATTR( attributeNode );
|
||||
SCH_FIELD* field = NULL;
|
||||
SCH_FIELD* field = nullptr;
|
||||
|
||||
if( attr.name.Lower() == "name" )
|
||||
{
|
||||
|
@ -1616,7 +1616,6 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if( aDevice->connects.size() != 0 )
|
||||
{
|
||||
for( const auto& connect : aDevice->connects )
|
||||
|
@ -1663,7 +1662,8 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
|
|||
}
|
||||
else if( nodeName == "text" )
|
||||
{
|
||||
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aSymbol, currentNode, aGateNumber ) );
|
||||
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aSymbol, currentNode,
|
||||
aGateNumber ) );
|
||||
|
||||
if( libtext->GetText().Upper() == ">NAME" )
|
||||
{
|
||||
|
@ -2261,7 +2261,6 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
|
|||
if( segAttached && !onIntersection( labelPos ) )
|
||||
continue; // label is placed correctly
|
||||
|
||||
|
||||
// Move the label to the nearest wire
|
||||
if( !segAttached )
|
||||
{
|
||||
|
@ -2272,7 +2271,6 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Create a vector pointing in the direction of the wire, 50 mils long
|
||||
VECTOR2I wireDirection( segAttached->B - segAttached->A );
|
||||
wireDirection = wireDirection.Resize( Mils2iu( 50 ) );
|
||||
|
|
|
@ -423,7 +423,7 @@ double SCH_SEXPR_PARSER::parseDouble()
|
|||
char* tmp;
|
||||
|
||||
// In case the file got saved with the wrong locale.
|
||||
if( strchr( CurText(), ',' ) != NULL )
|
||||
if( strchr( CurText(), ',' ) != nullptr )
|
||||
{
|
||||
THROW_PARSE_ERROR( _( "Floating point number with incorrect locale" ), CurSource(),
|
||||
CurLine(), CurLineNumber(), CurOffset() );
|
||||
|
@ -1094,7 +1094,8 @@ LIB_BEZIER* SCH_SEXPR_PARSER::parseBezier()
|
|||
LIB_CIRCLE* SCH_SEXPR_PARSER::parseCircle()
|
||||
{
|
||||
wxCHECK_MSG( CurTok() == T_circle, nullptr,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle token." ) );
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
|
||||
wxT( " as a circle token." ) );
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
|
@ -1439,7 +1440,8 @@ LIB_POLYLINE* SCH_SEXPR_PARSER::parsePolyLine()
|
|||
LIB_RECTANGLE* SCH_SEXPR_PARSER::parseRectangle()
|
||||
{
|
||||
wxCHECK_MSG( CurTok() == T_rectangle, nullptr,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a rectangle token." ) );
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
|
||||
wxT( " as a rectangle token." ) );
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
|
@ -1732,7 +1734,8 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
|
|||
// Empty property values are valid.
|
||||
wxString value = FromUTF8();
|
||||
|
||||
std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( wxDefaultPosition, -1, aParent, name );
|
||||
std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( wxDefaultPosition, -1,
|
||||
aParent, name );
|
||||
|
||||
field->SetText( value );
|
||||
field->SetVisible( true );
|
||||
|
|
|
@ -96,12 +96,12 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
|||
inline long parseHex()
|
||||
{
|
||||
NextTok();
|
||||
return strtol( CurText(), NULL, 16 );
|
||||
return strtol( CurText(), nullptr, 16 );
|
||||
}
|
||||
|
||||
inline int parseInt()
|
||||
{
|
||||
return (int)strtol( CurText(), NULL, 10 );
|
||||
return (int)strtol( CurText(), nullptr, 10 );
|
||||
}
|
||||
|
||||
inline int parseInt( const char* aExpected )
|
||||
|
|
|
@ -369,7 +369,7 @@ public:
|
|||
SCH_SEXPR_PLUGIN::SCH_SEXPR_PLUGIN() :
|
||||
m_progressReporter( nullptr )
|
||||
{
|
||||
init( NULL );
|
||||
init( nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,7 +431,7 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
|||
m_currentPath.push( m_path );
|
||||
init( aSchematic, aProperties );
|
||||
|
||||
if( aAppendToMe == NULL )
|
||||
if( aAppendToMe == nullptr )
|
||||
{
|
||||
// Clean up any allocated memory if an exception occurs loading the schematic.
|
||||
std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( aSchematic );
|
||||
|
@ -469,7 +469,7 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
|||
|
||||
void SCH_SEXPR_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
||||
{
|
||||
SCH_SCREEN* screen = NULL;
|
||||
SCH_SCREEN* screen = nullptr;
|
||||
|
||||
if( !aSheet->GetScreen() )
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ void SCH_SEXPR_PLUGIN::LoadContent( LINE_READER& aReader, SCH_SHEET* aSheet, int
|
|||
void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." );
|
||||
wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." );
|
||||
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
||||
|
@ -599,8 +599,8 @@ void SCH_SEXPR_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEM
|
|||
|
||||
void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||
{
|
||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
||||
wxCHECK_RET( m_schematic != NULL, "NULL SCHEMATIC* object." );
|
||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET* object." );
|
||||
wxCHECK_RET( m_schematic != nullptr, "NULL SCHEMATIC* object." );
|
||||
|
||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ void SCH_SEXPR_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel )
|
|||
|
||||
const wxImage* image = aBitmap->GetImage()->GetImageData();
|
||||
|
||||
wxCHECK_RET( image != NULL, "wxImage* is NULL" );
|
||||
wxCHECK_RET( image != nullptr, "wxImage* is NULL" );
|
||||
|
||||
m_out->Print( aNestLevel, "(image (at %s %s)",
|
||||
FormatInternalUnits( aBitmap->GetPosition().x ).c_str(),
|
||||
|
@ -1306,7 +1306,7 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
|||
|
||||
void SCH_SEXPR_PLUGIN::saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias, int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aAlias != NULL, "BUS_ALIAS* is NULL" );
|
||||
wxCHECK_RET( aAlias != nullptr, "BUS_ALIAS* is NULL" );
|
||||
|
||||
wxString members;
|
||||
|
||||
|
@ -1434,17 +1434,17 @@ bool SCH_SEXPR_PLUGIN_CACHE::IsFileChanged() const
|
|||
|
||||
LIB_SYMBOL* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
wxCHECK_MSG( aSymbol != NULL, NULL, "NULL pointer cannot be removed from library." );
|
||||
wxCHECK_MSG( aSymbol != nullptr, nullptr, "NULL pointer cannot be removed from library." );
|
||||
|
||||
LIB_SYMBOL* firstChild = NULL;
|
||||
LIB_SYMBOL* firstChild = nullptr;
|
||||
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbol->GetName() );
|
||||
|
||||
if( it == m_symbols.end() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
||||
// have done something terribly wrong.
|
||||
wxCHECK_MSG( *it->second == aSymbol, NULL,
|
||||
wxCHECK_MSG( *it->second == aSymbol, nullptr,
|
||||
"Pointer mismatch while attempting to remove alias entry <" + aSymbol->GetName() +
|
||||
"> from library cache <" + m_libFileName.GetName() + ">." );
|
||||
|
||||
|
@ -1944,8 +1944,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveField( LIB_FIELD* aField, OUTPUTFORMATTER& aFor
|
|||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
|
||||
OUTPUTFORMATTER& aFormatter,
|
||||
void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aPin && aPin->Type() == LIB_PIN_T, "Invalid LIB_PIN object." );
|
||||
|
@ -1989,8 +1988,7 @@ void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
|
|||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine,
|
||||
OUTPUTFORMATTER& aFormatter,
|
||||
void SCH_SEXPR_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aPolyLine && aPolyLine->Type() == LIB_POLYLINE_T, "Invalid LIB_POLYLINE object." );
|
||||
|
|
|
@ -122,7 +122,7 @@ static bool is_eol( char c )
|
|||
* @param aOutput - A pointer to a string pointer to the end of the comparison if not NULL.
|
||||
* @return true if \a aString was found starting at \a aLine. Otherwise false.
|
||||
*/
|
||||
static bool strCompare( const char* aString, const char* aLine, const char** aOutput = NULL )
|
||||
static bool strCompare( const char* aString, const char* aLine, const char** aOutput = nullptr )
|
||||
{
|
||||
size_t len = strlen( aString );
|
||||
bool retv = ( strncasecmp( aLine, aString, len ) == 0 ) &&
|
||||
|
@ -159,7 +159,7 @@ static bool strCompare( const char* aString, const char* aLine, const char** aOu
|
|||
* @throw An #IO_ERROR on an unexpected end of line.
|
||||
* @throw A #PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static int parseInt( LINE_READER& aReader, const char* aLine, const char** aOutput = NULL )
|
||||
static int parseInt( LINE_READER& aReader, const char* aLine, const char** aOutput = nullptr )
|
||||
{
|
||||
if( !*aLine )
|
||||
SCH_PARSE_ERROR( _( "unexpected end of line" ), aReader, aLine );
|
||||
|
@ -201,7 +201,7 @@ static int parseInt( LINE_READER& aReader, const char* aLine, const char** aOutp
|
|||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static uint32_t parseHex( LINE_READER& aReader, const char* aLine, const char** aOutput = NULL )
|
||||
static uint32_t parseHex( LINE_READER& aReader, const char* aLine, const char** aOutput = nullptr )
|
||||
{
|
||||
if( !*aLine )
|
||||
SCH_PARSE_ERROR( _( "unexpected end of line" ), aReader, aLine );
|
||||
|
@ -247,7 +247,7 @@ static uint32_t parseHex( LINE_READER& aReader, const char* aLine, const char**
|
|||
* @throw PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static double parseDouble( LINE_READER& aReader, const char* aLine,
|
||||
const char** aOutput = NULL )
|
||||
const char** aOutput = nullptr )
|
||||
{
|
||||
if( !*aLine )
|
||||
SCH_PARSE_ERROR( _( "unexpected end of line" ), aReader, aLine );
|
||||
|
@ -288,7 +288,7 @@ static double parseDouble( LINE_READER& aReader, const char* aLine,
|
|||
* @throw PARSE_ERROR if the parsed token is not a single character token.
|
||||
*/
|
||||
static char parseChar( LINE_READER& aReader, const char* aCurrentToken,
|
||||
const char** aNextToken = NULL )
|
||||
const char** aNextToken = nullptr )
|
||||
{
|
||||
while( *aCurrentToken && isspace( *aCurrentToken ) )
|
||||
aCurrentToken++;
|
||||
|
@ -328,7 +328,7 @@ static char parseChar( LINE_READER& aReader, const char* aCurrentToken,
|
|||
* @throw PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
*/
|
||||
static void parseUnquotedString( wxString& aString, LINE_READER& aReader,
|
||||
const char* aCurrentToken, const char** aNextToken = NULL,
|
||||
const char* aCurrentToken, const char** aNextToken = nullptr,
|
||||
bool aCanBeEmpty = false )
|
||||
{
|
||||
if( !*aCurrentToken )
|
||||
|
@ -390,7 +390,7 @@ static void parseUnquotedString( wxString& aString, LINE_READER& aReader,
|
|||
* @throw PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
*/
|
||||
static void parseQuotedString( wxString& aString, LINE_READER& aReader,
|
||||
const char* aCurrentToken, const char** aNextToken = NULL,
|
||||
const char* aCurrentToken, const char** aNextToken = nullptr,
|
||||
bool aCanBeEmpty = false )
|
||||
{
|
||||
if( !*aCurrentToken )
|
||||
|
@ -589,7 +589,7 @@ SCH_LEGACY_PLUGIN::SCH_LEGACY_PLUGIN() :
|
|||
m_lastProgressLine( 0 ),
|
||||
m_lineCount( 0 )
|
||||
{
|
||||
init( NULL );
|
||||
init( nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
@ -634,7 +634,7 @@ void SCH_LEGACY_PLUGIN::checkpoint()
|
|||
SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||
{
|
||||
wxASSERT( !aFileName || aSchematic != NULL );
|
||||
wxASSERT( !aFileName || aSchematic != nullptr );
|
||||
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||
SCH_SHEET* sheet;
|
||||
|
@ -672,7 +672,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
|
|||
m_currentPath.push( m_path );
|
||||
init( aSchematic, aProperties );
|
||||
|
||||
if( aAppendToMe == NULL )
|
||||
if( aAppendToMe == nullptr )
|
||||
{
|
||||
// Clean up any allocated memory if an exception occurs loading the schematic.
|
||||
std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( aSchematic );
|
||||
|
@ -702,7 +702,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
|
|||
|
||||
void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
||||
{
|
||||
SCH_SCREEN* screen = NULL;
|
||||
SCH_SCREEN* screen = nullptr;
|
||||
|
||||
if( !aSheet->GetScreen() )
|
||||
{
|
||||
|
@ -904,7 +904,7 @@ void SCH_LEGACY_PLUGIN::loadHeader( LINE_READER& aReader, SCH_SCREEN* aScreen )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::loadPageSettings( LINE_READER& aReader, SCH_SCREEN* aScreen )
|
||||
{
|
||||
wxASSERT( aScreen != NULL );
|
||||
wxASSERT( aScreen != nullptr );
|
||||
|
||||
wxString buf;
|
||||
const char* line = aReader.Line();
|
||||
|
@ -941,7 +941,7 @@ void SCH_LEGACY_PLUGIN::loadPageSettings( LINE_READER& aReader, SCH_SCREEN* aScr
|
|||
|
||||
aScreen->SetPageSettings( pageInfo );
|
||||
|
||||
while( line != NULL )
|
||||
while( line != nullptr )
|
||||
{
|
||||
buf.clear();
|
||||
|
||||
|
@ -1037,7 +1037,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
|||
|
||||
const char* line = aReader.ReadLine();
|
||||
|
||||
while( line != NULL )
|
||||
while( line != nullptr )
|
||||
{
|
||||
if( strCompare( "S", line, &line ) ) // Sheet dimensions.
|
||||
{
|
||||
|
@ -1090,7 +1090,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
|||
|
||||
sheetPin->SetText( text );
|
||||
|
||||
if( line == NULL )
|
||||
if( line == nullptr )
|
||||
THROW_IO_ERROR( _( "unexpected end of line" ) );
|
||||
|
||||
switch( parseChar( aReader, line, &line ) )
|
||||
|
@ -1128,7 +1128,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
|||
}
|
||||
else if( strCompare( "$EndSheet", line ) )
|
||||
{
|
||||
sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
return sheet.release();
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
|||
|
||||
SCH_PARSE_ERROR( "missing '$EndSheet`", aReader, line );
|
||||
|
||||
return NULL; // Prevents compiler warning. Should never get here.
|
||||
return nullptr; // Prevents compiler warning. Should never get here.
|
||||
}
|
||||
|
||||
|
||||
|
@ -1147,11 +1147,11 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
|
|||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "$Bitmap", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "$Bitmap", line, &line ), nullptr );
|
||||
|
||||
line = aReader.ReadLine();
|
||||
|
||||
while( line != NULL )
|
||||
while( line != nullptr )
|
||||
{
|
||||
if( strCompare( "Pos", line, &line ) )
|
||||
{
|
||||
|
@ -1213,7 +1213,7 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
|
|||
}
|
||||
}
|
||||
|
||||
if( line == NULL )
|
||||
if( line == nullptr )
|
||||
THROW_IO_ERROR( _( "unexpected end of file" ) );
|
||||
}
|
||||
else if( strCompare( "$EndBitmap", line ) )
|
||||
|
@ -1232,7 +1232,7 @@ SCH_JUNCTION* SCH_LEGACY_PLUGIN::loadJunction( LINE_READER& aReader )
|
|||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "Connection", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "Connection", line, &line ), nullptr );
|
||||
|
||||
wxString name;
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ SCH_NO_CONNECT* SCH_LEGACY_PLUGIN::loadNoConnect( LINE_READER& aReader )
|
|||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "NoConn", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "NoConn", line, &line ), nullptr );
|
||||
|
||||
wxString name;
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
|
|||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "Wire", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "Wire", line, &line ), nullptr );
|
||||
|
||||
if( strCompare( "Wire", line, &line ) )
|
||||
wire->SetLayer( LAYER_WIRE );
|
||||
|
@ -1372,7 +1372,7 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "Entry", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "Entry", line, &line ), nullptr );
|
||||
|
||||
std::unique_ptr<SCH_BUS_ENTRY_BASE> busEntry;
|
||||
|
||||
|
@ -1428,7 +1428,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "Text", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "Text", line, &line ), nullptr );
|
||||
|
||||
std::unique_ptr<SCH_TEXT> text;
|
||||
|
||||
|
@ -1545,13 +1545,13 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "$Comp", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "$Comp", line, &line ), nullptr );
|
||||
|
||||
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
|
||||
|
||||
line = aReader.ReadLine();
|
||||
|
||||
while( line != NULL )
|
||||
while( line != nullptr )
|
||||
{
|
||||
if( strCompare( "L", line, &line ) )
|
||||
{
|
||||
|
@ -1853,7 +1853,7 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
|||
|
||||
SCH_PARSE_ERROR( "invalid symbol line", aReader, line );
|
||||
|
||||
return NULL; // Prevents compiler warning. Should never get here.
|
||||
return nullptr; // Prevents compiler warning. Should never get here.
|
||||
}
|
||||
|
||||
|
||||
|
@ -1863,7 +1863,7 @@ std::shared_ptr<BUS_ALIAS> SCH_LEGACY_PLUGIN::loadBusAlias( LINE_READER& aReader
|
|||
auto busAlias = std::make_shared<BUS_ALIAS>( aScreen );
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "BusAlias", line, &line ), NULL );
|
||||
wxCHECK( strCompare( "BusAlias", line, &line ), nullptr );
|
||||
|
||||
wxString buf;
|
||||
parseUnquotedString( buf, aReader, line, &line );
|
||||
|
@ -1886,7 +1886,7 @@ std::shared_ptr<BUS_ALIAS> SCH_LEGACY_PLUGIN::loadBusAlias( LINE_READER& aReader
|
|||
void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
||||
const PROPERTIES* aProperties )
|
||||
{
|
||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET object." );
|
||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." );
|
||||
wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." );
|
||||
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values.
|
||||
|
@ -1909,8 +1909,8 @@ void SCH_LEGACY_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHE
|
|||
|
||||
void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||
{
|
||||
wxCHECK_RET( aSheet != NULL, "NULL SCH_SHEET* object." );
|
||||
wxCHECK_RET( m_schematic != NULL, "NULL SCHEMATIC* object." );
|
||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET* object." );
|
||||
wxCHECK_RET( m_schematic != nullptr, "NULL SCHEMATIC* object." );
|
||||
|
||||
SCH_SCREEN* screen = aSheet->GetScreen();
|
||||
|
||||
|
@ -2195,11 +2195,11 @@ void SCH_LEGACY_PLUGIN::saveField( SCH_FIELD* aField )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap )
|
||||
{
|
||||
wxCHECK_RET( aBitmap != NULL, "SCH_BITMAP* is NULL" );
|
||||
wxCHECK_RET( aBitmap != nullptr, "SCH_BITMAP* is NULL" );
|
||||
|
||||
const wxImage* image = aBitmap->GetImage()->GetImageData();
|
||||
|
||||
wxCHECK_RET( image != NULL, "wxImage* is NULL" );
|
||||
wxCHECK_RET( image != nullptr, "wxImage* is NULL" );
|
||||
|
||||
m_out->Print( 0, "$Bitmap\n" );
|
||||
m_out->Print( 0, "Pos %-4d %-4d\n",
|
||||
|
@ -2235,7 +2235,7 @@ void SCH_LEGACY_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
||||
{
|
||||
wxCHECK_RET( aSheet != NULL, "SCH_SHEET* is NULL" );
|
||||
wxCHECK_RET( aSheet != nullptr, "SCH_SHEET* is NULL" );
|
||||
|
||||
m_out->Print( 0, "$Sheet\n" );
|
||||
m_out->Print( 0, "S %-4d %-4d %-4d %-4d\n",
|
||||
|
@ -2299,7 +2299,7 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveJunction( SCH_JUNCTION* aJunction )
|
||||
{
|
||||
wxCHECK_RET( aJunction != NULL, "SCH_JUNCTION* is NULL" );
|
||||
wxCHECK_RET( aJunction != nullptr, "SCH_JUNCTION* is NULL" );
|
||||
|
||||
m_out->Print( 0, "Connection ~ %-4d %-4d\n",
|
||||
Iu2Mils( aJunction->GetPosition().x ),
|
||||
|
@ -2309,7 +2309,7 @@ void SCH_LEGACY_PLUGIN::saveJunction( SCH_JUNCTION* aJunction )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveNoConnect( SCH_NO_CONNECT* aNoConnect )
|
||||
{
|
||||
wxCHECK_RET( aNoConnect != NULL, "SCH_NOCONNECT* is NULL" );
|
||||
wxCHECK_RET( aNoConnect != nullptr, "SCH_NOCONNECT* is NULL" );
|
||||
|
||||
m_out->Print( 0, "NoConn ~ %-4d %-4d\n",
|
||||
Iu2Mils( aNoConnect->GetPosition().x ),
|
||||
|
@ -2319,7 +2319,7 @@ void SCH_LEGACY_PLUGIN::saveNoConnect( SCH_NO_CONNECT* aNoConnect )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry )
|
||||
{
|
||||
wxCHECK_RET( aBusEntry != NULL, "SCH_BUS_ENTRY_BASE* is NULL" );
|
||||
wxCHECK_RET( aBusEntry != nullptr, "SCH_BUS_ENTRY_BASE* is NULL" );
|
||||
|
||||
if( aBusEntry->GetLayer() == LAYER_WIRE )
|
||||
m_out->Print( 0, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n",
|
||||
|
@ -2336,7 +2336,7 @@ void SCH_LEGACY_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
|
||||
{
|
||||
wxCHECK_RET( aLine != NULL, "SCH_LINE* is NULL" );
|
||||
wxCHECK_RET( aLine != nullptr, "SCH_LINE* is NULL" );
|
||||
|
||||
const char* layer = "Notes";
|
||||
const char* width = "Line";
|
||||
|
@ -2375,7 +2375,7 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
|
||||
{
|
||||
wxCHECK_RET( aText != NULL, "SCH_TEXT* is NULL" );
|
||||
wxCHECK_RET( aText != nullptr, "SCH_TEXT* is NULL" );
|
||||
|
||||
const char* italics = "~";
|
||||
const char* textType = "Notes";
|
||||
|
@ -2448,7 +2448,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
|
|||
|
||||
void SCH_LEGACY_PLUGIN::saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias )
|
||||
{
|
||||
wxCHECK_RET( aAlias != NULL, "BUS_ALIAS* is NULL" );
|
||||
wxCHECK_RET( aAlias != nullptr, "BUS_ALIAS* is NULL" );
|
||||
|
||||
wxString members = boost::algorithm::join( aAlias->Members(), " " );
|
||||
|
||||
|
@ -2523,17 +2523,17 @@ bool SCH_LEGACY_PLUGIN_CACHE::IsFileChanged() const
|
|||
|
||||
LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
wxCHECK_MSG( aSymbol != NULL, NULL, "NULL pointer cannot be removed from library." );
|
||||
wxCHECK_MSG( aSymbol != nullptr, nullptr, "NULL pointer cannot be removed from library." );
|
||||
|
||||
LIB_SYMBOL* firstChild = NULL;
|
||||
LIB_SYMBOL* firstChild = nullptr;
|
||||
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbol->GetName() );
|
||||
|
||||
if( it == m_symbols.end() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
||||
// have done something terribly wrong.
|
||||
wxCHECK_MSG( *it->second == aSymbol, NULL,
|
||||
wxCHECK_MSG( *it->second == aSymbol, nullptr,
|
||||
"Pointer mismatch while attempting to remove alias entry <" + aSymbol->GetName() +
|
||||
"> from library cache <" + m_libFileName.GetName() + ">." );
|
||||
|
||||
|
@ -2697,7 +2697,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
|
|||
wxString text;
|
||||
wxString aliasName;
|
||||
wxFileName fn = m_libFileName;
|
||||
LIB_SYMBOL* symbol = NULL;;
|
||||
LIB_SYMBOL* symbol = nullptr;;
|
||||
|
||||
fn.SetExt( DOC_EXT );
|
||||
|
||||
|
@ -3275,7 +3275,7 @@ LIB_ARC* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "A", line, &line ), NULL, "Invalid LIB_ARC definition" );
|
||||
wxCHECK_MSG( strCompare( "A", line, &line ), nullptr, "Invalid LIB_ARC definition" );
|
||||
|
||||
LIB_ARC* arc = new LIB_ARC( aSymbol.get() );
|
||||
|
||||
|
@ -3341,7 +3341,7 @@ LIB_CIRCLE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL>& aS
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "C", line, &line ), NULL, "Invalid LIB_CIRCLE definition" );
|
||||
wxCHECK_MSG( strCompare( "C", line, &line ), nullptr, "Invalid LIB_CIRCLE definition" );
|
||||
|
||||
LIB_CIRCLE* circle = new LIB_CIRCLE( aSymbol.get() );
|
||||
|
||||
|
@ -3370,7 +3370,7 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>& aSymbo
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "T", line, &line ), NULL, "Invalid LIB_TEXT definition" );
|
||||
wxCHECK_MSG( strCompare( "T", line, &line ), nullptr, "Invalid LIB_TEXT definition" );
|
||||
|
||||
LIB_TEXT* text = new LIB_TEXT( aSymbol.get() );
|
||||
|
||||
|
@ -3461,7 +3461,7 @@ LIB_RECTANGLE* SCH_LEGACY_PLUGIN_CACHE::loadRectangle( std::unique_ptr<LIB_SYMBO
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "S", line, &line ), NULL, "Invalid LIB_RECTANGLE definition" );
|
||||
wxCHECK_MSG( strCompare( "S", line, &line ), nullptr, "Invalid LIB_RECTANGLE definition" );
|
||||
|
||||
LIB_RECTANGLE* rectangle = new LIB_RECTANGLE( aSymbol.get() );
|
||||
|
||||
|
@ -3493,7 +3493,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "X", line, &line ), NULL, "Invalid LIB_PIN definition" );
|
||||
wxCHECK_MSG( strCompare( "X", line, &line ), nullptr, "Invalid LIB_PIN definition" );
|
||||
|
||||
wxString name;
|
||||
wxString number;
|
||||
|
@ -3683,7 +3683,7 @@ LIB_POLYLINE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMBOL>
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "P", line, &line ), NULL, "Invalid LIB_POLYLINE definition" );
|
||||
wxCHECK_MSG( strCompare( "P", line, &line ), nullptr, "Invalid LIB_POLYLINE definition" );
|
||||
|
||||
LIB_POLYLINE* polyLine = new LIB_POLYLINE( aSymbol.get() );
|
||||
|
||||
|
@ -3714,7 +3714,7 @@ LIB_BEZIER* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL>& aS
|
|||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "B", line, &line ), NULL, "Invalid LIB_BEZIER definition" );
|
||||
wxCHECK_MSG( strCompare( "B", line, &line ), nullptr, "Invalid LIB_BEZIER definition" );
|
||||
|
||||
LIB_BEZIER* bezier = new LIB_BEZIER( aSymbol.get() );
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
SCH_REFERENCE() :
|
||||
m_sheetPath()
|
||||
{
|
||||
m_rootSymbol = NULL;
|
||||
m_libPart = NULL;
|
||||
m_rootSymbol = nullptr;
|
||||
m_libPart = nullptr;
|
||||
m_unit = 0;
|
||||
m_isNew = false;
|
||||
m_numRef = 0;
|
||||
|
|
|
@ -371,7 +371,7 @@ std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
|
|||
SCH_LINE* line = static_cast<SCH_LINE*>( item );
|
||||
|
||||
if( ( test_item->IsEndPoint( line->GetStartPoint() )
|
||||
&& !GetPin( line->GetStartPoint(), NULL, true ) )
|
||||
&& !GetPin( line->GetStartPoint(), nullptr, true ) )
|
||||
|| ( test_item->IsEndPoint( line->GetEndPoint() )
|
||||
&& !GetPin( line->GetEndPoint(), nullptr, true ) ) )
|
||||
{
|
||||
|
@ -509,7 +509,7 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const
|
|||
if( GetItem( aPosition, 1, SCH_JUNCTION_T ) )
|
||||
return true;
|
||||
|
||||
if( GetPin( aPosition, NULL, true ) )
|
||||
if( GetPin( aPosition, nullptr, true ) )
|
||||
return true;
|
||||
|
||||
if( GetWire( aPosition ) )
|
||||
|
@ -832,8 +832,8 @@ void SCH_SCREEN::ClearDrawingState()
|
|||
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol,
|
||||
bool aEndPointOnly ) const
|
||||
{
|
||||
SCH_SYMBOL* candidate = NULL;
|
||||
LIB_PIN* pin = NULL;
|
||||
SCH_SYMBOL* candidate = nullptr;
|
||||
LIB_PIN* pin = nullptr;
|
||||
|
||||
for( SCH_ITEM* item : Items().Overlapping( SCH_SYMBOL_T, aPosition ) )
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol,
|
|||
|
||||
if( aEndPointOnly )
|
||||
{
|
||||
pin = NULL;
|
||||
pin = nullptr;
|
||||
|
||||
if( !candidate->GetLibSymbolRef() )
|
||||
continue;
|
||||
|
@ -1021,7 +1021,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLay
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) const
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1105,7 +1105,7 @@ SCH_SCREEN* SCH_SCREENS::GetFirst()
|
|||
if( m_screens.size() > 0 )
|
||||
return m_screens[0];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ SCH_SCREEN* SCH_SCREENS::GetScreen( unsigned int aIndex ) const
|
|||
if( aIndex < m_screens.size() )
|
||||
return m_screens[ aIndex ];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1132,13 +1132,13 @@ SCH_SHEET* SCH_SCREENS::GetSheet( unsigned int aIndex ) const
|
|||
if( aIndex < m_sheets.size() )
|
||||
return m_sheets[ aIndex ];
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet )
|
||||
{
|
||||
if( aScreen == NULL )
|
||||
if( aScreen == nullptr )
|
||||
return;
|
||||
|
||||
for( const SCH_SCREEN* screen : m_screens )
|
||||
|
|
|
@ -77,7 +77,7 @@ SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const wxPoint& pos ) :
|
|||
m_layer = LAYER_SHEET;
|
||||
m_pos = pos;
|
||||
m_size = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) );
|
||||
m_screen = NULL;
|
||||
m_screen = nullptr;
|
||||
|
||||
for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
|
||||
{
|
||||
|
@ -159,14 +159,14 @@ void SCH_SHEET::SetScreen( SCH_SCREEN* aScreen )
|
|||
if( aScreen == m_screen )
|
||||
return;
|
||||
|
||||
if( m_screen != NULL )
|
||||
if( m_screen != nullptr )
|
||||
{
|
||||
m_screen->DecRefCount();
|
||||
|
||||
if( m_screen->GetRefCount() == 0 )
|
||||
{
|
||||
delete m_screen;
|
||||
m_screen = NULL;
|
||||
m_screen = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ void SCH_SHEET::SetScreen( SCH_SCREEN* aScreen )
|
|||
|
||||
int SCH_SHEET::GetScreenCount() const
|
||||
{
|
||||
if( m_screen == NULL )
|
||||
if( m_screen == nullptr )
|
||||
return 0;
|
||||
|
||||
return m_screen->GetRefCount();
|
||||
|
@ -299,7 +299,7 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
|
|||
|
||||
void SCH_SHEET::AddPin( SCH_SHEET_PIN* aSheetPin )
|
||||
{
|
||||
wxASSERT( aSheetPin != NULL );
|
||||
wxASSERT( aSheetPin != nullptr );
|
||||
wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
|
||||
|
||||
aSheetPin->SetParent( this );
|
||||
|
@ -310,7 +310,7 @@ void SCH_SHEET::AddPin( SCH_SHEET_PIN* aSheetPin )
|
|||
|
||||
void SCH_SHEET::RemovePin( const SCH_SHEET_PIN* aSheetPin )
|
||||
{
|
||||
wxASSERT( aSheetPin != NULL );
|
||||
wxASSERT( aSheetPin != nullptr );
|
||||
wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
|
||||
|
||||
for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
|
||||
|
@ -476,7 +476,7 @@ void SCH_SHEET::CleanupSheet()
|
|||
while( i != m_pins.end() )
|
||||
{
|
||||
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
||||
const SCH_HIERLABEL* HLabel = NULL;
|
||||
const SCH_HIERLABEL* HLabel = nullptr;
|
||||
|
||||
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ void SCH_SHEET::CleanupSheet()
|
|||
}
|
||||
}
|
||||
|
||||
if( HLabel == NULL ) // Hlabel not found: delete sheet label.
|
||||
if( HLabel == nullptr ) // Hlabel not found: delete sheet label.
|
||||
i = m_pins.erase( i );
|
||||
else
|
||||
++i;
|
||||
|
@ -503,7 +503,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
|
|||
return pin;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -757,7 +757,7 @@ void SCH_SHEET::Rotate( const wxPoint& aCenter )
|
|||
|
||||
if( m_fieldsAutoplaced == FIELDS_AUTOPLACED_AUTO )
|
||||
{
|
||||
AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -810,7 +810,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
|
|||
|
||||
// Move the fields if we're in autoplace mode
|
||||
if( m_fieldsAutoplaced == FIELDS_AUTOPLACED_AUTO )
|
||||
AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
// Move the sheet labels according to the new sheet size.
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
|
@ -883,7 +883,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
|
|||
// If caller wants to inspect my type
|
||||
if( stype == SCH_LOCATE_ANY_T || stype == Type() )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( this, nullptr ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOff
|
|||
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( aItem->Type() == SCH_SHEET_PIN_T,
|
||||
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
|
||||
aItem->GetClass() ) );
|
||||
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
|
||||
aItem->GetClass() ) );
|
||||
|
||||
SCH_SHEET_PIN* pin = ( SCH_SHEET_PIN* ) aItem;
|
||||
SCH_TEXT::SwapData( (SCH_TEXT*) pin );
|
||||
|
@ -157,7 +157,7 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
|
|||
{
|
||||
SCH_SHEET* sheet = GetParent();
|
||||
|
||||
if( sheet == NULL )
|
||||
if( sheet == nullptr )
|
||||
return;
|
||||
|
||||
int leftSide = sheet->m_pos.x;
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
return SCH_ITEM::Matches( GetText(), aSearchData );
|
||||
}
|
||||
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = nullptr ) override
|
||||
{
|
||||
return EDA_TEXT::Replace( aSearchData );
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ SCH_SYMBOL::SCH_SYMBOL( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
|||
|
||||
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
||||
const SCH_SHEET_PATH* aSheet, int unit, int convert, const wxPoint& pos ) :
|
||||
SCH_ITEM( NULL, SCH_SYMBOL_T )
|
||||
SCH_ITEM( nullptr, SCH_SYMBOL_T )
|
||||
{
|
||||
Init( pos );
|
||||
|
||||
|
@ -741,7 +741,7 @@ SCH_FIELD* SCH_SYMBOL::FindField( const wxString& aFieldName, bool aIncludeDefau
|
|||
return &m_fields[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -881,7 +881,7 @@ std::vector<SCH_PIN*> SCH_SYMBOL::GetPins( const SCH_SHEET_PATH* aSheet ) const
|
|||
|
||||
void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_SYMBOL_T),
|
||||
wxCHECK_RET( (aItem != nullptr) && (aItem->Type() == SCH_SYMBOL_T),
|
||||
wxT( "Cannot swap data with invalid symbol." ) );
|
||||
|
||||
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
|
||||
|
@ -1570,7 +1570,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|||
|
||||
wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
|
||||
{
|
||||
wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
|
||||
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
|
||||
wxT( "Cannot get physical position of pin." ) );
|
||||
|
||||
return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_pos;
|
||||
|
@ -1611,7 +1611,7 @@ LIB_ITEM* SCH_SYMBOL::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
|
|||
return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ extern std::string toUTFTildaText( const wxString& txt );
|
|||
class SCH_SYMBOL : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
|
||||
SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = nullptr );
|
||||
|
||||
/**
|
||||
* Create schematic symbol from library symbol object.
|
||||
|
|
|
@ -87,6 +87,7 @@ bool IncrementLabelMember( wxString& name, int aIncrement )
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -200,7 +201,7 @@ LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorY()
|
|||
|
||||
|
||||
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
|
||||
SCH_ITEM( NULL, aType ),
|
||||
SCH_ITEM( nullptr, aType ),
|
||||
EDA_TEXT( text ),
|
||||
m_shape( PINSHEETLABEL_SHAPE::PS_INPUT ),
|
||||
m_isDangling( false ),
|
||||
|
@ -792,6 +793,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
|
||||
|
@ -969,7 +971,7 @@ SEARCH_RESULT SCH_GLOBALLABEL::Visit( INSPECTOR aInspector, void* testData,
|
|||
// If caller wants to inspect my type
|
||||
if( stype == SCH_LOCATE_ANY_T || stype == Type() )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( this, NULL ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( this, nullptr ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
class SCH_FIELD_VALIDATOR : public wxTextValidator
|
||||
{
|
||||
public:
|
||||
SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aValue = NULL );
|
||||
SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxString* aValue = nullptr );
|
||||
|
||||
SCH_FIELD_VALIDATOR( const SCH_FIELD_VALIDATOR& aValidator );
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override
|
||||
{
|
||||
wxCommandEvent* event = NULL;
|
||||
wxCommandEvent* event = nullptr;
|
||||
|
||||
switch( aNewState )
|
||||
{
|
||||
|
@ -339,8 +339,7 @@ void SIM_PLOT_FRAME::initWorkbook()
|
|||
|
||||
void SIM_PLOT_FRAME::updateTitle()
|
||||
{
|
||||
wxFileName filename = Prj().AbsolutePath(
|
||||
m_simulator->Settings()->GetWorkbookFilename() );
|
||||
wxFileName filename = Prj().AbsolutePath( m_simulator->Settings()->GetWorkbookFilename() );
|
||||
|
||||
bool readOnly = false;
|
||||
bool unsaved = false;
|
||||
|
@ -818,7 +817,7 @@ void SIM_PLOT_FRAME::updateSignalList()
|
|||
wxMemoryDC bmDC;
|
||||
const int isize = bmDC.GetCharHeight();
|
||||
|
||||
if( m_signalsIconColorList == NULL )
|
||||
if( m_signalsIconColorList == nullptr )
|
||||
m_signalsIconColorList = new wxImageList( isize, isize, false );
|
||||
else
|
||||
m_signalsIconColorList->RemoveAll();
|
||||
|
@ -1068,6 +1067,7 @@ bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
SIM_PLOT_TYPE SIM_PLOT_FRAME::getXAxisType( SIM_TYPE aType ) const
|
||||
{
|
||||
switch( aType )
|
||||
|
@ -1545,14 +1545,14 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event )
|
|||
sizer->Add( text, 1, wxEXPAND );
|
||||
SetSizer( sizer );
|
||||
|
||||
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ), NULL,
|
||||
this );
|
||||
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),
|
||||
nullptr, this );
|
||||
|
||||
finishDialogSettings();
|
||||
}
|
||||
};
|
||||
|
||||
if( m_schematicFrame == NULL || m_simulator == NULL )
|
||||
if( m_schematicFrame == nullptr || m_simulator == nullptr )
|
||||
return;
|
||||
|
||||
NETLIST_VIEW_DIALOG dlg( this, m_simulator->GetNetlist() );
|
||||
|
@ -1793,7 +1793,7 @@ SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::SIGNAL_CONTEXT_MENU( const wxString& aSigna
|
|||
AddMenuItem( this, SHOW_CURSOR, _( "Show Cursor" ), KiBitmap( BITMAPS::pcb_target ) );
|
||||
|
||||
Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( SIGNAL_CONTEXT_MENU::onMenuEvent ),
|
||||
NULL, this );
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ void SIM_PLOT_PANEL::UpdateTraceStyle( TRACE* trace )
|
|||
bool SIM_PLOT_PANEL::addTrace( const wxString& aName, int aPoints, const double* aX,
|
||||
const double* aY, SIM_PLOT_TYPE aType, const wxString& aParam )
|
||||
{
|
||||
TRACE* trace = NULL;
|
||||
TRACE* trace = nullptr;
|
||||
wxString name = aName;
|
||||
|
||||
if( aType & SPT_AC_MAG )
|
||||
|
@ -601,7 +601,7 @@ void SIM_PLOT_PANEL::EnableCursor( const wxString& aName, bool aEnable )
|
|||
else
|
||||
{
|
||||
CURSOR* c = t->GetCursor();
|
||||
t->SetCursor( NULL );
|
||||
t->SetCursor( nullptr );
|
||||
m_plotWin->DelLayer( c, true );
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ public:
|
|||
{
|
||||
auto trace = m_traces.find( aName );
|
||||
|
||||
return trace == m_traces.end() ? NULL : trace->second;
|
||||
return trace == m_traces.end() ? nullptr : trace->second;
|
||||
}
|
||||
|
||||
void ShowGrid( bool aEnable )
|
||||
|
@ -270,10 +270,10 @@ public:
|
|||
///< Returns true if the trace has cursor shown.
|
||||
bool HasCursorEnabled( const wxString& aName ) const;
|
||||
|
||||
///< Toggles cursor for a particular trace.
|
||||
///< Toggle cursor for a particular trace.
|
||||
void EnableCursor( const wxString& aName, bool aEnable );
|
||||
|
||||
///< Resets scale ranges to fit the current traces
|
||||
///< Reset scale ranges to fit the current traces.
|
||||
void ResetScales();
|
||||
|
||||
///< Update trace line style
|
||||
|
|
|
@ -129,7 +129,7 @@ void SYMBOL_EDIT_FRAME::ExportSymbol()
|
|||
fn = dlg.GetPath();
|
||||
fn.MakeAbsolute();
|
||||
|
||||
LIB_SYMBOL* old_symbol = NULL;
|
||||
LIB_SYMBOL* old_symbol = nullptr;
|
||||
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromLibPath( fn.GetFullPath() );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
* a row is not found in this table. No ownership is
|
||||
* taken of aFallBackTable.
|
||||
*/
|
||||
SYMBOL_LIB_TABLE( SYMBOL_LIB_TABLE* aFallBackTable = NULL );
|
||||
SYMBOL_LIB_TABLE( SYMBOL_LIB_TABLE* aFallBackTable = nullptr );
|
||||
|
||||
/**
|
||||
* Return an SYMBOL_LIB_TABLE_ROW if \a aNickName is found in this table or in any chained
|
||||
|
|
|
@ -253,7 +253,7 @@ public:
|
|||
* Save or load the names of the currently configured symbol libraries (without paths).
|
||||
*/
|
||||
static void LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
||||
wxString* aPaths, wxArrayString* aNames=NULL );
|
||||
wxString* aPaths, wxArrayString* aNames = nullptr );
|
||||
|
||||
/**
|
||||
* Return the name of the cache library after potentially fixing it from
|
||||
|
|
|
@ -154,10 +154,10 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
|
|||
ReCreateMenuBar();
|
||||
|
||||
m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
|
||||
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
|
||||
|
||||
m_symbolList = new wxListBox( this, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
|
||||
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
|
||||
|
||||
if( aLibraryName.empty() )
|
||||
{
|
||||
|
@ -178,13 +178,15 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
|
|||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
// Manage main toolbar
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
||||
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
|
||||
.Bottom().Layer( 6 ) );
|
||||
|
||||
m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(3)
|
||||
.CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_libListWidth, -1 ) );
|
||||
m_auimgr.AddPane( m_symbolList, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1)
|
||||
.CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_symbolListWidth, -1 ) );
|
||||
.CaptionVisible( false ).MinSize( 80, -1 )
|
||||
.BestSize( m_symbolListWidth, -1 ) );
|
||||
|
||||
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||
|
||||
|
@ -208,7 +210,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
|
|||
double max_size_x = Millimeter2iu( 450 );
|
||||
double max_size_y = Millimeter2iu( 450 );
|
||||
BOX2D bbox;
|
||||
bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
|
||||
bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
|
||||
bbox.SetSize( max_size_x, max_size_y );
|
||||
GetCanvas()->GetView()->SetBoundary( bbox );
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
|
@ -466,7 +468,9 @@ void SYMBOL_VIEWER_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent )
|
|||
m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) );
|
||||
}
|
||||
else if( m_unitChoice->GetCount() )
|
||||
{
|
||||
m_unitChoice->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -544,7 +548,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
|
|||
|
||||
bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
|
||||
{
|
||||
if( m_symbolList == NULL )
|
||||
if( m_symbolList == nullptr )
|
||||
return false;
|
||||
|
||||
wxArrayString aliasNames;
|
||||
|
|
|
@ -129,7 +129,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
|
|||
|
||||
FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
|
||||
|
||||
if( cmpFile == NULL )
|
||||
if( cmpFile == nullptr )
|
||||
return false;
|
||||
|
||||
// cmpFileReader dtor will close cmpFile
|
||||
|
|
|
@ -74,7 +74,7 @@ VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I &aMousePos, int aLayer,
|
|||
ANCHOR* nearestOutline = nearestAnchor( aMousePos, OUTLINE, aLayer );
|
||||
ANCHOR* nearestCorner = nearestAnchor( aMousePos, CORNER, aLayer );
|
||||
ANCHOR* nearestOrigin = nearestAnchor( aMousePos, ORIGIN, aLayer );
|
||||
ANCHOR* best = NULL;
|
||||
ANCHOR* best = nullptr;
|
||||
double minDist = std::numeric_limits<double>::max();
|
||||
|
||||
if( nearestOrigin )
|
||||
|
@ -298,14 +298,16 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
|
|||
{
|
||||
VECTOR2I possible( line->GetStartPoint().x, pt.y );
|
||||
|
||||
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(), 0 ) )
|
||||
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(),
|
||||
0 ) )
|
||||
addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
|
||||
}
|
||||
else if( line->GetStartPoint().y == line->GetEndPoint().y )
|
||||
{
|
||||
VECTOR2I possible( pt.x, line->GetStartPoint().y );
|
||||
|
||||
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(), 0 ) )
|
||||
if( TestSegmentHit( wxPoint( possible ), line->GetStartPoint(), line->GetEndPoint(),
|
||||
0 ) )
|
||||
addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
|
||||
}
|
||||
|
||||
|
@ -317,7 +319,7 @@ EE_GRID_HELPER::ANCHOR* EE_GRID_HELPER::nearestAnchor( const VECTOR2I& aPos, int
|
|||
int aMatchLayer )
|
||||
{
|
||||
double minDist = std::numeric_limits<double>::max();
|
||||
ANCHOR* best = NULL;
|
||||
ANCHOR* best = nullptr;
|
||||
|
||||
for( ANCHOR& a : m_anchors )
|
||||
{
|
||||
|
|
|
@ -580,7 +580,7 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
// Update the fields if we're in autoplace mode
|
||||
if( sheet->GetFieldsAutoplaced() == FIELDS_AUTOPLACED_AUTO )
|
||||
sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
// Keep sheet pins attached to edges:
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
|
|
|
@ -90,7 +90,7 @@ bool SCH_DRAWING_TOOLS::Init()
|
|||
|
||||
EDA_RECT SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels()
|
||||
{
|
||||
// calculate thearea of the canvas in pixels that create no autopan when
|
||||
// calculate the area of the canvas in pixels that create no autopan when
|
||||
// is inside this area the mouse cursor
|
||||
wxSize canvas_size = m_frame->GetCanvas()->GetSize();
|
||||
EDA_RECT canvas_area( wxPoint( 0, 0 ), canvas_size );
|
||||
|
@ -256,7 +256,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
controls->WarpCursor( controls->GetCursorPosition(), true );
|
||||
else if( !canvas_area.Contains( wxPoint( newMousePos ) ) )
|
||||
// The mouse is outside the canvas area, after closing the dialog,
|
||||
// thus can creating autopan issues. Warp the mouse to the canvas centre
|
||||
// thus can creating autopan issues. Warp the mouse to the canvas center
|
||||
controls->WarpCursor( canvas_area.Centre(), false );
|
||||
|
||||
LIB_SYMBOL* libSymbol = sel.LibId.IsValid() ?
|
||||
|
@ -275,7 +275,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
|
||||
symbol->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
symbol->ClearEditFlags();
|
||||
|
||||
|
@ -501,7 +501,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
controls->WarpCursor( controls->GetCursorPosition(), true );
|
||||
else if( !canvas_area.Contains( wxPoint( newMousePos ) ) )
|
||||
// The mouse is outside the canvas area, after closing the dialog,
|
||||
// thus can creating autopan issues. Warp the mouse to the canvas centre
|
||||
// thus can creating autopan issues. Warp the mouse to the canvas center
|
||||
controls->WarpCursor( canvas_area.Centre(), false );
|
||||
|
||||
cursorPos = controls->GetMousePosition( true );
|
||||
|
@ -1175,9 +1175,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
controls->SetCursorPosition( cursorPos, false );
|
||||
}
|
||||
|
||||
// ... and second click places:
|
||||
else
|
||||
else // ... and second click places:
|
||||
{
|
||||
item->ClearFlags( IS_MOVING );
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item,
|
||||
|
@ -1336,7 +1334,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(),
|
||||
static_cast<wxPoint>( cursorPos ) );
|
||||
sheet->SetFlags( IS_NEW | IS_RESIZING );
|
||||
sheet->SetScreen( NULL );
|
||||
sheet->SetScreen( nullptr );
|
||||
sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness );
|
||||
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
|
||||
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
||||
|
@ -1376,7 +1374,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
if( m_frame->EditSheetProperties( static_cast<SCH_SHEET*>( sheet ),
|
||||
&m_frame->GetCurrentSheet(), nullptr ) )
|
||||
{
|
||||
sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), sheet, false );
|
||||
m_frame->UpdateHierarchyNavigator();
|
||||
|
|
|
@ -288,7 +288,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
wxString name = pin->GetName();
|
||||
LIB_PIN* next_pin = symbol->GetNextPin();
|
||||
|
||||
while( next_pin != NULL )
|
||||
while( next_pin != nullptr )
|
||||
{
|
||||
pin = next_pin;
|
||||
next_pin = symbol->GetNextPin( pin );
|
||||
|
@ -468,7 +468,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
|
||||
{
|
||||
if( aItem == NULL )
|
||||
if( aItem == nullptr )
|
||||
return;
|
||||
|
||||
DIALOG_LIB_EDIT_DRAW_ITEM dlg( m_frame, aItem );
|
||||
|
@ -492,7 +492,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
|
|||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editTextProperties( LIB_ITEM* aItem )
|
||||
{
|
||||
if ( ( aItem == NULL ) || ( aItem->Type() != LIB_TEXT_T ) )
|
||||
if ( ( aItem == nullptr ) || ( aItem->Type() != LIB_TEXT_T ) )
|
||||
return;
|
||||
|
||||
DIALOG_LIB_EDIT_TEXT dlg( m_frame, (LIB_TEXT*) aItem );
|
||||
|
@ -508,7 +508,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editTextProperties( LIB_ITEM* aItem )
|
|||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
||||
{
|
||||
if( aField == NULL )
|
||||
if( aField == nullptr )
|
||||
return;
|
||||
|
||||
wxString caption;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2015-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
|
||||
|
@ -53,10 +53,8 @@ EDA_RECT TRANSFORM::TransformCoordinate( const EDA_RECT& aRect ) const
|
|||
return rect;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the Inverse mirror/rotation transform.
|
||||
*/
|
||||
TRANSFORM TRANSFORM::InverseTransform( ) const
|
||||
|
||||
TRANSFORM TRANSFORM::InverseTransform() const
|
||||
{
|
||||
int invx1;
|
||||
int invx2;
|
||||
|
@ -64,9 +62,9 @@ TRANSFORM TRANSFORM::InverseTransform( ) const
|
|||
int invy2;
|
||||
|
||||
/* Calculates the inverse matrix coeffs:
|
||||
* for a matrix m{x1, x2, y1, y2}
|
||||
* the inverse matrix is 1/(x1*y2 -x2*y1) m{y2,-x2,-y1,x1)
|
||||
*/
|
||||
* for a matrix m{x1, x2, y1, y2}
|
||||
* the inverse matrix is 1/(x1*y2 -x2*y1) m{y2,-x2,-y1,x1)
|
||||
*/
|
||||
int det = x1*y2 -x2*y1; // Is never null, because the inverse matrix exists
|
||||
invx1 = y2/det;
|
||||
invx2 = -x2/det;
|
||||
|
@ -80,7 +78,7 @@ TRANSFORM TRANSFORM::InverseTransform( ) const
|
|||
|
||||
bool TRANSFORM::MapAngles( int* aAngle1, int* aAngle2 ) const
|
||||
{
|
||||
wxCHECK_MSG( aAngle1 != NULL && aAngle2 != NULL, false,
|
||||
wxCHECK_MSG( aAngle1 != nullptr && aAngle2 != nullptr, false,
|
||||
wxT( "Cannot map NULL point angles." ) );
|
||||
|
||||
int Angle, Delta;
|
||||
|
@ -88,6 +86,7 @@ bool TRANSFORM::MapAngles( int* aAngle1, int* aAngle2 ) const
|
|||
bool swap = false;
|
||||
|
||||
Delta = *aAngle2 - *aAngle1;
|
||||
|
||||
if( Delta >= 1800 )
|
||||
{
|
||||
*aAngle1 -= 1;
|
||||
|
@ -110,6 +109,7 @@ bool TRANSFORM::MapAngles( int* aAngle1, int* aAngle2 ) const
|
|||
|
||||
NORMALIZE_ANGLE_POS( *aAngle1 );
|
||||
NORMALIZE_ANGLE_POS( *aAngle2 );
|
||||
|
||||
if( *aAngle2 < *aAngle1 )
|
||||
*aAngle2 += 3600;
|
||||
|
||||
|
@ -121,8 +121,10 @@ bool TRANSFORM::MapAngles( int* aAngle1, int* aAngle2 ) const
|
|||
|
||||
NORMALIZE_ANGLE_POS( *aAngle1 );
|
||||
NORMALIZE_ANGLE_POS( *aAngle2 );
|
||||
|
||||
if( *aAngle2 < *aAngle1 )
|
||||
*aAngle2 += 3600;
|
||||
|
||||
swap = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Simon Richter <Simon.Richter@hogyros.de>
|
||||
* Copyright (C) 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
|
||||
|
@ -35,15 +36,15 @@ public:
|
|||
/// @todo C++11: replace with forwarder
|
||||
|
||||
PinShapeComboBox( wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxBitmapComboBoxNameStr );
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = nullptr,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxBitmapComboBoxNameStr );
|
||||
|
||||
GRAPHIC_PINSHAPE GetPinShapeSelection();
|
||||
void SetSelection( GRAPHIC_PINSHAPE aShape );
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Simon Richter <Simon.Richter@hogyros.de>
|
||||
* Copyright (C) 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
|
||||
|
@ -36,15 +37,15 @@ public:
|
|||
/// @todo C++11: replace with forwarder
|
||||
|
||||
PinTypeComboBox( wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxBitmapComboBoxNameStr );
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = nullptr,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxBitmapComboBoxNameStr );
|
||||
|
||||
ELECTRICAL_PINTYPE GetPinTypeSelection();
|
||||
void SetSelection( ELECTRICAL_PINTYPE aType );
|
||||
|
|
|
@ -60,7 +60,7 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
|
|||
|
||||
// Do not display the grid: the look is not good for a small canvas area.
|
||||
// But mainly, due to some strange bug I (JPC) was unable to fix, the grid creates
|
||||
// strange artifacts on Windows when eeschema is run from Kicad manager (but not in
|
||||
// strange artifacts on Windows when Eeschema is run from KiCad manager (but not in
|
||||
// stand alone...).
|
||||
m_preview->GetGAL()->SetGridVisibility( false );
|
||||
|
||||
|
@ -105,7 +105,7 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
|
|||
SetSizer( m_outerSizer );
|
||||
Layout();
|
||||
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( SYMBOL_PREVIEW_WIDGET::onSize ), NULL, this );
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( SYMBOL_PREVIEW_WIDGET::onSize ), nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, i
|
|||
|
||||
view->Add( m_previewItem );
|
||||
|
||||
// Get the symbole size, in internal units
|
||||
// Get the symbol size, in internal units
|
||||
m_itemBBox = m_previewItem->GetUnitBoundingBox( settings->m_ShowUnit,
|
||||
settings->m_ShowConvert );
|
||||
|
||||
|
@ -241,7 +241,9 @@ void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aCo
|
|||
m_previewItem = new LIB_SYMBOL( *aSymbol );
|
||||
|
||||
// For symbols having a De Morgan body style, use the first style
|
||||
auto settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
|
||||
auto settings =
|
||||
static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
|
||||
|
||||
// If unit isn't specified for a multi-unit part, pick the first. (Otherwise we'll
|
||||
// draw all of them.)
|
||||
settings->m_ShowUnit = ( m_previewItem->IsMulti() && aUnit == 0 ) ? 1 : aUnit;
|
||||
|
@ -251,7 +253,7 @@ void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aCo
|
|||
|
||||
view->Add( m_previewItem );
|
||||
|
||||
// Get the symbole size, in internal units
|
||||
// Get the symbol size, in internal units
|
||||
m_itemBBox = aSymbol->GetUnitBoundingBox( settings->m_ShowUnit, settings->m_ShowConvert );
|
||||
|
||||
// Calculate the draw scale to fit the drawing area
|
||||
|
|
|
@ -53,7 +53,7 @@ TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aFrame, wxWindow* aParent, SCH_SYMBO
|
|||
updateSlider();
|
||||
|
||||
m_simTimer.SetOwner( this );
|
||||
Connect( wxEVT_TIMER, wxTimerEventHandler( TUNER_SLIDER::onSimTimer ), NULL, this );
|
||||
Connect( wxEVT_TIMER, wxTimerEventHandler( TUNER_SLIDER::onSimTimer ), nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,7 +201,7 @@ void TUNER_SLIDER::onMinTextEnter( wxCommandEvent& event )
|
|||
|
||||
void TUNER_SLIDER::onSimTimer( wxTimerEvent& event )
|
||||
{
|
||||
if(m_changed)
|
||||
if( m_changed )
|
||||
{
|
||||
wxQueueEvent( m_frame, new wxCommandEvent( EVT_SIM_UPDATE ) );
|
||||
m_changed = false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2014 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,33 +45,24 @@
|
|||
#include <X2_gerber_attributes.h>
|
||||
#include <macros.h>
|
||||
|
||||
/*
|
||||
* X2_ATTRIBUTE
|
||||
* The attribute value consists of a number of substrings separated by a comma
|
||||
*/
|
||||
|
||||
X2_ATTRIBUTE::X2_ATTRIBUTE()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
X2_ATTRIBUTE::~X2_ATTRIBUTE()
|
||||
{
|
||||
}
|
||||
|
||||
/* return the attribute name (for instance .FileFunction)
|
||||
* which is given by TF command.
|
||||
*/
|
||||
|
||||
const wxString& X2_ATTRIBUTE::GetAttribute()
|
||||
{
|
||||
return m_Prms.Item( 0 );
|
||||
}
|
||||
|
||||
/* return a parameter
|
||||
* aIdx = the index of the parameter
|
||||
* aIdx = 0 is the parameter read after the TF function
|
||||
* (the same as GetAttribute())
|
||||
*/
|
||||
const wxString& X2_ATTRIBUTE::GetPrm( int aIdx)
|
||||
|
||||
const wxString& X2_ATTRIBUTE::GetPrm( int aIdx )
|
||||
{
|
||||
static const wxString dummy;
|
||||
|
||||
|
@ -81,15 +72,16 @@ const wxString& X2_ATTRIBUTE::GetPrm( int aIdx)
|
|||
return dummy;
|
||||
}
|
||||
|
||||
// Debug function: print using wxLogMessage the list of parameters
|
||||
|
||||
void X2_ATTRIBUTE::DbgListPrms()
|
||||
{
|
||||
wxLogMessage( wxT("prms count %d"), GetPrmCount() );
|
||||
wxLogMessage( wxT( "prms count %d" ), GetPrmCount() );
|
||||
|
||||
for( int ii = 0; ii < GetPrmCount(); ii++ )
|
||||
wxLogMessage( m_Prms.Item( ii ) );
|
||||
}
|
||||
|
||||
|
||||
bool X2_ATTRIBUTE::ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char* &aText,
|
||||
int& aLineNum )
|
||||
{
|
||||
|
@ -136,7 +128,7 @@ bool X2_ATTRIBUTE::ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, ch
|
|||
// end of current line, read another one.
|
||||
if( aBuffer && aFile )
|
||||
{
|
||||
if( fgets( aBuffer, aBuffSize, aFile ) == NULL )
|
||||
if( fgets( aBuffer, aBuffSize, aFile ) == nullptr )
|
||||
{
|
||||
// end of file
|
||||
ok = false;
|
||||
|
@ -147,27 +139,15 @@ bool X2_ATTRIBUTE::ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, ch
|
|||
aText = aBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* X2_ATTRIBUTE_FILEFUNCTION ( from %TF.FileFunction in Gerber file)
|
||||
* Example file function:
|
||||
* %TF.FileFunction,Copper,L1,Top*%
|
||||
* - Type. Such as copper, solder mask etc.
|
||||
* - Position. Specifies where the file appears in the PCB layer structure.
|
||||
* Corresponding position substring:
|
||||
* Copper layer: L1, L2, L3...to indicate the layer position followed by Top, Inr or
|
||||
* Bot. L1 is always the top copper layer. E.g. L2,Inr.
|
||||
* Extra layer, e.g. solder mask: Top or Bot - defines the attachment of the layer.
|
||||
* Drill/rout layer: E.g. 1,4 - where 1 is the start and 4 is the end copper layer. The
|
||||
* pair 1,4 defines the span of the drill/rout file
|
||||
* Optional index. This can be used in instances where for example there are two solder
|
||||
* masks on the same side. The index counts from the PCB surface outwards.
|
||||
*/
|
||||
|
||||
X2_ATTRIBUTE_FILEFUNCTION::X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase )
|
||||
: X2_ATTRIBUTE()
|
||||
{
|
||||
|
@ -181,18 +161,21 @@ X2_ATTRIBUTE_FILEFUNCTION::X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBa
|
|||
set_Z_Order();
|
||||
}
|
||||
|
||||
|
||||
const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetFileType()
|
||||
{
|
||||
// the type of layer (Copper, Soldermask ... )
|
||||
return m_Prms.Item( 1 );
|
||||
}
|
||||
|
||||
|
||||
const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetBrdLayerId()
|
||||
{
|
||||
// the brd layer identifier: Ln (for Copper type) or Top, Bot
|
||||
return m_Prms.Item( 2 );
|
||||
}
|
||||
|
||||
|
||||
const wxString X2_ATTRIBUTE_FILEFUNCTION::GetDrillLayerPair()
|
||||
{
|
||||
// the layer pair identifiers, for drill files, i.e.
|
||||
|
@ -201,6 +184,7 @@ const wxString X2_ATTRIBUTE_FILEFUNCTION::GetDrillLayerPair()
|
|||
return lpair;
|
||||
}
|
||||
|
||||
|
||||
const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetBrdLayerSide()
|
||||
{
|
||||
if( IsCopper() )
|
||||
|
@ -250,11 +234,6 @@ bool X2_ATTRIBUTE_FILEFUNCTION::IsDrillFile()
|
|||
}
|
||||
|
||||
|
||||
// Initialize the z order priority of the current file, from its attributes
|
||||
// this priority is the order of layers from top to bottom to draw/display gerber images
|
||||
// Stack up is( from external copper layer to external)
|
||||
// copper, then solder paste, then solder mask, then silk screen.
|
||||
// and global stackup is Front (top) layers then internal copper layers then Back (bottom) layers
|
||||
void X2_ATTRIBUTE_FILEFUNCTION::set_Z_Order()
|
||||
{
|
||||
m_z_order = -100; // low level
|
||||
|
@ -266,6 +245,7 @@ void X2_ATTRIBUTE_FILEFUNCTION::set_Z_Order()
|
|||
m_z_order = 0;
|
||||
wxString num = GetBrdLayerId().Mid( 1 );
|
||||
long lnum;
|
||||
|
||||
if( num.ToLong( &lnum ) )
|
||||
m_z_sub_order = -lnum;
|
||||
}
|
||||
|
|
|
@ -37,16 +37,16 @@
|
|||
|
||||
|
||||
/**
|
||||
* Function scaletoIU
|
||||
* converts a distance given in floating point to our internal units
|
||||
* Convert a distance given in floating point to our internal units.
|
||||
*/
|
||||
extern int scaletoIU( double aCoord, bool isMetric ); // defined it rs274d_read_XY_and_IJ_coordinates.cpp
|
||||
extern int scaletoIU( double aCoord, bool isMetric );
|
||||
|
||||
|
||||
/**
|
||||
* Function mapPt
|
||||
* translates a point from the aperture macro coordinate system to our
|
||||
* Translate a point from the aperture macro coordinate system to our
|
||||
* deci-mils coordinate system.
|
||||
* @return wxPoint - The GerbView coordinate system vector.
|
||||
*
|
||||
* @return The GerbView coordinate system vector.
|
||||
*/
|
||||
static wxPoint mapPt( double x, double y, bool isMetric )
|
||||
{
|
||||
|
@ -89,22 +89,28 @@ bool AM_PRIMITIVE::IsAMPrimitiveExposureOn( const GERBER_DRAW_ITEM* aParent ) co
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO(snh): Remove hard coded count
|
||||
const int seg_per_circle = 64; // Number of segments to approximate a circle
|
||||
|
||||
void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
||||
SHAPE_POLY_SET& aShapeBuffer,
|
||||
|
||||
void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer,
|
||||
wxPoint aShapePos )
|
||||
{
|
||||
#define TO_POLY_SHAPE { if( polybuffer.size() > 1 )\
|
||||
{ aShapeBuffer.NewOutline(); \
|
||||
for( unsigned jj = 0; jj < polybuffer.size(); jj++ )\
|
||||
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y );\
|
||||
aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y );}\
|
||||
}
|
||||
#define TO_POLY_SHAPE \
|
||||
{ \
|
||||
if( polybuffer.size() > 1 ) \
|
||||
{ \
|
||||
aShapeBuffer.NewOutline(); \
|
||||
for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) \
|
||||
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y ); \
|
||||
aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y ); \
|
||||
} \
|
||||
}
|
||||
|
||||
// Draw the primitive shape for flashed items.
|
||||
static std::vector<wxPoint> polybuffer; // create a static buffer to avoid a lot of memory reallocation
|
||||
// Create a static buffer to avoid a lot of memory reallocation.
|
||||
static std::vector<wxPoint> polybuffer;
|
||||
polybuffer.clear();
|
||||
|
||||
wxPoint curPos = aShapePos;
|
||||
|
@ -144,8 +150,8 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
|
||||
TO_POLY_SHAPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_LINE2:
|
||||
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
|
||||
|
@ -178,8 +184,8 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
|
||||
TO_POLY_SHAPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_LINE_CENTER:
|
||||
{
|
||||
|
@ -210,8 +216,8 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
|
||||
TO_POLY_SHAPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_LINE_LOWER_LEFT:
|
||||
{
|
||||
|
@ -238,8 +244,8 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
|
||||
TO_POLY_SHAPE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_THERMAL:
|
||||
{
|
||||
|
@ -248,7 +254,8 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
* type (7), center.x , center.y, outside diam, inside diam, crosshair thickness, rotation
|
||||
* type is not stored in parameters list, so the first parameter is center.x
|
||||
*
|
||||
* The thermal primitive is a ring (annulus) interrupted by four gaps. Exposure is always on.
|
||||
* The thermal primitive is a ring (annulus) interrupted by four gaps. Exposure is always
|
||||
* on.
|
||||
*/
|
||||
std::vector<wxPoint> subshape_poly;
|
||||
curPos += mapPt( params[0].GetValue( tool ), params[1].GetValue( tool ), m_GerbMetric );
|
||||
|
@ -290,8 +297,9 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
|
||||
/* Generated by an aperture macro declaration like:
|
||||
* "6,0,0,0.125,.01,0.01,3,0.003,0.150,0"
|
||||
* type(6), pos.x, pos.y, diam, penwidth, gap, circlecount, crosshair thickness, crosshaire len, rotation
|
||||
* type is not stored in parameters list, so the first parameter is pos.x
|
||||
* type(6), pos.x, pos.y, diam, penwidth, gap, circlecount, crosshair thickness,
|
||||
* crosshair len, rotation. The type is not stored in parameters list, so the first
|
||||
* parameter is pos.x.
|
||||
*/
|
||||
int outerDiam = scaletoIU( params[2].GetValue( tool ), m_GerbMetric );
|
||||
int penThickness = scaletoIU( params[3].GetValue( tool ), m_GerbMetric );
|
||||
|
@ -300,8 +308,9 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
|
||||
// Draw circles:
|
||||
wxPoint center = aParent->GetABPosition( curPos );
|
||||
|
||||
// adjust outerDiam by this on each nested circle
|
||||
int diamAdjust = (gap + penThickness) * 2;
|
||||
int diamAdjust = ( gap + penThickness ) * 2;
|
||||
|
||||
for( int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
|
||||
{
|
||||
|
@ -327,37 +336,42 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
ConvertShapeToPolygon( aParent, polybuffer );
|
||||
|
||||
rotation = params[8].GetValue( tool ) * 10.0;
|
||||
|
||||
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
||||
{
|
||||
// shape rotation:
|
||||
RotatePoint( &polybuffer[ii], -rotation );
|
||||
|
||||
// Move to current position:
|
||||
polybuffer[ii] += curPos;
|
||||
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
||||
}
|
||||
|
||||
TO_POLY_SHAPE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case AMP_OUTLINE:
|
||||
{
|
||||
/* Outline, Primitive Code 4
|
||||
* An outline primitive is an area enclosed by an n-point polygon defined by its start point and n
|
||||
* subsequent points. The outline must be closed, i.e. the last point must be equal to the start
|
||||
* point. There must be at least one subsequent point (to close the outline).
|
||||
* The outline of the primitive is actually the contour (see 2.6) that consists of linear segments
|
||||
* only, so it must conform to all the requirements described for contours.
|
||||
* An outline primitive is an area enclosed by an n-point polygon defined by its start
|
||||
* point and n
|
||||
* subsequent points. The outline must be closed, i.e. the last point must be equal to
|
||||
* the start point. There must be at least one subsequent point (to close the outline).
|
||||
* The outline of the primitive is actually the contour (see 2.6) that consists of linear
|
||||
* segments only, so it must conform to all the requirements described for contours.
|
||||
* Warning: Make no mistake: n is the number of subsequent points, being the number of
|
||||
* vertices of the outline or one less than the number of coordinate pairs.
|
||||
*/
|
||||
/* Generated by an aperture macro declaration like:
|
||||
* "4,1,3,0.0,0.0,0.0,0.5,0.5,0.5,0.5,0.0,-25"
|
||||
* type(4), exposure, corners count, corner1.x, corner.1y, ..., corner1.x, corner.1y, rotation
|
||||
* type(4), exposure, corners count, corner1.x, corner.1y, ..., corner1.x, corner.1y,
|
||||
* rotation
|
||||
* type is not stored in parameters list, so the first parameter is exposure
|
||||
*/
|
||||
// params[0] is the exposure and params[1] is the corners count after the first corner
|
||||
int numCorners = (int) params[1].GetValue( tool );
|
||||
|
||||
// the shape rotation is the last param of list, after corners
|
||||
int last_prm = params.size() - 1;
|
||||
rotation = params[last_prm].GetValue( tool ) * 10.0;
|
||||
|
@ -383,12 +397,12 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
if( prm_idx >= last_prm )
|
||||
break;
|
||||
}
|
||||
// rotate polygon and move it to the actual position
|
||||
// shape rotation:
|
||||
|
||||
// rotate polygon and move it to the actual position shape rotation:
|
||||
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
||||
{
|
||||
RotatePoint( &polybuffer[ii], -rotation );
|
||||
}
|
||||
}
|
||||
|
||||
// Move to current position:
|
||||
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
||||
|
@ -397,14 +411,14 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
||||
}
|
||||
|
||||
break;
|
||||
TO_POLY_SHAPE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_POLYGON:
|
||||
/* Polygon, Primitive Code 5
|
||||
* A polygon primitive is a regular polygon defined by the number of vertices n, the center point
|
||||
* and the diameter of the circumscribed circle
|
||||
* A polygon primitive is a regular polygon defined by the number of vertices n, the
|
||||
* center point and the diameter of the circumscribed circle
|
||||
*/
|
||||
/* Generated by an aperture macro declaration like:
|
||||
* "5,1,0.6,0,0,0.5,25"
|
||||
|
@ -412,6 +426,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
* type is not stored in parameters list, so the first parameter is exposure
|
||||
*/
|
||||
curPos += mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric );
|
||||
|
||||
// Creates the shape:
|
||||
ConvertShapeToPolygon( aParent, polybuffer );
|
||||
|
||||
|
@ -439,16 +454,6 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function ConvertShapeToPolygon (virtual)
|
||||
* convert a shape to an equivalent polygon.
|
||||
* Arcs and circles are approximated by segments
|
||||
* Useful when a shape is not a graphic primitive (shape with hole,
|
||||
* rotated shape ... ) and cannot be easily drawn.
|
||||
* note for some schapes conbining circles and solid lines (rectangles), only rectangles are converted
|
||||
* because circles are very easy to draw (no rotation problem) so convert them in polygons,
|
||||
* and draw them as polygons is not a good idea.
|
||||
*/
|
||||
void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
||||
std::vector<wxPoint>& aBuffer )
|
||||
{
|
||||
|
@ -465,12 +470,14 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
* type is not stored in parameters list, so the first parameter is exposure
|
||||
*/
|
||||
int radius = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ) / 2;
|
||||
|
||||
// A circle primitive can have a 0 size (for instance when used in roundrect macro),
|
||||
// so skip it
|
||||
if( radius <= 0 )
|
||||
break;
|
||||
|
||||
wxPoint center = mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint center = mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
wxPoint corner;
|
||||
const int delta = 3600 / seg_per_circle; // rot angle in 0.1 degree
|
||||
|
||||
|
@ -482,8 +489,9 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
corner += center;
|
||||
aBuffer.push_back( corner );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AMP_LINE2:
|
||||
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
|
||||
|
@ -516,13 +524,16 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
RotatePoint( &aBuffer[ii], -angle );
|
||||
aBuffer[ii] += start;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AMP_LINE_CENTER:
|
||||
{
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint pos = mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
wxPoint pos = mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
|
||||
// Build poly:
|
||||
pos.x -= size.x / 2;
|
||||
|
@ -534,14 +545,15 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
aBuffer.push_back( pos );
|
||||
pos.y -= size.y; // lower right
|
||||
aBuffer.push_back( pos );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_LINE_LOWER_LEFT:
|
||||
{
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint lowerLeft = mapPt( params[3].GetValue( tool ), params[4].GetValue(
|
||||
tool ), m_GerbMetric );
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
wxPoint lowerLeft = mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
|
||||
// Build poly:
|
||||
aBuffer.push_back( lowerLeft );
|
||||
|
@ -551,14 +563,15 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
aBuffer.push_back( lowerLeft );
|
||||
lowerLeft.y -= size.y; // lower right
|
||||
aBuffer.push_back( lowerLeft );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_THERMAL:
|
||||
{
|
||||
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from this first
|
||||
// rotated by 90, 180 and 270 deg.
|
||||
// params = center.x (unused here), center.y (unused here), outside diam, inside diam, crosshair thickness
|
||||
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from
|
||||
// this first rotated by 90, 180 and 270 deg.
|
||||
// params = center.x (unused here), center.y (unused here), outside diam, inside diam,
|
||||
// crosshair thickness.
|
||||
int outerRadius = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2;
|
||||
int innerRadius = scaletoIU( params[3].GetValue( tool ), m_GerbMetric ) / 2;
|
||||
|
||||
|
@ -569,12 +582,13 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
int halfthickness = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2;
|
||||
double angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) );
|
||||
|
||||
// Draw shape in the first cadrant (X and Y > 0)
|
||||
// Draw shape in the first quadrant (X and Y > 0)
|
||||
wxPoint pos, startpos;
|
||||
|
||||
// Inner arc
|
||||
startpos.x = innerRadius;
|
||||
double angle_end = 900 - angle_start;
|
||||
|
||||
for( double angle = angle_start; angle < angle_end; angle += 100 )
|
||||
{
|
||||
pos = startpos;
|
||||
|
@ -610,14 +624,15 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
break;
|
||||
|
||||
case AMP_MOIRE: // A cross hair with n concentric circles. Only the cross is built as polygon
|
||||
// because circles can be drawn easily
|
||||
case AMP_MOIRE:
|
||||
{
|
||||
// A cross hair with n concentric circles. Only the cross is built as
|
||||
// polygon because circles can be drawn easily
|
||||
int crossHairThickness = scaletoIU( params[6].GetValue( tool ), m_GerbMetric );
|
||||
int crossHairLength = scaletoIU( params[7].GetValue( tool ), m_GerbMetric );
|
||||
|
||||
// Create cross. First create 1/4 of the shape.
|
||||
// Others point are the same, totated by 90, 180 and 270 deg
|
||||
// Others point are the same, rotated by 90, 180 and 270 deg
|
||||
wxPoint pos( crossHairThickness / 2, crossHairLength / 2 );
|
||||
aBuffer.push_back( pos );
|
||||
pos.y = crossHairThickness / 2;
|
||||
|
@ -637,8 +652,9 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
aBuffer.push_back( pos );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_OUTLINE:
|
||||
// already is a polygon. Do nothing
|
||||
|
@ -648,19 +664,23 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
{
|
||||
int vertexcount = KiROUND( params[1].GetValue( tool ) );
|
||||
int radius = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2;
|
||||
|
||||
// rs274x said: vertex count = 3 ... 10, and the first corner is on the X axis
|
||||
if( vertexcount < 3 )
|
||||
vertexcount = 3;
|
||||
|
||||
if( vertexcount > 10 )
|
||||
vertexcount = 10;
|
||||
|
||||
for( int ii = 0; ii <= vertexcount; ii++ )
|
||||
{
|
||||
wxPoint pos( radius, 0);
|
||||
RotatePoint( &pos, ii * 3600 / vertexcount );
|
||||
aBuffer.push_back( pos );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AMP_COMMENT:
|
||||
case AMP_UNKNOWN:
|
||||
|
@ -669,16 +689,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
|||
}
|
||||
}
|
||||
|
||||
/** GetShapeDim
|
||||
* Calculate a value that can be used to evaluate the size of text
|
||||
* when displaying the D-Code of an item
|
||||
* due to the complexity of the shape of some primitives
|
||||
* one cannot calculate the "size" of a shape (only abounding box)
|
||||
* but here, the "dimension" of the shape is the diameter of the primitive
|
||||
* or for lines the width of the line
|
||||
* @param aParent = the parent GERBER_DRAW_ITEM which is actually drawn
|
||||
* @return a dimension, or -1 if no dim to calculate
|
||||
*/
|
||||
|
||||
int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
|
||||
{
|
||||
int dim = -1;
|
||||
|
@ -693,42 +704,47 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
|
|||
|
||||
case AMP_LINE2:
|
||||
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
|
||||
dim = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ); // linne width
|
||||
break;
|
||||
dim = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ); // line width
|
||||
break;
|
||||
|
||||
case AMP_LINE_CENTER:
|
||||
{
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
dim = std::min(size.x, size.y);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_LINE_LOWER_LEFT:
|
||||
{
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric );
|
||||
wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ),
|
||||
m_GerbMetric );
|
||||
dim = std::min(size.x, size.y);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_THERMAL:
|
||||
{
|
||||
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from this first
|
||||
// rotated by 90, 180 and 270 deg.
|
||||
// params = center.x (unused here), center.y (unused here), outside diam, inside diam, crosshair thickness
|
||||
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from
|
||||
// this first rotated by 90, 180 and 270 deg.
|
||||
// params = center.x (unused here), center.y (unused here), outside diam, inside diam,
|
||||
// crosshair thickness.
|
||||
dim = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2; // Outer diam
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMP_MOIRE: // A cross hair with n concentric circles.
|
||||
dim = scaletoIU( params[7].GetValue( tool ), m_GerbMetric ); // = cross hair len
|
||||
break;
|
||||
|
||||
case AMP_OUTLINE: // a free polygon :
|
||||
// dim = min side of the bounding box (this is a poor criteria, but what is a good criteria b?)
|
||||
{
|
||||
// dim = min side of the bounding box (this is a poor criteria, but what is a good
|
||||
// criteria b?)
|
||||
// exposure, corners count, corner1.x, corner.1y, ..., rotation
|
||||
// note: corners count is the count of corners following corner1
|
||||
int numPoints = (int) params[1].GetValue( tool );
|
||||
|
||||
// Read points. numPoints does not include the starting point, so add 1.
|
||||
// and calculate the bounding box;
|
||||
wxSize pos_min, pos_max, pos;
|
||||
|
@ -741,18 +757,24 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
|
|||
prm_idx++;
|
||||
pos.y = scaletoIU( params[prm_idx].GetValue( tool ), m_GerbMetric );
|
||||
prm_idx++;
|
||||
|
||||
if( i == 0 )
|
||||
{
|
||||
pos_min = pos_max = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// upper right corner:
|
||||
if( pos_min.x > pos.x )
|
||||
pos_min.x = pos.x;
|
||||
|
||||
if( pos_min.y > pos.y )
|
||||
pos_min.y = pos.y;
|
||||
|
||||
// lower left corner:
|
||||
if( pos_max.x < pos.x )
|
||||
pos_max.x = pos.x;
|
||||
|
||||
if( pos_max.y < pos.y )
|
||||
pos_max.y = pos.y;
|
||||
}
|
||||
|
@ -763,13 +785,14 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
|
|||
if( prm_idx >= last_prm )
|
||||
break;
|
||||
}
|
||||
|
||||
// calculate dim
|
||||
wxSize size;
|
||||
size.x = pos_max.x - pos_min.x;
|
||||
size.y = pos_max.y - pos_min.y;
|
||||
dim = std::min( size.x, size.y );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case AMP_POLYGON: // Regular polygon
|
||||
dim = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2; // Radius
|
||||
|
@ -780,6 +803,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent )
|
|||
case AMP_EOF:
|
||||
break;
|
||||
}
|
||||
|
||||
return dim;
|
||||
}
|
||||
|
||||
|
@ -799,7 +823,9 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
|||
continue;
|
||||
|
||||
if( prim_macro->IsAMPrimitiveExposureOn( aParent ) )
|
||||
{
|
||||
prim_macro->DrawBasicShape( aParent, m_shape, aShapePos );
|
||||
}
|
||||
else
|
||||
{
|
||||
prim_macro->DrawBasicShape( aParent, holeBuffer, aShapePos );
|
||||
|
@ -831,15 +857,9 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function DrawApertureMacroShape
|
||||
* Draw the primitive shape for flashed items.
|
||||
* When an item is flashed, this is the shape of the item
|
||||
*/
|
||||
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent,
|
||||
EDA_RECT* aClipBox, wxDC* aDC,
|
||||
COLOR4D aColor,
|
||||
wxPoint aShapePos, bool aFilledShape )
|
||||
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
|
||||
wxDC* aDC, COLOR4D aColor, wxPoint aShapePos,
|
||||
bool aFilledShape )
|
||||
{
|
||||
SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos );
|
||||
|
||||
|
@ -851,27 +871,20 @@ void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent,
|
|||
SHAPE_LINE_CHAIN& poly = shapeBuffer->Outline( ii );
|
||||
|
||||
GRClosedPoly( aClipBox, aDC, poly.PointCount(), (wxPoint*) &poly.CPoint( 0 ), aFilledShape,
|
||||
aColor, aColor );
|
||||
aColor, aColor );
|
||||
}
|
||||
}
|
||||
|
||||
/** GetShapeDim
|
||||
* Calculate a value that can be used to evaluate the size of text
|
||||
* when displaying the D-Code of an item
|
||||
* due to the complexity of a shape using many primitives
|
||||
* one cannot calculate the "size" of a shape (only abounding box)
|
||||
* but most of aperture macro are using one or few primitives
|
||||
* and the "dimension" of the shape is the diameter of the primitive
|
||||
* (or the max diameter of primitives)
|
||||
* @return a dimension, or -1 if no dim to calculate
|
||||
*/
|
||||
|
||||
int APERTURE_MACRO::GetShapeDim( GERBER_DRAW_ITEM* aParent )
|
||||
{
|
||||
int dim = -1;
|
||||
|
||||
for( AM_PRIMITIVES::iterator prim_macro = primitives.begin();
|
||||
prim_macro != primitives.end(); ++prim_macro )
|
||||
{
|
||||
int pdim = prim_macro->GetShapeDim( aParent );
|
||||
|
||||
if( dim < pdim )
|
||||
dim = pdim;
|
||||
}
|
||||
|
@ -880,20 +893,10 @@ int APERTURE_MACRO::GetShapeDim( GERBER_DRAW_ITEM* aParent )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* function GetLocalParam
|
||||
* Usually, parameters are defined inside the aperture primitive
|
||||
* using immediate mode or defered mode.
|
||||
* in defered mode the value is defined in a DCODE that want to use the aperture macro.
|
||||
* But some parameters are defined outside the aperture primitive
|
||||
* and are local to the aperture macro
|
||||
* @return the value of a defered parameter defined inside the aperture macro
|
||||
* @param aParamId = the param id (defined by $3 or $5 ..) to evaluate
|
||||
*/
|
||||
double APERTURE_MACRO::GetLocalParam( const D_CODE* aDcode, unsigned aParamId ) const
|
||||
{
|
||||
// find parameter descr.
|
||||
const AM_PARAM * param = NULL;
|
||||
const AM_PARAM * param = nullptr;
|
||||
|
||||
for( unsigned ii = 0; ii < m_localparamStack.size(); ii ++ )
|
||||
{
|
||||
|
@ -904,7 +907,7 @@ double APERTURE_MACRO::GetLocalParam( const D_CODE* aDcode, unsigned aParamId )
|
|||
}
|
||||
}
|
||||
|
||||
if ( param == NULL ) // not found
|
||||
if ( param == nullptr ) // not found
|
||||
return 0.0;
|
||||
|
||||
// Evaluate parameter
|
||||
|
|
|
@ -150,6 +150,10 @@ private:
|
|||
*
|
||||
* Arcs and circles are approximated by segments. Useful when a shape is not a graphic
|
||||
* primitive (shape with hole, rotated shape ... ) and cannot be easily drawn.
|
||||
*
|
||||
* @note Some schapes conbining circles and solid lines (rectangles), only rectangles are
|
||||
* converted because circles are very easy to draw (no rotation problem) so convert
|
||||
* them in polygons and draw them as polygons is not a good idea.
|
||||
*/
|
||||
void ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, std::vector<wxPoint>& aBuffer );
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2016 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
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
|
||||
{
|
||||
if( GetGerberLayout() == NULL )
|
||||
if( GetGerberLayout() == nullptr )
|
||||
return false;
|
||||
|
||||
if( query && GetScreen()->IsContentModified() )
|
||||
|
|
|
@ -77,7 +77,7 @@ void D_CODE::Clear_D_CODE_Data()
|
|||
m_DrillShape = APT_DEF_NO_HOLE;
|
||||
m_InUse = false;
|
||||
m_Defined = false;
|
||||
m_Macro = NULL;
|
||||
m_Macro = nullptr;
|
||||
m_Rotation = 0.0;
|
||||
m_EdgesCount = 0;
|
||||
m_Polygon.RemoveAllContours();
|
||||
|
@ -159,27 +159,29 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx
|
|||
|
||||
case APT_CIRCLE:
|
||||
radius = m_Size.x >> 1;
|
||||
if( !aFilledShape )
|
||||
GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos), radius, 0, aColor );
|
||||
else
|
||||
if( m_DrillShape == APT_DEF_NO_HOLE )
|
||||
{
|
||||
GRFilledCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos),
|
||||
radius, aColor );
|
||||
}
|
||||
else if( m_DrillShape == APT_DEF_ROUND_HOLE ) // round hole in shape
|
||||
{
|
||||
int width = (m_Size.x - m_Drill.x ) / 2;
|
||||
GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos),
|
||||
radius - (width / 2), width, aColor );
|
||||
}
|
||||
else // rectangular hole
|
||||
{
|
||||
if( m_Polygon.OutlineCount() == 0 )
|
||||
ConvertShapeToPolygon();
|
||||
|
||||
DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
|
||||
}
|
||||
if( !aFilledShape )
|
||||
{
|
||||
GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos), radius, 0, aColor );
|
||||
}
|
||||
else if( m_DrillShape == APT_DEF_NO_HOLE )
|
||||
{
|
||||
GRFilledCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos), radius, aColor );
|
||||
}
|
||||
else if( m_DrillShape == APT_DEF_ROUND_HOLE ) // round hole in shape
|
||||
{
|
||||
int width = (m_Size.x - m_Drill.x ) / 2;
|
||||
GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos),
|
||||
radius - (width / 2), width, aColor );
|
||||
}
|
||||
else // rectangular hole
|
||||
{
|
||||
if( m_Polygon.OutlineCount() == 0 )
|
||||
ConvertShapeToPolygon();
|
||||
|
||||
DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case APT_RECT:
|
||||
|
@ -248,6 +250,7 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx
|
|||
DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case APT_POLYGON:
|
||||
|
@ -334,7 +337,7 @@ void D_CODE::ConvertShapeToPolygon()
|
|||
// we create an horizontal oval shape. then rotate if needed
|
||||
if( m_Size.x > m_Size.y ) // horizontal oval
|
||||
{
|
||||
delta = (m_Size.x - m_Size.y) / 2;
|
||||
delta = ( m_Size.x - m_Size.y ) / 2;
|
||||
radius = m_Size.y / 2;
|
||||
}
|
||||
else // vertical oval
|
||||
|
@ -374,6 +377,7 @@ void D_CODE::ConvertShapeToPolygon()
|
|||
|
||||
addHoleToPolygon( &m_Polygon, m_DrillShape, m_Drill, initialpos );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case APT_POLYGON:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -40,9 +40,10 @@
|
|||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
// Imported function
|
||||
|
||||
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
|
||||
|
||||
|
||||
enum swap_layer_id {
|
||||
ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST,
|
||||
ID_BUTTON_0,
|
||||
|
@ -50,12 +51,6 @@ enum swap_layer_id {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* This dialog shows the gerber files loaded, and allows user to choose:
|
||||
* what gerber file and what board layer are used
|
||||
* the number of copper layers
|
||||
*/
|
||||
|
||||
int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2;
|
||||
|
||||
|
||||
|
@ -108,7 +103,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
|
||||
for( unsigned ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( images->GetGbrImage( ii ) == NULL )
|
||||
if( images->GetGbrImage( ii ) == nullptr )
|
||||
break;
|
||||
|
||||
m_buttonTable[m_gerberActiveLayersCount] = ii;
|
||||
|
@ -209,7 +204,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
m_layersList[ii] = text;
|
||||
}
|
||||
|
||||
// If the user has never stored any Gerber to Kicad layer mapping,
|
||||
// If the user has never stored any Gerber to KiCad layer mapping,
|
||||
// then disable the button to retrieve it
|
||||
if( config->m_GerberToPcbLayerMapping.size() == 0 )
|
||||
m_buttonRetrieve->Enable( false );
|
||||
|
@ -256,9 +251,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
}
|
||||
}
|
||||
|
||||
/* Ensure m_exportBoardCopperLayersCount = 2 to BOARD_COPPER_LAYERS_MAX_COUNT
|
||||
* and it is an even value because Boards have always an even layer count
|
||||
*/
|
||||
|
||||
void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
|
||||
{
|
||||
if( ( m_exportBoardCopperLayersCount & 1 ) )
|
||||
|
@ -272,18 +265,14 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when user change the current board copper layers count
|
||||
*/
|
||||
|
||||
void LAYERS_MAP_DIALOG::OnBrdLayersCountSelection( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetSelection();
|
||||
m_exportBoardCopperLayersCount = (id+1) * 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* reset pcb layers selection to the default value
|
||||
*/
|
||||
|
||||
void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
|
||||
{
|
||||
wxString msg;
|
||||
|
@ -299,8 +288,6 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Stores the current layers selection in config
|
||||
*/
|
||||
void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
|
||||
{
|
||||
auto config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
@ -318,6 +305,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
|
|||
m_buttonRetrieve->Enable( true );
|
||||
}
|
||||
|
||||
|
||||
void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
||||
{
|
||||
GERBVIEW_SETTINGS* config = static_cast<GERBVIEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
@ -340,6 +328,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
|||
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
|
||||
{
|
||||
LAYER_NUM layer = m_layersLookUpTable[ii];
|
||||
|
||||
if( layer == UNSELECTED_LAYER )
|
||||
{
|
||||
m_layersList[ii]->SetLabel( _( "Do not export" ) );
|
||||
|
@ -366,7 +355,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
|
|||
|
||||
if( (ii < 0) || (ii >= GERBER_DRAWLAYERS_COUNT) )
|
||||
{
|
||||
wxFAIL_MSG( wxT("Bad layer id") );
|
||||
wxFAIL_MSG( wxT( "Bad layer id" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,6 +366,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
|
|||
|
||||
// Get file name of Gerber loaded on this layer
|
||||
wxFileName fn( m_Parent->GetGerberLayout()->GetImagesList()->GetGbrImage( ii )->m_FileName );
|
||||
|
||||
// Surround it with quotes to make it stand out on the dialog title bar
|
||||
wxString layerName = "\"" + fn.GetFullName() + "\"";
|
||||
|
||||
|
@ -426,6 +416,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
|
|||
normalizeBrdLayersCount();
|
||||
|
||||
int inner_layer_max = 0;
|
||||
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( m_layersLookUpTable[ii] < F_Cu )
|
||||
|
@ -440,8 +431,8 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
|
|||
// internal copper layers = m_exportBoardCopperLayersCount-2
|
||||
if( inner_layer_max > m_exportBoardCopperLayersCount-2 )
|
||||
{
|
||||
wxMessageBox(
|
||||
_("Exported board does not have enough copper layers to handle selected inner layers") );
|
||||
wxMessageBox( _("Exported board does not have enough copper layers to handle selected "
|
||||
"inner layers") );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -803,7 +794,6 @@ int LAYERS_MAP_DIALOG::findNumX2GerbersLoaded( std::vector<int>& aGerber2KicadMa
|
|||
mapThis << x2->GetBrdLayerId() << x2->GetFileType();
|
||||
}
|
||||
|
||||
|
||||
// Check if the string we've isolated matches any known X2 layer names
|
||||
it = kicadLayers.find( mapThis );
|
||||
|
||||
|
|
|
@ -170,14 +170,15 @@ void DIALOG_PRINT_GERBVIEW::createExtraOptions()
|
|||
// Print mirrored
|
||||
m_checkboxMirror = new wxCheckBox( box, wxID_ANY, _( "Print mirrored" ) );
|
||||
optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows, 0 ), wxGBSpan( 1, cols ),
|
||||
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
||||
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_GERBVIEW::createLeftPanel()
|
||||
{
|
||||
wxStaticBoxSizer* sbLayersSizer = new wxStaticBoxSizer( new wxStaticBox( this,
|
||||
wxID_ANY, _( "Included Layers" ) ), wxVERTICAL );
|
||||
wxStaticBoxSizer* sbLayersSizer =
|
||||
new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _( "Included Layers" ) ),
|
||||
wxVERTICAL );
|
||||
|
||||
// Layer lists
|
||||
wxBoxSizer* bLayerListsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -195,9 +196,11 @@ void DIALOG_PRINT_GERBVIEW::createLeftPanel()
|
|||
_( "Deselect all" ) );
|
||||
|
||||
m_buttonSelectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onSelectAllClick ), NULL, this );
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onSelectAllClick ),
|
||||
nullptr, this );
|
||||
m_buttonDeselectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onDeselectAllClick ), NULL, this );
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onDeselectAllClick ),
|
||||
nullptr, this );
|
||||
|
||||
wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
buttonSizer->Add( m_buttonSelectAll, 1, wxALL, 5 );
|
||||
|
|
|
@ -46,7 +46,7 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString
|
|||
{
|
||||
m_gerbview_frame = aFrame;
|
||||
m_pcb_file_name = aFileName;
|
||||
m_fp = NULL;
|
||||
m_fp = nullptr;
|
||||
m_pcbCopperLayersCount = 2;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
|
|||
|
||||
m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) );
|
||||
|
||||
if( m_fp == NULL )
|
||||
if( m_fp == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Failed to create file '%s'." ), m_pcb_file_name );
|
||||
|
@ -83,7 +83,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
|
|||
{
|
||||
EXCELLON_IMAGE* excellon = dynamic_cast<EXCELLON_IMAGE*>( images->GetGbrImage( layer ) );
|
||||
|
||||
if( excellon == NULL ) // Layer not yet used or not a drill image
|
||||
if( excellon == nullptr ) // Layer not yet used or not a drill image
|
||||
continue;
|
||||
|
||||
for( GERBER_DRAW_ITEM* gerb_item : excellon->GetItems() )
|
||||
|
@ -95,7 +95,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
|
|||
{
|
||||
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
|
||||
|
||||
if( gerber == NULL ) // Graphic layer not yet used
|
||||
if( gerber == nullptr ) // Graphic layer not yet used
|
||||
continue;
|
||||
|
||||
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
||||
|
@ -115,7 +115,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
|
|||
{
|
||||
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
|
||||
|
||||
if( gerber == NULL ) // Graphic layer not yet used
|
||||
if( gerber == nullptr ) // Graphic layer not yet used
|
||||
continue;
|
||||
|
||||
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
||||
|
@ -134,12 +134,13 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCo
|
|||
fprintf( m_fp, ")\n" );
|
||||
|
||||
fclose( m_fp );
|
||||
m_fp = NULL;
|
||||
m_fp = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
|
||||
void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
|
||||
LAYER_NUM aLayer )
|
||||
{
|
||||
// used when a D_CODE is not found. default D_CODE to draw a flashed item
|
||||
static D_CODE dummyD_CODE( 0 );
|
||||
|
@ -149,7 +150,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt
|
|||
D_CODE* d_codeDescr = aGbrItem->GetDcodeDescr();
|
||||
SHAPE_POLY_SET polygon;
|
||||
|
||||
if( d_codeDescr == NULL )
|
||||
if( d_codeDescr == nullptr )
|
||||
d_codeDescr = &dummyD_CODE;
|
||||
|
||||
switch( aGbrItem->m_Shape )
|
||||
|
@ -159,11 +160,11 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt
|
|||
break;
|
||||
|
||||
case GBR_SPOT_CIRCLE:
|
||||
{
|
||||
{
|
||||
VECTOR2I center = aGbrItem->GetABPosition( seg_start );
|
||||
int radius = d_codeDescr->m_Size.x / 2;
|
||||
writePcbFilledCircle( center, radius, aLayer );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GBR_SPOT_RECT:
|
||||
|
@ -249,17 +250,6 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Many holes will be pads, but we have no way to create those without footprints, and creating
|
||||
* a footprint per pad is not really viable.
|
||||
*
|
||||
* So we use vias to mimic holes, with the loss of any hole shape (as we only have round holes
|
||||
* in vias at present).
|
||||
*
|
||||
* We start out with a via size minimally larger than the hole. We'll leave it this way if
|
||||
* the pad gets drawn as a copper polygon, or increase it to the proper size if it has a
|
||||
* circular, concentric copper flashing.
|
||||
*/
|
||||
void GBR_TO_PCB_EXPORTER::collect_hole( const GERBER_DRAW_ITEM* aGbrItem )
|
||||
{
|
||||
int size = std::min( aGbrItem->m_Size.x, aGbrItem->m_Size.y );
|
||||
|
@ -321,7 +311,8 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
|
|||
}
|
||||
|
||||
|
||||
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
|
||||
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
|
||||
LAYER_NUM aLayer )
|
||||
{
|
||||
wxPoint seg_start, seg_end;
|
||||
|
||||
|
@ -350,7 +341,8 @@ void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart,
|
|||
}
|
||||
|
||||
|
||||
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer )
|
||||
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
|
||||
LAYER_NUM aLayer )
|
||||
{
|
||||
double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
|
||||
(double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
|
||||
|
@ -384,6 +376,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb
|
|||
RotatePoint( &curr_end, aGbrItem->m_ArcCentre,
|
||||
-RAD2DECIDEG( DELTA_ANGLE * ii ) );
|
||||
seg_end = curr_end;
|
||||
|
||||
// Reverse Y axis:
|
||||
seg_start.y = -seg_start.y;
|
||||
seg_end.y = -seg_end.y;
|
||||
|
@ -395,6 +388,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb
|
|||
{
|
||||
seg_start = curr_start;
|
||||
seg_end = end;
|
||||
|
||||
// Reverse Y axis:
|
||||
seg_start.y = -seg_start.y;
|
||||
seg_end.y = -seg_end.y;
|
||||
|
@ -403,14 +397,6 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Flashed items are usually pads or vias. Pads are problematic because we have no way to
|
||||
* represent one in Pcbnew outside of a footprint (and creating a footprint per pad isn't really
|
||||
* viable).
|
||||
* If we've already created a via from a hole, and the flashed copper item is a simple circle
|
||||
* then we'll enlarge the via to the proper size. Otherwise we create a copper polygon to
|
||||
* represent the flashed item (which is presumably a pad).
|
||||
*/
|
||||
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aGbrItem,
|
||||
LAYER_NUM aLayer )
|
||||
{
|
||||
|
@ -419,7 +405,7 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aG
|
|||
D_CODE* d_codeDescr = aGbrItem->GetDcodeDescr();
|
||||
SHAPE_POLY_SET polygon;
|
||||
|
||||
if( d_codeDescr == NULL )
|
||||
if( d_codeDescr == nullptr )
|
||||
d_codeDescr = &flashed_item_D_CODE;
|
||||
|
||||
if( aGbrItem->m_Shape == GBR_SPOT_CIRCLE )
|
||||
|
@ -530,8 +516,8 @@ void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_N
|
|||
}
|
||||
|
||||
fprintf( m_fp, " (xy %s %s)",
|
||||
Double2Str( MapToPcbUnits( poly.CPoint( ii ).x + aOffset.x ) ).c_str(),
|
||||
Double2Str( MapToPcbUnits( -poly.CPoint( ii ).y + aOffset.y ) ).c_str() );
|
||||
Double2Str( MapToPcbUnits( poly.CPoint( ii ).x + aOffset.x ) ).c_str(),
|
||||
Double2Str( MapToPcbUnits( -poly.CPoint( ii ).y + aOffset.y ) ).c_str() );
|
||||
}
|
||||
|
||||
fprintf( m_fp, ")" );
|
||||
|
@ -539,8 +525,7 @@ void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, LAYER_N
|
|||
if( jj != MAX_COORD_CNT )
|
||||
fprintf( m_fp, "\n" );
|
||||
|
||||
fprintf( m_fp, "(layer %s) (width 0) )\n",
|
||||
TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
|
||||
fprintf( m_fp, "(layer %s) (width 0) )\n", TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -553,7 +538,7 @@ void GBR_TO_PCB_EXPORTER::writePcbZoneItem( const GERBER_DRAW_ITEM* aGbrItem, LA
|
|||
return;
|
||||
|
||||
fprintf( m_fp, "(zone (net 0) (net_name \"\") (layer %s) (tstamp 0000000) (hatch edge 0.508)\n",
|
||||
TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
|
||||
TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
|
||||
|
||||
fprintf( m_fp, " (connect_pads (clearance 0.0))\n" );
|
||||
|
||||
|
|
|
@ -63,7 +63,12 @@ private:
|
|||
/**
|
||||
* Collect holes from a drill layer.
|
||||
*
|
||||
* We'll use these later when writing pads & vias.
|
||||
* We'll use these later when writing pads & vias. Many holes will be pads, but we have
|
||||
* no way to create those without footprints, and creating a footprint per pad is not
|
||||
* really viable. We use vias to mimic holes, with the loss of any hole shape (as we only
|
||||
* have round holes in vias at present). We start out with a via size minimally larger
|
||||
* than the hole. We'll leave it this way if the pad gets drawn as a copper polygon, or
|
||||
* increase it to the proper size if it has a circular, concentric copper flashing.
|
||||
*/
|
||||
void collect_hole( const GERBER_DRAW_ITEM* aGbrItem );
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue