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.

90 lines
3.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. //==============================================================================
  19. // String::hashCode64 actually hit some dupes, so this is a more powerful version.
  20. const int64 hashCode64 (const String& s);
  21. const String randomHexString (Random& random, int numChars);
  22. const String hexString8Digits (int value);
  23. const String createAlphaNumericUID();
  24. const String createGUID (const String& seed); // Turns a seed into a windows GUID
  25. const String escapeSpaces (const String& text); // replaces spaces with blackslash-space
  26. const StringPairArray parsePreprocessorDefs (const String& defs);
  27. const StringPairArray mergePreprocessorDefs (StringPairArray inheritedDefs, const StringPairArray& overridingDefs);
  28. const String createGCCPreprocessorFlags (const StringPairArray& defs);
  29. const String replacePreprocessorDefs (const StringPairArray& definitions, String sourceString);
  30. //==============================================================================
  31. int indexOfLineStartingWith (const StringArray& lines, const String& text, int startIndex);
  32. void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX = true, bool scrollY = true);
  33. void drawComponentPlaceholder (Graphics& g, int w, int h, const String& text);
  34. void drawRecessedShadows (Graphics& g, int w, int h, int shadowSize);
  35. //==============================================================================
  36. class PropertyPanelWithTooltips : public Component,
  37. public Timer
  38. {
  39. public:
  40. PropertyPanelWithTooltips();
  41. ~PropertyPanelWithTooltips();
  42. PropertyPanel& getPanel() noexcept { return panel; }
  43. void paint (Graphics& g);
  44. void resized();
  45. void timerCallback();
  46. private:
  47. PropertyPanel panel;
  48. TextLayout layout;
  49. Component* lastComp;
  50. String lastTip;
  51. const String findTip (Component* c);
  52. };
  53. //==============================================================================
  54. class FloatingLabelComponent : public Component
  55. {
  56. public:
  57. FloatingLabelComponent();
  58. void remove();
  59. void update (Component* parent, const String& text, const Colour& textColour, int x, int y, bool toRight, bool below);
  60. void paint (Graphics& g);
  61. private:
  62. Font font;
  63. Colour colour;
  64. GlyphArrangement glyphs;
  65. };