65 forbiddenLayers.set(
Margin );
78 return aTypeName == wxGRID_VALUE_NUMBER;
84 return aTypeName == wxGRID_VALUE_NUMBER;
89 wxGridCellAttr::wxAttrKind )
104 return this->at( (
size_t) aRow );
110 wxFAIL_MSG(
wxString::Format( wxT(
"column %d doesn't hold a string value" ), aCol ) );
116 this->at( (
size_t) aRow ) =
ToLAYER_ID( (
int) aValue );
130 m_footprint( aFootprint ),
131 m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits ),
132 m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl,
133 m_SolderMaskMarginUnits ),
134 m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl,
135 m_SolderPasteMarginUnits ),
136 m_solderPasteRatio( aParent, m_PasteMarginRatioLabel, m_PasteMarginRatioCtrl,
137 m_PasteMarginRatioUnits ),
139 m_lastRequestedSize( 0, 0 )
141 SetEvtHandlerEnabled(
false );
170 [
this]( wxCommandEvent& aEvent )
175 [
this]( wxCommandEvent& aEvent )
180 m_itemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
191 infoFont.SetStyle( wxFONTSTYLE_ITALIC );
195 if(
static_cast<int>(
m_page ) >= 0 )
226 SetEvtHandlerEnabled(
true );
261 if( !wxDialog::TransferDataToWindow() )
277 FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
280 m_texts->push_back( *textItem );
299 wxGridTableMessage gridTableMessagesg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
327 if( !
group.IsEmpty() )
335 for(
int col = 0; col <
m_itemsGrid->GetNumberCols(); col++ )
347 col_size = std::max( col_size, GetTextExtent( board->
GetLayerName( layer ) ).x );
368 if( aFootprintName.IsEmpty() )
389 if( !DIALOG_SHIM::Validate() )
407 for(
size_t i = 2; i <
m_texts->size(); ++i )
411 if(
text.GetText().IsEmpty() )
451 if(
text.GetTextThickness() > maxPenWidth )
458 "It will be clamped." );
478 if( !DIALOG_SHIM::TransferDataFromWindow() )
509 std::vector<FP_TEXT*> items_to_remove;
518 if( i < m_texts->size() )
519 *textItem =
m_texts->at( i++ );
522 items_to_remove.push_back( textItem );
529 for(
FP_TEXT* item: items_to_remove )
533 item->DeleteStructure();
537 while( i < m_texts->size() )
541 view->
Add( newText );
547 privateLayers.set( layer );
556 case 1: attributes |=
FP_SMD;
break;
598 if( !
group.IsEmpty() )
606 fpList->insert( fpList->end(), panelList.begin(), panelList.end() );
608 commit.
Push(
_(
"Modify footprint properties" ) );
647 m_texts->push_back( textItem );
650 wxGridTableMessage msg(
m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
667 wxArrayInt selectedRows =
m_itemsGrid->GetSelectedRows();
669 if( selectedRows.empty() &&
m_itemsGrid->GetGridCursorRow() >= 0 )
670 selectedRows.push_back(
m_itemsGrid->GetGridCursorRow() );
672 if( selectedRows.empty() )
675 for(
int row : selectedRows )
679 DisplayError(
nullptr,
_(
"Reference and value are mandatory." ) );
685 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
687 for(
int row : selectedRows )
692 wxGridTableMessage msg(
m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
717 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
739 wxGridTableMessage msg(
m_privateLayers, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
776 if( selectedRows.empty() && curRow >= 0 && curRow < m_padGroupsGrid->GetNumberRows() )
777 selectedRows.Add( curRow );
779 for(
int ii = selectedRows.Count() - 1; ii >= 0; --ii )
781 int row = selectedRows.Item( ii );
783 curRow = std::min( curRow, row );
786 curRow = std::max( 0, curRow - 1 );
799 for(
int i = 1; i <
m_itemsGrid->GetNumberCols(); i++ )
849 textEntry->SelectAll();
871 wxSize new_size = aEvent.GetSize();
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
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
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
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)
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...
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetTextSize(const VECTOR2I &aNewSize)
void SetItalic(bool aItalic)
int GetNumberRows() override
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.
std::vector< FP_3DMODEL > & GetModelList()
bool TransferDataToWindow() override
void AdjustGridColumnWidths()
bool TransferDataFromWindow() override
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.
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
void SetValue(int aRow, int aCol, const wxString &aValue) override
int GetNumberRows() override
wxGridCellAttr * GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) 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)
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.
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 GetShownColumns()
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.
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)
wxFont GetInfoFont(wxWindow *aWindow)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Custom text control validator definitions.
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper