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 <grid_tricks.h>
34 #include <widgets/wx_grid.h>
36 
38 {
42 };
43 
45 {
49 };
50 
51 
53  DIALOG_CONFIGURE_PATHS_BASE( aParent ),
54  m_errorGrid( nullptr ), m_errorRow( -1 ), m_errorCol( -1 ),
55  m_resolver( aResolver ),
56  m_gridWidthsDirty( true )
57 {
58  m_btnAddEnvVar->SetBitmap( KiBitmap( small_plus_xpm ) );
59  m_btnDeleteEnvVar->SetBitmap( KiBitmap( trash_xpm ) );
60  m_btnAddSearchPath->SetBitmap( KiBitmap( small_plus_xpm ) );
61  m_btnDeleteSearchPath->SetBitmap( KiBitmap( trash_xpm ) );
62  m_btnMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
63  m_btnMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
64 
65  m_EnvVars->DeleteRows( 0, m_EnvVars->GetNumberRows() );
66  m_EnvVars->AppendCols( 1 ); // for the isExternal flags
67  m_EnvVars->HideCol( EV_FLAG_COL );
68  m_EnvVars->UseNativeColHeader( true );
69 
70  wxGridCellAttr* attr = new wxGridCellAttr;
71  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir ) );
72  m_EnvVars->SetColAttr( EV_PATH_COL, attr );
73 
74  attr = new wxGridCellAttr;
75  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir ) );
76  m_SearchPaths->SetColAttr( EV_PATH_COL, attr );
77 
78  // Give a bit more room for combobox editors
79  m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
80  m_SearchPaths->SetDefaultRowSize( m_SearchPaths->GetDefaultRowSize() + 4 );
81 
82  m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars ) );
83  m_SearchPaths->PushEventHandler( new GRID_TRICKS( m_SearchPaths ) );
84 
85  m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
86  m_SearchPaths->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
87 
88  if( m_resolver )
89  {
90  m_SearchPaths->DeleteRows( 0, m_SearchPaths->GetNumberRows() );
91  m_SearchPaths->UseNativeColHeader( true );
92 
93  // prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
94  m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
95  m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
96  }
97  else
98  m_sb3DSearchPaths->Show( false );
99 
101  m_sdbSizerOK->SetDefault();
102 
103  // wxFormBuilder doesn't include this event...
104  m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
105  m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
106 
107  GetSizer()->SetSizeHints( this );
108  Centre();
109 }
110 
111 
113 {
114  // Delete the GRID_TRICKS.
115  m_SearchPaths->PopEventHandler( true );
116  m_EnvVars->PopEventHandler( true );
117 
118  m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
119  m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
120 }
121 
122 
124 {
125  if( !wxDialog::TransferDataToWindow() )
126  return false;
127 
128  // Do 3D search paths first so they get first crack at setting m_curdir
129 
130  if( m_resolver )
131  {
132  const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
133 
134  for( auto it = paths->begin(); it != paths->end(); ++it )
135  {
136  if ( !( *it ).m_alias.StartsWith( "${" ) && !( *it ).m_alias.StartsWith( "$(" ) )
137  {
138  AppendSearchPath( it->m_alias, it->m_pathvar, it->m_description );
139 
140  if( m_curdir.IsEmpty() )
141  m_curdir = it->m_pathexp;
142  }
143  }
144  }
145 
146  // Environment variables
147 
148  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
149 
150  for( auto it = envVars.begin(); it != envVars.end(); ++it )
151  {
152  const wxString& path = it->second.GetValue();
153  AppendEnvVar( it->first, path, it->second.GetDefinedExternally() );
154 
155  if( m_curdir.IsEmpty() && !path.StartsWith( "${" ) && !path.StartsWith( "$(" ) )
156  m_curdir = path;
157  }
158 
159  return true;
160 }
161 
162 
163 void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString& aPath,
164  bool isExternal )
165 {
166  int i = m_EnvVars->GetNumberRows();
167 
168  m_EnvVars->AppendRows( 1 );
169 
170  m_EnvVars->SetCellValue( i, EV_NAME_COL, aName );
171 
172  wxGridCellAttr* nameCellAttr = m_EnvVars->GetOrCreateCellAttr( i, EV_NAME_COL );
173  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
174  nameTextEditor->SetValidator( ENV_VAR_NAME_VALIDATOR() );
175  nameCellAttr->SetEditor( nameTextEditor );
176  nameCellAttr->SetReadOnly( IsEnvVarImmutable( aName ) );
177  nameCellAttr->DecRef();
178 
179  m_EnvVars->SetCellValue( i, EV_PATH_COL, aPath );
180 
181  wxGridCellAttr* pathCellAttr = m_EnvVars->GetOrCreateCellAttr( i, EV_PATH_COL );
182  wxSystemColour c = isExternal ? wxSYS_COLOUR_MENU : wxSYS_COLOUR_LISTBOX;
183  pathCellAttr->SetBackgroundColour( wxSystemSettings::GetColour( c ) );
184  pathCellAttr->DecRef();
185 
186  m_EnvVars->SetCellValue( i, EV_FLAG_COL, isExternal ? wxT( "external" ) : wxEmptyString );
187 }
188 
189 
190 void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
191  const wxString& aDescription )
192 {
193  int i = m_SearchPaths->GetNumberRows();
194 
195  m_SearchPaths->AppendRows( 1 );
196 
197  m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
198 
199  wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
200  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
201  nameTextEditor->SetValidator( m_aliasValidator );
202  nameCellAttr->SetEditor( nameTextEditor );
203  nameCellAttr->DecRef();
204 
205  m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
206  m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
207 }
208 
209 
211 {
213  return false;
214 
215  if( !wxDialog::TransferDataFromWindow() )
216  return false;
217 
218  // Environment variables
219 
220  ENV_VAR_MAP envVarMap;
221 
222  for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
223  {
224  wxString name = m_EnvVars->GetCellValue( row, EV_NAME_COL );
225  wxString path = m_EnvVars->GetCellValue( row, EV_PATH_COL );
226  wxString external = m_EnvVars->GetCellValue( row, EV_FLAG_COL );
227 
228  if( external.Length() )
229  continue;
230 
231  if( name.IsEmpty() )
232  {
234  m_errorRow = row;
236  m_errorMsg = _( "Environment variable name cannot be empty." );
237  return false;
238  }
239  else if( path.IsEmpty() )
240  {
242  m_errorRow = row;
244  m_errorMsg = _( "Environment variable path cannot be empty." );
245  return false;
246  }
247 
248  envVarMap[ name ] = ENV_VAR_ITEM( path );
249  }
250 
251  Pgm().SetLocalEnvVariables( envVarMap );
252 
253  // 3D search paths
254 
255  if( m_resolver )
256  {
257  std::vector<SEARCH_PATH> alist;
258  SEARCH_PATH alias;
259 
260  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
261  {
262  alias.m_alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
263  alias.m_pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
264  alias.m_description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
265 
266  if( alias.m_alias.IsEmpty() )
267  {
269  m_errorRow = row;
271  m_errorMsg = _( "3D search path alias cannot be empty." );
272  return false;
273  }
274  else if( alias.m_pathvar.IsEmpty() )
275  {
277  m_errorRow = row;
279  m_errorMsg = _( "3D search path cannot be empty." );
280  return false;
281  }
282 
283  alist.push_back( alias );
284  }
285 
286  if( !m_resolver->UpdatePathList( alist ) )
287  return false;
288  }
289 
290  return true;
291 }
292 
293 
295 {
296  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
297  int row = event.GetRow();
298  int col = event.GetCol();
299  wxString text = event.GetString();
300 
301  if( text.IsEmpty() )
302  {
303  if( grid == m_EnvVars )
304  {
305  if( col == EV_NAME_COL )
306  m_errorMsg = _( "Environment variable name cannot be empty." );
307  else
308  m_errorMsg = _( "Environment variable path cannot be empty." );
309  }
310  else
311  {
312  if( col == SP_ALIAS_COL )
313  m_errorMsg = _( "3D search path alias cannot be empty." );
314  else
315  m_errorMsg = _( "3D search path cannot be empty." );
316  }
317  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
318  m_errorRow = row;
319  m_errorCol = col;
320 
321  event.Veto();
322  }
323 
324  if( grid == m_EnvVars )
325  {
326  if( col == EV_PATH_COL && m_EnvVars->GetCellValue( row, EV_FLAG_COL ).Length() )
327  {
328  wxString msg1 = _( "This path was defined externally to the running process and\n"
329  "will only be temporarily overwritten." );
330  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
331  "been defined are honored and any settings defined in the path\n"
332  "configuration dialog are ignored. If you did not intend for\n"
333  "this behavior, either rename any conflicting entries or remove\n"
334  "the external environment variable(s) from your system." );
335  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
336  dlg.ShowDetailedText( msg2 );
337  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
338  dlg.ShowModal();
339  }
340  else if( col == EV_NAME_COL && m_EnvVars->GetCellValue( row, EV_NAME_COL ) != text )
341  {
342  if( text == PROJECT_VAR_NAME ) // This env var name is reserved and cannot be added here:
343  {
344  wxMessageBox( wxString::Format(
345  _( "The name %s is reserved, and cannot be used here" ),
346  PROJECT_VAR_NAME ) );
347  event.Veto();
348  }
349  else // Changing name; clear external flag
350  m_EnvVars->SetCellValue( row, EV_FLAG_COL, wxEmptyString );
351  }
352  }
353 }
354 
355 
356 void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
357 {
359  return;
360 
361  AppendEnvVar( wxEmptyString, wxEmptyString, false );
362 
363  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
364  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, EV_NAME_COL );
365 
366  m_EnvVars->EnableCellEditControl( true );
367  m_EnvVars->ShowCellEditControl();
368 }
369 
370 
371 void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
372 {
374  return;
375 
376  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
377 
378  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
379  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
380 
381  m_SearchPaths->EnableCellEditControl( true );
382  m_SearchPaths->ShowCellEditControl();
383 }
384 
385 
386 void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
387 {
388  int curRow = m_EnvVars->GetGridCursorRow();
389 
390  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
391  return;
392  else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
393  {
394  wxBell();
395  return;
396  }
397 
398  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
399  m_EnvVars->DeleteRows( curRow, 1 );
400 
401  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
402  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
403 }
404 
405 
406 void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
407 {
408  int curRow = m_SearchPaths->GetGridCursorRow();
409 
410  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
411  return;
412 
413  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
414  m_SearchPaths->DeleteRows( curRow, 1 );
415 
416  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
417  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
418 }
419 
420 
421 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
422 {
424  return;
425 
426  int curRow = m_SearchPaths->GetGridCursorRow();
427  int prevRow = curRow - 1;
428 
429  if( curRow > 0 )
430  {
431  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
432  {
433  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
434  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
435  m_SearchPaths->SetCellValue( prevRow, i, tmp );
436  }
437 
438  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
439  }
440  else
441  wxBell();
442 }
443 
444 
445 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
446 {
448  return;
449 
450  int curRow = m_SearchPaths->GetGridCursorRow();
451  int nextRow = curRow + 1;
452 
453  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
454  {
455  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
456  {
457  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
458  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
459  m_SearchPaths->SetCellValue( nextRow, i, tmp );
460  }
461 
462  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
463  }
464  else
465  wxBell();
466 }
467 
468 
470 {
471  wxASSERT( (int) EV_PATH_COL == (int) SP_PATH_COL );
472 
473  if( aEvent.GetCol() == EV_PATH_COL )
474  {
475  wxMenu menu;
476 
477  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( folder_xpm ) );
478  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
479  {
480  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
481  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
482 
483  if( dlg.ShowModal() == wxID_OK )
484  {
485  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
486  grid->SetCellValue( aEvent.GetRow(), EV_PATH_COL, dlg.GetPath() );
487  m_curdir = dlg.GetPath();
488  }
489  }
490  }
491 }
492 
493 
494 void DIALOG_CONFIGURE_PATHS::OnGridCellChange( wxGridEvent& aEvent )
495 {
496  m_gridWidthsDirty = true;
497 
498  aEvent.Skip();
499 }
500 
501 
502 void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
503 {
504  if( m_gridWidthsDirty && ( !m_EnvVars->IsCellEditControlShown()
505  && !m_SearchPaths->IsCellEditControlShown() ) )
506  {
507  int width = m_EnvVars->GetClientRect().GetWidth();
508 
509  m_EnvVars->AutoSizeColumn( EV_NAME_COL );
510  m_EnvVars->SetColSize( EV_NAME_COL, std::max( m_EnvVars->GetColSize( EV_NAME_COL ), 120 ) );
511 
512  m_EnvVars->SetColSize( EV_PATH_COL, width - m_EnvVars->GetColSize( EV_NAME_COL ) );
513 
514  width = m_SearchPaths->GetClientRect().GetWidth();
515 
516  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
517  m_SearchPaths->SetColSize( SP_ALIAS_COL, std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
518 
519  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
520  m_SearchPaths->SetColSize( SP_PATH_COL, std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
521 
522  m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL )
523  + m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
524  m_gridWidthsDirty = false;
525  }
526 
527  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
528  // even when the original validation was triggered from a killFocus event (and for
529  // dialog with notebooks, so that the corresponding notebook page can be shown in
530  // the background when triggered from an OK).
531  if( m_errorGrid )
532  {
533  // We will re-enter this routine when the error dialog is displayed, so make
534  // sure we don't keep putting up more dialogs.
535  wxGrid* grid = m_errorGrid;
536  m_errorGrid = nullptr;
537 
539 
540  grid->SetFocus();
541  grid->MakeCellVisible( m_errorRow, m_errorCol );
542  grid->SetGridCursor( m_errorRow, m_errorCol );
543 
544  grid->EnableCellEditControl( true );
545  grid->ShowCellEditControl();
546  }
547 }
548 
549 
550 void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
551 {
552  m_gridWidthsDirty = true;
553 
554  event.Skip();
555 }
556 
557 
558 void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
559 {
560  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
561  "are names that have been defined externally at the system or user "
562  "level. Environment variables defined at the system or user level "
563  "take precedence over the ones defined in this table. This means the "
564  "values in this table are ignored." );
565  msg << "<br><br><b>";
566  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
567  "will only accept upper case letters, digits, and the underscore characters." );
568  msg << "</b>";
569 
570  for( const auto& var: GetPredefinedEnvVars() )
571  {
572  msg << "<br><br><b>" << var << "</b>";
573 
574  const auto desc = LookUpEnvVarHelp( var );
575 
576  if( desc.size() > 0 )
577  msg << ": " << desc;
578 
579  }
580 
581  HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
582  dlg.SetDialogSizeInDU( 400, 250 );
583 
584  dlg.AddHTML_Text( msg );
585  dlg.ShowModal();
586 }
void OnSearchPathMoveDown(wxCommandEvent &event) override
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox
Definition: confirm.cpp:53
bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
Definition: env_vars.cpp:49
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:249
const ENV_VAR_LIST & GetPredefinedEnvVars()
Get the list of pre-defined environment variables.
Definition: env_vars.cpp:61
Helper class to create more flexible dialogs, including 'do not show again' 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:251
void OnGridSize(wxSizeEvent &event) override
SEARCH_PATH_GRID_COLUMNS
Class ENV_VAR_ITEM.
Definition: pgm_base.h:107
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:37
wxString m_alias
Class GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GR...
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:115
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
Definition: validators.h:44
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:136
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:99
void OnAddSearchPath(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:172
Class HTML_MESSAGE_BOX.
VTBL_ENTRY const ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.h:315
#define _(s)
void OnSearchPathMoveUp(wxCommandEvent &event) override
VTBL_ENTRY void SetLocalEnvVariables(const ENV_VAR_MAP &aEnvVarMap)
Function SetLocalEnvVariables.
Definition: pgm_base.cpp:795
void SetDialogSizeInDU(int aWidth, int aHeight)
set the dialog size, using a "logical value.
This class provides a custom wxValidator object for limiting the allowable characters when defining a...
Definition: validators.h:91
void OnGridCellChange(wxGridEvent &event) override
wxString m_pathvar
const char * name
Definition: DXF_plotter.cpp:61
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 OnHelp(wxCommandEvent &event) override
#define max(a, b)
Definition: auxiliary.h:86
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void OnGridCellRightClick(wxGridEvent &event) override
size_t i
Definition: json11.cpp:649
void OnRemoveEnvVar(wxCommandEvent &event) override
int ShowModal() override
Definition: confirm.cpp:95
void OnDeleteSearchPath(wxCommandEvent &event) override
Functions related to environment variables, including help functions.
void OnAddEnvVar(wxCommandEvent &event) override
void AppendSearchPath(const wxString &aName, const wxString &aPath, const wxString &aDesc)
Custom text control validator definitions.