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.

82 lines
3.0KB

  1. /*
  2. ==============================================================================
  3. JUCE demo code - use at your own risk!
  4. ==============================================================================
  5. */
  6. #include "../JuceLibraryCode/JuceHeader.h"
  7. #include "SpectrogramComponent.h"
  8. //==============================================================================
  9. class SimpleFFTExampleApplication : public JUCEApplication
  10. {
  11. public:
  12. //==============================================================================
  13. SimpleFFTExampleApplication() {}
  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. //==============================================================================
  34. /*
  35. This class implements the desktop window that contains an instance of
  36. our MainContentComponent class.
  37. */
  38. class MainWindow : public DocumentWindow
  39. {
  40. public:
  41. MainWindow() : DocumentWindow (ProjectInfo::projectName,
  42. LookAndFeel::getDefaultLookAndFeel()
  43. .findColour (ResizableWindow::backgroundColourId),
  44. DocumentWindow::allButtons)
  45. {
  46. setUsingNativeTitleBar (true);
  47. setContentOwned (new SpectrogramComponent(), true);
  48. setResizable (true, true);
  49. centreWithSize (getWidth(), getHeight());
  50. setVisible (true);
  51. }
  52. void closeButtonPressed() override
  53. {
  54. // This is called when the user tries to close this window. Here, we'll just
  55. // ask the app to quit when this happens, but you can change this to do
  56. // whatever you need.
  57. JUCEApplication::getInstance()->systemRequestedQuit();
  58. }
  59. private:
  60. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  61. };
  62. private:
  63. ScopedPointer<MainWindow> mainWindow;
  64. };
  65. //==============================================================================
  66. // This macro generates the main() routine that launches the app.
  67. START_JUCE_APPLICATION (SimpleFFTExampleApplication)