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2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
83 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
84 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
85 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
86 { 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
87 { 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
88 { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
89 { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
90 { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
91 { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
92 { 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
93 { 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
103 COLOR4D top_color, bottom_color, background_color;
104 bool change = aForceRebuild;
106 int requested_scale =
Pgm().GetCommonSettings()->m_Appearance.icon_scale;
147 int buttonColor = -1;
149 brush.SetStyle( wxBRUSHSTYLE_SOLID );
151 iconDC.SetBrush( brush );
165 case 2: pen.SetColour( top_color.
ToColour() );
break;
166 case 3: pen.SetColour( bottom_color.
ToColour() );
break;
170 iconDC.SetPen( pen );
173 iconDC.DrawPoint( jj, ii );
179 iconDC.SelectObject( wxNullBitmap );
182 const int scale = ( requested_scale <= 0 ) ?
KiIconScale(
this ) : requested_scale;
187 wxIMAGE_QUALITY_NEAREST );
209 wxWindowUpdateLocker
dummy(
this );
219 wxAUI_TB_HORIZONTAL );
272 if( !
Kiface().IsSingle() )
283 if( SCRIPTING::IsWxAvailable() )
304 wxWindowUpdateLocker
dummy(
this );
313 wxDefaultPosition, wxDefaultSize,
362 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>(
false, selTool );
373 wxWindowUpdateLocker
dummy(
this );
392 if( !dimensionGroup )
394 dimensionGroup =
new ACTION_GROUP(
"group.pcbDimensions",
453 auto makeArcMenu = [&]()
455 std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>(
false, selTool );
465 auto makeRouteMenu = [&]()
467 std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>(
false, selTool );
473 routeMenu->AppendSeparator();
485 std::unique_ptr<ACTION_MENU> tuneMenu = std::make_unique<ACTION_MENU>(
false, selTool );
494 std::unique_ptr<ACTION_MENU> zoneMenu = std::make_unique<ACTION_MENU>(
false, selTool );
499 std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>(
false, selTool );
508 wxWindowUpdateLocker
dummy(
this );
522 auto layerIndicatorUpdate =
523 [
this] ( wxUpdateUIEvent& )
538 wxDefaultPosition, wxDefaultSize, 0,
nullptr );
542 m_SelTrackWidthBox->SetToolTip(
_(
"Select the default width for new tracks. Note that this "
543 "width can be overridden by the board minimum width, or by "
544 "the width of an existing track if the 'Use Existing Track "
545 "Width' feature is enabled." ) );
549 _(
"When routing from an existing track use its width instead "
550 "of the current width setting" ),
559 wxDefaultPosition, wxDefaultSize, 0,
nullptr );
583 wxDefaultPosition, wxDefaultSize, 0,
nullptr );
594 wxDefaultPosition, wxDefaultSize, 0,
nullptr );
634 const wxChar* format;
639 wxASSERT_MSG(
false, wxT(
"Invalid unit" ) );
658 if( aTrackWidthSelectBox ==
nullptr )
668 aTrackWidthSelectBox->Clear();
670 aTrackWidthSelectBox->Append(
_(
"Track: use netclass width" ) );
676 msg.Printf(
_(
"Track: %s (%s)" ),
ComboBoxUnits( primaryUnit, size ),
679 aTrackWidthSelectBox->Append( msg );
684 aTrackWidthSelectBox->Append( wxT(
"---" ) );
685 aTrackWidthSelectBox->Append(
_(
"Edit Pre-defined Sizes..." ) );
697 if( aViaSizeSelectBox ==
nullptr )
700 aViaSizeSelectBox->Clear();
705 EDA_UNITS secondaryUnit = EDA_UNITS::MILS;
712 secondaryUnit = EDA_UNITS::MILLIMETRES;
719 secondaryUnit = EDA_UNITS::MILS;
722 aViaSizeSelectBox->Append(
_(
"Via: use netclass sizes" ) );
727 wxString msg, priStr, secStr;
730 double hole = viaDimension.
m_Drill;
734 priStr =
ComboBoxUnits( primaryUnit, diam,
false ) + wxT(
" / " )
736 secStr =
ComboBoxUnits( secondaryUnit, diam,
false ) + wxT(
" / " )
745 msg.Printf(
_(
"Via: %s (%s)" ), priStr, secStr );
747 aViaSizeSelectBox->Append( msg );
752 aViaSizeSelectBox->Append( wxT(
"---" ) );
753 aViaSizeSelectBox->Append(
_(
"Edit Pre-defined Sizes..." ) );
771 if( aForceResizeToolbar )
779 wxAuiPaneInfo& layersManager =
m_auimgr.GetPane(
"LayersManager" );
780 wxAuiPaneInfo& selectionFilter =
m_auimgr.GetPane(
"SelectionFilter" );
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
static TOOL_ACTION gridProperties
static TOOL_ACTION updatePcbFromSchematic
static TOOL_ACTION toggleGrid
static TOOL_ACTION zoomRedraw
static TOOL_ACTION millimetersUnits
static TOOL_ACTION show3DViewer
static TOOL_ACTION zoomOutCenter
static TOOL_ACTION togglePolarCoords
static TOOL_ACTION milsUnits
static TOOL_ACTION toggleBoundingBoxes
static TOOL_ACTION pageSettings
static TOOL_ACTION inchesUnits
static TOOL_ACTION highContrastMode
static TOOL_ACTION toggleCursorStyle
static TOOL_ACTION gridOrigin
static TOOL_ACTION measureTool
static TOOL_ACTION selectionTool
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION deleteTool
static TOOL_ACTION zoomTool
static TOOL_ACTION showFootprintEditor
static TOOL_ACTION showProperties
static TOOL_ACTION zoomFitObjects
static TOOL_ACTION zoomInCenter
static TOOL_ACTION gridSetOrigin
static TOOL_ACTION showFootprintBrowser
static TOOL_ACTION toggleGridOverrides
A group of actions that will be displayed together on a toolbar palette.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
bool m_UseConnectedTrackWidth
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
unsigned GetTrackWidthIndex() const
unsigned GetViaSizeIndex() const
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
COLOR4D GetColor(int aLayer) const
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
wxChoice * m_gridSelectBox
ACTION_TOOLBAR * m_optionsToolBar
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
ACTION_TOOLBAR * m_mainToolBar
void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits) override
Get the pair or units in current use.
ACTION_TOOLBAR * m_drawToolBar
SEARCH_PANE * m_searchPane
wxChoice * m_zoomSelectBox
ACTION_TOOLBAR * m_auxiliaryToolBar
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
wxColour ToColour() const
int GetLayerSelection() const
int SetLayerSelection(int layer)
static TOOL_ACTION toggleHV45Mode
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeText
static TOOL_ACTION pointEditorArcKeepCenter
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION padDisplayMode
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
static TOOL_ACTION showRatsnest
static TOOL_ACTION zoneFillAll
static TOOL_ACTION showLayersManager
static TOOL_ACTION toggleNetHighlight
static TOOL_ACTION drawCircle
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
static TOOL_ACTION placeImage
static TOOL_ACTION routerTuneDiffPair
Activation of the Push and Shove router (diff pair tuning mode)
static TOOL_ACTION drawTextBox
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
static TOOL_ACTION routerWalkaroundMode
static TOOL_ACTION routerShoveMode
static TOOL_ACTION drawPolygon
static TOOL_ACTION zoneDisplayFilled
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION routerTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
static TOOL_ACTION viaDisplayMode
static TOOL_ACTION drawLeader
static TOOL_ACTION drillOrigin
static TOOL_ACTION routerTuneSingleTrace
Activation of the Push and Shove router (tune single line mode)
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION selectLayerPair
static TOOL_ACTION zoneDisplayTriangulated
static TOOL_ACTION ungroup
static TOOL_ACTION zoneDisplayFractured
static TOOL_ACTION drawVia
static TOOL_ACTION drawArc
static TOOL_ACTION runDRC
static TOOL_ACTION importNetlist
static TOOL_ACTION pointEditorArcKeepEndpoint
static TOOL_ACTION boardSetup
static TOOL_ACTION showEeschema
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION zoneUnfillAll
static TOOL_ACTION zoneDisplayOutline
static TOOL_ACTION ratsnestLineMode
static TOOL_ACTION mirrorV
static TOOL_ACTION unlock
static TOOL_ACTION placeFootprint
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
static TOOL_ACTION lengthTunerSettingsDialog
static TOOL_ACTION showPythonConsole
static TOOL_ACTION drawLine
static TOOL_ACTION localRatsnestTool
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION drawZone
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
APPEARANCE_CONTROLS * m_appearancePanel
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void UpdateTrackWidthSelectBox(wxChoice *aTrackWidthSelectBox, bool aEdit=true)
void OnUpdateSelectTrackWidth(wxUpdateUIEvent &aEvent)
void ReCreateHToolbar() override
void ReCreateVToolbar() override
void UpdateViaSizeSelectBox(wxChoice *aViaSizeSelectBox, bool aEdit=true)
LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
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...
bool m_show_layer_manager_tools
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
void PrepareLayerIndicator(bool aForceRebuild=false)
void ReCreateOptToolbar() override
void ReCreateAuxiliaryToolbar() override
void OnUpdateSelectAutoWidth(wxUpdateUIEvent &aEvent)
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
void OnUpdateSelectViaSize(wxUpdateUIEvent &aEvent)
void ToggleLayersManager()
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
wxChoice * m_SelViaSizeBox
static const wxString SearchPaneName()
wxChoice * m_SelTrackWidthBox
void AddActionPluginTools()
Append action plugin buttons to main toolbar.
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
@ LAYER_PCB_BACKGROUND
PCB background color.
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
KICOMMON_API bool IsImperialUnit(EDA_UNITS aUnit)
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
@ ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
@ ID_TOOLBARH_PCB_SELECT_LAYER
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
int GetUserUnits()
Return the currently selected user unit value for the interface.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
std::vector< FAB_LAYER_COLOR > dummy
int search_panel_dock_direction
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.