KiCad PCB EDA Suite
Loading...
Searching...
No Matches
zone_filler_tool.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef ZONE_FILLER_TOOL_H
24#define ZONE_FILLER_TOOL_H
25
26#include <tools/pcb_tool_base.h>
27#include <zone.h>
28
29
30class PCB_EDIT_FRAME;
33class ZONE_FILLER;
34
35#define ZONE_FILLER_TOOL_NAME "pcbnew.ZoneFiller"
36
41{
42public:
45
47 void Reset( RESET_REASON aReason ) override;
48
49 void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
50 void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr, bool aHeadless = false );
51
52 int ZoneFill( const TOOL_EVENT& aEvent );
53 int ZoneFillAll( const TOOL_EVENT& aEvent );
54 int ZoneFillDirty( const TOOL_EVENT& aEvent );
55 int ZoneUnfill( const TOOL_EVENT& aEvent );
56 int ZoneUnfillAll( const TOOL_EVENT& aEvent );
57
58 bool IsBusy() { return m_fillInProgress; }
59
61
62 void DirtyZone( ZONE* aZone )
63 {
64 m_dirtyZoneIDs.insert( aZone->m_Uuid );
65 }
66
67 static bool IsZoneFillAction( const TOOL_EVENT* aEvent );
68
69private:
71 void singleShotRefocus( wxIdleEvent& );
72
73 void rebuildConnectivity( bool aHeadless = false );
74 void refresh();
75
77 void setTransitions() override;
78
79private:
80 std::unique_ptr<ZONE_FILLER> m_filler;
82
83 std::set<KIID> m_dirtyZoneIDs;
84};
85
86#endif
const KIID m_Uuid
Definition eda_item.h:531
The main frame for Pcbnew.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
A progress reporter interface for use in multi-threaded environments.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void CheckAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr)
static bool IsZoneFillAction(const TOOL_EVENT *aEvent)
void DirtyZone(ZONE *aZone)
int ZoneFill(const TOOL_EVENT &aEvent)
void FillAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr, bool aHeadless=false)
std::unique_ptr< ZONE_FILLER > m_filler
PROGRESS_REPORTER * GetProgressReporter()
int ZoneUnfillAll(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
void refresh()
Set up handlers for various events.
std::set< KIID > m_dirtyZoneIDs
int ZoneFillAll(const TOOL_EVENT &aEvent)
int ZoneFillDirty(const TOOL_EVENT &aEvent)
void singleShotRefocus(wxIdleEvent &)
< Refocus on an idle event (used after the Progress Reporter messes up the focus).
int ZoneUnfill(const TOOL_EVENT &aEvent)
void rebuildConnectivity(bool aHeadless=false)
Handle a list of polygons defining a copper zone.
Definition zone.h:70
void Reset() override