47 m_errorRow( -1 ), m_errorCol( -1 )
63 m_TextVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
71 [
this]( wxIdleEvent& aEvent )
77 wxWindow* dialog = wxGetTopLevelParent( this );
78 wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
80 if( topLevelFocus == dialog && m_lastLoaded != m_project->GetTextVars() )
99 m_TextVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
111 if(
IsOK( m_parent,
_(
"The text variables have been changed outside the Setup dialog.\n"
112 "Do you wish to reload them?" ) ) )
147 nameCellAttr->SetEditor( nameTextEditor );
148 nameCellAttr->DecRef();
159 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
165 m_errorMsg =
_(
"Variable name cannot be empty." );
174 for(
int row = 0; row <
m_TextVars->GetNumberRows(); ++row )
178 variables[
name ] = value;
187 int row =
event.GetRow();
188 int col =
event.GetCol();
189 wxString
text =
event.GetString();
193 m_errorMsg =
_(
"Variable name cannot be empty." );
221 if( curRow < 0 || m_TextVars->GetNumberRows() <= curRow )
245 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
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 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.