KiCad PCB EDA Suite
dialog_configure_paths.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
5  * Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <dialog_configure_paths.h>
26 
27 #include <confirm.h>
28 #include <menus_helpers.h>
29 #include <validators.h>
30 #include <html_messagebox.h>
31 #include <filename_resolver.h>
32 #include <env_vars.h>
33 #include <widgets/wx_grid.h>
35 
37 {
41 };
42 
44 {
48 };
49 
50 
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 }
109 
110 
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 }
120 
121 
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 }
160 
161 
162 void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString& aPath,
163  bool isExternal )
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 }
187 
188 
189 void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
190  const wxString& aDescription )
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 }
207 
208 
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  wxString external = m_EnvVars->GetCellValue( row, EV_FLAG_COL );
226 
227  if( external.Length() )
228  continue;
229 
230  if( name.IsEmpty() )
231  {
233  m_errorRow = row;
235  m_errorMsg = _( "Environment variable name cannot be empty." );
236  return false;
237  }
238  else if( path.IsEmpty() )
239  {
241  m_errorRow = row;
243  m_errorMsg = _( "Environment variable path cannot be empty." );
244  return false;
245  }
246 
247  envVarMap[ name ] = ENV_VAR_ITEM( path );
248  }
249 
250  Pgm().SetLocalEnvVariables( envVarMap );
251 
252  // 3D search paths
253 
254  if( m_resolver )
255  {
256  std::vector<SEARCH_PATH> alist;
257  SEARCH_PATH alias;
258 
259  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
260  {
261  alias.m_alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
262  alias.m_pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
263  alias.m_description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
264 
265  if( alias.m_alias.IsEmpty() )
266  {
268  m_errorRow = row;
270  m_errorMsg = _( "3D search path alias cannot be empty." );
271  return false;
272  }
273  else if( alias.m_pathvar.IsEmpty() )
274  {
276  m_errorRow = row;
278  m_errorMsg = _( "3D search path cannot be empty." );
279  return false;
280  }
281 
282  alist.push_back( alias );
283  }
284 
285  if( !m_resolver->UpdatePathList( alist ) )
286  return false;
287  }
288 
289  return true;
290 }
291 
292 
294 {
295  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
296  int row = event.GetRow();
297  int col = event.GetCol();
298  wxString text = event.GetString();
299 
300  if( text.IsEmpty() )
301  {
302  if( grid == m_EnvVars )
303  {
304  if( col == EV_NAME_COL )
305  m_errorMsg = _( "Environment variable name cannot be empty." );
306  else
307  m_errorMsg = _( "Environment variable path cannot be empty." );
308  }
309  else
310  {
311  if( col == SP_ALIAS_COL )
312  m_errorMsg = _( "3D search path alias cannot be empty." );
313  else
314  m_errorMsg = _( "3D search path cannot be empty." );
315  }
316  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
317  m_errorRow = row;
318  m_errorCol = col;
319 
320  event.Veto();
321  }
322 
323  if( grid == m_EnvVars )
324  {
325  if( col == EV_PATH_COL && m_EnvVars->GetCellValue( row, EV_FLAG_COL ).Length() )
326  {
327  wxString msg1 = _( "This path was defined externally to the running process and\n"
328  "will only be temporarily overwritten." );
329  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
330  "been defined are honored and any settings defined in the path\n"
331  "configuration dialog are ignored. If you did not intend for\n"
332  "this behavior, either rename any conflicting entries or remove\n"
333  "the external environment variable(s) from your system." );
334  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
335  dlg.ShowDetailedText( msg2 );
336  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
337  dlg.ShowModal();
338  }
339  else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
340  {
341  // Changing name; clear external flag
342  m_EnvVars->SetCellValue( row, EV_FLAG_COL, wxEmptyString );
343  }
344  }
345 }
346 
347 
348 void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
349 {
351  return;
352 
353  AppendEnvVar( wxEmptyString, wxEmptyString, false );
354 
355  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
356  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
357 
358  m_EnvVars->EnableCellEditControl( true );
359  m_EnvVars->ShowCellEditControl();
360 }
361 
362 
363 void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
364 {
366  return;
367 
368  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
369 
370  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
371  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
372 
373  m_SearchPaths->EnableCellEditControl( true );
374  m_SearchPaths->ShowCellEditControl();
375 }
376 
377 
378 void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
379 {
380  int curRow = m_EnvVars->GetGridCursorRow();
381 
382  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
383  return;
384  else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
385  {
386  wxBell();
387  return;
388  }
389 
390  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
391  m_EnvVars->DeleteRows( curRow, 1 );
392 
393  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
394  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
395 }
396 
397 
398 void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
399 {
400  int curRow = m_SearchPaths->GetGridCursorRow();
401 
402  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
403  return;
404 
405  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
406  m_SearchPaths->DeleteRows( curRow, 1 );
407 
408  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
409  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
410 }
411 
412 
413 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
414 {
416  return;
417 
418  int curRow = m_SearchPaths->GetGridCursorRow();
419  int prevRow = curRow - 1;
420 
421  if( curRow > 0 )
422  {
423  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
424  {
425  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
426  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
427  m_SearchPaths->SetCellValue( prevRow, i, tmp );
428  }
429 
430  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
431  }
432  else
433  wxBell();
434 }
435 
436 
437 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
438 {
440  return;
441 
442  int curRow = m_SearchPaths->GetGridCursorRow();
443  int nextRow = curRow + 1;
444 
445  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
446  {
447  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
448  {
449  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
450  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
451  m_SearchPaths->SetCellValue( nextRow, i, tmp );
452  }
453 
454  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
455  }
456  else
457  wxBell();
458 }
459 
460 
462 {
463  wxASSERT( (int) EV_PATH_COL == (int) SP_PATH_COL );
464 
465  if( aEvent.GetCol() == EV_PATH_COL )
466  {
467  wxMenu menu;
468 
469  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( folder_xpm ) );
470  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
471  {
472  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
473  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
474 
475  if( dlg.ShowModal() == wxID_OK )
476  {
477  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
478  grid->SetCellValue( aEvent.GetRow(), EV_PATH_COL, dlg.GetPath() );
479  m_curdir = dlg.GetPath();
480  }
481  }
482  }
483 }
484 
485 
486 void DIALOG_CONFIGURE_PATHS::OnGridCellChange( wxGridEvent& aEvent )
487 {
488  m_gridWidthsDirty = true;
489 
490  aEvent.Skip();
491 }
492 
493 
494 void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
495 {
496  if( m_gridWidthsDirty && ( !m_EnvVars->IsCellEditControlShown()
497  && !m_SearchPaths->IsCellEditControlShown() ) )
498  {
499  int width = m_EnvVars->GetClientRect().GetWidth();
500 
501  m_EnvVars->AutoSizeColumn( EV_NAME_COL );
502  m_EnvVars->SetColSize( EV_NAME_COL, std::max( m_EnvVars->GetColSize( EV_NAME_COL ), 120 ) );
503 
504  m_EnvVars->SetColSize( EV_PATH_COL, width - m_EnvVars->GetColSize( EV_NAME_COL ) );
505 
506  width = m_SearchPaths->GetClientRect().GetWidth();
507 
508  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
509  m_SearchPaths->SetColSize( SP_ALIAS_COL, std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
510 
511  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
512  m_SearchPaths->SetColSize( SP_PATH_COL, std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
513 
514  m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL )
515  + m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
516  m_gridWidthsDirty = false;
517  }
518 
519  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
520  // even when the original validation was triggered from a killFocus event (and for
521  // dialog with notebooks, so that the corresponding notebook page can be shown in
522  // the background when triggered from an OK).
523  if( m_errorGrid )
524  {
525  // We will re-enter this routine when the error dialog is displayed, so make
526  // sure we don't keep putting up more dialogs.
527  wxGrid* grid = m_errorGrid;
528  m_errorGrid = nullptr;
529 
531 
532  grid->SetFocus();
533  grid->MakeCellVisible( m_errorRow, m_errorCol );
534  grid->SetGridCursor( m_errorRow, m_errorCol );
535 
536  grid->EnableCellEditControl( true );
537  grid->ShowCellEditControl();
538  }
539 }
540 
541 
542 void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
543 {
544  m_gridWidthsDirty = true;
545 
546  event.Skip();
547 }
548 
549 
550 void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
551 {
552  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
553  "are names that have been defined externally at the system or user "
554  "level. Environment variables defined at the system or user level "
555  "take precedence over the ones defined in this table. This means the "
556  "values in this table are ignored." );
557  msg << "<br><br><b>";
558  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
559  "will only accept upper case letters, digits, and the underscore characters." );
560  msg << "</b>";
561 
562  for( const auto& var: GetPredefinedEnvVars() )
563  {
564  msg << "<br><br><b>" << var << "</b>";
565 
566  const auto desc = LookUpEnvVarHelp( var );
567 
568  if( desc.size() > 0 )
569  msg << ": " << desc;
570 
571  }
572 
573  HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
574  dlg.SetDialogSizeInDU( 400, 250 );
575 
576  dlg.AddHTML_Text( msg );
577  dlg.ShowModal();
578 }
void OnSearchPathMoveDown(wxCommandEvent &event) override
void DoNotShowCheckbox(wxString file, int line)
Shows the &#39;do not show again&#39; checkbox
Definition: confirm.cpp:60
bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
Definition: env_vars.cpp:47
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:259
const ENV_VAR_LIST & GetPredefinedEnvVars()
Get the list of pre-defined environment variables.
Definition: env_vars.cpp:59
Helper class to create more flexible dialogs, including &#39;do not show again&#39; checkbox handling...
Definition: confirm.h:44
This file is part of the common library.
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
void OnGridSize(wxSizeEvent &event) override
SEARCH_PATH_GRID_COLUMNS
Class ENV_VAR_ITEM.
Definition: pgm_base.h:102
wxString m_alias
Class GRID_TRICKS is used to add cut, copy, and paste to an otherwise unmodied wxGrid instance...
Definition: grid_tricks.h:51
provides an extensible class to resolve 3D model paths.
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 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:116
Class GRID_CELL_TEXT_EDITOR.
Definition: validators.h:42
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
Class DIALOG_CONFIGURE_PATHS_BASE.
bool UpdatePathList(std::vector< SEARCH_PATH > &aPathList)
Function UpdatePathList clears the current path list and substitutes the given path list...
void AppendEnvVar(const wxString &aName, const wxString &aPath, bool isExternal)
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:131
FILENAME_RESOLVER * m_resolver
void OnUpdateUI(wxUpdateUIEvent &event) override
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder. ...
wxString m_description
DIALOG_CONFIGURE_PATHS(wxWindow *aParent, FILENAME_RESOLVER *aResolver)
wxString LookUpEnvVarHelp(const wxString &aEnvVar)
Look up long-form help text for a given environment variable.
Definition: env_vars.cpp:97
void OnAddSearchPath(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:156
Class HTML_MESSAGE_BOX.
VTBL_ENTRY const ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.h:314
void OnSearchPathMoveUp(wxCommandEvent &event) override
VTBL_ENTRY void SetLocalEnvVariables(const ENV_VAR_MAP &aEnvVarMap)
Function SetLocalEnvVariables.
Definition: pgm_base.cpp:867
void SetDialogSizeInDU(int aWidth, int aHeight)
set the dialog size, using a "logical value.
Class ENV_VAR_NAME_VALIDATOR.
Definition: validators.h:95
void OnGridCellChange(wxGridEvent &event) override
wxString m_pathvar
const char * name
Definition: DXF_plotter.cpp:61
void OnHelp(wxCommandEvent &event) override
#define max(a, b)
Definition: auxiliary.h:86
void AddHTML_Text(const wxString &message)
Function AddHTML_Text adds html text (without any change) to message list.
void OnGridCellRightClick(wxGridEvent &event) override
size_t i
Definition: json11.cpp:597
void OnRemoveEnvVar(wxCommandEvent &event) override
int ShowModal() override
Definition: confirm.cpp:102
void OnDeleteSearchPath(wxCommandEvent &event) override
Functions to provide helpful hints about what environment vars do.
void OnAddEnvVar(wxCommandEvent &event) override
void AppendSearchPath(const wxString &aName, const wxString &aPath, const wxString &aDesc)
Custom text control validator definitions.