KiCad PCB EDA Suite
DIALOG_SCH_SHEET_PROPS Class Reference

#include <dialog_sch_sheet_props.h>

Inheritance diagram for DIALOG_SCH_SHEET_PROPS:
DIALOG_SCH_SHEET_PROPS_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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_hiearchicalPathLabel
 
wxTextCtrl * m_heirarchyPath
 
wxStaticText * m_timestampLabel
 
wxTextCtrl * m_textCtrlTimeStamp
 
wxStaticLine * m_staticline1
 
wxStdDialogButtonSizer * m_stdDialogButtonSizer
 
wxButton * m_stdDialogButtonSizerOK
 
wxButton * m_stdDialogButtonSizerCancel
 
EDA_UNITS m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
EDA_BASE_FRAMEm_parentFrame
 
std::vector< wxWindow * > m_tabOrder
 

Private Member Functions

bool 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 (int aWidth)
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
SCH_SHEETm_sheet
 
bool * m_clearAnnotationNewItems
 
int m_width
 
int m_delayedFocusRow
 
int m_delayedFocusColumn
 
wxString m_shownColumns
 
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields
 
UNIT_BINDER m_borderWidth
 

Detailed Description

Definition at line 37 of file dialog_sch_sheet_props.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_SCH_SHEET_PROPS()

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

Definition at line 42 of file dialog_sch_sheet_props.cpp.

43  :
44  DIALOG_SCH_SHEET_PROPS_BASE( aParent ),
45  m_frame( aParent ),
46  m_clearAnnotationNewItems( aClearAnnotationNewItems ),
48 {
49  m_sheet = aSheet;
50  m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_sheet );
51  m_width = 100; // Will be later set to a better value
54 
55  // Give a bit more room for combobox editors
56  m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
57 
59  m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
60 
61  // Show/hide columns according to user's preference
62  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
63  wxASSERT( cfg );
64 
65  if( cfg )
66  {
67  m_shownColumns = cfg->m_Appearance.edit_sheet_visible_columns;
69  }
70 
71  wxToolTip::Enable( true );
72  m_stdDialogButtonSizerOK->SetDefault();
73 
74  // Configure button logos
75  m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
76  m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
77  m_bpMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
78  m_bpMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
79 
80  // Set font sizes
81  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
82  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
83  m_hiearchicalPathLabel->SetFont( infoFont );
84  m_heirarchyPath->SetFont( infoFont );
85  m_heirarchyPath->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
86  m_timestampLabel->SetFont( infoFont );
87  m_textCtrlTimeStamp->SetFont( infoFont );
88  m_textCtrlTimeStamp->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
89 
90  // wxFormBuilder doesn't include this event...
91  m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
92  wxGridEventHandler( DIALOG_SCH_SHEET_PROPS::OnGridCellChanging ),
93  NULL, this );
94 
96 }
const BITMAP_OPAQUE trash_xpm[1]
Definition: trash.cpp:46
void ShowHideColumns(const wxString &shownColumns)
Show/hide the grid columns based on a tokenized string of shown column indexes.
Definition: wx_grid.cpp:121
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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:59
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
DIALOG_SCH_SHEET_PROPS_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)
#define NULL
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void OnGridCellChanging(wxGridEvent &event)
const BITMAP_OPAQUE small_down_xpm[1]
Definition: small_down.cpp:25
const BITMAP_OPAQUE small_up_xpm[1]
Definition: small_up.cpp:26
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:20
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

References FDC_VALUE, DIALOG_SHIM::FinishDialogSettings(), KiBitmap(), Kiface(), DIALOG_SCH_SHEET_PROPS_BASE::m_bpAdd, DIALOG_SCH_SHEET_PROPS_BASE::m_bpDelete, DIALOG_SCH_SHEET_PROPS_BASE::m_bpMoveDown, DIALOG_SCH_SHEET_PROPS_BASE::m_bpMoveUp, m_delayedFocusColumn, m_delayedFocusRow, m_fields, DIALOG_SCH_SHEET_PROPS_BASE::m_grid, DIALOG_SCH_SHEET_PROPS_BASE::m_heirarchyPath, DIALOG_SCH_SHEET_PROPS_BASE::m_hiearchicalPathLabel, m_sheet, m_shownColumns, DIALOG_SCH_SHEET_PROPS_BASE::m_stdDialogButtonSizerOK, DIALOG_SCH_SHEET_PROPS_BASE::m_textCtrlTimeStamp, DIALOG_SCH_SHEET_PROPS_BASE::m_timestampLabel, m_width, NULL, OnGridCellChanging(), WX_GRID::SetTable(), SHEETNAME, WX_GRID::ShowHideColumns(), small_down_xpm, small_plus_xpm, small_up_xpm, and trash_xpm.

◆ ~DIALOG_SCH_SHEET_PROPS()

DIALOG_SCH_SHEET_PROPS::~DIALOG_SCH_SHEET_PROPS ( )
override

Definition at line 99 of file dialog_sch_sheet_props.cpp.

100 {
101  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
102  wxASSERT( cfg );
103 
104  if( cfg )
105  cfg->m_Appearance.edit_sheet_visible_columns = m_grid->GetShownColumns();
106 
107  // Prevents crash bug in wxGrid's d'tor
109 
110  m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
111  wxGridEventHandler( DIALOG_SCH_SHEET_PROPS::OnGridCellChanging ),
112  NULL, this );
113 
114  // Delete the GRID_TRICKS.
115  m_grid->PopEventHandler( true );
116 }
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:90
#define NULL
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void OnGridCellChanging(wxGridEvent &event)
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:103
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

References WX_GRID::DestroyTable(), WX_GRID::GetShownColumns(), Kiface(), m_fields, DIALOG_SCH_SHEET_PROPS_BASE::m_grid, NULL, and OnGridCellChanging().

Member Function Documentation

◆ AdjustGridColumns()

void DIALOG_SCH_SHEET_PROPS::AdjustGridColumns ( int  aWidth)
private

Definition at line 725 of file dialog_sch_sheet_props.cpp.

726 {
727  m_width = aWidth;
728  // Account for scroll bars
729  aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x );
730 
731  m_grid->AutoSizeColumn( 0 );
732 
733  int fixedColsWidth = m_grid->GetColSize( 0 );
734 
735  for( int i = 2; i < m_grid->GetNumberCols(); i++ )
736  fixedColsWidth += m_grid->GetColSize( i );
737 
738  m_grid->SetColSize( 1, aWidth - fixedColsWidth );
739 }

References DIALOG_SCH_SHEET_PROPS_BASE::m_grid, and m_width.

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

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 264 of file dialog_shim.cpp.

265 {
266  // so we can do logging of this state change:
267 
268 #if 0 && defined(DEBUG)
269  const char* type_id = typeid( *this ).name();
270  printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
271  fflush(0); //Needed on msys2 to immediately print the message
272 #endif
273 
274  return wxDialog::Enable( enable );
275 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 421 of file dialog_shim.cpp.

422 {
423  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
424  // handle validation in the same way as other dialogs.
425  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
426  return;
427 
428  SetReturnCode( retCode );
429 
430  if( !IsQuasiModal() )
431  {
432  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
433  "wasn't called" );
434  return;
435  }
436 
437  if( m_qmodal_loop )
438  {
439  if( m_qmodal_loop->IsRunning() )
440  m_qmodal_loop->Exit( 0 );
441  else
442  m_qmodal_loop->ScheduleExit( 0 );
443 
445  }
446 
449 
450  Show( false );
451 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
#define NULL
bool IsQuasiModal()
Definition: dialog_shim.h:124
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208

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

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

◆ FinishDialogSettings()

void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

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

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

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

Definition at line 139 of file dialog_shim.cpp.

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

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_EDITOR_DATA::DIALOG_EDITOR_DATA(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), 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_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_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_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_SHEET_PROPS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

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

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ HorizPixelsFromDU()

int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 160 of file dialog_shim.cpp.

161 {
162  wxSize sz( x, 0 );
163  return ConvertDialogToPixels( sz ).x;
164 }

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

◆ IsCtrl()

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

Definition at line 137 of file dialog_shim.h.

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

Referenced by DIALOG_LABEL_EDITOR::OnCharHook(), and DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

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

Definition at line 143 of file dialog_shim.h.

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

Referenced by DIALOG_LABEL_EDITOR::OnCharHook(), and DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

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

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 56 of file kiway_holder.h.

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

References KIWAY_HOLDER::m_kiway.

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

◆ OnAddField()

void DIALOG_SCH_SHEET_PROPS::OnAddField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 627 of file dialog_sch_sheet_props.cpp.

628 {
629  if( !m_grid->CommitPendingChanges() )
630  return;
631 
632  int fieldID = m_fields->size();
633  SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet,
634  SCH_SHEET::GetDefaultFieldName( fieldID ) );
635 
636  newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );
637 
638  m_fields->push_back( newField );
639 
640  // notify the grid
641  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
642  m_grid->ProcessTableMessage( msg );
643 
644  m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
645  m_grid->SetGridCursor( m_fields->size() - 1, 0 );
646 
647  m_grid->EnableCellEditControl();
648  m_grid->ShowCellEditControl();
649 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
static const wxString GetDefaultFieldName(int aFieldNdx)
Definition: sch_sheet.cpp:44
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:174
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

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

◆ OnDeleteField()

void DIALOG_SCH_SHEET_PROPS::OnDeleteField ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 652 of file dialog_sch_sheet_props.cpp.

653 {
654  int curRow = m_grid->GetGridCursorRow();
655 
656  if( curRow < 0 )
657  return;
658  else if( curRow < SHEET_MANDATORY_FIELDS )
659  {
660  DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
662  return;
663  }
664 
665  m_grid->CommitPendingChanges( true /* quiet mode */ );
666 
667  m_fields->erase( m_fields->begin() + curRow );
668 
669  // notify the grid
670  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 );
671  m_grid->ProcessTableMessage( msg );
672 
673  if( m_grid->GetNumberRows() > 0 )
674  {
675  m_grid->MakeCellVisible( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() );
676  m_grid->SetGridCursor( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() );
677  }
678 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:174
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

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

◆ OnGridCellChanging()

void DIALOG_SCH_SHEET_PROPS::OnGridCellChanging ( wxGridEvent &  event)
private

Definition at line 577 of file dialog_sch_sheet_props.cpp.

578 {
579  bool success = true;
580  wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
581  wxControl* control = editor->GetControl();
582  wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
583 
584  // Short-circuit the validator's more generic "can't be empty" message for the
585  // two mandatory fields:
586  if( event.GetRow() == SHEETNAME && event.GetCol() == FDC_VALUE )
587  {
588  if( textControl && textControl->IsEmpty() )
589  {
590  wxMessageBox( _( "A sheet must have a name." ) );
591  success = false;
592  }
593  }
594  else if( event.GetRow() == SHEETFILENAME && event.GetCol() == FDC_VALUE && textControl )
595  {
596  if( textControl->IsEmpty() )
597  {
598  wxMessageBox( _( "A sheet must have a file specified." ) );
599  success = false;
600  }
601  else
602  {
603  wxFileName fn = textControl->GetValue();
604 
605  if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
606  {
607  wxMessageBox( _( "Sheet filename must have a '.kicad_sch' extension." ) );
608  success = false;
609  }
610  }
611  }
612 
613  if( success && control && control->GetValidator() )
614  success = control->GetValidator()->Validate( control );
615 
616  if( !success )
617  {
618  event.Veto();
619  m_delayedFocusRow = event.GetRow();
620  m_delayedFocusColumn = event.GetCol();
621  }
622 
623  editor->DecRef();
624 }
#define _(s)
Definition: 3d_actions.cpp:33
const std::string KiCadSchematicFileExtension

References _, FDC_VALUE, KiCadSchematicFileExtension, m_delayedFocusColumn, m_delayedFocusRow, DIALOG_SCH_SHEET_PROPS_BASE::m_grid, SHEETFILENAME, and SHEETNAME.

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

◆ OnInitDlg()

void DIALOG_SCH_SHEET_PROPS::OnInitDlg ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 785 of file dialog_sch_sheet_props.cpp.

786 {
788 
789  // Now all widgets have the size fixed, call FinishDialogSettings
791 }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...

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

◆ OnMoveDown()

void DIALOG_SCH_SHEET_PROPS::OnMoveDown ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 703 of file dialog_sch_sheet_props.cpp.

704 {
705  if( !m_grid->CommitPendingChanges() )
706  return;
707 
708  int i = m_grid->GetGridCursorRow();
709 
710  if( i >= SHEET_MANDATORY_FIELDS && i < m_grid->GetNumberRows() - 1 )
711  {
712  SCH_FIELD tmp = m_fields->at( (unsigned) i );
713  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
714  m_fields->insert( m_fields->begin() + i + 1, tmp );
715  m_grid->ForceRefresh();
716 
717  m_grid->SetGridCursor( i + 1, m_grid->GetGridCursorCol() );
718  m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
719  }
720  else
721  wxBell();
722 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:174
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

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

◆ OnMoveUp()

void DIALOG_SCH_SHEET_PROPS::OnMoveUp ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 681 of file dialog_sch_sheet_props.cpp.

682 {
683  if( !m_grid->CommitPendingChanges() )
684  return;
685 
686  int i = m_grid->GetGridCursorRow();
687 
688  if( i > SHEET_MANDATORY_FIELDS )
689  {
690  SCH_FIELD tmp = m_fields->at( (unsigned) i );
691  m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 );
692  m_fields->insert( m_fields->begin() + i - 1, tmp );
693  m_grid->ForceRefresh();
694 
695  m_grid->SetGridCursor( i - 1, m_grid->GetGridCursorCol() );
696  m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
697  }
698  else
699  wxBell();
700 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:174
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

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

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 322 of file dialog_shim.cpp.

323 {
324  if( m_firstPaintEvent )
325  {
326 #ifdef __WXMAC__
327  fixOSXCancelButtonIssue( this );
328 #endif
329 
330  selectAllInTextCtrls( GetChildren() );
331 
333  m_initialFocusTarget->SetFocus();
334  else
335  SetFocus(); // Focus the dialog itself
336 
337  m_firstPaintEvent = false;
338  }
339 
340  event.Skip();
341 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203
bool m_firstPaintEvent
Definition: dialog_shim.h:202
static void selectAllInTextCtrls(wxWindowList &children)

References DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onSheetFilenameChanged()

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

Definition at line 336 of file dialog_sch_sheet_props.cpp.

337 {
338  wxString msg;
339 
340  // Relative file names are relative to the path of the current sheet. This allows for
341  // nesting of schematic files in subfolders.
342  wxFileName fileName( aNewFilename );
343 
344  if( fileName.GetExt().IsEmpty() )
345  {
346  fileName.SetExt( KiCadSchematicFileExtension );
347  }
348  else if( fileName.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
349  {
350  msg.Printf( _( "The file \"%s\" does not appear to be a valid schematic file." ),
351  fileName.GetFullName() );
352  wxMessageDialog badSchFileDialog( this, msg, _( "Invalid Schematic File" ),
353  wxOK | wxCENTRE | wxICON_EXCLAMATION );
354  badSchFileDialog.ShowModal();
355  return false;
356  }
357 
358  if( !fileName.IsAbsolute() )
359  {
360  const SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
361  wxCHECK_MSG( currentScreen, false, "Invalid sheet path object." );
362 
363  wxFileName currentSheetFileName = currentScreen->GetFileName();
364 
365  if( !fileName.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() ) )
366  {
367  wxFAIL_MSG( "Cannot normalize new sheet schematic file path." );
368  return false;
369  }
370  }
371 
372  wxString newAbsoluteFilename = fileName.GetFullPath();
373 
374  // Inside Eeschema, filenames are stored using unix notation
375  newAbsoluteFilename.Replace( wxT( "\\" ), wxT( "/" ) );
376 
377  bool renameFile = false;
378  bool loadFromFile = false;
379  bool clearAnnotation = false;
380  bool restoreSheet = false;
381  bool isExistingSheet = false;
382  SCH_SCREEN* useScreen = NULL;
383 
384  // Search for a schematic file having the same filename already in use in the hierarchy
385  // or on disk, in order to reuse it.
386  if( !m_frame->Schematic().Root().SearchHierarchy( newAbsoluteFilename, &useScreen ) )
387  {
388  loadFromFile = wxFileExists( newAbsoluteFilename );
389 
390  wxLogTrace( tracePathsAndFiles, "Sheet requested file \"%s\", %s",
391  newAbsoluteFilename,
392  ( loadFromFile ) ? "found" : "not found" );
393  }
394 
395  if( m_sheet->GetScreen() == NULL ) // New just created sheet.
396  {
397  if( !m_frame->AllowCaseSensitiveFileNameClashes( newAbsoluteFilename ) )
398  return false;
399 
400  if( useScreen || loadFromFile ) // Load from existing file.
401  {
402  clearAnnotation = true;
403  wxString existsMsg;
404  wxString linkMsg;
405  existsMsg.Printf( _( "\"%s\" already exists." ), fileName.GetFullName() );
406  linkMsg.Printf( _( "Link \"%s\" to this file?" ), newAbsoluteFilename );
407  msg.Printf( wxT( "%s\n\n%s" ), existsMsg, linkMsg );
408 
409  if( !IsOK( this, msg ) )
410  return false;
411  }
412  else // New file.
413  {
414  m_frame->InitSheet( m_sheet, newAbsoluteFilename );
415  }
416  }
417  else // Existing sheet.
418  {
419  bool isUndoable = true;
420  wxString replaceMsg;
421  wxString newMsg;
422  wxString noUndoMsg;
423  isExistingSheet = true;
424 
425  if( !m_frame->AllowCaseSensitiveFileNameClashes( newAbsoluteFilename ) )
426  return false;
427 
428  // Changing the filename of a sheet can modify the full hierarchy structure
429  // and can be not always undoable.
430  // So prepare messages for user notifications:
431  replaceMsg.Printf( _( "Change \"%s\" link from \"%s\" to \"%s\"?" ),
432  newAbsoluteFilename,
433  m_sheet->GetFileName(),
434  fileName.GetFullName() );
435  newMsg.Printf( _( "Create new file \"%s\" with contents of \"%s\"?" ),
436  fileName.GetFullName(),
437  m_sheet->GetFileName() );
438  noUndoMsg = _( "This action cannot be undone." );
439 
440  // We are always using here a case insensitive comparison to avoid issues
441  // under Windows, although under Unix filenames are case sensitive.
442  // But many users create schematic under both Unix and Windows
443  // **
444  // N.B. 1: aSheet->GetFileName() will return a relative path
445  // aSheet->GetScreen()->GetFileName() returns a full path
446  //
447  // N.B. 2: newFilename uses the unix notation for separator.
448  // so we must use it also to compare the old and new filenames
449  wxString oldAbsoluteFilename = m_sheet->GetScreen()->GetFileName();
450  oldAbsoluteFilename.Replace( wxT( "\\" ), wxT( "/" ) );
451 
452  if( newAbsoluteFilename.Cmp( oldAbsoluteFilename ) != 0 )
453  {
454  // Sheet file name changes cannot be undone.
455  isUndoable = false;
456 
457  if( useScreen || loadFromFile ) // Load from existing file.
458  {
459  clearAnnotation = true;
460 
461  msg.Printf( wxT( "%s\n\n%s" ), replaceMsg, noUndoMsg );
462 
463  if( !IsOK( this, msg ) )
464  return false;
465 
466  if( loadFromFile )
467  m_sheet->SetScreen( NULL );
468  }
469  else // Save to new file name.
470  {
471  if( m_sheet->GetScreenCount() > 1 )
472  {
473  msg.Printf( wxT( "%s\n\n%s" ), newMsg, noUndoMsg );
474 
475  if( !IsOK( this, msg ) )
476  return false;
477  }
478 
479  renameFile = true;
480  }
481  }
482 
483  if( isUndoable )
485 
486  if( renameFile )
487  {
488  SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
489 
490  // If the the associated screen is shared by more than one sheet, do not
491  // change the filename of the corresponding screen here.
492  // (a new screen will be created later)
493  // if it is not shared, update the filename
494  if( m_sheet->GetScreenCount() <= 1 )
495  m_sheet->GetScreen()->SetFileName( newAbsoluteFilename );
496 
497  try
498  {
499  pi->Save( newAbsoluteFilename, m_sheet, &m_frame->Schematic() );
500  }
501  catch( const IO_ERROR& ioe )
502  {
503  msg.Printf( _( "Error occurred saving schematic file \"%s\"." ),
504  newAbsoluteFilename );
505  DisplayErrorMessage( this, msg, ioe.What() );
506 
507  msg.Printf( _( "Failed to save schematic \"%s\"" ), newAbsoluteFilename );
508  m_frame->AppendMsgPanel( wxEmptyString, msg, CYAN );
509 
510  return false;
511  }
512 
513  // If the the associated screen is shared by more than one sheet, remove the
514  // screen and reload the file to a new screen. Failure to do this will trash
515  // the screen reference counting in complex hierarchies.
516  if( m_sheet->GetScreenCount() > 1 )
517  {
518  m_sheet->SetScreen( NULL );
519  loadFromFile = true;
520  }
521  }
522  }
523 
524  wxFileName nativeFileName( aNewFilename );
525  SCH_SHEET_PATH& currentSheet = m_frame->GetCurrentSheet();
526 
527  if( useScreen )
528  {
529  // Create a temporary sheet for recursion testing to prevent a possible recursion error.
530  std::unique_ptr< SCH_SHEET> tmpSheet( new SCH_SHEET );
531  tmpSheet->GetFields()[SHEETNAME] = m_fields->at( SHEETNAME );
532  tmpSheet->GetFields()[SHEETFILENAME].SetText( nativeFileName.GetFullPath() );
533  tmpSheet->SetScreen( useScreen );
534 
535  // No need to check for valid library IDs if we are using an existing screen.
536  if( m_frame->CheckSheetForRecursion( tmpSheet.get(), &currentSheet ) )
537  {
538  if( restoreSheet )
539  currentSheet.LastScreen()->Append( m_sheet );
540 
541  return false;
542  }
543 
544  // It's safe to set the sheet screen now.
545  m_sheet->SetScreen( useScreen );
546  }
547  else if( loadFromFile )
548  {
549  if( isExistingSheet )
550  {
551  // Temporarily remove the sheet from the current schematic page so that recursion
552  // and symbol library link tests can be performed with the modified sheet settings.
553  restoreSheet = true;
554  currentSheet.LastScreen()->Remove( m_sheet );
555  }
556 
557  if( !m_frame->LoadSheetFromFile( m_sheet, &currentSheet, newAbsoluteFilename )
558  || m_frame->CheckSheetForRecursion( m_sheet, &currentSheet ) )
559  {
560  if( restoreSheet )
561  currentSheet.LastScreen()->Append( m_sheet );
562 
563  return false;
564  }
565 
566  if( restoreSheet )
567  currentSheet.LastScreen()->Append( m_sheet );
568  }
569 
571  *m_clearAnnotationNewItems = clearAnnotation;
572 
573  return true;
574 }
bool CheckSheetForRecursion(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Verify that aSheet will not cause a recursion error in aHierarchy.
Definition: sheet.cpp:46
const wxString & GetFileName() const
Definition: sch_screen.h:196
bool Remove(SCH_ITEM *aItem)
Remove aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:309
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:621
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:150
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition: sheet.cpp:95
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:282
int GetScreenCount() const
Return the number of times the associated screen for the sheet is being used.
Definition: sch_sheet.cpp:173
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:104
bool AllowCaseSensitiveFileNameClashes(const wxString &aSchematicFileName)
Check aSchematicFileName for a potential file name case sensitivity clashes.
Definition: sheet.cpp:630
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
Definition: colors.h:59
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
SCHEMATIC & Schematic() const
SCH_SHEET_PATH.
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:491
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Definition: sch_io_mgr.h:467
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
SCH_SHEET & Root() const
Definition: schematic.h:104
SCH_SCREEN * LastScreen()
Function LastScreen.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:197
#define _(s)
Definition: 3d_actions.cpp:33
const std::string KiCadSchematicFileExtension
SCH_SHEET_PATH & GetCurrentSheet() const
void SetFileName(const wxString &aFileName)
Definition: sch_screen.h:194
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

References _, SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes(), SCH_SCREEN::Append(), EDA_DRAW_FRAME::AppendMsgPanel(), SCH_EDIT_FRAME::CheckSheetForRecursion(), CYAN, DisplayErrorMessage(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), SCH_SHEET::GetScreen(), SCH_SHEET::GetScreenCount(), SCH_EDIT_FRAME::InitSheet(), IsOK(), KiCadSchematicFileExtension, SCH_SHEET_PATH::LastScreen(), SCH_EDIT_FRAME::LoadSheetFromFile(), m_clearAnnotationNewItems, m_fields, m_frame, m_sheet, NULL, SCH_SCREEN::Remove(), SCHEMATIC::Root(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::Schematic(), SCH_SHEET::SearchHierarchy(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetScreen(), SHEETFILENAME, SHEETNAME, tracePathsAndFiles, UR_CHANGED, and IO_ERROR::What().

Referenced by TransferDataFromWindow().

◆ OnSizeGrid()

void DIALOG_SCH_SHEET_PROPS::OnSizeGrid ( wxSizeEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 771 of file dialog_sch_sheet_props.cpp.

772 {
773  auto new_size = event.GetSize().GetX();
774 
775  if( m_width != new_size )
776  {
777  AdjustGridColumns( new_size );
778  }
779 
780  // Always propagate for a grid repaint (needed if the height changes, as well as width)
781  event.Skip();
782 }

References AdjustGridColumns(), and m_width.

◆ OnUpdateUI()

void DIALOG_SCH_SHEET_PROPS::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_SCH_SHEET_PROPS_BASE.

Definition at line 742 of file dialog_sch_sheet_props.cpp.

743 {
744  wxString shownColumns = m_grid->GetShownColumns();
745 
746  if( shownColumns != m_shownColumns )
747  {
748  m_shownColumns = shownColumns;
749 
750  if( !m_grid->IsCellEditControlShown() )
751  AdjustGridColumns( m_grid->GetRect().GetWidth() );
752  }
753 
754  // Handle a delayed focus
755  if( m_delayedFocusRow >= 0 )
756  {
757  m_grid->SetFocus();
758  m_grid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn );
759  m_grid->SetGridCursor( m_delayedFocusRow, m_delayedFocusColumn );
760 
761 
762  m_grid->EnableCellEditControl( true );
763  m_grid->ShowCellEditControl();
764 
765  m_delayedFocusRow = -1;
767  }
768 }
wxString GetShownColumns()
Get a tokenized string containing the shown column indexes.
Definition: wx_grid.cpp:103

References AdjustGridColumns(), WX_GRID::GetShownColumns(), m_delayedFocusColumn, m_delayedFocusRow, DIALOG_SCH_SHEET_PROPS_BASE::m_grid, and m_shownColumns.

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 35 of file kiway_holder.cpp.

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

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_EDIT_FRAME::doAutoSave(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_EXPORT_SVG::ExportSVGFile(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectFile(), CVPCB_MAINFRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DRC::LoadRules(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), SCH_EDIT_FRAME::PrintPage(), EDA_DRAW_FRAME::PrintWorkSheet(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), KICAD_MANAGER_FRAME::SetProjectFileName(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_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 239 of file dialog_shim.cpp.

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

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

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY().

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

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

Definition at line 115 of file dialog_shim.h.

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203

References DIALOG_SHIM::m_initialFocusTarget.

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

◆ SetKiway()

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

Function SetKiway.

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

Definition at line 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

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

◆ SetSizeInDU()

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

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

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

Definition at line 153 of file dialog_shim.cpp.

154 {
155  wxSize sz( x, y );
156  SetSize( ConvertDialogToPixels( sz ) );
157 }

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

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 180 of file dialog_shim.cpp.

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

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 367 of file dialog_shim.cpp.

368 {
369  // This is an exception safe way to zero a pointer before returning.
370  // Yes, even though DismissModal() clears this first normally, this is
371  // here in case there's an exception before the dialog is dismissed.
372  struct NULLER
373  {
374  void*& m_what;
375  NULLER( void*& aPtr ) : m_what( aPtr ) {}
376  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
377  } clear_this( (void*&) m_qmodal_loop );
378 
379  // release the mouse if it's currently captured as the window having it
380  // will be disabled when this dialog is shown -- but will still keep the
381  // capture making it impossible to do anything in the modal dialog itself
382  wxWindow* win = wxWindow::GetCapture();
383  if( win )
384  win->ReleaseMouse();
385 
386  // Get the optimal parent
387  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
388 
389  // Show the optimal parent
390  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
391 
392  wxASSERT_MSG( !m_qmodal_parent_disabler,
393  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
394 
395  // quasi-modal: disable only my "optimal" parent
397 
398 #ifdef __WXMAC__
399  // Apple in its infinite wisdom will raise a disabled window before even passing
400  // us the event, so we have no way to stop it. Instead, we must set an order on
401  // the windows so that the quasi-modal will be pushed in front of the disabled
402  // window when it is raised.
403  ReparentQuasiModal();
404 #endif
405  Show( true );
406 
407  m_qmodal_showing = true;
408 
409  WX_EVENT_LOOP event_loop;
410 
411  m_qmodal_loop = &event_loop;
412 
413  event_loop.Run();
414 
415  m_qmodal_showing = false;
416 
417  return GetReturnCode();
418 }
bool m_qmodal_showing
Definition: dialog_shim.h:207
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:35
#define DBG(x)
Definition: fctsys.h:33

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

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

◆ TransferDataFromWindow()

bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow ( )
overrideprivate

Definition at line 240 of file dialog_sch_sheet_props.cpp.

241 {
242  if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
243  return false;
244 
245  wxString newRelativeNativeFilename = m_fields->at( SHEETFILENAME ).GetText();
246 
247  // Ensure filepath is not empty. (In normal use will be caught by grid validators,
248  // but unedited data from existing files can be bad.)
249 
250  // @todo What happens when there are invalid file name characters?
251  if( newRelativeNativeFilename.IsEmpty() )
252  {
253  wxMessageBox( _( "A sheet must have a valid file name." ) );
254  return false;
255  }
256 
257  // Ensure the filename extension is OK. (In normaly use will be caught by grid
258  // validators, but unedited data from existing files can be bad.)
259  wxFileName fn( newRelativeNativeFilename );
260 
261  if( fn.GetExt().CmpNoCase( KiCadSchematicFileExtension ) != 0 )
262  {
263  wxMessageBox( _( "Sheet file must have a '.kicad_sch' extension." ) );
264  return false;
265  }
266 
267  wxString newRelativeFilename = fn.GetFullPath();
268 
269  // Inside Eeschema, filenames are stored using unix notation
270  newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );
271 
272  wxString oldFilename = m_sheet->GetFields()[ SHEETFILENAME ].GetText();
273  oldFilename.Replace( wxT( "\\" ), wxT( "/" ) );
274 
275  bool filename_changed = oldFilename != newRelativeFilename;
276 
277  if( filename_changed )
278  {
279  if( !onSheetFilenameChanged( newRelativeFilename ) )
280  return false;
281  }
282 
283  wxString newSheetname = m_fields->at( SHEETNAME ).GetText();
284 
285  if( newSheetname.IsEmpty() )
286  newSheetname = _( "Untitled Sheet" );
287 
288  m_fields->at( SHEETNAME ).SetText( newSheetname );
289 
290  // change all field positions from relative to absolute
291  for( unsigned i = 0; i < m_fields->size(); ++i )
292  m_fields->at( i ).Offset( m_sheet->GetPosition() );
293 
296 
298 
300 
301  COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
302 
303  if( colorSettings->GetOverrideSchItemColors()
306  {
307  wxPanel temp( this );
308  temp.Hide();
309  PANEL_EESCHEMA_COLOR_SETTINGS prefs( m_frame, &temp );
310  wxString checkboxLabel = prefs.m_optOverrideColors->GetLabel();
311 
312  KIDIALOG dlg( this, _( "Note: item colors are overridden in the current color theme." ),
314  dlg.ShowDetailedText( wxString::Format( _( "To see individual item colors uncheck '%s'\n"
315  "in Preferences > Eeschema > Colors." ),
316  checkboxLabel ) );
317  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
318  dlg.ShowModal();
319  }
320 
323 
325 
326  // Refresh all sheets in case ordering changed.
327  for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_SHEET_T ) )
328  m_frame->RefreshItem( item );
329 
330  m_frame->OnModify();
331 
332  return true;
333 }
KIGFX::COLOR4D GetSwatchColor() const
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:44
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_sheet.h:275
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:290
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
COLOR_SETTINGS * GetColorSettings() override
Returns a pointer to the active color theme settings.
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:293
void SetBorderWidth(int aWidth)
Definition: sch_sheet.h:288
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetBackgroundColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:294
void SetBorderColor(KIGFX::COLOR4D aColor)
Definition: sch_sheet.h:291
void ClearFieldsAutoplaced()
Set fields automatically placed flag false.
Definition: sch_item.h:422
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:162
const wxPoint GetPosition() const override
Definition: sch_sheet.h:565
const std::string KiCadSchematicFileExtension
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
Color settings are a bit different than most of the settings objects in that there can be more than o...
bool GetOverrideSchItemColors() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool onSheetFilenameChanged(const wxString &aNewFilename)
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:151
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

References _, SCH_ITEM::ClearFieldsAutoplaced(), KIDIALOG::DoNotShowCheckbox(), Format(), SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), SCH_BASE_FRAME::GetColorSettings(), SCH_SHEET::GetFields(), COLOR_SETTINGS::GetOverrideSchItemColors(), SCH_SHEET::GetPosition(), SCH_EDIT_FRAME::GetScreen(), COLOR_SWATCH::GetSwatchColor(), UNIT_BINDER::GetValue(), SCH_SCREEN::Items(), KIDIALOG::KD_WARNING, KiCadSchematicFileExtension, DIALOG_SCH_SHEET_PROPS_BASE::m_backgroundSwatch, DIALOG_SCH_SHEET_PROPS_BASE::m_borderSwatch, m_borderWidth, m_fields, m_frame, PANEL_COLOR_SETTINGS_BASE::m_optOverrideColors, m_sheet, EE_RTREE::OfType(), SCH_EDIT_FRAME::OnModify(), onSheetFilenameChanged(), positioningChanged(), SCH_BASE_FRAME::RefreshItem(), SCH_SHEET_T, SCH_SHEET::SetBackgroundColor(), SCH_SHEET::SetBorderColor(), SCH_SHEET::SetBorderWidth(), SCH_SHEET::SetFields(), SHEETFILENAME, SHEETNAME, KIDIALOG::ShowModal(), and SCH_EDIT_FRAME::TestDanglingEnds().

◆ TransferDataToWindow()

bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow ( )
overrideprivate

Definition at line 119 of file dialog_sch_sheet_props.cpp.

120 {
121  if( !wxDialog::TransferDataToWindow() )
122  return false;
123 
124  // Push a copy of each field into m_updateFields
125  for( SCH_FIELD& field : m_sheet->GetFields() )
126  {
127  SCH_FIELD field_copy( field );
128 
129 #ifdef __WINDOWS__
130  // Filenames are stored using unix notation
131  if( field_copy.GetId() == SHEETFILENAME )
132  {
133  wxString filename = field_copy.GetText();
134  filename.Replace( wxT("/"), wxT("\\") );
135  field_copy.SetText( filename );
136  }
137 #endif
138 
139  // change offset to be symbol-relative
140  field_copy.Offset( -m_sheet->GetPosition() );
141 
142  m_fields->push_back( field_copy );
143  }
144 
145  // notify the grid
146  wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->size() );
147  m_grid->ProcessTableMessage( msg );
148  AdjustGridColumns( m_grid->GetRect().GetWidth() );
149 
150  // border width
152 
153  // set up color swatches
154  COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
155  KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
156  KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
157 
158  if( borderColor == COLOR4D::UNSPECIFIED )
159  borderColor = colorSettings->GetColor( LAYER_SHEET );
160 
161  if( backgroundColor == COLOR4D::UNSPECIFIED )
162  backgroundColor = colorSettings->GetColor( LAYER_SHEET_BACKGROUND );
163 
164  m_borderSwatch->SetSwatchColor( borderColor, false );
165  m_backgroundSwatch->SetSwatchColor( backgroundColor, false );
166 
170 
171  // set up the read-only fields
173  m_textCtrlTimeStamp->SetValue( m_sheet->m_Uuid.AsString() );
174 
175  Layout();
176 
177  return true;
178 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void SetSwatchColor(KIGFX::COLOR4D aColor, bool sendEvent)
Set the current swatch color directly.
wxString AsString() const
Definition: common.cpp:157
KIGFX::COLOR4D GetBorderColor() const
Definition: sch_sheet.h:290
void SetSwatchBackground(KIGFX::COLOR4D aBackground)
Set the swatch background color.
COLOR_SETTINGS * GetColorSettings() override
Returns a pointer to the active color theme settings.
KIGFX::COLOR4D GetBackgroundColor() const
Definition: sch_sheet.h:293
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:268
int GetBorderWidth() const
Definition: sch_sheet.h:287
const KIID m_Uuid
Definition: base_struct.h:166
COLOR4D GetColor(int aLayer) const
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
const wxPoint GetPosition() const override
Definition: sch_sheet.h:565
Color settings are a bit different than most of the settings objects in that there can be more than o...
SCH_SHEET_PATH & GetCurrentSheet() const
wxString PathHumanReadable() const
Function PathHumanReadable returns the sheet path in a human readable form, i.e.
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40

References AdjustGridColumns(), KIID::AsString(), SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), SCH_SHEET::GetBorderWidth(), COLOR_SETTINGS::GetColor(), SCH_BASE_FRAME::GetColorSettings(), SCH_EDIT_FRAME::GetCurrentSheet(), SCH_SHEET::GetFields(), SCH_FIELD::GetId(), SCH_SHEET::GetPosition(), EDA_TEXT::GetText(), LAYER_SCHEMATIC_BACKGROUND, LAYER_SHEET, LAYER_SHEET_BACKGROUND, DIALOG_SCH_SHEET_PROPS_BASE::m_backgroundSwatch, DIALOG_SCH_SHEET_PROPS_BASE::m_borderSwatch, m_borderWidth, m_fields, m_frame, DIALOG_SCH_SHEET_PROPS_BASE::m_grid, DIALOG_SCH_SHEET_PROPS_BASE::m_heirarchyPath, m_sheet, DIALOG_SCH_SHEET_PROPS_BASE::m_textCtrlTimeStamp, EDA_ITEM::m_Uuid, EDA_TEXT::Offset(), SCH_SHEET_PATH::PathHumanReadable(), COLOR_SWATCH::SetSwatchBackground(), COLOR_SWATCH::SetSwatchColor(), EDA_TEXT::SetText(), UNIT_BINDER::SetValue(), and SHEETFILENAME.

Referenced by OnInitDlg().

◆ Validate()

bool DIALOG_SCH_SHEET_PROPS::Validate ( )
overrideprivate

Definition at line 181 of file dialog_sch_sheet_props.cpp.

182 {
183  wxString msg;
184  LIB_ID id;
185 
186  if( !m_grid->CommitPendingChanges() || !m_grid->Validate() )
187  return false;
188 
189  // Check for missing field names.
190  for( size_t i = SHEET_MANDATORY_FIELDS; i < m_fields->size(); ++i )
191  {
192  SCH_FIELD& field = m_fields->at( i );
193  wxString fieldName = field.GetName( false );
194 
195  if( fieldName.IsEmpty() )
196  {
197  DisplayErrorMessage( this, _( "Fields must have a name." ) );
198 
200  m_delayedFocusRow = i;
201 
202  return false;
203  }
204  }
205 
206  return true;
207 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
The first 2 are mandatory, and must be instantiated in SCH_SHEET.
Definition: sch_sheet.h:70
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:174
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:420
FIELDS_GRID_TABLE< SCH_FIELD > * m_fields

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

◆ VertPixelsFromDU()

int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 167 of file dialog_shim.cpp.

168 {
169  wxSize sz( 0, y );
170  return ConvertDialogToPixels( sz ).y;
171 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT().

Member Data Documentation

◆ m_backgroundColorLabel

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_backgroundColorLabel
protectedinherited

◆ m_backgroundSwatch

COLOR_SWATCH* DIALOG_SCH_SHEET_PROPS_BASE::m_backgroundSwatch
protectedinherited

◆ m_borderColorLabel

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_borderColorLabel
protectedinherited

◆ m_borderSwatch

COLOR_SWATCH* DIALOG_SCH_SHEET_PROPS_BASE::m_borderSwatch
protectedinherited

◆ m_borderWidth

UNIT_BINDER DIALOG_SCH_SHEET_PROPS::m_borderWidth
private

Definition at line 56 of file dialog_sch_sheet_props.h.

Referenced by TransferDataFromWindow(), and TransferDataToWindow().

◆ m_borderWidthCtrl

wxTextCtrl* DIALOG_SCH_SHEET_PROPS_BASE::m_borderWidthCtrl
protectedinherited

◆ m_borderWidthLabel

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_borderWidthLabel
protectedinherited

◆ m_borderWidthUnits

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_borderWidthUnits
protectedinherited

◆ m_bpAdd

wxBitmapButton* DIALOG_SCH_SHEET_PROPS_BASE::m_bpAdd
protectedinherited

◆ m_bpDelete

wxBitmapButton* DIALOG_SCH_SHEET_PROPS_BASE::m_bpDelete
protectedinherited

◆ m_bpMoveDown

wxBitmapButton* DIALOG_SCH_SHEET_PROPS_BASE::m_bpMoveDown
protectedinherited

◆ m_bpMoveUp

wxBitmapButton* DIALOG_SCH_SHEET_PROPS_BASE::m_bpMoveUp
protectedinherited

◆ m_clearAnnotationNewItems

bool* DIALOG_SCH_SHEET_PROPS::m_clearAnnotationNewItems
private

Definition at line 48 of file dialog_sch_sheet_props.h.

Referenced by onSheetFilenameChanged().

◆ m_delayedFocusColumn

int DIALOG_SCH_SHEET_PROPS::m_delayedFocusColumn
private

◆ m_delayedFocusRow

int DIALOG_SCH_SHEET_PROPS::m_delayedFocusRow
private

◆ m_fields

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 202 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_frame

SCH_EDIT_FRAME* DIALOG_SCH_SHEET_PROPS::m_frame
private

◆ m_grid

◆ m_hash_key

◆ m_heirarchyPath

wxTextCtrl* DIALOG_SCH_SHEET_PROPS_BASE::m_heirarchyPath
protectedinherited

◆ m_hiearchicalPathLabel

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_hiearchicalPathLabel
protectedinherited

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 203 of file dialog_shim.h.

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

◆ m_longForm

wxBoxSizer* DIALOG_SCH_SHEET_PROPS_BASE::m_longForm
protectedinherited

◆ m_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

Definition at line 210 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnCharHook().

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

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

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

◆ m_sheet

SCH_SHEET* DIALOG_SCH_SHEET_PROPS::m_sheet
private

◆ m_shownColumns

wxString DIALOG_SCH_SHEET_PROPS::m_shownColumns
private

Definition at line 53 of file dialog_sch_sheet_props.h.

Referenced by DIALOG_SCH_SHEET_PROPS(), and OnUpdateUI().

◆ m_staticline1

wxStaticLine* DIALOG_SCH_SHEET_PROPS_BASE::m_staticline1
protectedinherited

◆ m_stdDialogButtonSizer

wxStdDialogButtonSizer* DIALOG_SCH_SHEET_PROPS_BASE::m_stdDialogButtonSizer
protectedinherited

◆ m_stdDialogButtonSizerCancel

wxButton* DIALOG_SCH_SHEET_PROPS_BASE::m_stdDialogButtonSizerCancel
protectedinherited

◆ m_stdDialogButtonSizerOK

wxButton* DIALOG_SCH_SHEET_PROPS_BASE::m_stdDialogButtonSizerOK
protectedinherited

◆ m_tabOrder

◆ m_textCtrlTimeStamp

wxTextCtrl* DIALOG_SCH_SHEET_PROPS_BASE::m_textCtrlTimeStamp
protectedinherited

◆ m_timestampLabel

wxStaticText* DIALOG_SCH_SHEET_PROPS_BASE::m_timestampLabel
protectedinherited

◆ m_units

◆ m_width

int DIALOG_SCH_SHEET_PROPS::m_width
private

Definition at line 50 of file dialog_sch_sheet_props.h.

Referenced by AdjustGridColumns(), DIALOG_SCH_SHEET_PROPS(), and OnSizeGrid().


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