28#include <wx/tooltip.h>
29#include <wx/wupdlock.h>
43 wxToolTip::Enable(
true );
55 [
this]( wxCommandEvent& aEvent )
59 m_fieldsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
80 for(
const auto& field : source )
82 m_fields[field.first] = field.second;
95 if( illegalCh == 0 &&
m_textName->GetValue().Find(
'/' ) != wxNOT_FOUND )
100 wxString msg = wxString::Format(
_(
"Illegal character '%c' in name '%s'." ),
104 wxMessageDialog errdlg(
this, msg,
_(
"Error" ) );
120 [&]() -> std::pair<int, int>
129 m_fieldsGrid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
130 m_fieldsGrid->SetCellAlignment( row, 1, wxALIGN_LEFT, wxALIGN_CENTRE );
176 for(
const auto& [fieldName, fieldValue] :
m_fields )
182 m_fieldsGrid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE );
183 m_fieldsGrid->SetCellAlignment( row, 1, wxALIGN_LEFT, wxALIGN_CENTRE );
199 for(
int row = 0; row <
m_fieldsGrid->GetNumberRows(); row++ )
201 wxString fieldName =
m_fieldsGrid->GetCellValue( row, 0 ).Strip();
202 fieldName.Replace( wxT(
"\n" ), wxT(
"" ),
true );
203 fieldName.Replace( wxT(
" " ), wxT(
" " ),
true );
207 wxMessageBox(
_(
"Duplicate fields are not allowed." ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
STD_BITMAP_BUTTON * m_bpMoveUp
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Design Block Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
STD_BITMAP_BUTTON * m_bpMoveDown
STD_BITMAP_BUTTON * m_bpDelete
STD_BITMAP_BUTTON * m_bpAdd
wxTextCtrl * m_textKeywords
wxTextCtrl * m_textDescription
void OnDeleteField(wxCommandEvent &aEvent) override
DESIGN_BLOCK * m_designBlock
void OnSizeGrid(wxSizeEvent &event) override
void OnMoveFieldUp(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
void OnMoveFieldDown(wxCommandEvent &aEvent) override
void OnAddField(wxCommandEvent &aEvent) override
bool TransferDataFromGrid()
~DIALOG_DESIGN_BLOCK_PROPERTIES() override
bool TransferDataToGrid()
void AdjustGridColumns(int aWidth)
bool TransferDataFromWindow() override
DIALOG_DESIGN_BLOCK_PROPERTIES(wxWindow *aParent, DESIGN_BLOCK *aDesignBlock, bool aDisableName=false)
nlohmann::ordered_map< wxString, wxString > m_fields
void SetupStandardButtons(std::map< int, wxString > aLabels={})
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
A logical library item identifier and consists of various portions much like a URI.
static unsigned FindIllegalLibraryNameChar(const UTF8 &aLibraryName)
Looks for characters that are illegal in library nicknames.