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, 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#define ZONE_FILLER_TOOL_NAME "pcbnew.ZoneFiller"
40
45{
46public:
49
51 void Reset( RESET_REASON aReason ) override;
52
53 void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
54 void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr, bool aHeadless = false );
55
56 int ZoneFill( const TOOL_EVENT& aEvent );
57 int ZoneFillAll( const TOOL_EVENT& aEvent );
58 int ZoneFillDirty( const TOOL_EVENT& aEvent );
59 int ZoneUnfill( const TOOL_EVENT& aEvent );
60 int ZoneUnfillAll( const TOOL_EVENT& aEvent );
61
62 bool IsBusy() { return m_fillInProgress; }
63
65
66 void DirtyZone( ZONE* aZone )
67 {
68 m_dirtyZoneIDs.insert( aZone->m_Uuid );
69 }
70
71 static bool IsZoneFillAction( const TOOL_EVENT* aEvent );
72
73private:
75 void singleShotRefocus( wxIdleEvent& );
76
77 void rebuildConnectivity( bool aHeadless = false );
78 void refresh();
79
81 void setTransitions() override;
82
83private:
84 std::unique_ptr<ZONE_FILLER> m_filler;
86
87 std::set<KIID> m_dirtyZoneIDs;
88};
89
90#endif
const KIID m_Uuid
Definition: eda_item.h:516
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:168
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)
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:74
void Reset() override