95#include <wx/filedlg.h>
96#include <wx/hyperlink.h>
131 wxIconBundle icon_bundle;
134 icon_bundle.AddIcon( icon );
136 icon_bundle.AddIcon( icon );
138 icon_bundle.AddIcon( icon );
140 icon_bundle.AddIcon( icon );
142 icon_bundle.AddIcon( icon );
144 SetIcons( icon_bundle );
161 GetBoard()->GetDesignSettings().m_NetSettings->GetDefaultNetclass()->SetClearance( 0 );
165 GetBoard()->GetDesignSettings().m_SolderMaskExpansion = 0;
215 libWidth = cfg->m_LibWidth;
216 aui_cfg = cfg->m_AuiPanels;
232 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
233#if !defined( _WIN32 )
236 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
245 .Bottom().Layer( 6 ) );
250 .Caption(
_(
"Libraries" ) )
252 .MinSize( FromDIP( 250 ), FromDIP( 80 ) )
253 .BestSize( FromDIP( 250 ), -1 ) );
256 .Caption(
_(
"Properties" ) ).PaneBorder(
false )
257 .MinSize( FromDIP( wxSize( 240, 60 ) ) ).BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
259 .Left().Layer( 2 ) );
265 .Caption(
_(
"Appearance" ) ).PaneBorder(
false )
267 .MinSize( FromDIP( 180 ), FromDIP( 80 ) )
268 .BestSize( FromDIP( 180 ), -1 ) );
270 .Right().Layer( 3 ).Position( 2 )
271 .Caption(
_(
"Selection Filter" ) ).PaneBorder(
false )
273 .MinSize( FromDIP( 180 ), -1 )
274 .BestSize( FromDIP( 180 ), -1 ) );
288 if( aIdx >= 0 && aIdx <
static_cast<int>(
m_tabContexts.size() ) )
293 [
this](
int aIdx ) ->
bool
307 const std::vector<EDITOR_TABS_MODEL::ENTRY>& entries =
m_tabsPanel->Model().Entries();
309 if( aIdx < 0 || aIdx >=
static_cast<int>( entries.size() ) )
312 bool modified = entries[aIdx].modified;
330 m_auimgr.GetPane(
"SelectionFilter" ).dock_proportion = 0;
334 DragAcceptFiles(
true );
339 wxAuiPaneInfo& treePane =
m_auimgr.GetPane(
"Footprints" );
340 wxAuiPaneInfo& layersManager =
m_auimgr.GetPane(
"LayersManager" );
361 m_apiHandler = std::make_unique<API_HANDLER_FOOTPRINT>(
this );
445 std::vector<MSG_PANEL_ITEM> msgItems;
514 wxAuiPaneInfo& layersManager =
m_auimgr.GetPane(
"LayersManager" );
515 wxAuiPaneInfo& selectionFilter =
m_auimgr.GetPane(
"SelectionFilter" );
557 if(
id.GetLibNickname().
empty() )
633 const wxString activeKey = cfg->m_ActiveTab;
640 id.SetLibItemName( aTab.m_fpName );
652 wxLogTrace( wxT(
"KICAD_FP_TABS" ),
653 wxT(
"Dropping persisted footprint tab '%s:%s' (failed to load)" ),
654 aTab.m_lib, aTab.m_fpName );
665 if( key == activeKey )
672 loadTab( *activeTab );
681 if( libNickname.Length() && footprintName.Length() )
685 id.SetLibItemName( footprintName );
708 const auto configureStackup =
712 board.SetCopperLayerCount( cuLayers.count() );
729 enabledLayers |= aLayerSet;
750 enabledLayers.
set( layer );
758 int userLayerCount = cfg->m_DesignSettings.GetUserDefinedLayerCount();
763 if( cfg->m_DesignSettings.m_UserLayerNames.contains(
LSET::Name( user ).ToStdString() ) )
764 enabledLayers.
set( user );
768 board.SetEnabledLayers( enabledLayers );
778 const FOOTPRINT* aFootprint,
bool aIsFromBoard,
779 const std::function<
bool(
const wxString& )>& aIsLibWritable )
791 if( libName.empty() || aIsLibWritable( libName ) )
808 [
this](
const wxString& aLib )
828 msg.Printf(
_(
"Editing %s from board. Saving will update the board only." ), fp->
GetReference() );
831 const auto openLibraryCopy =
832 [
this]( wxHyperlinkEvent& aEvent )
839 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
840 button->Bind( wxEVT_COMMAND_HYPERLINK, openLibraryCopy );
842 infobar->RemoveAllButtons();
843 infobar->AddButton( button );
844 infobar->AddCloseButton();
845 infobar->ShowMessage( msg, wxICON_INFORMATION );
850 msg.Printf(
_(
"Editing footprint from read-only library %s." ),
UnescapeString( libName ) );
854 link =
_(
"Save as editable copy" );
856 const auto saveAsEditableCopy =
857 [
this]( wxHyperlinkEvent& aEvent )
866 if( loc_infobar->IsShownOnScreen() && loc_infobar->
HasCloseButton() )
873 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
874 button->Bind( wxEVT_COMMAND_HYPERLINK, saveAsEditableCopy );
876 infobar->RemoveAllButtons();
877 infobar->AddButton( button );
878 infobar->AddCloseButton();
879 infobar->ShowMessage( msg, wxICON_INFORMATION );
908 m_activeTab->SetOriginalFootprintCopy( std::unique_ptr<FOOTPRINT>( fp_copy ) );
927 const bool fromBoard = aFootprint && aFootprint->
GetLink() !=
niluuid;
929 if( !aHasTabs || !aFootprint || fromBoard || !aFootprint->
GetFPID().
IsValid() )
968 [
this](
const std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT>& aCtx )
970 return aCtx->GetBoard() == m_pcb;
980 if(
m_pcb == aBoard )
997 rs->SetDashLengthRatio(
GetBoard()->GetPlotOptions().GetDashedLineDashRatio() );
998 rs->SetGapLengthRatio(
GetBoard()->GetPlotOptions().GetDashedLineGapRatio() );
1002 wxCommandEvent e( EDA_EVT_BOARD_CHANGED );
1003 ProcessEventLocally( e );
1019 std::vector<KIID>& sel =
m_activeTab->SavedSelection();
1023 sel.push_back( item->m_Uuid );
1155 auto board = std::make_unique<BOARD>();
1157 board->GetDesignSettings().m_NetSettings->GetDefaultNetclass()->SetClearance( 0 );
1158 board->GetDesignSettings().m_SolderMaskExpansion = 0;
1159 board->SetVisibleAlls();
1169 const wxString key = lib + wxT(
":" ) +
name;
1171 if(
int existing =
m_tabsPanel->FindTab( key ); existing >= 0 )
1178 ctx->SetPreview( aAsPreview );
1185 const int reuseSlot = aAsPreview ?
m_tabsPanel->Model().PreviewIndex() : -1;
1187 if( reuseSlot >= 0 && reuseSlot <
static_cast<int>(
m_tabContexts.size() ) )
1218 std::vector<std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT>>& aContexts,
int aSlot,
1219 std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT> aNew,
1225 std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT> displaced = std::move( aContexts[aSlot] );
1226 aContexts[aSlot] = std::move( aNew );
1230 aInstallSuccessor( *displaced );
1238 if( !aBoardFootprint )
1241 const KIID sourceUuid = aBoardFootprint->
m_Uuid;
1243 const wxString reference = aBoardFootprint->
GetReference();
1246 if(
int existing =
m_tabsPanel->FindTab( key ); existing >= 0 )
1248 m_tabsPanel->AddTab( key, reference + wxS(
" " ) +
_(
"[from board]" ),
false );
1255 auto ctx = std::make_unique<FOOTPRINT_EDITOR_TAB_CONTEXT>( sourceUuid, reference, std::move(
board ) );
1257 std::map<KIID, KIID>& uuidMap = ctx->BoardFootprintUuids();
1260 const auto recordAndUpdateUuid =
1264 uuidMap[newId] = aItem->m_Uuid;
1265 aItem->SetUuid( newId );
1277 recordAndUpdateUuid( clone );
1285 recordAndUpdateUuid( aItem );
1289 ctxBoard->
Add( clone );
1306 static_cast<PCB_TEXT*
>( aItem )->KeepUpright();
1314 m_tabsPanel->AddTab( key, reference + wxS(
" " ) +
_(
"[from board]" ),
false );
1322 std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT> ctx =
1325 const wxString key = ctx->GetTabKey();
1326 const wxString label = ctx->GetDisplayName();
1352 list->m_CommandsList.clear();
1366 if( aIdx < 0 || aIdx >=
static_cast<int>(
m_tabContexts.size() ) )
1379 wxString msg = wxString::Format(
_(
"Save changes to '%s' before closing?" ),
1382 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxYES_NO | wxCANCEL | wxICON_WARNING );
1383 dlg.SetYesNoCancelLabels(
_(
"Save" ),
_(
"Discard Changes" ),
_(
"Cancel" ) );
1395 const bool activatedForSave = ( ctx !=
m_activeTab );
1397 if( activatedForSave )
1402 if( activatedForSave && activeBeforeSave )
1411 case wxID_NO:
break;
1413 case wxID_CANCEL:
return false;
1417 const bool closingActive = ( ctx ==
m_activeTab );
1419 if( !closingActive )
1431 const int newCount =
static_cast<int>(
m_tabContexts.size() ) - 1;
1432 const int successorIdx = newCount > 0 ? std::min( aIdx, newCount - 1 ) : -1;
1434 if( successorIdx >= 0 )
1438 const int preEraseSuccessor = successorIdx < aIdx ? successorIdx : successorIdx + 1;
1482 && !newLib.IsEmpty() )
1484 const wxString unsavedKey =
m_activeTab->GetTabKey();
1494 const wxString oldKey = oldLib + wxT(
":" ) + oldName;
1508 m_tabsPanel->RenameTab( oldKey, newLib + wxT(
":" ) + newName, newName );
1514 for(
const std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT>& ctx :
m_tabContexts )
1516 if( ctx.get() !=
m_activeTab && ctx->IsTransient() && ctx->IsModified() )
1527 std::vector<FOOTPRINT_EDITOR_TAB_CONTEXT*> dirty;
1529 for(
const std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT>& ctx :
m_tabContexts )
1532 if( ctx.get() !=
m_activeTab && ctx->IsTransient() && ctx->IsModified() )
1533 dirty.push_back( ctx.get() );
1542 wxString msg = wxString::Format(
_(
"Save changes to '%s' before closing?" ), ctx->GetDisplayName() );
1543 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxYES_NO | wxCANCEL | wxICON_WARNING );
1544 dlg.SetYesNoCancelLabels(
_(
"Save" ),
_(
"Discard Changes" ),
_(
"Cancel" ) );
1548 if( answer == wxID_YES )
1555 if( !
SaveFootprint( ctx->GetBoard()->GetFirstFootprint() ) )
1563 else if( answer != wxID_NO )
1584 wxCHECK( aReplacement, );
1592 std::function<bool(
int )> savedCb = std::move(
m_tabsPanel->onCloseTabRequested );
1603 m_tabsPanel->onCloseTabRequested = std::move( savedCb );
1605 wxASSERT_MSG(
m_pcb == aReplacement,
1606 wxT(
"m_pcb must alias the frame-owned replacement before contexts are freed" ) );
1608 for(
const std::unique_ptr<FOOTPRINT_EDITOR_TAB_CONTEXT>& ctx :
m_tabContexts )
1641 wxFAIL_MSG( wxT(
"Plotting not supported in Footprint Editor" ) );
1649 wxFAIL_MSG( wxT(
"Plotting not supported in Footprint Editor" ) );
1693 wxString wx_source_name = source_name;
1761 const std::vector<EDITOR_TABS_MODEL::ENTRY>& entries =
m_tabsPanel->Model().Entries();
1771 const bool preview = i < entries.size() && entries[i].preview;
1804 return &cfg->m_MagneticItems;
1816 bool hasGraphicalItem = footprint->
Pads().size() || footprint->
Zones().size();
1818 if( !hasGraphicalItem )
1825 hasGraphicalItem =
true;
1830 if( hasGraphicalItem )
1836 BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
1837 newFootprintBB.Inflate(
pcbIUScale.mmToIU( 12 ) );
1838 return newFootprintBB;
1851 wxString msg =
_(
"Save changes to '%s' before closing?" );
1876 && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
1889 wxString msg =
_(
"Save changes to '%s' before closing?" );
1935 m_auimgr.GetPane( wxT(
"LayersManager" ) ).Show(
false );
1936 m_auimgr.GetPane( wxT(
"SelectionFilter" ) ).Show(
false );
1963 bool tree_shown = tree_pane_info.IsShown();
1964 tree_pane_info.Caption(
_(
"Libraries" ) );
1967 bool lm_shown = lm_pane_info.IsShown();
1968 lm_pane_info.Caption(
_(
"Appearance" ) );
1970 sf_pane_info.Caption(
_(
"Selection Filter" ) );
1976 lm_pane_info.Show( lm_shown );
1977 tree_pane_info.Show( tree_shown );
2012 SetTitle(
_(
"Footprint Editor" ) );
2044 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"FOOTPRINT_EDIT_FRAME::SyncLibraryTree enter" ) );
2057 adapter->Sync( footprints );
2059 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"FOOTPRINT_EDIT_FRAME::SyncLibraryTree Regenerate" ) );
2063 for(
const LIB_ID& libId : expanded )
2068 if( adapter->FindItem( target ) )
2070 if( targetSelected )
2083 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"FOOTPRINT_EDIT_FRAME::SyncLibraryTree exit" ) );
2142 pcbTool->SetIsFootprintEditor(
true );
2172#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
2173#define CHECK( x ) ACTION_CONDITIONS().Check( x )
2175 auto haveFootprintCond =
2181 auto footprintTargettedCond =
2187 auto footprintSelectedInTreeCond =
2194 const auto footprintFromBoardCond =
2200 auto pcbFrameExistsCond =
2205 return ( frame !=
nullptr );
2208 auto boardFootprintExistsCond =
2214 bool canInsert = frame && editorFootprint && editorFootprint->
GetLink() ==
niluuid;
2217 if( frame && editorFootprint && editorFootprint->
GetLink() !=
niluuid )
2225 if( editorFootprint->
GetLink() == candidate->m_Uuid )
2277 auto highContrastCond =
2283 auto autoConstraintsCond = [
this](
const SELECTION& )
2291 auto boardFlippedCond = [
this](
const SELECTION& )
2296 auto libraryTreeCond =
2302 auto layerManagerCond =
2305 return m_auimgr.GetPane(
"LayersManager" ).IsShown();
2308 auto propertiesCond =
2334 const auto isArcKeepCenterMode =
2340 const auto isArcKeepEndpointMode =
2346 const auto isArcKeepRadiusMode =
2359#define CURRENT_EDIT_TOOL( action ) \
2360 mgr->SetConditions( action, ACTION_CONDITIONS().Enable( haveFootprintCond ) \
2361 .Check( cond.CurrentTool( action ) ) )
2409#undef CURRENT_EDIT_TOOL
2472 wxFileName fn(
id.GetLibItemName() );
2473 fn.SetExt( wxT(
"png" ) );
2475 wxString projectPath = wxPathOnly(
Prj().GetProjectFullName() );
2477 wxFileDialog dlg(
this,
_(
"Export View as PNG" ), projectPath, fn.GetFullName(),
2482 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
@ KEEP_ENDPOINTS_OR_START_DIRECTION
Whe editing endpoints, the other end remains in place.
@ KEEP_CENTER_ENDS_ADJUST_ANGLE
When editing endpoints, only the angle is adjusted.
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
When editing endpoints, the angle and radius are adjusted.
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
static TOOL_ACTION toggleGrid
static TOOL_ACTION unselectAll
static TOOL_ACTION revert
static TOOL_ACTION showLibraryTree
static TOOL_ACTION saveAs
static TOOL_ACTION pluginsReload
static TOOL_ACTION selectSetLasso
static TOOL_ACTION selectSetRect
Set lasso selection mode.
static TOOL_ACTION pasteSpecial
static TOOL_ACTION showDatasheet
static TOOL_ACTION pointEditorArcKeepCenter
static TOOL_ACTION ungroup
static TOOL_ACTION toggleBoundingBoxes
static TOOL_ACTION pointEditorArcKeepRadius
static TOOL_ACTION duplicate
static TOOL_ACTION highContrastMode
static TOOL_ACTION embeddedFiles
static TOOL_ACTION measureTool
static TOOL_ACTION doDelete
static TOOL_ACTION selectionTool
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION deleteTool
static TOOL_ACTION zoomTool
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION showProperties
static TOOL_ACTION gridSetOrigin
static TOOL_ACTION ddAddLibrary
static TOOL_ACTION toggleGridOverrides
static TOOL_ACTION selectAll
static TOOL_ACTION pointEditorArcKeepEndpoint
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
bool IsContentModified() const
void SetContentModified(bool aModified=true)
BASE_SET & set(size_t pos)
Container for design settings for a BOARD object.
std::map< std::string, wxString > m_UserLayerNames
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void SetUserUnits(EDA_UNITS aUnits)
Color settings are a bit different than most of the settings objects in that there can be more than o...
Handle actions that are shared between different applications.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void UpdateToolbarControlSizes()
Update the sizes of any controls in the toolbars of the frame.
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
void FinishAUIInitialization()
virtual void RecreateToolbars()
UNDO_REDO_CONTAINER m_redoList
ACTION_TOOLBAR * m_tbLeft
virtual void OnSize(wxSizeEvent &aEvent)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
ACTION_TOOLBAR * m_tbTopMain
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void setupUnits(APP_SETTINGS_BASE *aCfg)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool SaveCanvasImageToFile(const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static bool m_openGLFailureOccured
Has any failure occurred when switching to OpenGL in any EDA_DRAW_FRAME?
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual void SetScreen(BASE_SCREEN *aScreen)
virtual void UpdateMsgPanel()
Redraw the message panel.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Return the canvas type stored in the application settings.
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void ForceRefresh()
Force a redraw.
@ GAL_TYPE_OPENGL
OpenGL implementation.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void SetParentGroup(EDA_GROUP *aGroup)
virtual void SetParent(EDA_ITEM *aParent)
Specialization of the wxAuiPaneInfo class for KiCad panels.
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
The tab strip plus the single shared GAL canvas.
VIEW_SNAPSHOT & ViewSnapshot()
std::vector< KIID > & SavedSelection()
Selection saved as resolved KIIDs, restored after the view is rebuilt.
UNDO_REDO_CONTAINER & RedoList()
UNDO_REDO_CONTAINER & UndoList()
void AddLibraries(EDA_BASE_FRAME *aParent)
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FOOTPRINT_LIBRARY_ADAPTER *aLibs)
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void RegisterHandler(API_HANDLER *aHandler)
Adds a new request handler to the server.
void DeregisterHandler(API_HANDLER *aHandler)
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
bool m_axesEnabled
Crosshair drawing mode.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Module editor specific tools.
A logical library item identifier and consists of various portions much like a URI.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
bool IsValid() const
Check if this LID_ID is valid.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
void RefreshLibTree()
Refresh the tree (mainly to update highlighting and asterisking)
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
void ShowChangedLanguage()
std::vector< LIB_ID > GetExpandedLibraries() const
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
void Regenerate(bool aKeepState)
Regenerate the tree.
void SetSortMode(LIB_TREE_MODEL_ADAPTER::SORT_MODE aMode)
Save/restore the sorting mode.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & UserMask()
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Describe the page size and margins of a paper page on which to eventually print or plot.
Gather all the actions that are shared by tools.
static TOOL_ACTION drawRuleArea
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION setAnchor
static TOOL_ACTION padDisplayMode
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION showLayersManager
static TOOL_ACTION addConstraintVertical
static TOOL_ACTION drawCircle
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION exportFootprint
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION addConstraintPerpendicular
static TOOL_ACTION drawPolygon
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION padTable
static TOOL_ACTION editTextAndGraphics
static TOOL_ACTION drawLeader
static TOOL_ACTION addConstraintAngular
static TOOL_ACTION addConstraintArcAngle
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION addConstraintHorizontal
static TOOL_ACTION drawEllipse
static TOOL_ACTION ddImportFootprint
static TOOL_ACTION placeImportedGraphics
static TOOL_ACTION addConstraintCollinear
static TOOL_ACTION drawArc
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION addConstraintEqualRadius
static TOOL_ACTION addConstraintTangent
static TOOL_ACTION loadFpFromBoard
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION addConstraintFixedLength
static TOOL_ACTION footprintProperties
static TOOL_ACTION flipBoard
static TOOL_ACTION toggleAutoConstraints
Toggle authoring constraints automatically while drawing.
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION checkFootprint
static TOOL_ACTION placeBarcode
static TOOL_ACTION placePoint
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION addConstraintSymmetric
static TOOL_ACTION addConstraintFixedPosition
Ground a point, and the cluster holding it.
static TOOL_ACTION mirrorV
static TOOL_ACTION addConstraintPointOnLine
static TOOL_ACTION repairFootprint
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION addConstraintCoincident
static TOOL_ACTION drawLine
static TOOL_ACTION cleanupGraphics
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
static TOOL_ACTION addConstraintParallel
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION addConstraintFixedRadius
static TOOL_ACTION addConstraintEqualLength
static TOOL_ACTION addConstraintMidpoint
static TOOL_ACTION addConstraintConcentric
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void configureToolbars() override
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void setFPWatcher(FOOTPRINT *aFootprint)
Create or removes a watcher on the specified footprint.
PCBNEW_SETTINGS * GetPcbNewSettings() const
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
const PAGE_INFO & GetPageSettings() const override
BOX2I GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Add the given footprint to the board.
PCB_DISPLAY_OPTIONS m_displayOptions
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
The main frame for Pcbnew.
Parameters and options when plotting/printing a board.
Tool that displays edit points allowing to modify items by dragging the points.
KICAD_API_SERVER & GetApiServer()
virtual SETTINGS_MANAGER & GetSettingsManager() const
A holder to handle information on schematic or board items.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
@ PCB_FOOTPRINT_EDITOR_FP_NAME
@ PCB_FOOTPRINT_EDITOR_LIB_NICKNAME
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
RAII class that sets an value at construction and resets it to the original value at destruction.
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
T * GetAppSettings(const char *aFilename)
Return a handle to the a given settings by type.
A holder to handle a list of undo (or redo) commands.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
EDA_UNITS GetUserUnits() const
A modified version of the wxInfoBar class that allows us to:
bool HasCloseButton() const
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
static bool empty(const wxTextEntryBase *aCtrl)
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_EDIT_FRAME_NAME
a few functions useful in geometry calculations.
static const std::string KiCadFootprintLibPathExtension
static const std::string KiCadFootprintFileExtension
static wxString PngFileWildcard()
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
TAB_VISUAL_STATE ResolveTabVisualState(bool aPreview, bool aModified)
Resolve a tab's decorations from its document state flags.
bool IsUserLayer(PCB_LAYER_ID aLayerId)
Test whether a layer is a non copper and a non tech layer.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
PGM_BASE & Pgm()
The global program "get" accessor.
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
View snapshot captured on detach, restored on activate.
Visual decorations derived from document state: preview is italic, modified is bold with a leading as...
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.
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.