76 return aTypeName == wxGRID_VALUE_NUMBER;
82 return aTypeName == wxGRID_VALUE_NUMBER;
87 wxGridCellAttr::wxAttrKind aKind )
102 return this->at( (
size_t) aRow );
108 wxFAIL_MSG( wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
114 this->at( (
size_t) aRow ) =
ToLAYER_ID( (
int) aValue );
128 m_footprint( aFootprint ),
129 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
130 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
131 m_SolderMaskMarginUnits ),
132 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
133 m_SolderPasteMarginUnits ),
134 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
135 m_PasteMarginRatioUnits ),
137 m_lastRequestedSize( 0, 0 )
139 SetEvtHandlerEnabled(
false );
156 icon.CopyFromBitmap(
KiBitmap( BITMAPS::icon_modedit ) );
168 [
this]( wxCommandEvent& aEvent )
173 [
this]( wxCommandEvent& aEvent )
178 m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
189 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
193 if(
static_cast<int>(
m_page ) >= 0 )
196 if(
m_page == NOTEBOOK_PAGES::PAGE_GENERAL )
203 else if(
m_page == NOTEBOOK_PAGES::PAGE_CLEARANCES )
224 SetEvtHandlerEnabled(
true );
236 catch(
const std::runtime_error& e )
238 wxFAIL_MSG( e.what() );
258 m_NoteBook->SetSelection(
static_cast<int>( NOTEBOOK_PAGES::PAGE_3D_MODELS ) );
272 if( !wxDialog::TransferDataToWindow() )
287 wxGridTableMessage tmsg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
303 wxGridTableMessage gridTableMessagesg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
348 if( !
group.IsEmpty() )
356 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
368 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
371 col_size +=
KiROUND( 14 * GetDPIScaleFactor() ) + 12;
389 if( aFootprintName.IsEmpty() )
410 if( !DIALOG_SHIM::Validate() )
428 for(
size_t i = 0; i <
m_fields->size(); ++i )
433 if( field.
GetName(
false ).IsEmpty() )
480 "It will be clamped." );
500 if( !DIALOG_SHIM::TransferDataFromWindow() )
528 std::vector<PCB_FIELD*> items_to_remove;
534 if( i < m_fields->size() )
537 items_to_remove.push_back( field );
543 for(
PCB_TEXT* item : items_to_remove )
547 item->DeleteStructure();
552 while( i < m_fields->size() )
560 privateLayers.
set( layer );
569 case 1: attributes |=
FP_SMD;
break;
597 m_footprint->SetLocalClearance( m_netClearance.GetValue() );
599 if( m_solderMask.IsNull() )
600 m_footprint->SetLocalSolderMaskMargin( {} );
602 m_footprint->SetLocalSolderMaskMargin( m_solderMask.GetValue() );
604 if( m_solderPaste.IsNull() )
605 m_footprint->SetLocalSolderPasteMargin( {} );
607 m_footprint->SetLocalSolderPasteMargin( m_solderPaste.GetValue() );
609 if( m_solderPasteRatio.IsNull() )
610 m_footprint->SetLocalSolderPasteMarginRatio( {} );
612 m_footprint->SetLocalSolderPasteMarginRatio( m_solderPasteRatio.GetDoubleValue() / 100.0 );
614 switch( m_ZoneConnectionChoice->GetSelection() )
623 m_footprint->ClearNetTiePadGroups();
625 for(
int ii = 0; ii < m_padGroupsGrid->GetNumberRows(); ++ii )
627 wxString
group = m_padGroupsGrid->GetCellValue( ii, 0 );
629 if( !
group.IsEmpty() )
630 m_footprint->AddNetTiePadGroup(
group );
634 std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
635 std::vector<FP_3DMODEL>* fpList = &m_footprint->Models();
637 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
639 commit.Push(
_(
"Edit Footprint Properties" ) );
665 int fieldId = (int)
m_fields->size();
684 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
701 wxArrayInt selectedRows =
m_itemsGrid->GetSelectedRows();
703 if( selectedRows.empty() &&
m_itemsGrid->GetGridCursorRow() >= 0 )
704 selectedRows.push_back(
m_itemsGrid->GetGridCursorRow() );
706 if( selectedRows.empty() )
709 for(
int row : selectedRows )
713 DisplayError(
this, wxString::Format(
_(
"The first %d fields are mandatory." ),
723 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
725 for(
int row : selectedRows )
730 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
755 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
777 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
814 if( selectedRows.empty() && curRow >= 0 && curRow < m_padGroupsGrid->GetNumberRows() )
815 selectedRows.Add( curRow );
817 for(
int ii = selectedRows.Count() - 1; ii >= 0; --ii )
819 int row = selectedRows.Item( ii );
821 curRow = std::min( curRow, row );
824 curRow = std::max( 0, curRow - 1 );
837 for(
int i = 0; i <
m_itemsGrid->GetNumberCols(); i++ )
892 textEntry->SelectAll();
916 wxSize new_size = aEvent.GetSize();
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
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.
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.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
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)
VECTOR2I GetTextSize() const
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.
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
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.
const UTF8 & GetLibItemName() const
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
bool TransferDataToWindow() override
void AdjustGridColumnWidths()
bool TransferDataFromWindow() override
wxString m_FootprintTextShownColumns
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
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
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
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()
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 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 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)
Calculates 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, int aDisplayTime)
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 Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
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
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Custom text control validator definitions.
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper