21#include <wx/checkbox.h>
23#include <wx/filedlg.h>
25#include <wx/textctrl.h>
53 const wxString& aPreselect ) :
54 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ) ),
61 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
73 wxString libName = aRawValue.BeforeFirst(
':', &itemName );
80 wxString rawValue = GetValue();
82 if( rawValue.IsEmpty() )
89 if( frame->ShowModal( &symbolId,
m_dlg ) )
102 wxEvtHandler* aEventHandler )
107 wxGridCellEditor::Create( aParent, aId, aEventHandler );
115 const wxString& aSymbolNetlist,
const wxString& aPreselect ) :
116 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
117 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
126 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
147 wxString fpid = GetValue();
158 frame->KiwayMailIn( event );
161 if( frame->ShowModal( &fpid,
m_dlg ) )
189 wxEvtHandler* aEventHandler )
198 Combo()->SetValidator( *m_validator );
202 wxGridCellEditor::Create( aParent, aId, aEventHandler );
210 std::vector<EMBEDDED_FILES*> aFilesStack ) :
211 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
212 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
220 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
243 m_dlg->PrepareForModalSubDialog();
245 wxString filename = GetValue();
247 if( filename.IsEmpty() || filename == wxT(
"~" ) )
251 wxFileDialog openFileDialog(
this,
_(
"Open file" ),
"",
"",
_(
"All Files" ) + wxT(
" (*.*)|*.*" ),
252 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
254 openFileDialog.SetCustomizeHook( customize );
258 if( openFileDialog.ShowModal() == wxID_OK )
260 filename = openFileDialog.GetPath();
261 wxFileName fn( filename );
266 SetValue(
result->GetLink() );
270 SetValue(
"file://" + filename );
279 m_dlg->CleanupAfterModalSubDialog();
290 if( GetValue().IsEmpty() )
311 Combo()->SetValidator( *m_validator );
314 wxGridCellEditor::Create( aParent, aId, aEventHandler );
322 wxString* aCurrentDir,
const wxString& aFileFilter = wxEmptyString,
323 bool aNormalize =
false,
324 const wxString& aNormalizeBasePath = wxEmptyString,
325 std::function<wxString(
const wxString& )> aEmbedCallback =
nullptr ) :
326 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
327 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
339 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
343 wxString* aCurrentDir,
344 std::function<wxString(
WX_GRID*
grid,
int row )> aFileFilterFn,
345 bool aNormalize =
false,
346 const wxString& aNormalizeBasePath = wxEmptyString,
347 std::function<wxString(
const wxString& )> aEmbedCallback =
nullptr ) :
348 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
349 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
361 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
373 m_dlg->PrepareForModalSubDialog();
378 wxFileName fn = GetValue();
388 wxFileDialog dlg(
m_dlg,
_(
"Select a File" ), fn.GetPath(), fn.GetFullName(),
392 dlg.SetCustomizeHook( customize );
396 if( dlg.ShowModal() == wxID_OK )
398 wxString filePath = dlg.GetPath();
399 wxString lastPath = dlg.GetDirectory();
400 wxString relPath = wxEmptyString;
406 if( relPath.IsEmpty() )
408 m_dlg->CleanupAfterModalSubDialog();
416 lastPath =
NormalizePath( dlg.GetDirectory(), &
Pgm().GetLocalEnvVariables(),
426 if( !
m_grid->CommitPendingChanges() )
435 wxDirDialog dlg(
m_dlg,
_(
"Select Path" ), fn.GetPath(),
436 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
438 if( dlg.ShowModal() == wxID_OK )
440 wxString filePath = dlg.GetPath();
441 wxString relPath = wxEmptyString;
455 if( !
m_grid->CommitPendingChanges() )
463 m_dlg->CleanupAfterModalSubDialog();
480 wxEvtHandler* aEventHandler )
500 Combo()->SetValidator( *m_validator );
503 wxGridCellEditor::Create( aParent, aId, aEventHandler );
510 int& aRow,
int& aCol ) :
511 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
512 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
521 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
545 Combo()->SetValidator( *m_validator );
549 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.