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-2021 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 
26 
27 #include <bitmaps.h>
28 #include <confirm.h>
29 #include <menus_helpers.h>
30 #include <validators.h>
32 #include <filename_resolver.h>
33 #include <env_vars.h>
34 #include <grid_tricks.h>
35 #include <pgm_base.h>
36 #include <widgets/wx_grid.h>
38 
39 #include <algorithm>
40 #include <wx/dirdlg.h>
41 
43 {
47 };
48 
50 {
54 };
55 
56 
58  DIALOG_CONFIGURE_PATHS_BASE( aParent ),
59  m_errorGrid( nullptr ),
60  m_errorRow( -1 ),
61  m_errorCol( -1 ),
62  m_resolver( aResolver ),
63  m_gridWidth( 0 ),
64  m_gridWidthsDirty( true ),
65  m_helpDialog( nullptr )
66 {
71  m_btnMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
73 
75  m_EnvVars->AppendCols( 1 ); // for the isExternal flags
76  m_EnvVars->HideCol( TV_FLAG_COL );
77  m_EnvVars->UseNativeColHeader( true );
78 
79  wxGridCellAttr* attr = new wxGridCellAttr;
80  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_EnvVars, &m_curdir, wxEmptyString ) );
81  m_EnvVars->SetColAttr( TV_VALUE_COL, attr );
82 
83  attr = new wxGridCellAttr;
84  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_SearchPaths, &m_curdir, wxEmptyString ) );
85  m_SearchPaths->SetColAttr( TV_VALUE_COL, attr );
86 
87  // Give a bit more room for combobox editors
88  m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
89  m_SearchPaths->SetDefaultRowSize( m_SearchPaths->GetDefaultRowSize() + 4 );
90 
91  m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars ) );
92  m_SearchPaths->PushEventHandler( new GRID_TRICKS( m_SearchPaths ) );
93 
94  m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
95  m_SearchPaths->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
96 
97  if( m_resolver )
98  {
100  m_SearchPaths->UseNativeColHeader( true );
101 
102  // prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
103  m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
104  m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
105  }
106  else
107  m_sb3DSearchPaths->Show( false );
108 
110  m_sdbSizerOK->SetDefault();
111 
112  // wxFormBuilder doesn't include this event...
113  m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING,
114  wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
115  nullptr, this );
116  m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING,
117  wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
118  nullptr, this );
119 
120  GetSizer()->SetSizeHints( this );
121  Centre();
122 }
123 
124 
126 {
127  // Delete the GRID_TRICKS.
128  m_SearchPaths->PopEventHandler( true );
129  m_EnvVars->PopEventHandler( true );
130 
131  if( m_helpDialog )
132  m_helpDialog->Destroy();
133 
134  m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
135  wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
136  nullptr, this );
137  m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING,
138  wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
139  nullptr, this );
140 }
141 
142 
144 {
145  if( !wxDialog::TransferDataToWindow() )
146  return false;
147 
148  // Do 3D search paths first so they get first crack at setting m_curdir
149 
150  if( m_resolver )
151  {
152  const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
153 
154  for( auto it = paths->begin(); it != paths->end(); ++it )
155  {
156  if ( !( *it ).m_Alias.StartsWith( "${" ) && !( *it ).m_Alias.StartsWith( "$(" ) )
157  {
158  AppendSearchPath( it->m_Alias, it->m_Pathvar, it->m_Description );
159 
160  if( m_curdir.IsEmpty() )
161  m_curdir = it->m_Pathexp;
162  }
163  }
164  }
165 
166  // Environment variables
167 
168  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
169 
170  for( auto it = envVars.begin(); it != envVars.end(); ++it )
171  {
172  const wxString& path = it->second.GetValue();
173  AppendEnvVar( it->first, path, it->second.GetDefinedExternally() );
174 
175  if( m_curdir.IsEmpty() && !path.StartsWith( "${" ) && !path.StartsWith( "$(" ) )
176  m_curdir = path;
177  }
178 
179  return true;
180 }
181 
182 
183 void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString& aPath,
184  bool isExternal )
185 {
186  int i = m_EnvVars->GetNumberRows();
187 
188  m_EnvVars->AppendRows( 1 );
189 
190  m_EnvVars->SetCellValue( i, TV_NAME_COL, aName );
191 
192  wxGridCellAttr* nameCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_NAME_COL );
193  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
194  nameTextEditor->SetValidator( ENV_VAR_NAME_VALIDATOR() );
195  nameCellAttr->SetEditor( nameTextEditor );
196  nameCellAttr->SetReadOnly( ENV_VAR::IsEnvVarImmutable( aName ) );
197  nameCellAttr->DecRef();
198 
199  m_EnvVars->SetCellValue( i, TV_VALUE_COL, aPath );
200 
201  wxGridCellAttr* pathCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_VALUE_COL );
202  wxSystemColour c = isExternal ? wxSYS_COLOUR_MENU : wxSYS_COLOUR_LISTBOX;
203  pathCellAttr->SetBackgroundColour( wxSystemSettings::GetColour( c ) );
204  pathCellAttr->DecRef();
205 
206  m_EnvVars->SetCellValue( i, TV_FLAG_COL, isExternal ? wxT( "external" ) : wxEmptyString );
207 }
208 
209 
210 void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
211  const wxString& aDescription )
212 {
213  int i = m_SearchPaths->GetNumberRows();
214 
215  m_SearchPaths->AppendRows( 1 );
216 
217  m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
218 
219  wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
220  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
221  nameTextEditor->SetValidator( m_aliasValidator );
222  nameCellAttr->SetEditor( nameTextEditor );
223  nameCellAttr->DecRef();
224 
225  m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
226  m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
227 }
228 
229 
231 {
233  return false;
234 
235  if( !wxDialog::TransferDataFromWindow() )
236  return false;
237 
238  // Environment variables
239 
240  ENV_VAR_MAP& envVarMap = Pgm().GetLocalEnvVariables();
241 
242  for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
243  {
244  wxString name = m_EnvVars->GetCellValue( row, TV_NAME_COL );
245  wxString path = m_EnvVars->GetCellValue( row, TV_VALUE_COL );
246  bool external = !m_EnvVars->GetCellValue( row, TV_FLAG_COL ).IsEmpty();
247 
248  if( external )
249  {
250  // Don't check for consistency on external variables, just use them as-is
251  }
252  else if( name.IsEmpty() )
253  {
255  m_errorRow = row;
257  m_errorMsg = _( "Environment variable name cannot be empty." );
258  return false;
259  }
260  else if( path.IsEmpty() )
261  {
263  m_errorRow = row;
265  m_errorMsg = _( "Environment variable path cannot be empty." );
266  return false;
267  }
268 
269  if( envVarMap.count( name ) )
270  envVarMap.at( name ).SetValue( path );
271  else
272  envVarMap[ name ] = ENV_VAR_ITEM( name, path );
273  }
274 
275  Pgm().SetLocalEnvVariables();
276 
277  // 3D search paths
278 
279  if( m_resolver )
280  {
281  std::vector<SEARCH_PATH> alist;
282  SEARCH_PATH alias;
283 
284  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
285  {
286  alias.m_Alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
287  alias.m_Pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
288  alias.m_Description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
289 
290  if( alias.m_Alias.IsEmpty() )
291  {
293  m_errorRow = row;
295  m_errorMsg = _( "3D search path alias cannot be empty." );
296  return false;
297  }
298  else if( alias.m_Pathvar.IsEmpty() )
299  {
301  m_errorRow = row;
303  m_errorMsg = _( "3D search path cannot be empty." );
304  return false;
305  }
306 
307  alist.push_back( alias );
308  }
309 
310  if( !m_resolver->UpdatePathList( alist ) )
311  return false;
312  }
313 
314  return true;
315 }
316 
317 
319 {
320  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
321  int row = event.GetRow();
322  int col = event.GetCol();
323  wxString text = event.GetString();
324 
325  if( text.IsEmpty() )
326  {
327  if( grid == m_EnvVars )
328  {
329  if( col == TV_NAME_COL )
330  m_errorMsg = _( "Environment variable name cannot be empty." );
331  else
332  m_errorMsg = _( "Environment variable path cannot be empty." );
333  }
334  else
335  {
336  if( col == SP_ALIAS_COL )
337  m_errorMsg = _( "3D search path alias cannot be empty." );
338  else
339  m_errorMsg = _( "3D search path cannot be empty." );
340  }
341 
342  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
343  m_errorRow = row;
344  m_errorCol = col;
345 
346  event.Veto();
347  }
348 
349  if( grid == m_EnvVars )
350  {
351  if( col == TV_VALUE_COL && m_EnvVars->GetCellValue( row, TV_FLAG_COL ).Length()
352  && !Pgm().GetCommonSettings()->m_DoNotShowAgain.env_var_overwrite_warning )
353  {
354  wxString msg1 = _( "This path was defined externally to the running process and\n"
355  "will only be temporarily overwritten." );
356  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
357  "been defined are honored and any settings defined in the path\n"
358  "configuration dialog are ignored. If you did not intend for\n"
359  "this behavior, either rename any conflicting entries or remove\n"
360  "the external environment variable(s) from your system." );
361  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
362  dlg.ShowDetailedText( msg2 );
363  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
364  dlg.ShowModal();
365 
366  if( dlg.DoNotShowAgain() )
367  Pgm().GetCommonSettings()->m_DoNotShowAgain.env_var_overwrite_warning = true;
368  }
369  else if( col == TV_NAME_COL && m_EnvVars->GetCellValue( row, TV_NAME_COL ) != text )
370  {
371  // This env var name is reserved and cannot be added here.
372  if( text == PROJECT_VAR_NAME )
373  {
374  wxMessageBox( wxString::Format( _( "The name %s is reserved, and cannot be used." ),
375  PROJECT_VAR_NAME ) );
376  event.Veto();
377  }
378  else // Changing name; clear external flag
379  {
380  m_EnvVars->SetCellValue( row, TV_FLAG_COL, wxEmptyString );
381  }
382  }
383  }
384 }
385 
386 
387 void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
388 {
390  return;
391 
392  AppendEnvVar( wxEmptyString, wxEmptyString, false );
393 
394  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
395  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
396 
397  m_EnvVars->EnableCellEditControl( true );
398  m_EnvVars->ShowCellEditControl();
399 }
400 
401 
402 void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
403 {
405  return;
406 
407  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
408 
409  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
410  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
411 
412  m_SearchPaths->EnableCellEditControl( true );
413  m_SearchPaths->ShowCellEditControl();
414 }
415 
416 
417 void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
418 {
419  int curRow = m_EnvVars->GetGridCursorRow();
420 
421  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
422  return;
423  else if( ENV_VAR::IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, TV_NAME_COL ) ) )
424  {
425  wxBell();
426  return;
427  }
428 
429  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
430  m_EnvVars->DeleteRows( curRow, 1 );
431 
432  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
433  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
434 }
435 
436 
437 void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
438 {
439  int curRow = m_SearchPaths->GetGridCursorRow();
440 
441  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
442  return;
443 
444  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
445  m_SearchPaths->DeleteRows( curRow, 1 );
446 
447  // if there are still rows in grid, make previous row visible
448  if( m_SearchPaths->GetNumberRows() )
449  {
450  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ),
451  m_SearchPaths->GetGridCursorCol() );
452  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
453  }
454 }
455 
456 
457 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
458 {
460  return;
461 
462  int curRow = m_SearchPaths->GetGridCursorRow();
463  int prevRow = curRow - 1;
464 
465  if( curRow > 0 )
466  {
467  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
468  {
469  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
470  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
471  m_SearchPaths->SetCellValue( prevRow, i, tmp );
472  }
473 
474  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
475  }
476  else
477  {
478  wxBell();
479  }
480 }
481 
482 
483 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
484 {
486  return;
487 
488  int curRow = m_SearchPaths->GetGridCursorRow();
489  int nextRow = curRow + 1;
490 
491  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
492  {
493  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
494  {
495  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
496  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
497  m_SearchPaths->SetCellValue( nextRow, i, tmp );
498  }
499 
500  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
501  }
502  else
503  {
504  wxBell();
505  }
506 }
507 
508 
510 {
511  wxASSERT((int) TV_VALUE_COL == (int) SP_PATH_COL );
512 
513  if( aEvent.GetCol() == TV_VALUE_COL )
514  {
515  wxMenu menu;
516 
517  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( BITMAPS::small_folder ) );
518 
519  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
520  {
521  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
522  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
523 
524  if( dlg.ShowModal() == wxID_OK )
525  {
526  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
527  grid->SetCellValue( aEvent.GetRow(), TV_VALUE_COL, dlg.GetPath() );
528  m_curdir = dlg.GetPath();
529  }
530  }
531  }
532 }
533 
534 
535 void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
536 {
537  if( m_gridWidthsDirty )
538  {
539  int width = m_EnvVars->GetClientRect().GetWidth();
540 
541  m_EnvVars->AutoSizeColumn( TV_NAME_COL );
542  m_EnvVars->SetColSize( TV_NAME_COL, std::max( m_EnvVars->GetColSize( TV_NAME_COL ), 120 ) );
543 
544  m_EnvVars->SetColSize( TV_VALUE_COL, width - m_EnvVars->GetColSize( TV_NAME_COL ) );
545 
546  width = m_SearchPaths->GetClientRect().GetWidth();
547 
548  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
549  m_SearchPaths->SetColSize( SP_ALIAS_COL,
550  std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
551 
552  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
553  m_SearchPaths->SetColSize( SP_PATH_COL,
554  std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
555 
556  m_SearchPaths->SetColSize( SP_DESC_COL, width -
557  ( m_SearchPaths->GetColSize( SP_ALIAS_COL ) +
558  m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
559  m_gridWidth = m_EnvVars->GetSize().GetX();
560  m_gridWidthsDirty = false;
561  }
562 
563  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
564  // even when the original validation was triggered from a killFocus event (and for
565  // dialog with notebooks, so that the corresponding notebook page can be shown in
566  // the background when triggered from an OK).
567  if( m_errorGrid )
568  {
569  // We will re-enter this routine when the error dialog is displayed, so make
570  // sure we don't keep putting up more dialogs.
571  wxGrid* grid = m_errorGrid;
572  m_errorGrid = nullptr;
573 
575 
576  grid->SetFocus();
577  grid->MakeCellVisible( m_errorRow, m_errorCol );
578  grid->SetGridCursor( m_errorRow, m_errorCol );
579 
580  grid->EnableCellEditControl( true );
581  grid->ShowCellEditControl();
582  }
583 }
584 
585 
586 void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
587 {
588  if( event.GetSize().GetX() != m_gridWidth )
589  m_gridWidthsDirty = true;
590 
591  event.Skip();
592 }
593 
594 
595 void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
596 {
597  if( m_helpDialog )
598  {
600  return;
601  }
602 
603  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
604  "are names that have been defined externally at the system or user "
605  "level. Environment variables defined at the system or user level "
606  "take precedence over the ones defined in this table. This means the "
607  "values in this table are ignored." );
608  msg << "<br><br><b>";
609  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
610  "will only accept upper case letters, digits, and the underscore characters." );
611  msg << "</b>";
612 
613  for( const auto& var : ENV_VAR::GetPredefinedEnvVars() )
614  {
615  msg << "<br><br><b>" << var << "</b>";
616 
617  const auto desc = ENV_VAR::LookUpEnvVarHelp( var );
618 
619  if( desc.size() > 0 )
620  msg << ": " << desc;
621 
622  }
623 
624  m_helpDialog = new HTML_MESSAGE_BOX( nullptr, this, _( "Environment Variable Help" ) );
625  m_helpDialog->SetDialogSizeInDU( 400, 250 );
626 
627  m_helpDialog->AddHTML_Text( msg );
629 
630  // m_helpDialog will be destroyed when closing the dialog
631 }
void OnSearchPathMoveDown(wxCommandEvent &event) override
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Definition: confirm.cpp:55
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:284
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:45
This file is part of the common library.
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
Definition: bitmap.cpp:257
HTML_MESSAGE_BOX * m_helpDialog
void OnGridSize(wxSizeEvent &event) override
SEARCH_PATH_GRID_COLUMNS
bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
Definition: env_vars.cpp:48
KiCad uses environment variables internally for determining the base paths for libraries,...
bool UpdatePathList(const std::vector< SEARCH_PATH > &aPathList)
Clear the current path list and substitutes the given path list and update the path configuration fil...
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:38
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:55
void OnGridCellChanging(wxGridEvent &event)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
Definition: validators.h:44
wxString m_Alias
Class DIALOG_CONFIGURE_PATHS_BASE.
void AppendEnvVar(const wxString &aName, const wxString &aPath, bool isExternal)
FILENAME_RESOLVER * m_resolver
void OnUpdateUI(wxUpdateUIEvent &event) override
wxString m_Description
wxString m_Pathvar
const std::list< SEARCH_PATH > * GetPaths() const
Return a pointer to the internal path list; the items in:load.
#define _(s)
DIALOG_CONFIGURE_PATHS(wxWindow *aParent, FILENAME_RESOLVER *aResolver)
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
void OnAddSearchPath(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:190
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
void OnSearchPathMoveUp(wxCommandEvent &event) override
bool DoNotShowAgain() const
Definition: confirm.cpp:63
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void ShowModeless()
Show a modeless version of the dialog (without an OK button).
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
wxString LookUpEnvVarHelp(const wxString &aEnvVar)
Look up long-form help text for a given environment variable.
Definition: env_vars.cpp:108
see class PGM_BASE
Provide an extensible class to resolve 3D model paths.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
const char * name
Definition: DXF_plotter.cpp:56
void OnHelp(wxCommandEvent &event) override
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void OnGridCellRightClick(wxGridEvent &event) override
void OnRemoveEnvVar(wxCommandEvent &event) override
const ENV_VAR_LIST & GetPredefinedEnvVars()
Get the list of pre-defined environment variables.
Definition: env_vars.cpp:60
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:106
int ShowModal() override
Definition: confirm.cpp:99
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.