KiCad PCB EDA Suite
DIALOG_SHEET_PROPERTIES Class Reference

#include <dialog_sheet_properties.h>

Inheritance diagram for DIALOG_SHEET_PROPERTIES:
DIALOG_SHEET_PROPERTIES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG , FRAME , PANEL }
 

Public Member Functions

 DIALOG_SHEET_PROPERTIES (SCH_EDIT_FRAME *aParent, SCH_SHEET *aSheet, bool *aClearAnnotationNewItems)
 
 ~DIALOG_SHEET_PROPERTIES () override
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal () const
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
void OnModify ()
 
void SetPosition (const wxPoint &aNewPosition)
 Force the position of the dialog to a new position. More...
 
EDA_UNITS GetUserUnits () const
 
void SetupStandardButtons (std::map< int, wxString > aLabels={})
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
bool HasKiway () const
 Safety check before asking for the Kiway reference. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

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) const
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int vertPixelsFromDU (int y) const
 Convert an integer number of dialog units to pixels, vertically. More...
 
void resetSize ()
 Clear the existing dialog size and position. More...
 
virtual void OnCharHook (wxKeyEvent &aEvt)
 

Protected Attributes

WX_INFOBARm_infoBar
 
wxBoxSizer * m_longForm
 
WX_GRIDm_grid
 
wxBitmapButton * m_bpAdd
 
wxBitmapButton * m_bpMoveUp
 
wxBitmapButton * m_bpMoveDown
 
wxBitmapButton * m_bpDelete
 
wxStaticText * m_borderWidthLabel
 
wxTextCtrl * m_borderWidthCtrl
 
wxStaticText * m_borderWidthUnits
 
wxStaticText * m_borderColorLabel
 
COLOR_SWATCHm_borderSwatch
 
wxStaticText * m_backgroundColorLabel
 
COLOR_SWATCHm_backgroundSwatch
 
wxStaticText * m_pageNumberStaticText
 
wxTextCtrl * m_pageNumberTextCtrl
 
wxStaticLine * m_staticline1
 
wxBoxSizer * m_sizerBottom
 
wxStaticText * m_hierarchicalPathLabel
 
wxStaticText * m_hierarchicalPath
 
wxStdDialogButtonSizer * m_stdDialogButtonSizer
 
wxButton * m_stdDialogButtonSizerOK
 
wxButton * m_stdDialogButtonSizerCancel
 
EDA_UNITS m_units
 
std::string m_hash_key
 
bool m_useCalculatedSize
 
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
 
wxSize m_initialSize
 

Private Member Functions

bool onSheetFilenameChanged (const wxString &aNewFilename)
 
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 OnSizeGrid (wxSizeEvent &event) override
 
void OnGridCellChanging (wxGridEvent &event)
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void OnInitDlg (wxInitDialogEvent &event) override
 
void AdjustGridColumns ()
 
void OnCloseWindow (wxCloseEvent &aEvent)
 Properly handle the wxCloseEvent when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM. More...
 
void OnButton (wxCommandEvent &aEvent)
 Properly handle the default button events when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM. More...
 
void OnGridEditorShown (wxGridEvent &event)
 
void OnGridEditorHidden (wxGridEvent &event)
 
 DECLARE_EVENT_TABLE ()
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
SCH_SHEETm_sheet
 
bool * m_clearAnnotationNewItems
 
wxSize m_size
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
wxString m_shownColumns
 
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields
 
UNIT_BINDER m_borderWidth
 
SCH_SHEET m_dummySheet
 
SCH_FIELD m_dummySheetNameField
 
KIWAYm_kiway
 
HOLDER_TYPE m_type
 

Detailed Description

Definition at line 37 of file dialog_sheet_properties.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 39 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_SHEET_PROPERTIES()

DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES ( SCH_EDIT_FRAME aParent,
SCH_SHEET aSheet,
bool *  aClearAnnotationNewItems 
)

Definition at line 46 of file dialog_sheet_properties.cpp.

47 :
49 m_frame( aParent ),
50 m_clearAnnotationNewItems( aClearAnnotationNewItems ),
52 m_dummySheet( *aSheet ),
53 m_dummySheetNameField( wxDefaultPosition, SHEETNAME, &m_dummySheet )
54{
55 m_sheet = aSheet;
56 m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_grid, m_sheet );
59
60 // Give a bit more room for combobox editors
61 m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
62
64 m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
65 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
66
67 // Show/hide columns according to user's preference
68 auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
69 wxASSERT( cfg );
70
71 if( cfg )
72 {
73 m_shownColumns = cfg->m_Appearance.edit_sheet_visible_columns;
75 }
76
78 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
79
80 wxToolTip::Enable( true );
82
83 // Configure button logos
84 m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
86 m_bpMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
88
89 // Set font sizes
91 m_hierarchicalPath->SetFont( KIUI::GetInfoFont( this ) );
92
93 // wxFormBuilder doesn't include this event...
94 m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
96 nullptr, this );
97
99}
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
bool GetOverrideSchItemColors() const
DIALOG_SHEET_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Sheet 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)
void OnGridCellChanging(wxGridEvent &event)
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:93
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:172
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:93
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:142
#define _(s)
@ FDC_VALUE
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
@ SHEETNAME
Definition: sch_sheet.h:43

References _, FDC_VALUE, DIALOG_SHIM::finishDialogSettings(), SCH_BASE_FRAME::GetColorSettings(), KIUI::GetInfoFont(), COLOR_SETTINGS::GetOverrideSchItemColors(), KiBitmap(), Kiface(), KIFACE_BASE::KifaceSettings(), DIALOG_SHEET_PROPERTIES_BASE::m_bpAdd, DIALOG_SHEET_PROPERTIES_BASE::m_bpDelete, DIALOG_SHEET_PROPERTIES_BASE::m_bpMoveDown, DIALOG_SHEET_PROPERTIES_BASE::m_bpMoveUp, m_delayedFocusColumn, m_delayedFocusRow, m_fields, m_frame, DIALOG_SHEET_PROPERTIES_BASE::m_grid, DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPath, DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPathLabel, DIALOG_SHEET_PROPERTIES_BASE::m_infoBar, m_sheet, m_shownColumns, OnGridCellChanging(), WX_GRID::SetTable(), DIALOG_SHIM::SetupStandardButtons(), SHEETNAME, WX_GRID::ShowHideColumns(), WX_INFOBAR::ShowMessage(), small_down, small_plus, small_trash, and small_up.

◆ ~DIALOG_SHEET_PROPERTIES()

DIALOG_SHEET_PROPERTIES::~DIALOG_SHEET_PROPERTIES ( )
override

Definition at line 102 of file dialog_sheet_properties.cpp.

103{
104 auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
105 wxASSERT( cfg );
106
107 if( cfg )
108 cfg->m_Appearance.edit_sheet_visible_columns = m_grid->GetShownColumns();
109
110 // Prevents crash bug in wxGrid's d'tor
112
113 m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
115 nullptr, this );
116
117 // Delete the GRID_TRICKS.
118 m_grid->PopEventHandler( true );
119}
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:139
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:153

References WX_GRID::DestroyTable(), WX_GRID::GetShownColumns(), Kiface(), KIFACE_BASE::KifaceSettings(), m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, and OnGridCellChanging().

Member Function Documentation

◆ AdjustGridColumns()

void DIALOG_SHEET_PROPERTIES::AdjustGridColumns ( )
private

Definition at line 830 of file dialog_sheet_properties.cpp.

831{
832 // Account for scroll bars
834
835 m_grid->AutoSizeColumn( 0 );
836
837 int fixedColsWidth = m_grid->GetColSize( 0 );
838
839 for( int i = 2; i < m_grid->GetNumberCols(); i++ )
840 fixedColsWidth += m_grid->GetColSize( i );
841
842 int colSize = std::max( width - fixedColsWidth, -1 );
843 colSize = ( colSize == 0 ) ? -1 : colSize; // don't hide the column!
844
845 m_grid->SetColSize( 1, colSize );
846}
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: gtk/ui.cpp:126

References KIPLATFORM::UI::GetUnobscuredSize(), and DIALOG_SHEET_PROPERTIES_BASE::m_grid.

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

◆ DECLARE_EVENT_TABLE()

DIALOG_SHIM::DECLARE_EVENT_TABLE ( )
privateinherited

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 319 of file dialog_shim.cpp.

320{
321 // so we can do logging of this state change:
322 return wxDialog::Enable( enable );
323}

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 487 of file dialog_shim.cpp.

488{
489 // Hook up validator and transfer data from controls handling so quasi-modal dialogs
490 // handle validation in the same way as other dialogs.
491 if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
492 return;
493
494 SetReturnCode( retCode );
495
496 if( !IsQuasiModal() )
497 {
498 wxFAIL_MSG( wxT( "Either DIALOG_SHIM::EndQuasiModal was called twice, or ShowQuasiModal"
499 "wasn't called" ) );
500 return;
501 }
502
503 if( m_qmodal_loop )
504 {
505 if( m_qmodal_loop->IsRunning() )
506 m_qmodal_loop->Exit( 0 );
507 else
508 m_qmodal_loop->ScheduleExit( 0 );
509
510 m_qmodal_loop = nullptr;
511 }
512
514 m_qmodal_parent_disabler = nullptr;
515
516 Show( false );
517}
bool Show(bool show) override
bool IsQuasiModal() const
Definition: dialog_shim.h:106
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:218
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:215

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

Referenced by EDA_3D_CONTROLLER::Main(), NETLIST_DIALOG::OnAddGenerator(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_SYMBOLS_LIBID::onCancel(), DIALOG_LIB_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), NETLIST_DIALOG::OnDelGenerator(), DIALOG_SYMBOL_PROPERTIES::OnEditLibrarySymbol(), DIALOG_SYMBOL_PROPERTIES::OnEditSymbol(), DIALOG_SYMBOL_PROPERTIES::OnExchangeSymbol(), PCB_ONE_LAYER_SELECTOR::OnLeftGridCellClick(), PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick(), DIALOG_SYMBOL_PROPERTIES::OnUpdateSymbol(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept(), 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 after all widgets have been initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at the end of TransferDataToWindow, or better yet, at end of a wxInitDialogEvent handler.

Definition at line 158 of file dialog_shim.cpp.

159{
160 // must be called from the constructor of derived classes,
161 // when all widgets are initialized, and therefore their size fixed
162
163 // SetSizeHints fixes the minimal size of sizers in the dialog
164 // (SetSizeHints calls Fit(), so no need to call it)
165 GetSizer()->SetSizeHints( this );
166}

Referenced by CONVERT_SETTINGS_DIALOG::CONVERT_SETTINGS_DIALOG(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER(), 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_SYMBOLS_LIBID::DIALOG_EDIT_SYMBOLS_LIBID(), 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_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_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_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MANAGE_REPOSITORIES::DIALOG_MANAGE_REPOSITORIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), 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_PCM::DIALOG_PCM(), 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_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_3DMODEL::DIALOG_SELECT_3DMODEL(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES(), DIALOG_SIM_MODEL< T >::DIALOG_SIM_MODEL(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_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(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), PAGED_DIALOG::finishInitialization(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SYMBOL_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 46 of file kiway_holder.h.

46{ return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:85

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ HasKiway()

bool KIWAY_HOLDER::HasKiway ( ) const
inlineinherited

Safety check before asking for the Kiway reference.

Returns
true if kiway is non-null

Definition at line 63 of file kiway_holder.h.

64 {
65 return m_kiway != nullptr;
66 }
KIWAY * m_kiway
Definition: kiway_holder.h:84

References KIWAY_HOLDER::m_kiway.

Referenced by DIALOG_SHIM::~DIALOG_SHIM().

◆ horizPixelsFromDU()

int DIALOG_SHIM::horizPixelsFromDU ( int  x) const
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 176 of file dialog_shim.cpp.

177{
178 wxSize sz( x, 0 );
179 return ConvertDialogToPixels( sz ).x;
180}

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

◆ IsCtrl()

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

Definition at line 128 of file dialog_shim.h.

129 {
130 return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
131 !e.ShiftDown() && !e.MetaDown();
132 }

◆ IsQuasiModal()

◆ IsShiftCtrl()

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

Definition at line 134 of file dialog_shim.h.

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

◆ Kiway()

KIWAY & KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return 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 53 of file kiway_holder.h.

54 {
55 wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
56 return *m_kiway;
57 }

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AskToSaveChanges(), CVPCB_MAINFRAME::BuildLibrariesListBox(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), PCB_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::FetchNetlistFromSchematic(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), SCRIPTING_TOOL::Init(), EDA_DRAW_FRAME::IsScriptingConsoleVisible(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PGM_SINGLE_TOP::MacOpenFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), SIM_PLOT_FRAME::onProbe(), PCB_EDIT_FRAME::OnQuit(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_FIELD_PROPERTIES::OnTextValueSelectButtonClick(), SIM_PLOT_FRAME::onTune(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SCH_EDITOR_CONTROL::rescueProject(), PCB_EDIT_FRAME::RunEeschema(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), EDA_DRAW_FRAME::ScriptingConsoleEnableDisable(), PCB_BASE_FRAME::SelectFootprintFromLibBrowser(), PCB_BASE_FRAME::SelectLibrary(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SendSelectItems(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurSymbol(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), PCB_EDIT_FRAME::TestStandalone(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ OnAddField()

void DIALOG_SHEET_PROPERTIES::OnAddField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 715 of file dialog_sheet_properties.cpp.

716{
718 return;
719
720 int fieldID = m_fields->size();
721 SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet,
723
724 newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );
725
726 m_fields->push_back( newField );
727
728 // notify the grid
729 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
730 m_grid->ProcessTableMessage( msg );
731
732 m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
733 m_grid->SetGridCursor( m_fields->size() - 1, 0 );
734
735 m_grid->EnableCellEditControl();
736 m_grid->ShowCellEditControl();
737}
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslated=true)
Definition: sch_sheet.cpp:53
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:226

References WX_GRID::CommitPendingChanges(), SCH_SHEET::GetDefaultFieldName(), m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, m_sheet, EDA_TEXT::SetTextAngle(), and SHEETNAME.

◆ OnButton()

void DIALOG_SHIM::OnButton ( wxCommandEvent &  aEvent)
privateinherited

Properly handle the default button events when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM.

Definition at line 533 of file dialog_shim.cpp.

534{
535 const int id = aEvent.GetId();
536
537 // If we are pressing a button to exit, we need to enable the escapeID
538 // otherwise the dialog does not process cancel
539 if( id == wxID_CANCEL )
540 SetEscapeId( wxID_ANY );
541
542 if( IsQuasiModal() )
543 {
544 if( id == GetAffirmativeId() )
545 {
546 EndQuasiModal( id );
547 }
548 else if( id == wxID_APPLY )
549 {
550 // Dialogs that provide Apply buttons should make sure data is valid before
551 // allowing a transfer, as there is no other way to indicate failure
552 // (i.e. the dialog can't refuse to close as it might with OK, because it
553 // isn't closing anyway)
554 if( Validate() )
555 {
556 ignore_unused( TransferDataFromWindow() );
557 }
558 }
559 else if( id == GetEscapeId() || (id == wxID_CANCEL && GetEscapeId() == wxID_ANY) )
560 {
561 EndQuasiModal( wxID_CANCEL );
562 }
563 else // not a standard button
564 {
565 aEvent.Skip();
566 }
567
568 return;
569 }
570
571 // This is mandatory to allow wxDialogBase::OnButton() to be called.
572 aEvent.Skip();
573}
void EndQuasiModal(int retCode)
void ignore_unused(const T &)
Definition: ignore.h:24

References DIALOG_SHIM::EndQuasiModal(), ignore_unused(), and DIALOG_SHIM::IsQuasiModal().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnCharHook()

void DIALOG_SHIM::OnCharHook ( wxKeyEvent &  aEvt)
protectedvirtualinherited

Reimplemented in HK_PROMPT_DIALOG, DIALOG_CHOOSE_SYMBOL, and HTML_MESSAGE_BOX.

Definition at line 576 of file dialog_shim.cpp.

577{
578 if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
579 {
580 if( m_parentFrame )
581 {
583 return;
584 }
585 }
586 // shift-return (Mac default) or Ctrl-Return (GTK) for OK
587 else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
588 {
589 wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
590 return;
591 }
592 else if( aEvt.GetKeyCode() == WXK_TAB && !aEvt.ControlDown() )
593 {
594 wxWindow* currentWindow = wxWindow::FindFocus();
595 int currentIdx = -1;
596 int delta = aEvt.ShiftDown() ? -1 : 1;
597
598 auto advance =
599 [&]( int& idx )
600 {
601 // Wrap-around modulus
602 int size = m_tabOrder.size();
603 idx = ( ( idx + delta ) % size + size ) % size;
604 };
605
606 for( size_t i = 0; i < m_tabOrder.size(); ++i )
607 {
608 if( m_tabOrder[i] == currentWindow )
609 {
610 currentIdx = (int) i;
611 break;
612 }
613 }
614
615 if( currentIdx >= 0 )
616 {
617 advance( currentIdx );
618
619 //todo: We don't currently have non-textentry dialog boxes but this will break if
620 // we add them.
621#ifdef __APPLE__
622 while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
623 advance( currentIdx );
624#endif
625
626 m_tabOrder[ currentIdx ]->SetFocus();
627 return;
628 }
629 }
630
631 aEvt.Skip();
632}
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:222
EDA_BASE_FRAME * m_parentFrame
Definition: dialog_shim.h:220
virtual void ToggleUserUnits()
constexpr int delta

References delta, DIALOG_SHIM::m_parentFrame, DIALOG_SHIM::m_tabOrder, and EDA_BASE_FRAME::ToggleUserUnits().

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), and DIALOG_TEXTBOX_PROPERTIES::~DIALOG_TEXTBOX_PROPERTIES().

◆ OnCloseWindow()

void DIALOG_SHIM::OnCloseWindow ( wxCloseEvent &  aEvent)
privateinherited

Properly handle the wxCloseEvent when in the quasimodal mode when not calling EndQuasiModal which is possible with any dialog derived from DIALOG_SHIM.

Definition at line 520 of file dialog_shim.cpp.

521{
522 if( IsQuasiModal() )
523 {
524 EndQuasiModal( wxID_CANCEL );
525 return;
526 }
527
528 // This is mandatory to allow wxDialogBase::OnCloseWindow() to be called.
529 aEvent.Skip();
530}

References DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::IsQuasiModal().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnDeleteField()

void DIALOG_SHEET_PROPERTIES::OnDeleteField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 740 of file dialog_sheet_properties.cpp.

741{
742 wxArrayInt selectedRows = m_grid->GetSelectedRows();
743
744 if( selectedRows.empty() && m_grid->GetGridCursorRow() >= 0 )
745 selectedRows.push_back( m_grid->GetGridCursorRow() );
746
747 if( selectedRows.empty() )
748 return;
749
750 for( int row : selectedRows )
751 {
752 if( row < SHEET_MANDATORY_FIELDS )
753 {
754 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
756 return;
757 }
758 }
759
760 m_grid->CommitPendingChanges( true /* quiet mode */ );
761
762 // Reverse sort so deleting a row doesn't change the indexes of the other rows.
763 selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
764
765 for( int row : selectedRows )
766 {
767 m_fields->erase( m_fields->begin() + row );
768
769 // notify the grid
770 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
771 m_grid->ProcessTableMessage( msg );
772
773 if( m_grid->GetNumberRows() > 0 )
774 {
775 m_grid->MakeCellVisible( std::max( 0, row-1 ), m_grid->GetGridCursorCol() );
776 m_grid->SetGridCursor( std::max( 0, row-1 ), m_grid->GetGridCursorCol() );
777 }
778 }
779}
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ SHEET_MANDATORY_FIELDS
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:47

References _, WX_GRID::CommitPendingChanges(), DisplayError(), Format(), m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, and SHEET_MANDATORY_FIELDS.

◆ OnGridCellChanging()

void DIALOG_SHEET_PROPERTIES::OnGridCellChanging ( wxGridEvent &  event)
private

Definition at line 675 of file dialog_sheet_properties.cpp.

676{
677 bool success = true;
678 wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
679 wxControl* control = editor->GetControl();
680 wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
681
682 // Short-circuit the validator's more generic "can't be empty" message for the
683 // two mandatory fields:
684 if( event.GetRow() == SHEETNAME && event.GetCol() == FDC_VALUE )
685 {
686 if( textControl && textControl->IsEmpty() )
687 {
688 wxMessageBox( _( "A sheet must have a name." ) );
689 success = false;
690 }
691 }
692 else if( event.GetRow() == SHEETFILENAME && event.GetCol() == FDC_VALUE && textControl )
693 {
694 if( textControl->IsEmpty() )
695 {
696 wxMessageBox( _( "A sheet must have a file specified." ) );
697 success = false;
698 }
699 }
700
701 if( success && control && control->GetValidator() )
702 success = control->GetValidator()->Validate( control );
703
704 if( !success )
705 {
706 event.Veto();
707 m_delayedFocusRow = event.GetRow();
708 m_delayedFocusColumn = event.GetCol();
709 }
710
711 editor->DecRef();
712}
@ SHEETFILENAME
Definition: sch_sheet.h:44

References _, editor, FDC_VALUE, m_delayedFocusColumn, m_delayedFocusRow, DIALOG_SHEET_PROPERTIES_BASE::m_grid, SHEETFILENAME, and SHEETNAME.

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

◆ OnGridEditorHidden()

void DIALOG_SHIM::OnGridEditorHidden ( wxGridEvent &  event)
privateinherited

Definition at line 642 of file dialog_shim.cpp.

643{
644 SetEscapeId( wxID_ANY );
645 event.Skip();
646}

◆ OnGridEditorShown()

void DIALOG_SHIM::OnGridEditorShown ( wxGridEvent &  event)
privateinherited

Definition at line 635 of file dialog_shim.cpp.

636{
637 SetEscapeId( wxID_NONE );
638 event.Skip();
639}

◆ OnInitDlg()

void DIALOG_SHEET_PROPERTIES::OnInitDlg ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 925 of file dialog_sheet_properties.cpp.

926{
928
929 // Now all widgets have the size fixed, call FinishDialogSettings
931}

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

◆ OnModify()

◆ OnMoveDown()

void DIALOG_SHEET_PROPERTIES::OnMoveDown ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 806 of file dialog_sheet_properties.cpp.

807{
809 return;
810
811 int i = m_grid->GetGridCursorRow();
812
813 if( i >= SHEET_MANDATORY_FIELDS && i < m_grid->GetNumberRows() - 1 )
814 {
815 SCH_FIELD tmp = m_fields->at( (unsigned) i );
816 m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
817 m_fields->insert( m_fields->begin() + i + 1, tmp );
818 m_grid->ForceRefresh();
819
820 m_grid->SetGridCursor( i + 1, m_grid->GetGridCursorCol() );
821 m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
822 }
823 else
824 {
825 wxBell();
826 }
827}

References WX_GRID::CommitPendingChanges(), m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, and SHEET_MANDATORY_FIELDS.

◆ OnMoveUp()

void DIALOG_SHEET_PROPERTIES::OnMoveUp ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 782 of file dialog_sheet_properties.cpp.

783{
785 return;
786
787 int i = m_grid->GetGridCursorRow();
788
789 if( i > SHEET_MANDATORY_FIELDS )
790 {
791 SCH_FIELD tmp = m_fields->at( (unsigned) i );
792 m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
793 m_fields->insert( m_fields->begin() + i - 1, tmp );
794 m_grid->ForceRefresh();
795
796 m_grid->SetGridCursor( i - 1, m_grid->GetGridCursorCol() );
797 m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
798 }
799 else
800 {
801 wxBell();
802 }
803}

References WX_GRID::CommitPendingChanges(), m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, and SHEET_MANDATORY_FIELDS.

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 387 of file dialog_shim.cpp.

388{
390 {
392
393 selectAllInTextCtrls( GetChildren() );
394
397 else
398 KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
399
400 m_firstPaintEvent = false;
401 }
402
403 event.Skip();
404}
bool m_firstPaintEvent
Definition: dialog_shim.h:212
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:213
static void selectAllInTextCtrls(wxWindowList &children)
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:71
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: gtk/ui.cpp:44

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

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onSheetFilenameChanged()

bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged ( const wxString &  aNewFilename)
private

Definition at line 412 of file dialog_sheet_properties.cpp.

413{
414 wxString msg;
415
416 // Sheet file names are relative to the path of the current sheet. This allows for
417 // nesting of schematic files in subfolders. Screen file names are always absolute.
418 wxFileName sheetFileName( aNewFilename );
419
420 if( sheetFileName.GetExt().IsEmpty() )
421 {
422 sheetFileName.SetExt( KiCadSchematicFileExtension );
423 }
424 else if( sheetFileName.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
425 {
426 msg = wxString::Format( _( "The file '%s' does not appear to be a valid schematic file." ),
427 sheetFileName.GetFullName() );
428 wxMessageDialog badSchFileDialog( this, msg, _( "Invalid Schematic File" ),
429 wxOK | wxCENTRE | wxICON_EXCLAMATION );
430 badSchFileDialog.ShowModal();
431 return false;
432 }
433
434 SCHEMATIC& schematic = m_frame->Schematic();
435 SCH_SCREEN* rootScreen = schematic.RootScreen();
436 SCH_SHEET_LIST fullHierarchy = schematic.GetFullHierarchy();
437 std::vector<SCH_SHEET_INSTANCE> sheetInstances = fullHierarchy.GetSheetInstances();
438 std::vector<SYMBOL_INSTANCE_REFERENCE> symbolInstances = rootScreen->GetSymbolInstances();
439 wxFileName screenFileName( sheetFileName );
440 wxFileName tmp( sheetFileName );
441
442 SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
443
444 wxCHECK( currentScreen, false );
445
446 // SCH_SCREEN file names are always absolute.
447 wxFileName currentScreenFileName = currentScreen->GetFileName();
448
449 if( !screenFileName.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS,
450 currentScreenFileName.GetPath() ) )
451 {
452 msg = wxString::Format( _( "Cannot normalize new sheet schematic file path:\n"
453 "'%s'\n"
454 "against parent sheet schematic file path:\n"
455 "'%s'." ),
456 sheetFileName.GetPath(),
457 currentScreenFileName.GetPath() );
458 DisplayError( this, msg );
459 return false;
460 }
461
462 wxString newAbsoluteFilename = screenFileName.GetFullPath();
463
464 // Inside Eeschema, filenames are stored using unix notation
465 newAbsoluteFilename.Replace( wxT( "\\" ), wxT( "/" ) );
466
467 bool renameFile = false;
468 bool loadFromFile = false;
469 bool clearAnnotation = false;
470 bool isExistingSheet = false;
471 SCH_SCREEN* useScreen = nullptr;
472 SCH_SCREEN* oldScreen = nullptr;
473
474 // Search for a schematic file having the same filename already in use in the hierarchy
475 // or on disk, in order to reuse it.
476 if( !schematic.Root().SearchHierarchy( newAbsoluteFilename, &useScreen ) )
477 {
478 loadFromFile = wxFileExists( newAbsoluteFilename );
479
480 wxLogTrace( tracePathsAndFiles, "\n Sheet requested file '%s', %s",
481 newAbsoluteFilename,
482 loadFromFile ? "found" : "not found" );
483 }
484
485 if( m_sheet->GetScreen() == nullptr ) // New just created sheet.
486 {
487 if( !m_frame->AllowCaseSensitiveFileNameClashes( newAbsoluteFilename ) )
488 return false;
489
490 if( useScreen || loadFromFile ) // Load from existing file.
491 {
492 clearAnnotation = true;
493
494 if( !IsOK( this, wxString::Format( _( "'%s' already exists." ),
495 sheetFileName.GetFullName() )
496 + wxT( "\n\n" )
497 + wxString::Format( _( "Link '%s' to this file?" ),
498 newAbsoluteFilename ) ) )
499 {
500 return false;
501 }
502 }
503 else // New file.
504 {
505 m_frame->InitSheet( m_sheet, newAbsoluteFilename );
506 }
507 }
508 else // Existing sheet.
509 {
510 bool isUndoable = true;
511 isExistingSheet = true;
512
513 if( !m_frame->AllowCaseSensitiveFileNameClashes( newAbsoluteFilename ) )
514 return false;
515
516 // We are always using here a case insensitive comparison to avoid issues
517 // under Windows, although under Unix filenames are case sensitive.
518 // But many users create schematic under both Unix and Windows
519 // **
520 // N.B. 1: aSheet->GetFileName() will return a relative path
521 // aSheet->GetScreen()->GetFileName() returns a full path
522 //
523 // N.B. 2: newFilename uses the unix notation for separator.
524 // so we must use it also to compare the old and new filenames
525 wxString oldAbsoluteFilename = m_sheet->GetScreen()->GetFileName();
526 oldAbsoluteFilename.Replace( wxT( "\\" ), wxT( "/" ) );
527
528 if( newAbsoluteFilename.Cmp( oldAbsoluteFilename ) != 0 )
529 {
530 // Sheet file name changes cannot be undone.
531 isUndoable = false;
532
533 if( useScreen || loadFromFile ) // Load from existing file.
534 {
535 clearAnnotation = true;
536
537 if( !IsOK( this, wxString::Format( _( "Change '%s' link from '%s' to '%s'?" ),
538 newAbsoluteFilename,
540 sheetFileName.GetFullName() )
541 + wxT( "\n\n" )
542 + _( "This action cannot be undone." ) ) )
543 {
544 return false;
545 }
546
547 if( loadFromFile )
548 m_sheet->SetScreen( nullptr );
549 }
550 else // Save to new file name.
551 {
552 if( m_sheet->GetScreenCount() > 1 )
553 {
554 if( !IsOK( this, wxString::Format( _( "Create new file '%s' with contents "
555 "of '%s'?" ),
556 sheetFileName.GetFullName(),
558 + wxT( "\n\n" )
559 + _( "This action cannot be undone." ) ) )
560 {
561 return false;
562 }
563 }
564
565 renameFile = true;
566 }
567 }
568
569 // If we are renaming files, the undo/redo list becomes invalid and must be cleared
570 if( isUndoable )
572 else
574
575 if( renameFile )
576 {
577 SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
578
579 // If the associated screen is shared by more than one sheet, do not
580 // change the filename of the corresponding screen here.
581 // (a new screen will be created later)
582 // if it is not shared, update the filename
583 if( m_sheet->GetScreenCount() <= 1 )
584 m_sheet->GetScreen()->SetFileName( newAbsoluteFilename );
585
586 try
587 {
588 pi->Save( newAbsoluteFilename, m_sheet, &schematic );
589 }
590 catch( const IO_ERROR& ioe )
591 {
592 msg = wxString::Format( _( "Error occurred saving schematic file '%s'." ),
593 newAbsoluteFilename );
594 DisplayErrorMessage( this, msg, ioe.What() );
595
596 msg = wxString::Format( _( "Failed to save schematic '%s'" ),
597 newAbsoluteFilename );
598 m_frame->SetMsgPanel( wxEmptyString, msg );
599 return false;
600 }
601
602 // If the associated screen is shared by more than one sheet, remove the
603 // screen and reload the file to a new screen. Failure to do this will trash
604 // the screen reference counting in complex hierarchies.
605 if( m_sheet->GetScreenCount() > 1 )
606 {
607 oldScreen = m_sheet->GetScreen();
608 m_sheet->SetScreen( nullptr );
609 loadFromFile = true;
610 }
611 }
612 }
613
614 SCH_SHEET_PATH& currentSheet = m_frame->GetCurrentSheet();
615
616 if( useScreen )
617 {
618 // Create a temporary sheet for recursion testing to prevent a possible recursion error.
619 std::unique_ptr< SCH_SHEET> tmpSheet = std::make_unique<SCH_SHEET>( &schematic );
620 tmpSheet->GetFields()[SHEETNAME] = m_fields->at( SHEETNAME );
621 tmpSheet->GetFields()[SHEETFILENAME].SetText( sheetFileName.GetFullPath() );
622 tmpSheet->SetScreen( useScreen );
623
624 // No need to check for valid library IDs if we are using an existing screen.
625 if( m_frame->CheckSheetForRecursion( tmpSheet.get(), &currentSheet ) )
626 return false;
627
628 // It's safe to set the sheet screen now.
629 m_sheet->SetScreen( useScreen );
630 // currentSheet.LastScreen()->Append( m_sheet );
631 }
632 else if( loadFromFile )
633 {
634 bool restoreSheet = false;
635
636 if( isExistingSheet )
637 {
638 // Temporarily remove the sheet from the current schematic page so that recursion
639 // and symbol library link tests can be performed with the modified sheet settings.
640 restoreSheet = true;
641 currentSheet.LastScreen()->Remove( m_sheet );
642 }
643
644 if( !m_frame->LoadSheetFromFile( m_sheet, &currentSheet, newAbsoluteFilename )
645 || m_frame->CheckSheetForRecursion( m_sheet, &currentSheet ) )
646 {
647 if( restoreSheet )
648 {
649 // If we cleared the previous screen, restore it before returning to the user
650 if( oldScreen )
651 m_sheet->SetScreen( oldScreen );
652
653 currentSheet.LastScreen()->Append( m_sheet );
654 }
655
656 return false;
657 }
658
659 if( restoreSheet )
660 currentSheet.LastScreen()->Append( m_sheet );
661
662 // The full hierarchy needs to be reloaded because due to the addition of a new sheet.
663 fullHierarchy = schematic.GetFullHierarchy();
664 fullHierarchy.UpdateSheetInstances( sheetInstances );
665 fullHierarchy.UpdateSymbolInstances( symbolInstances );
666 }
667
669 *m_clearAnnotationNewItems = clearAnnotation;
670
671 return true;
672}
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
Holds all the data relating to one schematic.
Definition: schematic.h:60
SCH_SHEET_LIST & GetFullHierarchy() const
Return the full schematic flattened hierarchical sheet list.
Definition: schematic.cpp:411
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:117
SCH_SHEET & Root() const
Definition: schematic.h:92
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
Definition: sheet.cpp:105
bool AllowCaseSensitiveFileNameClashes(const wxString &aSchematicFileName)
Check aSchematicFileName for a potential file name case sensitivity clashes.
Definition: sheet.cpp:553
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition: sheet.cpp:97
bool CheckSheetForRecursion(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Verify that aSheet will not cause a recursion error in aHierarchy.
Definition: sheet.cpp:47
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Definition: sch_io_mgr.h:480
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:273
const wxString & GetFileName() const
Definition: sch_screen.h:142
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Definition: sch_screen.cpp:110
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetSymbolInstances() const
Definition: sch_screen.h:487
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:146
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void UpdateSheetInstances(const std::vector< SCH_SHEET_INSTANCE > &aSheetInstances)
Update all of the sheet instance information using aSheetInstances.
void UpdateSymbolInstances(const std::vector< SYMBOL_INSTANCE_REFERENCE > &aSymbolInstances)
Update all of the symbol instance information using aSymbolInstances.
std::vector< SCH_SHEET_INSTANCE > GetSheetInstances() const
Fetch the instance information for all of the sheets in the hiearchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:302
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:681
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:102
int GetScreenCount() const
Return the number of times the associated screen for the sheet is being used.
Definition: sch_sheet.cpp:183
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:160
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:342
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
const std::string KiCadSchematicFileExtension
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition: wx_filename.h:38

References _, SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes(), SCH_SCREEN::Append(), CHANGED, SCH_EDIT_FRAME::CheckSheetForRecursion(), EDA_BASE_FRAME::ClearUndoRedoList(), DisplayError(), DisplayErrorMessage(), FN_NORMALIZE_FLAGS, Format(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), SCHEMATIC::GetFullHierarchy(), SCH_SHEET::GetScreen(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreenCount(), SCH_SHEET_LIST::GetSheetInstances(), SCH_SCREEN::GetSymbolInstances(), SCH_EDIT_FRAME::InitSheet(), IsOK(), KiCadSchematicFileExtension, SCH_SHEET_PATH::LastScreen(), SCH_EDIT_FRAME::LoadSheetFromFile(), m_clearAnnotationNewItems, m_fields, m_frame, m_sheet, SCH_SCREEN::Remove(), SCHEMATIC::Root(), SCHEMATIC::RootScreen(), SCH_PLUGIN::Save(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::Schematic(), SCH_SHEET::SearchHierarchy(), SCH_SCREEN::SetFileName(), EDA_DRAW_FRAME::SetMsgPanel(), SCH_SHEET::SetScreen(), SHEETFILENAME, SHEETNAME, tracePathsAndFiles, SCH_SHEET_LIST::UpdateSheetInstances(), SCH_SHEET_LIST::UpdateSymbolInstances(), and IO_ERROR::What().

Referenced by TransferDataFromWindow().

◆ OnSizeGrid()

void DIALOG_SHEET_PROPERTIES::OnSizeGrid ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 909 of file dialog_sheet_properties.cpp.

910{
911 auto new_size = event.GetSize();
912
913 if( m_size != new_size )
914 {
915 m_size = new_size;
916
918 }
919
920 // Always propagate for a grid repaint (needed if the height changes, as well as width)
921 event.Skip();
922}

References AdjustGridColumns(), and m_size.

◆ OnUpdateUI()

void DIALOG_SHEET_PROPERTIES::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SHEET_PROPERTIES_BASE.

Definition at line 849 of file dialog_sheet_properties.cpp.

850{
851 wxString shownColumns = m_grid->GetShownColumns();
852
853 if( shownColumns != m_shownColumns )
854 {
855 m_shownColumns = shownColumns;
856
857 if( !m_grid->IsCellEditControlShown() )
859 }
860
861 // Propagate changes in sheetname to displayed hierarchical path
862 wxString path = m_frame->GetCurrentSheet().PathHumanReadable( false );
863
864 if( path.Last() != '/' )
865 path.Append( '/' );
866
867 wxGridCellEditor* editor = m_grid->GetCellEditor( SHEETNAME, FDC_VALUE );
868 wxControl* control = editor->GetControl();
869 wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
870 wxString sheetName;
871
872 if( textControl )
873 sheetName = textControl->GetValue();
874 else
875 sheetName = m_grid->GetCellValue( SHEETNAME, FDC_VALUE );
876
878 m_dummySheetNameField.SetText( sheetName );
880
881 editor->DecRef();
882
883 wxClientDC dc( m_hierarchicalPathLabel );
884 int width = m_sizerBottom->GetSize().x - m_stdDialogButtonSizer->GetSize().x
885 - m_hierarchicalPathLabel->GetSize().x
886 - 30;
887
888 path = wxControl::Ellipsize( path, dc, wxELLIPSIZE_START, width, wxELLIPSIZE_FLAGS_NONE );
889
890 if( m_hierarchicalPath->GetLabel() != path )
891 m_hierarchicalPath->SetLabel( path );
892
893 // Handle a delayed focus
894 if( m_delayedFocusRow >= 0 )
895 {
896 m_grid->SetFocus();
897 m_grid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn );
899
900 m_grid->EnableCellEditControl( true );
901 m_grid->ShowCellEditControl();
902
905 }
906}
wxStdDialogButtonSizer * m_stdDialogButtonSizer
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:165
wxString PathHumanReadable(bool aUseShortRootName=true) const
Return the sheet path in a human readable form made from the sheet names.
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_sheet.cpp:305

References AdjustGridColumns(), editor, FDC_VALUE, SCH_EDIT_FRAME::GetCurrentSheet(), WX_GRID::GetShownColumns(), SCH_FIELD::GetShownText(), m_delayedFocusColumn, m_delayedFocusRow, m_dummySheet, m_dummySheetNameField, m_fields, m_frame, DIALOG_SHEET_PROPERTIES_BASE::m_grid, DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPath, DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPathLabel, m_shownColumns, DIALOG_SHEET_PROPERTIES_BASE::m_sizerBottom, DIALOG_SHEET_PROPERTIES_BASE::m_stdDialogButtonSizer, path, SCH_SHEET_PATH::PathHumanReadable(), SCH_SHEET::SetFields(), EDA_TEXT::SetText(), and SHEETNAME.

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return a reference to the PROJECT associated with this KIWAY.

Definition at line 36 of file kiway_holder.cpp.

37{
38 return Kiway().Prj();
39}
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:192

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

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), FP_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_LIBRARY_MANAGER::addLibrary(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLibrariesListBox(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), SIM_PLOT_FRAME::canCloseWindow(), PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), FIELDS_GRID_TRICKS::doPopupSelection(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), BOARD_EDITOR_CONTROL::ExportNetlist(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SIM_PLOT_FRAME::getDefaultFilename(), SIM_PLOT_FRAME::getDefaultPath(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), PCB_EDIT_FRAME::GetLastPath(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), SCH_BASE_FRAME::GetLibSymbol(), DIALOG_PLOT_SCHEMATIC::getOutputPath(), KICAD_MANAGER_FRAME::GetProjectFileName(), SCH_EDIT_FRAME::GetSchematicJunctionSize(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FIELDS_GRID_TABLE< T >::initGrid(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SYMBOL_EDIT_FRAME::KiwayMailIn(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), PCB_BASE_FRAME::loadFootprint(), CVPCB_MAINFRAME::LoadFootprintFiles(), PCB_EDIT_FRAME::LoadFootprints(), SCH_EDIT_FRAME::LoadProject(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SIM_PLOT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), SIM_PLOT_FRAME::loadWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbookAs(), PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PCB_EDIT_FRAME::onBoardLoaded(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_NETLIST_IMPORT::onBrowseNetlistFiles(), WX_HTML_REPORT_PANEL::onBtnSaveToFile(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), DIALOG_SYMBOL_FIELDS_TABLE::OnExport(), DIALOG_EXPORT_STEP::onExportButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_SCHEMATIC_SETUP::OnPageChanged(), DIALOG_BOARD_SETUP::OnPageChanged(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), SYMBOL_EDITOR_CONTROL::PinLibrary(), FOOTPRINT_EDITOR_CONTROL::PinLibrary(), DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::readNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint(), EDA_3D_VIEWER_FRAME::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), PCB_EDIT_FRAME::RunEeschema(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_EDIT_FRAME::saveSchematicFile(), EDA_BASE_FRAME::SaveSettings(), SIM_PLOT_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), SIM_PLOT_FRAME::saveWorkbook(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), PCB_EDIT_FRAME::SetBoard(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurSymbol(), PCB_EDIT_FRAME::SetLastPath(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SYMBOL_VIEWER_FRAME::ShowModal(), SYMBOL_LIBRARY_MANAGER::symTable(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER_FRAME::takeScreenshot(), PCB_EDIT_FRAME::TestStandalone(), DIALOG_ASSIGN_NETCLASS::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), SYMBOL_EDITOR_CONTROL::UnpinLibrary(), FOOTPRINT_EDITOR_CONTROL::UnpinLibrary(), SCH_EDIT_FRAME::updateAutoSaveFile(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), SCH_EDIT_FRAME::UpdateTitle(), SIM_PLOT_FRAME::updateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME(), PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL(), 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 294 of file dialog_shim.cpp.

295{
296 const char* hash_key;
297
298 if( m_hash_key.size() )
299 {
300 // a special case like EDA_LIST_DIALOG, which has multiple uses.
301 hash_key = m_hash_key.c_str();
302 }
303 else
304 {
305 hash_key = typeid(*this).name();
306 }
307
308 std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
309
310 if( it == class_map.end() )
311 return;
312
313 wxRect rect = it->second;
314 rect.SetSize( wxSize( 0, 0 ) );
315 class_map[ hash_key ] = rect;
316}
std::string m_hash_key
Definition: dialog_shim.h:203
static std::unordered_map< std::string, wxRect > class_map

References class_map, and DIALOG_SHIM::m_hash_key.

Referenced by DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES().

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

98 {
99 m_initialFocusTarget = aWindow;
100 }

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GET_FOOTPRINT_BY_NAME::DIALOG_GET_FOOTPRINT_BY_NAME(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), 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_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), HK_PROMPT_DIALOG::HK_PROMPT_DIALOG(), DIALOG_FIELD_PROPERTIES::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(), DIALOG_COPPER_ZONE::TransferDataToWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow(), and WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG().

◆ SetKiway()

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

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
aKiwayis often from a parent window or from KIFACE::CreateWindow().

Definition at line 43 of file kiway_holder.cpp.

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

References ignore_unused(), KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetPosition()

void DIALOG_SHIM::SetPosition ( const wxPoint &  aNewPosition)
inherited

Force the position of the dialog to a new position.

Parameters
aNewPositionis the new forced position

Definition at line 197 of file dialog_shim.cpp.

198{
199 wxDialog::SetPosition( aNewPosition );
200
201 // Now update the stored position:
202 const char* hash_key;
203
204 if( m_hash_key.size() )
205 {
206 // a special case like EDA_LIST_DIALOG, which has multiple uses.
207 hash_key = m_hash_key.c_str();
208 }
209 else
210 {
211 hash_key = typeid(*this).name();
212 }
213
214 std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
215
216 if( it == class_map.end() )
217 return;
218
219 wxRect rect = it->second;
220 rect.SetPosition( aNewPosition );
221
222 class_map[ hash_key ] = rect;
223}
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References class_map, DIALOG_SHIM::m_hash_key, and PCAD2KICAD::SetPosition().

Referenced by PCB_BASE_FRAME::SelectOneLayer().

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

170{
171 wxSize sz( x, y );
172 SetSize( ConvertDialogToPixels( sz ) );
173}

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

◆ SetupStandardButtons()

void DIALOG_SHIM::SetupStandardButtons ( std::map< int, wxString >  aLabels = {})
inherited

Definition at line 709 of file dialog_shim.cpp.

710{
711 recursiveDescent( GetSizer(), aLabels );
712}
static void recursiveDescent(wxSizer *aSizer, std::map< int, wxString > &aLabels)

References recursiveDescent().

Referenced by CONVERT_SETTINGS_DIALOG::CONVERT_SETTINGS_DIALOG(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_BOM::DIALOG_BOM(), DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CLEANUP_GRAPHICS::DIALOG_CLEANUP_GRAPHICS(), DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(), DIALOG_DIELECTRIC_MATERIAL::DIALOG_DIELECTRIC_MATERIAL(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FILTER_SELECTION::DIALOG_FILTER_SELECTION(), DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_GENDRILL::DIALOG_GENDRILL(), DIALOG_GET_FOOTPRINT_BY_NAME::DIALOG_GET_FOOTPRINT_BY_NAME(), DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION(), 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_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_IMPORT_SETTINGS::DIALOG_IMPORT_SETTINGS(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MIGRATE_SETTINGS::DIALOG_MIGRATE_SETTINGS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), 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_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PCM::DIALOG_PCM(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS(), DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS(), 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_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCH_IMPORT_SETTINGS::DIALOG_SCH_IMPORT_SETTINGS(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES(), DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_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(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), EDA_LIST_DIALOG::EDA_LIST_DIALOG(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), NETLIST_DIALOG_ADD_GENERATOR::NETLIST_DIALOG_ADD_GENERATOR(), PAGED_DIALOG::PAGED_DIALOG(), DIALOG_CLEANUP_TRACKS_AND_VIAS::setupOKButtonLabel(), WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG(), and WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 226 of file dialog_shim.cpp.

227{
228 bool ret;
229 const char* hash_key;
230
231 if( m_hash_key.size() )
232 {
233 // a special case like EDA_LIST_DIALOG, which has multiple uses.
234 hash_key = m_hash_key.c_str();
235 }
236 else
237 {
238 hash_key = typeid(*this).name();
239 }
240
241 // Show or hide the window. If hiding, save current position and size.
242 // If showing, use previous position and size.
243 if( show )
244 {
245#ifndef __WINDOWS__
246 wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
247#endif
248 ret = wxDialog::Show( show );
249
250 // classname is key, returns a zeroed out default EDA_RECT if none existed before.
251 wxRect savedDialogRect = class_map[ hash_key ];
252
253 if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
254 {
256 {
257 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
258 wxDialog::GetSize().x, wxDialog::GetSize().y, 0 );
259 }
260 else
261 {
262 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
263 std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
264 std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
265 0 );
266 }
267 }
268 else if( m_initialSize != wxDefaultSize )
269 SetSize( m_initialSize );
270
271 // Be sure that the dialog appears in a visible area
272 // (the dialog position might have been stored at the time when it was
273 // shown on another display)
274 if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
275 Centre();
276 }
277 else
278 {
279 // Save the dialog's position & size before hiding, using classname as key
280 class_map[ hash_key ] = wxRect( wxDialog::GetPosition(), wxDialog::GetSize() );
281
282#ifdef __WXMAC__
283 if ( m_eventLoop )
284 m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
285#endif
286
287 ret = wxDialog::Show( show );
288 }
289
290 return ret;
291}
bool m_useCalculatedSize
Definition: dialog_shim.h:207
wxSize m_initialSize
Definition: dialog_shim.h:225

References class_map, DIALOG_SHIM::m_hash_key, DIALOG_SHIM::m_initialSize, and DIALOG_SHIM::m_useCalculatedSize.

Referenced by FOOTPRINT_EDITOR_CONTROL::CheckFootprint(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), DIALOG_SHIM::EndQuasiModal(), GROUP_TOOL::GroupProperties(), EE_INSPECTION_TOOL::NextMarker(), DRC_TOOL::NextMarker(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_FOOTPRINT_CHECKER::OnLeftDClickItem(), GROUP_TOOL::PickNewMember(), EE_INSPECTION_TOOL::PrevMarker(), DRC_TOOL::PrevMarker(), CVPCB_MAINFRAME::readNetListAndFpFiles(), DIALOG_PAD_PROPERTIES::Show(), EDA_VIEW_SWITCHER::Show(), DIALOG_FIND::Show(), DRC_TOOL::ShowDRCDialog(), EE_INSPECTION_TOOL::ShowERCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), HTML_MESSAGE_BOX::ShowModeless(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 437 of file dialog_shim.cpp.

438{
439 // This is an exception safe way to zero a pointer before returning.
440 // Yes, even though DismissModal() clears this first normally, this is
441 // here in case there's an exception before the dialog is dismissed.
442 struct NULLER
443 {
444 void*& m_what;
445 NULLER( void*& aPtr ) : m_what( aPtr ) {}
446 ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
447 } clear_this( (void*&) m_qmodal_loop );
448
449 // release the mouse if it's currently captured as the window having it
450 // will be disabled when this dialog is shown -- but will still keep the
451 // capture making it impossible to do anything in the modal dialog itself
452 wxWindow* win = wxWindow::GetCapture();
453 if( win )
454 win->ReleaseMouse();
455
456 // Get the optimal parent
457 wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
458
459 wxASSERT_MSG( !m_qmodal_parent_disabler, wxT( "Caller using ShowQuasiModal() twice on same "
460 "window?" ) );
461
462 // quasi-modal: disable only my "optimal" parent
464
465 // Apple in its infinite wisdom will raise a disabled window before even passing
466 // us the event, so we have no way to stop it. Instead, we must set an order on
467 // the windows so that the quasi-modal will be pushed in front of the disabled
468 // window when it is raised.
470
471 Show( true );
472
473 m_qmodal_showing = true;
474
475 WX_EVENT_LOOP event_loop;
476
477 m_qmodal_loop = &event_loop;
478
479 event_loop.Run();
480
481 m_qmodal_showing = false;
482
483 return GetReturnCode();
484}
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:46
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
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:65

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 SCH_EDIT_TOOL::ChangeSymbols(), S3D::Configure3DPaths(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), PCB::IFACE::CreateWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditSymbolFields(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), InvokeCopperZonesEditor(), InvokeDialogCreateBOM(), InvokeDialogEditSymbolsLibId(), InvokeDialogRescueEach(), InvokeNonCopperZonesEditor(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), S3D::Select3DModel(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowExchangeFootprintsDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::ShowPadPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog(), and PCB_EDIT_FRAME::ToPlotter().

◆ TransferDataFromWindow()

bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow ( )
overrideprivate

Definition at line 243 of file dialog_sheet_properties.cpp.

244{
245 if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
246 return false;
247
248 // Sheet file names can be relative or absolute.
249 wxString sheetFileName = m_fields->at( SHEETFILENAME ).GetText();
250
251 // Ensure filepath is not empty. (In normal use will be caught by grid validators,
252 // but unedited data from existing files can be bad.)
253 if( sheetFileName.IsEmpty() )
254 {
255 DisplayError( this, _( "A sheet must have a valid file name." ) );
256 return false;
257 }
258
259 // Ensure the filename extension is OK. In normal use will be caught by grid validators,
260 // but unedited data from existing files can be bad.
261 wxFileName fn( sheetFileName );
262
263 if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
264 {
265 DisplayError( this, _( "Sheet file must have a '.kicad_sch' extension." ) );
266 return false;
267 }
268
269 wxString newRelativeFilename = fn.GetFullPath();
270
271 // Inside Eeschema, filenames are stored using unix notation
272 newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );
273
274 wxString oldFilename = m_sheet->GetFields()[ SHEETFILENAME ].GetText();
275 oldFilename.Replace( wxT( "\\" ), wxT( "/" ) );
276
277 bool filename_changed = oldFilename != newRelativeFilename;
278
279 if( filename_changed || m_sheet->IsNew() )
280 {
281 SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
282
283 wxCHECK( currentScreen, false );
284
285 bool clearFileName = false;
286
287 // This can happen for the root sheet when opening Eeschema in the stand alone mode.
288 if( currentScreen->GetFileName().IsEmpty() )
289 {
290 clearFileName = true;
291 currentScreen->SetFileName( m_frame->Prj().AbsolutePath( wxT( "noname.kicad_sch" ) ) );
292 }
293
294 wxFileName tmp( fn );
295 wxFileName screenFileName = currentScreen->GetFileName();
296
297 if( fn.IsAbsolute() && fn.MakeRelativeTo( screenFileName.GetPath() ) )
298 {
299 wxMessageDialog makeRelDlg( this, _( "Use relative path for sheet file?" ),
300 _( "Sheet File Path" ),
301 wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
302
303 makeRelDlg.SetExtendedMessage( _( "Using relative hierarchical sheet file name paths "
304 "improves schematic portability across systems and "
305 "platforms. Using absolute paths can result in "
306 "portability issues." ) );
307 makeRelDlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Use Relative Path" ) ),
308 wxMessageDialog::ButtonLabel( _( "Use Absolute Path" ) ) );
309
310 if( makeRelDlg.ShowModal() == wxID_YES )
311 {
312 wxLogTrace( tracePathsAndFiles, "\n Converted absolute path: '%s'"
313 "\n to relative path: '%s'",
314 tmp.GetPath(),
315 fn.GetPath() );
316 m_fields->at( SHEETFILENAME ).SetText( fn.GetFullPath() );
317 newRelativeFilename = fn.GetFullPath();
318 }
319 }
320
321 if( !onSheetFilenameChanged( newRelativeFilename ) )
322 {
323 if( clearFileName )
324 currentScreen->SetFileName( wxEmptyString );
325
326 return false;
327 }
328
329 if( clearFileName )
330 currentScreen->SetFileName( wxEmptyString );
331
332 // One last validity check (and potential repair) just to be sure to be sure
333 SCH_SHEET_LIST repairedList( &m_frame->Schematic().Root(), true );
334 }
335
336 wxString newSheetname = m_fields->at( SHEETNAME ).GetText();
337
338 if( newSheetname.IsEmpty() )
339 newSheetname = _( "Untitled Sheet" );
340
341 m_fields->at( SHEETNAME ).SetText( newSheetname );
342
343 // change all field positions from relative to absolute
344 for( unsigned i = 0; i < m_fields->size(); ++i )
345 m_fields->at( i ).Offset( m_sheet->GetPosition() );
346
349
351
353
354 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
355
356 if( colorSettings->GetOverrideSchItemColors()
359 {
360 wxPanel temp( this );
361 temp.Hide();
362 PANEL_EESCHEMA_COLOR_SETTINGS prefs( &temp );
363 wxString checkboxLabel = prefs.m_optOverrideColors->GetLabel();
364
365 KIDIALOG dlg( this, _( "Note: item colors are overridden in the current color theme." ),
367 dlg.ShowDetailedText( wxString::Format( _( "To see individual item colors uncheck '%s'\n"
368 "in Preferences > Eeschema > Colors." ),
369 checkboxLabel ) );
370 dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
371 dlg.ShowModal();
372 }
373
376
378
379 instance.push_back( m_sheet );
380
381 if( m_sheet->IsNew() )
382 {
383 m_sheet->AddInstance( instance );
384
385 if( filename_changed )
386 {
387 // Set the symbol instance data to the default for all new sheets and sub-sheets.
388 SCH_SHEET_LIST newInstances( m_sheet );
389
390 for( SCH_SHEET_PATH& newInstance : newInstances )
391 {
392 instance = m_frame->GetCurrentSheet() + newInstance;
394 }
395 }
396 }
397
398 m_sheet->SetPageNumber( instance, m_pageNumberTextCtrl->GetValue() );
399
401
402 // Refresh all sheets in case ordering changed.
403 for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_SHEET_T ) )
404 m_frame->UpdateItem( item );
405
406 m_frame->OnModify();
407
408 return true;
409}
Color settings are a bit different than most of the settings objects in that there can be more than o...
KIGFX::COLOR4D GetSwatchColor() const
bool onSheetFilenameChanged(const wxString &aNewFilename)
bool IsNew() const
Definition: eda_item.h:118
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:235
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:46
@ KD_WARNING
Definition: confirm.h:49
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:263
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:145
void ClearFieldsAutoplaced()
Definition: sch_item.h:416
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:107
void SetSymbolInstancesToDefault()
Set all of the symbol instances in this sheet instance to the default symbol instance data.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void SetBorderColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:111
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:90
void SetBackgroundColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:114
VECTOR2I GetPosition() const override
Definition: sch_sheet.h:367
void SetPageNumber(const SCH_SHEET_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
Definition: sch_sheet.cpp:1194
bool AddInstance(const SCH_SHEET_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
Definition: sch_sheet.cpp:1149
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:110
void SetBorderWidth(int aWidth)
Definition: sch_sheet.h:108
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:113
virtual long long int GetValue()
Return the current value in Internal Units.
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
@ SCH_SHEET_T
Definition: typeinfo.h:149

References _, PROJECT::AbsolutePath(), SCH_SHEET::AddInstance(), SCH_ITEM::ClearFieldsAutoplaced(), DisplayError(), KIDIALOG::DoNotShowCheckbox(), Format(), SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), SCH_BASE_FRAME::GetColorSettings(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFields(), SCH_SCREEN::GetFileName(), COLOR_SETTINGS::GetOverrideSchItemColors(), SCH_SHEET::GetPosition(), SCH_EDIT_FRAME::GetScreen(), COLOR_SWATCH::GetSwatchColor(), UNIT_BINDER::GetValue(), EDA_ITEM::IsNew(), SCH_SCREEN::Items(), KIDIALOG::KD_WARNING, KiCadSchematicFileExtension, SCH_SHEET_PATH::LastScreen(), DIALOG_SHEET_PROPERTIES_BASE::m_backgroundSwatch, DIALOG_SHEET_PROPERTIES_BASE::m_borderSwatch, m_borderWidth, m_fields, m_frame, PANEL_COLOR_SETTINGS_BASE::m_optOverrideColors, DIALOG_SHEET_PROPERTIES_BASE::m_pageNumberTextCtrl, m_sheet, EE_RTREE::OfType(), SCH_EDIT_FRAME::OnModify(), onSheetFilenameChanged(), positioningChanged(), KIWAY_HOLDER::Prj(), SCH_SHEET_PATH::push_back(), SCHEMATIC::Root(), SCH_SHEET_T, SCH_EDIT_FRAME::Schematic(), SCH_SHEET::SetBackgroundColor(), SCH_SHEET::SetBorderColor(), SCH_SHEET::SetBorderWidth(), SCH_SHEET::SetFields(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetPageNumber(), SCH_SHEET_PATH::SetSymbolInstancesToDefault(), SHEETFILENAME, SHEETNAME, KIDIALOG::ShowModal(), SCH_EDIT_FRAME::TestDanglingEnds(), tracePathsAndFiles, and SCH_EDIT_FRAME::UpdateItem().

◆ TransferDataToWindow()

bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow ( )
overrideprivate

Definition at line 122 of file dialog_sheet_properties.cpp.

123{
124 if( !wxDialog::TransferDataToWindow() )
125 return false;
126
127 // Push a copy of each field into m_updateFields
128 for( SCH_FIELD& field : m_sheet->GetFields() )
129 {
130 SCH_FIELD field_copy( field );
131
132#ifdef __WINDOWS__
133 // Filenames are stored using unix notation
134 if( field_copy.GetId() == SHEETFILENAME )
135 {
136 wxString filename = field_copy.GetText();
137 filename.Replace( wxT( "/" ), wxT( "\\" ) );
138 field_copy.SetText( filename );
139 }
140#endif
141
142 // change offset to be symbol-relative
143 field_copy.Offset( -m_sheet->GetPosition() );
144
145 m_fields->push_back( field_copy );
146 }
147
148 // notify the grid
149 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->size() );
150 m_grid->ProcessTableMessage( msg );
152
153 // border width
155
156 // set up color swatches
157 KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
158 KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
159
160 m_borderSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
161 m_backgroundSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
162
163 m_borderSwatch->SetSwatchColor( borderColor, false );
164 m_backgroundSwatch->SetSwatchColor( backgroundColor, false );
165
169
172
173 instance.push_back( m_sheet );
174
175 wxString nextPageNumber = m_sheet->GetPageNumber( instance );
176
177 m_pageNumberTextCtrl->ChangeValue( nextPageNumber );
178
179 Layout();
180
181 return true;
182}
COLOR4D GetColor(int aLayer) const
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
wxString GetPageNumber(const SCH_SHEET_PATH &aInstance) const
Return the sheet page number for aInstance.
Definition: sch_sheet.cpp:1174
int GetBorderWidth() const
Definition: sch_sheet.h:107
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376

References AdjustGridColumns(), SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), SCH_SHEET::GetBorderWidth(), COLOR_SETTINGS::GetColor(), SCH_BASE_FRAME::GetColorSettings(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFields(), SCHEMATIC::GetFullHierarchy(), SCH_FIELD::GetId(), SCH_SHEET::GetPageNumber(), SCH_SHEET::GetPosition(), EDA_TEXT::GetText(), LAYER_SCHEMATIC_BACKGROUND, DIALOG_SHEET_PROPERTIES_BASE::m_backgroundSwatch, DIALOG_SHEET_PROPERTIES_BASE::m_borderSwatch, m_borderWidth, m_fields, m_frame, DIALOG_SHEET_PROPERTIES_BASE::m_grid, DIALOG_SHEET_PROPERTIES_BASE::m_pageNumberTextCtrl, m_sheet, EDA_TEXT::Offset(), SCH_SHEET_PATH::push_back(), SCH_EDIT_FRAME::Schematic(), COLOR_SWATCH::SetDefaultColor(), COLOR_SWATCH::SetSwatchBackground(), COLOR_SWATCH::SetSwatchColor(), EDA_TEXT::SetText(), UNIT_BINDER::SetValue(), and SHEETFILENAME.

Referenced by OnInitDlg().

◆ Validate()

bool DIALOG_SHEET_PROPERTIES::Validate ( )
overrideprivate

Definition at line 185 of file dialog_sheet_properties.cpp.

186{
187 LIB_ID id;
188
189 if( !m_grid->CommitPendingChanges() || !m_grid->Validate() )
190 return false;
191
192 // Check for missing field names.
193 for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields->size(); ++i )
194 {
195 SCH_FIELD& field = m_fields->at( i );
196 wxString fieldName = field.GetName( false );
197
198 if( fieldName.IsEmpty() )
199 {
200 DisplayErrorMessage( this, _( "Fields must have a name." ) );
201
204
205 return false;
206 }
207 }
208
209 return true;
210}
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:52
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:791
@ FDC_NAME

References _, WX_GRID::CommitPendingChanges(), DisplayErrorMessage(), FDC_NAME, SCH_FIELD::GetName(), m_delayedFocusColumn, m_delayedFocusRow, m_fields, DIALOG_SHEET_PROPERTIES_BASE::m_grid, and SHEET_MANDATORY_FIELDS.

◆ vertPixelsFromDU()

int DIALOG_SHIM::vertPixelsFromDU ( int  y) const
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 183 of file dialog_shim.cpp.

184{
185 wxSize sz( 0, y );
186 return ConvertDialogToPixels( sz ).y;
187}

Referenced by DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

Member Data Documentation

◆ m_backgroundColorLabel

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_backgroundColorLabel
protectedinherited

◆ m_backgroundSwatch

COLOR_SWATCH* DIALOG_SHEET_PROPERTIES_BASE::m_backgroundSwatch
protectedinherited

◆ m_borderColorLabel

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_borderColorLabel
protectedinherited

◆ m_borderSwatch

COLOR_SWATCH* DIALOG_SHEET_PROPERTIES_BASE::m_borderSwatch
protectedinherited

◆ m_borderWidth

UNIT_BINDER DIALOG_SHEET_PROPERTIES::m_borderWidth
private

Definition at line 76 of file dialog_sheet_properties.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_borderWidthCtrl

wxTextCtrl* DIALOG_SHEET_PROPERTIES_BASE::m_borderWidthCtrl
protectedinherited

◆ m_borderWidthLabel

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_borderWidthLabel
protectedinherited

◆ m_borderWidthUnits

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_borderWidthUnits
protectedinherited

◆ m_bpAdd

wxBitmapButton* DIALOG_SHEET_PROPERTIES_BASE::m_bpAdd
protectedinherited

◆ m_bpDelete

wxBitmapButton* DIALOG_SHEET_PROPERTIES_BASE::m_bpDelete
protectedinherited

◆ m_bpMoveDown

wxBitmapButton* DIALOG_SHEET_PROPERTIES_BASE::m_bpMoveDown
protectedinherited

◆ m_bpMoveUp

wxBitmapButton* DIALOG_SHEET_PROPERTIES_BASE::m_bpMoveUp
protectedinherited

◆ m_clearAnnotationNewItems

bool* DIALOG_SHEET_PROPERTIES::m_clearAnnotationNewItems
private

Definition at line 68 of file dialog_sheet_properties.h.

Referenced by onSheetFilenameChanged().

◆ m_delayedFocusColumn

int DIALOG_SHEET_PROPERTIES::m_delayedFocusColumn
private

◆ m_delayedFocusRow

int DIALOG_SHEET_PROPERTIES::m_delayedFocusRow
private

◆ m_dummySheet

SCH_SHEET DIALOG_SHEET_PROPERTIES::m_dummySheet
private

Definition at line 78 of file dialog_sheet_properties.h.

Referenced by OnUpdateUI().

◆ m_dummySheetNameField

SCH_FIELD DIALOG_SHEET_PROPERTIES::m_dummySheetNameField
private

Definition at line 79 of file dialog_sheet_properties.h.

Referenced by OnUpdateUI().

◆ m_fields

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 212 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_frame

SCH_EDIT_FRAME* DIALOG_SHEET_PROPERTIES::m_frame
private

◆ m_grid

◆ m_hash_key

◆ m_hierarchicalPath

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPath
protectedinherited

◆ m_hierarchicalPathLabel

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_hierarchicalPathLabel
protectedinherited

◆ m_infoBar

WX_INFOBAR* DIALOG_SHEET_PROPERTIES_BASE::m_infoBar
protectedinherited

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 213 of file dialog_shim.h.

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

◆ m_initialSize

wxSize DIALOG_SHIM::m_initialSize
protectedinherited

Definition at line 225 of file dialog_shim.h.

Referenced by DIALOG_SHIM::Show().

◆ m_kiway

KIWAY* KIWAY_HOLDER::m_kiway
privateinherited

◆ m_longForm

wxBoxSizer* DIALOG_SHEET_PROPERTIES_BASE::m_longForm
protectedinherited

◆ m_pageNumberStaticText

wxStaticText* DIALOG_SHEET_PROPERTIES_BASE::m_pageNumberStaticText
protectedinherited

◆ m_pageNumberTextCtrl

wxTextCtrl* DIALOG_SHEET_PROPERTIES_BASE::m_pageNumberTextCtrl
protectedinherited

◆ m_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

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

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

◆ m_sheet

SCH_SHEET* DIALOG_SHEET_PROPERTIES::m_sheet
private

◆ m_shownColumns

wxString DIALOG_SHEET_PROPERTIES::m_shownColumns
private

Definition at line 73 of file dialog_sheet_properties.h.

Referenced by DIALOG_SHEET_PROPERTIES(), and OnUpdateUI().

◆ m_size

wxSize DIALOG_SHEET_PROPERTIES::m_size
private

Definition at line 70 of file dialog_sheet_properties.h.

Referenced by OnSizeGrid().

◆ m_sizerBottom

wxBoxSizer* DIALOG_SHEET_PROPERTIES_BASE::m_sizerBottom
protectedinherited

◆ m_staticline1

wxStaticLine* DIALOG_SHEET_PROPERTIES_BASE::m_staticline1
protectedinherited

◆ m_stdDialogButtonSizer

wxStdDialogButtonSizer* DIALOG_SHEET_PROPERTIES_BASE::m_stdDialogButtonSizer
protectedinherited

◆ m_stdDialogButtonSizerCancel

wxButton* DIALOG_SHEET_PROPERTIES_BASE::m_stdDialogButtonSizerCancel
protectedinherited

◆ m_stdDialogButtonSizerOK

wxButton* DIALOG_SHEET_PROPERTIES_BASE::m_stdDialogButtonSizerOK
protectedinherited

◆ m_tabOrder

◆ m_type

HOLDER_TYPE KIWAY_HOLDER::m_type
privateinherited

Definition at line 85 of file kiway_holder.h.

Referenced by KIWAY_HOLDER::GetType(), and SIM_PLOT_FRAME::onSimFinished().

◆ m_units

◆ m_useCalculatedSize

bool DIALOG_SHIM::m_useCalculatedSize
protectedinherited

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