KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
pcb_editor_conditions.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) 2020 Ian McInerney <ian.s.mcinerney at ieee.org>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef PCB_EDITOR_CONDITIONS_H_
26#define PCB_EDITOR_CONDITIONS_H_
27
28#include <functional>
30#include <tool/selection.h>
31#include <tool/tool_action.h>
32
33#include <pcb_base_frame.h>
34
35class EDA_BASE_FRAME;
36class EDA_DRAW_FRAME;
37
42{
43public:
45 EDITOR_CONDITIONS( aFrame )
46 {}
47
54
61
68
75
82
89
96
104
111
118
119protected:
121 static bool hasItemsFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
122
124 static bool padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
125
127 static bool padFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
128
130 static bool textFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
131
133 static bool graphicsFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
134
136 static bool viaFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
137
139 static bool trackFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
140
142 static bool zoneDisplayModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame,
143 ZONE_DISPLAY_MODE aMode );
144
146 static bool get45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
147
149 static bool footprintViewerAutoZoom( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
150};
151
152#endif /* PCB_EDITOR_CONDITIONS_H_ */
The base frame for deriving all KiCad main window classes.
The base class for create windows for drawing purpose.
Class that groups generic conditions for editor states.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Group generic conditions for PCB editor states.
static bool hasItemsFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
< Helper function used by HasItems()
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
static bool padNumberDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by PadFillDisplay()
SELECTION_CONDITION TrackFillDisplay()
Create a functor that tests if the frame fills tracks.
static bool padFillDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by TextFillDisplay()
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
static bool graphicsFillDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by ViaFillDisplay()
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
static bool zoneDisplayModeFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame, ZONE_DISPLAY_MODE aMode)
Helper function used by Line45degMode()
static bool get45degModeFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
SELECTION_CONDITION ZoneDisplayMode(ZONE_DISPLAY_MODE aMode)
Create a functor that tests the current zone display mode in the frame.
SELECTION_CONDITION FootprintViewerAutoZoom()
Create a functor that tests if the footprint viewer should auto zoom on new footprints.
static bool textFillDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by GraphicsFillDisplay()
static bool footprintViewerAutoZoom(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by FootprintViewerAutoZoom()
static bool viaFillDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by TrackFillDisplay()
SELECTION_CONDITION ViaFillDisplay()
Create a functor that tests if the frame fills vias.
PCB_EDITOR_CONDITIONS(PCB_BASE_FRAME *aFrame)
static bool trackFillDisplayFunc(const SELECTION &aSelection, PCB_BASE_FRAME *aFrame)
Helper function used by ZoneDisplayMode()
SELECTION_CONDITION Get45degMode()
Create a functor that tests whether only 45 degree lines should be allowed.
SELECTION_CONDITION PadNumbersDisplay()
Create a functor that tests if the pad numbers are displayed.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.