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2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
78 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
79 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
80 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
81 { 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
82 { 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
83 { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
84 { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
85 { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
86 { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
87 { 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
88 { 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
98 COLOR4D top_color, bottom_color, background_color;
99 bool change = aForceRebuild;
101 int requested_scale =
Pgm().GetCommonSettings()->m_Appearance.icon_scale;
142 int buttonColor = -1;
144 brush.SetStyle( wxBRUSHSTYLE_SOLID );
145 brush.SetColour( background_color.
WithAlpha(1.0).ToColour() );
146 iconDC.SetBrush( brush );
158 case 0: pen.SetColour(
ICON_WHITE.ToColour() );
break;
159 case 1: pen.SetColour(
ICON_BLACK.ToColour() );
break;
160 case 2: pen.SetColour( top_color.ToColour() );
break;
161 case 3: pen.SetColour( bottom_color.ToColour() );
break;
165 iconDC.SetPen( pen );
168 iconDC.DrawPoint( jj, ii );
174 iconDC.SelectObject( wxNullBitmap );
177 const int scale = ( requested_scale <= 0 ) ?
KiIconScale(
this ) : requested_scale;
182 wxIMAGE_QUALITY_NEAREST );
204 wxWindowUpdateLocker
dummy(
this );
218 auto layerIndicatorUpdate =
219 [
this] ( wxUpdateUIEvent& )
273 if( !
Kiface().IsSingle() )
298 #if defined(KICAD_SCRIPTING_WXPYTHON) 304 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) 305 AddActionPluginTools();
328 wxWindowUpdateLocker
dummy(
this );
337 wxDefaultPosition, wxDefaultSize,
370 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>(
false, selTool );
380 wxWindowUpdateLocker
dummy(
this );
399 if( !dimensionGroup )
401 dimensionGroup =
new ACTION_GROUP(
"group.pcbDimensions",
422 if( !microwaveGroup )
424 microwaveGroup =
new ACTION_GROUP(
"group.pcbMicrowave",
461 std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>(
false, selTool );
466 routeMenu->AppendSeparator();
470 std::unique_ptr<ACTION_MENU> zoneMenu = std::make_unique<ACTION_MENU>(
false, selTool );
475 std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>(
false, selTool );
485 wxWindowUpdateLocker
dummy(
this );
503 wxDefaultPosition, wxDefaultSize, 0,
NULL );
512 wxDefaultPosition, wxDefaultSize, 0,
NULL );
521 _(
"When routing from an existing track use its width instead " 522 "of the current width setting" ),
530 wxDefaultPosition, wxDefaultSize, 0,
NULL );
541 wxDefaultPosition, wxDefaultSize, 0,
NULL );
580 const wxChar* format;
605 if( aTrackWidthSelectBox ==
NULL )
615 aTrackWidthSelectBox->Clear();
617 aTrackWidthSelectBox->Append(
_(
"Track: use netclass width" ) );
623 msg.Printf(
_(
"Track: %s (%s)" ),
ComboBoxUnits( primaryUnit, size ),
626 aTrackWidthSelectBox->Append( msg );
631 aTrackWidthSelectBox->Append( wxT(
"---" ) );
632 aTrackWidthSelectBox->Append(
_(
"Edit Pre-defined Sizes..." ) );
644 if( aViaSizeSelectBox ==
NULL )
647 aViaSizeSelectBox->Clear();
669 aViaSizeSelectBox->Append(
_(
"Via: use netclass sizes" ) );
674 wxString msg, priStr, secStr;
677 double hole = viaDimension.
m_Drill;
692 msg.Printf(
_(
"Via: %s (%s)" ), priStr, secStr );
694 aViaSizeSelectBox->Append( msg );
699 aViaSizeSelectBox->Append( wxT(
"---" ) );
700 aViaSizeSelectBox->Append(
_(
"Edit Pre-defined Sizes..." ) );
718 if( aForceResizeToolbar )
static TOOL_ACTION drawLine
static TOOL_ACTION drawCenterDimension
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
static TOOL_ACTION unlock
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
static TOOL_ACTION selectLayerPair
static TOOL_ACTION zoomInCenter
static TOOL_ACTION pageSettings
static TOOL_ACTION drillOrigin
ACTION_TOOLBAR * m_auxiliaryToolBar
static TOOL_ACTION zoneFillAll
static TOOL_ACTION drawArc
std::vector< int > m_TrackWidthList
ACTION_TOOLBAR * m_optionsToolBar
static TOOL_ACTION microwaveCreateStubArc
static TOOL_ACTION ratsnestLineMode
static TOOL_ACTION zoomTool
static TOOL_ACTION zoneDisplayOutlines
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
static TOOL_ACTION toggleLine45degMode
Toggle 45 degree line drawing mode.
wxChoice * m_SelViaSizeBox
static TOOL_ACTION drawAlignedDimension
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
static TOOL_ACTION zoneDisplayDisable
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION millimetersUnits
static TOOL_ACTION drawPolygon
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
static TOOL_ACTION microwaveCreateLine
static TOOL_ACTION showPythonConsole
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
static TOOL_ACTION showLayersManager
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
static TOOL_ACTION updatePcbFromSchematic
Class to display a pcb layer list in a wxBitmapComboBox.
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
static TOOL_ACTION zoomFitObjects
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
ACTION_TOOLBAR * m_mainToolBar
void ReCreateHToolbar() override
static TOOL_ACTION ungroup
static TOOL_ACTION localRatsnestTool
wxChoice * m_SelTrackWidthBox
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
wxChoice * m_gridSelectBox
static TOOL_ACTION placeText
bool m_UseConnectedTrackWidth
bool IsImperialUnit(EDA_UNITS aUnit)
static TOOL_ACTION zoomOutCenter
This file contains miscellaneous commonly used macros and functions.
bool m_show_layer_manager_tools
virtual PCB_LAYER_ID GetActiveLayer() const
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void UpdateTrackWidthSelectBox(wxChoice *aTrackWidthSelectBox, bool aEdit=true)
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
static TOOL_ACTION highlightNetTool
LAYER_NUM GetLayerSelection() const
static TOOL_ACTION measureTool
A group of actions that will be displayed together on a toolbar palette.
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION importNetlist
static TOOL_ACTION toggleGrid
unsigned GetViaSizeIndex() const
static TOOL_ACTION showFootprintBrowser
static TOOL_ACTION inchesUnits
wxChoice * m_zoomSelectBox
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void ReCreateVToolbar() override
unsigned GetTrackWidthIndex() const
static TOOL_ACTION togglePolarCoords
void OnUpdateSelectAutoWidth(wxUpdateUIEvent &aEvent)
Helper dialog and control classes.
static TOOL_ACTION showRatsnest
static TOOL_ACTION drawRectangle
int SetLayerSelection(LAYER_NUM layer)
static TOOL_ACTION microwaveCreateGap
static TOOL_ACTION drawVia
static TOOL_ACTION showEeschema
static TOOL_ACTION routerWalkaroundMode
static TOOL_ACTION placeTarget
void ToggleLayersManager()
static TOOL_ACTION zoneUnfillAll
static TOOL_ACTION milsUnits
static TOOL_ACTION boardSetup
static TOOL_ACTION microwaveCreateStub
void PrepareLayerIndicator(bool aForceRebuild=false)
static TOOL_ACTION padDisplayMode
static TOOL_ACTION rotateCcw
static TOOL_ACTION drawCircle
static TOOL_ACTION viaDisplayMode
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
COLOR4D GetColor(int aLayer) const
static TOOL_ACTION microwaveCreateFunctionShape
double To_User_Unit(EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
static TOOL_ACTION placeFootprint
static TOOL_ACTION drawLeader
static TOOL_ACTION drawRuleArea
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
static TOOL_ACTION zoomRedraw
void OnUpdateSelectViaSize(wxUpdateUIEvent &aEvent)
void ReCreateOptToolbar() override
static TOOL_ACTION runDRC
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
static TOOL_ACTION gridProperties
static TOOL_ACTION deleteTool
void OnUpdateSelectTrackWidth(wxUpdateUIEvent &aEvent)
void UpdateViaSizeSelectBox(wxChoice *aViaSizeSelectBox, bool aEdit=true)
static TOOL_ACTION toggleCursorStyle
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
static TOOL_ACTION gridSetOrigin
static TOOL_ACTION routerShoveMode
static TOOL_ACTION highContrastMode
static TOOL_ACTION showFootprintEditor
static TOOL_ACTION drawZone
void ReCreateAuxiliaryToolbar() override
void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
Get the pair or units in current use.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION selectionTool
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Container for design settings for a BOARD object.
A color representation with 4 components: red, green, blue, alpha.
static TOOL_ACTION zoneDisplayEnable
ACTION_TOOLBAR * m_drawToolBar
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)