You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
  5. * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef _COMMON_SETTINGS_H
  21. #define _COMMON_SETTINGS_H
  22. #include <settings/json_settings.h>
  23. class COMMON_SETTINGS : public JSON_SETTINGS
  24. {
  25. public:
  26. struct APPEARANCE
  27. {
  28. double canvas_scale;
  29. int icon_scale;
  30. bool use_icons_in_menus;
  31. };
  32. struct AUTO_BACKUP
  33. {
  34. bool enabled; ///< Automatically back up the project when files are saved
  35. bool backup_on_autosave; ///< Trigger a backup on autosave
  36. int limit_total_files; ///< Maximum number of backup archives to retain
  37. int limit_daily_files; ///< Maximum files to keep per day, 0 for unlimited
  38. int min_interval; ///< Minimum time, in seconds, between subsequent backups
  39. /// Maximum total size of backups (bytes), 0 for unlimited
  40. unsigned long long limit_total_size;
  41. };
  42. struct ENVIRONMENT
  43. {
  44. bool show_warning_dialog;
  45. std::map<std::string, wxString> vars;
  46. };
  47. struct INPUT
  48. {
  49. bool auto_pan;
  50. int auto_pan_acceleration;
  51. bool center_on_zoom;
  52. bool immediate_actions;
  53. bool prefer_select_to_drag;
  54. bool warp_mouse_on_move;
  55. bool horizontal_pan;
  56. bool zoom_acceleration;
  57. int zoom_speed;
  58. bool zoom_speed_auto;
  59. int scroll_modifier_zoom;
  60. int scroll_modifier_pan_h;
  61. int scroll_modifier_pan_v;
  62. int drag_middle;
  63. int drag_right;
  64. };
  65. struct GRAPHICS
  66. {
  67. int cairo_aa_mode;
  68. int opengl_aa_mode;
  69. };
  70. struct SESSION
  71. {
  72. bool remember_open_files;
  73. };
  74. struct SYSTEM
  75. {
  76. int autosave_interval;
  77. wxString editor_name;
  78. int file_history_size;
  79. wxString language;
  80. wxString pdf_viewer_name;
  81. bool use_system_pdf_viewer;
  82. wxString working_dir;
  83. int clear_3d_cache_interval;
  84. };
  85. COMMON_SETTINGS();
  86. virtual ~COMMON_SETTINGS() {}
  87. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  88. private:
  89. bool migrateSchema0to1();
  90. public:
  91. APPEARANCE m_Appearance;
  92. AUTO_BACKUP m_Backup;
  93. ENVIRONMENT m_Env;
  94. INPUT m_Input;
  95. GRAPHICS m_Graphics;
  96. SESSION m_Session;
  97. SYSTEM m_System;
  98. // TODO: These may not want to be in common
  99. wxString m_3DLibsUrl;
  100. wxString m_3DLibsDownloadPath;
  101. };
  102. #endif