KiCad PCB EDA Suite
DIALOG_EDIT_COMPONENT_IN_LIBRARY Class Reference

#include <dialog_edit_component_in_lib.h>

Inheritance diagram for DIALOG_EDIT_COMPONENT_IN_LIBRARY:
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
bool Validate () override
 
 DIALOG_EDIT_COMPONENT_IN_LIBRARY (LIB_EDIT_FRAME *parent, LIB_PART *aLibEntry)
 Constructors. More...
 
 ~DIALOG_EDIT_COMPONENT_IN_LIBRARY ()
 
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...
 

Public Attributes

wxConfigBase * m_config
 
LIB_EDIT_FRAMEm_Parent
 
LIB_PARTm_libEntry
 
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
 
int m_currentAlias
 
LIB_ALIASES m_aliasesBuffer
 
UNIT_BINDER m_pinNameOffset
 
wxControl * m_delayedFocusCtrl
 
WX_GRIDm_delayedFocusGrid
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
int m_delayedFocusPage
 
wxString m_delayedErrorMessage
 
wxString m_shownColumns
 

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...
 

Protected Attributes

wxNotebook * m_NoteBook
 
wxPanel * m_PanelBasic
 
WX_GRIDm_grid
 
wxBitmapButton * m_bpAdd
 
wxBitmapButton * m_bpMoveUp
 
wxBitmapButton * m_bpMoveDown
 
wxBitmapButton * m_bpDelete
 
wxTextCtrl * m_SymbolNameCtrl
 
wxTextCtrl * m_DescCtrl
 
wxStaticText * staticKeywordsLabel
 
wxTextCtrl * m_KeywordCtrl
 
wxCheckBox * m_AsConvertButt
 
wxCheckBox * m_OptionPower
 
wxStaticText * m_staticTextNbUnits
 
wxSpinCtrl * m_SelNumberOfUnits
 
wxCheckBox * m_OptionPartsLocked
 
wxCheckBox * m_ShowPinNumButt
 
wxCheckBox * m_ShowPinNameButt
 
wxCheckBox * m_PinsNameInsideButt
 
wxStaticText * m_nameOffsetLabel
 
wxTextCtrl * m_nameOffsetCtrl
 
wxStaticText * m_nameOffsetUnits
 
wxPanel * m_PanelAlias
 
wxListBox * m_aliasListBox
 
wxBitmapButton * m_addAliasButton
 
wxBitmapButton * m_deleteAliasButton
 
wxStaticText * m_staticText12
 
WX_GRIDm_aliasGrid
 
wxTextCtrl * m_AliasNameCtrl
 
wxTextCtrl * m_AliasDescCtrl
 
wxStaticText * staticAliasKeywordsLabel
 
wxTextCtrl * m_AliasKeywordsCtrl
 
wxPanel * m_PanelFootprintFilter
 
wxStaticText * m_staticTextFootprints
 
wxListBox * m_FootprintFilterListBox
 
wxBitmapButton * m_addFilterButton
 
wxBitmapButton * m_editFilterButton
 
wxBitmapButton * m_deleteFilterButton
 
wxStdDialogButtonSizer * m_stdSizerButton
 
wxButton * m_stdSizerButtonOK
 
wxButton * m_stdSizerButtonCancel
 
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 transferAliasDataToBuffer ()
 
void OnAddField (wxCommandEvent &event) override
 
void OnDeleteField (wxCommandEvent &event) override
 
void OnMoveUp (wxCommandEvent &event) override
 
void OnMoveDown (wxCommandEvent &event) override
 
void OnSymbolNameKillFocus (wxFocusEvent &event) override
 
void OnSymbolNameText (wxCommandEvent &event) override
 
void OnSelectAlias (wxCommandEvent &event) override
 
void OnAddAlias (wxCommandEvent &event) override
 
void OnDeleteAlias (wxCommandEvent &event) override
 
void OnAddFootprintFilter (wxCommandEvent &event) override
 
void OnDeleteFootprintFilter (wxCommandEvent &event) override
 
void OnEditFootprintFilter (wxCommandEvent &event) override
 
void OnSizeGrid (wxSizeEvent &event) override
 
void OnSizeAliasGrid (wxSizeEvent &event) override
 
void OnGridCellChanging (wxGridEvent &event)
 
void OnAliasGridCellChanging (wxGridEvent &event)
 
void OnAliasNameKillFocus (wxFocusEvent &event) override
 
void OnAliasNameText (wxCommandEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void updateAliasName (bool aFromGrid, const wxString &aName)
 
bool checkAliasName (const wxString &aName)
 
void adjustGridColumns (int aWidth)
 
void adjustAliasGridColumns (int aWidth)
 

Static Private Attributes

static int m_lastOpenedPage = 0
 

Detailed Description

Definition at line 43 of file dialog_edit_component_in_lib.h.

Constructor & Destructor Documentation

DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY ( LIB_EDIT_FRAME parent,
LIB_PART aLibEntry 
)

Constructors.

Definition at line 54 of file dialog_edit_component_in_lib.cpp.

References DATASHEET, FDC_NAME, FDC_VALUE, DIALOG_SHIM::FinishDialogSettings(), FOOTPRINT, TEMPLATE_FIELDNAME::GetDefaultFieldName(), KiBitmap(), Kiface(), KIFACE_I::KifaceSettings(), LibEditFieldsShownColumnsKey, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_addAliasButton, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_addFilterButton, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_bpAdd, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_bpDelete, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_bpMoveDown, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_bpMoveUp, m_config, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_deleteAliasButton, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_deleteFilterButton, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_editFilterButton, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, m_libEntry, m_shownColumns, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_stdSizerButtonOK, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SymbolNameCtrl, OnAliasGridCellChanging(), OnGridCellChanging(), REFERENCE, WX_GRID::SetTable(), WX_GRID::ShowHideColumns(), and VALUE.

55  :
57  m_Parent( aParent ),
58  m_libEntry( aLibEntry ),
59  m_currentAlias( wxNOT_FOUND ),
61  m_delayedFocusCtrl( nullptr ),
62  m_delayedFocusGrid( nullptr ),
63  m_delayedFocusPage( -1 )
64 {
66 
67  // Give a bit more room for combobox editors
68  m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
69  m_aliasGrid->SetDefaultRowSize( m_aliasGrid->GetDefaultRowSize() + 4 );
70 
71  // Work around a bug in wxWidgets where it fails to recalculate the grid height
72  // after changing the default row size
73  m_aliasGrid->AppendRows( 1 );
74  m_aliasGrid->DeleteRows( m_grid->GetNumberRows() - 1, 1 );
75 
76  m_fields = new FIELDS_GRID_TABLE<LIB_FIELD>( this, aParent, m_libEntry );
78 
79  m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
80  m_aliasGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
81 
82  // Show/hide columns according to the user's preference
83  m_config->Read( LibEditFieldsShownColumnsKey, &m_shownColumns, wxT( "0 1 2 3 4 5 6 7" ) );
85  // Hide non-overridden rows in aliases grid
86  m_aliasGrid->HideRow( REFERENCE );
87  m_aliasGrid->HideRow( FOOTPRINT );
88 
89  wxGridCellAttr* attr = new wxGridCellAttr;
90  attr->SetReadOnly();
91  m_aliasGrid->SetColAttr( FDC_NAME, attr );
94 
95  attr = new wxGridCellAttr;
96  attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) );
97  m_aliasGrid->SetAttr( DATASHEET, FDC_VALUE, attr );
98 
99  m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
100 
101  // Configure button logos
102  m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
103  m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
104  m_bpMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
105  m_bpMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
106  m_addAliasButton->SetBitmap( KiBitmap( small_plus_xpm ) );
107  m_deleteAliasButton->SetBitmap( KiBitmap( trash_xpm ) );
108  m_addFilterButton->SetBitmap( KiBitmap( small_plus_xpm ) );
109  m_deleteFilterButton->SetBitmap( KiBitmap( trash_xpm ) );
110  m_editFilterButton->SetBitmap( KiBitmap( small_edit_xpm ) );
111 
112  m_stdSizerButtonOK->SetDefault();
113 
114  // wxFormBuilder doesn't include this event...
115  m_grid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging ), NULL, this );
116  m_aliasGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging ), NULL, this );
117 
118  m_grid->GetParent()->Layout();
119  m_aliasGrid->GetParent()->Layout();
120  Layout();
121 
123 }
name of datasheet
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...
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
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
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE(wxWindow *parent, wxWindowID id=ID_LIBEDIT_NOTEBOOK, const wxString &title=_("Library Symbol Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
#define LibEditFieldsShownColumnsKey
class SCH_FILED_VALIDATOR
#define VALUE
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY ( )

Definition at line 126 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::DestroyTable(), WX_GRID::GetShownColumns(), LibEditFieldsShownColumnsKey, m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, m_config, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, m_lastOpenedPage, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_NoteBook, OnAliasGridCellChanging(), and OnGridCellChanging().

127 {
128  m_lastOpenedPage = m_NoteBook->GetSelection( );
129 
131 
132  // Prevents crash bug in wxGrid's d'tor
134 
135  m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging ), NULL, this );
136  m_aliasGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging ), NULL, this );
137 
138  // Delete the GRID_TRICKS.
139  m_grid->PopEventHandler( true );
140  m_aliasGrid->PopEventHandler( true );
141 
142  // An OK will have transferred these and cleared the buffer, but we have to delete them
143  // on a Cancel.
144  for( LIB_ALIAS* alias : m_aliasesBuffer )
145  delete alias;
146 }
Part library alias object definition.
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
#define LibEditFieldsShownColumnsKey
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:90
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields

Member Function Documentation

void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustAliasGridColumns ( int  aWidth)
private
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustGridColumns ( int  aWidth)
private

Definition at line 734 of file dialog_edit_component_in_lib.cpp.

References FDC_NAME, FDC_VALUE, i, and DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid.

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

735 {
736  // Account for scroll bars
737  aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x );
738 
739  m_grid->AutoSizeColumn( FDC_NAME );
740 
741  int fixedColsWidth = m_grid->GetColSize( FDC_NAME );
742 
743  for( int i = 2; i < m_grid->GetNumberCols(); i++ )
744  fixedColsWidth += m_grid->GetColSize( i );
745 
746  m_grid->SetColSize( FDC_VALUE, aWidth - fixedColsWidth );
747 }
size_t i
Definition: json11.cpp:597
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName ( const wxString &  aName)
private

Definition at line 592 of file dialog_edit_component_in_lib.cpp.

References DisplayErrorMessage(), DisplayInfoMessage(), LIB_EDIT_FRAME::GetCurLib(), LIB_PART::GetName(), LIB_ALIAS::GetPart(), i, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, m_libEntry, m_Parent, and KIWAY_HOLDER::Prj().

Referenced by OnAliasGridCellChanging(), and OnAliasNameKillFocus().

593 {
594  if( aName.IsEmpty() )
595  return false;
596 
597  for( int i = 0; i < (int)m_aliasListBox->GetCount(); ++i )
598  {
599  if( i == m_aliasListBox->GetSelection() )
600  continue;
601 
602  if( m_aliasListBox->GetString( i ).CmpNoCase( aName ) == 0 )
603  {
604  wxString msg;
605  msg.Printf( _( "Alias \"%s\" already exists." ), aName );
606  DisplayInfoMessage( this, msg );
607  return false;
608  }
609  }
610 
611  wxString library = m_Parent->GetCurLib();
612 
613  if( !library.empty() )
614  {
615  LIB_ALIAS* existing = Prj().SchSymbolLibTable()->LoadSymbol( library, aName );
616 
617  if( existing && existing->GetPart()->GetName() != m_libEntry->GetName() )
618  {
619  wxString msg;
620  msg.Printf( _( "Symbol name \"%s\" already exists in library \"%s\"." ), aName, library );
621  DisplayErrorMessage( this, msg );
622  return false;
623  }
624  }
625 
626  return true;
627 }
Part library alias object definition.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:259
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
LIB_PART * GetPart() const
Get the shared LIB_PART.
size_t i
Definition: json11.cpp:597
const wxString & GetName() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
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_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_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_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_EDIT_COMPONENT_IN_LIBRARY::OnAddAlias ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 630 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), DATASHEET, dummy(), FDC_VALUE, Format(), LIB_PART::HasAlias(), m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, m_delayedFocusCtrl, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_DescCtrl, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_KeywordCtrl, m_libEntry, OnSelectAlias(), LIB_ALIAS::SetDescription(), LIB_ALIAS::SetDocFileName(), and LIB_ALIAS::SetKeyWords().

631 {
633  return;
634 
635  wxCommandEvent dummy;
636  wxString aliasname = _( "untitled" );
637  int suffix = 1;
638 
639  while( m_libEntry->HasAlias( aliasname ) )
640  aliasname = wxString::Format( _( "untitled%i" ), suffix++ );
641 
642  LIB_ALIAS* alias = new LIB_ALIAS( aliasname, m_libEntry );
643 
644  // Initialize with parent's data
645  alias->SetDescription( m_DescCtrl->GetValue() );
646  alias->SetKeyWords( m_KeywordCtrl->GetValue() );
647  alias->SetDocFileName( m_grid->GetCellValue( DATASHEET, FDC_VALUE ) );
648 
649  m_aliasesBuffer.push_back( alias ); // transfers ownership of alias to aliasesBuffer
650 
651  m_aliasListBox->Append( aliasname );
652  m_aliasListBox->SetSelection( m_aliasListBox->GetCount() - 1 );
653  OnSelectAlias( dummy );
654 }
Part library alias object definition.
name of datasheet
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
void SetDocFileName(const wxString &aDocFileName)
void OnSelectAlias(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
void SetDescription(const wxString &aDescription)
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
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
void SetKeyWords(const wxString &aKeyWords)
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 385 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, and m_libEntry.

386 {
387  if( !m_grid->CommitPendingChanges() )
388  return;
389 
390  int fieldID = m_fields->size();
391  LIB_FIELD newField( m_libEntry, fieldID );
392 
393  m_fields->push_back( newField );
394 
395  // notify the grid
396  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
397  m_grid->ProcessTableMessage( msg );
398 
399  m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
400  m_grid->SetGridCursor( m_fields->size() - 1, 0 );
401 
402  m_grid->EnableCellEditControl();
403  m_grid->ShowCellEditControl();
404 }
Field object used in symbol libraries.
Definition: lib_field.h:59
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddFootprintFilter ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 680 of file dialog_edit_component_in_lib.cpp.

References LIB_EDIT_FRAME::GetCurPart(), WX_TEXT_ENTRY_DIALOG::GetValue(), DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox, and m_Parent.

681 {
682  wxString filterLine;
683  LIB_PART* component = m_Parent->GetCurPart();
684 
685  if( component == NULL )
686  return;
687 
688  WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Add Footprint Filter" ), filterLine );
689 
690  if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue().IsEmpty() )
691  return;
692 
693  filterLine = dlg.GetValue();
694  filterLine.Replace( wxT( " " ), wxT( "_" ) );
695 
696  // duplicate filters do no harm, so don't be a nanny.
697 
698  m_FootprintFilterListBox->Append( filterLine );
699  m_FootprintFilterListBox->SetSelection( m_FootprintFilterListBox->GetCount() - 1 );
700 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Define a library symbol object.
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging ( wxGridEvent &  event)
private

Definition at line 497 of file dialog_edit_component_in_lib.cpp.

References checkAliasName(), DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, updateAliasName(), and VALUE.

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

498 {
499  if( event.GetRow() == VALUE )
500  {
501  int idx = m_aliasListBox->GetSelection();
502  wxString newName = event.GetString();
503 
504  if( idx < 0 || !checkAliasName( newName ) )
505  {
506  event.Veto();
507 
509  m_delayedFocusRow = event.GetRow();
510  m_delayedFocusColumn = event.GetCol();
511  m_delayedFocusPage = 1;
512  }
513  else
514  updateAliasName( true, newName );
515  }
516 }
void updateAliasName(bool aFromGrid, const wxString &aName)
#define VALUE
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameKillFocus ( wxFocusEvent &  event)
overrideprivatevirtual
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameText ( wxCommandEvent &  event)
overrideprivatevirtual
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteAlias ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 657 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), dummy(), m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, m_delayedFocusCtrl, max, and OnSelectAlias().

658 {
660  return;
661 
662  int sel = m_aliasListBox->GetSelection();
663 
664  if( sel == wxNOT_FOUND )
665  return;
666 
667  m_aliasListBox->Delete( (unsigned) sel );
668  m_aliasesBuffer.erase( m_aliasesBuffer.begin() + sel );
669 
670  if( m_aliasListBox->GetCount() == 0 )
671  m_aliasListBox->SetSelection( wxNOT_FOUND );
672  else
673  m_aliasListBox->SetSelection( std::max( 0, sel - 1 ) );
674 
675  wxCommandEvent dummy;
676  OnSelectAlias( dummy );
677 }
void OnSelectAlias(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
#define max(a, b)
Definition: auxiliary.h:86
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 407 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), DisplayError(), Format(), m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, MANDATORY_FIELDS, and max.

408 {
409  int curRow = m_grid->GetGridCursorRow();
410 
411  if( curRow < 0 )
412  return;
413  else if( curRow < MANDATORY_FIELDS )
414  {
415  DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
416  MANDATORY_FIELDS ) );
417  return;
418  }
419 
420  m_grid->CommitPendingChanges( true /* quiet mode */ );
421 
422  m_fields->erase( m_fields->begin() + curRow );
423 
424  // notify the grid
425  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
426  m_grid->ProcessTableMessage( msg );
427 
428  if( m_grid->GetNumberRows() > 0 )
429  {
430  m_grid->MakeCellVisible( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() );
431  m_grid->SetGridCursor( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() );
432  }
433 }
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:156
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
#define max(a, b)
Definition: auxiliary.h:86
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
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_EDIT_COMPONENT_IN_LIBRARY::OnDeleteFootprintFilter ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 703 of file dialog_edit_component_in_lib.cpp.

References DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox, and max.

704 {
705  int ii = m_FootprintFilterListBox->GetSelection();
706 
707  if( ii >= 0 )
708  {
709  m_FootprintFilterListBox->Delete( (unsigned) ii );
710 
711  if( m_FootprintFilterListBox->GetCount() == 0 )
712  m_FootprintFilterListBox->SetSelection( wxNOT_FOUND );
713  else
714  m_FootprintFilterListBox->SetSelection( std::max( 0, ii - 1 ) );
715  }
716 }
#define max(a, b)
Definition: auxiliary.h:86
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditFootprintFilter ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 718 of file dialog_edit_component_in_lib.cpp.

References WX_TEXT_ENTRY_DIALOG::GetValue(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox.

719 {
720  int idx = m_FootprintFilterListBox->GetSelection();
721 
722  if( idx >= 0 )
723  {
724  wxString filter = m_FootprintFilterListBox->GetStringSelection();
725 
726  WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Edit Footprint Filter" ), filter );
727 
728  if( dlg.ShowModal() == wxID_OK && !dlg.GetValue().IsEmpty() )
729  m_FootprintFilterListBox->SetString( (unsigned) idx, dlg.GetValue() );
730  }
731 }
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging ( wxGridEvent &  event)
private

Definition at line 346 of file dialog_edit_component_in_lib.cpp.

References FDC_VALUE, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SymbolNameCtrl, and VALUE.

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

347 {
348  wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
349  wxControl* control = editor->GetControl();
350 
351  if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
352  {
353  event.Veto();
354 
356  m_delayedFocusRow = event.GetRow();
357  m_delayedFocusColumn = event.GetCol();
358  m_delayedFocusPage = 0;
359  }
360  else if( event.GetRow() == VALUE && event.GetCol() == FDC_VALUE )
361  m_SymbolNameCtrl->ChangeValue( event.GetString() );
362 
363  editor->DecRef();
364 }
#define VALUE
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnMoveDown ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 458 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), i, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, and MANDATORY_FIELDS.

459 {
460  if( !m_grid->CommitPendingChanges() )
461  return;
462 
463  int i = m_grid->GetGridCursorRow();
464 
465  if( i >= MANDATORY_FIELDS )
466  {
467  LIB_FIELD tmp = m_fields->at( (unsigned) i );
468  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
469  m_fields->insert( m_fields->begin() + i + 1, tmp );
470  m_grid->ForceRefresh();
471 
472  m_grid->SetGridCursor( i + 1, m_grid->GetGridCursorCol() );
473  m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
474  }
475  else
476  wxBell();
477 }
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Field object used in symbol libraries.
Definition: lib_field.h:59
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
size_t i
Definition: json11.cpp:597
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnMoveUp ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 436 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), i, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, and MANDATORY_FIELDS.

437 {
438  if( !m_grid->CommitPendingChanges() )
439  return;
440 
441  int i = m_grid->GetGridCursorRow();
442 
443  if( i > MANDATORY_FIELDS )
444  {
445  LIB_FIELD tmp = m_fields->at( (unsigned) i );
446  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
447  m_fields->insert( m_fields->begin() + i - 1, tmp );
448  m_grid->ForceRefresh();
449 
450  m_grid->SetGridCursor( i - 1, m_grid->GetGridCursorCol() );
451  m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
452  }
453  else
454  wxBell();
455 }
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Field object used in symbol libraries.
Definition: lib_field.h:59
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
size_t i
Definition: json11.cpp:597
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
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_EDIT_COMPONENT_IN_LIBRARY::OnSelectAlias ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 551 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), DATASHEET, FDC_VALUE, LIB_ALIAS::GetDescription(), LIB_ALIAS::GetDocFileName(), LIB_ALIAS::GetKeyWords(), LIB_ALIAS::GetName(), DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasDescCtrl, m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasKeywordsCtrl, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasNameCtrl, m_currentAlias, m_delayedFocusCtrl, transferAliasDataToBuffer(), and VALUE.

Referenced by OnAddAlias(), OnDeleteAlias(), OnUpdateUI(), and TransferDataToWindow().

552 {
554  {
555  m_aliasListBox->SetSelection( m_currentAlias ); // veto selection change
556  return;
557  }
558 
559  // Copy any pending changes back into the buffer
561 
562  LIB_ALIAS* alias = nullptr;
563  int newIdx = m_aliasListBox->GetSelection();
564 
565  if( newIdx >= 0 )
566  {
567  alias = m_aliasesBuffer[ newIdx ];
568 
569  m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, alias->GetName() );
570  m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, alias->GetDocFileName() );
571 
572  // Use ChangeValue() so we don't generate events
573  m_AliasNameCtrl->ChangeValue( alias->GetName() );
574  m_AliasDescCtrl->ChangeValue( alias->GetDescription() );
575  m_AliasKeywordsCtrl->ChangeValue( alias->GetKeyWords() );
576  }
577  else
578  {
579  m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, wxEmptyString );
580  m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, wxEmptyString );
581 
582  // Use ChangeValue() so we don't generate events
583  m_AliasNameCtrl->ChangeValue( wxEmptyString );
584  m_AliasDescCtrl->ChangeValue( wxEmptyString );
585  m_AliasKeywordsCtrl->ChangeValue( wxEmptyString );
586  }
587 
588  m_currentAlias = newIdx;
589 }
Part library alias object definition.
name of datasheet
const wxString & GetKeyWords() const
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
const wxString & GetDescription() override
const wxString & GetDocFileName() const
const wxString & GetName() const override
#define VALUE
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeAliasGrid ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 848 of file dialog_edit_component_in_lib.cpp.

References adjustAliasGridColumns().

849 {
850  adjustAliasGridColumns( event.GetSize().GetX() );
851 
852  event.Skip();
853 }
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 840 of file dialog_edit_component_in_lib.cpp.

References adjustGridColumns().

841 {
842  adjustGridColumns( event.GetSize().GetX() );
843 
844  event.Skip();
845 }
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSymbolNameKillFocus ( wxFocusEvent &  event)
overrideprivatevirtual
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSymbolNameText ( wxCommandEvent &  event)
overrideprivatevirtual
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE.

Definition at line 757 of file dialog_edit_component_in_lib.cpp.

References adjustGridColumns(), DisplayError(), dummy(), UNIT_BINDER::Enable(), FDC_VALUE, WX_GRID::GetShownColumns(), DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, m_currentAlias, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusCtrl, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_NoteBook, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPartsLocked, m_pinNameOffset, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PinsNameInsideButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SelNumberOfUnits, m_shownColumns, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SymbolNameCtrl, OnSelectAlias(), and VALUE.

758 {
759  m_OptionPartsLocked->Enable( m_SelNumberOfUnits->GetValue() > 1 );
761 
762  if( m_grid->IsCellEditControlShown() )
763  {
764  int row = m_grid->GetGridCursorRow();
765  int col = m_grid->GetGridCursorCol();
766 
767  if( row == VALUE && col == FDC_VALUE )
768  {
769  wxGridCellEditor* editor = m_grid->GetCellEditor( row, col );
770  m_SymbolNameCtrl->ChangeValue( editor->GetValue() );
771  editor->DecRef();
772  }
773  }
774 
775  // Synthesize a Select event when the selection is cleared
776  if( m_aliasListBox->GetSelection() == wxNOT_FOUND && m_currentAlias != wxNOT_FOUND )
777  {
778  wxCommandEvent dummy;
779  OnSelectAlias( dummy );
780  }
781 
782  // Handle shown columns changes
783  wxString shownColumns = m_grid->GetShownColumns();
784 
785  if( shownColumns != m_shownColumns )
786  {
787  m_shownColumns = shownColumns;
788 
789  if( !m_grid->IsCellEditControlShown() )
790  adjustGridColumns( m_grid->GetRect().GetWidth() );
791  }
792 
793  // Handle a delayed focus. The delay allows us to:
794  // a) change focus when the error was triggered from within a killFocus handler
795  // b) show the correct notebook page in the background before the error dialog comes up
796  // when triggered from an OK or a notebook page change
797 
798  if( m_delayedFocusPage >= 0 && m_NoteBook->GetSelection() != m_delayedFocusPage )
799  {
800  m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage );
801  m_delayedFocusPage = -1;
802  }
803 
804  if( !m_delayedErrorMessage.IsEmpty() )
805  {
806  // We will re-enter this routine when the error dialog is displayed, so make
807  // sure we don't keep putting up more dialogs.
808  wxString msg = m_delayedErrorMessage;
809  m_delayedErrorMessage = wxEmptyString;
810 
811  // Do not use DisplayErrorMessage(); it screws up window order on Mac
812  DisplayError( nullptr, msg );
813  }
814 
815  if( m_delayedFocusCtrl )
816  {
817  m_delayedFocusCtrl->SetFocus();
818 
819  if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
820  dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
821 
822  m_delayedFocusCtrl = nullptr;
823  }
824  else if( m_delayedFocusGrid )
825  {
826  m_delayedFocusGrid->SetFocus();
829 
830  m_delayedFocusGrid->EnableCellEditControl( true );
831  m_delayedFocusGrid->ShowCellEditControl();
832 
833  m_delayedFocusGrid = nullptr;
834  m_delayedFocusRow = -1;
836  }
837 }
void OnSelectAlias(wxCommandEvent &event) override
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:90
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
#define VALUE
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 Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
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(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_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(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::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(), DIALOG_FOOTPRINT_BOARD_EDITOR::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_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_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_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
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::transferAliasDataToBuffer ( )
private

Definition at line 537 of file dialog_edit_component_in_lib.cpp.

References DATASHEET, FDC_VALUE, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasDescCtrl, m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasKeywordsCtrl, m_currentAlias, LIB_ALIAS::SetDescription(), LIB_ALIAS::SetDocFileName(), LIB_ALIAS::SetKeyWords(), LIB_ALIAS::SetName(), and VALUE.

Referenced by OnSelectAlias(), and TransferDataFromWindow().

538 {
539  if( m_currentAlias >= 0 )
540  {
542 
543  alias->SetName( m_aliasGrid->GetCellValue( VALUE, FDC_VALUE ) );
544  alias->SetDocFileName( m_aliasGrid->GetCellValue( DATASHEET, FDC_VALUE ) );
545  alias->SetDescription( m_AliasDescCtrl->GetValue() );
546  alias->SetKeyWords( m_AliasKeywordsCtrl->GetValue() );
547  }
548 }
Part library alias object definition.
name of datasheet
void SetDocFileName(const wxString &aDocFileName)
void SetName(const wxString &aName)
void SetDescription(const wxString &aDescription)
void SetKeyWords(const wxString &aKeyWords)
#define VALUE
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow ( )
override

Definition at line 277 of file dialog_edit_component_in_lib.cpp.

References LIB_PART::AddAlias(), LIB_PART::GetAlias(), LIB_PART::GetFootprints(), LIB_PART::GetName(), EDA_TEXT::GetText(), LIB_PART::GetUnitCount(), UNIT_BINDER::GetValue(), LIB_PART::GetValueField(), i, IU_PER_MILS, KiROUND(), LIB_PART::LockUnits(), m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AsConvertButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_DescCtrl, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_KeywordCtrl, m_libEntry, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPartsLocked, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPower, m_Parent, m_pinNameOffset, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PinsNameInsideButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SelNumberOfUnits, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNameButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNumButt, LIB_EDIT_FRAME::OnModify(), LIB_EDIT_FRAME::RebuildView(), LIB_PART::RemoveAllAliases(), LIB_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), LIB_ALIAS::SetDescription(), LIB_PART::SetFields(), LIB_PART::SetNormal(), LIB_PART::SetPinNameOffset(), LIB_PART::SetPower(), LIB_PART::SetShowPinNames(), LIB_PART::SetShowPinNumbers(), LIB_PART::SetUnitCount(), transferAliasDataToBuffer(), Validate(), and wxPoint::y.

278 {
279  if( !Validate() )
280  return false;
281 
283 
284  // The Y axis for components in lib is from bottom to top while the screen axis is top
285  // to bottom: we must change the y coord sign when writing back to the library
286  for( size_t i = 0; i < m_fields->size(); ++i )
287  {
288  wxPoint pos = m_fields->at( i ).GetPosition();
289  pos.y = -pos.y;
290  m_fields->at( i ).SetPosition( pos );
291  }
292 
294 
295  // We need to keep the name and the value the same at the moment!
296  SetName( m_libEntry->GetValueField().GetText() );
297 
298  LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
299 
300  rootAlias->SetDescription( m_DescCtrl->GetValue() );
301  rootAlias->SetKeyWords( m_KeywordCtrl->GetValue() );
302 
305 
306  m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
307 
308  if( m_OptionPower->GetValue() )
309  m_libEntry->SetPower();
310  else
312 
315 
316  if( m_PinsNameInsideButt->GetValue() )
317  {
318  int offset = KiROUND( (double) m_pinNameOffset.GetValue() / IU_PER_MILS );
319 
320  // We interpret an offset of 0 as "outside", so make sure it's non-zero
321  m_libEntry->SetPinNameOffset( offset == 0 ? 20 : offset );
322  }
323  else
324  {
325  m_libEntry->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin)
326  }
327 
330 
331  for( LIB_ALIAS* alias : m_aliasesBuffer )
332  m_libEntry->AddAlias( alias ); // Transfers ownership; no need to delete
333 
334  m_aliasesBuffer.clear();
335 
336  m_libEntry->GetFootprints().Clear();
338 
340  m_Parent->OnModify();
341 
342  return true;
343 }
Part library alias object definition.
void SetConversion(bool aSetConvert)
Set or clear the alternate body style (DeMorgan) for the part.
void SetPower()
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
LIB_ALIAS * GetAlias(size_t aIndex)
LIB_FIELD & GetValueField()
Return reference to the value field.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
void AddAlias(const wxString &aName)
Add an alias aName to the part.
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
void SetUnitCount(int count)
Set the units per part count.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
void SetDescription(const wxString &aDescription)
wxArrayString & GetFootprints()
int GetUnitCount() const
void RemoveAllAliases()
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
size_t i
Definition: json11.cpp:597
#define IU_PER_MILS
Definition: plotter.cpp:134
const wxString & GetName() const
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
void SetFields(const std::vector< LIB_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
void LockUnits(bool aLockUnits)
Set interchangeable the property for part units.
void SetNormal()
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow ( )
override

Definition at line 149 of file dialog_edit_component_in_lib.cpp.

References adjustAliasGridColumns(), adjustGridColumns(), dummy(), LIB_PART::GetAlias(), LIB_PART::GetAliases(), LIB_ALIAS::GetDescription(), LIB_PART::GetFields(), LIB_PART::GetFootprints(), LIB_ALIAS::GetKeyWords(), LIB_PART::GetName(), FIELDS_GRID_TABLE< T >::GetNumberRows(), LIB_PART::GetPinNameOffset(), LIB_PART::GetUnitCount(), LIB_PART::HasConversion(), i, LIB_PART::IsPower(), m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AsConvertButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_DescCtrl, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_KeywordCtrl, m_lastOpenedPage, m_libEntry, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_NoteBook, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPartsLocked, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPower, m_pinNameOffset, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PinsNameInsideButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SelNumberOfUnits, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNameButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNumButt, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SymbolNameCtrl, OnSelectAlias(), UNIT_BINDER::SetValue(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), LIB_PART::UnitsLocked(), and wxPoint::y.

150 {
151  if( !wxDialog::TransferDataToWindow() )
152  return false;
153 
154  // Push a copy of each field into m_fields
156 
157  // The Y axis for components in lib is from bottom to top while the screen axis is top
158  // to bottom: we must change the y coord sign for editing
159  for( size_t i = 0; i < m_fields->size(); ++i )
160  {
161  wxPoint pos = m_fields->at( i ).GetPosition();
162  pos.y = -pos.y;
163  m_fields->at( i ).SetPosition( pos );
164  }
165 
166  // notify the grid
167  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
168  m_grid->ProcessTableMessage( msg );
169  adjustGridColumns( m_grid->GetRect().GetWidth());
170 
171  m_SymbolNameCtrl->SetValue( m_libEntry->GetName() );
172 
173  LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
174  m_DescCtrl->SetValue( rootAlias->GetDescription() );
175  m_KeywordCtrl->SetValue( rootAlias->GetKeyWords() );
176 
179  m_AsConvertButt->SetValue( m_libEntry->HasConversion() );
180  m_OptionPower->SetValue( m_libEntry->IsPower() );
181 
183  m_ShowPinNameButt->SetValue( m_libEntry->ShowPinNames() );
184  m_PinsNameInsideButt->SetValue( m_libEntry->GetPinNameOffset() != 0 );
186 
187  const LIB_ALIASES aliases = m_libEntry->GetAliases();
188 
189  for( LIB_ALIAS* alias : aliases )
190  {
191  if( alias->IsRoot() )
192  continue;
193 
194  m_aliasesBuffer.push_back( new LIB_ALIAS( *alias, m_libEntry ) );
195  m_aliasListBox->Append( alias->GetName() );
196  }
197 
198  if( m_aliasListBox->GetCount() )
199  {
200  m_aliasListBox->SetSelection( 0 );
201 
202  wxCommandEvent dummy;
203  OnSelectAlias( dummy );
204  }
205 
206  adjustAliasGridColumns( m_aliasGrid->GetClientRect().GetWidth() - 4 );
207 
209 
210  m_NoteBook->SetSelection( (unsigned) m_lastOpenedPage );
211 
212  return true;
213 }
bool UnitsLocked() const
Check whether part units are interchangeable.
Part library alias object definition.
int GetPinNameOffset()
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
bool IsPower() const
int GetNumberRows() override
LIB_ALIAS * GetAlias(size_t aIndex)
LIB_ALIASES GetAliases() const
std::vector< LIB_ALIAS * > LIB_ALIASES
bool ShowPinNames()
bool ShowPinNumbers()
const wxString & GetKeyWords() const
void OnSelectAlias(wxCommandEvent &event) override
wxArrayString & GetFootprints()
int GetUnitCount() const
const wxString & GetDescription() override
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
size_t i
Definition: json11.cpp:597
const wxString & GetName() const
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
void GetFields(LIB_FIELDS &aList)
Return a list of fields within this part.
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::updateAliasName ( bool  aFromGrid,
const wxString &  aName 
)
private

Definition at line 480 of file dialog_edit_component_in_lib.cpp.

References FDC_VALUE, m_aliasesBuffer, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasListBox, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasNameCtrl, and VALUE.

Referenced by OnAliasGridCellChanging(), and OnAliasNameText().

481 {
482  int idx = m_aliasListBox->GetSelection();
483 
484  if( idx >= 0 )
485  {
486  m_aliasListBox->SetString( (unsigned) idx, aName );
487  m_aliasesBuffer[ idx ]->SetName( aName );
488 
489  if( aFromGrid )
490  m_AliasNameCtrl->ChangeValue( aName );
491  else
492  m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, aName );
493  }
494 }
#define VALUE
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate ( )
override

Definition at line 216 of file dialog_edit_component_in_lib.cpp.

References WX_GRID::CommitPendingChanges(), FDC_NAME, FDC_VALUE, LIB_FIELD::GetName(), LIB_PART::GetUnitCount(), LIB_PART::HasConversion(), i, IsOK(), SCH_COMPONENT::IsReferenceStringValid(), DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_aliasGrid, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AsConvertButt, m_delayedErrorMessage, m_delayedFocusColumn, m_delayedFocusGrid, m_delayedFocusPage, m_delayedFocusRow, m_fields, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_grid, m_libEntry, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_NoteBook, DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SelNumberOfUnits, MANDATORY_FIELDS, and REFERENCE.

Referenced by TransferDataFromWindow().

217 {
219  return false;
220 
221  if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) )
222  {
223  if( m_NoteBook->GetSelection() != 0 )
224  m_NoteBook->SetSelection( 0 );
225 
226  m_delayedErrorMessage = _( "References must start with a letter." );
230  m_delayedFocusPage = 0;
231 
232  return false;
233  }
234 
235  // Check for missing field names.
236  for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i )
237  {
238  LIB_FIELD& field = m_fields->at( i );
239  wxString fieldName = field.GetName( false );
240 
241  if( fieldName.IsEmpty() )
242  {
243  if( m_NoteBook->GetSelection() != 0 )
244  m_NoteBook->SetSelection( 0 );
245 
246  m_delayedErrorMessage = _( "Fields must have a name." );
250  m_delayedFocusPage = 0;
251 
252  return false;
253  }
254  }
255 
256  if( m_SelNumberOfUnits->GetValue() < m_libEntry->GetUnitCount() )
257  {
258  if( !IsOK( this, _( "Delete extra units from symbol?" ) ) )
259  return false;
260  }
261 
262  if( m_AsConvertButt->GetValue() && !m_libEntry->HasConversion() )
263  {
264  if( !IsOK( this, _( "Add new pins for alternate body style (DeMorgan) to symbol?" ) ) )
265  return false;
266  }
267  else if( !m_AsConvertButt->GetValue() && m_libEntry->HasConversion() )
268  {
269  if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from symbol?" ) ) )
270  return false;
271  }
272 
273  return true;
274 }
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Field object used in symbol libraries.
Definition: lib_field.h:59
Field Reference of part, i.e. "IC21".
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
wxString GetName(bool aTranslate=true) const
Returns the field name.
Definition: lib_field.cpp:440
int GetUnitCount() const
size_t i
Definition: json11.cpp:597
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
FIELDS_GRID_TABLE< LIB_FIELD > * m_fields
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:295
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

wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasDescCtrl
protectedinherited
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AliasKeywordsCtrl
protectedinherited
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_AsConvertButt
protectedinherited
wxConfigBase* DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_config
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_currentAlias
wxString DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedErrorMessage

Definition at line 64 of file dialog_edit_component_in_lib.h.

Referenced by OnUpdateUI(), and Validate().

int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedFocusColumn
wxControl* DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedFocusCtrl
WX_GRID* DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedFocusGrid
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedFocusPage
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_delayedFocusRow
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_DescCtrl
protectedinherited
bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxListBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_FootprintFilterListBox
protectedinherited
wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 150 of file dialog_shim.h.

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

wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_KeywordCtrl
protectedinherited
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_lastOpenedPage = 0
staticprivate
wxTextCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_nameOffsetCtrl
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_nameOffsetLabel
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_nameOffsetUnits
protectedinherited
wxNotebook* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_NoteBook
protectedinherited
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPartsLocked
protectedinherited
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_OptionPower
protectedinherited
wxPanel* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PanelAlias
protectedinherited
wxPanel* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PanelBasic
protectedinherited
wxPanel* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PanelFootprintFilter
protectedinherited
LIB_EDIT_FRAME* DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_Parent
UNIT_BINDER DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_pinNameOffset
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_PinsNameInsideButt
protectedinherited
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().

wxSpinCtrl* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_SelNumberOfUnits
protectedinherited
wxString DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_shownColumns

Definition at line 66 of file dialog_edit_component_in_lib.h.

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY(), and OnUpdateUI().

wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNameButt
protectedinherited
wxCheckBox* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_ShowPinNumButt
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_staticText12
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_staticTextFootprints
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_staticTextNbUnits
protectedinherited
wxStdDialogButtonSizer* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_stdSizerButton
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_stdSizerButtonCancel
protectedinherited
wxButton* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::m_stdSizerButtonOK
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::staticAliasKeywordsLabel
protectedinherited
wxStaticText* DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::staticKeywordsLabel
protectedinherited

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