26#include <wx/filedlg.h>
28#include <wx/textctrl.h>
56 return Combo()->GetValue();
65 wxGridCellEditor::SetSize( rect );
79 wxTextEntry* textEntry =
static_cast<wxTextEntry*
>(
Combo() );
85 ch =
event.GetUnicodeKey();
92 ch =
event.GetKeyCode();
93 isPrintable = ch >= WXK_SPACE && ch < WXK_START;
100 textEntry->Remove( 0, 1 );
106 const long pos = textEntry->GetLastPosition();
107 textEntry->Remove( pos - 1, pos );
113 textEntry->WriteText(
static_cast<wxChar
>( ch ) );
121 auto evtHandler =
static_cast< wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
124 evtHandler->SetInSetFocus(
true );
126 m_value = aGrid->GetTable()->GetValue( aRow, aCol );
135 const wxString value =
Combo()->GetValue();
151 aGrid->GetTable()->SetValue( aRow, aCol,
m_value );
162void GRID_CELL_TEXT_BUTTON::SetValidator(
const wxValidator& validator )
164 m_validator.reset(
static_cast< wxValidator*
>( validator.Clone() ) );
173 const wxString& aPreselect ) :
174 wxComboCtrl( aParent ),
178 SetButtonBitmaps(
KiBitmap( BITMAPS::small_library ) );
181 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
193 wxString libName = aRawValue.BeforeFirst(
':', &itemName );
200 wxString rawValue = GetValue();
202 if( rawValue.IsEmpty() )
220 wxEvtHandler* aEventHandler )
225 wxGridCellEditor::Create( aParent, aId, aEventHandler );
233 const wxString& aSymbolNetlist,
const wxString& aPreselect ) :
234 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
235 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
240 SetButtonBitmaps(
KiBitmap( BITMAPS::small_library ) );
243 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
255 wxString fpid = GetValue();
294 wxEvtHandler* aEventHandler )
303 Combo()->SetValidator( *m_validator );
307 wxGridCellEditor::Create( aParent, aId, aEventHandler );
315 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
316 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
320 SetButtonBitmaps(
KiBitmap( BITMAPS::www ) );
323 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
334 wxString filename = GetValue();
336 if( !filename.IsEmpty() && filename != wxT(
"~" ) )
346 wxEvtHandler* aEventHandler )
355 Combo()->SetValidator( *m_validator );
359 wxGridCellEditor::Create( aParent, aId, aEventHandler );
367 wxString* aCurrentDir,
const wxString& aFileFilter = wxEmptyString,
368 bool aNormalize =
false,
369 const wxString& aNormalizeBasePath = wxEmptyString ) :
370 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
371 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
379 SetButtonBitmaps(
KiBitmap( BITMAPS::small_folder ) );
382 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
386 wxString* aCurrentDir,
387 std::function<wxString(
WX_GRID*
grid,
int row )> aFileFilterFn,
388 bool aNormalize =
false,
389 const wxString& aNormalizeBasePath = wxEmptyString ) :
390 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
391 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
399 SetButtonBitmaps(
KiBitmap( BITMAPS::small_folder ) );
402 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
417 wxFileName fn = GetValue();
426 wxFileDialog dlg(
m_dlg,
_(
"Select a File" ), fn.GetPath(), fn.GetFullName(),
429 if( dlg.ShowModal() == wxID_OK )
431 wxString filePath = dlg.GetPath();
432 wxString lastPath = dlg.GetDirectory();
433 wxString relPath = wxEmptyString;
439 lastPath =
NormalizePath( dlg.GetDirectory(), &
Pgm().GetLocalEnvVariables(),
458 wxDirDialog dlg(
m_dlg,
_(
"Select Path" ), fn.GetPath(),
459 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
461 if( dlg.ShowModal() == wxID_OK )
463 wxString filePath = dlg.GetPath();
464 wxString relPath = wxEmptyString;
498 wxEvtHandler* aEventHandler )
513 Combo()->SetValidator( *m_validator );
517 wxGridCellEditor::Create( aParent, aId, aEventHandler );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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
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
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
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_EXPRESS &aEvent)
Receive KIWAY_EXPRESS 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.
Look for files in a number of paths.
void OnButtonClick() override
void DoSetPopupControl(wxComboPopup *popup) override
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
wxString m_normalizeBasePath
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)
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::string m_symbolNetlist
void OnButtonClick() override
void DoSetPopupControl(wxComboPopup *popup) override
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aSymbolNetlist, const wxString &aPreselect)
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)
TEXT_BUTTON_URL(wxWindow *aParent, DIALOG_SHIM *aParentDlg, SEARCH_STACK *aSearchStack)
void OnButtonClick() override
void DoSetPopupControl(wxComboPopup *popup) override
SEARCH_STACK * m_searchStack
static void CellEditorSetMargins(wxTextEntryBase *aEntry)
A helper function to set OS-specific margins for text-based cell editors.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
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)
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.
@ 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:...