From f606069bf66ca6a6582217209dec936c0ebd01da Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 10 Apr 2021 00:25:05 +0100 Subject: [PATCH] Formatting. --- pcbnew/dialogs/panel_fp_editor_defaults.cpp | 47 +++++++------- .../dialogs/panel_fp_editor_defaults_base.cpp | 64 +++++++++---------- .../dialogs/panel_fp_editor_defaults_base.fbp | 2 +- .../dialogs/panel_fp_editor_defaults_base.h | 2 +- 4 files changed, 58 insertions(+), 57 deletions(-) diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp index c60b55b89b..f481f266d3 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp +++ b/pcbnew/dialogs/panel_fp_editor_defaults.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -175,7 +175,7 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame m_parent( aParent ) { m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 ); - m_layerClassesGrid->SetDefaultRowSize( m_layerClassesGrid->GetDefaultRowSize() + 4 ); + m_graphicsGrid->SetDefaultRowSize( m_graphicsGrid->GetDefaultRowSize() + 4 ); m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true ); @@ -191,10 +191,10 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame // Work around a bug in wxWidgets where it fails to recalculate the grid height // after changing the default row size - m_layerClassesGrid->AppendRows( 1 ); - m_layerClassesGrid->DeleteRows( m_layerClassesGrid->GetNumberRows() - 1, 1 ); + m_graphicsGrid->AppendRows( 1 ); + m_graphicsGrid->DeleteRows( m_graphicsGrid->GetNumberRows() - 1, 1 ); - m_layerClassesGrid->PushEventHandler( new GRID_TRICKS( m_layerClassesGrid ) ); + m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) ); wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); infoFont.SetSymbolicSize( wxFONTSIZE_SMALL ); @@ -204,8 +204,8 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame PANEL_FP_EDITOR_DEFAULTS::~PANEL_FP_EDITOR_DEFAULTS() { - // destroy GRID_TRICKS before m_layerClassesGrid. - m_layerClassesGrid->PopEventHandler( true ); + // destroy GRID_TRICKS before m_graphicsGrid. + m_graphicsGrid->PopEventHandler( true ); } @@ -214,10 +214,11 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow() wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ); #define SET_MILS_CELL( row, col, val ) \ - m_layerClassesGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) ) + m_graphicsGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) ) #define DISABLE_CELL( row, col ) \ - m_layerClassesGrid->SetReadOnly( row, col ); m_layerClassesGrid->SetCellBackgroundColour( row, col, disabledColour ); + m_graphicsGrid->SetReadOnly( row, col ); \ + m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour ); for( int i = 0; i < ROW_COUNT; ++i ) { @@ -235,13 +236,13 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow() SET_MILS_CELL( i, COL_TEXT_WIDTH, m_brdSettings.m_TextSize[ i ].x ); SET_MILS_CELL( i, COL_TEXT_HEIGHT, m_brdSettings.m_TextSize[ i ].y ); SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_brdSettings.m_TextThickness[ i ] ); - m_layerClassesGrid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" ); + m_graphicsGrid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" ); auto attr = new wxGridCellAttr; attr->SetRenderer( new wxGridCellBoolRenderer() ); attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - m_layerClassesGrid->SetAttr( i, COL_TEXT_ITALIC, attr ); + m_graphicsGrid->SetAttr( i, COL_TEXT_ITALIC, attr ); } } @@ -257,17 +258,17 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow() m_textItemsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer ); } - for( int col = 0; col < m_layerClassesGrid->GetNumberCols(); col++ ) + for( int col = 0; col < m_graphicsGrid->GetNumberCols(); col++ ) { // Set the minimal width to the column label size. - m_layerClassesGrid->SetColMinimalWidth( col, m_layerClassesGrid->GetVisibleWidth( col, true, false, false ) ); + m_graphicsGrid->SetColMinimalWidth( col, m_graphicsGrid->GetVisibleWidth( col, true, false, false ) ); // Set the width to see the full contents - if( m_layerClassesGrid->IsColShown( col ) ) - m_layerClassesGrid->SetColSize( col, m_layerClassesGrid->GetVisibleWidth( col, true, true, true ) ); + if( m_graphicsGrid->IsColShown( col ) ) + m_graphicsGrid->SetColSize( col, m_graphicsGrid->GetVisibleWidth( col, true, true, true ) ); } - m_layerClassesGrid->SetRowLabelSize( m_layerClassesGrid->GetVisibleWidth( -1, true, true, true ) ); + m_graphicsGrid->SetRowLabelSize( m_graphicsGrid->GetVisibleWidth( -1, true, true, true ) ); Layout(); @@ -290,7 +291,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow ) if( aShow && m_firstShow ) { - m_layerClassesGrid->SetColSize( 0, m_layerClassesGrid->GetColSize( 0 ) + 1 ); + m_graphicsGrid->SetColSize( 0, m_graphicsGrid->GetColSize( 0 ) + 1 ); m_firstShow = false; } @@ -301,13 +302,13 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow ) int PANEL_FP_EDITOR_DEFAULTS::getGridValue( int aRow, int aCol ) { return ValueFromString( m_frame->GetUserUnits(), - m_layerClassesGrid->GetCellValue( aRow, aCol ) ); + m_graphicsGrid->GetCellValue( aRow, aCol ) ); } bool PANEL_FP_EDITOR_DEFAULTS::validateData() { - if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() ) + if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) return false; // Test text parameters. @@ -320,7 +321,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::validateData() { wxString msg = _( "Text will not be readable with a thickness greater than\n" "1/4 its width or height." ); - m_parent->SetError( msg, this, m_layerClassesGrid, row, COL_TEXT_THICKNESS ); + m_parent->SetError( msg, this, m_graphicsGrid, row, COL_TEXT_THICKNESS ); return false; } } @@ -345,7 +346,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow() getGridValue( i, COL_TEXT_HEIGHT ) ); m_brdSettings.m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS ); - wxString msg = m_layerClassesGrid->GetCellValue( i, COL_TEXT_ITALIC ); + wxString msg = m_graphicsGrid->GetCellValue( i, COL_TEXT_ITALIC ); m_brdSettings.m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg ); } @@ -373,7 +374,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow() void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event ) { - if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() ) + if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) return; wxGridTableBase* table = m_textItemsGrid->GetTable(); @@ -393,7 +394,7 @@ void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event ) void PANEL_FP_EDITOR_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event ) { - if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() ) + if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) return; int curRow = m_textItemsGrid->GetGridCursorRow(); diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp b/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp index e8a9601f46..b6d670b819 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp +++ b/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp @@ -104,49 +104,49 @@ PANEL_FP_EDITOR_DEFAULTS_BASE::PANEL_FP_EDITOR_DEFAULTS_BASE( wxWindow* parent, defaultPropertiesLabel->Wrap( -1 ); defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxBOTTOM|wxRIGHT, 5 ); - m_layerClassesGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_graphicsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); // Grid - m_layerClassesGrid->CreateGrid( 6, 5 ); - m_layerClassesGrid->EnableEditing( true ); - m_layerClassesGrid->EnableGridLines( true ); - m_layerClassesGrid->EnableDragGridSize( false ); - m_layerClassesGrid->SetMargins( 0, 0 ); + m_graphicsGrid->CreateGrid( 6, 5 ); + m_graphicsGrid->EnableEditing( true ); + m_graphicsGrid->EnableGridLines( true ); + m_graphicsGrid->EnableDragGridSize( false ); + m_graphicsGrid->SetMargins( 0, 0 ); // Columns - m_layerClassesGrid->SetColSize( 0, 110 ); - m_layerClassesGrid->SetColSize( 1, 100 ); - m_layerClassesGrid->SetColSize( 2, 100 ); - m_layerClassesGrid->SetColSize( 3, 100 ); - m_layerClassesGrid->SetColSize( 4, 60 ); - m_layerClassesGrid->EnableDragColMove( false ); - m_layerClassesGrid->EnableDragColSize( true ); - m_layerClassesGrid->SetColLabelSize( 22 ); - m_layerClassesGrid->SetColLabelValue( 0, _("Line Thickness") ); - m_layerClassesGrid->SetColLabelValue( 1, _("Text Width") ); - m_layerClassesGrid->SetColLabelValue( 2, _("Text Height") ); - m_layerClassesGrid->SetColLabelValue( 3, _("Text Thickness") ); - m_layerClassesGrid->SetColLabelValue( 4, _("Italic") ); - m_layerClassesGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + m_graphicsGrid->SetColSize( 0, 110 ); + m_graphicsGrid->SetColSize( 1, 100 ); + m_graphicsGrid->SetColSize( 2, 100 ); + m_graphicsGrid->SetColSize( 3, 100 ); + m_graphicsGrid->SetColSize( 4, 60 ); + m_graphicsGrid->EnableDragColMove( false ); + m_graphicsGrid->EnableDragColSize( true ); + m_graphicsGrid->SetColLabelSize( 22 ); + m_graphicsGrid->SetColLabelValue( 0, _( "Line Thickness") ); + m_graphicsGrid->SetColLabelValue( 1, _( "Text Width") ); + m_graphicsGrid->SetColLabelValue( 2, _( "Text Height") ); + m_graphicsGrid->SetColLabelValue( 3, _( "Text Thickness") ); + m_graphicsGrid->SetColLabelValue( 4, _( "Italic") ); + m_graphicsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); // Rows - m_layerClassesGrid->EnableDragRowSize( false ); - m_layerClassesGrid->SetRowLabelSize( 125 ); - m_layerClassesGrid->SetRowLabelValue( 0, _("Silk Layers") ); - m_layerClassesGrid->SetRowLabelValue( 1, _("Copper Layers") ); - m_layerClassesGrid->SetRowLabelValue( 2, _("Edge Cuts") ); - m_layerClassesGrid->SetRowLabelValue( 3, _("Courtyards") ); - m_layerClassesGrid->SetRowLabelValue( 4, _("Fab Layers") ); - m_layerClassesGrid->SetRowLabelValue( 5, _("Other Layers") ); - m_layerClassesGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); + m_graphicsGrid->EnableDragRowSize( false ); + m_graphicsGrid->SetRowLabelSize( 125 ); + m_graphicsGrid->SetRowLabelValue( 0, _( "Silk Layers") ); + m_graphicsGrid->SetRowLabelValue( 1, _( "Copper Layers") ); + m_graphicsGrid->SetRowLabelValue( 2, _( "Edge Cuts") ); + m_graphicsGrid->SetRowLabelValue( 3, _( "Courtyards") ); + m_graphicsGrid->SetRowLabelValue( 4, _( "Fab Layers") ); + m_graphicsGrid->SetRowLabelValue( 5, _( "Other Layers") ); + m_graphicsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); // Label Appearance // Cell Defaults - m_layerClassesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - m_layerClassesGrid->SetToolTip( _("Net Class parameters") ); + m_graphicsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_graphicsGrid->SetToolTip( _( "Net Class parameters") ); - defaultPropertiesSizer->Add( m_layerClassesGrid, 1, wxBOTTOM|wxLEFT, 20 ); + defaultPropertiesSizer->Add( m_graphicsGrid, 1, wxBOTTOM | wxLEFT, 20 ); bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp b/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp index 61b293212c..69832e089b 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp +++ b/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp @@ -606,7 +606,7 @@ 0 -1,-1 1 - m_layerClassesGrid + m_graphicsGrid 1 diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.h b/pcbnew/dialogs/panel_fp_editor_defaults_base.h index b51f491f6c..7f90675599 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.h +++ b/pcbnew/dialogs/panel_fp_editor_defaults_base.h @@ -43,7 +43,7 @@ class PANEL_FP_EDITOR_DEFAULTS_BASE : public wxPanel wxBitmapButton* m_bpAdd; wxBitmapButton* m_bpDelete; wxStaticText* m_staticTextInfo; - WX_GRID* m_layerClassesGrid; + WX_GRID* m_graphicsGrid; // Virtual event handlers, overide them in your derived class virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }