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.

juce_Application.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. JUCEApplication::JUCEApplication() {}
  21. JUCEApplication::~JUCEApplication() {}
  22. //==============================================================================
  23. JUCEApplication* JUCE_CALLTYPE JUCEApplication::getInstance() noexcept
  24. {
  25. return dynamic_cast<JUCEApplication*> (JUCEApplicationBase::getInstance());
  26. }
  27. bool JUCEApplication::moreThanOneInstanceAllowed() { return true; }
  28. void JUCEApplication::anotherInstanceStarted (const String&) {}
  29. void JUCEApplication::suspended() {}
  30. void JUCEApplication::resumed() {}
  31. void JUCEApplication::systemRequestedQuit() { quit(); }
  32. void JUCEApplication::unhandledException (const std::exception*, const String&, int)
  33. {
  34. jassertfalse;
  35. }
  36. //==============================================================================
  37. ApplicationCommandTarget* JUCEApplication::getNextCommandTarget()
  38. {
  39. return nullptr;
  40. }
  41. void JUCEApplication::getAllCommands (Array<CommandID>& commands)
  42. {
  43. commands.add (StandardApplicationCommandIDs::quit);
  44. }
  45. void JUCEApplication::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
  46. {
  47. if (commandID == StandardApplicationCommandIDs::quit)
  48. {
  49. result.setInfo (TRANS("Quit"),
  50. TRANS("Quits the application"),
  51. "Application", 0);
  52. result.defaultKeypresses.add (KeyPress ('q', ModifierKeys::commandModifier, 0));
  53. }
  54. }
  55. bool JUCEApplication::perform (const InvocationInfo& info)
  56. {
  57. if (info.commandID == StandardApplicationCommandIDs::quit)
  58. {
  59. systemRequestedQuit();
  60. return true;
  61. }
  62. return false;
  63. }
  64. //==============================================================================
  65. #if JUCE_MAC
  66. extern void juce_initialiseMacMainMenu();
  67. #endif
  68. bool JUCEApplication::initialiseApp()
  69. {
  70. if (JUCEApplicationBase::initialiseApp())
  71. {
  72. #if JUCE_MAC
  73. juce_initialiseMacMainMenu(); // (needs to get the app's name)
  74. #endif
  75. return true;
  76. }
  77. return false;
  78. }
  79. } // namespace juce