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.

155 lines
6.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #include "jucedemo_headers.h"
  19. #include "MainDemoWindow.h"
  20. //==============================================================================
  21. class JUCEDemoApplication : public JUCEApplication
  22. {
  23. /* Important! NEVER embed objects directly inside your JUCEApplication class! Use
  24. ONLY pointers to objects, which you should create during the initialise() method
  25. (NOT in the constructor!) and delete in the shutdown() method (NOT in the
  26. destructor!)
  27. This is because the application object gets created before Juce has been properly
  28. initialised, so any embedded objects would also get constructed too soon.
  29. */
  30. MainDemoWindow* theMainWindow;
  31. public:
  32. //==============================================================================
  33. JUCEDemoApplication()
  34. : theMainWindow (0)
  35. {
  36. // NEVER do anything in here that could involve any Juce function being called
  37. // - leave all your startup tasks until the initialise() method.
  38. }
  39. ~JUCEDemoApplication()
  40. {
  41. // Your shutdown() method should already have done all the things necessary to
  42. // clean up this app object, so you should never need to put anything in
  43. // the destructor.
  44. // Making any Juce calls in here could be very dangerous...
  45. }
  46. //==============================================================================
  47. void initialise (const String& /*commandLine*/)
  48. {
  49. // just create the main window...
  50. theMainWindow = new MainDemoWindow();
  51. #if JUCE_IPHONE
  52. theMainWindow->setVisible (true);
  53. theMainWindow->setBounds (0, 20, 320, 460);
  54. #else
  55. theMainWindow->centreWithSize (700, 600);
  56. #endif
  57. theMainWindow->setVisible (true);
  58. // this little function just demonstrates a few system info calls
  59. Logger::outputDebugString (collectSomeSystemInfo());
  60. /* on return from this method, the app will go into its the main event
  61. dispatch loop, and this will run until something calls
  62. JUCEAppliction::quit().
  63. In this case, JUCEAppliction::quit() will be called by the
  64. demo window when the user clicks on its close button.
  65. */
  66. }
  67. void shutdown()
  68. {
  69. delete theMainWindow;
  70. theMainWindow = 0;
  71. }
  72. //==============================================================================
  73. const String getApplicationName()
  74. {
  75. return T("JUCE Demo");
  76. }
  77. const String getApplicationVersion()
  78. {
  79. return ProjectInfo::versionString;
  80. }
  81. bool moreThanOneInstanceAllowed()
  82. {
  83. return true;
  84. }
  85. void anotherInstanceStarted (const String& /*commandLine*/)
  86. {
  87. // This will get called if the user launches another copy of the app, but
  88. // there's nothing that the demo app needs to do here.
  89. }
  90. private:
  91. //==============================================================================
  92. // this little function just demonstrates a few system info calls
  93. static const String collectSomeSystemInfo()
  94. {
  95. String systemInfo;
  96. systemInfo
  97. << "Time and date: " << Time::getCurrentTime().toString (true, true)
  98. << "\nUser logon name: " << SystemStats::getLogonName()
  99. << "\nFull user name: " << SystemStats::getFullUserName()
  100. << "\nOperating system: " << SystemStats::getOperatingSystemName()
  101. << "\nCPU vendor: " << SystemStats::getCpuVendor()
  102. << "\nCPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz"
  103. << "\nNumber of CPUs: " << SystemStats::getNumCpus()
  104. << "\nCPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no")
  105. << "\nCPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no")
  106. << "\nCPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no")
  107. << "\nCPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no")
  108. << "\nMemory size: " << SystemStats::getMemorySizeInMegabytes() << "MB"
  109. << "\nFound network card MAC addresses: " << SystemStats::getMACAddressStrings().joinIntoString (T(", "))
  110. << "\nCurrent executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName()
  111. << "\nCurrent application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName()
  112. << "\nCurrent working directory: " << File::getCurrentWorkingDirectory().getFullPathName()
  113. << "\nUser home directory: " << File::getSpecialLocation (File::userHomeDirectory).getFullPathName()
  114. << "\nUser documents directory: " << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName()
  115. << "\nUser application data directory: " << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName()
  116. << "\nCommon application data directory: " << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName()
  117. << "\nTemp directory: " << File::getSpecialLocation (File::tempDirectory).getFullPathName()
  118. << "\n\n";
  119. return systemInfo;
  120. }
  121. };
  122. //==============================================================================
  123. /*
  124. This macro creates the application's main() function..
  125. */
  126. START_JUCE_APPLICATION (JUCEDemoApplication)