Merge branch kicad:master into master

This commit is contained in:
Alihossein Sepahvand 2025-06-10 12:46:53 -06:00
commit 84b4eebe76
12 changed files with 1217 additions and 803 deletions

View File

@ -35,8 +35,11 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE( aFrame ),
m_parentTool( aParentTool )
{
m_bSizer1 = new wxBoxSizer( wxVERTICAL );
m_bSizer2 = new wxBoxSizer( wxVERTICAL );
// Generate the sheet source grid
m_sheetGrid = new WX_GRID( m_sourceNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_sheetGrid = new WX_GRID( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_sheetGrid->PushEventHandler( new GRID_TRICKS( static_cast<WX_GRID*>( m_sheetGrid ) ) );
m_sheetGrid->CreateGrid( 0, 3 );
m_sheetGrid->EnableEditing( false );
@ -61,11 +64,13 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
m_sheetGrid->SetColLabelValue( 1, _( "Sheet Path" ) );
m_sheetGrid->SetColLabelValue( 2, _( "Sheet Name" ) );
m_sheetGrid->AutoSizeColumn( 1 );
m_sourceNotebook->AddPage( m_sheetGrid, _( "Sheets" ) );
m_bSizer1->Add( m_sheetGrid, 1, wxEXPAND | wxALL, 5 );
m_panel1->SetSizer( m_bSizer1 );
m_panel1->Layout();
m_bSizer1->Fit( m_panel1 );
// Generate the component class source grid
m_componentClassGrid =
new WX_GRID( m_sourceNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_componentClassGrid = new WX_GRID( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_componentClassGrid->CreateGrid( 0, 2 );
m_componentClassGrid->EnableEditing( false );
m_componentClassGrid->EnableGridLines( true );
@ -87,7 +92,10 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
m_componentClassGrid->SetColLabelValue( 0, _( "Generate" ) );
m_componentClassGrid->SetColLabelValue( 1, _( "Component Class" ) );
m_componentClassGrid->AutoSizeColumn( 1 );
m_sourceNotebook->AddPage( m_componentClassGrid, _( "Component Classes" ) );
m_bSizer2->Add( m_componentClassGrid, 1, wxEXPAND | wxALL, 5 );
m_panel2->SetSizer( m_bSizer2 );
m_panel2->Layout();
m_bSizer2->Fit( m_panel2 );
// Generate the group source grid
m_groupGrid = new WX_GRID( m_sourceNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
@ -177,15 +185,12 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
}
}
m_sheetGrid->SetMaxSize( wxSize( -1, 800 ) );
m_sheetGrid->Fit();
m_componentClassGrid->SetMaxSize( wxSize( -1, 800 ) );
m_componentClassGrid->Fit();
m_groupGrid->SetMaxSize( wxSize( -1, 800 ) );
m_groupGrid->Fit();
m_cbGroupItems->SetValue( raData->m_options.m_groupItems );
m_cbReplaceExisting->SetValue( raData->m_replaceExisting );
Layout();
if( m_sheetGrid->GetNumberRows() == 1 )

View File

@ -50,6 +50,8 @@ public:
private:
MULTICHANNEL_TOOL* m_parentTool;
wxBoxSizer* m_bSizer1;
wxBoxSizer* m_bSizer2;
wxGrid* m_sheetGrid;
wxGrid* m_componentClassGrid;
wxGrid* m_groupGrid;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,21 +11,31 @@
DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 500,-1 ), wxDefaultSize );
m_GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
this->SetSizeHints( wxSize( -1,-1 ), wxSize( -1,-1 ) );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 3, 1, 0, 0 );
fgSizer3 = new wxFlexGridSizer( 0, 1, 0, 0 );
fgSizer3->AddGrowableCol( 0 );
fgSizer3->AddGrowableRow( 0 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_sourceNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_sourceNotebook->SetMinSize( wxSize( 600,400 ) );
m_panel1 = new wxPanel( m_sourceNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_sourceNotebook->AddPage( m_panel1, _("Sheets"), false );
m_panel2 = new wxPanel( m_sourceNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_sourceNotebook->AddPage( m_panel2, _("Component Classes"), false );
fgSizer3->Add( m_sourceNotebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
fgSizer3->Add( bSizer4, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL );
@ -57,11 +67,9 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE::DIALOG_MULTICHANNEL_GENERATE_RULE_
fgSizer3->Add( bottomButtonsSizer, 0, wxEXPAND|wxLEFT, 5 );
m_GeneralBoxSizer->Add( fgSizer3, 1, wxEXPAND, 5 );
this->SetSizer( m_GeneralBoxSizer );
this->SetSizer( fgSizer3 );
this->Layout();
fgSizer3->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE::OnInitDlg ) );

View File

@ -46,11 +46,11 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">500,-1</property>
<property name="maximum_size">-1,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE</property>
<property name="pos"></property>
<property name="size">548,328</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Generate Multichannel Rule Areas</property>
@ -61,32 +61,140 @@
<property name="window_style"></property>
<event name="OnInitDialog">OnInitDlg</event>
<event name="OnUpdateUI">OnUpdateUI</event>
<object class="wxBoxSizer" expanded="true">
<object class="wxFlexGridSizer" expanded="true">
<property name="cols">1</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0</property>
<property name="growablerows">0</property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_GeneralBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">private</property>
<property name="name">fgSizer3</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="true">
<property name="cols">1</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0</property>
<property name="growablerows">0</property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">fgSizer3</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="true">
<object class="wxNotebook" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size">-1,-1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">600,400</property>
<property name="moveable">1</property>
<property name="name">m_sourceNotebook</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnNotebookPageChanged">OnNotebookPageChanged</event>
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Sheets</property>
<property name="select">0</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size">-1,-1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">Component Classes</property>
<property name="select">0</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -97,7 +205,6 @@
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
@ -123,7 +230,89 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_sourceNotebook</property>
<property name="name">m_panel2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="false">
<property name="minimum_size"></property>
<property name="name">bSizer13</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Replace existing placement rule areas</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbReplaceExisting</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -137,190 +326,117 @@
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnNotebookPageChanged">OnNotebookPageChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bSizer13</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Replace existing placement rule areas</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbReplaceExisting</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Group footprints with their placement rule areas</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbGroupItems</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<object class="wxCheckBox" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Group footprints with their placement rule areas</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="name">bottomButtonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="spacer" expanded="false">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="false">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizerStdButtons</property>
<property name="permission">protected</property>
</object>
</object>
<property name="moveable">1</property>
<property name="name">m_cbGroupItems</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="false">
<property name="minimum_size"></property>
<property name="name">bottomButtonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="spacer" expanded="false">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="false">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizerStdButtons</property>
<property name="permission">protected</property>
</object>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,14 +11,18 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/panel.h>
#include <wx/gdicmn.h>
#include <wx/notebook.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -30,10 +34,11 @@
class DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE : public DIALOG_SHIM
{
private:
wxBoxSizer* m_GeneralBoxSizer;
protected:
wxNotebook* m_sourceNotebook;
wxPanel* m_panel1;
wxPanel* m_panel2;
wxCheckBox* m_cbReplaceExisting;
wxCheckBox* m_cbGroupItems;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
@ -48,7 +53,7 @@ class DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE : public DIALOG_SHIM
public:
DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Generate Multichannel Rule Areas"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 548,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Generate Multichannel Rule Areas"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE();

View File

@ -24,9 +24,12 @@
#include <dialogs/dialog_multichannel_repeat_layout.h>
#include <widgets/wx_grid.h>
#include <grid_tricks.h>
#include <pcb_edit_frame.h>
#include <tools/multichannel_tool.h>
#include <zone.h>
#include <board.h>
DIALOG_MULTICHANNEL_REPEAT_LAYOUT::DIALOG_MULTICHANNEL_REPEAT_LAYOUT (
PCB_BASE_FRAME* aFrame,
@ -34,6 +37,7 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT::DIALOG_MULTICHANNEL_REPEAT_LAYOUT (
DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE( aFrame ),
m_parentTool( aParentTool )
{
m_board = aFrame->GetBoard();
auto data = m_parentTool->GetData();
m_refRAName->SetLabelText( data->m_refRA->m_area->GetZoneName() );
@ -63,12 +67,14 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT::DIALOG_MULTICHANNEL_REPEAT_LAYOUT (
int i = 0;
m_raGrid->PushEventHandler( new GRID_TRICKS( static_cast<WX_GRID*>( m_raGrid ) ) );
m_raGrid->ClearGrid();
m_raGrid->EnableEditing( true );
m_raGrid->HideRowLabels();
m_raGrid->SetColLabelValue( 0, wxT("Copy") );
m_raGrid->SetColLabelValue( 1, wxT("Target Rule Area") );
m_raGrid->SetColLabelValue( 2, wxT("Status") );
m_raGrid->SetColLabelValue( 3, wxT( "RefFp" ) );
m_raGrid->AutoSizeColumn( 1 );
m_raGrid->AppendRows( m_targetRAs.size() - 1 );
@ -82,11 +88,22 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT::DIALOG_MULTICHANNEL_REPEAT_LAYOUT (
i++;
}
m_raGrid->SetMaxSize( wxSize( -1, 800 ) );
m_raGrid->SetMaxSize( wxSize( -1, 400 ) );
m_raGrid->Fit();
wxArrayString refFpNames;
refFpNames.push_back( "" );
for( FOOTPRINT* fp : data->m_refRA->m_raFootprints )
refFpNames.push_back( fp->GetReference() );
refFpNames.Sort();
m_refAnchorFp->Set( refFpNames );
m_refAnchorFp->SetSelection( 0 );
m_cbCopyPlacement->SetValue( data->m_options.m_copyPlacement );
m_cbCopyRouting->SetValue( data->m_options.m_copyRouting );
m_cbCopyOnlyConnectedRouting->SetValue( data->m_options.m_connectedRoutingOnly );
m_cbGroupItems->SetValue( data->m_options.m_groupItems );
m_cbCopyOtherItems->SetValue( data->m_options.m_copyOtherItems );
m_cbIncludeLockedComponents->SetValue( data->m_options.m_includeLockedItems );
@ -97,6 +114,10 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT::DIALOG_MULTICHANNEL_REPEAT_LAYOUT (
finishDialogSettings();
}
DIALOG_MULTICHANNEL_REPEAT_LAYOUT::~DIALOG_MULTICHANNEL_REPEAT_LAYOUT()
{
m_raGrid->PopEventHandler( true );
}
bool DIALOG_MULTICHANNEL_REPEAT_LAYOUT::TransferDataFromWindow()
{
@ -112,11 +133,25 @@ bool DIALOG_MULTICHANNEL_REPEAT_LAYOUT::TransferDataFromWindow()
data->m_options.m_copyPlacement = m_cbCopyPlacement->GetValue();
data->m_options.m_copyRouting = m_cbCopyRouting->GetValue();
data->m_options.m_connectedRoutingOnly = m_cbCopyOnlyConnectedRouting->GetValue();
data->m_options.m_copyOtherItems = m_cbCopyOtherItems->GetValue();
data->m_options.m_groupItems = m_cbGroupItems->GetValue();
data->m_options.m_includeLockedItems = m_cbIncludeLockedComponents->GetValue();
data->m_options.m_moveOffRAComponents = m_cbIncludeOffRAComponents->GetValue();
if( m_refAnchorFp->GetString( m_refAnchorFp->GetSelection() ) == "" )
{
data->m_options.m_anchorFp = nullptr;
}
else
{
for( FOOTPRINT* fp : m_board->Footprints() )
{
if( fp->GetReference() == m_refAnchorFp->GetString( m_refAnchorFp->GetSelection() ) )
data->m_options.m_anchorFp = fp;
}
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
#define __DIALOG_MULTICHANNEL_REPEAT_LAYOUT__
#include <vector>
#include <board.h>
#include <widgets/unit_binder.h>
#include <dialogs/dialog_multichannel_repeat_layout_base.h>
@ -39,6 +40,7 @@ public:
DIALOG_MULTICHANNEL_REPEAT_LAYOUT(
PCB_BASE_FRAME* aFrame,
MULTICHANNEL_TOOL* aParentTool );
~DIALOG_MULTICHANNEL_REPEAT_LAYOUT();
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
@ -54,6 +56,7 @@ private:
std::vector<TABLE_ENTRY> m_targetRAs;
MULTICHANNEL_TOOL* m_parentTool;
BOARD* m_board;
};
#endif

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,24 +11,21 @@
DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 800,-1 ), wxDefaultSize );
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
m_GeneralBoxSizer->SetMinSize( wxSize( 800,300 ) );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 1, 0, 0 );
fgSizer3->AddGrowableCol( 0 );
fgSizer3->AddGrowableRow( 2 );
fgSizer3->AddGrowableRow( 1 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer3->SetMinSize( wxSize( 800,300 ) );
fgSizer3->SetMinSize( wxSize( 600,-1 ) );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Target areas:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer3->Add( m_staticText4, 0, wxALL, 5 );
m_raGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_raGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_raGrid->CreateGrid( 1, 3 );
@ -39,8 +36,9 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE(
// Columns
m_raGrid->AutoSizeColumns();
m_raGrid->EnableDragColMove( true );
m_raGrid->EnableDragColMove( false );
m_raGrid->EnableDragColSize( true );
m_raGrid->SetColLabelSize( wxGRID_AUTOSIZE );
m_raGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@ -58,7 +56,7 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE(
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Reference Rule Area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Reference rule area:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizer4->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@ -71,14 +69,44 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE(
fgSizer3->Add( bSizer4, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxHORIZONTAL );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Anchor footprint:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizer41->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxArrayString m_refAnchorFpChoices;
m_refAnchorFp = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_refAnchorFpChoices, 0 );
m_refAnchorFp->SetSelection( 0 );
m_refAnchorFp->SetToolTip( _("Optional, use for precise and/or rotated placement.\nSelect reference rule area footprint, place corresponding\ntarget rule area footprint(s).") );
m_refAnchorFp->SetMaxSize( wxSize( -1,400 ) );
bSizer41->Add( m_refAnchorFp, 0, wxALL, 5 );
fgSizer3->Add( bSizer41, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxVERTICAL );
m_cbCopyPlacement = new wxCheckBox( this, wxID_ANY, _("Copy footprint placement"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer13->Add( m_cbCopyPlacement, 0, wxALL, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_cbCopyRouting = new wxCheckBox( this, wxID_ANY, _("Copy routing"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer13->Add( m_cbCopyRouting, 0, wxALL, 5 );
bSizer5->Add( m_cbCopyRouting, 0, wxALL, 5 );
m_cbCopyOnlyConnectedRouting = new wxCheckBox( this, wxID_ANY, _("Restrict to routing connected within the area"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbCopyOnlyConnectedRouting->SetValue(true);
m_cbCopyOnlyConnectedRouting->SetToolTip( _("Can be useful if unrelated tracks pass through the area") );
bSizer5->Add( m_cbCopyOnlyConnectedRouting, 0, wxALL, 5 );
bSizer13->Add( bSizer5, 1, wxEXPAND, 5 );
m_cbCopyOtherItems = new wxCheckBox( this, wxID_ANY, _("Copy other items"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbCopyOtherItems->SetToolTip( _("Copy text, shapes, zones, and other items inside the source rule area") );
@ -93,7 +121,9 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE(
m_cbGroupItems = new wxCheckBox( this, wxID_ANY, _("Group items with their target rule areas"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer13->Add( m_cbGroupItems, 0, wxALL, 5 );
m_cbIncludeLockedComponents = new wxCheckBox( this, wxID_ANY, _("Remove locked items from target rule areas"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbIncludeLockedComponents = new wxCheckBox( this, wxID_ANY, _("Include locked items"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbIncludeLockedComponents->SetToolTip( _("Copy from reference area + delete / update in target area if included") );
bSizer13->Add( m_cbIncludeLockedComponents, 0, wxALL, 5 );
@ -118,12 +148,9 @@ DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE(
fgSizer3->Add( bottomButtonsSizer, 0, wxEXPAND|wxLEFT, 5 );
m_GeneralBoxSizer->Add( fgSizer3, 1, wxEXPAND, 5 );
this->SetSizer( m_GeneralBoxSizer );
this->SetSizer( fgSizer3 );
this->Layout();
m_GeneralBoxSizer->Fit( this );
fgSizer3->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE::OnInitDlg ) );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -19,6 +19,7 @@
#include <wx/settings.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -31,15 +32,17 @@
class DIALOG_MULTICHANNEL_REPEAT_LAYOUT_BASE : public DIALOG_SHIM
{
private:
wxBoxSizer* m_GeneralBoxSizer;
protected:
wxStaticText* m_staticText4;
wxGrid* m_raGrid;
wxStaticText* m_staticText1;
wxStaticText* m_refRAName;
wxStaticText* m_staticText2;
wxChoice* m_refAnchorFp;
wxCheckBox* m_cbCopyPlacement;
wxCheckBox* m_cbCopyRouting;
wxCheckBox* m_cbCopyOnlyConnectedRouting;
wxCheckBox* m_cbCopyOtherItems;
wxCheckBox* m_cbIncludeOffRAComponents;
wxCheckBox* m_cbGroupItems;

View File

@ -528,7 +528,6 @@ int MULTICHANNEL_TOOL::RepeatLayout( const TOOL_EVENT& aEvent, ZONE* aRefZone )
int totalCopied = 0;
BOARD_COMMIT commit( GetManager(), true );
for( auto& targetArea : m_areas.m_compatMap )
{
if( !targetArea.second.m_doCopy )
@ -541,9 +540,8 @@ int MULTICHANNEL_TOOL::RepeatLayout( const TOOL_EVENT& aEvent, ZONE* aRefZone )
if( !targetArea.second.m_isOk )
continue;
if( !copyRuleAreaContents( targetArea.second.m_matchingComponents, &commit, m_areas.m_refRA,
targetArea.first, m_areas.m_options, targetArea.second.m_affectedItems,
if( !copyRuleAreaContents( targetArea.second.m_matchingComponents, &commit, m_areas.m_refRA, targetArea.first,
m_areas.m_options, targetArea.second.m_affectedItems,
targetArea.second.m_groupableItems ) )
{
auto errMsg = wxString::Format(
@ -561,6 +559,7 @@ int MULTICHANNEL_TOOL::RepeatLayout( const TOOL_EVENT& aEvent, ZONE* aRefZone )
return -1;
}
totalCopied++;
wxSafeYield();
}
if( m_areas.m_options.m_groupItems )
@ -616,44 +615,17 @@ wxString MULTICHANNEL_TOOL::stripComponentIndex( const wxString& aRef ) const
}
int MULTICHANNEL_TOOL::findRoutedConnections( std::set<BOARD_ITEM*>& aOutput,
int MULTICHANNEL_TOOL::findRouting( std::set<BOARD_CONNECTED_ITEM*>& aOutput,
std::shared_ptr<CONNECTIVITY_DATA> aConnectivity,
const SHAPE_POLY_SET& aRAPoly,
RULE_AREA* aRA,
FOOTPRINT* aFp,
const REPEAT_LAYOUT_OPTIONS& aOpts ) const
{
std::set<BOARD_ITEM*> conns;
for( PAD* pad : aFp->Pads() )
{
auto connectedItems = aConnectivity->GetConnectedItems( pad, EXCLUDE_ZONES | IGNORE_NETS );
for( BOARD_CONNECTED_ITEM* item : connectedItems )
conns.insert( item );
}
int count = 0;
for( BOARD_ITEM* item : conns )
{
// fixme: respect layer sets assigned to each RA
if( item->Type() == PCB_PAD_T )
continue;
std::shared_ptr<SHAPE> effShape = item->GetEffectiveShape( item->GetLayer() );
if( effShape->Collide( &aRAPoly, 0 ) )
{
aOutput.insert( item );
count++;
}
}
// The user also will consider tracks and vias that are inside the source area but
// not connected to any of the source pads to count as "routing" (e.g. stitching vias)
int count = 0;
PCBEXPR_COMPILER compiler( new PCBEXPR_UNIT_RESOLVER );
PCBEXPR_UCODE ucode;
PCBEXPR_CONTEXT ctx, preflightCtx;
@ -679,7 +651,7 @@ int MULTICHANNEL_TOOL::findRoutedConnections( std::set<BOARD_ITEM*>&
aRA->m_area->GetZoneName() );
auto testAndAdd =
[&]( BOARD_ITEM* aItem )
[&]( BOARD_CONNECTED_ITEM* aItem )
{
if( aOutput.contains( aItem ) )
return;
@ -707,10 +679,8 @@ int MULTICHANNEL_TOOL::findRoutedConnections( std::set<BOARD_ITEM*>&
}
bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatches,
BOARD_COMMIT* aCommit,
RULE_AREA* aRefArea, RULE_AREA* aTargetArea,
REPEAT_LAYOUT_OPTIONS aOpts,
bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatches, BOARD_COMMIT* aCommit,
RULE_AREA* aRefArea, RULE_AREA* aTargetArea, REPEAT_LAYOUT_OPTIONS aOpts,
std::unordered_set<BOARD_ITEM*>& aAffectedItems,
std::unordered_set<BOARD_ITEM*>& aGroupableItems )
{
@ -718,7 +688,28 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
SHAPE_LINE_CHAIN refOutline = aRefArea->m_area->Outline()->COutline( 0 );
SHAPE_LINE_CHAIN targetOutline = aTargetArea->m_area->Outline()->COutline( 0 );
FOOTPRINT* targetAnchorFp = nullptr;
VECTOR2I disp = aTargetArea->m_center - aRefArea->m_center;
EDA_ANGLE rot = EDA_ANGLE( 0 );
if( aOpts.m_anchorFp )
{
for( auto& fpPair : aMatches )
{
if( fpPair.first->GetReference() == aOpts.m_anchorFp->GetReference() )
targetAnchorFp = fpPair.second;
}
if( targetAnchorFp )
{
VECTOR2I oldpos = aOpts.m_anchorFp->GetPosition();
rot = EDA_ANGLE( targetAnchorFp->GetOrientationDegrees() - aOpts.m_anchorFp->GetOrientationDegrees() );
aOpts.m_anchorFp->Rotate( VECTOR2( 0, 0 ), EDA_ANGLE( rot ) );
oldpos = aOpts.m_anchorFp->GetPosition();
VECTOR2I newpos = targetAnchorFp->GetPosition();
disp = newpos - oldpos;
aOpts.m_anchorFp->Rotate( VECTOR2( 0, 0 ), EDA_ANGLE( -rot ) );
}
}
SHAPE_POLY_SET refPoly;
refPoly.AddOutline( refOutline );
@ -727,6 +718,7 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
SHAPE_POLY_SET targetPoly;
SHAPE_LINE_CHAIN newTargetOutline( refOutline );
newTargetOutline.Rotate( rot, VECTOR2( 0, 0 ) );
newTargetOutline.Move( disp );
targetPoly.AddOutline( newTargetOutline );
targetPoly.CacheTriangulation( false );
@ -740,26 +732,32 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
if( aOpts.m_copyRouting )
{
std::set<BOARD_ITEM*> refRouting;
std::set<BOARD_ITEM*> targetRouting;
std::set<BOARD_CONNECTED_ITEM*> refRouting;
std::set<BOARD_CONNECTED_ITEM*> targetRouting;
wxLogTrace( traceMultichannelTool, wxT("copying routing: %d fps\n"), (int) aMatches.size() );
std::set<int> refc;
std::set<int> targc;
for( auto& fpPair : aMatches )
{
findRoutedConnections( targetRouting, connectivity, targetPoly, aTargetArea,
fpPair.second, aOpts );
findRoutedConnections( refRouting, connectivity, refPoly, aRefArea, fpPair.first,
aOpts );
for( PAD* pad : fpPair.first->Pads() )
refc.insert( pad->GetNetCode() );
wxLogTrace( traceMultichannelTool, wxT("target-routes %d\n"), (int) targetRouting.size() );
for( PAD* pad : fpPair.second->Pads() )
targc.insert( pad->GetNetCode() );
}
for( BOARD_ITEM* item : targetRouting )
findRouting( targetRouting, connectivity, targetPoly, aTargetArea, aOpts );
findRouting( refRouting, connectivity, refPoly, aRefArea, aOpts );
for( BOARD_CONNECTED_ITEM* item : targetRouting )
{
if( item->IsLocked() && !aOpts.m_includeLockedItems )
continue;
if( aOpts.m_connectedRoutingOnly && !targc.contains( item->GetNetCode() ) )
continue;
// item already removed
if( aCommit->GetStatus( item ) != 0 )
continue;
@ -771,21 +769,23 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
}
}
for( BOARD_ITEM* item : refRouting )
for( BOARD_CONNECTED_ITEM* item : refRouting )
{
if( item->IsLocked() && !aOpts.m_includeLockedItems )
continue;
if( aOpts.m_connectedRoutingOnly && !refc.contains( item->GetNetCode() ) )
continue;
if( !aRefArea->m_area->GetLayerSet().Contains( item->GetLayer() ) )
continue;
if( !aTargetArea->m_area->GetLayerSet().Contains( item->GetLayer() ) )
continue;
BOARD_ITEM* copied = static_cast<BOARD_ITEM*>( item->Clone() );
BOARD_CONNECTED_ITEM* copied = static_cast<BOARD_CONNECTED_ITEM*>( item->Clone() );
if( item->Type() == PCB_VIA_T )
{
fixupNet( static_cast<BOARD_CONNECTED_ITEM*>( item ), static_cast<BOARD_CONNECTED_ITEM*>( copied ),
aMatches );
}
fixupNet( item, copied, aMatches );
copied->Rotate( VECTOR2( 0, 0 ), rot );
copied->Move( disp );
copied->SetParentGroup( nullptr );
const_cast<KIID&>( copied->m_Uuid ) = KIID();
@ -851,6 +851,9 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
&& item->GetParent()->Type() == PCB_FOOTPRINT_T )
continue;
if( item->IsLocked() && !aOpts.m_includeLockedItems )
continue;
BOARD_ITEM* copied = nullptr;
if( item->Type() != PCB_ZONE_T )
@ -900,6 +903,7 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
copied->ClearFlags();
copied->SetParentGroup( nullptr );
const_cast<KIID&>( copied->m_Uuid ) = KIID();
copied->Rotate( VECTOR2( 0, 0 ), rot );
copied->Move( disp );
aGroupableItems.insert( copied );
aCommit->Add( copied );
@ -907,11 +911,6 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
}
}
aTargetArea->m_area->RemoveAllContours();
aTargetArea->m_area->AddPolygon( newTargetOutline );
aTargetArea->m_area->UnHatchBorder();
aTargetArea->m_area->HatchBorder();
if( aOpts.m_copyPlacement )
{
for( auto& fpPair : aMatches )
@ -943,9 +942,9 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
targetFP->SetLayerAndFlip( refFP->GetLayer() );
targetFP->SetOrientation( refFP->GetOrientation() );
VECTOR2I targetPos = refFP->GetPosition() + disp;
targetFP->SetPosition( targetPos );
targetFP->SetPosition( refFP->GetPosition() );
targetFP->Rotate( VECTOR2( 0, 0 ), rot );
targetFP->Move( disp );
for( PCB_FIELD* refField : refFP->GetFields() )
{
if( !refField->IsVisible() )
@ -955,7 +954,9 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
wxCHECK2( targetField, continue );
targetField->SetAttributes( refField->GetAttributes() );
targetField->SetPosition( refField->GetPosition() + disp );
targetField->SetPosition( refField->GetPosition() );
targetField->Rotate( VECTOR2( 0, 0 ), rot );
targetField->Move( disp );
targetField->SetIsKnockout( refField->IsKnockout() );
}
@ -964,11 +965,16 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
}
}
aTargetArea->m_area->RemoveAllContours();
aTargetArea->m_area->AddPolygon( newTargetOutline );
aTargetArea->m_area->UnHatchBorder();
aTargetArea->m_area->HatchBorder();
return true;
}
/**
* @brief Attempts to modify the assigned net of copied items, especially intended for zones and vias
* @brief Attempts to make sure copied items are assigned the right net
*
*/
void MULTICHANNEL_TOOL::fixupNet( BOARD_CONNECTED_ITEM* aRef, BOARD_CONNECTED_ITEM* aTarget,

View File

@ -48,6 +48,7 @@ enum class REPEAT_LAYOUT_EDGE_MODE
struct REPEAT_LAYOUT_OPTIONS
{
bool m_copyRouting = true;
bool m_connectedRoutingOnly = false;
bool m_copyPlacement = true;
bool m_copyOtherItems = true;
bool m_groupItems = false;
@ -55,6 +56,7 @@ struct REPEAT_LAYOUT_OPTIONS
bool m_includeLockedItems = true;
bool m_keepOldRouting = false;
bool m_copyOnlyMatchingRAShapes = false;
FOOTPRINT* m_anchorFp = nullptr;
REPEAT_LAYOUT_EDGE_MODE m_edgeMode = REPEAT_LAYOUT_EDGE_MODE::INSIDE;
};
@ -144,9 +146,8 @@ private:
bool copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatches, BOARD_COMMIT* aCommit, RULE_AREA* aRefArea,
RULE_AREA* aTargetArea, REPEAT_LAYOUT_OPTIONS aOpts, std::unordered_set<BOARD_ITEM*>& aAffectedItems,
std::unordered_set<BOARD_ITEM*>& aGroupableItems );
int findRoutedConnections( std::set<BOARD_ITEM*>& aOutput,
std::shared_ptr<CONNECTIVITY_DATA> aConnectivity,
const SHAPE_POLY_SET& aRAPoly, RULE_AREA* aRA, FOOTPRINT* aFp,
int findRouting( std::set<BOARD_CONNECTED_ITEM*>& aOutput, std::shared_ptr<CONNECTIVITY_DATA> aConnectivity,
const SHAPE_POLY_SET& aRAPoly, RULE_AREA* aRA,
const REPEAT_LAYOUT_OPTIONS& aOpts ) const;
void fixupNet( BOARD_CONNECTED_ITEM* aRef, BOARD_CONNECTED_ITEM* aTarget,
TMATCH::COMPONENT_MATCHES& aComponentMatches );