66 m_TextVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
74 [
this]( wxIdleEvent& aEvent )
80 wxWindow* dialog = wxGetTopLevelParent(
this );
81 wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
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." );
173 std::map<wxString, wxString>& variables =
m_project->GetTextVars();
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.
STD_BITMAP_BUTTON * m_btnAddTextVar
STD_BITMAP_BUTTON * m_btnDeleteTextVar
PANEL_TEXT_VARIABLES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
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.
virtual std::map< wxString, wxString > & GetTextVars() const
std::map< int, int > COL_MIN_WIDTHS
Map of column indices to minimum widths.
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.