39 if( aProjectTemplateMgr )
41 m_title->SetLabel(
_(
"Project field name templates:" ) );
47 m_title->SetLabel(
_(
"Global field name templates:" ) );
62 m_grid->SetUseNativeColLabels();
68 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
75 m_grid->PopEventHandler(
true );
92 int row =
m_grid->GetNumberRows();
101 m_grid->MakeCellVisible( row, 0 );
102 m_grid->SetGridCursor( row, 0 );
111 wxArrayInt selectedRows =
m_grid->GetSelectedRows();
113 if( selectedRows.empty() &&
m_grid->GetGridCursorRow() >= 0 )
114 selectedRows.push_back(
m_grid->GetGridCursorRow() );
116 if( selectedRows.empty() )
120 selectedRows.Sort( [](
int* first,
int* second ) {
return *second - *first; } );
122 for(
int row : selectedRows )
125 m_grid->DeleteRows( row );
127 m_grid->MakeCellVisible( std::max( 0, row-1 ),
m_grid->GetGridCursorCol() );
128 m_grid->SetGridCursor( std::max( 0, row-1 ),
m_grid->GetGridCursorCol() );
140 for(
int row = 0; row <
m_grid->GetNumberRows(); ++row )
144 m_grid->SetCellValue( row, 1,
m_fields[row].m_Visible ? wxS(
"1" ) : wxS(
"0" ) );
145 m_grid->SetCellValue( row, 2,
m_fields[row].m_URL ? wxS(
"1" ) : wxS(
"0" ) );
148 m_grid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
151 m_grid->SetCellRenderer( row, 1,
new wxGridCellBoolRenderer() );
152 m_grid->SetReadOnly( row, 1 );
153 m_grid->SetCellAlignment( row, 1, wxALIGN_CENTRE, wxALIGN_CENTRE );
155 m_grid->SetCellRenderer( row, 2,
new wxGridCellBoolRenderer() );
156 m_grid->SetReadOnly( row, 2 );
157 m_grid->SetCellAlignment( row, 2, wxALIGN_CENTRE, wxALIGN_CENTRE );
171 for(
int row = 0; row <
m_grid->GetNumberRows(); ++row )
174 m_fields[row].m_Visible =
m_grid->GetCellValue( row, 1 ) == wxS(
"1" );
175 m_fields[row].m_URL =
m_grid->GetCellValue( row, 2 ) == wxS(
"1" );
191 if( !field.m_Name.IsEmpty() )
206 record.Replace( wxT(
"\n"), wxT(
""),
true );
207 record.Replace( wxT(
" "), wxT(
" "),
true );
223 aWidth -= (
m_grid->GetSize().x -
m_grid->GetClientSize().x );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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()
virtual SETTINGS_MANAGER & GetSettingsManager() const
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
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.
PGM_BASE & Pgm()
The global Program "get" accessor.
wxString From_UTF8(const char *cstring)
Hold a name of a symbol's field, field value, and default visibility.