25#include <wx/textdlg.h>
44 m_unitsProvider( aUnitsProvider ),
46 m_frameType( aFrameType ),
47 m_eventSource( aEventSource )
114 wxString savedGrid1 =
m_grid1Ctrl->GetStringSelection();
115 wxString savedGrid2 =
m_grid2Ctrl->GetStringSelection();
135 if( !
name.IsEmpty() )
138 msg.Printf(
_(
"%s%s (%s)" ),
name,
grid.MessageText(
scale, primaryUnit,
true ),
139 grid.MessageText(
scale, secondaryUnit,
true ) );
158 if( !
m_grid1Ctrl->SetStringSelection( savedGrid1 ) )
161 if( !
m_grid2Ctrl->SetStringSelection( savedGrid2 ) )
202 return RESETTABLE_PANEL::TransferDataFromWindow();
211 auto safeGrid = [&gridCfg](
int idx ) ->
int
213 if( idx < 0 || idx >= (
int) gridCfg.
grids.size() )
238 return RESETTABLE_PANEL::TransferDataToWindow();
244 GRID newGrid =
GRID{ wxEmptyString,
"",
"" };
248 if( dlg.ShowModal() != wxID_OK )
258 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
261 wxString::Format(
_(
"Grid size '%s' already exists." ),
267 gridCfg.
grids.insert( gridCfg.
grids.begin() + row, newGrid );
278 if( gridCfg.
grids.size() <= 1 )
280 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
283 wxString::Format(
_(
"At least one grid size is required." ) ) );
287 gridCfg.
grids.erase( gridCfg.
grids.begin() + row );
300 if( gridCfg.
grids.size() <= 1 || row == 0 )
303 std::swap( gridCfg.
grids[row], gridCfg.
grids[row - 1] );
316 if( gridCfg.
grids.size() <= 1 || row == ( (
int) gridCfg.
grids.size() - 1 ) )
319 std::swap( gridCfg.
grids[row], gridCfg.
grids[row + 1] );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
static TOOL_ACTION gridFast1
static TOOL_ACTION gridFast2
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
const std::vector< GRID > DefaultGridSizeList() const
Class PANEL_GRID_SETTINGS_BASE.
STD_BITMAP_BUTTON * m_removeGridButton
wxStaticLine * m_staticline3
wxCheckBox * m_checkGridOverrideConnected
wxCheckBox * m_checkGridOverrideText
wxChoice * m_gridOverrideConnectedChoice
wxCheckBox * m_checkGridOverrideGraphics
wxChoice * m_gridOverrideWiresChoice
STD_BITMAP_BUTTON * m_moveDownButton
wxStaticText * m_overridesLabel
wxChoice * m_gridOverrideTextChoice
wxCheckBox * m_checkGridOverrideVias
wxStaticText * m_grid2HotKey
wxStaticText * m_grid1HotKey
wxListBox * m_currentGridCtrl
wxChoice * m_gridOverrideGraphicsChoice
wxChoice * m_gridOverrideViasChoice
wxCheckBox * m_checkGridOverrideWires
STD_BITMAP_BUTTON * m_addGridButton
STD_BITMAP_BUTTON * m_moveUpButton
void ResetPanel() override
Reset the contents of this panel.
bool TransferDataToWindow() override
void OnRemoveGrid(wxCommandEvent &event) override
void OnMoveGridDown(wxCommandEvent &event) override
bool TransferDataFromWindow() override
APP_SETTINGS_BASE * m_cfg
void OnMoveGridUp(wxCommandEvent &event) override
PANEL_GRID_SETTINGS(wxWindow *aParent, UNITS_PROVIDER *aUnitsProvider, wxWindow *aEventSource, APP_SETTINGS_BASE *aCfg, FRAME_T aFrameType)
This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME.
UNITS_PROVIDER * m_unitsProvider
void OnAddGrid(wxCommandEvent &event) override
const EDA_IU_SCALE & GetIuScale() const
virtual void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
@ FRAME_SCH_SYMBOL_EDITOR
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
int override_connected_idx
std::vector< GRID > grids
int override_graphics_idx
Common grid settings, available to every frame.
wxString UserUnitsMessageText(UNITS_PROVIDER *aProvider, bool aDisplayUnits=true) const
Returns a string representation of the grid in the user's units.