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.

119 lines
12KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 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. #include "../jucer_Headers.h"
  19. #include "../Application/jucer_Application.h"
  20. #include "jucer_Icons.h"
  21. /*static String compactSVGPath (const String& pathString)
  22. {
  23. StringArray toks;
  24. String::CharPointerType s (pathString.getCharPointer());
  25. while (! s.isEmpty())
  26. {
  27. s = s.findEndOfWhitespace();
  28. if (s.toUpperCase() >= 'A' && s.toUpperCase() <= 'Z')
  29. {
  30. toks.add (String::charToString (s.getAndAdvance()));
  31. }
  32. else
  33. {
  34. String::CharPointerType s2 (s);
  35. double n = CharacterFunctions::readDoubleValue (s);
  36. if (s != s2)
  37. toks.add (String (n));
  38. else
  39. ++s;
  40. }
  41. }
  42. MemoryOutputStream newPath;
  43. bool lastWasDigit = false;
  44. for (int i = 0; i < toks.size(); ++i)
  45. {
  46. if (toks[i].toUpperCase()[0] >= 'A' && toks[i].toUpperCase()[0] <= 'Z')
  47. {
  48. newPath << toks[i];
  49. }
  50. else
  51. {
  52. const double val = toks[i].getDoubleValue();
  53. if (lastWasDigit && val >= 0)
  54. newPath << ' ';
  55. newPath << String (val, 1).trimCharactersAtEnd ("0").trimCharactersAtEnd (".");
  56. lastWasDigit = true;
  57. }
  58. }
  59. DBG (newPath.toString().quoted());
  60. return newPath.toString();
  61. }
  62. */
  63. static void parseSVGPath (Path& dest, const String& pathString)
  64. {
  65. XmlElement svg ("svg");
  66. XmlElement* path = svg.createNewChildElement ("path");
  67. path->setAttribute ("d", pathString);
  68. ScopedPointer<Drawable> d (Drawable::createFromSVG (svg));
  69. DrawablePath* dp = dynamic_cast <DrawablePath*> (d->getChildComponent(0));
  70. jassert (dp != nullptr);
  71. dest = dp->getPath();
  72. }
  73. Icons::Icons()
  74. {
  75. /* Some of the icon images used here are based on icons from this project:
  76. http://raphaeljs.com/icons
  77. They're MIT licensed - the licensing info is on the linked page.
  78. I thought they looked pretty stylish in this context, and it was also very
  79. convenient to be able to paste-in the shapes directly as SVG path strings!
  80. */
  81. parseSVGPath (folder, "M76.5 116.7C 138.2 91.9 199.5 66.4 261.4 42c 26.2 4.2 17 35.3 27.5 51.8 13.2 44.1 9.7 51.5 30.2 93.1-7.8 3.2-15.6 6.3-23.4 9.5C 270 143.9 270.7 124.6 255.1 68.8 208.7 77 149.6 111.5 96.9 132.9c 20.1 70.2 40.2 142 81.8 204.1 15.2 21.5 46.2 11 56-9.5 13.2-16.5 12.1-76.1 21.4-93.8 8.2-10 16.5-13.6 27.7-19.5 50.9-20.6 101.8-41.2 152.7-61.9 17 7-2.6 67.7-8.5 82.6-12.2 28.1-28.6 40.8-52.5 58.9-59.5 23.6-104.3 55.3-164.4 77.5-25.2 5.5-48.8-11.8-59.8-32-33.5-49.1-49.9-106.1-68-161.3-5.4-17.4-10.6-34.9-14-52.7 0.6-3.8 3.5-7.2 7.3-8.6z");
  82. parseSVGPath (document, "M23 5.7c-1.7-1.7-3.6-3.1-5.2-3.2c-0.1-0-0.2-0-0.3-0H 7.4c-0.2 0-0.3 0.1-0.4 0.2C 6.9 2.7 6.8 2.9 6.8 3v 25.8c 0 0.2 0.1 0.3 0.2 0.4c 0.1 0.1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7 0.4-1.1L 27.3 22.7zM 23.1 24.7c-1.2 0.5-2.5-0.1-3-1.3s 0.1-2.5 1.3-3c 1.2-0.5 2.5 0.1 3 1.3C 24.9 22.9 24.3 24.2 23.1 24.7z");
  85. parseSVGPath (graph, "M6.8 17.2l 7.4-3.7v-2.2h-0.8c-0.4 0-0.8-0.1-1.2-0.2v 1.2l-7.4 3.7v 2.9h 2V 17.2zM 26.6 18.9v-2.9l-7.4-3.7v-1.2c-0.4 0.2-0.8 0.2-1.2 0.2h-0.8l-0 2.2l 7.4 3.7v 1.7H 26.6zM 16.7 18.9v-7.5h-2v 7.5H 16.7zM 27.9 19.9H 23.3c-1.1 0-2 0.9-2 2V 26.5c 0 1.1 0.9 2 2 2h 4.6c 1.1 0 2-0.9 2-2v-4.6C 29.9 20.8 29 19.9 27.9 19.9zM 8.1 19.9H 3.5c-1.1 0-2 0.9-2 2V 26.5c 0 1.1 0.9 2 2 2h 4.6c 1.1 0 2-0.9 2-2v-4.6C 10.1 20.8 9.2 19.9 8.1 19.9zM 13.4 10.4H 18c 1.1 0 2-0.9 2-2V 3.8c 0-1.1-0.9-2-2-2h-4.6c-1.1 0-2 0.9-2 2v 4.6C 11.4 9.5 12.3 10.4 13.4 10.4zM 18 19.9h-4.6c-1.1 0-2 0.9-2 2V 26.5c 0 1.1 0.9 2 2 2H 18c 1.1 0 2-0.9 2-2v-4.6C 20 20.8 19.1 19.9 18 19.9z");
  86. parseSVGPath (exporter, "M15.1 2.3c-6 0-11 3.9-12.8 9.3h 3.2c 1.6-3.7 5.3-6.3 9.6-6.3c 5.8 0 10.4 4.7 10.4 10.4c-0 5.8-4.7 10.4-10.4 10.4c-4.3-0-8-2.6-9.6-6.3H 2.3c 1.7 5.4 6.8 9.3 12.8 9.3c 7.4-0 13.4-6 13.4-13.4C 28.5 8.3 22.5 2.3 15.1 2.3zM 10.9 19.8l 7.2-4.1l-7.2-4.1v 2.3H-0.1v 3.7h 11V 19.8z");
  87. parseSVGPath (jigsaw,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1.8 8.4 2 9 2.4 9.3l 5.4 3.1c-0.3 1.3-0.4 2.8-0.1 4.3l-5.8 1.6c-0.5 0.1-0.8 0.7-0.7 1.2c 0.1 0.5 0.7 0.8 1.2 0.7l 5.9-1.6c 0.5 1.1 1.4 2.3 2.4 3.4l-3.2 5.6c-0.3 0.5-0.1 1.1 0.4 1.4c 0.2 0.1 0.5 0.2 0.8 0.1c 0.2-0.1 0.5-0.2 0.6-0.5l 2.9-5.1c 2.7 2.6 5.7 4.1 5.8 1.1c 1.6 2.6 3.5-0.3 4.5-4l 5.2 2.9c 0.2 0.1 0.5 0.2 0.8 0.1c 0.2-0.1 0.5-0.2 0.6-0.5c 0.3-0.5 0.1-1.1-0.4-1.4l-5.7-3.2c 0.3-1.5 0.4-3 0.3-4.1l 5.9-1.6c 0.5-0.1 0.8-0.7 0.7-1.2C 29.7 11.1 29.1 10.8 28.6 10.9z");
  91. parseSVGPath (juceLogo, "M226.7 640.4c-57 1.6-111.2 23.8-159.4 52.7-104.3 66.1-167.2 193.3-153.2 316.7 1.5 56.3 29.4 106.9 54.8 155.6 32.3 57.5 87.1 98.8 146.1 126.5 34.5 16.6 71.4 30.3 110.2 30 41.7 2.5 84.2-1.9 123.5-16 49.7-17 95-47.2 129.1-87 66.2-73.9 104.7-174.4 96.6-274.3C 567.2 882.4 542.2 822.7 505.3 772.4 475.3 731.9 435.6 699 390.4 676.6 344.4 652.3 292.3 638 240 640.6c-4.4-0.3-8.8-0.2-13.3-0.2zm 71.7 40.3c 52.3-0.1 102.3 27.3 135 67.1 16.4 23.6 16 56.1 3 81.1-0.9 2.1-3.2 6.3 1.2 4.8 17.1-1.8 33.7-12.3 51.3-7.3 9.8 2.7 15.9 11.4 22.8 18.1 21.9 25.8 26.6 61.2 26.5 94 0.8 34.6-0.4 71.5-18.5 101.9-10.6 17.3-30.6 30.8-51.5 27.2 6.5 10.9 16.5 21.3 18.5 34.6 6.8 28.3-5.8 58.8-27.7 76.9-33.9 34.1-75.4 64.7-124.5 71-21.9 3.3-47.3-0.4-62.5-17.9-13-13.5-20.4-30.9-26.9-48.1-7.3 25.7-20.4 51.1-43 66.1-16.6 12.5-39.4 17.5-59.2 9.8-44.2-12.3-80.4-42.9-110.3-76.6-19.8-24.8-22.8-63.5-2.4-88.9 2.1-3.5 6.2-8.1 7.3-10.8-23.5 4.6-51.3-1.9-64.9-22.8-22.1-36.9-21.5-82.8-13.2-123.8 4.3-20.2 9.3-40.6 18-59.3 14.1-22.7 44-29.8 69-24.7-13.3-14.6-27.6-32.3-26-53.3 2.7-18.5 19-30.1 31.2-42.6 34.3-31.4 75.9-55.3 120.8-67.6 25.4-3.4 48.6 14.6 60.4 35.8 1.7 2.9 3.1 6 4.4 9.1 14.3-18 23.7-42.5 46.1-52.2 4.8-1.6 9.9-1.7 14.9-1.7zm 14.8 24.8c-24.2-0.5-45 19.7-49.5 42.7-16.4 53.2-8.9 110.1-2.7 164.5 1.1 9.8 2.2 19.4 3.6 29.1 49.5-33.9 101.4-65.8 140.5-112.1 10.7-14.4 20.4-32.6 16.5-51.1-13.2-30.6-43.6-49.1-73-61.3-11.3-5-22.5-12.6-35.4-11.8zM 185.4 716.7C 145 720.4 110.4 744.3 78.3 767.5 64.5 778.7 49 793.3 49 812.3c 2.4 15 18 22.4 28.6 31.2 40.2 28.8 84.2 52.1 124.4 81.1 9.7 6.7 19.3 13.9 30.2 18.8 5.4-50.9 0.1-102.3-7.5-152.6-5-23.3-7.1-50.2-25.6-67.3-4-3.2-8.3-6.9-13.6-6.6zm 283 133.2c-21.7 4.1-40.8 16.5-60 26.7-24.5 13.9-47.9 29.4-71.2 45-17.7 10.9-38.9 19.8-49.9 38.3-1.1 1.7-2 4.8 1 4.9 47.7 29.2 97.9 54.6 150.5 73.5 16.1 5.1 36.3 9.3 50.8-2.3 13.4-12.4 18.2-31.1 21.7-48.3 5.2-33.4-0.1-67.5-6.6-100.4-4.5-17-15.9-38.2-36.3-37.5zM 20.1 880.4c-18.3 3.2-28.4 22.3-31.1 39-5.9 28-4.5 56.9-6.6 85.3 0 16 1.7 34.4 14 45.9 15.3 10.7 35.1 4.6 51.7 1 24.5-5.8 45.7-20.1 68.2-30.8 34.4-17.8 68.3-36.6 102.4-55.2C 201.1 946.8 174.7 939.8 153 926.8 110.8 906.8 68.6 879.3 20.1 880.4zM 266.3 988.7c-4.2 58.8-4.4 118.2 2.5 176.7 3.2 20.2 10.3 42.5 28.4 54.1 16.4 8.7 36.3 6 53.8 2.7 28-6.3 51.2-25 71.8-44.2 15-14.8 28.7-31.1 39.3-49.2 5.8-17.1-5.4-34.4-18.5-44.7-28.6-25.2-63.5-41.2-96.4-59.6-26.3-13.6-53.2-26.1-80.8-36.7l-0.1 0.9zm-28.8 0c-50.4 20.7-96.4 50.3-142.4 79.3-22 15.1-45.6 33.8-52 61.1-3 10.9 1 22 7.4 30.9 21.7 35.8 58.5 60.4 97.1 75.3 12.3 4.5 26.8 4.3 37.7-3.6 22.9-14.7 32.4-42.1 38.1-67.4 9.2-43.1 12.5-87.2 14.6-131.2 0.6-15 0.7-30 0.7-44.9l-0.9 0.4-0.3 0.1z");
  92. }
  93. const Icons& getIcons()
  94. {
  95. return *JucerApplication::getApp().icons;
  96. }