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,
165 wxGrid*& aGrid, int& aRow ) :
166 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
167 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
168 m_dlg( aParentDlg ),
169 m_symbolNetlistProvider( aSymbolNetlistProvider ),
170 m_grid( aGrid ),
171 m_row( aRow )
172 {
173 m_buttonFpChooserLock = false;
174 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_library ) );
175
176 // win32 fix, avoids drawing the "native dropdown caret"
177 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
178 }
179
180protected:
181 void DoSetPopupControl( wxComboPopup* popup ) override
182 {
183 m_popup = nullptr;
184 }
185
186 void OnButtonClick() override
187 {
188 if( m_buttonFpChooserLock ) // The button to show the FP chooser is clicked, but
189 // a previous click is currently in progress.
190 return;
191
192 // Disable the button until we have finished processing it. Normally this is not an issue
193 // but if the footprint chooser is loading for the first time, it can be slow enough that
194 // multiple clicks will cause multiple instances of the footprint loader process to start
196
197 // pick a footprint using the footprint picker.
198 wxString fpid = GetValue();
199
200 wxString symbolNetlist;
201
203 symbolNetlist = m_symbolNetlistProvider( m_row );
204
205 if( SelectFootprintFromChooser( m_dlg, fpid, symbolNetlist ) )
206 {
207 SetValue( fpid );
208
209 // An accepted selection is a completed edit, just like the file browser below.
210 // Commit it now so cells depending on this value can refresh immediately.
211 if( WX_GRID* grid = dynamic_cast<WX_GRID*>( m_grid ) )
212 grid->CommitPendingChanges();
213 }
214
215 m_buttonFpChooserLock = false;
216 }
217
218protected:
220
221 // Lock flag to lock the button to show the FP chooser
222 // true when the button is busy, waiting all footprints loaded to
223 // avoid running more than once the FP chooser
225
226 /*
227 * Symbol netlist format:
228 * pinNumber pinName <tab> pinNumber pinName...
229 * fpFilter fpFilter...
230 */
231 std::function<wxString( int )> m_symbolNetlistProvider;
232 wxGrid*& m_grid;
233 int& m_row;
234};
235
236
237void GRID_CELL_FPID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
238 wxEvtHandler* aEventHandler )
239{
240 m_control = new TEXT_BUTTON_FP_CHOOSER( aParent, m_dlg, m_symbolNetlistProvider, m_grid, m_row );
242
243#if wxUSE_VALIDATORS
244 // validate text in textctrl, if validator is set
245 if ( m_validator )
246 {
247 Combo()->SetValidator( *m_validator );
248 }
249#endif
250
251 wxGridCellEditor::Create( aParent, aId, aEventHandler );
252}
253
254
255class TEXT_BUTTON_URL : public wxComboCtrl
256{
257public:
258 TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack,
259 const std::function<GRID_CELL_URL_EDITOR_CONTEXT( int )>& aContextProvider, int& aRow ) :
260 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
261 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
262 m_dlg( aParentDlg ),
263 m_searchStack( aSearchStack ),
264 m_contextProvider( aContextProvider ),
265 m_row( aRow )
266 {
268
269 // win32 fix, avoids drawing the "native dropdown caret"
270 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
271
272 // Bind event to handle text changes
273 Bind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this );
274 }
275
276 ~TEXT_BUTTON_URL() { Unbind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this ); }
277
278 // We don't own any of our raw pointers, so compiler's copy c'tor an operator= are OK.
279
280protected:
281 void DoSetPopupControl( wxComboPopup* popup ) override
282 {
283 m_popup = nullptr;
284 }
285
286 void OnButtonClick() override
287 {
288 m_dlg->PrepareForModalSubDialog();
289
291
293 context = m_contextProvider( m_row );
294
295 wxString filename = GetValue();
296
297 if( filename.IsEmpty() || filename == wxT( "~" ) )
298 {
300
301 wxFileDialog openFileDialog( this, _( "Open file" ), "", "", _( "All Files" ) + wxT( " (*.*)|*.*" ),
302 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
303
304 if( !context.m_embedTargets.empty() )
305 openFileDialog.SetCustomizeHook( customize );
306
308
309 if( openFileDialog.ShowModal() == wxID_OK )
310 {
311 filename = openFileDialog.GetPath();
312 wxFileName fn( filename );
313
314 if( customize.GetEmbed() && !context.m_embedTargets.empty() )
315 {
316 wxString link;
317
318 for( EMBEDDED_FILES* files : context.m_embedTargets )
319 {
320 if( !files )
321 continue;
322
323 if( EMBEDDED_FILES::EMBEDDED_FILE* result = files->AddFile( fn, false ) )
324 {
325 if( link.IsEmpty() )
326 link = result->GetLink();
327 }
328 }
329
330 if( !link.IsEmpty() )
331 SetValue( link );
332 }
333 else
334 {
335 SetValue( "file://" + filename );
336 }
337 }
338 }
339 else
340 {
341 GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Prj(), m_searchStack, context.m_filesStack );
342 }
343
344 m_dlg->CleanupAfterModalSubDialog();
345 }
346
347 void OnTextChange(wxCommandEvent& event)
348 {
350 event.Skip(); // Ensure that other handlers can process this event too
351 }
352
354 {
355 if( GetValue().IsEmpty() )
356 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
357 else
358 SetButtonBitmaps( KiBitmapBundle( BITMAPS::www ) );
359 }
360
361protected:
363 SEARCH_STACK* m_searchStack; // No ownership of pointer
364
366 int& m_row;
367};
368
369
370void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler )
371{
372 m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack, m_contextProvider, m_row );
374
375#if wxUSE_VALIDATORS
376 // validate text in textctrl, if validator is set
377 if ( m_validator )
378 Combo()->SetValidator( *m_validator );
379#endif
380
381 wxGridCellEditor::Create( aParent, aId, aEventHandler );
382}
383
384
385class TEXT_BUTTON_FILE_BROWSER : public wxComboCtrl
386{
387public:
388 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
389 wxString* aCurrentDir, const wxString& aFileFilter = wxEmptyString,
390 bool aNormalize = false,
391 const wxString& aNormalizeBasePath = wxEmptyString,
392 std::function<wxString( const wxString& )> aEmbedCallback = nullptr ) :
393 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
394 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
395 m_dlg( aParentDlg ),
396 m_grid( aGrid ),
397 m_currentDir( aCurrentDir ),
398 m_normalize( aNormalize ),
399 m_normalizeBasePath( aNormalizeBasePath ),
400 m_fileFilter( aFileFilter ),
401 m_embedCallback( std::move( aEmbedCallback ) )
402 {
403 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
404
405 // win32 fix, avoids drawing the "native dropdown caret"
406 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
407 }
408
409 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
410 wxString* aCurrentDir,
411 std::function<wxString( WX_GRID* grid, int row )> aFileFilterFn,
412 bool aNormalize = false,
413 const wxString& aNormalizeBasePath = wxEmptyString,
414 std::function<wxString( const wxString& )> aEmbedCallback = nullptr ) :
415 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
416 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
417 m_dlg( aParentDlg ),
418 m_grid( aGrid ),
419 m_currentDir( aCurrentDir ),
420 m_normalize( aNormalize ),
421 m_normalizeBasePath( aNormalizeBasePath ),
422 m_fileFilterFn( std::move( aFileFilterFn ) ),
423 m_embedCallback( std::move( aEmbedCallback ) )
424 {
425 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
426
427 // win32 fix, avoids drawing the "native dropdown caret"
428 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
429 }
430
431
432protected:
433 void DoSetPopupControl( wxComboPopup* popup ) override
434 {
435 m_popup = nullptr;
436 }
437
438 void OnButtonClick() override
439 {
440 m_dlg->PrepareForModalSubDialog();
441
442 if( m_fileFilterFn )
443 m_fileFilter = m_fileFilterFn( m_grid, m_grid->GetGridCursorRow() );
444
445 wxFileName fn = GetValue();
446
447 if( fn.GetPath().IsEmpty() && m_currentDir )
448 fn.SetPath( *m_currentDir );
449 else
450 fn.SetPath( ExpandEnvVarSubstitutions( fn.GetPath(), &m_dlg->Prj() ) );
451
452 if( !m_fileFilter.IsEmpty() )
453 {
455 wxFileDialog dlg( m_dlg, _( "Select a File" ), fn.GetPath(), fn.GetFullName(),
456 m_fileFilter, wxFD_FILE_MUST_EXIST | wxFD_OPEN );
457
458 if( m_embedCallback )
459 dlg.SetCustomizeHook( customize );
460
462
463 if( dlg.ShowModal() == wxID_OK )
464 {
465 wxString filePath = dlg.GetPath();
466 wxString lastPath = dlg.GetDirectory();
467 wxString relPath = wxEmptyString;
468
469 if( m_embedCallback && customize.GetEmbed() )
470 {
471 relPath = m_embedCallback( filePath );
472
473 if( relPath.IsEmpty() )
474 {
475 m_dlg->CleanupAfterModalSubDialog();
476 return;
477 }
478 }
479 else if( m_normalize )
480 {
481 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
483 lastPath = NormalizePath( dlg.GetDirectory(), &Pgm().GetLocalEnvVariables(),
485 }
486 else
487 {
488 relPath = filePath;
489 }
490
491 SetValue( relPath );
492
493 if( !m_grid->CommitPendingChanges() )
494 {;} // shouldn't happen, but Coverity doesn't know that
495
496 if( m_currentDir )
497 *m_currentDir = lastPath;
498 }
499 }
500 else
501 {
502 wxDirDialog dlg( m_dlg, _( "Select Path" ), fn.GetPath(),
503 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
504
505 if( dlg.ShowModal() == wxID_OK )
506 {
507 wxString filePath = dlg.GetPath();
508 wxString relPath = wxEmptyString;
509
510 if ( m_normalize )
511 {
512 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
514 }
515 else
516 {
517 relPath = filePath;
518 }
519
520 SetValue( relPath );
521
522 if( !m_grid->CommitPendingChanges() )
523 {;} // shouldn't happen, but Coverity doesn't know that
524
525 if( m_currentDir )
526 *m_currentDir = relPath;
527 }
528 }
529
530 m_dlg->CleanupAfterModalSubDialog();
531 }
532
533protected:
536 wxString* m_currentDir;
539
540 wxString m_fileFilter;
541 std::function<wxString( WX_GRID* aGrid, int aRow )> m_fileFilterFn;
542 std::function<wxString( const wxString& )> m_embedCallback;
543};
544
545
546void GRID_CELL_PATH_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
547 wxEvtHandler* aEventHandler )
548{
549 if( m_fileFilterFn )
550 {
551 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
554 }
555 else
556 {
557 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
560 }
561
563
564#if wxUSE_VALIDATORS
565 // validate text in textctrl, if validator is set
566 if ( m_validator )
567 Combo()->SetValidator( *m_validator );
568#endif
569
570 wxGridCellEditor::Create( aParent, aId, aEventHandler );
571}
572
573class TEXT_BUTTON_RUN_FUNCTION final : public wxComboCtrl
574{
575public:
576 TEXT_BUTTON_RUN_FUNCTION( wxWindow* aParent, DIALOG_SHIM* aParentDlg, std::function<void( int, int )>& aFunction,
577 int& aRow, int& aCol ) :
578 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
579 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
580 m_dlg( aParentDlg ),
581 m_function( aFunction ),
582 m_row( aRow ),
583 m_col( aCol )
584 {
585 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_refresh ) );
586
587 // win32 fix, avoids drawing the "native dropdown caret"
588 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
589 }
590
591protected:
592 void DoSetPopupControl( wxComboPopup* popup ) override { m_popup = nullptr; }
593
594 void OnButtonClick() override { m_function( m_row, m_col ); }
595
597 std::function<void( int, int )>& m_function;
598 int& m_row;
599 int& m_col;
600};
601
602
603void GRID_CELL_RUN_FUNCTION_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler )
604{
605 m_control = new TEXT_BUTTON_RUN_FUNCTION( aParent, m_dlg, m_function, m_row, m_col );
607
608#if wxUSE_VALIDATORS
609 // validate text in textctrl, if validator is set
610 if( m_validator )
611 {
612 Combo()->SetValidator( *m_validator );
613 }
614#endif
615
616 wxGridCellEditor::Create( aParent, aId, aEventHandler );
617}
618
619
620void GRID_CELL_RUN_FUNCTION_EDITOR::BeginEdit( int aRow, int aCol, wxGrid* aGrid )
621{
622 m_row = aRow;
623 m_col = aCol;
624
625 GRID_CELL_TEXT_BUTTON::BeginEdit( aRow, aCol, aGrid );
626}
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_MAIL_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
void DoSetPopupControl(wxComboPopup *popup) override
std::function< wxString(int)> m_symbolNetlistProvider
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const std::function< wxString(int)> &aSymbolNetlistProvider, wxGrid *&aGrid, int &aRow)
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:533
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.