The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

105 lines
3.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. #pragma once
  19. #include <map>
  20. #include "jucer_AppearanceSettings.h"
  21. //==============================================================================
  22. class StoredSettings : private ValueTree::Listener
  23. {
  24. public:
  25. StoredSettings();
  26. ~StoredSettings() override;
  27. PropertiesFile& getGlobalProperties();
  28. PropertiesFile& getProjectProperties (const String& projectUID);
  29. void flush();
  30. void reload();
  31. //==============================================================================
  32. RecentlyOpenedFilesList recentFiles;
  33. Array<File> getLastProjects();
  34. void setLastProjects (const Array<File>& files);
  35. //==============================================================================
  36. Array<Colour> swatchColours;
  37. struct ColourSelectorWithSwatches : public ColourSelector
  38. {
  39. ColourSelectorWithSwatches();
  40. ~ColourSelectorWithSwatches() override;
  41. int getNumSwatches() const override;
  42. Colour getSwatchColour (int index) const override;
  43. void setSwatchColour (int index, const Colour& newColour) override;
  44. };
  45. //==============================================================================
  46. ValueWithDefault getStoredPath (const Identifier& key, DependencyPathOS os);
  47. bool isJUCEPathIncorrect();
  48. //==============================================================================
  49. AppearanceSettings appearance;
  50. StringArray monospacedFontNames;
  51. File lastWizardFolder;
  52. private:
  53. //==============================================================================
  54. void updateGlobalPreferences();
  55. void updateRecentFiles();
  56. void updateLastWizardFolder();
  57. void updateKeyMappings();
  58. void loadSwatchColours();
  59. void saveSwatchColours();
  60. void updateOldProjectSettingsFiles();
  61. void checkJUCEPaths();
  62. //==============================================================================
  63. void changed (bool);
  64. void valueTreePropertyChanged (ValueTree& vt, const Identifier&) override { changed (vt == projectDefaults); }
  65. void valueTreeChildAdded (ValueTree& vt, ValueTree&) override { changed (vt == projectDefaults); }
  66. void valueTreeChildRemoved (ValueTree& vt, ValueTree&, int) override { changed (vt == projectDefaults); }
  67. void valueTreeChildOrderChanged (ValueTree& vt, int, int) override { changed (vt == projectDefaults); }
  68. void valueTreeParentChanged (ValueTree& vt) override { changed (vt == projectDefaults); }
  69. //==============================================================================
  70. OwnedArray<PropertiesFile> propertyFiles;
  71. ValueTree projectDefaults;
  72. ValueTree fallbackPaths;
  73. //==============================================================================
  74. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StoredSettings)
  75. };
  76. StoredSettings& getAppSettings();
  77. PropertiesFile& getGlobalProperties();