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.

101 lines
3.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. #ifndef __JUCER_APPEARANCESETTINGS_JUCEHEADER__
  18. #define __JUCER_APPEARANCESETTINGS_JUCEHEADER__
  19. class AppearanceSettings : private ValueTree::Listener
  20. {
  21. public:
  22. AppearanceSettings (bool updateAppWhenChanged);
  23. bool readFromFile (const File& file);
  24. bool readFromXML (const XmlElement&);
  25. bool writeToFile (const File& file) const;
  26. void updateColourScheme();
  27. void applyToCodeEditor (CodeEditorComponent& editor) const;
  28. StringArray getColourNames() const;
  29. Value getColourValue (const String& colourName);
  30. bool getColour (const String& name, Colour& resultIfFound) const;
  31. Font getCodeFont() const;
  32. Value getCodeFontValue();
  33. ValueTree settings;
  34. static File getSchemesFolder();
  35. StringArray getPresetSchemes();
  36. void refreshPresetSchemeList();
  37. void selectPresetScheme (int index);
  38. static Font getDefaultCodeFont();
  39. static void showEditorWindow (ScopedPointer<Component>& ownerPointer);
  40. static const char* getSchemeFileSuffix() { return ".scheme"; }
  41. static const char* getSchemeFileWildCard() { return "*.scheme"; }
  42. private:
  43. Array<File> presetSchemeFiles;
  44. static void writeDefaultSchemeFile (const String& xml, const String& name);
  45. void applyToLookAndFeel (LookAndFeel&) const;
  46. void valueTreePropertyChanged (ValueTree&, const Identifier&) override { updateColourScheme(); }
  47. void valueTreeChildAdded (ValueTree&, ValueTree&) override { updateColourScheme(); }
  48. void valueTreeChildRemoved (ValueTree&, ValueTree&) override { updateColourScheme(); }
  49. void valueTreeChildOrderChanged (ValueTree&) override { updateColourScheme(); }
  50. void valueTreeParentChanged (ValueTree&) override { updateColourScheme(); }
  51. void valueTreeRedirected (ValueTree&) override { updateColourScheme(); }
  52. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AppearanceSettings)
  53. };
  54. //==============================================================================
  55. class IntrojucerLookAndFeel : public LookAndFeel_V3
  56. {
  57. public:
  58. IntrojucerLookAndFeel();
  59. void fillWithBackgroundTexture (Graphics&);
  60. static void fillWithBackgroundTexture (Component&, Graphics&);
  61. void drawTabButton (TabBarButton& button, Graphics&, bool isMouseOver, bool isMouseDown) override;
  62. void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int, int) override {}
  63. int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;
  64. private:
  65. Image backgroundTexture;
  66. Colour backgroundTextureBaseColour;
  67. };
  68. #endif // __JUCER_APPEARANCESETTINGS_JUCEHEADER__