25#include <wx/checkbox.h> 
   27#include <wx/filedlg.h> 
   29#include <wx/textctrl.h> 
   59    return Combo()->GetValue();
 
 
   68    wxGridCellEditor::SetSize( rect );
 
 
   82    wxTextEntry* textEntry = 
static_cast<wxTextEntry*
>( 
Combo() );
 
   88    ch = 
event.GetUnicodeKey();
 
   95        ch = 
event.GetKeyCode();
 
   96        isPrintable = ch >= WXK_SPACE && ch < WXK_START;
 
  103        textEntry->Remove( 0, 1 );
 
  109        const long pos = textEntry->GetLastPosition();
 
  110        textEntry->Remove( pos - 1, pos );
 
  116            textEntry->WriteText( 
static_cast<wxChar
>( ch ) );
 
 
  125    auto evtHandler = 
static_cast< wxGridCellEditorEvtHandler* 
>( m_control->GetEventHandler() );
 
  128    evtHandler->SetInSetFocus( 
true );
 
  130    m_value = aGrid->GetTable()->GetValue( aRow, aCol );
 
 
  139    const wxString value = 
Combo()->GetValue();
 
 
  155    aGrid->GetTable()->SetValue( aRow, aCol, 
m_value );
 
 
  166void GRID_CELL_TEXT_BUTTON::SetValidator( 
const wxValidator& validator )
 
  168    m_validator.reset( 
static_cast< wxValidator* 
>( validator.Clone() ) );
 
  177                                const wxString& aPreselect ) :
 
  178            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ) ),
 
  185        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
  197        wxString libName = aRawValue.BeforeFirst( 
':', &itemName );
 
 
  204        wxString rawValue = GetValue();
 
  206        if( rawValue.IsEmpty() )
 
  213            if( frame->ShowModal( &symbolId, 
m_dlg ) )
 
 
 
  226                                         wxEvtHandler* aEventHandler )
 
  231    wxGridCellEditor::Create( aParent, aId, aEventHandler );
 
 
  239                            const wxString& aSymbolNetlist, 
const wxString& aPreselect ) :
 
  240            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
 
  241                         wxTE_PROCESS_ENTER | wxBORDER_NONE ),
 
  250        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
  271        wxString fpid = GetValue();
 
  282                frame->KiwayMailIn( event );
 
  285            if( frame->ShowModal( &fpid, 
m_dlg ) )
 
 
 
  313                                    wxEvtHandler* aEventHandler )
 
  322        Combo()->SetValidator( *m_validator );
 
  326    wxGridCellEditor::Create( aParent, aId, aEventHandler );
 
 
  334                     std::vector<EMBEDDED_FILES*> aFilesStack ) :
 
  335            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
 
  336                         wxTE_PROCESS_ENTER | wxBORDER_NONE ),
 
  344        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
  367        m_dlg->PrepareForModalSubDialog();
 
  369        wxString filename = GetValue();
 
  371        if( filename.IsEmpty() || filename == wxT( 
"~" ) )
 
  375            wxFileDialog openFileDialog( 
this, 
_( 
"Open file" ), 
"", 
"", 
_( 
"All Files" ) + wxT( 
" (*.*)|*.*" ),
 
  376                                         wxFD_OPEN | wxFD_FILE_MUST_EXIST );
 
  378            openFileDialog.SetCustomizeHook( customize );
 
  380            if( openFileDialog.ShowModal() == wxID_OK )
 
  382                filename = openFileDialog.GetPath();
 
  383                wxFileName fn( filename );
 
  388                    SetValue( 
result->GetLink() );
 
  392                    SetValue( 
"file://" + filename );
 
  401        m_dlg->CleanupAfterModalSubDialog();
 
 
  412        if( GetValue().IsEmpty() )
 
 
 
  433        Combo()->SetValidator( *m_validator );
 
  436    wxGridCellEditor::Create( aParent, aId, aEventHandler );
 
 
  444                              wxString* aCurrentDir, 
const wxString& aFileFilter = wxEmptyString,
 
  445                              bool aNormalize = 
false,
 
  446                              const wxString& aNormalizeBasePath = wxEmptyString,
 
  447                              std::function<wxString( 
const wxString& )> aEmbedCallback = 
nullptr ) :
 
  448            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
 
  449                         wxTE_PROCESS_ENTER | wxBORDER_NONE ),
 
  461        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
  465                              wxString* aCurrentDir,
 
  466                              std::function<wxString( 
WX_GRID* 
grid, 
int row )> aFileFilterFn,
 
  467                              bool aNormalize = 
false,
 
  468                              const wxString& aNormalizeBasePath = wxEmptyString,
 
  469                              std::function<wxString( 
const wxString& )> aEmbedCallback = 
nullptr ) :
 
  470            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
 
  471                         wxTE_PROCESS_ENTER | wxBORDER_NONE ),
 
  483        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
  495        m_dlg->PrepareForModalSubDialog();
 
  500        wxFileName fn = GetValue();
 
  510            wxFileDialog dlg( 
m_dlg, 
_( 
"Select a File" ), fn.GetPath(), fn.GetFullName(),
 
  514                dlg.SetCustomizeHook( customize );
 
  516            if( dlg.ShowModal() == wxID_OK )
 
  518                wxString filePath = dlg.GetPath();
 
  519                wxString lastPath = dlg.GetDirectory();
 
  520                wxString relPath = wxEmptyString;
 
  526                    if( relPath.IsEmpty() )
 
  528                        m_dlg->CleanupAfterModalSubDialog();
 
  536                    lastPath = 
NormalizePath( dlg.GetDirectory(), &
Pgm().GetLocalEnvVariables(),
 
  546                if( !
m_grid->CommitPendingChanges() )
 
  555            wxDirDialog dlg( 
m_dlg, 
_( 
"Select Path" ), fn.GetPath(),
 
  556                             wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
 
  558            if( dlg.ShowModal() == wxID_OK )
 
  560                wxString filePath = dlg.GetPath();
 
  561                wxString relPath = wxEmptyString;
 
  575                if( !
m_grid->CommitPendingChanges() )
 
  582        m_dlg->CleanupAfterModalSubDialog();
 
 
 
  599                                    wxEvtHandler* aEventHandler )
 
  619        Combo()->SetValidator( *m_validator );
 
  622    wxGridCellEditor::Create( aParent, aId, aEventHandler );
 
 
  629                              int& aRow, 
int& aCol ) :
 
  630            wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 0, 0 ),
 
  631                         wxTE_PROCESS_ENTER | wxBORDER_NONE ),
 
  640        Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
 
 
 
  664        Combo()->SetValidator( *m_validator );
 
  668    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
 
wxString GetValue() const override
 
wxComboCtrl * Combo() const
 
void StartingKey(wxKeyEvent &event) override
 
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
 
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *aNewVal) override
 
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
 
void SetSize(const wxRect &aRect) 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.
 
static void CellEditorTransformSizeRect(wxRect &aRect)
A helper function to tweak sizes of text-based cell editors depending on OS.
 
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.