56 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
57 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
58 m_OrientValidator( 3, &m_OrientValue ),
59 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ),
60 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
61 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_SolderPasteMarginUnits ),
62 m_initialFocus( true ),
73 for(
size_t i = 0; i <
m_NoteBook->GetPageCount(); ++i )
107 wxGridCellAttr* attr =
new wxGridCellAttr;
109 "*.*",
true,
Prj().GetProjectPath() ) );
113 attr =
new wxGridCellAttr;
114 attr->SetRenderer(
new wxGridCellBoolRenderer() );
116 attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
119 m_modelsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
125 aParent->
Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &
Pgm() );
132 wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
133 infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
144 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
194 Prj().Get3DCacheManager()->FlushCache(
false );
269 for(
PAD* pad : aFootprint->
Pads() )
271 if( !pad->IsLocked() )
281 if( !wxDialog::TransferDataToWindow() )
297 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
300 m_texts->push_back( *textItem );
336 m_AutoPlaceCtrl->SetItemToolTip( 0,
_(
"Footprint can be freely moved and oriented on the " 337 "canvas. At least some of the footprint's pads are " 338 "unlocked and can be moved with respect to the " 340 m_AutoPlaceCtrl->SetItemToolTip( 1,
_(
"Footprint can be freely moved and oriented on the " 341 "canvas, but all of its pads are locked with respect " 342 "to their position within in the footprint." ) );
343 m_AutoPlaceCtrl->SetItemToolTip( 2,
_(
"Footprint is locked: it cannot be freely moved and " 344 "oriented on the canvas and can only be selected when " 345 "the 'Locked items' checkbox is enabled in the " 346 "selection filter." ) );
396 wxString origPath, alias, shortPath;
402 origPath = model.m_Filename;
404 if( res && res->
SplitAlias( origPath, alias, shortPath ) )
405 origPath = alias + wxT(
":" ) + shortPath;
410 m_modelsGrid->SetCellValue( row, 1, model.m_Show ? wxT(
"1" ) : wxT(
"0" ) );
419 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
431 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
455 aModelIdx = std::max( 0, aModelIdx );
456 aModelIdx = std::min( aModelIdx,
m_modelsGrid->GetNumberRows() - 1 );
479 if( aEvent.GetCol() == 0 )
481 bool hasAlias =
false;
483 wxString filename =
m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
485 filename.Replace(
"\n",
"" );
486 filename.Replace(
"\r",
"" );
487 filename.Replace(
"\t",
"" );
500 filename.insert( 0, wxT(
":" ) );
504 filename.Replace( wxT(
"\\" ), wxT(
"/" ) );
508 m_modelsGrid->SetCellValue( aEvent.GetRow(), 0, filename );
510 else if( aEvent.GetCol() == 1 )
512 wxString showValue =
m_modelsGrid->GetCellValue( aEvent.GetRow(), 1 );
514 m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT(
"1" ) );
554 if( initialpath.IsEmpty() )
556 if( !wxGetEnv(
"KICAD6_3DMODEL_DIR", &initialpath ) || initialpath.IsEmpty() )
565 if( tmp > 0 && tmp <= INT_MAX )
584 if( res && res->
SplitAlias( filename, alias, shortPath ) )
585 filename = alias + wxT(
":" ) + shortPath;
635 if( !DIALOG_SHIM::Validate() )
639 for(
size_t i = 2; i <
m_texts->size(); ++i )
687 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
692 if( i < m_texts->size() )
693 *textItem =
m_texts->at( i++ );
700 while( i < m_texts->size() )
704 view->Add( newText );
714 msg.ToDouble( &dtmp );
743 pad->SetLocked(
true );
751 case 1: attributes |=
FP_SMD;
break;
779 bool change_layer =
false;
797 commit.
Push(
_(
"Modify footprint properties" ) );
824 m_texts->push_back( textItem );
827 wxGridTableMessage msg(
m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
847 else if( curRow < 2 )
849 DisplayError(
nullptr,
_(
"Reference and value are mandatory." ) );
856 wxGridTableMessage msg(
m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
882 for(
int i = 1; i <
m_itemsGrid->GetNumberCols(); i++ )
925 grid->MakeCellVisible( row, col );
931 grid->SetGridCursor( row, col );
932 grid->EnableCellEditControl(
true );
933 grid->ShowCellEditControl();
937 auto referenceEditor = grid->GetCellEditor( 0, 0 );
939 if(
auto textEntry = dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) )
942 referenceEditor->DecRef();
962 int page = aEvent.GetSelection();
966 m_NoteBook->ChangeSelection( (
unsigned) page );
973 wxSize pageSize =
m_NoteBook->GetPage( page )->GetSize();
976 m_NoteBook->GetPage( page )->SetSize( pageSize );
void SetMirrored(bool isMirrored)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
Container for project specific data.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
#define KICAD6_3DMODEL_DIR
A variable name whose value holds the path of 3D shape files.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const BITMAP_OPAQUE small_folder_xpm[1]
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
void ValidatorTransferToWindowWithoutEvents(wxValidator &aValidator)
Call a text validator's TransferDataToWindow method without firing a text change event.
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetNumberRows() override
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetItalic(bool isItalic)
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, FP_3DMODEL *aModel)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
void DeleteStructure()
Delete this object after removing from its parent if it has one.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
void SetTextSize(const wxSize &aNewSize)
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...
wxString m_FootprintTextShownColumns
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
virtual const wxString GetProjectPath() const
Return the full path of the project.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
bool GetTextUpright(PCB_LAYER_ID aLayer) const
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
bool GetTextItalic(PCB_LAYER_ID aLayer) const
virtual PCB_LAYER_ID GetActiveLayer() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
wxString m_lastFootprint3dDir
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Return true if the given name contains an alias and populates the string anAlias with the alias and a...
bool m_Show
Include model in rendering.
PCB_LAYER_ID
A quick note on layer IDs:
pads are covered by copper
STATUS_FLAGS GetEditFlags() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
const BITMAP_OPAQUE small_trash_xpm[1]
const BITMAP_OPAQUE icon_modedit_xpm[1]
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString m_Filename
The 3D shape filename in 3D library.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Use thermal relief for pads.
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
void SetKeepUpright(bool aKeepUpright)
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool Configure3DPaths(wxWindow *aParent, FILENAME_RESOLVER *aResolver)
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.
Provide an extensible class to resolve 3D model paths.
Declaration of the eda_3d_viewer class.
Information pertinent to a Pcbnew printed circuit board.
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
The main frame for Pcbnew.
PCBNEW_SETTINGS & Settings()
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
virtual long long int GetValue()
Return the current value in Internal Units.
static bool GetLayer(MODEL_VRML &aModel, LAYER_NUM layer, VRML_LAYER **vlayer)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
bool ValidateFileName(const wxString &aFileName, bool &hasAlias)
Returns true if the given path is a valid aliased relative path.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual const wxString & GetText() const
Return the string associated with the text object.
const BITMAP_OPAQUE small_plus_xpm[1]
Custom text control validator definitions.
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
Container for design settings for a BOARD object.