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.

98 lines
3.6KB

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