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.5KB

  1. /*
  2. ==============================================================================
  3. JUCE demo code - use at your own risk!
  4. ==============================================================================
  5. */
  6. #include "../JuceLibraryCode/JuceHeader.h"
  7. #include "StringDemoComponent.h"
  8. //==============================================================================
  9. class PluckedStringsDemoApplication : public JUCEApplication
  10. {
  11. public:
  12. //==============================================================================
  13. PluckedStringsDemoApplication() {}
  14. const String getApplicationName() override { return ProjectInfo::projectName; }
  15. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  16. bool moreThanOneInstanceAllowed() override { return true; }
  17. //==============================================================================
  18. void initialise (const String& /*commandLine*/) override
  19. {
  20. mainWindow = new MainWindow();
  21. }
  22. void shutdown() override
  23. {
  24. mainWindow = nullptr; // (deletes our window)
  25. }
  26. //==============================================================================
  27. void systemRequestedQuit() override
  28. {
  29. // This is called when the app is being asked to quit: you can ignore this
  30. // request and let the app carry on running, or call quit() to allow the app to close.
  31. quit();
  32. }
  33. void anotherInstanceStarted (const String& /*commandLine*/) override
  34. {
  35. // When another instance of the app is launched while this one is running,
  36. // this method is invoked, and the commandLine parameter tells you what
  37. // the other instance's command-line arguments were.
  38. }
  39. //==============================================================================
  40. class MainWindow : public DocumentWindow
  41. {
  42. public:
  43. MainWindow() : DocumentWindow (ProjectInfo::projectName,
  44. Colours::lightgrey,
  45. DocumentWindow::allButtons)
  46. {
  47. setUsingNativeTitleBar (true);
  48. setContentOwned (new StringDemoComponent(), true);
  49. setResizable (true, false);
  50. centreWithSize (getWidth(), getHeight());
  51. setVisible (true);
  52. }
  53. void closeButtonPressed() override
  54. {
  55. // This is called when the user tries to close this window. Here, we'll just
  56. // ask the app to quit when this happens, but you can change this to do
  57. // whatever you need.
  58. JUCEApplication::getInstance()->systemRequestedQuit();
  59. }
  60. /* Note: Be careful if you override any DocumentWindow methods - the base
  61. class uses a lot of them, so by overriding you might break its functionality.
  62. It's best to do all your work in your content component instead, but if
  63. you really have to override any DocumentWindow methods, make sure your
  64. subclass also calls the superclass's method.
  65. */
  66. private:
  67. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  68. };
  69. private:
  70. ScopedPointer<MainWindow> mainWindow;
  71. };
  72. //==============================================================================
  73. // This macro generates the main() routine that launches the app.
  74. START_JUCE_APPLICATION (PluckedStringsDemoApplication)