Browse Source
Migrate Pcbnew/footprint viewer/footprint editor to the new UI update system
pull/16/head
Migrate Pcbnew/footprint viewer/footprint editor to the new UI update system
pull/16/head
23 changed files with 1040 additions and 751 deletions
-
1common/CMakeLists.txt
-
10common/tool/action_toolbar.cpp
-
12common/tool/editor_conditions.cpp
-
12common/tool/selection_conditions.cpp
-
38cvpcb/display_footprints_frame.cpp
-
6include/tool/action_toolbar.h
-
12include/tool/editor_conditions.h
-
5include/tool/selection_conditions.h
-
107pcbnew/footprint_edit_frame.cpp
-
6pcbnew/footprint_edit_frame.h
-
49pcbnew/footprint_viewer_frame.cpp
-
6pcbnew/footprint_viewer_frame.h
-
300pcbnew/menubar_footprint_editor.cpp
-
487pcbnew/menubar_pcb_editor.cpp
-
206pcbnew/pcb_edit_frame.cpp
-
6pcbnew/pcb_edit_frame.h
-
1pcbnew/pcbnew.cpp
-
2pcbnew/swig/python_scripting.h
-
70pcbnew/toolbars_footprint_editor.cpp
-
44pcbnew/toolbars_footprint_viewer.cpp
-
136pcbnew/toolbars_pcb_editor.cpp
-
153pcbnew/tools/pcb_editor_conditions.cpp
-
122pcbnew/tools/pcb_editor_conditions.h
@ -0,0 +1,153 @@ |
|||
/*
|
|||
* 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> |
|||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* 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 |
|||
*/ |
|||
|
|||
|
|||
#include <pcb_base_frame.h>
|
|||
#include <tool/selection.h>
|
|||
#include <tools/pcb_editor_conditions.h>
|
|||
|
|||
#include <functional>
|
|||
#include <wx/debug.h>
|
|||
|
|||
using namespace std::placeholders; |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::PadNumbersDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::padNumberDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::PadFillDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::padFillDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::TextFillDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::textFillDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::GraphicsFillDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::graphicsFillDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::ViaFillDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::viaFillDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::TrackFillDisplay() |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::trackFillDisplayFunc, _1, drwFrame ); |
|||
} |
|||
|
|||
|
|||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::ZoneDisplayMode( ZONE_DISPLAY_MODE aMode ) |
|||
{ |
|||
// Requires a PCB_BASE_FRAME
|
|||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame ); |
|||
|
|||
wxASSERT( drwFrame ); |
|||
|
|||
return std::bind( &PCB_EDITOR_CONDITIONS::zoneDisplayModeFunc, _1, drwFrame, aMode ); |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayPadNum; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::padFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayPadFill; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::textFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayTextFill; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::graphicsFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayGraphicsFill; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::viaFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayViaFill; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::trackFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_DisplayPcbTrackFill; |
|||
} |
|||
|
|||
|
|||
bool PCB_EDITOR_CONDITIONS::zoneDisplayModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame, |
|||
ZONE_DISPLAY_MODE aMode ) |
|||
{ |
|||
return aFrame->GetDisplayOptions().m_ZoneDisplayMode == aMode; |
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
/* |
|||
* 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> |
|||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* 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 <common.h> |
|||
#include <functional> |
|||
#include <tool/editor_conditions.h> |
|||
#include <tool/selection.h> |
|||
#include <tool/tool_action.h> |
|||
|
|||
class EDA_BASE_FRAME; |
|||
class EDA_DRAW_FRAME; |
|||
class PCB_BASE_FRAME; |
|||
|
|||
/** |
|||
* Class that groups generic conditions for PCB editor states. |
|||
*/ |
|||
class PCB_EDITOR_CONDITIONS : public EDITOR_CONDITIONS |
|||
{ |
|||
public: |
|||
PCB_EDITOR_CONDITIONS( PCB_BASE_FRAME* aFrame ) : |
|||
EDITOR_CONDITIONS( aFrame ) |
|||
{} |
|||
|
|||
/** |
|||
* Creates a functor that tests if the pad numbers are displayed |
|||
* |
|||
* @return Functor returning true if the pad numbers are displayed |
|||
*/ |
|||
SELECTION_CONDITION PadNumbersDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests if the frame fills the pads |
|||
* |
|||
* @return Functor returning true if the pads are filled |
|||
*/ |
|||
SELECTION_CONDITION PadFillDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests if the frame fills text items |
|||
* |
|||
* @return Functor returning true if the text items are filled |
|||
*/ |
|||
SELECTION_CONDITION TextFillDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests if the frame fills graphics items |
|||
* |
|||
* @return Functor returning true if graphics items are filled |
|||
*/ |
|||
SELECTION_CONDITION GraphicsFillDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests if the frame fills vias |
|||
* |
|||
* @return Functor returning true if vias are filled |
|||
*/ |
|||
SELECTION_CONDITION ViaFillDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests if the frame fills vias |
|||
* |
|||
* @return Functor returning true if tracks are filled |
|||
*/ |
|||
SELECTION_CONDITION TrackFillDisplay(); |
|||
|
|||
/** |
|||
* Creates a functor that tests the current zone display mode in the frame |
|||
* |
|||
* @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 ); |
|||
|
|||
protected: |
|||
///> Helper function used by PadNumbersDisplay() |
|||
static bool padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by PadFillDisplay() |
|||
static bool padFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by TextFillDisplay() |
|||
static bool textFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by GraphicsFillDisplay() |
|||
static bool graphicsFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by ViaFillDisplay() |
|||
static bool viaFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by TrackFillDisplay() |
|||
static bool trackFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame ); |
|||
|
|||
///> Helper function used by ZoneDisplayMode() |
|||
static bool zoneDisplayModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame, |
|||
ZONE_DISPLAY_MODE aMode ); |
|||
}; |
|||
|
|||
#endif /* PCB_EDITOR_CONDITIONS_H_ */ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue