KiCad PCB EDA Suite
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC Class Reference

Dialog used to edit SCH_COMPONENT objects in a schematic. More...

#include <dialog_edit_component_in_schematic.h>

Inheritance diagram for DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 DIALOG_EDIT_COMPONENT_IN_SCHEMATIC (SCH_EDIT_FRAME *aParent, SCH_COMPONENT *aComponent)
 
 ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC () override
 
SCH_EDIT_FRAMEGetParent ()
 
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 GetUserUnits () const
 
HOLDER_TYPE GetType ()
 
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...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 
static void FixOSXCancelButtonIssue (wxWindow *aWindow)
 

Protected Member Functions

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...
 
void ResetSize ()
 Clear the existing dialog size and position. More...
 

Protected Attributes

wxNotebook * m_notebook1
 
wxPanel * generalPage
 
WX_GRIDm_fieldsGrid
 
wxBitmapButton * m_bpAdd
 
wxBitmapButton * m_bpMoveUp
 
wxBitmapButton * m_bpMoveDown
 
wxBitmapButton * m_bpDelete
 
wxStaticText * m_unitLabel
 
wxChoice * m_unitChoice
 
wxCheckBox * m_cbAlternateSymbol
 
wxStaticText * m_orientationLabel
 
wxChoice * m_orientationCtrl
 
wxStaticText * m_mirrorLabel
 
wxChoice * m_mirrorCtrl
 
wxCheckBox * m_ShowPinNumButt
 
wxCheckBox * m_ShowPinNameButt
 
wxCheckBox * m_cbExcludeFromBom
 
wxCheckBox * m_cbExcludeFromBoard
 
wxButton * m_updateSymbolBtn
 
wxButton * m_changeSymbolBtn
 
wxButton * m_editSchematicSymbolBtn
 
wxButton * m_editLibrarySymbolBtn
 
wxPanel * m_pinTablePage
 
WX_GRIDm_pinGrid
 
wxStaticText * m_libraryIDLabel
 
wxTextCtrl * m_tcLibraryID
 
wxButton * m_spiceFieldsButton
 
wxStdDialogButtonSizer * m_stdDialogButtonSizer
 
wxButton * m_stdDialogButtonSizerOK
 
wxButton * m_stdDialogButtonSizerCancel
 
EDA_UNITS 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
 
EDA_BASE_FRAMEm_parentFrame
 
std::vector< wxWindow * > m_tabOrder
 

Private Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
bool Validate () override
 
void OnAddField (wxCommandEvent &event) override
 
void OnDeleteField (wxCommandEvent &event) override
 
void OnMoveUp (wxCommandEvent &event) override
 
void OnMoveDown (wxCommandEvent &event) override
 
void OnEditSpiceModel (wxCommandEvent &event) override
 
void OnPinTableColSort (wxGridEvent &aEvent)
 
void OnPinTableCellEdited (wxGridEvent &event) override
 
void OnSizeGrid (wxSizeEvent &event) override
 
void OnGridCellChanging (wxGridEvent &event)
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void OnCancelButtonClick (wxCommandEvent &event) override
 
void OnInitDlg (wxInitDialogEvent &event) override
 
void OnEditSymbol (wxCommandEvent &) override
 
void OnEditLibrarySymbol (wxCommandEvent &) override
 
void OnUpdateSymbol (wxCommandEvent &) override
 
void OnExchangeSymbol (wxCommandEvent &) override
 
void AdjustGridColumns (int aWidth)
 

Private Attributes

SCH_COMPONENTm_comp
 
LIB_PARTm_part
 
int m_width
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
wxString m_shownColumns
 
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields
 
SCH_PIN_TABLE_DATA_MODELm_dataModel
 

Detailed Description

Dialog used to edit SCH_COMPONENT objects in a schematic.

This is derived from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE which is maintained by wxFormBuilder.

Definition at line 55 of file dialog_edit_component_in_schematic.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC()

DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC ( SCH_EDIT_FRAME aParent,
SCH_COMPONENT aComponent 
)

Definition at line 271 of file dialog_edit_component_in_schematic.cpp.

272  :
274 {
275  m_comp = aComponent;
276  m_part = m_comp->GetPartRef().get();
277 
278  // GetPartRef() now points to the cached part in the schematic, which should always be
279  // there
280  wxASSERT( m_part );
281 
282  m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_part );
283 
284  m_width = 0;
287 
288 #ifndef KICAD_SPICE
289  m_spiceFieldsButton->Hide();
290 #endif /* not KICAD_SPICE */
291 
292  // disable some options inside the edit dialog which can cause problems while dragging
293  if( m_comp->IsDragging() )
294  {
295  m_orientationLabel->Disable();
296  m_orientationCtrl->Disable();
297  m_mirrorLabel->Disable();
298  m_mirrorCtrl->Disable();
299  }
300 
301  // Give a bit more room for combobox editors
302  m_fieldsGrid->SetDefaultRowSize( m_fieldsGrid->GetDefaultRowSize() + 4 );
303  m_pinGrid->SetDefaultRowSize( m_pinGrid->GetDefaultRowSize() + 4 );
304 
306  m_fieldsGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_fieldsGrid, this ) );
307 
308  // Show/hide columns according to user's preference
309  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
310 
311  if( cfg )
312  {
313  m_shownColumns = cfg->m_Appearance.edit_component_visible_columns;
315  }
316 
318 
319  // Make a copy of the pins for editing
320  for( const std::unique_ptr<SCH_PIN>& pin : m_comp->GetRawPins() )
321  m_dataModel->push_back( *pin );
322 
323  m_dataModel->SortRows( COL_NUMBER, true );
325 
327  m_pinGrid->PushEventHandler( new GRID_TRICKS( m_pinGrid ) );
328 
329  // Set font size for items showing long strings:
330  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
331  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
332 
333  m_libraryIDLabel->SetFont( infoFont );
334  m_tcLibraryID->SetFont( infoFont );
335 
336  wxToolTip::Enable( true );
337  m_stdDialogButtonSizerOK->SetDefault();
338 
339  // Configure button logos
340  m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
341  m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
342  m_bpMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
343  m_bpMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
344 
345  // wxFormBuilder doesn't include this event...
346  m_fieldsGrid->Connect( wxEVT_GRID_CELL_CHANGING,
348  nullptr, this );
349 
350  m_pinGrid->Connect( wxEVT_GRID_COL_SORT,
352  nullptr, this );
353 
355 }
void SortRows(int aSortCol, bool ascending)
const BITMAP_OPAQUE trash_xpm[1]
Definition: trash.cpp:46
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:127
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GRID ins...
Definition: grid_tricks.h:51
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:65
Field Reference of part, i.e. "IC21".
bool IsDragging() const
Definition: base_struct.h:201
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Symbol Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU)
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const BITMAP_OPAQUE small_down_xpm[1]
Definition: small_down.cpp:25
std::unique_ptr< LIB_PART > & GetPartRef()
const BITMAP_OPAQUE small_up_xpm[1]
Definition: small_up.cpp:26
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:20

References SCH_PIN_TABLE_DATA_MODEL::BuildAttrs(), COL_NUMBER, FDC_VALUE, DIALOG_SHIM::FinishDialogSettings(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetRawPins(), EDA_ITEM::IsDragging(), KiBitmap(), Kiface(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_bpAdd, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_bpDelete, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_bpMoveDown, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_bpMoveUp, m_comp, m_dataModel, m_delayedFocusColumn, m_delayedFocusRow, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_libraryIDLabel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorLabel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationLabel, m_part, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, m_shownColumns, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_spiceFieldsButton, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_stdDialogButtonSizerOK, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_tcLibraryID, m_width, OnGridCellChanging(), OnPinTableColSort(), REFERENCE, WX_GRID::SetTable(), WX_GRID::ShowHideColumns(), small_down_xpm, small_plus_xpm, small_up_xpm, SCH_PIN_TABLE_DATA_MODEL::SortRows(), and trash_xpm.

◆ ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC()

DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC ( )
override

Definition at line 358 of file dialog_edit_component_in_schematic.cpp.

359 {
360  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
361 
362  if( cfg )
363  cfg->m_Appearance.edit_component_visible_columns = m_fieldsGrid->GetShownColumns();
364 
365  // Prevents crash bug in wxGrid's d'tor
368 
369  m_fieldsGrid->Disconnect( wxEVT_GRID_CELL_CHANGING,
371  nullptr, this );
372  m_pinGrid->Disconnect( wxEVT_GRID_COL_SORT,
374  nullptr, this );
375 
376  // Delete the GRID_TRICKS.
377  m_fieldsGrid->PopEventHandler( true );
378  m_pinGrid->PopEventHandler( true );
379 }
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:96
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:109

References WX_GRID::DestroyTable(), WX_GRID::GetShownColumns(), Kiface(), m_dataModel, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, OnGridCellChanging(), and OnPinTableColSort().

Member Function Documentation

◆ AdjustGridColumns()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::AdjustGridColumns ( int  aWidth)
private

Definition at line 914 of file dialog_edit_component_in_schematic.cpp.

915 {
916  wxGridUpdateLocker deferRepaintsTillLeavingScope;
917 
918  m_width = aWidth;
919 
920  // Account for scroll bars
921  int fieldsWidth = aWidth - ( m_fieldsGrid->GetSize().x - m_fieldsGrid->GetClientSize().x );
922  int pinTblWidth = aWidth - ( m_pinGrid->GetSize().x - m_pinGrid->GetClientSize().x );
923 
924  m_fieldsGrid->AutoSizeColumn( 0 );
925 
926  int fixedColsWidth = m_fieldsGrid->GetColSize( 0 );
927 
928  for( int i = 2; i < m_fieldsGrid->GetNumberCols(); i++ )
929  fixedColsWidth += m_fieldsGrid->GetColSize( i );
930 
931  m_fieldsGrid->SetColSize( 1, fieldsWidth - fixedColsWidth );
932 
933  // Stretch the Base Name and Alternate Assignment columns to fit.
934  for( int i = 0; i < COL_COUNT; ++i )
935  {
936  if( i != COL_BASE_NAME && i != COL_ALT_NAME )
937  pinTblWidth -= m_pinGrid->GetColSize( i );
938  }
939 
940  // Why? I haven't a clue....
941  pinTblWidth += 22;
942 
943  m_pinGrid->SetColSize( COL_BASE_NAME, pinTblWidth / 2 );
944  m_pinGrid->SetColSize( COL_ALT_NAME, pinTblWidth / 2 );
945 }

References COL_ALT_NAME, COL_BASE_NAME, COL_COUNT, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, and m_width.

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

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 269 of file dialog_shim.cpp.

270 {
271  // so we can do logging of this state change:
272  return wxDialog::Enable( enable );
273 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 388 of file dialog_shim.cpp.

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

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), 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(), OnEditLibrarySymbol(), OnEditSymbol(), OnExchangeSymbol(), HTML_MESSAGE_BOX::OnOKButtonClick(), OnUpdateSymbol(), 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 144 of file dialog_shim.cpp.

145 {
146  // must be called from the constructor of derived classes,
147  // when all widgets are initialized, and therefore their size fixed
148 
149  // SetSizeHints fixes the minimal size of sizers in the dialog
150  // (SetSizeHints calls Fit(), so no need to call it)
151  GetSizer()->SetSizeHints( this );
152 
153  // the default position, when calling the first time the dlg
154  Center();
155 }

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_EDITOR_DATA::DIALOG_EDITOR_DATA(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), 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_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_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_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), 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_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_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_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), 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_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SCH_SHEET_PROPS::OnInitDlg(), OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_BOARD_STATISTICS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

◆ FixOSXCancelButtonIssue()

static void DIALOG_SHIM::FixOSXCancelButtonIssue ( wxWindow *  aWindow)
staticinherited

◆ GetParent()

SCH_EDIT_FRAME * DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::GetParent ( void  )

Definition at line 382 of file dialog_edit_component_in_schematic.cpp.

383 {
384  return dynamic_cast<SCH_EDIT_FRAME*>( wxDialog::GetParent() );
385 }

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

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

166 {
167  wxSize sz( x, 0 );
168  return ConvertDialogToPixels( sz ).x;
169 }

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

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 136 of file dialog_shim.h.

137  {
138  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
139  !e.ShiftDown() && !e.MetaDown();
140  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 142 of file dialog_shim.h.

143  {
144  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
145  e.ShiftDown() && !e.MetaDown();
146  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ 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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), PCB_EDIT_FRAME::importFile(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SetCrossProbeConnection(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), LIB_CONTROL::UpdateSymbolInSchematic(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ OnAddField()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 751 of file dialog_edit_component_in_schematic.cpp.

752 {
754  return;
755 
756  SCHEMATIC_SETTINGS& settings = m_comp->Schematic()->Settings();
757  int fieldID = m_fields->size();
758  SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_comp,
760 
761  newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
762  newField.SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
763 
764  m_fields->push_back( newField );
765 
766  // notify the grid
767  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
768  m_fieldsGrid->ProcessTableMessage( msg );
769 
770  m_fieldsGrid->MakeCellVisible( (int) m_fields->size() - 1, 0 );
771  m_fieldsGrid->SetGridCursor( (int) m_fields->size() - 1, 0 );
772 
773  m_fieldsGrid->EnableCellEditControl();
774  m_fieldsGrid->ShowCellEditControl();
775 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:124
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:116
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Field Reference of part, i.e. "IC21".
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180
These settings were stored in SCH_BASE_FRAME previously.

References WX_GRID::CommitPendingChanges(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), m_comp, SCHEMATIC_SETTINGS::m_DefaultTextSize, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, REFERENCE, SCH_ITEM::Schematic(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextSize(), and SCHEMATIC::Settings().

◆ OnCancelButtonClick()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 513 of file dialog_edit_component_in_schematic.cpp.

514 {
515  // Running the Footprint Browser gums up the works and causes the automatic cancel
516  // stuff to no longer work. So we do it here ourselves.
517  EndQuasiModal( wxID_CANCEL );
518 }
void EndQuasiModal(int retCode)

References DIALOG_SHIM::EndQuasiModal().

◆ OnDeleteField()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnDeleteField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 778 of file dialog_edit_component_in_schematic.cpp.

779 {
780  int curRow = m_fieldsGrid->GetGridCursorRow();
781 
782  if( curRow < 0 )
783  {
784  return;
785  }
786  else if( curRow < MANDATORY_FIELDS )
787  {
788  DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
789  MANDATORY_FIELDS ) );
790  return;
791  }
792 
793  m_fieldsGrid->CommitPendingChanges( true /* quiet mode */ );
794 
795  m_fields->erase( m_fields->begin() + curRow );
796 
797  // notify the grid
798  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
799  m_fieldsGrid->ProcessTableMessage( msg );
800 
801  if( m_fieldsGrid->GetNumberRows() > 0 )
802  {
803  m_fieldsGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_fieldsGrid->GetGridCursorCol() );
804  m_fieldsGrid->SetGridCursor( std::max( 0, curRow-1 ), m_fieldsGrid->GetGridCursorCol() );
805  }
806 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180
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:201
#define _(s)
Definition: 3d_actions.cpp:33

References _, WX_GRID::CommitPendingChanges(), DisplayError(), Format(), m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, and MANDATORY_FIELDS.

◆ OnEditLibrarySymbol()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnEditLibrarySymbol ( wxCommandEvent &  )
overrideprivatevirtual

◆ OnEditSpiceModel()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnEditSpiceModel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 485 of file dialog_edit_component_in_schematic.cpp.

486 {
487 #ifdef KICAD_SPICE
488  int diff = m_fields->size();
489 
490  DIALOG_SPICE_MODEL dialog( this, *m_comp, m_fields );
491 
492  if( dialog.ShowModal() != wxID_OK )
493  return;
494 
495  diff = (int) m_fields->size() - diff;
496 
497  if( diff > 0 )
498  {
499  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, diff );
500  m_fieldsGrid->ProcessTableMessage( msg );
501  }
502  else if( diff < 0 )
503  {
504  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, -diff );
505  m_fieldsGrid->ProcessTableMessage( msg );
506  }
507 
508  m_fieldsGrid->ForceRefresh();
509 #endif /* KICAD_SPICE */
510 }

References m_comp, m_fields, and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid.

◆ OnEditSymbol()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnEditSymbol ( wxCommandEvent &  )
overrideprivatevirtual

◆ OnExchangeSymbol()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnExchangeSymbol ( wxCommandEvent &  )
overrideprivatevirtual

◆ OnGridCellChanging()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging ( wxGridEvent &  event)
private

Definition at line 716 of file dialog_edit_component_in_schematic.cpp.

717 {
718  wxGridCellEditor* editor = m_fieldsGrid->GetCellEditor( event.GetRow(), event.GetCol() );
719  wxControl* control = editor->GetControl();
720 
721  if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
722  {
723  event.Veto();
724  m_delayedFocusRow = event.GetRow();
725  m_delayedFocusColumn = event.GetCol();
726  }
727  else if( event.GetCol() == FDC_NAME )
728  {
729  wxString newName = event.GetString();
730 
731  for( int i = 0; i < m_fieldsGrid->GetNumberRows(); ++i )
732  {
733  if( i == event.GetRow() )
734  continue;
735 
736  if( newName.CmpNoCase( m_fieldsGrid->GetCellValue( i, FDC_NAME ) ) == 0 )
737  {
738  DisplayError( this, wxString::Format( _( "The name '%s' is already in use." ),
739  newName ) );
740  event.Veto();
741  m_delayedFocusRow = event.GetRow();
742  m_delayedFocusColumn = event.GetCol();
743  }
744  }
745  }
746 
747  editor->DecRef();
748 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
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:201
#define _(s)
Definition: 3d_actions.cpp:33

References _, DisplayError(), FDC_NAME, Format(), m_delayedFocusColumn, m_delayedFocusRow, and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid.

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

◆ OnInitDlg()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 991 of file dialog_edit_component_in_schematic.cpp.

992 {
994 
995  // Now all widgets have the size fixed, call FinishDialogSettings
997 }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...

References DIALOG_SHIM::FinishDialogSettings(), and TransferDataToWindow().

◆ OnMoveDown()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveDown ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 833 of file dialog_edit_component_in_schematic.cpp.

834 {
836  return;
837 
838  int i = m_fieldsGrid->GetGridCursorRow();
839 
840  if( i >= MANDATORY_FIELDS && i < m_fieldsGrid->GetNumberRows() - 1 )
841  {
842  SCH_FIELD tmp = m_fields->at( (unsigned) i );
843  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
844  m_fields->insert( m_fields->begin() + i + 1, tmp );
845  m_fieldsGrid->ForceRefresh();
846 
847  m_fieldsGrid->SetGridCursor( i + 1, m_fieldsGrid->GetGridCursorCol() );
848  m_fieldsGrid->MakeCellVisible( m_fieldsGrid->GetGridCursorRow(), m_fieldsGrid->GetGridCursorCol() );
849  }
850  else
851  {
852  wxBell();
853  }
854 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180

References WX_GRID::CommitPendingChanges(), m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, and MANDATORY_FIELDS.

◆ OnMoveUp()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveUp ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 809 of file dialog_edit_component_in_schematic.cpp.

810 {
812  return;
813 
814  int i = m_fieldsGrid->GetGridCursorRow();
815 
816  if( i > MANDATORY_FIELDS )
817  {
818  SCH_FIELD tmp = m_fields->at( (unsigned) i );
819  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
820  m_fields->insert( m_fields->begin() + i - 1, tmp );
821  m_fieldsGrid->ForceRefresh();
822 
823  m_fieldsGrid->SetGridCursor( i - 1, m_fieldsGrid->GetGridCursorCol() );
824  m_fieldsGrid->MakeCellVisible( m_fieldsGrid->GetGridCursorRow(), m_fieldsGrid->GetGridCursorCol() );
825  }
826  else
827  {
828  wxBell();
829  }
830 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180

References WX_GRID::CommitPendingChanges(), m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, and MANDATORY_FIELDS.

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 295 of file dialog_shim.cpp.

296 {
297  if( m_firstPaintEvent )
298  {
300 
301  selectAllInTextCtrls( GetChildren() );
302 
304  m_initialFocusTarget->SetFocus();
305  else
306  SetFocus(); // Focus the dialog itself
307 
308  m_firstPaintEvent = false;
309  }
310 
311  event.Skip();
312 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:204
bool m_firstPaintEvent
Definition: dialog_shim.h:203
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:46
static void selectAllInTextCtrls(wxWindowList &children)

References KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision(), DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnPinTableCellEdited()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnPinTableCellEdited ( wxGridEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 881 of file dialog_edit_component_in_schematic.cpp.

882 {
883  int row = aEvent.GetRow();
884 
885  if( m_pinGrid->GetCellValue( row, COL_ALT_NAME ) == m_dataModel->GetValue( row, COL_BASE_NAME ) )
886  m_dataModel->SetValue( row, COL_ALT_NAME, wxEmptyString );
887 
888  // These are just to get the cells refreshed
891 
892  m_modified = true;
893 }
wxString GetValue(int aRow, int aCol) override
void SetValue(int aRow, int aCol, const wxString &aValue) override

References COL_ALT_NAME, COL_BASE_NAME, COL_SHAPE, COL_TYPE, SCH_PIN_TABLE_DATA_MODEL::GetValue(), m_dataModel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, and SCH_PIN_TABLE_DATA_MODEL::SetValue().

◆ OnPinTableColSort()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnPinTableColSort ( wxGridEvent &  aEvent)
private

Definition at line 896 of file dialog_edit_component_in_schematic.cpp.

897 {
898  int sortCol = aEvent.GetCol();
899  bool ascending;
900 
901  // This is bonkers, but wxWidgets doesn't tell us ascending/descending in the
902  // event, and if we ask it will give us pre-event info.
903  if( m_pinGrid->IsSortingBy( sortCol ) )
904  // same column; invert ascending
905  ascending = !m_pinGrid->IsSortOrderAscending();
906  else
907  // different column; start with ascending
908  ascending = true;
909 
910  m_dataModel->SortRows( sortCol, ascending );
911 }
void SortRows(int aSortCol, bool ascending)

References m_dataModel, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, and SCH_PIN_TABLE_DATA_MODEL::SortRows().

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

◆ OnSizeGrid()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSizeGrid ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 977 of file dialog_edit_component_in_schematic.cpp.

978 {
979  auto new_size = event.GetSize().GetX();
980 
981  if( m_width != new_size )
982  {
983  AdjustGridColumns( new_size );
984  }
985 
986  // Always propagate for a grid repaint (needed if the height changes, as well as width)
987  event.Skip();
988 }

References AdjustGridColumns(), and m_width.

◆ OnUpdateSymbol()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnUpdateSymbol ( wxCommandEvent &  )
overrideprivatevirtual

◆ OnUpdateUI()

void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE.

Definition at line 948 of file dialog_edit_component_in_schematic.cpp.

949 {
950  wxString shownColumns = m_fieldsGrid->GetShownColumns();
951 
952  if( shownColumns != m_shownColumns )
953  {
954  m_shownColumns = shownColumns;
955 
956  if( !m_fieldsGrid->IsCellEditControlShown() )
957  AdjustGridColumns( m_fieldsGrid->GetRect().GetWidth() );
958  }
959 
960  // Handle a delayed focus
961  if( m_delayedFocusRow >= 0 )
962  {
963  m_fieldsGrid->SetFocus();
966 
967 
968  m_fieldsGrid->EnableCellEditControl( true );
969  m_fieldsGrid->ShowCellEditControl();
970 
971  m_delayedFocusRow = -1;
973  }
974 }
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:109

References AdjustGridColumns(), WX_GRID::GetShownColumns(), m_delayedFocusColumn, m_delayedFocusRow, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, and m_shownColumns.

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 35 of file kiway_holder.cpp.

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

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(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), 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_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_EXPORT_SVG::ExportSVGFile(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), EDA_BASE_FRAME::LoadWindowState(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), SCH_EDIT_FRAME::PrintPage(), EDA_DRAW_FRAME::PrintWorkSheet(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), PCB_INSPECTION_TOOL::reportCopperClearance(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), DRC_TOOL::RunTests(), 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(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), EDA_BASE_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ ResetSize()

void DIALOG_SHIM::ResetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 244 of file dialog_shim.cpp.

245 {
246  const char* hash_key;
247 
248  if( m_hash_key.size() )
249  {
250  // a special case like EDA_LIST_DIALOG, which has multiple uses.
251  hash_key = m_hash_key.c_str();
252  }
253  else
254  {
255  hash_key = typeid(*this).name();
256  }
257 
258  RECT_MAP::iterator it = class_map.find( hash_key );
259 
260  if( it == class_map.end() )
261  return;
262 
263  EDA_RECT rect = it->second;
264  rect.SetSize( 0, 0 );
265  class_map[ hash_key ] = rect;
266 }
std::string m_hash_key
Definition: dialog_shim.h:198
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References class_map, DIALOG_SHIM::m_hash_key, and EDA_RECT::SetSize().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY().

◆ 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 114 of file dialog_shim.h.

115  {
116  m_initialFocusTarget = aWindow;
117  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:204

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_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_BOARD_EDITOR::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_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), 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_RULE_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 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), 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 158 of file dialog_shim.cpp.

159 {
160  wxSize sz( x, y );
161  SetSize( ConvertDialogToPixels( sz ) );
162 }

Referenced by 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 185 of file dialog_shim.cpp.

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

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), EDA_VIEW_SWITCHER::Show(), DIALOG_PAD_PROPERTIES::Show(), DRC_TOOL::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), HTML_MESSAGE_BOX::ShowModeless(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 338 of file dialog_shim.cpp.

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

References DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, KIPLATFORM::UI::ReparentQuasiModal(), DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by LIB_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), LIB_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), and SCH_EDIT_FRAME::ShowSchematicSetupDialog().

◆ TransferDataFromWindow()

bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow ( )
overrideprivate

Definition at line 560 of file dialog_edit_component_in_schematic.cpp.

561 {
562  if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
563  return false;
564 
566  return false;
567 
569  return false;
570 
571  SCH_SCREEN* currentScreen = GetParent()->GetScreen();
572  SCHEMATIC& schematic = GetParent()->Schematic();
573 
574  wxCHECK( currentScreen, false );
575 
576  // This needs to be done before the LIB_ID is changed to prevent stale library symbols in
577  // the schematic file.
578  currentScreen->Remove( m_comp );
579 
580  wxString msg;
581 
582  // save old cmp in undo list if not already in edit, or moving ...
583  if( m_comp->GetEditFlags() == 0 )
584  GetParent()->SaveCopyInUndoList( currentScreen, m_comp, UNDO_REDO::CHANGED, false );
585 
586  // Save current flags which could be modified by next change settings
587  STATUS_FLAGS flags = m_comp->GetFlags();
588 
589  // For symbols with multiple shapes (De Morgan representation) Set the selected shape:
590  if( m_cbAlternateSymbol->IsEnabled() && m_cbAlternateSymbol->GetValue() )
591  m_comp->SetConvert( LIB_ITEM::LIB_CONVERT::DEMORGAN );
592  else
593  m_comp->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
594 
595  //Set the part selection in multiple part per package
596  int unit_selection = m_unitChoice->IsEnabled() ? m_unitChoice->GetSelection() + 1 : 1;
597  m_comp->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
598  m_comp->SetUnit( unit_selection );
599 
600  switch( m_orientationCtrl->GetSelection() )
601  {
602  case 0: m_comp->SetOrientation( CMP_ORIENT_0 ); break;
603  case 1: m_comp->SetOrientation( CMP_ORIENT_90 ); break;
604  case 2: m_comp->SetOrientation( CMP_ORIENT_270 ); break;
605  case 3: m_comp->SetOrientation( CMP_ORIENT_180 ); break;
606  }
607 
608  switch( m_mirrorCtrl->GetSelection() )
609  {
610  case 0: break;
611  case 1: m_comp->SetOrientation( CMP_MIRROR_X ); break;
612  case 2: m_comp->SetOrientation( CMP_MIRROR_Y ); break;
613  }
614 
615  m_part->SetShowPinNames( m_ShowPinNameButt->GetValue() );
616  m_part->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
617 
618  // Restore m_Flag modified by SetUnit() and other change settings
619  m_comp->ClearFlags();
620  m_comp->SetFlags( flags );
621 
622  // change all field positions from relative to absolute
623  for( unsigned i = 0; i < m_fields->size(); ++i )
624  m_fields->at( i ).Offset( m_comp->GetPosition() );
625 
626  LIB_PART* entry = GetParent()->GetLibPart( m_comp->GetLibId() );
627 
628  if( entry && entry->IsPower() )
629  m_fields->at( VALUE ).SetText( m_comp->GetLibId().GetLibItemName() );
630 
631  // Push all fields to the component -except- for those which are TEMPLATE_FIELDNAMES
632  // with empty values.
633  SCH_FIELDS& fields = m_comp->GetFields();
634 
635  fields.clear();
636 
637  for( size_t i = 0; i < m_fields->size(); ++i )
638  {
639  SCH_FIELD& field = m_fields->at( i );
640  bool emptyTemplateField = false;
641 
642  if( i >= MANDATORY_FIELDS )
643  {
644  for( const TEMPLATE_FIELDNAME& fieldname :
646  {
647  if( field.GetName() == fieldname.m_Name && field.GetText().IsEmpty() )
648  {
649  emptyTemplateField = true;
650  break;
651  }
652  }
653  }
654 
655  if( !emptyTemplateField )
656  fields.push_back( field );
657  }
658 
659  // Reference has a specific initialization, depending on the current active sheet
660  // because for a given component, in a complex hierarchy, there are more than one
661  // reference.
662  m_comp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE ).GetText() );
663 
664  // Similar for Value and Footprint, except that the GUI behaviour is that they are kept
665  // in sync between multiple instances.
666  m_comp->SetValue( m_fields->at( VALUE ).GetText() );
667  m_comp->SetFootprint( m_fields->at( FOOTPRINT ).GetText() );
668 
669  m_comp->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
671 
672  // The value, footprint and datasheet fields and exclude from bill of materials setting
673  // should be kept in sync in multi-unit parts.
674  if( m_comp->GetUnitCount() > 1 )
675  {
676  for( SCH_SHEET_PATH& sheet : GetParent()->Schematic().GetSheets() )
677  {
678  SCH_SCREEN* screen = sheet.LastScreen();
679  std::vector<SCH_COMPONENT*> otherUnits;
680 
681  CollectOtherUnits( sheet, m_comp, &otherUnits );
682 
683  for( SCH_COMPONENT* otherUnit : otherUnits )
684  {
685  GetParent()->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED, true /* append */);
686  otherUnit->GetField( VALUE )->SetText( m_fields->at( VALUE ).GetText() );
687  otherUnit->GetField( FOOTPRINT )->SetText( m_fields->at( FOOTPRINT ).GetText() );
688  otherUnit->GetField( DATASHEET )->SetText( m_fields->at( DATASHEET ).GetText() );
689  otherUnit->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
690  otherUnit->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
691  GetParent()->UpdateItem( otherUnit );
692  }
693  }
694  }
695 
696  // Update any assignments
697  for( const SCH_PIN& model_pin : *m_dataModel )
698  {
699  // map from the edited copy back to the "real" pin in the component
700  SCH_PIN* src_pin = m_comp->GetPin( model_pin.GetLibPin() );
701  src_pin->SetAlt( model_pin.GetAlt() );
702  }
703 
704  currentScreen->Append( m_comp );
707  GetParent()->OnModify();
708 
709  // This must go after OnModify() so that the connectivity graph will have been updated.
711 
712  return true;
713 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:243
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
name of datasheet
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:89
void SetIncludeInBom(bool aIncludeInBom)
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:42
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:124
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
TEMPLATES m_TemplateFieldNames
int GetUnitCount() const
Return the number of units per package of the symbol.
SCH_PIN * GetPin(const wxString &number)
Find a symbol pin by number.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void SetIncludeOnBoard(bool aIncludeOnBoard)
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:211
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
void SetConvert(int aConvert)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_component.h:65
SCHEMATIC & Schematic() const
Define a library symbol object.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
unsigned STATUS_FLAGS
Definition: base_struct.h:152
void SetUnit(int aUnit)
Change the unit number to aUnit.
SCH_SHEET_PATH.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180
Field Value of part, i.e. "3.3K".
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
bool IsPower() const
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:131
void SetAlt(const wxString &aAlt)
Definition: sch_pin.h:73
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:442
Schematic symbol object.
Definition: sch_component.h:80
wxPoint GetPosition() const override
Struct TEMPLATE_FIELDNAME holds a name of a component's field, field value, and default visibility.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
void CollectOtherUnits(SCH_SHEET_PATH &aSheet, SCH_COMPONENT *aUnit, std::vector< SCH_COMPONENT * > *otherUnits)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:234
const LIB_ID & GetLibId() const
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:273
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:127
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Function GetTemplateFieldName returns a template fieldnames list for read only access.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References SCH_SCREEN::Append(), CHANGED, EDA_ITEM::ClearFlags(), CMP_MIRROR_X, CMP_MIRROR_Y, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, CollectOtherUnits(), WX_GRID::CommitPendingChanges(), DATASHEET, FOOTPRINT, EDA_ITEM::GetEditFlags(), SCH_COMPONENT::GetFields(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), LIB_ID::GetLibItemName(), SCH_BASE_FRAME::GetLibPart(), SCH_FIELD::GetName(), GetParent(), SCH_COMPONENT::GetPin(), SCH_COMPONENT::GetPosition(), SCH_EDIT_FRAME::GetScreen(), SCHEMATIC::GetSheets(), TEMPLATES::GetTemplateFieldNames(), EDA_TEXT::GetText(), TOOLS_HOLDER::GetToolManager(), SCH_COMPONENT::GetUnitCount(), LIB_PART::IsPower(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbAlternateSymbol, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBoard, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBom, m_comp, m_dataModel, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationCtrl, m_part, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNameButt, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNumButt, SCHEMATIC_SETTINGS::m_TemplateFieldNames, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_unitChoice, MANDATORY_FIELDS, SCH_EDIT_FRAME::OnModify(), TOOL_MANAGER::PostEvent(), REFERENCE, SCH_SCREEN::Remove(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::Schematic(), EVENTS::SelectedItemsModified, SCH_PIN::SetAlt(), SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), SCH_COMPONENT::SetFootprint(), SCH_COMPONENT::SetIncludeInBom(), SCH_COMPONENT::SetIncludeOnBoard(), SCH_COMPONENT::SetOrientation(), SCH_COMPONENT::SetRef(), LIB_PART::SetShowPinNames(), LIB_PART::SetShowPinNumbers(), SCHEMATIC::Settings(), SCH_COMPONENT::SetUnit(), SCH_COMPONENT::SetUnitSelection(), SCH_COMPONENT::SetValue(), SCH_EDIT_FRAME::TestDanglingEnds(), SCH_BASE_FRAME::UpdateItem(), and VALUE.

◆ TransferDataToWindow()

bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow ( )
overrideprivate

Definition at line 388 of file dialog_edit_component_in_schematic.cpp.

389 {
390  if( !wxDialog::TransferDataToWindow() )
391  return false;
392 
393  std::set<wxString> defined;
394 
395  // Push a copy of each field into m_updateFields
396  for( int i = 0; i < m_comp->GetFieldCount(); ++i )
397  {
398  SCH_FIELD field( *m_comp->GetField( i ) );
399 
400  // change offset to be symbol-relative
401  field.Offset( -m_comp->GetPosition() );
402 
403  defined.insert( field.GetName() );
404  m_fields->push_back( field );
405  }
406 
407  // Add in any template fieldnames not yet defined:
408  for( const TEMPLATE_FIELDNAME& templateFieldname :
409  GetParent()->Schematic().Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
410  {
411  if( defined.count( templateFieldname.m_Name ) <= 0 )
412  {
413  SCH_FIELD field( wxPoint( 0, 0 ), -1, m_comp, templateFieldname.m_Name );
414  field.SetVisible( templateFieldname.m_Visible );
415  m_fields->push_back( field );
416  }
417  }
418 
419  // notify the grid
420  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->size() );
421  m_fieldsGrid->ProcessTableMessage( msg );
422  AdjustGridColumns( m_fieldsGrid->GetRect().GetWidth() );
423 
424  // If a multi-unit component, set up the unit selector and interchangeable checkbox.
425  if( m_comp->GetUnitCount() > 1 )
426  {
427  for( int ii = 1; ii <= m_comp->GetUnitCount(); ii++ )
428  m_unitChoice->Append( LIB_PART::SubReference( ii, false ) );
429 
430  if( m_comp->GetUnit() <= ( int )m_unitChoice->GetCount() )
431  m_unitChoice->SetSelection( m_comp->GetUnit() - 1 );
432  }
433  else
434  {
435  m_unitLabel->Enable( false );
436  m_unitChoice->Enable( false );
437  }
438 
439  if( m_part->HasConversion() )
440  {
441  if( m_comp->GetConvert() > LIB_ITEM::LIB_CONVERT::BASE )
442  m_cbAlternateSymbol->SetValue( true );
443  }
444  else
445  {
446  m_cbAlternateSymbol->Enable( false );
447  }
448 
449  // Set the symbol orientation and mirroring.
450  int orientation = m_comp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
451 
452  switch( orientation )
453  {
454  default:
455  case CMP_ORIENT_0: m_orientationCtrl->SetSelection( 0 ); break;
456  case CMP_ORIENT_90: m_orientationCtrl->SetSelection( 1 ); break;
457  case CMP_ORIENT_270: m_orientationCtrl->SetSelection( 2 ); break;
458  case CMP_ORIENT_180: m_orientationCtrl->SetSelection( 3 ); break;
459  }
460 
461  int mirror = m_comp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );
462 
463  switch( mirror )
464  {
465  default: m_mirrorCtrl->SetSelection( 0 ) ; break;
466  case CMP_MIRROR_X: m_mirrorCtrl->SetSelection( 1 ); break;
467  case CMP_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break;
468  }
469 
470  m_cbExcludeFromBom->SetValue( !m_comp->GetIncludeInBom() );
472 
473  m_ShowPinNumButt->SetValue( m_part->ShowPinNumbers() );
474  m_ShowPinNameButt->SetValue( m_part->ShowPinNames() );
475 
476  // Set the component's library name.
477  m_tcLibraryID->SetValue( m_comp->GetLibId().Format() );
478 
479  Layout();
480 
481  return true;
482 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void Offset(const wxPoint &aOffset)
Definition: eda_text.h:253
int GetOrientation()
Get the display symbol orientation.
bool GetIncludeOnBoard() const
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
int GetUnitCount() const
Return the number of units per package of the symbol.
bool ShowPinNames()
int GetUnit() const
bool ShowPinNumbers()
bool GetIncludeInBom() const
int GetFieldCount() const
Return the number of fields in this symbol.
UTF8 Format() const
Definition: lib_id.cpp:237
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
static wxString SubReference(int aUnit, bool aAddSeparator=true)
wxPoint GetPosition() const override
Struct TEMPLATE_FIELDNAME holds a name of a component's field, field value, and default visibility.
int GetConvert() const
const LIB_ID & GetLibId() const

References AdjustGridColumns(), CMP_MIRROR_X, CMP_MIRROR_Y, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, LIB_ID::Format(), SCH_COMPONENT::GetConvert(), SCH_COMPONENT::GetField(), SCH_COMPONENT::GetFieldCount(), SCH_COMPONENT::GetIncludeInBom(), SCH_COMPONENT::GetIncludeOnBoard(), SCH_COMPONENT::GetLibId(), SCH_COMPONENT::GetOrientation(), GetParent(), SCH_COMPONENT::GetPosition(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), LIB_PART::HasConversion(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbAlternateSymbol, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBoard, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBom, m_comp, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorCtrl, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationCtrl, m_part, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNameButt, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNumButt, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_tcLibraryID, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_unitChoice, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_unitLabel, EDA_TEXT::Offset(), EDA_TEXT::SetVisible(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), and LIB_PART::SubReference().

Referenced by OnInitDlg().

◆ Validate()

bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate ( )
overrideprivate

Definition at line 521 of file dialog_edit_component_in_schematic.cpp.

522 {
523  wxString msg;
524  LIB_ID id;
525 
526  if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
527  return false;
528 
529  if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) )
530  {
531  DisplayErrorMessage( this, _( "References must start with a letter." ) );
532 
535 
536  return false;
537  }
538 
539  // Check for missing field names.
540  for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i )
541  {
542  SCH_FIELD& field = m_fields->at( i );
543  wxString fieldName = field.GetName( false );
544 
545  if( fieldName.IsEmpty() )
546  {
547  DisplayErrorMessage( this, _( "Fields must have a name." ) );
548 
550  m_delayedFocusRow = i;
551 
552  return false;
553  }
554  }
555 
556  return true;
557 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Field Reference of part, i.e. "IC21".
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:442
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.

References _, WX_GRID::CommitPendingChanges(), DisplayErrorMessage(), FDC_NAME, FDC_VALUE, SCH_FIELD::GetName(), SCH_COMPONENT::IsReferenceStringValid(), m_delayedFocusColumn, m_delayedFocusRow, m_fields, DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_fieldsGrid, MANDATORY_FIELDS, and REFERENCE.

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

173 {
174  wxSize sz( 0, y );
175  return ConvertDialogToPixels( sz ).y;
176 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT().

Member Data Documentation

◆ generalPage

wxPanel* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::generalPage
protectedinherited

◆ m_bpAdd

◆ m_bpDelete

◆ m_bpMoveDown

◆ m_bpMoveUp

◆ m_cbAlternateSymbol

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbAlternateSymbol
protectedinherited

◆ m_cbExcludeFromBoard

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBoard
protectedinherited

◆ m_cbExcludeFromBom

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_cbExcludeFromBom
protectedinherited

◆ m_changeSymbolBtn

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_changeSymbolBtn
protectedinherited

◆ m_comp

SCH_COMPONENT* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_comp
private

◆ m_dataModel

◆ m_delayedFocusColumn

int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_delayedFocusColumn
private

◆ m_delayedFocusRow

int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_delayedFocusRow
private

◆ m_editLibrarySymbolBtn

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_editLibrarySymbolBtn
protectedinherited

◆ m_editSchematicSymbolBtn

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_editSchematicSymbolBtn
protectedinherited

◆ m_fields

◆ m_fieldsGrid

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 203 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_hash_key

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 204 of file dialog_shim.h.

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

◆ m_libraryIDLabel

wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_libraryIDLabel
protectedinherited

◆ m_mirrorCtrl

wxChoice* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorCtrl
protectedinherited

◆ m_mirrorLabel

wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_mirrorLabel
protectedinherited

◆ m_notebook1

wxNotebook* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_notebook1
protectedinherited

◆ m_orientationCtrl

wxChoice* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationCtrl
protectedinherited

◆ m_orientationLabel

wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_orientationLabel
protectedinherited

◆ m_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

Definition at line 211 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnCharHook(), and DIALOG_DRC::OnRunDRCClick().

◆ m_part

LIB_PART* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_part
private

◆ m_pinGrid

◆ m_pinTablePage

wxPanel* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_pinTablePage
protectedinherited

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 206 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 208 of file dialog_shim.h.

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

◆ m_shownColumns

wxString DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_shownColumns
private

◆ m_ShowPinNameButt

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNameButt
protectedinherited

◆ m_ShowPinNumButt

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_ShowPinNumButt
protectedinherited

◆ m_spiceFieldsButton

◆ m_stdDialogButtonSizer

wxStdDialogButtonSizer* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_stdDialogButtonSizer
protectedinherited

◆ m_stdDialogButtonSizerCancel

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_stdDialogButtonSizerCancel
protectedinherited

◆ m_stdDialogButtonSizerOK

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_stdDialogButtonSizerOK
protectedinherited

◆ m_tabOrder

◆ m_tcLibraryID

wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_tcLibraryID
protectedinherited

◆ m_unitChoice

wxChoice* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_unitChoice
protectedinherited

◆ m_unitLabel

wxStaticText* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_unitLabel
protectedinherited

◆ m_units

◆ m_updateSymbolBtn

wxButton* DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::m_updateSymbolBtn
protectedinherited

◆ m_width

int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::m_width
private

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