25#include <wx/checkbox.h>
27#include <wx/filedlg.h>
29#include <wx/textctrl.h>
56 const wxString& aPreselect ) :
57 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ) ),
64 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
76 wxString libName = aRawValue.BeforeFirst(
':', &itemName );
83 wxString rawValue = GetValue();
85 if( rawValue.IsEmpty() )
92 if( frame->ShowModal( &symbolId,
m_dlg ) )
105 wxEvtHandler* aEventHandler )
110 wxGridCellEditor::Create( aParent, aId, aEventHandler );
118 const wxString& aSymbolNetlist,
const wxString& aPreselect ) :
119 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
120 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
129 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
150 wxString fpid = GetValue();
161 frame->KiwayMailIn( event );
164 if( frame->ShowModal( &fpid,
m_dlg ) )
192 wxEvtHandler* aEventHandler )
201 Combo()->SetValidator( *m_validator );
205 wxGridCellEditor::Create( aParent, aId, aEventHandler );
213 std::vector<EMBEDDED_FILES*> aFilesStack ) :
214 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
215 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
223 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
246 m_dlg->PrepareForModalSubDialog();
248 wxString filename = GetValue();
250 if( filename.IsEmpty() || filename == wxT(
"~" ) )
254 wxFileDialog openFileDialog(
this,
_(
"Open file" ),
"",
"",
_(
"All Files" ) + wxT(
" (*.*)|*.*" ),
255 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
257 openFileDialog.SetCustomizeHook( customize );
259 if( openFileDialog.ShowModal() == wxID_OK )
261 filename = openFileDialog.GetPath();
262 wxFileName fn( filename );
267 SetValue(
result->GetLink() );
271 SetValue(
"file://" + filename );
280 m_dlg->CleanupAfterModalSubDialog();
291 if( GetValue().IsEmpty() )
312 Combo()->SetValidator( *m_validator );
315 wxGridCellEditor::Create( aParent, aId, aEventHandler );
323 wxString* aCurrentDir,
const wxString& aFileFilter = wxEmptyString,
324 bool aNormalize =
false,
325 const wxString& aNormalizeBasePath = wxEmptyString,
326 std::function<wxString(
const wxString& )> aEmbedCallback =
nullptr ) :
327 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
328 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
340 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
344 wxString* aCurrentDir,
345 std::function<wxString(
WX_GRID*
grid,
int row )> aFileFilterFn,
346 bool aNormalize =
false,
347 const wxString& aNormalizeBasePath = wxEmptyString,
348 std::function<wxString(
const wxString& )> aEmbedCallback =
nullptr ) :
349 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
350 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
362 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
374 m_dlg->PrepareForModalSubDialog();
379 wxFileName fn = GetValue();
389 wxFileDialog dlg(
m_dlg,
_(
"Select a File" ), fn.GetPath(), fn.GetFullName(),
393 dlg.SetCustomizeHook( customize );
395 if( dlg.ShowModal() == wxID_OK )
397 wxString filePath = dlg.GetPath();
398 wxString lastPath = dlg.GetDirectory();
399 wxString relPath = wxEmptyString;
405 if( relPath.IsEmpty() )
407 m_dlg->CleanupAfterModalSubDialog();
415 lastPath =
NormalizePath( dlg.GetDirectory(), &
Pgm().GetLocalEnvVariables(),
425 if( !
m_grid->CommitPendingChanges() )
434 wxDirDialog dlg(
m_dlg,
_(
"Select Path" ), fn.GetPath(),
435 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
437 if( dlg.ShowModal() == wxID_OK )
439 wxString filePath = dlg.GetPath();
440 wxString relPath = wxEmptyString;
454 if( !
m_grid->CommitPendingChanges() )
462 m_dlg->CleanupAfterModalSubDialog();
479 wxEvtHandler* aEventHandler )
499 Combo()->SetValidator( *m_validator );
502 wxGridCellEditor::Create( aParent, aId, aEventHandler );
509 int& aRow,
int& aCol ) :
510 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
511 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
520 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
544 Combo()->SetValidator( *m_validator );
548 wxGridCellEditor::Create( aParent, aId, aEventHandler );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
wxString m_normalizeBasePath
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
SEARCH_STACK * m_searchStack
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::vector< EMBEDDED_FILES * > m_filesStack
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Look for files in a number of paths.
void OnButtonClick() override
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
wxString m_normalizeBasePath
std::string m_symbolNetlist
void OnButtonClick() override
bool m_buttonFpChooserLock
void DoSetPopupControl(wxComboPopup *popup) override
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aSymbolNetlist, const wxString &aPreselect)
std::function< void(int, int)> & m_function
void DoSetPopupControl(wxComboPopup *popup) override
void OnButtonClick() 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)
void OnButtonClick() override
TEXT_BUTTON_SYMBOL_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
void UpdateButtonBitmaps()
std::vector< EMBEDDED_FILES * > m_filesStack
void OnButtonClick() override
TEXT_BUTTON_URL(wxWindow *aParent, DIALOG_SHIM *aParentDlg, SEARCH_STACK *aSearchStack, std::vector< EMBEDDED_FILES * > aFilesStack)
void DoSetPopupControl(wxComboPopup *popup) override
void OnTextChange(wxCommandEvent &event)
SEARCH_STACK * m_searchStack
static void CellEditorSetMargins(wxTextEntryBase *aEntry)
A helper function to set OS-specific margins for text-based cell editors.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
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.
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.
Helper functions to substitute paths with environmental variables.
@ FRAME_FOOTPRINT_CHOOSER
PGM_BASE & Pgm()
The global program "get" accessor.
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:...
wxString result
Test unit parsing edge cases and error handling.