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.

106 lines
3.8KB

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