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.

88 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  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. Component* createMainContentComponent();
  16. //==============================================================================
  17. class AudioPerformanceTestApplication : public JUCEApplication
  18. {
  19. public:
  20. //==============================================================================
  21. AudioPerformanceTestApplication() {}
  22. const String getApplicationName() override { return ProjectInfo::projectName; }
  23. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  24. bool moreThanOneInstanceAllowed() override { return true; }
  25. //==============================================================================
  26. void initialise (const String&) override
  27. {
  28. mainWindow.reset (new MainWindow (getApplicationName()));
  29. }
  30. void shutdown() override
  31. {
  32. mainWindow = nullptr; // (deletes our window)
  33. }
  34. //==============================================================================
  35. void systemRequestedQuit() override
  36. {
  37. quit();
  38. }
  39. //==============================================================================
  40. class MainWindow : public DocumentWindow
  41. {
  42. public:
  43. MainWindow (String name) : DocumentWindow (name,
  44. Colours::lightgrey,
  45. DocumentWindow::allButtons)
  46. {
  47. setUsingNativeTitleBar (true);
  48. setContentOwned (createMainContentComponent(), true);
  49. setResizable (false, false);
  50. #if JUCE_IOS || JUCE_ANDROID
  51. setFullScreen (true);
  52. #else
  53. centreWithSize (getWidth(), getHeight());
  54. #endif
  55. setVisible (true);
  56. }
  57. void closeButtonPressed() override
  58. {
  59. JUCEApplication::getInstance()->systemRequestedQuit();
  60. }
  61. private:
  62. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  63. };
  64. private:
  65. std::unique_ptr<MainWindow> mainWindow;
  66. };
  67. //==============================================================================
  68. START_JUCE_APPLICATION (AudioPerformanceTestApplication)