86#include <wx/filedlg.h>
92using namespace std::placeholders;
98using ZonePriorityMap = std::map<unsigned, std::vector<ZONE*>>;
101std::vector<ZONE*> getOverlappingZones(
BOARD* aBoard,
ZONE* aZone )
103 std::vector<ZONE*> overlapping;
108 if( candidate == aZone )
111 if( candidate->GetIsRuleArea() || candidate->IsTeardropArea() )
114 if( !( candidate->GetLayerSet() & aZone->
GetLayerSet() ).any() )
117 if( !candidate->GetBoundingBox().Intersects( bbox ) )
124 if( aOutline.
Collide( &candidateOutline )
128 overlapping.push_back( candidate );
136ZonePriorityMap buildPriorityMap(
BOARD* aBoard,
ZONE* aExclude )
138 ZonePriorityMap byPriority;
142 if( z == aExclude || z->GetIsRuleArea() || z->IsTeardropArea() )
145 byPriority[z->GetAssignedPriority()].push_back( z );
164std::vector<ZONE*> findCascadeZones(
const ZonePriorityMap& aByPriority,
165 unsigned aFromPriority,
bool aCascadeUp,
168 std::vector<ZONE*>
result;
169 unsigned p = aFromPriority;
172 for(
auto it = aByPriority.find( p ); it != aByPriority.end();
173 it = aByPriority.find( p ) )
175 for(
ZONE* z : it->second )
235 bool canRaise =
false;
236 bool canLower =
false;
238 if( selection.
Size() == 1 )
240 ZONE* zone =
dynamic_cast<ZONE*
>( selection[0] );
245 std::vector<ZONE*> overlapping = getOverlappingZones( board, zone );
247 for(
ZONE* other : overlapping )
386 auto activeToolCondition =
389 return ( !
m_frame->ToolStackIsEmpty() );
392 auto inactiveStateCondition =
395 return (
m_frame->ToolStackIsEmpty() && aSel.Size() == 0 );
398 auto placeModuleCondition =
404 auto& ctxMenu =
m_menu->GetMenu();
408 ctxMenu.AddSeparator( 1 );
412 ctxMenu.AddSeparator( 1000 );
417 std::shared_ptr<ZONE_CONTEXT_MENU> zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
418 zoneMenu->SetTool(
this );
420 std::shared_ptr<LOCK_CONTEXT_MENU> lockMenu = std::make_shared<LOCK_CONTEXT_MENU>(
this );
454 auto toolActiveFunctor =
476 const wxString title =
_(
"Export for Older KiCad Version" );
479 if(
m_frame->IsContentModified() )
481 int answer = wxMessageBox(
_(
"You have unsaved changes. Save them before exporting?" ), title,
482 wxYES_NO | wxCANCEL | wxICON_WARNING,
m_frame );
484 if( answer == wxCANCEL )
487 if( answer == wxYES && !
m_frame->SaveBoard() )
489 wxMessageBox(
_(
"The board was not saved. Nothing was exported." ), title, wxOK | wxICON_ERROR,
m_frame );
494 const wxString
board =
m_frame->GetBoard()->GetFileName();
530 m_frame->SaveBoard(
true,
true );
537 m_frame->ExportFootprintsToLibrary(
false );
558 m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally(
565 text->ClearRenderCache();
566 text->ClearBoundingBoxCache();
653 m_frame->ShowFindByPropertiesDialog();
681 wxString fullFileName =
frame()->GetBoard()->GetFileName();
686 wxFileName::SplitPath( fullFileName, &
path, &
name, &ext );
689 fullFileName = wxFileSelector(
_(
"Specctra Session File" ),
path,
name,
694 if( !fullFileName.IsEmpty() )
706 if( fullFileName.IsEmpty() )
708 fn =
m_frame->GetBoard()->GetFileName();
716 fullFileName = wxFileSelector(
_(
"Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
718 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR,
frame() );
720 if( !fullFileName.IsEmpty() )
734 wxFileName fn =
m_frame->Prj().GetProjectFullName();
738 fn.SetExt( wxT(
"pcb_net" ) );
740 wxFileDialog dlg(
m_frame,
_(
"Export Board Netlist" ), fn.GetPath(), fn.GetFullName(),
742 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
748 if( dlg.ShowModal() == wxID_CANCEL )
753 if( !fn.IsDirWritable() )
770 { footprint->m_Uuid } );
774 const wxString& netname =
pad->GetShortNetname();
776 if( !netname.IsEmpty() )
777 component->
AddNet(
pad->GetNumber(), netname,
pad->GetPinFunction(),
pad->GetPinType() );
780 nlohmann::ordered_map<wxString, wxString> fields;
784 wxCHECK2( field,
continue );
786 fields[field->GetUntranslatedName()] = field->GetText();
791 netlist.AddComponent( component );
804 fn.GetFullPath(), ioe.
What() ) );
817 m_frame->SetPlotSettings( plotSettings );
836 errors += duplicates;
837 details += wxString::Format(
_(
"%d duplicate IDs replaced.\n" ), duplicates );
854 details += wxString::Format(
_(
"Orphaned net %s re-parented.\n" ),
874 details += wxString::Format(
_(
"Orphaned net %s re-parented.\n" ),
893 wxString msg = wxString::Format(
_(
"%d potential problems repaired." ), errors );
910 bool fetched =
false;
915 fetched =
m_frame->FetchNetlistFromSchematic(
916 netlist,
_(
"Updating PCB requires a fully annotated schematic." ) );
933 "stand-alone mode. In order to create or update PCBs "
934 "from schematics, you must launch the KiCad project "
935 "manager and create a project." ) );
948 if( wxWindow* blocking_win =
frame->Kiway().GetBlockingDialog() )
949 blocking_win->Close(
true );
962 wxFileName schematic(
project.GetProjectPath(),
project.GetProjectName(),
965 if( !schematic.FileExists() )
967 wxFileName legacySchematic(
project.GetProjectPath(),
project.GetProjectName(),
970 if( legacySchematic.FileExists() )
972 schematic = legacySchematic;
976 msg.Printf(
_(
"Schematic file '%s' not found." ), schematic.GetFullPath() );
1004 wxEventBlocker blocker( boardFrame );
1011 if( !
frame->IsShownOnScreen() )
1014 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
1015 frame->Show(
true );
1020 if(
frame->IsIconized() )
1022 frame->Iconize(
false );
1026 frame->Maximize(
false );
1092 if(
m_frame->ToolStackIsEmpty()
1099 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1110 if( candidate > track->
GetWidth() )
1120 commit.
Push(
_(
"Increase Track Width" ) );
1162 if(
m_frame->ToolStackIsEmpty()
1169 if( item->IsType( { PCB_TRACE_T, PCB_ARC_T } ) )
1180 if( candidate < track->GetWidth() )
1190 commit.
Push(
_(
"Decrease Track Width" ) );
1232 if(
m_frame->ToolStackIsEmpty()
1235 int complexPadstacks = 0;
1236 int incremented = 0;
1271 if( incremented == 0 && complexPadstacks > 0 )
1273 m_frame->ShowInfoBarError( wxString::Format(
_(
"%s not supported on complex padstacks." ),
1298 if(
m_frame->ToolStackIsEmpty()
1301 int complexPadstacks = 0;
1302 int decremented = 0;
1337 if( decremented == 0 && complexPadstacks > 0 )
1339 m_frame->ShowInfoBarError( wxString::Format(
_(
"%s not supported on complex padstacks." ),
1389 bool fromOtherCommand = fp !=
nullptr;
1416 if( fromOtherCommand )
1439 bool ignorePrimePosition =
false;
1440 bool reselect =
false;
1442 auto applyPlacementFrameOrientation =
1451 prevFrameAngle = newAngle;
1453 if( !
delta.IsZero() )
1466 applyPlacementFrameOrientation();
1477 ignorePrimePosition =
true;
1484 cursorPos =
controls->GetCursorPosition( !evt->DisableGridSnapping() );
1486 if( reselect && fp )
1489 if( evt->IsCancelInteractive() || ( fp && evt->IsAction( &
ACTIONS::undo ) ) )
1496 else if( evt->IsActivate() )
1501 if( evt->IsMoveTool() )
1504 m_frame->PushTool( originalEvent );
1509 else if( evt->IsClick(
BUT_LEFT ) )
1514 fp =
m_frame->SelectFootprintFromLibrary();
1522 if( evt->IsPrime() && !ignorePrimePosition )
1524 cursorPos = evt->Position();
1541 board->UpdateUserUnits( fp,
m_frame->GetCanvas()->GetView() );
1545 pad->SetLocalRatsnestVisible(
m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1548 pad->SetNetCode( 0 );
1559 applyPlacementFrameOrientation();
1569 commit.
Push(
_(
"Place Footprint" ) );
1581 applyPlacementFrameOrientation();
1598 evt->SetPassEvent();
1602 controls->SetAutoPan( fp !=
nullptr );
1603 controls->CaptureCursor( fp !=
nullptr );
1645 const bool isHover =
selection.IsHover();
1654 if( !item->IsBOARD_ITEM() )
1657 if(
static_cast<BOARD_ITEM*
>( item )->IsLocked() )
1667 if( !item->IsBOARD_ITEM() )
1685 commit.
Modify( generator );
1694 commit.
Modify( board_item );
1712 if( !commit.
Empty() )
1728 std::vector<ZONE*>& aOriginZones, std::vector<ZONE*>& aMergedZones )
1730 aCommit.
Modify( aOriginZones[0] );
1732 aOriginZones[0]->Outline()->ClearArcs();
1734 for(
unsigned int i = 1; i < aOriginZones.size(); i++ )
1736 SHAPE_POLY_SET otherOutline = aOriginZones[i]->Outline()->CloneDropTriangulation();
1738 aOriginZones[0]->Outline()->BooleanAdd( otherOutline );
1741 aOriginZones[0]->Outline()->Simplify();
1746 if( aOriginZones[0]->Outline()->IsSelfIntersecting() || aOriginZones[0]->Outline()->OutlineCount() > 1 )
1755 unsigned highestPriority = aOriginZones[0]->GetAssignedPriority();
1757 for(
unsigned int i = 1; i < aOriginZones.size(); i++ )
1759 highestPriority = std::max( highestPriority, aOriginZones[i]->GetAssignedPriority() );
1760 aCommit.
Remove( aOriginZones[i] );
1763 aOriginZones[0]->SetAssignedPriority( highestPriority );
1765 aMergedZones.push_back( aOriginZones[0] );
1767 aOriginZones[0]->SetLocalFlags( 1 );
1768 aOriginZones[0]->HatchBorder();
1769 aOriginZones[0]->CacheTriangulation();
1786 ZONE* firstZone =
nullptr;
1787 std::vector<ZONE*> toMerge, merged;
1791 ZONE* curr_area =
dynamic_cast<ZONE*
>( item );
1797 firstZone = curr_area;
1803 wxLogMessage(
_(
"Some zone netcodes did not match and were not merged." ) );
1809 wxLogMessage(
_(
"Some zones were rule areas and were not merged." ) );
1815 wxLogMessage(
_(
"Some zone layer sets did not match and were not merged." ) );
1819 bool intersects = curr_area == firstZone;
1821 for(
ZONE* candidate : toMerge )
1826 if(
board->TestZoneIntersection( curr_area, candidate ) )
1832 wxLogMessage(
_(
"Some zones did not intersect and were not merged." ) );
1836 toMerge.push_back( curr_area );
1841 if( !toMerge.empty() )
1845 commit.
Push(
_(
"Merge Zones" ) );
1872 zoneSettings << *oldZone;
1882 if( dialogResult != wxID_OK )
1888 std::unique_ptr<ZONE> newZone = std::make_unique<ZONE>( *oldZone );
1889 newZone->ClearSelected();
1893 if( !newZone->GetZoneName().IsEmpty() )
1894 newZone->SetZoneName(
board()->GetUniqueZoneName( newZone->GetZoneName() ) );
1901 commit.
Add( newZone.release() );
1902 commit.
Push(
_(
"Duplicate Zone" ) );
1920 std::vector<ZONE*> overlapping = getOverlappingZones(
board(), zone );
1924 for(
ZONE* other : overlapping )
1925 maxOverlapping = std::max( maxOverlapping, other->GetAssignedPriority() );
1932 ZonePriorityMap byPriority = buildPriorityMap(
board(), zone );
1935 bool cascadeDownViable =
false;
1936 std::vector<ZONE*> cascadeDown =
1937 findCascadeZones( byPriority, maxOverlapping,
false, cascadeDownViable );
1940 bool cascadeUpViable =
false;
1941 std::vector<ZONE*> cascadeUp;
1942 bool canCascadeUp = ( maxOverlapping < UINT_MAX );
1945 cascadeUp = findCascadeZones( byPriority, maxOverlapping + 1,
true, cascadeUpViable );
1947 if( !cascadeDownViable && !cascadeUpViable )
1953 bool useDown = cascadeDownViable
1954 && ( !cascadeUpViable || cascadeDown.size() <= cascadeUp.size() );
1960 for(
ZONE* z : cascadeDown )
1971 for(
ZONE* z : cascadeUp )
1980 commit.
Push(
_(
"Move Zone to Top Priority" ) );
1998 std::vector<ZONE*> overlapping = getOverlappingZones(
board(), zone );
2001 ZONE* target =
nullptr;
2004 for(
ZONE* other : overlapping )
2006 if( other->GetAssignedPriority() > zonePriority )
2034 commit.
Push(
_(
"Raise Zone Priority" ) );
2052 std::vector<ZONE*> overlapping = getOverlappingZones(
board(), zone );
2055 ZONE* target =
nullptr;
2058 for(
ZONE* other : overlapping )
2060 if( other->GetAssignedPriority() < zonePriority )
2088 commit.
Push(
_(
"Lower Zone Priority" ) );
2106 std::vector<ZONE*> overlapping = getOverlappingZones(
board(), zone );
2110 for(
ZONE* other : overlapping )
2111 minOverlapping = std::min( minOverlapping, other->GetAssignedPriority() );
2118 ZonePriorityMap byPriority = buildPriorityMap(
board(), zone );
2121 bool cascadeUpViable =
false;
2122 std::vector<ZONE*> cascadeUp =
2123 findCascadeZones( byPriority, minOverlapping,
true, cascadeUpViable );
2126 bool cascadeDownViable =
false;
2127 std::vector<ZONE*> cascadeDown;
2128 bool canCascadeDown = ( minOverlapping > 0 );
2130 if( canCascadeDown )
2133 findCascadeZones( byPriority, minOverlapping - 1,
false, cascadeDownViable );
2136 if( !cascadeUpViable && !cascadeDownViable )
2142 bool useUp = cascadeUpViable
2143 && ( !cascadeDownViable || cascadeUp.size() <= cascadeDown.size() );
2149 for(
ZONE* z : cascadeUp )
2160 for(
ZONE* z : cascadeDown )
2169 commit.
Push(
_(
"Move Zone to Bottom Priority" ) );
2177 m_frame->GetBoard()->OnBoardSelectionChanged();
2193 if(
m_frame->m_ProbingSchToPcb )
2201 focusItem =
selection.GetLastAddedItem();
2206 m_frame->Update3DView(
false,
frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
2218 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2221 aCollector.
Remove( aCollector[ i ] );
2230 std::set<wxString> netNames;
2231 std::set<int> netCodes;
2244 if( netNames.empty() )
2246 m_frame->ShowInfoBarError(
_(
"Selection contains no items with labeled nets." ) );
2251 for(
const int& code : netCodes )
2258 [
this](
const std::vector<wxString>& aNetNames )
2263 for(
const wxString& curr_netName : aNetNames )
2267 if( curr_netCode > 0 )
2275 if( dlg.ShowModal() == wxID_OK )
2296 tableTool->EditTable( aEvent );
2317 fp_editor->Show(
true );
2364 [
this] (
const VECTOR2D& pt ) ->
bool
constexpr EDA_IU_SCALE pcbIUScale
static bool mergeZones(EDA_DRAW_FRAME *aFrame, BOARD_COMMIT &aCommit, std::vector< ZONE * > &aOriginZones, std::vector< ZONE * > &aMergedZones)
static TOOL_ACTION updatePcbFromSchematic
static TOOL_ACTION cancelInteractive
static TOOL_ACTION revert
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION saveAs
static TOOL_ACTION exportForOlderVersion
static TOOL_ACTION pickerTool
static TOOL_ACTION findPrevious
static TOOL_ACTION findNext
static TOOL_ACTION pageSettings
static TOOL_ACTION showSearch
static TOOL_ACTION showGitCommitPane
static TOOL_ACTION updateSchematicFromPcb
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION showProperties
static TOOL_ACTION saveCopy
static TOOL_ACTION refreshPreview
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
void Revert() override
Revert the commit by restoring the modified items state.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
NETINFO_ITEM * GetNet() const
Return NETINFO_ITEM object for a given item.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
std::shared_ptr< NET_SETTINGS > m_NetSettings
int GetNextDiffPairIndex(int aIndex, bool aForward) const
Compute the next diff pair dimensions list index when cycling predefined sizes, skipping the index-0 ...
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
bool m_UseConnectedTrackWidth
int GetTrackWidthIndex() const
int GetViaSizeIndex() const
int GetDiffPairIndex() const
void SetDiffPairIndex(int aIndex)
bool m_TempOverrideTrackWidth
int GetNextTrackWidthIndex(int aIndex, bool aForward) const
Compute the next track width list index when cycling predefined sizes, skipping the index-0 netclass ...
void SetAuxOrigin(const VECTOR2I &aOrigin)
void SetTrackWidthIndex(int aIndex)
Set the current track width list index to aIndex.
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
int GetNextViaSizeIndex(int aIndex, bool aForward) const
Compute the next via size list index when cycling predefined sizes, skipping the index-0 netclass pla...
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int ExportNetlist(const TOOL_EVENT &aEvent)
int UnlockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
int Save(const TOOL_EVENT &aEvent)
int ImportNetlist(const TOOL_EVENT &aEvent)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
int ZoneMerge(const TOOL_EVENT &aEvent)
int CrossProbeToSch(const TOOL_EVENT &aEvent)
Notify Eeschema about selected items.
int ZonePriorityMoveToTop(const TOOL_EVENT &aEvent)
int GenBOMFileFromBoard(const TOOL_EVENT &aEvent)
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
Low-level access (below undo) to setting the drill origin.
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
int ShowEeschema(const TOOL_EVENT &aEvent)
int ExportFootprints(const TOOL_EVENT &aEvent)
int SaveAs(const TOOL_EVENT &aEvent)
int AssignNetclass(const TOOL_EVENT &aEvent)
Assign a netclass to a labelled net.
int ToggleNetInspector(const TOOL_EVENT &aEvent)
int UpdateSchematicFromPCB(const TOOL_EVENT &aEvent)
int ZonePriorityRaise(const TOOL_EVENT &aEvent)
int ExplicitCrossProbeToSch(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
int ExportHyperlynx(const TOOL_EVENT &aEvent)
int ToggleSearch(const TOOL_EVENT &aEvent)
int DrillOrigin(const TOOL_EVENT &aEvent)
Run the drill origin tool for setting the origin for drill and pick-and-place files.
MODIFY_MODE
How to modify a property for selected items.
int ViaSizeDec(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int RepairBoard(const TOOL_EVENT &aEvent)
int ZoneDuplicate(const TOOL_EVENT &aEvent)
Duplicate a zone onto a layer (prompts for new layer)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
int GenerateBOM(const TOOL_EVENT &aEvent)
int ToggleGitCommitPane(const TOOL_EVENT &aEvent)
int PlaceFootprint(const TOOL_EVENT &aEvent)
Display a dialog to select a footprint to be added and allows the user to set its position.
int BoardSetup(const TOOL_EVENT &aEvent)
int ZonePriorityLower(const TOOL_EVENT &aEvent)
int modifyLockSelected(MODIFY_MODE aMode)
void setTransitions() override
Set up handlers for various events.
int TrackWidthInc(const TOOL_EVENT &aEvent)
int GenerateODBPPFiles(const TOOL_EVENT &aEvent)
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Toggle 'lock' property for selected items.
int ToggleConstraintsPanel(const TOOL_EVENT &aEvent)
int AutoTrackWidth(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
int PageSettings(const TOOL_EVENT &aEvent)
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
int FindByProperties(const TOOL_EVENT &aEvent)
int EditFootprintFields(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
int ToggleLibraryTree(const TOOL_EVENT &aEvent)
int ExportGenCAD(const TOOL_EVENT &aEvent)
Export GenCAD 1.4 format.
int ViaSizeInc(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
int OnAngleSnapModeChanged(const TOOL_EVENT &aEvent)
int ExportCmpFile(const TOOL_EVENT &aEvent)
int Find(const TOOL_EVENT &aEvent)
int DesignRules(const TOOL_EVENT &aEvent)
int GenFootprintsReport(const TOOL_EVENT &aEvent)
int ExportForOlderVersion(const TOOL_EVENT &aEvent)
void doCrossProbePcbToSch(const TOOL_EVENT &aEvent, bool aForce)
int GenD356File(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
int ExportIDF(const TOOL_EVENT &aEvent)
int TrackWidthDec(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int Search(const TOOL_EVENT &aEvent)
int GenIPC2581File(const TOOL_EVENT &aEvent)
int ExportVRML(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int SaveCopy(const TOOL_EVENT &aEvent)
int ChangeLineMode(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
int ZonePriorityMoveToBottom(const TOOL_EVENT &aEvent)
int GenerateGerbers(const TOOL_EVENT &aEvent)
int ToggleProperties(const TOOL_EVENT &aEvent)
int OpenNonKicadBoard(const TOOL_EVENT &aEvent)
int ExportSTEP(const TOOL_EVENT &aEvent)
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 void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const ZONES & Zones() const
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
int GetCount() const
Return the number of objects in the list.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
Store all of the related component information found in a netlist.
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
void SetFields(nlohmann::ordered_map< wxString, wxString > aFields)
void SetWksFileName(const wxString &aFilename)
A dialog to set the plot options and create plot files in various formats.
bool Show(bool show) override
void SelectToolbarAction(const TOOL_ACTION &aAction) override
Select the given action in the toolbar group which contains it, if any.
The base class for create windows for drawing purpose.
void ForceRefresh()
Force a redraw.
A set of EDA_ITEMs (i.e., without duplicates).
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void SetPosition(const VECTOR2I &aPos)
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected item had a property changed (except movement)
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT UnselectedEvent
Used when the right click button is pressed, or when the select tool is in effect.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
wxString m_outputFile
Where to write the downgraded copy.
wxString m_filename
Input board file (may be empty to downgrade only libraries)
wxString m_variant
Flatten this variant into the export. Empty means the base design.
A color representation with 4 components: red, green, blue, alpha.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void PinCursorInsideNonAutoscrollArea(bool aWarpMouseCursor)=0
An abstract base class for deriving all objects that can be added to a VIEW.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
void MarkDirty()
Force redraw of view on the next rendering.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Helper widget to add controls to a wxFileDialog to set netlist configuration options.
int GetNetlistOptions() const
static wxWindow * Create(wxWindow *aParent)
int GetViaDiameter() const
int GetTrackWidth() const
Handle the data for a net.
const wxString & GetNetname() const
bool HasAutoGeneratedNetname() const
NETINFO_ITEM * GetNetItem(int aNetCode) const
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
std::shared_ptr< NETCLASS > GetDefaultNetclass() const
Gets the default netclass for the project.
@ NORMAL
Shape is the same on all layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
static TOOL_ACTION lineModeFree
Unconstrained angle mode (icon lines_any)
static TOOL_ACTION showConstraintsPanel
Toggle the docked constraints pane (board editor).
static TOOL_ACTION zonesManager
static TOOL_ACTION generateBOM
static TOOL_ACTION drcRuleEditor
static TOOL_ACTION exportGenCAD
static TOOL_ACTION zoneFillAll
static TOOL_ACTION showLayersManager
static TOOL_ACTION trackWidthDec
static TOOL_ACTION generateDrillFiles
static TOOL_ACTION exportVRML
static TOOL_ACTION generateD356File
static TOOL_ACTION exportCmpFile
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION exportSpecctraDSN
static TOOL_ACTION trackWidthInc
static TOOL_ACTION autoTrackWidth
static TOOL_ACTION generateIPC2581File
static TOOL_ACTION getAndPlace
Find an item and start moving.
static TOOL_ACTION generateODBPPFile
static TOOL_ACTION drawZoneCutout
static TOOL_ACTION openNonKicadBoard
static TOOL_ACTION viaSizeDec
static TOOL_ACTION zoneFill
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION editFpInFpEditor
static TOOL_ACTION toggleLock
static TOOL_ACTION drillResetOrigin
static TOOL_ACTION lineMode45
45-degree-or-orthogonal mode (icon hv45mode)
static TOOL_ACTION zonePriorityMoveToBottom
static TOOL_ACTION zonePriorityMoveToTop
static TOOL_ACTION viaSizeInc
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION generateBOMLegacy
static TOOL_ACTION zoneUnfill
static TOOL_ACTION generatePosFile
static TOOL_ACTION drillOrigin
static TOOL_ACTION assignNetClass
static TOOL_ACTION repairBoard
static TOOL_ACTION exportSTEP
static TOOL_ACTION showNetInspector
static TOOL_ACTION findByProperties
Find items by property criteria or expression.
static TOOL_ACTION generateGerbers
static TOOL_ACTION generateReportFile
static TOOL_ACTION exportHyperlynx
static TOOL_ACTION zonePriorityLower
static TOOL_ACTION exportIDF
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
static TOOL_ACTION importNetlist
static TOOL_ACTION drawSimilarZone
static TOOL_ACTION boardSetup
static TOOL_ACTION showEeschema
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION zoneUnfillAll
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
static TOOL_ACTION editFootprintFields
static TOOL_ACTION lineMode90
90-degree-only mode (icon lines90)
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION zoneMerge
static TOOL_ACTION drillSetOrigin
static TOOL_ACTION unlock
static TOOL_ACTION exportFootprints
static TOOL_ACTION placeFootprint
static TOOL_ACTION zonePriorityRaise
static TOOL_ACTION importSpecctraSession
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Common, abstract interface for edit frames.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
The main frame for Pcbnew.
void SetLocked(bool aLocked) override
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
static bool HasUnlockedItems(const SELECTION &aSelection)
Test if any selected items are unlocked.
static bool HasLockedItems(const SELECTION &aSelection)
Test if any selected items are locked.
virtual void SetWidth(int aWidth)
virtual int GetWidth() const
virtual COMMON_SETTINGS * GetCommonSettings() const
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void SetDescription(const wxString &aDescription)
RouterState GetState() const
Container for project specific data.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
int Size() const
Returns the number of selected parts.
void SetReferencePoint(const VECTOR2I &aP)
Represent a set of closed polygons.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int TotalVertices() const
Return total number of vertices stored in the set.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Copy settings to a given zone.
Handle a list of polygons defining a copper zone.
void SetNeedRefill(bool aNeedRefill)
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
const BOX2I GetBoundingBox() const override
SHAPE_POLY_SET GetBoardOutline() const
bool IsTeardropArea() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool IsOnCopperLayer() const override
void SetAssignedPriority(unsigned aPriority)
unsigned GetAssignedPriority() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE *aZone, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
Invoke a modal dialog window for copper zone editing.
void RunExportForOlderVersion(EDA_BASE_FRAME *aFrame, const DOWNGRADE_EXPORT_RUNNER &aRun)
bool RunDowngradeJob(KIWAY &aKiway, KIWAY::FACE_T aFace, JOB_T &aJob, const DOWNGRADE_EXPORT_PASS &aPass, DOWNGRADE_EXPORT_RESULT &aResult)
Fill in the parts of a downgrade job that every editor sets the same way, run it, and hand back its r...
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings)
Invoke a modal dialog window for non-copper zone editing.
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aZoneSettings, BOARD *aBoard, CONVERT_SETTINGS *aConvertSettings)
Invoke a modal dialog window for copper zone editing.
static constexpr EDA_ANGLE ANGLE_0
#define IS_NEW
New item, just created.
const wxString EESCHEMA_EXE
LEADER_MODE
The kind of the leader line.
@ DIRECT
Unconstrained point-to-point.
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
static const std::string LegacySchematicFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SpecctraDsnFileExtension
static const std::string SpecctraSessionFileExtension
static wxString SpecctraSessionFileWildcard()
static wxString SpecctraDsnFileWildcard()
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
@ PNS_MODE_ROUTE_DIFF_PAIR
#define MAX_PAGE_SIZE_PCBNEW_MILS
EDA_ANGLE GridFrameAngleAt(const BOARD &aBoard, const VECTOR2I &aPos, PCB_GRID_ROLE aRole)
World frame angle of the grid active for aRole at aPos; ANGLE_0 when no grid applies.
EDA_ANGLE GridFrameRotationDelta(const EDA_ANGLE &aFrom, const EDA_ANGLE &aTo, const EDA_ANGLE &aRotationStep)
Minimal rotation that re-aligns an item from frame angle aFrom to aTo, reduced modulo min( aRotationS...
PGM_BASE & Pgm()
The global program "get" accessor.
T * GetAppSettings(const char *aFilename)
std::vector< FAB_LAYER_COLOR > dummy
What one pass of an export is asked to do.
wxString m_variant
Variant to flatten, empty for the base design.
bool m_dryRun
Classify only, write nothing.
wxString m_folder
Destination, empty on a dry run.
What the flow needs back from a pass.
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
wxString result
Test unit parsing edge cases and error handling.
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.