2016-12-23 17:06:33 +01:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2016-12-23 17:06:33 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2016-12-23 16:21:00 +01:00
|
|
|
#ifndef GAL_DISPLAY_OPTIONS_H__
|
|
|
|
#define GAL_DISPLAY_OPTIONS_H__
|
|
|
|
|
2023-09-26 07:40:17 -04:00
|
|
|
#include <gal/gal.h>
|
2024-08-27 19:15:25 -04:00
|
|
|
#include <dpi_scaling.h>
|
2023-09-06 21:25:24 -04:00
|
|
|
#include <core/observable.h>
|
2016-12-23 16:21:00 +01:00
|
|
|
|
2020-01-12 20:44:19 -05:00
|
|
|
class COMMON_SETTINGS;
|
|
|
|
struct WINDOW_SETTINGS;
|
2016-12-23 16:21:00 +01:00
|
|
|
class wxString;
|
2019-04-11 20:35:52 +01:00
|
|
|
class wxWindow;
|
|
|
|
|
2023-09-27 08:22:39 +02:00
|
|
|
#if defined( _MSC_VER )
|
2023-09-26 07:40:17 -04:00
|
|
|
#pragma warning( push )
|
|
|
|
#pragma warning( disable : 4275 )
|
2023-09-27 08:22:39 +02:00
|
|
|
#endif
|
2016-12-23 16:21:00 +01:00
|
|
|
|
2017-02-13 19:43:28 +08:00
|
|
|
namespace KIGFX
|
|
|
|
{
|
|
|
|
/**
|
2025-01-04 09:21:11 -05:00
|
|
|
* Type definition of the grid style.
|
2017-02-13 19:43:28 +08:00
|
|
|
*/
|
2017-02-16 10:50:34 +08:00
|
|
|
enum class GRID_STYLE
|
2017-02-13 19:43:28 +08:00
|
|
|
{
|
2017-03-01 10:29:19 +01:00
|
|
|
DOTS, ///< Use dots for the grid
|
2017-09-14 16:52:24 +02:00
|
|
|
LINES, ///< Use lines for the grid
|
2017-03-01 10:29:19 +01:00
|
|
|
SMALL_CROSS ///< Use small cross instead of dots for the grid
|
2017-02-13 19:43:28 +08:00
|
|
|
};
|
2016-12-23 16:21:00 +01:00
|
|
|
|
2025-07-27 20:22:59 -07:00
|
|
|
enum class GAL_ANTIALIASING_MODE
|
2017-01-11 16:19:58 +01:00
|
|
|
{
|
2025-07-27 20:22:59 -07:00
|
|
|
AA_NONE,
|
|
|
|
AA_FAST,
|
|
|
|
AA_HIGHQUALITY,
|
2018-01-04 05:13:00 -07:00
|
|
|
};
|
|
|
|
|
2020-09-10 20:07:56 -07:00
|
|
|
enum class GRID_SNAPPING
|
|
|
|
{
|
|
|
|
ALWAYS,
|
|
|
|
WITH_GRID,
|
|
|
|
NEVER
|
|
|
|
};
|
|
|
|
|
2025-08-22 18:19:28 -07:00
|
|
|
enum class CROSS_HAIR_MODE : int
|
|
|
|
{
|
|
|
|
SMALL_CROSS,
|
|
|
|
FULLSCREEN_CROSS,
|
|
|
|
FULLSCREEN_DIAGONAL
|
|
|
|
};
|
|
|
|
|
2017-02-13 19:43:28 +08:00
|
|
|
class GAL_DISPLAY_OPTIONS;
|
|
|
|
|
2023-09-26 07:40:17 -04:00
|
|
|
class GAL_API GAL_DISPLAY_OPTIONS_OBSERVER
|
2016-12-23 16:21:00 +01:00
|
|
|
{
|
|
|
|
public:
|
2017-01-11 16:19:58 +01:00
|
|
|
virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
|
2025-01-04 09:21:11 -05:00
|
|
|
|
2017-02-16 09:15:45 +08:00
|
|
|
protected:
|
|
|
|
// Observer lifetimes aren't handled by base class pointer
|
|
|
|
virtual ~GAL_DISPLAY_OPTIONS_OBSERVER() {}
|
2016-12-23 16:21:00 +01:00
|
|
|
};
|
|
|
|
|
2023-09-26 07:40:17 -04:00
|
|
|
class GAL_API GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
|
2016-12-23 16:21:00 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
GAL_DISPLAY_OPTIONS();
|
|
|
|
|
2025-01-06 12:07:47 +00:00
|
|
|
virtual ~GAL_DISPLAY_OPTIONS()
|
|
|
|
{}
|
|
|
|
|
2025-07-27 20:22:59 -07:00
|
|
|
GAL_ANTIALIASING_MODE antialiasing_mode;
|
2018-01-04 05:13:00 -07:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< The grid style to draw the grid in
|
2017-02-13 19:53:58 +08:00
|
|
|
KIGFX::GRID_STYLE m_gridStyle;
|
2017-02-14 23:31:21 +08:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< Snapping options for the grid
|
2020-09-10 20:07:56 -07:00
|
|
|
GRID_SNAPPING m_gridSnapping;
|
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< Thickness to render grid lines/dots
|
2017-02-14 23:31:21 +08:00
|
|
|
double m_gridLineWidth;
|
2017-02-13 11:47:50 +08:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< Minimum pixel distance between displayed grid lines
|
2017-02-13 11:47:50 +08:00
|
|
|
double m_gridMinSpacing;
|
2017-03-08 09:37:12 +01:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< Whether or not to draw the coordinate system axes
|
2017-03-08 09:37:12 +01:00
|
|
|
bool m_axesEnabled;
|
2017-03-19 04:03:24 +08:00
|
|
|
|
2025-08-22 18:19:28 -07:00
|
|
|
///< Crosshair drawing mode
|
|
|
|
CROSS_HAIR_MODE m_crossHairMode;
|
2017-03-20 04:51:59 +08:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< Force cursor display
|
2017-03-19 04:03:24 +08:00
|
|
|
bool m_forceDisplayCursor;
|
2019-03-22 21:15:26 +00:00
|
|
|
|
2021-01-25 07:42:36 -05:00
|
|
|
///< The pixel scale factor (>1 for hi-DPI scaled displays)
|
2019-03-22 21:15:26 +00:00
|
|
|
double m_scaleFactor;
|
2016-12-23 16:21:00 +01:00
|
|
|
|
2025-08-22 18:19:28 -07:00
|
|
|
void SetCursorMode( CROSS_HAIR_MODE aMode ) { m_crossHairMode = aMode; }
|
|
|
|
|
|
|
|
CROSS_HAIR_MODE GetCursorMode() const { return m_crossHairMode; }
|
|
|
|
|
2023-09-22 23:17:53 -04:00
|
|
|
void NotifyChanged();
|
|
|
|
};
|
2023-09-26 07:40:17 -04:00
|
|
|
|
|
|
|
} // namespace KIGFX
|
|
|
|
|
2023-09-27 08:22:39 +02:00
|
|
|
#if defined( _MSC_VER )
|
2023-09-26 07:40:17 -04:00
|
|
|
#pragma warning( pop )
|
2023-09-27 08:22:39 +02:00
|
|
|
#endif
|
2016-12-23 16:21:00 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|