2020-01-13 01:44:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
|
|
|
* Copyright (C) 2020 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _COMMON_SETTINGS_H
|
|
|
|
#define _COMMON_SETTINGS_H
|
|
|
|
|
2021-05-01 17:39:35 +00:00
|
|
|
#include <settings/environment.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/json_settings.h>
|
|
|
|
|
|
|
|
|
2021-01-11 15:46:41 +00:00
|
|
|
enum class MOUSE_DRAG_ACTION
|
|
|
|
{
|
|
|
|
// WARNING: these are encoded as integers in the file, so don't change their values.
|
|
|
|
DRAG_ANY = -2,
|
|
|
|
DRAG_SELECTED,
|
|
|
|
SELECT,
|
|
|
|
ZOOM,
|
|
|
|
PAN,
|
|
|
|
NONE
|
|
|
|
};
|
|
|
|
|
2021-03-09 22:47:24 +00:00
|
|
|
enum class ICON_THEME
|
|
|
|
{
|
|
|
|
LIGHT,
|
|
|
|
DARK,
|
|
|
|
AUTO
|
|
|
|
};
|
|
|
|
|
2021-01-11 15:46:41 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
class COMMON_SETTINGS : public JSON_SETTINGS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct APPEARANCE
|
|
|
|
{
|
2022-08-21 12:39:55 +00:00
|
|
|
bool show_scrollbars;
|
2021-03-09 22:47:24 +00:00
|
|
|
double canvas_scale;
|
|
|
|
int icon_scale;
|
|
|
|
ICON_THEME icon_theme;
|
|
|
|
bool use_icons_in_menus;
|
2021-09-16 17:29:29 +00:00
|
|
|
bool apply_icon_scale_to_fonts;
|
2021-11-05 23:35:10 +00:00
|
|
|
double hicontrast_dimming_factor;
|
2022-01-23 23:04:19 +00:00
|
|
|
int text_editor_zoom;
|
2020-01-13 01:44:19 +00:00
|
|
|
};
|
|
|
|
|
2020-07-03 13:40:31 +00:00
|
|
|
struct AUTO_BACKUP
|
|
|
|
{
|
|
|
|
bool enabled; ///< Automatically back up the project when files are saved
|
|
|
|
bool backup_on_autosave; ///< Trigger a backup on autosave
|
|
|
|
int limit_total_files; ///< Maximum number of backup archives to retain
|
|
|
|
int limit_daily_files; ///< Maximum files to keep per day, 0 for unlimited
|
|
|
|
int min_interval; ///< Minimum time, in seconds, between subsequent backups
|
|
|
|
|
|
|
|
/// Maximum total size of backups (bytes), 0 for unlimited
|
|
|
|
unsigned long long limit_total_size;
|
|
|
|
};
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
struct ENVIRONMENT
|
|
|
|
{
|
2021-05-01 17:39:35 +00:00
|
|
|
ENV_VAR_MAP vars;
|
2020-01-13 01:44:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct INPUT
|
|
|
|
{
|
2022-09-30 18:32:06 +00:00
|
|
|
bool focus_follow_sch_pcb;
|
2020-01-13 01:44:19 +00:00
|
|
|
bool auto_pan;
|
2020-05-17 00:19:48 +00:00
|
|
|
int auto_pan_acceleration;
|
2020-01-13 01:44:19 +00:00
|
|
|
bool center_on_zoom;
|
|
|
|
bool immediate_actions;
|
|
|
|
bool warp_mouse_on_move;
|
2020-05-17 00:19:48 +00:00
|
|
|
bool horizontal_pan;
|
2023-05-31 02:06:49 +00:00
|
|
|
bool hotkey_feedback;
|
2020-05-17 00:19:48 +00:00
|
|
|
|
|
|
|
bool zoom_acceleration;
|
|
|
|
int zoom_speed;
|
|
|
|
bool zoom_speed_auto;
|
|
|
|
|
|
|
|
int scroll_modifier_zoom;
|
|
|
|
int scroll_modifier_pan_h;
|
|
|
|
int scroll_modifier_pan_v;
|
|
|
|
|
2021-01-11 15:46:41 +00:00
|
|
|
MOUSE_DRAG_ACTION drag_left;
|
|
|
|
MOUSE_DRAG_ACTION drag_middle;
|
|
|
|
MOUSE_DRAG_ACTION drag_right;
|
2023-08-17 19:17:50 +00:00
|
|
|
|
|
|
|
bool reverse_scroll_pan_h;
|
2020-01-13 01:44:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GRAPHICS
|
|
|
|
{
|
|
|
|
int cairo_aa_mode;
|
|
|
|
int opengl_aa_mode;
|
|
|
|
};
|
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
struct SESSION
|
|
|
|
{
|
|
|
|
bool remember_open_files;
|
2022-07-22 08:26:49 +00:00
|
|
|
std::vector<wxString> pinned_symbol_libs;
|
|
|
|
std::vector<wxString> pinned_fp_libs;
|
2020-08-24 02:01:14 +00:00
|
|
|
};
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
struct SYSTEM
|
|
|
|
{
|
|
|
|
int autosave_interval;
|
2021-09-19 13:45:27 +00:00
|
|
|
wxString text_editor;
|
2020-01-13 01:44:19 +00:00
|
|
|
int file_history_size;
|
|
|
|
wxString language;
|
|
|
|
wxString pdf_viewer_name;
|
|
|
|
bool use_system_pdf_viewer;
|
|
|
|
wxString working_dir;
|
2020-08-09 10:41:45 +00:00
|
|
|
int clear_3d_cache_interval;
|
2020-01-13 01:44:19 +00:00
|
|
|
};
|
|
|
|
|
2021-07-27 14:13:26 +00:00
|
|
|
struct DO_NOT_SHOW_AGAIN
|
|
|
|
{
|
|
|
|
bool zone_fill_warning;
|
|
|
|
bool env_var_overwrite_warning;
|
|
|
|
bool scaled_3d_models_warning;
|
2022-04-02 01:21:55 +00:00
|
|
|
bool data_collection_prompt;
|
2021-07-27 14:13:26 +00:00
|
|
|
};
|
|
|
|
|
2021-02-23 14:34:18 +00:00
|
|
|
struct NETCLASS_PANEL
|
|
|
|
{
|
|
|
|
int sash_pos;
|
|
|
|
};
|
|
|
|
|
2021-11-14 13:10:24 +00:00
|
|
|
struct PACKAGE_MANAGER
|
|
|
|
{
|
|
|
|
int sash_pos;
|
|
|
|
};
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
struct GIT_REPOSITORY
|
|
|
|
{
|
|
|
|
wxString name;
|
|
|
|
wxString path;
|
|
|
|
wxString authType;
|
|
|
|
wxString username;
|
|
|
|
wxString ssh_path;
|
|
|
|
bool active;
|
|
|
|
bool checkValid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GIT
|
|
|
|
{
|
|
|
|
std::vector<GIT_REPOSITORY> repositories;
|
|
|
|
bool useDefaultAuthor;
|
|
|
|
wxString authorName;
|
|
|
|
wxString authorEmail;
|
|
|
|
};
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
COMMON_SETTINGS();
|
|
|
|
|
|
|
|
virtual ~COMMON_SETTINGS() {}
|
|
|
|
|
|
|
|
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
|
|
|
|
2021-05-01 17:39:35 +00:00
|
|
|
/**
|
|
|
|
* Creates the built-in environment variables and sets their default values
|
|
|
|
*/
|
|
|
|
void InitializeEnvironment();
|
|
|
|
|
2020-05-17 00:19:48 +00:00
|
|
|
private:
|
|
|
|
bool migrateSchema0to1();
|
2021-01-11 11:48:51 +00:00
|
|
|
bool migrateSchema1to2();
|
2022-09-26 01:08:51 +00:00
|
|
|
bool migrateSchema2to3();
|
|
|
|
|
|
|
|
struct LEGACY_3D_SEARCH_PATH
|
|
|
|
{
|
|
|
|
wxString m_Alias; // alias to the base path
|
|
|
|
wxString m_Pathvar; // base path as stored in the config file
|
|
|
|
wxString m_Pathexp; // expanded base path
|
|
|
|
wxString m_Description; // description of the aliased path
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool getLegacy3DHollerith( const std::string& aString, size_t& aIndex,
|
|
|
|
wxString& aResult );
|
|
|
|
bool readLegacy3DResolverCfg( const wxString& aPath, std::vector<LEGACY_3D_SEARCH_PATH>& aSearchPaths );
|
2020-05-17 00:19:48 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
public:
|
|
|
|
APPEARANCE m_Appearance;
|
|
|
|
|
2020-07-03 13:40:31 +00:00
|
|
|
AUTO_BACKUP m_Backup;
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
ENVIRONMENT m_Env;
|
|
|
|
|
|
|
|
INPUT m_Input;
|
|
|
|
|
|
|
|
GRAPHICS m_Graphics;
|
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
SESSION m_Session;
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
SYSTEM m_System;
|
|
|
|
|
2021-07-27 14:13:26 +00:00
|
|
|
DO_NOT_SHOW_AGAIN m_DoNotShowAgain;
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-07-27 14:13:26 +00:00
|
|
|
NETCLASS_PANEL m_NetclassPanel;
|
2021-11-14 13:10:24 +00:00
|
|
|
|
|
|
|
PACKAGE_MANAGER m_PackageManager;
|
2023-09-14 21:39:42 +00:00
|
|
|
|
|
|
|
GIT m_Git;
|
2020-01-13 01:44:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|