KiCad PCB EDA Suite
DIALOG_FOOTPRINT_FP_EDITOR Class Reference

#include <dialog_edit_footprint_for_fp_editor.h>

Inheritance diagram for DIALOG_FOOTPRINT_FP_EDITOR:
DIALOG_FOOTPRINT_FP_EDITOR_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_FOOTPRINT_FP_EDITOR (FOOTPRINT_EDIT_FRAME *aParent, MODULE *aModule)
 
 ~DIALOG_FOOTPRINT_FP_EDITOR () override
 
bool Validate () override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS_T GetUserUnits () const override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

virtual void OnInitDlg (wxInitDialogEvent &event)
 
void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxNotebook * m_NoteBook
 
wxPanel * m_PanelGeneral
 
WX_GRIDm_itemsGrid
 
wxBitmapButton * m_bpAdd
 
wxBitmapButton * m_bpDelete
 
wxTextCtrl * m_FootprintNameCtrl
 
wxTextCtrl * m_DocCtrl
 
wxStaticText * staticKeywordsLabel
 
wxTextCtrl * m_KeywordCtrl
 
wxRadioBox * m_AutoPlaceCtrl
 
wxStaticBoxSizer * m_sizerAP
 
wxBoxSizer * m_sizerAllow90
 
wxStaticText * m_allow90Label
 
wxSlider * m_CostRot90Ctrl
 
wxBoxSizer * m_sizerAllow180
 
wxStaticText * m_allow180Label
 
wxSlider * m_CostRot180Ctrl
 
wxRadioBox * m_AttributsCtrl
 
wxPanel * m_PanelClearances
 
wxStaticText * m_staticTextInfo
 
wxStaticText * m_staticTextInfoValPos
 
wxStaticText * m_staticTextInfoValNeg
 
wxStaticText * m_NetClearanceLabel
 
wxTextCtrl * m_NetClearanceCtrl
 
wxStaticText * m_NetClearanceUnits
 
wxStaticText * m_SolderMaskMarginLabel
 
wxTextCtrl * m_SolderMaskMarginCtrl
 
wxStaticText * m_SolderMaskMarginUnits
 
wxStaticText * m_SolderPasteMarginLabel
 
wxTextCtrl * m_SolderPasteMarginCtrl
 
wxStaticText * m_SolderPasteMarginUnits
 
wxStaticText * m_staticTextRatio
 
TEXT_CTRL_EVALm_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxStaticText * m_staticTextInfoCopper
 
wxStaticText * m_staticText16
 
wxChoice * m_ZoneConnectionChoice
 
wxPanel * m_Panel3D
 
wxBoxSizer * bSizerMain3D
 
WX_GRIDm_modelsGrid
 
wxBitmapButton * m_button3DShapeAdd
 
wxBitmapButton * m_button3DShapeBrowse
 
wxBitmapButton * m_button3DShapeRemove
 
wxButton * m_buttonConfig3DPaths
 
wxBoxSizer * bLowerSizer3D
 
wxStdDialogButtonSizer * m_sdbSizerStdButtons
 
wxButton * m_sdbSizerStdButtonsOK
 
wxButton * m_sdbSizerStdButtonsCancel
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void On3DModelSelected (wxGridEvent &) override
 
void On3DModelCellChanged (wxGridEvent &aEvent) override
 
void OnRemove3DModel (wxCommandEvent &event) override
 
void OnAdd3DModel (wxCommandEvent &event) override
 
void OnAdd3DRow (wxCommandEvent &event) override
 
void Cfg3DPath (wxCommandEvent &event) override
 
void OnGridSize (wxSizeEvent &event) override
 
void OnFootprintNameKillFocus (wxFocusEvent &event) override
 
void OnFootprintNameText (wxCommandEvent &event) override
 
void OnGridCellChanging (wxGridEvent &event)
 
void OnAddField (wxCommandEvent &event) override
 
void OnDeleteField (wxCommandEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
bool checkFootprintName (const wxString &aFootprintName)
 
void select3DModel (int aModelIdx)
 
void adjustGridColumns (int aWidth)
 

Private Attributes

wxConfigBase * m_config
 
FOOTPRINT_EDIT_FRAMEm_frame
 
MODULEm_footprint
 
TEXT_MOD_GRID_TABLEm_texts
 
UNIT_BINDER m_netClearance
 
UNIT_BINDER m_solderMask
 
UNIT_BINDER m_solderPaste
 
std::vector< MODULE_3D_SETTINGSm_shapes3D_list
 
PANEL_PREV_3Dm_PreviewPane
 
wxControl * m_delayedFocusCtrl
 
int m_delayedFocusPage
 
WX_GRIDm_delayedFocusGrid
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
wxString m_delayedErrorMessage
 
bool m_inSelect
 

Static Private Attributes

static int m_page = 0
 

Detailed Description

Definition at line 39 of file dialog_edit_footprint_for_fp_editor.h.

Constructor & Destructor Documentation

◆ DIALOG_FOOTPRINT_FP_EDITOR()

DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR ( FOOTPRINT_EDIT_FRAME aParent,
MODULE aModule 
)

Definition at line 59 of file dialog_edit_footprint_for_fp_editor.cpp.

60  :
65  m_inSelect( false )
66 {
68 
69  m_frame = aParent;
70  m_footprint = aModule;
71 
73 
74  m_delayedErrorMessage = wxEmptyString;
75  m_delayedFocusCtrl = nullptr;
76  m_delayedFocusGrid = nullptr;
77  m_delayedFocusRow = -1;
79  m_delayedFocusPage = -1;
80 
81  // Give an icon
82  wxIcon icon;
83  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
84  SetIcon( icon );
85 
86  // Give a bit more room for combobox editors
87  m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
88  m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
89 
91  m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
92  m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
93 
94  // Show/hide columns according to the user's preference
95  wxString shownColumns;
96  m_config->Read( LibFootprintTextShownColumnsKey, &shownColumns, wxT( "0 1 2 3 4 5 6" ) );
97  m_itemsGrid->ShowHideColumns( shownColumns );
98 
99  // Set up the 3D models grid
100  wxGridCellAttr* attr = new wxGridCellAttr;
101  attr->SetRenderer( new wxGridCellBoolRenderer() );
102  attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
103  attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
104  m_modelsGrid->SetColAttr( 1, attr );
105  m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
106 
107  aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
108 
110 
111  bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );
112 
114 
115  // Set font sizes
116  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
117  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
118  m_allow90Label->SetFont( infoFont );
119  m_allow180Label->SetFont( infoFont );
120  m_staticTextInfoValNeg->SetFont( infoFont );
121  m_staticTextInfoValPos->SetFont( infoFont );
122  m_staticTextInfoCopper->SetFont( infoFont );
123 
124  if( m_page >= 0 )
125  m_NoteBook->SetSelection( (unsigned) m_page );
126 
127  if( m_page == 0 )
128  {
130  m_delayedFocusRow = 0;
132  m_delayedFocusPage = 0;
133  }
134  else if ( m_page == 1 )
136  else
137  {
139  m_delayedFocusRow = 0;
141  m_delayedFocusPage = 2;
142  }
143 
144  m_sdbSizerStdButtonsOK->SetDefault();
145 
146  // Configure button logos
147  m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
148  m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
149  m_button3DShapeAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
150  m_button3DShapeBrowse->SetBitmap( KiBitmap( folder_xpm ) );
151  m_button3DShapeRemove->SetBitmap( KiBitmap( trash_xpm ) );
152 
153  // wxFormBuilder doesn't include this event...
154  m_itemsGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_FOOTPRINT_FP_EDITOR::OnGridCellChanging ), NULL, this );
155 
157 }
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:119
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GR...
Definition: grid_tricks.h:51
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
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...
Definition: wx_grid.cpp:57
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:116
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
Class FILE_NAME_CHAR_VALIDATOR.
Definition: validators.h:63
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define LibFootprintTextShownColumnsKey
DIALOG_FOOTPRINT_FP_EDITOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Footprint Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
EDA_UNITS_T m_units
Definition: dialog_shim.h:173
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References DIALOG_FOOTPRINT_FP_EDITOR_BASE::bLowerSizer3D, DIALOG_SHIM::FinishDialogSettings(), KiBitmap(), Kiface(), KIFACE_I::KifaceSettings(), LibFootprintTextShownColumnsKey, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_allow180Label, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_allow90Label, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_bpAdd, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_bpDelete, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeAdd, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeBrowse, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeRemove, m_config, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusCtrl, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, m_footprint, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, m_frame, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NetClearanceCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NoteBook, m_page, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_Panel3D, m_PreviewPane, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sdbSizerStdButtonsOK, m_shapes3D_list, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoCopper, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoValNeg, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoValPos, m_texts, DIALOG_SHIM::m_units, OnGridCellChanging(), Pgm(), KIWAY_HOLDER::Prj(), DIALOG_SHIM::SetInitialFocus(), WX_GRID::SetTable(), and WX_GRID::ShowHideColumns().

◆ ~DIALOG_FOOTPRINT_FP_EDITOR()

DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR ( )
override

Definition at line 160 of file dialog_edit_footprint_for_fp_editor.cpp.

161 {
163 
164  // Prevents crash bug in wxGrid's d'tor
166 
167  m_itemsGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_FOOTPRINT_FP_EDITOR::OnGridCellChanging ), NULL, this );
168 
169  // Delete the GRID_TRICKS.
170  m_itemsGrid->PopEventHandler( true );
171  m_modelsGrid->PopEventHandler( true );
172 
173  // free the memory used by all models, otherwise models which were
174  // browsed but not used would consume memory
175  Prj().Get3DCacheManager()->FlushCache( false );
176 
177  // the GL canvas has to be visible before it is destroyed
178  m_page = m_NoteBook->GetSelection();
179  m_NoteBook->SetSelection( 1 );
180 
181  delete m_PreviewPane;
182 }
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
Definition: wx_grid.cpp:88
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define LibFootprintTextShownColumnsKey
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:101

References WX_GRID::DestroyTable(), WX_GRID::GetShownColumns(), LibFootprintTextShownColumnsKey, m_config, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NoteBook, m_page, m_PreviewPane, m_texts, OnGridCellChanging(), and KIWAY_HOLDER::Prj().

Member Function Documentation

◆ adjustGridColumns()

void DIALOG_FOOTPRINT_FP_EDITOR::adjustGridColumns ( int  aWidth)
private

Definition at line 773 of file dialog_edit_footprint_for_fp_editor.cpp.

774 {
775  // Account for scroll bars
776  int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
777  int modelsWidth = aWidth - ( m_modelsGrid->GetSize().x - m_modelsGrid->GetClientSize().x );
778 
779  itemsWidth -= m_itemsGrid->GetRowLabelSize();
780 
781  for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
782  itemsWidth -= m_itemsGrid->GetColSize( i );
783 
784  if( itemsWidth > 0 )
785  m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
786  m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
787 
788  m_modelsGrid->SetColSize( 0, modelsWidth - m_modelsGrid->GetColSize( 1 ) - 5 );
789 }
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.
Definition: wx_grid.cpp:223
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597

References WX_GRID::GetVisibleWidth(), i, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, and max.

Referenced by OnGridSize(), OnUpdateUI(), and TransferDataToWindow().

◆ Cfg3DPath()

void DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 766 of file dialog_edit_footprint_for_fp_editor.cpp.

767 {
768  if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
770 }
void UpdateDummyModule(bool aRelaodRequired=true)
UpdateModelInfoList - copy shapes from the current shape list which are flagged for preview to the co...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool Configure3DPaths(wxWindow *aParent, FILENAME_RESOLVER *aResolver)

References S3D::Configure3DPaths(), m_PreviewPane, KIWAY_HOLDER::Prj(), and PANEL_PREV_3D::UpdateDummyModule().

◆ checkFootprintName()

bool DIALOG_FOOTPRINT_FP_EDITOR::checkFootprintName ( const wxString &  aFootprintName)
private

Definition at line 490 of file dialog_edit_footprint_for_fp_editor.cpp.

491 {
492  if( aFootprintName.IsEmpty() || !MODULE::IsLibNameValid( aFootprintName ) )
493  {
494  if( aFootprintName.IsEmpty() )
495  m_delayedErrorMessage = _( "Footprint must have a name." );
496  else
497  m_delayedErrorMessage.Printf( _( "Footprint name may not contain \"%s\"." ),
499 
500  return false;
501  }
502 
503  return true;
504 }
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
static function StringLibNameInvalidChars Test for validity of the name in a library of the footprint...
static bool IsLibNameValid(const wxString &aName)
static function IsLibNameValid Test for validity of a name of a footprint to be used in a footprint l...

References MODULE::IsLibNameValid(), m_delayedErrorMessage, and MODULE::StringLibNameInvalidChars().

Referenced by OnFootprintNameKillFocus(), OnGridCellChanging(), and Validate().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 230 of file dialog_shim.cpp.

231 {
232  // so we can do logging of this state change:
233 
234 #if defined(DEBUG)
235  const char* type_id = typeid( *this ).name();
236  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
237  fflush(0); //Needed on msys2 to immediately print the message
238 #endif
239 
240  return wxDialog::Enable( enable );
241 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 391 of file dialog_shim.cpp.

392 {
393  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
394  // handle validation in the same way as other dialogs.
395  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
396  return;
397 
398  SetReturnCode( retCode );
399 
400  if( !IsQuasiModal() )
401  {
402  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
403  return;
404  }
405 
406  if( m_qmodal_loop )
407  {
408  if( m_qmodal_loop->IsRunning() )
409  m_qmodal_loop->Exit( 0 );
410  else
411  m_qmodal_loop->ScheduleExit( 0 );
412 
413  m_qmodal_loop = NULL;
414  }
415 
418 
419  Show( false );
420 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:183
bool IsQuasiModal()
Definition: dialog_shim.h:125
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:185

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ FinishDialogSettings()

void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 129 of file dialog_shim.cpp.

130 {
131  // must be called from the constructor of derived classes,
132  // when all widgets are initialized, and therefore their size fixed
133 
134  // SetSizeHints fixes the minimal size of sizers in the dialog
135  // (SetSizeHints calls Fit(), so no need to call it)
136  GetSizer()->SetSizeHints( this );
137 
138  // the default position, when calling the first time the dlg
139  Center();
140 }

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXIT::DIALOG_EXIT(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

◆ GetUserUnits()

◆ HorizPixelsFromDU()

int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 150 of file dialog_shim.cpp.

151 {
152  wxSize sz( x, 0 );
153  return ConvertDialogToPixels( sz ).x;
154 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT().

◆ IsQuasiModal()

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), SCH_EDIT_FRAME::doUpdatePcb(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ On3DModelCellChanged()

void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged ( wxGridEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 346 of file dialog_edit_footprint_for_fp_editor.cpp.

347 {
348  if( aEvent.GetCol() == 0 )
349  {
350  bool hasAlias = false;
351  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
352  wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
353 
354  if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
355  {
356  m_delayedErrorMessage = wxString::Format( _( "Invalid filename: %s" ), filename );
358  m_delayedFocusRow = aEvent.GetRow();
359  m_delayedFocusColumn = aEvent.GetCol();
360  m_delayedFocusPage = 2;
361  aEvent.Veto();
362  }
363 
364  // if the user has specified an alias in the name then prepend ':'
365  if( hasAlias )
366  filename.insert( 0, wxT( ":" ) );
367 
368 #ifdef __WINDOWS__
369  // In Kicad files, filenames and paths are stored using Unix notation
370  filename.Replace( wxT( "\\" ), wxT( "/" ) );
371 #endif
372 
373  m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
374  }
375  else if( aEvent.GetCol() == 1 )
376  {
377  wxString previewValue = m_modelsGrid->GetCellValue( aEvent.GetRow(), 1 );
378 
379  m_shapes3D_list[ aEvent.GetRow() ].m_Preview = previewValue == wxT( "1" );
380  }
381 
383 }
void UpdateDummyModule(bool aRelaodRequired=true)
UpdateModelInfoList - copy shapes from the current shape list which are flagged for preview to the co...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool ValidateFileName(const wxString &aFileName, bool &hasAlias)
Function ValidateName returns true if the given path is a valid aliased relative path.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References Format(), m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, m_PreviewPane, m_shapes3D_list, KIWAY_HOLDER::Prj(), PANEL_PREV_3D::UpdateDummyModule(), and FILENAME_RESOLVER::ValidateFileName().

◆ On3DModelSelected()

void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelSelected ( wxGridEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 339 of file dialog_edit_footprint_for_fp_editor.cpp.

340 {
341  if( !m_inSelect )
342  select3DModel( aEvent.GetRow() );
343 }

References m_inSelect, and select3DModel().

◆ OnAdd3DModel()

void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 404 of file dialog_edit_footprint_for_fp_editor.cpp.

405 {
407  return;
408 
409  PROJECT& prj = Prj();
410  MODULE_3D_SETTINGS model;
411 
412  wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
413  wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
414  int filter = 0;
415 
416  // If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
417  // varaible and fall back to the project path if necessary.
418  if( initialpath.IsEmpty() )
419  {
420  if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
421  initialpath = prj.GetProjectPath();
422  }
423 
424  if( !sidx.empty() )
425  {
426  long tmp;
427  sidx.ToLong( &tmp );
428 
429  if( tmp > 0 && tmp <= INT_MAX )
430  filter = (int) tmp;
431  }
432 
433  if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
434  || model.m_Filename.empty() )
435  {
436  return;
437  }
438 
439  prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
440  sidx = wxString::Format( wxT( "%i" ), filter );
442  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
443  wxString alias;
444  wxString shortPath;
445  wxString filename = model.m_Filename;
446 
447  if( res && res->SplitAlias( filename, alias, shortPath ) )
448  filename = alias + wxT( ":" ) + shortPath;
449 
450 #ifdef __WINDOWS__
451  // In Kicad files, filenames and paths are stored using Unix notation
452  model.m_Filename.Replace( "\\", "/" );
453 #endif
454 
455  model.m_Preview = true;
456  m_shapes3D_list.push_back( model );
457 
458  int idx = m_modelsGrid->GetNumberRows();
459  m_modelsGrid->AppendRows( 1 );
460  m_modelsGrid->SetCellValue( idx, 0, filename );
461  m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
462 
464 }
Class PROJECT holds project specific data.
Definition: project.h:57
void UpdateDummyModule(bool aRelaodRequired=true)
UpdateModelInfoList - copy shapes from the current shape list which are flagged for preview to the co...
bool m_Preview
Include module in 3D preview.
Definition: class_module.h:103
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Function SplitAlias returns true if the given name contains an alias and populates the string anAlias...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:102
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:171
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:186
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, MODULE_3D_SETTINGS *aModel)
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References WX_GRID::CommitPendingChanges(), Format(), PROJECT::GetProjectPath(), PROJECT::GetRString(), MODULE_3D_SETTINGS::m_Filename, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, MODULE_3D_SETTINGS::m_Preview, m_PreviewPane, m_shapes3D_list, KIWAY_HOLDER::Prj(), S3D::Select3DModel(), PROJECT::SetRString(), FILENAME_RESOLVER::SplitAlias(), PANEL_PREV_3D::UpdateDummyModule(), PROJECT::VIEWER_3D_FILTER_INDEX, and PROJECT::VIEWER_3D_PATH.

◆ OnAdd3DRow()

void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 467 of file dialog_edit_footprint_for_fp_editor.cpp.

468 {
470  return;
471 
472  MODULE_3D_SETTINGS model;
473 
474  model.m_Preview = true;
475  m_shapes3D_list.push_back( model );
476 
477  int row = m_modelsGrid->GetNumberRows();
478  m_modelsGrid->AppendRows( 1 );
479  m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
480 
481  m_modelsGrid->SetFocus();
482  m_modelsGrid->MakeCellVisible( row, 0 );
483  m_modelsGrid->SetGridCursor( row, 0 );
484 
485  m_modelsGrid->EnableCellEditControl( true );
486  m_modelsGrid->ShowCellEditControl();
487 }
bool m_Preview
Include module in 3D preview.
Definition: class_module.h:103
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References WX_GRID::CommitPendingChanges(), DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, MODULE_3D_SETTINGS::m_Preview, and m_shapes3D_list.

◆ OnAddField()

void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 704 of file dialog_edit_footprint_for_fp_editor.cpp.

705 {
707  return;
708 
709  const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
710  TEXTE_MODULE textMod( m_footprint );
711 
712  // Set active layer if legal; otherwise copy layer from previous text item
713  if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
714  textMod.SetLayer( m_frame->GetActiveLayer() );
715  else
716  textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
717 
718  textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
719  textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
720  textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
721 
722  m_texts->push_back( textMod );
723 
724  // notify the grid
725  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
726  m_itemsGrid->ProcessTableMessage( msg );
727 
728  m_itemsGrid->SetFocus();
729  m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
730  m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
731 
732  m_itemsGrid->EnableCellEditControl( true );
733  m_itemsGrid->ShowCellEditControl();
734 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
int GetTextThickness(PCB_LAYER_ID aLayer) const
Function GetTextThickness Returns the default text thickness from the layer class for the given layer...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:746
bool GetTextItalic(PCB_LAYER_ID aLayer) const
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
static bool GetLayer(MODEL_VRML &aModel, LAYER_NUM layer, VRML_LAYER **vlayer)
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Function GetTextSize Returns the default text size from the layer class for the given layer.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References LSET::AllTechMask(), WX_GRID::CommitPendingChanges(), PCB_BASE_FRAME::GetActiveLayer(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), BOARD_ITEM::GetLayer(), GetLayer(), BOARD_DESIGN_SETTINGS::GetTextItalic(), BOARD_DESIGN_SETTINGS::GetTextSize(), BOARD_DESIGN_SETTINGS::GetTextThickness(), m_footprint, m_frame, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, m_texts, EDA_TEXT::SetItalic(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetTextSize(), and EDA_TEXT::SetThickness().

◆ OnDeleteField()

void DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 737 of file dialog_edit_footprint_for_fp_editor.cpp.

738 {
740  return;
741 
742  int curRow = m_itemsGrid->GetGridCursorRow();
743 
744  if( curRow < 0 )
745  return;
746  else if( curRow < 2 )
747  {
748  DisplayError( nullptr, _( "Reference and value are mandatory." ) );
749  return;
750  }
751 
752  m_texts->erase( m_texts->begin() + curRow );
753 
754  // notify the grid
755  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
756  m_itemsGrid->ProcessTableMessage( msg );
757 
758  if( m_itemsGrid->GetNumberRows() > 0 )
759  {
760  m_itemsGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
761  m_itemsGrid->SetGridCursor( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
762  }
763 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
#define max(a, b)
Definition: auxiliary.h:86
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243

References WX_GRID::CommitPendingChanges(), DisplayError(), DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, m_texts, and max.

◆ OnFootprintNameKillFocus()

void DIALOG_FOOTPRINT_FP_EDITOR::OnFootprintNameKillFocus ( wxFocusEvent &  event)
overrideprivatevirtual

◆ OnFootprintNameText()

void DIALOG_FOOTPRINT_FP_EDITOR::OnFootprintNameText ( wxCommandEvent &  event)
overrideprivatevirtual

◆ OnGridCellChanging()

void DIALOG_FOOTPRINT_FP_EDITOR::OnGridCellChanging ( wxGridEvent &  event)
private

Definition at line 657 of file dialog_edit_footprint_for_fp_editor.cpp.

658 {
659  if( event.GetRow() == 1 && event.GetCol() == TMC_TEXT )
660  {
661  if( !checkFootprintName( event.GetString() ) )
662  {
663  event.Veto();
664 
665  if( m_NoteBook->GetSelection() != 0 )
666  m_NoteBook->SetSelection( 0 );
667 
669  m_delayedFocusRow = event.GetRow();
670  m_delayedFocusColumn = event.GetCol();
671  m_delayedFocusPage = 0;
672  }
673  else if( !footprintIsFromBoard( m_footprint ) )
674  {
675  // Keep Name and Value of footprints in library in sync
676  m_FootprintNameCtrl->ChangeValue( event.GetString() );
677  }
678  }
679 }
static bool footprintIsFromBoard(MODULE *aFootprint)
bool checkFootprintName(const wxString &aFootprintName)

References checkFootprintName(), footprintIsFromBoard(), m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, m_footprint, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NoteBook, and TMC_TEXT.

Referenced by DIALOG_FOOTPRINT_FP_EDITOR(), and ~DIALOG_FOOTPRINT_FP_EDITOR().

◆ OnGridSize()

void DIALOG_FOOTPRINT_FP_EDITOR::OnGridSize ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 859 of file dialog_edit_footprint_for_fp_editor.cpp.

860 {
861  adjustGridColumns( event.GetSize().GetX());
862 
863  event.Skip();
864 }

References adjustGridColumns().

◆ OnInitDlg()

virtual void DIALOG_FOOTPRINT_FP_EDITOR_BASE::OnInitDlg ( wxInitDialogEvent &  event)
inlineprotectedvirtualinherited

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 293 of file dialog_shim.cpp.

294 {
295  if( m_firstPaintEvent )
296  {
297 #ifdef __WXMAC__
298  fixOSXCancelButtonIssue( this );
299  selectAllInTextCtrls( GetChildren() );
300 #endif
301 
303  m_initialFocusTarget->SetFocus();
304  else
305  SetFocus(); // Focus the dialog itself
306 
307  m_firstPaintEvent = false;
308  }
309 
310  event.Skip();
311 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:180
bool m_firstPaintEvent
Definition: dialog_shim.h:179

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnRemove3DModel()

void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 386 of file dialog_edit_footprint_for_fp_editor.cpp.

387 {
389  return;
390 
391  int idx = m_modelsGrid->GetGridCursorRow();
392 
393  if( idx >= 0 )
394  {
395  m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
396  m_modelsGrid->DeleteRows( idx );
397 
398  select3DModel( idx-1 ); // will clamp idx within bounds
400  }
401 }
void UpdateDummyModule(bool aRelaodRequired=true)
UpdateModelInfoList - copy shapes from the current shape list which are flagged for preview to the co...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References WX_GRID::CommitPendingChanges(), DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, m_PreviewPane, m_shapes3D_list, select3DModel(), and PANEL_PREV_3D::UpdateDummyModule().

◆ OnUpdateUI()

void DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_FP_EDITOR_BASE.

Definition at line 792 of file dialog_edit_footprint_for_fp_editor.cpp.

793 {
794  if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
795  adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
796 
797  if( m_itemsGrid->IsCellEditControlShown() )
798  {
799  int row = m_itemsGrid->GetGridCursorRow();
800  int col = m_itemsGrid->GetGridCursorCol();
801 
802  if( row == 1 && col == TMC_TEXT )
803  {
804  wxGridCellEditor* editor = m_itemsGrid->GetCellEditor( row, col );
805  m_FootprintNameCtrl->ChangeValue( editor->GetValue() );
806  editor->DecRef();
807  }
808  }
809 
810  // Handle a delayed focus. The delay allows us to:
811  // a) change focus when the error was triggered from within a killFocus handler
812  // b) show the correct notebook page in the background before the error dialog comes up
813  // when triggered from an OK or a notebook page change
814 
815  if( m_delayedFocusPage >= 0 )
816  {
817  if( m_NoteBook->GetSelection() != m_delayedFocusPage )
818  m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage );
819 
820  m_delayedFocusPage = -1;
821  }
822 
823  if( !m_delayedErrorMessage.IsEmpty() )
824  {
825  // We will re-enter this routine when the error dialog is displayed, so make
826  // sure we don't keep putting up more dialogs.
827  wxString msg = m_delayedErrorMessage;
828  m_delayedErrorMessage = wxEmptyString;
829 
830  // Do not use DisplayErrorMessage(); it screws up window order on Mac
831  DisplayError( nullptr, msg );
832  }
833 
834  if( m_delayedFocusCtrl )
835  {
836  m_delayedFocusCtrl->SetFocus();
837 
838  if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
839  dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
840 
841  m_delayedFocusCtrl = nullptr;
842  }
843  else if( m_delayedFocusGrid )
844  {
845  m_delayedFocusGrid->SetFocus();
848 
849  m_delayedFocusGrid->EnableCellEditControl( true );
850  m_delayedFocusGrid->ShowCellEditControl();
851 
852  m_delayedFocusGrid = nullptr;
853  m_delayedFocusRow = -1;
855  }
856 }
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243

References adjustGridColumns(), DisplayError(), m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusCtrl, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NoteBook, and TMC_TEXT.

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doUpdatePcb(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLoadProject(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), SCH_EDIT_FRAME::OnPrint(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::PrintPage(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), ~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ select3DModel()

void DIALOG_FOOTPRINT_FP_EDITOR::select3DModel ( int  aModelIdx)
private

Definition at line 320 of file dialog_edit_footprint_for_fp_editor.cpp.

321 {
322  m_inSelect = true;
323 
324  aModelIdx = std::max( 0, aModelIdx );
325  aModelIdx = std::min( aModelIdx, m_modelsGrid->GetNumberRows() - 1 );
326 
327  if( m_modelsGrid->GetNumberRows() )
328  {
329  m_modelsGrid->SelectRow( aModelIdx );
330  m_modelsGrid->SetGridCursor( aModelIdx, 0 );
331  }
332 
333  m_PreviewPane->SetSelectedModel( aModelIdx );
334 
335  m_inSelect = false;
336 }
void SetSelectedModel(int idx)
SetModelDataIdx - Sets the currently selected index in the model list so that the scale/rotation/offs...
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85

References m_inSelect, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, m_PreviewPane, max, min, and PANEL_PREV_3D::SetSelectedModel().

Referenced by On3DModelSelected(), OnRemove3DModel(), and TransferDataToWindow().

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 116 of file dialog_shim.h.

117  {
118  m_initialFocusTarget = aWindow;
119  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:180

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), LIB_EDIT_FRAME::savePartAs(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 47 of file kiway_holder.cpp.

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61

References KIWAY_HOLDER::m_kiway, and name.

Referenced by InvokePcbLibTableEditor(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetSizeInDU()

void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 143 of file dialog_shim.cpp.

144 {
145  wxSize sz( x, y );
146  SetSize( ConvertDialogToPixels( sz ) );
147 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 171 of file dialog_shim.cpp.

172 {
173  bool ret;
174  const char* hash_key;
175 
176  if( m_hash_key.size() )
177  {
178  // a special case like EDA_LIST_DIALOG, which has multiple uses.
179  hash_key = m_hash_key.c_str();
180  }
181  else
182  {
183  hash_key = typeid(*this).name();
184  }
185 
186  // Show or hide the window. If hiding, save current position and size.
187  // If showing, use previous position and size.
188  if( show )
189  {
190 #ifndef __WINDOWS__
191  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
192 #endif
193  ret = wxDialog::Show( show );
194 
195  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
196  EDA_RECT savedDialogRect = class_map[ hash_key ];
197 
198  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
199  {
200  SetSize( savedDialogRect.GetPosition().x,
201  savedDialogRect.GetPosition().y,
202  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
203  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
204  0 );
205  }
206 
207  // Be sure that the dialog appears in a visible area
208  // (the dialog position might have been stored at the time when it was
209  // shown on another display)
210  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
211  Centre();
212  }
213  else
214  {
215  // Save the dialog's position & size before hiding, using classname as key
216  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
217 
218 #ifdef __WXMAC__
219  if ( m_eventLoop )
220  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
221 #endif
222 
223  ret = wxDialog::Show( show );
224  }
225 
226  return ret;
227 }
std::string m_hash_key
Definition: dialog_shim.h:174
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxSize GetSize() const
Definition: eda_rect.h:101

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, and max.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), SCH_EDIT_FRAME::OnFindItems(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 337 of file dialog_shim.cpp.

338 {
339  // This is an exception safe way to zero a pointer before returning.
340  // Yes, even though DismissModal() clears this first normally, this is
341  // here in case there's an exception before the dialog is dismissed.
342  struct NULLER
343  {
344  void*& m_what;
345  NULLER( void*& aPtr ) : m_what( aPtr ) {}
346  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
347  } clear_this( (void*&) m_qmodal_loop );
348 
349  // release the mouse if it's currently captured as the window having it
350  // will be disabled when this dialog is shown -- but will still keep the
351  // capture making it impossible to do anything in the modal dialog itself
352  wxWindow* win = wxWindow::GetCapture();
353  if( win )
354  win->ReleaseMouse();
355 
356  // Get the optimal parent
357  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
358 
359  // Show the optimal parent
360  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
361 
362  wxASSERT_MSG( !m_qmodal_parent_disabler,
363  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
364 
365  // quasi-modal: disable only my "optimal" parent
367 
368 #ifdef __WXMAC__
369  // Apple in its infinite wisdom will raise a disabled window before even passing
370  // us the event, so we have no way to stop it. Instead, we must set an order on
371  // the windows so that the quasi-modal will be pushed in front of the disabled
372  // window when it is raised.
373  ReparentQuasiModal();
374 #endif
375  Show( true );
376 
377  m_qmodal_showing = true;
378 
379  WX_EVENT_LOOP event_loop;
380 
381  m_qmodal_loop = &event_loop;
382 
383  event_loop.Run();
384 
385  m_qmodal_showing = false;
386 
387  return GetReturnCode();
388 }
bool m_qmodal_showing
Definition: dialog_shim.h:184
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:183
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:185
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:34
#define DBG(x)
Definition: fctsys.h:33

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

◆ TransferDataFromWindow()

bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow ( )
override

Definition at line 555 of file dialog_edit_footprint_for_fp_editor.cpp.

556 {
557  if( !Validate() )
558  return false;
559 
560  if( !DIALOG_SHIM::TransferDataFromWindow() )
561  return false;
562 
563  if( !m_PanelGeneral->TransferDataFromWindow() )
564  return false;
565 
566  if( !m_Panel3D->TransferDataFromWindow() )
567  return false;
568 
569  auto view = m_frame->GetGalCanvas()->GetView();
570  BOARD_COMMIT commit( m_frame );
571  commit.Modify( m_footprint );
572 
573  LIB_ID fpID = m_footprint->GetFPID();
574  fpID.SetLibItemName( m_FootprintNameCtrl->GetValue(), false );
575  m_footprint->SetFPID( fpID );
576 
577  m_footprint->SetDescription( m_DocCtrl->GetValue() );
578  m_footprint->SetKeywords( m_KeywordCtrl->GetValue() );
579 
580  // copy reference and value
581  m_footprint->Reference() = m_texts->at( 0 );
582  m_footprint->Value() = m_texts->at( 1 );
583 
584  size_t i = 2;
585  for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
586  {
587  TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );
588 
589  if( textModule )
590  {
591  // copy grid table entries till we run out, then delete any remaining texts
592  if( i < m_texts->size() )
593  *textModule = m_texts->at( i++ );
594  else
595  textModule->DeleteStructure();
596  }
597  }
598 
599  // if there are still grid table entries, create new texts for them
600  while( i < m_texts->size() )
601  {
602  auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
603  m_footprint->Add( newText, ADD_APPEND );
604  view->Add( newText );
605  }
606 
607  m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
608 
609  switch( m_AttributsCtrl->GetSelection() )
610  {
611  case 0: m_footprint->SetAttributes( 0 ); break;
612  case 1: m_footprint->SetAttributes( MOD_CMS ); break;
613  case 2: m_footprint->SetAttributes( MOD_VIRTUAL ); break;
614  default: wxFAIL;
615  }
616 
619 
620  // Initialize masks clearances
624 
625  double dtmp = 0.0;
626  wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
627  msg.ToDouble( &dtmp );
628 
629  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
630  if( dtmp < -50.0 )
631  dtmp = -50.0;
632  // A margin ratio is always <= 0
633  // 0 means use full pad copper area
634  if( dtmp > 0.0 )
635  dtmp = 0.0;
636 
638 
639  std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models();
640  draw3D->clear();
641  draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
642 
644 
645  commit.Push( _( "Modify module properties" ) );
646 
647  return true;
648 }
void SetPlacementCost90(int aCost)
Definition: class_module.h:574
TEXTE_MODULE & Reference()
Definition: class_module.h:503
void SetLocalClearance(int aClearance)
Definition: class_module.h:208
void SetPlacementCost180(int aCost)
Definition: class_module.h:571
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:76
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one.
const LIB_ID & GetFPID() const
Definition: class_module.h:192
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_module.h:214
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:502
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:163
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_module.h:205
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:206
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_module.h:211
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:178
BOARD_ITEM * Next() const
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:277
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Virtual component: when created by copper shapes on board (Like edge card connectors,...
Definition: class_module.h:78
size_t i
Definition: json11.cpp:597
void SetKeywords(const wxString &aKeywords)
Definition: class_module.h:199
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
void SetFPID(const LIB_ID &aFPID)
Definition: class_module.h:193
void SetAttributes(int aAttributes)
Definition: class_module.h:226
void SetDescription(const wxString &aDoc)
Definition: class_module.h:196
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References MODULE::Add(), ADD_APPEND, MODULE::CalculateBoundingBox(), BOARD_ITEM::DeleteStructure(), DLIST< T >::GetFirst(), MODULE::GetFPID(), EDA_DRAW_FRAME::GetGalCanvas(), UNIT_BINDER::GetValue(), EDA_DRAW_PANEL_GAL::GetView(), MODULE::GraphicalItemsList(), i, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AttributsCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot90Ctrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_DocCtrl, m_footprint, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, m_frame, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_KeywordCtrl, m_netClearance, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_Panel3D, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_PanelGeneral, m_shapes3D_list, m_solderMask, m_solderPaste, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, m_texts, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), COMMIT::Modify(), BOARD_ITEM::Next(), BOARD_COMMIT::Push(), MODULE::Reference(), MODULE::SetAttributes(), MODULE::SetDescription(), MODULE::SetFPID(), MODULE::SetKeywords(), LIB_ID::SetLibItemName(), MODULE::SetLocalClearance(), MODULE::SetLocalSolderMaskMargin(), MODULE::SetLocalSolderPasteMargin(), MODULE::SetLocalSolderPasteMarginRatio(), MODULE::SetLocked(), MODULE::SetPlacementCost180(), MODULE::SetPlacementCost90(), Validate(), and MODULE::Value().

◆ TransferDataToWindow()

bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow ( )
override

Definition at line 185 of file dialog_edit_footprint_for_fp_editor.cpp.

186 {
187  LIB_ID fpID = m_footprint->GetFPID();
188  wxString footprintName = fpID.GetLibItemName();
189 
190  m_FootprintNameCtrl->ChangeValue( footprintName );
191 
192  m_DocCtrl->SetValue( m_footprint->GetDescription() );
193  m_KeywordCtrl->SetValue( m_footprint->GetKeywords() );
194 
195  if( !wxDialog::TransferDataToWindow() )
196  return false;
197 
198  if( !m_PanelGeneral->TransferDataToWindow() )
199  return false;
200 
201  if( !m_Panel3D->TransferDataToWindow() )
202  return false;
203 
204  // Module Texts
205 
206  m_texts->push_back( m_footprint->Reference() );
207  m_texts->push_back( m_footprint->Value() );
208 
209  for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
210  {
211  auto textModule = dyn_cast<TEXTE_MODULE*>( item );
212 
213  if( textModule )
214  m_texts->push_back( *textModule );
215  }
216 
217  // notify the grid
218  wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
219  m_itemsGrid->ProcessTableMessage( tmsg );
220 
221  // Module Properties
222 
223  m_AutoPlaceCtrl->SetSelection( (m_footprint->IsLocked()) ? 1 : 0 );
224  m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Enable hotkey move commands and Auto Placement" ) );
225  m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Disable hotkey move commands and Auto Placement" ) );
226 
229 
230  m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD footprints\n"
231  "Footprints with this option are not put in the footprint position list file" ) );
232  m_AttributsCtrl->SetItemToolTip( 1, _( "Use this attribute for SMD footprints.\n"
233  "Only footprints with this option are put in the footprint position list file" ) );
234  m_AttributsCtrl->SetItemToolTip( 2, _( "Use this attribute for \"virtual\" footprints drawn on board\n"
235  "such as an edge connector (old ISA PC bus for instance)" ) );
236 
237  switch( m_footprint->GetAttributes() & 255 )
238  {
239  case MOD_CMS: m_AttributsCtrl->SetSelection( 1 ); break;
240  case MOD_VIRTUAL: m_AttributsCtrl->SetSelection( 2 ); break;
241  case 0:
242  default: m_AttributsCtrl->SetSelection( 0 ); break;
243  }
244 
245  // Local Clearances
246 
250 
251  // Prefer "-0" to "0" for normally negative values
253  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
254 
255  // Add solder paste margin ratio in percent
256  // for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
257  wxString msg;
258  msg.Printf( wxT( "%f" ), m_footprint->GetLocalSolderPasteMarginRatio() * 100.0 );
259 
261  msg[0] == '0') // Sometimes Printf adds a sign if the value is very small (0.0)
262  m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
263  else
265 
266  // 3D Settings
267 
268  wxString default_path;
269  wxGetEnv( KISYS3DMOD, &default_path );
270 #ifdef __WINDOWS__
271  default_path.Replace( wxT( "/" ), wxT( "\\" ) );
272 #endif
273 
274  m_shapes3D_list.clear();
275  m_modelsGrid->DeleteRows( 0, m_modelsGrid->GetNumberRows() );
276 
277  wxString origPath, alias, shortPath;
278  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
279 
280  for( MODULE_3D_SETTINGS model : m_footprint->Models() )
281  {
282  m_shapes3D_list.push_back( model );
283  origPath = model.m_Filename;
284 
285  if( res && res->SplitAlias( origPath, alias, shortPath ) )
286  origPath = alias + wxT( ":" ) + shortPath;
287 
288  m_modelsGrid->AppendRows( 1 );
289  int row = m_modelsGrid->GetNumberRows() - 1;
290  m_modelsGrid->SetCellValue( row, 0, origPath );
291  m_modelsGrid->SetCellValue( row, 1, model.m_Preview ? wxT( "1" ) : wxT( "0" ) );
292  }
293 
294  select3DModel( 0 ); // will clamp idx within bounds
295 
296  for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
297  {
298  // Adjust min size to the column label size
299  m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false, false ) );
300  // Adjust the column size. The column 6 has a small bitmap, so its width must be taken in account
301  int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
302 
303  if( col == 6 )
304  col_size += 20;
305 
306  if( m_itemsGrid->IsColShown( col ) )
307  m_itemsGrid->SetColSize( col, col_size );
308  }
309 
310  m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, true, true, true ) );
311  m_modelsGrid->SetColSize( 1, m_modelsGrid->GetVisibleWidth( 1, true, false, false ) );
312 
313  Layout();
314  adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
315 
316  return true;
317 }
int GetAttributes() const
Definition: class_module.h:225
int GetPlacementCost90() const
Definition: class_module.h:573
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
TEXTE_MODULE & Reference()
Definition: class_module.h:503
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:76
const LIB_ID & GetFPID() const
Definition: class_module.h:192
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int GetLocalSolderMaskMargin() const
Definition: class_module.h:204
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
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.
Definition: wx_grid.cpp:223
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Function SplitAlias returns true if the given name contains an alias and populates the string anAlias...
int GetLocalClearance() const
Definition: class_module.h:207
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:502
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define KISYS3DMOD
A variable name whose value holds the path of 3D shape files.
Definition: 3d_viewer.h:38
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:163
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:267
const wxString & GetKeywords() const
Definition: class_module.h:198
int GetLocalSolderPasteMargin() const
Definition: class_module.h:210
int GetPlacementCost180() const
Definition: class_module.h:570
const wxString & GetDescription() const
Definition: class_module.h:195
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:213
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:178
BOARD_ITEM * Next() const
Virtual component: when created by copper shapes on board (Like edge card connectors,...
Definition: class_module.h:78
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
int GetNumberRows() override
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

References adjustGridColumns(), MODULE::GetAttributes(), MODULE::GetDescription(), DLIST< T >::GetFirst(), MODULE::GetFPID(), MODULE::GetKeywords(), LIB_ID::GetLibItemName(), MODULE::GetLocalClearance(), MODULE::GetLocalSolderMaskMargin(), MODULE::GetLocalSolderPasteMargin(), MODULE::GetLocalSolderPasteMarginRatio(), TEXT_MOD_GRID_TABLE::GetNumberRows(), MODULE::GetPlacementCost180(), MODULE::GetPlacementCost90(), WX_GRID::GetVisibleWidth(), MODULE::GraphicalItemsList(), MODULE::IsLocked(), KISYS3DMOD, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AttributsCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot90Ctrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_DocCtrl, m_footprint, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_KeywordCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_modelsGrid, m_netClearance, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_Panel3D, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_PanelGeneral, m_shapes3D_list, m_solderMask, m_solderPaste, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, m_texts, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), BOARD_ITEM::Next(), KIWAY_HOLDER::Prj(), MODULE::Reference(), select3DModel(), TEXT_CTRL_EVAL::SetValue(), UNIT_BINDER::SetValue(), FILENAME_RESOLVER::SplitAlias(), and MODULE::Value().

◆ Validate()

bool DIALOG_FOOTPRINT_FP_EDITOR::Validate ( )
override

Definition at line 507 of file dialog_edit_footprint_for_fp_editor.cpp.

508 {
510  return false;
511 
512  if( !DIALOG_SHIM::Validate() )
513  return false;
514 
515  // First, test for invalid chars in module name
516  wxString footprintName = m_FootprintNameCtrl->GetValue();
517 
518  if( !checkFootprintName( footprintName ) )
519  {
520  if( m_NoteBook->GetSelection() != 0 )
521  m_NoteBook->SetSelection( 0 );
522 
524  m_delayedFocusPage = 0;
525 
526  return false;
527  }
528 
529  // Check for empty texts.
530  for( size_t i = 2; i < m_texts->size(); ++i )
531  {
532  TEXTE_MODULE& text = m_texts->at( i );
533 
534  if( text.GetText().IsEmpty() )
535  {
536  if( m_NoteBook->GetSelection() != 0 )
537  m_NoteBook->SetSelection( 0 );
538 
539  m_delayedErrorMessage = _( "Text items must have some content." );
543 
544  return false;
545  }
546  }
547 
548  if( !m_netClearance.Validate( 0, INT_MAX ) )
549  return false;
550 
551  return true;
552 }
virtual bool Validate(int aMin, int aMax, bool setFocusOnError=true)
Function Validate Validates the control against the given range, informing the user of any errors fou...
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
size_t i
Definition: json11.cpp:597
bool checkFootprintName(const wxString &aFootprintName)

References checkFootprintName(), WX_GRID::CommitPendingChanges(), EDA_TEXT::GetText(), i, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusCtrl, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_FootprintNameCtrl, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_itemsGrid, m_netClearance, DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NoteBook, m_texts, TMC_TEXT, and UNIT_BINDER::Validate().

Referenced by TransferDataFromWindow().

◆ VertPixelsFromDU()

int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 157 of file dialog_shim.cpp.

158 {
159  wxSize sz( 0, y );
160  return ConvertDialogToPixels( sz ).y;
161 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT().

Member Data Documentation

◆ bLowerSizer3D

wxBoxSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::bLowerSizer3D
protectedinherited

◆ bSizerMain3D

wxBoxSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::bSizerMain3D
protectedinherited

◆ m_allow180Label

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_allow180Label
protectedinherited

◆ m_allow90Label

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_allow90Label
protectedinherited

◆ m_AttributsCtrl

wxRadioBox* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AttributsCtrl
protectedinherited

◆ m_AutoPlaceCtrl

wxRadioBox* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_AutoPlaceCtrl
protectedinherited

◆ m_bpAdd

◆ m_bpDelete

◆ m_button3DShapeAdd

wxBitmapButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeAdd
protectedinherited

◆ m_button3DShapeBrowse

wxBitmapButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeBrowse
protectedinherited

◆ m_button3DShapeRemove

wxBitmapButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_button3DShapeRemove
protectedinherited

◆ m_buttonConfig3DPaths

wxButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_buttonConfig3DPaths
protectedinherited

◆ m_config

wxConfigBase* DIALOG_FOOTPRINT_FP_EDITOR::m_config
private

◆ m_CostRot180Ctrl

wxSlider* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot180Ctrl
protectedinherited

◆ m_CostRot90Ctrl

wxSlider* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_CostRot90Ctrl
protectedinherited

◆ m_delayedErrorMessage

wxString DIALOG_FOOTPRINT_FP_EDITOR::m_delayedErrorMessage
private

◆ m_delayedFocusColumn

int DIALOG_FOOTPRINT_FP_EDITOR::m_delayedFocusColumn
private

◆ m_delayedFocusCtrl

wxControl* DIALOG_FOOTPRINT_FP_EDITOR::m_delayedFocusCtrl
private

◆ m_delayedFocusGrid

WX_GRID* DIALOG_FOOTPRINT_FP_EDITOR::m_delayedFocusGrid
private

◆ m_delayedFocusPage

int DIALOG_FOOTPRINT_FP_EDITOR::m_delayedFocusPage
private

◆ m_delayedFocusRow

int DIALOG_FOOTPRINT_FP_EDITOR::m_delayedFocusRow
private

◆ m_DocCtrl

wxTextCtrl* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_DocCtrl
protectedinherited

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 179 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_footprint

◆ m_FootprintNameCtrl

◆ m_frame

FOOTPRINT_EDIT_FRAME* DIALOG_FOOTPRINT_FP_EDITOR::m_frame
private

◆ m_hash_key

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 180 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

◆ m_inSelect

bool DIALOG_FOOTPRINT_FP_EDITOR::m_inSelect
private

Definition at line 65 of file dialog_edit_footprint_for_fp_editor.h.

Referenced by On3DModelSelected(), and select3DModel().

◆ m_itemsGrid

◆ m_KeywordCtrl

wxTextCtrl* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_KeywordCtrl
protectedinherited

◆ m_modelsGrid

◆ m_netClearance

UNIT_BINDER DIALOG_FOOTPRINT_FP_EDITOR::m_netClearance
private

◆ m_NetClearanceCtrl

wxTextCtrl* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NetClearanceCtrl
protectedinherited

◆ m_NetClearanceLabel

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NetClearanceLabel
protectedinherited

◆ m_NetClearanceUnits

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_NetClearanceUnits
protectedinherited

◆ m_NoteBook

◆ m_page

int DIALOG_FOOTPRINT_FP_EDITOR::m_page = 0
staticprivate

◆ m_Panel3D

wxPanel* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_Panel3D
protectedinherited

◆ m_PanelClearances

wxPanel* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_PanelClearances
protectedinherited

◆ m_PanelGeneral

wxPanel* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_PanelGeneral
protectedinherited

◆ m_PreviewPane

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 183 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_qmodal_parent_disabler

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited

◆ m_qmodal_showing

bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 184 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

◆ m_sdbSizerStdButtons

wxStdDialogButtonSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sdbSizerStdButtons
protectedinherited

◆ m_sdbSizerStdButtonsCancel

wxButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sdbSizerStdButtonsCancel
protectedinherited

◆ m_sdbSizerStdButtonsOK

wxButton* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sdbSizerStdButtonsOK
protectedinherited

◆ m_shapes3D_list

◆ m_sizerAllow180

wxBoxSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sizerAllow180
protectedinherited

◆ m_sizerAllow90

wxBoxSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sizerAllow90
protectedinherited

◆ m_sizerAP

wxStaticBoxSizer* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_sizerAP
protectedinherited

◆ m_solderMask

UNIT_BINDER DIALOG_FOOTPRINT_FP_EDITOR::m_solderMask
private

◆ m_SolderMaskMarginCtrl

wxTextCtrl* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderMaskMarginCtrl
protectedinherited

◆ m_SolderMaskMarginLabel

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderMaskMarginLabel
protectedinherited

◆ m_SolderMaskMarginUnits

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderMaskMarginUnits
protectedinherited

◆ m_solderPaste

UNIT_BINDER DIALOG_FOOTPRINT_FP_EDITOR::m_solderPaste
private

◆ m_SolderPasteMarginCtrl

wxTextCtrl* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginCtrl
protectedinherited

◆ m_SolderPasteMarginLabel

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginLabel
protectedinherited

◆ m_SolderPasteMarginRatioCtrl

TEXT_CTRL_EVAL* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginRatioCtrl
protectedinherited

◆ m_SolderPasteMarginUnits

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteMarginUnits
protectedinherited

◆ m_SolderPasteRatioMarginUnits

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_SolderPasteRatioMarginUnits
protectedinherited

◆ m_staticText16

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticText16
protectedinherited

◆ m_staticTextInfo

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfo
protectedinherited

◆ m_staticTextInfoCopper

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoCopper
protectedinherited

◆ m_staticTextInfoValNeg

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoValNeg
protectedinherited

◆ m_staticTextInfoValPos

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextInfoValPos
protectedinherited

◆ m_staticTextRatio

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_staticTextRatio
protectedinherited

◆ m_texts

◆ m_units

◆ m_ZoneConnectionChoice

wxChoice* DIALOG_FOOTPRINT_FP_EDITOR_BASE::m_ZoneConnectionChoice
protectedinherited

◆ staticKeywordsLabel

wxStaticText* DIALOG_FOOTPRINT_FP_EDITOR_BASE::staticKeywordsLabel
protectedinherited

The documentation for this class was generated from the following files: