2016-12-23 16:06:33 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
2021-01-25 12:42:36 +00:00
|
|
|
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-12-23 16:06:33 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2016-12-23 15:21:00 +00:00
|
|
|
#ifndef GAL_DISPLAY_OPTIONS_H__
|
|
|
|
#define GAL_DISPLAY_OPTIONS_H__
|
|
|
|
|
2020-06-19 16:02:46 +00:00
|
|
|
#include <gal/dpi_scaling.h>
|
2016-12-23 15:21:00 +00:00
|
|
|
#include <observable.h>
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
class COMMON_SETTINGS;
|
|
|
|
struct WINDOW_SETTINGS;
|
2016-12-23 15:21:00 +00:00
|
|
|
class wxString;
|
2019-04-11 19:35:52 +00:00
|
|
|
class wxWindow;
|
|
|
|
|
2016-12-23 15:21:00 +00:00
|
|
|
|
2017-02-13 11:43:28 +00:00
|
|
|
namespace KIGFX
|
|
|
|
{
|
|
|
|
/**
|
2017-02-16 02:50:34 +00:00
|
|
|
* GRID_STYLE: Type definition of the grid style
|
2017-02-13 11:43:28 +00:00
|
|
|
*/
|
2017-02-16 02:50:34 +00:00
|
|
|
enum class GRID_STYLE
|
2017-02-13 11:43:28 +00:00
|
|
|
{
|
2017-03-01 09:29:19 +00:00
|
|
|
DOTS, ///< Use dots for the grid
|
2017-09-14 14:52:24 +00:00
|
|
|
LINES, ///< Use lines for the grid
|
2017-03-01 09:29:19 +00:00
|
|
|
SMALL_CROSS ///< Use small cross instead of dots for the grid
|
2017-02-13 11:43:28 +00:00
|
|
|
};
|
2016-12-23 15:21:00 +00:00
|
|
|
|
2017-02-16 02:40:35 +00:00
|
|
|
enum class OPENGL_ANTIALIASING_MODE
|
2017-01-11 15:19:58 +00:00
|
|
|
{
|
2017-02-16 02:40:35 +00:00
|
|
|
NONE,
|
2021-06-09 00:20:41 +00:00
|
|
|
SMAA,
|
|
|
|
SUPERSAMPLING,
|
2016-12-23 15:21:00 +00:00
|
|
|
};
|
|
|
|
|
2018-01-04 12:13:00 +00:00
|
|
|
enum class CAIRO_ANTIALIASING_MODE
|
|
|
|
{
|
|
|
|
NONE,
|
|
|
|
FAST,
|
|
|
|
GOOD,
|
|
|
|
};
|
|
|
|
|
2020-09-11 03:07:56 +00:00
|
|
|
enum class GRID_SNAPPING
|
|
|
|
{
|
|
|
|
ALWAYS,
|
|
|
|
WITH_GRID,
|
|
|
|
NEVER
|
|
|
|
};
|
|
|
|
|
2017-02-13 11:43:28 +00:00
|
|
|
class GAL_DISPLAY_OPTIONS;
|
|
|
|
|
2016-12-23 15:21:00 +00:00
|
|
|
class GAL_DISPLAY_OPTIONS_OBSERVER
|
|
|
|
{
|
|
|
|
public:
|
2017-01-11 15:19:58 +00:00
|
|
|
virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
|
2017-02-16 01:15:45 +00:00
|
|
|
protected:
|
|
|
|
// Observer lifetimes aren't handled by base class pointer
|
|
|
|
virtual ~GAL_DISPLAY_OPTIONS_OBSERVER() {}
|
2016-12-23 15:21:00 +00:00
|
|
|
};
|
|
|
|
|
2017-01-11 15:19:58 +00:00
|
|
|
class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
|
2016-12-23 15:21:00 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
GAL_DISPLAY_OPTIONS();
|
|
|
|
|
2019-04-11 19:35:52 +00:00
|
|
|
/**
|
2021-01-25 12:42:36 +00:00
|
|
|
* Read GAL config options from application-level config
|
2020-01-13 01:44:19 +00:00
|
|
|
* @param aCfg the window settings to load from
|
2019-04-11 19:35:52 +00:00
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadWindowSettings( WINDOW_SETTINGS& aCfg );
|
2019-04-11 19:35:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Read GAL config options from the common config store
|
2020-01-13 01:44:19 +00:00
|
|
|
* @param aCommonSettings the common config store
|
|
|
|
* @param aWindow the wx parent window (used for DPI scaling)
|
2019-04-11 19:35:52 +00:00
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadCommonConfig( COMMON_SETTINGS& aCommonSettings, wxWindow* aWindow );
|
2019-04-11 19:35:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Read application and common configs
|
|
|
|
* @param aCommonConfig the common config store
|
|
|
|
* @param aCfg the application config base
|
|
|
|
* @param aBaseName the application's GAL options key prefix
|
|
|
|
* @param aWindow the wx parent window (used for DPI scaling)
|
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadConfig( COMMON_SETTINGS& aCommonConfig, WINDOW_SETTINGS& aWindowConfig,
|
|
|
|
wxWindow* aWindow );
|
2019-04-11 19:35:52 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void WriteConfig( WINDOW_SETTINGS& aCfg );
|
2016-12-23 15:21:00 +00:00
|
|
|
|
2020-02-21 22:57:32 +00:00
|
|
|
void UpdateScaleFactor();
|
|
|
|
|
2016-12-23 15:21:00 +00:00
|
|
|
void NotifyChanged();
|
2017-02-13 11:43:28 +00:00
|
|
|
|
|
|
|
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode;
|
2017-02-13 11:53:58 +00:00
|
|
|
|
2018-01-04 12:13:00 +00:00
|
|
|
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode;
|
|
|
|
|
2020-02-21 22:57:32 +00:00
|
|
|
DPI_SCALING m_dpi;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The grid style to draw the grid in
|
2017-02-13 11:53:58 +00:00
|
|
|
KIGFX::GRID_STYLE m_gridStyle;
|
2017-02-14 15:31:21 +00:00
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Snapping options for the grid
|
2020-09-11 03:07:56 +00:00
|
|
|
GRID_SNAPPING m_gridSnapping;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Thickness to render grid lines/dots
|
2017-02-14 15:31:21 +00:00
|
|
|
double m_gridLineWidth;
|
2017-02-13 03:47:50 +00:00
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Minimum pixel distance between displayed grid lines
|
2017-02-13 03:47:50 +00:00
|
|
|
double m_gridMinSpacing;
|
2017-03-08 08:37:12 +00:00
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Whether or not to draw the coordinate system axes
|
2017-03-08 08:37:12 +00:00
|
|
|
bool m_axesEnabled;
|
2017-03-18 20:03:24 +00:00
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Fullscreen crosshair or small cross
|
2017-03-19 20:51:59 +00:00
|
|
|
bool m_fullscreenCursor;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Force cursor display
|
2017-03-18 20:03:24 +00:00
|
|
|
bool m_forceDisplayCursor;
|
2019-03-22 21:15:26 +00:00
|
|
|
|
2021-01-25 12:42:36 +00: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 15:21:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|