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.

123 lines
4.9KB

  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
  56. {
  57. public:
  58. IntrojucerLookAndFeel();
  59. void fillWithBackgroundTexture (Graphics&);
  60. static void fillWithBackgroundTexture (Component&, Graphics&);
  61. int getTabButtonOverlap (int tabDepth) override;
  62. int getTabButtonSpaceAroundImage() override;
  63. int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;
  64. static Colour getTabBackgroundColour (TabBarButton&);
  65. void drawTabButton (TabBarButton& button, Graphics&, bool isMouseOver, bool isMouseDown) override;
  66. Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton&, Rectangle<int>& textArea, Component&) override;
  67. void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int, int) override {}
  68. void drawStretchableLayoutResizerBar (Graphics&, int w, int h, bool isVerticalBar, bool isMouseOver, bool isMouseDragging) override;
  69. Rectangle<int> getPropertyComponentContentPosition (PropertyComponent&) override;
  70. bool areScrollbarButtonsVisible() override { return false; }
  71. void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height, bool isScrollbarVertical,
  72. int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override;
  73. void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area, bool isMouseOver, bool isMouseDown,
  74. ConcertinaPanel&, Component&) override;
  75. void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
  76. bool isMouseOverButton, bool isButtonDown) override;
  77. void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) override;
  78. static Colour getScrollbarColourForBackground (Colour background);
  79. private:
  80. Image backgroundTexture;
  81. Colour backgroundTextureBaseColour;
  82. };
  83. #endif // __JUCER_APPEARANCESETTINGS_JUCEHEADER__