Audio plugin host https://kx.studio/carla
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.

98 lines
2.7KB

  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. namespace juce
  14. {
  15. JUCEApplication::JUCEApplication() {}
  16. JUCEApplication::~JUCEApplication() {}
  17. //==============================================================================
  18. JUCEApplication* JUCE_CALLTYPE JUCEApplication::getInstance() noexcept
  19. {
  20. return dynamic_cast<JUCEApplication*> (JUCEApplicationBase::getInstance());
  21. }
  22. bool JUCEApplication::moreThanOneInstanceAllowed() { return true; }
  23. void JUCEApplication::anotherInstanceStarted (const String&) {}
  24. void JUCEApplication::suspended() {}
  25. void JUCEApplication::resumed() {}
  26. void JUCEApplication::systemRequestedQuit() { quit(); }
  27. void JUCEApplication::unhandledException (const std::exception*, const String&, int)
  28. {
  29. jassertfalse;
  30. }
  31. //==============================================================================
  32. ApplicationCommandTarget* JUCEApplication::getNextCommandTarget()
  33. {
  34. return nullptr;
  35. }
  36. void JUCEApplication::getAllCommands (Array<CommandID>& commands)
  37. {
  38. commands.add (StandardApplicationCommandIDs::quit);
  39. }
  40. void JUCEApplication::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
  41. {
  42. if (commandID == StandardApplicationCommandIDs::quit)
  43. {
  44. result.setInfo (TRANS("Quit"),
  45. TRANS("Quits the application"),
  46. "Application", 0);
  47. result.defaultKeypresses.add (KeyPress ('q', ModifierKeys::commandModifier, 0));
  48. }
  49. }
  50. bool JUCEApplication::perform (const InvocationInfo& info)
  51. {
  52. if (info.commandID == StandardApplicationCommandIDs::quit)
  53. {
  54. systemRequestedQuit();
  55. return true;
  56. }
  57. return false;
  58. }
  59. //==============================================================================
  60. #if JUCE_MAC
  61. extern void juce_initialiseMacMainMenu();
  62. #endif
  63. bool JUCEApplication::initialiseApp()
  64. {
  65. if (JUCEApplicationBase::initialiseApp())
  66. {
  67. #if JUCE_MAC
  68. juce_initialiseMacMainMenu(); // (needs to get the app's name)
  69. #endif
  70. return true;
  71. }
  72. return false;
  73. }
  74. } // namespace juce