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.

92 lines
3.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. #include <JuceHeader.h>
  19. #include "MainComponent.h"
  20. //==============================================================================
  21. class AudioPerformanceTestApplication : public JUCEApplication
  22. {
  23. public:
  24. //==============================================================================
  25. AudioPerformanceTestApplication() {}
  26. const String getApplicationName() override { return ProjectInfo::projectName; }
  27. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  28. bool moreThanOneInstanceAllowed() override { return true; }
  29. //==============================================================================
  30. void initialise (const String&) override
  31. {
  32. mainWindow.reset (new MainWindow (getApplicationName()));
  33. }
  34. void shutdown() override
  35. {
  36. mainWindow = nullptr; // (deletes our window)
  37. }
  38. //==============================================================================
  39. void systemRequestedQuit() override
  40. {
  41. quit();
  42. }
  43. //==============================================================================
  44. class MainWindow : public DocumentWindow
  45. {
  46. public:
  47. explicit MainWindow (String name)
  48. : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons)
  49. {
  50. setUsingNativeTitleBar (true);
  51. setContentOwned (createMainContentComponent(), true);
  52. setResizable (false, false);
  53. #if JUCE_IOS || JUCE_ANDROID
  54. setFullScreen (true);
  55. #else
  56. centreWithSize (getWidth(), getHeight());
  57. #endif
  58. setVisible (true);
  59. }
  60. void closeButtonPressed() override
  61. {
  62. JUCEApplication::getInstance()->systemRequestedQuit();
  63. }
  64. private:
  65. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  66. };
  67. private:
  68. std::unique_ptr<MainWindow> mainWindow;
  69. };
  70. //==============================================================================
  71. START_JUCE_APPLICATION (AudioPerformanceTestApplication)