Pcbnew: Add drill holes table to board statistics

NEW: Add drill holes table to board statistics as a separate tab in the board
statistics dialog. Print the drill holes table in the generated statistics file.
NEW: Make the generated statistics file Markdown compatible.
This commit is contained in:
Mikołaj Wielgus 2019-11-10 21:30:58 +01:00 committed by jean-pierre charras
parent 9d288968e7
commit 4b92c516e1
5 changed files with 1814 additions and 1618 deletions

View File

@ -75,6 +75,9 @@ DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame )
{
m_parentFrame = aParentFrame;
m_gridDrills->UseNativeColHeader();
m_gridDrills->Connect( wxEVT_GRID_COL_SORT, wxGridEventHandler( drillGridSort ), NULL, this );
m_checkBoxExcludeComponentsNoPins->SetValue( s_savedDialogState.excludeNoPins );
m_checkBoxSubtractHoles->SetValue( s_savedDialogState.subtractHoles );
@ -95,7 +98,6 @@ DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame )
m_gridBoard->SetCellValue( 2, 0, _( "Area:" ) );
m_gridBoard->SetCellAlignment( 2, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
wxGrid* grids[] = { m_gridComponents, m_gridPads, m_gridVias, m_gridBoard };
for( auto& grid : grids )
{
@ -168,6 +170,7 @@ bool DIALOG_BOARD_STATISTICS::TransferDataToWindow()
getDataFromPCB();
updateWidets();
Layout();
drillsPanel->Layout();
FinishDialogSettings();
return true;
}
@ -209,10 +212,48 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
break;
}
}
if( pad->GetDrillSize().x > 0 && pad->GetDrillSize().y > 0 )
{
PCB_LAYER_ID top, bottom;
if( pad->GetLayerSet().CuStack().empty() )
{
// The pad is not on any copper layer
top = UNDEFINED_LAYER;
bottom = UNDEFINED_LAYER;
}
else
{
top = pad->GetLayerSet().CuStack().front();
bottom = pad->GetLayerSet().CuStack().back();
}
drillType_t drill( pad->GetDrillSize().x, pad->GetDrillSize().y,
pad->GetDrillShape(), pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED,
true, top, bottom );
auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ )
{
if( *it == drill )
{
it->qty++;
break;
}
}
// Get vias count
if( it == m_drillTypes.end() )
{
drill.qty = 1;
m_drillTypes.push_back( drill );
m_gridDrills->InsertRows();
}
}
}
}
// Get via counts
for( auto& track : board->Tracks() )
{
if( auto via = dyn_cast<VIA*>( track ) )
@ -225,9 +266,32 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
break;
}
}
drillType_t drill( via->GetDrillValue(), via->GetDrillValue(), PAD_DRILL_SHAPE_CIRCLE,
true, false, via->TopLayer(), via->BottomLayer() );
auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ )
{
if( *it == drill )
{
it->qty++;
break;
}
}
if( it == m_drillTypes.end() )
{
drill.qty = 1;
m_drillTypes.push_back( drill );
m_gridDrills->InsertRows();
}
}
}
sort( m_drillTypes.begin(), m_drillTypes.end(),
drillType_t::COMPARE( drillType_t::COL_COUNT, false ) );
bool boundingBoxCreated = false; //flag if bounding box initialized
BOX2I bbox;
SHAPE_POLY_SET polySet;
@ -337,6 +401,7 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
totalBack += type.backSideQty;
currentRow++;
}
m_gridComponents->SetCellValue( currentRow, COL_LABEL, _( "Total:" ) );
m_gridComponents->SetCellValue( currentRow, COL_FRONT_SIDE,
wxString::Format( "%i ", totalFront ) );
@ -363,14 +428,188 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
m_gridBoard->SetCellValue( ROW_BOARD_AREA, COL_AMOUNT, _( "unknown" ) );
}
updateDrillGrid();
m_gridComponents->AutoSize();
m_gridPads->AutoSize();
m_gridBoard->AutoSize();
m_gridVias->AutoSize();
m_gridDrills->AutoSize();
adjustDrillGridColumns();
}
void DIALOG_BOARD_STATISTICS::updateDrillGrid()
{
BOARD* board = m_parentFrame->GetBoard();
int currentRow = 0;
for( auto& type : m_drillTypes )
{
wxString shapeStr;
wxString startLayerStr;
wxString stopLayerStr;
switch( type.shape )
{
case PAD_DRILL_SHAPE_CIRCLE:
shapeStr = _( "Round" );
break;
case PAD_DRILL_SHAPE_OBLONG:
shapeStr = _( "Slot" );
break;
default:
shapeStr = _( "???" );
break;
}
if( type.startLayer == UNDEFINED_LAYER )
startLayerStr = _( "N/A" );
else
startLayerStr = board->GetLayerName( type.startLayer );
if( type.stopLayer == UNDEFINED_LAYER )
stopLayerStr = _( "N/A" );
else
stopLayerStr = board->GetLayerName( type.stopLayer );
m_gridDrills->SetCellValue(
currentRow, drillType_t::COL_COUNT, wxString::Format( "%i", type.qty ) );
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_SHAPE, shapeStr );
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_X_SIZE,
MessageTextFromValue( GetUserUnits(), type.xSize ) );
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_Y_SIZE,
MessageTextFromValue( GetUserUnits(), type.ySize ) );
m_gridDrills->SetCellValue(
currentRow, drillType_t::COL_PLATED, type.isPlated ? _( "PTH" ) : _( "NPTH" ) );
m_gridDrills->SetCellValue(
currentRow, drillType_t::COL_VIA_PAD, type.isPad ? _( "Pad" ) : _( "Via" ) );
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_START_LAYER, startLayerStr );
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_STOP_LAYER, stopLayerStr );
currentRow++;
}
}
void DIALOG_BOARD_STATISTICS::printGridToStringAsTable( wxGrid* aGrid, wxString& aStr,
bool aUseRowLabels, bool aUseColLabels, bool aUseFirstColAsLabel )
{
std::vector<int> widths( aGrid->GetNumberCols(), 0 );
int rowLabelsWidth = 0;
// Determine column widths.
if( aUseColLabels )
{
for( int col = 0; col < aGrid->GetNumberCols(); col++ )
widths[col] = aGrid->GetColLabelValue( col ).length();
}
for( int row = 0; row < aGrid->GetNumberRows(); row++ )
{
rowLabelsWidth = std::max<int>( rowLabelsWidth, aGrid->GetRowLabelValue( row ).length() );
for( int col = 0; col < aGrid->GetNumberCols(); col++ )
widths[col] = std::max<int>( widths[col], aGrid->GetCellValue( row, col ).length() );
}
// Print the cells.
wxString tmp;
// Print column labels.
aStr << "|";
if( aUseRowLabels )
{
aStr.Append( ' ', rowLabelsWidth );
aStr << " |";
}
for( int col = 0; col < aGrid->GetNumberCols(); col++ )
{
if( aUseColLabels )
tmp.Printf( " %*s |", widths[col], aGrid->GetColLabelValue( col ) );
else
tmp.Printf( " %*s |", widths[col], aGrid->GetCellValue( 0, col ) );
aStr << tmp;
}
aStr << "\n";
// Print column label horizontal separators.
aStr << "|";
if( aUseRowLabels )
{
aStr.Append( '-', rowLabelsWidth );
aStr << "-|";
}
for( int col = 0; col < aGrid->GetNumberCols(); col++ )
{
aStr << "-";
aStr.Append( '-', widths[col] );
aStr << "-|";
}
aStr << "\n";
// Print regular cells.
int firstRow = 0, firstCol = 0;
if( !aUseColLabels )
firstRow = 1;
if( !aUseRowLabels && aUseFirstColAsLabel )
firstCol = 1;
for( int row = firstRow; row < aGrid->GetNumberRows(); row++ )
{
if( aUseRowLabels )
tmp.Printf( "|%-*s |", rowLabelsWidth, aGrid->GetRowLabelValue( row ) );
else if( aUseFirstColAsLabel )
tmp.Printf( "|%-*s |", widths[0], aGrid->GetCellValue( row, 0 ) );
else
tmp.Printf( "|" );
aStr << tmp;
for( int col = firstCol; col < aGrid->GetNumberCols(); col++ )
{
tmp.Printf( " %*s |", widths[col], aGrid->GetCellValue( row, col ) );
aStr << tmp;
}
aStr << "\n";
}
}
void DIALOG_BOARD_STATISTICS::adjustDrillGridColumns()
{
int newTotalWidth = m_gridDrills->GetClientSize().GetWidth();
int curTotalWidth = 0;
// Find the total current width
for( int i = 0; i < m_gridDrills->GetNumberCols(); i++ )
{
if( i != drillType_t::COL_START_LAYER && i != drillType_t::COL_STOP_LAYER )
curTotalWidth += m_gridDrills->GetColSize( i );
}
// Resize the last two columns to fill all available space
int remainingWidth = newTotalWidth - curTotalWidth;
m_gridDrills->SetColSize( drillType_t::COL_START_LAYER, remainingWidth / 2 );
m_gridDrills->SetColSize( drillType_t::COL_STOP_LAYER, remainingWidth - remainingWidth / 2 );
m_gridDrills->Refresh();
}
// If any checkbox clicked, we have to refresh dialog data
void DIALOG_BOARD_STATISTICS::checkboxClicked( wxCommandEvent& event )
void DIALOG_BOARD_STATISTICS::checkboxClicked( wxCommandEvent& aEvent )
{
s_savedDialogState.excludeNoPins = m_checkBoxExcludeComponentsNoPins->GetValue();
s_savedDialogState.subtractHoles = m_checkBoxSubtractHoles->GetValue();
@ -378,10 +617,10 @@ void DIALOG_BOARD_STATISTICS::checkboxClicked( wxCommandEvent& event )
getDataFromPCB();
updateWidets();
Layout();
Fit();
drillsPanel->Layout();
}
void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& event )
void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& aEvent )
{
FILE* outFile;
wxString msg;
@ -411,93 +650,87 @@ void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& event )
}
msg << _( "PCB statistics report" ) << "\n";
msg << _( "Date: " ) << wxDateTime::Now().Format() << "\n";
msg << _( "Project: " ) << Prj().GetProjectName() << "\n";
msg << _( "Board name: " ) << boardName << "\n";
msg << _( "=====================" ) << "\n";
msg << _( "- Date: " ) << wxDateTime::Now().Format() << "\n";
msg << _( "- Project: " ) << Prj().GetProjectName() << "\n";
msg << _( "- Board name: " ) << boardName << "\n";
msg << "\n";
msg << "Board\n";
msg << _( "Board" ) << "\n";
msg << _( "-----" ) << "\n";
if( m_hasOutline )
{
msg << _( "Width: " ) << MessageTextFromValue( GetUserUnits(), m_boardWidth ) << "\n";
msg << _( "Height: " ) << MessageTextFromValue( GetUserUnits(), m_boardHeight ) << "\n";
msg << _( "Area: " ) << wxString::Format( wxT( "%.3f %s²" ), m_boardArea,
GetAbbreviatedUnitsLabel( GetUserUnits() ) ) << "\n";
msg << _( "- Width: " ) << MessageTextFromValue( GetUserUnits(), m_boardWidth ) << "\n";
msg << _( "- Height: " ) << MessageTextFromValue( GetUserUnits(), m_boardHeight ) << "\n";
msg << _( "- Area: " )
<< wxString::Format(
wxT( "%.3f %s²" ), m_boardArea, GetAbbreviatedUnitsLabel( GetUserUnits() ) )
<< "\n";
}
else
{
msg << _( "Width: " ) << _( "unknown" ) << "\n";
msg << _( "Height: " ) << _( "unknown" ) << "\n";
msg << _( "Area: " ) << _( "unknown" ) << "\n";
msg << _( "- Width: " ) << _( "unknown" ) << "\n";
msg << _( "- Height: " ) << _( "unknown" ) << "\n";
msg << _( "- Area: " ) << _( "unknown" ) << "\n";
}
msg << "\n";
msg << "Pads\n";
msg << _( "Pads" ) << "\n";
msg << _( "----" ) << "\n";
for( auto& type : m_padsTypes )
msg << type.title << " " << type.qty << "\n";
msg << "- " << type.title << " " << type.qty << "\n";
msg << "\n";
msg << "Vias\n";
msg << _( "Vias" ) << "\n";
msg << _( "----" ) << "\n";
for( auto& type : m_viasTypes )
msg << type.title << " " << type.qty << "\n";
msg << "- " << type.title << " " << type.qty << "\n";
// We will save data about components in the table.
// We have to calculate column widths
int colsWidth[4];
wxString columns[4] = { "", _( "Front Side" ), _( "Back Side" ), _( "Total" ) };
std::vector<int> widths;
std::vector<wxString> labels{ _( "" ), _( "Front Side" ), _( "Back Side" ), _( "Total" ) };
wxString tmp;
for( int i = 0; i < 4; i++ )
colsWidth[i] = columns[i].size();
for( auto label : labels )
widths.push_back( label.size() );
int frontTotal = 0;
int backTotal = 0;
for( auto& type : m_componentsTypes )
for( auto type : m_componentsTypes )
{
// Get maximum width for left label column
colsWidth[0] = std::max<int>( type.title.size(), colsWidth[0] );
widths[0] = std::max<int>( type.title.size(), widths[0] );
frontTotal += type.frontSideQty;
backTotal += type.backSideQty;
}
// Get maximum width for other columns
tmp.Printf( "%d", frontTotal );
colsWidth[1] = std::max<int>( tmp.size(), colsWidth[1] );
tmp.Printf( "%d", backTotal );
colsWidth[2] = std::max<int>( tmp.size(), colsWidth[2] );
tmp.Printf( "%d", frontTotal + backTotal );
colsWidth[3] = std::max<int>( tmp.size(), colsWidth[3] );
tmp.Printf( "%i", frontTotal );
widths[1] = std::max<int>( tmp.size(), widths[1] );
tmp.Printf( "%i", backTotal );
widths[2] = std::max<int>( tmp.size(), widths[2] );
tmp.Printf( "%i", frontTotal + backTotal );
widths[3] = std::max<int>( tmp.size(), widths[3] );
//Write components amount to file
msg << "\n";
msg << _( "Components" ) << "\n";
tmp.Printf( "%-*s | %*s | %*s | %*s |\n",
colsWidth[0], columns[0],
colsWidth[1], columns[1],
colsWidth[2], columns[2],
colsWidth[3], columns[3] );
msg += tmp;
msg << _( "----------" ) << "\n";
msg << "\n";
for( auto& type : m_componentsTypes )
{
tmp.Printf( "%-*s | %*d | %*d | %*d |\n",
colsWidth[0], type.title,
colsWidth[1], type.frontSideQty,
colsWidth[2], type.backSideQty,
colsWidth[3], type.backSideQty + type.frontSideQty );
msg += tmp;
}
printGridToStringAsTable( m_gridComponents, msg, false, false, true );
tmp.Printf( "%-*s | %*d | %*d | %*d |\n",
colsWidth[0], _( "Total:" ),
colsWidth[1], frontTotal,
colsWidth[2], backTotal,
colsWidth[3], frontTotal + backTotal );
msg += tmp;
msg << "\n";
msg << _( "Drill holes" ) << "\n";
msg << _( "-----------" ) << "\n";
msg << "\n";
printGridToStringAsTable( m_gridDrills, msg, false, true, false );
if( fprintf( outFile, "%s", TO_UTF8( msg ) ) < 0 )
{
@ -508,6 +741,23 @@ void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& event )
fclose( outFile );
}
void DIALOG_BOARD_STATISTICS::drillGridSize( wxSizeEvent& aEvent )
{
aEvent.Skip();
adjustDrillGridColumns();
}
void DIALOG_BOARD_STATISTICS::drillGridSort( wxGridEvent& aEvent )
{
drillType_t::COL_ID colId = static_cast<drillType_t::COL_ID>( aEvent.GetCol() );
bool ascending =
!( m_gridDrills->IsSortingBy( colId ) && m_gridDrills->IsSortOrderAscending() );
sort( m_drillTypes.begin(), m_drillTypes.end(), drillType_t::COMPARE( colId, ascending ) );
updateDrillGrid();
}
DIALOG_BOARD_STATISTICS::~DIALOG_BOARD_STATISTICS()
{
}

View File

@ -87,9 +87,87 @@ public:
int backSideQty;
};
struct drillType_t
{
enum COL_ID
{
COL_COUNT,
COL_SHAPE,
COL_X_SIZE,
COL_Y_SIZE,
COL_PLATED,
COL_VIA_PAD,
COL_START_LAYER,
COL_STOP_LAYER
};
drillType_t( int aXSize, int aYSize, PAD_DRILL_SHAPE_T aShape, bool aIsPlated, bool aIsPad,
PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aStopLayer, int aQty = 0 )
: xSize( aXSize ),
ySize( aYSize ),
shape( aShape ),
isPlated( aIsPlated ),
isPad( aIsPad ),
startLayer( aStartLayer ),
stopLayer( aStopLayer ),
qty( aQty )
{
}
bool operator==( const drillType_t& other )
{
return xSize == other.xSize && ySize == other.ySize && shape == other.shape
&& isPlated == other.isPlated && isPad == other.isPad
&& startLayer == other.startLayer && stopLayer == other.stopLayer;
}
struct COMPARE
{
COMPARE( COL_ID aColId, bool aAscending ) : colId( aColId ), ascending( aAscending )
{
}
bool operator()( const drillType_t& aLeft, const drillType_t& aRight )
{
switch( colId )
{
case COL_COUNT:
return compareDrillParameters( aLeft.qty, aRight.qty );
case COL_SHAPE:
return compareDrillParameters( aLeft.shape, aRight.shape );
case COL_X_SIZE:
return compareDrillParameters( aLeft.xSize, aRight.xSize );
case COL_Y_SIZE:
return compareDrillParameters( aLeft.ySize, aRight.ySize );
case COL_PLATED:
return ascending ? aLeft.isPlated : aRight.isPlated;
case COL_VIA_PAD:
return ascending ? aLeft.isPad : aRight.isPad;
case COL_START_LAYER:
return compareDrillParameters( aLeft.startLayer, aRight.startLayer );
case COL_STOP_LAYER:
return compareDrillParameters( aLeft.stopLayer, aRight.stopLayer );
}
return false;
}
bool compareDrillParameters( int aLeft, int aRight )
{
return ascending ? aLeft < aRight : aLeft > aRight;
}
COL_ID colId;
bool ascending;
};
int xSize;
int ySize;
PAD_DRILL_SHAPE_T shape;
bool isPlated;
bool isPad;
PCB_LAYER_ID startLayer;
PCB_LAYER_ID stopLayer;
int qty;
};
using componentsTypeList_t = std::deque<componentsType_t>;
using padsTypeList_t = std::deque<padsType_t>;
using viasTypeList_t = std::deque<viasType_t>;
using drillTypeList_t = std::deque<drillType_t>;
DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame );
~DIALOG_BOARD_STATISTICS();
@ -97,17 +175,9 @@ public:
///> Get data from the PCB board and print it to dialog
bool TransferDataToWindow() override;
///> Function to fill up all items types to be shown in the dialog.
void refreshItemsTypes();
///> Gets data from board
void getDataFromPCB();
///> Applies data to dialog widgets
void updateWidets();
private:
PCB_EDIT_FRAME* m_parentFrame;
int m_boardWidth;
int m_boardHeight;
double m_boardArea;
@ -124,9 +194,35 @@ private:
///> Holds all vias types to be shown in the dialog
viasTypeList_t m_viasTypes;
///> Holds all drill hole types to be shown in the dialog
drillTypeList_t m_drillTypes;
///> Function to fill up all items types to be shown in the dialog.
void refreshItemsTypes();
///> Gets data from board
void getDataFromPCB();
///> Applies data to dialog widgets
void updateWidets();
///> Updates drills grid
void updateDrillGrid();
///> Prints grid to string in tabular format
void printGridToStringAsTable( wxGrid* aGrid, wxString& aStr, bool aUseRowLabels,
bool aUseColLabels, bool aUseFirstColAsLabel );
void adjustDrillGridColumns();
void checkboxClicked( wxCommandEvent& aEvent ) override;
///> Save board statistics to a file
void saveReportClicked( wxCommandEvent& event ) override;
void checkboxClicked( wxCommandEvent& event ) override;
void saveReportClicked( wxCommandEvent& aEvent ) override;
void drillGridSize( wxSizeEvent& aEvent ) override;
void drillGridSort( wxGridEvent& aEvent );
};
#endif // __DIALOG_BOARD_STATISTICS_H

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -16,6 +16,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
wxBoxSizer* bMainBoxSizer;
bMainBoxSizer = new wxBoxSizer( wxVERTICAL );
topNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
generalPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bGeneralPanelSizer;
bGeneralPanelSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizerContents;
fgSizerContents = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizerContents->AddGrowableCol( 0 );
@ -29,11 +34,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerComponents = new wxBoxSizer( wxVERTICAL );
wxStaticText* componentsLabel;
componentsLabel = new wxStaticText( this, wxID_ANY, _("Components"), wxDefaultPosition, wxDefaultSize, 0 );
componentsLabel = new wxStaticText( generalPanel, wxID_ANY, _("Components"), wxDefaultPosition, wxDefaultSize, 0 );
componentsLabel->Wrap( -1 );
bSizerComponents->Add( componentsLabel, 0, wxALL, 5 );
m_gridComponents = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridComponents = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridComponents->CreateGrid( 5, 4 );
@ -69,11 +74,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerPads = new wxBoxSizer( wxVERTICAL );
wxStaticText* padsLabel;
padsLabel = new wxStaticText( this, wxID_ANY, _("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
padsLabel = new wxStaticText( generalPanel, wxID_ANY, _("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
padsLabel->Wrap( -1 );
bSizerPads->Add( padsLabel, 0, wxALL, 5 );
m_gridPads = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridPads = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridPads->CreateGrid( 5, 2 );
@ -109,11 +114,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerBrdSize = new wxBoxSizer( wxVERTICAL );
wxStaticText* boardLabel;
boardLabel = new wxStaticText( this, wxID_ANY, _("Board Size"), wxDefaultPosition, wxDefaultSize, 0 );
boardLabel = new wxStaticText( generalPanel, wxID_ANY, _("Board Size"), wxDefaultPosition, wxDefaultSize, 0 );
boardLabel->Wrap( -1 );
bSizerBrdSize->Add( boardLabel, 0, wxALL, 5 );
m_gridBoard = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridBoard = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridBoard->CreateGrid( 3, 2 );
@ -148,11 +153,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
wxBoxSizer* bSizerVias;
bSizerVias = new wxBoxSizer( wxVERTICAL );
viasLabel = new wxStaticText( this, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
viasLabel = new wxStaticText( generalPanel, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
viasLabel->Wrap( -1 );
bSizerVias->Add( viasLabel, 0, wxALL, 5 );
m_gridVias = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridVias = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridVias->CreateGrid( 4, 2 );
@ -185,22 +190,74 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
fgSizerContents->Add( bSizerVias, 1, wxEXPAND|wxLEFT, 5 );
bMainBoxSizer->Add( fgSizerContents, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bGeneralPanelSizer->Add( fgSizerContents, 1, wxEXPAND, 5 );
wxGridSizer* gOptionsSizer;
gOptionsSizer = new wxGridSizer( 0, 2, 0, 0 );
m_checkBoxSubtractHoles = new wxCheckBox( this, wxID_ANY, _("Subtract holes from board area"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxSubtractHoles = new wxCheckBox( generalPanel, wxID_ANY, _("Subtract holes from board area"), wxDefaultPosition, wxDefaultSize, 0 );
gOptionsSizer->Add( m_checkBoxSubtractHoles, 0, wxALL|wxEXPAND, 5 );
m_checkBoxExcludeComponentsNoPins = new wxCheckBox( this, wxID_ANY, _("Exclude components with no pins"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxExcludeComponentsNoPins = new wxCheckBox( generalPanel, wxID_ANY, _("Exclude components with no pins"), wxDefaultPosition, wxDefaultSize, 0 );
gOptionsSizer->Add( m_checkBoxExcludeComponentsNoPins, 0, wxALL|wxEXPAND, 5 );
bMainBoxSizer->Add( gOptionsSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bGeneralPanelSizer->Add( gOptionsSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainBoxSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
generalPanel->SetSizer( bGeneralPanelSizer );
generalPanel->Layout();
bGeneralPanelSizer->Fit( generalPanel );
topNotebook->AddPage( generalPanel, _("General"), true );
drillsPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bDrillsSizer;
bDrillsSizer = new wxBoxSizer( wxVERTICAL );
m_gridDrills = new wxGrid( drillsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
// Grid
m_gridDrills->CreateGrid( 0, 8 );
m_gridDrills->EnableEditing( false );
m_gridDrills->EnableGridLines( true );
m_gridDrills->EnableDragGridSize( true );
m_gridDrills->SetMargins( 0, 0 );
// Columns
m_gridDrills->AutoSizeColumns();
m_gridDrills->EnableDragColMove( true );
m_gridDrills->EnableDragColSize( true );
m_gridDrills->SetColLabelSize( 20 );
m_gridDrills->SetColLabelValue( 0, _("Count") );
m_gridDrills->SetColLabelValue( 1, _("Shape") );
m_gridDrills->SetColLabelValue( 2, _("X Size") );
m_gridDrills->SetColLabelValue( 3, _("Y Size") );
m_gridDrills->SetColLabelValue( 4, _("Plated") );
m_gridDrills->SetColLabelValue( 5, _("Via/Pad") );
m_gridDrills->SetColLabelValue( 6, _("Start Layer") );
m_gridDrills->SetColLabelValue( 7, _("Stop Layer") );
m_gridDrills->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridDrills->EnableDragRowSize( true );
m_gridDrills->SetRowLabelSize( 0 );
m_gridDrills->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
m_gridDrills->SetLabelFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
// Cell Defaults
m_gridDrills->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP );
m_gridDrills->SetMaxSize( wxSize( -1,300 ) );
bDrillsSizer->Add( m_gridDrills, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
drillsPanel->SetSizer( bDrillsSizer );
drillsPanel->Layout();
bDrillsSizer->Fit( drillsPanel );
topNotebook->AddPage( drillsPanel, _("Drill Holes"), false );
bMainBoxSizer->Add( topNotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerBottom;
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );
@ -226,16 +283,20 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_BOARD_STATISTICS_BASE::windowSize ) );
m_checkBoxSubtractHoles->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::checkboxClicked ), NULL, this );
m_checkBoxExcludeComponentsNoPins->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::checkboxClicked ), NULL, this );
m_gridDrills->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_BOARD_STATISTICS_BASE::drillGridSize ), NULL, this );
m_buttonSaveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::saveReportClicked ), NULL, this );
}
DIALOG_BOARD_STATISTICS_BASE::~DIALOG_BOARD_STATISTICS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_BOARD_STATISTICS_BASE::windowSize ) );
m_checkBoxSubtractHoles->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::checkboxClicked ), NULL, this );
m_checkBoxExcludeComponentsNoPins->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::checkboxClicked ), NULL, this );
m_gridDrills->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_BOARD_STATISTICS_BASE::drillGridSize ), NULL, this );
m_buttonSaveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BOARD_STATISTICS_BASE::saveReportClicked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_BOARD_STATISTICS_BASE_H__
#define __DIALOG_BOARD_STATISTICS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -21,7 +20,11 @@
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -36,6 +39,8 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM
private:
protected:
wxNotebook* topNotebook;
wxPanel* generalPanel;
wxGrid* m_gridComponents;
wxGrid* m_gridPads;
wxGrid* m_gridBoard;
@ -43,13 +48,16 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM
wxGrid* m_gridVias;
wxCheckBox* m_checkBoxSubtractHoles;
wxCheckBox* m_checkBoxExcludeComponentsNoPins;
wxStaticLine* m_staticline2;
wxPanel* drillsPanel;
wxGrid* m_gridDrills;
wxButton* m_buttonSaveReport;
wxStdDialogButtonSizer* m_sdbControlSizer;
wxButton* m_sdbControlSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void windowSize( wxSizeEvent& event ) { event.Skip(); }
virtual void checkboxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void drillGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void saveReportClicked( wxCommandEvent& event ) { event.Skip(); }
@ -60,4 +68,3 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM
};
#endif //__DIALOG_BOARD_STATISTICS_BASE_H__