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 
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 
74  m_EnvVars->DeleteRows( 0, m_EnvVars->GetNumberRows() );
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  {
99  m_SearchPaths->DeleteRows( 0, m_SearchPaths->GetNumberRows() );
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, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
114  m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
115 
116  GetSizer()->SetSizeHints( this );
117  Centre();
118 }
119 
120 
122 {
123  // Delete the GRID_TRICKS.
124  m_SearchPaths->PopEventHandler( true );
125  m_EnvVars->PopEventHandler( true );
126 
127  if( m_helpDialog )
128  m_helpDialog->Destroy();
129 
130  m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
131  m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
132 }
133 
134 
136 {
137  if( !wxDialog::TransferDataToWindow() )
138  return false;
139 
140  // Do 3D search paths first so they get first crack at setting m_curdir
141 
142  if( m_resolver )
143  {
144  const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
145 
146  for( auto it = paths->begin(); it != paths->end(); ++it )
147  {
148  if ( !( *it ).m_Alias.StartsWith( "${" ) && !( *it ).m_Alias.StartsWith( "$(" ) )
149  {
150  AppendSearchPath( it->m_Alias, it->m_Pathvar, it->m_Description );
151 
152  if( m_curdir.IsEmpty() )
153  m_curdir = it->m_Pathexp;
154  }
155  }
156  }
157 
158  // Environment variables
159 
160  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
161 
162  for( auto it = envVars.begin(); it != envVars.end(); ++it )
163  {
164  const wxString& path = it->second.GetValue();
165  AppendEnvVar( it->first, path, it->second.GetDefinedExternally() );
166 
167  if( m_curdir.IsEmpty() && !path.StartsWith( "${" ) && !path.StartsWith( "$(" ) )
168  m_curdir = path;
169  }
170 
171  return true;
172 }
173 
174 
175 void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString& aPath,
176  bool isExternal )
177 {
178  int i = m_EnvVars->GetNumberRows();
179 
180  m_EnvVars->AppendRows( 1 );
181 
182  m_EnvVars->SetCellValue( i, TV_NAME_COL, aName );
183 
184  wxGridCellAttr* nameCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_NAME_COL );
185  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
186  nameTextEditor->SetValidator( ENV_VAR_NAME_VALIDATOR() );
187  nameCellAttr->SetEditor( nameTextEditor );
188  nameCellAttr->SetReadOnly( IsEnvVarImmutable( aName ) );
189  nameCellAttr->DecRef();
190 
191  m_EnvVars->SetCellValue( i, TV_VALUE_COL, aPath );
192 
193  wxGridCellAttr* pathCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_VALUE_COL );
194  wxSystemColour c = isExternal ? wxSYS_COLOUR_MENU : wxSYS_COLOUR_LISTBOX;
195  pathCellAttr->SetBackgroundColour( wxSystemSettings::GetColour( c ) );
196  pathCellAttr->DecRef();
197 
198  m_EnvVars->SetCellValue( i, TV_FLAG_COL, isExternal ? wxT( "external" ) : wxEmptyString );
199 }
200 
201 
202 void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
203  const wxString& aDescription )
204 {
205  int i = m_SearchPaths->GetNumberRows();
206 
207  m_SearchPaths->AppendRows( 1 );
208 
209  m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
210 
211  wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
212  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
213  nameTextEditor->SetValidator( m_aliasValidator );
214  nameCellAttr->SetEditor( nameTextEditor );
215  nameCellAttr->DecRef();
216 
217  m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
218  m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
219 }
220 
221 
223 {
225  return false;
226 
227  if( !wxDialog::TransferDataFromWindow() )
228  return false;
229 
230  // Environment variables
231 
232  ENV_VAR_MAP& envVarMap = Pgm().GetLocalEnvVariables();
233 
234  for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
235  {
236  wxString name = m_EnvVars->GetCellValue( row, TV_NAME_COL );
237  wxString path = m_EnvVars->GetCellValue( row, TV_VALUE_COL );
238  bool external = !m_EnvVars->GetCellValue( row, TV_FLAG_COL ).IsEmpty();
239 
240  if( external )
241  {
242  // Don't check for consistency on external variables, just use them as-is
243  }
244  else if( name.IsEmpty() )
245  {
247  m_errorRow = row;
249  m_errorMsg = _( "Environment variable name cannot be empty." );
250  return false;
251  }
252  else if( path.IsEmpty() )
253  {
255  m_errorRow = row;
257  m_errorMsg = _( "Environment variable path cannot be empty." );
258  return false;
259  }
260 
261  if( envVarMap.count( name ) )
262  envVarMap.at( name ).SetValue( path );
263  else
264  envVarMap[ name ] = ENV_VAR_ITEM( name, path );
265  }
266 
267  Pgm().SetLocalEnvVariables();
268 
269  // 3D search paths
270 
271  if( m_resolver )
272  {
273  std::vector<SEARCH_PATH> alist;
274  SEARCH_PATH alias;
275 
276  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
277  {
278  alias.m_Alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
279  alias.m_Pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
280  alias.m_Description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
281 
282  if( alias.m_Alias.IsEmpty() )
283  {
285  m_errorRow = row;
287  m_errorMsg = _( "3D search path alias cannot be empty." );
288  return false;
289  }
290  else if( alias.m_Pathvar.IsEmpty() )
291  {
293  m_errorRow = row;
295  m_errorMsg = _( "3D search path cannot be empty." );
296  return false;
297  }
298 
299  alist.push_back( alias );
300  }
301 
302  if( !m_resolver->UpdatePathList( alist ) )
303  return false;
304  }
305 
306  return true;
307 }
308 
309 
311 {
312  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
313  int row = event.GetRow();
314  int col = event.GetCol();
315  wxString text = event.GetString();
316 
317  if( text.IsEmpty() )
318  {
319  if( grid == m_EnvVars )
320  {
321  if( col == TV_NAME_COL )
322  m_errorMsg = _( "Environment variable name cannot be empty." );
323  else
324  m_errorMsg = _( "Environment variable path cannot be empty." );
325  }
326  else
327  {
328  if( col == SP_ALIAS_COL )
329  m_errorMsg = _( "3D search path alias cannot be empty." );
330  else
331  m_errorMsg = _( "3D search path cannot be empty." );
332  }
333  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
334  m_errorRow = row;
335  m_errorCol = col;
336 
337  event.Veto();
338  }
339 
340  if( grid == m_EnvVars )
341  {
342  if( col == TV_VALUE_COL && m_EnvVars->GetCellValue( row, TV_FLAG_COL ).Length() )
343  {
344  wxString msg1 = _( "This path was defined externally to the running process and\n"
345  "will only be temporarily overwritten." );
346  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
347  "been defined are honored and any settings defined in the path\n"
348  "configuration dialog are ignored. If you did not intend for\n"
349  "this behavior, either rename any conflicting entries or remove\n"
350  "the external environment variable(s) from your system." );
351  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
352  dlg.ShowDetailedText( msg2 );
353  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
354  dlg.ShowModal();
355  }
356  else if( col == TV_NAME_COL && m_EnvVars->GetCellValue( row, TV_NAME_COL ) != text )
357  {
358  if( text == PROJECT_VAR_NAME ) // This env var name is reserved and cannot be added here:
359  {
360  wxMessageBox( wxString::Format(
361  _( "The name %s is reserved, and cannot be used here" ),
362  PROJECT_VAR_NAME ) );
363  event.Veto();
364  }
365  else // Changing name; clear external flag
366  m_EnvVars->SetCellValue( row, TV_FLAG_COL, wxEmptyString );
367  }
368  }
369 }
370 
371 
372 void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
373 {
375  return;
376 
377  AppendEnvVar( wxEmptyString, wxEmptyString, false );
378 
379  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
380  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
381 
382  m_EnvVars->EnableCellEditControl( true );
383  m_EnvVars->ShowCellEditControl();
384 }
385 
386 
387 void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
388 {
390  return;
391 
392  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
393 
394  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
395  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
396 
397  m_SearchPaths->EnableCellEditControl( true );
398  m_SearchPaths->ShowCellEditControl();
399 }
400 
401 
402 void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
403 {
404  int curRow = m_EnvVars->GetGridCursorRow();
405 
406  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
407  return;
408  else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, TV_NAME_COL ) ) )
409  {
410  wxBell();
411  return;
412  }
413 
414  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
415  m_EnvVars->DeleteRows( curRow, 1 );
416 
417  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
418  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
419 }
420 
421 
422 void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
423 {
424  int curRow = m_SearchPaths->GetGridCursorRow();
425 
426  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
427  return;
428 
429  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
430  m_SearchPaths->DeleteRows( curRow, 1 );
431 
432  // if there are still rows in grid, make previous row visible
433  if( m_SearchPaths->GetNumberRows() )
434  {
435  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
436  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
437  }
438 }
439 
440 
441 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
442 {
444  return;
445 
446  int curRow = m_SearchPaths->GetGridCursorRow();
447  int prevRow = curRow - 1;
448 
449  if( curRow > 0 )
450  {
451  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
452  {
453  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
454  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
455  m_SearchPaths->SetCellValue( prevRow, i, tmp );
456  }
457 
458  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
459  }
460  else
461  wxBell();
462 }
463 
464 
465 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
466 {
468  return;
469 
470  int curRow = m_SearchPaths->GetGridCursorRow();
471  int nextRow = curRow + 1;
472 
473  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
474  {
475  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
476  {
477  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
478  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
479  m_SearchPaths->SetCellValue( nextRow, i, tmp );
480  }
481 
482  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
483  }
484  else
485  wxBell();
486 }
487 
488 
490 {
491  wxASSERT((int) TV_VALUE_COL == (int) SP_PATH_COL );
492 
493  if( aEvent.GetCol() == TV_VALUE_COL )
494  {
495  wxMenu menu;
496 
497  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( BITMAPS::small_folder ) );
498  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
499  {
500  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
501  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
502 
503  if( dlg.ShowModal() == wxID_OK )
504  {
505  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
506  grid->SetCellValue( aEvent.GetRow(), TV_VALUE_COL, dlg.GetPath() );
507  m_curdir = dlg.GetPath();
508  }
509  }
510  }
511 }
512 
513 
514 void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
515 {
516  if( m_gridWidthsDirty )
517  {
518  int width = m_EnvVars->GetClientRect().GetWidth();
519 
520  m_EnvVars->AutoSizeColumn( TV_NAME_COL );
521  m_EnvVars->SetColSize( TV_NAME_COL, std::max( m_EnvVars->GetColSize( TV_NAME_COL ), 120 ) );
522 
523  m_EnvVars->SetColSize( TV_VALUE_COL, width - m_EnvVars->GetColSize( TV_NAME_COL ) );
524 
525  width = m_SearchPaths->GetClientRect().GetWidth();
526 
527  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
528  m_SearchPaths->SetColSize( SP_ALIAS_COL, std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
529 
530  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
531  m_SearchPaths->SetColSize( SP_PATH_COL, std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
532 
533  m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL )
534  + m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
535  m_gridWidth = m_EnvVars->GetSize().GetX();
536  m_gridWidthsDirty = false;
537  }
538 
539  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
540  // even when the original validation was triggered from a killFocus event (and for
541  // dialog with notebooks, so that the corresponding notebook page can be shown in
542  // the background when triggered from an OK).
543  if( m_errorGrid )
544  {
545  // We will re-enter this routine when the error dialog is displayed, so make
546  // sure we don't keep putting up more dialogs.
547  wxGrid* grid = m_errorGrid;
548  m_errorGrid = nullptr;
549 
551 
552  grid->SetFocus();
553  grid->MakeCellVisible( m_errorRow, m_errorCol );
554  grid->SetGridCursor( m_errorRow, m_errorCol );
555 
556  grid->EnableCellEditControl( true );
557  grid->ShowCellEditControl();
558  }
559 }
560 
561 
562 void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
563 {
564  if( event.GetSize().GetX() != m_gridWidth )
565  m_gridWidthsDirty = true;
566 
567  event.Skip();
568 }
569 
570 
571 void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
572 {
573  if( m_helpDialog )
574  {
576  return;
577  }
578 
579  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
580  "are names that have been defined externally at the system or user "
581  "level. Environment variables defined at the system or user level "
582  "take precedence over the ones defined in this table. This means the "
583  "values in this table are ignored." );
584  msg << "<br><br><b>";
585  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
586  "will only accept upper case letters, digits, and the underscore characters." );
587  msg << "</b>";
588 
589  for( const auto& var: GetPredefinedEnvVars() )
590  {
591  msg << "<br><br><b>" << var << "</b>";
592 
593  const auto desc = LookUpEnvVarHelp( var );
594 
595  if( desc.size() > 0 )
596  msg << ": " << desc;
597 
598  }
599 
600  m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Environment Variable Help" ) );
601  m_helpDialog->SetDialogSizeInDU( 400, 250 );
602 
603  m_helpDialog->AddHTML_Text( msg );
605 
606  // m_helpDialog will be destroyed when closing the dialog
607 }
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
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)
Display an error message with aMessage.
Definition: confirm.cpp:265
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 '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:254
HTML_MESSAGE_BOX * m_helpDialog
void OnGridSize(wxSizeEvent &event) override
SEARCH_PATH_GRID_COLUMNS
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:52
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)
#define NULL
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.
wxString LookUpEnvVarHelp(const wxString &aEnvVar)
Look up long-form help text for a given environment variable.
Definition: env_vars.cpp:104
void OnAddSearchPath(wxCommandEvent &event) override
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:182
HTML_MESSAGE_BOX.
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
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
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:59
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
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.