Replace single zone fill under "draft" terminology.
Also sets Autofill Zones to default to on.
This commit is contained in:
parent
4039b7da6b
commit
b6bd74d822
|
@ -882,6 +882,8 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::zoneFill, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::zoneUnfill, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( cond.Get45degMode() ) );
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
&m_Use45DegreeLimit, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.auto_fill_zones",
|
||||
&m_AutoRefillZones, false ) );
|
||||
&m_AutoRefillZones, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.allow_free_pads",
|
||||
&m_AllowFreePads, false ) );
|
||||
|
|
|
@ -85,7 +85,9 @@ public:
|
|||
SetIcon( BITMAPS::add_zone );
|
||||
SetTitle( _( "Zones" ) );
|
||||
|
||||
Add( PCB_ACTIONS::zoneFill );
|
||||
Add( PCB_ACTIONS::zoneFillAll );
|
||||
Add( PCB_ACTIONS::zoneUnfill );
|
||||
Add( PCB_ACTIONS::zoneUnfillAll );
|
||||
|
||||
AppendSeparator();
|
||||
|
@ -188,10 +190,10 @@ bool BOARD_EDITOR_CONTROL::Init()
|
|||
// Finally, add the standard zoom & grid items
|
||||
getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
|
||||
|
||||
auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
|
||||
std::shared_ptr<ZONE_CONTEXT_MENU> zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
|
||||
zoneMenu->SetTool( this );
|
||||
|
||||
auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
|
||||
std::shared_ptr<LOCK_CONTEXT_MENU> lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
|
||||
lockMenu->SetTool( this );
|
||||
|
||||
// Add the PCB control menus to relevant other tools
|
||||
|
@ -212,7 +214,7 @@ bool BOARD_EDITOR_CONTROL::Init()
|
|||
|
||||
menu.AddMenu( lockMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
|
||||
|
||||
menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } ), 200 );
|
||||
menu.AddMenu( zoneMenu.get(), SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } ), 100 );
|
||||
}
|
||||
|
||||
DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();
|
||||
|
@ -235,7 +237,7 @@ bool BOARD_EDITOR_CONTROL::Init()
|
|||
};
|
||||
};
|
||||
|
||||
menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 200 );
|
||||
menu.AddMenu( zoneMenu.get(), toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ), 300 );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1369,6 +1369,12 @@ TOOL_ACTION PCB_ACTIONS::filterSelection( "pcbnew.InteractiveSelection.FilterSel
|
|||
|
||||
// ZONE_FILLER_TOOL
|
||||
//
|
||||
TOOL_ACTION PCB_ACTIONS::zoneFill( "pcbnew.ZoneFiller.zoneFill",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Draft Fill Selected Zone(s)" ),
|
||||
_( "Update copper fill of selected zone(s) without regard to other interacting zones" ),
|
||||
BITMAPS::fill_zone );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::zoneFillAll( "pcbnew.ZoneFiller.zoneFillAll",
|
||||
AS_GLOBAL,
|
||||
'B', LEGACY_HK_NAME( "Fill or Refill All Zones" ),
|
||||
|
@ -1378,6 +1384,11 @@ TOOL_ACTION PCB_ACTIONS::zoneFillAll( "pcbnew.ZoneFiller.zoneFillAll",
|
|||
TOOL_ACTION PCB_ACTIONS::zoneFillDirty( "pcbnew.ZoneFiller.zoneFillDirty",
|
||||
AS_CONTEXT );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::zoneUnfill( "pcbnew.ZoneFiller.zoneUnfill",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Unfill Selected Zone(s)" ), _( "Remove copper fill from selected zone(s)" ),
|
||||
BITMAPS::zone_unfill );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::zoneUnfillAll( "pcbnew.ZoneFiller.zoneUnfillAll",
|
||||
AS_GLOBAL,
|
||||
MD_CTRL + 'B', LEGACY_HK_NAME( "Remove Filled Areas in All Zones" ),
|
||||
|
|
|
@ -336,8 +336,10 @@ public:
|
|||
static TOOL_ACTION assignNetClass;
|
||||
|
||||
// Zone actions
|
||||
static TOOL_ACTION zoneFill;
|
||||
static TOOL_ACTION zoneFillAll;
|
||||
static TOOL_ACTION zoneFillDirty;
|
||||
static TOOL_ACTION zoneUnfill;
|
||||
static TOOL_ACTION zoneUnfillAll;
|
||||
static TOOL_ACTION zoneMerge;
|
||||
|
||||
|
|
|
@ -276,6 +276,58 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( m_fillInProgress )
|
||||
{
|
||||
wxBell();
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_fillInProgress = true;
|
||||
|
||||
std::vector<ZONE*> toFill;
|
||||
|
||||
if( ZONE* passedZone = aEvent.Parameter<ZONE*>() )
|
||||
{
|
||||
toFill.push_back( passedZone );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( EDA_ITEM* item : selection() )
|
||||
{
|
||||
if( ZONE* zone = dynamic_cast<ZONE*>( item ) )
|
||||
toFill.push_back( zone );
|
||||
}
|
||||
}
|
||||
|
||||
BOARD_COMMIT commit( this );
|
||||
std::unique_ptr<WX_PROGRESS_REPORTER> reporter;
|
||||
ZONE_FILLER filler( board(), &commit );
|
||||
|
||||
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Fill Zone" ), 5 );
|
||||
filler.SetProgressReporter( reporter.get() );
|
||||
|
||||
if( filler.Fill( toFill ) )
|
||||
{
|
||||
reporter->AdvancePhase();
|
||||
commit.Push( _( "Fill Zone(s)" ), SKIP_CONNECTIVITY | ZONE_FILL_OP );
|
||||
}
|
||||
else
|
||||
{
|
||||
commit.Revert();
|
||||
}
|
||||
|
||||
board()->BuildConnectivity( reporter.get() );
|
||||
m_toolMgr->PostEvent( EVENTS::ConnectivityChangedEvent );
|
||||
|
||||
refresh();
|
||||
|
||||
m_fillInProgress = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int ZONE_FILLER_TOOL::ZoneFillAll( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
FillAllZones( frame() );
|
||||
|
@ -283,6 +335,29 @@ int ZONE_FILLER_TOOL::ZoneFillAll( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
BOARD_COMMIT commit( this );
|
||||
|
||||
for( EDA_ITEM* item : selection() )
|
||||
{
|
||||
assert( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T );
|
||||
|
||||
ZONE* zone = static_cast<ZONE*>( item );
|
||||
|
||||
commit.Modify( zone );
|
||||
|
||||
zone->UnFill();
|
||||
}
|
||||
|
||||
commit.Push( _( "Unfill Zone" ), ZONE_FILL_OP );
|
||||
|
||||
refresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int ZONE_FILLER_TOOL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
BOARD_COMMIT commit( this );
|
||||
|
@ -334,7 +409,9 @@ bool ZONE_FILLER_TOOL::IsZoneFillAction( const TOOL_EVENT* aEvent )
|
|||
void ZONE_FILLER_TOOL::setTransitions()
|
||||
{
|
||||
// Zone actions
|
||||
Go( &ZONE_FILLER_TOOL::ZoneFill, PCB_ACTIONS::zoneFill.MakeEvent() );
|
||||
Go( &ZONE_FILLER_TOOL::ZoneFillAll, PCB_ACTIONS::zoneFillAll.MakeEvent() );
|
||||
Go( &ZONE_FILLER_TOOL::ZoneFillDirty, PCB_ACTIONS::zoneFillDirty.MakeEvent() );
|
||||
Go( &ZONE_FILLER_TOOL::ZoneUnfill, PCB_ACTIONS::zoneUnfill.MakeEvent() );
|
||||
Go( &ZONE_FILLER_TOOL::ZoneUnfillAll, PCB_ACTIONS::zoneUnfillAll.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -51,8 +51,10 @@ public:
|
|||
void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
|
||||
void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
|
||||
|
||||
int ZoneFill( const TOOL_EVENT& aEvent );
|
||||
int ZoneFillAll( const TOOL_EVENT& aEvent );
|
||||
int ZoneFillDirty( const TOOL_EVENT& aEvent );
|
||||
int ZoneUnfill( const TOOL_EVENT& aEvent );
|
||||
int ZoneUnfillAll( const TOOL_EVENT& aEvent );
|
||||
|
||||
bool IsBusy() { return m_fillInProgress; }
|
||||
|
|
Loading…
Reference in New Issue