45 m_project( aProject ),
46 m_lastCheckedTicker( 0 ),
47 m_errorRow( -1 ), m_errorCol( -1 ),
48 m_gridWidthsDirty( true )
64 m_TextVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
72 [
this]( wxIdleEvent& aEvent )
78 wxWindow* dialog = wxGetTopLevelParent( this );
79 wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
81 if( topLevelFocus == dialog && m_lastLoaded != m_project->GetTextVars() )
93 m_TextVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
105 if(
IsOK( m_parent,
_(
"The text variables have been changed outside the Setup dialog.\n"
106 "Do you wish to reload them?" ) ) )
141 nameCellAttr->SetEditor( nameTextEditor );
142 nameCellAttr->DecRef();
153 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
159 m_errorMsg =
_(
"Variable name cannot be empty." );
168 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
172 variables[
name ] = value;
181 int row =
event.GetRow();
182 int col =
event.GetCol();
183 wxString
text =
event.GetString();
187 m_errorMsg =
_(
"Variable name cannot be empty." );
215 if( curRow < 0 || m_TextVars->GetNumberRows() <= curRow )
238 int width =
m_TextVars->GetClientRect().GetWidth();
260 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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
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 OnGridSize(wxSizeEvent &event) override
void AppendTextVar(const wxString &aName, const wxString &aValue)
void OnGridCellChange(wxGridEvent &event) override
wxTextValidator m_nameValidator
PANEL_TEXT_VARIABLES(wxWindow *aParent, PROJECT *aProject)
Container for project specific data.
int GetTextVarsTicker() const
virtual std::map< wxString, wxString > & GetTextVars() const
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.