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.

85 lines
2.7KB

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