diff --git a/common/pcb.keywords b/common/pcb.keywords index a2cfd3706c..9fd476e1bb 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -209,6 +209,7 @@ pad_prop_fiducial_glob pad_prop_castellated pad_prop_testpoint pad_prop_heatsink +private_layers property page paper diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index efb27f90ad..2f1a288ac0 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -940,95 +940,11 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& 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 ); diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 407fa30494..c94008b077 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Mario Luzeiro * 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 ); -} diff --git a/pcbnew/dialogs/dialog_footprint_properties.h b/pcbnew/dialogs/dialog_footprint_properties.h index 331bbc8e53..a52bdf0449 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.h +++ b/pcbnew/dialogs/dialog_footprint_properties.h @@ -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 m_orientValidator; - double m_orientValue; + UNIT_BINDER m_orientation; UNIT_BINDER m_netClearance; UNIT_BINDER m_solderMask; diff --git a/pcbnew/dialogs/dialog_footprint_properties_base.cpp b/pcbnew/dialogs/dialog_footprint_properties_base.cpp index b242057a48..dd58ca8f5f 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_base.cpp @@ -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 ); diff --git a/pcbnew/dialogs/dialog_footprint_properties_base.fbp b/pcbnew/dialogs/dialog_footprint_properties_base.fbp index f89b487c7e..4e8bc0c2e1 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_base.fbp +++ b/pcbnew/dialogs/dialog_footprint_properties_base.fbp @@ -121,7 +121,7 @@ General - 0 + 1 1 1 @@ -457,20 +457,20 @@ bSizerProperties wxHORIZONTAL none - + 5 wxEXPAND 1 - + bSizerLeft wxVERTICAL private - + 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - + wxEXPAND|wxALL + 1 + wxID_ANY Position @@ -478,11 +478,11 @@ wxVERTICAL 1 none - - 5 - wxEXPAND + + 3 + wxEXPAND|wxBOTTOM 0 - + 3 wxBOTH 1 @@ -492,8 +492,8 @@ fgSizerPos wxFLEX_GROWMODE_SPECIFIED none - 3 - 2 + 4 + 1 5 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT @@ -742,8 +742,8 @@ - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP 1 1 @@ -866,6 +866,142 @@ -1 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Orientation: + 0 + + 0 + + + 0 + + 1 + m_orientationLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "0" "90" "-90" "180" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_orientationCtrl + 1 + + + protected + 1 + + Resizable + -1 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + 5 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT @@ -929,7 +1065,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND 0 1 @@ -993,453 +1129,68 @@ - - - - 3 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Orientation - - sbOrientationSizer - wxVERTICAL - 1 - none - + 5 - wxEXPAND|wxBOTTOM - 1 - - - wxBOTH - 1 - - 0 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Locked + + 0 + + + 0 - gbSizer1 - wxFLEX_GROWMODE_SPECIFIED - none - 1 - - 3 - 2 - 0 - wxBOTTOM - 0 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0.0 - - 0 - - - 0 - - 1 - m_Orient0 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - FootprintOrientEvent - - - - 3 - 2 - 0 - wxBOTTOM - 1 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 90.0 - - 0 - - - 0 - - 1 - m_Orient90 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - FootprintOrientEvent - - - - 3 - 2 - 0 - wxBOTTOM - 2 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - -90.0 - - 0 - - - 0 - - 1 - m_Orient270 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - FootprintOrientEvent - - - - 1 - 2 - 0 - wxBOTTOM - 3 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 180.0 - - 0 - - - 0 - - 1 - m_Orient180 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - FootprintOrientEvent - - - - 5 - 1 - 0 - wxALIGN_CENTER_VERTICAL - 4 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Other: - - 0 - - - 0 - - 1 - m_OrientOther - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - FootprintOrientEvent - - - - 5 - 1 - 1 - wxEXPAND|wxRIGHT|wxLEFT - 4 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - -1,-1 - 1 - m_OrientValueCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnOtherOrientation - - + 1 + m_cbLocked + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + @@ -1455,108 +1206,32 @@ bSizerMiddle wxVERTICAL none - + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Unlock footprint" "Lock footprint" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move and Place - 1 - - 0 - - - 0 - - 1 - m_AutoPlaceCtrl - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxALL - 0 - + wxID_ANY - Auto-placement Rules + Fabrication Attributes - m_sizerAP + sbFabSizer wxVERTICAL 1 - protected - + none + 5 wxEXPAND 0 - + - m_sizerAllow90 - wxVERTICAL - protected - - 2 - wxALL + bPartTypeSizer + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -1584,7 +1259,7 @@ 0 0 wxID_ANY - Allow 90 degree rotated placement: + Footprint type: 0 0 @@ -1593,7 +1268,7 @@ 0 1 - m_allow90Label + m_componentTypeLabel 1 @@ -1604,7 +1279,7 @@ 1 - + ; ; forward_declare 0 @@ -1613,11 +1288,11 @@ -1 - + 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 1 + 1 1 1 @@ -1631,6 +1306,7 @@ 1 0 + "Through hole" "SMD" "Other" 1 1 @@ -1645,16 +1321,14 @@ 0 0 wxID_ANY - 10 0 - 0 0 1 - m_CostRot90Ctrl + m_componentType 1 @@ -1662,17 +1336,17 @@ 1 Resizable + 0 1 - wxSL_HORIZONTAL|wxSL_LABELS - + + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - 0 @@ -1680,151 +1354,206 @@ - - 8 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 8 + + 5 + wxEXPAND + 1 + + 0 protected 0 - + 5 - wxEXPAND + wxALL 0 - + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Not in schematic + + 0 + + + 0 - m_sizerAllow180 - wxVERTICAL + 1 + m_boardOnly + 1 + + protected - - 2 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Allow 180 degree rotated placement: - 0 - - 0 - - - 0 - - 1 - m_allow180Label - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 10 - - 0 - - 0 - - 0 - - 1 - m_CostRot180Ctrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSL_HORIZONTAL|wxSL_LABELS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from position files + + 0 + + + 0 + + 1 + m_excludeFromPosFiles + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exclude from BOM + + 0 + + + 0 + + 1 + m_excludeFromBOM + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + @@ -1842,7 +1571,7 @@ none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 @@ -2073,7 +1802,7 @@ wxEXPAND 0 - 10 + 15 protected 0 @@ -2163,348 +1892,6 @@ 0 - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Fabrication Attributes - - sbFabSizer - wxVERTICAL - 1 - none - - 5 - wxEXPAND - 1 - - - bPartTypeSizer - wxHORIZONTAL - none - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Footprint type: - 0 - - 0 - - - 0 - - 1 - m_componentTypeLabel - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Through hole" "SMD" "Other" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_componentType - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Not in schematic - - 0 - - - 0 - - 1 - m_boardOnly - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exclude from position files - - 0 - - - 0 - - 1 - m_excludeFromPosFiles - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Exclude from BOM - - 0 - - - 0 - - 1 - m_excludeFromBOM - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - @@ -2515,7 +1902,7 @@ Clearance Overrides and Settings - 1 + 0 1 1 diff --git a/pcbnew/dialogs/dialog_footprint_properties_base.h b/pcbnew/dialogs/dialog_footprint_properties_base.h index be21cc9b4f..123303ff09 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_base.h +++ b/pcbnew/dialogs/dialog_footprint_properties_base.h @@ -29,13 +29,11 @@ class WX_GRID; #include #include #include +#include #include -#include -#include -#include -#include #include #include +#include #include #include @@ -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(); } diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp index fc58af5a43..ec08c44562 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp @@ -47,9 +47,70 @@ #include #include #include +#include #include +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( 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( item ); + FP_TEXT* textItem = dyn_cast( 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( m_delayedFocusCtrl ) ) + if( wxTextEntry* textEntry = dynamic_cast( m_delayedFocusCtrl ) ) textEntry->SelectAll(); m_delayedFocusCtrl = nullptr; diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.h b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.h index fa7c9a53c4..48401501b1 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.h +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.h @@ -36,6 +36,31 @@ class FOOTPRINT_EDIT_FRAME; class PANEL_FP_PROPERTIES_3D_MODEL; +class PRIVATE_LAYERS_GRID_TABLE : public wxGridTableBase, public std::vector +{ +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; }; diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp index 5aee6a4fee..631c9ddb7b 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp @@ -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 ); } diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp index 72b435f539..72fcba393f 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,7 +14,6 @@ dialog_footprint_properties_fp_editor_base 1000 none - 1 dialog_footprint_properties_fp_editor_base @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -52,7 +50,6 @@ DIALOG_SHIM; dialog_shim.h Footprint Properties - 0 @@ -303,7 +300,6 @@ - 0 @@ -387,7 +383,6 @@ - 0 @@ -453,8 +448,8 @@ - 5 - wxBOTTOM|wxEXPAND|wxTOP + 10 + wxEXPAND|wxBOTTOM 0 2 @@ -470,7 +465,7 @@ 3 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -531,7 +526,7 @@ 5 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -848,7 +843,7 @@ 5 - wxEXPAND|wxTOP|wxBOTTOM + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT 0 @@ -856,178 +851,120 @@ wxHORIZONTAL none - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 15 + wxEXPAND|wxRIGHT 1 wxID_ANY - Auto-placement Rules + Private Layers - m_sizerAP + bSizerPrivateLayers wxVERTICAL 1 - protected + none 5 - wxEXPAND - 0 - - - m_sizerAllow90 - wxVERTICAL - protected - - 5 - wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Allow 90 degree rotated placement: - 0 - - 0 - - - 0 - - 1 - m_allow90Label - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 10 - - 0 - - 0 - - 0 - - 1 - m_CostRot90Ctrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSL_HORIZONTAL|wxSL_LABELS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - 5 - wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 - - 8 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTER + 0 + + wxALIGN_CENTER + 1 + 180 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + -1,-1 + 1 + m_privateLayersGrid + 1 + + protected - 0 + 1 + + Resizable + wxALIGN_LEFT + 0 + + wxALIGN_CENTER + + 2 + 1 + -1,-1 + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + OnGridSize 5 - wxEXPAND|wxBOTTOM + wxEXPAND 0 - m_sizerAllow180 - wxVERTICAL - protected - + bButtonSize1 + wxHORIZONTAL + none + 5 - wxLEFT + wxBOTTOM|wxLEFT|wxRIGHT 0 - + 1 1 1 @@ -1038,57 +975,79 @@ + 1 0 1 1 + + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_ANY - Allow 180 degree rotated placement: + Add Excluded Layer + 0 0 0 - + -1,-1 1 - m_allow180Label + m_bpAddLayer 1 protected 1 + + Resizable 1 - + ; forward_declare 0 + + wxFILTER_NONE + wxDefaultValidator + - -1 + OnAddLayer - - 10 - wxEXPAND|wxRIGHT|wxLEFT + + 5 + wxEXPAND 0 - + + 0 + protected + 20 + + + + 5 + wxRIGHT + 0 + 1 1 1 @@ -1099,54 +1058,62 @@ + 1 0 1 1 + + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_ANY - 10 + Delete Excluded Layer + + 0 0 - 0 0 - + -1,-1 1 - m_CostRot180Ctrl + m_bpDeleteLayer 1 protected 1 + + Resizable 1 - wxSL_HORIZONTAL|wxSL_LABELS - + + ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - 0 + OnDeleteLayer @@ -1155,17 +1122,7 @@ 5 - wxEXPAND - 0 - - 0 - protected - 10 - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT 1 wxID_ANY diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h index 7c6ed23e63..84a4c9402a 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h @@ -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 #include #include -#include #include #include #include @@ -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(); }; diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 1f9636552d..6c88b989f1 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -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() ); diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index f63c08a833..67d4ec435c 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -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, diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 76e540049f..d028247c06 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -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 m_3D_Drawings; // 3D models. std::map m_properties; diff --git a/pcbnew/fp_text_grid_table.cpp b/pcbnew/fp_text_grid_table.cpp index c59795e1aa..44888c23b2 100644 --- a/pcbnew/fp_text_grid_table.cpp +++ b/pcbnew/fp_text_grid_table.cpp @@ -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 #include #include #include @@ -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 ) { diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 4fd89a3fe6..364e77cfed 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -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( 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 { diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 67e61ca78d..1b395e06cb 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -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( item ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 9133435a4e..eb81e1d868 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -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; diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index ae214a6203..f1ec983a29 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -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 ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index 95c5918b4f..b33cfa37fd 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -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 diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 81fb52673f..82525925c6 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -1203,29 +1203,10 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint ) char* uuid = strtok_r( (char*) line + SZ( "Sc" ), delims, (char**) &data ); const_cast( 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 {