39 if( aProjectTemplateMgr )
41 m_title->SetLabel(
_(
"Project field name templates:" ) );
47 m_title->SetLabel(
_(
"Global field name templates:" ) );
66 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
73 m_grid->PopEventHandler(
true );
90 int row =
m_grid->GetNumberRows();
99 m_grid->MakeCellVisible( row, 0 );
100 m_grid->SetGridCursor( row, 0 );
109 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
111 if( selectedRows.empty() &&
m_grid->GetGridCursorRow() >= 0 )
112 selectedRows.push_back(
m_grid->GetGridCursorRow() );
114 if( selectedRows.empty() )
118 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
120 for(
int row : selectedRows )
123 m_grid->DeleteRows( row );
125 m_grid->MakeCellVisible( std::max( 0, row-1 ),
m_grid->GetGridCursorCol() );
126 m_grid->SetGridCursor( std::max( 0, row-1 ),
m_grid->GetGridCursorCol() );
138 for(
int row = 0; row <
m_grid->GetNumberRows(); ++row )
142 m_grid->SetCellValue( row, 1,
m_fields[row].m_Visible ? wxS(
"1" ) : wxS(
"0" ) );
143 m_grid->SetCellValue( row, 2,
m_fields[row].m_URL ? wxS(
"1" ) : wxS(
"0" ) );
146 m_grid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
149 m_grid->SetCellRenderer( row, 1,
new wxGridCellBoolRenderer() );
150 m_grid->SetReadOnly( row, 1 );
151 m_grid->SetCellAlignment( row, 1, wxALIGN_CENTRE, wxALIGN_CENTRE );
153 m_grid->SetCellRenderer( row, 2,
new wxGridCellBoolRenderer() );
154 m_grid->SetReadOnly( row, 2 );
155 m_grid->SetCellAlignment( row, 2, wxALIGN_CENTRE, wxALIGN_CENTRE );
169 for(
int row = 0; row <
m_grid->GetNumberRows(); ++row )
172 m_fields[row].m_Visible =
m_grid->GetCellValue( row, 1 ) == wxS(
"1" );
173 m_fields[row].m_URL =
m_grid->GetCellValue( row, 2 ) == wxS(
"1" );
189 if( !field.m_Name.IsEmpty() )
204 record.Replace( wxT(
"\n"), wxT(
""),
true );
205 record.Replace( wxT(
" "), wxT(
" "),
true );
221 aWidth -= (
m_grid->GetSize().x -
m_grid->GetClientSize().x );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Class PANEL_TEMPLATE_FIELDNAMES_BASE.
STD_BITMAP_BUTTON * m_addFieldButton
STD_BITMAP_BUTTON * m_deleteFieldButton
void OnAddButtonClick(wxCommandEvent &event) override
Adds a new template fieldname (with default values) to the template fieldnames data.
~PANEL_TEMPLATE_FIELDNAMES() override
bool TransferDataToWindow() override
TEMPLATES * m_templateMgr
TEMPLATE_FIELDNAMES m_fields
void AdjustGridColumns(int aWidth)
void ImportSettingsFrom(TEMPLATES *templateMgr)
PANEL_TEMPLATE_FIELDNAMES(wxWindow *aWindow, TEMPLATES *aProjectTemplateMgr)
TEMPLATES m_templateMgrInstance
bool TransferDataFromWindow() override
void OnSizeGrid(wxSizeEvent &event) override
void OnDeleteButtonClick(wxCommandEvent &event) override
Deletes the selected template fieldname from the template fieldnames data.
bool TransferDataToGrid()
bool TransferDataFromGrid()
void AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName, bool aGlobal)
Insert or append a wanted symbol field name into the field names template.
void AddTemplateFieldNames(const wxString &aSerializedFieldNames)
Add a serialized list of template field names.
void DeleteAllFieldNameTemplates(bool aGlobal)
Delete the entire contents.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
void Format(OUTPUTFORMATTER *out, int nestLevel, bool aGlobal) const
Serialize this object out as text into the given OUTPUTFORMATTER.
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.
This file contains miscellaneous commonly used macros and functions.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Hold a name of a symbol's field, field value, and default visibility.