38 _( "Select an <b>Option Choice</b> in the listbox above, and then click the <b>Append Selected Option</b> button." )
55 const wxString& aPluginType,
const wxString& aOptions,
66 m_grid->SetDefaultRowSize(
m_grid->GetDefaultRowSize() + 4 );
68 m_grid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
87 wxString item =
FROM_UTF8( it->first.c_str() );
108 m_grid->PopEventHandler(
true );
113 if( !DIALOG_SHIM::TransferDataToWindow() )
123 if( (
int) props->size() >
m_grid->GetNumberRows() )
124 m_grid->AppendRows( props->size() -
m_grid->GetNumberRows() );
128 for( STRING_UTF8_MAP::const_iterator it = props->begin(); it != props->end();
132 m_grid->SetCellValue( row, 1, it->second );
146 if( !DIALOG_SHIM::TransferDataFromWindow() )
150 const int rowCount =
m_grid->GetNumberRows();
152 for(
int row = 0; row<rowCount; ++row )
155 UTF8 value =
m_grid->GetCellValue( row, 1 ).Trim(
false ).Trim();
176 int row =
m_grid->GetNumberRows();
181 m_grid->MakeCellVisible( row, 0 );
182 m_grid->SetGridCursor( row, 0 );
189 int selected_row =
m_listbox->GetSelection();
190 if( selected_row != wxNOT_FOUND )
192 wxString option =
m_listbox->GetString( selected_row );
194 int row_count =
m_grid->GetNumberRows();
197 for( row=0; row<row_count; ++row )
199 wxString col0 =
m_grid->GetCellValue( row, 0 );
205 if( row == row_count )
208 m_grid->SetCellValue( row, 0, option );
218 if( event.IsSelection() )
220 string option =
TO_UTF8( event.GetString() );
256 int curRow =
m_grid->GetGridCursorRow();
258 m_grid->DeleteRows( curRow );
261 curRow = std::max( 0, curRow - 1 );
262 m_grid->MakeCellVisible( curRow,
m_grid->GetGridCursorCol() );
263 m_grid->SetGridCursor( curRow,
m_grid->GetGridCursorCol() );
277 int width =
m_grid->GetClientRect().GetWidth();
279 m_grid->AutoSizeColumn( 0 );
280 m_grid->SetColSize( 0, std::max( 72,
m_grid->GetColSize( 0 ) ) );
282 m_grid->SetColSize( 1, std::max( 120, width -
m_grid->GetColSize( 0 ) ) );
288 void onSize( wxSizeEvent& aEvent )
override
298 const wxString& aPluginType,
const wxString& aOptions,
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Class DIALOG_FP_PLUGIN_OPTIONS_BASE.
STD_BITMAP_BUTTON * m_delete_button
STD_BITMAP_BUTTON * m_append_button
DIALOG_FP_PLUGIN_OPTIONS is an options editor in the form of a two column name/value spreadsheet like...
void onListBoxItemSelected(wxCommandEvent &event) override
bool TransferDataToWindow() override
void onAppendRow(wxCommandEvent &) override
void onListBoxItemDoubleClicked(wxCommandEvent &event) override
void onSize(wxSizeEvent &aEvent) override
void onUpdateUI(wxUpdateUIEvent &) override
void onGridCellChange(wxGridEvent &aEvent) override
STRING_UTF8_MAP m_choices
~DIALOG_FP_PLUGIN_OPTIONS() override
DIALOG_FP_PLUGIN_OPTIONS(wxWindow *aParent, const wxString &aNickname, const wxString &aPluginType, const wxString &aOptions, wxString *aResult)
void onDeleteRow(wxCommandEvent &) override
void onAppendOption(wxCommandEvent &) override
bool TransferDataFromWindow() override
const wxString & m_callers_options
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
bool SetPage(const wxString &aSource) override
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
static PCB_FILE_T EnumFromStr(const wxString &aFileType)
Return the PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
static STRING_UTF8_MAP * ParseOptions(const std::string &aOptionsList)
Parses aOptionsList and places the result into a #PROPERTIES object which is returned.
static UTF8 FormatOptions(const STRING_UTF8_MAP *aProperties)
Returns a list of options from the aProperties parameter.
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
virtual void FootprintLibOptions(STRING_UTF8_MAP *aListToAppendTo) const
Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.
A name/value tuple with unique names and optional values.
bool Value(const char *aName, UTF8 *aFetchedValue=nullptr) const
Fetch a property by aName and returns true if that property was found, else false.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void InvokePluginOptionsEditor(wxWindow *aCaller, const wxString &aNickname, const wxString &aPluginType, const wxString &aOptions, wxString *aResult)
Function InvokePluginOptionsEditor calls DIALOG_FP_PLUGIN_OPTIONS dialog so that plugin options set c...
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.