2020-05-22 18:27:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-05-22 18:27:05 +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_VIEWER_TOOLS_H_
|
|
|
|
#define PCB_VIEWER_TOOLS_H_
|
|
|
|
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2020-05-22 18:27:05 +00:00
|
|
|
#include <tool/tool_interactive.h>
|
2021-12-26 00:36:12 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2020-05-22 18:27:05 +00:00
|
|
|
|
|
|
|
class PCB_BASE_FRAME;
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Tool useful for viewing footprints.
|
2020-05-22 18:27:05 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* This tool is designed to be lighter-weight so that it doesn't bring in as many PcbNew
|
|
|
|
* dependencies (since it is used in cvpcb).
|
2020-05-22 18:27:05 +00:00
|
|
|
*/
|
|
|
|
class PCB_VIEWER_TOOLS : public TOOL_INTERACTIVE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PCB_VIEWER_TOOLS() :
|
|
|
|
TOOL_INTERACTIVE( "pcbnew.PCBViewerTools" ),
|
|
|
|
m_footprintFrame( false )
|
|
|
|
{}
|
|
|
|
|
|
|
|
~PCB_VIEWER_TOOLS() override {}
|
|
|
|
|
|
|
|
bool Init() override;
|
|
|
|
|
|
|
|
/// @copydoc TOOL_BASE::Reset()
|
|
|
|
void Reset( RESET_REASON aReason ) override;
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Launch a tool to measure between points.
|
2020-05-22 18:27:05 +00:00
|
|
|
int MeasureTool( const TOOL_EVENT& aEvent );
|
|
|
|
|
|
|
|
// Display modes
|
2020-05-23 17:14:49 +00:00
|
|
|
int ShowPadNumbers( const TOOL_EVENT& aEvent );
|
2020-05-22 18:27:05 +00:00
|
|
|
int PadDisplayMode( const TOOL_EVENT& aEvent );
|
2020-05-26 22:21:38 +00:00
|
|
|
int GraphicOutlines( const TOOL_EVENT& aEvent );
|
|
|
|
int TextOutlines( const TOOL_EVENT& aEvent );
|
2020-05-22 18:27:05 +00:00
|
|
|
|
|
|
|
/// Show the 3D viewer
|
|
|
|
int Show3DViewer( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Set up handlers for various events.
|
2020-05-22 18:27:05 +00:00
|
|
|
void setTransitions() override;
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Toggle edit footprint mode.
|
|
|
|
*
|
|
|
|
* When enabled, one may select parts of footprints individually (graphics, pads, etc.),
|
|
|
|
* so they can be modified.
|
|
|
|
*
|
2020-05-22 18:27:05 +00:00
|
|
|
* @param aEnabled decides if the mode should be enabled.
|
|
|
|
*/
|
|
|
|
void SetFootprintFrame( bool aIsFrame )
|
|
|
|
{
|
|
|
|
m_footprintFrame = aIsFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsFootprintFrame() const
|
|
|
|
{
|
|
|
|
return m_footprintFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PCB_BASE_FRAME* frame() const
|
|
|
|
{
|
|
|
|
return getEditFrame<PCB_BASE_FRAME>();
|
|
|
|
}
|
|
|
|
|
|
|
|
KIGFX::PCB_VIEW* view() const
|
|
|
|
{
|
|
|
|
return static_cast<KIGFX::PCB_VIEW*>( getView() );
|
|
|
|
}
|
|
|
|
|
2021-12-26 00:36:12 +00:00
|
|
|
PCBNEW_SETTINGS::DISPLAY_OPTIONS& displayOptions() const
|
2020-05-22 18:27:05 +00:00
|
|
|
{
|
2021-12-26 00:36:12 +00:00
|
|
|
return frame()->GetPcbNewSettings()->m_Display;
|
2020-05-22 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PCB_DRAW_PANEL_GAL* canvas() const
|
|
|
|
{
|
|
|
|
return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetCanvas() );
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD* board() const
|
|
|
|
{
|
|
|
|
return getModel<BOARD>();
|
|
|
|
}
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint() const
|
2020-05-22 18:27:05 +00:00
|
|
|
{
|
2020-11-08 21:29:04 +00:00
|
|
|
return board()->GetFirstFootprint();
|
2020-05-22 18:27:05 +00:00
|
|
|
}
|
2021-01-27 22:15:38 +00:00
|
|
|
|
|
|
|
bool m_footprintFrame; ///< Is this tool associated with a footprint frame
|
2020-05-22 18:27:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|