81 return aTypeName == wxGRID_VALUE_NUMBER;
87 return aTypeName == wxGRID_VALUE_NUMBER;
92 wxGridCellAttr::wxAttrKind aKind )
107 return this->at( (
size_t) aRow );
113 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
119 this->at( (
size_t) aRow ) =
ToLAYER_ID( (
int) aValue );
133 m_footprint( aFootprint ),
134 m_initialized( false ),
135 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
136 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
137 m_SolderMaskMarginUnits ),
138 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
139 m_SolderPasteMarginUnits ),
140 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
141 m_PasteMarginRatioUnits ),
143 m_lastRequestedSize( 0, 0 )
145 SetEvtHandlerEnabled(
false );
166 icon.CopyFromBitmap(
KiBitmap( BITMAPS::icon_modedit ) );
178 [
this]( wxCommandEvent& aEvent )
183 [
this]( wxCommandEvent& aEvent )
188 m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
199 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
203 if(
static_cast<int>(
m_page ) >= 0 )
206 if(
m_page == NOTEBOOK_PAGES::PAGE_GENERAL )
213 else if(
m_page == NOTEBOOK_PAGES::PAGE_CLEARANCES )
237 SetEvtHandlerEnabled(
true );
257 m_NoteBook->SetSelection(
static_cast<int>( NOTEBOOK_PAGES::PAGE_3D_MODELS ) );
271 if( !wxDialog::TransferDataToWindow() )
289 wxGridTableMessage tmsg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
305 wxGridTableMessage gridTableMessagesg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
350 if( !
group.IsEmpty() )
362 std::set<wxString> availablePads;
365 availablePads.insert(
pad->GetNumber() );
372 for(
const wxString& pinNumber :
group )
374 availablePads.erase( pinNumber );
375 groupTxt << pinNumber;
377 if( ++i <
group.size() )
384 for(
const wxString&
pin : availablePads )
388 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
400 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
403 col_size +=
KiROUND( 14 * GetDPIScaleFactor() ) + 12;
423 if( aFootprintName.IsEmpty() )
440 if( aFootprintName != originalFPName && tbl->
FootprintExists( libraryName, aFootprintName ) )
442 wxString msg = wxString::Format(
_(
"Footprint '%s' already exists in library '%s'." ),
443 aFootprintName, libraryName );
445 KIDIALOG errorDlg(
m_frame, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
446 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
465 if( !DIALOG_SHIM::Validate() )
484 for(
int i = 0; i < (int)
m_fields->size(); ++i )
489 if( field.
GetName(
false ).IsEmpty() )
536 "It will be clamped." );
574 if( !DIALOG_SHIM::TransferDataFromWindow() )
578 std::set<wxString> files;
579 std::set<wxString> files_to_delete;
585 files.insert( field.GetText() );
593 if( files.find( field->GetText() ) == files.end() )
594 files_to_delete.insert( field->GetText() );
598 for(
const wxString& file : files_to_delete )
626 view->
Add( newField );
640 privateLayers.
set( layer );
649 case 1: attributes |=
FP_SMD;
break;
709 if( !
group.IsEmpty() )
721 std::set<wxString>&
group = jumpers.emplace_back();
723 while( tokenizer.HasMoreTokens() )
725 if( wxString token = tokenizer.GetNextToken(); !token.IsEmpty() )
726 group.insert( token );
734 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
736 commit.Push(
_(
"Edit Footprint Properties" ) );
765 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
784 wxArrayInt selectedRows =
m_itemsGrid->GetSelectedRows();
786 if( selectedRows.empty() &&
m_itemsGrid->GetGridCursorRow() >= 0 )
787 selectedRows.push_back(
m_itemsGrid->GetGridCursorRow() );
789 if( selectedRows.empty() )
792 for(
int row : selectedRows )
794 if( row < m_fields->GetMandatoryRowCount() )
796 DisplayError(
this, wxString::Format(
_(
"The first %d fields are mandatory." ),
806 selectedRows.Sort( [](
int* first,
int* second )
808 return *second - *first;
811 for(
int row : selectedRows )
816 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
843 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
867 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
908 if( selectedRows.empty() && curRow >= 0 && curRow < m_padGroupsGrid->GetNumberRows() )
909 selectedRows.Add( curRow );
911 for(
int ii = (
int) selectedRows.Count() - 1; ii >= 0; --ii )
913 int row = selectedRows.Item( ii );
915 curRow = std::min( curRow, row );
918 curRow = std::max( 0, curRow - 1 );
933 for(
int i = 0; i <
m_itemsGrid->GetNumberCols(); i++ )
988 textEntry->SelectAll();
1012 wxSize new_size = aEvent.GetSize();
1076 wxArrayInt selections;
1086 for(
int idx : selections )
1094 for(
int idx = selections.size() - 1; idx >= 0; --idx )
1106 wxArrayInt selections;
1113 for(
int idx : selections )
1117 while( tokenizer.HasMoreTokens() )
1119 if( wxString token = tokenizer.GetNextToken(); !token.IsEmpty() )
1124 for(
int idx = selections.size() - 1; idx >= 0; --idx )
1134 wxArrayInt selections;
1142 wxArrayInt selections;
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.
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.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
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...
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
void RemoveFile(const wxString &name, bool aErase=true)
Remove a file from the collection and frees the memory.
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.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
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.
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
EMBEDDED_FILES * GetLocalFiles()
bool TransferDataToWindow() override
std::vector< FP_3DMODEL > & GetModelList()
bool TransferDataToWindow() override
void AdjustGridColumnWidths()
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
int GetNumberRows() override
int GetMandatoryRowCount() const
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.
wxString GetValue(int aRow, int aCol) override
PRIVATE_LAYERS_GRID_TABLE(PCB_BASE_FRAME *aFrame)
wxGridCellAttr * m_layerColAttr
bool CanGetValueAs(int aRow, int aCol, const wxString &aTypeName) override
long GetValueAsLong(int aRow, int aCol) override
bool CanSetValueAs(int aRow, int aCol, const wxString &aTypeName) override
wxGridCellAttr * GetAttr(int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
int GetNumberRows() override
void SetValueAsLong(int aRow, int aCol, long aValue) override
~PRIVATE_LAYERS_GRID_TABLE()
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
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.
virtual long long int GetValue()
Return the current value in Internal Units.
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 void SetNegativeZero()
virtual double GetDoubleValue()
Return the current value in Internal Units.
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.
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
wxGridCellAttr * enhanceAttr(wxGridCellAttr *aInputAttr, int aRow, int aCol, wxGridCellAttr::wxAttrKind aKind)
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
This file is part of the common library.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
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:...
constexpr int mmToIU(double mm) const
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
Custom text control validator definitions.