KiCad PCB EDA Suite
Loading...
Searching...
No Matches
grid_text_button_helpers.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) 2021 CERN
5 * Copyright The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <wx/checkbox.h>
22#include <wx/combo.h>
23#include <wx/filedlg.h>
24#include <wx/dirdlg.h>
25#include <wx/textctrl.h>
26
27#include <set>
28#include <string>
29
30#include <bitmaps.h>
31#include <embedded_files.h>
32#include <kiplatform/ui.h>
33#include <kiway.h>
34#include <kiway_player.h>
35#include <kiway_mail.h>
36#include <string_utils.h>
37#include <dialog_shim.h>
38#include <common.h>
39#include <env_paths.h>
40#include <pgm_base.h>
41#include <widgets/wx_grid.h>
44#include <eda_doc.h>
45
46
47//-------- Renderer ---------------------------------------------------------------------
48// None required; just render as normal text.
49
50
51GRID_CELL_URL_EDITOR_CONTEXT MakeGridCellUrlEditorContext( const std::vector<EMBEDDED_FILES*>& aEmbedTargets,
52 const std::vector<EMBEDDED_FILES*>& aAdditionalLookupFiles )
53{
55 std::set<EMBEDDED_FILES*> filesSeen;
56
57 for( EMBEDDED_FILES* files : aEmbedTargets )
58 {
59 if( !files || !filesSeen.insert( files ).second )
60 continue;
61
62 context.m_embedTargets.push_back( files );
63 context.m_filesStack.push_back( files );
64 }
65
66 for( EMBEDDED_FILES* files : aAdditionalLookupFiles )
67 {
68 if( files && filesSeen.insert( files ).second )
69 context.m_filesStack.push_back( files );
70 }
71
72 return context;
73}
74
75
76bool SelectFootprintFromChooser( DIALOG_SHIM* aDialog, wxString& aFootprint,
77 const wxString& aSymbolNetlist )
78{
79 KIWAY_PLAYER* frame = aDialog->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, aDialog );
80
81 if( !frame )
82 return false;
83
84 if( !aSymbolNetlist.IsEmpty() )
85 {
86 std::string payload = aSymbolNetlist.ToStdString();
88 frame->KiwayMailIn( event );
89 }
90
91 bool selected = frame->ShowModal( &aFootprint, aDialog );
92 frame->Destroy();
93 return selected;
94}
95
96
97
98class TEXT_BUTTON_SYMBOL_CHOOSER : public wxComboCtrl
99{
100public:
101 TEXT_BUTTON_SYMBOL_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg,
102 const wxString& aPreselect ) :
103 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ) ),
104 m_dlg( aParentDlg ),
105 m_preselect( aPreselect )
106 {
107 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_library ) );
108
109 // win32 fix, avoids drawing the "native dropdown caret"
110 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
111 }
112
113protected:
114 void DoSetPopupControl( wxComboPopup* popup ) override
115 {
116 m_popup = nullptr;
117 }
118
119 wxString escapeLibId( const wxString& aRawValue )
120 {
121 wxString itemName;
122 wxString libName = aRawValue.BeforeFirst( ':', &itemName );
123 return EscapeString( libName, CTX_LIBID ) + ':' + EscapeString( itemName, CTX_LIBID );
124 }
125
126 void OnButtonClick() override
127 {
128 // pick a symbol using the symbol picker.
129 wxString rawValue = GetValue();
130
131 if( rawValue.IsEmpty() )
132 rawValue = m_preselect;
133
134 wxString symbolId = escapeLibId( rawValue );
135
136 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg ) )
137 {
138 if( frame->ShowModal( &symbolId, m_dlg ) )
139 SetValue( UnescapeString( symbolId ) );
140
141 frame->Destroy();
142 }
143 }
144
146 wxString m_preselect;
147};
148
149
150void GRID_CELL_SYMBOL_ID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
151 wxEvtHandler* aEventHandler )
152{
153 m_control = new TEXT_BUTTON_SYMBOL_CHOOSER( aParent, m_dlg, m_preselect );
155
156 wxGridCellEditor::Create( aParent, aId, aEventHandler );
157}
158
159
160class TEXT_BUTTON_FP_CHOOSER : public wxComboCtrl
161{
162public:
163 TEXT_BUTTON_FP_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg,
164 const std::function<wxString( int )>& aSymbolNetlistProvider, int& aRow ) :
165 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
166 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
167 m_dlg( aParentDlg ),
168 m_symbolNetlistProvider( aSymbolNetlistProvider ),
169 m_row( aRow )
170 {
171 m_buttonFpChooserLock = false;
172 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_library ) );
173
174 // win32 fix, avoids drawing the "native dropdown caret"
175 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
176 }
177
178protected:
179 void DoSetPopupControl( wxComboPopup* popup ) override
180 {
181 m_popup = nullptr;
182 }
183
184 void OnButtonClick() override
185 {
186 if( m_buttonFpChooserLock ) // The button to show the FP chooser is clicked, but
187 // a previous click is currently in progress.
188 return;
189
190 // Disable the button until we have finished processing it. Normally this is not an issue
191 // but if the footprint chooser is loading for the first time, it can be slow enough that
192 // multiple clicks will cause multiple instances of the footprint loader process to start
194
195 // pick a footprint using the footprint picker.
196 wxString fpid = GetValue();
197
198 wxString symbolNetlist;
199
201 symbolNetlist = m_symbolNetlistProvider( m_row );
202
203 if( SelectFootprintFromChooser( m_dlg, fpid, symbolNetlist ) )
204 SetValue( fpid );
205
206 m_buttonFpChooserLock = false;
207 }
208
209protected:
211
212 // Lock flag to lock the button to show the FP chooser
213 // true when the button is busy, waiting all footprints loaded to
214 // avoid running more than once the FP chooser
216
217 /*
218 * Symbol netlist format:
219 * pinNumber pinName <tab> pinNumber pinName...
220 * fpFilter fpFilter...
221 */
222 std::function<wxString( int )> m_symbolNetlistProvider;
223 int& m_row;
224};
225
226
227void GRID_CELL_FPID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
228 wxEvtHandler* aEventHandler )
229{
230 m_control = new TEXT_BUTTON_FP_CHOOSER( aParent, m_dlg, m_symbolNetlistProvider, m_row );
232
233#if wxUSE_VALIDATORS
234 // validate text in textctrl, if validator is set
235 if ( m_validator )
236 {
237 Combo()->SetValidator( *m_validator );
238 }
239#endif
240
241 wxGridCellEditor::Create( aParent, aId, aEventHandler );
242}
243
244
245class TEXT_BUTTON_URL : public wxComboCtrl
246{
247public:
248 TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack,
249 const std::function<GRID_CELL_URL_EDITOR_CONTEXT( int )>& aContextProvider, int& aRow ) :
250 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
251 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
252 m_dlg( aParentDlg ),
253 m_searchStack( aSearchStack ),
254 m_contextProvider( aContextProvider ),
255 m_row( aRow )
256 {
258
259 // win32 fix, avoids drawing the "native dropdown caret"
260 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
261
262 // Bind event to handle text changes
263 Bind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this );
264 }
265
266 ~TEXT_BUTTON_URL() { Unbind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this ); }
267
268 // We don't own any of our raw pointers, so compiler's copy c'tor an operator= are OK.
269
270protected:
271 void DoSetPopupControl( wxComboPopup* popup ) override
272 {
273 m_popup = nullptr;
274 }
275
276 void OnButtonClick() override
277 {
278 m_dlg->PrepareForModalSubDialog();
279
281
283 context = m_contextProvider( m_row );
284
285 wxString filename = GetValue();
286
287 if( filename.IsEmpty() || filename == wxT( "~" ) )
288 {
290
291 wxFileDialog openFileDialog( this, _( "Open file" ), "", "", _( "All Files" ) + wxT( " (*.*)|*.*" ),
292 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
293
294 if( !context.m_embedTargets.empty() )
295 openFileDialog.SetCustomizeHook( customize );
296
298
299 if( openFileDialog.ShowModal() == wxID_OK )
300 {
301 filename = openFileDialog.GetPath();
302 wxFileName fn( filename );
303
304 if( customize.GetEmbed() && !context.m_embedTargets.empty() )
305 {
306 wxString link;
307
308 for( EMBEDDED_FILES* files : context.m_embedTargets )
309 {
310 if( !files )
311 continue;
312
313 if( EMBEDDED_FILES::EMBEDDED_FILE* result = files->AddFile( fn, false ) )
314 {
315 if( link.IsEmpty() )
316 link = result->GetLink();
317 }
318 }
319
320 if( !link.IsEmpty() )
321 SetValue( link );
322 }
323 else
324 {
325 SetValue( "file://" + filename );
326 }
327 }
328 }
329 else
330 {
331 GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Prj(), m_searchStack, context.m_filesStack );
332 }
333
334 m_dlg->CleanupAfterModalSubDialog();
335 }
336
337 void OnTextChange(wxCommandEvent& event)
338 {
340 event.Skip(); // Ensure that other handlers can process this event too
341 }
342
344 {
345 if( GetValue().IsEmpty() )
346 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
347 else
348 SetButtonBitmaps( KiBitmapBundle( BITMAPS::www ) );
349 }
350
351protected:
353 SEARCH_STACK* m_searchStack; // No ownership of pointer
354
356 int& m_row;
357};
358
359
360void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler )
361{
362 m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack, m_contextProvider, m_row );
364
365#if wxUSE_VALIDATORS
366 // validate text in textctrl, if validator is set
367 if ( m_validator )
368 Combo()->SetValidator( *m_validator );
369#endif
370
371 wxGridCellEditor::Create( aParent, aId, aEventHandler );
372}
373
374
375class TEXT_BUTTON_FILE_BROWSER : public wxComboCtrl
376{
377public:
378 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
379 wxString* aCurrentDir, const wxString& aFileFilter = wxEmptyString,
380 bool aNormalize = false,
381 const wxString& aNormalizeBasePath = wxEmptyString,
382 std::function<wxString( const wxString& )> aEmbedCallback = nullptr ) :
383 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
384 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
385 m_dlg( aParentDlg ),
386 m_grid( aGrid ),
387 m_currentDir( aCurrentDir ),
388 m_normalize( aNormalize ),
389 m_normalizeBasePath( aNormalizeBasePath ),
390 m_fileFilter( aFileFilter ),
391 m_embedCallback( std::move( aEmbedCallback ) )
392 {
393 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
394
395 // win32 fix, avoids drawing the "native dropdown caret"
396 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
397 }
398
399 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
400 wxString* aCurrentDir,
401 std::function<wxString( WX_GRID* grid, int row )> aFileFilterFn,
402 bool aNormalize = false,
403 const wxString& aNormalizeBasePath = wxEmptyString,
404 std::function<wxString( const wxString& )> aEmbedCallback = nullptr ) :
405 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
406 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
407 m_dlg( aParentDlg ),
408 m_grid( aGrid ),
409 m_currentDir( aCurrentDir ),
410 m_normalize( aNormalize ),
411 m_normalizeBasePath( aNormalizeBasePath ),
412 m_fileFilterFn( std::move( aFileFilterFn ) ),
413 m_embedCallback( std::move( aEmbedCallback ) )
414 {
415 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
416
417 // win32 fix, avoids drawing the "native dropdown caret"
418 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
419 }
420
421
422protected:
423 void DoSetPopupControl( wxComboPopup* popup ) override
424 {
425 m_popup = nullptr;
426 }
427
428 void OnButtonClick() override
429 {
430 m_dlg->PrepareForModalSubDialog();
431
432 if( m_fileFilterFn )
433 m_fileFilter = m_fileFilterFn( m_grid, m_grid->GetGridCursorRow() );
434
435 wxFileName fn = GetValue();
436
437 if( fn.GetPath().IsEmpty() && m_currentDir )
438 fn.SetPath( *m_currentDir );
439 else
440 fn.SetPath( ExpandEnvVarSubstitutions( fn.GetPath(), &m_dlg->Prj() ) );
441
442 if( !m_fileFilter.IsEmpty() )
443 {
445 wxFileDialog dlg( m_dlg, _( "Select a File" ), fn.GetPath(), fn.GetFullName(),
446 m_fileFilter, wxFD_FILE_MUST_EXIST | wxFD_OPEN );
447
448 if( m_embedCallback )
449 dlg.SetCustomizeHook( customize );
450
452
453 if( dlg.ShowModal() == wxID_OK )
454 {
455 wxString filePath = dlg.GetPath();
456 wxString lastPath = dlg.GetDirectory();
457 wxString relPath = wxEmptyString;
458
459 if( m_embedCallback && customize.GetEmbed() )
460 {
461 relPath = m_embedCallback( filePath );
462
463 if( relPath.IsEmpty() )
464 {
465 m_dlg->CleanupAfterModalSubDialog();
466 return;
467 }
468 }
469 else if( m_normalize )
470 {
471 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
473 lastPath = NormalizePath( dlg.GetDirectory(), &Pgm().GetLocalEnvVariables(),
475 }
476 else
477 {
478 relPath = filePath;
479 }
480
481 SetValue( relPath );
482
483 if( !m_grid->CommitPendingChanges() )
484 {;} // shouldn't happen, but Coverity doesn't know that
485
486 if( m_currentDir )
487 *m_currentDir = lastPath;
488 }
489 }
490 else
491 {
492 wxDirDialog dlg( m_dlg, _( "Select Path" ), fn.GetPath(),
493 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
494
495 if( dlg.ShowModal() == wxID_OK )
496 {
497 wxString filePath = dlg.GetPath();
498 wxString relPath = wxEmptyString;
499
500 if ( m_normalize )
501 {
502 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
504 }
505 else
506 {
507 relPath = filePath;
508 }
509
510 SetValue( relPath );
511
512 if( !m_grid->CommitPendingChanges() )
513 {;} // shouldn't happen, but Coverity doesn't know that
514
515 if( m_currentDir )
516 *m_currentDir = relPath;
517 }
518 }
519
520 m_dlg->CleanupAfterModalSubDialog();
521 }
522
523protected:
526 wxString* m_currentDir;
529
530 wxString m_fileFilter;
531 std::function<wxString( WX_GRID* aGrid, int aRow )> m_fileFilterFn;
532 std::function<wxString( const wxString& )> m_embedCallback;
533};
534
535
536void GRID_CELL_PATH_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
537 wxEvtHandler* aEventHandler )
538{
539 if( m_fileFilterFn )
540 {
541 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
544 }
545 else
546 {
547 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
550 }
551
553
554#if wxUSE_VALIDATORS
555 // validate text in textctrl, if validator is set
556 if ( m_validator )
557 Combo()->SetValidator( *m_validator );
558#endif
559
560 wxGridCellEditor::Create( aParent, aId, aEventHandler );
561}
562
563class TEXT_BUTTON_RUN_FUNCTION final : public wxComboCtrl
564{
565public:
566 TEXT_BUTTON_RUN_FUNCTION( wxWindow* aParent, DIALOG_SHIM* aParentDlg, std::function<void( int, int )>& aFunction,
567 int& aRow, int& aCol ) :
568 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
569 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
570 m_dlg( aParentDlg ),
571 m_function( aFunction ),
572 m_row( aRow ),
573 m_col( aCol )
574 {
575 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_refresh ) );
576
577 // win32 fix, avoids drawing the "native dropdown caret"
578 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
579 }
580
581protected:
582 void DoSetPopupControl( wxComboPopup* popup ) override { m_popup = nullptr; }
583
584 void OnButtonClick() override { m_function( m_row, m_col ); }
585
587 std::function<void( int, int )>& m_function;
588 int& m_row;
589 int& m_col;
590};
591
592
593void GRID_CELL_RUN_FUNCTION_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler )
594{
595 m_control = new TEXT_BUTTON_RUN_FUNCTION( aParent, m_dlg, m_function, m_row, m_col );
597
598#if wxUSE_VALIDATORS
599 // validate text in textctrl, if validator is set
600 if( m_validator )
601 {
602 Combo()->SetValidator( *m_validator );
603 }
604#endif
605
606 wxGridCellEditor::Create( aParent, aId, aEventHandler );
607}
608
609
610void GRID_CELL_RUN_FUNCTION_EDITOR::BeginEdit( int aRow, int aCol, wxGrid* aGrid )
611{
612 m_row = aRow;
613 m_col = aCol;
614
615 GRID_CELL_TEXT_BUTTON::BeginEdit( aRow, aCol, aGrid );
616}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:80
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::function< wxString(int)> m_symbolNetlistProvider
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
std::function< wxString(const wxString &)> m_embedCallback
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::function< void(int, int)> m_function
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
wxComboCtrl * Combo() const
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
std::function< GRID_CELL_URL_EDITOR_CONTEXT(int)> m_contextProvider
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:34
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
virtual void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent)
Receive #KIWAY_ROUTED_EVENT messages from other players.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:388
Look for files in a number of paths.
void DoSetPopupControl(wxComboPopup *popup) override
std::function< wxString(const wxString &)> m_embedCallback
TEXT_BUTTON_FILE_BROWSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, WX_GRID *aGrid, wxString *aCurrentDir, const wxString &aFileFilter=wxEmptyString, bool aNormalize=false, const wxString &aNormalizeBasePath=wxEmptyString, std::function< wxString(const wxString &)> aEmbedCallback=nullptr)
TEXT_BUTTON_FILE_BROWSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, WX_GRID *aGrid, wxString *aCurrentDir, std::function< wxString(WX_GRID *grid, int row)> aFileFilterFn, bool aNormalize=false, const wxString &aNormalizeBasePath=wxEmptyString, std::function< wxString(const wxString &)> aEmbedCallback=nullptr)
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const std::function< wxString(int)> &aSymbolNetlistProvider, int &aRow)
void DoSetPopupControl(wxComboPopup *popup) override
std::function< wxString(int)> m_symbolNetlistProvider
std::function< void(int, int)> & m_function
void DoSetPopupControl(wxComboPopup *popup) override
TEXT_BUTTON_RUN_FUNCTION(wxWindow *aParent, DIALOG_SHIM *aParentDlg, std::function< void(int, int)> &aFunction, int &aRow, int &aCol)
void DoSetPopupControl(wxComboPopup *popup) override
wxString escapeLibId(const wxString &aRawValue)
TEXT_BUTTON_SYMBOL_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
TEXT_BUTTON_URL(wxWindow *aParent, DIALOG_SHIM *aParentDlg, SEARCH_STACK *aSearchStack, const std::function< GRID_CELL_URL_EDITOR_CONTEXT(int)> &aContextProvider, int &aRow)
std::function< GRID_CELL_URL_EDITOR_CONTEXT(int)> m_contextProvider
void DoSetPopupControl(wxComboPopup *popup) override
void OnTextChange(wxCommandEvent &event)
static void CellEditorSetMargins(wxTextEntryBase *aEntry)
A helper function to set OS-specific margins for text-based cell editors.
Definition wx_grid.cpp:75
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:776
#define _(s)
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, std::vector< EMBEDDED_FILES * > aFilesStack)
Open a document (file) with the suitable browser.
Definition eda_doc.cpp:59
This file is part of the common library.
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition env_paths.cpp:73
Helper functions to substitute paths with environmental variables.
@ FRAME_FOOTPRINT_CHOOSER
Definition frame_type.h:40
@ FRAME_SYMBOL_CHOOSER
Definition frame_type.h:33
bool SelectFootprintFromChooser(DIALOG_SHIM *aDialog, wxString &aFootprint, const wxString &aSymbolNetlist)
GRID_CELL_URL_EDITOR_CONTEXT MakeGridCellUrlEditorContext(const std::vector< EMBEDDED_FILES * > &aEmbedTargets, const std::vector< EMBEDDED_FILES * > &aAdditionalLookupFiles)
@ MAIL_SYMBOL_NETLIST
Definition mail_type.h:41
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:521
STL namespace.
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
std::vector< EMBEDDED_FILES * > m_embedTargets
std::vector< EMBEDDED_FILES * > m_filesStack
wxString result
Test unit parsing edge cases and error handling.