36#include <wx/hyperlink.h>
67 std::vector<PCB_GENERATOR*> regenerated;
72 if( !brd || !genTool )
80 gen->EditStart( genTool, brd, &aCommit );
81 gen->Update( genTool, brd, &aCommit );
82 gen->EditFinish( genTool, brd, &aCommit );
83 regenerated.push_back( gen );
92 if( aRegenerated.empty() )
102 std::set<ZONE*> uniqueZones;
106 std::vector<ZONE*> zones = gen->GetZonesNeedingRefillAfterUpdate();
108 for(
ZONE* zone : zones )
109 uniqueZones.insert( zone );
112 if( uniqueZones.empty() )
115 std::vector<ZONE*> toRefill( uniqueZones.begin(), uniqueZones.end() );
122 if( refiller.
Fill( toRefill ) )
136 std::vector<ZONE*> toFill;
139 toFill.push_back( zone );
142 std::unique_ptr<WX_PROGRESS_REPORTER>
reporter;
144 m_filler = std::make_unique<ZONE_FILLER>(
frame()->GetBoard(), &commit );
148 m_filler->SetProgressReporter( aReporter );
156 if(
m_filler->Fill( toFill,
true, aCaller ) )
192 std::unique_ptr<WX_PROGRESS_REPORTER>
reporter;
194 std::vector<ZONE*> toFill;
201 toFill.push_back( zone );
203 m_filler = std::make_unique<ZONE_FILLER>(
board(), &commit );
205 if( !aHeadless && !
board()->GetDesignSettings().m_DRCEngine->RulesValid() )
210 infobar->
AddLink(
_(
"Show DRC rules" ),
211 [
frame]( wxHyperlinkEvent& aEvent )
213 frame->ShowBoardSetupDialog(
_(
"Rules" ) );
216 infobar->
ShowMessageFor(
_(
"Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
222 m_filler->SetProgressReporter( aReporter );
224 else if( !aHeadless )
226 reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller,
_(
"Fill All Zones" ), 5,
PR_CAN_ABORT );
232 if(
m_filler->GetProgressReporter() )
233 m_filler->GetProgressReporter()->AdvancePhase();
242 frame->m_ZoneFillsDirty =
false;
254 if( !aHeadless &&
m_filler->IsDebug() )
255 frame->UpdateUserInterface();
270 std::vector<ZONE*> toFill;
275 toFill.push_back( zone );
292 std::unique_ptr<WX_PROGRESS_REPORTER>
reporter;
295 m_filler = std::make_unique<ZONE_FILLER>(
board(), &commit );
297 if( !
board()->GetDesignSettings().m_DRCEngine->RulesValid() )
303 infobar->
AddLink(
_(
"Show DRC rules" ),
304 [
frame]( wxHyperlinkEvent& aLocEvent )
306 frame->ShowBoardSetupDialog(
_(
"Rules" ) );
309 infobar->
ShowMessageFor(
_(
"Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
313 for(
ZONE* zone : toFill )
315 zone->GetLayerSet().RunOnLayers(
318 pts += zone->GetFilledPolysList( layer )->FullPointCount();
323 wxString title = wxString::Format(
_(
"Refill %d Zones" ), (
int) toFill.size() );
331 bool filled =
m_filler->Fill( toFill );
332 std::vector<PCB_GENERATOR*> regenerated;
357 infobar->
AddLink(
_(
"Open Preferences" ),
358 [
this]( wxHyperlinkEvent& )
363 infobar->
ShowMessageFor(
_(
"Automatic refill of zones can be turned off in Preferences if it becomes "
365 10000, wxICON_INFORMATION, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
369 frame->UpdateUserInterface();
390 std::vector<ZONE*> toFill;
394 toFill.push_back( passedZone );
405 if(
ZONE* zone =
dynamic_cast<ZONE*
>( item ) )
406 toFill.push_back( zone );
420 std::unique_ptr<WX_PROGRESS_REPORTER>
reporter;
422 m_filler = std::make_unique<ZONE_FILLER>(
board(), &commit );
459 std::vector<ZONE*> toUnfill;
463 if(
ZONE* zone =
dynamic_cast<ZONE*
>( item ) )
464 toUnfill.push_back( zone );
468 if( toUnfill.empty() )
476 for(
ZONE* zone : toUnfill )
513 return m_filler->GetProgressReporter();
546 return via->GetRemoveUnconnected();
548 else if(
PAD*
pad =
dynamic_cast<PAD*
>( aItem ) )
550 return pad->GetRemoveUnconnected();
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
Information pertinent to a Pcbnew printed circuit board.
const GENERATORS & Generators() const
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void IncrementTimeStamp()
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
static const TOOL_EVENT ConnectivityChangedEvent
Selected item had a property changed (except movement)
Used when the right click button is pressed, or when the select tool is in effect.
An abstract base class for deriving all objects that can be added to a VIEW.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
static TOOL_ACTION zoneFillAll
static TOOL_ACTION zoneFill
static TOOL_ACTION zoneUnfill
static TOOL_ACTION zoneUnfillAll
static TOOL_ACTION zoneFillDirty
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
The main frame for Pcbnew.
A progress reporter interface for use in multi-threaded environments.
TEARDROP_MANAGER manage and build teardrop areas A teardrop area is a polygonal area (a copper ZONE) ...
void UpdateTeardrops(BOARD_COMMIT &aCommit, const std::vector< BOARD_ITEM * > *dirtyPadsAndVias, const std::set< PCB_TRACK * > *dirtyTracks, bool aForceFullUpdate=false)
Update teardrops on a list of items.
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.
bool Fill(const std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Fills the given list of zones.
Handle a list of polygons defining a copper zone.
PCB_LAYER_ID
A quick note on layer IDs:
@ ALL
All except INITIAL_ADD.
Class to handle a set of BOARD_ITEMs.
int64_t GetRunningMicroSecs()
An alternate way to calculate an elapsed time (in microsecondes) to class PROF_COUNTER.
#define SKIP_CONNECTIVITY
IbisParser parser & reporter
VECTOR2< int32_t > VECTOR2I