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