kicad-source/include/dpi_scaling_common.h
Seth Hillbrand 0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00

96 lines
3.3 KiB
C++

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The 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 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
*/
#ifndef DPI_SCALING_COMMON__H
#define DPI_SCALING_COMMON__H
#include <kicommon.h>
#include <dpi_scaling.h>
class COMMON_SETTINGS;
class wxWindow;
/**
* Class to handle configuration and automatic determination of the DPI
* scale to use for canvases. This has several sources and the availability of
* some of them are platform dependent.
*/
class KICOMMON_API DPI_SCALING_COMMON : public DPI_SCALING
{
public:
/**
* Construct a DPI scale provider.
*
* @param aConfig the config store to check for a user value (can be nullptr,
* in which case on automatically determined values are considered)
* @param aWindow a WX window to use for automatic DPI determination
* @return the scaling factor (1.0 = no scaling)
*/
DPI_SCALING_COMMON( COMMON_SETTINGS* aConfig, const wxWindow* aWindow );
/**
* Get the DPI scale from all known sources in order:
*
* * user config, if given
* * user's environment variables, if set and according to platform
* * WX's internal determination of the DPI scaling (WX > 3.1)
*/
double GetScaleFactor() const override;
/**
* Get the content scale factor, which may be different from the scale
* factor on some platforms. This value should be used for scaling
* user interface elements (fonts, icons, etc) whereas the scale
* factor should be used for scaling canvases.
*/
double GetContentScaleFactor() const override;
/**
* Is the current value auto scaled, or is it user-set in the config
*/
bool GetCanvasIsAutoScaled() const override;
/**
* Set the common DPI config in a given config object
*
* The encoding of the automatic/manual nature of the config is handled internally.
*
* @param aAuto store a value meaning "no user-set scale"
* @param aValue the value to store (ignored if aAuto set)
*/
void SetDpiConfig( bool aAuto, double aValue ) override;
private:
/**
* The configuration object to use to get/set user setting. nullptr
* if only automatic options are wanted
*/
COMMON_SETTINGS* m_config;
/**
* The WX window to use for WX's automatic DPI checking
*/
const wxWindow* m_window;
};
#endif // DPI_SCALING__H