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.

69 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  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. //==============================================================================
  15. class AppearanceSettings : private ValueTree::Listener
  16. {
  17. public:
  18. AppearanceSettings (bool updateAppWhenChanged);
  19. bool readFromFile (const File& file);
  20. bool readFromXML (const XmlElement&);
  21. bool writeToFile (const File& file) const;
  22. void updateColourScheme();
  23. void applyToCodeEditor (CodeEditorComponent& editor) const;
  24. StringArray getColourNames() const;
  25. Value getColourValue (const String& colourName);
  26. bool getColour (const String& name, Colour& resultIfFound) const;
  27. Font getCodeFont() const;
  28. Value getCodeFontValue();
  29. ValueTree settings;
  30. static File getSchemesFolder();
  31. StringArray getPresetSchemes();
  32. void refreshPresetSchemeList();
  33. void selectPresetScheme (int index);
  34. static Font getDefaultCodeFont();
  35. static const char* getSchemeFileSuffix() { return ".scheme"; }
  36. static const char* getSchemeFileWildCard() { return "*.scheme"; }
  37. private:
  38. Array<File> presetSchemeFiles;
  39. static void writeDefaultSchemeFile (const String& xml, const String& name);
  40. void valueTreePropertyChanged (ValueTree&, const Identifier&) override { updateColourScheme(); }
  41. void valueTreeChildAdded (ValueTree&, ValueTree&) override { updateColourScheme(); }
  42. void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { updateColourScheme(); }
  43. void valueTreeChildOrderChanged (ValueTree&, int, int) override { updateColourScheme(); }
  44. void valueTreeParentChanged (ValueTree&) override { updateColourScheme(); }
  45. void valueTreeRedirected (ValueTree&) override { updateColourScheme(); }
  46. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AppearanceSettings)
  47. };