gal as a shared lib, gaasl!

This commit is contained in:
Marek Roszko 2023-09-26 07:40:17 -04:00
parent 464179894d
commit 4746bde4b3
30 changed files with 162 additions and 49 deletions

View File

@ -40,6 +40,7 @@
paths: paths:
- build/linux/3d-viewer/ - build/linux/3d-viewer/
- build/linux/common/libkicommon.so* - build/linux/common/libkicommon.so*
- build/linux/common/gal/libgal.so*
- build/linux/eeschema/_eeschema.kiface - build/linux/eeschema/_eeschema.kiface
- build/linux/kicad/kicad-cli - build/linux/kicad/kicad-cli
- build/linux/pcbnew/pcbnew.py - build/linux/pcbnew/pcbnew.py

View File

@ -381,15 +381,6 @@ set( PLUGINS_EASYEDAPRO_SRCS
plugins/easyedapro/easyedapro_import_utils.cpp plugins/easyedapro/easyedapro_import_utils.cpp
) )
set( FONT_SRCS
font/font.cpp
font/glyph.cpp
font/stroke_font.cpp
font/outline_font.cpp
font/outline_decomposer.cpp
font/text_attributes.cpp
)
set( COMMON_IMPORT_GFX_SRCS set( COMMON_IMPORT_GFX_SRCS
import_gfx/graphics_import_mgr.cpp import_gfx/graphics_import_mgr.cpp
import_gfx/graphics_importer.cpp import_gfx/graphics_importer.cpp
@ -511,10 +502,6 @@ set( COMMON_SRCS
origin_viewitem.cpp origin_viewitem.cpp
view/view.cpp
view/view_item.cpp
view/view_group.cpp
tool/action_manager.cpp tool/action_manager.cpp
tool/action_menu.cpp tool/action_menu.cpp
tool/action_toolbar.cpp tool/action_toolbar.cpp

View File

@ -1,4 +1,14 @@
set( FONT_SRCS
../font/font.cpp
../font/glyph.cpp
../font/stroke_font.cpp
../font/outline_font.cpp
../font/outline_decomposer.cpp
../font/text_attributes.cpp
)
set( GAL_SRCS set( GAL_SRCS
# Common part # Common part
../callback_gal.cpp ../callback_gal.cpp
@ -10,9 +20,14 @@ set( GAL_SRCS
hidpi_gl_canvas.cpp hidpi_gl_canvas.cpp
hidpi_gl_3D_canvas.cpp hidpi_gl_3D_canvas.cpp
../view/view.cpp
../view/view_controls.cpp ../view/view_controls.cpp
../view/view_group.cpp
../view/view_overlay.cpp ../view/view_overlay.cpp
../view/zoom_controller.cpp ../view/zoom_controller.cpp
../view/view_item.cpp
${FONT_SRCS}
3d/camera.cpp 3d/camera.cpp
@ -40,7 +55,7 @@ set( GAL_SRCS
cairo/cairo_print.cpp cairo/cairo_print.cpp
) )
add_library( gal STATIC ${GAL_SRCS} ) add_library( gal SHARED ${GAL_SRCS} )
if( WIN32 ) if( WIN32 )
# we need the gdiplus library for cairo printing on windows # we need the gdiplus library for cairo printing on windows
@ -49,7 +64,6 @@ endif()
target_link_libraries( gal target_link_libraries( gal
kicommon kicommon
common
kimath kimath
kiplatform kiplatform
nlohmann_json nlohmann_json
@ -63,6 +77,42 @@ target_link_libraries( gal
${HarfBuzz_LIBRARIES} ${HarfBuzz_LIBRARIES}
${Fontconfig_LIBRARIES} ${Fontconfig_LIBRARIES}
) )
target_compile_definitions( gal PRIVATE GAL_DLL=1 )
install( TARGETS gal
RUNTIME DESTINATION ${KICAD_LIB}
LIBRARY DESTINATION ${KICAD_LIB}
COMPONENT binary
)
include( ${KICAD_CMAKE_MODULE_PATH}/KiCadVersion.cmake )
include( ${KICAD_CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header(${CMAKE_SOURCE_DIR})
# Extract the major and minor build version as a string
string( REGEX MATCH
"([0-9]+)\\.([0-9]+)\\.([0-9]+)"
KICAD_MAJOR_MINOR_PATCH_VERSION
"${KICAD_VERSION}"
)
set_target_properties( gal PROPERTIES
OUTPUT_NAME gal
SOVERSION ${KICAD_MAJOR_MINOR_PATCH_VERSION}
)
if( APPLE )
# puts library into the main kicad.app bundle in build tree
set_target_properties( gal PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}"
INSTALL_NAME_DIR "${OSX_BUNDLE_BUILD_LIB_DIR}"
)
set_target_properties( gal PROPERTIES INSTALL_RPATH
"@executable_path/../Frameworks" )
set_target_properties( gal PROPERTIES BUILD_WITH_INSTALL_RPATH 1 )
endif()
function( add_shader outTarget inFile shaderName ) function( add_shader outTarget inFile shaderName )
set(outCppName "${shaderName}.cpp") set(outCppName "${shaderName}.cpp")
set(outHeaderName "${shaderName}.h") set(outHeaderName "${shaderName}.h")

View File

@ -23,6 +23,7 @@
#include <gal/dpi_scaling.h> #include <gal/dpi_scaling.h>
double DPI_SCALING::GetMaxScaleFactor() double DPI_SCALING::GetMaxScaleFactor()
{ {
// displays with higher than 4.0 DPI are not really going to be useful // displays with higher than 4.0 DPI are not really going to be useful
@ -37,6 +38,7 @@ double DPI_SCALING::GetMinScaleFactor()
return 1.0; return 1.0;
} }
double DPI_SCALING::GetDefaultScaleFactor() double DPI_SCALING::GetDefaultScaleFactor()
{ {
// no scaling => 1.0 // no scaling => 1.0

View File

@ -119,6 +119,7 @@ principle should be easily implemented by adapting the current STL containers.
// TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;) // TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;)
#define KICOMMON_API #define KICOMMON_API
#define GAL_API
// header files that must be wrapped // header files that must be wrapped

View File

@ -24,9 +24,10 @@
#ifndef CALLBACK_GAL_H #ifndef CALLBACK_GAL_H
#define CALLBACK_GAL_H #define CALLBACK_GAL_H
#include <gal/gal.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
class CALLBACK_GAL : public KIGFX::GAL class GAL_API CALLBACK_GAL : public KIGFX::GAL
{ {
public: public:
CALLBACK_GAL( KIGFX::GAL_DISPLAY_OPTIONS& aDisplayOptions, CALLBACK_GAL( KIGFX::GAL_DISPLAY_OPTIONS& aDisplayOptions,

View File

@ -27,6 +27,7 @@
#ifndef FONT_H_ #ifndef FONT_H_
#define FONT_H_ #define FONT_H_
#include <gal/gal.h>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
@ -89,7 +90,7 @@ inline bool IsSubscript( TEXT_STYLE_FLAGS aFlags )
namespace KIFONT namespace KIFONT
{ {
class METRICS class GAL_API METRICS
{ {
public: public:
/** /**
@ -126,7 +127,7 @@ public:
/** /**
* FONT is an abstract base class for both outline and stroke fonts * FONT is an abstract base class for both outline and stroke fonts
*/ */
class FONT class GAL_API FONT
{ {
public: public:
explicit FONT(); explicit FONT();

View File

@ -25,12 +25,15 @@
#ifndef GLYPH_H #ifndef GLYPH_H
#define GLYPH_H #define GLYPH_H
#include <gal/gal.h>
#include <memory> #include <memory>
#include <math/box2.h> #include <math/box2.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#include <wx/debug.h> #include <wx/debug.h>
#include "../../libs/kimath/include/geometry/eda_angle.h" #include "../../libs/kimath/include/geometry/eda_angle.h"
#pragma warning( push )
#pragma warning( disable : 4275 )
namespace KIFONT namespace KIFONT
{ {
@ -42,7 +45,7 @@ constexpr int GLYPH_RESOLUTION = 288;
constexpr double GLYPH_SIZE_SCALER = GLYPH_DEFAULT_DPI / (double) GLYPH_RESOLUTION; constexpr double GLYPH_SIZE_SCALER = GLYPH_DEFAULT_DPI / (double) GLYPH_RESOLUTION;
class GLYPH class GAL_API GLYPH
{ {
public: public:
virtual ~GLYPH() virtual ~GLYPH()
@ -55,7 +58,7 @@ public:
}; };
class OUTLINE_GLYPH : public GLYPH, public SHAPE_POLY_SET class GAL_API OUTLINE_GLYPH : public GLYPH, public SHAPE_POLY_SET
{ {
public: public:
OUTLINE_GLYPH() : OUTLINE_GLYPH() :
@ -80,7 +83,7 @@ public:
}; };
class STROKE_GLYPH : public GLYPH, public std::vector<std::vector<VECTOR2D>> class GAL_API STROKE_GLYPH : public GLYPH, public std::vector<std::vector<VECTOR2D>>
{ {
public: public:
STROKE_GLYPH() STROKE_GLYPH()
@ -114,4 +117,6 @@ typedef std::vector<BOX2D> GLYPH_BOUNDING_BOX_LIST;
} // namespace KIFONT } // namespace KIFONT
#pragma warning( pop )
#endif // GLYPH_H #endif // GLYPH_H

View File

@ -27,6 +27,7 @@
#ifndef OUTLINE_FONT_H_ #ifndef OUTLINE_FONT_H_
#define OUTLINE_FONT_H_ #define OUTLINE_FONT_H_
#include <gal/gal.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <ft2build.h> #include <ft2build.h>
@ -47,7 +48,7 @@ namespace KIFONT
/** /**
* Class OUTLINE_FONT implements outline font drawing. * Class OUTLINE_FONT implements outline font drawing.
*/ */
class OUTLINE_FONT : public FONT class GAL_API OUTLINE_FONT : public FONT
{ {
public: public:
OUTLINE_FONT(); OUTLINE_FONT();

View File

@ -30,6 +30,7 @@
#ifndef STROKE_FONT_H #ifndef STROKE_FONT_H
#define STROKE_FONT_H #define STROKE_FONT_H
#include <gal/gal.h>
#include <map> #include <map>
#include <deque> #include <deque>
#include <algorithm> #include <algorithm>
@ -49,7 +50,7 @@ namespace KIFONT
* *
* A stroke font is composed of lines. * A stroke font is composed of lines.
*/ */
class STROKE_FONT : public FONT class GAL_API STROKE_FONT : public FONT
{ {
public: public:
STROKE_FONT(); STROKE_FONT();

View File

@ -24,6 +24,7 @@
#include <math/vector2d.h> #include <math/vector2d.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <geometry/eda_angle.h> #include <geometry/eda_angle.h>
#include <gal/gal.h>
namespace KIFONT namespace KIFONT
@ -56,7 +57,7 @@ enum GR_TEXT_V_ALIGN_T
#define TO_VJUSTIFY( x ) static_cast<GR_TEXT_V_ALIGN_T>( x ) #define TO_VJUSTIFY( x ) static_cast<GR_TEXT_V_ALIGN_T>( x )
class TEXT_ATTRIBUTES class GAL_API TEXT_ATTRIBUTES
{ {
public: public:
TEXT_ATTRIBUTES( KIFONT::FONT* aFont = nullptr ); TEXT_ATTRIBUTES( KIFONT::FONT* aFont = nullptr );
@ -87,7 +88,7 @@ public:
}; };
extern std::ostream& operator<<( std::ostream& aStream, const TEXT_ATTRIBUTES& aAttributes ); extern GAL_API std::ostream& operator<<( std::ostream& aStream, const TEXT_ATTRIBUTES& aAttributes );
template<> template<>

View File

@ -30,6 +30,7 @@
#ifndef CAMERA_H #ifndef CAMERA_H
#define CAMERA_H #define CAMERA_H
#include <gal/gal.h>
#include <plugins/3dapi/xv3d_types.h> #include <plugins/3dapi/xv3d_types.h>
#include <wx/gdicmn.h> // for wxSize #include <wx/gdicmn.h> // for wxSize
#include <vector> #include <vector>
@ -74,7 +75,7 @@ enum class CAMERA_INTERPOLATION
* *
* It must be derived by other classes to implement a real camera object. * It must be derived by other classes to implement a real camera object.
*/ */
class CAMERA class GAL_API CAMERA
{ {
public: public:
static const float DEFAULT_MIN_ZOOM; static const float DEFAULT_MIN_ZOOM;

View File

@ -34,6 +34,7 @@
#include <cairo.h> #include <cairo.h>
#include <gal/gal.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
@ -54,7 +55,7 @@ namespace KIGFX
{ {
class CAIRO_COMPOSITOR; class CAIRO_COMPOSITOR;
class CAIRO_GAL_BASE : public GAL class GAL_API CAIRO_GAL_BASE : public GAL
{ {
public: public:
CAIRO_GAL_BASE( GAL_DISPLAY_OPTIONS& aDisplayOptions ); CAIRO_GAL_BASE( GAL_DISPLAY_OPTIONS& aDisplayOptions );
@ -372,7 +373,7 @@ protected:
}; };
class CAIRO_GAL : public CAIRO_GAL_BASE, public wxWindow class GAL_API CAIRO_GAL : public CAIRO_GAL_BASE, public wxWindow
{ {
public: public:
/** /**

View File

@ -24,6 +24,7 @@
#ifndef DPI_SCALING__H #ifndef DPI_SCALING__H
#define DPI_SCALING__H #define DPI_SCALING__H
#include <gal/gal.h>
#include <wx/window.h> #include <wx/window.h>
/** /**
@ -31,7 +32,7 @@
* scale to use for canvases. This has several sources and the availability of * scale to use for canvases. This has several sources and the availability of
* some of them are platform dependent. * some of them are platform dependent.
*/ */
class DPI_SCALING class GAL_API DPI_SCALING
{ {
public: public:
/** /**

32
include/gal/gal.h Normal file
View File

@ -0,0 +1,32 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <import_export.h>
#ifndef SWIG
#if defined( GAL_DLL )
#define GAL_API APIEXPORT
#else
#define GAL_API APIIMPORT
#endif
#else
#define GAL_API
#endif

View File

@ -24,6 +24,7 @@
#ifndef GAL_DISPLAY_OPTIONS_H__ #ifndef GAL_DISPLAY_OPTIONS_H__
#define GAL_DISPLAY_OPTIONS_H__ #define GAL_DISPLAY_OPTIONS_H__
#include <gal/gal.h>
#include <gal/dpi_scaling.h> #include <gal/dpi_scaling.h>
#include <core/observable.h> #include <core/observable.h>
@ -32,6 +33,8 @@ struct WINDOW_SETTINGS;
class wxString; class wxString;
class wxWindow; class wxWindow;
#pragma warning( push )
#pragma warning( disable : 4275 )
namespace KIGFX namespace KIGFX
{ {
@ -68,7 +71,7 @@ namespace KIGFX
class GAL_DISPLAY_OPTIONS; class GAL_DISPLAY_OPTIONS;
class GAL_DISPLAY_OPTIONS_OBSERVER class GAL_API GAL_DISPLAY_OPTIONS_OBSERVER
{ {
public: public:
virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0; virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
@ -77,7 +80,7 @@ namespace KIGFX
virtual ~GAL_DISPLAY_OPTIONS_OBSERVER() {} virtual ~GAL_DISPLAY_OPTIONS_OBSERVER() {}
}; };
class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER> class GAL_API GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
{ {
public: public:
GAL_DISPLAY_OPTIONS(); GAL_DISPLAY_OPTIONS();
@ -112,7 +115,10 @@ namespace KIGFX
void NotifyChanged(); void NotifyChanged();
}; };
}
} // namespace KIGFX
#pragma warning( pop )
#endif #endif

View File

@ -19,6 +19,8 @@
#ifndef GAL_PRINT_H #ifndef GAL_PRINT_H
#define GAL_PRINT_H #define GAL_PRINT_H
#include <gal/gal.h>
class wxDC; class wxDC;
namespace KIGFX { namespace KIGFX {
@ -26,7 +28,7 @@ class GAL;
class GAL_DISPLAY_OPTIONS; class GAL_DISPLAY_OPTIONS;
class PRINT_CONTEXT class GAL_API PRINT_CONTEXT
{ {
public: public:
virtual ~PRINT_CONTEXT() {} virtual ~PRINT_CONTEXT() {}
@ -38,7 +40,7 @@ public:
/** /**
* @brief Wrapper around GAL to provide information needed for printing. * @brief Wrapper around GAL to provide information needed for printing.
*/ */
class GAL_PRINT class GAL_API GAL_PRINT
{ {
public: public:
static std::unique_ptr<GAL_PRINT> Create( GAL_DISPLAY_OPTIONS& aOptions, wxDC* aDC ); static std::unique_ptr<GAL_PRINT> Create( GAL_DISPLAY_OPTIONS& aOptions, wxDC* aDC );

View File

@ -33,6 +33,7 @@
#include <math/matrix3x3.h> #include <math/matrix3x3.h>
#include <gal/gal.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <gal/cursors.h> #include <gal/cursors.h>
#include <gal/definitions.h> #include <gal/definitions.h>
@ -56,7 +57,7 @@ namespace KIGFX
* this layer. So zooming is handled here as well. * this layer. So zooming is handled here as well.
* *
*/ */
class GAL : GAL_DISPLAY_OPTIONS_OBSERVER class GAL_API GAL : GAL_DISPLAY_OPTIONS_OBSERVER
{ {
// These friend declarations allow us to hide routines that should not be called. The // These friend declarations allow us to hide routines that should not be called. The
// corresponding RAII objects must be used instead. // corresponding RAII objects must be used instead.

View File

@ -25,6 +25,7 @@
#ifndef HIDPI_GL_3D_CANVAS_H #ifndef HIDPI_GL_3D_CANVAS_H
#define HIDPI_GL_3D_CANVAS_H #define HIDPI_GL_3D_CANVAS_H
#include <gal/gal.h>
#include <atomic> #include <atomic>
#include <gal/3d/camera.h> #include <gal/3d/camera.h>
#include <gal/hidpi_gl_canvas.h> #include <gal/hidpi_gl_canvas.h>
@ -35,7 +36,7 @@
* Provides basic 3D controls ( zoom, rotate, translate, ... ) * Provides basic 3D controls ( zoom, rotate, translate, ... )
* *
*/ */
class HIDPI_GL_3D_CANVAS : public HIDPI_GL_CANVAS class GAL_API HIDPI_GL_3D_CANVAS : public HIDPI_GL_CANVAS
{ {
public: public:
// wxGLCanvas constructor // wxGLCanvas constructor

View File

@ -29,6 +29,7 @@
#include <view/view_controls.h> #include <view/view_controls.h>
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
#include <gal/gal.h>
/** /**
@ -36,7 +37,7 @@
* *
* This is a small wrapper class to enable HiDPI/Retina support for wxGLCanvas. * This is a small wrapper class to enable HiDPI/Retina support for wxGLCanvas.
*/ */
class HIDPI_GL_CANVAS : public wxGLCanvas class GAL_API HIDPI_GL_CANVAS : public wxGLCanvas
{ {
public: public:
// wxGLCanvas constructor // wxGLCanvas constructor

View File

@ -27,11 +27,12 @@
#ifndef GL_CONTEXT_MANAGER_H #ifndef GL_CONTEXT_MANAGER_H
#define GL_CONTEXT_MANAGER_H #define GL_CONTEXT_MANAGER_H
#include <gal/gal.h>
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
#include <mutex> #include <mutex>
#include <map> #include <map>
class GL_CONTEXT_MANAGER class GAL_API GL_CONTEXT_MANAGER
{ {
public: public:
/** /**

View File

@ -30,6 +30,7 @@
#define OPENGLGAL_H_ #define OPENGLGAL_H_
// GAL imports // GAL imports
#include <gal/gal.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <gal/gal_display_options.h> #include <gal/gal_display_options.h>
#include <gal/opengl/shader.h> #include <gal/opengl/shader.h>
@ -66,7 +67,7 @@ class GL_BITMAP_CACHE;
* and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern * and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern
* graphics card GPUs. All methods here benefit thus from the hardware acceleration. * graphics card GPUs. All methods here benefit thus from the hardware acceleration.
*/ */
class OPENGL_GAL : public GAL, public HIDPI_GL_CANVAS class GAL_API OPENGL_GAL : public GAL, public HIDPI_GL_CANVAS
{ {
public: public:
/** /**

View File

@ -34,6 +34,7 @@
#include <wx/dc.h> #include <wx/dc.h>
#include <gal/gal.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <render_settings.h> #include <render_settings.h>
#include <layer_ids.h> #include <layer_ids.h>
@ -54,7 +55,7 @@ class VIEW_ITEM;
* of the objects as simple container objects in DLL/DSOs. PAINTER is an abstract layer * of the objects as simple container objects in DLL/DSOs. PAINTER is an abstract layer
* because every module (pcbnew, eeschema, etc.) has to draw different kinds of objects. * because every module (pcbnew, eeschema, etc.) has to draw different kinds of objects.
*/ */
class PAINTER class GAL_API PAINTER
{ {
public: public:
/** /**

View File

@ -121,6 +121,8 @@ private:
FuncType m_func; FuncType m_func;
}; };
#pragma warning( push )
#pragma warning( disable : 5266 ) // 'const' qualifier on return type has no effect
template<typename Owner, typename T, typename Base = Owner> template<typename Owner, typename T, typename Base = Owner>
class METHOD class METHOD
@ -174,6 +176,7 @@ public:
METHOD() = delete; METHOD() = delete;
}; };
#pragma warning( pop )
class PROPERTY_BASE class PROPERTY_BASE
{ {

View File

@ -27,6 +27,7 @@
#ifndef __VIEW_H #ifndef __VIEW_H
#define __VIEW_H #define __VIEW_H
#include <gal/gal.h>
#include <vector> #include <vector>
#include <set> #include <set>
#include <unordered_map> #include <unordered_map>
@ -63,7 +64,7 @@ class VIEW_RTREE;
* final stage by the GAL. The VIEW class also provides fast methods for finding all visible * final stage by the GAL. The VIEW class also provides fast methods for finding all visible
* objects that are within a given rectangular area, useful for object selection/hit testing. * objects that are within a given rectangular area, useful for object selection/hit testing.
*/ */
class VIEW class GAL_API VIEW
{ {
public: public:
friend class VIEW_ITEM; friend class VIEW_ITEM;

View File

@ -31,6 +31,7 @@
#include <math/box2.h> #include <math/box2.h>
#include <settings/common_settings.h> #include <settings/common_settings.h>
#include <gal/gal.h>
namespace KIGFX namespace KIGFX
{ {
@ -38,7 +39,7 @@ class VIEW;
///< Structure to keep VIEW_CONTROLS settings for easy store/restore operations ///< Structure to keep VIEW_CONTROLS settings for easy store/restore operations
struct VC_SETTINGS struct GAL_API VC_SETTINGS
{ {
VC_SETTINGS() VC_SETTINGS()
{ {
@ -130,7 +131,7 @@ struct VC_SETTINGS
* An interface for classes handling user events controlling the view behavior such as * An interface for classes handling user events controlling the view behavior such as
* zooming, panning, mouse grab, etc. * zooming, panning, mouse grab, etc.
*/ */
class VIEW_CONTROLS class GAL_API VIEW_CONTROLS
{ {
public: public:
VIEW_CONTROLS( VIEW* aView ) : VIEW_CONTROLS( VIEW* aView ) :

View File

@ -32,6 +32,7 @@
#ifndef VIEW_GROUP_H_ #ifndef VIEW_GROUP_H_
#define VIEW_GROUP_H_ #define VIEW_GROUP_H_
#include <gal/gal.h>
#include <view/view_item.h> #include <view/view_item.h>
#include <deque> #include <deque>
@ -43,7 +44,7 @@ namespace KIGFX
* VIEW_GROUP does not take over ownership of the held items. The main purpose of this class is * VIEW_GROUP does not take over ownership of the held items. The main purpose of this class is
* to group items and draw them on a single layer (in particular the overlay). * to group items and draw them on a single layer (in particular the overlay).
*/ */
class VIEW_GROUP : public VIEW_ITEM class GAL_API VIEW_GROUP : public VIEW_ITEM
{ {
public: public:
VIEW_GROUP( VIEW* aView = nullptr ); VIEW_GROUP( VIEW* aView = nullptr );

View File

@ -27,11 +27,14 @@
#ifndef __VIEW_ITEM_H #ifndef __VIEW_ITEM_H
#define __VIEW_ITEM_H #define __VIEW_ITEM_H
#include <gal/gal.h>
#include <vector> #include <vector>
#include <bitset> #include <bitset>
#include <math/box2.h> #include <math/box2.h>
#include <inspectable.h> #include <inspectable.h>
#pragma warning( push )
#pragma warning( disable : 4275 )
namespace KIGFX namespace KIGFX
{ {
@ -73,7 +76,7 @@ enum VIEW_VISIBILITY_FLAGS {
* VIEW_ITEM objects are never owned by a #VIEW. A single VIEW_ITEM can belong to any number of * VIEW_ITEM objects are never owned by a #VIEW. A single VIEW_ITEM can belong to any number of
* static VIEWs, but only one dynamic VIEW due to storage of only one VIEW reference. * static VIEWs, but only one dynamic VIEW due to storage of only one VIEW reference.
*/ */
class VIEW_ITEM : public INSPECTABLE class GAL_API VIEW_ITEM : public INSPECTABLE
{ {
public: public:
VIEW_ITEM() : VIEW_ITEM() :
@ -161,4 +164,6 @@ private:
} // namespace KIGFX } // namespace KIGFX
#pragma warning( pop )
#endif #endif

View File

@ -27,6 +27,7 @@
#ifndef __VIEW_OVERLAY_H #ifndef __VIEW_OVERLAY_H
#define __VIEW_OVERLAY_H #define __VIEW_OVERLAY_H
#include <gal/gal.h>
#include <view/view_item.h> #include <view/view_item.h>
#include <vector> #include <vector>
@ -40,7 +41,7 @@ namespace KIGFX
{ {
class VIEW; class VIEW;
class VIEW_OVERLAY : public VIEW_ITEM class GAL_API VIEW_OVERLAY : public VIEW_ITEM
{ {
public: public:

View File

@ -30,6 +30,7 @@
#ifndef __ZOOM_CONTROLLER_H #ifndef __ZOOM_CONTROLLER_H
#define __ZOOM_CONTROLLER_H #define __ZOOM_CONTROLLER_H
#include <gal/gal.h>
#include <chrono> #include <chrono>
#include <memory> #include <memory>
@ -39,7 +40,7 @@ namespace KIGFX
/** /**
* Handle the response of the zoom scale to external inputs. * Handle the response of the zoom scale to external inputs.
*/ */
class ZOOM_CONTROLLER class GAL_API ZOOM_CONTROLLER
{ {
public: public:
virtual ~ZOOM_CONTROLLER() = default; virtual ~ZOOM_CONTROLLER() = default;
@ -58,7 +59,7 @@ public:
/** /**
* Class that zooms faster if scroll events happen very close together. * Class that zooms faster if scroll events happen very close together.
*/ */
class ACCELERATING_ZOOM_CONTROLLER : public ZOOM_CONTROLLER class GAL_API ACCELERATING_ZOOM_CONTROLLER : public ZOOM_CONTROLLER
{ {
public: public:
///< The type of the acceleration timeout. ///< The type of the acceleration timeout.
@ -138,7 +139,7 @@ private:
* A CONSTANT_ZOOM_CONTROLLER that zooms by a fixed factor based only on the magnitude of the scroll * A CONSTANT_ZOOM_CONTROLLER that zooms by a fixed factor based only on the magnitude of the scroll
* wheel rotation. * wheel rotation.
*/ */
class CONSTANT_ZOOM_CONTROLLER : public ZOOM_CONTROLLER class GAL_API CONSTANT_ZOOM_CONTROLLER : public ZOOM_CONTROLLER
{ {
public: public:
/** /**