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 <confirm.h>
28 #include <menus_helpers.h>
29 #include <validators.h>
31 #include <filename_resolver.h>
32 #include <env_vars.h>
33 #include <grid_tricks.h>
34 #include <widgets/wx_grid.h>
36 
37 #include <algorithm>
38 #include <wx/dirdlg.h>
39 
41 {
45 };
46 
48 {
52 };
53 
54 
56  DIALOG_CONFIGURE_PATHS_BASE( aParent ),
57  m_errorGrid( nullptr ),
58  m_errorRow( -1 ),
59  m_errorCol( -1 ),
60  m_resolver( aResolver ),
61  m_gridWidth( 0 ),
62  m_gridWidthsDirty( true ),
63  m_helpDialog( nullptr )
64 {
65  m_btnAddEnvVar->SetBitmap( KiBitmap( small_plus_xpm ) );
69  m_btnMoveUp->SetBitmap( KiBitmap( small_up_xpm ) );
70  m_btnMoveDown->SetBitmap( KiBitmap( small_down_xpm ) );
71 
72  m_EnvVars->DeleteRows( 0, m_EnvVars->GetNumberRows() );
73  m_EnvVars->AppendCols( 1 ); // for the isExternal flags
74  m_EnvVars->HideCol( TV_FLAG_COL );
75  m_EnvVars->UseNativeColHeader( true );
76 
77  wxGridCellAttr* attr = new wxGridCellAttr;
78  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir, wxEmptyString ) );
79  m_EnvVars->SetColAttr( TV_VALUE_COL, attr );
80 
81  attr = new wxGridCellAttr;
82  attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, &m_curdir, wxEmptyString ) );
83  m_SearchPaths->SetColAttr( TV_VALUE_COL, attr );
84 
85  // Give a bit more room for combobox editors
86  m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
87  m_SearchPaths->SetDefaultRowSize( m_SearchPaths->GetDefaultRowSize() + 4 );
88 
89  m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars ) );
90  m_SearchPaths->PushEventHandler( new GRID_TRICKS( m_SearchPaths ) );
91 
92  m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
93  m_SearchPaths->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
94 
95  if( m_resolver )
96  {
97  m_SearchPaths->DeleteRows( 0, m_SearchPaths->GetNumberRows() );
98  m_SearchPaths->UseNativeColHeader( true );
99 
100  // prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
101  m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
102  m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
103  }
104  else
105  m_sb3DSearchPaths->Show( false );
106 
108  m_sdbSizerOK->SetDefault();
109 
110  // wxFormBuilder doesn't include this event...
111  m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
112  m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
113 
114  GetSizer()->SetSizeHints( this );
115  Centre();
116 }
117 
118 
120 {
121  // Delete the GRID_TRICKS.
122  m_SearchPaths->PopEventHandler( true );
123  m_EnvVars->PopEventHandler( true );
124 
125  if( m_helpDialog )
126  m_helpDialog->Destroy();
127 
128  m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
129  m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
130 }
131 
132 
134 {
135  if( !wxDialog::TransferDataToWindow() )
136  return false;
137 
138  // Do 3D search paths first so they get first crack at setting m_curdir
139 
140  if( m_resolver )
141  {
142  const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
143 
144  for( auto it = paths->begin(); it != paths->end(); ++it )
145  {
146  if ( !( *it ).m_Alias.StartsWith( "${" ) && !( *it ).m_Alias.StartsWith( "$(" ) )
147  {
148  AppendSearchPath( it->m_Alias, it->m_Pathvar, it->m_Description );
149 
150  if( m_curdir.IsEmpty() )
151  m_curdir = it->m_Pathexp;
152  }
153  }
154  }
155 
156  // Environment variables
157 
158  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
159 
160  for( auto it = envVars.begin(); it != envVars.end(); ++it )
161  {
162  const wxString& path = it->second.GetValue();
163  AppendEnvVar( it->first, path, it->second.GetDefinedExternally() );
164 
165  if( m_curdir.IsEmpty() && !path.StartsWith( "${" ) && !path.StartsWith( "$(" ) )
166  m_curdir = path;
167  }
168 
169  return true;
170 }
171 
172 
173 void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString& aPath,
174  bool isExternal )
175 {
176  int i = m_EnvVars->GetNumberRows();
177 
178  m_EnvVars->AppendRows( 1 );
179 
180  m_EnvVars->SetCellValue( i, TV_NAME_COL, aName );
181 
182  wxGridCellAttr* nameCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_NAME_COL );
183  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
184  nameTextEditor->SetValidator( ENV_VAR_NAME_VALIDATOR() );
185  nameCellAttr->SetEditor( nameTextEditor );
186  nameCellAttr->SetReadOnly( IsEnvVarImmutable( aName ) );
187  nameCellAttr->DecRef();
188 
189  m_EnvVars->SetCellValue( i, TV_VALUE_COL, aPath );
190 
191  wxGridCellAttr* pathCellAttr = m_EnvVars->GetOrCreateCellAttr( i, TV_VALUE_COL );
192  wxSystemColour c = isExternal ? wxSYS_COLOUR_MENU : wxSYS_COLOUR_LISTBOX;
193  pathCellAttr->SetBackgroundColour( wxSystemSettings::GetColour( c ) );
194  pathCellAttr->DecRef();
195 
196  m_EnvVars->SetCellValue( i, TV_FLAG_COL, isExternal ? wxT( "external" ) : wxEmptyString );
197 }
198 
199 
200 void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
201  const wxString& aDescription )
202 {
203  int i = m_SearchPaths->GetNumberRows();
204 
205  m_SearchPaths->AppendRows( 1 );
206 
207  m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
208 
209  wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
210  wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
211  nameTextEditor->SetValidator( m_aliasValidator );
212  nameCellAttr->SetEditor( nameTextEditor );
213  nameCellAttr->DecRef();
214 
215  m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
216  m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
217 }
218 
219 
221 {
223  return false;
224 
225  if( !wxDialog::TransferDataFromWindow() )
226  return false;
227 
228  // Environment variables
229 
230  ENV_VAR_MAP envVarMap;
231 
232  for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
233  {
234  wxString name = m_EnvVars->GetCellValue( row, TV_NAME_COL );
235  wxString path = m_EnvVars->GetCellValue( row, TV_VALUE_COL );
236  wxString external = m_EnvVars->GetCellValue( row, TV_FLAG_COL );
237  ENV_VAR_ITEM var( path );
238 
239  if( external.Length() )
240  {
241  // Don't check for consistency on external variables, just use them as-is
242  var.SetDefinedExternally( true );
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  envVarMap[ name ] = var;
262  }
263 
264  Pgm().SetLocalEnvVariables( envVarMap );
265 
266  // 3D search paths
267 
268  if( m_resolver )
269  {
270  std::vector<SEARCH_PATH> alist;
271  SEARCH_PATH alias;
272 
273  for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
274  {
275  alias.m_Alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
276  alias.m_Pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
277  alias.m_Description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
278 
279  if( alias.m_Alias.IsEmpty() )
280  {
282  m_errorRow = row;
284  m_errorMsg = _( "3D search path alias cannot be empty." );
285  return false;
286  }
287  else if( alias.m_Pathvar.IsEmpty() )
288  {
290  m_errorRow = row;
292  m_errorMsg = _( "3D search path cannot be empty." );
293  return false;
294  }
295 
296  alist.push_back( alias );
297  }
298 
299  if( !m_resolver->UpdatePathList( alist ) )
300  return false;
301  }
302 
303  return true;
304 }
305 
306 
308 {
309  wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
310  int row = event.GetRow();
311  int col = event.GetCol();
312  wxString text = event.GetString();
313 
314  if( text.IsEmpty() )
315  {
316  if( grid == m_EnvVars )
317  {
318  if( col == TV_NAME_COL )
319  m_errorMsg = _( "Environment variable name cannot be empty." );
320  else
321  m_errorMsg = _( "Environment variable path cannot be empty." );
322  }
323  else
324  {
325  if( col == SP_ALIAS_COL )
326  m_errorMsg = _( "3D search path alias cannot be empty." );
327  else
328  m_errorMsg = _( "3D search path cannot be empty." );
329  }
330  m_errorGrid = dynamic_cast<wxGrid*>( event.GetEventObject() );
331  m_errorRow = row;
332  m_errorCol = col;
333 
334  event.Veto();
335  }
336 
337  if( grid == m_EnvVars )
338  {
339  if( col == TV_VALUE_COL && m_EnvVars->GetCellValue( row, TV_FLAG_COL ).Length() )
340  {
341  wxString msg1 = _( "This path was defined externally to the running process and\n"
342  "will only be temporarily overwritten." );
343  wxString msg2 = _( "The next time KiCad is launched, any paths that have already\n"
344  "been defined are honored and any settings defined in the path\n"
345  "configuration dialog are ignored. If you did not intend for\n"
346  "this behavior, either rename any conflicting entries or remove\n"
347  "the external environment variable(s) from your system." );
348  KIDIALOG dlg( this, msg1, KIDIALOG::KD_WARNING );
349  dlg.ShowDetailedText( msg2 );
350  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
351  dlg.ShowModal();
352  }
353  else if( col == TV_NAME_COL && m_EnvVars->GetCellValue( row, TV_NAME_COL ) != text )
354  {
355  if( text == PROJECT_VAR_NAME ) // This env var name is reserved and cannot be added here:
356  {
357  wxMessageBox( wxString::Format(
358  _( "The name %s is reserved, and cannot be used here" ),
359  PROJECT_VAR_NAME ) );
360  event.Veto();
361  }
362  else // Changing name; clear external flag
363  m_EnvVars->SetCellValue( row, TV_FLAG_COL, wxEmptyString );
364  }
365  }
366 }
367 
368 
369 void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
370 {
372  return;
373 
374  AppendEnvVar( wxEmptyString, wxEmptyString, false );
375 
376  m_EnvVars->MakeCellVisible( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
377  m_EnvVars->SetGridCursor( m_EnvVars->GetNumberRows() - 1, TV_NAME_COL );
378 
379  m_EnvVars->EnableCellEditControl( true );
380  m_EnvVars->ShowCellEditControl();
381 }
382 
383 
384 void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
385 {
387  return;
388 
389  AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
390 
391  m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
392  m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
393 
394  m_SearchPaths->EnableCellEditControl( true );
395  m_SearchPaths->ShowCellEditControl();
396 }
397 
398 
399 void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
400 {
401  int curRow = m_EnvVars->GetGridCursorRow();
402 
403  if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
404  return;
405  else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, TV_NAME_COL ) ) )
406  {
407  wxBell();
408  return;
409  }
410 
411  m_EnvVars->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
412  m_EnvVars->DeleteRows( curRow, 1 );
413 
414  m_EnvVars->MakeCellVisible( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
415  m_EnvVars->SetGridCursor( std::max( 0, curRow-1 ), m_EnvVars->GetGridCursorCol() );
416 }
417 
418 
419 void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
420 {
421  int curRow = m_SearchPaths->GetGridCursorRow();
422 
423  if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
424  return;
425 
426  m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
427  m_SearchPaths->DeleteRows( curRow, 1 );
428 
429  // if there are still rows in grid, make previous row visible
430  if( m_SearchPaths->GetNumberRows() )
431  {
432  m_SearchPaths->MakeCellVisible( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
433  m_SearchPaths->SetGridCursor( std::max( 0, curRow-1 ), m_SearchPaths->GetGridCursorCol() );
434  }
435 }
436 
437 
438 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
439 {
441  return;
442 
443  int curRow = m_SearchPaths->GetGridCursorRow();
444  int prevRow = curRow - 1;
445 
446  if( curRow > 0 )
447  {
448  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
449  {
450  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
451  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
452  m_SearchPaths->SetCellValue( prevRow, i, tmp );
453  }
454 
455  m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
456  }
457  else
458  wxBell();
459 }
460 
461 
462 void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
463 {
465  return;
466 
467  int curRow = m_SearchPaths->GetGridCursorRow();
468  int nextRow = curRow + 1;
469 
470  if( curRow < m_SearchPaths->GetNumberRows() - 1 )
471  {
472  for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
473  {
474  wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
475  m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
476  m_SearchPaths->SetCellValue( nextRow, i, tmp );
477  }
478 
479  m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
480  }
481  else
482  wxBell();
483 }
484 
485 
487 {
488  wxASSERT((int) TV_VALUE_COL == (int) SP_PATH_COL );
489 
490  if( aEvent.GetCol() == TV_VALUE_COL )
491  {
492  wxMenu menu;
493 
494  AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( small_folder_xpm ) );
495  if( GetPopupMenuSelectionFromUser( menu ) == 1 )
496  {
497  wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
498  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
499 
500  if( dlg.ShowModal() == wxID_OK )
501  {
502  wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
503  grid->SetCellValue( aEvent.GetRow(), TV_VALUE_COL, dlg.GetPath() );
504  m_curdir = dlg.GetPath();
505  }
506  }
507  }
508 }
509 
510 
511 void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
512 {
513  if( m_gridWidthsDirty )
514  {
515  int width = m_EnvVars->GetClientRect().GetWidth();
516 
517  m_EnvVars->AutoSizeColumn( TV_NAME_COL );
518  m_EnvVars->SetColSize( TV_NAME_COL, std::max( m_EnvVars->GetColSize( TV_NAME_COL ), 120 ) );
519 
520  m_EnvVars->SetColSize( TV_VALUE_COL, width - m_EnvVars->GetColSize( TV_NAME_COL ) );
521 
522  width = m_SearchPaths->GetClientRect().GetWidth();
523 
524  m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
525  m_SearchPaths->SetColSize( SP_ALIAS_COL, std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
526 
527  m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
528  m_SearchPaths->SetColSize( SP_PATH_COL, std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
529 
530  m_SearchPaths->SetColSize( SP_DESC_COL, width - ( m_SearchPaths->GetColSize( SP_ALIAS_COL )
531  + m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
532  m_gridWidth = m_EnvVars->GetSize().GetX();
533  m_gridWidthsDirty = false;
534  }
535 
536  // Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
537  // even when the original validation was triggered from a killFocus event (and for
538  // dialog with notebooks, so that the corresponding notebook page can be shown in
539  // the background when triggered from an OK).
540  if( m_errorGrid )
541  {
542  // We will re-enter this routine when the error dialog is displayed, so make
543  // sure we don't keep putting up more dialogs.
544  wxGrid* grid = m_errorGrid;
545  m_errorGrid = nullptr;
546 
548 
549  grid->SetFocus();
550  grid->MakeCellVisible( m_errorRow, m_errorCol );
551  grid->SetGridCursor( m_errorRow, m_errorCol );
552 
553  grid->EnableCellEditControl( true );
554  grid->ShowCellEditControl();
555  }
556 }
557 
558 
559 void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
560 {
561  if( event.GetSize().GetX() != m_gridWidth )
562  m_gridWidthsDirty = true;
563 
564  event.Skip();
565 }
566 
567 
568 void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
569 {
570  if( m_helpDialog )
571  {
573  return;
574  }
575 
576  wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
577  "are names that have been defined externally at the system or user "
578  "level. Environment variables defined at the system or user level "
579  "take precedence over the ones defined in this table. This means the "
580  "values in this table are ignored." );
581  msg << "<br><br><b>";
582  msg << _( "To ensure environment variable names are valid on all platforms, the name field "
583  "will only accept upper case letters, digits, and the underscore characters." );
584  msg << "</b>";
585 
586  for( const auto& var: GetPredefinedEnvVars() )
587  {
588  msg << "<br><br><b>" << var << "</b>";
589 
590  const auto desc = LookUpEnvVarHelp( var );
591 
592  if( desc.size() > 0 )
593  msg << ": " << desc;
594 
595  }
596 
597  m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Environment Variable Help" ) );
598  m_helpDialog->SetDialogSizeInDU( 400, 250 );
599 
600  m_helpDialog->AddHTML_Text( msg );
602 
603  // m_helpDialog will be destroyed when closing the dialog
604 }
void OnSearchPathMoveDown(wxCommandEvent &event) override
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox
Definition: confirm.cpp:56
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:266
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:44
This file is part of the common library.
const BITMAP_OPAQUE small_folder_xpm[1]
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:221
HTML_MESSAGE_BOX * m_helpDialog
void OnGridSize(wxSizeEvent &event) override
SEARCH_PATH_GRID_COLUMNS
A simple helper class to store environment variable values and the status of whether or not they were...
Definition: pgm_base.h:84
#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:51
const std::list< SEARCH_PATH > * GetPaths(void)
Return a pointer to the internal path list; the items in:load.
void OnGridCellChanging(wxGridEvent &event)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:98
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
Class DIALOG_CONFIGURE_PATHS_BASE.
bool UpdatePathList(std::vector< SEARCH_PATH > &aPathList)
Clear the current path list and substitutes the given path list and update the path configuration fil...
void AppendEnvVar(const wxString &aName, const wxString &aPath, bool isExternal)
#define NULL
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:113
FILENAME_RESOLVER * m_resolver
void OnUpdateUI(wxUpdateUIEvent &event) override
void SetDefinedExternally(bool aIsDefinedExternally)
Definition: pgm_base.h:96
const BITMAP_OPAQUE small_down_xpm[1]
Definition: small_down.cpp:23
wxString m_Description
wxString m_Pathvar
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.
const BITMAP_OPAQUE small_up_xpm[1]
Definition: small_up.cpp:23
const BITMAP_OPAQUE small_trash_xpm[1]
Definition: small_trash.cpp:23
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
Provide an extensible class to resolve 3D model paths.
const char * name
Definition: DXF_plotter.cpp:59
void OnHelp(wxCommandEvent &event) override
#define _(s)
Definition: 3d_actions.cpp:33
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:100
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)
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:18
Custom text control validator definitions.