24#include <wx/hyperlink.h>
25#include <wx/filename.h>
107using namespace std::placeholders;
141 double backgroundBrightness =
m_frame->GetCanvas()->GetGAL()->GetClearColor().GetBrightness();
144 if( backgroundBrightness > 0.5 )
193 const wxString fn = *aEvent.
Parameter<wxString*>();
202 const wxString fn = *aEvent.
Parameter<wxString*>();
204 m_frame->Zoom_Automatique(
false );
262 editFrame->OnDisplayOptionsChanged();
294 if(
Pgm().GetCommonSettings()->m_DoNotShowAgain.zone_fill_warning )
297 bool unfilledZones =
false;
299 for(
const ZONE* zone :
board()->Zones() )
301 if( !zone->GetIsRuleArea() && !zone->IsFilled() )
303 unfilledZones =
true;
313 infobar->
AddLink(
_(
"Don't show again" ),
314 [&]( wxHyperlinkEvent& aEvent )
317 m_frame->GetInfoBar()->Dismiss();
321 msg.Printf(
_(
"Not all zones are filled. Use Edit > Fill All Zones (%s) if you wish to see all fills." ),
364 m_frame->SetDisplayOptions( opts );
382 m_frame->SetDisplayOptions( opts );
398 m_frame->SetDisplayOptions( opts );
407 if( !
Pgm().GetCommonSettings()->m_Input.hotkey_feedback )
412 wxArrayString labels;
413 labels.Add(
_(
"Normal" ) );
414 labels.Add(
_(
"Dimmed" ) );
415 labels.Add(
_(
"Hidden" ) );
417 if( !
m_frame->GetHotkeyPopup() )
442 m_frame->SetDisplayOptions( opts );
467 editFrame->OnDisplayOptionsChanged();
489 bool wraparound =
false;
503 for( ; ii < (int) layerStack.size(); ii++ )
505 if( layer == layerStack[ii] )
510 for( ; ii < (int) layerStack.size(); ii++ )
514 if( jj >= (
int) layerStack.size() )
517 layer = layerStack[jj];
548 bool wraparound =
false;
562 for( ; ii < (int) layerStack.size(); ii++ )
564 if( layer == layerStack[ii] )
569 for( ; ii >= 0; ii-- )
574 jj = (int) layerStack.size() - 1;
576 layer = layerStack[jj];
605 int currentLayer =
m_frame->GetActiveLayer();
619#define ALPHA_MIN 0.20
620#define ALPHA_MAX 1.00
621#define ALPHA_STEP 0.05
627 int currentLayer =
m_frame->GetActiveLayer();
633 settings->
SetColor( currentLayer, currentColor );
634 m_frame->GetCanvas()->UpdateColors();
637 view->UpdateLayerColor( currentLayer );
643 m_frame->GetCanvas()->ForceRefresh();
657 int currentLayer =
m_frame->GetActiveLayer();
663 settings->
SetColor( currentLayer, currentColor );
664 m_frame->GetCanvas()->UpdateColors();
667 view->UpdateLayerColor( currentLayer );
673 m_frame->GetCanvas()->ForceRefresh();
696 if( presets.size() < 2 )
699 if( currentIndex < 0 )
701 wxASSERT_MSG(
false,
"Current layer pair not found in layer settings" );
705 const int nextIndex = ( currentIndex + 1 ) % presets.size();
706 const LAYER_PAIR& nextPair = presets[nextIndex].GetLayerPair();
719 if( !
Pgm().GetCommonSettings()->m_Input.hotkey_feedback )
734 wxArrayString labels;
737 wxString label = layerPresentation.
getLayerPairName( layerPairInfo.GetLayerPair() );
739 if( layerPairInfo.GetName() )
740 label += wxT(
" (" ) + *layerPairInfo.GetName() + wxT(
")" );
745 if( !editFrame->GetHotkeyPopup() )
746 editFrame->CreateHotkeyPopup();
799 [
this](
const VECTOR2D& pt ) ->
bool
821#define HITTEST_THRESHOLD_PIXELS 5
842 [
this](
const VECTOR2D& aPosition ) ->
bool
885 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
887 if( !selectionTool->
Selectable( collector[i] ) )
912 [
this](
const int& aFinalState )
921 m_frame->GetCanvas()->Refresh();
931 std::vector<BOARD_ITEM*>& aPastedItems )
939 pad->SetParent( editorFootprint );
940 aPastedItems.push_back(
pad );
943 aClipFootprint->
Pads().clear();
950 wxCHECK2( field,
continue );
952 if( field->IsMandatory() )
954 if(
EDA_GROUP* parentGroup = field->GetParentGroup() )
955 parentGroup->RemoveItem( field );
964 VECTOR2I pos = field->GetFPRelativePosition();
965 field->SetParent( editorFootprint );
966 field->SetFPRelativePosition( pos );
968 aPastedItems.push_back( field );
984 item->Rotate( item->GetPosition(), -aClipFootprint->
GetOrientation() );
985 item->Rotate( item->GetPosition(), editorFootprint->
GetOrientation() );
987 VECTOR2I pos = item->GetFPRelativePosition();
988 item->SetParent( editorFootprint );
989 item->SetFPRelativePosition( pos );
991 aPastedItems.push_back( item );
996 for(
ZONE* zone : aClipFootprint->
Zones() )
998 zone->SetParent( editorFootprint );
999 aPastedItems.push_back( zone );
1002 aClipFootprint->
Zones().clear();
1006 group->SetParent( editorFootprint );
1007 aPastedItems.push_back(
group );
1010 aClipFootprint->
Groups().clear();
1016 constraint->SetParent( editorFootprint );
1017 aPastedItems.push_back( constraint );
1035 std::vector<BOARD_ITEM*> returnItems;
1039 if( !item->FitsEnabledLayers( enabledLayers, copperLayers ) )
1041 if(
EDA_GROUP* parentGroup = item->GetParentGroup() )
1042 parentGroup->RemoveItem( item );
1048 if( !item->IsLayerAgnostic() )
1049 item->SetLayerSet( item->GetLayerSet() & enabledLayers );
1051 returnItems.push_back( item );
1054 if( returnItems.size() < aItems.size() )
1057 "present in the current board.\n"
1058 "These items could not be pasted.\n" ) );
1061 aItems = returnItems;
1078 if(
PAD*
pad =
dynamic_cast<PAD*
>( item ) )
1099 if( wxDialog::OSXHasModalDialogsOpen() )
1113 if( selTool && clipItem )
1117 bool hasTableCells =
false;
1123 hasTableCells =
true;
1134 BOARD* clipBoard =
static_cast<BOARD*
>( clipItem );
1140 clipboardTable =
static_cast<PCB_TABLE*
>( item );
1146 if( clipboardTable )
1162 commit.
Push(
_(
"Paste Cells" ) );
1178 std::vector<BOARD_ITEM*> newItems;
1182 auto refImg = std::make_unique<PCB_REFERENCE_IMAGE>(
m_frame->GetModel() );
1184 if( refImg->GetReferenceImage().SetImage( clipImg->ConvertToImage() ) )
1185 newItems.push_back( refImg.release() );
1191 if( clipText.empty() )
1198 "Do you want to continue?" ) );
1203 std::unique_ptr<PCB_TEXT> item = std::make_unique<PCB_TEXT>(
m_frame->GetModel() );
1204 item->SetText( clipText );
1205 item->SetLayer(
m_frame->GetActiveLayer() );
1207 newItems.push_back( item.release() );
1210 bool cancelled = !
placeBoardItems( &commit, newItems,
true,
false,
false,
false );
1215 commit.
Push(
_(
"Paste Text" ) );
1222 bool clear_nets =
false;
1223 const wxString defaultRef = wxT(
"REF**" );
1240 BOARD* clipBoard =
static_cast<BOARD*
>( clipItem );
1242 if( isFootprintEditor || clear_nets )
1253 bool cancelled =
false;
1255 switch( clipItem->
Type() )
1259 BOARD* clipBoard =
static_cast<BOARD*
>( clipItem );
1261 if( isFootprintEditor )
1264 std::vector<BOARD_ITEM*> pastedItems;
1268 group->SetParent( editorFootprint );
1269 pastedItems.push_back(
group );
1279 switch( clipDrawItem->Type() )
1293 clipDrawItem->SetParent( editorFootprint );
1294 pastedItems.push_back( clipDrawItem );
1300 if(
EDA_GROUP* parentGroup = clipDrawItem->GetParentGroup() )
1301 parentGroup->RemoveItem( clipDrawItem );
1313 constraint->SetParent( editorFootprint );
1314 pastedItems.push_back( constraint );
1322 [&](
EDA_ITEM* item,
void* testData )
1354 fp->ResolveComponentClassNames(
board(), fp->GetTransientComponentClassNames() );
1355 fp->ClearTransientComponentClassNames();
1361 fp->SetReference( defaultRef );
1373 std::vector<BOARD_ITEM*> pastedItems;
1375 if( isFootprintEditor )
1378 delete clipFootprint;
1388 pastedItems.push_back( clipFootprint );
1402 m_frame->DisplayToolMsg(
_(
"Invalid clipboard contents" ) );
1409 commit.
Push(
_(
"Paste" ) );
1450 std::unique_ptr<DESIGN_BLOCK> designBlock( designBlockPane->
GetDesignBlock( selectedLibId,
true,
true ) );
1455 if( designBlock->GetBoardFile().IsEmpty() || !wxFileName::FileExists( designBlock->GetBoardFile() ) )
1457 editFrame->
ShowInfoBarError(
_(
"Design block has no layout to place." ),
true );
1467 bool repeatPlacement =
false;
1470 repeatPlacement = cfg->m_DesignBlockChooserPanel.repeated_placement;
1476 ret =
AppendBoard( *pi, designBlock->GetBoardFile(), designBlock.get() );
1477 }
while( repeatPlacement && ret == 0 );
1497 std::vector<PCB_GROUP*> linkedGroups;
1498 int skippedNoLink = 0;
1508 linkedGroups.push_back( g );
1513 if( linkedGroups.empty() )
1515 m_frame->ShowInfoBarError(
_(
"No groups with a linked design block are selected." ),
true );
1521 bool hasLocked =
false;
1525 hasLocked = g->IsLocked();
1541 m_frame->ShowInfoBarWarning(
_(
"Selection contains locked items. "
1542 "Enable 'Override locks' to operate on them." ),
1556 std::vector<Failure> failures;
1558 bool cancelled =
false;
1559 bool netlessCopperPlaced =
false;
1561 std::unique_ptr<WX_PROGRESS_REPORTER> progress;
1563 if( linkedGroups.size() > 1 &&
Pgm().IsGUI() )
1565 progress = std::make_unique<WX_PROGRESS_REPORTER>(
m_frame,
_(
"Applying Design Block Layouts" ),
1569 auto generateBoundingBox = [](
const std::unordered_set<EDA_ITEM*>& aItems )
1571 std::vector<VECTOR2I> bbCorners;
1572 bbCorners.reserve( aItems.size() * 4 );
1576 const BOX2I bb = item->GetBoundingBox().GetInflated( 100000 );
1580 std::vector<VECTOR2I> hullVertices;
1589 auto applyOneGroup = [&](
PCB_GROUP*
group, wxString& outErr ) ->
bool
1592 std::unique_ptr<DESIGN_BLOCK> designBlock(
1598 if( designBlock->GetBoardFile().IsEmpty() )
1600 outErr =
_(
"the design block has no saved board layout" );
1612 auto clearFlags = [&]()
1628 if( !pi ||
AppendBoard( *pi, designBlock->GetBoardFile(), designBlock.get(), &tempCommit,
true ) != 0 )
1631 outErr =
_(
"the design block's board file could not be read" );
1658 outErr =
_(
"the design block's board layout is empty" );
1663 bool blockHasNetlessCopper =
false;
1671 blockHasNetlessCopper =
true;
1704 if(
group->GetItems().empty() )
1709 outErr =
_(
"the group has no items" );
1730 .m_connectedRoutingOnly =
false,
1731 .m_copyPlacement =
true,
1732 .m_copyOtherItems =
true,
1733 .m_groupItems =
false,
1734 .m_includeLockedItems =
true };
1739 std::vector<NETINFO_ITEM*> isolatedNets =
1743 tempCommit.
Added( net );
1746 int result = mct->
RepeatLayout( aEvent, dbRA, destRA, options, &sharedCommit, &repeatErr );
1756 outErr = repeatErr.IsEmpty() ?
_(
"the layout could not be copied onto the group" ) : repeatErr;
1760 if( blockHasNetlessCopper )
1761 netlessCopperPlaced =
true;
1766 for(
size_t i = 0; i < linkedGroups.size(); ++i )
1772 progress->SetCurrentProgress(
static_cast<double>( i ) / linkedGroups.size() );
1774 wxString::Format(
_(
"Applying layout to group %zu of %zu..." ), i + 1, linkedGroups.size() ) );
1776 if( !progress->KeepRefreshing() )
1785 if( applyOneGroup( g, err ) )
1788 failures.push_back( { g, err } );
1792 progress->SetCurrentProgress( 1.0 );
1796 sharedCommit.Revert();
1797 m_frame->ShowInfoBarMsg(
_(
"Apply design block layout cancelled." ),
true );
1803 sharedCommit.Push(
_(
"Apply Design Block Layout" ) );
1805 if( netlessCopperPlaced )
1806 m_frame->ShowInfoBarMsg(
_(
"Copied copper has no net assigned. Assign nets to connect it." ),
true );
1810 sharedCommit.Revert();
1813 if( skippedNoLink > 0 || !failures.empty() || linkedGroups.size() > 1 )
1817 html << wxT(
"<p>" )
1818 << wxString::Format(
_(
"Applied design block layout to %d of %d group(s)." ), applied,
1819 (
int) linkedGroups.size() )
1822 if( skippedNoLink > 0 )
1824 html << wxT(
"<p>" )
1825 << wxString::Format(
_(
"Skipped %d selected item(s) that are not groups linked to a "
1831 if( !failures.empty() )
1833 html << wxT(
"<p>" ) <<
_(
"The following groups could not be processed:" ) << wxT(
"</p><ul>" );
1835 for(
const Failure& f : failures )
1837 wxString
name = f.group->GetName().IsEmpty() ?
_(
"(unnamed group)" ) : f.group->GetName();
1838 wxString reason = f.reason;
1840 reason.Replace( wxT(
"\n" ), wxT(
"<br>" ) );
1841 html << wxString::Format( wxT(
"<li><b>%s</b>: %s</li>" ),
name, reason );
1844 html << wxT(
"</ul>" );
1853 return applied > 0 ? 0 : 1;
1872 if( !
group->HasDesignBlockLink() )
1877 std::unique_ptr<DESIGN_BLOCK> designBlock( designBlockPane->
GetDesignBlock(
group->GetDesignBlockLibId(),
1883 if( designBlock->GetBoardFile().IsEmpty() )
1886 msg.Printf(
_(
"Design block %s does not have a board file." ),
1887 group->GetDesignBlockLibId().GetUniStringLibId() );
1888 m_frame->GetInfoBar()->ShowMessageFor( msg, 5000, wxICON_WARNING );
1899 if( aEvent.
Parameter<
bool*>() !=
nullptr )
1900 return AppendBoard( *pi, designBlock->GetBoardFile(), designBlock.get(),
1903 return AppendBoard( *pi, designBlock->GetBoardFile(), designBlock.get() );
1923 if( !
group->HasDesignBlockLink() )
1928 std::unique_ptr<DESIGN_BLOCK> designBlock( designBlockPane->
GetDesignBlock(
group->GetDesignBlockLibId(),
1941 bool aReannotateDuplicates,
bool aSkipMove )
1944 bool isNew =
board() != aBoard;
1945 std::vector<BOARD_ITEM*> items;
1953 bool doCopy = ( item->GetFlags() &
SKIP_STRUCT ) == 0;
1956 item->SetFlags( isNew ?
IS_NEW : 0 );
1959 items.push_back( item );
1970 item->SetParent(
board() );
1975 return placeBoardItems( aCommit, items, isNew, aAnchorAtOrigin, aReannotateDuplicates, aSkipMove );
1980 bool aAnchorAtOrigin,
bool aReannotateDuplicates,
bool aSkipMove )
1986 std::vector<BOARD_ITEM*> itemsToSel;
1987 itemsToSel.reserve( aItems.size() );
1993 std::map<KIID, KIID> idMap;
1994 std::set<BOARD_ITEM*> resetItems;
1996 auto resetUuidOnce =
1999 if( !resetItems.insert( aItem ).second )
2002 KIID oldUuid = aItem->m_Uuid;
2004 idMap[oldUuid] = aItem->m_Uuid;
2011 resetUuidOnce( item );
2013 item->RunOnChildren(
2016 resetUuidOnce( aChild );
2024 if( item->IsGroupableType() && !item->GetParentGroup() )
2027 enteredGroup->AddItem( item );
2031 item->SetParent(
board() );
2036 ZONE* zone =
static_cast<ZONE*
>( item );
2066 if( !item->GetParentGroup() || !
alg::contains( aItems, item->GetParentGroup()->AsEdaItem() ) )
2067 itemsToSel.push_back( item );
2072 if( aIsNew && !idMap.empty() )
2076 item->RemapKIIDs( idMap );
2077 item->RunOnChildren( [&](
BOARD_ITEM* aChild )
2086 EDA_ITEMS toSel( itemsToSel.begin(), itemsToSel.end() );
2096 aCommit->
Add( item );
2098 aCommit->
Added( item );
2105 if( aAnchorAtOrigin )
2111 selection.SetReferencePoint( item->GetPosition() );
2141 std::unique_ptr<BOARD_COMMIT> tempCommit;
2146 tempCommit = std::make_unique<BOARD_COMMIT>( editFrame );
2147 commit = tempCommit.get();
2154 std::set<NETINFO_ITEM*> existingNets;
2157 existingNets.insert( net );
2162 auto clearSkipStructOnExistingItems =
2169 std::map<wxString, wxString> oldProperties = brd->
GetProperties();
2170 std::map<wxString, wxString> newProperties;
2182 std::map<std::string, UTF8> props;
2186 props[
"page_width"] = std::to_string( editFrame->
GetPageSizeIU().
x );
2187 props[
"page_height"] = std::to_string( editFrame->
GetPageSizeIU().
y );
2191 [&]( wxString aTitle,
int aIcon, wxString aMessage, wxString aAction ) ->
bool
2193 KIDIALOG dlg( editFrame, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
2195 if( !aAction.IsEmpty() )
2196 dlg.SetOKLabel( aAction );
2206 mappable->RegisterCallback(
2207 [editFrame](
const std::vector<INPUT_LAYER_DESC>& aLayerDescs )
2221 clearSkipStructOnExistingItems();
2228 for(
const std::pair<const wxString, wxString>& prop : oldProperties )
2229 newProperties[prop.first] = prop.second;
2245 if( !existingNets.contains( net ) )
2246 commit->
Added( net );
2259 connectedItem->SetLocalRatsnestVisible( showGlobalRatsnest );
2264 pad->SetLocalRatsnestVisible( showGlobalRatsnest );
2272 if( copperLayerCount > initialCopperLayerCount )
2277 enabledLayers |= initialEnabledLayers;
2285 wxString msg = wxString::Format(
_(
"Board changed from %d to %d copper layers, stackup updated." ),
2286 initialCopperLayerCount,
2293 bool placeAsGroup =
false;
2296 placeAsGroup = cfg->m_DesignBlockChooserPanel.place_as_group;
2306 int groupableCount = 0;
2310 if( eda_item->IsBOARD_ITEM()
2317 if( groupableCount >= 2 )
2333 if( eda_item->IsBOARD_ITEM() )
2335 if(
static_cast<BOARD_ITEM*
>( eda_item )->IsLocked() )
2336 group->SetLocked(
true );
2344 if( eda_item->IsBOARD_ITEM()
2347 commit->
Modify( eda_item );
2348 group->AddItem( eda_item );
2363 commit->
Push( aDesignBlock ?
_(
"Place Design Block" ) :
_(
"Append Board" ) );
2379 clearSkipStructOnExistingItems();
2388 wxCommandEvent
dummy;
2400 wxCommandEvent
dummy;
2412 :
m_frame->GetPcbNewSettings()->m_MagneticItems;
2420 snapMode = !snapMode;
2430 if( !
Pgm().GetCommonSettings()->m_Input.hotkey_feedback )
2433 wxArrayString labels;
2434 labels.Add(
_(
"Active Layer" ) );
2435 labels.Add(
_(
"All Layers" ) );
2437 if( !
m_frame->GetHotkeyPopup() )
2443 :
m_frame->GetPcbNewSettings()->m_MagneticItems;
2446 popup->
Popup(
_(
"Object Snapping" ), labels,
static_cast<int>( settings.
allLayers ) );
2458 std::shared_ptr<DRC_ENGINE> drcEngine =
m_frame->GetBoard()->GetDesignSettings().m_DRCEngine;
2461 std::vector<MSG_PANEL_ITEM> msgItems;
2463 if( routerTool && routerTool->RoutingInProgress() )
2465 routerTool->UpdateMessagePanel();
2469 if( !pcbFrame && !
m_frame->GetModel() )
2489 msgItems.emplace_back(
_(
"UUID" ), *uuid );
2505 if( candidate->GetNet() != coupledNet )
2510 if( !coupledItem || dist_sq < closestDist_sq )
2512 coupledItem = candidate;
2513 closestDist_sq = dist_sq;
2519 wxString msg =
m_frame->MessageTextFromMinOptMax( constraint.
Value() );
2521 if( !msg.IsEmpty() )
2523 msgItems.emplace_back( wxString::Format(
_(
"DP Gap Constraints: %s" ), msg ),
2524 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2532 msgItems.emplace_back( wxString::Format(
_(
"DP Max Uncoupled-length: %s" ), msg ),
2533 wxString::Format(
_(
"(from %s)" ), constraint.
GetName() ) );
2537 else if( pcbFrame &&
selection.GetSize() == 2 )
2554 if( a_conn && b_conn )
2560 if( overlap.count() > 0 )
2564 if( a_netcode != b_netcode || a_netcode < 0 || b_netcode < 0 )
2567 msgItems.emplace_back(
_(
"Resolved Clearance" ),
2574 int actual_clearance = a_shape->GetClearance( b_shape.get() );
2576 if( actual_clearance > -1 && actual_clearance < std::numeric_limits<int>::max() )
2578 msgItems.emplace_back(
_(
"Actual Clearance" ),
2579 m_frame->MessageTextFromValue( actual_clearance ) );
2600 int actual = std::numeric_limits<int>::max();
2607 actual = std::min(
actual, hole->GetClearance( other.get() ) );
2615 actual = std::min(
actual, hole->GetClearance( other.get() ) );
2618 if(
actual < std::numeric_limits<int>::max() )
2621 msgItems.emplace_back(
_(
"Resolved Hole Clearance" ),
2624 if(
actual > -1 &&
actual < std::numeric_limits<int>::max() )
2626 msgItems.emplace_back(
_(
"Actual Hole Clearance" ),
2661 msgItems.emplace_back(
_(
"Resolved Edge Clearance" ),
2666 msgItems.emplace_back(
_(
"Resolved Margin Clearance" ),
2676 if( msgItems.empty() )
2679 std::map<KICAD_T, int> typeCounts;
2682 typeCounts[item->Type()]++;
2685 bool allSameType = ( typeCounts.size() == 1 );
2686 KICAD_T commonType = allSameType ? typeCounts.begin()->first :
NOT_USED;
2691 wxString typeName =
selection.Front()->GetFriendlyName();
2692 msgItems.emplace_back( typeName, wxString::Format( wxT(
"%d" ),
selection.GetSize() ) );
2697 std::set<wxString> layers;
2698 std::set<PAD_SHAPE> shapes;
2699 std::set<VECTOR2I> sizes;
2705 layers.insert(
pad->LayerMaskDescribe() );
2707 pad->Padstack().ForEachUniqueLayer(
2710 shapes.insert(
pad->GetShape( aLayer ) );
2711 sizes.insert(
pad->GetSize( aLayer ) );
2715 if( layers.size() == 1 )
2716 msgItems.emplace_back(
_(
"Layer" ), *layers.begin() );
2718 if( shapes.size() == 1 )
2721 if( sizes.size() == 1 )
2723 msgItems.emplace_back(
_(
"Pad Size" ),
2724 wxString::Format( wxT(
"%s x %s" ),
2725 m_frame->MessageTextFromValue( sizes.begin()->x ),
2726 m_frame->MessageTextFromValue( sizes.begin()->y ) ) );
2735 for(
const auto& [type, count] : typeCounts )
2737 if( !breakdown.IsEmpty() )
2738 breakdown += wxT(
", " );
2745 if( item->Type() == type )
2747 typeName = item->GetFriendlyName();
2752 breakdown += wxString::Format( wxT(
"%s: %d" ), typeName, count );
2755 msgItems.emplace_back(
_(
"Selected Items" ),
2756 wxString::Format( wxT(
"%d (%s)" ),
selection.GetSize(), breakdown ) );
2761 std::set<wxString> netNames;
2762 std::set<wxString> netClasses;
2772 netClasses.insert(
UnescapeString( bci->GetEffectiveNetClass()->GetHumanReadableName() ) );
2774 if( netNames.size() > 1 && netClasses.size() > 1 )
2779 if( netNames.size() == 1 )
2780 msgItems.emplace_back(
_(
"Net" ), *netNames.begin() );
2782 if( netClasses.size() == 1 )
2783 msgItems.emplace_back(
_(
"Resolved Netclass" ), *netClasses.begin() );
2789 bool lengthValid =
true;
2790 double selectedLength = 0;
2793 std::function<void(
EDA_ITEM* )> accumulateTrackLength;
2795 accumulateTrackLength =
2800 selectedLength +=
static_cast<PCB_TRACK*
>( aItem )->GetLength();
2818 lengthValid =
false;
2828 lengthValid =
false;
2835 accumulateTrackLength( item );
2840 msgItems.emplace_back(
_(
"Selected 2D Length" ),
2841 m_frame->MessageTextFromValue( selectedLength ) );
2847 LSET enabledLayers =
m_frame->GetBoard()->GetEnabledLayers();
2849 bool areaValid =
true;
2850 bool hasCopper =
false;
2851 bool hasNonCopper =
false;
2853 std::map<PCB_LAYER_ID, SHAPE_POLY_SET> layerPolys;
2856 std::function<void(
EDA_ITEM* )> accumulateArea;
2882 LSET itemLayers = boardItem->GetLayerSet() & enabledLayers;
2886 boardItem->TransformShapeToPolySet( layerPolys[layer], layer, 0,
2889 if( enabledCopper.
Contains( layer ) )
2892 hasNonCopper =
true;
2897 static_cast<PAD*
>( aItem )->TransformHoleToPolygon( holes, 0,
ARC_LOW_DEF,
2904 int R =
via->GetDrillValue() / 2;
2914 accumulateArea( item );
2921 for(
auto& [layer, layerPoly] : layerPolys )
2924 if( enabledCopper.
Contains( layer ) )
2925 layerPoly.BooleanSubtract( holes );
2927 area += layerPoly.Area();
2933 if( hasCopper && !hasNonCopper )
2934 areaLabel =
_(
"Selected 2D Copper Area" );
2935 else if( !hasCopper && hasNonCopper )
2936 areaLabel =
_(
"Selected 2D Area" );
2938 areaLabel =
_(
"Selected 2D Total Area" );
2940 msgItems.emplace_back( areaLabel,
2950 m_frame->SetMsgPanel( msgItems );
2967 wxFileName fileName = wxFileName( *aEvent.
Parameter<wxString*>() );
2974 wxString filePath = fileName.GetFullPath();
2992 std::vector<BOARD_ITEM*> items;
2993 items.push_back(
table );
2997 commit.
Push(
_(
"Place Board Characteristics" ) );
3013 std::vector<BOARD_ITEM*> items;
3014 items.push_back(
table );
3018 commit.
Push(
_(
"Place Board Stackup Table" ) );
3029 _(
"No documentation layer is enabled to hold a drill chart." ),
3030 _(
"Place Drill Chart" ) );
3035 const wxString& aNoLayerMessage )
3040 if( !aAvailable( layer ) )
3047 m_frame->ShowInfoBarError( aNoLayerMessage );
3052 m_frame->SetActiveLayer( layer );
3057 if( !
board->IsLayerVisible( layer ) )
3059 m_frame->ShowInfoBarWarning( wxString::Format(
3060 _(
"Layer '%s' is hidden; nothing will be shown until you make it visible." ),
3061 board->GetLayerName( layer ) ) );
3069 const wxString& aUndoMessage )
3075 const auto available =
3089 aTable->SetLayer( layer );
3097 if( item->Type() == aTable->Type() && item->GetLayer() == layer )
3103 const BOX2I bbox = aTable->GetBoundingBox();
3107 std::vector<BOARD_ITEM*> items{ aTable.get() };
3124 commit.
Push( aUndoMessage );
3136 const auto available =
3165 commit.
Push(
_(
"Place Drill Map" ) );
3190 dialog->
Show(
true );
3200 m_frame->SetDisplayOptions( opts );
3250 std::vector<const EMBEDDED_FILES*> stack;
3254 int embeddedCount = 0;
3258 bool fpModified =
false;
3269 wxFileName fname( fullPath );
3270 wxString ext = fname.GetExt().Upper();
3272 if( fname.Exists() )
3277 model.m_Filename = file->GetLink();
3282 if( ext ==
"WRL" || ext ==
"WRZ" )
3287 alts.Add( wxT(
"stp" ) );
3288 alts.Add( wxT(
"step" ) );
3289 alts.Add( wxT(
"STP" ) );
3290 alts.Add( wxT(
"STEP" ) );
3291 alts.Add( wxT(
"Stp" ) );
3292 alts.Add( wxT(
"Step" ) );
3293 alts.Add( wxT(
"stpz" ) );
3294 alts.Add( wxT(
"stpZ" ) );
3295 alts.Add( wxT(
"STPZ" ) );
3297 for(
const auto& alt : alts )
3299 wxFileName altFile( fname.GetPath(),
3300 fname.GetName() + wxT(
"." ) + alt );
3302 if( altFile.IsOk() && altFile.FileExists() )
3317 if( embeddedCount > 0 )
3319 commit.
Push(
_(
"Embed 3D Models" ) );
3320 wxString msg = wxString::Format(
_(
"%d 3D model(s) successfully embedded." ), embeddedCount );
3321 m_frame->GetInfoBar()->ShowMessageFor( msg, 5000 );
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
PCB_TABLE * Build_Board_Characteristics_Table(BOARD *aBoard, EDA_UNITS aDisplayUnits)
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)
PCB_TABLE * Build_Board_Stackup_Table(BOARD *aBoard, EDA_UNITS aDisplayUnits)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION addLibrary
static TOOL_ACTION pickerTool
static TOOL_ACTION gridResetOrigin
static TOOL_ACTION pasteSpecial
static TOOL_ACTION highContrastModeCycle
static TOOL_ACTION highContrastMode
static TOOL_ACTION deleteTool
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION newLibrary
static TOOL_ACTION gridSetOrigin
static TOOL_ACTION ddAddLibrary
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void OnBoardChanged()
Update the panel contents from the application and board models.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
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,...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
NETINFO_ITEM * GetNet() const
Return NETINFO_ITEM object for a given item.
void SetGridOrigin(const VECTOR2I &aOrigin)
BOARD_STACKUP & GetStackupDescriptor()
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsOnCopperLayer() const
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
virtual bool HasHole() const
virtual void RemapKIIDs(const std::map< KIID, KIID > &aIdMap)
Remap KIIDs this item stores to reference other items (e.g.
bool SynchronizeWithBoard(const BOARD_DESIGN_SETTINGS *aSettings)
Synchronize the BOARD_STACKUP_ITEM* list with the board.
Information pertinent to a Pcbnew printed circuit board.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
const NETINFO_LIST & GetNetInfo() const
EMBEDDED_FILES * GetEmbeddedFiles() override
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
void MapNets(BOARD *aDestBoard)
Map all nets in the given board to nets with the same name (if any) in the destination board.
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
const PAGE_INFO & GetPageSettings() const
void SetProperties(const std::map< wxString, wxString > &aProps)
const GROUPS & Groups() const
The groups must maintain the following invariants.
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
TITLE_BLOCK & GetTitleBlock()
int GetCopperLayerCount() const
const std::map< wxString, wxString > & GetProperties() const
const FOOTPRINTS & Footprints() const
void RemoveAll(std::initializer_list< KICAD_T > aTypes={ PCB_NETINFO_T, PCB_MARKER_T, PCB_GROUP_T, PCB_ZONE_T, PCB_GENERATOR_T, PCB_FOOTPRINT_T, PCB_TRACE_T, PCB_SHAPE_T })
An efficient way to remove all items of a certain type from the board.
const BOARD_ITEM_SET GetItemSet()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
void SetPageSettings(const PAGE_INFO &aPageSettings)
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
void SetCopperLayerCount(int aCount)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
BOARD_DESIGN_SETTINGS & GetDesignSettings()
const DRAWINGS & Drawings() const
constexpr size_type GetHeight() const
int GetCount() const
Return the number of objects in the list.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
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.
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
void SelectLibId(const LIB_ID &aLibId)
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
DESIGN_BLOCK * GetDesignBlock(const LIB_ID &aLibId, bool aUseCacheLib, bool aShowErrorMsg, wxString *aErrorMsg=nullptr)
Load design block from design block library table.
const LIB_ID & GetLibId() const
Modeless inspector for the board's drill groups.
static std::map< wxString, PCB_LAYER_ID > RunModal(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
Create and show a dialog (modal) and returns the data from it after completion.
bool GetClearNets() const
bool Show(bool show) override
MINOPTMAX< int > & Value()
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=INFOBAR_MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
WX_INFOBAR * GetInfoBar()
bool GetOverrideLocks() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A set of EDA_ITEMs (i.e., without duplicates).
bool HasDesignBlockLink() const
void RemoveItem(EDA_ITEM *aItem)
Remove item from group.
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 wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
bool IsHatchedFill() const
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
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 ContrastModeChangedByKeyEvent
static const TOOL_EVENT ConnectivityChangedEvent
static const TOOL_EVENT UnselectedEvent
Provide an extensible class to resolve 3D model paths.
wxString ResolvePath(const wxString &aFileName, const wxString &aWorkingPath, std::vector< const EMBEDDED_FILES * > aEmbeddedFilesStack)
Determine the full path of the given file name.
A general implementation of a COLLECTORS_GUIDE.
Used when the right click button is pressed, or when the select tool is in effect.
static const std::vector< KICAD_T > BoardLevelItems
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
static const std::vector< KICAD_T > AllBoardItems
A scan list for all editable board items.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
One pass of rebuilding tables.
void SetDialogSizeInDU(int aWidth, int aHeight)
Set the dialog size, using a "logical" value.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
virtual void SetProgressReporter(PROGRESS_REPORTER *aReporter)
Set an optional progress reporter.
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()
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D & Darken(double aFactor)
Makes the color darker by a given factor.
COLOR4D & Brighten(double aFactor)
Makes the color brighter by a given factor.
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
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...
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
bool IsBOARD_ITEM() const
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...
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
void MarkDirty()
Force redraw of view on the next rendering.
Plugin class for import plugins that support remappable layers.
All information about a layer pair as stored in the layer pair store.
Management class for layer pairs in a PCB.
std::vector< LAYER_PAIR_INFO > GetEnabledLayerPairs(int &aCurrentIndex) const
Get a vector of all enabled layer pairs, in order.
void SetCurrentLayerPair(const LAYER_PAIR &aPair)
Set the "active" layer pair.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
const UTF8 & GetLibItemName() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
bool Contains(PCB_LAYER_ID aLayer) const
See if the layer set contains a PCB layer.
EDA_MSG_PANEL items for displaying messages.
Handle the data for a net.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
static wxString ShowPadShape(PAD_SHAPE aShape)
bool HasHole() const override
Describe the page size and margins of a paper page on which to eventually print or plot.
static TOOL_ACTION layerToggle
static TOOL_ACTION layerInner12
static TOOL_ACTION nextFootprint
static TOOL_ACTION layerInner8
static TOOL_ACTION zoneDisplayToggle
static TOOL_ACTION previousFootprint
static TOOL_ACTION layerInner3
static TOOL_ACTION layerPrev
static TOOL_ACTION showRatsnest
static TOOL_ACTION zoneFillAll
static TOOL_ACTION layerInner2
static TOOL_ACTION magneticSnapAllLayers
static TOOL_ACTION collect3DModels
static TOOL_ACTION saveToLinkedDesignBlock
static TOOL_ACTION placeDrillMap
static TOOL_ACTION ddAppendBoard
Drag and drop.
static TOOL_ACTION layerInner25
static TOOL_ACTION magneticSnapActiveLayer
Snapping controls.
static TOOL_ACTION layerAlphaDec
static TOOL_ACTION zoneDisplayFilled
static TOOL_ACTION layerInner24
static TOOL_ACTION viaDisplayMode
static TOOL_ACTION layerInner29
static TOOL_ACTION placeCharacteristics
static TOOL_ACTION layerInner11
static TOOL_ACTION layerAlphaInc
static TOOL_ACTION layerPairPresetsCycle
static TOOL_ACTION layerInner16
static TOOL_ACTION layerInner26
static TOOL_ACTION layerInner18
static TOOL_ACTION layerInner14
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION magneticSnapToggle
static TOOL_ACTION layerInner6
static TOOL_ACTION applyDesignBlockLayout
static TOOL_ACTION ddImportFootprint
static TOOL_ACTION zoneDisplayTriangulated
static TOOL_ACTION rehatchShapes
static TOOL_ACTION layerInner22
static TOOL_ACTION placeDesignBlock
static TOOL_ACTION layerInner5
static TOOL_ACTION zoneDisplayFractured
static TOOL_ACTION ratsnestModeCycle
static TOOL_ACTION layerInner20
static TOOL_ACTION layerInner7
static TOOL_ACTION layerInner27
static TOOL_ACTION loadFpFromBoard
static TOOL_ACTION appendBoard
static TOOL_ACTION netColorModeCycle
static TOOL_ACTION layerInner1
static TOOL_ACTION layerInner10
static TOOL_ACTION layerInner15
static TOOL_ACTION layerInner17
static TOOL_ACTION flipBoard
static TOOL_ACTION layerBottom
static TOOL_ACTION zoneDisplayOutline
static TOOL_ACTION ratsnestLineMode
static TOOL_ACTION layerInner19
static TOOL_ACTION layerInner9
static TOOL_ACTION showDrillGroups
static TOOL_ACTION placeDrillChart
static TOOL_ACTION move
move or drag an item
static TOOL_ACTION layerInner30
static TOOL_ACTION layerTop
static TOOL_ACTION updateDesignBlockFromSelection
static TOOL_ACTION layerInner4
static TOOL_ACTION layerInner13
static TOOL_ACTION layerInner21
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION layerNext
static TOOL_ACTION placeLinkedDesignBlock
static TOOL_ACTION placeStackup
static TOOL_ACTION layerInner23
static TOOL_ACTION layerInner28
Common, abstract interface for edit frames.
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
APPEARANCE_CONTROLS * GetAppearancePanel()
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
void UpdateVertexEditorSelection(BOARD_ITEM *aItem)
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
const VECTOR2I GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
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.
A geometric constraint between board items (issue #2329).
int PlaceDrillChart(const TOOL_EVENT &aEvent)
int RehatchShapes(const TOOL_EVENT &aEvent)
void setTransitions() override
Sets up handlers for various events.
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
int AddLibrary(const TOOL_EVENT &aEvent)
int DdAppendBoard(const TOOL_EVENT &aEvent)
int LoadFpFromBoard(const TOOL_EVENT &aEvent)
int SaveToLinkedDesignBlock(const TOOL_EVENT &aEvent)
int DdImportFootprint(const TOOL_EVENT &aEvent)
int SnapModeFeedback(const TOOL_EVENT &aEvent)
int NetColorModeCycle(const TOOL_EVENT &aEvent)
int SaveFpToBoard(const TOOL_EVENT &aEvent)
int RatsnestModeCycle(const TOOL_EVENT &aEvent)
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int DdAddLibrary(const TOOL_EVENT &aEvent)
int ShowDrillGroups(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
int PlaceLinkedDesignBlock(const TOOL_EVENT &aEvent)
bool placeBoardItems(BOARD_COMMIT *aCommit, std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates, bool aSkipMove)
Add and select or just select for move/place command a list of board items.
PCB_LAYER_ID pickDocumentationLayer(const std::function< bool(PCB_LAYER_ID)> &aAvailable, const wxString &aNoLayerMessage)
The active layer when aAvailable accepts it, otherwise the first documentation layer it does,...
int LayerPresetFeedback(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int placeGeneratedTable(std::unique_ptr< PCB_GENERATED_TABLE > aTable, const wxString &aNoLayerMessage, const wxString &aUndoMessage)
Build a generated table on a documentation layer and hand it to the user to place.
int LayerAlphaDec(const TOOL_EVENT &aEvent)
static void rehatchBoardItem(KIGFX::VIEW *aView, BOARD_ITEM *aItem)
Regenerate and redraw an item's hatching, skipping non-hatched shapes. Static for testing.
int LayerNext(const TOOL_EVENT &aEvent)
int PlaceStackup(const TOOL_EVENT &aEvent)
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
int ToggleRatsnest(const TOOL_EVENT &aEvent)
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
int HighContrastMode(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
int ViaDisplayMode(const TOOL_EVENT &aEvent)
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
int CollectAndEmbed3DModels(const TOOL_EVENT &aEvent)
void pruneItemLayers(std::vector< BOARD_ITEM * > &aItems)
Helper for pasting.
int GridPlaceOrigin(const TOOL_EVENT &aEvent)
int FlipPcbView(const TOOL_EVENT &aEvent)
int PlaceCharacteristics(const TOOL_EVENT &aEvent)
wxWeakRef< wxDialog > m_drillGroupsDialog
Modeless, so it outlives the action that opened it.
int ApplyDesignBlockLayout(const TOOL_EVENT &aEvent)
int SnapMode(const TOOL_EVENT &aEvent)
int ContrastModeFeedback(const TOOL_EVENT &aEvent)
int LayerToggle(const TOOL_EVENT &aEvent)
int AppendBoard(PCB_IO &pi, const wxString &fileName, DESIGN_BLOCK *aDesignBlock=nullptr, BOARD_COMMIT *aCommit=nullptr, bool aSkipMove=false)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int IterateFootprint(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridResetOrigin(const TOOL_EVENT &aEvent)
BOARD_ITEM * m_pickerItem
int InteractiveDelete(const TOOL_EVENT &aEvent)
int AppendDesignBlock(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
int PlaceDrillMap(const TOOL_EVENT &aEvent)
int CycleLayerPresets(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
void unfilledZoneCheck()
We have bug reports indicating that some new users confuse zone filling/unfilling with the display mo...
int LayerSwitch(const TOOL_EVENT &aEvent)
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
void RedrawRatsnest()
Force refresh of the ratsnest visual representation.
Turns on drill symbols at the holes, for one layer.
The main frame for Pcbnew.
PCB_DESIGN_BLOCK_PANE * GetDesignBlockPane() const
static const TOOL_EVENT & SnappingModeChangedByKeyEvent()
Hotkey feedback.
static const TOOL_EVENT & LayerPairPresetChangedByKeyEvent()
A set of BOARD_ITEMs (i.e., without duplicates).
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a PCB_IO which the caller can use to import, export, save, or load design documents.
static PCB_FILE_T FindPluginTypeFromBoardPath(const wxString &aFileName, int aCtl=0)
Return a plugin type given a path for a board file.
A base class that BOARD loading and saving plugins should derive from.
void LoadAndAppendBoard(const wxString &aFileName, BOARD &aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Same as LoadBoard(), but appends the loaded board to an existing board, which must already exist.
virtual void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
Register a KIDIALOG callback for collecting info from the user.
Class that manages the presentation of PCB layers in a PCB frame.
wxString getLayerPairName(const LAYER_PAIR &aPair) const
PCB_LAYER_ID m_Route_Layer_TOP
PCB_LAYER_ID m_Route_Layer_BOTTOM
void UpdateHatching() const override
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual COMMON_SETTINGS * GetCommonSettings() const
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Container for project specific data.
virtual const wxString GetProjectPath() const
Return the full path of the project.
Cache for storing the 3D shapes.
FILENAME_RESOLVER * GetResolver() noexcept
ecoord SquaredDistance(const SEG &aSeg) const
VECTOR2I::extended_type ecoord
virtual void Add(EDA_ITEM *aItem)
A null aItem is ignored; the selection never holds null members.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
virtual VECTOR2I Centre() const
Compute a center-of-mass of the shape.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
static constexpr extended_type ECOORD_MAX
A modified version of the wxInfoBar class that allows us to:
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
void AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link to the infobar.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
Handle a list of polygons defining a copper zone.
void SetDoNotAllowPads(bool aEnable)
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
void SetPlacementAreaSource(const wxString &aSource)
void SetPlacementAreaSourceType(PLACEMENT_SOURCE_T aType)
SHAPE_POLY_SET * Outline()
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
void SetIsRuleArea(bool aEnable)
void SetDoNotAllowTracks(bool aEnable)
const wxString & GetZoneName() const
void SetLayerSet(const LSET &aLayerSet) override
void SetDoNotAllowVias(bool aEnable)
void SetDoNotAllowFootprints(bool aEnable)
void SetDoNotAllowZoneFills(bool aEnable)
void SetZoneName(const wxString &aName)
void SetPlacementAreaEnabled(bool aEnabled)
std::unique_ptr< wxBitmap > GetImageFromClipboard()
Get image data from the clipboard, if there is any.
std::string GetClipboardUTF8()
Return the information currently stored in the system clipboard.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
void BuildConvexHull(std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
@ DIFF_PAIR_GAP_CONSTRAINT
@ EDGE_CLEARANCE_CONSTRAINT
@ MAX_UNCOUPLED_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
Declaration of the eda_3d_viewer class.
#define IS_NEW
New item, just created.
#define MCT_SKIP_STRUCT
flag used by the multichannel tool to mark items that should be skipped
#define SKIP_STRUCT
flag indicating that the structure should be ignored
LSET DocumentationLayers()
Layers a drill chart or drill map may live on.
static const std::string KiCadUriPrefix
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
#define KICTL_KICAD_ONLY
chosen file is from KiCad according to user
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
#define ZONE_LAYER_FOR(boardLayer)
std::optional< wxString > GetMsgPanelDisplayUuid(const KIID &aKiid)
Get a formatted UUID string for display in the message panel, according to the current advanced confi...
SHAPE_LINE_CHAIN RectifyPolygon(const SHAPE_LINE_CHAIN &aPoly)
Take a polygon and 'rectify' it, so that all sides are H/V.
void CollectBoxCorners(const BOX2I &aBox, std::vector< VECTOR2I > &aCorners)
Add the 4 corners of a BOX2I to a vector.
@ REPAINT
Item needs to be redrawn.
constexpr char APPEND_PRESERVE_DESTINATION_STACKUP[]
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, wxString *aFileName, int aCtl=0)
Show a wxFileDialog asking for a BOARD filename to open.
PCB_TABLE * Build_Board_Characteristics_Table(BOARD *aBoard, EDA_UNITS aDisplayUnits)
PCB_TABLE * Build_Board_Stackup_Table(BOARD *aBoard, EDA_UNITS aDisplayUnits)
static void recordPastedItems(TOOL_MANAGER *aToolMgr, const std::vector< BOARD_ITEM * > &aItems)
Handle items that have been pasted.
static void pasteFootprintItemsToFootprintEditor(FOOTPRINT *aClipFootprint, BOARD *aBoard, std::vector< BOARD_ITEM * > &aPastedItems)
Class to handle a set of BOARD_ITEMs.
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, wxString *aFileName, int aCtl=0)
Show a wxFileDialog asking for a BOARD filename to open.
PGM_BASE & Pgm()
The global program "get" accessor.
#define HITTEST_THRESHOLD_PIXELS
std::vector< EDA_ITEM * > EDA_ITEMS
Utility functions for working with shapes.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
RATSNEST_MODE m_RatsnestMode
bool m_ShowGlobalRatsnest
Options for copying a placement rule area onto the others linked to it.
std::unordered_set< EDA_ITEM * > m_designBlockItems
PLACEMENT_SOURCE_T m_sourceType
std::set< FOOTPRINT * > m_components
static std::vector< int > candidates(const SEGMENT_INDEX &aIndex, const SEG &aQuery, int aPadding)
wxString result
Test unit parsing edge cases and error handling.
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_CONSTRAINT_T
a geometric constraint between board items
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ NOT_USED
the 3d code uses this value
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
Definition of file extensions used in Kicad.