60 m_footprint( aFootprint ),
61 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
62 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
63 m_orientation( aParent, m_orientationLabel, m_orientationCtrl, nullptr ),
64 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
65 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
66 m_SolderMaskMarginUnits ),
67 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
68 m_SolderPasteMarginUnits ),
69 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
70 m_PasteMarginRatioUnits ),
71 m_returnValue( FP_PROPS_CANCEL ),
72 m_initialized( false ),
74 m_lastRequestedSize( 0, 0 )
97 icon.CopyFromBitmap(
KiBitmap( BITMAPS::icon_modedit ) );
115 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
125 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
196 catch(
const std::runtime_error& e )
198 wxFAIL_MSG( e.what() );
264 if( !wxDialog::TransferDataToWindow() )
287 wxGridTableMessage tmsg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
302 m_cbLocked->SetToolTip(
_(
"Locked footprints cannot be freely moved and oriented on the "
303 "canvas and can only be selected when the 'Locked items' checkbox "
304 "is checked in the selection filter." ) );
355 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
367 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
370 col_size +=
KiROUND( 14 * GetDPIScaleFactor() ) + 12;
392 if( !DIALOG_SHIM::Validate() )
396 for(
size_t i = 0; i <
m_fields->size(); ++i )
401 if( field.
GetName(
false ).IsEmpty() )
429 else if( width > maxSize )
456 else if( height > maxSize )
482 "It will be clamped at %s." ),
519 std::set<wxString> files;
520 std::set<wxString> files_to_delete;
526 files.insert( field.GetText() );
534 if( files.find( field->GetText() ) == files.end() )
535 files_to_delete.insert( field->GetText() );
539 for(
const wxString& file : files_to_delete )
556 newField->
SetText( commit.GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() ) );
558 if( !field.IsMandatory() )
562 view->
Add( newField );
613 case 1: attributes |=
FP_SMD;
break;
643 bool change_layer =
false;
662 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
666 commit.Push(
_(
"Edit Footprint Properties" ) );
689 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
708 wxArrayInt selectedRows =
m_itemsGrid->GetSelectedRows();
710 if( selectedRows.empty() &&
m_itemsGrid->GetGridCursorRow() >= 0 )
711 selectedRows.push_back(
m_itemsGrid->GetGridCursorRow() );
713 if( selectedRows.empty() )
716 for(
int row : selectedRows )
719 if( row < m_fields->GetMandatoryRowCount() )
721 DisplayError(
this, wxString::Format(
_(
"The first %d fields are mandatory." ),
731 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
733 for(
int row : selectedRows )
738 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
759 for(
int i = 0; i <
m_itemsGrid->GetNumberCols(); i++ )
805 grid->MakeCellVisible( row, col );
811 grid->SetGridCursor( row, col );
813 if( !( col == 0 && row < m_fields->GetMandatoryRowCount() ) )
814 grid->EnableCellEditControl(
true );
816 grid->ShowCellEditControl();
820 auto referenceEditor =
grid->GetCellEditor( 0, 0 );
822 if(
auto textEntry =
dynamic_cast<wxTextEntry*
>( referenceEditor->GetControl() ) )
825 referenceEditor->DecRef();
836 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)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
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...
EDA_ITEM_FLAGS GetEditFlags() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
int GetTextThickness() const
VECTOR2I GetTextSize() const
void RemoveFile(const wxString &name, bool aErase=true)
Remove a file from the collection and frees the memory.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
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.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
EMBEDDED_FILES * GetLocalFiles()
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
std::vector< FP_3DMODEL > & GetModelList()
bool TransferDataToWindow() override
void AdjustGridColumnWidths()
bool TransferDataFromWindow() override
FLIP_DIRECTION m_FlipDirection
wxString m_FootprintTextShownColumns
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
The main frame for Pcbnew.
int GetNumberRows() override
int GetMandatoryRowCount() const
void SetOrdinal(int aOrdinal)
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.
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings) 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.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetNegativeZero()
virtual double GetDoubleValue()
Return the current value in Internal Units.
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
wxString GetShownColumnsAsString()
Get a tokenized string containing the shown column indexes.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
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 void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
constexpr int mmToIU(double mm) const
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)