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.

78 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #pragma once
  18. class AppearanceSettings : private ValueTree::Listener
  19. {
  20. public:
  21. AppearanceSettings (bool updateAppWhenChanged);
  22. bool readFromFile (const File& file);
  23. bool readFromXML (const XmlElement&);
  24. bool writeToFile (const File& file) const;
  25. void updateColourScheme();
  26. void applyToCodeEditor (CodeEditorComponent& editor) const;
  27. StringArray getColourNames() const;
  28. Value getColourValue (const String& colourName);
  29. bool getColour (const String& name, Colour& resultIfFound) const;
  30. Font getCodeFont() const;
  31. Value getCodeFontValue();
  32. ValueTree settings;
  33. static File getSchemesFolder();
  34. StringArray getPresetSchemes();
  35. void refreshPresetSchemeList();
  36. void selectPresetScheme (int index);
  37. static Font getDefaultCodeFont();
  38. static void showGlobalPreferences (ScopedPointer<Component>& ownerPointer);
  39. static const char* getSchemeFileSuffix() { return ".scheme"; }
  40. static const char* getSchemeFileWildCard() { return "*.scheme"; }
  41. private:
  42. Array<File> presetSchemeFiles;
  43. static void writeDefaultSchemeFile (const String& xml, const String& name);
  44. void applyToLookAndFeel (LookAndFeel&) const;
  45. void valueTreePropertyChanged (ValueTree&, const Identifier&) override { updateColourScheme(); }
  46. void valueTreeChildAdded (ValueTree&, ValueTree&) override { updateColourScheme(); }
  47. void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { updateColourScheme(); }
  48. void valueTreeChildOrderChanged (ValueTree&, int, int) override { updateColourScheme(); }
  49. void valueTreeParentChanged (ValueTree&) override { updateColourScheme(); }
  50. void valueTreeRedirected (ValueTree&) override { updateColourScheme(); }
  51. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AppearanceSettings)
  52. };