47 m_project( aProject ),
48 m_lastCheckedTicker( 0 ),
66 m_TextVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
74 [
this]( wxIdleEvent& aEvent )
80 wxWindow* dialog = wxGetTopLevelParent( this );
81 wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
83 if( topLevelFocus == dialog && m_lastLoaded != m_project->GetTextVars() )
102 m_TextVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
114 if(
IsOK( m_parent,
_(
"The text variables have been changed outside the Setup dialog.\n"
115 "Do you wish to reload them?" ) ) )
150 nameCellAttr->SetEditor( nameTextEditor );
151 nameCellAttr->DecRef();
162 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
168 m_errorMsg =
_(
"Variable name cannot be empty." );
177 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
181 variables[
name ] = value;
190 int row =
event.GetRow();
191 int col =
event.GetCol();
192 wxString
text =
event.GetString();
196 m_errorMsg =
_(
"Variable name cannot be empty." );
208 [&]() -> std::pair<int, int>
239 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Class PANEL_TEXT_VARIABLES_BASE.
STD_BITMAP_BUTTON * m_btnAddTextVar
STD_BITMAP_BUTTON * m_btnDeleteTextVar
std::unique_ptr< WX_GRID_AUTOSIZER > m_autoSizer
bool TransferDataToWindow() override
std::map< wxString, wxString > m_lastLoaded
void OnGridCellChanging(wxGridEvent &event)
~PANEL_TEXT_VARIABLES() override
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnRemoveTextVar(wxCommandEvent &event) override
bool TransferDataFromWindow() override
void OnAddTextVar(wxCommandEvent &event) override
void AppendTextVar(const wxString &aName, const wxString &aValue)
wxTextValidator m_nameValidator
void ImportSettingsFrom(const PROJECT *aOtherProject)
PANEL_TEXT_VARIABLES(wxWindow *aParent, PROJECT *aProject)
Container for project specific data.
int GetTextVarsTicker() const
virtual std::map< wxString, wxString > & GetTextVars() const
std::map< int, int > COL_MIN_WIDTHS
Map of column indices to minimum widths.
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
void OnAddRow(const std::function< std::pair< int, int >()> &aAdder)
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
Custom text control validator definitions.