Commenting and formatting. No functional changes.

This commit is contained in:
Jeff Young 2023-03-13 11:25:30 +00:00
parent 664e5629f2
commit 0fb1ccff21
9 changed files with 50 additions and 114 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@ -137,23 +137,6 @@ void DS_DATA_MODEL::Remove( DS_DATA_ITEM* aItem )
}
int DS_DATA_MODEL::GetItemIndex( DS_DATA_ITEM* aItem ) const
{
unsigned idx = 0;
while( idx < m_list.size() )
{
if( m_list[idx] == aItem )
return (int) idx;
idx++;
}
return -1;
}
/* return the item from its index aIdx, or NULL if does not exist
*/
DS_DATA_ITEM* DS_DATA_MODEL::GetItem( unsigned aIdx ) const
{
if( aIdx < m_list.size() )

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@ -38,21 +38,13 @@ wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
{
switch( aFormat )
{
case PLOT_FORMAT::DXF:
return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::POST:
return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::PDF:
return PDF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::HPGL:
return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::GERBER:
return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::SVG:
return SVG_PLOTTER::GetDefaultFileExtension();
default:
wxASSERT( false );
return wxEmptyString;
case PLOT_FORMAT::DXF: return DXF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::POST: return PS_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::PDF: return PDF_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::HPGL: return HPGL_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::GERBER: return GERBER_PLOTTER::GetDefaultFileExtension();
case PLOT_FORMAT::SVG: return SVG_PLOTTER::GetDefaultFileExtension();
default: wxFAIL; return wxEmptyString;
}
}
@ -174,7 +166,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
break;
bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
PLOTTER::USE_DEFAULT_LINE_WIDTH );
PLOTTER::USE_DEFAULT_LINE_WIDTH );
}
break;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -114,11 +114,6 @@ public:
void Append( DS_DATA_ITEM* aItem );
void Remove( DS_DATA_ITEM* aItem );
/**
* @return the index of aItem, or -1 if does not exist.
*/
int GetItemIndex( DS_DATA_ITEM* aItem ) const;
/**
* @return is the item from its index \a aIdx, or NULL if does not exist.
*/

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -109,6 +109,7 @@ protected:
m_flags = 0;
}
protected:
DS_DATA_ITEM* m_peer; // the parent DS_DATA_ITEM item in the DS_DATA_MODEL
int m_index; // the index in the parent's repeat count
int m_penWidth;
@ -194,7 +195,6 @@ public:
*/
SHAPE_POLY_SET m_Polygons;
private:
VECTOR2I m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent
// (used only in drawing sheet editor to draw anchors)
@ -287,9 +287,9 @@ public:
#endif
private:
VECTOR2I m_markerPos; // position of the marker
VECTOR2I m_pageSize; // full size of the page
double m_markerSize;
VECTOR2I m_markerPos; // position of the marker
VECTOR2I m_pageSize; // full size of the page
double m_markerSize;
};
@ -500,11 +500,6 @@ public:
return nullptr;
}
void GetAllItems( std::vector<DS_DRAW_ITEM_BASE*>* aList )
{
*aList = m_graphicList;
}
/**
* Draws the item list created by BuildDrawItemsList
*/

View File

@ -1,7 +1,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-2023 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
@ -129,8 +129,8 @@ private:
*
* @param aDC The device context.
* @param aPageInfo for margins and page size (in mils).
* @param aSheetName The sheet name, for basic inscriptions.
* @param aSheetPath The sheetpath (full sheet name), for basic inscriptions.
* @param aSheetName The sheet name, for basic inscriptions.
* @param aSheetPath The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for text variable resolution.
* @param aProperties Optional properties for text variable resolution.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -88,19 +88,13 @@ public:
* Can be used to override which layer ID is used for drawing sheet item colors
* @param aLayerId is the color to use (defaults to LAYER_DRAWINGSHEET if this is not called)
*/
void SetColorLayer( int aLayerId )
{
m_colorLayer = aLayerId;
}
void SetColorLayer( int aLayerId ) { m_colorLayer = aLayerId; }
/**
* Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
* @param aLayerId is the layer to use
*/
void SetPageBorderColorLayer( int aLayerId )
{
m_pageBorderColorLayer = aLayerId;
}
void SetPageBorderColorLayer( int aLayerId ) { m_pageBorderColorLayer = aLayerId; }
const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
@ -133,6 +127,7 @@ protected:
void buildDrawList( KIGFX::VIEW* aView, const std::map<wxString, wxString>* aProperties,
DS_DRAW_ITEM_LIST* aDrawList ) const;
protected:
/// the factor between mils (units used in drawing sheet and internal units)
/// it is the value IU_PER_MILS used in the caller
int m_mils2IUscalefactor;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
@ -37,8 +37,8 @@
#include <advanced_config.h>
PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo )
: BOARD_PRINTOUT_SETTINGS( aPageInfo )
PCBNEW_PRINTOUT_SETTINGS::PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ) :
BOARD_PRINTOUT_SETTINGS( aPageInfo )
{
m_DrillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
m_Pagination = ALL_LAYERS;
@ -77,7 +77,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle ) :
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
{
m_board = aBoard;
}
@ -309,19 +309,10 @@ int KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
SHAPE_SEGMENT KIGFX::PCB_PRINT_PAINTER::getPadHoleShape( const PAD* aPad ) const
{
SHAPE_SEGMENT segm;
if( m_drillMarkReal )
{
segm = KIGFX::PCB_PAINTER::getPadHoleShape( aPad );
}
return KIGFX::PCB_PAINTER::getPadHoleShape( aPad );
else
{
segm = SHAPE_SEGMENT( aPad->GetPosition(),
aPad->GetPosition(), m_drillMarkSize );
}
return segm;
return SHAPE_SEGMENT( aPad->GetPosition(), aPad->GetPosition(), m_drillMarkSize );
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2018 CERN
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -50,7 +50,7 @@ class PCBNEW_PRINTOUT : public BOARD_PRINTOUT
{
public:
PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle );
const KIGFX::VIEW* aView, const wxString& aTitle );
bool OnPrintPage( int aPage ) override;
@ -68,8 +68,7 @@ protected:
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
private:
BOARD* m_board;
BOARD* m_board;
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings;
};
@ -104,11 +103,9 @@ protected:
int getViaDrillSize( const PCB_VIA* aVia ) const override;
///< Flag deciding whether use the actual hole size or user-specified size for drill marks
bool m_drillMarkReal;
///< User-specified size for drill marks (expressed in internal units)
int m_drillMarkSize;
protected:
bool m_drillMarkReal; ///< Actual hole size or user-specified size for drill marks
int m_drillMarkSize; ///< User-specified size (in internal units)
};
}; // namespace KIGFX

View File

@ -726,8 +726,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
for( int kk = 0; kk <= outlines.HoleCount(ii); kk++ )
{
cornerList.clear();
const SHAPE_LINE_CHAIN& path =
( kk == 0 ) ? outlines.COutline( ii ) : outlines.CHole( ii, kk - 1 );
const SHAPE_LINE_CHAIN& path = ( kk == 0 ) ? outlines.COutline( ii )
: outlines.CHole( ii, kk - 1 );
aPlotter->PlotPoly( path, FILL_T::NO_FILL );
}
@ -737,8 +737,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( aPlotOpt.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE )
{
int smallDrill = ( aPlotOpt.GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE )
? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) :
INT_MAX;
? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize )
: INT_MAX;
for( FOOTPRINT* footprint : aBoard->Footprints() )
{
@ -756,8 +756,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
else
{
// Note: small drill marks have no significance when applied to slots
aPlotter->ThickSegment( slot->GetSeg().A,
slot->GetSeg().B,
aPlotter->ThickSegment( slot->GetSeg().A, slot->GetSeg().B,
slot->GetWidth(), SKETCH, nullptr );
}
}
@ -782,26 +781,16 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
*
* Solder mask layers have a minimum thickness value and cannot be drawn like standard layers,
* unless the minimum thickness is 0.
* Currently the algo is:
* 1 - build all pad shapes as polygons with a size inflated by
* mask clearance + (min width solder mask /2)
* 2 - Merge shapes
* 3 - deflate result by (min width solder mask /2)
* 4 - ORing result by all pad shapes as polygons with a size inflated by
* mask clearance only (because deflate sometimes creates shape artifacts)
* 5 - draw result as polygons
*
* The algorithm is somewhat complicated to allow for min web thickness while also preserving
* pad attributes in Gerber.
*
* create initial polygons for every shape (pad or polygon),
* inflate and deflate polygons
* with Min Thickness/2, and merges the result (like initial algo)
* remove all initial polygons.
* The remaining polygons are areas with thickness < min thickness
* plot all initial shapes by flashing (or using regions) for pad and polygons
* (shapes will be better) and remaining polygons to
* remove areas with thickness < min thickness from final mask
* 1 - create initial polygons for every shape
* 2 - inflate and deflate polygons with Min Thickness/2, and merges the result
* 3 - substract all initial polygons from (2), leaving the areas where the thickness was less
* than min thickness
* 4 - plot all initial shapes by flashing (or using regions), including Gerber attribute data
* 5 - plot remaining polygons from (2) (witout any Gerber attributes)
*/
void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
@ -827,9 +816,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// Extra margin is half the min width for solder mask, which is used to merge too-close shapes
// (distance < aMinThickness), and will be removed when creating the actual shapes.
// Will contain shapes inflated by inflate value that will be merged and deflated by
// inflate value to build final polygons
// After calculations the remaining polygons are polygons to plot
// Will contain shapes inflated by inflate value that will be merged and deflated by inflate
// value to build final polygons
SHAPE_POLY_SET areas;
// Will contain exact shapes of all items on solder mask
@ -972,8 +960,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int numSegs = GetArcToSegmentCount( inflate, maxError, FULL_CIRCLE );
// Merge all polygons: After deflating, not merged (not overlapping) polygons
// will have the initial shape (with perhaps small changes due to deflating transform)
// Merge all polygons: After deflating, not merged (not overlapping) polygons will have the
// initial shape (with perhaps small changes due to deflating transform)
areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
areas.Deflate( inflate, numSegs );