81 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
83 embeddedFilesStack.push_back(
m_frame->GetBoard()->GetEmbeddedFiles() );
110 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
140 "Enter an absolute value (e.g., -0.1mm), a percentage "
141 "(e.g., -5%), or both (e.g., -0.1mm - 5%).\n"
142 "If blank, the global value is used." ) );
247 if( !wxDialog::TransferDataToWindow() )
260 wxString variantName;
263 variantName =
m_footprint->GetBoard()->GetCurrentVariant();
268 wxCHECK2( srcField,
continue );
278 wxGridTableMessage tmsg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
m_fields->GetNumberRows() );
292 m_cbLocked->SetToolTip(
_(
"Locked footprints cannot be freely moved or oriented on the canvas and can only be "
293 "selected when the 'Locked items' checkbox is checked in the selection filter." ) );
321 if(
m_footprint->GetLocalSolderMaskMargin().has_value() )
340 wxString jumperGroups;
342 if(
m_footprint->GetDuplicatePadNumbersAreJumpers() )
343 jumperGroups =
_(
"all pads with duplicate numbers" );
349 for(
const wxString& pinNumber :
group.GetNames() )
351 if( !groupTxt.IsEmpty() )
354 groupTxt << pinNumber;
357 if( !jumperGroups.IsEmpty() )
358 jumperGroups <<
"; ";
360 jumperGroups <<
"(" << groupTxt <<
")";
363 if( jumperGroups.IsEmpty() )
376 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
381 int col_size =
m_itemsGrid->GetVisibleWidth( col );
388 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
391 col_size +=
KiROUND( 14 * GetDPIScaleFactor() ) + 12;
413 if( !DIALOG_SHIM::Validate() )
417 for(
size_t i = 0; i <
m_fields->size(); ++i )
422 if( field.
GetName(
false ).IsEmpty() )
450 else if( width > maxSize )
452 wxString max =
m_frame->StringFromValue( maxSize,
true );
477 else if( height > maxSize )
479 wxString max =
m_frame->StringFromValue( maxSize,
true );
496 wxString clamped =
m_frame->StringFromValue( maxPenWidth,
true );
502 "It will be clamped at %s." ),
514 if( wxString error =
m_solderPaste.Validate(); !error.IsEmpty() )
547 (void)
m_3dPanel->TransferDataFromWindow();
552 std::set<wxString> files;
553 std::set<wxString> files_to_delete;
559 files.insert( field.GetText() );
565 wxCHECK2( field,
continue );
569 if( files.find( field->GetText() ) == files.end() )
570 files_to_delete.insert( field->GetText() );
574 for(
const wxString& file : files_to_delete )
583 wxString variantName;
589 std::map<wxString, wxString> baseFieldValues;
592 baseFieldValues[existing->GetName()] = existing->GetText();
594 std::vector<PCB_FIELD> newFields;
598 newFields.reserve(
m_fields->size() );
602 PCB_FIELD& newField = newFields.emplace_back( field );
603 wxString newText = commit.GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() );
605 if( !variantName.IsEmpty() )
607 auto it = baseFieldValues.find( field.GetName() );
608 wxString baseText = ( it != baseFieldValues.end() ) ? it->second : wxString();
625 if( !field.IsMandatory() )
629 std::vector<PCB_FIELD*> addedFields;
630 std::vector<PCB_FIELD*> detachedFields;
632 m_footprint->UpdateFields( newFields, addedFields, detachedFields );
636 if(
EDA_GROUP* parentGroup = field->GetParentGroup() )
637 parentGroup->RemoveItem( field );
649 if(
EDA_GROUP* parentGroup = field->GetParentGroup() )
650 parentGroup->AddItem( field );
657 if( field->IsSelected() )
661 field->ClearSelected();
700 case 1: attributes |=
FP_SMD;
break;
707 if( !variantName.IsEmpty() )
760 bool change_layer =
false;
776 std::vector<FP_3DMODEL>& panelList =
m_3dPanel->GetModelList();
777 std::vector<FP_3DMODEL>* fpList = &
m_footprint->Models();
779 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
783 commit.Push(
_(
"Edit Footprint Properties" ) );
793 [&]() -> std::pair<int, int>
805 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
819 if( row < m_fields->GetMandatoryRowCount() )
821 DisplayError(
this, wxString::Format(
_(
"The first %d fields are mandatory." ),
822 m_fields->GetMandatoryRowCount() ) );
839 wxGridCellEditor*
editor =
m_itemsGrid->GetCellEditor( aEvent.GetRow(), aEvent.GetCol() );
840 wxControl* control =
editor->GetControl();
842 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
849 else if( aEvent.GetCol() ==
PFC_NAME )
851 wxString newName = aEvent.GetString();
853 for(
int row = 0; row <
m_itemsGrid->GetNumberRows(); ++row )
855 if( row == aEvent.GetRow() )
904 grid->MakeCellVisible( row, col );
910 grid->SetGridCursor( row, col );
912 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
913 grid->EnableCellEditControl(
true );
915 grid->ShowCellEditControl();
919 wxGridCellEditor* referenceEditor =
grid->GetCellEditor( 0, 0 );
921 if( wxTextEntry* textEntry =
dynamic_cast<wxTextEntry*
>( referenceEditor->GetControl() ) )
924 referenceEditor->DecRef();
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)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
wxString GetCurrentVariant() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
std::vector< wxWindow * > m_tabOrder
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...
A set of EDA_ITEMs (i.e., without duplicates).
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Represents a group of jumper pins or pads, keyed by name.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
The main frame for Pcbnew.
void SetOrdinal(int aOrdinal, FIELD_T aType)
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &aSettings, bool aCheckSide) override
int GetTextThickness() const override
VECTOR2I GetTextSize() const override
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
void FlushCache(bool closePlugins=true)
Free all data in the cache and by default closes all plugins.
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:
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
bool FieldNamesAreDuplicates(const wxString &aLhs, const wxString &aRhs, std::initializer_list< FIELD_T > aMandatoryFields)
Test whether two field names should be treated as duplicates for the purposes of field name uniquenes...
wxString GetUserFieldName(int aFieldNdx, TRANSLATION aTranslation)
@ USER
The field ID hasn't been set yet; field is invalid.
int FindNotebookPage(wxNotebook *aNotebook, wxWindow *aChildWindow)
VECTOR2< int32_t > VECTOR2I
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper