2020-08-13 23:09:17 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee.org>
|
2021-01-27 22:15:38 +00:00
|
|
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PCB_EDITOR_CONDITIONS_H_
|
|
|
|
#define PCB_EDITOR_CONDITIONS_H_
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <tool/editor_conditions.h>
|
|
|
|
#include <tool/selection.h>
|
|
|
|
#include <tool/tool_action.h>
|
|
|
|
|
2021-06-06 17:26:26 +00:00
|
|
|
#include <pcb_base_frame.h>
|
|
|
|
|
2020-08-13 23:09:17 +00:00
|
|
|
class EDA_BASE_FRAME;
|
|
|
|
class EDA_DRAW_FRAME;
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Group generic conditions for PCB editor states.
|
2020-08-13 23:09:17 +00:00
|
|
|
*/
|
|
|
|
class PCB_EDITOR_CONDITIONS : public EDITOR_CONDITIONS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PCB_EDITOR_CONDITIONS( PCB_BASE_FRAME* aFrame ) :
|
|
|
|
EDITOR_CONDITIONS( aFrame )
|
|
|
|
{}
|
|
|
|
|
2020-08-19 22:15:44 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if there are items in the board
|
2020-08-19 22:15:44 +00:00
|
|
|
*
|
2021-06-09 19:32:58 +00:00
|
|
|
* @return Functor returning true if the current board has items
|
2020-08-19 22:15:44 +00:00
|
|
|
*/
|
|
|
|
SELECTION_CONDITION HasItems();
|
|
|
|
|
2020-08-13 23:09:17 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if the pad numbers are displayed
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if the pad numbers are displayed
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION PadNumbersDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if the frame fills the pads
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if the pads are filled
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION PadFillDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if the frame fills text items
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if the text items are filled
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION TextFillDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if the frame fills graphics items
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if graphics items are filled
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION GraphicsFillDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if the frame fills vias
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if vias are filled
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION ViaFillDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-02-05 23:43:32 +00:00
|
|
|
* Create a functor that tests if the frame fills tracks
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @return Functor returning true if tracks are filled
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION TrackFillDisplay();
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests the current zone display mode in the frame
|
2020-08-13 23:09:17 +00:00
|
|
|
*
|
|
|
|
* @param aMode is the mode to test for
|
|
|
|
* @return Functor returning true if the frame is using the specified mode
|
|
|
|
*/
|
|
|
|
SELECTION_CONDITION ZoneDisplayMode( ZONE_DISPLAY_MODE aMode );
|
|
|
|
|
2021-02-05 23:43:32 +00:00
|
|
|
/**
|
2021-09-02 22:32:15 +00:00
|
|
|
* Create a functor that tests whether only 45 degree lines should be allowed
|
2021-02-05 23:43:32 +00:00
|
|
|
*
|
2021-09-02 22:32:15 +00:00
|
|
|
* @return Functor returning true if only 45 degree lines should be allowed
|
2021-02-05 23:43:32 +00:00
|
|
|
*/
|
2021-09-02 22:32:15 +00:00
|
|
|
SELECTION_CONDITION Get45degMode();
|
2021-02-05 23:43:32 +00:00
|
|
|
|
2020-08-13 23:09:17 +00:00
|
|
|
protected:
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by HasItems()
|
2020-08-19 22:15:44 +00:00
|
|
|
static bool hasItemsFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by PadNumbersDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by PadFillDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool padFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by TextFillDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool textFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by GraphicsFillDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool graphicsFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by ViaFillDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool viaFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by TrackFillDisplay()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool trackFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by ZoneDisplayMode()
|
2020-08-13 23:09:17 +00:00
|
|
|
static bool zoneDisplayModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame,
|
|
|
|
ZONE_DISPLAY_MODE aMode );
|
2021-02-05 23:43:32 +00:00
|
|
|
|
|
|
|
///< Helper function used by Line45degMode()
|
2021-09-02 22:32:15 +00:00
|
|
|
static bool get45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
2020-08-13 23:09:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PCB_EDITOR_CONDITIONS_H_ */
|