KiCad PCB EDA Suite
DIALOG_FOOTPRINT_BOARD_EDITOR Class Reference

#include <dialog_edit_footprint_for_BoardEditor.h>

Inheritance diagram for DIALOG_FOOTPRINT_BOARD_EDITOR:
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  FP_PRM_EDITOR_RETVALUE {
  PRM_EDITOR_WANT_UPDATE_FP, PRM_EDITOR_WANT_EXCHANGE_FP, PRM_EDITOR_EDIT_OK, PRM_EDITOR_EDIT_BOARD_FOOTPRINT,
  PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT
}
 

Public Member Functions

 DIALOG_FOOTPRINT_BOARD_EDITOR (PCB_EDIT_FRAME *aParent, MODULE *aModule, wxDC *aDC)
 
 ~DIALOG_FOOTPRINT_BOARD_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
 
wxStaticText * m_XPosLabel
 
wxTextCtrl * m_ModPositionX
 
wxStaticText * m_XPosUnit
 
wxStaticText * m_YPosLabel
 
wxTextCtrl * m_ModPositionY
 
wxStaticText * m_YPosUnit
 
wxRadioButton * m_Orient0
 
wxRadioButton * m_Orient90
 
wxRadioButton * m_Orient270
 
wxRadioButton * m_Orient180
 
wxRadioButton * m_OrientOther
 
wxTextCtrl * m_OrientValueCtrl
 
wxStaticText * m_BoardSideLabel
 
wxChoice * m_BoardSideCtrl
 
wxRadioBox * m_AutoPlaceCtrl
 
wxStaticBoxSizer * m_sizerAP
 
wxBoxSizer * m_sizerAllow90
 
wxStaticText * m_allow90Label
 
wxSlider * m_CostRot90Ctrl
 
wxBoxSizer * m_sizerAllow180
 
wxStaticText * m_allow180Label
 
wxSlider * m_CostRot180Ctrl
 
wxButton * m_buttonUpdate
 
wxButton * m_buttonExchange
 
wxButton * m_buttonModuleEditor
 
wxButton * m_button5
 
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_buttonAdd
 
wxBitmapButton * m_buttonBrowse
 
wxBitmapButton * m_buttonRemove
 
wxButton * m_button8
 
wxBoxSizer * bLowerSizer3D
 
wxStaticText * m_libraryIDLabel
 
wxStaticText * m_staticLibraryID
 
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 &) override
 
void OnAdd3DModel (wxCommandEvent &) override
 
void OnAdd3DRow (wxCommandEvent &) override
 
void EditFootprint (wxCommandEvent &) override
 
void EditLibraryFootprint (wxCommandEvent &) override
 
void UpdateModule (wxCommandEvent &) override
 
void ExchangeModule (wxCommandEvent &) override
 
void ModuleOrientEvent (wxCommandEvent &) override
 
void OnOtherOrientation (wxKeyEvent &aEvent) override
 
void Cfg3DPath (wxCommandEvent &) override
 
void OnGridSize (wxSizeEvent &aEvent) override
 
void OnAddField (wxCommandEvent &) override
 
void OnDeleteField (wxCommandEvent &) override
 
void OnUpdateUI (wxUpdateUIEvent &) override
 
void select3DModel (int aModelIdx)
 
void adjustGridColumns (int aWidth)
 

Private Attributes

wxConfigBase * m_config
 
PCB_EDIT_FRAMEm_frame
 
wxDC * m_DC
 
MODULEm_footprint
 
TEXT_MOD_GRID_TABLEm_texts
 
UNIT_BINDER m_posX
 
UNIT_BINDER m_posY
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 
UNIT_BINDER m_netClearance
 
UNIT_BINDER m_solderMask
 
UNIT_BINDER m_solderPaste
 
std::vector< MODULE_3D_SETTINGSm_shapes3D_list
 
PANEL_PREV_3Dm_PreviewPane
 
wxString m_delayedErrorMessage
 
wxGrid * m_delayedFocusGrid
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
bool m_inSelect
 

Static Private Attributes

static int m_page = 0
 

Detailed Description

Definition at line 41 of file dialog_edit_footprint_for_BoardEditor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR ( PCB_EDIT_FRAME aParent,
MODULE aModule,
wxDC *  aDC 
)

Definition at line 58 of file dialog_edit_footprint_for_BoardEditor.cpp.

References DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::bLowerSizer3D, DIALOG_SHIM::FinishDialogSettings(), FootprintTextShownColumnsKey, KiBitmap(), Kiface(), KIFACE_I::KifaceSettings(), DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_allow180Label, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_allow90Label, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_bpAdd, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_bpDelete, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonAdd, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonBrowse, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonRemove, m_config, m_DC, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusRow, m_footprint, m_frame, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_libraryIDLabel, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_modelsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NetClearanceCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NoteBook, m_OrientValidator, m_OrientValue, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_OrientValueCtrl, m_page, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Panel3D, m_PreviewPane, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsOK, m_shapes3D_list, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticLibraryID, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoCopper, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoValNeg, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoValPos, m_texts, DIALOG_SHIM::m_units, Pgm(), KIWAY_HOLDER::Prj(), DIALOG_SHIM::SetInitialFocus(), WX_GRID::SetTable(), and WX_GRID::ShowHideColumns().

59  :
67  m_inSelect( false )
68 {
70 
71  m_frame = aParent;
72  m_DC = aDC;
73  m_footprint = aModule;
74 
76 
77  m_delayedErrorMessage = wxEmptyString;
78  m_delayedFocusGrid = nullptr;
79  m_delayedFocusRow = -1;
81 
82  // Give an icon
83  wxIcon icon;
84  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
85  SetIcon( icon );
86 
87  // Give a bit more room for combobox editors
88  m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
89  m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
90 
92  m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
93  m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
94 
95  // Show/hide text item columns according to the user's preference
96  wxString shownColumns;
97  m_config->Read( FootprintTextShownColumnsKey, &shownColumns, wxT( "0 1 2 3 4 5 6" ) );
98  m_itemsGrid->ShowHideColumns( shownColumns );
99 
100  // Set up the 3D models grid
101  wxGridCellAttr* attr = new wxGridCellAttr;
102  attr->SetRenderer( new wxGridCellBoolRenderer() );
103  attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
104  attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
105  m_modelsGrid->SetColAttr( 1, attr );
106  m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
107 
108  m_OrientValidator.SetRange( -360.0, 360.0 );
109  m_OrientValueCtrl->SetValidator( m_OrientValidator );
111 
112  aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
113 
115 
116  bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );
117 
118  // Set font sizes
119  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
120  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
121  m_allow90Label->SetFont( infoFont );
122  m_allow180Label->SetFont( infoFont );
123  m_libraryIDLabel->SetFont( infoFont );
124  m_staticLibraryID->SetFont( infoFont );
125  m_staticTextInfoValNeg->SetFont( infoFont );
126  m_staticTextInfoValPos->SetFont( infoFont );
127  m_staticTextInfoCopper->SetFont( infoFont );
128 
129  m_NoteBook->SetSelection( m_page );
130 
131  if( m_page == 0 )
132  {
134  m_delayedFocusRow = 0;
136  }
137  else if ( m_page == 1 )
139  else
140  {
142  m_delayedFocusRow = 0;
144  }
145 
146  m_sdbSizerStdButtonsOK->SetDefault();
147 
148  m_OrientValue = 0;
149 
150  // Configure button logos
151  m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
152  m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
153  m_buttonAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
154  m_buttonBrowse->SetBitmap( KiBitmap( folder_xpm ) );
155  m_buttonRemove->SetBitmap( KiBitmap( trash_xpm ) );
156 
158 }
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:108
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 cut, copy, and paste to an otherwise unmodied wxGrid instance...
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&#39;s SetTable() method with one which doesn&#39;t mess up the grid column widths when setting th...
Definition: wx_grid.cpp:46
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:86
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
wxFloatingPointValidator< double > m_OrientValidator
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
DIALOG_FOOTPRINT_BOARD_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:143
#define FootprintTextShownColumnsKey
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR ( )
override

Definition at line 161 of file dialog_edit_footprint_for_BoardEditor.cpp.

References WX_GRID::DestroyTable(), FootprintTextShownColumnsKey, WX_GRID::GetShownColumns(), m_config, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_modelsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NoteBook, m_page, m_PreviewPane, m_texts, and KIWAY_HOLDER::Prj().

162 {
164 
165  // Prevents crash bug in wxGrid's d'tor
167 
168  // Delete the GRID_TRICKS.
169  m_itemsGrid->PopEventHandler( true );
170  m_modelsGrid->PopEventHandler( true );
171 
172  // free the memory used by all models, otherwise models which were
173  // browsed but not used would consume memory
174  Prj().Get3DCacheManager()->FlushCache( false );
175 
176  // the GL canvas has to be visible before it is destroyed
177  m_page = m_NoteBook->GetSelection();
178  m_NoteBook->SetSelection( 1 );
179 
180  delete m_PreviewPane;
181 }
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:77
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:90
#define FootprintTextShownColumnsKey

Member Function Documentation

void DIALOG_FOOTPRINT_BOARD_EDITOR::adjustGridColumns ( int  aWidth)
private

Definition at line 796 of file dialog_edit_footprint_for_BoardEditor.cpp.

References i, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_modelsGrid, and max.

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

797 {
798  // Account for scroll bars
799  int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
800  int modelsWidth = aWidth - ( m_modelsGrid->GetSize().x - m_modelsGrid->GetClientSize().x );
801 
802  itemsWidth -= m_itemsGrid->GetRowLabelSize();
803 
804  for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
805  itemsWidth -= m_itemsGrid->GetColSize( i );
806 
807  m_itemsGrid->SetColSize( 0, std::max( itemsWidth, 120 ) );
808 
809  m_modelsGrid->SetColSize( 0, modelsWidth - m_modelsGrid->GetColSize( 1 ) - 5 );
810 }
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
void DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 789 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

790 {
791  if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
793 }
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)
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 184 of file dialog_edit_footprint_for_BoardEditor.cpp.

References GetNewTimeStamp(), EDA_ITEM::GetTimeStamp(), m_footprint, m_frame, PCB_EDIT_FRAME::OnModify(), PRM_EDITOR_EDIT_BOARD_FOOTPRINT, and EDA_ITEM::SetTimeStamp().

185 {
186  if( m_footprint->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
187  {
189  m_frame->OnModify();
190  }
191 
193 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
timestamp_t GetTimeStamp() const
Definition: base_struct.h:207
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditLibraryFootprint ( wxCommandEvent &  )
overrideprivatevirtual
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::IsQuasiModal().

222 {
223  // so we can do logging of this state change:
224 
225 #if defined(DEBUG)
226  const char* type_id = typeid( *this ).name();
227  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
228 #endif
229 
230  return wxDialog::Enable( enable );
231 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 381 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::OnButton(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), DIALOG_SHIM::SetInitialFocus(), and DIALOG_SHIM::~DIALOG_SHIM().

382 {
383  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
384  // handle validation in the same way as other dialogs.
385  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
386  return;
387 
388  SetReturnCode( retCode );
389 
390  if( !IsQuasiModal() )
391  {
392  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
393  return;
394  }
395 
396  if( m_qmodal_loop )
397  {
398  if( m_qmodal_loop->IsRunning() )
399  m_qmodal_loop->Exit( 0 );
400  else
401  m_qmodal_loop->ScheduleExit( 0 );
402 
403  m_qmodal_loop = NULL;
404  }
405 
408 
409  Show( false );
410 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool IsQuasiModal()
Definition: dialog_shim.h:95
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
void DIALOG_FOOTPRINT_BOARD_EDITOR::ExchangeModule ( wxCommandEvent &  )
overrideprivatevirtual
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 120 of file dialog_shim.cpp.

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_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_FP_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_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_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_SHIM::GetUserUnits(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
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 141 of file dialog_shim.cpp.

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

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
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.

References KIWAY_HOLDER::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

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(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), 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(), 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_BASE_FRAME::OnOpenLibraryViewer(), 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(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), 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().

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
void DIALOG_FOOTPRINT_BOARD_EDITOR::ModuleOrientEvent ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 214 of file dialog_edit_footprint_for_BoardEditor.cpp.

References DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient0, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient180, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient270, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient90, m_OrientValidator, and m_OrientValue.

215 {
216  if( m_Orient0->GetValue() )
217  m_OrientValue = 0.0;
218  else if( m_Orient90->GetValue() )
219  m_OrientValue = 90.0;
220  else if( m_Orient270->GetValue() )
221  m_OrientValue = 270.0;
222  else if( m_Orient180->GetValue() )
223  m_OrientValue = 180.0;
224 
225  m_OrientValidator.TransferToWindow();
226 }
wxFloatingPointValidator< double > m_OrientValidator
void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged ( wxGridEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 410 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

411 {
412  if( aEvent.GetCol() == 0 )
413  {
414  bool hasAlias = false;
415  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
416  wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), 0 );
417 
418  if( filename.empty() || !res->ValidateFileName( filename, hasAlias ) )
419  {
420  m_delayedErrorMessage = wxString::Format( _( "Invalid filename: %s" ), filename );
422  m_delayedFocusRow = aEvent.GetRow();
423  m_delayedFocusColumn = aEvent.GetCol();
424  aEvent.Veto();
425  }
426 
427  // if the user has specified an alias in the name then prepend ':'
428  if( hasAlias )
429  filename.insert( 0, wxT( ":" ) );
430 
431 #ifdef __WINDOWS__
432  // In Kicad files, filenames and paths are stored using Unix notation
433  filename.Replace( wxT( "\\" ), wxT( "/" ) );
434 #endif
435 
436  m_shapes3D_list[ aEvent.GetRow() ].m_Filename = filename;
437  }
438  else if( aEvent.GetCol() == 1 )
439  {
440  wxString previewValue = m_modelsGrid->GetCellValue( aEvent.GetRow(), 1 );
441 
442  m_shapes3D_list[ aEvent.GetRow() ].m_Preview = previewValue == wxT( "1" );
443  }
444 
446 }
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
void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelSelected ( wxGridEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 403 of file dialog_edit_footprint_for_BoardEditor.cpp.

References m_inSelect, and select3DModel().

void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 466 of file dialog_edit_footprint_for_BoardEditor.cpp.

References WX_GRID::CommitPendingChanges(), Format(), PROJECT::GetProjectPath(), PROJECT::GetRString(), MODULE_3D_SETTINGS::m_Filename, DIALOG_FOOTPRINT_BOARD_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.

467 {
469  return;
470 
471  PROJECT& prj = Prj();
472  MODULE_3D_SETTINGS model;
473 
474  wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
475  wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
476  int filter = 0;
477 
478  // If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
479  // varaible and fall back to the project path if necessary.
480  if( initialpath.IsEmpty() )
481  {
482  if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
483  initialpath = prj.GetProjectPath();
484  }
485 
486  if( !sidx.empty() )
487  {
488  long tmp;
489  sidx.ToLong( &tmp );
490 
491  if( tmp > 0 && tmp <= INT_MAX )
492  filter = (int) tmp;
493  }
494 
495  if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
496  || model.m_Filename.empty() )
497  {
498  return;
499  }
500 
501  prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
502  sidx = wxString::Format( wxT( "%i" ), filter );
504  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
505  wxString alias;
506  wxString shortPath;
507  wxString filename = model.m_Filename;
508 
509  if( res && res->SplitAlias( filename, alias, shortPath ) )
510  filename = alias + wxT( ":" ) + shortPath;
511 
512 #ifdef __WINDOWS__
513  // In Kicad files, filenames and paths are stored using Unix notation
514  model.m_Filename.Replace( "\\", "/" );
515 #endif
516 
517  model.m_Preview = true;
518  m_shapes3D_list.push_back( model );
519 
520  int idx = m_modelsGrid->GetNumberRows();
521  m_modelsGrid->AppendRows( 1 );
522  m_modelsGrid->SetCellValue( idx, 0, filename );
523  m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
524 
526 }
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:104
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:103
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
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, MODULE_3D_SETTINGS *aModel)
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DRow ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 529 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

530 {
532  return;
533 
534  MODULE_3D_SETTINGS model;
535 
536  model.m_Preview = true;
537  m_shapes3D_list.push_back( model );
538 
539  int row = m_modelsGrid->GetNumberRows();
540  m_modelsGrid->AppendRows( 1 );
541  m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
542 
543  m_modelsGrid->SetFocus();
544  m_modelsGrid->MakeCellVisible( row, 0 );
545  m_modelsGrid->SetGridCursor( row, 0 );
546 
547  m_modelsGrid->EnableCellEditControl( true );
548  m_modelsGrid->ShowCellEditControl();
549 }
bool m_Preview
Include module in 3D preview.
Definition: class_module.h:104
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 727 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

728 {
730  return;
731 
732  const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
733  TEXTE_MODULE textMod( m_footprint );
734 
735  // Set active layer if legal; otherwise copy layer from previous text item
736  if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
737  textMod.SetLayer( m_frame->GetActiveLayer() );
738  else
739  textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
740 
741  textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
742  textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
743  textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
744  textMod.SetKeepUpright( dsnSettings.GetTextUpright( textMod.GetLayer() ) );
745 
746  m_texts->push_back( textMod );
747 
748  // notify the grid
749  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
750  m_itemsGrid->ProcessTableMessage( msg );
751 
752  m_itemsGrid->SetFocus();
753  m_itemsGrid->MakeCellVisible( m_texts->size() - 1, 0 );
754  m_itemsGrid->SetGridCursor( m_texts->size() - 1, 0 );
755 
756  m_itemsGrid->EnableCellEditControl( true );
757  m_itemsGrid->ShowCellEditControl();
758 }
bool GetTextItalic(PCB_LAYER_ID aLayer) const
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:743
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Function GetTextSize Returns the default text size from the layer class for the given layer...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
bool GetTextUpright(PCB_LAYER_ID aLayer) const
static bool GetLayer(MODEL_VRML &aModel, LAYER_NUM layer, VRML_LAYER **vlayer)
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnDeleteField ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 761 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

762 {
763  m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
764 
765  int curRow = m_itemsGrid->GetGridCursorRow();
766 
767  if( curRow < 0 )
768  return;
769  else if( curRow < 2 )
770  {
771  DisplayError( nullptr, _( "Reference and value are mandatory." ) );
772  return;
773  }
774 
775  m_texts->erase( m_texts->begin() + curRow );
776 
777  // notify the grid
778  wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
779  m_itemsGrid->ProcessTableMessage( msg );
780 
781  if( m_itemsGrid->GetNumberRows() > 0 )
782  {
783  m_itemsGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
784  m_itemsGrid->SetGridCursor( std::max( 0, curRow-1 ), m_itemsGrid->GetGridCursorCol() );
785  }
786 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
#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:245
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnGridSize ( wxSizeEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 859 of file dialog_edit_footprint_for_BoardEditor.cpp.

References adjustGridColumns().

860 {
861  adjustGridColumns( aEvent.GetSize().GetX());
862 
863  aEvent.Skip();
864 }
virtual void DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnInitDlg ( wxInitDialogEvent &  event)
inlineprotectedvirtualinherited
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnOtherOrientation ( wxKeyEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 229 of file dialog_edit_footprint_for_BoardEditor.cpp.

References DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_OrientOther.

230 {
231  m_OrientOther->SetValue( true );
232 
233  aEvent.Skip();
234 }
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

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

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

284 {
285  if( m_firstPaintEvent )
286  {
287 #ifdef __WXMAC__
288  fixOSXCancelButtonIssue( this );
289  selectAllInTextCtrls( GetChildren() );
290 #endif
291 
293  m_initialFocusTarget->SetFocus();
294  else
295  SetFocus(); // Focus the dialog itself
296 
297  m_firstPaintEvent = false;
298  }
299 
300  event.Skip();
301 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
bool m_firstPaintEvent
Definition: dialog_shim.h:149
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnRemove3DModel ( wxCommandEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 449 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

450 {
451  m_modelsGrid->CommitPendingChanges( true /* quiet mode */ );
452 
453  int idx = m_modelsGrid->GetGridCursorRow();
454 
455  if( idx >= 0 )
456  {
457  m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
458  m_modelsGrid->DeleteRows( idx, 1 );
459 
460  select3DModel( idx ); // will clamp idx within bounds
462  }
463 }
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:156
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI ( wxUpdateUIEvent &  )
overrideprivatevirtual

Reimplemented from DIALOG_FOOTPRINT_BOARD_EDITOR_BASE.

Definition at line 813 of file dialog_edit_footprint_for_BoardEditor.cpp.

References adjustGridColumns(), DisplayError(), m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusRow, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_modelsGrid, and SelectReferenceNumber().

814 {
815  if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
816  adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
817 
818  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
819  // even when the original validation was triggered from a killFocus event, and so
820  // that the corresponding notebook page can be shown in the background when triggered
821  // from an OK.
822  if( m_delayedFocusRow >= 0 )
823  {
824  // We will re-enter this routine if an error dialog is displayed, so make sure we
825  // zero out our member variables first.
826  wxGrid* grid = m_delayedFocusGrid;
827  int row = m_delayedFocusRow;
828  int col = m_delayedFocusColumn;
829  wxString msg = m_delayedErrorMessage;
830 
831  m_delayedFocusGrid = nullptr;
832  m_delayedFocusRow = -1;
834  m_delayedErrorMessage = wxEmptyString;
835 
836  if( !msg.IsEmpty() )
837  {
838  // Do not use DisplayErrorMessage(); it screws up window order on Mac
839  DisplayError( nullptr, msg );
840  }
841 
842  grid->SetFocus();
843  grid->MakeCellVisible( row, col );
844  grid->SetGridCursor( row, col );
845 
846  grid->EnableCellEditControl( true );
847  grid->ShowCellEditControl();
848 
849  if( grid == m_itemsGrid && row == 0 && col == 0 )
850  {
851  auto referenceEditor = grid->GetCellEditor( 0, 0 );
852  SelectReferenceNumber( dynamic_cast<wxTextEntry*>( referenceEditor->GetControl() ) );
853  referenceEditor->DecRef();
854  }
855  }
856 }
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: common.cpp:155
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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.

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(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), 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_FP_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::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), 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(), DIALOG_BOM::getPluginFileName(), 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(), KIWAY_HOLDER::Kiway(), 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(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), 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(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), 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::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(), 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(), 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(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), ~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

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
void DIALOG_FOOTPRINT_BOARD_EDITOR::select3DModel ( int  aModelIdx)
private

Definition at line 384 of file dialog_edit_footprint_for_BoardEditor.cpp.

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

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

385 {
386  m_inSelect = true;
387 
388  aModelIdx = std::max( 0, aModelIdx );
389  aModelIdx = std::min( aModelIdx, m_modelsGrid->GetNumberRows() - 1 );
390 
391  if( m_modelsGrid->GetNumberRows() )
392  {
393  m_modelsGrid->SelectRow( aModelIdx );
394  m_modelsGrid->SetGridCursor( aModelIdx, 0 );
395  }
396 
397  m_PreviewPane->SetSelectedModel( aModelIdx );
398 
399  m_inSelect = false;
400 }
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
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 86 of file dialog_shim.h.

References DIALOG_SHIM::EndQuasiModal(), DIALOG_SHIM::m_initialFocusTarget, and DIALOG_SHIM::ShowQuasiModal().

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_FP_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_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(), and LIB_EDIT_FRAME::savePartAs().

87  {
88  m_initialFocusTarget = aWindow;
89  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
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.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

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
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 134 of file dialog_shim.cpp.

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

135 {
136  wxSize sz( x, y );
137  SetSize( ConvertDialogToPixels( sz ) );
138 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 162 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), 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().

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

Definition at line 327 of file dialog_shim.cpp.

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(), 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(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), and DIALOG_SHIM::SetInitialFocus().

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

Definition at line 586 of file dialog_edit_footprint_for_BoardEditor.cpp.

References MODULE::Add(), ADD_APPEND, B_Cu, BRIGHTENED, MODULE::CalculateBoundingBox(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), BOARD_ITEM::DeleteStructure(), MODULE::Draw(), dyn_cast(), EDA_ITEM_ALL_FLAGS, F_Cu, MODULE::Flip(), EDA_DRAW_FRAME::GetCanvas(), DLIST< T >::GetFirst(), EDA_ITEM::GetFlags(), EDA_DRAW_FRAME::GetGalCanvas(), BOARD_ITEM::GetLayer(), MODULE::GetOrientation(), MODULE::GetPosition(), UNIT_BINDER::GetValue(), EDA_DRAW_PANEL_GAL::GetView(), GR_OR, GR_XOR, MODULE::GraphicalItemsList(), HIGHLIGHTED, i, KiROUND(), DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AttributsCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_BoardSideCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot90Ctrl, m_DC, m_footprint, m_frame, m_netClearance, m_OrientValidator, m_OrientValue, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Panel3D, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_PanelGeneral, m_posX, m_posY, m_shapes3D_list, m_solderMask, m_solderPaste, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, m_texts, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_ZoneConnectionChoice, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), COMMIT::Modify(), BOARD_ITEM::Next(), PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, PRM_EDITOR_EDIT_OK, BOARD_COMMIT::Push(), MODULE::Reference(), MODULE::Rotate(), SELECTED, MODULE::SetAttributes(), MODULE::SetLocalClearance(), MODULE::SetLocalSolderMaskMargin(), MODULE::SetLocalSolderPasteMargin(), MODULE::SetLocalSolderPasteMarginRatio(), MODULE::SetLocked(), MODULE::SetPadsLocked(), MODULE::SetPlacementCost180(), MODULE::SetPlacementCost90(), MODULE::SetPosition(), MODULE::SetZoneConnection(), Validate(), and MODULE::Value().

587 {
588  if( !Validate() )
589  return false;
590 
591  if( !DIALOG_SHIM::TransferDataFromWindow() )
592  return false;
593 
594  if( !m_PanelGeneral->TransferDataFromWindow() )
595  return false;
596 
597  if( !m_Panel3D->TransferDataFromWindow() )
598  return false;
599 
600  if( m_DC )
601  {
604  }
605 
606  auto view = m_frame->GetGalCanvas()->GetView();
607  BOARD_COMMIT commit( m_frame );
608  commit.Modify( m_footprint );
609 
610  // copy reference and value
611  m_footprint->Reference() = m_texts->at( 0 );
612  m_footprint->Value() = m_texts->at( 1 );
613 
614  size_t i = 2;
615  for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
616  {
617  TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );
618 
619  if( textModule )
620  {
621  // copy grid table entries till we run out, then delete any remaining texts
622  if( i < m_texts->size() )
623  *textModule = m_texts->at( i++ );
624  else
625  textModule->DeleteStructure();
626  }
627  }
628 
629  // if there are still grid table entries, create new texts for them
630  while( i < m_texts->size() )
631  {
632  auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
633  m_footprint->Add( newText, ADD_APPEND );
634  view->Add( newText );
635  }
636 
637  // Initialize masks clearances
641 
642  double dtmp = 0.0;
643  wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
644  msg.ToDouble( &dtmp );
645 
646  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
647  if( dtmp < -50.0 )
648  dtmp = -50.0;
649  // A margin ratio is always <= 0
650  // 0 means use full pad copper area
651  if( dtmp > 0.0 )
652  dtmp = 0.0;
653 
655 
656  switch( m_ZoneConnectionChoice->GetSelection() )
657  {
658  default:
663  }
664 
665  // Set Module Position
666  wxPoint modpos( m_posX.GetValue(), m_posY.GetValue() );
667  m_footprint->SetPosition( modpos );
668  m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
669  m_footprint->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
670 
671  switch( m_AttributsCtrl->GetSelection() )
672  {
673  case 0: m_footprint->SetAttributes( 0 ); break;
674  case 1: m_footprint->SetAttributes( MOD_CMS ); break;
675  case 2: m_footprint->SetAttributes( MOD_VIRTUAL ); break;
676  default: wxFAIL;
677  }
678 
681 
682  // Now, set orientation. Must be done after other changes because rotation changes field
683  // positions on board (so that relative positions are held constant)
684  m_OrientValidator.TransferFromWindow();
685 
686  int orient = KiROUND( m_OrientValue * 10.0 );
687 
688  if( m_footprint->GetOrientation() != orient )
690 
691  // Set component side, that also have effect on the fields positions on board
692  bool change_layer = false;
693  if( m_BoardSideCtrl->GetSelection() == 0 ) // layer req = COMPONENT
694  {
695  if( m_footprint->GetLayer() == B_Cu )
696  change_layer = true;
697  }
698  else if( m_footprint->GetLayer() == F_Cu )
699  change_layer = true;
700 
701  if( change_layer )
703 
704  std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models();
705  draw3D->clear();
706  draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
707 
709 
710  // This is a simple edit, we must create an undo entry
711  int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
712  if( ( m_footprint->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
713  commit.Push( _( "Modify module properties" ) );
714 
715  SetReturnCode( PRM_EDITOR_EDIT_OK );
716 
717  if( m_DC )
718  {
721  }
722 
723  return true;
724 }
void SetPlacementCost90(int aCost)
Definition: class_module.h:584
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
TEXTE_MODULE & Reference()
Definition: class_module.h:513
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:388
void SetLocalClearance(int aClearance)
Definition: class_module.h:209
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
void SetPlacementCost180(int aCost)
Definition: class_module.h:581
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:77
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one...
void SetZoneConnection(ZoneConnection aType)
Definition: class_module.h:217
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:145
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_module.h:215
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
Pads are not covered.
Definition: zones.h:52
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
BOARD_ITEM * Next() const
#define SELECTED
Definition: base_struct.h:121
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
double GetOrientation() const
Definition: class_module.h:189
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:512
virtual void CrossHairOn(wxDC *DC=nullptr)
wxFloatingPointValidator< double > m_OrientValidator
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
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
virtual void CrossHairOff(wxDC *DC=nullptr)
void SetPadsLocked(bool aPadsLocked)
Definition: class_module.h:306
void SetPosition(const wxPoint &aPos) override
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_module.h:206
Definition: gr_basic.h:38
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_module.h:212
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:179
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:278
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:79
size_t i
Definition: json11.cpp:597
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:908
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:166
const wxPoint GetPosition() const override
Definition: class_module.h:184
Use thermal relief for pads.
Definition: zones.h:53
void SetAttributes(int aAttributes)
Definition: class_module.h:227
pads are covered by copper
Definition: zones.h:54
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow ( )
override

Definition at line 237 of file dialog_edit_footprint_for_BoardEditor.cpp.

References adjustGridColumns(), B_Cu, dyn_cast(), LIB_ID::Format(), MODULE::GetAttributes(), DLIST< T >::GetFirst(), MODULE::GetFPID(), BOARD_ITEM::GetLayer(), MODULE::GetLocalClearance(), MODULE::GetLocalSolderMaskMargin(), MODULE::GetLocalSolderPasteMargin(), MODULE::GetLocalSolderPasteMarginRatio(), TEXT_MOD_GRID_TABLE::GetNumberRows(), MODULE::GetOrientation(), MODULE::GetPlacementCost180(), MODULE::GetPlacementCost90(), MODULE::GetPosition(), MODULE::GetZoneConnection(), MODULE::GraphicalItemsList(), MODULE::IsLocked(), KISYS3DMOD, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AttributsCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_BoardSideCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot90Ctrl, m_footprint, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_modelsGrid, m_netClearance, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient0, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient180, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient270, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Orient90, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_OrientOther, m_OrientValidator, m_OrientValue, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Panel3D, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_PanelGeneral, m_posX, m_posY, m_shapes3D_list, m_solderMask, m_solderPaste, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticLibraryID, m_texts, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_ZoneConnectionChoice, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), BOARD_ITEM::Next(), PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, MODULE::PadsLocked(), KIWAY_HOLDER::Prj(), MODULE::Reference(), select3DModel(), TEXT_CTRL_EVAL::SetValue(), UNIT_BINDER::SetValue(), FILENAME_RESOLVER::SplitAlias(), MODULE::Value(), wxPoint::x, and wxPoint::y.

238 {
239  if( !wxDialog::TransferDataToWindow() )
240  return false;
241 
242  if( !m_PanelGeneral->TransferDataToWindow() )
243  return false;
244 
245  if( !m_Panel3D->TransferDataToWindow() )
246  return false;
247 
248  // Module Texts
249 
250  m_texts->push_back( m_footprint->Reference() );
251  m_texts->push_back( m_footprint->Value() );
252 
253  for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() )
254  {
255  auto textModule = dyn_cast<TEXTE_MODULE*>( item );
256 
257  if( textModule )
258  m_texts->push_back( *textModule );
259  }
260 
261  // notify the grid
262  wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
263  m_itemsGrid->ProcessTableMessage( tmsg );
264 
265  // Module Properties
266 
269 
271  m_Orient0->SetValue( m_OrientValue == 0.0 );
272  m_Orient90->SetValue( m_OrientValue == 90.0 || m_OrientValue == -270.0 );
273  m_Orient270->SetValue( m_OrientValue == 270.0 || m_OrientValue == -90.0 );
274  m_Orient180->SetValue( m_OrientValue == 180.0 || m_OrientValue == -180.0 );
275 
276  m_OrientOther->SetValue( !m_Orient0->GetValue() && !m_Orient90->GetValue()
277  && !m_Orient270->GetValue() && !m_Orient180->GetValue() );
278  m_OrientValidator.TransferToWindow();
279 
280  m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
281 
282  if( m_footprint->IsLocked() )
283  m_AutoPlaceCtrl->SetSelection( 2 );
284  else if( m_footprint->PadsLocked() )
285  m_AutoPlaceCtrl->SetSelection( 1 );
286  else
287  m_AutoPlaceCtrl->SetSelection( 0 );
288 
289  m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Component can be freely moved and auto placed. User "
290  "can arbitrarily select and edit component's pads." ) );
291  m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Component can be freely moved and auto placed, but "
292  "its pads cannot be selected or edited." ) );
293  m_AutoPlaceCtrl->SetItemToolTip( 2, _( "Component is locked: it cannot be freely moved or "
294  "auto placed." ) );
295 
298 
299  m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD footprints\n"
300  "Footprints with this option are not put in the footprint position list file" ) );
301  m_AttributsCtrl->SetItemToolTip( 1, _( "Use this attribute for SMD footprints.\n"
302  "Only footprints with this option are put in the footprint position list file" ) );
303  m_AttributsCtrl->SetItemToolTip( 2, _( "Use this attribute for \"virtual\" footprints drawn on board\n"
304  "such as an edge connector (old ISA PC bus for instance)" ) );
305 
306  switch( m_footprint->GetAttributes() & 255 )
307  {
308  case MOD_CMS: m_AttributsCtrl->SetSelection( 1 ); break;
309  case MOD_VIRTUAL: m_AttributsCtrl->SetSelection( 2 ); break;
310  case 0:
311  default: m_AttributsCtrl->SetSelection( 0 ); break;
312  }
313 
314  // Local Clearances
315 
319 
320  // Prefer "-0" to "0" for normally negative values
322  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
323 
324  // Add solder paste margin ratio in per cent
325  // for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
326  wxString msg;
327  msg.Printf( wxT( "%f" ), m_footprint->GetLocalSolderPasteMarginRatio() * 100.0 );
328 
330  msg[0] == '0') // Sometimes Printf adds a sign if the value is very small (0.0)
331  m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
332  else
334 
335  switch( m_footprint->GetZoneConnection() )
336  {
337  default:
338  case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
339  case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
340  case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
341  case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
342  }
343 
344  // 3D Settings
345 
346  wxString default_path;
347  wxGetEnv( KISYS3DMOD, &default_path );
348 #ifdef __WINDOWS__
349  default_path.Replace( wxT( "/" ), wxT( "\\" ) );
350 #endif
351 
352  m_shapes3D_list.clear();
353  m_modelsGrid->DeleteRows( 0, m_modelsGrid->GetNumberRows() );
354 
355  wxString origPath, alias, shortPath;
356  FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
357 
358  for( MODULE_3D_SETTINGS model : m_footprint->Models() )
359  {
360  m_shapes3D_list.push_back( model );
361  origPath = model.m_Filename;
362 
363  if( res && res->SplitAlias( origPath, alias, shortPath ) )
364  origPath = alias + wxT( ":" ) + shortPath;
365 
366  m_modelsGrid->AppendRows( 1 );
367  int row = m_modelsGrid->GetNumberRows() - 1;
368  m_modelsGrid->SetCellValue( row, 0, origPath );
369  m_modelsGrid->SetCellValue( row, 1, model.m_Preview ? wxT( "1" ) : wxT( "0" ) );
370  }
371 
372  select3DModel( 0 ); // will clamp idx within bounds
373 
374  // Show the footprint's ID.
375  m_staticLibraryID->SetLabel( m_footprint->GetFPID().Format() );
376 
377  Layout();
378  adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
379 
380  return true;
381 }
TEXTE_MODULE & Reference()
Definition: class_module.h:513
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
int GetLocalClearance() const
Definition: class_module.h:208
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:77
ZoneConnection GetZoneConnection() const
Definition: class_module.h:218
int GetPlacementCost90() const
Definition: class_module.h:583
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:214
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
Pads are not covered.
Definition: zones.h:52
BOARD_ITEM * Next() const
const LIB_ID & GetFPID() const
Definition: class_module.h:193
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool PadsLocked() const
Definition: class_module.h:304
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...
double GetOrientation() const
Definition: class_module.h:189
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:512
#define KISYS3DMOD
A variable name whose value holds the path of 3D shape files.
Definition: 3d_viewer.h:38
wxFloatingPointValidator< double > m_OrientValidator
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
int GetAttributes() const
Definition: class_module.h:226
int GetLocalSolderMaskMargin() const
Definition: class_module.h:205
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:268
int GetLocalSolderPasteMargin() const
Definition: class_module.h:211
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:179
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:79
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
UTF8 Format() const
Definition: lib_id.cpp:237
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:166
int GetPlacementCost180() const
Definition: class_module.h:580
const wxPoint GetPosition() const override
Definition: class_module.h:184
Use thermal relief for pads.
Definition: zones.h:53
pads are covered by copper
Definition: zones.h:54
int GetNumberRows() override
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void DIALOG_FOOTPRINT_BOARD_EDITOR::UpdateModule ( wxCommandEvent &  )
overrideprivatevirtual
bool DIALOG_FOOTPRINT_BOARD_EDITOR::Validate ( )
override

Definition at line 552 of file dialog_edit_footprint_for_BoardEditor.cpp.

References WX_GRID::CommitPendingChanges(), EDA_TEXT::GetText(), i, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusRow, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_itemsGrid, m_netClearance, DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NoteBook, m_texts, TMC_TEXT, and UNIT_BINDER::Validate().

Referenced by TransferDataFromWindow().

553 {
555  return false;
556 
557  if( !DIALOG_SHIM::Validate() )
558  return false;
559 
560  // Check for empty texts.
561  for( size_t i = 2; i < m_texts->size(); ++i )
562  {
563  TEXTE_MODULE& text = m_texts->at( i );
564 
565  if( text.GetText().IsEmpty() )
566  {
567  if( m_NoteBook->GetSelection() != 0 )
568  m_NoteBook->SetSelection( 0 );
569 
571  m_delayedErrorMessage = _( "Text items must have some content." );
574 
575  return false;
576  }
577  }
578 
579  if( !m_netClearance.Validate( true ) )
580  return false;
581 
582  return true;
583 }
virtual bool Validate(bool setFocusOnError=false)
Function Validate Validates the control, informing the user of any errors found.
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:156
size_t i
Definition: json11.cpp:597
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 148 of file dialog_shim.cpp.

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

149 {
150  wxSize sz( 0, y );
151  return ConvertDialogToPixels( sz ).y;
152 }

Member Data Documentation

wxBoxSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::bLowerSizer3D
protectedinherited
wxBoxSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::bSizerMain3D
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_allow180Label
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_allow90Label
protectedinherited
wxRadioBox* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AttributsCtrl
protectedinherited
wxRadioBox* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_AutoPlaceCtrl
protectedinherited
wxChoice* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_BoardSideCtrl
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_BoardSideLabel
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_button5
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_button8
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonExchange
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonModuleEditor
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_buttonUpdate
protectedinherited
wxConfigBase* DIALOG_FOOTPRINT_BOARD_EDITOR::m_config
private
wxSlider* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot180Ctrl
protectedinherited
wxSlider* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_CostRot90Ctrl
protectedinherited
wxDC* DIALOG_FOOTPRINT_BOARD_EDITOR::m_DC
private
wxString DIALOG_FOOTPRINT_BOARD_EDITOR::m_delayedErrorMessage
private
int DIALOG_FOOTPRINT_BOARD_EDITOR::m_delayedFocusColumn
private
wxGrid* DIALOG_FOOTPRINT_BOARD_EDITOR::m_delayedFocusGrid
private
int DIALOG_FOOTPRINT_BOARD_EDITOR::m_delayedFocusRow
private
bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

MODULE* DIALOG_FOOTPRINT_BOARD_EDITOR::m_footprint
private
PCB_EDIT_FRAME* DIALOG_FOOTPRINT_BOARD_EDITOR::m_frame
private
wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 150 of file dialog_shim.h.

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

bool DIALOG_FOOTPRINT_BOARD_EDITOR::m_inSelect
private

Definition at line 69 of file dialog_edit_footprint_for_BoardEditor.h.

Referenced by On3DModelSelected(), and select3DModel().

wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_libraryIDLabel
protectedinherited
wxTextCtrl* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_ModPositionX
protectedinherited
wxTextCtrl* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_ModPositionY
protectedinherited
UNIT_BINDER DIALOG_FOOTPRINT_BOARD_EDITOR::m_netClearance
private
wxTextCtrl* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NetClearanceCtrl
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NetClearanceLabel
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NetClearanceUnits
protectedinherited
wxNotebook* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_NoteBook
protectedinherited
wxFloatingPointValidator<double> DIALOG_FOOTPRINT_BOARD_EDITOR::m_OrientValidator
private
double DIALOG_FOOTPRINT_BOARD_EDITOR::m_OrientValue
private
int DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0
staticprivate
wxPanel* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_Panel3D
protectedinherited
wxPanel* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_PanelClearances
protectedinherited
wxPanel* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_PanelGeneral
protectedinherited
UNIT_BINDER DIALOG_FOOTPRINT_BOARD_EDITOR::m_posX
private
UNIT_BINDER DIALOG_FOOTPRINT_BOARD_EDITOR::m_posY
private
WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 153 of file dialog_shim.h.

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

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 154 of file dialog_shim.h.

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

wxStdDialogButtonSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sdbSizerStdButtons
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsCancel
protectedinherited
wxButton* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsOK
protectedinherited
wxBoxSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sizerAllow180
protectedinherited
wxBoxSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sizerAllow90
protectedinherited
wxStaticBoxSizer* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_sizerAP
protectedinherited
UNIT_BINDER DIALOG_FOOTPRINT_BOARD_EDITOR::m_solderMask
private
wxTextCtrl* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderMaskMarginCtrl
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderMaskMarginLabel
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderMaskMarginUnits
protectedinherited
UNIT_BINDER DIALOG_FOOTPRINT_BOARD_EDITOR::m_solderPaste
private
wxTextCtrl* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginCtrl
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginLabel
protectedinherited
TEXT_CTRL_EVAL* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteMarginUnits
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_SolderPasteRatioMarginUnits
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticLibraryID
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticText16
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfo
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoCopper
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoValNeg
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextInfoValPos
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_staticTextRatio
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_XPosLabel
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_XPosUnit
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_YPosLabel
protectedinherited
wxStaticText* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_YPosUnit
protectedinherited
wxChoice* DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::m_ZoneConnectionChoice
protectedinherited

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