KiCad PCB EDA Suite
DIALOG_BOARD_STATISTICS Class Reference

Dialog to show common board info. More...

#include <dialog_board_statistics.h>

Inheritance diagram for DIALOG_BOARD_STATISTICS:
DIALOG_BOARD_STATISTICS_BASE DIALOG_SHIM KIWAY_HOLDER

Classes

struct  componentsType_t
 Footprint attributes (such as SMD, THT, Virtual and so on), which will be shown in the dialog. More...
 
struct  drillType_t
 
struct  typeContainer_t
 Type information, which will be shown in dialog. More...
 

Public Types

using padsType_t = typeContainer_t< PAD_ATTR_T >
 
using viasType_t = typeContainer_t< VIATYPE >
 
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 >
 
enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 DIALOG_BOARD_STATISTICS (PCB_EDIT_FRAME *aParentFrame)
 
 ~DIALOG_BOARD_STATISTICS ()
 Get data from the PCB board and print it to dialog. More...
 
bool TransferDataToWindow () override
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal () const
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
void SetPosition (const wxPoint &aNewPosition)
 Force the position of the dialog to a new position. More...
 
EDA_UNITS GetUserUnits () const
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

Protected Member Functions

virtual void windowSize (wxSizeEvent &event)
 
void finishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void setSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int horizPixelsFromDU (int x) const
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int vertPixelsFromDU (int y) const
 Convert an integer number of dialog units to pixels, vertically. More...
 
void resetSize ()
 Clear the existing dialog size and position. More...
 
virtual void OnCharHook (wxKeyEvent &aEvt)
 

Protected Attributes

wxNotebook * topNotebook
 
wxPanel * generalPanel
 
wxGrid * m_gridComponents
 
wxGrid * m_gridPads
 
wxGrid * m_gridBoard
 
wxStaticText * viasLabel
 
wxGrid * m_gridVias
 
wxCheckBox * m_checkBoxSubtractHoles
 
wxCheckBox * m_checkBoxExcludeComponentsNoPins
 
wxPanel * drillsPanel
 
wxGrid * m_gridDrills
 
wxButton * m_buttonSaveReport
 
wxStdDialogButtonSizer * m_sdbControlSizer
 
wxButton * m_sdbControlSizerCancel
 
EDA_UNITS m_units
 
std::string m_hash_key
 
bool m_useCalculatedSize
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
std::vector< wxWindow * > m_tabOrder
 

Private Member Functions

void refreshItemsTypes ()
 < Function to fill up all items types to be shown in the dialog. More...
 
void getDataFromPCB ()
 Apply data to dialog widgets. More...
 
void updateWidets ()
 Update drills grid. More...
 
void updateDrillGrid ()
 Print grid to string in tabular format. More...
 
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. More...
 
void saveReportClicked (wxCommandEvent &aEvent) override
 
void drillGridSize (wxSizeEvent &aEvent) override
 
void drillGridSort (wxGridEvent &aEvent)
 

Private Attributes

PCB_EDIT_FRAMEm_parentFrame
 
int m_boardWidth
 
int m_boardHeight
 
double m_boardArea
 Show if board outline properly defined. More...
 
bool m_hasOutline
 Hold all components types to be shown in the dialog. More...
 
componentsTypeList_t m_componentsTypes
 Hold all pads types to be shown in the dialog. More...
 
padsTypeList_t m_padsTypes
 Hold all vias types to be shown in the dialog. More...
 
viasTypeList_t m_viasTypes
 Hold all drill hole types to be shown in the dialog. More...
 
drillTypeList_t m_drillTypes
 

Detailed Description

Dialog to show common board info.

Definition at line 44 of file dialog_board_statistics.h.

Member Typedef Documentation

◆ componentsTypeList_t

◆ drillTypeList_t

Definition at line 174 of file dialog_board_statistics.h.

◆ padsType_t

◆ padsTypeList_t

Definition at line 172 of file dialog_board_statistics.h.

◆ viasType_t

◆ viasTypeList_t

Definition at line 173 of file dialog_board_statistics.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_BOARD_STATISTICS()

DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS ( PCB_EDIT_FRAME aParentFrame)

Definition at line 71 of file dialog_board_statistics.cpp.

71  :
72  DIALOG_BOARD_STATISTICS_BASE( aParentFrame ),
73  m_boardWidth( 0 ),
74  m_boardHeight( 0 ),
75  m_boardArea( 0.0 ),
76  m_hasOutline( false )
77 {
78  m_parentFrame = aParentFrame;
79 
80  m_gridDrills->UseNativeColHeader();
81  m_gridDrills->Connect( wxEVT_GRID_COL_SORT, wxGridEventHandler( DIALOG_BOARD_STATISTICS::drillGridSort ), NULL, this );
82 
85 
86  // Make labels for grids
87  wxFont headingFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
88  headingFont.SetSymbolicSize( wxFONTSIZE_SMALL );
89  m_gridComponents->SetCellValue( ROW_LABEL, COL_FRONT_SIDE, _( "Front Side" ) );
90  m_gridComponents->SetCellFont( ROW_LABEL, COL_FRONT_SIDE, headingFont );
91  m_gridComponents->SetCellValue( ROW_LABEL, COL_BOTTOM_SIDE, _( "Back Side" ) );
92  m_gridComponents->SetCellFont( ROW_LABEL, COL_BOTTOM_SIDE, headingFont );
93  m_gridComponents->SetCellValue( ROW_LABEL, COL_TOTAL, _( "Total" ) );
94  m_gridComponents->SetCellFont( ROW_LABEL, COL_TOTAL, headingFont );
95 
96  m_gridBoard->SetCellValue( 0, 0, _( "Width:" ) );
97  m_gridBoard->SetCellAlignment( 0, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
98  m_gridBoard->SetCellValue( 1, 0, _( "Height:" ) );
99  m_gridBoard->SetCellAlignment( 1, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
100  m_gridBoard->SetCellValue( 2, 0, _( "Area:" ) );
101  m_gridBoard->SetCellAlignment( 2, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
102 
103  wxGrid* grids[] = { m_gridComponents, m_gridPads, m_gridVias, m_gridBoard };
104  for( auto& grid : grids )
105  {
106  // Remove wxgrid's selection boxes
107  grid->SetCellHighlightPenWidth( 0 );
108  grid->SetColMinimalAcceptableWidth( 80 );
109  for( int i = 0; i < grid->GetNumberRows(); i++ )
110  grid->SetCellAlignment( i, COL_LABEL, wxALIGN_LEFT, wxALIGN_CENTRE );
111  }
112 
113  wxFileName fn = m_parentFrame->GetBoard()->GetFileName();
114 
116  || s_savedDialogState.m_project != Prj().GetProjectFullName() )
117  {
118  fn.SetName( fn.GetName() + "_report" );
119  fn.SetExt( "txt" );
120  s_savedDialogState.saveReportName = fn.GetFullName();
121  s_savedDialogState.saveReportFolder = wxPathOnly( Prj().GetProjectFullName() );
124  }
125 
126  // The wxStdDialogButtonSizer wxID_CANCLE button is in fact a close button
127  // Nothing to cancel:
128  m_sdbControlSizerCancel->SetLabel( _( "Close" ) );
129 }
bool m_hasOutline
Hold all components types to be shown in the dialog.
const wxString & GetFileName() const
Definition: board.h:291
double m_boardArea
Show if board outline properly defined.
#define COL_TOTAL
void drillGridSort(wxGridEvent &aEvent)
#define COL_BOTTOM_SIDE
#define NULL
#define ROW_LABEL
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
#define COL_FRONT_SIDE
DIALOG_BOARD_STATISTICS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Board Statistics"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
#define _(s)
Definition: 3d_actions.cpp:33
BOARD * GetBoard() const
#define COL_LABEL
static DIALOG_BOARD_STATISTICS_SAVED_STATE s_savedDialogState

References _, COL_BOTTOM_SIDE, COL_FRONT_SIDE, COL_LABEL, COL_TOTAL, drillGridSort(), DIALOG_BOARD_STATISTICS_SAVED_STATE::excludeNoPins, PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), PROJECT::GetProjectFullName(), DIALOG_BOARD_STATISTICS_BASE::m_checkBoxExcludeComponentsNoPins, DIALOG_BOARD_STATISTICS_BASE::m_checkBoxSubtractHoles, DIALOG_BOARD_STATISTICS_BASE::m_gridBoard, DIALOG_BOARD_STATISTICS_BASE::m_gridComponents, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, DIALOG_BOARD_STATISTICS_BASE::m_gridPads, DIALOG_BOARD_STATISTICS_BASE::m_gridVias, m_parentFrame, DIALOG_BOARD_STATISTICS_SAVED_STATE::m_project, DIALOG_BOARD_STATISTICS_BASE::m_sdbControlSizerCancel, NULL, KIWAY_HOLDER::Prj(), ROW_LABEL, s_savedDialogState, DIALOG_BOARD_STATISTICS_SAVED_STATE::saveReportFolder, DIALOG_BOARD_STATISTICS_SAVED_STATE::saveReportInitialized, DIALOG_BOARD_STATISTICS_SAVED_STATE::saveReportName, and DIALOG_BOARD_STATISTICS_SAVED_STATE::subtractHoles.

◆ ~DIALOG_BOARD_STATISTICS()

DIALOG_BOARD_STATISTICS::~DIALOG_BOARD_STATISTICS ( )

Get data from the PCB board and print it to dialog.

Definition at line 749 of file dialog_board_statistics.cpp.

750 {
751 }

Member Function Documentation

◆ adjustDrillGridColumns()

void DIALOG_BOARD_STATISTICS::adjustDrillGridColumns ( )
private

Definition at line 584 of file dialog_board_statistics.cpp.

585 {
586  int newTotalWidth = m_gridDrills->GetClientSize().GetWidth();
587  int curTotalWidth = 0;
588 
589  // Find the total current width
590  for( int i = 0; i < m_gridDrills->GetNumberCols(); i++ )
591  {
593  curTotalWidth += m_gridDrills->GetColSize( i );
594  }
595 
596  // Resize the last two columns to fill all available space
597 
598  int remainingWidth = newTotalWidth - curTotalWidth;
599 
600  m_gridDrills->SetColSize( drillType_t::COL_START_LAYER, remainingWidth / 2 );
601  m_gridDrills->SetColSize( drillType_t::COL_STOP_LAYER, remainingWidth - remainingWidth / 2 );
602 
603  m_gridDrills->Refresh();
604 }

References DIALOG_BOARD_STATISTICS::drillType_t::COL_START_LAYER, DIALOG_BOARD_STATISTICS::drillType_t::COL_STOP_LAYER, and DIALOG_BOARD_STATISTICS_BASE::m_gridDrills.

Referenced by drillGridSize(), and updateWidets().

◆ checkboxClicked()

void DIALOG_BOARD_STATISTICS::checkboxClicked ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Save board statistics to a file.

Reimplemented from DIALOG_BOARD_STATISTICS_BASE.

Definition at line 607 of file dialog_board_statistics.cpp.

608 {
612  getDataFromPCB();
613  updateWidets();
614  Layout();
615  drillsPanel->Layout();
616 }
void refreshItemsTypes()
< Function to fill up all items types to be shown in the dialog.
void getDataFromPCB()
Apply data to dialog widgets.
void updateWidets()
Update drills grid.
static DIALOG_BOARD_STATISTICS_SAVED_STATE s_savedDialogState

References DIALOG_BOARD_STATISTICS_BASE::drillsPanel, DIALOG_BOARD_STATISTICS_SAVED_STATE::excludeNoPins, getDataFromPCB(), DIALOG_BOARD_STATISTICS_BASE::m_checkBoxExcludeComponentsNoPins, DIALOG_BOARD_STATISTICS_BASE::m_checkBoxSubtractHoles, refreshItemsTypes(), s_savedDialogState, DIALOG_BOARD_STATISTICS_SAVED_STATE::subtractHoles, and updateWidets().

◆ drillGridSize()

void DIALOG_BOARD_STATISTICS::drillGridSize ( wxSizeEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_BOARD_STATISTICS_BASE.

Definition at line 732 of file dialog_board_statistics.cpp.

733 {
734  aEvent.Skip();
736 }

References adjustDrillGridColumns().

◆ drillGridSort()

void DIALOG_BOARD_STATISTICS::drillGridSort ( wxGridEvent &  aEvent)
private

Definition at line 738 of file dialog_board_statistics.cpp.

739 {
740  drillType_t::COL_ID colId = static_cast<drillType_t::COL_ID>( aEvent.GetCol() );
741  bool ascending =
742  !( m_gridDrills->IsSortingBy( colId ) && m_gridDrills->IsSortOrderAscending() );
743 
744  sort( m_drillTypes.begin(), m_drillTypes.end(), drillType_t::COMPARE( colId, ascending ) );
745 
746  updateDrillGrid();
747 }
void updateDrillGrid()
Print grid to string in tabular format.

References m_drillTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, and updateDrillGrid().

Referenced by DIALOG_BOARD_STATISTICS().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 307 of file dialog_shim.cpp.

308 {
309  // so we can do logging of this state change:
310  return wxDialog::Enable( enable );
311 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 445 of file dialog_shim.cpp.

446 {
447  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
448  // handle validation in the same way as other dialogs.
449  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
450  return;
451 
452  SetReturnCode( retCode );
453 
454  if( !IsQuasiModal() )
455  {
456  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
457  "wasn't called" );
458  return;
459  }
460 
461  if( m_qmodal_loop )
462  {
463  if( m_qmodal_loop->IsRunning() )
464  m_qmodal_loop->Exit( 0 );
465  else
466  m_qmodal_loop->ScheduleExit( 0 );
467 
469  }
470 
473 
474  Show( false );
475 }
bool IsQuasiModal() const
Definition: dialog_shim.h:107
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:212
#define NULL
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:215

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, NULL, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_SYMBOL::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_SYMBOL_PROPERTIES::OnEditLibrarySymbol(), DIALOG_SYMBOL_PROPERTIES::OnEditSymbol(), DIALOG_SYMBOL_PROPERTIES::OnExchangeSymbol(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnUpdateSymbol(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_SYMBOL::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ finishDialogSettings()

void DIALOG_SHIM::finishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

finishDialogSettings must be called from derived classes after all widgets have been initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at the end of TransferDataToWindow, or better yet, at end of a wxInitDialogEvent handler.

Definition at line 148 of file dialog_shim.cpp.

149 {
150  // must be called from the constructor of derived classes,
151  // when all widgets are initialized, and therefore their size fixed
152 
153  // SetSizeHints fixes the minimal size of sizers in the dialog
154  // (SetSizeHints calls Fit(), so no need to call it)
155  GetSizer()->SetSizeHints( this );
156 }

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SHEET_PROPERTIES::OnInitDlg(), DIALOG_SYMBOL_PROPERTIES::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

◆ getDataFromPCB()

void DIALOG_BOARD_STATISTICS::getDataFromPCB ( )
private

Apply data to dialog widgets.

Definition at line 179 of file dialog_board_statistics.cpp.

180 {
181  BOARD* board = m_parentFrame->GetBoard();
182 
183  // Get footprints and pads count
184  for( FOOTPRINT* footprint : board->Footprints() )
185  {
186  // Do not proceed footprints with no pads if checkbox checked
187  if( m_checkBoxExcludeComponentsNoPins->GetValue() && ! footprint->Pads().size() )
188  continue;
189 
190  // Go through components types list
191  for( auto& type : m_componentsTypes )
192  {
193  if(( footprint->GetAttributes() & type.attribute ) > 0 )
194  {
195  if( footprint->IsFlipped() )
196  type.backSideQty++;
197  else
198  type.frontSideQty++;
199  break;
200  }
201  }
202 
203  for( PAD* pad : footprint->Pads() )
204  {
205  // Go through pads types list
206  for( auto& type : m_padsTypes )
207  {
208  if( pad->GetAttribute() == type.attribute )
209  {
210  type.qty++;
211  break;
212  }
213  }
214 
215  if( pad->GetDrillSize().x > 0 && pad->GetDrillSize().y > 0 )
216  {
217  PCB_LAYER_ID top, bottom;
218 
219  if( pad->GetLayerSet().CuStack().empty() )
220  {
221  // The pad is not on any copper layer
222  top = UNDEFINED_LAYER;
223  bottom = UNDEFINED_LAYER;
224  }
225  else
226  {
227  top = pad->GetLayerSet().CuStack().front();
228  bottom = pad->GetLayerSet().CuStack().back();
229  }
230 
231  drillType_t drill( pad->GetDrillSize().x, pad->GetDrillSize().y,
232  pad->GetDrillShape(), pad->GetAttribute() != PAD_ATTRIB_NPTH,
233  true, top, bottom );
234 
235  auto it = m_drillTypes.begin();
236 
237  for( ; it != m_drillTypes.end(); it++ )
238  {
239  if( *it == drill )
240  {
241  it->qty++;
242  break;
243  }
244  }
245 
246  if( it == m_drillTypes.end() )
247  {
248  drill.qty = 1;
249  m_drillTypes.push_back( drill );
250  m_gridDrills->InsertRows();
251  }
252  }
253  }
254  }
255 
256  // Get via counts
257  for( TRACK* track : board->Tracks() )
258  {
259  if( VIA* via = dyn_cast<VIA*>( track ) )
260  {
261  for( auto& type : m_viasTypes )
262  {
263  if( via->GetViaType() == type.attribute )
264  {
265  type.qty++;
266  break;
267  }
268  }
269 
270  drillType_t drill( via->GetDrillValue(), via->GetDrillValue(), PAD_DRILL_SHAPE_CIRCLE,
271  true, false, via->TopLayer(), via->BottomLayer() );
272 
273  auto it = m_drillTypes.begin();
274 
275  for( ; it != m_drillTypes.end(); it++ )
276  {
277  if( *it == drill )
278  {
279  it->qty++;
280  break;
281  }
282  }
283 
284  if( it == m_drillTypes.end() )
285  {
286  drill.qty = 1;
287  m_drillTypes.push_back( drill );
288  m_gridDrills->InsertRows();
289  }
290  }
291  }
292 
293  sort( m_drillTypes.begin(), m_drillTypes.end(),
294  drillType_t::COMPARE( drillType_t::COL_COUNT, false ) );
295 
296  bool boundingBoxCreated = false; //flag if bounding box initialized
297  BOX2I bbox;
298  SHAPE_POLY_SET polySet;
299  m_hasOutline = board->GetBoardPolygonOutlines( polySet );
300 
301  // If board has no Edge Cuts lines, board->GetBoardPolygonOutlines will
302  // return small rectangle, so we double check that
303  bool edgeCutsExists = false;
304 
305  for( BOARD_ITEM* drawing : board->Drawings() )
306  {
307  if( drawing->GetLayer() == Edge_Cuts )
308  {
309  edgeCutsExists = true;
310  break;
311  }
312  }
313 
314  if( !edgeCutsExists )
315  m_hasOutline = false;
316 
317  if( m_hasOutline )
318  {
319  m_boardArea = 0.0;
320 
321  for( int i = 0; i < polySet.OutlineCount(); i++ )
322  {
323  SHAPE_LINE_CHAIN& outline = polySet.Outline( i );
324  m_boardArea += std::fabs( outline.Area() );
325 
326  // If checkbox "subtract holes" is checked
327  if( m_checkBoxSubtractHoles->GetValue() )
328  {
329  for( int j = 0; j < polySet.HoleCount( i ); j++ )
330  m_boardArea -= std::fabs( polySet.Hole( i, j ).Area() );
331  }
332 
333  if( boundingBoxCreated )
334  {
335  bbox.Merge( outline.BBox() );
336  }
337  else
338  {
339  bbox = outline.BBox();
340  boundingBoxCreated = true;
341  }
342  }
343 
344  m_boardWidth = bbox.GetWidth();
345  m_boardHeight = bbox.GetHeight();
346  }
347 }
bool m_hasOutline
Hold all components types to be shown in the dialog.
Definition: track.h:343
int OutlineCount() const
Return the number of vertices in a given outline/hole.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
Definition: board.cpp:1862
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
viasTypeList_t m_viasTypes
Hold all drill hole types to be shown in the dialog.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
double m_boardArea
Show if board outline properly defined.
PCB_LAYER_ID
A quick note on layer IDs:
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
coord_type GetWidth() const
Definition: box2.h:197
FOOTPRINTS & Footprints()
Definition: board.h:296
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:386
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:189
SHAPE_LINE_CHAIN.
coord_type GetHeight() const
Definition: box2.h:198
padsTypeList_t m_padsTypes
Hold all vias types to be shown in the dialog.
BOARD * GetBoard() const
Definition: pad.h:60
componentsTypeList_t m_componentsTypes
Hold all pads types to be shown in the dialog.
DRAWINGS & Drawings()
Definition: board.h:299
TRACKS & Tracks()
Definition: board.h:293
Definition: track.h:83

References SHAPE_LINE_CHAIN::Area(), SHAPE_LINE_CHAIN::BBox(), DIALOG_BOARD_STATISTICS::drillType_t::COL_COUNT, BOARD::Drawings(), Edge_Cuts, BOARD::Footprints(), PCB_BASE_FRAME::GetBoard(), BOARD::GetBoardPolygonOutlines(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), m_boardArea, m_boardHeight, m_boardWidth, DIALOG_BOARD_STATISTICS_BASE::m_checkBoxExcludeComponentsNoPins, DIALOG_BOARD_STATISTICS_BASE::m_checkBoxSubtractHoles, m_componentsTypes, m_drillTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, m_hasOutline, m_padsTypes, m_parentFrame, m_viasTypes, BOX2< Vec >::Merge(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), PAD_ATTRIB_NPTH, PAD_DRILL_SHAPE_CIRCLE, BOARD::Tracks(), and UNDEFINED_LAYER.

Referenced by checkboxClicked(), and TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:79

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ horizPixelsFromDU()

int DIALOG_SHIM::horizPixelsFromDU ( int  x) const
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 166 of file dialog_shim.cpp.

167 {
168  wxSize sz( x, 0 );
169  return ConvertDialogToPixels( sz ).x;
170 }

Referenced by DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 125 of file dialog_shim.h.

126  {
127  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
128  !e.ShiftDown() && !e.MetaDown();
129  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 131 of file dialog_shim.h.

132  {
133  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
134  e.ShiftDown() && !e.MetaDown();
135  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:78

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), SYMBOL_EDIT_FRAME::canCloseWindow(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurPart(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ OnCharHook()

void DIALOG_SHIM::OnCharHook ( wxKeyEvent &  aEvt)
protectedvirtualinherited

Reimplemented in DIALOG_CHOOSE_SYMBOL, HK_PROMPT_DIALOG, DIALOG_TEXT_PROPERTIES, and HTML_MESSAGE_BOX.

Definition at line 536 of file dialog_shim.cpp.

537 {
538  if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
539  {
540  if( m_parentFrame )
541  {
543  return;
544  }
545  }
546  // shift-return (Mac default) or Ctrl-Return (GTK) for OK
547  else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
548  {
549  wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
550  return;
551  }
552  else if( aEvt.GetKeyCode() == WXK_TAB && !aEvt.ControlDown() )
553  {
554  wxWindow* currentWindow = wxWindow::FindFocus();
555  int currentIdx = -1;
556  int delta = aEvt.ShiftDown() ? -1 : 1;
557 
558  auto advance = [&]( int& idx )
559  {
560  // Wrap-around modulus
561  int size = m_tabOrder.size();
562  idx = ( ( idx + delta ) % size + size ) % size;
563  };
564 
565  for( size_t i = 0; i < m_tabOrder.size(); ++i )
566  {
567  if( m_tabOrder[i] == currentWindow )
568  {
569  currentIdx = (int) i;
570  break;
571  }
572  }
573 
574  if( currentIdx >= 0 )
575  {
576  advance( currentIdx );
577 
578  //todo: We don't currently have non-textentry dialog boxes but this will break if
579  // we add them.
580 #ifdef __APPLE__
581  while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
582  advance( currentIdx );
583 #endif
584 
585  m_tabOrder[ currentIdx ]->SetFocus();
586  return;
587  }
588  }
589 
590  aEvt.Skip();
591 }
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:219
EDA_BASE_FRAME * m_parentFrame
Definition: dialog_shim.h:217
virtual void ToggleUserUnits()

References DIALOG_SHIM::m_parentFrame, DIALOG_SHIM::m_tabOrder, and EDA_BASE_FRAME::ToggleUserUnits().

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 352 of file dialog_shim.cpp.

353 {
354  if( m_firstPaintEvent )
355  {
357 
358  selectAllInTextCtrls( GetChildren() );
359 
362  else
363  KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
364 
365  m_firstPaintEvent = false;
366  }
367 
368  event.Skip();
369 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:210
bool m_firstPaintEvent
Definition: dialog_shim.h:209
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: gtk/ui.cpp:44
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:56
static void selectAllInTextCtrls(wxWindowList &children)

References KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision(), KIPLATFORM::UI::ForceFocus(), DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ printGridToStringAsTable()

void DIALOG_BOARD_STATISTICS::printGridToStringAsTable ( wxGrid *  aGrid,
wxString &  aStr,
bool  aUseRowLabels,
bool  aUseColLabels,
bool  aUseFirstColAsLabel 
)
private

Definition at line 489 of file dialog_board_statistics.cpp.

491 {
492  std::vector<int> widths( aGrid->GetNumberCols(), 0 );
493  int rowLabelsWidth = 0;
494 
495  // Determine column widths.
496 
497  if( aUseColLabels )
498  {
499  for( int col = 0; col < aGrid->GetNumberCols(); col++ )
500  widths[col] = aGrid->GetColLabelValue( col ).length();
501  }
502 
503  for( int row = 0; row < aGrid->GetNumberRows(); row++ )
504  {
505  rowLabelsWidth = std::max<int>( rowLabelsWidth, aGrid->GetRowLabelValue( row ).length() );
506 
507  for( int col = 0; col < aGrid->GetNumberCols(); col++ )
508  widths[col] = std::max<int>( widths[col], aGrid->GetCellValue( row, col ).length() );
509  }
510 
511  // Print the cells.
512 
513  wxString tmp;
514 
515  // Print column labels.
516 
517  aStr << "|";
518 
519  if( aUseRowLabels )
520  {
521  aStr.Append( ' ', rowLabelsWidth );
522  aStr << " |";
523  }
524 
525  for( int col = 0; col < aGrid->GetNumberCols(); col++ )
526  {
527  if( aUseColLabels )
528  tmp.Printf( " %*s |", widths[col], aGrid->GetColLabelValue( col ) );
529  else
530  tmp.Printf( " %*s |", widths[col], aGrid->GetCellValue( 0, col ) );
531  aStr << tmp;
532  }
533 
534  aStr << "\n";
535 
536  // Print column label horizontal separators.
537 
538  aStr << "|";
539 
540  if( aUseRowLabels )
541  {
542  aStr.Append( '-', rowLabelsWidth );
543  aStr << "-|";
544  }
545 
546  for( int col = 0; col < aGrid->GetNumberCols(); col++ )
547  {
548  aStr << "-";
549  aStr.Append( '-', widths[col] );
550  aStr << "-|";
551  }
552 
553  aStr << "\n";
554 
555  // Print regular cells.
556 
557  int firstRow = 0, firstCol = 0;
558 
559  if( !aUseColLabels )
560  firstRow = 1;
561 
562  if( !aUseRowLabels && aUseFirstColAsLabel )
563  firstCol = 1;
564 
565  for( int row = firstRow; row < aGrid->GetNumberRows(); row++ )
566  {
567  if( aUseRowLabels )
568  tmp.Printf( "|%-*s |", rowLabelsWidth, aGrid->GetRowLabelValue( row ) );
569  else if( aUseFirstColAsLabel )
570  tmp.Printf( "|%-*s |", widths[0], aGrid->GetCellValue( row, 0 ) );
571  else
572  tmp.Printf( "|" );
573  aStr << tmp;
574 
575  for( int col = firstCol; col < aGrid->GetNumberCols(); col++ )
576  {
577  tmp.Printf( " %*s |", widths[col], aGrid->GetCellValue( row, col ) );
578  aStr << tmp;
579  }
580  aStr << "\n";
581  }
582 }

Referenced by saveReportClicked().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return a reference to the PROJECT associated with this KIWAY.

Definition at line 35 of file kiway_holder.cpp.

36 {
37  return Kiway().Prj();
38 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:174

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_PROPERTIES::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), DIALOG_EXPORT_SVG::ExportSVGFile(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_PROPERTIES::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::Save_File(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), SYMBOL_EDIT_FRAME::savePartAs(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), saveReportClicked(), EDA_BASE_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), SYMBOL_VIEWER_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), SYMBOL_LIBRARY_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ refreshItemsTypes()

void DIALOG_BOARD_STATISTICS::refreshItemsTypes ( )
private

< Function to fill up all items types to be shown in the dialog.

Get data from board.

Definition at line 131 of file dialog_board_statistics.cpp.

132 {
133  m_componentsTypes.clear();
134 
135  // If you need some more types to be shown, simply add them to the
136  // corresponding list
137  m_componentsTypes.push_back( componentsType_t( FP_THROUGH_HOLE, _( "THT:" ) ) );
138  m_componentsTypes.push_back( componentsType_t( FP_SMD, _( "SMD:" ) ) );
139 
140  m_padsTypes.clear();
141  m_padsTypes.push_back( padsType_t( PAD_ATTRIB_PTH, _( "Through hole:" ) ) );
142  m_padsTypes.push_back( padsType_t( PAD_ATTRIB_SMD, _( "SMD:" ) ) );
143  m_padsTypes.push_back( padsType_t( PAD_ATTRIB_CONN, _( "Connector:" ) ) );
144  m_padsTypes.push_back( padsType_t( PAD_ATTRIB_NPTH, _( "NPTH:" ) ) );
145 
146  m_viasTypes.clear();
147  m_viasTypes.push_back( viasType_t( VIATYPE::THROUGH, _( "Through vias:" ) ) );
148  m_viasTypes.push_back( viasType_t( VIATYPE::BLIND_BURIED, _( "Blind/buried:" ) ) );
149  m_viasTypes.push_back( viasType_t( VIATYPE::MICROVIA, _( "Micro vias:" ) ) );
150 
151  // If there not enough rows in grids, append some
152  int appendRows = m_componentsTypes.size() + 2 - m_gridComponents->GetNumberRows();
153 
154  if( appendRows > 0 )
155  m_gridComponents->AppendRows( appendRows );
156 
157  appendRows = m_padsTypes.size() + 1 - m_gridPads->GetNumberRows();
158 
159  if( appendRows > 0 )
160  m_gridPads->AppendRows( appendRows );
161 
162  appendRows = m_viasTypes.size() + 1 - m_gridVias->GetNumberRows();
163 
164  if( appendRows )
165  m_gridVias->AppendRows( appendRows );
166 }
typeContainer_t< VIATYPE > viasType_t
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
viasTypeList_t m_viasTypes
Hold all drill hole types to be shown in the dialog.
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
typeContainer_t< PAD_ATTR_T > padsType_t
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:82
#define _(s)
Definition: 3d_actions.cpp:33
Plated through hole pad.
Definition: pad_shapes.h:80
padsTypeList_t m_padsTypes
Hold all vias types to be shown in the dialog.
componentsTypeList_t m_componentsTypes
Hold all pads types to be shown in the dialog.

References _, BLIND_BURIED, FP_SMD, FP_THROUGH_HOLE, m_componentsTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridComponents, DIALOG_BOARD_STATISTICS_BASE::m_gridPads, DIALOG_BOARD_STATISTICS_BASE::m_gridVias, m_padsTypes, m_viasTypes, MICROVIA, PAD_ATTRIB_CONN, PAD_ATTRIB_NPTH, PAD_ATTRIB_PTH, PAD_ATTRIB_SMD, and THROUGH.

Referenced by checkboxClicked(), and TransferDataToWindow().

◆ resetSize()

void DIALOG_SHIM::resetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 282 of file dialog_shim.cpp.

283 {
284  const char* hash_key;
285 
286  if( m_hash_key.size() )
287  {
288  // a special case like EDA_LIST_DIALOG, which has multiple uses.
289  hash_key = m_hash_key.c_str();
290  }
291  else
292  {
293  hash_key = typeid(*this).name();
294  }
295 
296  RECT_MAP::iterator it = class_map.find( hash_key );
297 
298  if( it == class_map.end() )
299  return;
300 
301  EDA_RECT rect = it->second;
302  rect.SetSize( 0, 0 );
303  class_map[ hash_key ] = rect;
304 }
std::string m_hash_key
Definition: dialog_shim.h:200
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:139
Handle the component boundary box.
Definition: eda_rect.h:42

References class_map, DIALOG_SHIM::m_hash_key, and EDA_RECT::SetSize().

Referenced by DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES().

◆ saveReportClicked()

void DIALOG_BOARD_STATISTICS::saveReportClicked ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_BOARD_STATISTICS_BASE.

Definition at line 618 of file dialog_board_statistics.cpp.

619 {
620  FILE* outFile;
621  wxString msg;
622  wxString boardName;
623 
624  wxFileName fn = m_parentFrame->GetBoard()->GetFileName();
625  boardName = fn.GetName();
626  wxFileDialog saveFileDialog( this, _( "Save Report File" ),
630  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
631 
632  if( saveFileDialog.ShowModal() == wxID_CANCEL )
633  return;
634 
635  s_savedDialogState.saveReportFolder = wxPathOnly( saveFileDialog.GetPath() );
636  s_savedDialogState.saveReportName = saveFileDialog.GetFilename();
637 
638  outFile = wxFopen( saveFileDialog.GetPath(), "wt" );
639 
640  if( outFile == NULL )
641  {
642  msg.Printf( _( "Unable to create file \"%s\"" ), saveFileDialog.GetPath() );
643  DisplayErrorMessage( this, msg );
644  return;
645  }
646 
647  msg << _( "PCB statistics report\n=====================" ) << "\n";
648  msg << wxS( "- " ) << _( "Date" ) << wxS( ": " ) << wxDateTime::Now().Format() << "\n";
649  msg << wxS( "- " ) << _( "Project" ) << wxS( ": " )<< Prj().GetProjectName() << "\n";
650  msg << wxS( "- " ) << _( "Board name" ) << wxS( ": " )<< boardName << "\n";
651 
652  msg << "\n";
653  msg << _( "Board" ) << "\n-----\n";
654 
655  if( m_hasOutline )
656  {
657  msg << wxS( "- " ) << _( "Width" ) << wxS( ": " ) << MessageTextFromValue( GetUserUnits(), m_boardWidth ) << "\n";
658  msg << wxS( "- " ) << _( "Height" ) << wxS( ": " )<< MessageTextFromValue( GetUserUnits(), m_boardHeight ) << "\n";
659  msg << wxS( "- " ) << _( "Area" ) + wxS( ": " ) << MessageTextFromValue( GetUserUnits(), m_boardArea, true, EDA_DATA_TYPE::AREA );
660  msg << "\n";
661  }
662  else
663  {
664  msg << wxS( "- " ) << _( "Width" ) << wxS( ": " ) << _( "unknown" ) << "\n";
665  msg << wxS( "- " ) << _( "Height" ) << wxS( ": " ) << _( "unknown" ) << "\n";
666  msg << wxS( "- " ) << _( "Area" ) << wxS( ": " ) << _( "unknown" ) << "\n";
667  }
668 
669  msg << "\n";
670  msg << _( "Pads" ) << "\n----\n";
671 
672  for( auto& type : m_padsTypes )
673  msg << "- " << type.title << " " << type.qty << "\n";
674 
675  msg << "\n";
676  msg << _( "Vias" ) << "\n----\n";
677 
678  for( auto& type : m_viasTypes )
679  msg << "- " << type.title << " " << type.qty << "\n";
680 
681  // We will save data about components in the table.
682  // We have to calculate column widths
683  std::vector<int> widths;
684  std::vector<wxString> labels{ "", _( "Front Side" ), _( "Back Side" ), _( "Total" ) };
685  wxString tmp;
686 
687  widths.reserve( labels.size() );
688  for( const auto& label : labels )
689  widths.push_back( label.size() );
690 
691  int frontTotal = 0;
692  int backTotal = 0;
693 
694  for( const auto& type : m_componentsTypes )
695  {
696  // Get maximum width for left label column
697  widths[0] = std::max<int>( type.title.size(), widths[0] );
698  frontTotal += type.frontSideQty;
699  backTotal += type.backSideQty;
700  }
701 
702  // Get maximum width for other columns
703  tmp.Printf( "%i", frontTotal );
704  widths[1] = std::max<int>( tmp.size(), widths[1] );
705  tmp.Printf( "%i", backTotal );
706  widths[2] = std::max<int>( tmp.size(), widths[2] );
707  tmp.Printf( "%i", frontTotal + backTotal );
708  widths[3] = std::max<int>( tmp.size(), widths[3] );
709 
710  //Write components amount to file
711  msg << "\n";
712  msg << _( "Components" ) << "\n----------\n";
713  msg << "\n";
714 
715  printGridToStringAsTable( m_gridComponents, msg, false, false, true );
716 
717  msg << "\n";
718  msg << _( "Drill holes" ) << "\n-----------\n";
719  msg << "\n";
720 
721  printGridToStringAsTable( m_gridDrills, msg, false, true, false );
722 
723  if( fprintf( outFile, "%s", TO_UTF8( msg ) ) < 0 )
724  {
725  msg.Printf( _( "Error writing to file \"%s\"" ), saveFileDialog.GetPath() );
726  DisplayErrorMessage( this, msg );
727  }
728 
729  fclose( outFile );
730 }
bool m_hasOutline
Hold all components types to be shown in the dialog.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:125
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:266
viasTypeList_t m_viasTypes
Hold all drill hole types to be shown in the dialog.
const wxString & GetFileName() const
Definition: board.h:291
double m_boardArea
Show if board outline properly defined.
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:120
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
#define NULL
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void printGridToStringAsTable(wxGrid *aGrid, wxString &aStr, bool aUseRowLabels, bool aUseColLabels, bool aUseFirstColAsLabel)
#define _(s)
Definition: 3d_actions.cpp:33
wxString TextFileWildcard()
padsTypeList_t m_padsTypes
Hold all vias types to be shown in the dialog.
virtual const wxString GetProjectName() const
Return the short name of the project.
BOARD * GetBoard() const
static DIALOG_BOARD_STATISTICS_SAVED_STATE s_savedDialogState
componentsTypeList_t m_componentsTypes
Hold all pads types to be shown in the dialog.

References _, AREA, DisplayErrorMessage(), PCB_BASE_FRAME::GetBoard(), BOARD::GetFileName(), PROJECT::GetProjectName(), DIALOG_SHIM::GetUserUnits(), m_boardArea, m_boardHeight, m_boardWidth, m_componentsTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridComponents, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, m_hasOutline, m_padsTypes, m_parentFrame, m_viasTypes, MessageTextFromValue(), NULL, printGridToStringAsTable(), KIWAY_HOLDER::Prj(), s_savedDialogState, DIALOG_BOARD_STATISTICS_SAVED_STATE::saveReportFolder, DIALOG_BOARD_STATISTICS_SAVED_STATE::saveReportName, TextFileWildcard(), and TO_UTF8.

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 98 of file dialog_shim.h.

99  {
100  m_initialFocusTarget = aWindow;
101  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:210

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), HK_PROMPT_DIALOG::HK_PROMPT_DIALOG(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_EDIT_FRAME::savePartAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow(), DIALOG_COPPER_ZONE::TransferDataToWindow(), and WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
aKiwayis often from a parent window or from KIFACE::CreateWindow().

Definition at line 42 of file kiway_holder.cpp.

43 {
44 #if defined(DEBUG)
45  // offer a trap point for debugging most any window
46  wxASSERT( aDest );
47  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
48  {
49  int breakhere=1;
50  (void) breakhere;
51  }
52 #endif
53 
54  (void) aDest;
55 
56  m_kiway = aKiway;
57 }
KIWAY * m_kiway
Definition: kiway_holder.h:78
const char * name
Definition: DXF_plotter.cpp:59

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetPosition()

void DIALOG_SHIM::SetPosition ( const wxPoint &  aNewPosition)
inherited

Force the position of the dialog to a new position.

Parameters
aNewPositionis the new forced position

Definition at line 187 of file dialog_shim.cpp.

188 {
189  wxDialog::SetPosition( aNewPosition );
190 
191  // Now update the stored position:
192  const char* hash_key;
193 
194  if( m_hash_key.size() )
195  {
196  // a special case like EDA_LIST_DIALOG, which has multiple uses.
197  hash_key = m_hash_key.c_str();
198  }
199  else
200  {
201  hash_key = typeid(*this).name();
202  }
203 
204  RECT_MAP::iterator it = class_map.find( hash_key );
205 
206  if( it == class_map.end() )
207  return;
208 
209  EDA_RECT rect = it->second;
210  rect.SetOrigin( aNewPosition );
211 
212  class_map[ hash_key ] = rect;
213 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
std::string m_hash_key
Definition: dialog_shim.h:200
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
static RECT_MAP class_map
Handle the component boundary box.
Definition: eda_rect.h:42

References class_map, DIALOG_SHIM::m_hash_key, EDA_RECT::SetOrigin(), and PCAD2KICAD::SetPosition().

Referenced by DIALOG_SCH_FIND::DIALOG_SCH_FIND(), and PCB_BASE_FRAME::SelectOneLayer().

◆ setSizeInDU()

void DIALOG_SHIM::setSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 159 of file dialog_shim.cpp.

160 {
161  wxSize sz( x, y );
162  SetSize( ConvertDialogToPixels( sz ) );
163 }

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 216 of file dialog_shim.cpp.

217 {
218  bool ret;
219  const char* hash_key;
220 
221  if( m_hash_key.size() )
222  {
223  // a special case like EDA_LIST_DIALOG, which has multiple uses.
224  hash_key = m_hash_key.c_str();
225  }
226  else
227  {
228  hash_key = typeid(*this).name();
229  }
230 
231  // Show or hide the window. If hiding, save current position and size.
232  // If showing, use previous position and size.
233  if( show )
234  {
235 #ifndef __WINDOWS__
236  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
237 #endif
238  ret = wxDialog::Show( show );
239 
240  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
241  EDA_RECT savedDialogRect = class_map[ hash_key ];
242 
243  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
244  {
245  if( m_useCalculatedSize )
246  {
247  SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
248  wxDialog::GetSize().x, wxDialog::GetSize().y, 0 );
249  }
250  else
251  {
252  SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
253  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
254  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
255  0 );
256  }
257  }
258 
259  // Be sure that the dialog appears in a visible area
260  // (the dialog position might have been stored at the time when it was
261  // shown on another display)
262  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
263  Centre();
264  }
265  else
266  {
267  // Save the dialog's position & size before hiding, using classname as key
268  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
269 
270 #ifdef __WXMAC__
271  if ( m_eventLoop )
272  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
273 #endif
274 
275  ret = wxDialog::Show( show );
276  }
277 
278  return ret;
279 }
std::string m_hash_key
Definition: dialog_shim.h:200
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:107
Handle the component boundary box.
Definition: eda_rect.h:42
bool m_useCalculatedSize
Definition: dialog_shim.h:204
const wxSize GetSize() const
Definition: eda_rect.h:96

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, and DIALOG_SHIM::m_useCalculatedSize.

Referenced by FOOTPRINT_EDITOR_CONTROL::CheckFootprint(), DIALOG_SHIM::EndQuasiModal(), GROUP_TOOL::GroupProperties(), EE_INSPECTION_TOOL::NextMarker(), DRC_TOOL::NextMarker(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_FOOTPRINT_CHECKER::OnLeftDClickItem(), GROUP_TOOL::PickNewMember(), POSITION_RELATIVE_TOOL::PositionRelative(), EE_INSPECTION_TOOL::PrevMarker(), DRC_TOOL::PrevMarker(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), EDA_VIEW_SWITCHER::Show(), DIALOG_PAD_PROPERTIES::Show(), DRC_TOOL::ShowDRCDialog(), EE_INSPECTION_TOOL::ShowERCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), HTML_MESSAGE_BOX::ShowModeless(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 395 of file dialog_shim.cpp.

396 {
397  // This is an exception safe way to zero a pointer before returning.
398  // Yes, even though DismissModal() clears this first normally, this is
399  // here in case there's an exception before the dialog is dismissed.
400  struct NULLER
401  {
402  void*& m_what;
403  NULLER( void*& aPtr ) : m_what( aPtr ) {}
404  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
405  } clear_this( (void*&) m_qmodal_loop );
406 
407  // release the mouse if it's currently captured as the window having it
408  // will be disabled when this dialog is shown -- but will still keep the
409  // capture making it impossible to do anything in the modal dialog itself
410  wxWindow* win = wxWindow::GetCapture();
411  if( win )
412  win->ReleaseMouse();
413 
414  // Get the optimal parent
415  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
416 
417  wxASSERT_MSG( !m_qmodal_parent_disabler,
418  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
419 
420  // quasi-modal: disable only my "optimal" parent
422 
423  // Apple in its infinite wisdom will raise a disabled window before even passing
424  // us the event, so we have no way to stop it. Instead, we must set an order on
425  // the windows so that the quasi-modal will be pushed in front of the disabled
426  // window when it is raised.
428 
429  Show( true );
430 
431  m_qmodal_showing = true;
432 
433  WX_EVENT_LOOP event_loop;
434 
435  m_qmodal_loop = &event_loop;
436 
437  event_loop.Run();
438 
439  m_qmodal_showing = false;
440 
441  return GetReturnCode();
442 }
bool m_qmodal_showing
Definition: dialog_shim.h:214
#define WX_EVENT_LOOP
Definition: kiway_player.h:43
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:212
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:215
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:42
void ReparentQuasiModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: gtk/ui.cpp:50

References DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, KIPLATFORM::UI::ReparentQuasiModal(), DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_TOOL::ChangeSymbols(), S3D::Configure3DPaths(), COMMON_CONTROL::ConfigurePaths(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), InvokeCopperZonesEditor(), InvokeDialogCreateBOM(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeNonCopperZonesEditor(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), S3D::Select3DModel(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowDimensionPropertiesDialog(), PCB_EDIT_FRAME::ShowExchangeFootprintsDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::ShowPadPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), and PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog().

◆ TransferDataToWindow()

bool DIALOG_BOARD_STATISTICS::TransferDataToWindow ( )
override

Definition at line 168 of file dialog_board_statistics.cpp.

169 {
171  getDataFromPCB();
172  updateWidets();
173  Layout();
174  drillsPanel->Layout();
176  return true;
177 }
void refreshItemsTypes()
< Function to fill up all items types to be shown in the dialog.
void getDataFromPCB()
Apply data to dialog widgets.
void updateWidets()
Update drills grid.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...

References DIALOG_BOARD_STATISTICS_BASE::drillsPanel, DIALOG_SHIM::finishDialogSettings(), getDataFromPCB(), refreshItemsTypes(), and updateWidets().

◆ updateDrillGrid()

void DIALOG_BOARD_STATISTICS::updateDrillGrid ( )
private

Print grid to string in tabular format.

Definition at line 437 of file dialog_board_statistics.cpp.

438 {
439  BOARD* board = m_parentFrame->GetBoard();
440  int currentRow = 0;
441 
442  for( auto& type : m_drillTypes )
443  {
444  wxString shapeStr;
445  wxString startLayerStr;
446  wxString stopLayerStr;
447 
448  switch( type.shape )
449  {
451  shapeStr = _( "Round" );
452  break;
454  shapeStr = _( "Slot" );
455  break;
456  default:
457  shapeStr = _( "???" );
458  break;
459  }
460 
461  if( type.startLayer == UNDEFINED_LAYER )
462  startLayerStr = _( "N/A" );
463  else
464  startLayerStr = board->GetLayerName( type.startLayer );
465 
466  if( type.stopLayer == UNDEFINED_LAYER )
467  stopLayerStr = _( "N/A" );
468  else
469  stopLayerStr = board->GetLayerName( type.stopLayer );
470 
471  m_gridDrills->SetCellValue(
472  currentRow, drillType_t::COL_COUNT, wxString::Format( "%i", type.qty ) );
473  m_gridDrills->SetCellValue( currentRow, drillType_t::COL_SHAPE, shapeStr );
474  m_gridDrills->SetCellValue( currentRow, drillType_t::COL_X_SIZE,
475  MessageTextFromValue( GetUserUnits(), type.xSize ) );
476  m_gridDrills->SetCellValue( currentRow, drillType_t::COL_Y_SIZE,
477  MessageTextFromValue( GetUserUnits(), type.ySize ) );
478  m_gridDrills->SetCellValue(
479  currentRow, drillType_t::COL_PLATED, type.isPlated ? _( "PTH" ) : _( "NPTH" ) );
480  m_gridDrills->SetCellValue(
481  currentRow, drillType_t::COL_VIA_PAD, type.isPad ? _( "Pad" ) : _( "Via" ) );
482  m_gridDrills->SetCellValue( currentRow, drillType_t::COL_START_LAYER, startLayerStr );
483  m_gridDrills->SetCellValue( currentRow, drillType_t::COL_STOP_LAYER, stopLayerStr );
484 
485  currentRow++;
486  }
487 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:125
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:120
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:189
#define _(s)
Definition: 3d_actions.cpp:33
BOARD * GetBoard() const

References _, DIALOG_BOARD_STATISTICS::drillType_t::COL_COUNT, DIALOG_BOARD_STATISTICS::drillType_t::COL_PLATED, DIALOG_BOARD_STATISTICS::drillType_t::COL_SHAPE, DIALOG_BOARD_STATISTICS::drillType_t::COL_START_LAYER, DIALOG_BOARD_STATISTICS::drillType_t::COL_STOP_LAYER, DIALOG_BOARD_STATISTICS::drillType_t::COL_VIA_PAD, DIALOG_BOARD_STATISTICS::drillType_t::COL_X_SIZE, DIALOG_BOARD_STATISTICS::drillType_t::COL_Y_SIZE, Format(), PCB_BASE_FRAME::GetBoard(), BOARD::GetLayerName(), DIALOG_SHIM::GetUserUnits(), m_drillTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, m_parentFrame, MessageTextFromValue(), PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, and UNDEFINED_LAYER.

Referenced by drillGridSort(), and updateWidets().

◆ updateWidets()

void DIALOG_BOARD_STATISTICS::updateWidets ( )
private

Update drills grid.

Definition at line 349 of file dialog_board_statistics.cpp.

350 {
351  int totalPads = 0;
352  int currentRow = 0;
353 
354  for( auto& type : m_padsTypes )
355  {
356  m_gridPads->SetCellValue( currentRow, COL_LABEL, type.title );
357  m_gridPads->SetCellValue(
358  currentRow, COL_AMOUNT, wxString::Format( wxT( "%i " ), type.qty ) );
359  totalPads += type.qty;
360  currentRow++;
361  }
362 
363  m_gridPads->SetCellValue( currentRow, COL_LABEL, _( "Total:" ) );
364  m_gridPads->SetCellValue( currentRow, COL_AMOUNT, wxString::Format( "%i ", totalPads ) );
365 
366  int totalVias = 0;
367  currentRow = 0;
368 
369  for( auto& type : m_viasTypes )
370  {
371  m_gridVias->SetCellValue( currentRow, COL_LABEL, type.title );
372  m_gridVias->SetCellValue(
373  currentRow, COL_AMOUNT, wxString::Format( "%i ", type.qty ) );
374  totalVias += type.qty;
375  currentRow++;
376  }
377 
378  m_gridVias->SetCellValue( currentRow, COL_LABEL, _( "Total:" ) );
379  m_gridVias->SetCellValue( currentRow, COL_AMOUNT, wxString::Format( "%i ", totalVias ) );
380 
381 
382  int totalFront = 0;
383  int totalBack = 0;
384 
385  // We don't use row 0, as there labels are
386  currentRow = 1;
387 
388  for( auto& type : m_componentsTypes )
389  {
390  m_gridComponents->SetCellValue( currentRow, COL_LABEL, type.title );
391  m_gridComponents->SetCellValue(
392  currentRow, COL_FRONT_SIDE, wxString::Format( "%i ", type.frontSideQty ) );
393  m_gridComponents->SetCellValue(
394  currentRow, COL_BOTTOM_SIDE, wxString::Format( "%i ", type.backSideQty ) );
395  m_gridComponents->SetCellValue( currentRow, 3,
396  wxString::Format( wxT( "%i " ), type.frontSideQty + type.backSideQty ) );
397  totalFront += type.frontSideQty;
398  totalBack += type.backSideQty;
399  currentRow++;
400  }
401 
402  m_gridComponents->SetCellValue( currentRow, COL_LABEL, _( "Total:" ) );
403  m_gridComponents->SetCellValue( currentRow, COL_FRONT_SIDE,
404  wxString::Format( "%i ", totalFront ) );
405  m_gridComponents->SetCellValue( currentRow, COL_BOTTOM_SIDE,
406  wxString::Format( "%i ", totalBack ) );
407  m_gridComponents->SetCellValue( currentRow, COL_TOTAL,
408  wxString::Format( "%i ", totalFront + totalBack ) );
409 
410  if( m_hasOutline )
411  {
412  m_gridBoard->SetCellValue( ROW_BOARD_WIDTH, COL_AMOUNT,
414  m_gridBoard->SetCellValue( ROW_BOARD_HEIGHT, COL_AMOUNT,
416  m_gridBoard->SetCellValue( ROW_BOARD_AREA, COL_AMOUNT,
418  }
419  else
420  {
421  m_gridBoard->SetCellValue( ROW_BOARD_WIDTH, COL_AMOUNT, _( "unknown" ) );
422  m_gridBoard->SetCellValue( ROW_BOARD_HEIGHT, COL_AMOUNT, _( "unknown" ) );
423  m_gridBoard->SetCellValue( ROW_BOARD_AREA, COL_AMOUNT, _( "unknown" ) );
424  }
425 
426  updateDrillGrid();
427 
428  m_gridComponents->AutoSize();
429  m_gridPads->AutoSize();
430  m_gridBoard->AutoSize();
431  m_gridVias->AutoSize();
432  m_gridDrills->AutoSize();
433 
435 }
bool m_hasOutline
Hold all components types to be shown in the dialog.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:125
#define COL_AMOUNT
viasTypeList_t m_viasTypes
Hold all drill hole types to be shown in the dialog.
#define ROW_BOARD_AREA
#define ROW_BOARD_HEIGHT
double m_boardArea
Show if board outline properly defined.
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:120
#define COL_TOTAL
#define COL_BOTTOM_SIDE
#define COL_FRONT_SIDE
void updateDrillGrid()
Print grid to string in tabular format.
#define ROW_BOARD_WIDTH
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
padsTypeList_t m_padsTypes
Hold all vias types to be shown in the dialog.
#define COL_LABEL
componentsTypeList_t m_componentsTypes
Hold all pads types to be shown in the dialog.

References _, adjustDrillGridColumns(), AREA, COL_AMOUNT, COL_BOTTOM_SIDE, COL_FRONT_SIDE, COL_LABEL, COL_TOTAL, Format(), DIALOG_SHIM::GetUserUnits(), m_boardArea, m_boardHeight, m_boardWidth, m_componentsTypes, DIALOG_BOARD_STATISTICS_BASE::m_gridBoard, DIALOG_BOARD_STATISTICS_BASE::m_gridComponents, DIALOG_BOARD_STATISTICS_BASE::m_gridDrills, DIALOG_BOARD_STATISTICS_BASE::m_gridPads, DIALOG_BOARD_STATISTICS_BASE::m_gridVias, m_hasOutline, m_padsTypes, m_viasTypes, MessageTextFromValue(), ROW_BOARD_AREA, ROW_BOARD_HEIGHT, ROW_BOARD_WIDTH, and updateDrillGrid().

Referenced by checkboxClicked(), and TransferDataToWindow().

◆ vertPixelsFromDU()

int DIALOG_SHIM::vertPixelsFromDU ( int  y) const
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 173 of file dialog_shim.cpp.

174 {
175  wxSize sz( 0, y );
176  return ConvertDialogToPixels( sz ).y;
177 }

Referenced by DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

◆ windowSize()

virtual void DIALOG_BOARD_STATISTICS_BASE::windowSize ( wxSizeEvent &  event)
inlineprotectedvirtualinherited

Member Data Documentation

◆ drillsPanel

wxPanel* DIALOG_BOARD_STATISTICS_BASE::drillsPanel
protectedinherited

◆ generalPanel

wxPanel* DIALOG_BOARD_STATISTICS_BASE::generalPanel
protectedinherited

◆ m_boardArea

double DIALOG_BOARD_STATISTICS::m_boardArea
private

Show if board outline properly defined.

Definition at line 215 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), saveReportClicked(), and updateWidets().

◆ m_boardHeight

int DIALOG_BOARD_STATISTICS::m_boardHeight
private

Definition at line 214 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), saveReportClicked(), and updateWidets().

◆ m_boardWidth

int DIALOG_BOARD_STATISTICS::m_boardWidth
private

Definition at line 213 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), saveReportClicked(), and updateWidets().

◆ m_buttonSaveReport

wxButton* DIALOG_BOARD_STATISTICS_BASE::m_buttonSaveReport
protectedinherited

◆ m_checkBoxExcludeComponentsNoPins

wxCheckBox* DIALOG_BOARD_STATISTICS_BASE::m_checkBoxExcludeComponentsNoPins
protectedinherited

◆ m_checkBoxSubtractHoles

wxCheckBox* DIALOG_BOARD_STATISTICS_BASE::m_checkBoxSubtractHoles
protectedinherited

◆ m_componentsTypes

componentsTypeList_t DIALOG_BOARD_STATISTICS::m_componentsTypes
private

Hold all pads types to be shown in the dialog.

Definition at line 221 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), refreshItemsTypes(), saveReportClicked(), and updateWidets().

◆ m_drillTypes

drillTypeList_t DIALOG_BOARD_STATISTICS::m_drillTypes
private

Definition at line 230 of file dialog_board_statistics.h.

Referenced by drillGridSort(), getDataFromPCB(), and updateDrillGrid().

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 209 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_gridBoard

wxGrid* DIALOG_BOARD_STATISTICS_BASE::m_gridBoard
protectedinherited

◆ m_gridComponents

wxGrid* DIALOG_BOARD_STATISTICS_BASE::m_gridComponents
protectedinherited

◆ m_gridDrills

◆ m_gridPads

wxGrid* DIALOG_BOARD_STATISTICS_BASE::m_gridPads
protectedinherited

◆ m_gridVias

wxGrid* DIALOG_BOARD_STATISTICS_BASE::m_gridVias
protectedinherited

◆ m_hash_key

◆ m_hasOutline

bool DIALOG_BOARD_STATISTICS::m_hasOutline
private

Hold all components types to be shown in the dialog.

Definition at line 218 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), saveReportClicked(), and updateWidets().

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 210 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

◆ m_padsTypes

padsTypeList_t DIALOG_BOARD_STATISTICS::m_padsTypes
private

Hold all vias types to be shown in the dialog.

Definition at line 224 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), refreshItemsTypes(), saveReportClicked(), and updateWidets().

◆ m_parentFrame

PCB_EDIT_FRAME* DIALOG_BOARD_STATISTICS::m_parentFrame
private

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 212 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_qmodal_parent_disabler

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited

◆ m_qmodal_showing

bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 214 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_sdbControlSizer

wxStdDialogButtonSizer* DIALOG_BOARD_STATISTICS_BASE::m_sdbControlSizer
protectedinherited

◆ m_sdbControlSizerCancel

wxButton* DIALOG_BOARD_STATISTICS_BASE::m_sdbControlSizerCancel
protectedinherited

◆ m_tabOrder

◆ m_units

◆ m_useCalculatedSize

bool DIALOG_SHIM::m_useCalculatedSize
protectedinherited

◆ m_viasTypes

viasTypeList_t DIALOG_BOARD_STATISTICS::m_viasTypes
private

Hold all drill hole types to be shown in the dialog.

Definition at line 227 of file dialog_board_statistics.h.

Referenced by getDataFromPCB(), refreshItemsTypes(), saveReportClicked(), and updateWidets().

◆ topNotebook

wxNotebook* DIALOG_BOARD_STATISTICS_BASE::topNotebook
protectedinherited

◆ viasLabel

wxStaticText* DIALOG_BOARD_STATISTICS_BASE::viasLabel
protectedinherited

The documentation for this class was generated from the following files: