Rename cvpcb footprint viewer tools
This is in preparation for the actionization of the main cvpcb window.
This commit is contained in:
parent
4c2ea8879f
commit
c0b80c67b9
|
@ -47,8 +47,8 @@ set( CVPCB_SRCS
|
|||
readwrite_dlgs.cpp
|
||||
toolbars_cvpcb.cpp
|
||||
tools/cvpcb_actions.cpp
|
||||
tools/cvpcb_control.cpp
|
||||
tools/cvpcb_selection_tool.cpp
|
||||
tools/cvpcb_fpviewer_control.cpp
|
||||
tools/cvpcb_fpviewer_selection_tool.cpp
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
#include <tool/common_tools.h>
|
||||
#include <tool/zoom_tool.h>
|
||||
#include <tools/cvpcb_actions.h>
|
||||
#include <tools/cvpcb_selection_tool.h>
|
||||
#include <tools/cvpcb_control.h>
|
||||
#include <tools/cvpcb_fpviewer_control.h>
|
||||
#include <tools/cvpcb_fpviewer_selection_tool.h>
|
||||
|
||||
// Colors for layers and items
|
||||
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY );
|
||||
|
@ -119,8 +119,8 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
|||
|
||||
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||
m_toolManager->RegisterTool( new CVPCB_SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new CVPCB_CONTROL );
|
||||
m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_CONTROL );
|
||||
m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
|
||||
m_toolManager->InitTools();
|
||||
|
||||
// Run the control tool, it is supposed to be always active
|
||||
|
|
|
@ -25,33 +25,33 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <tool/actions.h>
|
||||
#include <tools/cvpcb_control.h>
|
||||
using namespace std::placeholders;
|
||||
|
||||
#include <tool/actions.h>
|
||||
#include <tools/cvpcb_fpviewer_control.h>
|
||||
|
||||
CVPCB_CONTROL::CVPCB_CONTROL() :
|
||||
TOOL_INTERACTIVE( "cvpcb.Control" ),
|
||||
m_frame( nullptr )
|
||||
|
||||
CVPCB_FOOTPRINT_VIEWER_CONTROL::CVPCB_FOOTPRINT_VIEWER_CONTROL() :
|
||||
TOOL_INTERACTIVE( "cvpcb.FootprintViewerControl" ),
|
||||
m_frame( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_CONTROL::Reset( RESET_REASON aReason )
|
||||
void CVPCB_FOOTPRINT_VIEWER_CONTROL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_frame = getEditFrame<DISPLAY_FOOTPRINTS_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int CVPCB_CONTROL::Show3DViewer( const TOOL_EVENT& aEvent )
|
||||
int CVPCB_FOOTPRINT_VIEWER_CONTROL::Show3DViewer( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->CreateAndShow3D_Frame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_CONTROL::setTransitions()
|
||||
void CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions()
|
||||
{
|
||||
// Miscellaneous
|
||||
Go( &CVPCB_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
|
||||
Go( &CVPCB_FOOTPRINT_VIEWER_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2014-2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
* Copyright (C) 2007-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2007-2019 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
|
||||
|
@ -23,28 +23,29 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef CVPCB_CONTROL_H
|
||||
#define CVPCB_CONTROL_H
|
||||
#ifndef CVPCB_FOOTPRINT_VIEWER_CONTROL_H_
|
||||
#define CVPCB_FOOTPRINT_VIEWER_CONTROL_H_
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <display_footprints_frame.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class CVPCB_CONTROL
|
||||
* Class CVPCB_FOOTPRINT_VIEWER_CONTROL
|
||||
*
|
||||
* Handles actions in cvpcb display frame.
|
||||
* Handles control actions for the cvpcb footprint display frame.
|
||||
*/
|
||||
|
||||
class CVPCB_CONTROL : public TOOL_INTERACTIVE
|
||||
class CVPCB_FOOTPRINT_VIEWER_CONTROL : public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
CVPCB_CONTROL();
|
||||
~CVPCB_CONTROL() { }
|
||||
CVPCB_FOOTPRINT_VIEWER_CONTROL();
|
||||
~CVPCB_FOOTPRINT_VIEWER_CONTROL() {}
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Show the 3D viewer with the currently selected footprint
|
||||
int Show3DViewer( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Sets up handlers for various events.
|
|
@ -17,41 +17,41 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <limits>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
using namespace std::placeholders;
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <view/view.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <cvpcb_id.h>
|
||||
#include <preview_items/ruler_item.h>
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/cvpcb_actions.h>
|
||||
#include <tools/cvpcb_selection_tool.h>
|
||||
#include <preview_items/ruler_item.h>
|
||||
#include <cvpcb_id.h>
|
||||
#include <tools/cvpcb_fpviewer_selection_tool.h>
|
||||
#include <view/view.h>
|
||||
|
||||
|
||||
CVPCB_SELECTION_TOOL::CVPCB_SELECTION_TOOL() :
|
||||
TOOL_INTERACTIVE( "cvpcb.InteractiveSelection" ),
|
||||
CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL() :
|
||||
TOOL_INTERACTIVE( "cvpcb.FootprintViewerInteractiveSelection" ),
|
||||
m_frame( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool CVPCB_SELECTION_TOOL::Init()
|
||||
bool CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init()
|
||||
{
|
||||
getEditFrame<DISPLAY_FOOTPRINTS_FRAME>()->AddStandardSubMenus( m_menu );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
|
||||
void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_frame = getEditFrame<DISPLAY_FOOTPRINTS_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int CVPCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Main loop: keep receiving events
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
|
@ -102,18 +102,18 @@ int CVPCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
auto& view = *getView();
|
||||
auto& controls = *getViewControls();
|
||||
auto previous_settings = controls.GetSettings();
|
||||
auto previous_settings = controls.GetSettings();
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
|
||||
|
||||
view.Add( &ruler );
|
||||
view.SetVisible( &ruler, false );
|
||||
|
@ -129,7 +129,7 @@ int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
||||
const VECTOR2I cursorPos = controls.GetCursorPosition();
|
||||
|
||||
auto clearRuler = [&] () {
|
||||
auto clearRuler = [&]() {
|
||||
view.SetVisible( &ruler, false );
|
||||
controls.SetAutoPan( false );
|
||||
controls.CaptureCursor( false );
|
||||
|
@ -223,9 +223,9 @@ int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CVPCB_SELECTION_TOOL::setTransitions()
|
||||
void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions()
|
||||
{
|
||||
Go( &CVPCB_SELECTION_TOOL::Main, CVPCB_ACTIONS::selectionActivate.MakeEvent() );
|
||||
Go( &CVPCB_SELECTION_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
|
||||
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main,
|
||||
CVPCB_ACTIONS::selectionActivate.MakeEvent() );
|
||||
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
|
||||
}
|
||||
|
|
@ -17,25 +17,27 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CVPCB_SELECTION_TOOL_H
|
||||
#define CVPCB_SELECTION_TOOL_H
|
||||
#ifndef CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL_H_
|
||||
#define CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL_H_
|
||||
|
||||
#include <display_footprints_frame.h>
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/action_menu.h>
|
||||
#include <tool/selection.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <display_footprints_frame.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class CVPCB_SELECTION_TOOL
|
||||
* Class CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL
|
||||
*
|
||||
* Selection tool for the footprint viewer in cvpcb.
|
||||
*/
|
||||
class CVPCB_SELECTION_TOOL : public TOOL_INTERACTIVE
|
||||
class CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL : public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
CVPCB_SELECTION_TOOL();
|
||||
~CVPCB_SELECTION_TOOL() { }
|
||||
CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL();
|
||||
~CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL() {}
|
||||
|
||||
/// @copydoc TOOL_BASE::Init()
|
||||
bool Init() override;
|
||||
|
@ -53,8 +55,12 @@ public:
|
|||
/**
|
||||
* Selections aren't currently supported in the footprint viewer.
|
||||
*/
|
||||
SELECTION& GetSelection() { return m_selection; }
|
||||
void clearSelection() {};
|
||||
SELECTION& GetSelection()
|
||||
{
|
||||
return m_selection;
|
||||
}
|
||||
|
||||
void clearSelection() {}
|
||||
|
||||
///> Launches a tool to measure between points
|
||||
int MeasureTool( const TOOL_EVENT& aEvent );
|
||||
|
@ -63,6 +69,7 @@ public:
|
|||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
/// Pointer to the parent frame.
|
||||
DISPLAY_FOOTPRINTS_FRAME* m_frame;
|
||||
|
||||
/// Current state of selection (not really used: no selection in display footprints frame).
|
Loading…
Reference in New Issue