Swap out autoplace rotation costs for private footprint layers.

Fixes https://gitlab.com/kicad/code/kicad/issues/2291

Fixes https://gitlab.com/kicad/code/kicad/issues/5391
This commit is contained in:
Jeff Young 2021-12-05 21:56:55 +00:00
parent fa908e1f98
commit d649b288a6
22 changed files with 1016 additions and 1729 deletions

View File

@ -209,6 +209,7 @@ pad_prop_fiducial_glob
pad_prop_castellated
pad_prop_testpoint
pad_prop_heatsink
private_layers
property
page
paper

View File

@ -940,95 +940,11 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<FOOTPRINT*>& aFootprin
m_progressReporter->SetTitle( wxString::Format( _( "Autoplacing %s" ),
footprint->GetReference() ) );
double initialOrient = footprint->GetOrientation();
error = getOptimalFPPlacement( footprint );
double bestScore = m_minCost;
double bestRotation = 0.0;
int rotAllowed;
if( error == AR_ABORT_PLACEMENT )
goto end_of_tst;
// Try orientations 90, 180, 270 degrees from initial orientation
rotAllowed = footprint->GetPlacementCost180();
if( rotAllowed != 0 )
{
rotateFootprint( footprint, 1800.0, true );
error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better.
{
bestScore = m_minCost;
bestRotation = 1800.0;
}
else
{
rotateFootprint( footprint, initialOrient, false );
}
if( error == AR_ABORT_PLACEMENT )
goto end_of_tst;
}
// Determine if the best orientation of a footprint is 90.
rotAllowed = footprint->GetPlacementCost90();
if( rotAllowed != 0 )
{
rotateFootprint( footprint, 900.0, true );
error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better.
{
bestScore = m_minCost;
bestRotation = 900.0;
}
else
{
rotateFootprint( footprint, initialOrient, false );
}
if( error == AR_ABORT_PLACEMENT )
goto end_of_tst;
}
// Determine if the best orientation of a footprint is -90.
if( rotAllowed != 0 )
{
rotateFootprint( footprint, 2700.0, true );
error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better.
{
bestScore = m_minCost;
bestRotation = 2700.0;
}
else
{
rotateFootprint( footprint, initialOrient, false );
}
if( error == AR_ABORT_PLACEMENT )
goto end_of_tst;
}
end_of_tst:
if( error == AR_ABORT_PLACEMENT )
break;
bestRotation += initialOrient;
if( bestRotation != footprint->GetOrientation() )
{
rotateFootprint( footprint, bestRotation, false );
}
// Place footprint.
placeFootprint( footprint, true, m_curPosition );

View File

@ -4,7 +4,7 @@
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -59,7 +59,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_footprint( aFootprint ),
m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
m_orientValidator( 3, &m_orientValue ),
m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
m_SolderMaskMarginUnits ),
@ -105,16 +105,18 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
// Show/hide text item columns according to the user's preference
m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
m_orientValidator.SetRange( -360.0, 360.0 );
m_OrientValueCtrl->SetValidator( m_orientValidator );
m_orientValidator.SetWindow( m_OrientValueCtrl );
m_orientation.SetUnits( EDA_UNITS::DEGREES );
m_orientation.SetPrecision( 3 );
// Set predefined rotations in combo dropdown, according to the locale floating point
// separator notation
double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
for( size_t ii = 0; ii < m_orientationCtrl->GetCount() && ii < 4; ++ii )
m_orientationCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
// Set font size for items showing long strings:
wxFont infoFont = KIUI::GetInfoFont( this );
#if __WXMAC__
m_allow90Label->SetFont( infoFont );
m_allow180Label->SetFont( infoFont );
#endif
m_libraryIDLabel->SetFont( infoFont );
m_tcLibraryID->SetFont( infoFont );
@ -140,8 +142,6 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_solderPasteRatio.SetUnits( EDA_UNITS::PERCENT );
m_solderPasteRatio.SetNegativeZero();
m_orientValue = 0;
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
@ -156,7 +156,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
{
m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns =
m_itemsGrid->GetShownColumns().ToStdString();
m_itemsGrid->GetShownColumns().ToStdString();
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_texts );
@ -214,29 +214,6 @@ void DIALOG_FOOTPRINT_PROPERTIES::ChangeFootprint( wxCommandEvent& )
}
void DIALOG_FOOTPRINT_PROPERTIES::FootprintOrientEvent( wxCommandEvent& )
{
if( m_Orient0->GetValue() )
m_orientValue = 0.0;
else if( m_Orient90->GetValue() )
m_orientValue = 90.0;
else if( m_Orient270->GetValue() )
m_orientValue = 270.0;
else if( m_Orient180->GetValue() )
m_orientValue = 180.0;
updateOrientationControl();
}
void DIALOG_FOOTPRINT_PROPERTIES::OnOtherOrientation( wxCommandEvent& aEvent )
{
m_OrientOther->SetValue( true );
aEvent.Skip();
}
bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
@ -272,32 +249,12 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
m_orientValue = m_footprint->GetOrientation() / 10.0;
m_orientation.SetDoubleValue( m_footprint->GetOrientation() / 10.0 );
if( m_orientValue == 0.0 )
m_Orient0->SetValue( true );
else if( m_orientValue == 90.0 || m_orientValue == -270.0 )
m_Orient90->SetValue( true );
else if( m_orientValue == 270.0 || m_orientValue == -90.0 )
m_Orient270->SetValue( true );
else if( m_orientValue == 180.0 || m_orientValue == -180.0 )
m_Orient180->SetValue( true );
else
m_OrientOther->SetValue( true );
updateOrientationControl();
m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 );
m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Footprint can be freely moved and oriented on the "
"canvas." ) );
m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Footprint is locked: it cannot be freely moved and "
"oriented on the canvas and can only be selected when "
"the 'Locked items' checkbox is enabled in the "
"selection filter." ) );
m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() );
m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() );
m_cbLocked->SetValue( m_footprint->IsLocked() );
m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
"canvas and can only be selected when the 'Locked items' checkbox "
"is enabled in the selection filter." ) );
if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
m_componentType->SetSelection( 0 );
@ -458,7 +415,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
// Set Footprint Position
wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
m_footprint->SetPosition( pos );
m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
m_footprint->SetLocked( m_cbLocked->GetValue() );
int attributes = 0;
@ -483,14 +440,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
m_footprint->SetAttributes( attributes );
m_footprint->SetPlacementCost90( m_CostRot90Ctrl->GetValue() );
m_footprint->SetPlacementCost180( m_CostRot180Ctrl->GetValue() );
// Now, set orientation. Must be done after other changes because rotation changes field
// positions on board (so that relative positions are held constant)
m_orientValidator.TransferFromWindow();
double orient = m_orientValue * 10;
double orient = m_orientation.GetDoubleValue() * 10.0;
if( m_footprint->GetOrientation() != orient )
m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );
@ -721,7 +671,3 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
}
void DIALOG_FOOTPRINT_PROPERTIES::updateOrientationControl()
{
KIUI::ValidatorTransferToWindowWithoutEvents( m_orientValidator );
}

View File

@ -68,24 +68,14 @@ private:
void EditLibraryFootprint( wxCommandEvent& ) override;
void UpdateFootprint( wxCommandEvent& ) override;
void ChangeFootprint( wxCommandEvent& ) override;
void FootprintOrientEvent( wxCommandEvent& ) override;
void OnOtherOrientation( wxCommandEvent& aEvent ) override;
void OnGridSize( wxSizeEvent& aEvent ) override;
void OnAddField( wxCommandEvent& ) override;
void OnDeleteField( wxCommandEvent& ) override;
void OnUpdateUI( wxUpdateUIEvent& ) override;
void OnPageChange( wxNotebookEvent& event ) override;
void select3DModel( int aModelIdx );
void adjustGridColumns( int aWidth );
/**
* Update the orientation validated control, without triggering a change
* event on the control (which would update the radio buttons)
*/
void updateOrientationControl();
private:
PCB_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint;
@ -95,8 +85,7 @@ private:
FP_TEXT_GRID_TABLE* m_texts;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
wxFloatingPointValidator<double> m_orientValidator;
double m_orientValue;
UNIT_BINDER m_orientation;
UNIT_BINDER m_netClearance;
UNIT_BINDER m_solderMask;

View File

@ -105,7 +105,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Position") ), wxVERTICAL );
wxFlexGridSizer* fgSizerPos;
fgSizerPos = new wxFlexGridSizer( 3, 3, 2, 0 );
fgSizerPos = new wxFlexGridSizer( 4, 3, 1, 0 );
fgSizerPos->AddGrowableCol( 1 );
fgSizerPos->AddGrowableRow( 2 );
fgSizerPos->SetFlexibleDirection( wxBOTH );
@ -127,12 +127,26 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
fgSizerPos->Add( m_YPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_ModPositionY = new wxTextCtrl( sbSizer7->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerPos->Add( m_ModPositionY, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
fgSizerPos->Add( m_ModPositionY, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 1 );
m_YPosUnit = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_YPosUnit->Wrap( -1 );
fgSizerPos->Add( m_YPosUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_orientationLabel = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_orientationLabel->Wrap( -1 );
fgSizerPos->Add( m_orientationLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_orientationCtrl = new wxComboBox( sbSizer7->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_orientationCtrl->Append( _("0") );
m_orientationCtrl->Append( _("90") );
m_orientationCtrl->Append( _("-90") );
m_orientationCtrl->Append( _("180") );
fgSizerPos->Add( m_orientationCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizerPos->Add( 0, 0, 1, wxEXPAND, 5 );
m_BoardSideLabel = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, _("Side:"), wxDefaultPosition, wxDefaultSize, 0 );
m_BoardSideLabel->Wrap( -1 );
fgSizerPos->Add( m_BoardSideLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
@ -141,50 +155,16 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
int m_BoardSideCtrlNChoices = sizeof( m_BoardSideCtrlChoices ) / sizeof( wxString );
m_BoardSideCtrl = new wxChoice( sbSizer7->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_BoardSideCtrlNChoices, m_BoardSideCtrlChoices, 0 );
m_BoardSideCtrl->SetSelection( 1 );
fgSizerPos->Add( m_BoardSideCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
fgSizerPos->Add( m_BoardSideCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
sbSizer7->Add( fgSizerPos, 0, wxEXPAND, 5 );
sbSizer7->Add( fgSizerPos, 0, wxEXPAND|wxBOTTOM, 3 );
m_cbLocked = new wxCheckBox( sbSizer7->GetStaticBox(), wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer7->Add( m_cbLocked, 0, wxALL, 5 );
bSizerLeft->Add( sbSizer7, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerLeft->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 3 );
wxStaticBoxSizer* sbOrientationSizer;
sbOrientationSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Orientation") ), wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 1, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_Orient0 = new wxRadioButton( sbOrientationSizer->GetStaticBox(), wxID_ANY, _("0.0"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_Orient0, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 3 );
m_Orient90 = new wxRadioButton( sbOrientationSizer->GetStaticBox(), wxID_ANY, _("90.0"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_Orient90, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 3 );
m_Orient270 = new wxRadioButton( sbOrientationSizer->GetStaticBox(), wxID_ANY, _("-90.0"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_Orient270, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 3 );
m_Orient180 = new wxRadioButton( sbOrientationSizer->GetStaticBox(), wxID_ANY, _("180.0"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_Orient180, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 1 );
m_OrientOther = new wxRadioButton( sbOrientationSizer->GetStaticBox(), wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_OrientOther, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_OrientValueCtrl = new wxTextCtrl( sbOrientationSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_OrientValueCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT|wxLEFT, 5 );
gbSizer1->AddGrowableCol( 1 );
sbOrientationSizer->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
bSizerLeft->Add( sbOrientationSizer, 0, wxEXPAND|wxALL, 5 );
bSizerLeft->Add( sbSizer7, 1, wxEXPAND|wxALL, 5 );
bSizerProperties->Add( bSizerLeft, 1, wxEXPAND, 5 );
@ -192,46 +172,39 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_AutoPlaceCtrlChoices[] = { _("Unlock footprint"), _("Lock footprint") };
int m_AutoPlaceCtrlNChoices = sizeof( m_AutoPlaceCtrlChoices ) / sizeof( wxString );
m_AutoPlaceCtrl = new wxRadioBox( m_PanelGeneral, wxID_ANY, _("Move and Place"), wxDefaultPosition, wxDefaultSize, m_AutoPlaceCtrlNChoices, m_AutoPlaceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_AutoPlaceCtrl->SetSelection( 0 );
bSizerMiddle->Add( m_AutoPlaceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbFabSizer;
sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL );
wxBoxSizer* bPartTypeSizer;
bPartTypeSizer = new wxBoxSizer( wxHORIZONTAL );
m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Footprint type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_componentTypeLabel->Wrap( -1 );
bPartTypeSizer->Add( m_componentTypeLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_componentTypeChoices[] = { _("Through hole"), _("SMD"), _("Other") };
int m_componentTypeNChoices = sizeof( m_componentTypeChoices ) / sizeof( wxString );
m_componentType = new wxChoice( sbFabSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_componentTypeNChoices, m_componentTypeChoices, 0 );
m_componentType->SetSelection( 0 );
bPartTypeSizer->Add( m_componentType, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMiddle->Add( 0, 0, 1, wxEXPAND, 5 );
m_sizerAP = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Auto-placement Rules") ), wxVERTICAL );
m_sizerAllow90 = new wxBoxSizer( wxVERTICAL );
m_allow90Label = new wxStaticText( m_sizerAP->GetStaticBox(), wxID_ANY, _("Allow 90 degree rotated placement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_allow90Label->Wrap( -1 );
m_sizerAllow90->Add( m_allow90Label, 0, wxALL, 2 );
m_CostRot90Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sizerAllow90->Add( m_CostRot90Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
sbFabSizer->Add( bPartTypeSizer, 0, wxEXPAND, 5 );
m_sizerAP->Add( m_sizerAllow90, 0, wxEXPAND, 5 );
sbFabSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_boardOnly = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Not in schematic"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_boardOnly, 0, wxALL, 5 );
m_excludeFromPosFiles = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from position files"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_excludeFromPosFiles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_excludeFromBOM = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from BOM"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_excludeFromBOM, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sizerAP->Add( 0, 8, 0, wxEXPAND|wxTOP|wxBOTTOM, 8 );
m_sizerAllow180 = new wxBoxSizer( wxVERTICAL );
m_allow180Label = new wxStaticText( m_sizerAP->GetStaticBox(), wxID_ANY, _("Allow 180 degree rotated placement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_allow180Label->Wrap( -1 );
m_sizerAllow180->Add( m_allow180Label, 0, wxBOTTOM|wxRIGHT|wxLEFT, 2 );
m_CostRot180Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sizerAllow180->Add( m_CostRot180Ctrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sizerAP->Add( m_sizerAllow180, 0, wxEXPAND, 5 );
bSizerMiddle->Add( m_sizerAP, 0, wxEXPAND|wxALL, 5 );
bSizerMiddle->Add( sbFabSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerProperties->Add( bSizerMiddle, 1, wxEXPAND|wxTOP, 5 );
@ -252,48 +225,17 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
bButtonsSizer->Add( m_buttonModuleEditor, 0, wxEXPAND|wxALL, 5 );
bButtonsSizer->Add( 0, 10, 0, wxEXPAND, 5 );
bButtonsSizer->Add( 0, 15, 0, wxEXPAND, 5 );
m_button5 = new wxButton( m_PanelGeneral, wxID_ANY, _("Edit Library Footprint..."), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_button5, 0, wxEXPAND|wxALL, 5 );
bSizerRight->Add( bButtonsSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerRight->Add( bButtonsSizer, 0, wxEXPAND|wxALL, 5 );
bSizerRight->Add( 0, 0, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbFabSizer;
sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL );
wxBoxSizer* bPartTypeSizer;
bPartTypeSizer = new wxBoxSizer( wxHORIZONTAL );
m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Footprint type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_componentTypeLabel->Wrap( -1 );
bPartTypeSizer->Add( m_componentTypeLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_componentTypeChoices[] = { _("Through hole"), _("SMD"), _("Other") };
int m_componentTypeNChoices = sizeof( m_componentTypeChoices ) / sizeof( wxString );
m_componentType = new wxChoice( sbFabSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_componentTypeNChoices, m_componentTypeChoices, 0 );
m_componentType->SetSelection( 0 );
bPartTypeSizer->Add( m_componentType, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbFabSizer->Add( bPartTypeSizer, 1, wxEXPAND, 5 );
m_boardOnly = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Not in schematic"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_boardOnly, 0, wxALL, 5 );
m_excludeFromPosFiles = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from position files"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_excludeFromPosFiles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_excludeFromBOM = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Exclude from BOM"), wxDefaultPosition, wxDefaultSize, 0 );
sbFabSizer->Add( m_excludeFromBOM, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerRight->Add( sbFabSizer, 0, wxEXPAND|wxALL, 5 );
bSizerProperties->Add( bSizerRight, 1, wxEXPAND|wxTOP, 5 );
@ -304,7 +246,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_PanelGeneral->SetSizer( m_PanelPropertiesBoxSizer );
m_PanelGeneral->Layout();
m_PanelPropertiesBoxSizer->Fit( m_PanelGeneral );
m_NoteBook->AddPage( m_PanelGeneral, _("General"), false );
m_NoteBook->AddPage( m_PanelGeneral, _("General"), true );
m_PanelClearances = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerPanelClearances;
bSizerPanelClearances = new wxBoxSizer( wxVERTICAL );
@ -420,7 +362,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_PanelClearances->SetSizer( bSizerPanelClearances );
m_PanelClearances->Layout();
bSizerPanelClearances->Fit( m_PanelClearances );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), true );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), false );
m_GeneralBoxSizer->Add( m_NoteBook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -473,12 +415,6 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_itemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient90->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientOther->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientValueCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::UpdateFootprint ), NULL, this );
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );
@ -494,12 +430,6 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::~DIALOG_FOOTPRINT_PROPERTIES_BASE()
m_itemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient90->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientOther->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientValueCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::UpdateFootprint ), NULL, this );
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -29,13 +29,11 @@ class WX_GRID;
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/combobox.h>
#include <wx/choice.h>
#include <wx/radiobut.h>
#include <wx/gbsizer.h>
#include <wx/radiobox.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/gbsizer.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
@ -64,31 +62,20 @@ class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_YPosLabel;
wxTextCtrl* m_ModPositionY;
wxStaticText* m_YPosUnit;
wxStaticText* m_orientationLabel;
wxComboBox* m_orientationCtrl;
wxStaticText* m_BoardSideLabel;
wxChoice* m_BoardSideCtrl;
wxRadioButton* m_Orient0;
wxRadioButton* m_Orient90;
wxRadioButton* m_Orient270;
wxRadioButton* m_Orient180;
wxRadioButton* m_OrientOther;
wxTextCtrl* m_OrientValueCtrl;
wxRadioBox* m_AutoPlaceCtrl;
wxStaticBoxSizer* m_sizerAP;
wxBoxSizer* m_sizerAllow90;
wxStaticText* m_allow90Label;
wxSlider* m_CostRot90Ctrl;
wxBoxSizer* m_sizerAllow180;
wxStaticText* m_allow180Label;
wxSlider* m_CostRot180Ctrl;
wxButton* m_buttonUpdate;
wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor;
wxButton* m_button5;
wxCheckBox* m_cbLocked;
wxStaticText* m_componentTypeLabel;
wxChoice* m_componentType;
wxCheckBox* m_boardOnly;
wxCheckBox* m_excludeFromPosFiles;
wxCheckBox* m_excludeFromBOM;
wxButton* m_buttonUpdate;
wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor;
wxButton* m_button5;
wxPanel* m_PanelClearances;
wxStaticText* m_staticTextInfo;
wxStaticText* m_NetClearanceLabel;
@ -121,8 +108,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void FootprintOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOtherOrientation( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void ChangeFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditFootprint( wxCommandEvent& event ) { event.Skip(); }

View File

@ -47,9 +47,70 @@
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <tools/pcb_selection_tool.h>
#include <grid_layer_box_helpers.h>
#include <fp_lib_table.h>
PRIVATE_LAYERS_GRID_TABLE::PRIVATE_LAYERS_GRID_TABLE( PCB_BASE_FRAME* aFrame ) :
m_frame( aFrame )
{
m_layerColAttr = new wxGridCellAttr;
m_layerColAttr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_frame ) );
LSET forbiddenLayers = LSET::AllCuMask() | LSET::AllTechMask();
m_layerColAttr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_frame, forbiddenLayers ) );
}
PRIVATE_LAYERS_GRID_TABLE::~PRIVATE_LAYERS_GRID_TABLE()
{
m_layerColAttr->DecRef();
}
bool PRIVATE_LAYERS_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
{
return aTypeName == wxGRID_VALUE_NUMBER;
}
bool PRIVATE_LAYERS_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
{
return aTypeName == wxGRID_VALUE_NUMBER;
}
wxGridCellAttr* PRIVATE_LAYERS_GRID_TABLE::GetAttr( int aRow, int aCol,
wxGridCellAttr::wxAttrKind )
{
m_layerColAttr->IncRef();
return m_layerColAttr;
}
wxString PRIVATE_LAYERS_GRID_TABLE::GetValue( int aRow, int aCol )
{
return m_frame->GetBoard()->GetLayerName( this->at( (size_t) aRow ) );
}
long PRIVATE_LAYERS_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
{
return this->at( (size_t) aRow );
}
void PRIVATE_LAYERS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
{
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a string value" ), aCol ) );
}
void PRIVATE_LAYERS_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue )
{
this->at( (size_t) aRow ) = ToLAYER_ID( (int) aValue );
}
// Remember the last open page during session.
@ -75,6 +136,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
m_NoteBook->AddPage( m_3dPanel, _("3D Models"), false );
m_texts = new FP_TEXT_GRID_TABLE( m_frame );
m_privateLayers = new PRIVATE_LAYERS_GRID_TABLE( m_frame );
m_delayedErrorMessage = wxEmptyString;
m_delayedFocusCtrl = nullptr;
@ -90,10 +152,16 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
// Give a bit more room for combobox editors
m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
m_privateLayersGrid->SetDefaultRowSize( m_privateLayersGrid->GetDefaultRowSize() + 4 );
m_itemsGrid->SetTable( m_texts );
m_privateLayersGrid->SetTable( m_privateLayers );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_privateLayersGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
m_privateLayersGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to the user's preference
m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns );
@ -102,11 +170,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
// Set font sizes
wxFont infoFont = KIUI::GetInfoFont( this );
#if __WXMAC__
m_allow90Label->SetFont( infoFont );
m_allow180Label->SetFont( infoFont );
#endif
infoFont.SetStyle( wxFONTSTYLE_ITALIC );
m_staticTextInfoCopper->SetFont( infoFont );
m_staticTextInfoPaste->SetFont( infoFont );
@ -134,14 +197,11 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
// Configure button logos
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
m_bpAddLayer->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
m_bpDeleteLayer->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
SetupStandardButtons();
// wxFormBuilder doesn't include this event...
m_itemsGrid->Connect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging ),
nullptr, this );
finishDialogSettings();
}
@ -153,13 +213,11 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR()
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_texts );
m_itemsGrid->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging ),
nullptr, this );
m_privateLayersGrid->DestroyTable( m_privateLayers );
// Delete the GRID_TRICKS.
m_itemsGrid->PopEventHandler( true );
m_privateLayersGrid->PopEventHandler( true );
m_page = static_cast<NOTEBOOK_PAGES>( m_NoteBook->GetSelection() );
@ -192,9 +250,9 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
for( auto item : m_footprint->GraphicalItems() )
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
{
auto textItem = dyn_cast<FP_TEXT*>( item );
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
if( textItem )
m_texts->push_back( *textItem );
@ -204,10 +262,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
m_itemsGrid->ProcessTableMessage( tmsg );
// Footprint Properties
m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() );
m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() );
if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
m_componentType->SetSelection( 0 );
else if( m_footprint->GetAttributes() & FP_SMD )
@ -215,6 +269,15 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
else
m_componentType->SetSelection( 2 );
// Private layers
for( PCB_LAYER_ID privateLayer : m_footprint->GetPrivateLayers().UIOrder() )
m_privateLayers->push_back( privateLayer );
// Notify the grid
wxGridTableMessage gridTableMessagesg( m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_privateLayers->GetNumberRows() );
m_privateLayersGrid->ProcessTableMessage( gridTableMessagesg );
m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
@ -351,8 +414,8 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
if( !m_3dPanel->TransferDataFromWindow() )
return false;
auto view = m_frame->GetCanvas()->GetView();
BOARD_COMMIT commit( m_frame );
KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
BOARD_COMMIT commit( m_frame );
commit.Modify( m_footprint );
LIB_ID fpID = m_footprint->GetFPID();
@ -402,6 +465,13 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
view->Add( newText );
}
LSET privateLayers;
for( PCB_LAYER_ID layer : *m_privateLayers )
privateLayers.set( layer );
m_footprint->SetPrivateLayers( privateLayers );
int attributes = 0;
switch( m_componentType->GetSelection() )
@ -425,9 +495,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
m_footprint->SetAttributes( attributes );
m_footprint->SetPlacementCost90( m_CostRot90Ctrl->GetValue() );
m_footprint->SetPlacementCost180( m_CostRot180Ctrl->GetValue() );
// Initialize masks clearances
m_footprint->SetLocalClearance( m_netClearance.GetValue() );
m_footprint->SetLocalSolderMaskMargin( m_solderMask.GetValue() );
@ -461,12 +528,6 @@ static bool footprintIsFromBoard( FOOTPRINT* aFootprint )
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnGridCellChanging( wxGridEvent& event )
{
// Currently: nothing to do
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnFootprintNameText( wxCommandEvent& event )
{
if( !footprintIsFromBoard( m_footprint ) )
@ -551,6 +612,56 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnDeleteField( wxCommandEvent& event
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddLayer( wxCommandEvent& event )
{
if( !m_privateLayersGrid->CommitPendingChanges() )
return;
PCB_LAYER_ID nextLayer = User_1;
while( alg::contains( *m_privateLayers, nextLayer ) && nextLayer < User_9 )
nextLayer = ToLAYER_ID( nextLayer + 1 );
m_privateLayers->push_back( nextLayer );
// notify the grid
wxGridTableMessage msg( m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
m_privateLayersGrid->ProcessTableMessage( msg );
m_privateLayersGrid->SetFocus();
m_privateLayersGrid->MakeCellVisible( m_privateLayers->size() - 1, 0 );
m_privateLayersGrid->SetGridCursor( m_privateLayers->size() - 1, 0 );
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnDeleteLayer( wxCommandEvent& event )
{
if( !m_privateLayersGrid->CommitPendingChanges() )
return;
int curRow = m_privateLayersGrid->GetGridCursorRow();
if( curRow < 0 )
{
return;
}
m_privateLayers->erase( m_privateLayers->begin() + curRow );
// notify the grid
wxGridTableMessage msg( m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
m_privateLayersGrid->ProcessTableMessage( msg );
if( m_privateLayersGrid->GetNumberRows() > 0 )
{
m_privateLayersGrid->MakeCellVisible( std::max( 0, curRow-1 ),
m_privateLayersGrid->GetGridCursorCol() );
m_privateLayersGrid->SetGridCursor( std::max( 0, curRow-1 ),
m_privateLayersGrid->GetGridCursorCol() );
}
}
void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::adjustGridColumns( int aWidth )
{
// Account for scroll bars
@ -605,7 +716,7 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
{
m_delayedFocusCtrl->SetFocus();
if( auto textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
textEntry->SelectAll();
m_delayedFocusCtrl = nullptr;

View File

@ -36,6 +36,31 @@ class FOOTPRINT_EDIT_FRAME;
class PANEL_FP_PROPERTIES_3D_MODEL;
class PRIVATE_LAYERS_GRID_TABLE : public wxGridTableBase, public std::vector<PCB_LAYER_ID>
{
public:
PRIVATE_LAYERS_GRID_TABLE( PCB_BASE_FRAME* aFrame );
~PRIVATE_LAYERS_GRID_TABLE();
int GetNumberRows() override { return (int) size(); }
int GetNumberCols() override { return 1; }
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
wxGridCellAttr* GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ) override;
wxString GetValue( int aRow, int aCol ) override;
long GetValueAsLong( int aRow, int aCol ) override;
void SetValue( int aRow, int aCol, const wxString& aValue ) override;
void SetValueAsLong( int aRow, int aCol, long aValue ) override;
private:
PCB_BASE_FRAME* m_frame;
wxGridCellAttr* m_layerColAttr;
};
enum class NOTEBOOK_PAGES
{
PAGE_UNKNOWN = -1,
@ -59,9 +84,10 @@ private:
// virtual event functions
void OnGridSize( wxSizeEvent& event ) override;
void OnFootprintNameText( wxCommandEvent& event ) override;
void OnGridCellChanging( wxGridEvent& event );
void OnAddField( wxCommandEvent& event ) override;
void OnDeleteField( wxCommandEvent& event ) override;
void OnAddLayer( wxCommandEvent& event ) override;
void OnDeleteLayer( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
bool checkFootprintName( const wxString& aFootprintName );
@ -69,25 +95,26 @@ private:
void adjustGridColumns( int aWidth );
private:
FOOTPRINT_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint;
FOOTPRINT_EDIT_FRAME* m_frame;
FOOTPRINT* m_footprint;
static NOTEBOOK_PAGES m_page; // remember the last open page during session
static NOTEBOOK_PAGES m_page; // remember the last open page during session
FP_TEXT_GRID_TABLE* m_texts;
FP_TEXT_GRID_TABLE* m_texts;
PRIVATE_LAYERS_GRID_TABLE* m_privateLayers;
UNIT_BINDER m_netClearance;
UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste;
UNIT_BINDER m_solderPasteRatio;
UNIT_BINDER m_netClearance;
UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste;
UNIT_BINDER m_solderPasteRatio;
wxControl* m_delayedFocusCtrl;
NOTEBOOK_PAGES m_delayedFocusPage;
wxControl* m_delayedFocusCtrl;
NOTEBOOK_PAGES m_delayedFocusPage;
WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow;
int m_delayedFocusColumn;
wxString m_delayedErrorMessage;
WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow;
int m_delayedFocusColumn;
wxString m_delayedErrorMessage;
PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -49,6 +49,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_itemsGrid->SetColSize( 10, 110 );
m_itemsGrid->EnableDragColMove( false );
m_itemsGrid->EnableDragColSize( true );
m_itemsGrid->SetColLabelSize( 24 );
m_itemsGrid->SetColLabelValue( 0, _("Text Items") );
m_itemsGrid->SetColLabelValue( 1, _("Show") );
m_itemsGrid->SetColLabelValue( 2, _("Width") );
@ -60,14 +61,13 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_itemsGrid->SetColLabelValue( 8, _("Unconstrained") );
m_itemsGrid->SetColLabelValue( 9, _("X Offset") );
m_itemsGrid->SetColLabelValue( 10, _("Y Offset") );
m_itemsGrid->SetColLabelSize( 24 );
m_itemsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_itemsGrid->EnableDragRowSize( false );
m_itemsGrid->SetRowLabelSize( 160 );
m_itemsGrid->SetRowLabelValue( 0, _("Reference designator") );
m_itemsGrid->SetRowLabelValue( 1, _("Value") );
m_itemsGrid->SetRowLabelSize( 160 );
m_itemsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Label Appearance
@ -105,10 +105,10 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
wxStaticText* staticFPNameLabel;
staticFPNameLabel = new wxStaticText( m_PanelGeneral, wxID_ANY, _("Footprint name:"), wxDefaultPosition, wxDefaultSize, 0 );
staticFPNameLabel->Wrap( -1 );
fgSizerFPID->Add( staticFPNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
fgSizerFPID->Add( staticFPNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_FootprintNameCtrl = new wxTextCtrl( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerFPID->Add( m_FootprintNameCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
fgSizerFPID->Add( m_FootprintNameCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticText* staticDescriptionLabel;
staticDescriptionLabel = new wxStaticText( m_PanelGeneral, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
@ -126,45 +126,58 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
fgSizerFPID->Add( m_KeywordCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_PanelPropertiesBoxSizer->Add( fgSizerFPID, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
m_PanelPropertiesBoxSizer->Add( fgSizerFPID, 0, wxEXPAND|wxBOTTOM, 10 );
wxBoxSizer* bSizerProperties;
bSizerProperties = new wxBoxSizer( wxHORIZONTAL );
m_sizerAP = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Auto-placement Rules") ), wxVERTICAL );
wxStaticBoxSizer* bSizerPrivateLayers;
bSizerPrivateLayers = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Private Layers") ), wxVERTICAL );
m_sizerAllow90 = new wxBoxSizer( wxVERTICAL );
m_privateLayersGrid = new WX_GRID( bSizerPrivateLayers->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_allow90Label = new wxStaticText( m_sizerAP->GetStaticBox(), wxID_ANY, _("Allow 90 degree rotated placement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_allow90Label->Wrap( -1 );
m_sizerAllow90->Add( m_allow90Label, 0, wxLEFT, 5 );
// Grid
m_privateLayersGrid->CreateGrid( 2, 1 );
m_privateLayersGrid->EnableEditing( true );
m_privateLayersGrid->EnableGridLines( true );
m_privateLayersGrid->EnableDragGridSize( false );
m_privateLayersGrid->SetMargins( 0, 0 );
m_CostRot90Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sizerAllow90->Add( m_CostRot90Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
// Columns
m_privateLayersGrid->SetColSize( 0, 180 );
m_privateLayersGrid->EnableDragColMove( false );
m_privateLayersGrid->EnableDragColSize( true );
m_privateLayersGrid->SetColLabelSize( 0 );
m_privateLayersGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_privateLayersGrid->EnableDragRowSize( false );
m_privateLayersGrid->SetRowLabelSize( 0 );
m_privateLayersGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_privateLayersGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerPrivateLayers->Add( m_privateLayersGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bButtonSize1;
bButtonSize1 = new wxBoxSizer( wxHORIZONTAL );
m_bpAddLayer = new wxBitmapButton( bSizerPrivateLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bButtonSize1->Add( m_bpAddLayer, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_sizerAP->Add( m_sizerAllow90, 0, wxEXPAND, 5 );
bButtonSize1->Add( 20, 0, 0, wxEXPAND, 5 );
m_bpDeleteLayer = new wxBitmapButton( bSizerPrivateLayers->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bButtonSize1->Add( m_bpDeleteLayer, 0, wxRIGHT, 5 );
m_sizerAP->Add( 0, 8, 1, wxEXPAND, 5 );
m_sizerAllow180 = new wxBoxSizer( wxVERTICAL );
m_allow180Label = new wxStaticText( m_sizerAP->GetStaticBox(), wxID_ANY, _("Allow 180 degree rotated placement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_allow180Label->Wrap( -1 );
m_sizerAllow180->Add( m_allow180Label, 0, wxLEFT, 5 );
m_CostRot180Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sizerAllow180->Add( m_CostRot180Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizerPrivateLayers->Add( bButtonSize1, 0, wxEXPAND, 5 );
m_sizerAP->Add( m_sizerAllow180, 0, wxEXPAND|wxBOTTOM, 5 );
bSizerProperties->Add( m_sizerAP, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerProperties->Add( 10, 0, 0, wxEXPAND, 5 );
bSizerProperties->Add( bSizerPrivateLayers, 1, wxEXPAND|wxRIGHT, 15 );
wxStaticBoxSizer* sbFabSizer;
sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL );
@ -195,16 +208,16 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
sbFabSizer->Add( m_excludeFromBOM, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerProperties->Add( sbFabSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerProperties->Add( sbFabSizer, 1, wxEXPAND|wxRIGHT, 5 );
m_PanelPropertiesBoxSizer->Add( bSizerProperties, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_PanelPropertiesBoxSizer->Add( bSizerProperties, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_PanelGeneral->SetSizer( m_PanelPropertiesBoxSizer );
m_PanelGeneral->Layout();
m_PanelPropertiesBoxSizer->Fit( m_PanelGeneral );
m_NoteBook->AddPage( m_PanelGeneral, _("General"), false );
m_NoteBook->AddPage( m_PanelGeneral, _("General"), true );
m_PanelClearances = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerPanelClearances;
bSizerPanelClearances = new wxBoxSizer( wxVERTICAL );
@ -320,7 +333,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_PanelClearances->SetSizer( bSizerPanelClearances );
m_PanelClearances->Layout();
bSizerPanelClearances->Fit( m_PanelClearances );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), true );
m_NoteBook->AddPage( m_PanelClearances, _("Clearance Overrides and Settings"), false );
m_GeneralBoxSizer->Add( m_NoteBook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -351,6 +364,9 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this );
m_FootprintNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this );
m_privateLayersGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddLayer ), NULL, this );
m_bpDeleteLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteLayer ), NULL, this );
}
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE()
@ -362,5 +378,8 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDIT
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteField ), NULL, this );
m_FootprintNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnFootprintNameText ), NULL, this );
m_privateLayersGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnGridSize ), NULL, this );
m_bpAddLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnAddLayer ), NULL, this );
m_bpDeleteLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::OnDeleteLayer ), NULL, this );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,7 +14,6 @@
<property name="file">dialog_footprint_properties_fp_editor_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_footprint_properties_fp_editor_base</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -52,7 +50,6 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Footprint Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -303,7 +300,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -387,7 +383,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -453,8 +448,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="border">10</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
@ -470,7 +465,7 @@
<property name="vgap">3</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -531,7 +526,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@ -848,7 +843,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -856,178 +851,120 @@
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="border">15</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Auto-placement Rules</property>
<property name="label">Private Layers</property>
<property name="minimum_size"></property>
<property name="name">m_sizerAP</property>
<property name="name">bSizerPrivateLayers</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_sizerAllow90</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Allow 90 degree rotated placement:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_allow90Label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxSlider" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maxValue">10</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_CostRot90Ctrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">8</property>
<object class="wxGrid" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">0</property>
<property name="col_label_values"></property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">1</property>
<property name="column_sizes">180</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_privateLayersGrid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="width">0</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">2</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnSize">OnGridSize</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_sizerAllow180</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="0">
<property name="name">bButtonSize1</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1038,57 +975,79 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Allow 180 degree rotated placement:</property>
<property name="label">Add Excluded Layer</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_allow180Label</property>
<property name="name">m_bpAddLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnButtonClick">OnAddLayer</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSlider" expanded="0">
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1099,54 +1058,62 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maxValue">10</property>
<property name="label">Delete Excluded Layer</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_CostRot180Ctrl</property>
<property name="name">m_bpDeleteLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteLayer</event>
</object>
</object>
</object>
@ -1155,17 +1122,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -29,7 +29,6 @@ class WX_GRID;
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/slider.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
@ -59,13 +58,9 @@ class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE : public DIALOG_SHIM
wxTextCtrl* m_DocCtrl;
wxStaticText* staticKeywordsLabel;
wxTextCtrl* m_KeywordCtrl;
wxStaticBoxSizer* m_sizerAP;
wxBoxSizer* m_sizerAllow90;
wxStaticText* m_allow90Label;
wxSlider* m_CostRot90Ctrl;
wxBoxSizer* m_sizerAllow180;
wxStaticText* m_allow180Label;
wxSlider* m_CostRot180Ctrl;
WX_GRID* m_privateLayersGrid;
wxBitmapButton* m_bpAddLayer;
wxBitmapButton* m_bpDeleteLayer;
wxStaticText* m_componentTypeLabel;
wxChoice* m_componentType;
wxCheckBox* m_boardOnly;
@ -94,19 +89,20 @@ class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
// Virtual event handlers, override them in your derived class
// Virtual event handlers, overide them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFootprintNameText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddLayer( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteLayer( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE();
};

View File

@ -325,9 +325,6 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint )
TEST( GetKeywords(), aLibFootprint->GetKeywords() );
TEST( GetAttributes(), aLibFootprint->GetAttributes() );
TEST( GetPlacementCost90(), aLibFootprint->GetPlacementCost90() );
TEST( GetPlacementCost180(), aLibFootprint->GetPlacementCost180() );
TEST( GetLocalClearance(), aLibFootprint->GetLocalClearance() );
TEST( GetLocalSolderMaskMargin(), aLibFootprint->GetLocalSolderMaskMargin() );
TEST( GetLocalSolderPasteMargin(), aLibFootprint->GetLocalSolderPasteMargin() );

View File

@ -61,7 +61,6 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
m_orient = 0;
m_fpStatus = FP_PADS_are_LOCKED;
m_arflag = 0;
m_rot90Cost = m_rot180Cost = 0;
m_link = 0;
m_lastEditTime = 0;
m_localClearance = 0;
@ -86,8 +85,6 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
m_attributes = aFootprint.m_attributes;
m_fpStatus = aFootprint.m_fpStatus;
m_orient = aFootprint.m_orient;
m_rot90Cost = aFootprint.m_rot90Cost;
m_rot180Cost = aFootprint.m_rot180Cost;
m_lastEditTime = aFootprint.m_lastEditTime;
m_link = aFootprint.m_link;
m_path = aFootprint.m_path;
@ -170,14 +167,14 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
}
}
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings = aFootprint.m_3D_Drawings;
// Copy auxiliary data
m_3D_Drawings = aFootprint.m_3D_Drawings;
m_doc = aFootprint.m_doc;
m_keywords = aFootprint.m_keywords;
m_properties = aFootprint.m_properties;
m_privateLayers = aFootprint.m_privateLayers;
m_doc = aFootprint.m_doc;
m_keywords = aFootprint.m_keywords;
m_properties = aFootprint.m_properties;
m_arflag = 0;
m_arflag = 0;
m_initial_comments = aFootprint.m_initial_comments ?
new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
@ -267,8 +264,6 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
m_attributes = aOther.m_attributes;
m_fpStatus = aOther.m_fpStatus;
m_orient = aOther.m_orient;
m_rot90Cost = aOther.m_rot90Cost;
m_rot180Cost = aOther.m_rot180Cost;
m_lastEditTime = aOther.m_lastEditTime;
m_link = aOther.m_link;
m_path = aOther.m_path;
@ -335,12 +330,12 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
aOther.Groups().clear();
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
// Copy auxiliary data
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
m_privateLayers = aOther.m_privateLayers;
m_initial_comments = aOther.m_initial_comments;
@ -365,8 +360,6 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
m_attributes = aOther.m_attributes;
m_fpStatus = aOther.m_fpStatus;
m_orient = aOther.m_orient;
m_rot90Cost = aOther.m_rot90Cost;
m_rot180Cost = aOther.m_rot180Cost;
m_lastEditTime = aOther.m_lastEditTime;
m_link = aOther.m_link;
m_path = aOther.m_path;
@ -444,12 +437,12 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
Add( newGroup );
}
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
// Copy auxiliary data
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
m_privateLayers = aOther.m_privateLayers;
m_initial_comments = aOther.m_initial_comments ?
new wxArrayString( *aOther.m_initial_comments ) : nullptr;
@ -744,6 +737,7 @@ const EDA_RECT FOOTPRINT::GetBoundingBox() const
const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const
{
const BOARD* board = GetBoard();
bool isFPEdit = board && board->IsFootprintHolder();
if( board )
{
@ -772,6 +766,9 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
for( BOARD_ITEM* item : m_drawings )
{
if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) )
continue;
if( item->Type() == PCB_FP_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
area.Merge( item->GetBoundingBox() );
}
@ -789,6 +786,9 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
{
for( BOARD_ITEM* item : m_drawings )
{
if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) )
continue;
if( item->Type() == PCB_FP_TEXT_T )
area.Merge( item->GetBoundingBox() );
}
@ -855,6 +855,7 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
{
const BOARD* board = GetBoard();
bool isFPEdit = board && board->IsFootprintHolder();
if( board )
{
@ -867,6 +868,9 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
for( BOARD_ITEM* item : m_drawings )
{
if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) )
continue;
if( item->Type() == PCB_FP_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
{
item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,

View File

@ -121,6 +121,9 @@ public:
return aItem && aItem->Type() == PCB_FOOTPRINT_T;
}
LSET GetPrivateLayers() const { return m_privateLayers; }
void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; }
///< @copydoc BOARD_ITEM_CONTAINER::Add()
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
@ -571,12 +574,6 @@ public:
KIID GetLink() const { return m_link; }
void SetLink( const KIID& aLink ) { m_link = aLink; }
int GetPlacementCost180() const { return m_rot180Cost; }
void SetPlacementCost180( int aCost ) { m_rot180Cost = aCost; }
int GetPlacementCost90() const { return m_rot90Cost; }
void SetPlacementCost90( int aCost ) { m_rot90Cost = aCost; }
BOARD_ITEM* Duplicate() const override;
/**
@ -778,8 +775,7 @@ private:
timestamp_t m_lastEditTime;
int m_arflag; // Use to trace ratsnest and auto routing.
KIID m_link; // Temporary logical link used during editing
int m_rot90Cost; // Horizontal automatic placement cost ( 0..10 ).
int m_rot180Cost; // Vertical automatic placement cost ( 0..10 ).
LSET m_privateLayers; // Layers visible only in the footprint editor
std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
std::map<wxString, wxString> m_properties;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-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
@ -21,7 +21,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiway.h>
#include <kiway_player.h>
#include <fp_text_grid_table.h>
#include <widgets/grid_icon_text_helpers.h>
@ -192,7 +191,7 @@ wxGridCellAttr* FP_TEXT_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr:
wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
{
const FP_TEXT& text = this->at((size_t) aRow );
const FP_TEXT& text = this->at( (size_t) aRow );
switch( aCol )
{
@ -231,13 +230,14 @@ wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
bool FP_TEXT_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
{
FP_TEXT& text = this->at((size_t) aRow );
FP_TEXT& text = this->at( (size_t) aRow );
switch( aCol )
{
case FPT_SHOWN: return text.IsVisible();
case FPT_ITALIC: return text.IsItalic();
case FPT_UPRIGHT: return text.IsKeepUpright();
default:
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) );
return false;
@ -247,11 +247,12 @@ bool FP_TEXT_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
{
FP_TEXT& text = this->at((size_t) aRow );
FP_TEXT& text = this->at( (size_t) aRow );
switch( aCol )
{
case FPT_LAYER: return text.GetLayer();
default:
wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a long value" ), aCol ) );
return 0;
@ -261,7 +262,7 @@ long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
{
FP_TEXT& text = this->at((size_t) aRow );
FP_TEXT& text = this->at( (size_t) aRow );
wxPoint pos;
switch( aCol )
@ -310,7 +311,7 @@ void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
void FP_TEXT_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
{
FP_TEXT& text = this->at((size_t) aRow );
FP_TEXT& text = this->at( (size_t) aRow );
switch( aCol )
{
@ -334,7 +335,7 @@ void FP_TEXT_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
void FP_TEXT_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue )
{
FP_TEXT& text = this->at((size_t) aRow );
FP_TEXT& text = this->at( (size_t) aRow );
switch( aCol )
{

View File

@ -422,6 +422,25 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
m_maxError = bds.m_MaxError;
m_holePlatingThickness = bds.GetHolePlatingThickness();
if( item->GetParentFootprint() && !board->IsFootprintHolder() )
{
FOOTPRINT* parentFP = static_cast<FOOTPRINT*>( item->GetParentFootprint() );
if( item->GetLayerSet().count() > 1 )
{
// For multi-layer objects, exclude only those layers that are private
if( IsPcbLayer( aLayer ) && parentFP->GetPrivateLayers().test( aLayer ) )
return false;
}
else
{
// For single-layer objects, exclude all layers including ancillary layers
// such as holes, netnames, etc.
if( parentFP->GetPrivateLayers().test( item->GetLayer() ) )
return false;
}
}
}
else
{

View File

@ -326,7 +326,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
continue;
if( !m_layerMask[textLayer] )
if( !m_layerMask[textLayer] || aFootprint->GetPrivateLayers().test( textLayer ) )
continue;
if( textItem->GetText() == wxT( "${REFERENCE}" ) && !GetPlotReference() )
@ -531,6 +531,9 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
{
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
if( aFootprint->GetPrivateLayers().test( item->GetLayer() ) )
continue;
if( item->Type() == PCB_FP_SHAPE_T )
{
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( item );

View File

@ -3380,14 +3380,28 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
break;
case T_autoplace_cost90:
footprint->SetPlacementCost90( parseInt( "auto place cost at 90 degrees" ) );
case T_autoplace_cost180:
parseInt( "legacy auto-place cost" );
NeedRIGHT();
break;
case T_autoplace_cost180:
footprint->SetPlacementCost180( parseInt( "auto place cost at 180 degrees" ) );
NeedRIGHT();
case T_private_layers:
{
LSET privateLayers;
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
auto it = m_layerIndices.find( CurStr() );
if( it != m_layerIndices.end() )
privateLayers.set( it->second );
else
Expecting( "layer name" );
}
footprint->SetPrivateLayers( privateLayers );
break;
}
case T_solder_mask_margin:
footprint->SetLocalSolderMaskMargin( parseBoardUnits( "local solder mask margin "
@ -3396,14 +3410,14 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
break;
case T_solder_paste_margin:
footprint->SetLocalSolderPasteMargin(
parseBoardUnits( "local solder paste margin value" ) );
footprint->SetLocalSolderPasteMargin( parseBoardUnits( "local solder paste margin "
"value" ) );
NeedRIGHT();
break;
case T_solder_paste_ratio:
footprint->SetLocalSolderPasteMarginRatio(
parseDouble( "local solder paste margin ratio value" ) );
footprint->SetLocalSolderPasteMarginRatio( parseDouble( "local solder paste margin "
"ratio value" ) );
NeedRIGHT();
break;

View File

@ -1172,12 +1172,6 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(path %s)\n",
m_out->Quotew( aFootprint->GetPath().AsString() ).c_str() );
if( aFootprint->GetPlacementCost90() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost90 %d)\n", aFootprint->GetPlacementCost90() );
if( aFootprint->GetPlacementCost180() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost180 %d)\n", aFootprint->GetPlacementCost180() );
if( aFootprint->GetLocalSolderMaskMargin() != 0 )
m_out->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatInternalUnits( aFootprint->GetLocalSolderMaskMargin() ).c_str() );
@ -1224,6 +1218,19 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
m_out->Print( 0, ")\n" );
}
if( aFootprint->GetPrivateLayers().any() )
{
m_out->Print( aNestLevel+1, "(private_layers" );
for( PCB_LAYER_ID layer : aFootprint->GetPrivateLayers().Seq() )
{
wxString canonicalName( LSET::Name( layer ) );
m_out->Print( 0, " \"%s\"", canonicalName.ToStdString().c_str() );
}
m_out->Print( 0, ")\n" );
}
Format( (BOARD_ITEM*) &aFootprint->Reference(), aNestLevel + 1 );
Format( (BOARD_ITEM*) &aFootprint->Value(), aNestLevel + 1 );

View File

@ -107,7 +107,8 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides
//#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute
//#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting
#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
//#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
#define SEXPR_BOARD_FILE_VERSION 20221231 // Private footprint layers
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting

View File

@ -1203,29 +1203,10 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
char* uuid = strtok_r( (char*) line + SZ( "Sc" ), delims, (char**) &data );
const_cast<KIID&>( aFootprint->m_Uuid ) = KIID( uuid );
}
else if( TESTLINE( "Op" ) ) // (Op)tions for auto placement
else if( TESTLINE( "Op" ) ) // (Op)tions for auto placement (no longer supported)
{
int itmp1 = hexParse( line + SZ( "Op" ), &data );
int itmp2 = hexParse( data );
int cntRot180 = itmp2 & 0x0F;
if( cntRot180 > 10 )
cntRot180 = 10;
aFootprint->SetPlacementCost180( cntRot180 );
int cntRot90 = itmp1 & 0x0F;
if( cntRot90 > 10 )
cntRot90 = 0;
itmp1 = (itmp1 >> 4) & 0x0F;
if( itmp1 > 10 )
itmp1 = 0;
aFootprint->SetPlacementCost90((itmp1 << 4) | cntRot90 );
hexParse( line + SZ( "Op" ), &data );
hexParse( data );
}
else if( TESTLINE( "At" ) ) // (At)tributes of footprint
{