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 (C) 2021-2022 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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef ZONE_FILLER_TOOL_H
28#define ZONE_FILLER_TOOL_H
29
30#include <tools/pcb_tool_base.h>
31#include <zone.h>
32
33
34class PCB_EDIT_FRAME;
37class ZONE_FILLER;
38
39
44{
45public:
48
50 void Reset( RESET_REASON aReason ) override;
51
52 void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
53 void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
54
55 int ZoneFill( const TOOL_EVENT& aEvent );
56 int ZoneFillAll( const TOOL_EVENT& aEvent );
57 int ZoneFillDirty( const TOOL_EVENT& aEvent );
58 int ZoneUnfill( const TOOL_EVENT& aEvent );
59 int ZoneUnfillAll( const TOOL_EVENT& aEvent );
60
61 bool IsBusy() { return m_fillInProgress; }
62
64
65 void DirtyZone( ZONE* aZone )
66 {
67 m_dirtyZoneIDs.insert( aZone->m_Uuid );
68 }
69
70 static bool IsZoneFillAction( const TOOL_EVENT* aEvent );
71
72private:
74 void singleShotRefocus( wxIdleEvent& );
75
77 void refresh();
78
80 void setTransitions() override;
81
82private:
83 std::unique_ptr<ZONE_FILLER> m_filler;
85
86 std::set<KIID> m_dirtyZoneIDs;
87};
88
89#endif
const KIID m_Uuid
Definition: eda_item.h:485
The main frame for Pcbnew.
A progress reporter interface for use in multi-threaded environments.
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
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...
Handle actions specific to filling copper zones.
void CheckAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr)
static bool IsZoneFillAction(const TOOL_EVENT *aEvent)
void DirtyZone(ZONE *aZone)
void FillAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr)
int ZoneFill(const TOOL_EVENT &aEvent)
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)
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
void Reset() override