KiCad PCB EDA Suite
DIALOG_CONFIGURE_PATHS Class Reference

#include <dialog_configure_paths.h>

Inheritance diagram for DIALOG_CONFIGURE_PATHS:
DIALOG_CONFIGURE_PATHS_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

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

Protected Member Functions

void OnGridCellRightClick (wxGridEvent &event) override
 
void OnGridCellChange (wxGridEvent &event) override
 
void OnGridSize (wxSizeEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void OnGridCellChanging (wxGridEvent &event)
 
void OnAddEnvVar (wxCommandEvent &event) override
 
void OnRemoveEnvVar (wxCommandEvent &event) override
 
void OnAddSearchPath (wxCommandEvent &event) override
 
void OnDeleteSearchPath (wxCommandEvent &event) override
 
void OnSearchPathMoveUp (wxCommandEvent &event) override
 
void OnSearchPathMoveDown (wxCommandEvent &event) override
 
void OnHelp (wxCommandEvent &event) override
 
void AppendEnvVar (const wxString &aName, const wxString &aPath, bool isExternal)
 
void AppendSearchPath (const wxString &aName, const wxString &aPath, const wxString &aDesc)
 
void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

WX_GRIDm_EnvVars
 
wxBitmapButton * m_btnAddEnvVar
 
wxBitmapButton * m_btnDeleteEnvVar
 
wxStaticBoxSizer * m_sb3DSearchPaths
 
WX_GRIDm_SearchPaths
 
wxBitmapButton * m_btnAddSearchPath
 
wxBitmapButton * m_btnMoveUp
 
wxBitmapButton * m_btnMoveDown
 
wxBitmapButton * m_btnDeleteSearchPath
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
wxButton * m_sdbSizerHelp
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Attributes

wxString m_errorMsg
 
wxGrid * m_errorGrid
 
int m_errorRow
 
int m_errorCol
 
FILENAME_RESOLVERm_resolver
 
wxString m_curdir
 
wxTextValidator m_aliasValidator
 
bool m_gridWidthsDirty
 

Detailed Description

Definition at line 38 of file dialog_configure_paths.h.

Constructor & Destructor Documentation

DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS ( wxWindow *  aParent,
FILENAME_RESOLVER aResolver 
)

Definition at line 51 of file dialog_configure_paths.cpp.

References EV_FLAG_COL, EV_PATH_COL, KiBitmap(), m_aliasValidator, DIALOG_CONFIGURE_PATHS_BASE::m_btnAddEnvVar, DIALOG_CONFIGURE_PATHS_BASE::m_btnAddSearchPath, DIALOG_CONFIGURE_PATHS_BASE::m_btnDeleteEnvVar, DIALOG_CONFIGURE_PATHS_BASE::m_btnDeleteSearchPath, DIALOG_CONFIGURE_PATHS_BASE::m_btnMoveDown, DIALOG_CONFIGURE_PATHS_BASE::m_btnMoveUp, m_curdir, DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, m_resolver, DIALOG_CONFIGURE_PATHS_BASE::m_sb3DSearchPaths, DIALOG_CONFIGURE_PATHS_BASE::m_sdbSizerOK, DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, OnGridCellChanging(), and DIALOG_SHIM::SetInitialFocus().

51  :
52  DIALOG_CONFIGURE_PATHS_BASE( aParent ),
53  m_errorGrid( nullptr ),
54  m_resolver( aResolver ),
55  m_gridWidthsDirty( true )
56 {
57  m_btnAddEnvVar->SetBitmap( KiBitmap( small_plus_xpm ) );
58  m_btnDeleteEnvVar->SetBitmap( KiBitmap( trash_xpm ) );
59  m_btnAddSearchPath->SetBitmap( KiBitmap( small_plus_xpm ) );
60  m_btnDeleteSearchPath->SetBitmap( KiBitmap( trash_xpm ) );
61  m_btnMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
62  m_btnMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
63 
64  m_EnvVars->DeleteRows( 0, m_EnvVars->GetNumberRows() );
65  m_EnvVars->AppendCols( 1 ); // for the isExternal flags
66  m_EnvVars->HideCol( EV_FLAG_COL );
67  m_EnvVars->UseNativeColHeader( true );
68 
69  wxGridCellAttr* attr = new wxGridCellAttr;
70  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir ) );
71  m_EnvVars->SetColAttr( EV_PATH_COL, attr );
72 
73  attr = new wxGridCellAttr;
74  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir ) );
75  m_SearchPaths->SetColAttr( EV_PATH_COL, attr );
76 
77  // Give a bit more room for combobox editors
78  m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
79  m_SearchPaths->SetDefaultRowSize( m_SearchPaths->GetDefaultRowSize() + 4 );
80 
81  m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars ) );
82  m_SearchPaths->PushEventHandler( new GRID_TRICKS( m_SearchPaths ) );
83 
84  m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
85  m_SearchPaths->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
86 
87  if( m_resolver )
88  {
89  m_SearchPaths->DeleteRows( 0, m_SearchPaths->GetNumberRows() );
90  m_SearchPaths->UseNativeColHeader( true );
91 
92  // prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
93  m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
94  m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
95  }
96  else
97  m_sb3DSearchPaths->Show( false );
98 
100  m_sdbSizerOK->SetDefault();
101 
102  // wxFormBuilder doesn't include this event...
103  m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
104  m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
105 
106  GetSizer()->SetSizeHints( this );
107  Centre();
108 }
Class GRID_TRICKS is used to add cut, copy, and paste to an otherwise unmodied wxGrid instance...
Definition: grid_tricks.h:51
void OnGridCellChanging(wxGridEvent &event)
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:115
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
FILENAME_RESOLVER * m_resolver
DIALOG_CONFIGURE_PATHS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Configure Paths"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS ( )
override

Definition at line 111 of file dialog_configure_paths.cpp.

References DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, and OnGridCellChanging().

112 {
113  // Delete the GRID_TRICKS.
114  m_SearchPaths->PopEventHandler( true );
115  m_EnvVars->PopEventHandler( true );
116 
117  m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
118  m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
119 }
void OnGridCellChanging(wxGridEvent &event)

Member Function Documentation

void DIALOG_CONFIGURE_PATHS::AppendEnvVar ( const wxString &  aName,
const wxString &  aPath,
bool  isExternal 
)
protected

Definition at line 162 of file dialog_configure_paths.cpp.

References EV_FLAG_COL, EV_NAME_COL, EV_PATH_COL, i, IsEnvVarImmutable(), and DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars.

Referenced by OnAddEnvVar(), and TransferDataToWindow().

164 {
165  int i = m_EnvVars->GetNumberRows();
166 
167  m_EnvVars->AppendRows( 1 );
168 
169  m_EnvVars->SetCellValue( i, EV_NAME_COL, aName );
170 
171  wxGridCellAttr* nameCellAttr = m_EnvVars->GetOrCreateCellAttr( i, EV_NAME_COL );
172  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
173  nameTextEditor->SetValidator( ENV_VAR_NAME_VALIDATOR() );
174  nameCellAttr->SetEditor( nameTextEditor );
175  nameCellAttr->SetReadOnly( IsEnvVarImmutable( aName ) );
176  nameCellAttr->DecRef();
177 
178  m_EnvVars->SetCellValue( i, EV_PATH_COL, aPath );
179 
180  wxGridCellAttr* pathCellAttr = m_EnvVars->GetOrCreateCellAttr( i, EV_PATH_COL );
181  wxSystemColour c = isExternal ? wxSYS_COLOUR_MENU : wxSYS_COLOUR_LISTBOX;
182  pathCellAttr->SetBackgroundColour( wxSystemSettings::GetColour( c ) );
183  pathCellAttr->DecRef();
184 
185  m_EnvVars->SetCellValue( i, EV_FLAG_COL, isExternal ? wxT( "external" ) : wxEmptyString );
186 }
bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
Definition: env_vars.cpp:47
Class GRID_CELL_TEXT_EDITOR.
Definition: validators.h:42
Class ENV_VAR_NAME_VALIDATOR.
Definition: validators.h:95
size_t i
Definition: json11.cpp:597
void DIALOG_CONFIGURE_PATHS::AppendSearchPath ( const wxString &  aName,
const wxString &  aPath,
const wxString &  aDesc 
)
protected

Definition at line 189 of file dialog_configure_paths.cpp.

References i, m_aliasValidator, DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, SP_ALIAS_COL, SP_DESC_COL, and SP_PATH_COL.

Referenced by OnAddSearchPath(), and TransferDataToWindow().

191 {
192  int i = m_SearchPaths->GetNumberRows();
193 
194  m_SearchPaths->AppendRows( 1 );
195 
196  m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
197 
198  wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
199  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
200  nameTextEditor->SetValidator( m_aliasValidator );
201  nameCellAttr->SetEditor( nameTextEditor );
202  nameCellAttr->DecRef();
203 
204  m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
205  m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
206 }
Class GRID_CELL_TEXT_EDITOR.
Definition: validators.h:42
size_t i
Definition: json11.cpp:597
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

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

Definition at line 381 of file dialog_shim.cpp.

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

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

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

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

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

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

Definition at line 120 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 141 of file dialog_shim.cpp.

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

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

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

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

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

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94
void DIALOG_CONFIGURE_PATHS::OnAddEnvVar ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 344 of file dialog_configure_paths.cpp.

References AppendEnvVar(), WX_GRID::CommitPendingChanges(), EV_NAME_COL, and DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars.

345 {
347  return;
348 
349  AppendEnvVar( wxEmptyString, wxEmptyString, false );
350 
351  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
352  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
353 
354  m_EnvVars->EnableCellEditControl( true );
355  m_EnvVars->ShowCellEditControl();
356 }
void AppendEnvVar(const wxString &aName, const wxString &aPath, bool isExternal)
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
void DIALOG_CONFIGURE_PATHS::OnAddSearchPath ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 359 of file dialog_configure_paths.cpp.

References AppendSearchPath(), WX_GRID::CommitPendingChanges(), DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, and SP_ALIAS_COL.

360 {
362  return;
363 
364  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
365 
366  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
367  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
368 
369  m_SearchPaths->EnableCellEditControl( true );
370  m_SearchPaths->ShowCellEditControl();
371 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
void AppendSearchPath(const wxString &aName, const wxString &aPath, const wxString &aDesc)
void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 394 of file dialog_configure_paths.cpp.

References WX_GRID::CommitPendingChanges(), DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, and max.

395 {
396  int curRow = m_SearchPaths->GetGridCursorRow();
397 
398  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
399  return;
400 
401  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
402  m_SearchPaths->DeleteRows( curRow, 1 );
403 
404  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
405  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
406 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
#define max(a, b)
Definition: auxiliary.h:86
void DIALOG_CONFIGURE_PATHS::OnGridCellChange ( wxGridEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 482 of file dialog_configure_paths.cpp.

References m_gridWidthsDirty.

483 {
484  m_gridWidthsDirty = true;
485 
486  aEvent.Skip();
487 }
void DIALOG_CONFIGURE_PATHS::OnGridCellChanging ( wxGridEvent &  event)
protected

Definition at line 289 of file dialog_configure_paths.cpp.

References KIDIALOG::DoNotShowCheckbox(), EV_FLAG_COL, EV_NAME_COL, EV_PATH_COL, KIDIALOG::KD_WARNING, DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, m_errorCol, m_errorGrid, m_errorMsg, m_errorRow, KIDIALOG::ShowModal(), and SP_ALIAS_COL.

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

290 {
291  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
292  int row = event.GetRow();
293  int col = event.GetCol();
294  wxString text = event.GetString();
295 
296  if( text.IsEmpty() )
297  {
298  if( grid == m_EnvVars )
299  {
300  if( col == EV_NAME_COL )
301  m_errorMsg = _( "Environment variable name cannot be empty." );
302  else
303  m_errorMsg = _( "Environment variable path cannot be empty." );
304  }
305  else
306  {
307  if( col == SP_ALIAS_COL )
308  m_errorMsg = _( "3D search path alias cannot be empty." );
309  else
310  m_errorMsg = _( "3D search path cannot be empty." );
311  }
312  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
313  m_errorRow = row;
314  m_errorCol = col;
315 
316  event.Veto();
317  }
318 
319  if( grid == m_EnvVars )
320  {
321  if( col == EV_PATH_COL && m_EnvVars->GetCellValue( row, EV_FLAG_COL ).Length() )
322  {
323  wxString msg1 = _( "This path was defined externally to the running process and\n"
324  "will only be temporarily overwritten." );
325  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
326  "been defined are honored and any settings defined in the path\n"
327  "configuration dialog are ignored. If you did not intend for\n"
328  "this behavior, either rename any conflicting entries or remove\n"
329  "the external environment variable(s) from your system." );
330  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
331  dlg.ShowDetailedText( msg2 );
332  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
333  dlg.ShowModal();
334  }
335  else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
336  {
337  // Changing name; clear external flag
338  m_EnvVars->SetCellValue( row, EV_FLAG_COL, wxEmptyString );
339  }
340  }
341 }
Helper class to create more flexible dialogs, including &#39;do not show again&#39; checkbox handling...
Definition: confirm.h:44
void DIALOG_CONFIGURE_PATHS::OnGridCellRightClick ( wxGridEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 457 of file dialog_configure_paths.cpp.

References AddMenuItem(), EV_PATH_COL, KiBitmap(), m_curdir, and SP_PATH_COL.

458 {
459  wxASSERT( (int) EV_PATH_COL == (int) SP_PATH_COL );
460 
461  if( aEvent.GetCol() == EV_PATH_COL )
462  {
463  wxMenu menu;
464 
465  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( folder_xpm ) );
466  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
467  {
468  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
469  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
470 
471  if( dlg.ShowModal() == wxID_OK )
472  {
473  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
474  grid->SetCellValue( aEvent.GetRow(), EV_PATH_COL, dlg.GetPath() );
475  m_curdir = dlg.GetPath();
476  }
477  }
478  }
479 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void DIALOG_CONFIGURE_PATHS::OnGridSize ( wxSizeEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 538 of file dialog_configure_paths.cpp.

References m_gridWidthsDirty.

539 {
540  m_gridWidthsDirty = true;
541 
542  event.Skip();
543 }
void DIALOG_CONFIGURE_PATHS::OnHelp ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 546 of file dialog_configure_paths.cpp.

References HTML_MESSAGE_BOX::AddHTML_Text(), GetPredefinedEnvVars(), LookUpEnvVarHelp(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

547 {
548  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
549  "are names that have been defined externally at the system or user "
550  "level. Environment variables defined at the system or user level "
551  "take precedence over the ones defined in this table. This means the "
552  "values in this table are ignored." );
553  msg << "<br><br><b>";
554  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
555  "will only accept upper case letters, digits, and the underscore characters." );
556  msg << "</b>";
557 
558  for( const auto& var: GetPredefinedEnvVars() )
559  {
560  msg << "<br><br><b>" << var << "</b>";
561 
562  const auto desc = LookUpEnvVarHelp( var );
563 
564  if( desc.size() > 0 )
565  msg << ": " << desc;
566 
567  }
568 
569  HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
570  dlg.SetDialogSizeInDU( 400, 250 );
571 
572  dlg.AddHTML_Text( msg );
573  dlg.ShowModal();
574 }
const ENV_VAR_LIST & GetPredefinedEnvVars()
Get the list of pre-defined environment variables.
Definition: env_vars.cpp:59
wxString LookUpEnvVarHelp(const wxString &aEnvVar)
Look up long-form help text for a given environment variable.
Definition: env_vars.cpp:97
Class HTML_MESSAGE_BOX.
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::DIALOG_SHIM().

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

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 374 of file dialog_configure_paths.cpp.

References WX_GRID::CommitPendingChanges(), EV_NAME_COL, IsEnvVarImmutable(), DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, and max.

375 {
376  int curRow = m_EnvVars->GetGridCursorRow();
377 
378  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
379  return;
380  else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
381  {
382  wxBell();
383  return;
384  }
385 
386  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
387  m_EnvVars->DeleteRows( curRow, 1 );
388 
389  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
390  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
391 }
bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
Definition: env_vars.cpp:47
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
#define max(a, b)
Definition: auxiliary.h:86
void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 433 of file dialog_configure_paths.cpp.

References WX_GRID::CommitPendingChanges(), i, and DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths.

434 {
436  return;
437 
438  int curRow = m_SearchPaths->GetGridCursorRow();
439  int nextRow = curRow + 1;
440 
441  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
442  {
443  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
444  {
445  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
446  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
447  m_SearchPaths->SetCellValue( nextRow, i, tmp );
448  }
449 
450  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
451  }
452  else
453  wxBell();
454 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
size_t i
Definition: json11.cpp:597
void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 409 of file dialog_configure_paths.cpp.

References WX_GRID::CommitPendingChanges(), i, and DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths.

410 {
412  return;
413 
414  int curRow = m_SearchPaths->GetGridCursorRow();
415  int prevRow = curRow - 1;
416 
417  if( curRow > 0 )
418  {
419  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
420  {
421  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
422  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
423  m_SearchPaths->SetCellValue( prevRow, i, tmp );
424  }
425 
426  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
427  }
428  else
429  wxBell();
430 }
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
size_t i
Definition: json11.cpp:597
void DIALOG_CONFIGURE_PATHS::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprotectedvirtual

Reimplemented from DIALOG_CONFIGURE_PATHS_BASE.

Definition at line 490 of file dialog_configure_paths.cpp.

References DisplayErrorMessage(), EV_NAME_COL, EV_PATH_COL, DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, m_errorCol, m_errorGrid, m_errorMsg, m_errorRow, m_gridWidthsDirty, DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, max, SP_ALIAS_COL, SP_DESC_COL, and SP_PATH_COL.

491 {
492  if( m_gridWidthsDirty && ( !m_EnvVars->IsCellEditControlShown()
493  && !m_SearchPaths->IsCellEditControlShown() ) )
494  {
495  int width = m_EnvVars->GetClientRect().GetWidth();
496 
497  m_EnvVars->AutoSizeColumn( EV_NAME_COL );
498  m_EnvVars->SetColSize( EV_NAME_COL, std::max( m_EnvVars->GetColSize( EV_NAME_COL ), 120 ) );
499 
500  m_EnvVars->SetColSize( EV_PATH_COL, width - m_EnvVars->GetColSize( EV_NAME_COL ) );
501 
502  width = m_SearchPaths->GetClientRect().GetWidth();
503 
504  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
505  m_SearchPaths->SetColSize( SP_ALIAS_COL, std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
506 
507  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
508  m_SearchPaths->SetColSize( SP_PATH_COL, std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
509 
510  m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL )
511  + m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
512  m_gridWidthsDirty = false;
513  }
514 
515  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
516  // even when the original validation was triggered from a killFocus event (and for
517  // dialog with notebooks, so that the corresponding notebook page can be shown in
518  // the background when triggered from an OK).
519  if( m_errorGrid )
520  {
521  // We will re-enter this routine when the error dialog is displayed, so make
522  // sure we don't keep putting up more dialogs.
523  wxGrid* grid = m_errorGrid;
524  m_errorGrid = nullptr;
525 
527 
528  grid->SetFocus();
529  grid->MakeCellVisible( m_errorRow, m_errorCol );
530  grid->SetGridCursor( m_errorRow, m_errorCol );
531 
532  grid->EnableCellEditControl( true );
533  grid->ShowCellEditControl();
534  }
535 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:259
#define max(a, b)
Definition: auxiliary.h:86
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 34 of file kiway_holder.cpp.

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

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

Definition at line 115 of file dialog_shim.h.

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

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:179
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

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

Definition at line 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

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

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

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

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

Definition at line 134 of file dialog_shim.cpp.

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

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

Definition at line 162 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

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

Definition at line 327 of file dialog_shim.cpp.

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

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

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

Definition at line 209 of file dialog_configure_paths.cpp.

References WX_GRID::CommitPendingChanges(), EV_NAME_COL, EV_PATH_COL, SEARCH_PATH::m_alias, SEARCH_PATH::m_description, DIALOG_CONFIGURE_PATHS_BASE::m_EnvVars, m_errorCol, m_errorGrid, m_errorMsg, m_errorRow, SEARCH_PATH::m_pathvar, m_resolver, DIALOG_CONFIGURE_PATHS_BASE::m_SearchPaths, name, Pgm(), PGM_BASE::SetLocalEnvVariables(), SP_ALIAS_COL, SP_DESC_COL, SP_PATH_COL, and FILENAME_RESOLVER::UpdatePathList().

210 {
212  return false;
213 
214  if( !wxDialog::TransferDataFromWindow() )
215  return false;
216 
217  // Environment variables
218 
219  ENV_VAR_MAP envVarMap;
220 
221  for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
222  {
223  wxString name = m_EnvVars->GetCellValue( row, EV_NAME_COL );
224  wxString path = m_EnvVars->GetCellValue( row, EV_PATH_COL );
225 
226  if( name.IsEmpty() )
227  {
229  m_errorRow = row;
231  m_errorMsg = _( "Environment variable name cannot be empty." );
232  return false;
233  }
234  else if( path.IsEmpty() )
235  {
237  m_errorRow = row;
239  m_errorMsg = _( "Environment variable path cannot be empty." );
240  return false;
241  }
242 
243  envVarMap[ name ] = ENV_VAR_ITEM( path );
244  }
245 
246  Pgm().SetLocalEnvVariables( envVarMap );
247 
248  // 3D search paths
249 
250  if( m_resolver )
251  {
252  std::vector<SEARCH_PATH> alist;
253  SEARCH_PATH alias;
254 
255  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
256  {
257  alias.m_alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
258  alias.m_pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
259  alias.m_description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
260 
261  if( alias.m_alias.IsEmpty() )
262  {
264  m_errorRow = row;
266  m_errorMsg = _( "3D search path alias cannot be empty." );
267  return false;
268  }
269  else if( alias.m_pathvar.IsEmpty() )
270  {
272  m_errorRow = row;
274  m_errorMsg = _( "3D search path cannot be empty." );
275  return false;
276  }
277 
278  alist.push_back( alias );
279  }
280 
281  if( !m_resolver->UpdatePathList( alist ) )
282  return false;
283  }
284 
285  return true;
286 }
Class ENV_VAR_ITEM.
Definition: pgm_base.h:100
wxString m_alias
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
bool UpdatePathList(std::vector< SEARCH_PATH > &aPathList)
Function UpdatePathList clears the current path list and substitutes the given path list...
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:129
FILENAME_RESOLVER * m_resolver
wxString m_description
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
VTBL_ENTRY void SetLocalEnvVariables(const ENV_VAR_MAP &aEnvVarMap)
Function SetLocalEnvVariables.
Definition: pgm_base.cpp:860
wxString m_pathvar
const char * name
Definition: DXF_plotter.cpp:61
bool DIALOG_CONFIGURE_PATHS::TransferDataToWindow ( )
override

Definition at line 122 of file dialog_configure_paths.cpp.

References AppendEnvVar(), AppendSearchPath(), PGM_BASE::GetLocalEnvVariables(), FILENAME_RESOLVER::GetPaths(), m_curdir, m_resolver, and Pgm().

123 {
124  if( !wxDialog::TransferDataToWindow() )
125  return false;
126 
127  // Do 3D search paths first so they get first crack at setting m_curdir
128 
129  if( m_resolver )
130  {
131  const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
132 
133  for( auto it = paths->begin(); it != paths->end(); ++it )
134  {
135  if ( !( *it ).m_alias.StartsWith( "${" ) && !( *it ).m_alias.StartsWith( "$(" ) )
136  {
137  AppendSearchPath( it->m_alias, it->m_pathvar, it->m_description );
138 
139  if( m_curdir.IsEmpty() )
140  m_curdir = it->m_pathexp;
141  }
142  }
143  }
144 
145  // Environment variables
146 
147  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
148 
149  for( auto it = envVars.begin(); it != envVars.end(); ++it )
150  {
151  const wxString& path = it->second.GetValue();
152  AppendEnvVar( it->first, path, it->second.GetDefinedExternally() );
153 
154  if( m_curdir.IsEmpty() && !path.StartsWith( "${" ) && !path.StartsWith( "$(" ) )
155  m_curdir = path;
156  }
157 
158  return true;
159 }
const std::list< SEARCH_PATH > * GetPaths(void)
Function GetPaths returns a pointer to the internal path list; the items in:load. ...
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
void AppendEnvVar(const wxString &aName, const wxString &aPath, bool isExternal)
VTBL_ENTRY const ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.h:312
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:129
FILENAME_RESOLVER * m_resolver
void AppendSearchPath(const wxString &aName, const wxString &aPath, const wxString &aDesc)
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 148 of file dialog_shim.cpp.

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

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

Member Data Documentation

wxTextValidator DIALOG_CONFIGURE_PATHS::m_aliasValidator
private

Definition at line 73 of file dialog_configure_paths.h.

Referenced by AppendSearchPath(), and DIALOG_CONFIGURE_PATHS().

wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnAddEnvVar
protectedinherited
wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnAddSearchPath
protectedinherited
wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnDeleteEnvVar
protectedinherited
wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnDeleteSearchPath
protectedinherited
wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnMoveDown
protectedinherited
wxBitmapButton* DIALOG_CONFIGURE_PATHS_BASE::m_btnMoveUp
protectedinherited
wxString DIALOG_CONFIGURE_PATHS::m_curdir
private
int DIALOG_CONFIGURE_PATHS::m_errorCol
private

Definition at line 69 of file dialog_configure_paths.h.

Referenced by OnGridCellChanging(), OnUpdateUI(), and TransferDataFromWindow().

wxGrid* DIALOG_CONFIGURE_PATHS::m_errorGrid
private

Definition at line 67 of file dialog_configure_paths.h.

Referenced by OnGridCellChanging(), OnUpdateUI(), and TransferDataFromWindow().

wxString DIALOG_CONFIGURE_PATHS::m_errorMsg
private

Definition at line 66 of file dialog_configure_paths.h.

Referenced by OnGridCellChanging(), OnUpdateUI(), and TransferDataFromWindow().

int DIALOG_CONFIGURE_PATHS::m_errorRow
private

Definition at line 68 of file dialog_configure_paths.h.

Referenced by OnGridCellChanging(), OnUpdateUI(), and TransferDataFromWindow().

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 178 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

bool DIALOG_CONFIGURE_PATHS::m_gridWidthsDirty
private

Definition at line 75 of file dialog_configure_paths.h.

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

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 179 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 182 of file dialog_shim.h.

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

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

Definition at line 183 of file dialog_shim.h.

Referenced by DIALOG_SHIM::ShowQuasiModal().

FILENAME_RESOLVER* DIALOG_CONFIGURE_PATHS::m_resolver
private
wxStaticBoxSizer* DIALOG_CONFIGURE_PATHS_BASE::m_sb3DSearchPaths
protectedinherited
wxStdDialogButtonSizer* DIALOG_CONFIGURE_PATHS_BASE::m_sdbSizer
protectedinherited
wxButton* DIALOG_CONFIGURE_PATHS_BASE::m_sdbSizerCancel
protectedinherited
wxButton* DIALOG_CONFIGURE_PATHS_BASE::m_sdbSizerHelp
protectedinherited
wxButton* DIALOG_CONFIGURE_PATHS_BASE::m_sdbSizerOK
protectedinherited

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