75 bool CanGetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override;
76 bool CanSetValueAs(
int aRow,
int aCol,
const wxString& aTypeName )
override;
77 wxGridCellAttr*
GetAttr(
int aRow,
int aCol, wxGridCellAttr::wxAttrKind aKind )
override;
79 wxString
GetValue(
int aRow,
int aCol )
override;
82 void SetValue(
int aRow,
int aCol,
const wxString& aValue )
override;
109 return aTypeName == wxGRID_VALUE_NUMBER;
115 return aTypeName == wxGRID_VALUE_NUMBER;
128 return m_frame->GetBoard()->GetLayerName( this->at( (
size_t) aRow ) );
134 return this->at( (
size_t) aRow );
140 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
146 this->at( (
size_t) aRow ) =
ToLAYER_ID( (
int) aValue );
168 SetEvtHandlerEnabled(
false );
210 [
this]( wxCommandEvent& aEvent )
215 [
this]( wxCommandEvent& aEvent )
220 [
this]( wxCommandEvent& aEvent )
225 [
this]( wxCommandEvent& aEvent )
230 m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
246 if(
static_cast<int>(
m_page ) >= 0 )
281 SetEvtHandlerEnabled(
true );
287 m_frame->GetSettings()->m_FootprintTextShownColumns =
m_itemsGrid->GetShownColumnsAsString();
318 if( !wxDialog::TransferDataToWindow() )
336 wxGridTableMessage tmsg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_fields->GetNumberRows() );
351 wxGridTableMessage gridTableMessagesg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
385 wxGridTableMessage gridTableMessagesCustom(
m_customUserLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
402 if(
m_footprint->GetLocalSolderMaskMargin().has_value() )
407 if(
m_footprint->GetLocalSolderPasteMargin().has_value() )
412 if(
m_footprint->GetLocalSolderPasteMarginRatio().has_value() )
431 if( !
group.IsEmpty() )
444 for(
const wxString& pinNumber :
group )
446 if( !groupTxt.IsEmpty() )
449 groupTxt << pinNumber;
457 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
462 int col_size =
m_itemsGrid->GetVisibleWidth( col );
469 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
472 col_size +=
KiROUND( 14 * GetDPIScaleFactor() ) + 12;
492 if( aFootprintName.IsEmpty() )
509 if( aFootprintName != originalFPName && tbl->
FootprintExists( libraryName, aFootprintName ) )
511 wxString msg = wxString::Format(
_(
"Footprint '%s' already exists in library '%s'." ),
512 aFootprintName, libraryName );
514 KIDIALOG errorDlg(
m_frame, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
515 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
538 userLayers.
set( layer );
557 wxCHECK2( aSubItem, );
559 switch( aSubItem->
Type() )
563 ZONE& zone =
static_cast<ZONE&
>( *aSubItem );
569 usedLayers.set( aSubItem->
GetLayer() );
584 if( !DIALOG_SHIM::Validate() )
603 for(
int i = 0; i < (int)
m_fields->size(); ++i )
608 if( field.
GetName(
false ).IsEmpty() )
626 m_frame->StringFromValue( maxSize,
true ) );
638 m_frame->StringFromValue( maxSize,
true ) );
654 "It will be clamped." );
667 if(
m_frame->DeleteFootprintFromLibrary( overwrite,
false ) )
668 m_frame->SyncLibraryTree(
true );
676 usedLayers &=
~LSET::AllTechMask();
677 usedLayers &=
~LSET::UserMask();
679 if( usedLayers.any() )
682 wxString::Format(
_(
"You are trying to remove layers that are used by the footprint: %s.\n"
683 "Please remove the objects that use these layers first." ),
715 if( !DIALOG_SHIM::TransferDataFromWindow() )
719 std::set<wxString> files;
720 std::set<wxString> files_to_delete;
726 files.insert( field.GetText() );
734 if( files.find( field->GetText() ) == files.end() )
735 files_to_delete.insert( field->GetText() );
739 for(
const wxString& file : files_to_delete )
767 view->
Add( newField );
781 privateLayers.
set( layer );
790 m_footprint->SetStackupLayers( std::move( customLayers ) );
803 case 1: attributes |=
FP_SMD;
break;
860 if( !
group.IsEmpty() )
866 std::vector<std::set<wxString>>& jumpers =
m_footprint->JumperPadGroups();
871 wxStringTokenizer tokenizer(
m_jumperGroupsGrid->GetCellValue( ii, 0 ),
", \t\r\n", wxTOKEN_STRTOK );
872 std::set<wxString>&
group = jumpers.emplace_back();
874 while( tokenizer.HasMoreTokens() )
876 if( wxString token = tokenizer.GetNextToken(); !token.IsEmpty() )
877 group.insert( token );
882 std::vector<FP_3DMODEL>& panelList =
m_3dPanel->GetModelList();
883 std::vector<FP_3DMODEL>* fpList = &
m_footprint->Models();
885 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
887 commit.Push(
_(
"Edit Footprint Properties" ) );
896 [&]() -> std::pair<int, int>
915 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
929 if( row < m_fields->GetMandatoryRowCount() )
931 DisplayError(
this, wxString::Format(
_(
"The first %d fields are mandatory." ),
932 m_fields->GetMandatoryRowCount() ) );
943 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
954 aLayerTable.erase( aLayerTable.begin() + aRow );
957 wxGridTableMessage msg( &aLayerTable, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
958 aGrid.ProcessTableMessage( msg );
972 aGridTable.push_back( nextLayer );
975 wxGridTableMessage msg( &aGridTable, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
976 aGrid.ProcessTableMessage( msg );
979 return { aGridTable.size() - 1, 0 };
1056 [&]() -> std::pair<int, int>
1058 aGrid->AppendRows( 1 );
1061 return { aGrid->GetNumberRows() - 1, 0 };
1071 aGrid->DeleteRows( row, 1 );
1085 for(
int i = 0; i <
m_itemsGrid->GetNumberCols(); i++ )
1095 auto updateSingleColumnGrid =
1098 aGrid->SetColSize( 0, std::max( aGrid->GetClientSize().x, aGrid->GetVisibleWidth( 0 ) ) );
1142 textEntry->SelectAll();
1166 wxSize new_size = aEvent.GetSize();
constexpr EDA_IU_SCALE pcbIUScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION selectionClear
Clear the current selection.
BASE_SET & set(size_t pos)
Container for design settings for a BOARD object.
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
KICAD_T Type() const
Returns the type of object.
int GetTextHeight() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
int GetTextThickness() const
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
VECTOR2I GetTextSize() const
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
int GetNumberCols() override
LAYERS_GRID_TABLE(PCB_BASE_FRAME *aFrame, const LSET &aForbiddenLayers)
wxString GetValue(int aRow, int aCol) override
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetValueAsLong(int aRow, int aCol, long aValue) override
long GetValueAsLong(int aRow, int aCol) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
int GetNumberRows() override
wxGridCellAttr * m_layerColAttr
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
A logical library item identifier and consists of various portions much like a URI.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
bool IsValid() const
Check if this LID_ID is valid.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
PCB_FIELD * CloneField() const
Same as Clone, but returns a PCB_FIELD item.
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
void OnAddRow(const std::function< std::pair< int, int >()> &aAdder)
Handle a list of polygons defining a copper zone.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
Declaration of the eda_3d_viewer class.
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
static const std::string KiCadUriPrefix
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
wxString AccumulateNames(const LSEQ &aLayers, const BOARD *aBoard)
Accumulate layer names from a layer set into a comma separated string.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
@ USER
The field ID hasn't been set yet; field is invalid.
@ PCB_ZONE_T
class ZONE, a copper pour area
Custom text control validator definitions.
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper