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.

93 lines
3.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #include "../JuceLibraryCode/JuceHeader.h"
  18. struct ExpressiveMidiTestClasses
  19. {
  20. #include "Setup.h"
  21. #include "Synth.h"
  22. #include "Visualiser.h"
  23. #include "MainComponent.h"
  24. };
  25. //==============================================================================
  26. class ExpressiveMidiTestApplication : public JUCEApplication
  27. {
  28. public:
  29. //==========================================================================
  30. ExpressiveMidiTestApplication() {}
  31. const String getApplicationName() override { return ProjectInfo::projectName; }
  32. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  33. bool moreThanOneInstanceAllowed() override { return true; }
  34. //==========================================================================
  35. void initialise (const String& commandLine) override
  36. {
  37. mainWindow = new MainWindow (getApplicationName());
  38. }
  39. void shutdown() override
  40. {
  41. mainWindow = nullptr;
  42. }
  43. void systemRequestedQuit() override
  44. {
  45. quit();
  46. }
  47. //==========================================================================
  48. class MainWindow : public DocumentWindow
  49. {
  50. public:
  51. MainWindow (String name)
  52. : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons)
  53. {
  54. setUsingNativeTitleBar (true);
  55. setContentOwned (new ExpressiveMidiTestClasses::MainComponent(), true);
  56. centreWithSize (getWidth(), getHeight());
  57. setVisible (true);
  58. }
  59. void closeButtonPressed() override
  60. {
  61. JUCEApplication::getInstance()->systemRequestedQuit();
  62. }
  63. private:
  64. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  65. };
  66. private:
  67. //==========================================================================
  68. ScopedPointer<MainWindow> mainWindow;
  69. };
  70. //==============================================================================
  71. START_JUCE_APPLICATION (ExpressiveMidiTestApplication)