You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

694 lines
22 KiB

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
13 years ago
11 years ago
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
13 years ago
11 years ago
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
13 years ago
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
13 years ago
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
13 years ago
11 years ago
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
13 years ago
11 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
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
13 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
  5. * Copyright (C) 2013-2015 CERN
  6. * Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
  9. * @author Maciej Suminski <maciej.suminski@cern.ch>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, you may find one here:
  23. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  24. * or you may search the http://www.gnu.org website for the version 2 license,
  25. * or you may write to the Free Software Foundation, Inc.,
  26. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  27. */
  28. #include <view/view.h>
  29. #include <view/wx_view_controls.h>
  30. #include <view/zoom_controller.h>
  31. #include <gal/graphics_abstraction_layer.h>
  32. #include <tool/tool_dispatcher.h>
  33. using namespace KIGFX;
  34. const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType();
  35. static std::unique_ptr<ZOOM_CONTROLLER> GetZoomControllerForPlatform()
  36. {
  37. #ifdef __WXMAC__
  38. // On Apple pointer devices, wheel events occur frequently and with
  39. // smaller rotation values. For those devices, let's handle zoom
  40. // based on the rotation amount rather than the time difference.
  41. return std::make_unique<CONSTANT_ZOOM_CONTROLLER>( CONSTANT_ZOOM_CONTROLLER::MAC_SCALE );
  42. #elif __WXGTK3__
  43. // GTK3 is similar, but the scale constant is smaller
  44. return std::make_unique<CONSTANT_ZOOM_CONTROLLER>( CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE );
  45. #else
  46. return std::make_unique<ACCELERATING_ZOOM_CONTROLLER>();
  47. #endif
  48. }
  49. WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel ) :
  50. VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ),
  51. m_scrollScale( 1.0, 1.0 ), m_lastTimestamp( 0 ), m_cursorPos( 0, 0 ), m_updateCursor( true )
  52. {
  53. m_parentPanel->Connect( wxEVT_MOTION,
  54. wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this );
  55. #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
  56. m_parentPanel->Connect( wxEVT_MAGNIFY,
  57. wxMouseEventHandler( WX_VIEW_CONTROLS::onMagnify ), NULL, this );
  58. #endif
  59. m_parentPanel->Connect( wxEVT_MOUSEWHEEL,
  60. wxMouseEventHandler( WX_VIEW_CONTROLS::onWheel ), NULL, this );
  61. m_parentPanel->Connect( wxEVT_MIDDLE_UP,
  62. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  63. m_parentPanel->Connect( wxEVT_MIDDLE_DOWN,
  64. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  65. m_parentPanel->Connect( wxEVT_LEFT_UP,
  66. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  67. m_parentPanel->Connect( wxEVT_LEFT_DOWN,
  68. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  69. m_parentPanel->Connect( wxEVT_RIGHT_UP,
  70. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  71. m_parentPanel->Connect( wxEVT_RIGHT_DOWN,
  72. wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
  73. #if defined _WIN32 || defined _WIN64
  74. m_parentPanel->Connect( wxEVT_ENTER_WINDOW,
  75. wxMouseEventHandler( WX_VIEW_CONTROLS::onEnter ), NULL, this );
  76. #endif
  77. m_parentPanel->Connect( wxEVT_LEAVE_WINDOW,
  78. wxMouseEventHandler( WX_VIEW_CONTROLS::onLeave ), NULL, this );
  79. m_parentPanel->Connect( wxEVT_SCROLLWIN_THUMBTRACK,
  80. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  81. m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEUP,
  82. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  83. m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEDOWN,
  84. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  85. m_parentPanel->Connect( wxEVT_SCROLLWIN_BOTTOM,
  86. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  87. m_parentPanel->Connect( wxEVT_SCROLLWIN_TOP,
  88. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  89. m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEUP,
  90. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  91. m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEDOWN,
  92. wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
  93. m_zoomController = GetZoomControllerForPlatform();
  94. m_cursorWarped = false;
  95. m_panTimer.SetOwner( this );
  96. this->Connect( wxEVT_TIMER,
  97. wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
  98. m_settings.m_lastKeyboardCursorPositionValid = false;
  99. }
  100. WX_VIEW_CONTROLS::~WX_VIEW_CONTROLS()
  101. {
  102. }
  103. void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
  104. {
  105. bool isAutoPanning = false;
  106. VECTOR2D mousePos( aEvent.GetX(), aEvent.GetY() );
  107. if( m_settings.m_autoPanEnabled && m_settings.m_autoPanSettingEnabled )
  108. isAutoPanning = handleAutoPanning( aEvent );
  109. if( !isAutoPanning && aEvent.Dragging() )
  110. {
  111. if( m_state == DRAG_PANNING )
  112. {
  113. VECTOR2D d = m_dragStartPoint - mousePos;
  114. VECTOR2D delta = m_view->ToWorld( d, false );
  115. m_view->SetCenter( m_lookStartPoint + delta );
  116. aEvent.StopPropagation();
  117. }
  118. }
  119. if( m_updateCursor ) // do not update the cursor position if it was explicitly set
  120. m_cursorPos = m_view->ToWorld( mousePos );
  121. else
  122. m_updateCursor = true;
  123. aEvent.Skip();
  124. }
  125. void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
  126. {
  127. #ifdef __WXGTK3__
  128. if( aEvent.GetTimestamp() == m_lastTimestamp )
  129. {
  130. aEvent.Skip( false );
  131. return;
  132. }
  133. m_lastTimestamp = aEvent.GetTimestamp();
  134. #endif
  135. const double wheelPanSpeed = 0.001;
  136. const int axis = aEvent.GetWheelAxis();
  137. // mousewheelpan disabled:
  138. // wheel + ctrl -> horizontal scrolling;
  139. // wheel + shift -> vertical scrolling;
  140. // wheel -> zooming;
  141. // mousewheelpan enabled:
  142. // wheel -> pan;
  143. // wheel + ctrl -> zooming;
  144. // wheel + shift -> horizontal scrolling.
  145. if( ( !m_settings.m_enableMousewheelPan && ( aEvent.ControlDown() || aEvent.ShiftDown() ) ) ||
  146. ( m_settings.m_enableMousewheelPan && !aEvent.ControlDown() ) )
  147. {
  148. // Scrolling
  149. VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
  150. ( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
  151. double scrollX = 0.0;
  152. double scrollY = 0.0;
  153. if( m_settings.m_enableMousewheelPan )
  154. {
  155. if ( axis == wxMOUSE_WHEEL_HORIZONTAL || aEvent.ShiftDown() )
  156. scrollX = scrollVec.x;
  157. else
  158. scrollY = -scrollVec.y;
  159. }
  160. else
  161. {
  162. if( aEvent.ControlDown() )
  163. scrollX = -scrollVec.x;
  164. else
  165. scrollY = -scrollVec.y;
  166. }
  167. VECTOR2D delta( scrollX, scrollY );
  168. m_view->SetCenter( m_view->GetCenter() + delta );
  169. refreshMouse();
  170. }
  171. else
  172. {
  173. // Restrict zoom handling to the vertical axis, otherwise horizontal
  174. // scrolling events (e.g. touchpads and some mice) end up interpreted
  175. // as vertical scroll events and confuse the user.
  176. if( axis == wxMOUSE_WHEEL_VERTICAL )
  177. {
  178. const int rotation = aEvent.GetWheelRotation();
  179. const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
  180. if( IsCursorWarpingEnabled() )
  181. {
  182. CenterOnCursor();
  183. m_view->SetScale( m_view->GetScale() * zoomScale );
  184. }
  185. else
  186. {
  187. const VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
  188. m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
  189. }
  190. }
  191. }
  192. // Do not skip this event, otherwise wxWidgets will fire
  193. // 3 wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN (normal wxWidgets behavior)
  194. // and we do not want that.
  195. m_parentPanel->Refresh();
  196. }
  197. #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
  198. void WX_VIEW_CONTROLS::onMagnify( wxMouseEvent& aEvent )
  199. {
  200. // Scale based on the magnification from our underlying magnification event.
  201. VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
  202. m_view->SetScale( m_view->GetScale() * ( aEvent.GetMagnification() + 1.0f ), anchor );
  203. aEvent.Skip();
  204. }
  205. #endif
  206. void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent )
  207. {
  208. switch( m_state )
  209. {
  210. case IDLE:
  211. case AUTO_PANNING:
  212. if( aEvent.MiddleDown() ||
  213. ( aEvent.LeftDown() && m_settings.m_panWithLeftButton ) ||
  214. ( aEvent.RightDown() && m_settings.m_panWithRightButton ) )
  215. {
  216. m_dragStartPoint = VECTOR2D( aEvent.GetX(), aEvent.GetY() );
  217. m_lookStartPoint = m_view->GetCenter();
  218. m_state = DRAG_PANNING;
  219. }
  220. if( aEvent.LeftUp() )
  221. m_state = IDLE; // Stop autopanning when user release left mouse button
  222. break;
  223. case DRAG_PANNING:
  224. if( aEvent.MiddleUp() || aEvent.LeftUp() || aEvent.RightUp() )
  225. m_state = IDLE;
  226. break;
  227. }
  228. aEvent.Skip();
  229. }
  230. void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& aEvent )
  231. {
  232. m_parentPanel->SetFocus();
  233. }
  234. void WX_VIEW_CONTROLS::onLeave( wxMouseEvent& aEvent )
  235. {
  236. if( m_settings.m_cursorCaptured )
  237. {
  238. bool warp = false;
  239. int x = aEvent.GetX();
  240. int y = aEvent.GetY();
  241. wxSize parentSize = m_parentPanel->GetClientSize();
  242. if( x < 0 )
  243. {
  244. x = 0;
  245. warp = true;
  246. }
  247. else if( x >= parentSize.x )
  248. {
  249. x = parentSize.x - 1;
  250. warp = true;
  251. }
  252. if( y < 0 )
  253. {
  254. y = 0;
  255. warp = true;
  256. }
  257. else if( y >= parentSize.y )
  258. {
  259. y = parentSize.y - 1;
  260. warp = true;
  261. }
  262. if( warp )
  263. m_parentPanel->WarpPointer( x, y );
  264. }
  265. }
  266. void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
  267. {
  268. switch( m_state )
  269. {
  270. case AUTO_PANNING:
  271. {
  272. if( !m_settings.m_autoPanEnabled )
  273. {
  274. m_state = IDLE;
  275. return;
  276. }
  277. #if wxCHECK_VERSION( 3, 0, 0 )
  278. if( !m_parentPanel->HasFocus() )
  279. break;
  280. #endif
  281. double borderSize = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
  282. m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().y );
  283. VECTOR2D dir( m_panDirection );
  284. if( dir.EuclideanNorm() > borderSize )
  285. dir = dir.Resize( borderSize );
  286. dir = m_view->ToWorld( dir, false );
  287. m_view->SetCenter( m_view->GetCenter() + dir * m_settings.m_autoPanSpeed );
  288. refreshMouse();
  289. }
  290. break;
  291. case IDLE: // Just remove unnecessary warnings
  292. case DRAG_PANNING:
  293. break;
  294. }
  295. }
  296. void WX_VIEW_CONTROLS::onScroll( wxScrollWinEvent& aEvent )
  297. {
  298. const double linePanDelta = 0.05;
  299. const double pagePanDelta = 0.5;
  300. int type = aEvent.GetEventType();
  301. int dir = aEvent.GetOrientation();
  302. if( type == wxEVT_SCROLLWIN_THUMBTRACK )
  303. {
  304. auto center = m_view->GetCenter();
  305. const auto& boundary = m_view->GetBoundary();
  306. // Flip scroll direction in flipped view
  307. const double xstart = ( m_view->IsMirroredX() ?
  308. boundary.GetRight() : boundary.GetLeft() );
  309. const double xdelta = ( m_view->IsMirroredX() ? -1 : 1 );
  310. if( dir == wxHORIZONTAL )
  311. center.x = xstart + xdelta * ( aEvent.GetPosition() / m_scrollScale.x );
  312. else
  313. center.y = boundary.GetTop() + aEvent.GetPosition() / m_scrollScale.y;
  314. m_view->SetCenter( center );
  315. }
  316. else
  317. {
  318. double dist = 0;
  319. if( type == wxEVT_SCROLLWIN_PAGEUP )
  320. dist = pagePanDelta;
  321. else if( type == wxEVT_SCROLLWIN_PAGEDOWN )
  322. dist = -pagePanDelta;
  323. else if( type == wxEVT_SCROLLWIN_LINEUP )
  324. dist = linePanDelta;
  325. else if( type == wxEVT_SCROLLWIN_LINEDOWN )
  326. dist = -linePanDelta;
  327. else
  328. {
  329. wxASSERT( "Unhandled event type" );
  330. return;
  331. }
  332. VECTOR2D scroll = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * dist;
  333. double scrollX = 0.0;
  334. double scrollY = 0.0;
  335. if ( dir == wxHORIZONTAL )
  336. scrollX = -scroll.x;
  337. else
  338. scrollY = -scroll.y;
  339. VECTOR2D delta( scrollX, scrollY );
  340. m_view->SetCenter( m_view->GetCenter() + delta );
  341. }
  342. m_parentPanel->Refresh();
  343. }
  344. void WX_VIEW_CONTROLS::SetGrabMouse( bool aEnabled )
  345. {
  346. if( aEnabled && !m_settings.m_grabMouse )
  347. m_parentPanel->CaptureMouse();
  348. else if( !aEnabled && m_settings.m_grabMouse )
  349. m_parentPanel->ReleaseMouse();
  350. VIEW_CONTROLS::SetGrabMouse( aEnabled );
  351. }
  352. VECTOR2D WX_VIEW_CONTROLS::GetMousePosition( bool aWorldCoordinates ) const
  353. {
  354. wxPoint msp = getMouseScreenPosition();
  355. VECTOR2D screenPos( msp.x, msp.y );
  356. return aWorldCoordinates ? m_view->ToWorld( screenPos ) : screenPos;
  357. }
  358. VECTOR2D WX_VIEW_CONTROLS::GetRawCursorPosition( bool aEnableSnapping ) const
  359. {
  360. if( aEnableSnapping )
  361. {
  362. return m_view->GetGAL()->GetGridPoint( m_cursorPos );
  363. }
  364. else
  365. {
  366. return m_cursorPos;
  367. }
  368. }
  369. VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition( bool aEnableSnapping ) const
  370. {
  371. if( m_settings.m_forceCursorPosition )
  372. {
  373. return m_settings.m_forcedPosition;
  374. }
  375. else
  376. {
  377. return GetRawCursorPosition( aEnableSnapping );
  378. }
  379. }
  380. void WX_VIEW_CONTROLS::SetCursorPosition( const VECTOR2D& aPosition, bool aWarpView,
  381. bool aTriggeredByArrows )
  382. {
  383. m_updateCursor = false;
  384. if( aTriggeredByArrows )
  385. {
  386. m_settings.m_lastKeyboardCursorPositionValid = true;
  387. m_settings.m_lastKeyboardCursorPosition = aPosition;
  388. m_cursorWarped = false;
  389. }
  390. else
  391. {
  392. m_settings.m_lastKeyboardCursorPositionValid = false;
  393. m_cursorWarped = true;
  394. }
  395. WarpCursor( aPosition, true, aWarpView );
  396. m_cursorPos = aPosition;
  397. }
  398. void WX_VIEW_CONTROLS::SetCrossHairCursorPosition( const VECTOR2D& aPosition, bool aWarpView = true )
  399. {
  400. m_updateCursor = false;
  401. const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
  402. BOX2I screen( VECTOR2I( 0, 0 ), screenSize );
  403. VECTOR2D screenPos = m_view->ToScreen( aPosition );
  404. if( aWarpView && !screen.Contains( screenPos ) )
  405. m_view->SetCenter( aPosition );
  406. m_cursorPos = aPosition;
  407. }
  408. void WX_VIEW_CONTROLS::WarpCursor( const VECTOR2D& aPosition, bool aWorldCoordinates,
  409. bool aWarpView )
  410. {
  411. if( aWorldCoordinates )
  412. {
  413. const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
  414. BOX2I screen( VECTOR2I( 0, 0 ), screenSize );
  415. VECTOR2D screenPos = m_view->ToScreen( aPosition );
  416. if( !screen.Contains( screenPos ) )
  417. {
  418. if( aWarpView )
  419. {
  420. m_view->SetCenter( aPosition );
  421. m_parentPanel->WarpPointer( screenSize.x / 2, screenSize.y / 2 );
  422. }
  423. }
  424. else
  425. {
  426. m_parentPanel->WarpPointer( screenPos.x, screenPos.y );
  427. }
  428. }
  429. else
  430. {
  431. m_parentPanel->WarpPointer( aPosition.x, aPosition.y );
  432. }
  433. refreshMouse();
  434. }
  435. void WX_VIEW_CONTROLS::CenterOnCursor() const
  436. {
  437. const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
  438. VECTOR2I screenCenter( screenSize / 2 );
  439. if( GetMousePosition( false ) != screenCenter )
  440. {
  441. m_view->SetCenter( GetCursorPosition() );
  442. m_parentPanel->WarpPointer( KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
  443. }
  444. }
  445. bool WX_VIEW_CONTROLS::handleAutoPanning( const wxMouseEvent& aEvent )
  446. {
  447. VECTOR2I p( aEvent.GetX(), aEvent.GetY() );
  448. VECTOR2I pKey( m_view->ToScreen(m_settings.m_lastKeyboardCursorPosition ) );
  449. if( m_cursorWarped || (m_settings.m_lastKeyboardCursorPositionValid && (p == pKey)) )
  450. {
  451. // last cursor move event came from keyboard cursor control. If auto-panning is enabled and
  452. // the next position is inside the autopan zone, check if it really came from a mouse event, otherwise
  453. // disable autopan temporarily. Also temporaly disable autopan if the cursor is in the autopan zone
  454. // because the application warped the cursor.
  455. m_cursorWarped = false;
  456. return true;
  457. }
  458. m_cursorWarped = false;
  459. // Compute areas where autopanning is active
  460. int borderStart = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
  461. m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().y );
  462. int borderEndX = m_view->GetScreenPixelSize().x - borderStart;
  463. int borderEndY = m_view->GetScreenPixelSize().y - borderStart;
  464. if( p.x < borderStart )
  465. m_panDirection.x = -( borderStart - p.x );
  466. else if( p.x > borderEndX )
  467. m_panDirection.x = ( p.x - borderEndX );
  468. else
  469. m_panDirection.x = 0;
  470. if( p.y < borderStart )
  471. m_panDirection.y = -( borderStart - p.y );
  472. else if( p.y > borderEndY )
  473. m_panDirection.y = ( p.y - borderEndY );
  474. else
  475. m_panDirection.y = 0;
  476. bool borderHit = ( m_panDirection.x != 0 || m_panDirection.y != 0 );
  477. switch( m_state )
  478. {
  479. case AUTO_PANNING:
  480. if( !borderHit )
  481. {
  482. m_panTimer.Stop();
  483. m_state = IDLE;
  484. return false;
  485. }
  486. return true;
  487. break;
  488. case IDLE:
  489. if( borderHit )
  490. {
  491. m_state = AUTO_PANNING;
  492. m_panTimer.Start( (int) ( 250.0 / 60.0 ) );
  493. return true;
  494. }
  495. return false;
  496. break;
  497. case DRAG_PANNING:
  498. return false;
  499. }
  500. wxASSERT_MSG( false, wxT( "This line should never be reached" ) );
  501. return false; // Should not be reached, just avoid the compiler warnings..
  502. }
  503. void WX_VIEW_CONTROLS::refreshMouse()
  504. {
  505. // Notify tools that the cursor position has changed in the world coordinates
  506. wxMouseEvent moveEvent( EVT_REFRESH_MOUSE );
  507. wxPoint msp = getMouseScreenPosition();
  508. moveEvent.SetX( msp.x );
  509. moveEvent.SetY( msp.y );
  510. // Set the modifiers state
  511. #if wxCHECK_VERSION( 3, 0, 0 )
  512. moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
  513. moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
  514. moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
  515. #else
  516. // wx <3.0 do not have accessors, but the fields are exposed
  517. moveEvent.m_controlDown = wxGetKeyState( WXK_CONTROL );
  518. moveEvent.m_shiftDown = wxGetKeyState( WXK_SHIFT );
  519. moveEvent.m_altDown = wxGetKeyState( WXK_ALT );
  520. #endif
  521. m_cursorPos = m_view->ToWorld( VECTOR2D( msp.x, msp.y ) );
  522. wxPostEvent( m_parentPanel, moveEvent );
  523. }
  524. wxPoint WX_VIEW_CONTROLS::getMouseScreenPosition() const
  525. {
  526. wxPoint msp = wxGetMousePosition();
  527. m_parentPanel->ScreenToClient( &msp.x, &msp.y );
  528. return msp;
  529. }
  530. void WX_VIEW_CONTROLS::UpdateScrollbars()
  531. {
  532. const BOX2D viewport = m_view->GetViewport();
  533. const BOX2D& boundary = m_view->GetBoundary();
  534. m_scrollScale.x = 2e3 / viewport.GetWidth(); // TODO it does not have to be updated so often
  535. m_scrollScale.y = 2e3 / viewport.GetHeight();
  536. VECTOR2I newScroll( ( viewport.Centre().x - boundary.GetLeft() ) * m_scrollScale.x,
  537. ( viewport.Centre().y - boundary.GetTop() ) * m_scrollScale.y );
  538. // Flip scroll direction in flipped view
  539. if( m_view->IsMirroredX() )
  540. newScroll.x = ( boundary.GetRight() - viewport.Centre().x ) * m_scrollScale.x;
  541. // Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuosly
  542. // refreshed (Windows)
  543. if( m_scrollPos != newScroll )
  544. {
  545. // Another example of wxWidgets being broken by design: scroll position is determined by the
  546. // left (or top, if vertical) edge of the slider. Fortunately, slider size seems to be constant
  547. // (at least for wxGTK and wxMSW), so we have to add its size to allow user to scroll the workspace
  548. // till the end.
  549. m_parentPanel->SetScrollbars( 1, 1,
  550. #if defined(__LINUX__)
  551. m_scrollScale.x * boundary.GetWidth() + 1623, m_scrollScale.y * boundary.GetHeight() + 1623,
  552. #elif defined(__WIN32__) || defined(__WIN64__)
  553. m_scrollScale.x * boundary.GetWidth() + 1377, m_scrollScale.y * boundary.GetHeight() + 741,
  554. #else
  555. m_scrollScale.x * boundary.GetWidth(), m_scrollScale.y * boundary.GetHeight(),
  556. #endif
  557. newScroll.x, newScroll.y, false );
  558. m_scrollPos = newScroll;
  559. }
  560. }
  561. void WX_VIEW_CONTROLS::ForceCursorPosition( bool aEnabled, const VECTOR2D& aPosition )
  562. {
  563. m_settings.m_forceCursorPosition = aEnabled;
  564. m_settings.m_forcedPosition = aPosition;
  565. }