Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
|
|
|
|
* Copyright (C) 2013 CERN
|
2020-12-27 00:41:04 +00:00
|
|
|
* Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-02-24 19:53:02 +00:00
|
|
|
*
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file view_controls.h
|
|
|
|
* @brief VIEW_CONTROLS class definition.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIEW_CONTROLS_H
|
|
|
|
#define __VIEW_CONTROLS_H
|
|
|
|
|
|
|
|
#include <math/box2.h>
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
namespace KIGFX
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
{
|
|
|
|
class VIEW;
|
|
|
|
|
2020-05-17 00:19:48 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Action to perform when the mouse is dragged
|
2020-05-17 00:19:48 +00:00
|
|
|
enum class MOUSE_DRAG_ACTION
|
|
|
|
{
|
|
|
|
SELECT,
|
|
|
|
ZOOM,
|
|
|
|
PAN,
|
|
|
|
NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Structure to keep VIEW_CONTROLS settings for easy store/restore operations
|
2017-03-06 10:41:06 +00:00
|
|
|
struct VC_SETTINGS
|
|
|
|
{
|
|
|
|
VC_SETTINGS()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Restore the default settings.
|
2017-03-06 10:41:06 +00:00
|
|
|
void Reset();
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Flag determining the cursor visibility.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_showCursor;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Forced cursor position (world coordinates).
|
2017-03-06 10:41:06 +00:00
|
|
|
VECTOR2D m_forcedPosition;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Is the forced cursor position enabled.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_forceCursorPosition;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Should the cursor be locked within the parent window area.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_cursorCaptured;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Should the cursor snap to grid or move freely.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_snappingEnabled;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Flag for grabbing the mouse cursor.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_grabMouse;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Flag for turning on autopanning.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_autoPanEnabled;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Flag for turning on autopanning.
|
2017-11-23 22:04:52 +00:00
|
|
|
bool m_autoPanSettingEnabled;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Distance from cursor to VIEW edge when panning is active.
|
2017-03-06 10:41:06 +00:00
|
|
|
float m_autoPanMargin;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< How fast is panning when in auto mode.
|
2017-03-06 10:41:06 +00:00
|
|
|
float m_autoPanSpeed;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< How fast does panning accelerate when approaching the window boundary.
|
2020-01-07 19:35:45 +00:00
|
|
|
float m_autoPanAcceleration;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< If the cursor is allowed to be warped.
|
2017-03-06 10:41:06 +00:00
|
|
|
bool m_warpCursor;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Enable horizontal panning with the horizontal scroll/trackpad input.
|
2020-05-17 00:19:48 +00:00
|
|
|
bool m_horizontalPan;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Enable the accelerating zoom controller.
|
2020-05-17 00:19:48 +00:00
|
|
|
bool m_zoomAcceleration;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Zoom speed for the non-accelerating zoom controller.
|
2020-05-17 00:19:48 +00:00
|
|
|
int m_zoomSpeed;
|
2017-09-06 01:28:01 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< When true, ignore zoom_speed and pick a platform-specific default.
|
2020-05-17 00:19:48 +00:00
|
|
|
bool m_zoomSpeedAuto;
|
2017-09-06 01:28:01 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< What modifier key to enable zoom with the (vertical) scroll wheel.
|
2020-05-17 00:19:48 +00:00
|
|
|
int m_scrollModifierZoom;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< What modifier key to enable horizontal pan with the (vertical) scroll wheel.
|
2020-05-17 00:19:48 +00:00
|
|
|
int m_scrollModifierPanH;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< What modifier key to enable vertical with the (vertical) scroll wheel.
|
2020-05-17 00:19:48 +00:00
|
|
|
int m_scrollModifierPanV;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< What drag action to perform when the middle button is pressed.
|
2020-05-17 00:19:48 +00:00
|
|
|
MOUSE_DRAG_ACTION m_dragMiddle;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< What drag action to perform when the right button is pressed.
|
2020-05-17 00:19:48 +00:00
|
|
|
MOUSE_DRAG_ACTION m_dragRight;
|
2018-12-23 17:57:40 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Is last cursor motion event coming from keyboard arrow cursor motion action.
|
2018-12-23 17:57:40 +00:00
|
|
|
bool m_lastKeyboardCursorPositionValid;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< ACTIONS::CURSOR_UP, ACTIONS::CURSOR_DOWN, etc.
|
2019-12-15 14:29:22 +00:00
|
|
|
long m_lastKeyboardCursorCommand;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Position of the above event.
|
2018-12-23 17:57:40 +00:00
|
|
|
VECTOR2D m_lastKeyboardCursorPosition;
|
2017-03-06 10:41:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* An interface for classes handling user events controlling the view behavior such as
|
|
|
|
* zooming, panning, mouse grab, etc.
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
*/
|
|
|
|
class VIEW_CONTROLS
|
|
|
|
{
|
|
|
|
public:
|
2019-02-16 04:14:40 +00:00
|
|
|
VIEW_CONTROLS( VIEW* aView ) :
|
|
|
|
m_view( aView ), m_cursorWarped( false )
|
2014-03-12 16:09:53 +00:00
|
|
|
{
|
|
|
|
}
|
2013-10-14 18:40:36 +00:00
|
|
|
|
|
|
|
virtual ~VIEW_CONTROLS()
|
2017-02-11 19:54:44 +00:00
|
|
|
{
|
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Turn on/off mouse grabbing.
|
|
|
|
* When the mouse is grabbed, it cannot go outside the VIEW.
|
|
|
|
*
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* @param aEnabled tells if mouse should be grabbed or not.
|
|
|
|
*/
|
2013-09-09 08:53:46 +00:00
|
|
|
virtual void SetGrabMouse( bool aEnabled )
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_grabMouse = aEnabled;
|
2013-09-09 08:53:46 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Turn on/off auto panning (this feature is used when there is a tool active (eg. drawing a
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* track) and user moves mouse to the VIEW edge - then the view can be translated or not).
|
2020-12-27 00:41:04 +00:00
|
|
|
*
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
* @param aEnabled tells if the autopanning should be active.
|
|
|
|
*/
|
2013-09-09 08:53:46 +00:00
|
|
|
virtual void SetAutoPan( bool aEnabled )
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_autoPanEnabled = aEnabled;
|
2013-09-09 08:53:46 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2017-11-23 22:04:52 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Turn on/off auto panning (user setting to disable it entirely).
|
|
|
|
*
|
2017-11-23 22:04:52 +00:00
|
|
|
* @param aEnabled tells if the autopanning should be enabled.
|
|
|
|
*/
|
|
|
|
virtual void EnableAutoPan( bool aEnabled )
|
|
|
|
{
|
|
|
|
m_settings.m_autoPanSettingEnabled = aEnabled;
|
|
|
|
}
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Set the speed of autopanning.
|
|
|
|
*
|
2013-09-09 08:53:46 +00:00
|
|
|
* @param aSpeed is a new speed for autopanning.
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
*/
|
2013-09-09 08:53:46 +00:00
|
|
|
virtual void SetAutoPanSpeed( float aSpeed )
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_autoPanSpeed = aSpeed;
|
2013-09-09 08:53:46 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2020-01-07 19:35:45 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Set the speed of autopanning.
|
|
|
|
*
|
2020-01-07 19:35:45 +00:00
|
|
|
* @param aSpeed is a new speed for autopanning.
|
|
|
|
*/
|
|
|
|
virtual void SetAutoPanAcceleration( float aAcceleration )
|
|
|
|
{
|
|
|
|
m_settings.m_autoPanAcceleration = aAcceleration;
|
|
|
|
}
|
|
|
|
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Set the margin for autopanning (ie. the area when autopanning becomes active).
|
|
|
|
*
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aMargin is a new margin for autopanning.
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
*/
|
2013-09-09 08:53:46 +00:00
|
|
|
virtual void SetAutoPanMargin( float aMargin )
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_autoPanMargin = aMargin;
|
2015-07-15 15:32:30 +00:00
|
|
|
}
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return the current mouse pointer position.
|
|
|
|
*
|
|
|
|
* @note The position may be different from the cursor position if snapping is
|
|
|
|
* enabled (@see GetCursorPosition()).
|
2013-09-09 08:53:46 +00:00
|
|
|
*
|
2017-06-12 13:27:10 +00:00
|
|
|
* @param aWorldCoordinates if true, the result is given in world coordinates, otherwise
|
2020-12-27 00:41:04 +00:00
|
|
|
* it is given in screen coordinates.
|
2017-06-12 13:27:10 +00:00
|
|
|
* @return The current mouse pointer position in either world or screen coordinates.
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
*/
|
2017-06-12 13:27:10 +00:00
|
|
|
virtual VECTOR2D GetMousePosition( bool aWorldCoordinates = true ) const = 0;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2013-09-09 08:53:46 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return the current cursor position in world coordinates.
|
|
|
|
*
|
|
|
|
* @note The position may be different from the mouse pointer position if snapping is
|
|
|
|
* enabled or cursor position is forced to a specific point.
|
2013-09-09 08:53:46 +00:00
|
|
|
*
|
2014-02-13 19:23:28 +00:00
|
|
|
* @return The current cursor position in world coordinates.
|
2013-09-09 08:53:46 +00:00
|
|
|
*/
|
2017-07-12 07:34:20 +00:00
|
|
|
VECTOR2D GetCursorPosition() const
|
|
|
|
{
|
|
|
|
return GetCursorPosition( m_settings.m_snappingEnabled );
|
|
|
|
}
|
|
|
|
|
2017-11-15 23:42:40 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return the current cursor position in world coordinates ignoring the cursorUp
|
2017-11-15 23:42:40 +00:00
|
|
|
* position force mode.
|
|
|
|
*
|
|
|
|
* @return The current cursor position in world coordinates.
|
|
|
|
*/
|
|
|
|
virtual VECTOR2D GetRawCursorPosition( bool aSnappingEnabled = true ) const = 0;
|
|
|
|
|
2017-07-12 07:34:20 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return the current cursor position in world coordinates.
|
|
|
|
*
|
|
|
|
* @note The position may be different from the mouse pointer position if snapping is
|
|
|
|
* enabled or cursor position is forced to a specific point.
|
2017-07-12 07:34:20 +00:00
|
|
|
*
|
|
|
|
* @param aEnableSnapping selects whether cursor position should be snapped to the grid.
|
|
|
|
* @return The current cursor position in world coordinates.
|
|
|
|
*/
|
|
|
|
virtual VECTOR2D GetCursorPosition( bool aEnableSnapping ) const = 0;
|
2013-08-02 14:51:38 +00:00
|
|
|
|
2013-10-14 11:43:57 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Place the cursor immediately at a given point. Mouse movement is ignored.
|
|
|
|
*
|
2013-09-18 11:15:42 +00:00
|
|
|
* @param aEnabled enable forced cursor position
|
2015-07-15 15:32:30 +00:00
|
|
|
* @param aPosition the position (world coordinates).
|
2013-09-09 08:53:46 +00:00
|
|
|
*/
|
2014-02-13 19:23:28 +00:00
|
|
|
virtual void ForceCursorPosition( bool aEnabled, const VECTOR2D& aPosition = VECTOR2D( 0, 0 ) )
|
2013-09-09 08:53:46 +00:00
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_forceCursorPosition = aEnabled;
|
|
|
|
m_settings.m_forcedPosition = aPosition;
|
2013-09-09 08:53:46 +00:00
|
|
|
}
|
2013-08-02 14:51:38 +00:00
|
|
|
|
2017-08-22 13:13:25 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Move cursor to the requested position expressed in world coordinates.
|
|
|
|
*
|
|
|
|
* The position is not forced and will be overridden with the next mouse motion event.
|
|
|
|
* Mouse cursor follows the world cursor.
|
|
|
|
*
|
2017-08-22 13:13:25 +00:00
|
|
|
* @param aPosition is the requested cursor position in the world coordinates.
|
2017-09-22 08:59:42 +00:00
|
|
|
* @param aWarpView enables/disables view warp if the cursor is outside the current viewport.
|
2017-08-22 13:13:25 +00:00
|
|
|
*/
|
2019-12-15 14:29:22 +00:00
|
|
|
virtual void SetCursorPosition( const VECTOR2D& aPosition, bool aWarpView = true,
|
|
|
|
bool aTriggeredByArrows = false, long aArrowCommand = 0 ) = 0;
|
2017-08-22 13:13:25 +00:00
|
|
|
|
2018-01-17 14:36:04 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Move the graphic crosshair cursor to the requested position expressed in world coordinates.
|
|
|
|
*
|
2018-01-17 14:36:04 +00:00
|
|
|
* @param aPosition is the requested cursor position in the world coordinates.
|
|
|
|
* @param aWarpView enables/disables view warp if the cursor is outside the current viewport.
|
|
|
|
*/
|
2018-01-18 09:09:43 +00:00
|
|
|
virtual void SetCrossHairCursorPosition( const VECTOR2D& aPosition, bool aWarpView = true ) = 0;
|
2018-01-17 14:36:04 +00:00
|
|
|
|
2017-02-24 15:39:52 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return true if the current cursor position is forced to a specific location, ignoring
|
2017-02-24 15:39:52 +00:00
|
|
|
* the mouse cursor position.
|
|
|
|
*/
|
|
|
|
bool ForcedCursorPosition() const
|
|
|
|
{
|
|
|
|
return m_settings.m_forceCursorPosition;
|
|
|
|
}
|
|
|
|
|
2013-10-14 18:40:36 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Enable or disables display of cursor.
|
|
|
|
*
|
2013-10-14 18:40:36 +00:00
|
|
|
* @param aEnabled decides if the cursor should be shown.
|
|
|
|
*/
|
2013-09-18 14:59:08 +00:00
|
|
|
virtual void ShowCursor( bool aEnabled );
|
2013-09-18 11:15:42 +00:00
|
|
|
|
2017-02-11 19:54:44 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return true when cursor is visible.
|
|
|
|
*
|
2017-02-11 19:54:44 +00:00
|
|
|
* @return True if cursor is visible.
|
|
|
|
*/
|
|
|
|
bool IsCursorShown() const;
|
|
|
|
|
2015-03-10 12:20:38 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Force the cursor to stay within the drawing panel area.
|
|
|
|
*
|
2015-03-10 12:20:38 +00:00
|
|
|
* @param aEnabled determines if the cursor should be captured.
|
|
|
|
*/
|
|
|
|
virtual void CaptureCursor( bool aEnabled )
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_cursorCaptured = aEnabled;
|
2015-03-10 12:20:38 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 10:41:06 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Return true if the cursor position is set by one of the tools.
|
|
|
|
*
|
|
|
|
* A forced cursor position means it does not react to mouse movement.
|
2017-03-06 10:41:06 +00:00
|
|
|
*/
|
2015-04-30 08:46:06 +00:00
|
|
|
inline bool IsCursorPositionForced() const
|
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
return m_settings.m_forceCursorPosition;
|
2015-04-30 08:46:06 +00:00
|
|
|
}
|
|
|
|
|
2015-07-09 08:18:27 +00:00
|
|
|
/**
|
2015-07-15 15:32:30 +00:00
|
|
|
* If enabled (@see SetEnableCursorWarping(), warps the cursor to the specified position,
|
|
|
|
* expressed either in the screen coordinates or the world coordinates.
|
2020-12-27 00:41:04 +00:00
|
|
|
*
|
2015-07-15 15:32:30 +00:00
|
|
|
* @param aPosition is the position where the cursor should be warped.
|
|
|
|
* @param aWorldCoordinates if true treats aPosition as the world coordinates, otherwise it
|
2020-12-27 00:41:04 +00:00
|
|
|
* uses it as the screen coordinates.
|
2015-07-15 15:32:30 +00:00
|
|
|
* @param aWarpView determines if the view can be warped too (only matters if the position is
|
2020-12-27 00:41:04 +00:00
|
|
|
* specified in the world coordinates and its not visible in the current
|
|
|
|
* viewport).
|
2015-07-15 15:32:30 +00:00
|
|
|
*/
|
|
|
|
virtual void WarpCursor( const VECTOR2D& aPosition, bool aWorldCoordinates = false,
|
2018-02-13 08:45:03 +00:00
|
|
|
bool aWarpView = false ) = 0;
|
2015-07-15 15:32:30 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Enable or disable warping the cursor.
|
|
|
|
*
|
2017-06-21 07:32:19 +00:00
|
|
|
* @param aEnable is true if the cursor is allowed to be warped.
|
2015-07-09 08:18:27 +00:00
|
|
|
*/
|
2015-07-15 15:32:30 +00:00
|
|
|
void EnableCursorWarping( bool aEnable )
|
2015-07-09 08:18:27 +00:00
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
m_settings.m_warpCursor = aEnable;
|
2015-07-09 08:18:27 +00:00
|
|
|
}
|
|
|
|
|
2015-07-15 15:32:30 +00:00
|
|
|
/**
|
2017-06-21 07:32:19 +00:00
|
|
|
* @return the current setting for cursor warping.
|
2015-07-15 15:32:30 +00:00
|
|
|
*/
|
|
|
|
bool IsCursorWarpingEnabled() const
|
2015-07-09 08:18:27 +00:00
|
|
|
{
|
2017-02-11 19:54:44 +00:00
|
|
|
return m_settings.m_warpCursor;
|
2015-07-09 08:18:27 +00:00
|
|
|
}
|
|
|
|
|
2015-07-24 07:42:45 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Set the viewport center to the current cursor position and warps the cursor to the
|
2015-07-24 07:42:45 +00:00
|
|
|
* screen center.
|
|
|
|
*/
|
|
|
|
virtual void CenterOnCursor() const = 0;
|
|
|
|
|
2015-07-24 08:58:47 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Restore the default VIEW_CONTROLS settings.
|
2015-07-24 08:58:47 +00:00
|
|
|
*/
|
|
|
|
virtual void Reset();
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Return the current VIEW_CONTROLS settings.
|
2017-03-06 10:41:06 +00:00
|
|
|
const VC_SETTINGS& GetSettings() const
|
2017-02-11 19:54:44 +00:00
|
|
|
{
|
|
|
|
return m_settings;
|
|
|
|
}
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Apply VIEW_CONTROLS settings from an object.
|
2017-03-06 10:41:06 +00:00
|
|
|
void ApplySettings( const VC_SETTINGS& aSettings );
|
2017-02-11 19:54:44 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Load new settings from program common settings.
|
2020-05-17 00:19:48 +00:00
|
|
|
virtual void LoadSettings() {}
|
|
|
|
|
2017-02-11 19:54:44 +00:00
|
|
|
protected:
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Pointer to controlled VIEW.
|
2017-02-11 20:26:08 +00:00
|
|
|
VIEW* m_view;
|
2016-02-24 19:53:02 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Application warped the cursor, not the user (keyboard).
|
2019-01-08 19:47:00 +00:00
|
|
|
bool m_cursorWarped;
|
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Current VIEW_CONTROLS settings.
|
2017-03-06 10:41:06 +00:00
|
|
|
VC_SETTINGS m_settings;
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
};
|
2013-10-14 14:13:35 +00:00
|
|
|
} // namespace KIGFX
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
|
|
|
#endif
|