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.

28457 lines
734KB

  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. #ifndef __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  19. #define __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  20. #define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
  21. /*** Start of inlined file: juce.h ***/
  22. #ifndef __JUCE_JUCEHEADER__
  23. #define __JUCE_JUCEHEADER__
  24. #define JUCE_PUBLIC_INCLUDES 1
  25. // (this includes things that need defining outside of the JUCE namespace)
  26. /*** Start of inlined file: juce_StandardHeader.h ***/
  27. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  28. #define __JUCE_STANDARDHEADER_JUCEHEADER__
  29. #define JUCE_MAJOR_VERSION 1
  30. #define JUCE_MINOR_VERSION 51
  31. #define JUCE_BUILDNUMBER 5
  32. #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)
  33. /*** Start of inlined file: juce_TargetPlatform.h ***/
  34. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  35. #define __JUCE_TARGETPLATFORM_JUCEHEADER__
  36. #if (defined (_WIN32) || defined (_WIN64))
  37. #define JUCE_WIN32 1
  38. #define JUCE_WINDOWS 1
  39. #elif defined (LINUX) || defined (__linux__)
  40. #define JUCE_LINUX 1
  41. #elif defined(__APPLE_CPP__) || defined(__APPLE_CC__)
  42. #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
  43. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
  44. #define JUCE_IPHONE 1
  45. #else
  46. #define JUCE_MAC 1
  47. #endif
  48. #else
  49. #error "Unknown platform!"
  50. #endif
  51. #if JUCE_WINDOWS
  52. #ifdef _MSC_VER
  53. #ifdef _WIN64
  54. #define JUCE_64BIT 1
  55. #else
  56. #define JUCE_32BIT 1
  57. #endif
  58. #endif
  59. #ifdef _DEBUG
  60. #define JUCE_DEBUG 1
  61. #endif
  62. #ifdef __MINGW32__
  63. #define JUCE_MINGW 1
  64. #endif
  65. #define JUCE_LITTLE_ENDIAN 1
  66. #define JUCE_INTEL 1
  67. #endif
  68. #if JUCE_MAC
  69. #ifndef NDEBUG
  70. #define JUCE_DEBUG 1
  71. #endif
  72. #ifdef __LITTLE_ENDIAN__
  73. #define JUCE_LITTLE_ENDIAN 1
  74. #else
  75. #define JUCE_BIG_ENDIAN 1
  76. #endif
  77. #if defined (__ppc__) || defined (__ppc64__)
  78. #define JUCE_PPC 1
  79. #undef MAC_OS_X_VERSION_MAX_ALLOWED
  80. #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_4
  81. #else
  82. #define JUCE_INTEL 1
  83. #endif
  84. #ifdef __LP64__
  85. #define JUCE_64BIT 1
  86. #else
  87. #define JUCE_32BIT 1
  88. #endif
  89. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  90. #error "Building for OSX 10.3 is no longer supported!"
  91. #endif
  92. #ifndef MAC_OS_X_VERSION_10_5
  93. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  94. #endif
  95. #endif
  96. #if JUCE_IPHONE
  97. #ifndef NDEBUG
  98. #define JUCE_DEBUG 1
  99. #endif
  100. #ifdef __LITTLE_ENDIAN__
  101. #define JUCE_LITTLE_ENDIAN 1
  102. #else
  103. #define JUCE_BIG_ENDIAN 1
  104. #endif
  105. #endif
  106. #if JUCE_LINUX
  107. #ifdef _DEBUG
  108. #define JUCE_DEBUG 1
  109. #endif
  110. // Allow override for big-endian Linux platforms
  111. #ifndef JUCE_BIG_ENDIAN
  112. #define JUCE_LITTLE_ENDIAN 1
  113. #endif
  114. #if defined (__LP64__) || defined (_LP64)
  115. #define JUCE_64BIT 1
  116. #else
  117. #define JUCE_32BIT 1
  118. #endif
  119. #define JUCE_INTEL 1
  120. #endif
  121. // Compiler type macros.
  122. #ifdef __GNUC__
  123. #define JUCE_GCC 1
  124. #elif defined (_MSC_VER)
  125. #define JUCE_MSVC 1
  126. #if _MSC_VER >= 1400
  127. #define JUCE_USE_INTRINSICS 1
  128. #endif
  129. #else
  130. #error unknown compiler
  131. #endif
  132. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  133. /*** End of inlined file: juce_TargetPlatform.h ***/
  134. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  135. /*** Start of inlined file: juce_Config.h ***/
  136. #ifndef __JUCE_CONFIG_JUCEHEADER__
  137. #define __JUCE_CONFIG_JUCEHEADER__
  138. #ifndef JUCE_NAMESPACE
  139. #define JUCE_NAMESPACE juce
  140. #endif
  141. #ifndef JUCE_FORCE_DEBUG
  142. //#define JUCE_FORCE_DEBUG 1
  143. #endif
  144. #ifndef JUCE_LOG_ASSERTIONS
  145. // #define JUCE_LOG_ASSERTIONS 1
  146. #endif
  147. #ifndef JUCE_ASIO
  148. #define JUCE_ASIO 1
  149. #endif
  150. #ifndef JUCE_WASAPI
  151. // #define JUCE_WASAPI 1
  152. #endif
  153. #ifndef JUCE_DIRECTSOUND
  154. #define JUCE_DIRECTSOUND 1
  155. #endif
  156. #ifndef JUCE_ALSA
  157. #define JUCE_ALSA 1
  158. #endif
  159. #ifndef JUCE_JACK
  160. #define JUCE_JACK 1
  161. #endif
  162. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  163. #define JUCE_QUICKTIME 1
  164. #endif
  165. #ifndef JUCE_OPENGL
  166. #define JUCE_OPENGL 1
  167. #endif
  168. #ifndef JUCE_USE_FLAC
  169. #define JUCE_USE_FLAC 1
  170. #endif
  171. #ifndef JUCE_USE_OGGVORBIS
  172. #define JUCE_USE_OGGVORBIS 1
  173. #endif
  174. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  175. #define JUCE_USE_CDBURNER 1
  176. #endif
  177. #ifndef JUCE_USE_CDREADER
  178. #define JUCE_USE_CDREADER 1
  179. #endif
  180. #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
  181. // #define JUCE_USE_CAMERA 1
  182. #endif
  183. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  184. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  185. #endif
  186. #ifndef JUCE_USE_XINERAMA
  187. #define JUCE_USE_XINERAMA 1
  188. #endif
  189. #ifndef JUCE_USE_XSHM
  190. #define JUCE_USE_XSHM 1
  191. #endif
  192. #ifndef JUCE_PLUGINHOST_VST
  193. // #define JUCE_PLUGINHOST_VST 1
  194. #endif
  195. #ifndef JUCE_PLUGINHOST_AU
  196. // #define JUCE_PLUGINHOST_AU 1
  197. #endif
  198. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  199. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  200. #endif
  201. #ifndef JUCE_WEB_BROWSER
  202. #define JUCE_WEB_BROWSER 1
  203. #endif
  204. #ifndef JUCE_SUPPORT_CARBON
  205. #define JUCE_SUPPORT_CARBON 1
  206. #endif
  207. #ifndef JUCE_INCLUDE_ZLIB_CODE
  208. #define JUCE_INCLUDE_ZLIB_CODE 1
  209. #endif
  210. #ifndef JUCE_INCLUDE_FLAC_CODE
  211. #define JUCE_INCLUDE_FLAC_CODE 1
  212. #endif
  213. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  214. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  217. #define JUCE_INCLUDE_PNGLIB_CODE 1
  218. #endif
  219. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  220. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  221. #endif
  222. #ifndef JUCE_CHECK_MEMORY_LEAKS
  223. #define JUCE_CHECK_MEMORY_LEAKS 1
  224. #endif
  225. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  226. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  227. #endif
  228. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  229. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  230. #undef JUCE_QUICKTIME
  231. #define JUCE_QUICKTIME 0
  232. #undef JUCE_OPENGL
  233. #define JUCE_OPENGL 0
  234. #undef JUCE_USE_CDBURNER
  235. #define JUCE_USE_CDBURNER 0
  236. #undef JUCE_USE_CDREADER
  237. #define JUCE_USE_CDREADER 0
  238. #undef JUCE_WEB_BROWSER
  239. #define JUCE_WEB_BROWSER 0
  240. #undef JUCE_PLUGINHOST_AU
  241. #define JUCE_PLUGINHOST_AU 0
  242. #undef JUCE_PLUGINHOST_VST
  243. #define JUCE_PLUGINHOST_VST 0
  244. #endif
  245. #endif
  246. /*** End of inlined file: juce_Config.h ***/
  247. #ifdef JUCE_NAMESPACE
  248. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  249. #define END_JUCE_NAMESPACE }
  250. #else
  251. #define BEGIN_JUCE_NAMESPACE
  252. #define END_JUCE_NAMESPACE
  253. #endif
  254. /*** Start of inlined file: juce_PlatformDefs.h ***/
  255. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  256. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  257. #ifdef JUCE_FORCE_DEBUG
  258. #undef JUCE_DEBUG
  259. #if JUCE_FORCE_DEBUG
  260. #define JUCE_DEBUG 1
  261. #endif
  262. #endif
  263. #if JUCE_MSVC
  264. #define JUCE_CALLTYPE __stdcall
  265. #else
  266. #define JUCE_CALLTYPE
  267. #endif
  268. // Debugging and assertion macros
  269. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  270. #if JUCE_LOG_ASSERTIONS
  271. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  272. #elif defined (JUCE_DEBUG)
  273. #define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
  274. #else
  275. #define juce_LogCurrentAssertion
  276. #endif
  277. #ifdef JUCE_DEBUG
  278. // If debugging is enabled..
  279. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  280. #define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
  281. // Assertions..
  282. #if JUCE_WINDOWS || DOXYGEN
  283. #if JUCE_USE_INTRINSICS
  284. #pragma intrinsic (__debugbreak)
  285. #define juce_breakDebugger __debugbreak();
  286. #elif JUCE_GCC
  287. #define juce_breakDebugger asm("int $3");
  288. #else
  289. #define juce_breakDebugger { __asm int 3 }
  290. #endif
  291. #elif JUCE_MAC
  292. #define juce_breakDebugger Debugger();
  293. #elif JUCE_IPHONE
  294. #define juce_breakDebugger kill (0, SIGTRAP);
  295. #elif JUCE_LINUX
  296. #define juce_breakDebugger kill (0, SIGTRAP);
  297. #endif
  298. /** This will always cause an assertion failure.
  299. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  300. in juce_Config.h).
  301. @see jassert()
  302. */
  303. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  304. /** Platform-independent assertion macro.
  305. This gets optimised out when not being built with debugging turned on.
  306. Be careful not to call any functions within its arguments that are vital to
  307. the behaviour of the program, because these won't get called in the release
  308. build.
  309. @see jassertfalse
  310. */
  311. #define jassert(expression) { if (! (expression)) jassertfalse }
  312. #else
  313. // If debugging is disabled, these dummy debug and assertion macros are used..
  314. #define DBG(dbgtext)
  315. #define DBG_PRINTF(dbgprintf)
  316. #define jassertfalse { juce_LogCurrentAssertion }
  317. #if JUCE_LOG_ASSERTIONS
  318. #define jassert(expression) { if (! (expression)) jassertfalse }
  319. #else
  320. #define jassert(a) { }
  321. #endif
  322. #endif
  323. #ifndef DOXYGEN
  324. template <bool b> struct JuceStaticAssert;
  325. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  326. #endif
  327. /** A compile-time assertion macro.
  328. If the expression parameter is false, the macro will cause a compile error.
  329. */
  330. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  331. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  332. #define JUCE_TRY try
  333. #define JUCE_CATCH_EXCEPTION \
  334. catch (const std::exception& e) \
  335. { \
  336. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  337. } \
  338. catch (...) \
  339. { \
  340. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  341. }
  342. #define JUCE_CATCH_ALL catch (...) {}
  343. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  344. #else
  345. #define JUCE_TRY
  346. #define JUCE_CATCH_EXCEPTION
  347. #define JUCE_CATCH_ALL
  348. #define JUCE_CATCH_ALL_ASSERT
  349. #endif
  350. // Macros for inlining.
  351. #if JUCE_MSVC
  352. #ifndef JUCE_DEBUG
  353. #define forcedinline __forceinline
  354. #else
  355. #define forcedinline inline
  356. #endif
  357. #else
  358. #ifndef JUCE_DEBUG
  359. #define forcedinline inline __attribute__((always_inline))
  360. #else
  361. #define forcedinline inline
  362. #endif
  363. #endif
  364. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  365. /*** End of inlined file: juce_PlatformDefs.h ***/
  366. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  367. #if JUCE_MSVC
  368. #if (defined(_MSC_VER) && (_MSC_VER <= 1200))
  369. #pragma warning (disable: 4284) // (spurious VC6 warning)
  370. #endif
  371. #pragma warning (push)
  372. #pragma warning (disable: 4514 4245 4100)
  373. #endif
  374. #include <cstdlib>
  375. #include <cstdarg>
  376. #include <climits>
  377. #include <limits>
  378. #include <cmath>
  379. #include <cwchar>
  380. #include <stdexcept>
  381. #include <typeinfo>
  382. #include <cstring>
  383. #include <cstdio>
  384. #include <iostream>
  385. #if JUCE_USE_INTRINSICS
  386. #include <intrin.h>
  387. #endif
  388. #if JUCE_MAC || JUCE_IPHONE
  389. #include <libkern/OSAtomic.h>
  390. #endif
  391. #if JUCE_LINUX
  392. #include <signal.h>
  393. #endif
  394. #if JUCE_MSVC && JUCE_DEBUG
  395. #include <crtdbg.h>
  396. #endif
  397. #if JUCE_MSVC
  398. #include <malloc.h>
  399. #pragma warning (pop)
  400. #if ! JUCE_PUBLIC_INCLUDES
  401. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  402. #endif
  403. #endif
  404. // DLL building settings on Win32
  405. #if JUCE_MSVC
  406. #ifdef JUCE_DLL_BUILD
  407. #define JUCE_API __declspec (dllexport)
  408. #pragma warning (disable: 4251)
  409. #elif defined (JUCE_DLL)
  410. #define JUCE_API __declspec (dllimport)
  411. #pragma warning (disable: 4251)
  412. #endif
  413. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  414. #ifdef JUCE_DLL_BUILD
  415. #define JUCE_API __attribute__ ((visibility("default")))
  416. #endif
  417. #endif
  418. #ifndef JUCE_API
  419. #define JUCE_API
  420. #endif
  421. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  422. // Now include some basics that are needed by most of the Juce classes...
  423. BEGIN_JUCE_NAMESPACE
  424. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  425. #if JUCE_LOG_ASSERTIONS
  426. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  427. #endif
  428. /*** Start of inlined file: juce_Memory.h ***/
  429. #ifndef __JUCE_MEMORY_JUCEHEADER__
  430. #define __JUCE_MEMORY_JUCEHEADER__
  431. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  432. #ifndef JUCE_DLL
  433. // Win32 debug non-DLL versions..
  434. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  435. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  436. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  437. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  438. #else
  439. // Win32 debug DLL versions..
  440. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  441. // way all juce calls in the DLL and in the host API will all use the same allocator.
  442. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  443. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  444. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  445. extern JUCE_API void juce_DebugFree (void* const block);
  446. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  447. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  448. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  449. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  450. #endif
  451. #if ! defined (_AFXDLL)
  452. #define juce_UseDebuggingNewOperator \
  453. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  454. static void* operator new (size_t, void* p) { return p; } \
  455. static void operator delete (void* p) { juce_free (p); } \
  456. static void operator delete (void*, void*) { }
  457. #endif
  458. #elif defined (JUCE_DLL)
  459. // Win32 DLL (release) versions..
  460. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  461. // way all juce calls in the DLL and in the host API will all use the same allocator.
  462. extern JUCE_API void* juce_Malloc (const int size);
  463. extern JUCE_API void* juce_Calloc (const int size);
  464. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  465. extern JUCE_API void juce_Free (void* const block);
  466. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  467. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  468. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  469. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  470. #define juce_UseDebuggingNewOperator \
  471. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  472. static void* operator new (size_t, void* p) { return p; } \
  473. static void operator delete (void* p) { juce_free (p); } \
  474. static void operator delete (void*, void*) { }
  475. #else
  476. // Mac, Linux and Win32 (release) versions..
  477. #define juce_malloc(numBytes) malloc (numBytes)
  478. #define juce_calloc(numBytes) calloc (1, numBytes)
  479. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  480. #define juce_free(location) free (location)
  481. #endif
  482. #ifndef juce_UseDebuggingNewOperator
  483. #define juce_UseDebuggingNewOperator
  484. #endif
  485. #if JUCE_MSVC
  486. #define juce_ThreadLocal __declspec(thread)
  487. #else
  488. #define juce_ThreadLocal __thread
  489. #endif
  490. #if JUCE_MINGW
  491. #define alloca __builtin_alloca
  492. #endif
  493. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  494. template <typename Type>
  495. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  496. template <typename Type>
  497. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  498. #endif // __JUCE_MEMORY_JUCEHEADER__
  499. /*** End of inlined file: juce_Memory.h ***/
  500. /*** Start of inlined file: juce_MathsFunctions.h ***/
  501. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  502. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  503. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  504. typedef signed char int8;
  505. typedef unsigned char uint8;
  506. typedef signed short int16;
  507. typedef unsigned short uint16;
  508. typedef signed int int32;
  509. typedef unsigned int uint32;
  510. #if JUCE_MSVC
  511. typedef __int64 int64;
  512. typedef unsigned __int64 uint64;
  513. #define literal64bit(longLiteral) ((__int64) longLiteral)
  514. #else
  515. typedef long long int64;
  516. typedef unsigned long long uint64;
  517. #define literal64bit(longLiteral) (longLiteral##LL)
  518. #endif
  519. #if JUCE_64BIT
  520. typedef int64 pointer_sized_int;
  521. typedef uint64 pointer_sized_uint;
  522. #elif _MSC_VER >= 1300
  523. typedef _W64 int pointer_sized_int;
  524. typedef _W64 unsigned int pointer_sized_uint;
  525. #else
  526. typedef int pointer_sized_int;
  527. typedef unsigned int pointer_sized_uint;
  528. #endif
  529. typedef wchar_t juce_wchar;
  530. // Some indispensible min/max functions
  531. template <typename Type>
  532. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  533. template <typename Type>
  534. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  535. template <typename Type>
  536. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  537. template <typename Type>
  538. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  539. template <typename Type>
  540. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  541. template <typename Type>
  542. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  543. template <typename Type>
  544. inline Type jlimit (const Type lowerLimit,
  545. const Type upperLimit,
  546. const Type valueToConstrain) throw()
  547. {
  548. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  549. return (valueToConstrain < lowerLimit) ? lowerLimit
  550. : ((valueToConstrain > upperLimit) ? upperLimit
  551. : valueToConstrain);
  552. }
  553. template <typename Type>
  554. inline void swapVariables (Type& variable1, Type& variable2)
  555. {
  556. const Type tempVal = variable1;
  557. variable1 = variable2;
  558. variable2 = tempVal;
  559. }
  560. template <typename Type>
  561. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  562. // Some useful maths functions that aren't always present with all compilers and build settings.
  563. inline double juce_hypot (double a, double b)
  564. {
  565. #if JUCE_WINDOWS
  566. return _hypot (a, b);
  567. #else
  568. return hypot (a, b);
  569. #endif
  570. }
  571. inline float juce_hypotf (float a, float b)
  572. {
  573. #if JUCE_WINDOWS
  574. return (float) _hypot (a, b);
  575. #else
  576. return hypotf (a, b);
  577. #endif
  578. }
  579. inline int64 abs64 (const int64 n)
  580. {
  581. return (n >= 0) ? n : -n;
  582. }
  583. const double double_Pi = 3.1415926535897932384626433832795;
  584. const float float_Pi = 3.14159265358979323846f;
  585. template <typename FloatingPointType>
  586. inline bool juce_isfinite (FloatingPointType value)
  587. {
  588. #if JUCE_WINDOWS
  589. return _finite (value);
  590. #else
  591. return std::isfinite (value);
  592. #endif
  593. }
  594. template <typename FloatType>
  595. inline int roundToInt (const FloatType value) throw()
  596. {
  597. union { int asInt[2]; double asDouble; } n;
  598. n.asDouble = ((double) value) + 6755399441055744.0;
  599. #if JUCE_BIG_ENDIAN
  600. return n.asInt [1];
  601. #else
  602. return n.asInt [0];
  603. #endif
  604. }
  605. inline int roundToIntAccurate (const double value) throw()
  606. {
  607. return roundToInt (value + 1.5e-8);
  608. }
  609. inline int roundDoubleToInt (const double value) throw()
  610. {
  611. return roundToInt (value);
  612. }
  613. inline int roundFloatToInt (const float value) throw()
  614. {
  615. return roundToInt (value);
  616. }
  617. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  618. /*** End of inlined file: juce_MathsFunctions.h ***/
  619. /*** Start of inlined file: juce_ByteOrder.h ***/
  620. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  621. #define __JUCE_BYTEORDER_JUCEHEADER__
  622. class JUCE_API ByteOrder
  623. {
  624. public:
  625. static uint16 swap (uint16 value);
  626. static uint32 swap (uint32 value);
  627. static uint64 swap (uint64 value);
  628. static uint16 swapIfBigEndian (const uint16 value);
  629. static uint32 swapIfBigEndian (const uint32 value);
  630. static uint64 swapIfBigEndian (const uint64 value);
  631. static uint16 swapIfLittleEndian (const uint16 value);
  632. static uint32 swapIfLittleEndian (const uint32 value);
  633. static uint64 swapIfLittleEndian (const uint64 value);
  634. static uint32 littleEndianInt (const char* const bytes);
  635. static uint16 littleEndianShort (const char* const bytes);
  636. static uint32 bigEndianInt (const char* const bytes);
  637. static uint16 bigEndianShort (const char* const bytes);
  638. static int littleEndian24Bit (const char* const bytes);
  639. static int bigEndian24Bit (const char* const bytes);
  640. static void littleEndian24BitToChars (const int value, char* const destBytes);
  641. static void bigEndian24BitToChars (const int value, char* const destBytes);
  642. static bool isBigEndian();
  643. };
  644. #if JUCE_USE_INTRINSICS
  645. #pragma intrinsic (_byteswap_ulong)
  646. #endif
  647. inline uint16 ByteOrder::swap (uint16 n)
  648. {
  649. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  650. return (uint16) _byteswap_ushort (n);
  651. #else
  652. return (uint16) ((n << 8) | (n >> 8));
  653. #endif
  654. }
  655. inline uint32 ByteOrder::swap (uint32 n)
  656. {
  657. #if JUCE_MAC || JUCE_IPHONE
  658. return OSSwapInt32 (n);
  659. #elif JUCE_GCC
  660. asm("bswap %%eax" : "=a"(n) : "a"(n));
  661. return n;
  662. #elif JUCE_USE_INTRINSICS
  663. return _byteswap_ulong (n);
  664. #else
  665. __asm {
  666. mov eax, n
  667. bswap eax
  668. mov n, eax
  669. }
  670. return n;
  671. #endif
  672. }
  673. inline uint64 ByteOrder::swap (uint64 value)
  674. {
  675. #if JUCE_MAC || JUCE_IPHONE
  676. return OSSwapInt64 (value);
  677. #elif JUCE_USE_INTRINSICS
  678. return _byteswap_uint64 (value);
  679. #else
  680. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  681. #endif
  682. }
  683. #if JUCE_LITTLE_ENDIAN
  684. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  685. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  686. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  687. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  688. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  689. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  690. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  691. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  692. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  693. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  694. inline bool ByteOrder::isBigEndian() { return false; }
  695. #else
  696. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  697. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  698. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  699. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  700. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  701. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  702. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  703. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  704. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  705. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  706. inline bool ByteOrder::isBigEndian() { return true; }
  707. #endif
  708. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  709. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  710. inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
  711. inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
  712. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  713. /*** End of inlined file: juce_ByteOrder.h ***/
  714. /*** Start of inlined file: juce_Logger.h ***/
  715. #ifndef __JUCE_LOGGER_JUCEHEADER__
  716. #define __JUCE_LOGGER_JUCEHEADER__
  717. /*** Start of inlined file: juce_String.h ***/
  718. #ifndef __JUCE_STRING_JUCEHEADER__
  719. #define __JUCE_STRING_JUCEHEADER__
  720. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  721. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  722. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  723. #define JUCE_T(stringLiteral) (L##stringLiteral)
  724. typedef juce_wchar tchar;
  725. #if ! JUCE_DONT_DEFINE_MACROS
  726. #define T(stringLiteral) JUCE_T(stringLiteral)
  727. #endif
  728. class JUCE_API CharacterFunctions
  729. {
  730. public:
  731. static int length (const char* const s) throw();
  732. static int length (const juce_wchar* const s) throw();
  733. static void copy (char* dest, const char* src, const int maxBytes) throw();
  734. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  735. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  736. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  737. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  738. static void append (char* dest, const char* src) throw();
  739. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  740. static int compare (const char* const s1, const char* const s2) throw();
  741. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  742. static int compare (const juce_wchar* s1, const char* s2) throw();
  743. static int compare (const char* s1, const juce_wchar* s2) throw();
  744. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  745. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  746. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  747. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  748. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  749. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  750. static const char* find (const char* const haystack, const char* const needle) throw();
  751. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  752. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  753. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  754. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  755. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  756. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  757. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  758. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  759. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  760. static int getIntValue (const char* const s) throw();
  761. static int getIntValue (const juce_wchar* s) throw();
  762. static int64 getInt64Value (const char* s) throw();
  763. static int64 getInt64Value (const juce_wchar* s) throw();
  764. static double getDoubleValue (const char* const s) throw();
  765. static double getDoubleValue (const juce_wchar* const s) throw();
  766. static char toUpperCase (const char character) throw();
  767. static juce_wchar toUpperCase (const juce_wchar character) throw();
  768. static void toUpperCase (char* s) throw();
  769. static void toUpperCase (juce_wchar* s) throw();
  770. static bool isUpperCase (const char character) throw();
  771. static bool isUpperCase (const juce_wchar character) throw();
  772. static char toLowerCase (const char character) throw();
  773. static juce_wchar toLowerCase (const juce_wchar character) throw();
  774. static void toLowerCase (char* s) throw();
  775. static void toLowerCase (juce_wchar* s) throw();
  776. static bool isLowerCase (const char character) throw();
  777. static bool isLowerCase (const juce_wchar character) throw();
  778. static bool isWhitespace (const char character) throw();
  779. static bool isWhitespace (const juce_wchar character) throw();
  780. static bool isDigit (const char character) throw();
  781. static bool isDigit (const juce_wchar character) throw();
  782. static bool isLetter (const char character) throw();
  783. static bool isLetter (const juce_wchar character) throw();
  784. static bool isLetterOrDigit (const char character) throw();
  785. static bool isLetterOrDigit (const juce_wchar character) throw();
  786. static int getHexDigitValue (const juce_wchar digit) throw();
  787. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  788. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  789. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  790. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  791. };
  792. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  793. /*** End of inlined file: juce_CharacterFunctions.h ***/
  794. class OutputStream;
  795. class JUCE_API String
  796. {
  797. public:
  798. String() throw();
  799. String (const String& other) throw();
  800. String (const char* const text) throw();
  801. String (const char* const text,
  802. const size_t maxChars) throw();
  803. String (const juce_wchar* const unicodeText) throw();
  804. String (const juce_wchar* const unicodeText,
  805. const size_t maxChars) throw();
  806. static const String charToString (const juce_wchar character) throw();
  807. ~String() throw();
  808. static const String empty;
  809. int hashCode() const throw();
  810. int64 hashCode64() const throw();
  811. int length() const throw();
  812. // Assignment and concatenation operators..
  813. String& operator= (const String& other) throw();
  814. String& operator+= (const tchar* const textToAppend);
  815. String& operator+= (const String& stringToAppend);
  816. String& operator+= (const char characterToAppend);
  817. String& operator+= (const juce_wchar characterToAppend);
  818. String& operator+= (const int numberToAppend);
  819. String& operator+= (const unsigned int numberToAppend);
  820. void append (const tchar* const textToAppend,
  821. const int maxCharsToTake);
  822. // Comparison methods..
  823. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  824. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  825. bool equalsIgnoreCase (const String& other) const throw();
  826. bool equalsIgnoreCase (const tchar* const other) const throw();
  827. int compare (const String& other) const throw();
  828. int compare (const char* other) const throw();
  829. int compare (const juce_wchar* other) const throw();
  830. int compareIgnoreCase (const String& other) const throw();
  831. int compareLexicographically (const String& other) const throw();
  832. bool startsWith (const tchar* const text) const throw();
  833. bool startsWithChar (const tchar character) const throw();
  834. bool startsWithIgnoreCase (const tchar* const text) const throw();
  835. bool endsWith (const tchar* const text) const throw();
  836. bool endsWithChar (const tchar character) const throw();
  837. bool endsWithIgnoreCase (const tchar* const text) const throw();
  838. bool contains (const tchar* const text) const throw();
  839. bool containsChar (const tchar character) const throw();
  840. bool containsIgnoreCase (const tchar* const text) const throw();
  841. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  842. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  843. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  844. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  845. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  846. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  847. bool containsNonWhitespaceChars() const throw();
  848. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  849. // Substring location methods..
  850. int indexOfChar (const tchar characterToLookFor) const throw();
  851. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  852. int indexOfAnyOf (const tchar* const charactersToLookFor,
  853. const int startIndex = 0,
  854. const bool ignoreCase = false) const throw();
  855. int indexOf (const tchar* const text) const throw();
  856. int indexOf (const int startIndex,
  857. const tchar* const textToLookFor) const throw();
  858. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  859. int indexOfIgnoreCase (const int startIndex,
  860. const tchar* const textToLookFor) const throw();
  861. int lastIndexOfChar (const tchar character) const throw();
  862. int lastIndexOf (const tchar* const textToLookFor) const throw();
  863. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  864. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  865. const bool ignoreCase = false) const throw();
  866. // Substring extraction and manipulation methods..
  867. /** Returns the character at this index in the string.
  868. No checks are made to see if the index is within a valid range, so be careful!
  869. */
  870. inline const juce_wchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  871. juce_wchar& operator[] (const int index) throw();
  872. juce_wchar getLastCharacter() const throw();
  873. const String substring (int startIndex,
  874. int endIndex) const throw();
  875. const String substring (const int startIndex) const throw();
  876. const String dropLastCharacters (const int numberToDrop) const throw();
  877. const String getLastCharacters (const int numCharacters) const throw();
  878. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  879. const bool includeSubStringInResult,
  880. const bool ignoreCase) const throw();
  881. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  882. const bool includeSubStringInResult,
  883. const bool ignoreCase) const throw();
  884. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  885. const bool includeSubStringInResult,
  886. const bool ignoreCase) const throw();
  887. const String upToLastOccurrenceOf (const tchar* substringToFind,
  888. const bool includeSubStringInResult,
  889. const bool ignoreCase) const throw();
  890. const String trim() const throw();
  891. const String trimStart() const throw();
  892. const String trimEnd() const throw();
  893. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  894. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  895. const String toUpperCase() const throw();
  896. const String toLowerCase() const throw();
  897. const String replaceSection (int startIndex,
  898. int numCharactersToReplace,
  899. const tchar* const stringToInsert) const throw();
  900. const String replace (const tchar* const stringToReplace,
  901. const tchar* const stringToInsertInstead,
  902. const bool ignoreCase = false) const throw();
  903. const String replaceCharacter (const tchar characterToReplace,
  904. const tchar characterToInsertInstead) const throw();
  905. const String replaceCharacters (const String& charactersToReplace,
  906. const tchar* const charactersToInsertInstead) const throw();
  907. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  908. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  909. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  910. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  911. bool isQuotedString() const throw();
  912. const String unquoted() const throw();
  913. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  914. void printf (const tchar* const format, ...) throw();
  915. static const String formatted (const tchar* const format, ...) throw();
  916. void vprintf (const tchar* const format, va_list& args) throw();
  917. static const String repeatedString (const tchar* const stringToRepeat,
  918. int numberOfTimesToRepeat) throw();
  919. static const String createStringFromData (const void* const data,
  920. const int size) throw();
  921. // Numeric conversions..
  922. explicit String (const int decimalInteger) throw();
  923. explicit String (const unsigned int decimalInteger) throw();
  924. explicit String (const short decimalInteger) throw();
  925. explicit String (const unsigned short decimalInteger) throw();
  926. explicit String (const int64 largeIntegerValue) throw();
  927. explicit String (const uint64 largeIntegerValue) throw();
  928. explicit String (const float floatValue,
  929. const int numberOfDecimalPlaces = 0) throw();
  930. explicit String (const double doubleValue,
  931. const int numberOfDecimalPlaces = 0) throw();
  932. int getIntValue() const throw();
  933. int64 getLargeIntValue() const throw();
  934. int getTrailingIntValue() const throw();
  935. float getFloatValue() const throw();
  936. double getDoubleValue() const throw();
  937. int getHexValue32() const throw();
  938. int64 getHexValue64() const throw();
  939. static const String toHexString (const int number) throw();
  940. static const String toHexString (const int64 number) throw();
  941. static const String toHexString (const short number) throw();
  942. static const String toHexString (const unsigned char* data,
  943. const int size,
  944. const int groupSize = 1) throw();
  945. inline operator const juce_wchar*() const throw() { return text->text; }
  946. inline operator juce_wchar*() throw() { return text->text; }
  947. const char* toUTF8() const;
  948. static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
  949. int getNumBytesAsUTF8() const throw();
  950. int copyToUTF8 (char* destBuffer, const int maxBufferSizeBytes) const throw();
  951. const char* toCString() const;
  952. int getNumBytesAsCString() const throw();
  953. int copyToCString (char* destBuffer, const int maxBufferSizeBytes) const throw();
  954. void copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw();
  955. void preallocateStorage (const size_t numCharsNeeded) throw();
  956. class JUCE_API Concatenator
  957. {
  958. public:
  959. Concatenator (String& stringToAppendTo);
  960. ~Concatenator();
  961. void append (const String& s);
  962. private:
  963. String& result;
  964. int nextIndex;
  965. Concatenator (const Concatenator&);
  966. Concatenator& operator= (const Concatenator&);
  967. };
  968. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  969. private:
  970. struct InternalRefCountedStringHolder
  971. {
  972. int refCount;
  973. int allocatedNumChars;
  974. wchar_t text[1];
  975. };
  976. InternalRefCountedStringHolder* text;
  977. static InternalRefCountedStringHolder emptyString;
  978. // internal constructor that preallocates a certain amount of memory
  979. String (const int numChars, const int dummyVariable) throw();
  980. void createInternal (const int numChars) throw();
  981. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  982. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  983. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  984. void dupeInternalIfMultiplyReferenced() throw();
  985. };
  986. const String operator+ (const char* string1, const String& string2);
  987. const String operator+ (const juce_wchar* string1, const String& string2);
  988. const String operator+ (char string1, const String& string2);
  989. const String operator+ (juce_wchar string1, const String& string2);
  990. const String operator+ (String string1, const String& string2);
  991. const String operator+ (String string1, const char* string2);
  992. const String operator+ (String string1, const juce_wchar* string2);
  993. const String operator+ (String string1, char characterToAppend);
  994. const String operator+ (String string1, juce_wchar characterToAppend);
  995. String& operator<< (String& string1, const char characterToAppend);
  996. String& operator<< (String& string1, const juce_wchar characterToAppend);
  997. String& operator<< (String& string1, const char* const string2);
  998. String& operator<< (String& string1, const juce_wchar* const string2);
  999. String& operator<< (String& string1, const String& string2);
  1000. String& operator<< (String& string1, const short number);
  1001. String& operator<< (String& string1, const int number);
  1002. String& operator<< (String& string1, const unsigned int number);
  1003. String& operator<< (String& string1, const long number);
  1004. String& operator<< (String& string1, const unsigned long number);
  1005. String& operator<< (String& string1, const float number);
  1006. String& operator<< (String& string1, const double number);
  1007. bool operator== (const String& string1, const String& string2) throw();
  1008. bool operator== (const String& string1, const char* string2) throw();
  1009. bool operator== (const String& string1, const juce_wchar* string2) throw();
  1010. bool operator!= (const String& string1, const String& string2) throw();
  1011. bool operator!= (const String& string1, const char* string2) throw();
  1012. bool operator!= (const String& string1, const juce_wchar* string2) throw();
  1013. bool operator> (const String& string1, const String& string2) throw();
  1014. bool operator< (const String& string1, const String& string2) throw();
  1015. bool operator>= (const String& string1, const String& string2) throw();
  1016. bool operator<= (const String& string1, const String& string2) throw();
  1017. template <class charT, class traits>
  1018. std::basic_ostream <charT, traits>& operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite)
  1019. {
  1020. return stream << stringToWrite.toUTF8();
  1021. }
  1022. OutputStream& operator<< (OutputStream& stream, const String& text);
  1023. #endif // __JUCE_STRING_JUCEHEADER__
  1024. /*** End of inlined file: juce_String.h ***/
  1025. class JUCE_API Logger
  1026. {
  1027. public:
  1028. virtual ~Logger();
  1029. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1030. const bool deleteOldLogger = false);
  1031. static void JUCE_CALLTYPE writeToLog (const String& message);
  1032. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1033. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1034. protected:
  1035. Logger();
  1036. virtual void logMessage (const String& message) = 0;
  1037. };
  1038. #endif // __JUCE_LOGGER_JUCEHEADER__
  1039. /*** End of inlined file: juce_Logger.h ***/
  1040. END_JUCE_NAMESPACE
  1041. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1042. /*** End of inlined file: juce_StandardHeader.h ***/
  1043. BEGIN_JUCE_NAMESPACE
  1044. #if JUCE_MSVC
  1045. // this is set explicitly in case the app is using a different packing size.
  1046. #pragma pack (push, 8)
  1047. #pragma warning (push)
  1048. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1049. #endif
  1050. // this is where all the class header files get brought in..
  1051. /*** Start of inlined file: juce_core_includes.h ***/
  1052. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1053. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1054. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1055. /*** Start of inlined file: juce_Array.h ***/
  1056. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1057. #define __JUCE_ARRAY_JUCEHEADER__
  1058. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1059. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1060. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1061. /*** Start of inlined file: juce_HeapBlock.h ***/
  1062. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1063. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1064. template <class ElementType>
  1065. class HeapBlock
  1066. {
  1067. public:
  1068. HeapBlock() throw() : data (0)
  1069. {
  1070. }
  1071. HeapBlock (const size_t numElements)
  1072. : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType)))
  1073. {
  1074. }
  1075. ~HeapBlock()
  1076. {
  1077. ::juce_free (data);
  1078. }
  1079. inline operator ElementType*() const throw() { return data; }
  1080. inline ElementType* getData() const throw() { return data; }
  1081. inline operator void*() const throw() { return static_cast <void*> (data); }
  1082. inline ElementType* operator->() const throw() { return data; }
  1083. template <typename IndexType>
  1084. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1085. template <typename IndexType>
  1086. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1087. inline ElementType* const* operator&() const throw() { return static_cast <ElementType* const*> (&data); }
  1088. inline ElementType** operator&() throw() { return static_cast <ElementType**> (&data); }
  1089. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1090. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1091. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1092. {
  1093. ::juce_free (data);
  1094. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1095. }
  1096. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1097. {
  1098. ::juce_free (data);
  1099. data = (ElementType*) ::juce_calloc (newNumElements * elementSize);
  1100. }
  1101. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1102. {
  1103. ::juce_free (data);
  1104. if (initialiseToZero)
  1105. data = (ElementType*) ::juce_calloc (newNumElements * sizeof (ElementType));
  1106. else
  1107. data = (ElementType*) ::juce_malloc (newNumElements * sizeof (ElementType));
  1108. }
  1109. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1110. {
  1111. if (data == 0)
  1112. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1113. else
  1114. data = (ElementType*) ::juce_realloc (data, newNumElements * elementSize);
  1115. }
  1116. void free()
  1117. {
  1118. ::juce_free (data);
  1119. data = 0;
  1120. }
  1121. void swapWith (HeapBlock <ElementType>& other) throw()
  1122. {
  1123. swapVariables (data, other.data);
  1124. }
  1125. private:
  1126. ElementType* data;
  1127. HeapBlock (const HeapBlock&);
  1128. HeapBlock& operator= (const HeapBlock&);
  1129. };
  1130. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1131. /*** End of inlined file: juce_HeapBlock.h ***/
  1132. template <class ElementType, class TypeOfCriticalSectionToUse>
  1133. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1134. {
  1135. public:
  1136. ArrayAllocationBase() throw()
  1137. : numAllocated (0)
  1138. {
  1139. }
  1140. ~ArrayAllocationBase()
  1141. {
  1142. }
  1143. void setAllocatedSize (const int numElements)
  1144. {
  1145. if (numAllocated != numElements)
  1146. {
  1147. if (numElements > 0)
  1148. elements.realloc (numElements);
  1149. else
  1150. elements.free();
  1151. numAllocated = numElements;
  1152. }
  1153. }
  1154. void ensureAllocatedSize (const int minNumElements)
  1155. {
  1156. if (minNumElements > numAllocated)
  1157. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1158. }
  1159. void shrinkToNoMoreThan (const int maxNumElements)
  1160. {
  1161. if (maxNumElements < numAllocated)
  1162. setAllocatedSize (maxNumElements);
  1163. }
  1164. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1165. {
  1166. elements.swapWith (other.elements);
  1167. swapVariables (numAllocated, other.numAllocated);
  1168. }
  1169. HeapBlock <ElementType> elements;
  1170. int numAllocated;
  1171. private:
  1172. ArrayAllocationBase (const ArrayAllocationBase&);
  1173. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1174. };
  1175. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1176. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1177. /*** Start of inlined file: juce_ElementComparator.h ***/
  1178. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1179. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1180. template <class ElementType, class ElementComparator>
  1181. static void sortArray (ElementComparator& comparator,
  1182. ElementType* const array,
  1183. int firstElement,
  1184. int lastElement,
  1185. const bool retainOrderOfEquivalentItems)
  1186. {
  1187. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1188. // avoids getting warning messages about the parameter being unused
  1189. if (lastElement > firstElement)
  1190. {
  1191. if (retainOrderOfEquivalentItems)
  1192. {
  1193. for (int i = firstElement; i < lastElement; ++i)
  1194. {
  1195. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1196. {
  1197. const ElementType temp = array [i];
  1198. array [i] = array[i + 1];
  1199. array [i + 1] = temp;
  1200. if (i > firstElement)
  1201. i -= 2;
  1202. }
  1203. }
  1204. }
  1205. else
  1206. {
  1207. int fromStack[30], toStack[30];
  1208. int stackIndex = 0;
  1209. for (;;)
  1210. {
  1211. const int size = (lastElement - firstElement) + 1;
  1212. if (size <= 8)
  1213. {
  1214. int j = lastElement;
  1215. int maxIndex;
  1216. while (j > firstElement)
  1217. {
  1218. maxIndex = firstElement;
  1219. for (int k = firstElement + 1; k <= j; ++k)
  1220. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1221. maxIndex = k;
  1222. const ElementType temp = array [maxIndex];
  1223. array [maxIndex] = array[j];
  1224. array [j] = temp;
  1225. --j;
  1226. }
  1227. }
  1228. else
  1229. {
  1230. const int mid = firstElement + (size >> 1);
  1231. ElementType temp = array [mid];
  1232. array [mid] = array [firstElement];
  1233. array [firstElement] = temp;
  1234. int i = firstElement;
  1235. int j = lastElement + 1;
  1236. for (;;)
  1237. {
  1238. while (++i <= lastElement
  1239. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1240. {}
  1241. while (--j > firstElement
  1242. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1243. {}
  1244. if (j < i)
  1245. break;
  1246. temp = array[i];
  1247. array[i] = array[j];
  1248. array[j] = temp;
  1249. }
  1250. temp = array [firstElement];
  1251. array [firstElement] = array[j];
  1252. array [j] = temp;
  1253. if (j - 1 - firstElement >= lastElement - i)
  1254. {
  1255. if (firstElement + 1 < j)
  1256. {
  1257. fromStack [stackIndex] = firstElement;
  1258. toStack [stackIndex] = j - 1;
  1259. ++stackIndex;
  1260. }
  1261. if (i < lastElement)
  1262. {
  1263. firstElement = i;
  1264. continue;
  1265. }
  1266. }
  1267. else
  1268. {
  1269. if (i < lastElement)
  1270. {
  1271. fromStack [stackIndex] = i;
  1272. toStack [stackIndex] = lastElement;
  1273. ++stackIndex;
  1274. }
  1275. if (firstElement + 1 < j)
  1276. {
  1277. lastElement = j - 1;
  1278. continue;
  1279. }
  1280. }
  1281. }
  1282. if (--stackIndex < 0)
  1283. break;
  1284. jassert (stackIndex < numElementsInArray (fromStack));
  1285. firstElement = fromStack [stackIndex];
  1286. lastElement = toStack [stackIndex];
  1287. }
  1288. }
  1289. }
  1290. }
  1291. template <class ElementType, class ElementComparator>
  1292. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1293. ElementType* const array,
  1294. const ElementType newElement,
  1295. int firstElement,
  1296. int lastElement)
  1297. {
  1298. jassert (firstElement <= lastElement);
  1299. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1300. // avoids getting warning messages about the parameter being unused
  1301. while (firstElement < lastElement)
  1302. {
  1303. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1304. {
  1305. ++firstElement;
  1306. break;
  1307. }
  1308. else
  1309. {
  1310. const int halfway = (firstElement + lastElement) >> 1;
  1311. if (halfway == firstElement)
  1312. {
  1313. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1314. ++firstElement;
  1315. break;
  1316. }
  1317. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1318. {
  1319. firstElement = halfway;
  1320. }
  1321. else
  1322. {
  1323. lastElement = halfway;
  1324. }
  1325. }
  1326. }
  1327. return firstElement;
  1328. }
  1329. template <class ElementType>
  1330. class IntegerElementComparator
  1331. {
  1332. public:
  1333. static int compareElements (const ElementType first,
  1334. const ElementType second) throw()
  1335. {
  1336. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1337. }
  1338. };
  1339. template <class ElementType>
  1340. class FloatElementComparator
  1341. {
  1342. public:
  1343. static int compareElements (const ElementType first,
  1344. const ElementType second) throw()
  1345. {
  1346. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1347. }
  1348. };
  1349. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1350. /*** End of inlined file: juce_ElementComparator.h ***/
  1351. /*** Start of inlined file: juce_CriticalSection.h ***/
  1352. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1353. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1354. class JUCE_API ScopedLock;
  1355. class JUCE_API ScopedUnlock;
  1356. class JUCE_API CriticalSection
  1357. {
  1358. public:
  1359. CriticalSection() throw();
  1360. ~CriticalSection() throw();
  1361. void enter() const throw();
  1362. bool tryEnter() const throw();
  1363. void exit() const throw();
  1364. typedef ScopedLock ScopedLockType;
  1365. typedef ScopedUnlock ScopedUnlockType;
  1366. juce_UseDebuggingNewOperator
  1367. private:
  1368. #if JUCE_WIN32
  1369. #if JUCE_64BIT
  1370. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1371. // block of memory here that's big enough to be used internally as a windows critical
  1372. // section object.
  1373. uint8 internal [44];
  1374. #else
  1375. uint8 internal [24];
  1376. #endif
  1377. #else
  1378. mutable pthread_mutex_t internal;
  1379. #endif
  1380. CriticalSection (const CriticalSection&);
  1381. CriticalSection& operator= (const CriticalSection&);
  1382. };
  1383. class JUCE_API DummyCriticalSection
  1384. {
  1385. public:
  1386. inline DummyCriticalSection() throw() {}
  1387. inline ~DummyCriticalSection() throw() {}
  1388. inline void enter() const throw() {}
  1389. inline void exit() const throw() {}
  1390. struct ScopedLockType
  1391. {
  1392. ScopedLockType (const DummyCriticalSection&) throw() {}
  1393. };
  1394. typedef ScopedLockType ScopedUnlockType;
  1395. };
  1396. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1397. /*** End of inlined file: juce_CriticalSection.h ***/
  1398. template <typename ElementType,
  1399. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1400. class Array
  1401. {
  1402. public:
  1403. Array() throw()
  1404. : numUsed (0)
  1405. {
  1406. }
  1407. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1408. {
  1409. const ScopedLockType lock (other.getLock());
  1410. numUsed = other.numUsed;
  1411. data.setAllocatedSize (other.numUsed);
  1412. for (int i = 0; i < numUsed; ++i)
  1413. new (data.elements + i) ElementType (other.data.elements[i]);
  1414. }
  1415. explicit Array (const ElementType* values)
  1416. : numUsed (0)
  1417. {
  1418. while (*values != 0)
  1419. add (*values++);
  1420. }
  1421. Array (const ElementType* values, int numValues)
  1422. : numUsed (numValues)
  1423. {
  1424. data.setAllocatedSize (numValues);
  1425. for (int i = 0; i < numValues; ++i)
  1426. new (data.elements + i) ElementType (values[i]);
  1427. }
  1428. ~Array()
  1429. {
  1430. for (int i = 0; i < numUsed; ++i)
  1431. data.elements[i].~ElementType();
  1432. }
  1433. Array& operator= (const Array& other)
  1434. {
  1435. if (this != &other)
  1436. {
  1437. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1438. swapWithArray (otherCopy);
  1439. }
  1440. return *this;
  1441. }
  1442. template <class OtherArrayType>
  1443. bool operator== (const OtherArrayType& other) const
  1444. {
  1445. const ScopedLockType lock (getLock());
  1446. if (numUsed != other.numUsed)
  1447. return false;
  1448. for (int i = numUsed; --i >= 0;)
  1449. if (data.elements [i] != other.data.elements [i])
  1450. return false;
  1451. return true;
  1452. }
  1453. template <class OtherArrayType>
  1454. bool operator!= (const OtherArrayType& other) const
  1455. {
  1456. return ! operator== (other);
  1457. }
  1458. void clear()
  1459. {
  1460. const ScopedLockType lock (getLock());
  1461. for (int i = 0; i < numUsed; ++i)
  1462. data.elements[i].~ElementType();
  1463. data.setAllocatedSize (0);
  1464. numUsed = 0;
  1465. }
  1466. void clearQuick()
  1467. {
  1468. const ScopedLockType lock (getLock());
  1469. for (int i = 0; i < numUsed; ++i)
  1470. data.elements[i].~ElementType();
  1471. numUsed = 0;
  1472. }
  1473. inline int size() const throw()
  1474. {
  1475. return numUsed;
  1476. }
  1477. inline ElementType operator[] (const int index) const
  1478. {
  1479. const ScopedLockType lock (getLock());
  1480. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  1481. : ElementType();
  1482. }
  1483. inline const ElementType getUnchecked (const int index) const
  1484. {
  1485. const ScopedLockType lock (getLock());
  1486. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1487. return data.elements [index];
  1488. }
  1489. inline ElementType& getReference (const int index) const throw()
  1490. {
  1491. const ScopedLockType lock (getLock());
  1492. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1493. return data.elements [index];
  1494. }
  1495. inline ElementType getFirst() const
  1496. {
  1497. const ScopedLockType lock (getLock());
  1498. return (numUsed > 0) ? data.elements [0]
  1499. : ElementType();
  1500. }
  1501. inline ElementType getLast() const
  1502. {
  1503. const ScopedLockType lock (getLock());
  1504. return (numUsed > 0) ? data.elements [numUsed - 1]
  1505. : ElementType();
  1506. }
  1507. int indexOf (const ElementType& elementToLookFor) const
  1508. {
  1509. const ScopedLockType lock (getLock());
  1510. const ElementType* e = data.elements;
  1511. const ElementType* const end = e + numUsed;
  1512. while (e != end)
  1513. {
  1514. if (elementToLookFor == *e)
  1515. return (int) (e - data.elements);
  1516. ++e;
  1517. }
  1518. return -1;
  1519. }
  1520. bool contains (const ElementType& elementToLookFor) const
  1521. {
  1522. const ScopedLockType lock (getLock());
  1523. const ElementType* e = data.elements;
  1524. const ElementType* const end = e + numUsed;
  1525. while (e != end)
  1526. {
  1527. if (elementToLookFor == *e)
  1528. return true;
  1529. ++e;
  1530. }
  1531. return false;
  1532. }
  1533. void add (const ElementType& newElement)
  1534. {
  1535. const ScopedLockType lock (getLock());
  1536. data.ensureAllocatedSize (numUsed + 1);
  1537. new (data.elements + numUsed++) ElementType (newElement);
  1538. }
  1539. void insert (int indexToInsertAt, const ElementType& newElement)
  1540. {
  1541. const ScopedLockType lock (getLock());
  1542. data.ensureAllocatedSize (numUsed + 1);
  1543. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1544. {
  1545. ElementType* const insertPos = data.elements + indexToInsertAt;
  1546. const int numberToMove = numUsed - indexToInsertAt;
  1547. if (numberToMove > 0)
  1548. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1549. new (insertPos) ElementType (newElement);
  1550. ++numUsed;
  1551. }
  1552. else
  1553. {
  1554. new (data.elements + numUsed++) ElementType (newElement);
  1555. }
  1556. }
  1557. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1558. int numberOfTimesToInsertIt)
  1559. {
  1560. if (numberOfTimesToInsertIt > 0)
  1561. {
  1562. const ScopedLockType lock (getLock());
  1563. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1564. ElementType* insertPos;
  1565. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1566. {
  1567. insertPos = data.elements + indexToInsertAt;
  1568. const int numberToMove = numUsed - indexToInsertAt;
  1569. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1570. }
  1571. else
  1572. {
  1573. insertPos = data.elements + numUsed;
  1574. }
  1575. numUsed += numberOfTimesToInsertIt;
  1576. while (--numberOfTimesToInsertIt >= 0)
  1577. new (insertPos++) ElementType (newElement);
  1578. }
  1579. }
  1580. void insertArray (int indexToInsertAt,
  1581. const ElementType* newElements,
  1582. int numberOfElements)
  1583. {
  1584. if (numberOfElements > 0)
  1585. {
  1586. const ScopedLockType lock (getLock());
  1587. data.ensureAllocatedSize (numUsed + numberOfElements);
  1588. ElementType* insertPos;
  1589. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1590. {
  1591. insertPos = data.elements + indexToInsertAt;
  1592. const int numberToMove = numUsed - indexToInsertAt;
  1593. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1594. }
  1595. else
  1596. {
  1597. insertPos = data.elements + numUsed;
  1598. }
  1599. numUsed += numberOfElements;
  1600. while (--numberOfElements >= 0)
  1601. new (insertPos++) ElementType (*newElements++);
  1602. }
  1603. }
  1604. void addIfNotAlreadyThere (const ElementType& newElement)
  1605. {
  1606. const ScopedLockType lock (getLock());
  1607. if (! contains (newElement))
  1608. add (newElement);
  1609. }
  1610. void set (const int indexToChange, const ElementType& newValue)
  1611. {
  1612. jassert (indexToChange >= 0);
  1613. const ScopedLockType lock (getLock());
  1614. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1615. {
  1616. data.elements [indexToChange] = newValue;
  1617. }
  1618. else if (indexToChange >= 0)
  1619. {
  1620. data.ensureAllocatedSize (numUsed + 1);
  1621. new (data.elements + numUsed++) ElementType (newValue);
  1622. }
  1623. }
  1624. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1625. {
  1626. const ScopedLockType lock (getLock());
  1627. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1628. data.elements [indexToChange] = newValue;
  1629. }
  1630. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1631. {
  1632. const ScopedLockType lock (getLock());
  1633. if (numElementsToAdd > 0)
  1634. {
  1635. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1636. while (--numElementsToAdd >= 0)
  1637. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1638. }
  1639. }
  1640. void swapWithArray (Array& otherArray) throw()
  1641. {
  1642. const ScopedLockType lock1 (getLock());
  1643. const ScopedLockType lock2 (otherArray.getLock());
  1644. data.swapWith (otherArray.data);
  1645. swapVariables (numUsed, otherArray.numUsed);
  1646. }
  1647. template <class OtherArrayType>
  1648. void addArray (const OtherArrayType& arrayToAddFrom,
  1649. int startIndex = 0,
  1650. int numElementsToAdd = -1)
  1651. {
  1652. const typename OtherArrayType::ScopedLockType lock1 (arrayToAddFrom.getLock());
  1653. const ScopedLockType lock2 (getLock());
  1654. if (startIndex < 0)
  1655. {
  1656. jassertfalse
  1657. startIndex = 0;
  1658. }
  1659. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1660. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1661. while (--numElementsToAdd >= 0)
  1662. add (arrayToAddFrom.getUnchecked (startIndex++));
  1663. }
  1664. template <class ElementComparator>
  1665. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1666. {
  1667. const ScopedLockType lock (getLock());
  1668. insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
  1669. }
  1670. template <class ElementComparator>
  1671. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1672. {
  1673. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1674. // avoids getting warning messages about the parameter being unused
  1675. const ScopedLockType lock (getLock());
  1676. int start = 0;
  1677. int end = numUsed;
  1678. for (;;)
  1679. {
  1680. if (start >= end)
  1681. {
  1682. return -1;
  1683. }
  1684. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1685. {
  1686. return start;
  1687. }
  1688. else
  1689. {
  1690. const int halfway = (start + end) >> 1;
  1691. if (halfway == start)
  1692. return -1;
  1693. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1694. start = halfway;
  1695. else
  1696. end = halfway;
  1697. }
  1698. }
  1699. }
  1700. ElementType remove (const int indexToRemove)
  1701. {
  1702. const ScopedLockType lock (getLock());
  1703. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1704. {
  1705. --numUsed;
  1706. ElementType* const e = data.elements + indexToRemove;
  1707. ElementType removed (*e);
  1708. e->~ElementType();
  1709. const int numberToShift = numUsed - indexToRemove;
  1710. if (numberToShift > 0)
  1711. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1712. if ((numUsed << 1) < data.numAllocated)
  1713. minimiseStorageOverheads();
  1714. return removed;
  1715. }
  1716. else
  1717. {
  1718. return ElementType();
  1719. }
  1720. }
  1721. void removeValue (const ElementType& valueToRemove)
  1722. {
  1723. const ScopedLockType lock (getLock());
  1724. ElementType* e = data.elements;
  1725. for (int i = numUsed; --i >= 0;)
  1726. {
  1727. if (valueToRemove == *e)
  1728. {
  1729. remove ((int) (e - data.elements));
  1730. break;
  1731. }
  1732. ++e;
  1733. }
  1734. }
  1735. void removeRange (int startIndex, int numberToRemove)
  1736. {
  1737. const ScopedLockType lock (getLock());
  1738. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1739. startIndex = jlimit (0, numUsed, startIndex);
  1740. if (endIndex > startIndex)
  1741. {
  1742. ElementType* e = data.elements + startIndex;
  1743. numberToRemove = endIndex - startIndex;
  1744. for (int i = 0; i < numberToRemove; ++i)
  1745. e[i].~ElementType();
  1746. const int numToShift = numUsed - endIndex;
  1747. if (numToShift > 0)
  1748. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1749. numUsed -= numberToRemove;
  1750. if ((numUsed << 1) < data.numAllocated)
  1751. minimiseStorageOverheads();
  1752. }
  1753. }
  1754. void removeLast (int howManyToRemove = 1)
  1755. {
  1756. const ScopedLockType lock (getLock());
  1757. if (howManyToRemove > numUsed)
  1758. howManyToRemove = numUsed;
  1759. for (int i = 0; i < howManyToRemove; ++i)
  1760. data.elements [numUsed - i].~ElementType();
  1761. numUsed -= howManyToRemove;
  1762. if ((numUsed << 1) < data.numAllocated)
  1763. minimiseStorageOverheads();
  1764. }
  1765. template <class OtherArrayType>
  1766. void removeValuesIn (const OtherArrayType& otherArray)
  1767. {
  1768. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1769. const ScopedLockType lock2 (getLock());
  1770. if (this == &otherArray)
  1771. {
  1772. clear();
  1773. }
  1774. else
  1775. {
  1776. if (otherArray.size() > 0)
  1777. {
  1778. for (int i = numUsed; --i >= 0;)
  1779. if (otherArray.contains (data.elements [i]))
  1780. remove (i);
  1781. }
  1782. }
  1783. }
  1784. template <class OtherArrayType>
  1785. void removeValuesNotIn (const OtherArrayType& otherArray)
  1786. {
  1787. const typename OtherArrayType::ScopedLockType lock1 (otherArray.getLock());
  1788. const ScopedLockType lock2 (getLock());
  1789. if (this != &otherArray)
  1790. {
  1791. if (otherArray.size() <= 0)
  1792. {
  1793. clear();
  1794. }
  1795. else
  1796. {
  1797. for (int i = numUsed; --i >= 0;)
  1798. if (! otherArray.contains (data.elements [i]))
  1799. remove (i);
  1800. }
  1801. }
  1802. }
  1803. void swap (const int index1,
  1804. const int index2)
  1805. {
  1806. const ScopedLockType lock (getLock());
  1807. if (((unsigned int) index1) < (unsigned int) numUsed
  1808. && ((unsigned int) index2) < (unsigned int) numUsed)
  1809. {
  1810. swapVariables (data.elements [index1],
  1811. data.elements [index2]);
  1812. }
  1813. }
  1814. void move (const int currentIndex, int newIndex) throw()
  1815. {
  1816. if (currentIndex != newIndex)
  1817. {
  1818. const ScopedLockType lock (getLock());
  1819. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1820. {
  1821. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1822. newIndex = numUsed - 1;
  1823. char tempCopy [sizeof (ElementType)];
  1824. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1825. if (newIndex > currentIndex)
  1826. {
  1827. memmove (data.elements + currentIndex,
  1828. data.elements + currentIndex + 1,
  1829. (newIndex - currentIndex) * sizeof (ElementType));
  1830. }
  1831. else
  1832. {
  1833. memmove (data.elements + newIndex + 1,
  1834. data.elements + newIndex,
  1835. (currentIndex - newIndex) * sizeof (ElementType));
  1836. }
  1837. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1838. }
  1839. }
  1840. }
  1841. void minimiseStorageOverheads()
  1842. {
  1843. const ScopedLockType lock (getLock());
  1844. data.shrinkToNoMoreThan (numUsed);
  1845. }
  1846. void ensureStorageAllocated (const int minNumElements)
  1847. {
  1848. const ScopedLockType lock (getLock());
  1849. data.ensureAllocatedSize (minNumElements);
  1850. }
  1851. template <class ElementComparator>
  1852. void sort (ElementComparator& comparator,
  1853. const bool retainOrderOfEquivalentItems = false) const
  1854. {
  1855. const ScopedLockType lock (getLock());
  1856. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1857. // avoids getting warning messages about the parameter being unused
  1858. sortArray (comparator, (ElementType*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  1859. }
  1860. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  1861. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  1862. juce_UseDebuggingNewOperator
  1863. private:
  1864. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1865. int numUsed;
  1866. };
  1867. #endif // __JUCE_ARRAY_JUCEHEADER__
  1868. /*** End of inlined file: juce_Array.h ***/
  1869. #endif
  1870. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1871. #endif
  1872. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1873. /*** Start of inlined file: juce_BitArray.h ***/
  1874. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1875. #define __JUCE_BITARRAY_JUCEHEADER__
  1876. class MemoryBlock;
  1877. class JUCE_API BitArray
  1878. {
  1879. public:
  1880. BitArray() throw();
  1881. BitArray (const unsigned int value) throw();
  1882. BitArray (const int value) throw();
  1883. BitArray (int64 value) throw();
  1884. BitArray (const BitArray& other) throw();
  1885. ~BitArray() throw();
  1886. BitArray& operator= (const BitArray& other) throw();
  1887. bool operator== (const BitArray& other) const throw();
  1888. bool operator!= (const BitArray& other) const throw();
  1889. void clear() throw();
  1890. void clearBit (const int bitNumber) throw();
  1891. void setBit (const int bitNumber) throw();
  1892. void setBit (const int bitNumber,
  1893. const bool shouldBeSet) throw();
  1894. void setRange (int startBit,
  1895. int numBits,
  1896. const bool shouldBeSet) throw();
  1897. void insertBit (const int bitNumber,
  1898. const bool shouldBeSet) throw();
  1899. bool operator[] (const int bit) const throw();
  1900. bool isEmpty() const throw();
  1901. const BitArray getBitRange (int startBit, int numBits) const throw();
  1902. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1903. void setBitRangeAsInt (int startBit, int numBits,
  1904. unsigned int valueToSet) throw();
  1905. void orWith (const BitArray& other) throw();
  1906. void andWith (const BitArray& other) throw();
  1907. void xorWith (const BitArray& other) throw();
  1908. void add (const BitArray& other) throw();
  1909. void subtract (const BitArray& other) throw();
  1910. void multiplyBy (const BitArray& other) throw();
  1911. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1912. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1913. void modulo (const BitArray& divisor) throw();
  1914. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1915. void inverseModulo (const BitArray& modulus) throw();
  1916. void shiftBits (int howManyBitsLeft,
  1917. int startBit = 0) throw();
  1918. int compare (const BitArray& other) const throw();
  1919. int compareAbsolute (const BitArray& other) const throw();
  1920. bool isNegative() const throw();
  1921. void setNegative (const bool shouldBeNegative) throw();
  1922. void negate() throw();
  1923. int countNumberOfSetBits() const throw();
  1924. int findNextSetBit (int startIndex = 0) const throw();
  1925. int findNextClearBit (int startIndex = 0) const throw();
  1926. int getHighestBit() const throw();
  1927. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1928. void parseString (const String& text,
  1929. const int base) throw();
  1930. const MemoryBlock toMemoryBlock() const throw();
  1931. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1932. juce_UseDebuggingNewOperator
  1933. private:
  1934. void ensureSize (const int numVals) throw();
  1935. HeapBlock <unsigned int> values;
  1936. int numValues, highestBit;
  1937. bool negative;
  1938. };
  1939. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1940. /*** End of inlined file: juce_BitArray.h ***/
  1941. #endif
  1942. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1943. /*** Start of inlined file: juce_DynamicObject.h ***/
  1944. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1945. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1946. /*** Start of inlined file: juce_NamedValueSet.h ***/
  1947. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1948. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1949. /*** Start of inlined file: juce_Variant.h ***/
  1950. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1951. #define __JUCE_VARIANT_JUCEHEADER__
  1952. /*** Start of inlined file: juce_OutputStream.h ***/
  1953. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1954. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1955. /*** Start of inlined file: juce_InputStream.h ***/
  1956. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  1957. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  1958. /*** Start of inlined file: juce_MemoryBlock.h ***/
  1959. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1960. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1961. class JUCE_API MemoryBlock
  1962. {
  1963. public:
  1964. MemoryBlock() throw();
  1965. MemoryBlock (const size_t initialSize,
  1966. const bool initialiseToZero = false) throw();
  1967. MemoryBlock (const MemoryBlock& other) throw();
  1968. MemoryBlock (const void* const dataToInitialiseFrom,
  1969. const size_t sizeInBytes) throw();
  1970. ~MemoryBlock() throw();
  1971. MemoryBlock& operator= (const MemoryBlock& other) throw();
  1972. bool operator== (const MemoryBlock& other) const throw();
  1973. bool operator!= (const MemoryBlock& other) const throw();
  1974. bool matches (const void* data, size_t dataSize) const throw();
  1975. void* getData() const throw() { return data; }
  1976. template <typename Type>
  1977. char& operator[] (const Type offset) const throw() { return data [offset]; }
  1978. size_t getSize() const throw() { return size; }
  1979. void setSize (const size_t newSize,
  1980. const bool initialiseNewSpaceToZero = false) throw();
  1981. void ensureSize (const size_t minimumSize,
  1982. const bool initialiseNewSpaceToZero = false) throw();
  1983. void fillWith (const uint8 valueToUse) throw();
  1984. void append (const void* const data,
  1985. const size_t numBytes) throw();
  1986. void swapWith (MemoryBlock& other) throw();
  1987. void copyFrom (const void* srcData,
  1988. int destinationOffset,
  1989. size_t numBytes) throw();
  1990. void copyTo (void* destData,
  1991. int sourceOffset,
  1992. size_t numBytes) const throw();
  1993. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  1994. const String toString() const throw();
  1995. void loadFromHexString (const String& sourceHexString) throw();
  1996. void setBitRange (size_t bitRangeStart,
  1997. size_t numBits,
  1998. int binaryNumberToApply) throw();
  1999. int getBitRange (size_t bitRangeStart,
  2000. size_t numBitsToRead) const throw();
  2001. const String toBase64Encoding() const throw();
  2002. bool fromBase64Encoding (const String& encodedString) throw();
  2003. juce_UseDebuggingNewOperator
  2004. private:
  2005. HeapBlock <char> data;
  2006. size_t size;
  2007. };
  2008. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2009. /*** End of inlined file: juce_MemoryBlock.h ***/
  2010. class JUCE_API InputStream
  2011. {
  2012. public:
  2013. virtual ~InputStream() {}
  2014. virtual int64 getTotalLength() = 0;
  2015. virtual bool isExhausted() = 0;
  2016. virtual int read (void* destBuffer,
  2017. int maxBytesToRead) = 0;
  2018. virtual char readByte();
  2019. virtual bool readBool();
  2020. virtual short readShort();
  2021. virtual short readShortBigEndian();
  2022. virtual int readInt();
  2023. virtual int readIntBigEndian();
  2024. virtual int64 readInt64();
  2025. virtual int64 readInt64BigEndian();
  2026. virtual float readFloat();
  2027. virtual float readFloatBigEndian();
  2028. virtual double readDouble();
  2029. virtual double readDoubleBigEndian();
  2030. virtual int readCompressedInt();
  2031. virtual const String readNextLine();
  2032. virtual const String readString();
  2033. virtual const String readEntireStreamAsString();
  2034. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2035. int maxNumBytesToRead = -1);
  2036. virtual int64 getPosition() = 0;
  2037. virtual bool setPosition (int64 newPosition) = 0;
  2038. virtual void skipNextBytes (int64 numBytesToSkip);
  2039. juce_UseDebuggingNewOperator
  2040. protected:
  2041. InputStream() throw() {}
  2042. };
  2043. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2044. /*** End of inlined file: juce_InputStream.h ***/
  2045. class JUCE_API OutputStream
  2046. {
  2047. protected:
  2048. OutputStream();
  2049. public:
  2050. virtual ~OutputStream();
  2051. virtual void flush() = 0;
  2052. virtual bool setPosition (int64 newPosition) = 0;
  2053. virtual int64 getPosition() = 0;
  2054. virtual bool write (const void* dataToWrite,
  2055. int howManyBytes) = 0;
  2056. virtual void writeByte (char byte);
  2057. virtual void writeBool (bool boolValue);
  2058. virtual void writeShort (short value);
  2059. virtual void writeShortBigEndian (short value);
  2060. virtual void writeInt (int value);
  2061. virtual void writeIntBigEndian (int value);
  2062. virtual void writeInt64 (int64 value);
  2063. virtual void writeInt64BigEndian (int64 value);
  2064. virtual void writeFloat (float value);
  2065. virtual void writeFloatBigEndian (float value);
  2066. virtual void writeDouble (double value);
  2067. virtual void writeDoubleBigEndian (double value);
  2068. virtual void writeCompressedInt (int value);
  2069. virtual void writeString (const String& text);
  2070. virtual void writeText (const String& text,
  2071. const bool asUnicode,
  2072. const bool writeUnicodeHeaderBytes);
  2073. virtual int writeFromInputStream (InputStream& source, int maxNumBytesToWrite);
  2074. juce_UseDebuggingNewOperator
  2075. };
  2076. OutputStream& operator<< (OutputStream& stream, const int number);
  2077. OutputStream& operator<< (OutputStream& stream, const double number);
  2078. OutputStream& operator<< (OutputStream& stream, const char character);
  2079. OutputStream& operator<< (OutputStream& stream, const char* const text);
  2080. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2081. /*** End of inlined file: juce_OutputStream.h ***/
  2082. class JUCE_API DynamicObject;
  2083. class JUCE_API var
  2084. {
  2085. public:
  2086. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2087. var() throw();
  2088. ~var() throw();
  2089. static const var null;
  2090. var (const var& valueToCopy);
  2091. var (const int value) throw();
  2092. var (const bool value) throw();
  2093. var (const double value) throw();
  2094. var (const char* const value);
  2095. var (const juce_wchar* const value);
  2096. var (const String& value);
  2097. var (DynamicObject* const object);
  2098. var (MethodFunction method) throw();
  2099. var& operator= (const var& valueToCopy);
  2100. var& operator= (int value);
  2101. var& operator= (bool value);
  2102. var& operator= (double value);
  2103. var& operator= (const char* value);
  2104. var& operator= (const juce_wchar* value);
  2105. var& operator= (const String& value);
  2106. var& operator= (DynamicObject* object);
  2107. var& operator= (MethodFunction method);
  2108. void swapWith (var& other) throw();
  2109. operator int() const;
  2110. operator bool() const;
  2111. operator float() const;
  2112. operator double() const;
  2113. operator const String() const;
  2114. const String toString() const;
  2115. DynamicObject* getObject() const;
  2116. bool isVoid() const throw() { return type == voidType; }
  2117. bool isInt() const throw() { return type == intType; }
  2118. bool isBool() const throw() { return type == boolType; }
  2119. bool isDouble() const throw() { return type == doubleType; }
  2120. bool isString() const throw() { return type == stringType; }
  2121. bool isObject() const throw() { return type == objectType; }
  2122. bool isMethod() const throw() { return type == methodType; }
  2123. void writeToStream (OutputStream& output) const;
  2124. static const var readFromStream (InputStream& input);
  2125. class JUCE_API identifier
  2126. {
  2127. public:
  2128. identifier() throw();
  2129. identifier (const char* const name);
  2130. identifier (const String& name);
  2131. ~identifier();
  2132. bool operator== (const identifier& other) const throw()
  2133. {
  2134. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2135. return hashCode == other.hashCode;
  2136. }
  2137. String name;
  2138. int hashCode;
  2139. };
  2140. const var operator[] (const identifier& propertyName) const;
  2141. const var call (const identifier& method) const;
  2142. const var call (const identifier& method, const var& arg1) const;
  2143. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2144. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2145. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2146. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2147. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2148. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2149. juce_UseDebuggingNewOperator
  2150. bool equals (const var& other) const throw();
  2151. private:
  2152. enum Type
  2153. {
  2154. voidType = 0,
  2155. intType,
  2156. boolType,
  2157. doubleType,
  2158. stringType,
  2159. objectType,
  2160. methodType
  2161. };
  2162. union ValueUnion
  2163. {
  2164. int intValue;
  2165. bool boolValue;
  2166. double doubleValue;
  2167. String* stringValue;
  2168. DynamicObject* objectValue;
  2169. MethodFunction methodValue;
  2170. };
  2171. Type type;
  2172. ValueUnion value;
  2173. };
  2174. bool operator== (const var& v1, const var& v2) throw();
  2175. bool operator!= (const var& v1, const var& v2) throw();
  2176. bool operator== (const var& v1, const String& v2) throw();
  2177. bool operator!= (const var& v1, const String& v2) throw();
  2178. #endif // __JUCE_VARIANT_JUCEHEADER__
  2179. /*** End of inlined file: juce_Variant.h ***/
  2180. class JUCE_API NamedValueSet
  2181. {
  2182. public:
  2183. NamedValueSet() throw();
  2184. NamedValueSet (const NamedValueSet& other);
  2185. NamedValueSet& operator= (const NamedValueSet& other);
  2186. ~NamedValueSet();
  2187. int size() const throw();
  2188. const var& operator[] (const var::identifier& name) const;
  2189. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2190. var* getItem (const var::identifier& name) const;
  2191. bool set (const var::identifier& name, const var& newValue);
  2192. bool contains (const var::identifier& name) const;
  2193. bool remove (const var::identifier& name);
  2194. const var::identifier getName (int index) const;
  2195. void clear();
  2196. juce_UseDebuggingNewOperator
  2197. private:
  2198. struct NamedValue
  2199. {
  2200. NamedValue() throw();
  2201. NamedValue (const var::identifier& name, const var& value);
  2202. var::identifier name;
  2203. var value;
  2204. };
  2205. Array <NamedValue> values;
  2206. };
  2207. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2208. /*** End of inlined file: juce_NamedValueSet.h ***/
  2209. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2210. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2211. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2212. /*** Start of inlined file: juce_Atomic.h ***/
  2213. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2214. #define __JUCE_ATOMIC_JUCEHEADER__
  2215. class JUCE_API Atomic
  2216. {
  2217. public:
  2218. static void increment (int32& variable);
  2219. static int32 incrementAndReturn (int32& variable);
  2220. static void decrement (int32& variable);
  2221. static int32 decrementAndReturn (int32& variable);
  2222. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2223. static void* swapPointers (void* volatile* value1, void* value2);
  2224. };
  2225. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2226. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2227. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2228. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2229. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2230. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2231. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2232. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2233. {
  2234. void* currentVal = *value1;
  2235. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 && ! JUCE_64BIT
  2236. while (! OSAtomicCompareAndSwap32 ((int32_t) currentVal, (int32_t) value2, (int32_t*) value1)) { currentVal = *value1; }
  2237. #else
  2238. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2239. #endif
  2240. return currentVal;
  2241. }
  2242. #elif JUCE_LINUX // Linux...
  2243. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2244. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2245. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2246. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2247. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2248. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2249. inline void* Atomic::swapPointers (void* volatile* value1, void* value2)
  2250. {
  2251. void* currentVal = *value1;
  2252. while (! __sync_bool_compare_and_swap (value1, currentVal, value2)) { currentVal = *value1; }
  2253. return currentVal;
  2254. }
  2255. #elif JUCE_USE_INTRINSICS // Windows...
  2256. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2257. // declared in juce_win32_Threads.cpp)
  2258. #pragma intrinsic (_InterlockedIncrement)
  2259. #pragma intrinsic (_InterlockedDecrement)
  2260. #pragma intrinsic (_InterlockedCompareExchange)
  2261. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2262. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2263. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2264. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2265. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2266. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2267. #endif
  2268. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2269. /*** End of inlined file: juce_Atomic.h ***/
  2270. class JUCE_API ReferenceCountedObject
  2271. {
  2272. public:
  2273. inline void incReferenceCount() throw()
  2274. {
  2275. Atomic::increment (refCounts);
  2276. jassert (refCounts > 0);
  2277. }
  2278. inline void decReferenceCount() throw()
  2279. {
  2280. jassert (refCounts > 0);
  2281. if (Atomic::decrementAndReturn (refCounts) == 0)
  2282. delete this;
  2283. }
  2284. inline int getReferenceCount() const throw()
  2285. {
  2286. return refCounts;
  2287. }
  2288. protected:
  2289. ReferenceCountedObject()
  2290. : refCounts (0)
  2291. {
  2292. }
  2293. virtual ~ReferenceCountedObject()
  2294. {
  2295. // it's dangerous to delete an object that's still referenced by something else!
  2296. jassert (refCounts == 0);
  2297. }
  2298. private:
  2299. int refCounts;
  2300. };
  2301. template <class ReferenceCountedObjectClass>
  2302. class ReferenceCountedObjectPtr
  2303. {
  2304. public:
  2305. inline ReferenceCountedObjectPtr() throw()
  2306. : referencedObject (0)
  2307. {
  2308. }
  2309. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2310. : referencedObject (refCountedObject)
  2311. {
  2312. if (refCountedObject != 0)
  2313. refCountedObject->incReferenceCount();
  2314. }
  2315. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2316. : referencedObject (other.referencedObject)
  2317. {
  2318. if (referencedObject != 0)
  2319. referencedObject->incReferenceCount();
  2320. }
  2321. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2322. {
  2323. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2324. if (newObject != referencedObject)
  2325. {
  2326. if (newObject != 0)
  2327. newObject->incReferenceCount();
  2328. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2329. referencedObject = newObject;
  2330. if (oldObject != 0)
  2331. oldObject->decReferenceCount();
  2332. }
  2333. return *this;
  2334. }
  2335. ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2336. {
  2337. if (referencedObject != newObject)
  2338. {
  2339. if (newObject != 0)
  2340. newObject->incReferenceCount();
  2341. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2342. referencedObject = newObject;
  2343. if (oldObject != 0)
  2344. oldObject->decReferenceCount();
  2345. }
  2346. return *this;
  2347. }
  2348. inline ~ReferenceCountedObjectPtr()
  2349. {
  2350. if (referencedObject != 0)
  2351. referencedObject->decReferenceCount();
  2352. }
  2353. inline operator ReferenceCountedObjectClass*() const throw()
  2354. {
  2355. return referencedObject;
  2356. }
  2357. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2358. {
  2359. return referencedObject == object;
  2360. }
  2361. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2362. {
  2363. return referencedObject != object;
  2364. }
  2365. // the -> operator is called on the referenced object
  2366. inline ReferenceCountedObjectClass* operator->() const throw()
  2367. {
  2368. return referencedObject;
  2369. }
  2370. private:
  2371. ReferenceCountedObjectClass* referencedObject;
  2372. };
  2373. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2374. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2375. class JUCE_API DynamicObject : public ReferenceCountedObject
  2376. {
  2377. public:
  2378. DynamicObject();
  2379. virtual ~DynamicObject();
  2380. virtual bool hasProperty (const var::identifier& propertyName) const;
  2381. virtual const var getProperty (const var::identifier& propertyName) const;
  2382. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2383. virtual void removeProperty (const var::identifier& propertyName);
  2384. virtual bool hasMethod (const var::identifier& methodName) const;
  2385. virtual const var invokeMethod (const var::identifier& methodName,
  2386. const var* parameters,
  2387. int numParameters);
  2388. void setMethod (const var::identifier& methodName,
  2389. var::MethodFunction methodFunction);
  2390. void clear();
  2391. juce_UseDebuggingNewOperator
  2392. private:
  2393. NamedValueSet properties;
  2394. };
  2395. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2396. /*** End of inlined file: juce_DynamicObject.h ***/
  2397. #endif
  2398. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2399. #endif
  2400. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2401. #endif
  2402. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2403. #endif
  2404. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2405. #endif
  2406. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2407. /*** Start of inlined file: juce_OwnedArray.h ***/
  2408. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2409. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2410. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2411. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2412. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2413. template <class ObjectType>
  2414. class JUCE_API ScopedPointer
  2415. {
  2416. public:
  2417. inline ScopedPointer() throw() : object (0)
  2418. {
  2419. }
  2420. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2421. : object (objectToTakePossessionOf)
  2422. {
  2423. }
  2424. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2425. : object (objectToTransferFrom.object)
  2426. {
  2427. objectToTransferFrom.object = 0;
  2428. }
  2429. inline ~ScopedPointer() { delete object; }
  2430. ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2431. {
  2432. if (this != objectToTransferFrom.getAddress())
  2433. {
  2434. // Two ScopedPointers should never be able to refer to the same object - if
  2435. // this happens, you must have done something dodgy!
  2436. jassert (object == 0 || object != objectToTransferFrom.object);
  2437. ObjectType* const oldObject = object;
  2438. object = objectToTransferFrom.object;
  2439. objectToTransferFrom.object = 0;
  2440. delete oldObject;
  2441. }
  2442. return *this;
  2443. }
  2444. ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2445. {
  2446. if (object != newObjectToTakePossessionOf)
  2447. {
  2448. ObjectType* const oldObject = object;
  2449. object = newObjectToTakePossessionOf;
  2450. delete oldObject;
  2451. }
  2452. return *this;
  2453. }
  2454. inline operator ObjectType*() const throw() { return object; }
  2455. inline ObjectType& operator*() const throw() { return *object; }
  2456. inline ObjectType* operator->() const throw() { return object; }
  2457. inline ObjectType* const* operator&() const throw() { return static_cast <ObjectType* const*> (&object); }
  2458. inline ObjectType** operator&() throw() { return static_cast <ObjectType**> (&object); }
  2459. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2460. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2461. {
  2462. // Two ScopedPointers should never be able to refer to the same object - if
  2463. // this happens, you must have done something dodgy!
  2464. jassert (object != other.object);
  2465. swapVariables (object, other.object);
  2466. }
  2467. private:
  2468. ObjectType* object;
  2469. // (Required as an alternative to the overloaded & operator).
  2470. const ScopedPointer* getAddress() const throw() { return this; }
  2471. };
  2472. template <class ObjectType>
  2473. inline bool operator== (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2474. {
  2475. return static_cast <ObjectType*> (pointer1) == pointer2;
  2476. }
  2477. template <class ObjectType>
  2478. inline bool operator!= (const ScopedPointer<ObjectType>& pointer1, const ObjectType* const pointer2) throw()
  2479. {
  2480. return static_cast <ObjectType*> (pointer1) != pointer2;
  2481. }
  2482. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2483. /*** End of inlined file: juce_ScopedPointer.h ***/
  2484. template <class ObjectClass,
  2485. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2486. class OwnedArray
  2487. {
  2488. public:
  2489. OwnedArray() throw()
  2490. : numUsed (0)
  2491. {
  2492. }
  2493. ~OwnedArray()
  2494. {
  2495. clear (true);
  2496. }
  2497. void clear (const bool deleteObjects = true)
  2498. {
  2499. const ScopedLockType lock (getLock());
  2500. if (deleteObjects)
  2501. {
  2502. while (numUsed > 0)
  2503. delete data.elements [--numUsed];
  2504. }
  2505. data.setAllocatedSize (0);
  2506. numUsed = 0;
  2507. }
  2508. inline int size() const throw()
  2509. {
  2510. return numUsed;
  2511. }
  2512. inline ObjectClass* operator[] (const int index) const throw()
  2513. {
  2514. const ScopedLockType lock (getLock());
  2515. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  2516. : static_cast <ObjectClass*> (0);
  2517. }
  2518. inline ObjectClass* getUnchecked (const int index) const throw()
  2519. {
  2520. const ScopedLockType lock (getLock());
  2521. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2522. return data.elements [index];
  2523. }
  2524. inline ObjectClass* getFirst() const throw()
  2525. {
  2526. const ScopedLockType lock (getLock());
  2527. return numUsed > 0 ? data.elements [0]
  2528. : static_cast <ObjectClass*> (0);
  2529. }
  2530. inline ObjectClass* getLast() const throw()
  2531. {
  2532. const ScopedLockType lock (getLock());
  2533. return numUsed > 0 ? data.elements [numUsed - 1]
  2534. : static_cast <ObjectClass*> (0);
  2535. }
  2536. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2537. {
  2538. const ScopedLockType lock (getLock());
  2539. ObjectClass* const* e = data.elements;
  2540. ObjectClass* const* const end = e + numUsed;
  2541. while (e != end)
  2542. {
  2543. if (objectToLookFor == *e)
  2544. return (int) (e - data.elements);
  2545. ++e;
  2546. }
  2547. return -1;
  2548. }
  2549. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2550. {
  2551. const ScopedLockType lock (getLock());
  2552. ObjectClass* const* e = data.elements;
  2553. ObjectClass* const* const end = e + numUsed;
  2554. while (e != end)
  2555. {
  2556. if (objectToLookFor == *e)
  2557. return true;
  2558. ++e;
  2559. }
  2560. return false;
  2561. }
  2562. void add (const ObjectClass* const newObject) throw()
  2563. {
  2564. const ScopedLockType lock (getLock());
  2565. data.ensureAllocatedSize (numUsed + 1);
  2566. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2567. }
  2568. void insert (int indexToInsertAt,
  2569. const ObjectClass* const newObject) throw()
  2570. {
  2571. if (indexToInsertAt >= 0)
  2572. {
  2573. const ScopedLockType lock (getLock());
  2574. if (indexToInsertAt > numUsed)
  2575. indexToInsertAt = numUsed;
  2576. data.ensureAllocatedSize (numUsed + 1);
  2577. ObjectClass** const e = data.elements + indexToInsertAt;
  2578. const int numToMove = numUsed - indexToInsertAt;
  2579. if (numToMove > 0)
  2580. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2581. *e = const_cast <ObjectClass*> (newObject);
  2582. ++numUsed;
  2583. }
  2584. else
  2585. {
  2586. add (newObject);
  2587. }
  2588. }
  2589. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2590. {
  2591. const ScopedLockType lock (getLock());
  2592. if (! contains (newObject))
  2593. add (newObject);
  2594. }
  2595. void set (const int indexToChange,
  2596. const ObjectClass* const newObject,
  2597. const bool deleteOldElement = true)
  2598. {
  2599. if (indexToChange >= 0)
  2600. {
  2601. ScopedPointer <ObjectClass> toDelete;
  2602. const ScopedLockType lock (getLock());
  2603. if (indexToChange < numUsed)
  2604. {
  2605. if (deleteOldElement)
  2606. {
  2607. toDelete = data.elements [indexToChange];
  2608. if (toDelete == newObject)
  2609. toDelete = 0;
  2610. }
  2611. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2612. }
  2613. else
  2614. {
  2615. data.ensureAllocatedSize (numUsed + 1);
  2616. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2617. }
  2618. }
  2619. }
  2620. template <class ElementComparator>
  2621. void addSorted (ElementComparator& comparator,
  2622. ObjectClass* const newObject) throw()
  2623. {
  2624. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2625. // avoids getting warning messages about the parameter being unused
  2626. const ScopedLockType lock (getLock());
  2627. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  2628. }
  2629. template <class ElementComparator>
  2630. int indexOfSorted (ElementComparator& comparator,
  2631. const ObjectClass* const objectToLookFor) const throw()
  2632. {
  2633. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2634. // avoids getting warning messages about the parameter being unused
  2635. const ScopedLockType lock (getLock());
  2636. int start = 0;
  2637. int end = numUsed;
  2638. for (;;)
  2639. {
  2640. if (start >= end)
  2641. {
  2642. return -1;
  2643. }
  2644. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2645. {
  2646. return start;
  2647. }
  2648. else
  2649. {
  2650. const int halfway = (start + end) >> 1;
  2651. if (halfway == start)
  2652. return -1;
  2653. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2654. start = halfway;
  2655. else
  2656. end = halfway;
  2657. }
  2658. }
  2659. }
  2660. void remove (const int indexToRemove,
  2661. const bool deleteObject = true)
  2662. {
  2663. ScopedPointer <ObjectClass> toDelete;
  2664. const ScopedLockType lock (getLock());
  2665. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2666. {
  2667. ObjectClass** const e = data.elements + indexToRemove;
  2668. if (deleteObject)
  2669. toDelete = *e;
  2670. --numUsed;
  2671. const int numToShift = numUsed - indexToRemove;
  2672. if (numToShift > 0)
  2673. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2674. if ((numUsed << 1) < data.numAllocated)
  2675. minimiseStorageOverheads();
  2676. }
  2677. }
  2678. void removeObject (const ObjectClass* const objectToRemove,
  2679. const bool deleteObject = true)
  2680. {
  2681. const ScopedLockType lock (getLock());
  2682. ObjectClass** e = data.elements;
  2683. for (int i = numUsed; --i >= 0;)
  2684. {
  2685. if (objectToRemove == *e)
  2686. {
  2687. remove ((int) (e - data.elements), deleteObject);
  2688. break;
  2689. }
  2690. ++e;
  2691. }
  2692. }
  2693. void removeRange (int startIndex,
  2694. const int numberToRemove,
  2695. const bool deleteObjects = true)
  2696. {
  2697. const ScopedLockType lock (getLock());
  2698. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2699. startIndex = jlimit (0, numUsed, startIndex);
  2700. if (endIndex > startIndex)
  2701. {
  2702. if (deleteObjects)
  2703. {
  2704. for (int i = startIndex; i < endIndex; ++i)
  2705. {
  2706. delete data.elements [i];
  2707. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2708. }
  2709. }
  2710. const int rangeSize = endIndex - startIndex;
  2711. ObjectClass** e = data.elements + startIndex;
  2712. int numToShift = numUsed - endIndex;
  2713. numUsed -= rangeSize;
  2714. while (--numToShift >= 0)
  2715. {
  2716. *e = e [rangeSize];
  2717. ++e;
  2718. }
  2719. if ((numUsed << 1) < data.numAllocated)
  2720. minimiseStorageOverheads();
  2721. }
  2722. }
  2723. void removeLast (int howManyToRemove = 1,
  2724. const bool deleteObjects = true)
  2725. {
  2726. const ScopedLockType lock (getLock());
  2727. if (howManyToRemove >= numUsed)
  2728. {
  2729. clear (deleteObjects);
  2730. }
  2731. else
  2732. {
  2733. while (--howManyToRemove >= 0)
  2734. remove (numUsed - 1, deleteObjects);
  2735. }
  2736. }
  2737. void swap (const int index1,
  2738. const int index2) throw()
  2739. {
  2740. const ScopedLockType lock (getLock());
  2741. if (((unsigned int) index1) < (unsigned int) numUsed
  2742. && ((unsigned int) index2) < (unsigned int) numUsed)
  2743. {
  2744. swapVariables (data.elements [index1],
  2745. data.elements [index2]);
  2746. }
  2747. }
  2748. void move (const int currentIndex,
  2749. int newIndex) throw()
  2750. {
  2751. if (currentIndex != newIndex)
  2752. {
  2753. const ScopedLockType lock (getLock());
  2754. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2755. {
  2756. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2757. newIndex = numUsed - 1;
  2758. ObjectClass* const value = data.elements [currentIndex];
  2759. if (newIndex > currentIndex)
  2760. {
  2761. memmove (data.elements + currentIndex,
  2762. data.elements + currentIndex + 1,
  2763. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2764. }
  2765. else
  2766. {
  2767. memmove (data.elements + newIndex + 1,
  2768. data.elements + newIndex,
  2769. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2770. }
  2771. data.elements [newIndex] = value;
  2772. }
  2773. }
  2774. }
  2775. void swapWithArray (OwnedArray& otherArray) throw()
  2776. {
  2777. const ScopedLockType lock1 (getLock());
  2778. const ScopedLockType lock2 (otherArray.getLock());
  2779. data.swapWith (otherArray.data);
  2780. swapVariables (numUsed, otherArray.numUsed);
  2781. }
  2782. void minimiseStorageOverheads() throw()
  2783. {
  2784. const ScopedLockType lock (getLock());
  2785. data.shrinkToNoMoreThan (numUsed);
  2786. }
  2787. void ensureStorageAllocated (const int minNumElements) throw()
  2788. {
  2789. const ScopedLockType lock (getLock());
  2790. data.ensureAllocatedSize (minNumElements);
  2791. }
  2792. template <class ElementComparator>
  2793. void sort (ElementComparator& comparator,
  2794. const bool retainOrderOfEquivalentItems = false) const throw()
  2795. {
  2796. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2797. // avoids getting warning messages about the parameter being unused
  2798. const ScopedLockType lock (getLock());
  2799. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  2800. }
  2801. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  2802. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  2803. juce_UseDebuggingNewOperator
  2804. private:
  2805. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2806. int numUsed;
  2807. // disallow copy constructor and assignment
  2808. OwnedArray (const OwnedArray&);
  2809. OwnedArray& operator= (const OwnedArray&);
  2810. };
  2811. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2812. /*** End of inlined file: juce_OwnedArray.h ***/
  2813. #endif
  2814. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2815. /*** Start of inlined file: juce_PropertySet.h ***/
  2816. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2817. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2818. /*** Start of inlined file: juce_StringPairArray.h ***/
  2819. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2820. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2821. /*** Start of inlined file: juce_StringArray.h ***/
  2822. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2823. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2824. #ifndef DOXYGEN
  2825. // (used in StringArray::appendNumbersToDuplicates)
  2826. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2827. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2828. #endif
  2829. class JUCE_API StringArray
  2830. {
  2831. public:
  2832. StringArray() throw();
  2833. StringArray (const StringArray& other);
  2834. StringArray (const juce_wchar** const strings,
  2835. const int numberOfStrings);
  2836. StringArray (const char** const strings,
  2837. const int numberOfStrings);
  2838. explicit StringArray (const juce_wchar** const strings);
  2839. explicit StringArray (const char** const strings);
  2840. ~StringArray();
  2841. StringArray& operator= (const StringArray& other);
  2842. bool operator== (const StringArray& other) const;
  2843. bool operator!= (const StringArray& other) const;
  2844. inline int size() const throw() { return strings.size(); };
  2845. const String& operator[] (const int index) const throw();
  2846. bool contains (const String& stringToLookFor,
  2847. const bool ignoreCase = false) const;
  2848. int indexOf (const String& stringToLookFor,
  2849. const bool ignoreCase = false,
  2850. int startIndex = 0) const;
  2851. void add (const String& stringToAdd);
  2852. void insert (const int index, const String& stringToAdd);
  2853. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2854. void set (const int index, const String& newString);
  2855. void addArray (const StringArray& other,
  2856. int startIndex = 0,
  2857. int numElementsToAdd = -1);
  2858. int addTokens (const tchar* const stringToTokenise,
  2859. const bool preserveQuotedStrings);
  2860. int addTokens (const tchar* const stringToTokenise,
  2861. const tchar* breakCharacters,
  2862. const tchar* quoteCharacters);
  2863. int addLines (const tchar* stringToBreakUp);
  2864. void clear();
  2865. void remove (const int index);
  2866. void removeString (const String& stringToRemove,
  2867. const bool ignoreCase = false);
  2868. void removeDuplicates (const bool ignoreCase);
  2869. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2870. void move (const int currentIndex, int newIndex) throw();
  2871. void trim();
  2872. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2873. const bool appendNumberToFirstInstance,
  2874. const tchar* const preNumberString = defaultPreNumberString,
  2875. const tchar* const postNumberString = defaultPostNumberString);
  2876. const String joinIntoString (const String& separatorString,
  2877. int startIndex = 0,
  2878. int numberOfElements = -1) const;
  2879. void sort (const bool ignoreCase);
  2880. void minimiseStorageOverheads();
  2881. juce_UseDebuggingNewOperator
  2882. private:
  2883. Array <String> strings;
  2884. };
  2885. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2886. /*** End of inlined file: juce_StringArray.h ***/
  2887. class JUCE_API StringPairArray
  2888. {
  2889. public:
  2890. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2891. StringPairArray (const StringPairArray& other) throw();
  2892. ~StringPairArray() throw();
  2893. StringPairArray& operator= (const StringPairArray& other) throw();
  2894. bool operator== (const StringPairArray& other) const throw();
  2895. bool operator!= (const StringPairArray& other) const throw();
  2896. const String& operator[] (const String& key) const throw();
  2897. const String getValue (const String& key, const String& defaultReturnValue) const;
  2898. const StringArray& getAllKeys() const throw() { return keys; }
  2899. const StringArray& getAllValues() const throw() { return values; }
  2900. inline int size() const throw() { return keys.size(); };
  2901. void set (const String& key,
  2902. const String& value) throw();
  2903. void addArray (const StringPairArray& other);
  2904. void clear() throw();
  2905. void remove (const String& key) throw();
  2906. void remove (const int index) throw();
  2907. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2908. const String getDescription() const;
  2909. void minimiseStorageOverheads() throw();
  2910. juce_UseDebuggingNewOperator
  2911. private:
  2912. StringArray keys, values;
  2913. bool ignoreCase;
  2914. };
  2915. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2916. /*** End of inlined file: juce_StringPairArray.h ***/
  2917. /*** Start of inlined file: juce_XmlElement.h ***/
  2918. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  2919. #define __JUCE_XMLELEMENT_JUCEHEADER__
  2920. /*** Start of inlined file: juce_File.h ***/
  2921. #ifndef __JUCE_FILE_JUCEHEADER__
  2922. #define __JUCE_FILE_JUCEHEADER__
  2923. /*** Start of inlined file: juce_Time.h ***/
  2924. #ifndef __JUCE_TIME_JUCEHEADER__
  2925. #define __JUCE_TIME_JUCEHEADER__
  2926. /*** Start of inlined file: juce_RelativeTime.h ***/
  2927. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  2928. #define __JUCE_RELATIVETIME_JUCEHEADER__
  2929. class JUCE_API RelativeTime
  2930. {
  2931. public:
  2932. explicit RelativeTime (const double seconds = 0.0) throw();
  2933. RelativeTime (const RelativeTime& other) throw();
  2934. RelativeTime& operator= (const RelativeTime& other) throw();
  2935. ~RelativeTime() throw();
  2936. static const RelativeTime milliseconds (const int milliseconds) throw();
  2937. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  2938. static const RelativeTime minutes (const double numberOfMinutes) throw();
  2939. static const RelativeTime hours (const double numberOfHours) throw();
  2940. static const RelativeTime days (const double numberOfDays) throw();
  2941. static const RelativeTime weeks (const double numberOfWeeks) throw();
  2942. int64 inMilliseconds() const throw();
  2943. double inSeconds() const throw() { return seconds; }
  2944. double inMinutes() const throw();
  2945. double inHours() const throw();
  2946. double inDays() const throw();
  2947. double inWeeks() const throw();
  2948. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  2949. bool operator== (const RelativeTime& other) const throw();
  2950. bool operator!= (const RelativeTime& other) const throw();
  2951. bool operator> (const RelativeTime& other) const throw();
  2952. bool operator< (const RelativeTime& other) const throw();
  2953. bool operator>= (const RelativeTime& other) const throw();
  2954. bool operator<= (const RelativeTime& other) const throw();
  2955. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  2956. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  2957. const RelativeTime operator+ (const double secondsToAdd) const throw();
  2958. const RelativeTime operator- (const double secondsToSubtract) const throw();
  2959. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  2960. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  2961. const RelativeTime& operator+= (const double secondsToAdd) throw();
  2962. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  2963. juce_UseDebuggingNewOperator
  2964. private:
  2965. double seconds;
  2966. };
  2967. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  2968. /*** End of inlined file: juce_RelativeTime.h ***/
  2969. class JUCE_API Time
  2970. {
  2971. public:
  2972. Time() throw();
  2973. Time (const Time& other) throw();
  2974. Time (const int64 millisecondsSinceEpoch) throw();
  2975. Time (const int year,
  2976. const int month,
  2977. const int day,
  2978. const int hours,
  2979. const int minutes,
  2980. const int seconds = 0,
  2981. const int milliseconds = 0,
  2982. const bool useLocalTime = true) throw();
  2983. ~Time() throw();
  2984. Time& operator= (const Time& other) throw();
  2985. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  2986. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  2987. int getYear() const throw();
  2988. int getMonth() const throw();
  2989. const String getMonthName (const bool threeLetterVersion) const throw();
  2990. int getDayOfMonth() const throw();
  2991. int getDayOfWeek() const throw();
  2992. const String getWeekdayName (const bool threeLetterVersion) const throw();
  2993. int getHours() const throw();
  2994. bool isAfternoon() const throw();
  2995. int getHoursInAmPmFormat() const throw();
  2996. int getMinutes() const throw();
  2997. int getSeconds() const throw();
  2998. int getMilliseconds() const throw();
  2999. bool isDaylightSavingTime() const throw();
  3000. const String getTimeZone() const throw();
  3001. const String toString (const bool includeDate,
  3002. const bool includeTime,
  3003. const bool includeSeconds = true,
  3004. const bool use24HourClock = false) const throw();
  3005. const String formatted (const tchar* const format) const throw();
  3006. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3007. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3008. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3009. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3010. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3011. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3012. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3013. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3014. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3015. bool setSystemTimeToThisTime() const throw();
  3016. static const String getWeekdayName (int dayNumber,
  3017. const bool threeLetterVersion) throw();
  3018. static const String getMonthName (int monthNumber,
  3019. const bool threeLetterVersion) throw();
  3020. // Static methods for getting system timers directly..
  3021. static int64 currentTimeMillis() throw();
  3022. static uint32 getMillisecondCounter() throw();
  3023. static double getMillisecondCounterHiRes() throw();
  3024. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  3025. static uint32 getApproximateMillisecondCounter() throw();
  3026. // High-resolution timers..
  3027. static int64 getHighResolutionTicks() throw();
  3028. static int64 getHighResolutionTicksPerSecond() throw();
  3029. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  3030. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  3031. private:
  3032. int64 millisSinceEpoch;
  3033. };
  3034. #endif // __JUCE_TIME_JUCEHEADER__
  3035. /*** End of inlined file: juce_Time.h ***/
  3036. class FileInputStream;
  3037. class FileOutputStream;
  3038. class JUCE_API File
  3039. {
  3040. public:
  3041. File() {}
  3042. File (const String& path);
  3043. File (const File& other);
  3044. ~File() {}
  3045. File& operator= (const String& newFilePath);
  3046. File& operator= (const File& otherFile);
  3047. static const File nonexistent;
  3048. bool exists() const;
  3049. bool existsAsFile() const;
  3050. bool isDirectory() const;
  3051. int64 getSize() const;
  3052. static const String descriptionOfSizeInBytes (const int64 bytes);
  3053. const String& getFullPathName() const throw() { return fullPath; }
  3054. const String getFileName() const;
  3055. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3056. const String getFileExtension() const;
  3057. bool hasFileExtension (const String& extensionToTest) const;
  3058. const File withFileExtension (const String& newExtension) const;
  3059. const String getFileNameWithoutExtension() const;
  3060. int hashCode() const;
  3061. int64 hashCode64() const;
  3062. const File getChildFile (String relativePath) const;
  3063. const File getSiblingFile (const String& siblingFileName) const;
  3064. const File getParentDirectory() const;
  3065. bool isAChildOf (const File& potentialParentDirectory) const;
  3066. const File getNonexistentChildFile (const String& prefix,
  3067. const String& suffix,
  3068. bool putNumbersInBrackets = true) const;
  3069. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3070. bool operator== (const File& otherFile) const;
  3071. bool operator!= (const File& otherFile) const;
  3072. bool hasWriteAccess() const;
  3073. bool setReadOnly (const bool shouldBeReadOnly,
  3074. const bool applyRecursively = false) const;
  3075. bool isHidden() const;
  3076. const File getLinkedTarget() const;
  3077. const Time getLastModificationTime() const;
  3078. const Time getLastAccessTime() const;
  3079. const Time getCreationTime() const;
  3080. bool setLastModificationTime (const Time& newTime) const;
  3081. bool setLastAccessTime (const Time& newTime) const;
  3082. bool setCreationTime (const Time& newTime) const;
  3083. const String getVersion() const;
  3084. bool create() const;
  3085. bool createDirectory() const;
  3086. bool deleteFile() const;
  3087. bool deleteRecursively() const;
  3088. bool moveToTrash() const;
  3089. bool moveFileTo (const File& targetLocation) const;
  3090. bool copyFileTo (const File& targetLocation) const;
  3091. bool copyDirectoryTo (const File& newDirectory) const;
  3092. enum TypesOfFileToFind
  3093. {
  3094. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3095. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3096. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3097. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3098. };
  3099. int findChildFiles (Array<File>& results,
  3100. const int whatToLookFor,
  3101. const bool searchRecursively,
  3102. const String& wildCardPattern = JUCE_T("*")) const;
  3103. int getNumberOfChildFiles (const int whatToLookFor,
  3104. const String& wildCardPattern = JUCE_T("*")) const;
  3105. bool containsSubDirectories() const;
  3106. FileInputStream* createInputStream() const;
  3107. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3108. bool loadFileAsData (MemoryBlock& result) const;
  3109. const String loadFileAsString() const;
  3110. bool appendData (const void* const dataToAppend,
  3111. const int numberOfBytes) const;
  3112. bool replaceWithData (const void* const dataToWrite,
  3113. const int numberOfBytes) const;
  3114. bool appendText (const String& textToAppend,
  3115. const bool asUnicode = false,
  3116. const bool writeUnicodeHeaderBytes = false) const;
  3117. bool replaceWithText (const String& textToWrite,
  3118. const bool asUnicode = false,
  3119. const bool writeUnicodeHeaderBytes = false) const;
  3120. static void findFileSystemRoots (Array<File>& results);
  3121. const String getVolumeLabel() const;
  3122. int getVolumeSerialNumber() const;
  3123. int64 getBytesFreeOnVolume() const;
  3124. int64 getVolumeTotalSize() const;
  3125. bool isOnCDRomDrive() const;
  3126. bool isOnHardDisk() const;
  3127. bool isOnRemovableDrive() const;
  3128. bool startAsProcess (const String& parameters = String::empty) const;
  3129. void revealToUser() const;
  3130. enum SpecialLocationType
  3131. {
  3132. userHomeDirectory,
  3133. userDocumentsDirectory,
  3134. userDesktopDirectory,
  3135. userApplicationDataDirectory,
  3136. commonApplicationDataDirectory,
  3137. tempDirectory,
  3138. currentExecutableFile,
  3139. currentApplicationFile,
  3140. invokedExecutableFile,
  3141. globalApplicationsDirectory,
  3142. userMusicDirectory,
  3143. userMoviesDirectory,
  3144. };
  3145. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3146. static const File createTempFile (const String& fileNameEnding);
  3147. static const File getCurrentWorkingDirectory();
  3148. bool setAsCurrentWorkingDirectory() const;
  3149. static const tchar separator;
  3150. static const tchar* separatorString;
  3151. static const String createLegalFileName (const String& fileNameToFix);
  3152. static const String createLegalPathName (const String& pathNameToFix);
  3153. static bool areFileNamesCaseSensitive();
  3154. static bool isAbsolutePath (const String& path);
  3155. static const File createFileWithoutCheckingPath (const String& path);
  3156. juce_UseDebuggingNewOperator
  3157. private:
  3158. String fullPath;
  3159. // internal way of contructing a file without checking the path
  3160. friend class DirectoryIterator;
  3161. File (const String&, int);
  3162. const String getPathUpToLastSlash() const;
  3163. };
  3164. #endif // __JUCE_FILE_JUCEHEADER__
  3165. /*** End of inlined file: juce_File.h ***/
  3166. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3167. \
  3168. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3169. childElementVariableName != 0; \
  3170. childElementVariableName = childElementVariableName->getNextElement())
  3171. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3172. \
  3173. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3174. childElementVariableName != 0; \
  3175. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3176. class JUCE_API XmlElement
  3177. {
  3178. public:
  3179. XmlElement (const String& tagName) throw();
  3180. XmlElement (const XmlElement& other) throw();
  3181. XmlElement& operator= (const XmlElement& other) throw();
  3182. ~XmlElement() throw();
  3183. bool isEquivalentTo (const XmlElement* const other,
  3184. const bool ignoreOrderOfAttributes) const throw();
  3185. const String createDocument (const String& dtdToUse,
  3186. const bool allOnOneLine = false,
  3187. const bool includeXmlHeader = true,
  3188. const String& encodingType = JUCE_T("UTF-8"),
  3189. const int lineWrapLength = 60) const throw();
  3190. void writeToStream (OutputStream& output,
  3191. const String& dtdToUse,
  3192. const bool allOnOneLine = false,
  3193. const bool includeXmlHeader = true,
  3194. const String& encodingType = JUCE_T("UTF-8"),
  3195. const int lineWrapLength = 60) const throw();
  3196. bool writeToFile (const File& destinationFile,
  3197. const String& dtdToUse,
  3198. const String& encodingType = JUCE_T("UTF-8"),
  3199. const int lineWrapLength = 60) const throw();
  3200. inline const String& getTagName() const throw() { return tagName; }
  3201. bool hasTagName (const String& possibleTagName) const throw();
  3202. int getNumAttributes() const throw();
  3203. const String& getAttributeName (const int attributeIndex) const throw();
  3204. const String& getAttributeValue (const int attributeIndex) const throw();
  3205. // Attribute-handling methods..
  3206. bool hasAttribute (const String& attributeName) const throw();
  3207. const String getStringAttribute (const String& attributeName,
  3208. const String& defaultReturnValue = String::empty) const throw();
  3209. bool compareAttribute (const String& attributeName,
  3210. const String& stringToCompareAgainst,
  3211. const bool ignoreCase = false) const throw();
  3212. int getIntAttribute (const String& attributeName,
  3213. const int defaultReturnValue = 0) const throw();
  3214. double getDoubleAttribute (const String& attributeName,
  3215. const double defaultReturnValue = 0.0) const throw();
  3216. bool getBoolAttribute (const String& attributeName,
  3217. const bool defaultReturnValue = false) const throw();
  3218. void setAttribute (const String& attributeName,
  3219. const String& newValue) throw();
  3220. void setAttribute (const String& attributeName,
  3221. const int newValue) throw();
  3222. void setAttribute (const String& attributeName,
  3223. const double newValue) throw();
  3224. void removeAttribute (const String& attributeName) throw();
  3225. void removeAllAttributes() throw();
  3226. // Child element methods..
  3227. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3228. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3229. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3230. int getNumChildElements() const throw();
  3231. XmlElement* getChildElement (const int index) const throw();
  3232. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3233. void addChildElement (XmlElement* const newChildElement) throw();
  3234. void insertChildElement (XmlElement* const newChildNode,
  3235. int indexToInsertAt) throw();
  3236. XmlElement* createNewChildElement (const String& tagName);
  3237. bool replaceChildElement (XmlElement* const currentChildElement,
  3238. XmlElement* const newChildNode) throw();
  3239. void removeChildElement (XmlElement* const childToRemove,
  3240. const bool shouldDeleteTheChild) throw();
  3241. void deleteAllChildElements() throw();
  3242. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3243. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3244. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3245. template <class ElementComparator>
  3246. void sortChildElements (ElementComparator& comparator,
  3247. const bool retainOrderOfEquivalentItems = false) throw()
  3248. {
  3249. const int num = getNumChildElements();
  3250. if (num > 1)
  3251. {
  3252. HeapBlock <XmlElement*> elems (num);
  3253. getChildElementsAsArray (elems);
  3254. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3255. reorderChildElements (elems, num);
  3256. }
  3257. }
  3258. bool isTextElement() const throw();
  3259. const String getText() const throw();
  3260. void setText (const String& newText) throw();
  3261. const String getAllSubText() const throw();
  3262. const String getChildElementAllSubText (const String& childTagName,
  3263. const String& defaultReturnValue) const throw();
  3264. void addTextElement (const String& text) throw();
  3265. void deleteAllTextElements() throw();
  3266. static XmlElement* createTextElement (const String& text) throw();
  3267. juce_UseDebuggingNewOperator
  3268. private:
  3269. friend class XmlDocument;
  3270. String tagName;
  3271. XmlElement* firstChildElement;
  3272. XmlElement* nextElement;
  3273. struct XmlAttributeNode
  3274. {
  3275. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3276. XmlAttributeNode (const String& name, const String& value) throw();
  3277. String name, value;
  3278. XmlAttributeNode* next;
  3279. private:
  3280. XmlAttributeNode& operator= (const XmlAttributeNode&);
  3281. };
  3282. XmlAttributeNode* attributes;
  3283. XmlElement (int) throw(); // for internal use
  3284. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3285. void writeElementAsText (OutputStream& out,
  3286. const int indentationLevel,
  3287. const int lineWrapLength) const throw();
  3288. void getChildElementsAsArray (XmlElement**) const throw();
  3289. void reorderChildElements (XmlElement** const, const int) throw();
  3290. };
  3291. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3292. /*** End of inlined file: juce_XmlElement.h ***/
  3293. class JUCE_API PropertySet
  3294. {
  3295. public:
  3296. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3297. PropertySet (const PropertySet& other) throw();
  3298. PropertySet& operator= (const PropertySet& other) throw();
  3299. virtual ~PropertySet();
  3300. const String getValue (const String& keyName,
  3301. const String& defaultReturnValue = String::empty) const throw();
  3302. int getIntValue (const String& keyName,
  3303. const int defaultReturnValue = 0) const throw();
  3304. double getDoubleValue (const String& keyName,
  3305. const double defaultReturnValue = 0.0) const throw();
  3306. bool getBoolValue (const String& keyName,
  3307. const bool defaultReturnValue = false) const throw();
  3308. XmlElement* getXmlValue (const String& keyName) const;
  3309. void setValue (const String& keyName, const String& value) throw();
  3310. void setValue (const String& keyName, const tchar* const value) throw();
  3311. void setValue (const String& keyName, const int value) throw();
  3312. void setValue (const String& keyName, const double value) throw();
  3313. void setValue (const String& keyName, const bool value) throw();
  3314. void setValue (const String& keyName, const XmlElement* const xml);
  3315. void removeValue (const String& keyName) throw();
  3316. bool containsKey (const String& keyName) const throw();
  3317. void clear();
  3318. StringPairArray& getAllProperties() throw() { return properties; }
  3319. const CriticalSection& getLock() const throw() { return lock; }
  3320. XmlElement* createXml (const String& nodeName) const throw();
  3321. void restoreFromXml (const XmlElement& xml) throw();
  3322. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3323. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3324. juce_UseDebuggingNewOperator
  3325. protected:
  3326. virtual void propertyChanged();
  3327. private:
  3328. StringPairArray properties;
  3329. PropertySet* fallbackProperties;
  3330. CriticalSection lock;
  3331. bool ignoreCaseOfKeys;
  3332. };
  3333. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3334. /*** End of inlined file: juce_PropertySet.h ***/
  3335. #endif
  3336. #ifndef __JUCE_RANGE_JUCEHEADER__
  3337. /*** Start of inlined file: juce_Range.h ***/
  3338. #ifndef __JUCE_RANGE_JUCEHEADER__
  3339. #define __JUCE_RANGE_JUCEHEADER__
  3340. template <typename ValueType>
  3341. class Range
  3342. {
  3343. public:
  3344. Range() throw()
  3345. : start (ValueType()), end (ValueType())
  3346. {
  3347. }
  3348. Range (const ValueType start_, const ValueType end_) throw()
  3349. : start (start_), end (jmax (start_, end_))
  3350. {
  3351. }
  3352. Range (const Range& other) throw()
  3353. : start (other.start), end (other.end)
  3354. {
  3355. }
  3356. Range& operator= (const Range& other) throw()
  3357. {
  3358. start = other.start;
  3359. end = other.end;
  3360. return *this;
  3361. }
  3362. ~Range() throw()
  3363. {
  3364. }
  3365. static const Range between (const ValueType position1, const ValueType position2) throw()
  3366. {
  3367. return (position1 < position2) ? Range (position1, position2)
  3368. : Range (position2, position1);
  3369. }
  3370. static const Range emptyRange (const ValueType start) throw()
  3371. {
  3372. return Range (start, start);
  3373. }
  3374. inline ValueType getStart() const throw() { return start; }
  3375. inline ValueType getLength() const throw() { return end - start; }
  3376. inline ValueType getEnd() const throw() { return end; }
  3377. inline bool isEmpty() const throw() { return start == end; }
  3378. void setStart (const ValueType newStart) throw()
  3379. {
  3380. start = newStart;
  3381. if (newStart > end)
  3382. end = newStart;
  3383. }
  3384. const Range withStart (const ValueType newStart) const throw()
  3385. {
  3386. return Range (newStart, jmax (newStart, end));
  3387. }
  3388. void setEnd (const ValueType newEnd) throw()
  3389. {
  3390. end = newEnd;
  3391. if (newEnd < start)
  3392. start = newEnd;
  3393. }
  3394. const Range withEnd (const ValueType newEnd) const throw()
  3395. {
  3396. return Range (jmin (start, newEnd), newEnd);
  3397. }
  3398. void setLength (const ValueType newLength) throw()
  3399. {
  3400. end = start + jmax (ValueType(), newLength);
  3401. }
  3402. const Range withLength (const ValueType newLength) const throw()
  3403. {
  3404. return Range (start, start + newLength);
  3405. }
  3406. inline const Range& operator+= (const ValueType amountToAdd) throw()
  3407. {
  3408. start += amountToAdd;
  3409. end += amountToAdd;
  3410. return *this;
  3411. }
  3412. inline const Range& operator-= (const ValueType amountToSubtract) throw()
  3413. {
  3414. start -= amountToSubtract;
  3415. end -= amountToSubtract;
  3416. return *this;
  3417. }
  3418. const Range operator+ (const ValueType amountToAdd) const throw()
  3419. {
  3420. return Range (start + amountToAdd, end + amountToAdd);
  3421. }
  3422. const Range operator- (const ValueType amountToSubtract) const throw()
  3423. {
  3424. return Range (start - amountToSubtract, end - amountToSubtract);
  3425. }
  3426. bool contains (const ValueType position) const throw()
  3427. {
  3428. return position >= start && position < end;
  3429. }
  3430. ValueType clipValue (const ValueType value) const throw()
  3431. {
  3432. return jlimit (start, end, value);
  3433. }
  3434. bool intersects (const Range& other) const throw()
  3435. {
  3436. return other.start < end && other.end > start;
  3437. }
  3438. const Range getIntersectionWith (const Range& other) const throw()
  3439. {
  3440. return Range (jmax (start, other.start),
  3441. jmin (end, other.end));
  3442. }
  3443. const Range getUnionWith (const Range& other) const throw()
  3444. {
  3445. return Range (jmin (start, other.start),
  3446. jmax (end, other.end));
  3447. }
  3448. juce_UseDebuggingNewOperator
  3449. private:
  3450. ValueType start, end;
  3451. };
  3452. #endif // __JUCE_RANGE_JUCEHEADER__
  3453. /*** End of inlined file: juce_Range.h ***/
  3454. #endif
  3455. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3456. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3457. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3458. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3459. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3460. class ReferenceCountedArray
  3461. {
  3462. public:
  3463. ReferenceCountedArray() throw()
  3464. : numUsed (0)
  3465. {
  3466. }
  3467. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3468. {
  3469. const ScopedLockType lock (other.getLock());
  3470. numUsed = other.numUsed;
  3471. data.setAllocatedSize (numUsed);
  3472. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3473. for (int i = numUsed; --i >= 0;)
  3474. if (data.elements[i] != 0)
  3475. data.elements[i]->incReferenceCount();
  3476. }
  3477. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3478. {
  3479. if (this != &other)
  3480. {
  3481. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3482. swapWithArray (other);
  3483. }
  3484. return *this;
  3485. }
  3486. ~ReferenceCountedArray()
  3487. {
  3488. clear();
  3489. }
  3490. void clear()
  3491. {
  3492. const ScopedLockType lock (getLock());
  3493. while (numUsed > 0)
  3494. if (data.elements [--numUsed] != 0)
  3495. data.elements [numUsed]->decReferenceCount();
  3496. jassert (numUsed == 0);
  3497. data.setAllocatedSize (0);
  3498. }
  3499. inline int size() const throw()
  3500. {
  3501. return numUsed;
  3502. }
  3503. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3504. {
  3505. const ScopedLockType lock (getLock());
  3506. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3507. : (ObjectClass*) 0;
  3508. }
  3509. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3510. {
  3511. const ScopedLockType lock (getLock());
  3512. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3513. return data.elements [index];
  3514. }
  3515. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3516. {
  3517. const ScopedLockType lock (getLock());
  3518. return numUsed > 0 ? data.elements [0]
  3519. : (ObjectClass*) 0;
  3520. }
  3521. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3522. {
  3523. const ScopedLockType lock (getLock());
  3524. return numUsed > 0 ? data.elements [numUsed - 1]
  3525. : (ObjectClass*) 0;
  3526. }
  3527. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3528. {
  3529. const ScopedLockType lock (getLock());
  3530. ObjectClass** e = data.elements;
  3531. ObjectClass** const end = e + numUsed;
  3532. while (e != end)
  3533. {
  3534. if (objectToLookFor == *e)
  3535. return (int) (e - data.elements);
  3536. ++e;
  3537. }
  3538. return -1;
  3539. }
  3540. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3541. {
  3542. const ScopedLockType lock (getLock());
  3543. ObjectClass** e = data.elements;
  3544. ObjectClass** const end = e + numUsed;
  3545. while (e != end)
  3546. {
  3547. if (objectToLookFor == *e)
  3548. return true;
  3549. ++e;
  3550. }
  3551. return false;
  3552. }
  3553. void add (ObjectClass* const newObject) throw()
  3554. {
  3555. const ScopedLockType lock (getLock());
  3556. data.ensureAllocatedSize (numUsed + 1);
  3557. data.elements [numUsed++] = newObject;
  3558. if (newObject != 0)
  3559. newObject->incReferenceCount();
  3560. }
  3561. void insert (int indexToInsertAt,
  3562. ObjectClass* const newObject) throw()
  3563. {
  3564. if (indexToInsertAt >= 0)
  3565. {
  3566. const ScopedLockType lock (getLock());
  3567. if (indexToInsertAt > numUsed)
  3568. indexToInsertAt = numUsed;
  3569. data.ensureAllocatedSize (numUsed + 1);
  3570. ObjectClass** const e = data.elements + indexToInsertAt;
  3571. const int numToMove = numUsed - indexToInsertAt;
  3572. if (numToMove > 0)
  3573. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3574. *e = newObject;
  3575. if (newObject != 0)
  3576. newObject->incReferenceCount();
  3577. ++numUsed;
  3578. }
  3579. else
  3580. {
  3581. add (newObject);
  3582. }
  3583. }
  3584. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3585. {
  3586. const ScopedLockType lock (getLock());
  3587. if (! contains (newObject))
  3588. add (newObject);
  3589. }
  3590. void set (const int indexToChange,
  3591. ObjectClass* const newObject)
  3592. {
  3593. if (indexToChange >= 0)
  3594. {
  3595. const ScopedLockType lock (getLock());
  3596. if (newObject != 0)
  3597. newObject->incReferenceCount();
  3598. if (indexToChange < numUsed)
  3599. {
  3600. if (data.elements [indexToChange] != 0)
  3601. data.elements [indexToChange]->decReferenceCount();
  3602. data.elements [indexToChange] = newObject;
  3603. }
  3604. else
  3605. {
  3606. data.ensureAllocatedSize (numUsed + 1);
  3607. data.elements [numUsed++] = newObject;
  3608. }
  3609. }
  3610. }
  3611. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3612. int startIndex = 0,
  3613. int numElementsToAdd = -1) throw()
  3614. {
  3615. arrayToAddFrom.lockArray();
  3616. const ScopedLockType lock (getLock());
  3617. if (startIndex < 0)
  3618. {
  3619. jassertfalse
  3620. startIndex = 0;
  3621. }
  3622. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3623. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3624. if (numElementsToAdd > 0)
  3625. {
  3626. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3627. while (--numElementsToAdd >= 0)
  3628. add (arrayToAddFrom.getUnchecked (startIndex++));
  3629. }
  3630. arrayToAddFrom.unlockArray();
  3631. }
  3632. template <class ElementComparator>
  3633. void addSorted (ElementComparator& comparator,
  3634. ObjectClass* newObject) throw()
  3635. {
  3636. const ScopedLockType lock (getLock());
  3637. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  3638. }
  3639. template <class ElementComparator>
  3640. void addOrReplaceSorted (ElementComparator& comparator,
  3641. ObjectClass* newObject) throw()
  3642. {
  3643. const ScopedLockType lock (getLock());
  3644. const int index = findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed);
  3645. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3646. set (index - 1, newObject); // replace an existing object that matches
  3647. else
  3648. insert (index, newObject); // no match, so insert the new one
  3649. }
  3650. void remove (const int indexToRemove)
  3651. {
  3652. const ScopedLockType lock (getLock());
  3653. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3654. {
  3655. ObjectClass** const e = data.elements + indexToRemove;
  3656. if (*e != 0)
  3657. (*e)->decReferenceCount();
  3658. --numUsed;
  3659. const int numberToShift = numUsed - indexToRemove;
  3660. if (numberToShift > 0)
  3661. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3662. if ((numUsed << 1) < data.numAllocated)
  3663. minimiseStorageOverheads();
  3664. }
  3665. }
  3666. void removeObject (ObjectClass* const objectToRemove)
  3667. {
  3668. const ScopedLockType lock (getLock());
  3669. remove (indexOf (objectToRemove));
  3670. }
  3671. void removeRange (const int startIndex,
  3672. const int numberToRemove)
  3673. {
  3674. const ScopedLockType lock (getLock());
  3675. const int start = jlimit (0, numUsed, startIndex);
  3676. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3677. if (end > start)
  3678. {
  3679. int i;
  3680. for (i = start; i < end; ++i)
  3681. {
  3682. if (data.elements[i] != 0)
  3683. {
  3684. data.elements[i]->decReferenceCount();
  3685. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3686. }
  3687. }
  3688. const int rangeSize = end - start;
  3689. ObjectClass** e = data.elements + start;
  3690. i = numUsed - end;
  3691. numUsed -= rangeSize;
  3692. while (--i >= 0)
  3693. {
  3694. *e = e [rangeSize];
  3695. ++e;
  3696. }
  3697. if ((numUsed << 1) < data.numAllocated)
  3698. minimiseStorageOverheads();
  3699. }
  3700. }
  3701. void removeLast (int howManyToRemove = 1)
  3702. {
  3703. const ScopedLockType lock (getLock());
  3704. if (howManyToRemove > numUsed)
  3705. howManyToRemove = numUsed;
  3706. while (--howManyToRemove >= 0)
  3707. remove (numUsed - 1);
  3708. }
  3709. void swap (const int index1,
  3710. const int index2) throw()
  3711. {
  3712. const ScopedLockType lock (getLock());
  3713. if (((unsigned int) index1) < (unsigned int) numUsed
  3714. && ((unsigned int) index2) < (unsigned int) numUsed)
  3715. {
  3716. swapVariables (data.elements [index1],
  3717. data.elements [index2]);
  3718. }
  3719. }
  3720. void move (const int currentIndex,
  3721. int newIndex) throw()
  3722. {
  3723. if (currentIndex != newIndex)
  3724. {
  3725. const ScopedLockType lock (getLock());
  3726. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3727. {
  3728. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3729. newIndex = numUsed - 1;
  3730. ObjectClass* const value = data.elements [currentIndex];
  3731. if (newIndex > currentIndex)
  3732. {
  3733. memmove (data.elements + currentIndex,
  3734. data.elements + currentIndex + 1,
  3735. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3736. }
  3737. else
  3738. {
  3739. memmove (data.elements + newIndex + 1,
  3740. data.elements + newIndex,
  3741. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3742. }
  3743. data.elements [newIndex] = value;
  3744. }
  3745. }
  3746. }
  3747. void swapWithArray (ReferenceCountedArray& otherArray) throw()
  3748. {
  3749. const ScopedLockType lock1 (getLock());
  3750. const ScopedLockType lock2 (otherArray.getLock());
  3751. data.swapWith (otherArray.data);
  3752. swapVariables (numUsed, otherArray.numUsed);
  3753. }
  3754. bool operator== (const ReferenceCountedArray& other) const throw()
  3755. {
  3756. const ScopedLockType lock2 (other.getLock());
  3757. const ScopedLockType lock1 (getLock());
  3758. if (numUsed != other.numUsed)
  3759. return false;
  3760. for (int i = numUsed; --i >= 0;)
  3761. if (data.elements [i] != other.data.elements [i])
  3762. return false;
  3763. return true;
  3764. }
  3765. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3766. {
  3767. return ! operator== (other);
  3768. }
  3769. template <class ElementComparator>
  3770. void sort (ElementComparator& comparator,
  3771. const bool retainOrderOfEquivalentItems = false) const throw()
  3772. {
  3773. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3774. // avoids getting warning messages about the parameter being unused
  3775. const ScopedLockType lock (getLock());
  3776. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  3777. }
  3778. void minimiseStorageOverheads() throw()
  3779. {
  3780. const ScopedLockType lock (getLock());
  3781. data.shrinkToNoMoreThan (numUsed);
  3782. }
  3783. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  3784. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  3785. juce_UseDebuggingNewOperator
  3786. private:
  3787. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3788. int numUsed;
  3789. };
  3790. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3791. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3792. #endif
  3793. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3794. #endif
  3795. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3796. #endif
  3797. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3798. /*** Start of inlined file: juce_SortedSet.h ***/
  3799. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3800. #define __JUCE_SORTEDSET_JUCEHEADER__
  3801. #if JUCE_MSVC
  3802. #pragma warning (push)
  3803. #pragma warning (disable: 4512)
  3804. #endif
  3805. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3806. class SortedSet
  3807. {
  3808. public:
  3809. SortedSet() throw()
  3810. : numUsed (0)
  3811. {
  3812. }
  3813. SortedSet (const SortedSet& other) throw()
  3814. {
  3815. const ScopedLockType lock (other.getLock());
  3816. numUsed = other.numUsed;
  3817. data.setAllocatedSize (other.numUsed);
  3818. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3819. }
  3820. ~SortedSet() throw()
  3821. {
  3822. }
  3823. SortedSet& operator= (const SortedSet& other) throw()
  3824. {
  3825. if (this != &other)
  3826. {
  3827. const ScopedLockType lock1 (other.getLock());
  3828. const ScopedLockType lock2 (getLock());
  3829. data.ensureAllocatedSize (other.size());
  3830. numUsed = other.numUsed;
  3831. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3832. minimiseStorageOverheads();
  3833. }
  3834. return *this;
  3835. }
  3836. bool operator== (const SortedSet<ElementType>& other) const throw()
  3837. {
  3838. const ScopedLockType lock (getLock());
  3839. if (numUsed != other.numUsed)
  3840. return false;
  3841. for (int i = numUsed; --i >= 0;)
  3842. if (data.elements[i] != other.data.elements[i])
  3843. return false;
  3844. return true;
  3845. }
  3846. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3847. {
  3848. return ! operator== (other);
  3849. }
  3850. void clear() throw()
  3851. {
  3852. const ScopedLockType lock (getLock());
  3853. data.setAllocatedSize (0);
  3854. numUsed = 0;
  3855. }
  3856. void clearQuick() throw()
  3857. {
  3858. const ScopedLockType lock (getLock());
  3859. numUsed = 0;
  3860. }
  3861. inline int size() const throw()
  3862. {
  3863. return numUsed;
  3864. }
  3865. inline ElementType operator[] (const int index) const throw()
  3866. {
  3867. const ScopedLockType lock (getLock());
  3868. return (((unsigned int) index) < (unsigned int) numUsed) ? data.elements [index]
  3869. : ElementType();
  3870. }
  3871. inline ElementType getUnchecked (const int index) const throw()
  3872. {
  3873. const ScopedLockType lock (getLock());
  3874. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3875. return data.elements [index];
  3876. }
  3877. inline ElementType getFirst() const throw()
  3878. {
  3879. const ScopedLockType lock (getLock());
  3880. return numUsed > 0 ? data.elements [0] : ElementType();
  3881. }
  3882. inline ElementType getLast() const throw()
  3883. {
  3884. const ScopedLockType lock (getLock());
  3885. return numUsed > 0 ? data.elements [numUsed - 1] : ElementType();
  3886. }
  3887. int indexOf (const ElementType elementToLookFor) const throw()
  3888. {
  3889. const ScopedLockType lock (getLock());
  3890. int start = 0;
  3891. int end = numUsed;
  3892. for (;;)
  3893. {
  3894. if (start >= end)
  3895. {
  3896. return -1;
  3897. }
  3898. else if (elementToLookFor == data.elements [start])
  3899. {
  3900. return start;
  3901. }
  3902. else
  3903. {
  3904. const int halfway = (start + end) >> 1;
  3905. if (halfway == start)
  3906. return -1;
  3907. else if (elementToLookFor >= data.elements [halfway])
  3908. start = halfway;
  3909. else
  3910. end = halfway;
  3911. }
  3912. }
  3913. }
  3914. bool contains (const ElementType elementToLookFor) const throw()
  3915. {
  3916. const ScopedLockType lock (getLock());
  3917. int start = 0;
  3918. int end = numUsed;
  3919. for (;;)
  3920. {
  3921. if (start >= end)
  3922. {
  3923. return false;
  3924. }
  3925. else if (elementToLookFor == data.elements [start])
  3926. {
  3927. return true;
  3928. }
  3929. else
  3930. {
  3931. const int halfway = (start + end) >> 1;
  3932. if (halfway == start)
  3933. return false;
  3934. else if (elementToLookFor >= data.elements [halfway])
  3935. start = halfway;
  3936. else
  3937. end = halfway;
  3938. }
  3939. }
  3940. }
  3941. void add (const ElementType newElement) throw()
  3942. {
  3943. const ScopedLockType lock (getLock());
  3944. int start = 0;
  3945. int end = numUsed;
  3946. for (;;)
  3947. {
  3948. if (start >= end)
  3949. {
  3950. jassert (start <= end);
  3951. insertInternal (start, newElement);
  3952. break;
  3953. }
  3954. else if (newElement == data.elements [start])
  3955. {
  3956. break;
  3957. }
  3958. else
  3959. {
  3960. const int halfway = (start + end) >> 1;
  3961. if (halfway == start)
  3962. {
  3963. if (newElement >= data.elements [halfway])
  3964. insertInternal (start + 1, newElement);
  3965. else
  3966. insertInternal (start, newElement);
  3967. break;
  3968. }
  3969. else if (newElement >= data.elements [halfway])
  3970. start = halfway;
  3971. else
  3972. end = halfway;
  3973. }
  3974. }
  3975. }
  3976. void addArray (const ElementType* elementsToAdd,
  3977. int numElementsToAdd) throw()
  3978. {
  3979. const ScopedLockType lock (getLock());
  3980. while (--numElementsToAdd >= 0)
  3981. add (*elementsToAdd++);
  3982. }
  3983. template <class OtherSetType>
  3984. void addSet (const OtherSetType& setToAddFrom,
  3985. int startIndex = 0,
  3986. int numElementsToAdd = -1) throw()
  3987. {
  3988. const typename OtherSetType::ScopedLockType lock1 (setToAddFrom.getLock());
  3989. const ScopedLockType lock2 (getLock());
  3990. jassert (this != &setToAddFrom);
  3991. if (this != &setToAddFrom)
  3992. {
  3993. if (startIndex < 0)
  3994. {
  3995. jassertfalse
  3996. startIndex = 0;
  3997. }
  3998. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  3999. numElementsToAdd = setToAddFrom.size() - startIndex;
  4000. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4001. }
  4002. }
  4003. ElementType remove (const int indexToRemove) throw()
  4004. {
  4005. const ScopedLockType lock (getLock());
  4006. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4007. {
  4008. --numUsed;
  4009. ElementType* const e = data.elements + indexToRemove;
  4010. ElementType const removed = *e;
  4011. const int numberToShift = numUsed - indexToRemove;
  4012. if (numberToShift > 0)
  4013. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4014. if ((numUsed << 1) < data.numAllocated)
  4015. minimiseStorageOverheads();
  4016. return removed;
  4017. }
  4018. return 0;
  4019. }
  4020. void removeValue (const ElementType valueToRemove) throw()
  4021. {
  4022. const ScopedLockType lock (getLock());
  4023. remove (indexOf (valueToRemove));
  4024. }
  4025. template <class OtherSetType>
  4026. void removeValuesIn (const OtherSetType& otherSet) throw()
  4027. {
  4028. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4029. const ScopedLockType lock2 (getLock());
  4030. if (this == &otherSet)
  4031. {
  4032. clear();
  4033. }
  4034. else
  4035. {
  4036. if (otherSet.size() > 0)
  4037. {
  4038. for (int i = numUsed; --i >= 0;)
  4039. if (otherSet.contains (data.elements [i]))
  4040. remove (i);
  4041. }
  4042. }
  4043. }
  4044. template <class OtherSetType>
  4045. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4046. {
  4047. const typename OtherSetType::ScopedLockType lock1 (otherSet.getLock());
  4048. const ScopedLockType lock2 (getLock());
  4049. if (this != &otherSet)
  4050. {
  4051. if (otherSet.size() <= 0)
  4052. {
  4053. clear();
  4054. }
  4055. else
  4056. {
  4057. for (int i = numUsed; --i >= 0;)
  4058. if (! otherSet.contains (data.elements [i]))
  4059. remove (i);
  4060. }
  4061. }
  4062. }
  4063. void minimiseStorageOverheads() throw()
  4064. {
  4065. const ScopedLockType lock (getLock());
  4066. data.shrinkToNoMoreThan (numUsed);
  4067. }
  4068. inline const TypeOfCriticalSectionToUse& getLock() const throw() { return data; }
  4069. typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
  4070. juce_UseDebuggingNewOperator
  4071. private:
  4072. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4073. int numUsed;
  4074. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4075. {
  4076. data.ensureAllocatedSize (numUsed + 1);
  4077. ElementType* const insertPos = data.elements + indexToInsertAt;
  4078. const int numberToMove = numUsed - indexToInsertAt;
  4079. if (numberToMove > 0)
  4080. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4081. *insertPos = newElement;
  4082. ++numUsed;
  4083. }
  4084. };
  4085. #if JUCE_MSVC
  4086. #pragma warning (pop)
  4087. #endif
  4088. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4089. /*** End of inlined file: juce_SortedSet.h ***/
  4090. #endif
  4091. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4092. /*** Start of inlined file: juce_SparseSet.h ***/
  4093. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4094. #define __JUCE_SPARSESET_JUCEHEADER__
  4095. template <class Type>
  4096. class SparseSet
  4097. {
  4098. public:
  4099. SparseSet() throw()
  4100. {
  4101. }
  4102. SparseSet (const SparseSet<Type>& other) throw()
  4103. : values (other.values)
  4104. {
  4105. }
  4106. ~SparseSet() throw()
  4107. {
  4108. }
  4109. void clear() throw()
  4110. {
  4111. values.clear();
  4112. }
  4113. bool isEmpty() const throw()
  4114. {
  4115. return values.size() == 0;
  4116. }
  4117. Type size() const throw()
  4118. {
  4119. Type num = 0;
  4120. for (int i = 0; i < values.size(); i += 2)
  4121. num += values[i + 1] - values[i];
  4122. return num;
  4123. }
  4124. Type operator[] (int index) const throw()
  4125. {
  4126. for (int i = 0; i < values.size(); i += 2)
  4127. {
  4128. const Type s = values.getUnchecked(i);
  4129. const Type e = values.getUnchecked(i + 1);
  4130. if (index < e - s)
  4131. return s + index;
  4132. index -= e - s;
  4133. }
  4134. return (Type) 0;
  4135. }
  4136. bool contains (const Type valueToLookFor) const throw()
  4137. {
  4138. bool on = false;
  4139. for (int i = 0; i < values.size(); ++i)
  4140. {
  4141. if (values.getUnchecked(i) > valueToLookFor)
  4142. return on;
  4143. on = ! on;
  4144. }
  4145. return false;
  4146. }
  4147. int getNumRanges() const throw()
  4148. {
  4149. return values.size() >> 1;
  4150. }
  4151. bool getRange (const int rangeIndex,
  4152. Type& startValue,
  4153. Type& numValues) const throw()
  4154. {
  4155. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4156. {
  4157. startValue = values [rangeIndex << 1];
  4158. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4159. return true;
  4160. }
  4161. return false;
  4162. }
  4163. bool getTotalRange (Type& lowestValue,
  4164. Type& highestValue) const throw()
  4165. {
  4166. if (values.size() > 0)
  4167. {
  4168. lowestValue = values.getUnchecked (0);
  4169. highestValue = values.getUnchecked (values.size() - 1);
  4170. return true;
  4171. }
  4172. return false;
  4173. }
  4174. void addRange (const Type firstValue,
  4175. const Type numValuesToAdd) throw()
  4176. {
  4177. jassert (numValuesToAdd >= 0);
  4178. if (numValuesToAdd > 0)
  4179. {
  4180. removeRange (firstValue, numValuesToAdd);
  4181. IntegerElementComparator<Type> sorter;
  4182. values.addSorted (sorter, firstValue);
  4183. values.addSorted (sorter, firstValue + numValuesToAdd);
  4184. simplify();
  4185. }
  4186. }
  4187. void removeRange (const Type firstValue,
  4188. const Type numValuesToRemove) throw()
  4189. {
  4190. jassert (numValuesToRemove >= 0);
  4191. if (numValuesToRemove >= 0
  4192. && firstValue < values.getLast())
  4193. {
  4194. const bool onAtStart = contains (firstValue - 1);
  4195. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4196. const bool onAtEnd = contains (lastValue);
  4197. for (int i = values.size(); --i >= 0;)
  4198. {
  4199. if (values.getUnchecked(i) <= lastValue)
  4200. {
  4201. while (values.getUnchecked(i) >= firstValue)
  4202. {
  4203. values.remove (i);
  4204. if (--i < 0)
  4205. break;
  4206. }
  4207. break;
  4208. }
  4209. }
  4210. IntegerElementComparator<Type> sorter;
  4211. if (onAtStart)
  4212. values.addSorted (sorter, firstValue);
  4213. if (onAtEnd)
  4214. values.addSorted (sorter, lastValue);
  4215. simplify();
  4216. }
  4217. }
  4218. void invertRange (const Type firstValue,
  4219. const Type numValues)
  4220. {
  4221. SparseSet newItems;
  4222. newItems.addRange (firstValue, numValues);
  4223. int i;
  4224. for (i = getNumRanges(); --i >= 0;)
  4225. {
  4226. const int start = values [i << 1];
  4227. const int end = values [(i << 1) + 1];
  4228. newItems.removeRange (start, end);
  4229. }
  4230. removeRange (firstValue, numValues);
  4231. for (i = newItems.getNumRanges(); --i >= 0;)
  4232. {
  4233. const int start = newItems.values [i << 1];
  4234. const int end = newItems.values [(i << 1) + 1];
  4235. addRange (start, end);
  4236. }
  4237. }
  4238. bool overlapsRange (const Type firstValue,
  4239. const Type numValues) throw()
  4240. {
  4241. jassert (numValues >= 0);
  4242. if (numValues > 0)
  4243. {
  4244. for (int i = getNumRanges(); --i >= 0;)
  4245. {
  4246. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4247. return false;
  4248. if (firstValue + numValues > values.getUnchecked (i << 1))
  4249. return true;
  4250. }
  4251. }
  4252. return false;
  4253. }
  4254. bool containsRange (const Type firstValue,
  4255. const Type numValues) throw()
  4256. {
  4257. jassert (numValues >= 0);
  4258. if (numValues > 0)
  4259. {
  4260. for (int i = getNumRanges(); --i >= 0;)
  4261. {
  4262. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4263. return false;
  4264. if (firstValue >= values.getUnchecked (i << 1)
  4265. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4266. return true;
  4267. }
  4268. }
  4269. return false;
  4270. }
  4271. bool operator== (const SparseSet<Type>& other) throw()
  4272. {
  4273. return values == other.values;
  4274. }
  4275. bool operator!= (const SparseSet<Type>& other) throw()
  4276. {
  4277. return values != other.values;
  4278. }
  4279. juce_UseDebuggingNewOperator
  4280. private:
  4281. // alternating start/end values of ranges of values that are present.
  4282. Array<Type, DummyCriticalSection> values;
  4283. void simplify() throw()
  4284. {
  4285. jassert ((values.size() & 1) == 0);
  4286. for (int i = values.size(); --i > 0;)
  4287. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4288. values.removeRange (i - 1, 2);
  4289. }
  4290. };
  4291. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4292. /*** End of inlined file: juce_SparseSet.h ***/
  4293. #endif
  4294. #ifndef __JUCE_VALUE_JUCEHEADER__
  4295. /*** Start of inlined file: juce_Value.h ***/
  4296. #ifndef __JUCE_VALUE_JUCEHEADER__
  4297. #define __JUCE_VALUE_JUCEHEADER__
  4298. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4299. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4300. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4301. /*** Start of inlined file: juce_MessageListener.h ***/
  4302. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4303. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4304. /*** Start of inlined file: juce_Message.h ***/
  4305. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4306. #define __JUCE_MESSAGE_JUCEHEADER__
  4307. class MessageListener;
  4308. class MessageManager;
  4309. class JUCE_API Message
  4310. {
  4311. public:
  4312. Message() throw();
  4313. Message (const int intParameter1,
  4314. const int intParameter2,
  4315. const int intParameter3,
  4316. void* const pointerParameter) throw();
  4317. virtual ~Message() throw();
  4318. // These values can be used for carrying simple data that the application needs to
  4319. // pass around. For more complex messages, just create a subclass.
  4320. int intParameter1; /**< user-defined integer value. */
  4321. int intParameter2; /**< user-defined integer value. */
  4322. int intParameter3; /**< user-defined integer value. */
  4323. void* pointerParameter; /**< user-defined pointer value. */
  4324. juce_UseDebuggingNewOperator
  4325. private:
  4326. friend class MessageListener;
  4327. friend class MessageManager;
  4328. MessageListener* messageRecipient;
  4329. Message (const Message&);
  4330. Message& operator= (const Message&);
  4331. };
  4332. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4333. /*** End of inlined file: juce_Message.h ***/
  4334. class JUCE_API MessageListener
  4335. {
  4336. protected:
  4337. MessageListener() throw();
  4338. public:
  4339. virtual ~MessageListener();
  4340. virtual void handleMessage (const Message& message) = 0;
  4341. void postMessage (Message* const message) const throw();
  4342. bool isValidMessageListener() const throw();
  4343. };
  4344. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4345. /*** End of inlined file: juce_MessageListener.h ***/
  4346. class JUCE_API AsyncUpdater
  4347. {
  4348. public:
  4349. AsyncUpdater() throw();
  4350. virtual ~AsyncUpdater();
  4351. void triggerAsyncUpdate() throw();
  4352. void cancelPendingUpdate() throw();
  4353. void handleUpdateNowIfNeeded();
  4354. virtual void handleAsyncUpdate() = 0;
  4355. private:
  4356. class AsyncUpdaterInternal : public MessageListener
  4357. {
  4358. public:
  4359. AsyncUpdaterInternal() throw() {}
  4360. ~AsyncUpdaterInternal() {}
  4361. void handleMessage (const Message&);
  4362. AsyncUpdater* owner;
  4363. private:
  4364. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4365. AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4366. };
  4367. AsyncUpdaterInternal internalAsyncHandler;
  4368. bool asyncMessagePending;
  4369. };
  4370. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4371. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4372. class JUCE_API Value
  4373. {
  4374. public:
  4375. Value();
  4376. Value (const Value& other);
  4377. Value (const var& initialValue);
  4378. ~Value();
  4379. const var getValue() const;
  4380. operator const var() const;
  4381. const String toString() const;
  4382. void setValue (const var& newValue);
  4383. Value& operator= (const var& newValue);
  4384. void referTo (const Value& valueToReferTo);
  4385. bool refersToSameSourceAs (const Value& other) const;
  4386. bool operator== (const Value& other) const;
  4387. bool operator!= (const Value& other) const;
  4388. class JUCE_API Listener
  4389. {
  4390. public:
  4391. Listener() {}
  4392. virtual ~Listener() {}
  4393. virtual void valueChanged (Value& value) = 0;
  4394. };
  4395. void addListener (Listener* const listener);
  4396. void removeListener (Listener* const listener);
  4397. class JUCE_API ValueSource : public ReferenceCountedObject,
  4398. public AsyncUpdater
  4399. {
  4400. public:
  4401. ValueSource();
  4402. virtual ~ValueSource();
  4403. virtual const var getValue() const = 0;
  4404. virtual void setValue (const var& newValue) = 0;
  4405. void sendChangeMessage (const bool dispatchSynchronously);
  4406. juce_UseDebuggingNewOperator
  4407. protected:
  4408. friend class Value;
  4409. SortedSet <Value*> valuesWithListeners;
  4410. void handleAsyncUpdate();
  4411. ValueSource (const ValueSource&);
  4412. ValueSource& operator= (const ValueSource&);
  4413. };
  4414. explicit Value (ValueSource* const valueSource);
  4415. ValueSource& getValueSource() { return *value; }
  4416. juce_UseDebuggingNewOperator
  4417. private:
  4418. friend class ValueSource;
  4419. ReferenceCountedObjectPtr <ValueSource> value;
  4420. SortedSet <Listener*> listeners;
  4421. void callListeners();
  4422. // This is disallowed to avoid confusion about whether it should
  4423. // do a by-value or by-reference copy.
  4424. Value& operator= (const Value& other);
  4425. };
  4426. #endif // __JUCE_VALUE_JUCEHEADER__
  4427. /*** End of inlined file: juce_Value.h ***/
  4428. #endif
  4429. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4430. /*** Start of inlined file: juce_ValueTree.h ***/
  4431. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4432. #define __JUCE_VALUETREE_JUCEHEADER__
  4433. /*** Start of inlined file: juce_UndoManager.h ***/
  4434. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4435. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4436. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4437. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4438. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4439. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4440. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4441. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4442. /*** Start of inlined file: juce_ChangeListener.h ***/
  4443. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4444. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4445. class JUCE_API ChangeListener
  4446. {
  4447. public:
  4448. virtual ~ChangeListener() {}
  4449. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4450. };
  4451. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4452. /*** End of inlined file: juce_ChangeListener.h ***/
  4453. /*** Start of inlined file: juce_ScopedLock.h ***/
  4454. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4455. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4456. class JUCE_API ScopedLock
  4457. {
  4458. public:
  4459. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4460. inline ~ScopedLock() throw() { lock_.exit(); }
  4461. private:
  4462. const CriticalSection& lock_;
  4463. ScopedLock (const ScopedLock&);
  4464. ScopedLock& operator= (const ScopedLock&);
  4465. };
  4466. class ScopedUnlock
  4467. {
  4468. public:
  4469. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4470. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4471. private:
  4472. const CriticalSection& lock_;
  4473. ScopedUnlock (const ScopedLock&);
  4474. ScopedUnlock& operator= (const ScopedUnlock&);
  4475. };
  4476. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4477. /*** End of inlined file: juce_ScopedLock.h ***/
  4478. class JUCE_API ChangeListenerList : public MessageListener
  4479. {
  4480. public:
  4481. ChangeListenerList() throw();
  4482. ~ChangeListenerList() throw();
  4483. void addChangeListener (ChangeListener* const listener) throw();
  4484. void removeChangeListener (ChangeListener* const listener) throw();
  4485. void removeAllChangeListeners() throw();
  4486. void sendChangeMessage (void* objectThatHasChanged) throw();
  4487. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4488. void dispatchPendingMessages();
  4489. void handleMessage (const Message&);
  4490. juce_UseDebuggingNewOperator
  4491. private:
  4492. SortedSet <void*> listeners;
  4493. CriticalSection lock;
  4494. void* lastChangedObject;
  4495. bool messagePending;
  4496. ChangeListenerList (const ChangeListenerList&);
  4497. ChangeListenerList& operator= (const ChangeListenerList&);
  4498. };
  4499. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4500. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4501. class JUCE_API ChangeBroadcaster
  4502. {
  4503. public:
  4504. ChangeBroadcaster() throw();
  4505. virtual ~ChangeBroadcaster();
  4506. void addChangeListener (ChangeListener* const listener) throw();
  4507. void removeChangeListener (ChangeListener* const listener) throw();
  4508. void removeAllChangeListeners() throw();
  4509. void sendChangeMessage (void* objectThatHasChanged) throw();
  4510. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4511. void dispatchPendingMessages();
  4512. private:
  4513. ChangeListenerList changeListenerList;
  4514. ChangeBroadcaster (const ChangeBroadcaster&);
  4515. ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4516. };
  4517. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4518. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4519. /*** Start of inlined file: juce_UndoableAction.h ***/
  4520. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4521. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4522. class JUCE_API UndoableAction
  4523. {
  4524. protected:
  4525. UndoableAction() throw() {}
  4526. public:
  4527. virtual ~UndoableAction() {}
  4528. virtual bool perform() = 0;
  4529. virtual bool undo() = 0;
  4530. virtual int getSizeInUnits() { return 10; }
  4531. };
  4532. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4533. /*** End of inlined file: juce_UndoableAction.h ***/
  4534. class JUCE_API UndoManager : public ChangeBroadcaster
  4535. {
  4536. public:
  4537. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4538. const int minimumTransactionsToKeep = 30);
  4539. ~UndoManager();
  4540. void clearUndoHistory();
  4541. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4542. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4543. const int minimumTransactionsToKeep);
  4544. bool perform (UndoableAction* const action,
  4545. const String& actionName = String::empty);
  4546. void beginNewTransaction (const String& actionName = String::empty);
  4547. void setCurrentTransactionName (const String& newName);
  4548. bool canUndo() const;
  4549. const String getUndoDescription() const;
  4550. bool undo();
  4551. bool undoCurrentTransactionOnly();
  4552. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4553. int getNumActionsInCurrentTransaction() const;
  4554. bool canRedo() const;
  4555. const String getRedoDescription() const;
  4556. bool redo();
  4557. juce_UseDebuggingNewOperator
  4558. private:
  4559. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4560. StringArray transactionNames;
  4561. String currentTransactionName;
  4562. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4563. bool newTransaction, reentrancyCheck;
  4564. // disallow copy constructor
  4565. UndoManager (const UndoManager&);
  4566. UndoManager& operator= (const UndoManager&);
  4567. };
  4568. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4569. /*** End of inlined file: juce_UndoManager.h ***/
  4570. class JUCE_API ValueTree
  4571. {
  4572. public:
  4573. ValueTree (const String& type);
  4574. ValueTree (const ValueTree& other);
  4575. ValueTree& operator= (const ValueTree& other);
  4576. ~ValueTree();
  4577. bool operator== (const ValueTree& other) const;
  4578. bool operator!= (const ValueTree& other) const;
  4579. bool isValid() const { return object != 0; }
  4580. ValueTree createCopy() const;
  4581. const String getType() const;
  4582. bool hasType (const String& typeName) const;
  4583. const var& getProperty (const var::identifier& name) const;
  4584. const var& operator[] (const var::identifier& name) const;
  4585. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4586. bool hasProperty (const var::identifier& name) const;
  4587. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4588. void removeAllProperties (UndoManager* const undoManager);
  4589. int getNumProperties() const;
  4590. const var::identifier getPropertyName (int index) const;
  4591. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4592. int getNumChildren() const;
  4593. ValueTree getChild (int index) const;
  4594. ValueTree getChildWithName (const String& type) const;
  4595. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4596. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4597. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4598. void removeChild (const int childIndex, UndoManager* const undoManager);
  4599. void removeAllChildren (UndoManager* const undoManager);
  4600. bool isAChildOf (const ValueTree& possibleParent) const;
  4601. ValueTree getParent() const;
  4602. XmlElement* createXml() const;
  4603. static ValueTree fromXml (const XmlElement& xml);
  4604. void writeToStream (OutputStream& output);
  4605. static ValueTree readFromStream (InputStream& input);
  4606. class JUCE_API Listener
  4607. {
  4608. public:
  4609. virtual ~Listener() {}
  4610. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4611. const var::identifier& property) = 0;
  4612. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4613. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4614. };
  4615. void addListener (Listener* listener);
  4616. void removeListener (Listener* listener);
  4617. template <typename ElementComparator>
  4618. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4619. {
  4620. if (object != 0)
  4621. {
  4622. ComparatorAdapter <ElementComparator> adapter (comparator);
  4623. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4624. object->sendChildChangeMessage();
  4625. }
  4626. }
  4627. juce_UseDebuggingNewOperator
  4628. private:
  4629. friend class ValueTreeSetPropertyAction;
  4630. friend class ValueTreeChildChangeAction;
  4631. class JUCE_API SharedObject : public ReferenceCountedObject
  4632. {
  4633. public:
  4634. SharedObject (const String& type);
  4635. SharedObject (const SharedObject& other);
  4636. ~SharedObject();
  4637. const String type;
  4638. NamedValueSet properties;
  4639. ReferenceCountedArray <SharedObject> children;
  4640. SortedSet <ValueTree*> valueTreesWithListeners;
  4641. SharedObject* parent;
  4642. void sendPropertyChangeMessage (const var::identifier& property);
  4643. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4644. void sendChildChangeMessage();
  4645. void sendChildChangeMessage (ValueTree& tree);
  4646. void sendParentChangeMessage();
  4647. const var& getProperty (const var::identifier& name) const;
  4648. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4649. bool hasProperty (const var::identifier& name) const;
  4650. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4651. void removeAllProperties (UndoManager* const undoManager);
  4652. bool isAChildOf (const SharedObject* const possibleParent) const;
  4653. ValueTree getChildWithName (const String& type) const;
  4654. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4655. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4656. void removeChild (const int childIndex, UndoManager* const undoManager);
  4657. void removeAllChildren (UndoManager* const undoManager);
  4658. XmlElement* createXml() const;
  4659. juce_UseDebuggingNewOperator
  4660. private:
  4661. SharedObject& operator= (const SharedObject&);
  4662. };
  4663. template <typename ElementComparator>
  4664. class ComparatorAdapter
  4665. {
  4666. public:
  4667. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4668. int compareElements (SharedObject* const first, SharedObject* const second)
  4669. {
  4670. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4671. }
  4672. private:
  4673. ElementComparator& comparator;
  4674. };
  4675. friend class SharedObject;
  4676. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4677. ReferenceCountedObjectPtr <SharedObject> object;
  4678. SortedSet <Listener*> listeners;
  4679. void deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4680. void deliverChildChangeMessage (ValueTree& tree);
  4681. void deliverParentChangeMessage (ValueTree& tree);
  4682. ValueTree (SharedObject* const object_);
  4683. };
  4684. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4685. /*** End of inlined file: juce_ValueTree.h ***/
  4686. #endif
  4687. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4688. #endif
  4689. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4690. /*** Start of inlined file: juce_VoidArray.h ***/
  4691. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4692. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4693. typedef Array <void*> VoidArray;
  4694. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4695. /*** End of inlined file: juce_VoidArray.h ***/
  4696. #endif
  4697. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4698. #endif
  4699. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4700. #endif
  4701. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4702. /*** Start of inlined file: juce_FileLogger.h ***/
  4703. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4704. #define __JUCE_FILELOGGER_JUCEHEADER__
  4705. class JUCE_API FileLogger : public Logger
  4706. {
  4707. public:
  4708. FileLogger (const File& fileToWriteTo,
  4709. const String& welcomeMessage,
  4710. const int maxInitialFileSizeBytes = 128 * 1024);
  4711. ~FileLogger();
  4712. void logMessage (const String& message);
  4713. const File getLogFile() const { return logFile; }
  4714. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4715. const String& logFileName,
  4716. const String& welcomeMessage,
  4717. const int maxInitialFileSizeBytes = 128 * 1024);
  4718. juce_UseDebuggingNewOperator
  4719. private:
  4720. File logFile;
  4721. CriticalSection logLock;
  4722. ScopedPointer <FileOutputStream> logStream;
  4723. void trimFileSize (int maxFileSizeBytes) const;
  4724. FileLogger (const FileLogger&);
  4725. FileLogger& operator= (const FileLogger&);
  4726. };
  4727. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4728. /*** End of inlined file: juce_FileLogger.h ***/
  4729. #endif
  4730. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4731. /*** Start of inlined file: juce_Initialisation.h ***/
  4732. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4733. #define __JUCE_INITIALISATION_JUCEHEADER__
  4734. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4735. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4736. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4737. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4738. class ScopedJuceInitialiser_NonGUI
  4739. {
  4740. public:
  4741. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4742. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4743. };
  4744. class ScopedJuceInitialiser_GUI
  4745. {
  4746. public:
  4747. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4748. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4749. };
  4750. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4751. /*** End of inlined file: juce_Initialisation.h ***/
  4752. #endif
  4753. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4754. #endif
  4755. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4756. #endif
  4757. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4758. #endif
  4759. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4760. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4761. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4762. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4763. class JUCE_API PerformanceCounter
  4764. {
  4765. public:
  4766. PerformanceCounter (const String& counterName,
  4767. int runsPerPrintout = 100,
  4768. const File& loggingFile = File::nonexistent);
  4769. ~PerformanceCounter();
  4770. void start();
  4771. void stop();
  4772. void printStatistics();
  4773. juce_UseDebuggingNewOperator
  4774. private:
  4775. String name;
  4776. int numRuns, runsPerPrint;
  4777. double totalTime;
  4778. int64 started;
  4779. File outputFile;
  4780. };
  4781. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4782. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4783. #endif
  4784. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4785. #endif
  4786. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4787. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4788. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4789. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4790. class JUCE_API PlatformUtilities
  4791. {
  4792. public:
  4793. static void beep();
  4794. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4795. const String& emailSubject,
  4796. const String& bodyText,
  4797. const StringArray& filesToAttach);
  4798. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4799. static const String cfStringToJuceString (CFStringRef cfString);
  4800. static CFStringRef juceStringToCFString (const String& s);
  4801. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4802. static const String makePathFromFSRef (FSRef* file);
  4803. static const String convertToPrecomposedUnicode (const String& s);
  4804. static OSType getTypeOfFile (const String& filename);
  4805. static bool isBundle (const String& filename);
  4806. static void addItemToDock (const File& file);
  4807. static int getOSXMinorVersionNumber();
  4808. #endif
  4809. #if JUCE_WINDOWS || DOXYGEN
  4810. // Some registry helper functions:
  4811. static const String getRegistryValue (const String& regValuePath,
  4812. const String& defaultValue = String::empty);
  4813. static void setRegistryValue (const String& regValuePath,
  4814. const String& value);
  4815. static bool registryValueExists (const String& regValuePath);
  4816. static void deleteRegistryValue (const String& regValuePath);
  4817. static void deleteRegistryKey (const String& regKeyPath);
  4818. static void registerFileAssociation (const String& fileExtension,
  4819. const String& symbolicDescription,
  4820. const String& fullDescription,
  4821. const File& targetExecutable,
  4822. int iconResourceNumber);
  4823. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  4824. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  4825. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  4826. #endif
  4827. static void fpuReset();
  4828. #if JUCE_LINUX || JUCE_WINDOWS
  4829. static void* loadDynamicLibrary (const String& pathOrFilename);
  4830. static void freeDynamicLibrary (void* libraryHandle);
  4831. static void* getProcedureEntryPoint (void* libraryHandle,
  4832. const String& procedureName);
  4833. #endif
  4834. #if JUCE_LINUX || DOXYGEN
  4835. #endif
  4836. };
  4837. #if JUCE_MAC || JUCE_IPHONE
  4838. class ScopedAutoReleasePool
  4839. {
  4840. public:
  4841. ScopedAutoReleasePool();
  4842. ~ScopedAutoReleasePool();
  4843. private:
  4844. void* pool;
  4845. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  4846. ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  4847. };
  4848. #endif
  4849. #if JUCE_LINUX
  4850. class ScopedXLock
  4851. {
  4852. public:
  4853. ScopedXLock();
  4854. ~ScopedXLock();
  4855. };
  4856. #endif
  4857. #if JUCE_MAC
  4858. class JUCE_API AppleRemoteDevice
  4859. {
  4860. public:
  4861. AppleRemoteDevice();
  4862. virtual ~AppleRemoteDevice();
  4863. enum ButtonType
  4864. {
  4865. menuButton = 0, /**< The menu button (if it's held for a short time). */
  4866. playButton, /**< The play button. */
  4867. plusButton, /**< The plus or volume-up button. */
  4868. minusButton, /**< The minus or volume-down button. */
  4869. rightButton, /**< The right button (if it's held for a short time). */
  4870. leftButton, /**< The left button (if it's held for a short time). */
  4871. rightButton_Long, /**< The right button (if it's held for a long time). */
  4872. leftButton_Long, /**< The menu button (if it's held for a long time). */
  4873. menuButton_Long, /**< The menu button (if it's held for a long time). */
  4874. playButtonSleepMode,
  4875. switched
  4876. };
  4877. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  4878. bool start (const bool inExclusiveMode);
  4879. void stop();
  4880. bool isActive() const;
  4881. int getRemoteId() const { return remoteId; }
  4882. juce_UseDebuggingNewOperator
  4883. void handleCallbackInternal();
  4884. private:
  4885. void* device;
  4886. void* queue;
  4887. int remoteId;
  4888. bool open (const bool openInExclusiveMode);
  4889. AppleRemoteDevice (const AppleRemoteDevice&);
  4890. AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  4891. };
  4892. #endif
  4893. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4894. /*** End of inlined file: juce_PlatformUtilities.h ***/
  4895. #endif
  4896. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4897. /*** Start of inlined file: juce_Random.h ***/
  4898. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4899. #define __JUCE_RANDOM_JUCEHEADER__
  4900. class JUCE_API Random
  4901. {
  4902. public:
  4903. Random (const int64 seedValue) throw();
  4904. ~Random() throw();
  4905. int nextInt() throw();
  4906. int nextInt (const int maxValue) throw();
  4907. int64 nextInt64() throw();
  4908. float nextFloat() throw();
  4909. double nextDouble() throw();
  4910. bool nextBool() throw();
  4911. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  4912. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  4913. static Random& getSystemRandom() throw();
  4914. void setSeed (const int64 newSeed) throw();
  4915. void combineSeed (const int64 seedValue) throw();
  4916. void setSeedRandomly();
  4917. juce_UseDebuggingNewOperator
  4918. private:
  4919. int64 seed;
  4920. };
  4921. #endif // __JUCE_RANDOM_JUCEHEADER__
  4922. /*** End of inlined file: juce_Random.h ***/
  4923. #endif
  4924. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  4925. #endif
  4926. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  4927. /*** Start of inlined file: juce_Singleton.h ***/
  4928. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  4929. #define __JUCE_SINGLETON_JUCEHEADER__
  4930. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  4931. \
  4932. static classname* _singletonInstance; \
  4933. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  4934. \
  4935. static classname* getInstance() \
  4936. { \
  4937. if (_singletonInstance == 0) \
  4938. {\
  4939. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  4940. \
  4941. if (_singletonInstance == 0) \
  4942. { \
  4943. static bool alreadyInside = false; \
  4944. static bool createdOnceAlready = false; \
  4945. \
  4946. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  4947. jassert (! problem); \
  4948. if (! problem) \
  4949. { \
  4950. createdOnceAlready = true; \
  4951. alreadyInside = true; \
  4952. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  4953. alreadyInside = false; \
  4954. \
  4955. _singletonInstance = newObject; \
  4956. } \
  4957. } \
  4958. } \
  4959. \
  4960. return _singletonInstance; \
  4961. } \
  4962. \
  4963. static inline classname* getInstanceWithoutCreating() throw() \
  4964. { \
  4965. return _singletonInstance; \
  4966. } \
  4967. \
  4968. static void deleteInstance() \
  4969. { \
  4970. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  4971. if (_singletonInstance != 0) \
  4972. { \
  4973. classname* const old = _singletonInstance; \
  4974. _singletonInstance = 0; \
  4975. delete old; \
  4976. } \
  4977. } \
  4978. \
  4979. void clearSingletonInstance() throw() \
  4980. { \
  4981. if (_singletonInstance == this) \
  4982. _singletonInstance = 0; \
  4983. }
  4984. #define juce_ImplementSingleton(classname) \
  4985. \
  4986. classname* classname::_singletonInstance = 0; \
  4987. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  4988. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  4989. \
  4990. static classname* _singletonInstance; \
  4991. \
  4992. static classname* getInstance() \
  4993. { \
  4994. if (_singletonInstance == 0) \
  4995. { \
  4996. static bool alreadyInside = false; \
  4997. static bool createdOnceAlready = false; \
  4998. \
  4999. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5000. jassert (! problem); \
  5001. if (! problem) \
  5002. { \
  5003. createdOnceAlready = true; \
  5004. alreadyInside = true; \
  5005. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5006. alreadyInside = false; \
  5007. \
  5008. _singletonInstance = newObject; \
  5009. } \
  5010. } \
  5011. \
  5012. return _singletonInstance; \
  5013. } \
  5014. \
  5015. static inline classname* getInstanceWithoutCreating() throw() \
  5016. { \
  5017. return _singletonInstance; \
  5018. } \
  5019. \
  5020. static void deleteInstance() \
  5021. { \
  5022. if (_singletonInstance != 0) \
  5023. { \
  5024. classname* const old = _singletonInstance; \
  5025. _singletonInstance = 0; \
  5026. delete old; \
  5027. } \
  5028. } \
  5029. \
  5030. void clearSingletonInstance() throw() \
  5031. { \
  5032. if (_singletonInstance == this) \
  5033. _singletonInstance = 0; \
  5034. }
  5035. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5036. \
  5037. static classname* _singletonInstance; \
  5038. \
  5039. static classname* getInstance() \
  5040. { \
  5041. if (_singletonInstance == 0) \
  5042. _singletonInstance = new classname(); \
  5043. \
  5044. return _singletonInstance; \
  5045. } \
  5046. \
  5047. static inline classname* getInstanceWithoutCreating() throw() \
  5048. { \
  5049. return _singletonInstance; \
  5050. } \
  5051. \
  5052. static void deleteInstance() \
  5053. { \
  5054. if (_singletonInstance != 0) \
  5055. { \
  5056. classname* const old = _singletonInstance; \
  5057. _singletonInstance = 0; \
  5058. delete old; \
  5059. } \
  5060. } \
  5061. \
  5062. void clearSingletonInstance() throw() \
  5063. { \
  5064. if (_singletonInstance == this) \
  5065. _singletonInstance = 0; \
  5066. }
  5067. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5068. \
  5069. classname* classname::_singletonInstance = 0;
  5070. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5071. /*** End of inlined file: juce_Singleton.h ***/
  5072. #endif
  5073. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5074. #endif
  5075. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5076. /*** Start of inlined file: juce_SystemStats.h ***/
  5077. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5078. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5079. class JUCE_API SystemStats
  5080. {
  5081. public:
  5082. static const String getJUCEVersion() throw();
  5083. enum OperatingSystemType
  5084. {
  5085. UnknownOS = 0,
  5086. MacOSX = 0x1000,
  5087. Linux = 0x2000,
  5088. Win95 = 0x4001,
  5089. Win98 = 0x4002,
  5090. WinNT351 = 0x4103,
  5091. WinNT40 = 0x4104,
  5092. Win2000 = 0x4105,
  5093. WinXP = 0x4106,
  5094. WinVista = 0x4107,
  5095. Windows7 = 0x4108,
  5096. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5097. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5098. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5099. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5100. };
  5101. static OperatingSystemType getOperatingSystemType() throw();
  5102. static const String getOperatingSystemName() throw();
  5103. static bool isOperatingSystem64Bit() throw();
  5104. static const String getLogonName();
  5105. static const String getFullUserName();
  5106. // CPU and memory information..
  5107. static int getCpuSpeedInMegaherz() throw();
  5108. static const String getCpuVendor() throw();
  5109. static bool hasMMX() throw();
  5110. static bool hasSSE() throw();
  5111. static bool hasSSE2() throw();
  5112. static bool has3DNow() throw();
  5113. static int getNumCpus() throw();
  5114. static int64 getClockCycleCounter() throw();
  5115. static int getMemorySizeInMegabytes() throw();
  5116. static int getPageSize() throw();
  5117. static int getMACAddresses (int64* addresses, int maxNum,
  5118. #if JUCE_MAC
  5119. const bool littleEndian = true) throw();
  5120. #else
  5121. const bool littleEndian = false) throw();
  5122. #endif
  5123. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5124. static void initialiseStats() throw();
  5125. };
  5126. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5127. /*** End of inlined file: juce_SystemStats.h ***/
  5128. #endif
  5129. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5130. #endif
  5131. #ifndef __JUCE_TIME_JUCEHEADER__
  5132. #endif
  5133. #ifndef __JUCE_UUID_JUCEHEADER__
  5134. /*** Start of inlined file: juce_Uuid.h ***/
  5135. #ifndef __JUCE_UUID_JUCEHEADER__
  5136. #define __JUCE_UUID_JUCEHEADER__
  5137. class JUCE_API Uuid
  5138. {
  5139. public:
  5140. Uuid();
  5141. ~Uuid() throw();
  5142. Uuid (const Uuid& other);
  5143. Uuid& operator= (const Uuid& other);
  5144. bool isNull() const throw();
  5145. bool operator== (const Uuid& other) const;
  5146. bool operator!= (const Uuid& other) const;
  5147. const String toString() const;
  5148. Uuid (const String& uuidString);
  5149. Uuid& operator= (const String& uuidString);
  5150. const uint8* getRawData() const throw() { return value.asBytes; }
  5151. Uuid (const uint8* const rawData);
  5152. Uuid& operator= (const uint8* const rawData);
  5153. juce_UseDebuggingNewOperator
  5154. private:
  5155. union
  5156. {
  5157. uint8 asBytes [16];
  5158. int asInt[4];
  5159. int64 asInt64[2];
  5160. } value;
  5161. };
  5162. #endif // __JUCE_UUID_JUCEHEADER__
  5163. /*** End of inlined file: juce_Uuid.h ***/
  5164. #endif
  5165. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5166. /*** Start of inlined file: juce_BlowFish.h ***/
  5167. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5168. #define __JUCE_BLOWFISH_JUCEHEADER__
  5169. class JUCE_API BlowFish
  5170. {
  5171. public:
  5172. BlowFish (const uint8* keyData, int keyBytes);
  5173. BlowFish (const BlowFish& other);
  5174. BlowFish& operator= (const BlowFish& other);
  5175. ~BlowFish();
  5176. void encrypt (uint32& data1, uint32& data2) const;
  5177. void decrypt (uint32& data1, uint32& data2) const;
  5178. juce_UseDebuggingNewOperator
  5179. private:
  5180. uint32 p[18];
  5181. HeapBlock <uint32> s[4];
  5182. uint32 F (uint32 x) const;
  5183. };
  5184. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5185. /*** End of inlined file: juce_BlowFish.h ***/
  5186. #endif
  5187. #ifndef __JUCE_MD5_JUCEHEADER__
  5188. /*** Start of inlined file: juce_MD5.h ***/
  5189. #ifndef __JUCE_MD5_JUCEHEADER__
  5190. #define __JUCE_MD5_JUCEHEADER__
  5191. class JUCE_API MD5
  5192. {
  5193. public:
  5194. MD5();
  5195. MD5 (const MD5& other);
  5196. MD5& operator= (const MD5& other);
  5197. MD5 (const MemoryBlock& data);
  5198. MD5 (const char* data, const size_t numBytes);
  5199. MD5 (const String& text);
  5200. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5201. MD5 (const File& file);
  5202. ~MD5();
  5203. const MemoryBlock getRawChecksumData() const;
  5204. const String toHexString() const;
  5205. bool operator== (const MD5& other) const;
  5206. bool operator!= (const MD5& other) const;
  5207. juce_UseDebuggingNewOperator
  5208. private:
  5209. uint8 result [16];
  5210. struct ProcessContext
  5211. {
  5212. uint8 buffer [64];
  5213. uint32 state [4];
  5214. uint32 count [2];
  5215. ProcessContext();
  5216. void processBlock (const uint8* const data, size_t dataSize);
  5217. void transform (const uint8* const buffer);
  5218. void finish (uint8* const result);
  5219. };
  5220. void processStream (InputStream& input, int64 numBytesToRead);
  5221. };
  5222. #endif // __JUCE_MD5_JUCEHEADER__
  5223. /*** End of inlined file: juce_MD5.h ***/
  5224. #endif
  5225. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5226. /*** Start of inlined file: juce_Primes.h ***/
  5227. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5228. #define __JUCE_PRIMES_JUCEHEADER__
  5229. class JUCE_API Primes
  5230. {
  5231. public:
  5232. static const BitArray createProbablePrime (int bitLength,
  5233. int certainty,
  5234. const int* randomSeeds = 0,
  5235. int numRandomSeeds = 0) throw();
  5236. static bool isProbablyPrime (const BitArray& number,
  5237. int certainty) throw();
  5238. };
  5239. #endif // __JUCE_PRIMES_JUCEHEADER__
  5240. /*** End of inlined file: juce_Primes.h ***/
  5241. #endif
  5242. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5243. /*** Start of inlined file: juce_RSAKey.h ***/
  5244. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5245. #define __JUCE_RSAKEY_JUCEHEADER__
  5246. class JUCE_API RSAKey
  5247. {
  5248. public:
  5249. RSAKey() throw();
  5250. RSAKey (const String& stringRepresentation) throw();
  5251. ~RSAKey() throw();
  5252. const String toString() const throw();
  5253. bool applyToValue (BitArray& value) const throw();
  5254. static void createKeyPair (RSAKey& publicKey,
  5255. RSAKey& privateKey,
  5256. const int numBits,
  5257. const int* randomSeeds = 0,
  5258. const int numRandomSeeds = 0) throw();
  5259. juce_UseDebuggingNewOperator
  5260. protected:
  5261. BitArray part1, part2;
  5262. };
  5263. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5264. /*** End of inlined file: juce_RSAKey.h ***/
  5265. #endif
  5266. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5267. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5268. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5269. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5270. class JUCE_API DirectoryIterator
  5271. {
  5272. public:
  5273. DirectoryIterator (const File& directory,
  5274. bool isRecursive,
  5275. const String& wildCard = JUCE_T("*"),
  5276. const int whatToLookFor = File::findFiles);
  5277. ~DirectoryIterator();
  5278. bool next();
  5279. const File getFile() const;
  5280. float getEstimatedProgress() const;
  5281. juce_UseDebuggingNewOperator
  5282. private:
  5283. Array <File> filesFound;
  5284. Array <File> dirsFound;
  5285. String wildCard;
  5286. int index;
  5287. const int whatToLookFor;
  5288. ScopedPointer <DirectoryIterator> subIterator;
  5289. DirectoryIterator (const DirectoryIterator&);
  5290. DirectoryIterator& operator= (const DirectoryIterator&);
  5291. };
  5292. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5293. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5294. #endif
  5295. #ifndef __JUCE_FILE_JUCEHEADER__
  5296. #endif
  5297. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5298. /*** Start of inlined file: juce_FileInputStream.h ***/
  5299. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5300. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5301. class JUCE_API FileInputStream : public InputStream
  5302. {
  5303. public:
  5304. FileInputStream (const File& fileToRead);
  5305. ~FileInputStream();
  5306. const File& getFile() const throw() { return file; }
  5307. int64 getTotalLength();
  5308. int read (void* destBuffer, int maxBytesToRead);
  5309. bool isExhausted();
  5310. int64 getPosition();
  5311. bool setPosition (int64 pos);
  5312. juce_UseDebuggingNewOperator
  5313. private:
  5314. File file;
  5315. void* fileHandle;
  5316. int64 currentPosition, totalSize;
  5317. bool needToSeek;
  5318. FileInputStream (const FileInputStream&);
  5319. FileInputStream& operator= (const FileInputStream&);
  5320. };
  5321. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5322. /*** End of inlined file: juce_FileInputStream.h ***/
  5323. #endif
  5324. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5325. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5326. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5327. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5328. class JUCE_API FileOutputStream : public OutputStream
  5329. {
  5330. public:
  5331. FileOutputStream (const File& fileToWriteTo,
  5332. const int bufferSizeToUse = 16384);
  5333. ~FileOutputStream();
  5334. const File& getFile() const { return file; }
  5335. bool failedToOpen() const { return fileHandle == 0; }
  5336. void flush();
  5337. int64 getPosition();
  5338. bool setPosition (int64 pos);
  5339. bool write (const void* data, int numBytes);
  5340. juce_UseDebuggingNewOperator
  5341. private:
  5342. File file;
  5343. void* fileHandle;
  5344. int64 currentPosition;
  5345. int bufferSize, bytesInBuffer;
  5346. HeapBlock <char> buffer;
  5347. };
  5348. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5349. /*** End of inlined file: juce_FileOutputStream.h ***/
  5350. #endif
  5351. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5352. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5353. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5354. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5355. class JUCE_API FileSearchPath
  5356. {
  5357. public:
  5358. FileSearchPath();
  5359. FileSearchPath (const String& path);
  5360. FileSearchPath (const FileSearchPath& other);
  5361. ~FileSearchPath();
  5362. FileSearchPath& operator= (const String& path);
  5363. int getNumPaths() const;
  5364. const File operator[] (const int index) const;
  5365. const String toString() const;
  5366. void add (const File& directoryToAdd,
  5367. const int insertIndex = -1);
  5368. void addIfNotAlreadyThere (const File& directoryToAdd);
  5369. void remove (const int indexToRemove);
  5370. void addPath (const FileSearchPath& other);
  5371. void removeRedundantPaths();
  5372. void removeNonExistentPaths();
  5373. int findChildFiles (Array<File>& results,
  5374. const int whatToLookFor,
  5375. const bool searchRecursively,
  5376. const String& wildCardPattern = JUCE_T("*")) const;
  5377. bool isFileInPath (const File& fileToCheck,
  5378. const bool checkRecursively) const;
  5379. juce_UseDebuggingNewOperator
  5380. private:
  5381. StringArray directories;
  5382. void init (const String& path);
  5383. };
  5384. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5385. /*** End of inlined file: juce_FileSearchPath.h ***/
  5386. #endif
  5387. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5388. /*** Start of inlined file: juce_NamedPipe.h ***/
  5389. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5390. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5391. class JUCE_API NamedPipe
  5392. {
  5393. public:
  5394. NamedPipe();
  5395. ~NamedPipe();
  5396. bool openExisting (const String& pipeName);
  5397. bool createNewPipe (const String& pipeName);
  5398. void close();
  5399. bool isOpen() const;
  5400. const String getName() const;
  5401. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5402. int write (const void* sourceBuffer, int numBytesToWrite,
  5403. int timeOutMilliseconds = 2000);
  5404. void cancelPendingReads();
  5405. juce_UseDebuggingNewOperator
  5406. private:
  5407. void* internal;
  5408. String currentPipeName;
  5409. NamedPipe (const NamedPipe&);
  5410. NamedPipe& operator= (const NamedPipe&);
  5411. bool openInternal (const String& pipeName, const bool createPipe);
  5412. };
  5413. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5414. /*** End of inlined file: juce_NamedPipe.h ***/
  5415. #endif
  5416. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5417. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5418. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5419. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5420. class JUCE_API TemporaryFile
  5421. {
  5422. public:
  5423. enum OptionFlags
  5424. {
  5425. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5426. i.e. its name should start with a dot. */
  5427. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5428. the file is unique, they should go in brackets rather
  5429. than just being appended (see File::getNonexistentSibling() )*/
  5430. };
  5431. TemporaryFile (const String& suffix = String::empty,
  5432. const int optionFlags = 0);
  5433. TemporaryFile (const File& targetFile,
  5434. const int optionFlags = 0);
  5435. ~TemporaryFile();
  5436. const File getFile() const { return temporaryFile; }
  5437. const File getTargetFile() const { return targetFile; }
  5438. bool overwriteTargetFileWithTemporary() const;
  5439. juce_UseDebuggingNewOperator
  5440. private:
  5441. File temporaryFile, targetFile;
  5442. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5443. TemporaryFile (const TemporaryFile&);
  5444. TemporaryFile& operator= (const TemporaryFile&);
  5445. };
  5446. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5447. /*** End of inlined file: juce_TemporaryFile.h ***/
  5448. #endif
  5449. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5450. /*** Start of inlined file: juce_ZipFile.h ***/
  5451. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5452. #define __JUCE_ZIPFILE_JUCEHEADER__
  5453. /*** Start of inlined file: juce_InputSource.h ***/
  5454. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5455. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5456. class JUCE_API InputSource
  5457. {
  5458. public:
  5459. InputSource() throw() {}
  5460. virtual ~InputSource() {}
  5461. virtual InputStream* createInputStream() = 0;
  5462. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5463. virtual int64 hashCode() const = 0;
  5464. juce_UseDebuggingNewOperator
  5465. };
  5466. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5467. /*** End of inlined file: juce_InputSource.h ***/
  5468. class JUCE_API ZipFile
  5469. {
  5470. public:
  5471. ZipFile (InputStream* const inputStream,
  5472. const bool deleteStreamWhenDestroyed) throw();
  5473. ZipFile (const File& file);
  5474. ZipFile (InputSource* const inputSource);
  5475. ~ZipFile() throw();
  5476. struct ZipEntry
  5477. {
  5478. String filename;
  5479. unsigned int uncompressedSize;
  5480. Time fileTime;
  5481. };
  5482. int getNumEntries() const throw();
  5483. const ZipEntry* getEntry (const int index) const throw();
  5484. int getIndexOfFileName (const String& fileName) const throw();
  5485. const ZipEntry* getEntry (const String& fileName) const throw();
  5486. void sortEntriesByFilename();
  5487. InputStream* createStreamForEntry (const int index);
  5488. void uncompressTo (const File& targetDirectory,
  5489. const bool shouldOverwriteFiles = true);
  5490. juce_UseDebuggingNewOperator
  5491. private:
  5492. class ZipInputStream;
  5493. class ZipFilenameComparator;
  5494. class ZipEntryInfo;
  5495. friend class ZipInputStream;
  5496. friend class ZipFilenameComparator;
  5497. friend class ZipEntryInfo;
  5498. OwnedArray <ZipEntryInfo> entries;
  5499. CriticalSection lock;
  5500. InputStream* inputStream;
  5501. ScopedPointer <InputStream> streamToDelete;
  5502. ScopedPointer <InputSource> inputSource;
  5503. #ifdef JUCE_DEBUG
  5504. int numOpenStreams;
  5505. #endif
  5506. void init();
  5507. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5508. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5509. ZipFile (const ZipFile&);
  5510. ZipFile& operator= (const ZipFile&);
  5511. };
  5512. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5513. /*** End of inlined file: juce_ZipFile.h ***/
  5514. #endif
  5515. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5516. /*** Start of inlined file: juce_Socket.h ***/
  5517. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5518. #define __JUCE_SOCKET_JUCEHEADER__
  5519. class JUCE_API StreamingSocket
  5520. {
  5521. public:
  5522. StreamingSocket();
  5523. ~StreamingSocket();
  5524. bool bindToPort (const int localPortNumber);
  5525. bool connect (const String& remoteHostname,
  5526. const int remotePortNumber,
  5527. const int timeOutMillisecs = 3000);
  5528. bool isConnected() const throw() { return connected; }
  5529. void close();
  5530. const String& getHostName() const throw() { return hostName; }
  5531. int getPort() const throw() { return portNumber; }
  5532. bool isLocal() const throw();
  5533. int waitUntilReady (const bool readyForReading,
  5534. const int timeoutMsecs) const;
  5535. int read (void* destBuffer, const int maxBytesToRead,
  5536. const bool blockUntilSpecifiedAmountHasArrived);
  5537. int write (const void* sourceBuffer, const int numBytesToWrite);
  5538. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5539. StreamingSocket* waitForNextConnection() const;
  5540. juce_UseDebuggingNewOperator
  5541. private:
  5542. String hostName;
  5543. int volatile portNumber, handle;
  5544. bool connected, isListener;
  5545. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5546. StreamingSocket (const StreamingSocket&);
  5547. StreamingSocket& operator= (const StreamingSocket&);
  5548. };
  5549. class JUCE_API DatagramSocket
  5550. {
  5551. public:
  5552. DatagramSocket (const int localPortNumber,
  5553. const bool enableBroadcasting = false);
  5554. ~DatagramSocket();
  5555. bool bindToPort (const int localPortNumber);
  5556. bool connect (const String& remoteHostname,
  5557. const int remotePortNumber,
  5558. const int timeOutMillisecs = 3000);
  5559. bool isConnected() const throw() { return connected; }
  5560. void close();
  5561. const String& getHostName() const throw() { return hostName; }
  5562. int getPort() const throw() { return portNumber; }
  5563. bool isLocal() const throw();
  5564. int waitUntilReady (const bool readyForReading,
  5565. const int timeoutMsecs) const;
  5566. int read (void* destBuffer, const int maxBytesToRead,
  5567. const bool blockUntilSpecifiedAmountHasArrived);
  5568. int write (const void* sourceBuffer, const int numBytesToWrite);
  5569. DatagramSocket* waitForNextConnection() const;
  5570. juce_UseDebuggingNewOperator
  5571. private:
  5572. String hostName;
  5573. int volatile portNumber, handle;
  5574. bool connected, allowBroadcast;
  5575. void* serverAddress;
  5576. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5577. DatagramSocket (const DatagramSocket&);
  5578. DatagramSocket& operator= (const DatagramSocket&);
  5579. };
  5580. #endif // __JUCE_SOCKET_JUCEHEADER__
  5581. /*** End of inlined file: juce_Socket.h ***/
  5582. #endif
  5583. #ifndef __JUCE_URL_JUCEHEADER__
  5584. /*** Start of inlined file: juce_URL.h ***/
  5585. #ifndef __JUCE_URL_JUCEHEADER__
  5586. #define __JUCE_URL_JUCEHEADER__
  5587. class JUCE_API URL
  5588. {
  5589. public:
  5590. URL();
  5591. URL (const String& url);
  5592. URL (const URL& other);
  5593. ~URL();
  5594. URL& operator= (const URL& other);
  5595. const String toString (const bool includeGetParameters) const;
  5596. bool isWellFormed() const;
  5597. const String getDomain() const;
  5598. const String getSubPath() const;
  5599. const String getScheme() const;
  5600. const URL withNewSubPath (const String& newPath) const;
  5601. const URL withParameter (const String& parameterName,
  5602. const String& parameterValue) const;
  5603. const URL withFileToUpload (const String& parameterName,
  5604. const File& fileToUpload,
  5605. const String& mimeType) const;
  5606. const StringPairArray& getParameters() const;
  5607. const StringPairArray& getFilesToUpload() const;
  5608. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5609. const URL withPOSTData (const String& postData) const;
  5610. const String getPostData() const { return postData; }
  5611. bool launchInDefaultBrowser() const;
  5612. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5613. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5614. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5615. InputStream* createInputStream (const bool usePostCommand,
  5616. OpenStreamProgressCallback* const progressCallback = 0,
  5617. void* const progressCallbackContext = 0,
  5618. const String& extraHeaders = String::empty,
  5619. const int connectionTimeOutMs = 0) const;
  5620. bool readEntireBinaryStream (MemoryBlock& destData,
  5621. const bool usePostCommand = false) const;
  5622. const String readEntireTextStream (const bool usePostCommand = false) const;
  5623. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5624. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5625. const bool isParameter);
  5626. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5627. juce_UseDebuggingNewOperator
  5628. private:
  5629. String url, postData;
  5630. StringPairArray parameters, filesToUpload, mimeTypes;
  5631. };
  5632. #endif // __JUCE_URL_JUCEHEADER__
  5633. /*** End of inlined file: juce_URL.h ***/
  5634. #endif
  5635. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5636. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5637. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5638. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5639. class JUCE_API BufferedInputStream : public InputStream
  5640. {
  5641. public:
  5642. BufferedInputStream (InputStream* const sourceStream,
  5643. const int bufferSize,
  5644. const bool deleteSourceWhenDestroyed);
  5645. ~BufferedInputStream();
  5646. int64 getTotalLength();
  5647. int64 getPosition();
  5648. bool setPosition (int64 newPosition);
  5649. int read (void* destBuffer, int maxBytesToRead);
  5650. const String readString();
  5651. bool isExhausted();
  5652. juce_UseDebuggingNewOperator
  5653. private:
  5654. InputStream* const source;
  5655. ScopedPointer <InputStream> sourceToDelete;
  5656. int bufferSize;
  5657. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5658. HeapBlock <char> buffer;
  5659. void ensureBuffered();
  5660. BufferedInputStream (const BufferedInputStream&);
  5661. BufferedInputStream& operator= (const BufferedInputStream&);
  5662. };
  5663. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5664. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5665. #endif
  5666. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5667. /*** Start of inlined file: juce_FileInputSource.h ***/
  5668. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5669. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5670. class JUCE_API FileInputSource : public InputSource
  5671. {
  5672. public:
  5673. FileInputSource (const File& file);
  5674. ~FileInputSource();
  5675. InputStream* createInputStream();
  5676. InputStream* createInputStreamFor (const String& relatedItemPath);
  5677. int64 hashCode() const;
  5678. juce_UseDebuggingNewOperator
  5679. private:
  5680. const File file;
  5681. FileInputSource (const FileInputSource&);
  5682. FileInputSource& operator= (const FileInputSource&);
  5683. };
  5684. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5685. /*** End of inlined file: juce_FileInputSource.h ***/
  5686. #endif
  5687. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5688. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5689. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5690. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5691. class GZIPCompressorHelper;
  5692. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5693. {
  5694. public:
  5695. GZIPCompressorOutputStream (OutputStream* const destStream,
  5696. int compressionLevel = 0,
  5697. const bool deleteDestStreamWhenDestroyed = false,
  5698. const bool noWrap = false);
  5699. ~GZIPCompressorOutputStream();
  5700. void flush();
  5701. int64 getPosition();
  5702. bool setPosition (int64 newPosition);
  5703. bool write (const void* destBuffer, int howMany);
  5704. juce_UseDebuggingNewOperator
  5705. private:
  5706. OutputStream* const destStream;
  5707. ScopedPointer <OutputStream> streamToDelete;
  5708. HeapBlock <uint8> buffer;
  5709. ScopedPointer <GZIPCompressorHelper> helper;
  5710. bool doNextBlock();
  5711. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5712. GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5713. };
  5714. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5715. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5716. #endif
  5717. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5718. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5719. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5720. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5721. class GZIPDecompressHelper;
  5722. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5723. {
  5724. public:
  5725. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5726. const bool deleteSourceWhenDestroyed,
  5727. const bool noWrap = false,
  5728. const int64 uncompressedStreamLength = -1);
  5729. ~GZIPDecompressorInputStream();
  5730. int64 getPosition();
  5731. bool setPosition (int64 pos);
  5732. int64 getTotalLength();
  5733. bool isExhausted();
  5734. int read (void* destBuffer, int maxBytesToRead);
  5735. juce_UseDebuggingNewOperator
  5736. private:
  5737. InputStream* const sourceStream;
  5738. ScopedPointer <InputStream> streamToDelete;
  5739. const int64 uncompressedStreamLength;
  5740. const bool noWrap;
  5741. bool isEof;
  5742. int activeBufferSize;
  5743. int64 originalSourcePos, currentPos;
  5744. HeapBlock <uint8> buffer;
  5745. ScopedPointer <GZIPDecompressHelper> helper;
  5746. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5747. GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5748. };
  5749. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5750. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5751. #endif
  5752. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5753. #endif
  5754. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5755. #endif
  5756. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5757. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5758. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5759. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5760. class JUCE_API MemoryInputStream : public InputStream
  5761. {
  5762. public:
  5763. MemoryInputStream (const void* const sourceData,
  5764. const size_t sourceDataSize,
  5765. const bool keepInternalCopyOfData);
  5766. ~MemoryInputStream();
  5767. int64 getPosition();
  5768. bool setPosition (int64 pos);
  5769. int64 getTotalLength();
  5770. bool isExhausted();
  5771. int read (void* destBuffer, int maxBytesToRead);
  5772. juce_UseDebuggingNewOperator
  5773. private:
  5774. const char* data;
  5775. size_t dataSize, position;
  5776. MemoryBlock internalCopy;
  5777. };
  5778. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5779. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5780. #endif
  5781. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5782. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5783. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5784. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5785. class JUCE_API MemoryOutputStream : public OutputStream
  5786. {
  5787. public:
  5788. MemoryOutputStream (const size_t initialSize = 256,
  5789. const size_t granularity = 256,
  5790. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5791. ~MemoryOutputStream() throw();
  5792. const char* getData() const throw();
  5793. size_t getDataSize() const throw();
  5794. void reset() throw();
  5795. void flush();
  5796. bool write (const void* buffer, int howMany);
  5797. int64 getPosition();
  5798. bool setPosition (int64 newPosition);
  5799. juce_UseDebuggingNewOperator
  5800. private:
  5801. MemoryBlock* data;
  5802. ScopedPointer <MemoryBlock> dataToDelete;
  5803. size_t position, size, blockSize;
  5804. };
  5805. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5806. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  5807. #endif
  5808. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  5809. #endif
  5810. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5811. /*** Start of inlined file: juce_SubregionStream.h ***/
  5812. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5813. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5814. class JUCE_API SubregionStream : public InputStream
  5815. {
  5816. public:
  5817. SubregionStream (InputStream* const sourceStream,
  5818. const int64 startPositionInSourceStream,
  5819. const int64 lengthOfSourceStream,
  5820. const bool deleteSourceWhenDestroyed) throw();
  5821. ~SubregionStream() throw();
  5822. int64 getTotalLength();
  5823. int64 getPosition();
  5824. bool setPosition (int64 newPosition);
  5825. int read (void* destBuffer, int maxBytesToRead);
  5826. bool isExhausted();
  5827. juce_UseDebuggingNewOperator
  5828. private:
  5829. InputStream* const source;
  5830. ScopedPointer <InputStream> sourceToDelete;
  5831. const int64 startPositionInSourceStream, lengthOfSourceStream;
  5832. SubregionStream (const SubregionStream&);
  5833. SubregionStream& operator= (const SubregionStream&);
  5834. };
  5835. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5836. /*** End of inlined file: juce_SubregionStream.h ***/
  5837. #endif
  5838. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  5839. #endif
  5840. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5841. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  5842. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5843. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5844. #define TRANS(stringLiteral) \
  5845. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  5846. class JUCE_API LocalisedStrings
  5847. {
  5848. public:
  5849. LocalisedStrings (const String& fileContents);
  5850. LocalisedStrings (const File& fileToLoad);
  5851. ~LocalisedStrings();
  5852. static void setCurrentMappings (LocalisedStrings* newTranslations);
  5853. static LocalisedStrings* getCurrentMappings();
  5854. static const String translateWithCurrentMappings (const String& text);
  5855. static const String translateWithCurrentMappings (const char* text);
  5856. const String translate (const String& text) const;
  5857. const String getLanguageName() const { return languageName; }
  5858. const StringArray getCountryCodes() const { return countryCodes; }
  5859. void setIgnoresCase (const bool shouldIgnoreCase);
  5860. juce_UseDebuggingNewOperator
  5861. private:
  5862. String languageName;
  5863. StringArray countryCodes;
  5864. StringPairArray translations;
  5865. void loadFromText (const String& fileContents);
  5866. };
  5867. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5868. /*** End of inlined file: juce_LocalisedStrings.h ***/
  5869. #endif
  5870. #ifndef __JUCE_STRING_JUCEHEADER__
  5871. #endif
  5872. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  5873. #endif
  5874. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  5875. #endif
  5876. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5877. /*** Start of inlined file: juce_XmlDocument.h ***/
  5878. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5879. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  5880. class JUCE_API XmlDocument
  5881. {
  5882. public:
  5883. XmlDocument (const String& documentText) throw();
  5884. XmlDocument (const File& file);
  5885. ~XmlDocument() throw();
  5886. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  5887. const String& getLastParseError() const throw();
  5888. void setInputSource (InputSource* const newSource) throw();
  5889. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  5890. juce_UseDebuggingNewOperator
  5891. private:
  5892. String originalText;
  5893. const tchar* input;
  5894. bool outOfData, errorOccurred;
  5895. bool identifierLookupTable [128];
  5896. String lastError, dtdText;
  5897. StringArray tokenisedDTD;
  5898. bool needToLoadDTD, ignoreEmptyTextElements;
  5899. ScopedPointer <InputSource> inputSource;
  5900. void setLastError (const String& desc, const bool carryOn) throw();
  5901. void skipHeader() throw();
  5902. void skipNextWhiteSpace() throw();
  5903. tchar readNextChar() throw();
  5904. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  5905. void readChildElements (XmlElement* parent) throw();
  5906. int findNextTokenLength() throw();
  5907. void readQuotedString (String& result) throw();
  5908. void readEntity (String& result) throw();
  5909. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  5910. bool isXmlIdentifierChar (const tchar c) const throw();
  5911. const String getFileContents (const String& filename) const;
  5912. const String expandEntity (const String& entity);
  5913. const String expandExternalEntity (const String& entity);
  5914. const String getParameterEntity (const String& entity);
  5915. };
  5916. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  5917. /*** End of inlined file: juce_XmlDocument.h ***/
  5918. #endif
  5919. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  5920. #endif
  5921. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  5922. #endif
  5923. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5924. /*** Start of inlined file: juce_InterProcessLock.h ***/
  5925. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5926. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5927. class JUCE_API InterProcessLock
  5928. {
  5929. public:
  5930. InterProcessLock (const String& name);
  5931. ~InterProcessLock();
  5932. bool enter (int timeOutMillisecs = -1);
  5933. void exit();
  5934. juce_UseDebuggingNewOperator
  5935. private:
  5936. #if JUCE_WINDOWS
  5937. void* internal;
  5938. // #elif JUCE_64BIT
  5939. // long long internal;
  5940. #else
  5941. int internal;
  5942. #endif
  5943. String name;
  5944. int reentrancyLevel;
  5945. InterProcessLock (const InterProcessLock&);
  5946. InterProcessLock& operator= (const InterProcessLock&);
  5947. };
  5948. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5949. /*** End of inlined file: juce_InterProcessLock.h ***/
  5950. #endif
  5951. #ifndef __JUCE_PROCESS_JUCEHEADER__
  5952. /*** Start of inlined file: juce_Process.h ***/
  5953. #ifndef __JUCE_PROCESS_JUCEHEADER__
  5954. #define __JUCE_PROCESS_JUCEHEADER__
  5955. class JUCE_API Process
  5956. {
  5957. public:
  5958. enum ProcessPriority
  5959. {
  5960. LowPriority = 0,
  5961. NormalPriority = 1,
  5962. HighPriority = 2,
  5963. RealtimePriority = 3
  5964. };
  5965. static void setPriority (const ProcessPriority priority);
  5966. static void terminate();
  5967. static bool isForegroundProcess();
  5968. static void raisePrivilege();
  5969. static void lowerPrivilege();
  5970. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  5971. };
  5972. #endif // __JUCE_PROCESS_JUCEHEADER__
  5973. /*** End of inlined file: juce_Process.h ***/
  5974. #endif
  5975. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  5976. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  5977. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  5978. #define __JUCE_READWRITELOCK_JUCEHEADER__
  5979. /*** Start of inlined file: juce_WaitableEvent.h ***/
  5980. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  5981. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  5982. class JUCE_API WaitableEvent
  5983. {
  5984. public:
  5985. WaitableEvent() throw();
  5986. ~WaitableEvent() throw();
  5987. bool wait (const int timeOutMilliseconds = -1) const throw();
  5988. void signal() const throw();
  5989. void reset() const throw();
  5990. juce_UseDebuggingNewOperator
  5991. private:
  5992. void* internal;
  5993. WaitableEvent (const WaitableEvent&);
  5994. WaitableEvent& operator= (const WaitableEvent&);
  5995. };
  5996. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  5997. /*** End of inlined file: juce_WaitableEvent.h ***/
  5998. /*** Start of inlined file: juce_Thread.h ***/
  5999. #ifndef __JUCE_THREAD_JUCEHEADER__
  6000. #define __JUCE_THREAD_JUCEHEADER__
  6001. class JUCE_API Thread
  6002. {
  6003. public:
  6004. Thread (const String& threadName);
  6005. virtual ~Thread();
  6006. virtual void run() = 0;
  6007. // Thread control functions..
  6008. void startThread();
  6009. void startThread (const int priority);
  6010. void stopThread (const int timeOutMilliseconds);
  6011. bool isThreadRunning() const;
  6012. void signalThreadShouldExit();
  6013. inline bool threadShouldExit() const { return threadShouldExit_; }
  6014. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6015. bool setPriority (const int priority);
  6016. static bool setCurrentThreadPriority (const int priority);
  6017. void setAffinityMask (const uint32 affinityMask);
  6018. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6019. // this can be called from any thread that needs to pause..
  6020. static void JUCE_CALLTYPE sleep (int milliseconds);
  6021. static void JUCE_CALLTYPE yield();
  6022. bool wait (const int timeOutMilliseconds) const;
  6023. void notify() const;
  6024. typedef void* ThreadID;
  6025. static ThreadID getCurrentThreadId();
  6026. static Thread* getCurrentThread();
  6027. ThreadID getThreadId() const { return threadId_; }
  6028. const String getThreadName() const { return threadName_; }
  6029. static int getNumRunningThreads();
  6030. static void stopAllThreads (const int timeoutInMillisecs);
  6031. juce_UseDebuggingNewOperator
  6032. private:
  6033. const String threadName_;
  6034. void* volatile threadHandle_;
  6035. CriticalSection startStopLock;
  6036. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6037. int threadPriority_;
  6038. ThreadID threadId_;
  6039. uint32 affinityMask_;
  6040. bool volatile threadShouldExit_;
  6041. friend void JUCE_API juce_threadEntryPoint (void*);
  6042. static void threadEntryPoint (Thread* thread);
  6043. static Array<Thread*> runningThreads;
  6044. static CriticalSection runningThreadsLock;
  6045. Thread (const Thread&);
  6046. Thread& operator= (const Thread&);
  6047. };
  6048. #endif // __JUCE_THREAD_JUCEHEADER__
  6049. /*** End of inlined file: juce_Thread.h ***/
  6050. class JUCE_API ReadWriteLock
  6051. {
  6052. public:
  6053. ReadWriteLock() throw();
  6054. ~ReadWriteLock() throw();
  6055. void enterRead() const throw();
  6056. void exitRead() const throw();
  6057. void enterWrite() const throw();
  6058. bool tryEnterWrite() const throw();
  6059. void exitWrite() const throw();
  6060. juce_UseDebuggingNewOperator
  6061. private:
  6062. CriticalSection accessLock;
  6063. WaitableEvent waitEvent;
  6064. mutable int numWaitingWriters, numWriters;
  6065. mutable Thread::ThreadID writerThreadId;
  6066. mutable Array <Thread::ThreadID> readerThreads;
  6067. ReadWriteLock (const ReadWriteLock&);
  6068. ReadWriteLock& operator= (const ReadWriteLock&);
  6069. };
  6070. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6071. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6072. #endif
  6073. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6074. #endif
  6075. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6076. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6077. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6078. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6079. class JUCE_API ScopedReadLock
  6080. {
  6081. public:
  6082. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6083. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6084. private:
  6085. const ReadWriteLock& lock_;
  6086. ScopedReadLock (const ScopedReadLock&);
  6087. ScopedReadLock& operator= (const ScopedReadLock&);
  6088. };
  6089. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6090. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6091. #endif
  6092. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6093. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6094. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6095. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6096. class JUCE_API ScopedTryLock
  6097. {
  6098. public:
  6099. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6100. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6101. bool isLocked() const throw() { return lockWasSuccessful; }
  6102. private:
  6103. const CriticalSection& lock_;
  6104. const bool lockWasSuccessful;
  6105. ScopedTryLock (const ScopedTryLock&);
  6106. ScopedTryLock& operator= (const ScopedTryLock&);
  6107. };
  6108. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6109. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6110. #endif
  6111. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6112. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6113. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6114. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6115. class JUCE_API ScopedWriteLock
  6116. {
  6117. public:
  6118. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6119. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6120. private:
  6121. const ReadWriteLock& lock_;
  6122. ScopedWriteLock (const ScopedWriteLock&);
  6123. ScopedWriteLock& operator= (const ScopedWriteLock&);
  6124. };
  6125. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6126. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6127. #endif
  6128. #ifndef __JUCE_THREAD_JUCEHEADER__
  6129. #endif
  6130. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6131. /*** Start of inlined file: juce_ThreadPool.h ***/
  6132. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6133. #define __JUCE_THREADPOOL_JUCEHEADER__
  6134. class ThreadPool;
  6135. class ThreadPoolThread;
  6136. class JUCE_API ThreadPoolJob
  6137. {
  6138. public:
  6139. ThreadPoolJob (const String& name);
  6140. virtual ~ThreadPoolJob();
  6141. const String getJobName() const;
  6142. void setJobName (const String& newName);
  6143. enum JobStatus
  6144. {
  6145. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6146. removed from the pool. */
  6147. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6148. should be automatically deleted by the pool. */
  6149. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6150. again when a thread is free. */
  6151. };
  6152. virtual JobStatus runJob() = 0;
  6153. bool isRunning() const { return isActive; }
  6154. bool shouldExit() const { return shouldStop; }
  6155. void signalJobShouldExit();
  6156. juce_UseDebuggingNewOperator
  6157. private:
  6158. friend class ThreadPool;
  6159. friend class ThreadPoolThread;
  6160. String jobName;
  6161. ThreadPool* pool;
  6162. bool shouldStop, isActive, shouldBeDeleted;
  6163. ThreadPoolJob (const ThreadPoolJob&);
  6164. ThreadPoolJob& operator= (const ThreadPoolJob&);
  6165. };
  6166. class JUCE_API ThreadPool
  6167. {
  6168. public:
  6169. ThreadPool (const int numberOfThreads,
  6170. const bool startThreadsOnlyWhenNeeded = true,
  6171. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6172. ~ThreadPool();
  6173. class JUCE_API JobSelector
  6174. {
  6175. public:
  6176. virtual ~JobSelector() {}
  6177. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6178. };
  6179. void addJob (ThreadPoolJob* const job);
  6180. bool removeJob (ThreadPoolJob* const job,
  6181. const bool interruptIfRunning,
  6182. const int timeOutMilliseconds);
  6183. bool removeAllJobs (const bool interruptRunningJobs,
  6184. const int timeOutMilliseconds,
  6185. const bool deleteInactiveJobs = false,
  6186. JobSelector* selectedJobsToRemove = 0);
  6187. int getNumJobs() const;
  6188. ThreadPoolJob* getJob (const int index) const;
  6189. bool contains (const ThreadPoolJob* const job) const;
  6190. bool isJobRunning (const ThreadPoolJob* const job) const;
  6191. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6192. const int timeOutMilliseconds) const;
  6193. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6194. bool setThreadPriorities (const int newPriority);
  6195. juce_UseDebuggingNewOperator
  6196. private:
  6197. const int threadStopTimeout;
  6198. int priority;
  6199. class ThreadPoolThread;
  6200. OwnedArray <ThreadPoolThread> threads;
  6201. Array <ThreadPoolJob*> jobs;
  6202. CriticalSection lock;
  6203. uint32 lastJobEndTime;
  6204. WaitableEvent jobFinishedSignal;
  6205. friend class ThreadPoolThread;
  6206. bool runNextJob();
  6207. ThreadPool (const ThreadPool&);
  6208. ThreadPool& operator= (const ThreadPool&);
  6209. };
  6210. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6211. /*** End of inlined file: juce_ThreadPool.h ***/
  6212. #endif
  6213. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6214. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6215. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6216. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6217. class JUCE_API TimeSliceClient
  6218. {
  6219. public:
  6220. virtual ~TimeSliceClient() {}
  6221. virtual bool useTimeSlice() = 0;
  6222. };
  6223. class JUCE_API TimeSliceThread : public Thread
  6224. {
  6225. public:
  6226. TimeSliceThread (const String& threadName);
  6227. ~TimeSliceThread();
  6228. void addTimeSliceClient (TimeSliceClient* const client);
  6229. void removeTimeSliceClient (TimeSliceClient* const client);
  6230. int getNumClients() const;
  6231. TimeSliceClient* getClient (const int index) const;
  6232. void run();
  6233. juce_UseDebuggingNewOperator
  6234. private:
  6235. CriticalSection callbackLock, listLock;
  6236. Array <TimeSliceClient*> clients;
  6237. int index;
  6238. TimeSliceClient* clientBeingCalled;
  6239. bool clientsChanged;
  6240. TimeSliceThread (const TimeSliceThread&);
  6241. TimeSliceThread& operator= (const TimeSliceThread&);
  6242. };
  6243. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6244. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6245. #endif
  6246. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6247. #endif
  6248. #endif
  6249. /*** End of inlined file: juce_core_includes.h ***/
  6250. // if you're compiling a command-line app, you might want to just include the core headers,
  6251. // so you can set this macro before including juce.h
  6252. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6253. /*** Start of inlined file: juce_app_includes.h ***/
  6254. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6255. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6256. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6257. /*** Start of inlined file: juce_Application.h ***/
  6258. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6259. #define __JUCE_APPLICATION_JUCEHEADER__
  6260. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6261. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6262. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6263. /*** Start of inlined file: juce_Component.h ***/
  6264. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6265. #define __JUCE_COMPONENT_JUCEHEADER__
  6266. /*** Start of inlined file: juce_MouseCursor.h ***/
  6267. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6268. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6269. class Image;
  6270. class SharedMouseCursorInternal;
  6271. class ComponentPeer;
  6272. class Component;
  6273. class JUCE_API MouseCursor
  6274. {
  6275. public:
  6276. enum StandardCursorType
  6277. {
  6278. NoCursor = 0, /**< An invisible cursor. */
  6279. NormalCursor, /**< The stardard arrow cursor. */
  6280. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6281. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6282. CrosshairCursor, /**< A pair of crosshairs. */
  6283. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6284. that you're dragging a copy of something. */
  6285. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6286. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6287. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6288. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6289. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6290. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6291. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6292. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6293. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6294. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6295. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6296. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6297. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6298. };
  6299. MouseCursor() throw();
  6300. MouseCursor (const StandardCursorType type) throw();
  6301. MouseCursor (const Image& image,
  6302. const int hotSpotX,
  6303. const int hotSpotY) throw();
  6304. MouseCursor (const MouseCursor& other) throw();
  6305. MouseCursor& operator= (const MouseCursor& other) throw();
  6306. ~MouseCursor() throw();
  6307. bool operator== (const MouseCursor& other) const throw();
  6308. bool operator!= (const MouseCursor& other) const throw();
  6309. static void showWaitCursor() throw();
  6310. static void hideWaitCursor() throw();
  6311. juce_UseDebuggingNewOperator
  6312. private:
  6313. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6314. friend class MouseInputSourceInternal;
  6315. void showInWindow (ComponentPeer* window) const throw();
  6316. void showInAllWindows() const throw();
  6317. void* getHandle() const throw();
  6318. };
  6319. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6320. /*** End of inlined file: juce_MouseCursor.h ***/
  6321. /*** Start of inlined file: juce_MouseListener.h ***/
  6322. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6323. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6324. class MouseEvent;
  6325. class JUCE_API MouseListener
  6326. {
  6327. public:
  6328. virtual ~MouseListener() {}
  6329. virtual void mouseMove (const MouseEvent& e);
  6330. virtual void mouseEnter (const MouseEvent& e);
  6331. virtual void mouseExit (const MouseEvent& e);
  6332. virtual void mouseDown (const MouseEvent& e);
  6333. virtual void mouseDrag (const MouseEvent& e);
  6334. virtual void mouseUp (const MouseEvent& e);
  6335. virtual void mouseDoubleClick (const MouseEvent& e);
  6336. virtual void mouseWheelMove (const MouseEvent& e,
  6337. float wheelIncrementX,
  6338. float wheelIncrementY);
  6339. };
  6340. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6341. /*** End of inlined file: juce_MouseListener.h ***/
  6342. /*** Start of inlined file: juce_MouseEvent.h ***/
  6343. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6344. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6345. class Component;
  6346. class MouseInputSource;
  6347. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6348. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6349. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6350. class JUCE_API ModifierKeys
  6351. {
  6352. public:
  6353. ModifierKeys (const int flags = 0) throw();
  6354. ModifierKeys (const ModifierKeys& other) throw();
  6355. ModifierKeys& operator= (const ModifierKeys& other) throw();
  6356. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6357. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6358. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6359. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6360. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6361. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6362. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6363. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6364. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6365. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6366. enum Flags
  6367. {
  6368. shiftModifier = 1,
  6369. ctrlModifier = 2,
  6370. altModifier = 4,
  6371. leftButtonModifier = 16,
  6372. rightButtonModifier = 32,
  6373. middleButtonModifier = 64,
  6374. #if JUCE_MAC
  6375. commandModifier = 8,
  6376. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6377. #else
  6378. commandModifier = ctrlModifier,
  6379. popupMenuClickModifier = rightButtonModifier,
  6380. #endif
  6381. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6382. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6383. };
  6384. const ModifierKeys withOnlyMouseButtons() const throw() { return ModifierKeys (flags & allMouseButtonModifiers); }
  6385. const ModifierKeys withoutMouseButtons() const throw() { return ModifierKeys (flags & ~allMouseButtonModifiers); }
  6386. bool operator== (const ModifierKeys& other) const throw() { return flags == other.flags; }
  6387. bool operator!= (const ModifierKeys& other) const throw() { return flags != other.flags; }
  6388. inline int getRawFlags() const throw() { return flags; }
  6389. inline const ModifierKeys withoutFlags (int rawFlagsToClear) const throw() { return ModifierKeys (flags & ~rawFlagsToClear); }
  6390. inline const ModifierKeys withFlags (int rawFlagsToSet) const throw() { return ModifierKeys (flags | rawFlagsToSet); }
  6391. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6392. int getNumMouseButtonsDown() const throw();
  6393. static const ModifierKeys getCurrentModifiers() throw();
  6394. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6395. private:
  6396. int flags;
  6397. static ModifierKeys currentModifiers;
  6398. friend class ComponentPeer;
  6399. friend class MouseInputSource;
  6400. friend class MouseInputSourceInternal;
  6401. static void updateCurrentModifiers() throw();
  6402. };
  6403. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6404. /*** End of inlined file: juce_ModifierKeys.h ***/
  6405. /*** Start of inlined file: juce_Point.h ***/
  6406. #ifndef __JUCE_POINT_JUCEHEADER__
  6407. #define __JUCE_POINT_JUCEHEADER__
  6408. /*** Start of inlined file: juce_AffineTransform.h ***/
  6409. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6410. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6411. class JUCE_API AffineTransform
  6412. {
  6413. public:
  6414. AffineTransform() throw();
  6415. AffineTransform (const AffineTransform& other) throw();
  6416. AffineTransform (const float mat00, const float mat01, const float mat02,
  6417. const float mat10, const float mat11, const float mat12) throw();
  6418. AffineTransform& operator= (const AffineTransform& other) throw();
  6419. bool operator== (const AffineTransform& other) const throw();
  6420. bool operator!= (const AffineTransform& other) const throw();
  6421. static const AffineTransform identity;
  6422. void transformPoint (float& x,
  6423. float& y) const throw();
  6424. void transformPoint (double& x,
  6425. double& y) const throw();
  6426. const AffineTransform translated (const float deltaX,
  6427. const float deltaY) const throw();
  6428. static const AffineTransform translation (const float deltaX,
  6429. const float deltaY) throw();
  6430. const AffineTransform rotated (const float angleInRadians) const throw();
  6431. const AffineTransform rotated (const float angleInRadians,
  6432. const float pivotX,
  6433. const float pivotY) const throw();
  6434. static const AffineTransform rotation (const float angleInRadians) throw();
  6435. static const AffineTransform rotation (const float angleInRadians,
  6436. const float pivotX,
  6437. const float pivotY) throw();
  6438. const AffineTransform scaled (const float factorX,
  6439. const float factorY) const throw();
  6440. static const AffineTransform scale (const float factorX,
  6441. const float factorY) throw();
  6442. const AffineTransform sheared (const float shearX,
  6443. const float shearY) const throw();
  6444. const AffineTransform inverted() const throw();
  6445. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6446. bool isIdentity() const throw();
  6447. bool isSingularity() const throw();
  6448. bool isOnlyTranslation() const throw();
  6449. float getTranslationX() const throw() { return mat02; }
  6450. float getTranslationY() const throw() { return mat12; }
  6451. juce_UseDebuggingNewOperator
  6452. float mat00, mat01, mat02;
  6453. float mat10, mat11, mat12;
  6454. private:
  6455. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6456. const float mat10, const float mat11, const float mat12) const throw();
  6457. };
  6458. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6459. /*** End of inlined file: juce_AffineTransform.h ***/
  6460. template <typename ValueType>
  6461. class Point
  6462. {
  6463. public:
  6464. Point() throw() : x (0), y (0) {}
  6465. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6466. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6467. ~Point() throw() {}
  6468. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6469. inline ValueType getX() const throw() { return x; }
  6470. inline ValueType getY() const throw() { return y; }
  6471. inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
  6472. inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
  6473. bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
  6474. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6475. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6476. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6477. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6478. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6479. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6480. const Point operator-() const throw() { return Point (-x, -y); }
  6481. ValueType getDistanceFrom (const Point& other) const throw() { return (ValueType) juce_hypot (x - other.x, y - other.y); }
  6482. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6483. juce_UseDebuggingNewOperator
  6484. private:
  6485. ValueType x, y;
  6486. };
  6487. #endif // __JUCE_POINT_JUCEHEADER__
  6488. /*** End of inlined file: juce_Point.h ***/
  6489. class JUCE_API MouseEvent
  6490. {
  6491. public:
  6492. MouseEvent (MouseInputSource& source,
  6493. const Point<int>& position,
  6494. const ModifierKeys& modifiers,
  6495. Component* const originator,
  6496. const Time& eventTime,
  6497. const Point<int> mouseDownPos,
  6498. const Time& mouseDownTime,
  6499. const int numberOfClicks,
  6500. const bool mouseWasDragged) throw();
  6501. ~MouseEvent() throw();
  6502. const int x;
  6503. const int y;
  6504. const ModifierKeys mods;
  6505. Component* const eventComponent;
  6506. Component* const originalComponent;
  6507. const Time eventTime;
  6508. MouseInputSource& source;
  6509. int getMouseDownX() const throw();
  6510. int getMouseDownY() const throw();
  6511. const Point<int> getMouseDownPosition() const throw();
  6512. int getDistanceFromDragStart() const throw();
  6513. int getDistanceFromDragStartX() const throw();
  6514. int getDistanceFromDragStartY() const throw();
  6515. bool mouseWasClicked() const throw();
  6516. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6517. int getLengthOfMousePress() const throw();
  6518. const Point<int> getPosition() const throw();
  6519. int getScreenX() const;
  6520. int getScreenY() const;
  6521. const Point<int> getScreenPosition() const;
  6522. int getMouseDownScreenX() const;
  6523. int getMouseDownScreenY() const;
  6524. const Point<int> getMouseDownScreenPosition() const;
  6525. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6526. const MouseEvent withNewPosition (const Point<int>& newPosition) const throw();
  6527. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6528. static int getDoubleClickTimeout() throw();
  6529. juce_UseDebuggingNewOperator
  6530. private:
  6531. const Point<int> mouseDownPos;
  6532. const Time mouseDownTime;
  6533. const int numberOfClicks;
  6534. const bool wasMovedSinceMouseDown;
  6535. MouseEvent& operator= (const MouseEvent&);
  6536. };
  6537. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6538. /*** End of inlined file: juce_MouseEvent.h ***/
  6539. /*** Start of inlined file: juce_ComponentListener.h ***/
  6540. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6541. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6542. class Component;
  6543. class JUCE_API ComponentListener
  6544. {
  6545. public:
  6546. virtual ~ComponentListener() {}
  6547. virtual void componentMovedOrResized (Component& component,
  6548. bool wasMoved,
  6549. bool wasResized);
  6550. virtual void componentBroughtToFront (Component& component);
  6551. virtual void componentVisibilityChanged (Component& component);
  6552. virtual void componentChildrenChanged (Component& component);
  6553. virtual void componentParentHierarchyChanged (Component& component);
  6554. virtual void componentNameChanged (Component& component);
  6555. virtual void componentBeingDeleted (Component& component);
  6556. };
  6557. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6558. /*** End of inlined file: juce_ComponentListener.h ***/
  6559. /*** Start of inlined file: juce_KeyListener.h ***/
  6560. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6561. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6562. /*** Start of inlined file: juce_KeyPress.h ***/
  6563. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6564. #define __JUCE_KEYPRESS_JUCEHEADER__
  6565. class JUCE_API KeyPress
  6566. {
  6567. public:
  6568. KeyPress() throw();
  6569. KeyPress (const int keyCode,
  6570. const ModifierKeys& modifiers,
  6571. const juce_wchar textCharacter) throw();
  6572. KeyPress (const int keyCode) throw();
  6573. KeyPress (const KeyPress& other) throw();
  6574. KeyPress& operator= (const KeyPress& other) throw();
  6575. bool operator== (const KeyPress& other) const throw();
  6576. bool operator!= (const KeyPress& other) const throw();
  6577. bool isValid() const throw() { return keyCode != 0; }
  6578. int getKeyCode() const throw() { return keyCode; }
  6579. const ModifierKeys getModifiers() const throw() { return mods; }
  6580. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6581. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6582. static const KeyPress createFromDescription (const String& textVersion) throw();
  6583. const String getTextDescription() const throw();
  6584. bool isCurrentlyDown() const throw();
  6585. static bool isKeyCurrentlyDown (int keyCode) throw();
  6586. // Key codes
  6587. //
  6588. // Note that the actual values of these are platform-specific and may change
  6589. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6590. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6591. //
  6592. static const int spaceKey; /**< key-code for the space bar */
  6593. static const int escapeKey; /**< key-code for the escape key */
  6594. static const int returnKey; /**< key-code for the return key*/
  6595. static const int tabKey; /**< key-code for the tab key*/
  6596. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6597. static const int backspaceKey; /**< key-code for the backspace key */
  6598. static const int insertKey; /**< key-code for the insert key */
  6599. static const int upKey; /**< key-code for the cursor-up key */
  6600. static const int downKey; /**< key-code for the cursor-down key */
  6601. static const int leftKey; /**< key-code for the cursor-left key */
  6602. static const int rightKey; /**< key-code for the cursor-right key */
  6603. static const int pageUpKey; /**< key-code for the page-up key */
  6604. static const int pageDownKey; /**< key-code for the page-down key */
  6605. static const int homeKey; /**< key-code for the home key */
  6606. static const int endKey; /**< key-code for the end key */
  6607. static const int F1Key; /**< key-code for the F1 key */
  6608. static const int F2Key; /**< key-code for the F2 key */
  6609. static const int F3Key; /**< key-code for the F3 key */
  6610. static const int F4Key; /**< key-code for the F4 key */
  6611. static const int F5Key; /**< key-code for the F5 key */
  6612. static const int F6Key; /**< key-code for the F6 key */
  6613. static const int F7Key; /**< key-code for the F7 key */
  6614. static const int F8Key; /**< key-code for the F8 key */
  6615. static const int F9Key; /**< key-code for the F9 key */
  6616. static const int F10Key; /**< key-code for the F10 key */
  6617. static const int F11Key; /**< key-code for the F11 key */
  6618. static const int F12Key; /**< key-code for the F12 key */
  6619. static const int F13Key; /**< key-code for the F13 key */
  6620. static const int F14Key; /**< key-code for the F14 key */
  6621. static const int F15Key; /**< key-code for the F15 key */
  6622. static const int F16Key; /**< key-code for the F16 key */
  6623. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6624. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6625. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6626. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6627. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6628. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6629. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6630. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6631. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6632. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6633. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6634. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6635. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6636. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6637. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6638. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6639. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6640. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6641. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6642. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6643. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6644. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6645. juce_UseDebuggingNewOperator
  6646. private:
  6647. int keyCode;
  6648. ModifierKeys mods;
  6649. juce_wchar textCharacter;
  6650. };
  6651. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6652. /*** End of inlined file: juce_KeyPress.h ***/
  6653. class Component;
  6654. class JUCE_API KeyListener
  6655. {
  6656. public:
  6657. virtual ~KeyListener() {}
  6658. virtual bool keyPressed (const KeyPress& key,
  6659. Component* originatingComponent) = 0;
  6660. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6661. };
  6662. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6663. /*** End of inlined file: juce_KeyListener.h ***/
  6664. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6665. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6666. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6667. class Component;
  6668. class JUCE_API KeyboardFocusTraverser
  6669. {
  6670. public:
  6671. KeyboardFocusTraverser();
  6672. virtual ~KeyboardFocusTraverser();
  6673. virtual Component* getNextComponent (Component* current);
  6674. virtual Component* getPreviousComponent (Component* current);
  6675. virtual Component* getDefaultComponent (Component* parentComponent);
  6676. };
  6677. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6678. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6679. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6680. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6681. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6682. /*** Start of inlined file: juce_Graphics.h ***/
  6683. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6684. #define __JUCE_GRAPHICS_JUCEHEADER__
  6685. /*** Start of inlined file: juce_Font.h ***/
  6686. #ifndef __JUCE_FONT_JUCEHEADER__
  6687. #define __JUCE_FONT_JUCEHEADER__
  6688. /*** Start of inlined file: juce_Typeface.h ***/
  6689. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6690. #define __JUCE_TYPEFACE_JUCEHEADER__
  6691. /*** Start of inlined file: juce_Path.h ***/
  6692. #ifndef __JUCE_PATH_JUCEHEADER__
  6693. #define __JUCE_PATH_JUCEHEADER__
  6694. /*** Start of inlined file: juce_Rectangle.h ***/
  6695. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6696. #define __JUCE_RECTANGLE_JUCEHEADER__
  6697. class RectangleList;
  6698. template <typename ValueType>
  6699. class Rectangle
  6700. {
  6701. public:
  6702. Rectangle() throw()
  6703. : x (0), y (0), w (0), h (0)
  6704. {
  6705. }
  6706. Rectangle (const Rectangle& other) throw()
  6707. : x (other.x), y (other.y),
  6708. w (other.w), h (other.h)
  6709. {
  6710. }
  6711. Rectangle (const ValueType initialX, const ValueType initialY,
  6712. const ValueType width, const ValueType height) throw()
  6713. : x (initialX), y (initialY),
  6714. w (width), h (height)
  6715. {
  6716. }
  6717. Rectangle (const ValueType width, const ValueType height) throw()
  6718. : x (0), y (0), w (width), h (height)
  6719. {
  6720. }
  6721. Rectangle& operator= (const Rectangle& other) throw()
  6722. {
  6723. x = other.x; y = other.y;
  6724. w = other.w; h = other.h;
  6725. return *this;
  6726. }
  6727. ~Rectangle() throw() {}
  6728. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6729. inline ValueType getX() const throw() { return x; }
  6730. inline ValueType getY() const throw() { return y; }
  6731. inline ValueType getWidth() const throw() { return w; }
  6732. inline ValueType getHeight() const throw() { return h; }
  6733. inline ValueType getRight() const throw() { return x + w; }
  6734. inline ValueType getBottom() const throw() { return y + h; }
  6735. ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6736. ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6737. const Point<ValueType> getCentre() const throw() { return Point<ValueType> (x + w / (ValueType) 2, y + h / (ValueType) 2); }
  6738. ValueType getAspectRatio (const bool widthOverHeight = true) const throw() { return widthOverHeight ? w / h : h / w; }
  6739. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6740. void setPosition (const Point<ValueType>& newPos) throw() { x = newPos.getX(); y = newPos.getY(); }
  6741. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6742. const Rectangle withPosition (const Point<ValueType>& newPos) const throw() { return Rectangle (newPos.getX(), newPos.getY(), w, h); }
  6743. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6744. const Rectangle withSize (const ValueType newWidth, const ValueType newHeight) const throw() { return Rectangle (x, y, newWidth, newHeight); }
  6745. void setBounds (const ValueType newX, const ValueType newY,
  6746. const ValueType newWidth, const ValueType newHeight) throw()
  6747. {
  6748. x = newX; y = newY; w = newWidth; h = newHeight;
  6749. }
  6750. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6751. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6752. void setLeft (const ValueType newLeft) throw()
  6753. {
  6754. w = jmax (ValueType(), x + w - newLeft);
  6755. x = newLeft;
  6756. }
  6757. void setTop (const ValueType newTop) throw()
  6758. {
  6759. h = jmax (ValueType(), y + h - newTop);
  6760. y = newTop;
  6761. }
  6762. void setRight (const ValueType newRight) throw()
  6763. {
  6764. x = jmin (x, newRight);
  6765. w = newRight - x;
  6766. }
  6767. void setBottom (const ValueType newBottom) throw()
  6768. {
  6769. y = jmin (y, newBottom);
  6770. h = newBottom - y;
  6771. }
  6772. void translate (const ValueType deltaX,
  6773. const ValueType deltaY) throw()
  6774. {
  6775. x += deltaX;
  6776. y += deltaY;
  6777. }
  6778. const Rectangle translated (const ValueType deltaX,
  6779. const ValueType deltaY) const throw()
  6780. {
  6781. return Rectangle (x + deltaX, y + deltaY, w, h);
  6782. }
  6783. void expand (const ValueType deltaX,
  6784. const ValueType deltaY) throw()
  6785. {
  6786. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6787. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6788. setBounds (x - deltaX, y - deltaY, nw, nh);
  6789. }
  6790. const Rectangle expanded (const ValueType deltaX,
  6791. const ValueType deltaY) const throw()
  6792. {
  6793. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6794. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6795. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  6796. }
  6797. void reduce (const ValueType deltaX,
  6798. const ValueType deltaY) throw()
  6799. {
  6800. expand (-deltaX, -deltaY);
  6801. }
  6802. const Rectangle reduced (const ValueType deltaX,
  6803. const ValueType deltaY) const throw()
  6804. {
  6805. return expanded (-deltaX, -deltaY);
  6806. }
  6807. bool operator== (const Rectangle& other) const throw()
  6808. {
  6809. return x == other.x && y == other.y
  6810. && w == other.w && h == other.h;
  6811. }
  6812. bool operator!= (const Rectangle& other) const throw()
  6813. {
  6814. return x != other.x || y != other.y
  6815. || w != other.w || h != other.h;
  6816. }
  6817. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  6818. {
  6819. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  6820. }
  6821. bool contains (const Point<ValueType> point) const throw()
  6822. {
  6823. return point.getX() >= x && point.getY() >= y && point.getX() < x + w && point.getY() < y + h;
  6824. }
  6825. bool contains (const Rectangle& other) const throw()
  6826. {
  6827. return x <= other.x && y <= other.y
  6828. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  6829. }
  6830. const Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const throw()
  6831. {
  6832. return Point<ValueType> (jlimit (x, x + w, point.getX()),
  6833. jlimit (y, y + h, point.getY()));
  6834. }
  6835. bool intersects (const Rectangle& other) const throw()
  6836. {
  6837. return x + w > other.x
  6838. && y + h > other.y
  6839. && x < other.x + other.w
  6840. && y < other.y + other.h
  6841. && w > ValueType() && h > ValueType();
  6842. }
  6843. const Rectangle getIntersection (const Rectangle& other) const throw()
  6844. {
  6845. const ValueType nx = jmax (x, other.x);
  6846. const ValueType ny = jmax (y, other.y);
  6847. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  6848. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  6849. if (nw >= ValueType() && nh >= ValueType())
  6850. return Rectangle (nx, ny, nw, nh);
  6851. return Rectangle();
  6852. }
  6853. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  6854. {
  6855. const int maxX = jmax (otherX, x);
  6856. otherW = jmin (otherX + otherW, x + w) - maxX;
  6857. if (otherW > 0)
  6858. {
  6859. const int maxY = jmax (otherY, y);
  6860. otherH = jmin (otherY + otherH, y + h) - maxY;
  6861. if (otherH > 0)
  6862. {
  6863. otherX = maxX; otherY = maxY;
  6864. return true;
  6865. }
  6866. }
  6867. return false;
  6868. }
  6869. const Rectangle getUnion (const Rectangle& other) const throw()
  6870. {
  6871. const ValueType newX = jmin (x, other.x);
  6872. const ValueType newY = jmin (y, other.y);
  6873. return Rectangle (newX, newY,
  6874. jmax (x + w, other.x + other.w) - newX,
  6875. jmax (y + h, other.y + other.h) - newY);
  6876. }
  6877. bool enlargeIfAdjacent (const Rectangle& other) throw()
  6878. {
  6879. if (x == other.x && getRight() == other.getRight()
  6880. && (other.getBottom() >= y && other.y <= getBottom()))
  6881. {
  6882. const ValueType newY = jmin (y, other.y);
  6883. h = jmax (getBottom(), other.getBottom()) - newY;
  6884. y = newY;
  6885. return true;
  6886. }
  6887. else if (y == other.y && getBottom() == other.getBottom()
  6888. && (other.getRight() >= x && other.x <= getRight()))
  6889. {
  6890. const ValueType newX = jmin (x, other.x);
  6891. w = jmax (getRight(), other.getRight()) - newX;
  6892. x = newX;
  6893. return true;
  6894. }
  6895. return false;
  6896. }
  6897. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  6898. {
  6899. int inside = 0;
  6900. const int otherR = other.getRight();
  6901. if (x >= other.x && x < otherR) inside = 1;
  6902. const int otherB = other.getBottom();
  6903. if (y >= other.y && y < otherB) inside |= 2;
  6904. const int r = x + w;
  6905. if (r >= other.x && r < otherR) inside |= 4;
  6906. const int b = y + h;
  6907. if (b >= other.y && b < otherB) inside |= 8;
  6908. switch (inside)
  6909. {
  6910. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  6911. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  6912. case 2 + 4 + 8: w = other.x - x; return true;
  6913. case 1 + 4 + 8: h = other.y - y; return true;
  6914. }
  6915. return false;
  6916. }
  6917. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  6918. {
  6919. float x1 = x, y1 = y;
  6920. float x2 = x + w, y2 = y;
  6921. float x3 = x, y3 = y + h;
  6922. float x4 = x2, y4 = y3;
  6923. transform.transformPoint (x1, y1);
  6924. transform.transformPoint (x2, y2);
  6925. transform.transformPoint (x3, y3);
  6926. transform.transformPoint (x4, y4);
  6927. const float x = jmin (x1, x2, x3, x4);
  6928. const float y = jmin (y1, y2, y3, y4);
  6929. return Rectangle (x, y,
  6930. jmax (x1, x2, x3, x4) - x,
  6931. jmax (y1, y2, y3, y4) - y);
  6932. }
  6933. const Rectangle<int> getSmallestIntegerContainer() const throw()
  6934. {
  6935. const int x1 = (int) floorf ((float) x);
  6936. const int y1 = (int) floorf ((float) y);
  6937. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  6938. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  6939. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  6940. }
  6941. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  6942. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  6943. {
  6944. const ValueType x = jmax (x1, x2);
  6945. w1 = jmin (x1 + w1, x2 + w2) - x;
  6946. if (w1 > 0)
  6947. {
  6948. const ValueType y = jmax (y1, y2);
  6949. h1 = jmin (y1 + h1, y2 + h2) - y;
  6950. if (h1 > 0)
  6951. {
  6952. x1 = x; y1 = y;
  6953. return true;
  6954. }
  6955. }
  6956. return false;
  6957. }
  6958. const String toString() const
  6959. {
  6960. String s;
  6961. s.preallocateStorage (16);
  6962. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  6963. return s;
  6964. }
  6965. static const Rectangle fromString (const String& stringVersion)
  6966. {
  6967. StringArray toks;
  6968. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), 0);
  6969. return Rectangle (toks[0].trim().getIntValue(),
  6970. toks[1].trim().getIntValue(),
  6971. toks[2].trim().getIntValue(),
  6972. toks[3].trim().getIntValue());
  6973. }
  6974. juce_UseDebuggingNewOperator
  6975. private:
  6976. friend class RectangleList;
  6977. ValueType x, y, w, h;
  6978. };
  6979. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  6980. /*** End of inlined file: juce_Rectangle.h ***/
  6981. /*** Start of inlined file: juce_Justification.h ***/
  6982. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  6983. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  6984. class JUCE_API Justification
  6985. {
  6986. public:
  6987. inline Justification (const int flags_) throw() : flags (flags_) {}
  6988. Justification (const Justification& other) throw();
  6989. Justification& operator= (const Justification& other) throw();
  6990. inline int getFlags() const throw() { return flags; }
  6991. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6992. int getOnlyVerticalFlags() const throw();
  6993. int getOnlyHorizontalFlags() const throw();
  6994. void applyToRectangle (int& x, int& y,
  6995. const int w, const int h,
  6996. const int spaceX, const int spaceY,
  6997. const int spaceW, const int spaceH) const throw();
  6998. enum
  6999. {
  7000. left = 1,
  7001. right = 2,
  7002. horizontallyCentred = 4,
  7003. top = 8,
  7004. bottom = 16,
  7005. verticallyCentred = 32,
  7006. horizontallyJustified = 64,
  7007. centred = 36,
  7008. centredLeft = 33,
  7009. centredRight = 34,
  7010. centredTop = 12,
  7011. centredBottom = 20,
  7012. topLeft = 9,
  7013. topRight = 10,
  7014. bottomLeft = 17,
  7015. bottomRight = 18
  7016. };
  7017. private:
  7018. int flags;
  7019. };
  7020. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7021. /*** End of inlined file: juce_Justification.h ***/
  7022. /*** Start of inlined file: juce_EdgeTable.h ***/
  7023. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7024. #define __JUCE_EDGETABLE_JUCEHEADER__
  7025. class Path;
  7026. class RectangleList;
  7027. class Image;
  7028. class JUCE_API EdgeTable
  7029. {
  7030. public:
  7031. EdgeTable (const Rectangle<int>& clipLimits,
  7032. const Path& pathToAdd,
  7033. const AffineTransform& transform) throw();
  7034. EdgeTable (const Rectangle<int>& rectangleToAdd) throw();
  7035. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  7036. EdgeTable (const float x, const float y,
  7037. const float w, const float h) throw();
  7038. EdgeTable (const EdgeTable& other) throw();
  7039. EdgeTable& operator= (const EdgeTable& other) throw();
  7040. ~EdgeTable() throw();
  7041. void clipToRectangle (const Rectangle<int>& r) throw();
  7042. void excludeRectangle (const Rectangle<int>& r) throw();
  7043. void clipToEdgeTable (const EdgeTable& other);
  7044. void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw();
  7045. bool isEmpty() throw();
  7046. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7047. void translate (float dx, int dy) throw();
  7048. void optimiseTable() throw();
  7049. template <class EdgeTableIterationCallback>
  7050. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7051. {
  7052. const int* lineStart = table;
  7053. for (int y = 0; y < bounds.getHeight(); ++y)
  7054. {
  7055. const int* line = lineStart;
  7056. lineStart += lineStrideElements;
  7057. int numPoints = line[0];
  7058. if (--numPoints > 0)
  7059. {
  7060. int x = *++line;
  7061. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7062. int levelAccumulator = 0;
  7063. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7064. while (--numPoints >= 0)
  7065. {
  7066. const int level = *++line;
  7067. jassert (((unsigned int) level) < (unsigned int) 256);
  7068. const int endX = *++line;
  7069. jassert (endX >= x);
  7070. const int endOfRun = (endX >> 8);
  7071. if (endOfRun == (x >> 8))
  7072. {
  7073. // small segment within the same pixel, so just save it for the next
  7074. // time round..
  7075. levelAccumulator += (endX - x) * level;
  7076. }
  7077. else
  7078. {
  7079. // plot the fist pixel of this segment, including any accumulated
  7080. // levels from smaller segments that haven't been drawn yet
  7081. levelAccumulator += (0xff - (x & 0xff)) * level;
  7082. levelAccumulator >>= 8;
  7083. x >>= 8;
  7084. if (levelAccumulator > 0)
  7085. {
  7086. if (levelAccumulator >> 8)
  7087. levelAccumulator = 0xff;
  7088. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7089. }
  7090. // if there's a run of similar pixels, do it all in one go..
  7091. if (level > 0)
  7092. {
  7093. jassert (endOfRun <= bounds.getRight());
  7094. const int numPix = endOfRun - ++x;
  7095. if (numPix > 0)
  7096. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7097. }
  7098. // save the bit at the end to be drawn next time round the loop.
  7099. levelAccumulator = (endX & 0xff) * level;
  7100. }
  7101. x = endX;
  7102. }
  7103. if (levelAccumulator > 0)
  7104. {
  7105. levelAccumulator >>= 8;
  7106. if (levelAccumulator >> 8)
  7107. levelAccumulator = 0xff;
  7108. x >>= 8;
  7109. jassert (x >= bounds.getX() && x < bounds.getRight());
  7110. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7111. }
  7112. }
  7113. }
  7114. }
  7115. juce_UseDebuggingNewOperator
  7116. private:
  7117. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7118. HeapBlock<int> table;
  7119. Rectangle<int> bounds;
  7120. int maxEdgesPerLine, lineStrideElements;
  7121. bool needToCheckEmptinesss;
  7122. void addEdgePoint (const int x, const int y, const int winding) throw();
  7123. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7124. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7125. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7126. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7127. static void copyEdgeTableData (int* dest, const int destLineStride, const int* src, const int srcLineStride, int numLines) throw();
  7128. };
  7129. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7130. /*** End of inlined file: juce_EdgeTable.h ***/
  7131. class Image;
  7132. class JUCE_API Path
  7133. {
  7134. public:
  7135. Path() throw();
  7136. Path (const Path& other) throw();
  7137. ~Path() throw();
  7138. Path& operator= (const Path& other) throw();
  7139. bool isEmpty() const throw();
  7140. const Rectangle<float> getBounds() const throw();
  7141. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7142. bool contains (const float x,
  7143. const float y,
  7144. const float tolerence = 10.0f) const throw();
  7145. bool intersectsLine (const float x1, const float y1,
  7146. const float x2, const float y2,
  7147. const float tolerence = 10.0f) throw();
  7148. void clear() throw();
  7149. void startNewSubPath (const float startX,
  7150. const float startY) throw();
  7151. void closeSubPath() throw();
  7152. void lineTo (const float endX,
  7153. const float endY) throw();
  7154. void quadraticTo (const float controlPointX,
  7155. const float controlPointY,
  7156. const float endPointX,
  7157. const float endPointY) throw();
  7158. void cubicTo (const float controlPoint1X,
  7159. const float controlPoint1Y,
  7160. const float controlPoint2X,
  7161. const float controlPoint2Y,
  7162. const float endPointX,
  7163. const float endPointY) throw();
  7164. const Point<float> getCurrentPosition() const;
  7165. void addRectangle (const float x, const float y,
  7166. const float w, const float h) throw();
  7167. void addRectangle (const Rectangle<int>& rectangle) throw();
  7168. void addRoundedRectangle (const float x, const float y,
  7169. const float w, const float h,
  7170. float cornerSize) throw();
  7171. void addRoundedRectangle (const float x, const float y,
  7172. const float w, const float h,
  7173. float cornerSizeX,
  7174. float cornerSizeY) throw();
  7175. void addTriangle (const float x1, const float y1,
  7176. const float x2, const float y2,
  7177. const float x3, const float y3) throw();
  7178. void addQuadrilateral (const float x1, const float y1,
  7179. const float x2, const float y2,
  7180. const float x3, const float y3,
  7181. const float x4, const float y4) throw();
  7182. void addEllipse (const float x, const float y,
  7183. const float width, const float height) throw();
  7184. void addArc (const float x, const float y,
  7185. const float width, const float height,
  7186. const float fromRadians,
  7187. const float toRadians,
  7188. const bool startAsNewSubPath = false) throw();
  7189. void addCentredArc (const float centreX, const float centreY,
  7190. const float radiusX, const float radiusY,
  7191. const float rotationOfEllipse,
  7192. const float fromRadians,
  7193. const float toRadians,
  7194. const bool startAsNewSubPath = false) throw();
  7195. void addPieSegment (const float x, const float y,
  7196. const float width, const float height,
  7197. const float fromRadians,
  7198. const float toRadians,
  7199. const float innerCircleProportionalSize);
  7200. void addLineSegment (const float startX, const float startY,
  7201. const float endX, const float endY,
  7202. float lineThickness) throw();
  7203. void addArrow (const float startX, const float startY,
  7204. const float endX, const float endY,
  7205. float lineThickness,
  7206. float arrowheadWidth,
  7207. float arrowheadLength) throw();
  7208. void addStar (const float centreX,
  7209. const float centreY,
  7210. const int numberOfPoints,
  7211. const float innerRadius,
  7212. const float outerRadius,
  7213. const float startAngle = 0.0f);
  7214. void addBubble (float bodyX, float bodyY,
  7215. float bodyW, float bodyH,
  7216. float cornerSize,
  7217. float arrowTipX,
  7218. float arrowTipY,
  7219. int whichSide,
  7220. float arrowPositionAlongEdgeProportional,
  7221. float arrowWidth);
  7222. void addPath (const Path& pathToAppend) throw();
  7223. void addPath (const Path& pathToAppend,
  7224. const AffineTransform& transformToApply) throw();
  7225. void swapWithPath (Path& other);
  7226. void applyTransform (const AffineTransform& transform) throw();
  7227. void scaleToFit (const float x, const float y,
  7228. const float width, const float height,
  7229. const bool preserveProportions) throw();
  7230. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7231. const float width, const float height,
  7232. const bool preserveProportions,
  7233. const Justification& justificationType = Justification::centred) const throw();
  7234. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7235. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7236. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7237. class JUCE_API Iterator
  7238. {
  7239. public:
  7240. Iterator (const Path& path);
  7241. ~Iterator();
  7242. bool next();
  7243. enum PathElementType
  7244. {
  7245. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7246. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7247. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7248. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7249. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7250. };
  7251. PathElementType elementType;
  7252. float x1, y1, x2, y2, x3, y3;
  7253. private:
  7254. const Path& path;
  7255. int index;
  7256. Iterator (const Iterator&);
  7257. Iterator& operator= (const Iterator&);
  7258. };
  7259. void loadPathFromStream (InputStream& source);
  7260. void loadPathFromData (const unsigned char* const data,
  7261. const int numberOfBytes) throw();
  7262. void writePathToStream (OutputStream& destination) const;
  7263. const String toString() const;
  7264. void restoreFromString (const String& stringVersion);
  7265. juce_UseDebuggingNewOperator
  7266. private:
  7267. friend class PathFlatteningIterator;
  7268. friend class Path::Iterator;
  7269. ArrayAllocationBase <float, DummyCriticalSection> data;
  7270. int numElements;
  7271. float pathXMin, pathXMax, pathYMin, pathYMax;
  7272. bool useNonZeroWinding;
  7273. static const float lineMarker;
  7274. static const float moveMarker;
  7275. static const float quadMarker;
  7276. static const float cubicMarker;
  7277. static const float closeSubPathMarker;
  7278. };
  7279. #endif // __JUCE_PATH_JUCEHEADER__
  7280. /*** End of inlined file: juce_Path.h ***/
  7281. class Font;
  7282. class JUCE_API Typeface : public ReferenceCountedObject
  7283. {
  7284. public:
  7285. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7286. const String getName() const throw() { return name; }
  7287. static const Ptr createSystemTypefaceFor (const Font& font);
  7288. virtual ~Typeface();
  7289. virtual float getAscent() const = 0;
  7290. virtual float getDescent() const = 0;
  7291. virtual float getStringWidth (const String& text) = 0;
  7292. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7293. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7294. juce_UseDebuggingNewOperator
  7295. protected:
  7296. String name;
  7297. Typeface (const String& name) throw();
  7298. private:
  7299. Typeface (const Typeface&);
  7300. Typeface& operator= (const Typeface&);
  7301. };
  7302. class JUCE_API CustomTypeface : public Typeface
  7303. {
  7304. public:
  7305. CustomTypeface();
  7306. CustomTypeface (InputStream& serialisedTypefaceStream);
  7307. ~CustomTypeface();
  7308. void clear();
  7309. void setCharacteristics (const String& name, const float ascent,
  7310. const bool isBold, const bool isItalic,
  7311. const juce_wchar defaultCharacter) throw();
  7312. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7313. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7314. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7315. bool writeToStream (OutputStream& outputStream);
  7316. // The following methods implement the basic Typeface behaviour.
  7317. float getAscent() const;
  7318. float getDescent() const;
  7319. float getStringWidth (const String& text);
  7320. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7321. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7322. int getGlyphForCharacter (juce_wchar character);
  7323. juce_UseDebuggingNewOperator
  7324. protected:
  7325. juce_wchar defaultCharacter;
  7326. float ascent;
  7327. bool isBold, isItalic;
  7328. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7329. private:
  7330. class GlyphInfo;
  7331. friend class OwnedArray<GlyphInfo>;
  7332. OwnedArray <GlyphInfo> glyphs;
  7333. short lookupTable [128];
  7334. CustomTypeface (const CustomTypeface&);
  7335. CustomTypeface& operator= (const CustomTypeface&);
  7336. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7337. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7338. };
  7339. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7340. /*** End of inlined file: juce_Typeface.h ***/
  7341. class LowLevelGraphicsContext;
  7342. class JUCE_API Font
  7343. {
  7344. public:
  7345. enum FontStyleFlags
  7346. {
  7347. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7348. bold = 1, /**< boldens the font. @see setStyleFlags */
  7349. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7350. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7351. };
  7352. Font (const float fontHeight,
  7353. const int styleFlags = plain) throw();
  7354. Font (const String& typefaceName,
  7355. const float fontHeight,
  7356. const int styleFlags) throw();
  7357. Font (const Font& other) throw();
  7358. Font (const Typeface::Ptr& typeface) throw();
  7359. Font() throw();
  7360. Font& operator= (const Font& other) throw();
  7361. bool operator== (const Font& other) const throw();
  7362. bool operator!= (const Font& other) const throw();
  7363. ~Font() throw();
  7364. void setTypefaceName (const String& faceName) throw();
  7365. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7366. static const String getDefaultSansSerifFontName() throw();
  7367. static const String getDefaultSerifFontName() throw();
  7368. static const String getDefaultMonospacedFontName() throw();
  7369. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7370. float getHeight() const throw() { return font->height; }
  7371. void setHeight (float newHeight) throw();
  7372. void setHeightWithoutChangingWidth (float newHeight) throw();
  7373. float getAscent() const throw();
  7374. float getDescent() const throw();
  7375. int getStyleFlags() const throw() { return font->styleFlags; }
  7376. void setStyleFlags (const int newFlags) throw();
  7377. void setBold (const bool shouldBeBold) throw();
  7378. bool isBold() const throw();
  7379. void setItalic (const bool shouldBeItalic) throw();
  7380. bool isItalic() const throw();
  7381. void setUnderline (const bool shouldBeUnderlined) throw();
  7382. bool isUnderlined() const throw();
  7383. void setHorizontalScale (const float scaleFactor) throw();
  7384. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7385. void setExtraKerningFactor (const float extraKerning) throw();
  7386. float getExtraKerningFactor() const throw() { return font->kerning; }
  7387. void setSizeAndStyle (float newHeight,
  7388. const int newStyleFlags,
  7389. const float newHorizontalScale,
  7390. const float newKerningAmount) throw();
  7391. int getStringWidth (const String& text) const throw();
  7392. float getStringWidthFloat (const String& text) const throw();
  7393. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7394. Typeface* getTypeface() const throw();
  7395. static void findFonts (Array<Font>& results) throw();
  7396. static const StringArray findAllTypefaceNames() throw();
  7397. static const String getFallbackFontName() throw();
  7398. static void setFallbackFontName (const String& name) throw();
  7399. juce_UseDebuggingNewOperator
  7400. private:
  7401. friend class FontGlyphAlphaMap;
  7402. friend class TypefaceCache;
  7403. class SharedFontInternal : public ReferenceCountedObject
  7404. {
  7405. public:
  7406. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7407. const float kerning, const float ascent, const int styleFlags,
  7408. Typeface* const typeface) throw();
  7409. SharedFontInternal (const SharedFontInternal& other) throw();
  7410. String typefaceName;
  7411. float height, horizontalScale, kerning, ascent;
  7412. int styleFlags;
  7413. Typeface::Ptr typeface;
  7414. };
  7415. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7416. void dupeInternalIfShared() throw();
  7417. };
  7418. #endif // __JUCE_FONT_JUCEHEADER__
  7419. /*** End of inlined file: juce_Font.h ***/
  7420. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7421. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7422. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7423. class JUCE_API PathStrokeType
  7424. {
  7425. public:
  7426. enum JointStyle
  7427. {
  7428. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7429. Note that for angles that curve back on themselves, drawing a
  7430. mitre could require extending the point too far away from the
  7431. path, so a mitre limit is imposed and any corners that exceed it
  7432. are drawn as bevelled instead. */
  7433. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7434. beveled /**< Indicates that corners should be drawn with a line flattening their
  7435. outside edge. */
  7436. };
  7437. enum EndCapStyle
  7438. {
  7439. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7440. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7441. the thickness of the stroke. */
  7442. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7443. };
  7444. PathStrokeType (const float strokeThickness,
  7445. const JointStyle jointStyle = mitered,
  7446. const EndCapStyle endStyle = butt) throw();
  7447. PathStrokeType (const PathStrokeType& other) throw();
  7448. PathStrokeType& operator= (const PathStrokeType& other) throw();
  7449. ~PathStrokeType() throw();
  7450. void createStrokedPath (Path& destPath,
  7451. const Path& sourcePath,
  7452. const AffineTransform& transform = AffineTransform::identity,
  7453. const float extraAccuracy = 1.0f) const;
  7454. void createDashedStroke (Path& destPath,
  7455. const Path& sourcePath,
  7456. const float* dashLengths,
  7457. int numDashLengths,
  7458. const AffineTransform& transform = AffineTransform::identity,
  7459. const float extraAccuracy = 1.0f) const;
  7460. float getStrokeThickness() const throw() { return thickness; }
  7461. JointStyle getJointStyle() const throw() { return jointStyle; }
  7462. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7463. juce_UseDebuggingNewOperator
  7464. bool operator== (const PathStrokeType& other) const throw();
  7465. bool operator!= (const PathStrokeType& other) const throw();
  7466. private:
  7467. float thickness;
  7468. JointStyle jointStyle;
  7469. EndCapStyle endStyle;
  7470. };
  7471. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7472. /*** End of inlined file: juce_PathStrokeType.h ***/
  7473. /*** Start of inlined file: juce_Line.h ***/
  7474. #ifndef __JUCE_LINE_JUCEHEADER__
  7475. #define __JUCE_LINE_JUCEHEADER__
  7476. class JUCE_API Line
  7477. {
  7478. public:
  7479. Line() throw();
  7480. Line (const Line& other) throw();
  7481. Line (const float startX,
  7482. const float startY,
  7483. const float endX,
  7484. const float endY) throw();
  7485. Line (const Point<float>& start,
  7486. const Point<float>& end) throw();
  7487. Line& operator= (const Line& other) throw();
  7488. ~Line() throw();
  7489. inline float getStartX() const throw() { return startX; }
  7490. inline float getStartY() const throw() { return startY; }
  7491. inline float getEndX() const throw() { return endX; }
  7492. inline float getEndY() const throw() { return endY; }
  7493. const Point<float> getStart() const throw();
  7494. const Point<float> getEnd() const throw();
  7495. void setStart (const float newStartX,
  7496. const float newStartY) throw();
  7497. void setEnd (const float newEndX,
  7498. const float newEndY) throw();
  7499. void setStart (const Point<float>& newStart) throw();
  7500. void setEnd (const Point<float>& newEnd) throw();
  7501. void applyTransform (const AffineTransform& transform) throw();
  7502. float getLength() const throw();
  7503. bool isVertical() const throw();
  7504. bool isHorizontal() const throw();
  7505. float getAngle() const throw();
  7506. bool operator== (const Line& other) const throw();
  7507. bool operator!= (const Line& other) const throw();
  7508. bool intersects (const Line& line,
  7509. float& intersectionX,
  7510. float& intersectionY) const throw();
  7511. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7512. const Point<float> getPointAlongLine (const float distanceFromStart,
  7513. const float perpendicularDistance) const throw();
  7514. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7515. float getDistanceFromLine (const float x,
  7516. const float y) const throw();
  7517. float findNearestPointTo (const float x,
  7518. const float y) const throw();
  7519. bool isPointAbove (const float x, const float y) const throw();
  7520. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7521. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7522. bool clipToPath (const Path& path,
  7523. const bool keepSectionOutsidePath) throw();
  7524. juce_UseDebuggingNewOperator
  7525. private:
  7526. float startX, startY, endX, endY;
  7527. };
  7528. #endif // __JUCE_LINE_JUCEHEADER__
  7529. /*** End of inlined file: juce_Line.h ***/
  7530. /*** Start of inlined file: juce_Colours.h ***/
  7531. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7532. #define __JUCE_COLOURS_JUCEHEADER__
  7533. /*** Start of inlined file: juce_Colour.h ***/
  7534. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7535. #define __JUCE_COLOUR_JUCEHEADER__
  7536. /*** Start of inlined file: juce_PixelFormats.h ***/
  7537. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7538. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7539. #if JUCE_MSVC
  7540. #pragma pack (push, 1)
  7541. #define PACKED
  7542. #elif JUCE_GCC
  7543. #define PACKED __attribute__((packed))
  7544. #else
  7545. #define PACKED
  7546. #endif
  7547. class PixelRGB;
  7548. class PixelAlpha;
  7549. class JUCE_API PixelARGB
  7550. {
  7551. public:
  7552. PixelARGB() throw() {}
  7553. ~PixelARGB() throw() {}
  7554. PixelARGB (const uint32 argb_) throw()
  7555. : argb (argb_)
  7556. {
  7557. }
  7558. forcedinline uint32 getARGB() const throw() { return argb; }
  7559. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7560. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7561. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7562. forcedinline uint8 getRed() const throw() { return components.r; }
  7563. forcedinline uint8 getGreen() const throw() { return components.g; }
  7564. forcedinline uint8 getBlue() const throw() { return components.b; }
  7565. forcedinline void blend (const PixelARGB& src) throw()
  7566. {
  7567. uint32 sargb = src.getARGB();
  7568. const uint32 alpha = 0x100 - (sargb >> 24);
  7569. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7570. sargb += 0xff00ff00 & (getAG() * alpha);
  7571. argb = sargb;
  7572. }
  7573. forcedinline void blend (const PixelAlpha& src) throw();
  7574. forcedinline void blend (const PixelRGB& src) throw();
  7575. template <class Pixel>
  7576. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7577. {
  7578. ++extraAlpha;
  7579. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7580. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7581. const uint32 alpha = 0x100 - (sargb >> 24);
  7582. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7583. sargb += 0xff00ff00 & (getAG() * alpha);
  7584. argb = sargb;
  7585. }
  7586. template <class Pixel>
  7587. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7588. {
  7589. uint32 drb = getRB();
  7590. drb += (((src.getRB() - drb) * amount) >> 8);
  7591. drb &= 0x00ff00ff;
  7592. uint32 dag = getAG();
  7593. dag += (((src.getAG() - dag) * amount) >> 8);
  7594. dag &= 0x00ff00ff;
  7595. dag <<= 8;
  7596. dag |= drb;
  7597. argb = dag;
  7598. }
  7599. template <class Pixel>
  7600. forcedinline void set (const Pixel& src) throw()
  7601. {
  7602. argb = src.getARGB();
  7603. }
  7604. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7605. {
  7606. components.a = newAlpha;
  7607. }
  7608. forcedinline void multiplyAlpha (int multiplier) throw()
  7609. {
  7610. ++multiplier;
  7611. argb = ((multiplier * getAG()) & 0xff00ff00)
  7612. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7613. }
  7614. forcedinline void multiplyAlpha (const float multiplier) throw()
  7615. {
  7616. multiplyAlpha ((int) (multiplier * 256.0f));
  7617. }
  7618. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7619. {
  7620. components.b = b;
  7621. components.g = g;
  7622. components.r = r;
  7623. components.a = a;
  7624. }
  7625. forcedinline void premultiply() throw()
  7626. {
  7627. const uint32 alpha = components.a;
  7628. if (alpha < 0xff)
  7629. {
  7630. if (alpha == 0)
  7631. {
  7632. components.b = 0;
  7633. components.g = 0;
  7634. components.r = 0;
  7635. }
  7636. else
  7637. {
  7638. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7639. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7640. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7641. }
  7642. }
  7643. }
  7644. forcedinline void unpremultiply() throw()
  7645. {
  7646. const uint32 alpha = components.a;
  7647. if (alpha < 0xff)
  7648. {
  7649. if (alpha == 0)
  7650. {
  7651. components.b = 0;
  7652. components.g = 0;
  7653. components.r = 0;
  7654. }
  7655. else
  7656. {
  7657. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7658. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7659. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7660. }
  7661. }
  7662. }
  7663. forcedinline void desaturate() throw()
  7664. {
  7665. if (components.a < 0xff && components.a > 0)
  7666. {
  7667. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7668. components.r = components.g = components.b
  7669. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7670. }
  7671. else
  7672. {
  7673. components.r = components.g = components.b
  7674. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7675. }
  7676. }
  7677. #if JUCE_BIG_ENDIAN
  7678. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7679. #else
  7680. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7681. #endif
  7682. private:
  7683. union
  7684. {
  7685. uint32 argb;
  7686. struct
  7687. {
  7688. #if JUCE_BIG_ENDIAN
  7689. uint8 a : 8, r : 8, g : 8, b : 8;
  7690. #else
  7691. uint8 b, g, r, a;
  7692. #endif
  7693. } PACKED components;
  7694. };
  7695. } PACKED;
  7696. class JUCE_API PixelRGB
  7697. {
  7698. public:
  7699. PixelRGB() throw() {}
  7700. ~PixelRGB() throw() {}
  7701. PixelRGB (const uint32 argb) throw()
  7702. {
  7703. r = (uint8) (argb >> 16);
  7704. g = (uint8) (argb >> 8);
  7705. b = (uint8) (argb);
  7706. }
  7707. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7708. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7709. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7710. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7711. forcedinline uint8 getRed() const throw() { return r; }
  7712. forcedinline uint8 getGreen() const throw() { return g; }
  7713. forcedinline uint8 getBlue() const throw() { return b; }
  7714. forcedinline void blend (const PixelARGB& src) throw()
  7715. {
  7716. uint32 sargb = src.getARGB();
  7717. const uint32 alpha = 0x100 - (sargb >> 24);
  7718. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7719. sargb += 0x0000ff00 & (g * alpha);
  7720. r = (uint8) (sargb >> 16);
  7721. g = (uint8) (sargb >> 8);
  7722. b = (uint8) sargb;
  7723. }
  7724. forcedinline void blend (const PixelRGB& src) throw()
  7725. {
  7726. set (src);
  7727. }
  7728. forcedinline void blend (const PixelAlpha& src) throw();
  7729. template <class Pixel>
  7730. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7731. {
  7732. ++extraAlpha;
  7733. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7734. const uint32 sag = extraAlpha * src.getAG();
  7735. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7736. const uint32 alpha = 0x100 - (sargb >> 24);
  7737. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7738. sargb += 0x0000ff00 & (g * alpha);
  7739. b = (uint8) sargb;
  7740. g = (uint8) (sargb >> 8);
  7741. r = (uint8) (sargb >> 16);
  7742. }
  7743. template <class Pixel>
  7744. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7745. {
  7746. uint32 drb = getRB();
  7747. drb += (((src.getRB() - drb) * amount) >> 8);
  7748. uint32 dag = getAG();
  7749. dag += (((src.getAG() - dag) * amount) >> 8);
  7750. b = (uint8) drb;
  7751. g = (uint8) dag;
  7752. r = (uint8) (drb >> 16);
  7753. }
  7754. template <class Pixel>
  7755. forcedinline void set (const Pixel& src) throw()
  7756. {
  7757. b = src.getBlue();
  7758. g = src.getGreen();
  7759. r = src.getRed();
  7760. }
  7761. forcedinline void setAlpha (const uint8) throw() {}
  7762. forcedinline void multiplyAlpha (int) throw() {}
  7763. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7764. {
  7765. r = r_;
  7766. g = g_;
  7767. b = b_;
  7768. }
  7769. forcedinline void premultiply() throw() {}
  7770. forcedinline void unpremultiply() throw() {}
  7771. forcedinline void desaturate() throw()
  7772. {
  7773. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7774. }
  7775. #if JUCE_MAC
  7776. enum { indexR = 0, indexG = 1, indexB = 2 };
  7777. #else
  7778. enum { indexR = 2, indexG = 1, indexB = 0 };
  7779. #endif
  7780. private:
  7781. #if JUCE_MAC
  7782. uint8 r, g, b;
  7783. #else
  7784. uint8 b, g, r;
  7785. #endif
  7786. } PACKED;
  7787. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7788. {
  7789. set (src);
  7790. }
  7791. class JUCE_API PixelAlpha
  7792. {
  7793. public:
  7794. PixelAlpha() throw() {}
  7795. ~PixelAlpha() throw() {}
  7796. PixelAlpha (const uint32 argb) throw()
  7797. {
  7798. a = (uint8) (argb >> 24);
  7799. }
  7800. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7801. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7802. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7803. forcedinline uint8 getAlpha() const throw() { return a; }
  7804. forcedinline uint8 getRed() const throw() { return 0; }
  7805. forcedinline uint8 getGreen() const throw() { return 0; }
  7806. forcedinline uint8 getBlue() const throw() { return 0; }
  7807. template <class Pixel>
  7808. forcedinline void blend (const Pixel& src) throw()
  7809. {
  7810. const int srcA = src.getAlpha();
  7811. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7812. }
  7813. template <class Pixel>
  7814. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7815. {
  7816. ++extraAlpha;
  7817. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  7818. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  7819. }
  7820. template <class Pixel>
  7821. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7822. {
  7823. a += ((src,getAlpha() - a) * amount) >> 8;
  7824. }
  7825. template <class Pixel>
  7826. forcedinline void set (const Pixel& src) throw()
  7827. {
  7828. a = src.getAlpha();
  7829. }
  7830. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7831. {
  7832. a = newAlpha;
  7833. }
  7834. forcedinline void multiplyAlpha (int multiplier) throw()
  7835. {
  7836. ++multiplier;
  7837. a = (uint8) ((a * multiplier) >> 8);
  7838. }
  7839. forcedinline void multiplyAlpha (const float multiplier) throw()
  7840. {
  7841. a = (uint8) (a * multiplier);
  7842. }
  7843. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  7844. {
  7845. a = a_;
  7846. }
  7847. forcedinline void premultiply() throw()
  7848. {
  7849. }
  7850. forcedinline void unpremultiply() throw()
  7851. {
  7852. }
  7853. forcedinline void desaturate() throw()
  7854. {
  7855. }
  7856. private:
  7857. uint8 a : 8;
  7858. } PACKED;
  7859. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  7860. {
  7861. blend (PixelARGB (src.getARGB()));
  7862. }
  7863. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  7864. {
  7865. uint32 sargb = src.getARGB();
  7866. const uint32 alpha = 0x100 - (sargb >> 24);
  7867. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7868. sargb += 0xff00ff00 & (getAG() * alpha);
  7869. argb = sargb;
  7870. }
  7871. #if JUCE_MSVC
  7872. #pragma pack (pop)
  7873. #endif
  7874. #undef PACKED
  7875. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  7876. /*** End of inlined file: juce_PixelFormats.h ***/
  7877. class JUCE_API Colour
  7878. {
  7879. public:
  7880. Colour() throw();
  7881. Colour (const Colour& other) throw();
  7882. explicit Colour (const uint32 argb) throw();
  7883. Colour (const uint8 red,
  7884. const uint8 green,
  7885. const uint8 blue) throw();
  7886. static const Colour fromRGB (const uint8 red,
  7887. const uint8 green,
  7888. const uint8 blue) throw();
  7889. Colour (const uint8 red,
  7890. const uint8 green,
  7891. const uint8 blue,
  7892. const uint8 alpha) throw();
  7893. static const Colour fromRGBA (const uint8 red,
  7894. const uint8 green,
  7895. const uint8 blue,
  7896. const uint8 alpha) throw();
  7897. Colour (const uint8 red,
  7898. const uint8 green,
  7899. const uint8 blue,
  7900. const float alpha) throw();
  7901. static const Colour fromRGBAFloat (const uint8 red,
  7902. const uint8 green,
  7903. const uint8 blue,
  7904. const float alpha) throw();
  7905. Colour (const float hue,
  7906. const float saturation,
  7907. const float brightness,
  7908. const uint8 alpha) throw();
  7909. Colour (const float hue,
  7910. const float saturation,
  7911. const float brightness,
  7912. const float alpha) throw();
  7913. static const Colour fromHSV (const float hue,
  7914. const float saturation,
  7915. const float brightness,
  7916. const float alpha) throw();
  7917. ~Colour() throw();
  7918. Colour& operator= (const Colour& other) throw();
  7919. bool operator== (const Colour& other) const throw();
  7920. bool operator!= (const Colour& other) const throw();
  7921. uint8 getRed() const throw() { return argb.getRed(); }
  7922. uint8 getGreen() const throw() { return argb.getGreen(); }
  7923. uint8 getBlue() const throw() { return argb.getBlue(); }
  7924. float getFloatRed() const throw();
  7925. float getFloatGreen() const throw();
  7926. float getFloatBlue() const throw();
  7927. const PixelARGB getPixelARGB() const throw();
  7928. uint32 getARGB() const throw();
  7929. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  7930. float getFloatAlpha() const throw();
  7931. bool isOpaque() const throw();
  7932. bool isTransparent() const throw();
  7933. const Colour withAlpha (const uint8 newAlpha) const throw();
  7934. const Colour withAlpha (const float newAlpha) const throw();
  7935. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  7936. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  7937. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  7938. float getHue() const throw();
  7939. float getSaturation() const throw();
  7940. float getBrightness() const throw();
  7941. void getHSB (float& hue,
  7942. float& saturation,
  7943. float& brightness) const throw();
  7944. const Colour withHue (const float newHue) const throw();
  7945. const Colour withSaturation (const float newSaturation) const throw();
  7946. const Colour withBrightness (const float newBrightness) const throw();
  7947. const Colour withRotatedHue (const float amountToRotate) const throw();
  7948. const Colour withMultipliedSaturation (const float multiplier) const throw();
  7949. const Colour withMultipliedBrightness (const float amount) const throw();
  7950. const Colour brighter (float amountBrighter = 0.4f) const throw();
  7951. const Colour darker (float amountDarker = 0.4f) const throw();
  7952. const Colour contrasting (const float amount = 1.0f) const throw();
  7953. static const Colour contrasting (const Colour& colour1,
  7954. const Colour& colour2) throw();
  7955. static const Colour greyLevel (const float brightness) throw();
  7956. const String toString() const throw();
  7957. static const Colour fromString (const String& encodedColourString);
  7958. juce_UseDebuggingNewOperator
  7959. private:
  7960. PixelARGB argb;
  7961. };
  7962. #endif // __JUCE_COLOUR_JUCEHEADER__
  7963. /*** End of inlined file: juce_Colour.h ***/
  7964. class Colours
  7965. {
  7966. public:
  7967. static JUCE_API const Colour
  7968. transparentBlack, /**< ARGB = 0x00000000 */
  7969. transparentWhite, /**< ARGB = 0x00ffffff */
  7970. black, /**< ARGB = 0xff000000 */
  7971. white, /**< ARGB = 0xffffffff */
  7972. blue, /**< ARGB = 0xff0000ff */
  7973. grey, /**< ARGB = 0xff808080 */
  7974. green, /**< ARGB = 0xff008000 */
  7975. red, /**< ARGB = 0xffff0000 */
  7976. yellow, /**< ARGB = 0xffffff00 */
  7977. aliceblue, antiquewhite, aqua, aquamarine,
  7978. azure, beige, bisque, blanchedalmond,
  7979. blueviolet, brown, burlywood, cadetblue,
  7980. chartreuse, chocolate, coral, cornflowerblue,
  7981. cornsilk, crimson, cyan, darkblue,
  7982. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  7983. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  7984. darkorchid, darkred, darksalmon, darkseagreen,
  7985. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  7986. deeppink, deepskyblue, dimgrey, dodgerblue,
  7987. firebrick, floralwhite, forestgreen, fuchsia,
  7988. gainsboro, gold, goldenrod, greenyellow,
  7989. honeydew, hotpink, indianred, indigo,
  7990. ivory, khaki, lavender, lavenderblush,
  7991. lemonchiffon, lightblue, lightcoral, lightcyan,
  7992. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  7993. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  7994. lightsteelblue, lightyellow, lime, limegreen,
  7995. linen, magenta, maroon, mediumaquamarine,
  7996. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  7997. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  7998. midnightblue, mintcream, mistyrose, navajowhite,
  7999. navy, oldlace, olive, olivedrab,
  8000. orange, orangered, orchid, palegoldenrod,
  8001. palegreen, paleturquoise, palevioletred, papayawhip,
  8002. peachpuff, peru, pink, plum,
  8003. powderblue, purple, rosybrown, royalblue,
  8004. saddlebrown, salmon, sandybrown, seagreen,
  8005. seashell, sienna, silver, skyblue,
  8006. slateblue, slategrey, snow, springgreen,
  8007. steelblue, tan, teal, thistle,
  8008. tomato, turquoise, violet, wheat,
  8009. whitesmoke, yellowgreen;
  8010. static JUCE_API const Colour findColourForName (const String& colourName,
  8011. const Colour& defaultColour);
  8012. private:
  8013. // this isn't a class you should ever instantiate - it's just here for the
  8014. // static values in it.
  8015. Colours();
  8016. };
  8017. #endif // __JUCE_COLOURS_JUCEHEADER__
  8018. /*** End of inlined file: juce_Colours.h ***/
  8019. /*** Start of inlined file: juce_FillType.h ***/
  8020. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8021. #define __JUCE_FILLTYPE_JUCEHEADER__
  8022. /*** Start of inlined file: juce_ColourGradient.h ***/
  8023. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8024. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8025. class JUCE_API ColourGradient
  8026. {
  8027. public:
  8028. ColourGradient (const Colour& colour1,
  8029. const float x1,
  8030. const float y1,
  8031. const Colour& colour2,
  8032. const float x2,
  8033. const float y2,
  8034. const bool isRadial) throw();
  8035. ColourGradient() throw();
  8036. ~ColourGradient() throw();
  8037. void clearColours() throw();
  8038. void addColour (const double proportionAlongGradient,
  8039. const Colour& colour) throw();
  8040. void multiplyOpacity (const float multiplier) throw();
  8041. int getNumColours() const throw();
  8042. double getColourPosition (const int index) const throw();
  8043. const Colour getColour (const int index) const throw();
  8044. const Colour getColourAtPosition (const float position) const throw();
  8045. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8046. bool isOpaque() const throw();
  8047. bool isInvisible() const throw();
  8048. float x1;
  8049. float y1;
  8050. float x2;
  8051. float y2;
  8052. bool isRadial;
  8053. juce_UseDebuggingNewOperator
  8054. private:
  8055. Array <uint32> colours;
  8056. };
  8057. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8058. /*** End of inlined file: juce_ColourGradient.h ***/
  8059. class Image;
  8060. class JUCE_API FillType
  8061. {
  8062. public:
  8063. FillType() throw();
  8064. FillType (const Colour& colour) throw();
  8065. FillType (const ColourGradient& gradient) throw();
  8066. FillType (const Image& image, const AffineTransform& transform) throw();
  8067. FillType (const FillType& other) throw();
  8068. FillType& operator= (const FillType& other) throw();
  8069. ~FillType() throw();
  8070. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8071. bool isGradient() const throw() { return gradient != 0; }
  8072. bool isTiledImage() const throw() { return image != 0; }
  8073. void setColour (const Colour& newColour) throw();
  8074. void setGradient (const ColourGradient& newGradient) throw();
  8075. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8076. void setOpacity (const float newOpacity) throw();
  8077. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8078. Colour colour;
  8079. ScopedPointer <ColourGradient> gradient;
  8080. const Image* image;
  8081. AffineTransform transform;
  8082. juce_UseDebuggingNewOperator
  8083. };
  8084. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8085. /*** End of inlined file: juce_FillType.h ***/
  8086. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8087. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8088. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8089. class JUCE_API RectanglePlacement
  8090. {
  8091. public:
  8092. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  8093. RectanglePlacement (const RectanglePlacement& other) throw();
  8094. RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8095. enum
  8096. {
  8097. xLeft = 1,
  8098. xRight = 2,
  8099. xMid = 4,
  8100. yTop = 8,
  8101. yBottom = 16,
  8102. yMid = 32,
  8103. stretchToFit = 64,
  8104. fillDestination = 128,
  8105. onlyReduceInSize = 256,
  8106. onlyIncreaseInSize = 512,
  8107. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8108. centred = 4 + 32
  8109. };
  8110. inline int getFlags() const throw() { return flags; }
  8111. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8112. void applyTo (double& sourceX,
  8113. double& sourceY,
  8114. double& sourceW,
  8115. double& sourceH,
  8116. const double destinationX,
  8117. const double destinationY,
  8118. const double destinationW,
  8119. const double destinationH) const throw();
  8120. const AffineTransform getTransformToFit (float sourceX,
  8121. float sourceY,
  8122. float sourceW,
  8123. float sourceH,
  8124. const float destinationX,
  8125. const float destinationY,
  8126. const float destinationW,
  8127. const float destinationH) const throw();
  8128. private:
  8129. int flags;
  8130. };
  8131. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8132. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8133. class LowLevelGraphicsContext;
  8134. class Image;
  8135. class RectangleList;
  8136. class JUCE_API Graphics
  8137. {
  8138. public:
  8139. Graphics (Image& imageToDrawOnto) throw();
  8140. ~Graphics() throw();
  8141. void setColour (const Colour& newColour) throw();
  8142. void setOpacity (const float newOpacity) throw();
  8143. void setGradientFill (const ColourGradient& gradient) throw();
  8144. void setTiledImageFill (const Image& imageToUse,
  8145. const int anchorX,
  8146. const int anchorY,
  8147. const float opacity) throw();
  8148. void setFillType (const FillType& newFill) throw();
  8149. void setFont (const Font& newFont) throw();
  8150. void setFont (const float newFontHeight,
  8151. const int fontStyleFlags = Font::plain) throw();
  8152. void drawSingleLineText (const String& text,
  8153. const int startX,
  8154. const int baselineY) const throw();
  8155. void drawMultiLineText (const String& text,
  8156. const int startX,
  8157. const int baselineY,
  8158. const int maximumLineWidth) const throw();
  8159. void drawTextAsPath (const String& text,
  8160. const AffineTransform& transform) const throw();
  8161. void drawText (const String& text,
  8162. const int x,
  8163. const int y,
  8164. const int width,
  8165. const int height,
  8166. const Justification& justificationType,
  8167. const bool useEllipsesIfTooBig) const throw();
  8168. void drawFittedText (const String& text,
  8169. const int x,
  8170. const int y,
  8171. const int width,
  8172. const int height,
  8173. const Justification& justificationFlags,
  8174. const int maximumNumberOfLines,
  8175. const float minimumHorizontalScale = 0.7f) const throw();
  8176. void fillAll() const throw();
  8177. void fillAll (const Colour& colourToUse) const throw();
  8178. void fillRect (int x,
  8179. int y,
  8180. int width,
  8181. int height) const throw();
  8182. void fillRect (const Rectangle<int>& rectangle) const throw();
  8183. void fillRect (const float x,
  8184. const float y,
  8185. const float width,
  8186. const float height) const throw();
  8187. void fillRoundedRectangle (const float x,
  8188. const float y,
  8189. const float width,
  8190. const float height,
  8191. const float cornerSize) const throw();
  8192. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8193. const float cornerSize) const throw();
  8194. void fillCheckerBoard (int x, int y,
  8195. int width, int height,
  8196. const int checkWidth,
  8197. const int checkHeight,
  8198. const Colour& colour1,
  8199. const Colour& colour2) const throw();
  8200. void drawRect (const int x,
  8201. const int y,
  8202. const int width,
  8203. const int height,
  8204. const int lineThickness = 1) const throw();
  8205. void drawRect (const float x,
  8206. const float y,
  8207. const float width,
  8208. const float height,
  8209. const float lineThickness = 1.0f) const throw();
  8210. void drawRect (const Rectangle<int>& rectangle,
  8211. const int lineThickness = 1) const throw();
  8212. void drawRoundedRectangle (const float x,
  8213. const float y,
  8214. const float width,
  8215. const float height,
  8216. const float cornerSize,
  8217. const float lineThickness) const throw();
  8218. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8219. const float cornerSize,
  8220. const float lineThickness) const throw();
  8221. void drawBevel (const int x,
  8222. const int y,
  8223. const int width,
  8224. const int height,
  8225. const int bevelThickness,
  8226. const Colour& topLeftColour = Colours::white,
  8227. const Colour& bottomRightColour = Colours::black,
  8228. const bool useGradient = true,
  8229. const bool sharpEdgeOnOutside = true) const throw();
  8230. void setPixel (int x, int y) const throw();
  8231. void fillEllipse (const float x,
  8232. const float y,
  8233. const float width,
  8234. const float height) const throw();
  8235. void drawEllipse (const float x,
  8236. const float y,
  8237. const float width,
  8238. const float height,
  8239. const float lineThickness) const throw();
  8240. void drawLine (float startX,
  8241. float startY,
  8242. float endX,
  8243. float endY) const throw();
  8244. void drawLine (const float startX,
  8245. const float startY,
  8246. const float endX,
  8247. const float endY,
  8248. const float lineThickness) const throw();
  8249. void drawLine (const Line& line) const throw();
  8250. void drawLine (const Line& line,
  8251. const float lineThickness) const throw();
  8252. void drawDashedLine (const float startX,
  8253. const float startY,
  8254. const float endX,
  8255. const float endY,
  8256. const float* const dashLengths,
  8257. const int numDashLengths,
  8258. const float lineThickness = 1.0f) const throw();
  8259. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8260. void drawHorizontalLine (const int y, float left, float right) const throw();
  8261. void fillPath (const Path& path,
  8262. const AffineTransform& transform = AffineTransform::identity) const throw();
  8263. void strokePath (const Path& path,
  8264. const PathStrokeType& strokeType,
  8265. const AffineTransform& transform = AffineTransform::identity) const throw();
  8266. void drawArrow (const float startX,
  8267. const float startY,
  8268. const float endX,
  8269. const float endY,
  8270. const float lineThickness,
  8271. const float arrowheadWidth,
  8272. const float arrowheadLength) const throw();
  8273. enum ResamplingQuality
  8274. {
  8275. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8276. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8277. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8278. };
  8279. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8280. void drawImageAt (const Image* const imageToDraw,
  8281. const int topLeftX,
  8282. const int topLeftY,
  8283. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8284. void drawImage (const Image* const imageToDraw,
  8285. int destX,
  8286. int destY,
  8287. int destWidth,
  8288. int destHeight,
  8289. int sourceX,
  8290. int sourceY,
  8291. int sourceWidth,
  8292. int sourceHeight,
  8293. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8294. void drawImageTransformed (const Image* const imageToDraw,
  8295. const Rectangle<int>& imageSubRegion,
  8296. const AffineTransform& transform,
  8297. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8298. void drawImageWithin (const Image* const imageToDraw,
  8299. const int destX,
  8300. const int destY,
  8301. const int destWidth,
  8302. const int destHeight,
  8303. const RectanglePlacement& placementWithinTarget,
  8304. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8305. const Rectangle<int> getClipBounds() const throw();
  8306. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8307. bool reduceClipRegion (const int x, const int y,
  8308. const int width, const int height) throw();
  8309. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8310. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8311. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8312. const AffineTransform& transform) throw();
  8313. void excludeClipRegion (const int x, const int y,
  8314. const int width, const int height) throw();
  8315. bool isClipEmpty() const throw();
  8316. void saveState() throw();
  8317. void restoreState() throw();
  8318. void setOrigin (const int newOriginX,
  8319. const int newOriginY) throw();
  8320. void resetToDefaultState() throw();
  8321. bool isVectorDevice() const throw();
  8322. juce_UseDebuggingNewOperator
  8323. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8324. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8325. private:
  8326. LowLevelGraphicsContext* const context;
  8327. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8328. bool saveStatePending;
  8329. void saveStateIfPending() throw();
  8330. Graphics (const Graphics&);
  8331. Graphics& operator= (const Graphics& other);
  8332. };
  8333. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8334. /*** End of inlined file: juce_Graphics.h ***/
  8335. class JUCE_API ImageEffectFilter
  8336. {
  8337. public:
  8338. virtual void applyEffect (Image& sourceImage,
  8339. Graphics& destContext) = 0;
  8340. virtual ~ImageEffectFilter() {}
  8341. };
  8342. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8343. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8344. /*** Start of inlined file: juce_RectangleList.h ***/
  8345. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8346. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8347. class JUCE_API RectangleList
  8348. {
  8349. public:
  8350. RectangleList() throw();
  8351. RectangleList (const RectangleList& other) throw();
  8352. RectangleList (const Rectangle<int>& rect) throw();
  8353. RectangleList& operator= (const RectangleList& other) throw();
  8354. ~RectangleList() throw();
  8355. bool isEmpty() const throw();
  8356. int getNumRectangles() const throw() { return rects.size(); }
  8357. const Rectangle<int> getRectangle (const int index) const throw();
  8358. void clear() throw();
  8359. void add (const int x, const int y,
  8360. const int w, const int h) throw();
  8361. void add (const Rectangle<int>& rect) throw();
  8362. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8363. void add (const RectangleList& other) throw();
  8364. void subtract (const Rectangle<int>& rect) throw();
  8365. void subtract (const RectangleList& otherList) throw();
  8366. bool clipTo (const Rectangle<int>& rect) throw();
  8367. bool clipTo (const RectangleList& other) throw();
  8368. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8369. void swapWith (RectangleList& otherList) throw();
  8370. bool containsPoint (const int x, const int y) const throw();
  8371. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8372. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8373. bool intersects (const RectangleList& other) const throw();
  8374. const Rectangle<int> getBounds() const throw();
  8375. void consolidate() throw();
  8376. void offsetAll (const int dx, const int dy) throw();
  8377. const Path toPath() const throw();
  8378. class Iterator
  8379. {
  8380. public:
  8381. Iterator (const RectangleList& list) throw();
  8382. ~Iterator() throw();
  8383. bool next() throw();
  8384. const Rectangle<int>* getRectangle() const throw() { return current; }
  8385. juce_UseDebuggingNewOperator
  8386. private:
  8387. const Rectangle<int>* current;
  8388. const RectangleList& owner;
  8389. int index;
  8390. Iterator (const Iterator&);
  8391. Iterator& operator= (const Iterator&);
  8392. };
  8393. juce_UseDebuggingNewOperator
  8394. private:
  8395. friend class Iterator;
  8396. Array <Rectangle<int> > rects;
  8397. };
  8398. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8399. /*** End of inlined file: juce_RectangleList.h ***/
  8400. /*** Start of inlined file: juce_BorderSize.h ***/
  8401. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8402. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8403. class JUCE_API BorderSize
  8404. {
  8405. public:
  8406. BorderSize() throw();
  8407. BorderSize (const BorderSize& other) throw();
  8408. BorderSize (const int topGap,
  8409. const int leftGap,
  8410. const int bottomGap,
  8411. const int rightGap) throw();
  8412. BorderSize (const int allGaps) throw();
  8413. ~BorderSize() throw();
  8414. int getTop() const throw() { return top; }
  8415. int getLeft() const throw() { return left; }
  8416. int getBottom() const throw() { return bottom; }
  8417. int getRight() const throw() { return right; }
  8418. int getTopAndBottom() const throw() { return top + bottom; }
  8419. int getLeftAndRight() const throw() { return left + right; }
  8420. void setTop (const int newTopGap) throw();
  8421. void setLeft (const int newLeftGap) throw();
  8422. void setBottom (const int newBottomGap) throw();
  8423. void setRight (const int newRightGap) throw();
  8424. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8425. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8426. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8427. void addTo (Rectangle<int>& original) const throw();
  8428. bool operator== (const BorderSize& other) const throw();
  8429. bool operator!= (const BorderSize& other) const throw();
  8430. juce_UseDebuggingNewOperator
  8431. private:
  8432. int top, left, bottom, right;
  8433. };
  8434. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8435. /*** End of inlined file: juce_BorderSize.h ***/
  8436. class LookAndFeel;
  8437. class MouseInputSource;
  8438. class MouseInputSourceInternal;
  8439. class ComponentPeer;
  8440. class JUCE_API Component : public MouseListener,
  8441. protected MessageListener
  8442. {
  8443. public:
  8444. Component() throw();
  8445. virtual ~Component();
  8446. Component (const String& componentName) throw();
  8447. const String& getName() const throw() { return componentName_; }
  8448. virtual void setName (const String& newName);
  8449. bool isValidComponent() const throw();
  8450. virtual void setVisible (bool shouldBeVisible);
  8451. bool isVisible() const throw() { return flags.visibleFlag; }
  8452. virtual void visibilityChanged();
  8453. bool isShowing() const throw();
  8454. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8455. const int deltaXToMove = 0,
  8456. const int deltaYToMove = 0,
  8457. const float scaleFactorAtEnd = 1.0f);
  8458. virtual void addToDesktop (int windowStyleFlags,
  8459. void* nativeWindowToAttachTo = 0);
  8460. void removeFromDesktop();
  8461. bool isOnDesktop() const throw();
  8462. ComponentPeer* getPeer() const throw();
  8463. virtual void userTriedToCloseWindow();
  8464. virtual void minimisationStateChanged (bool isNowMinimised);
  8465. void toFront (const bool shouldAlsoGainFocus);
  8466. void toBack();
  8467. void toBehind (Component* const other);
  8468. void setAlwaysOnTop (const bool shouldStayOnTop);
  8469. bool isAlwaysOnTop() const throw();
  8470. inline int getX() const throw() { return bounds_.getX(); }
  8471. inline int getY() const throw() { return bounds_.getY(); }
  8472. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8473. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8474. int getRight() const throw() { return bounds_.getRight(); }
  8475. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8476. int getBottom() const throw() { return bounds_.getBottom(); }
  8477. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8478. void getVisibleArea (RectangleList& result,
  8479. const bool includeSiblings) const;
  8480. int getScreenX() const;
  8481. int getScreenY() const;
  8482. const Point<int> getScreenPosition() const;
  8483. const Rectangle<int> getScreenBounds() const;
  8484. const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
  8485. const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
  8486. const Point<int> relativePositionToOtherComponent (const Component* const targetComponent,
  8487. const Point<int>& positionRelativeToThis) const;
  8488. void setTopLeftPosition (const int x, const int y);
  8489. void setTopRightPosition (const int x, const int y);
  8490. void setSize (const int newWidth, const int newHeight);
  8491. void setBounds (int x, int y, int width, int height);
  8492. void setBounds (const Rectangle<int>& newBounds);
  8493. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8494. const float proportionalWidth, const float proportionalHeight);
  8495. void setBoundsInset (const BorderSize& borders);
  8496. void setBoundsToFit (int x, int y, int width, int height,
  8497. const Justification& justification,
  8498. const bool onlyReduceInSize);
  8499. void setCentrePosition (const int x, const int y);
  8500. void setCentreRelative (const float x, const float y);
  8501. void centreWithSize (const int width, const int height);
  8502. int proportionOfWidth (const float proportion) const throw();
  8503. int proportionOfHeight (const float proportion) const throw();
  8504. int getParentWidth() const throw();
  8505. int getParentHeight() const throw();
  8506. const Rectangle<int> getParentMonitorArea() const throw();
  8507. int getNumChildComponents() const throw();
  8508. Component* getChildComponent (const int index) const throw();
  8509. int getIndexOfChildComponent (const Component* const child) const throw();
  8510. void addChildComponent (Component* const child,
  8511. int zOrder = -1);
  8512. void addAndMakeVisible (Component* const child,
  8513. int zOrder = -1);
  8514. void removeChildComponent (Component* const childToRemove);
  8515. Component* removeChildComponent (const int childIndexToRemove);
  8516. void removeAllChildren();
  8517. void deleteAllChildren();
  8518. Component* getParentComponent() const throw() { return parentComponent_; }
  8519. template <class TargetClass>
  8520. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8521. {
  8522. (void) dummyParameter;
  8523. Component* p = parentComponent_;
  8524. while (p != 0)
  8525. {
  8526. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8527. if (target != 0)
  8528. return target;
  8529. p = p->parentComponent_;
  8530. }
  8531. return 0;
  8532. }
  8533. Component* getTopLevelComponent() const throw();
  8534. bool isParentOf (const Component* possibleChild) const throw();
  8535. virtual void parentHierarchyChanged();
  8536. virtual void childrenChanged();
  8537. virtual bool hitTest (int x, int y);
  8538. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8539. const bool allowClicksOnChildComponents) throw();
  8540. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8541. bool& allowsClicksOnChildComponents) const throw();
  8542. virtual bool contains (int x, int y);
  8543. bool reallyContains (int x, int y,
  8544. const bool returnTrueIfWithinAChild);
  8545. Component* getComponentAt (const int x, const int y);
  8546. Component* getComponentAt (const Point<int>& position);
  8547. void repaint() throw();
  8548. void repaint (const int x, const int y,
  8549. const int width, const int height) throw();
  8550. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8551. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8552. const bool clipImageToComponentBounds = true);
  8553. void paintEntireComponent (Graphics& context);
  8554. void setComponentEffect (ImageEffectFilter* const newEffect);
  8555. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8556. LookAndFeel& getLookAndFeel() const throw();
  8557. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8558. virtual void lookAndFeelChanged();
  8559. void sendLookAndFeelChange();
  8560. void setOpaque (const bool shouldBeOpaque) throw();
  8561. bool isOpaque() const throw();
  8562. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8563. bool isBroughtToFrontOnMouseClick() const throw();
  8564. // Keyboard focus methods
  8565. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8566. bool getWantsKeyboardFocus() const throw();
  8567. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8568. bool getMouseClickGrabsKeyboardFocus() const throw();
  8569. void grabKeyboardFocus();
  8570. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8571. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8572. void moveKeyboardFocusToSibling (const bool moveToNext);
  8573. virtual KeyboardFocusTraverser* createFocusTraverser();
  8574. int getExplicitFocusOrder() const throw();
  8575. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8576. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8577. bool isFocusContainer() const throw();
  8578. bool isEnabled() const throw();
  8579. void setEnabled (const bool shouldBeEnabled);
  8580. virtual void enablementChanged();
  8581. void setMouseCursor (const MouseCursor& cursorType) throw();
  8582. virtual const MouseCursor getMouseCursor();
  8583. void updateMouseCursor() const throw();
  8584. virtual void paint (Graphics& g);
  8585. virtual void paintOverChildren (Graphics& g);
  8586. virtual void mouseMove (const MouseEvent& e);
  8587. virtual void mouseEnter (const MouseEvent& e);
  8588. virtual void mouseExit (const MouseEvent& e);
  8589. virtual void mouseDown (const MouseEvent& e);
  8590. virtual void mouseDrag (const MouseEvent& e);
  8591. virtual void mouseUp (const MouseEvent& e);
  8592. virtual void mouseDoubleClick (const MouseEvent& e);
  8593. virtual void mouseWheelMove (const MouseEvent& e,
  8594. float wheelIncrementX,
  8595. float wheelIncrementY);
  8596. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8597. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8598. void addMouseListener (MouseListener* const newListener,
  8599. const bool wantsEventsForAllNestedChildComponents) throw();
  8600. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8601. void addKeyListener (KeyListener* const newListener) throw();
  8602. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8603. virtual bool keyPressed (const KeyPress& key);
  8604. virtual bool keyStateChanged (const bool isKeyDown);
  8605. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8606. enum FocusChangeType
  8607. {
  8608. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8609. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8610. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8611. };
  8612. virtual void focusGained (FocusChangeType cause);
  8613. virtual void focusLost (FocusChangeType cause);
  8614. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8615. bool isMouseOver() const throw();
  8616. bool isMouseButtonDown() const throw();
  8617. bool isMouseOverOrDragging() const throw();
  8618. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8619. const Point<int> getMouseXYRelative() const;
  8620. virtual void resized();
  8621. virtual void moved();
  8622. virtual void childBoundsChanged (Component* child);
  8623. virtual void parentSizeChanged();
  8624. virtual void broughtToFront();
  8625. void addComponentListener (ComponentListener* const newListener) throw();
  8626. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8627. void postCommandMessage (const int commandId) throw();
  8628. virtual void handleCommandMessage (int commandId);
  8629. int runModalLoop();
  8630. void enterModalState (const bool takeKeyboardFocus = true);
  8631. void exitModalState (const int returnValue);
  8632. bool isCurrentlyModal() const throw();
  8633. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8634. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8635. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8636. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8637. virtual void inputAttemptWhenModal();
  8638. NamedValueSet& getProperties() throw() { return properties; }
  8639. const NamedValueSet& getProperties() const throw() { return properties; }
  8640. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8641. void setColour (const int colourId, const Colour& colour);
  8642. void removeColour (const int colourId);
  8643. bool isColourSpecified (const int colourId) const throw();
  8644. void copyAllExplicitColoursTo (Component& target) const throw();
  8645. virtual void colourChanged();
  8646. void* getWindowHandle() const throw();
  8647. uint32 getComponentUID() const throw() { return componentUID; }
  8648. template <class ComponentType>
  8649. class JUCE_API SafePointer : private ComponentListener
  8650. {
  8651. public:
  8652. SafePointer() : comp (0) {}
  8653. SafePointer (ComponentType* const component) : comp (component) { attach(); }
  8654. SafePointer (const SafePointer& other) : comp (other.comp) { attach(); }
  8655. ~SafePointer() { detach(); }
  8656. SafePointer& operator= (const SafePointer& other) { return operator= (other.comp); }
  8657. SafePointer& operator= (ComponentType* const newComponent)
  8658. {
  8659. detach();
  8660. comp = newComponent;
  8661. attach();
  8662. return *this;
  8663. }
  8664. operator ComponentType*() throw() { return comp; }
  8665. operator const ComponentType*() const throw() { return comp; }
  8666. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8667. ComponentType* operator->() throw() { jassert (comp != 0); return comp; }
  8668. /** Returns the component that this pointer refers to, or null if the component no longer exists. */
  8669. const ComponentType* operator->() const throw() { jassert (comp != 0); return comp; }
  8670. juce_UseDebuggingNewOperator
  8671. private:
  8672. ComponentType* comp;
  8673. void attach() { if (comp != 0) comp->addComponentListener (this); }
  8674. void detach() { if (comp != 0) comp->removeComponentListener (this); }
  8675. void componentBeingDeleted (Component&) { comp = 0; }
  8676. };
  8677. juce_UseDebuggingNewOperator
  8678. private:
  8679. friend class ComponentPeer;
  8680. friend class InternalDragRepeater;
  8681. friend class MouseInputSource;
  8682. friend class MouseInputSourceInternal;
  8683. static Component* currentlyFocusedComponent;
  8684. String componentName_;
  8685. Component* parentComponent_;
  8686. uint32 componentUID;
  8687. Rectangle<int> bounds_;
  8688. int numDeepMouseListeners;
  8689. Array <Component*> childComponentList_;
  8690. LookAndFeel* lookAndFeel_;
  8691. MouseCursor cursor_;
  8692. ImageEffectFilter* effect_;
  8693. Image* bufferedImage_;
  8694. VoidArray* mouseListeners_;
  8695. VoidArray* keyListeners_;
  8696. VoidArray* componentListeners_;
  8697. NamedValueSet properties;
  8698. struct ComponentFlags
  8699. {
  8700. bool hasHeavyweightPeerFlag : 1;
  8701. bool visibleFlag : 1;
  8702. bool opaqueFlag : 1;
  8703. bool ignoresMouseClicksFlag : 1;
  8704. bool allowChildMouseClicksFlag : 1;
  8705. bool wantsFocusFlag : 1;
  8706. bool isFocusContainerFlag : 1;
  8707. bool dontFocusOnMouseClickFlag : 1;
  8708. bool alwaysOnTopFlag : 1;
  8709. bool bufferToImageFlag : 1;
  8710. bool bringToFrontOnClickFlag : 1;
  8711. bool repaintOnMouseActivityFlag : 1;
  8712. bool draggingFlag : 1;
  8713. bool mouseOverFlag : 1;
  8714. bool mouseInsideFlag : 1;
  8715. bool currentlyModalFlag : 1;
  8716. bool isDisabledFlag : 1;
  8717. bool childCompFocusedFlag : 1;
  8718. #ifdef JUCE_DEBUG
  8719. bool isInsidePaintCall : 1;
  8720. #endif
  8721. };
  8722. union
  8723. {
  8724. uint32 componentFlags_;
  8725. ComponentFlags flags;
  8726. };
  8727. void internalMouseEnter (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8728. void internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8729. void internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8730. void internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers);
  8731. void internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8732. void internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time);
  8733. void internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const float amountX, const float amountY);
  8734. void internalBroughtToFront();
  8735. void internalFocusGain (const FocusChangeType cause);
  8736. void internalFocusLoss (const FocusChangeType cause);
  8737. void internalChildFocusChange (FocusChangeType cause);
  8738. void internalModalInputAttempt();
  8739. void internalModifierKeysChanged();
  8740. void internalChildrenChanged();
  8741. void internalHierarchyChanged();
  8742. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8743. void repaintParent() throw();
  8744. void sendFakeMouseMove() const;
  8745. void takeKeyboardFocus (const FocusChangeType cause);
  8746. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8747. static void giveAwayFocus();
  8748. void sendEnablementChangeMessage();
  8749. static void* runModalLoopCallback (void*);
  8750. static void bringModalComponentToFront();
  8751. void subtractObscuredRegions (RectangleList& result, const Point<int>& delta,
  8752. const Rectangle<int>& clipRect,
  8753. const Component* const compToAvoid) const throw();
  8754. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8755. const int deltaX, const int deltaY) const throw();
  8756. // how much of the component is not off the edges of its parents
  8757. const Rectangle<int> getUnclippedArea() const;
  8758. void sendVisibilityChangeMessage();
  8759. // This is included here just to cause a compile error if your code is still handling
  8760. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8761. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8762. // implement its methods instead of this Component method).
  8763. virtual void filesDropped (const StringArray&, int, int) {}
  8764. // components aren't allowed to have copy constructors, as this would mess up parent
  8765. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8766. // this one to avoid compiler warnings.
  8767. Component (const Component&);
  8768. Component& operator= (const Component&);
  8769. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8770. // subclass to use the new parameters to keyStateChanged)
  8771. virtual void keyStateChanged() {};
  8772. protected:
  8773. virtual void internalRepaint (int x, int y, int w, int h);
  8774. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8775. void handleMessage (const Message&);
  8776. };
  8777. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8778. /*** End of inlined file: juce_Component.h ***/
  8779. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8780. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8781. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8782. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  8783. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8784. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8785. typedef int CommandID;
  8786. namespace StandardApplicationCommandIDs
  8787. {
  8788. static const CommandID quit = 0x1001;
  8789. static const CommandID del = 0x1002;
  8790. static const CommandID cut = 0x1003;
  8791. static const CommandID copy = 0x1004;
  8792. static const CommandID paste = 0x1005;
  8793. static const CommandID selectAll = 0x1006;
  8794. static const CommandID deselectAll = 0x1007;
  8795. }
  8796. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8797. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  8798. struct JUCE_API ApplicationCommandInfo
  8799. {
  8800. ApplicationCommandInfo (const CommandID commandID) throw();
  8801. void setInfo (const String& shortName,
  8802. const String& description,
  8803. const String& categoryName,
  8804. const int flags) throw();
  8805. void setActive (const bool isActive) throw();
  8806. void setTicked (const bool isTicked) throw();
  8807. void addDefaultKeypress (const int keyCode,
  8808. const ModifierKeys& modifiers) throw();
  8809. CommandID commandID;
  8810. String shortName;
  8811. String description;
  8812. String categoryName;
  8813. Array <KeyPress> defaultKeypresses;
  8814. enum CommandFlags
  8815. {
  8816. isDisabled = 1 << 0,
  8817. isTicked = 1 << 1,
  8818. wantsKeyUpDownCallbacks = 1 << 2,
  8819. hiddenFromKeyEditor = 1 << 3,
  8820. readOnlyInKeyEditor = 1 << 4,
  8821. dontTriggerVisualFeedback = 1 << 5
  8822. };
  8823. int flags;
  8824. };
  8825. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8826. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  8827. class JUCE_API ApplicationCommandTarget
  8828. {
  8829. public:
  8830. ApplicationCommandTarget();
  8831. virtual ~ApplicationCommandTarget();
  8832. struct JUCE_API InvocationInfo
  8833. {
  8834. InvocationInfo (const CommandID commandID) throw();
  8835. CommandID commandID;
  8836. int commandFlags;
  8837. enum InvocationMethod
  8838. {
  8839. direct = 0, /**< The command is being invoked directly by a piece of code. */
  8840. fromKeyPress, /**< The command is being invoked by a key-press. */
  8841. fromMenu, /**< The command is being invoked by a menu selection. */
  8842. fromButton /**< The command is being invoked by a button click. */
  8843. };
  8844. InvocationMethod invocationMethod;
  8845. Component* originatingComponent;
  8846. KeyPress keyPress;
  8847. bool isKeyDown;
  8848. int millisecsSinceKeyPressed;
  8849. };
  8850. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  8851. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  8852. virtual void getCommandInfo (const CommandID commandID,
  8853. ApplicationCommandInfo& result) = 0;
  8854. virtual bool perform (const InvocationInfo& info) = 0;
  8855. bool invoke (const InvocationInfo& invocationInfo,
  8856. const bool asynchronously);
  8857. bool invokeDirectly (const CommandID commandID,
  8858. const bool asynchronously);
  8859. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  8860. bool isCommandActive (const CommandID commandID);
  8861. ApplicationCommandTarget* findFirstTargetParentComponent();
  8862. juce_UseDebuggingNewOperator
  8863. private:
  8864. // (for async invocation of commands)
  8865. class CommandTargetMessageInvoker : public MessageListener
  8866. {
  8867. public:
  8868. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  8869. ~CommandTargetMessageInvoker();
  8870. void handleMessage (const Message& message);
  8871. private:
  8872. ApplicationCommandTarget* const owner;
  8873. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  8874. CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  8875. };
  8876. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  8877. friend class CommandTargetMessageInvoker;
  8878. bool tryToInvoke (const InvocationInfo& info, const bool async);
  8879. ApplicationCommandTarget (const ApplicationCommandTarget&);
  8880. ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  8881. };
  8882. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  8883. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  8884. /*** Start of inlined file: juce_ActionListener.h ***/
  8885. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  8886. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  8887. class JUCE_API ActionListener
  8888. {
  8889. public:
  8890. virtual ~ActionListener() {}
  8891. virtual void actionListenerCallback (const String& message) = 0;
  8892. };
  8893. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  8894. /*** End of inlined file: juce_ActionListener.h ***/
  8895. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  8896. private ActionListener
  8897. {
  8898. protected:
  8899. JUCEApplication();
  8900. public:
  8901. virtual ~JUCEApplication();
  8902. static JUCEApplication* getInstance() throw();
  8903. virtual void initialise (const String& commandLineParameters) = 0;
  8904. bool isInitialising() const throw();
  8905. virtual void shutdown() = 0;
  8906. virtual const String getApplicationName() = 0;
  8907. virtual const String getApplicationVersion();
  8908. virtual bool moreThanOneInstanceAllowed();
  8909. virtual void anotherInstanceStarted (const String& commandLine);
  8910. virtual void systemRequestedQuit();
  8911. virtual void unhandledException (const std::exception* e,
  8912. const String& sourceFilename,
  8913. const int lineNumber);
  8914. static void quit();
  8915. void setApplicationReturnValue (const int newReturnValue) throw();
  8916. int getApplicationReturnValue() const throw() { return appReturnValue; }
  8917. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  8918. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  8919. static int main (String& commandLine, JUCEApplication* const newApp);
  8920. static int main (int argc, const char* argv[], JUCEApplication* const newApp);
  8921. static void sendUnhandledException (const std::exception* const e,
  8922. const char* const sourceFile,
  8923. const int lineNumber);
  8924. ApplicationCommandTarget* getNextCommandTarget();
  8925. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  8926. void getAllCommands (Array <CommandID>& commands);
  8927. bool perform (const InvocationInfo& info);
  8928. void actionListenerCallback (const String& message);
  8929. private:
  8930. String commandLineParameters;
  8931. int appReturnValue;
  8932. bool stillInitialising;
  8933. ScopedPointer<InterProcessLock> appLock;
  8934. JUCEApplication (const JUCEApplication&);
  8935. JUCEApplication& operator= (const JUCEApplication&);
  8936. public:
  8937. bool initialiseApp (String& commandLine);
  8938. static int shutdownAppAndClearUp();
  8939. };
  8940. #endif // __JUCE_APPLICATION_JUCEHEADER__
  8941. /*** End of inlined file: juce_Application.h ***/
  8942. #endif
  8943. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8944. #endif
  8945. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8946. #endif
  8947. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8948. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  8949. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8950. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8951. /*** Start of inlined file: juce_Desktop.h ***/
  8952. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  8953. #define __JUCE_DESKTOP_JUCEHEADER__
  8954. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  8955. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8956. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8957. class JUCE_API DeletedAtShutdown
  8958. {
  8959. protected:
  8960. DeletedAtShutdown();
  8961. virtual ~DeletedAtShutdown();
  8962. public:
  8963. static void deleteAll();
  8964. private:
  8965. DeletedAtShutdown (const DeletedAtShutdown&);
  8966. DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  8967. };
  8968. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8969. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  8970. /*** Start of inlined file: juce_Timer.h ***/
  8971. #ifndef __JUCE_TIMER_JUCEHEADER__
  8972. #define __JUCE_TIMER_JUCEHEADER__
  8973. class InternalTimerThread;
  8974. class JUCE_API Timer
  8975. {
  8976. protected:
  8977. Timer() throw();
  8978. Timer (const Timer& other) throw();
  8979. public:
  8980. virtual ~Timer();
  8981. virtual void timerCallback() = 0;
  8982. void startTimer (const int intervalInMilliseconds) throw();
  8983. void stopTimer() throw();
  8984. bool isTimerRunning() const throw() { return periodMs > 0; }
  8985. int getTimerInterval() const throw() { return periodMs; }
  8986. private:
  8987. friend class InternalTimerThread;
  8988. int countdownMs, periodMs;
  8989. Timer* previous;
  8990. Timer* next;
  8991. Timer& operator= (const Timer&);
  8992. };
  8993. #endif // __JUCE_TIMER_JUCEHEADER__
  8994. /*** End of inlined file: juce_Timer.h ***/
  8995. class MouseInputSource;
  8996. class MouseInputSourceInternal;
  8997. class MouseListener;
  8998. class JUCE_API FocusChangeListener
  8999. {
  9000. public:
  9001. virtual ~FocusChangeListener() {}
  9002. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9003. };
  9004. class JUCE_API Desktop : private DeletedAtShutdown,
  9005. private Timer,
  9006. private AsyncUpdater
  9007. {
  9008. public:
  9009. static Desktop& JUCE_CALLTYPE getInstance() throw();
  9010. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9011. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9012. const Rectangle<int> getMonitorAreaContaining (const Point<int>& position, const bool clippedToWorkArea = true) const throw();
  9013. static const Point<int> getMousePosition();
  9014. static void setMousePosition (const Point<int>& newPosition);
  9015. static const Point<int> getLastMouseDownPosition() throw();
  9016. static int getMouseButtonClickCounter() throw();
  9017. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9018. static bool isScreenSaverEnabled() throw();
  9019. void addGlobalMouseListener (MouseListener* const listener) throw();
  9020. void removeGlobalMouseListener (MouseListener* const listener) throw();
  9021. void addFocusChangeListener (FocusChangeListener* const listener) throw();
  9022. void removeFocusChangeListener (FocusChangeListener* const listener) throw();
  9023. void setKioskModeComponent (Component* componentToUse,
  9024. const bool allowMenusAndBars = true);
  9025. Component* getKioskModeComponent() const { return kioskModeComponent; }
  9026. int getNumComponents() const throw();
  9027. Component* getComponent (const int index) const throw();
  9028. Component* findComponentAt (const Point<int>& screenPosition) const;
  9029. int getNumMouseSources() const throw() { return mouseSources.size(); }
  9030. MouseInputSource* getMouseSource (int index) const throw() { return mouseSources [index]; }
  9031. MouseInputSource& getMainMouseSource() const throw() { return *mouseSources.getUnchecked(0); }
  9032. int getNumDraggingMouseSources() const throw();
  9033. MouseInputSource* getDraggingMouseSource (int index) const throw();
  9034. juce_UseDebuggingNewOperator
  9035. void refreshMonitorSizes() throw();
  9036. static bool canUseSemiTransparentWindows() throw();
  9037. private:
  9038. static Desktop* instance;
  9039. friend class Component;
  9040. friend class ComponentPeer;
  9041. friend class MouseInputSource;
  9042. friend class MouseInputSourceInternal;
  9043. SortedSet <void*> mouseListeners, focusListeners;
  9044. Array <Component*> desktopComponents;
  9045. friend class DeletedAtShutdown;
  9046. friend class TopLevelWindowManager;
  9047. Desktop() throw();
  9048. ~Desktop() throw();
  9049. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9050. OwnedArray <MouseInputSource> mouseSources;
  9051. Point<int> lastFakeMouseMove;
  9052. int mouseClickCounter;
  9053. void incrementMouseClickCounter() throw();
  9054. Component* kioskModeComponent;
  9055. Rectangle<int> kioskComponentOriginalBounds;
  9056. void timerCallback();
  9057. void sendMouseMove();
  9058. void resetTimer() throw();
  9059. int getNumDisplayMonitors() const throw();
  9060. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9061. void addDesktopComponent (Component* const c) throw();
  9062. void removeDesktopComponent (Component* const c) throw();
  9063. void componentBroughtToFront (Component* const c) throw();
  9064. void triggerFocusCallback() throw();
  9065. void handleAsyncUpdate();
  9066. Desktop (const Desktop&);
  9067. Desktop& operator= (const Desktop&);
  9068. };
  9069. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9070. /*** End of inlined file: juce_Desktop.h ***/
  9071. class KeyPressMappingSet;
  9072. class ApplicationCommandManagerListener;
  9073. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9074. private FocusChangeListener
  9075. {
  9076. public:
  9077. ApplicationCommandManager();
  9078. virtual ~ApplicationCommandManager();
  9079. void clearCommands();
  9080. void registerCommand (const ApplicationCommandInfo& newCommand);
  9081. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9082. void removeCommand (const CommandID commandID);
  9083. void commandStatusChanged();
  9084. int getNumCommands() const throw() { return commands.size(); }
  9085. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9086. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9087. const String getNameOfCommand (const CommandID commandID) const throw();
  9088. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9089. const StringArray getCommandCategories() const throw();
  9090. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9091. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9092. bool invokeDirectly (const CommandID commandID,
  9093. const bool asynchronously);
  9094. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9095. const bool asynchronously);
  9096. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9097. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9098. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9099. ApplicationCommandInfo& upToDateInfo);
  9100. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9101. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9102. static ApplicationCommandTarget* findDefaultComponentTarget();
  9103. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9104. juce_UseDebuggingNewOperator
  9105. private:
  9106. OwnedArray <ApplicationCommandInfo> commands;
  9107. SortedSet <void*> listeners;
  9108. ScopedPointer <KeyPressMappingSet> keyMappings;
  9109. ApplicationCommandTarget* firstTarget;
  9110. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) const;
  9111. void handleAsyncUpdate();
  9112. void globalFocusChanged (Component*);
  9113. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9114. // version of this method.
  9115. virtual short getFirstCommandTarget() { return 0; }
  9116. };
  9117. class JUCE_API ApplicationCommandManagerListener
  9118. {
  9119. public:
  9120. virtual ~ApplicationCommandManagerListener() {}
  9121. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9122. virtual void applicationCommandListChanged() = 0;
  9123. };
  9124. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9125. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9126. #endif
  9127. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9128. #endif
  9129. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9130. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9131. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9132. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9133. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9134. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9135. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9136. class JUCE_API PropertiesFile : public PropertySet,
  9137. public ChangeBroadcaster,
  9138. private Timer
  9139. {
  9140. public:
  9141. enum FileFormatOptions
  9142. {
  9143. ignoreCaseOfKeyNames = 1,
  9144. storeAsBinary = 2,
  9145. storeAsCompressedBinary = 4,
  9146. storeAsXML = 8
  9147. };
  9148. PropertiesFile (const File& file,
  9149. const int millisecondsBeforeSaving,
  9150. const int options);
  9151. ~PropertiesFile();
  9152. bool saveIfNeeded();
  9153. bool save();
  9154. bool needsToBeSaved() const;
  9155. const File getFile() const { return file; }
  9156. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9157. const String& fileNameSuffix,
  9158. const String& folderName,
  9159. const bool commonToAllUsers,
  9160. const int millisecondsBeforeSaving,
  9161. const int propertiesFileOptions);
  9162. static const File getDefaultAppSettingsFile (const String& applicationName,
  9163. const String& fileNameSuffix,
  9164. const String& folderName,
  9165. const bool commonToAllUsers);
  9166. juce_UseDebuggingNewOperator
  9167. protected:
  9168. virtual void propertyChanged();
  9169. private:
  9170. File file;
  9171. int timerInterval;
  9172. const int options;
  9173. bool needsWriting;
  9174. void timerCallback();
  9175. PropertiesFile (const PropertiesFile&);
  9176. PropertiesFile& operator= (const PropertiesFile&);
  9177. };
  9178. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9179. /*** End of inlined file: juce_PropertiesFile.h ***/
  9180. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9181. {
  9182. public:
  9183. ApplicationProperties() throw();
  9184. ~ApplicationProperties();
  9185. juce_DeclareSingleton (ApplicationProperties, false)
  9186. void setStorageParameters (const String& applicationName,
  9187. const String& fileNameSuffix,
  9188. const String& folderName,
  9189. const int millisecondsBeforeSaving,
  9190. const int propertiesFileOptions) throw();
  9191. bool testWriteAccess (const bool testUserSettings,
  9192. const bool testCommonSettings,
  9193. const bool showWarningDialogOnFailure);
  9194. PropertiesFile* getUserSettings() throw();
  9195. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9196. bool saveIfNeeded();
  9197. void closeFiles();
  9198. juce_UseDebuggingNewOperator
  9199. private:
  9200. ScopedPointer <PropertiesFile> userProps, commonProps;
  9201. String appName, fileSuffix, folderName;
  9202. int msBeforeSaving, options;
  9203. int commonSettingsAreReadOnly;
  9204. ApplicationProperties (const ApplicationProperties&);
  9205. ApplicationProperties& operator= (const ApplicationProperties&);
  9206. void openFiles() throw();
  9207. };
  9208. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9209. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9210. #endif
  9211. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9212. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9213. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9214. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9215. /*** Start of inlined file: juce_AudioFormat.h ***/
  9216. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9217. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9218. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9219. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9220. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9221. class AudioFormat;
  9222. class JUCE_API AudioFormatReader
  9223. {
  9224. protected:
  9225. AudioFormatReader (InputStream* const sourceStream,
  9226. const String& formatName);
  9227. public:
  9228. virtual ~AudioFormatReader();
  9229. const String getFormatName() const throw() { return formatName; }
  9230. bool read (int** destSamples,
  9231. int numDestChannels,
  9232. int64 startSampleInSource,
  9233. int numSamplesToRead,
  9234. const bool fillLeftoverChannelsWithCopies);
  9235. virtual void readMaxLevels (int64 startSample,
  9236. int64 numSamples,
  9237. float& lowestLeft,
  9238. float& highestLeft,
  9239. float& lowestRight,
  9240. float& highestRight);
  9241. int64 searchForLevel (int64 startSample,
  9242. int64 numSamplesToSearch,
  9243. const double magnitudeRangeMinimum,
  9244. const double magnitudeRangeMaximum,
  9245. const int minimumConsecutiveSamples);
  9246. double sampleRate;
  9247. unsigned int bitsPerSample;
  9248. int64 lengthInSamples;
  9249. unsigned int numChannels;
  9250. bool usesFloatingPointData;
  9251. StringPairArray metadataValues;
  9252. InputStream* input;
  9253. virtual bool readSamples (int** destSamples,
  9254. int numDestChannels,
  9255. int startOffsetInDestBuffer,
  9256. int64 startSampleInFile,
  9257. int numSamples) = 0;
  9258. juce_UseDebuggingNewOperator
  9259. private:
  9260. String formatName;
  9261. AudioFormatReader (const AudioFormatReader&);
  9262. AudioFormatReader& operator= (const AudioFormatReader&);
  9263. };
  9264. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9265. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9266. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9267. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9268. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9269. /*** Start of inlined file: juce_AudioSource.h ***/
  9270. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9271. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9272. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9273. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9274. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9275. class AudioFormatReader;
  9276. class AudioFormatWriter;
  9277. class JUCE_API AudioSampleBuffer
  9278. {
  9279. public:
  9280. AudioSampleBuffer (const int numChannels,
  9281. const int numSamples) throw();
  9282. AudioSampleBuffer (float** dataToReferTo,
  9283. const int numChannels,
  9284. const int numSamples) throw();
  9285. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9286. AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9287. virtual ~AudioSampleBuffer() throw();
  9288. int getNumChannels() const throw() { return numChannels; }
  9289. int getNumSamples() const throw() { return size; }
  9290. float* getSampleData (const int channelNumber) const throw()
  9291. {
  9292. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9293. return channels [channelNumber];
  9294. }
  9295. float* getSampleData (const int channelNumber,
  9296. const int sampleOffset) const throw()
  9297. {
  9298. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9299. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9300. return channels [channelNumber] + sampleOffset;
  9301. }
  9302. float** getArrayOfChannels() const throw() { return channels; }
  9303. void setSize (const int newNumChannels,
  9304. const int newNumSamples,
  9305. const bool keepExistingContent = false,
  9306. const bool clearExtraSpace = false,
  9307. const bool avoidReallocating = false) throw();
  9308. void setDataToReferTo (float** dataToReferTo,
  9309. const int numChannels,
  9310. const int numSamples) throw();
  9311. void clear() throw();
  9312. void clear (const int startSample,
  9313. const int numSamples) throw();
  9314. void clear (const int channel,
  9315. const int startSample,
  9316. const int numSamples) throw();
  9317. void applyGain (const int channel,
  9318. const int startSample,
  9319. int numSamples,
  9320. const float gain) throw();
  9321. void applyGain (const int startSample,
  9322. const int numSamples,
  9323. const float gain) throw();
  9324. void applyGainRamp (const int channel,
  9325. const int startSample,
  9326. int numSamples,
  9327. float startGain,
  9328. float endGain) throw();
  9329. void addFrom (const int destChannel,
  9330. const int destStartSample,
  9331. const AudioSampleBuffer& source,
  9332. const int sourceChannel,
  9333. const int sourceStartSample,
  9334. int numSamples,
  9335. const float gainToApplyToSource = 1.0f) throw();
  9336. void addFrom (const int destChannel,
  9337. const int destStartSample,
  9338. const float* source,
  9339. int numSamples,
  9340. const float gainToApplyToSource = 1.0f) throw();
  9341. void addFromWithRamp (const int destChannel,
  9342. const int destStartSample,
  9343. const float* source,
  9344. int numSamples,
  9345. float startGain,
  9346. float endGain) throw();
  9347. void copyFrom (const int destChannel,
  9348. const int destStartSample,
  9349. const AudioSampleBuffer& source,
  9350. const int sourceChannel,
  9351. const int sourceStartSample,
  9352. int numSamples) throw();
  9353. void copyFrom (const int destChannel,
  9354. const int destStartSample,
  9355. const float* source,
  9356. int numSamples) throw();
  9357. void copyFrom (const int destChannel,
  9358. const int destStartSample,
  9359. const float* source,
  9360. int numSamples,
  9361. const float gain) throw();
  9362. void copyFromWithRamp (const int destChannel,
  9363. const int destStartSample,
  9364. const float* source,
  9365. int numSamples,
  9366. float startGain,
  9367. float endGain) throw();
  9368. void findMinMax (const int channel,
  9369. const int startSample,
  9370. int numSamples,
  9371. float& minVal,
  9372. float& maxVal) const throw();
  9373. float getMagnitude (const int channel,
  9374. const int startSample,
  9375. const int numSamples) const throw();
  9376. float getMagnitude (const int startSample,
  9377. const int numSamples) const throw();
  9378. float getRMSLevel (const int channel,
  9379. const int startSample,
  9380. const int numSamples) const throw();
  9381. void readFromAudioReader (AudioFormatReader* reader,
  9382. const int startSample,
  9383. const int numSamples,
  9384. const int readerStartSample,
  9385. const bool useReaderLeftChan,
  9386. const bool useReaderRightChan) throw();
  9387. void writeToAudioWriter (AudioFormatWriter* writer,
  9388. const int startSample,
  9389. const int numSamples) const throw();
  9390. juce_UseDebuggingNewOperator
  9391. private:
  9392. int numChannels, size;
  9393. size_t allocatedBytes;
  9394. float** channels;
  9395. HeapBlock <char> allocatedData;
  9396. float* preallocatedChannelSpace [32];
  9397. void allocateData();
  9398. void allocateChannels (float** const dataToReferTo);
  9399. };
  9400. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9401. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9402. struct JUCE_API AudioSourceChannelInfo
  9403. {
  9404. AudioSampleBuffer* buffer;
  9405. int startSample;
  9406. int numSamples;
  9407. void clearActiveBufferRegion() const
  9408. {
  9409. if (buffer != 0)
  9410. buffer->clear (startSample, numSamples);
  9411. }
  9412. };
  9413. class JUCE_API AudioSource
  9414. {
  9415. protected:
  9416. AudioSource() throw() {}
  9417. public:
  9418. virtual ~AudioSource() {}
  9419. virtual void prepareToPlay (int samplesPerBlockExpected,
  9420. double sampleRate) = 0;
  9421. virtual void releaseResources() = 0;
  9422. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9423. };
  9424. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9425. /*** End of inlined file: juce_AudioSource.h ***/
  9426. class JUCE_API AudioFormatWriter
  9427. {
  9428. protected:
  9429. AudioFormatWriter (OutputStream* const destStream,
  9430. const String& formatName,
  9431. const double sampleRate,
  9432. const unsigned int numberOfChannels,
  9433. const unsigned int bitsPerSample);
  9434. public:
  9435. virtual ~AudioFormatWriter();
  9436. const String getFormatName() const throw() { return formatName; }
  9437. virtual bool write (const int** samplesToWrite,
  9438. int numSamples) = 0;
  9439. bool writeFromAudioReader (AudioFormatReader& reader,
  9440. int64 startSample,
  9441. int64 numSamplesToRead);
  9442. bool writeFromAudioSource (AudioSource& source,
  9443. int numSamplesToRead,
  9444. const int samplesPerBlock = 2048);
  9445. double getSampleRate() const throw() { return sampleRate; }
  9446. int getNumChannels() const throw() { return numChannels; }
  9447. int getBitsPerSample() const throw() { return bitsPerSample; }
  9448. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9449. juce_UseDebuggingNewOperator
  9450. protected:
  9451. double sampleRate;
  9452. unsigned int numChannels;
  9453. unsigned int bitsPerSample;
  9454. bool usesFloatingPointData;
  9455. OutputStream* output;
  9456. private:
  9457. String formatName;
  9458. };
  9459. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9460. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9461. class JUCE_API AudioFormat
  9462. {
  9463. public:
  9464. virtual ~AudioFormat();
  9465. const String& getFormatName() const;
  9466. const StringArray& getFileExtensions() const;
  9467. virtual bool canHandleFile (const File& fileToTest);
  9468. virtual const Array <int> getPossibleSampleRates() = 0;
  9469. virtual const Array <int> getPossibleBitDepths() = 0;
  9470. virtual bool canDoStereo() = 0;
  9471. virtual bool canDoMono() = 0;
  9472. virtual bool isCompressed();
  9473. virtual const StringArray getQualityOptions();
  9474. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9475. const bool deleteStreamIfOpeningFails) = 0;
  9476. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9477. double sampleRateToUse,
  9478. unsigned int numberOfChannels,
  9479. int bitsPerSample,
  9480. const StringPairArray& metadataValues,
  9481. int qualityOptionIndex) = 0;
  9482. protected:
  9483. AudioFormat (const String& formatName,
  9484. const tchar** const fileExtensions);
  9485. private:
  9486. String formatName;
  9487. StringArray fileExtensions;
  9488. };
  9489. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9490. /*** End of inlined file: juce_AudioFormat.h ***/
  9491. class JUCE_API AiffAudioFormat : public AudioFormat
  9492. {
  9493. public:
  9494. AiffAudioFormat();
  9495. ~AiffAudioFormat();
  9496. const Array <int> getPossibleSampleRates();
  9497. const Array <int> getPossibleBitDepths();
  9498. bool canDoStereo();
  9499. bool canDoMono();
  9500. #if JUCE_MAC
  9501. bool canHandleFile (const File& fileToTest);
  9502. #endif
  9503. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9504. const bool deleteStreamIfOpeningFails);
  9505. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9506. double sampleRateToUse,
  9507. unsigned int numberOfChannels,
  9508. int bitsPerSample,
  9509. const StringPairArray& metadataValues,
  9510. int qualityOptionIndex);
  9511. juce_UseDebuggingNewOperator
  9512. };
  9513. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9514. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9515. #endif
  9516. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9517. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9518. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9519. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9520. #if JUCE_USE_CDBURNER
  9521. class AudioCDBurner : public ChangeBroadcaster
  9522. {
  9523. public:
  9524. static const StringArray findAvailableDevices();
  9525. static AudioCDBurner* openDevice (const int deviceIndex);
  9526. ~AudioCDBurner();
  9527. enum DiskState
  9528. {
  9529. unknown, /**< An error condition, if the device isn't responding. */
  9530. trayOpen, /**< The drive is currently open. Note that a slot-loading drive
  9531. may seem to be permanently open. */
  9532. noDisc, /**< The drive has no disk in it. */
  9533. writableDiskPresent, /**< The drive contains a writeable disk. */
  9534. readOnlyDiskPresent /**< The drive contains a read-only disk. */
  9535. };
  9536. DiskState getDiskState() const;
  9537. bool isDiskPresent() const;
  9538. bool openTray();
  9539. DiskState waitUntilStateChange (int timeOutMilliseconds);
  9540. const Array<int> getAvailableWriteSpeeds() const;
  9541. bool setBufferUnderrunProtection (const bool shouldBeEnabled);
  9542. int getNumAvailableAudioBlocks() const;
  9543. bool addAudioTrack (AudioSource* source, int numSamples);
  9544. class BurnProgressListener
  9545. {
  9546. public:
  9547. BurnProgressListener() throw() {}
  9548. virtual ~BurnProgressListener() {}
  9549. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9550. };
  9551. const String burn (BurnProgressListener* listener,
  9552. bool ejectDiscAfterwards,
  9553. bool performFakeBurnForTesting,
  9554. int writeSpeed);
  9555. void abortBurn();
  9556. juce_UseDebuggingNewOperator
  9557. private:
  9558. AudioCDBurner (const int deviceIndex);
  9559. class Pimpl;
  9560. friend class ScopedPointer<Pimpl>;
  9561. ScopedPointer<Pimpl> pimpl;
  9562. };
  9563. #endif
  9564. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9565. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9566. #endif
  9567. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9568. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9569. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9570. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9571. #if JUCE_USE_CDREADER
  9572. #if JUCE_MAC
  9573. #endif
  9574. class JUCE_API AudioCDReader : public AudioFormatReader
  9575. {
  9576. public:
  9577. static const StringArray getAvailableCDNames();
  9578. static AudioCDReader* createReaderForCD (const int index);
  9579. ~AudioCDReader();
  9580. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9581. int64 startSampleInFile, int numSamples);
  9582. bool isCDStillPresent() const;
  9583. int getNumTracks() const;
  9584. int getPositionOfTrackStart (int trackNum) const;
  9585. bool isTrackAudio (int trackNum) const;
  9586. void refreshTrackLengths();
  9587. void enableIndexScanning (bool enabled);
  9588. int getLastIndex() const;
  9589. const Array <int> findIndexesInTrack (const int trackNumber);
  9590. int getCDDBId();
  9591. void ejectDisk();
  9592. juce_UseDebuggingNewOperator
  9593. private:
  9594. #if JUCE_MAC
  9595. File volumeDir;
  9596. Array<File> tracks;
  9597. Array<int> trackStartSamples;
  9598. int currentReaderTrack;
  9599. ScopedPointer <AudioFormatReader> reader;
  9600. AudioCDReader (const File& volume);
  9601. public:
  9602. static int compareElements (const File&, const File&);
  9603. private:
  9604. #elif JUCE_WINDOWS
  9605. int numTracks;
  9606. int trackStarts[100];
  9607. bool audioTracks [100];
  9608. void* handle;
  9609. bool indexingEnabled;
  9610. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9611. MemoryBlock buffer;
  9612. AudioCDReader (void* handle);
  9613. int getIndexAt (int samplePos);
  9614. #elif JUCE_LINUX
  9615. AudioCDReader();
  9616. #endif
  9617. AudioCDReader (const AudioCDReader&);
  9618. AudioCDReader& operator= (const AudioCDReader&);
  9619. };
  9620. #endif
  9621. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9622. /*** End of inlined file: juce_AudioCDReader.h ***/
  9623. #endif
  9624. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9625. #endif
  9626. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9627. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9628. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9629. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9630. class JUCE_API AudioFormatManager
  9631. {
  9632. public:
  9633. AudioFormatManager();
  9634. ~AudioFormatManager();
  9635. juce_DeclareSingleton (AudioFormatManager, false);
  9636. void registerFormat (AudioFormat* newFormat,
  9637. const bool makeThisTheDefaultFormat);
  9638. void registerBasicFormats();
  9639. void clearFormats();
  9640. int getNumKnownFormats() const;
  9641. AudioFormat* getKnownFormat (const int index) const;
  9642. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9643. AudioFormat* getDefaultFormat() const;
  9644. const String getWildcardForAllFormats() const;
  9645. AudioFormatReader* createReaderFor (const File& audioFile);
  9646. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9647. juce_UseDebuggingNewOperator
  9648. private:
  9649. VoidArray knownFormats;
  9650. int defaultFormatIndex;
  9651. };
  9652. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9653. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9654. #endif
  9655. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9656. #endif
  9657. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9658. #endif
  9659. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9660. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9661. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9662. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9663. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9664. {
  9665. public:
  9666. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9667. const int64 subsectionStartSample,
  9668. const int64 subsectionLength,
  9669. const bool deleteSourceWhenDeleted);
  9670. ~AudioSubsectionReader();
  9671. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9672. int64 startSampleInFile, int numSamples);
  9673. void readMaxLevels (int64 startSample,
  9674. int64 numSamples,
  9675. float& lowestLeft,
  9676. float& highestLeft,
  9677. float& lowestRight,
  9678. float& highestRight);
  9679. juce_UseDebuggingNewOperator
  9680. private:
  9681. AudioFormatReader* const source;
  9682. int64 startSample, length;
  9683. const bool deleteSourceWhenDeleted;
  9684. AudioSubsectionReader (const AudioSubsectionReader&);
  9685. AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9686. };
  9687. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9688. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9689. #endif
  9690. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9691. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9692. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9693. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9694. class AudioThumbnailCache;
  9695. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9696. public TimeSliceClient,
  9697. private Timer
  9698. {
  9699. public:
  9700. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9701. AudioFormatManager& formatManagerToUse,
  9702. AudioThumbnailCache& cacheToUse);
  9703. ~AudioThumbnail();
  9704. void setSource (InputSource* const newSource);
  9705. void loadFrom (InputStream& input);
  9706. void saveTo (OutputStream& output) const;
  9707. int getNumChannels() const throw();
  9708. double getTotalLength() const throw();
  9709. void drawChannel (Graphics& g,
  9710. int x, int y, int w, int h,
  9711. double startTimeSeconds,
  9712. double endTimeSeconds,
  9713. int channelNum,
  9714. const float verticalZoomFactor);
  9715. bool isFullyLoaded() const throw();
  9716. bool useTimeSlice();
  9717. void timerCallback();
  9718. juce_UseDebuggingNewOperator
  9719. private:
  9720. AudioFormatManager& formatManagerToUse;
  9721. AudioThumbnailCache& cache;
  9722. ScopedPointer <InputSource> source;
  9723. CriticalSection readerLock;
  9724. ScopedPointer <AudioFormatReader> reader;
  9725. MemoryBlock data, cachedLevels;
  9726. int orginalSamplesPerThumbnailSample;
  9727. int numChannelsCached, numSamplesCached;
  9728. double cachedStart, cachedTimePerPixel;
  9729. bool cacheNeedsRefilling;
  9730. void clear();
  9731. AudioFormatReader* createReader() const;
  9732. void generateSection (AudioFormatReader& reader,
  9733. int64 startSample,
  9734. int numSamples);
  9735. char* getChannelData (int channel) const;
  9736. void refillCache (const int numSamples,
  9737. double startTime,
  9738. const double timePerPixel);
  9739. friend class AudioThumbnailCache;
  9740. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9741. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9742. // returns true if more needs to be read
  9743. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9744. };
  9745. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9746. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9747. #endif
  9748. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9749. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9750. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9751. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9752. struct ThumbnailCacheEntry;
  9753. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9754. {
  9755. public:
  9756. AudioThumbnailCache (const int maxNumThumbsToStore);
  9757. ~AudioThumbnailCache();
  9758. void clear();
  9759. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9760. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9761. juce_UseDebuggingNewOperator
  9762. private:
  9763. OwnedArray <ThumbnailCacheEntry> thumbs;
  9764. int maxNumThumbsToStore;
  9765. friend class AudioThumbnail;
  9766. void addThumbnail (AudioThumbnail* const thumb);
  9767. void removeThumbnail (AudioThumbnail* const thumb);
  9768. };
  9769. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9770. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9771. #endif
  9772. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9773. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  9774. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9775. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9776. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9777. class JUCE_API FlacAudioFormat : public AudioFormat
  9778. {
  9779. public:
  9780. FlacAudioFormat();
  9781. ~FlacAudioFormat();
  9782. const Array <int> getPossibleSampleRates();
  9783. const Array <int> getPossibleBitDepths();
  9784. bool canDoStereo();
  9785. bool canDoMono();
  9786. bool isCompressed();
  9787. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9788. const bool deleteStreamIfOpeningFails);
  9789. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9790. double sampleRateToUse,
  9791. unsigned int numberOfChannels,
  9792. int bitsPerSample,
  9793. const StringPairArray& metadataValues,
  9794. int qualityOptionIndex);
  9795. juce_UseDebuggingNewOperator
  9796. };
  9797. #endif
  9798. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9799. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  9800. #endif
  9801. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9802. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  9803. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9804. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9805. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9806. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9807. {
  9808. public:
  9809. OggVorbisAudioFormat();
  9810. ~OggVorbisAudioFormat();
  9811. const Array <int> getPossibleSampleRates();
  9812. const Array <int> getPossibleBitDepths();
  9813. bool canDoStereo();
  9814. bool canDoMono();
  9815. bool isCompressed();
  9816. const StringArray getQualityOptions();
  9817. int estimateOggFileQuality (const File& source);
  9818. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9819. const bool deleteStreamIfOpeningFails);
  9820. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9821. double sampleRateToUse,
  9822. unsigned int numberOfChannels,
  9823. int bitsPerSample,
  9824. const StringPairArray& metadataValues,
  9825. int qualityOptionIndex);
  9826. juce_UseDebuggingNewOperator
  9827. };
  9828. #endif
  9829. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9830. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  9831. #endif
  9832. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9833. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  9834. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9835. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9836. #if JUCE_QUICKTIME
  9837. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  9838. {
  9839. public:
  9840. QuickTimeAudioFormat();
  9841. ~QuickTimeAudioFormat();
  9842. const Array <int> getPossibleSampleRates();
  9843. const Array <int> getPossibleBitDepths();
  9844. bool canDoStereo();
  9845. bool canDoMono();
  9846. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9847. const bool deleteStreamIfOpeningFails);
  9848. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9849. double sampleRateToUse,
  9850. unsigned int numberOfChannels,
  9851. int bitsPerSample,
  9852. const StringPairArray& metadataValues,
  9853. int qualityOptionIndex);
  9854. juce_UseDebuggingNewOperator
  9855. };
  9856. #endif
  9857. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9858. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  9859. #endif
  9860. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9861. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  9862. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9863. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9864. class JUCE_API WavAudioFormat : public AudioFormat
  9865. {
  9866. public:
  9867. WavAudioFormat();
  9868. ~WavAudioFormat();
  9869. static const tchar* const bwavDescription;
  9870. static const tchar* const bwavOriginator;
  9871. static const tchar* const bwavOriginatorRef;
  9872. static const tchar* const bwavOriginationDate;
  9873. static const tchar* const bwavOriginationTime;
  9874. static const tchar* const bwavTimeReference;
  9875. static const tchar* const bwavCodingHistory;
  9876. static const StringPairArray createBWAVMetadata (const String& description,
  9877. const String& originator,
  9878. const String& originatorRef,
  9879. const Time& dateAndTime,
  9880. const int64 timeReferenceSamples,
  9881. const String& codingHistory);
  9882. const Array <int> getPossibleSampleRates();
  9883. const Array <int> getPossibleBitDepths();
  9884. bool canDoStereo();
  9885. bool canDoMono();
  9886. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9887. const bool deleteStreamIfOpeningFails);
  9888. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9889. double sampleRateToUse,
  9890. unsigned int numberOfChannels,
  9891. int bitsPerSample,
  9892. const StringPairArray& metadataValues,
  9893. int qualityOptionIndex);
  9894. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  9895. juce_UseDebuggingNewOperator
  9896. };
  9897. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9898. /*** End of inlined file: juce_WavAudioFormat.h ***/
  9899. #endif
  9900. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9901. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  9902. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9903. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9904. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  9905. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9906. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9907. class JUCE_API PositionableAudioSource : public AudioSource
  9908. {
  9909. protected:
  9910. PositionableAudioSource() throw() {}
  9911. public:
  9912. ~PositionableAudioSource() {}
  9913. virtual void setNextReadPosition (int newPosition) = 0;
  9914. virtual int getNextReadPosition() const = 0;
  9915. virtual int getTotalLength() const = 0;
  9916. virtual bool isLooping() const = 0;
  9917. };
  9918. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9919. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  9920. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  9921. {
  9922. public:
  9923. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  9924. const bool deleteReaderWhenThisIsDeleted);
  9925. ~AudioFormatReaderSource();
  9926. void setLooping (const bool shouldLoop) throw();
  9927. bool isLooping() const { return looping; }
  9928. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  9929. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9930. void releaseResources();
  9931. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9932. void setNextReadPosition (int newPosition);
  9933. int getNextReadPosition() const;
  9934. int getTotalLength() const;
  9935. juce_UseDebuggingNewOperator
  9936. private:
  9937. AudioFormatReader* reader;
  9938. bool deleteReader;
  9939. int volatile nextPlayPos;
  9940. bool volatile looping;
  9941. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  9942. AudioFormatReaderSource (const AudioFormatReaderSource&);
  9943. AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  9944. };
  9945. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9946. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  9947. #endif
  9948. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9949. #endif
  9950. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9951. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  9952. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9953. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9954. /*** Start of inlined file: juce_AudioIODevice.h ***/
  9955. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9956. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9957. class AudioIODevice;
  9958. class JUCE_API AudioIODeviceCallback
  9959. {
  9960. public:
  9961. virtual ~AudioIODeviceCallback() {}
  9962. virtual void audioDeviceIOCallback (const float** inputChannelData,
  9963. int numInputChannels,
  9964. float** outputChannelData,
  9965. int numOutputChannels,
  9966. int numSamples) = 0;
  9967. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  9968. virtual void audioDeviceStopped() = 0;
  9969. };
  9970. class JUCE_API AudioIODevice
  9971. {
  9972. public:
  9973. virtual ~AudioIODevice();
  9974. const String& getName() const throw() { return name; }
  9975. const String& getTypeName() const throw() { return typeName; }
  9976. virtual const StringArray getOutputChannelNames() = 0;
  9977. virtual const StringArray getInputChannelNames() = 0;
  9978. virtual int getNumSampleRates() = 0;
  9979. virtual double getSampleRate (int index) = 0;
  9980. virtual int getNumBufferSizesAvailable() = 0;
  9981. virtual int getBufferSizeSamples (int index) = 0;
  9982. virtual int getDefaultBufferSize() = 0;
  9983. virtual const String open (const BitArray& inputChannels,
  9984. const BitArray& outputChannels,
  9985. double sampleRate,
  9986. int bufferSizeSamples) = 0;
  9987. virtual void close() = 0;
  9988. virtual bool isOpen() = 0;
  9989. virtual void start (AudioIODeviceCallback* callback) = 0;
  9990. virtual void stop() = 0;
  9991. virtual bool isPlaying() = 0;
  9992. virtual const String getLastError() = 0;
  9993. virtual int getCurrentBufferSizeSamples() = 0;
  9994. virtual double getCurrentSampleRate() = 0;
  9995. virtual int getCurrentBitDepth() = 0;
  9996. virtual const BitArray getActiveOutputChannels() const = 0;
  9997. virtual const BitArray getActiveInputChannels() const = 0;
  9998. virtual int getOutputLatencyInSamples() = 0;
  9999. virtual int getInputLatencyInSamples() = 0;
  10000. virtual bool hasControlPanel() const;
  10001. virtual bool showControlPanel();
  10002. protected:
  10003. AudioIODevice (const String& deviceName,
  10004. const String& typeName);
  10005. String name, typeName;
  10006. };
  10007. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10008. /*** End of inlined file: juce_AudioIODevice.h ***/
  10009. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10010. {
  10011. public:
  10012. AudioSourcePlayer();
  10013. virtual ~AudioSourcePlayer();
  10014. void setSource (AudioSource* newSource);
  10015. AudioSource* getCurrentSource() const throw() { return source; }
  10016. void setGain (const float newGain) throw();
  10017. void audioDeviceIOCallback (const float** inputChannelData,
  10018. int totalNumInputChannels,
  10019. float** outputChannelData,
  10020. int totalNumOutputChannels,
  10021. int numSamples);
  10022. void audioDeviceAboutToStart (AudioIODevice* device);
  10023. void audioDeviceStopped();
  10024. juce_UseDebuggingNewOperator
  10025. private:
  10026. CriticalSection readLock;
  10027. AudioSource* source;
  10028. double sampleRate;
  10029. int bufferSize;
  10030. float* channels [128];
  10031. float* outputChans [128];
  10032. const float* inputChans [128];
  10033. AudioSampleBuffer tempBuffer;
  10034. float lastGain, gain;
  10035. AudioSourcePlayer (const AudioSourcePlayer&);
  10036. AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10037. };
  10038. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10039. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10040. #endif
  10041. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10042. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10043. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10044. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10045. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10046. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10047. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10048. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10049. {
  10050. public:
  10051. BufferingAudioSource (PositionableAudioSource* source,
  10052. const bool deleteSourceWhenDeleted,
  10053. int numberOfSamplesToBuffer);
  10054. ~BufferingAudioSource();
  10055. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10056. void releaseResources();
  10057. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10058. void setNextReadPosition (int newPosition);
  10059. int getNextReadPosition() const;
  10060. int getTotalLength() const { return source->getTotalLength(); }
  10061. bool isLooping() const { return source->isLooping(); }
  10062. juce_UseDebuggingNewOperator
  10063. private:
  10064. PositionableAudioSource* source;
  10065. bool deleteSourceWhenDeleted;
  10066. int numberOfSamplesToBuffer;
  10067. AudioSampleBuffer buffer;
  10068. CriticalSection bufferStartPosLock;
  10069. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10070. bool wasSourceLooping;
  10071. double volatile sampleRate;
  10072. friend class SharedBufferingAudioSourceThread;
  10073. bool readNextBufferChunk();
  10074. void readBufferSection (int start, int length, int bufferOffset);
  10075. BufferingAudioSource (const BufferingAudioSource&);
  10076. BufferingAudioSource& operator= (const BufferingAudioSource&);
  10077. };
  10078. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10079. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10080. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10081. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10082. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10083. class JUCE_API ResamplingAudioSource : public AudioSource
  10084. {
  10085. public:
  10086. ResamplingAudioSource (AudioSource* const inputSource,
  10087. const bool deleteInputWhenDeleted);
  10088. ~ResamplingAudioSource();
  10089. void setResamplingRatio (const double samplesInPerOutputSample);
  10090. double getResamplingRatio() const throw() { return ratio; }
  10091. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10092. void releaseResources();
  10093. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10094. juce_UseDebuggingNewOperator
  10095. private:
  10096. AudioSource* const input;
  10097. const bool deleteInputWhenDeleted;
  10098. double ratio, lastRatio;
  10099. AudioSampleBuffer buffer;
  10100. int bufferPos, sampsInBuffer;
  10101. double subSampleOffset;
  10102. double coefficients[6];
  10103. CriticalSection ratioLock;
  10104. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10105. void createLowPass (const double proportionalRate);
  10106. struct FilterState
  10107. {
  10108. double x1, x2, y1, y2;
  10109. };
  10110. FilterState filterStates[2];
  10111. void resetFilters();
  10112. void applyFilter (float* samples, int num, FilterState& fs);
  10113. ResamplingAudioSource (const ResamplingAudioSource&);
  10114. ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10115. };
  10116. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10117. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10118. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10119. public ChangeBroadcaster
  10120. {
  10121. public:
  10122. AudioTransportSource();
  10123. ~AudioTransportSource();
  10124. void setSource (PositionableAudioSource* const newSource,
  10125. int readAheadBufferSize = 0,
  10126. double sourceSampleRateToCorrectFor = 0.0);
  10127. void setPosition (double newPosition);
  10128. double getCurrentPosition() const;
  10129. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10130. void start();
  10131. void stop();
  10132. bool isPlaying() const throw() { return playing; }
  10133. void setGain (const float newGain) throw();
  10134. float getGain() const throw() { return gain; }
  10135. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10136. void releaseResources();
  10137. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10138. void setNextReadPosition (int newPosition);
  10139. int getNextReadPosition() const;
  10140. int getTotalLength() const;
  10141. bool isLooping() const;
  10142. juce_UseDebuggingNewOperator
  10143. private:
  10144. PositionableAudioSource* source;
  10145. ResamplingAudioSource* resamplerSource;
  10146. BufferingAudioSource* bufferingSource;
  10147. PositionableAudioSource* positionableSource;
  10148. AudioSource* masterSource;
  10149. CriticalSection callbackLock;
  10150. float volatile gain, lastGain;
  10151. bool volatile playing, stopped;
  10152. double sampleRate, sourceSampleRate;
  10153. int blockSize, readAheadBufferSize;
  10154. bool isPrepared, inputStreamEOF;
  10155. AudioTransportSource (const AudioTransportSource&);
  10156. AudioTransportSource& operator= (const AudioTransportSource&);
  10157. };
  10158. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10159. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10160. #endif
  10161. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10162. #endif
  10163. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10164. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10165. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10166. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10167. class ChannelRemappingAudioSource : public AudioSource
  10168. {
  10169. public:
  10170. ChannelRemappingAudioSource (AudioSource* const source,
  10171. const bool deleteSourceWhenDeleted);
  10172. ~ChannelRemappingAudioSource();
  10173. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10174. void clearAllMappings() throw();
  10175. void setInputChannelMapping (const int destChannelIndex,
  10176. const int sourceChannelIndex) throw();
  10177. void setOutputChannelMapping (const int sourceChannelIndex,
  10178. const int destChannelIndex) throw();
  10179. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10180. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10181. XmlElement* createXml() const throw();
  10182. void restoreFromXml (const XmlElement& e) throw();
  10183. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10184. void releaseResources();
  10185. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10186. juce_UseDebuggingNewOperator
  10187. private:
  10188. int requiredNumberOfChannels;
  10189. Array <int> remappedInputs, remappedOutputs;
  10190. AudioSource* const source;
  10191. const bool deleteSourceWhenDeleted;
  10192. AudioSampleBuffer buffer;
  10193. AudioSourceChannelInfo remappedInfo;
  10194. CriticalSection lock;
  10195. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10196. ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10197. };
  10198. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10199. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10200. #endif
  10201. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10202. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10203. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10204. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10205. /*** Start of inlined file: juce_IIRFilter.h ***/
  10206. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10207. #define __JUCE_IIRFILTER_JUCEHEADER__
  10208. class JUCE_API IIRFilter
  10209. {
  10210. public:
  10211. IIRFilter() throw();
  10212. IIRFilter (const IIRFilter& other) throw();
  10213. ~IIRFilter() throw();
  10214. void reset() throw();
  10215. void processSamples (float* const samples,
  10216. const int numSamples) throw();
  10217. float processSingleSampleRaw (const float sample) throw();
  10218. void makeLowPass (const double sampleRate,
  10219. const double frequency) throw();
  10220. void makeHighPass (const double sampleRate,
  10221. const double frequency) throw();
  10222. void makeLowShelf (const double sampleRate,
  10223. const double cutOffFrequency,
  10224. const double Q,
  10225. const float gainFactor) throw();
  10226. void makeHighShelf (const double sampleRate,
  10227. const double cutOffFrequency,
  10228. const double Q,
  10229. const float gainFactor) throw();
  10230. void makeBandPass (const double sampleRate,
  10231. const double centreFrequency,
  10232. const double Q,
  10233. const float gainFactor) throw();
  10234. void makeInactive() throw();
  10235. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10236. juce_UseDebuggingNewOperator
  10237. protected:
  10238. CriticalSection processLock;
  10239. void setCoefficients (double c1, double c2, double c3,
  10240. double c4, double c5, double c6) throw();
  10241. bool active;
  10242. float coefficients[6];
  10243. float x1, x2, y1, y2;
  10244. // (use the copyCoefficientsFrom() method instead of this operator)
  10245. IIRFilter& operator= (const IIRFilter&);
  10246. };
  10247. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10248. /*** End of inlined file: juce_IIRFilter.h ***/
  10249. class JUCE_API IIRFilterAudioSource : public AudioSource
  10250. {
  10251. public:
  10252. IIRFilterAudioSource (AudioSource* const inputSource,
  10253. const bool deleteInputWhenDeleted);
  10254. ~IIRFilterAudioSource();
  10255. void setFilterParameters (const IIRFilter& newSettings);
  10256. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10257. void releaseResources();
  10258. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10259. juce_UseDebuggingNewOperator
  10260. private:
  10261. AudioSource* const input;
  10262. const bool deleteInputWhenDeleted;
  10263. OwnedArray <IIRFilter> iirFilters;
  10264. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10265. IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10266. };
  10267. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10268. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10269. #endif
  10270. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10271. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10272. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10273. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10274. class JUCE_API MixerAudioSource : public AudioSource
  10275. {
  10276. public:
  10277. MixerAudioSource();
  10278. ~MixerAudioSource();
  10279. void addInputSource (AudioSource* newInput,
  10280. const bool deleteWhenRemoved);
  10281. void removeInputSource (AudioSource* input,
  10282. const bool deleteSource);
  10283. void removeAllInputs();
  10284. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10285. void releaseResources();
  10286. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10287. juce_UseDebuggingNewOperator
  10288. private:
  10289. VoidArray inputs;
  10290. BitArray inputsToDelete;
  10291. CriticalSection lock;
  10292. AudioSampleBuffer tempBuffer;
  10293. double currentSampleRate;
  10294. int bufferSizeExpected;
  10295. MixerAudioSource (const MixerAudioSource&);
  10296. MixerAudioSource& operator= (const MixerAudioSource&);
  10297. };
  10298. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10299. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10300. #endif
  10301. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10302. #endif
  10303. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10304. #endif
  10305. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10306. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10307. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10308. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10309. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10310. {
  10311. public:
  10312. ToneGeneratorAudioSource();
  10313. ~ToneGeneratorAudioSource();
  10314. void setAmplitude (const float newAmplitude);
  10315. void setFrequency (const double newFrequencyHz);
  10316. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10317. void releaseResources();
  10318. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10319. juce_UseDebuggingNewOperator
  10320. private:
  10321. double frequency, sampleRate;
  10322. double currentPhase, phasePerSample;
  10323. float amplitude;
  10324. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10325. ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10326. };
  10327. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10328. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10329. #endif
  10330. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10331. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10332. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10333. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10334. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10335. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10336. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10337. class AudioDeviceManager;
  10338. class Component;
  10339. class JUCE_API AudioIODeviceType
  10340. {
  10341. public:
  10342. const String& getTypeName() const throw() { return typeName; }
  10343. virtual void scanForDevices() = 0;
  10344. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10345. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10346. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10347. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10348. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10349. const String& inputDeviceName) = 0;
  10350. struct DeviceSetupDetails
  10351. {
  10352. AudioDeviceManager* manager;
  10353. int minNumInputChannels, maxNumInputChannels;
  10354. int minNumOutputChannels, maxNumOutputChannels;
  10355. bool useStereoPairs;
  10356. };
  10357. virtual ~AudioIODeviceType();
  10358. protected:
  10359. AudioIODeviceType (const tchar* const typeName);
  10360. private:
  10361. String typeName;
  10362. AudioIODeviceType (const AudioIODeviceType&);
  10363. AudioIODeviceType& operator= (const AudioIODeviceType&);
  10364. };
  10365. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10366. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10367. /*** Start of inlined file: juce_MidiInput.h ***/
  10368. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10369. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10370. /*** Start of inlined file: juce_MidiMessage.h ***/
  10371. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10372. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10373. class JUCE_API MidiMessage
  10374. {
  10375. public:
  10376. MidiMessage (const int byte1,
  10377. const int byte2,
  10378. const int byte3,
  10379. const double timeStamp = 0) throw();
  10380. MidiMessage (const int byte1,
  10381. const int byte2,
  10382. const double timeStamp = 0) throw();
  10383. MidiMessage (const int byte1,
  10384. const double timeStamp = 0) throw();
  10385. MidiMessage (const uint8* const data,
  10386. const int dataSize,
  10387. const double timeStamp = 0) throw();
  10388. MidiMessage (const uint8* data,
  10389. int size,
  10390. int& numBytesUsed,
  10391. uint8 lastStatusByte,
  10392. double timeStamp = 0) throw();
  10393. MidiMessage (const MidiMessage& other) throw();
  10394. MidiMessage (const MidiMessage& other,
  10395. const double newTimeStamp) throw();
  10396. ~MidiMessage() throw();
  10397. MidiMessage& operator= (const MidiMessage& other) throw();
  10398. uint8* getRawData() const throw() { return data; }
  10399. int getRawDataSize() const throw() { return size; }
  10400. double getTimeStamp() const throw() { return timeStamp; }
  10401. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10402. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10403. int getChannel() const throw();
  10404. bool isForChannel (const int channelNumber) const throw();
  10405. void setChannel (const int newChannelNumber) throw();
  10406. bool isSysEx() const throw();
  10407. const uint8* getSysExData() const throw();
  10408. int getSysExDataSize() const throw();
  10409. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10410. static const MidiMessage noteOn (const int channel,
  10411. const int noteNumber,
  10412. const float velocity) throw();
  10413. static const MidiMessage noteOn (const int channel,
  10414. const int noteNumber,
  10415. const uint8 velocity) throw();
  10416. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10417. static const MidiMessage noteOff (const int channel,
  10418. const int noteNumber) throw();
  10419. bool isNoteOnOrOff() const throw();
  10420. int getNoteNumber() const throw();
  10421. void setNoteNumber (const int newNoteNumber) throw();
  10422. uint8 getVelocity() const throw();
  10423. float getFloatVelocity() const throw();
  10424. void setVelocity (const float newVelocity) throw();
  10425. void multiplyVelocity (const float scaleFactor) throw();
  10426. bool isProgramChange() const throw();
  10427. int getProgramChangeNumber() const throw();
  10428. static const MidiMessage programChange (const int channel,
  10429. const int programNumber) throw();
  10430. bool isPitchWheel() const throw();
  10431. int getPitchWheelValue() const throw();
  10432. static const MidiMessage pitchWheel (const int channel,
  10433. const int position) throw();
  10434. bool isAftertouch() const throw();
  10435. int getAfterTouchValue() const throw();
  10436. static const MidiMessage aftertouchChange (const int channel,
  10437. const int noteNumber,
  10438. const int aftertouchAmount) throw();
  10439. bool isChannelPressure() const throw();
  10440. int getChannelPressureValue() const throw();
  10441. static const MidiMessage channelPressureChange (const int channel,
  10442. const int pressure) throw();
  10443. bool isController() const throw();
  10444. int getControllerNumber() const throw();
  10445. int getControllerValue() const throw();
  10446. static const MidiMessage controllerEvent (const int channel,
  10447. const int controllerType,
  10448. const int value) throw();
  10449. bool isAllNotesOff() const throw();
  10450. bool isAllSoundOff() const throw();
  10451. static const MidiMessage allNotesOff (const int channel) throw();
  10452. static const MidiMessage allSoundOff (const int channel) throw();
  10453. static const MidiMessage allControllersOff (const int channel) throw();
  10454. bool isMetaEvent() const throw();
  10455. int getMetaEventType() const throw();
  10456. const uint8* getMetaEventData() const throw();
  10457. int getMetaEventLength() const throw();
  10458. bool isTrackMetaEvent() const throw();
  10459. bool isEndOfTrackMetaEvent() const throw();
  10460. static const MidiMessage endOfTrack() throw();
  10461. bool isTrackNameEvent() const throw();
  10462. bool isTextMetaEvent() const throw();
  10463. const String getTextFromTextMetaEvent() const throw();
  10464. bool isTempoMetaEvent() const throw();
  10465. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10466. double getTempoSecondsPerQuarterNote() const throw();
  10467. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10468. bool isTimeSignatureMetaEvent() const throw();
  10469. void getTimeSignatureInfo (int& numerator,
  10470. int& denominator) const throw();
  10471. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10472. const int denominator) throw();
  10473. bool isKeySignatureMetaEvent() const throw();
  10474. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10475. bool isMidiChannelMetaEvent() const throw();
  10476. int getMidiChannelMetaEventChannel() const throw();
  10477. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10478. bool isActiveSense() const throw();
  10479. bool isMidiStart() const throw();
  10480. static const MidiMessage midiStart() throw();
  10481. bool isMidiContinue() const throw();
  10482. static const MidiMessage midiContinue() throw();
  10483. bool isMidiStop() const throw();
  10484. static const MidiMessage midiStop() throw();
  10485. bool isMidiClock() const throw();
  10486. static const MidiMessage midiClock() throw();
  10487. bool isSongPositionPointer() const throw();
  10488. int getSongPositionPointerMidiBeat() const throw();
  10489. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10490. bool isQuarterFrame() const throw();
  10491. int getQuarterFrameSequenceNumber() const throw();
  10492. int getQuarterFrameValue() const throw();
  10493. static const MidiMessage quarterFrame (const int sequenceNumber,
  10494. const int value) throw();
  10495. enum SmpteTimecodeType
  10496. {
  10497. fps24 = 0,
  10498. fps25 = 1,
  10499. fps30drop = 2,
  10500. fps30 = 3
  10501. };
  10502. bool isFullFrame() const throw();
  10503. void getFullFrameParameters (int& hours,
  10504. int& minutes,
  10505. int& seconds,
  10506. int& frames,
  10507. SmpteTimecodeType& timecodeType) const throw();
  10508. static const MidiMessage fullFrame (const int hours,
  10509. const int minutes,
  10510. const int seconds,
  10511. const int frames,
  10512. SmpteTimecodeType timecodeType);
  10513. enum MidiMachineControlCommand
  10514. {
  10515. mmc_stop = 1,
  10516. mmc_play = 2,
  10517. mmc_deferredplay = 3,
  10518. mmc_fastforward = 4,
  10519. mmc_rewind = 5,
  10520. mmc_recordStart = 6,
  10521. mmc_recordStop = 7,
  10522. mmc_pause = 9
  10523. };
  10524. bool isMidiMachineControlMessage() const throw();
  10525. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10526. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10527. bool isMidiMachineControlGoto (int& hours,
  10528. int& minutes,
  10529. int& seconds,
  10530. int& frames) const throw();
  10531. static const MidiMessage midiMachineControlGoto (int hours,
  10532. int minutes,
  10533. int seconds,
  10534. int frames);
  10535. static const MidiMessage masterVolume (const float volume) throw();
  10536. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10537. const int dataSize) throw();
  10538. static int readVariableLengthVal (const uint8* data,
  10539. int& numBytesUsed) throw();
  10540. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10541. static const String getMidiNoteName (int noteNumber,
  10542. bool useSharps,
  10543. bool includeOctaveNumber,
  10544. int octaveNumForMiddleC) throw();
  10545. static const double getMidiNoteInHertz (int noteNumber) throw();
  10546. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10547. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10548. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10549. static const String getControllerName (int controllerNumber) throw();
  10550. juce_UseDebuggingNewOperator
  10551. private:
  10552. double timeStamp;
  10553. uint8* data;
  10554. int message, size;
  10555. };
  10556. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10557. /*** End of inlined file: juce_MidiMessage.h ***/
  10558. class MidiInput;
  10559. class JUCE_API MidiInputCallback
  10560. {
  10561. public:
  10562. virtual ~MidiInputCallback() {}
  10563. virtual void handleIncomingMidiMessage (MidiInput* source,
  10564. const MidiMessage& message) = 0;
  10565. virtual void handlePartialSysexMessage (MidiInput* source,
  10566. const uint8* messageData,
  10567. const int numBytesSoFar,
  10568. const double timestamp)
  10569. {
  10570. // (this bit is just to avoid compiler warnings about unused variables)
  10571. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10572. }
  10573. };
  10574. class JUCE_API MidiInput
  10575. {
  10576. public:
  10577. static const StringArray getDevices();
  10578. static int getDefaultDeviceIndex();
  10579. static MidiInput* openDevice (int deviceIndex,
  10580. MidiInputCallback* callback);
  10581. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10582. static MidiInput* createNewDevice (const String& deviceName,
  10583. MidiInputCallback* callback);
  10584. #endif
  10585. virtual ~MidiInput();
  10586. virtual const String getName() const throw() { return name; }
  10587. virtual void setName (const String& newName) throw() { name = newName; }
  10588. virtual void start();
  10589. virtual void stop();
  10590. juce_UseDebuggingNewOperator
  10591. protected:
  10592. String name;
  10593. void* internal;
  10594. MidiInput (const String& name);
  10595. MidiInput (const MidiInput&);
  10596. };
  10597. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10598. /*** End of inlined file: juce_MidiInput.h ***/
  10599. /*** Start of inlined file: juce_MidiOutput.h ***/
  10600. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10601. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10602. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10603. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10604. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10605. class JUCE_API MidiBuffer
  10606. {
  10607. public:
  10608. MidiBuffer() throw();
  10609. MidiBuffer (const MidiMessage& message) throw();
  10610. MidiBuffer (const MidiBuffer& other) throw();
  10611. MidiBuffer& operator= (const MidiBuffer& other) throw();
  10612. ~MidiBuffer() throw();
  10613. void clear() throw();
  10614. void clear (const int start,
  10615. const int numSamples) throw();
  10616. bool isEmpty() const throw();
  10617. int getNumEvents() const throw();
  10618. void addEvent (const MidiMessage& midiMessage,
  10619. const int sampleNumber) throw();
  10620. void addEvent (const uint8* const rawMidiData,
  10621. const int maxBytesOfMidiData,
  10622. const int sampleNumber) throw();
  10623. void addEvents (const MidiBuffer& otherBuffer,
  10624. const int startSample,
  10625. const int numSamples,
  10626. const int sampleDeltaToAdd) throw();
  10627. int getFirstEventTime() const throw();
  10628. int getLastEventTime() const throw();
  10629. void swap (MidiBuffer& other);
  10630. class Iterator
  10631. {
  10632. public:
  10633. Iterator (const MidiBuffer& buffer) throw();
  10634. ~Iterator() throw();
  10635. void setNextSamplePosition (const int samplePosition) throw();
  10636. bool getNextEvent (MidiMessage& result,
  10637. int& samplePosition) throw();
  10638. bool getNextEvent (const uint8* &midiData,
  10639. int& numBytesOfMidiData,
  10640. int& samplePosition) throw();
  10641. juce_UseDebuggingNewOperator
  10642. private:
  10643. const MidiBuffer& buffer;
  10644. const uint8* data;
  10645. Iterator (const Iterator&);
  10646. Iterator& operator= (const Iterator&);
  10647. };
  10648. juce_UseDebuggingNewOperator
  10649. private:
  10650. friend class MidiBuffer::Iterator;
  10651. MemoryBlock data;
  10652. int bytesUsed;
  10653. uint8* getData() const throw() { return reinterpret_cast <uint8*> (data.getData()); }
  10654. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10655. };
  10656. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10657. /*** End of inlined file: juce_MidiBuffer.h ***/
  10658. class JUCE_API MidiOutput : private Thread
  10659. {
  10660. public:
  10661. static const StringArray getDevices();
  10662. static int getDefaultDeviceIndex();
  10663. static MidiOutput* openDevice (int deviceIndex);
  10664. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10665. static MidiOutput* createNewDevice (const String& deviceName);
  10666. #endif
  10667. virtual ~MidiOutput();
  10668. virtual void sendMessageNow (const MidiMessage& message);
  10669. virtual void reset();
  10670. virtual bool getVolume (float& leftVol,
  10671. float& rightVol);
  10672. virtual void setVolume (float leftVol,
  10673. float rightVol);
  10674. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10675. const double millisecondCounterToStartAt,
  10676. double samplesPerSecondForBuffer) throw();
  10677. virtual void clearAllPendingMessages() throw();
  10678. virtual void startBackgroundThread() throw();
  10679. virtual void stopBackgroundThread() throw();
  10680. juce_UseDebuggingNewOperator
  10681. protected:
  10682. void* internal;
  10683. struct PendingMessage
  10684. {
  10685. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10686. MidiMessage message;
  10687. PendingMessage* next;
  10688. juce_UseDebuggingNewOperator
  10689. };
  10690. CriticalSection lock;
  10691. PendingMessage* firstMessage;
  10692. MidiOutput() throw();
  10693. MidiOutput (const MidiOutput&);
  10694. void run();
  10695. };
  10696. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10697. /*** End of inlined file: juce_MidiOutput.h ***/
  10698. /*** Start of inlined file: juce_ComboBox.h ***/
  10699. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10700. #define __JUCE_COMBOBOX_JUCEHEADER__
  10701. /*** Start of inlined file: juce_Label.h ***/
  10702. #ifndef __JUCE_LABEL_JUCEHEADER__
  10703. #define __JUCE_LABEL_JUCEHEADER__
  10704. /*** Start of inlined file: juce_TextEditor.h ***/
  10705. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10706. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10707. /*** Start of inlined file: juce_Viewport.h ***/
  10708. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10709. #define __JUCE_VIEWPORT_JUCEHEADER__
  10710. /*** Start of inlined file: juce_ScrollBar.h ***/
  10711. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10712. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10713. /*** Start of inlined file: juce_Button.h ***/
  10714. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10715. #define __JUCE_BUTTON_JUCEHEADER__
  10716. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10717. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10718. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10719. /*** Start of inlined file: juce_TooltipClient.h ***/
  10720. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10721. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10722. class JUCE_API TooltipClient
  10723. {
  10724. public:
  10725. virtual ~TooltipClient() {}
  10726. virtual const String getTooltip() = 0;
  10727. };
  10728. class JUCE_API SettableTooltipClient : public TooltipClient
  10729. {
  10730. public:
  10731. virtual ~SettableTooltipClient() {}
  10732. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10733. virtual const String getTooltip() { return tooltipString; }
  10734. juce_UseDebuggingNewOperator
  10735. protected:
  10736. String tooltipString;
  10737. };
  10738. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10739. /*** End of inlined file: juce_TooltipClient.h ***/
  10740. class JUCE_API TooltipWindow : public Component,
  10741. private Timer
  10742. {
  10743. public:
  10744. TooltipWindow (Component* parentComponent = 0,
  10745. const int millisecondsBeforeTipAppears = 700);
  10746. ~TooltipWindow();
  10747. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10748. enum ColourIds
  10749. {
  10750. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10751. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10752. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10753. };
  10754. juce_UseDebuggingNewOperator
  10755. private:
  10756. int millisecondsBeforeTipAppears;
  10757. Point<int> lastMousePos;
  10758. int mouseClicks;
  10759. unsigned int lastCompChangeTime, lastHideTime;
  10760. Component* lastComponentUnderMouse;
  10761. bool changedCompsSinceShown;
  10762. String tipShowing, lastTipUnderMouse;
  10763. void paint (Graphics& g);
  10764. void mouseEnter (const MouseEvent& e);
  10765. void timerCallback();
  10766. static const String getTipFor (Component* const c);
  10767. void showFor (const String& tip);
  10768. void hide();
  10769. TooltipWindow (const TooltipWindow&);
  10770. TooltipWindow& operator= (const TooltipWindow&);
  10771. };
  10772. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10773. /*** End of inlined file: juce_TooltipWindow.h ***/
  10774. class Button;
  10775. class JUCE_API ButtonListener
  10776. {
  10777. public:
  10778. virtual ~ButtonListener() {}
  10779. virtual void buttonClicked (Button* button) = 0;
  10780. virtual void buttonStateChanged (Button*) {}
  10781. };
  10782. class JUCE_API Button : public Component,
  10783. public SettableTooltipClient,
  10784. public ApplicationCommandManagerListener,
  10785. public Value::Listener,
  10786. private KeyListener
  10787. {
  10788. protected:
  10789. Button (const String& buttonName);
  10790. public:
  10791. virtual ~Button();
  10792. void setButtonText (const String& newText);
  10793. const String getButtonText() const { return text; }
  10794. bool isDown() const throw();
  10795. bool isOver() const throw();
  10796. void setToggleState (const bool shouldBeOn,
  10797. const bool sendChangeNotification);
  10798. bool getToggleState() const throw() { return isOn.getValue(); }
  10799. Value& getToggleStateValue() { return isOn; }
  10800. void setClickingTogglesState (const bool shouldToggle) throw();
  10801. bool getClickingTogglesState() const throw();
  10802. void setRadioGroupId (const int newGroupId);
  10803. int getRadioGroupId() const throw() { return radioGroupId; }
  10804. void addButtonListener (ButtonListener* const newListener);
  10805. void removeButtonListener (ButtonListener* const listener);
  10806. virtual void triggerClick();
  10807. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10808. const int commandID,
  10809. const bool generateTooltip);
  10810. int getCommandID() const throw() { return commandID; }
  10811. void addShortcut (const KeyPress& key);
  10812. void clearShortcuts();
  10813. bool isRegisteredForShortcut (const KeyPress& key) const;
  10814. void setRepeatSpeed (const int initialDelayInMillisecs,
  10815. const int repeatDelayInMillisecs,
  10816. const int minimumDelayInMillisecs = -1) throw();
  10817. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  10818. uint32 getMillisecondsSinceButtonDown() const throw();
  10819. void setVisible (bool shouldBeVisible);
  10820. void setTooltip (const String& newTooltip);
  10821. // (implementation of the TooltipClient method)
  10822. const String getTooltip();
  10823. enum ConnectedEdgeFlags
  10824. {
  10825. ConnectedOnLeft = 1,
  10826. ConnectedOnRight = 2,
  10827. ConnectedOnTop = 4,
  10828. ConnectedOnBottom = 8
  10829. };
  10830. void setConnectedEdges (const int connectedEdgeFlags);
  10831. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  10832. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  10833. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  10834. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  10835. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  10836. enum ButtonState
  10837. {
  10838. buttonNormal,
  10839. buttonOver,
  10840. buttonDown
  10841. };
  10842. void setState (const ButtonState newState);
  10843. juce_UseDebuggingNewOperator
  10844. protected:
  10845. virtual void clicked();
  10846. virtual void clicked (const ModifierKeys& modifiers);
  10847. virtual void paintButton (Graphics& g,
  10848. bool isMouseOverButton,
  10849. bool isButtonDown) = 0;
  10850. virtual void buttonStateChanged();
  10851. virtual void internalClickCallback (const ModifierKeys& modifiers);
  10852. void handleCommandMessage (int commandId);
  10853. void mouseEnter (const MouseEvent& e);
  10854. void mouseExit (const MouseEvent& e);
  10855. void mouseDown (const MouseEvent& e);
  10856. void mouseDrag (const MouseEvent& e);
  10857. void mouseUp (const MouseEvent& e);
  10858. bool keyPressed (const KeyPress& key);
  10859. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  10860. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  10861. void paint (Graphics& g);
  10862. void parentHierarchyChanged();
  10863. void focusGained (FocusChangeType cause);
  10864. void focusLost (FocusChangeType cause);
  10865. void enablementChanged();
  10866. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  10867. void applicationCommandListChanged();
  10868. void valueChanged (Value& value);
  10869. private:
  10870. Array <KeyPress> shortcuts;
  10871. Component* keySource;
  10872. String text;
  10873. SortedSet <void*> buttonListeners;
  10874. class RepeatTimer;
  10875. friend class RepeatTimer;
  10876. friend class ScopedPointer <RepeatTimer>;
  10877. ScopedPointer <RepeatTimer> repeatTimer;
  10878. uint32 buttonPressTime, lastTimeCallbackTime;
  10879. ApplicationCommandManager* commandManagerToUse;
  10880. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  10881. int radioGroupId, commandID, connectedEdgeFlags;
  10882. ButtonState buttonState;
  10883. Value isOn;
  10884. bool lastToggleState : 1;
  10885. bool clickTogglesState : 1;
  10886. bool needsToRelease : 1;
  10887. bool needsRepainting : 1;
  10888. bool isKeyDown : 1;
  10889. bool triggerOnMouseDown : 1;
  10890. bool generateTooltip : 1;
  10891. void repeatTimerCallback();
  10892. RepeatTimer& getRepeatTimer();
  10893. ButtonState updateState (const MouseEvent* const e);
  10894. bool isShortcutPressed() const;
  10895. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  10896. void flashButtonState();
  10897. void sendClickMessage (const ModifierKeys& modifiers);
  10898. void sendStateMessage();
  10899. Button (const Button&);
  10900. Button& operator= (const Button&);
  10901. };
  10902. #endif // __JUCE_BUTTON_JUCEHEADER__
  10903. /*** End of inlined file: juce_Button.h ***/
  10904. class ScrollBar;
  10905. class JUCE_API ScrollBarListener
  10906. {
  10907. public:
  10908. virtual ~ScrollBarListener() {}
  10909. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  10910. const double newRangeStart) = 0;
  10911. };
  10912. class JUCE_API ScrollBar : public Component,
  10913. public AsyncUpdater,
  10914. private Timer
  10915. {
  10916. public:
  10917. ScrollBar (const bool isVertical,
  10918. const bool buttonsAreVisible = true);
  10919. ~ScrollBar();
  10920. bool isVertical() const throw() { return vertical; }
  10921. void setOrientation (const bool shouldBeVertical) throw();
  10922. void setButtonVisibility (const bool buttonsAreVisible);
  10923. void setAutoHide (const bool shouldHideWhenFullRange);
  10924. void setRangeLimits (const double minimum,
  10925. const double maximum) throw();
  10926. double getMinimumRangeLimit() const throw() { return minimum; }
  10927. double getMaximumRangeLimit() const throw() { return maximum; }
  10928. void setCurrentRange (double newStart,
  10929. double newSize) throw();
  10930. void setCurrentRangeStart (double newStart) throw();
  10931. double getCurrentRangeStart() const throw() { return rangeStart; }
  10932. double getCurrentRangeSize() const throw() { return rangeSize; }
  10933. void setSingleStepSize (const double newSingleStepSize) throw();
  10934. void moveScrollbarInSteps (const int howManySteps) throw();
  10935. void moveScrollbarInPages (const int howManyPages) throw();
  10936. void scrollToTop() throw();
  10937. void scrollToBottom() throw();
  10938. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  10939. const int repeatDelayInMillisecs,
  10940. const int minimumDelayInMillisecs = -1) throw();
  10941. enum ColourIds
  10942. {
  10943. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  10944. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  10945. trackColourId = 0x1000401 /**< A base colour to use for the slot area of the bar. The look and feel will probably use variations on this colour. */
  10946. };
  10947. void addListener (ScrollBarListener* const listener) throw();
  10948. void removeListener (ScrollBarListener* const listener) throw();
  10949. bool keyPressed (const KeyPress& key);
  10950. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10951. void lookAndFeelChanged();
  10952. void handleAsyncUpdate();
  10953. void mouseDown (const MouseEvent& e);
  10954. void mouseDrag (const MouseEvent& e);
  10955. void mouseUp (const MouseEvent& e);
  10956. void paint (Graphics& g);
  10957. void resized();
  10958. juce_UseDebuggingNewOperator
  10959. private:
  10960. double minimum, maximum;
  10961. double rangeStart, rangeSize;
  10962. double singleStepSize, dragStartRange;
  10963. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  10964. int dragStartMousePos, lastMousePos;
  10965. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  10966. bool vertical, isDraggingThumb, alwaysVisible;
  10967. Button* upButton;
  10968. Button* downButton;
  10969. SortedSet <void*> listeners;
  10970. void updateThumbPosition() throw();
  10971. void timerCallback();
  10972. ScrollBar (const ScrollBar&);
  10973. ScrollBar& operator= (const ScrollBar&);
  10974. };
  10975. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  10976. /*** End of inlined file: juce_ScrollBar.h ***/
  10977. class JUCE_API Viewport : public Component,
  10978. private ComponentListener,
  10979. private ScrollBarListener
  10980. {
  10981. public:
  10982. Viewport (const String& componentName = String::empty);
  10983. ~Viewport();
  10984. void setViewedComponent (Component* const newViewedComponent);
  10985. Component* getViewedComponent() const throw() { return contentComp; }
  10986. void setViewPosition (const int xPixelsOffset,
  10987. const int yPixelsOffset);
  10988. void setViewPositionProportionately (const double proportionX,
  10989. const double proportionY);
  10990. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  10991. int getViewPositionX() const throw() { return lastVX; }
  10992. int getViewPositionY() const throw() { return lastVY; }
  10993. int getViewWidth() const throw() { return lastVW; }
  10994. int getViewHeight() const throw() { return lastVH; }
  10995. int getMaximumVisibleWidth() const throw();
  10996. int getMaximumVisibleHeight() const throw();
  10997. virtual void visibleAreaChanged (int visibleX, int visibleY,
  10998. int visibleW, int visibleH);
  10999. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11000. const bool showHorizontalScrollbarIfNeeded);
  11001. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11002. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11003. void setScrollBarThickness (const int thickness);
  11004. int getScrollBarThickness() const throw();
  11005. void setSingleStepSizes (const int stepX, const int stepY);
  11006. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11007. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11008. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11009. juce_UseDebuggingNewOperator
  11010. void resized();
  11011. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  11012. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11013. bool keyPressed (const KeyPress& key);
  11014. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11015. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11016. private:
  11017. Component* contentComp;
  11018. int lastVX, lastVY, lastVW, lastVH;
  11019. int scrollBarThickness;
  11020. int singleStepX, singleStepY;
  11021. bool showHScrollbar, showVScrollbar;
  11022. Component* contentHolder;
  11023. ScrollBar* verticalScrollBar;
  11024. ScrollBar* horizontalScrollBar;
  11025. void updateVisibleRegion();
  11026. Viewport (const Viewport&);
  11027. Viewport& operator= (const Viewport&);
  11028. };
  11029. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11030. /*** End of inlined file: juce_Viewport.h ***/
  11031. /*** Start of inlined file: juce_PopupMenu.h ***/
  11032. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11033. #define __JUCE_POPUPMENU_JUCEHEADER__
  11034. class PopupMenuCustomComponent;
  11035. class JUCE_API PopupMenu
  11036. {
  11037. public:
  11038. PopupMenu();
  11039. PopupMenu (const PopupMenu& other);
  11040. ~PopupMenu();
  11041. PopupMenu& operator= (const PopupMenu& other);
  11042. void clear();
  11043. void addItem (const int itemResultId,
  11044. const String& itemText,
  11045. const bool isActive = true,
  11046. const bool isTicked = false,
  11047. const Image* const iconToUse = 0);
  11048. void addCommandItem (ApplicationCommandManager* commandManager,
  11049. const int commandID,
  11050. const String& displayName = String::empty);
  11051. void addColouredItem (const int itemResultId,
  11052. const String& itemText,
  11053. const Colour& itemTextColour,
  11054. const bool isActive = true,
  11055. const bool isTicked = false,
  11056. const Image* const iconToUse = 0);
  11057. void addCustomItem (const int itemResultId,
  11058. PopupMenuCustomComponent* const customComponent);
  11059. void addCustomItem (const int itemResultId,
  11060. Component* customComponent,
  11061. int idealWidth, int idealHeight,
  11062. const bool triggerMenuItemAutomaticallyWhenClicked);
  11063. void addSubMenu (const String& subMenuName,
  11064. const PopupMenu& subMenu,
  11065. const bool isActive = true,
  11066. Image* const iconToUse = 0,
  11067. const bool isTicked = false);
  11068. void addSeparator();
  11069. void addSectionHeader (const String& title);
  11070. int getNumItems() const throw();
  11071. bool containsCommandItem (const int commandID) const;
  11072. bool containsAnyActiveItems() const throw();
  11073. int show (const int itemIdThatMustBeVisible = 0,
  11074. const int minimumWidth = 0,
  11075. const int maximumNumColumns = 0,
  11076. const int standardItemHeight = 0);
  11077. int showAt (const int screenX,
  11078. const int screenY,
  11079. const int itemIdThatMustBeVisible = 0,
  11080. const int minimumWidth = 0,
  11081. const int maximumNumColumns = 0,
  11082. const int standardItemHeight = 0);
  11083. int showAt (Component* componentToAttachTo,
  11084. const int itemIdThatMustBeVisible = 0,
  11085. const int minimumWidth = 0,
  11086. const int maximumNumColumns = 0,
  11087. const int standardItemHeight = 0);
  11088. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11089. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11090. enum ColourIds
  11091. {
  11092. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11093. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11094. colour is specified when the item is added). */
  11095. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11096. addSectionHeader() method). */
  11097. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11098. highlighted menu item. */
  11099. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11100. highlighted item. */
  11101. };
  11102. class JUCE_API MenuItemIterator
  11103. {
  11104. public:
  11105. MenuItemIterator (const PopupMenu& menu);
  11106. ~MenuItemIterator();
  11107. bool next();
  11108. String itemName;
  11109. const PopupMenu* subMenu;
  11110. int itemId;
  11111. bool isSeparator;
  11112. bool isTicked;
  11113. bool isEnabled;
  11114. bool isCustomComponent;
  11115. bool isSectionHeader;
  11116. const Colour* customColour;
  11117. const Image* customImage;
  11118. ApplicationCommandManager* commandManager;
  11119. juce_UseDebuggingNewOperator
  11120. private:
  11121. const PopupMenu& menu;
  11122. int index;
  11123. MenuItemIterator (const MenuItemIterator&);
  11124. MenuItemIterator& operator= (const MenuItemIterator&);
  11125. };
  11126. juce_UseDebuggingNewOperator
  11127. private:
  11128. class Item;
  11129. class ItemComponent;
  11130. class Window;
  11131. friend class MenuItemIterator;
  11132. friend class ItemComponent;
  11133. friend class Window;
  11134. friend class PopupMenuCustomComponent;
  11135. friend class OwnedArray <Item>;
  11136. friend class ScopedPointer <Window>;
  11137. OwnedArray <Item> items;
  11138. LookAndFeel* lookAndFeel;
  11139. bool separatorPending;
  11140. void addSeparatorIfPending();
  11141. int showMenu (const int x, const int y, const int w, const int h,
  11142. const int itemIdThatMustBeVisible,
  11143. const int minimumWidth,
  11144. const int maximumNumColumns,
  11145. const int standardItemHeight,
  11146. const bool alignToRectangle,
  11147. Component* const componentAttachedTo);
  11148. friend class MenuBarComponent;
  11149. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11150. const int itemIdThatMustBeVisible,
  11151. const int minimumWidth,
  11152. const int maximumNumColumns,
  11153. const int standardItemHeight,
  11154. const bool alignToRectangle,
  11155. Component* menuBarComponent,
  11156. ApplicationCommandManager** managerOfChosenCommand,
  11157. Component* const componentAttachedTo);
  11158. };
  11159. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11160. /*** End of inlined file: juce_PopupMenu.h ***/
  11161. /*** Start of inlined file: juce_TextInputTarget.h ***/
  11162. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11163. #define __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11164. class JUCE_API TextInputTarget
  11165. {
  11166. public:
  11167. TextInputTarget() {}
  11168. virtual ~TextInputTarget() {}
  11169. virtual const Range<int> getHighlightedRegion() const = 0;
  11170. virtual void setHighlightedRegion (const Range<int>& newRange) = 0;
  11171. virtual const String getTextInRange (const Range<int>& range) const = 0;
  11172. virtual void insertTextAtCaret (const String& textToInsert) = 0;
  11173. };
  11174. #endif // __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  11175. /*** End of inlined file: juce_TextInputTarget.h ***/
  11176. class TextEditor;
  11177. class TextHolderComponent;
  11178. class JUCE_API TextEditorListener
  11179. {
  11180. public:
  11181. virtual ~TextEditorListener() {}
  11182. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11183. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11184. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11185. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11186. };
  11187. class JUCE_API TextEditor : public Component,
  11188. public TextInputTarget,
  11189. public SettableTooltipClient
  11190. {
  11191. public:
  11192. TextEditor (const String& componentName = String::empty,
  11193. const tchar passwordCharacter = 0);
  11194. virtual ~TextEditor();
  11195. void setMultiLine (const bool shouldBeMultiLine,
  11196. const bool shouldWordWrap = true);
  11197. bool isMultiLine() const;
  11198. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11199. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11200. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11201. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11202. void setReadOnly (const bool shouldBeReadOnly);
  11203. bool isReadOnly() const;
  11204. void setCaretVisible (const bool shouldBeVisible);
  11205. bool isCaretVisible() const { return caretVisible; }
  11206. void setScrollbarsShown (bool shouldBeEnabled);
  11207. bool areScrollbarsShown() const { return scrollbarVisible; }
  11208. void setPasswordCharacter (const tchar passwordCharacter);
  11209. tchar getPasswordCharacter() const { return passwordCharacter; }
  11210. void setPopupMenuEnabled (const bool menuEnabled);
  11211. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11212. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11213. enum ColourIds
  11214. {
  11215. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11216. transparent if necessary. */
  11217. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11218. that because the editor can contain multiple colours, calling this
  11219. method won't change the colour of existing text - to do that, call
  11220. applyFontToAllText() after calling this method.*/
  11221. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11222. the text - this can be transparent if you don't want to show any
  11223. highlighting.*/
  11224. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11225. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11226. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11227. the edge of the component. */
  11228. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11229. the edge of the component when it has focus. */
  11230. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11231. around the edge of the editor. */
  11232. };
  11233. void setFont (const Font& newFont);
  11234. void applyFontToAllText (const Font& newFont);
  11235. const Font getFont() const;
  11236. void setSelectAllWhenFocused (const bool b);
  11237. void setInputRestrictions (const int maxTextLength,
  11238. const String& allowedCharacters = String::empty);
  11239. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11240. void setScrollBarThickness (const int newThicknessPixels);
  11241. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11242. void addListener (TextEditorListener* const newListener);
  11243. void removeListener (TextEditorListener* const listenerToRemove);
  11244. const String getText() const;
  11245. const String getTextInRange (const Range<int>& textRange) const;
  11246. bool isEmpty() const;
  11247. void setText (const String& newText,
  11248. const bool sendTextChangeMessage = true);
  11249. Value& getTextValue();
  11250. void insertTextAtCaret (const String& textToInsert);
  11251. void clear();
  11252. void cut();
  11253. void copy();
  11254. void paste();
  11255. void setCaretPosition (const int newIndex);
  11256. int getCaretPosition() const;
  11257. void scrollEditorToPositionCaret (const int desiredCaretX,
  11258. const int desiredCaretY);
  11259. const Rectangle<int> getCaretRectangle();
  11260. void setHighlightedRegion (const Range<int>& newSelection);
  11261. const Range<int> getHighlightedRegion() const { return selection; }
  11262. const String getHighlightedText() const;
  11263. int getTextIndexAt (const int x, const int y);
  11264. int getTotalNumChars() const;
  11265. int getTextWidth() const;
  11266. int getTextHeight() const;
  11267. void setIndents (const int newLeftIndent, const int newTopIndent);
  11268. void setBorder (const BorderSize& border);
  11269. const BorderSize getBorder() const;
  11270. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11271. void paint (Graphics& g);
  11272. void paintOverChildren (Graphics& g);
  11273. void mouseDown (const MouseEvent& e);
  11274. void mouseUp (const MouseEvent& e);
  11275. void mouseDrag (const MouseEvent& e);
  11276. void mouseDoubleClick (const MouseEvent& e);
  11277. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11278. bool keyPressed (const KeyPress& key);
  11279. bool keyStateChanged (const bool isKeyDown);
  11280. void focusGained (FocusChangeType cause);
  11281. void focusLost (FocusChangeType cause);
  11282. void resized();
  11283. void enablementChanged();
  11284. void colourChanged();
  11285. juce_UseDebuggingNewOperator
  11286. protected:
  11287. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11288. const MouseEvent* mouseClickEvent);
  11289. virtual void performPopupMenuAction (const int menuItemID);
  11290. void scrollToMakeSureCursorIsVisible();
  11291. void moveCaret (int newCaretPos);
  11292. void moveCursorTo (const int newPosition, const bool isSelecting);
  11293. void textChanged();
  11294. void newTransaction();
  11295. void doUndoRedo (const bool isRedo);
  11296. virtual void returnPressed();
  11297. virtual void escapePressed();
  11298. void handleCommandMessage (int commandId);
  11299. private:
  11300. ScopedPointer <Viewport> viewport;
  11301. TextHolderComponent* textHolder;
  11302. BorderSize borderSize;
  11303. bool readOnly : 1;
  11304. bool multiline : 1;
  11305. bool wordWrap : 1;
  11306. bool returnKeyStartsNewLine : 1;
  11307. bool caretVisible : 1;
  11308. bool popupMenuEnabled : 1;
  11309. bool selectAllTextWhenFocused : 1;
  11310. bool scrollbarVisible : 1;
  11311. bool wasFocused : 1;
  11312. bool caretFlashState : 1;
  11313. bool keepCursorOnScreen : 1;
  11314. bool tabKeyUsed : 1;
  11315. bool menuActive : 1;
  11316. bool valueTextNeedsUpdating : 1;
  11317. UndoManager undoManager;
  11318. float cursorX, cursorY, cursorHeight;
  11319. int maxTextLength;
  11320. Range<int> selection;
  11321. int leftIndent, topIndent;
  11322. unsigned int lastTransactionTime;
  11323. Font currentFont;
  11324. mutable int totalNumChars;
  11325. int caretPosition;
  11326. VoidArray sections;
  11327. String textToShowWhenEmpty;
  11328. Colour colourForTextWhenEmpty;
  11329. tchar passwordCharacter;
  11330. Value textValue;
  11331. enum
  11332. {
  11333. notDragging,
  11334. draggingSelectionStart,
  11335. draggingSelectionEnd
  11336. } dragType;
  11337. String allowedCharacters;
  11338. SortedSet <void*> listeners;
  11339. friend class TextEditorInsertAction;
  11340. friend class TextEditorRemoveAction;
  11341. void coalesceSimilarSections();
  11342. void splitSection (const int sectionIndex, const int charToSplitAt);
  11343. void clearInternal (UndoManager* const um);
  11344. void insert (const String& text,
  11345. const int insertIndex,
  11346. const Font& font,
  11347. const Colour& colour,
  11348. UndoManager* const um,
  11349. const int caretPositionToMoveTo);
  11350. void reinsert (const int insertIndex,
  11351. const VoidArray& sections);
  11352. void remove (const Range<int>& range,
  11353. UndoManager* const um,
  11354. const int caretPositionToMoveTo);
  11355. void getCharPosition (const int index,
  11356. float& x, float& y,
  11357. float& lineHeight) const;
  11358. void updateCaretPosition();
  11359. void textWasChangedByValue();
  11360. int indexAtPosition (const float x,
  11361. const float y);
  11362. int findWordBreakAfter (const int position) const;
  11363. int findWordBreakBefore (const int position) const;
  11364. friend class TextHolderComponent;
  11365. friend class TextEditorViewport;
  11366. void drawContent (Graphics& g);
  11367. void updateTextHolderSize();
  11368. float getWordWrapWidth() const;
  11369. void timerCallbackInt();
  11370. void repaintCaret();
  11371. void repaintText (const Range<int>& range);
  11372. UndoManager* getUndoManager() throw();
  11373. TextEditor (const TextEditor&);
  11374. TextEditor& operator= (const TextEditor&);
  11375. };
  11376. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11377. /*** End of inlined file: juce_TextEditor.h ***/
  11378. class Label;
  11379. class JUCE_API LabelListener
  11380. {
  11381. public:
  11382. virtual ~LabelListener() {}
  11383. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11384. };
  11385. class JUCE_API Label : public Component,
  11386. public SettableTooltipClient,
  11387. protected TextEditorListener,
  11388. private ComponentListener,
  11389. private Value::Listener
  11390. {
  11391. public:
  11392. Label (const String& componentName,
  11393. const String& labelText);
  11394. ~Label();
  11395. void setText (const String& newText,
  11396. const bool broadcastChangeMessage);
  11397. const String getText (const bool returnActiveEditorContents = false) const throw();
  11398. Value& getTextValue() { return textValue; }
  11399. void setFont (const Font& newFont) throw();
  11400. const Font& getFont() const throw();
  11401. enum ColourIds
  11402. {
  11403. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11404. textColourId = 0x1000281, /**< The colour for the text. */
  11405. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11406. Leave this transparent to not have an outline. */
  11407. };
  11408. void setJustificationType (const Justification& justification) throw();
  11409. const Justification getJustificationType() const throw() { return justification; }
  11410. void setBorderSize (int horizontalBorder, int verticalBorder);
  11411. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11412. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11413. void attachToComponent (Component* owner,
  11414. const bool onLeft);
  11415. Component* getAttachedComponent() const;
  11416. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11417. void setMinimumHorizontalScale (const float newScale);
  11418. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11419. void addListener (LabelListener* const listener) throw();
  11420. void removeListener (LabelListener* const listener) throw();
  11421. void setEditable (const bool editOnSingleClick,
  11422. const bool editOnDoubleClick = false,
  11423. const bool lossOfFocusDiscardsChanges = false) throw();
  11424. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11425. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11426. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11427. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11428. void showEditor();
  11429. void hideEditor (const bool discardCurrentEditorContents);
  11430. bool isBeingEdited() const throw();
  11431. juce_UseDebuggingNewOperator
  11432. protected:
  11433. virtual TextEditor* createEditorComponent();
  11434. virtual void textWasEdited();
  11435. virtual void textWasChanged();
  11436. virtual void editorShown (TextEditor* editorComponent);
  11437. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11438. void paint (Graphics& g);
  11439. void resized();
  11440. void mouseUp (const MouseEvent& e);
  11441. void mouseDoubleClick (const MouseEvent& e);
  11442. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11443. void componentParentHierarchyChanged (Component& component);
  11444. void componentVisibilityChanged (Component& component);
  11445. void inputAttemptWhenModal();
  11446. void focusGained (FocusChangeType);
  11447. void enablementChanged();
  11448. KeyboardFocusTraverser* createFocusTraverser();
  11449. void textEditorTextChanged (TextEditor& editor);
  11450. void textEditorReturnKeyPressed (TextEditor& editor);
  11451. void textEditorEscapeKeyPressed (TextEditor& editor);
  11452. void textEditorFocusLost (TextEditor& editor);
  11453. void colourChanged();
  11454. void valueChanged (Value&);
  11455. private:
  11456. Value textValue;
  11457. String lastTextValue;
  11458. Font font;
  11459. Justification justification;
  11460. ScopedPointer <TextEditor> editor;
  11461. SortedSet <void*> listeners;
  11462. Component::SafePointer<Component> ownerComponent;
  11463. int horizontalBorderSize, verticalBorderSize;
  11464. float minimumHorizontalScale;
  11465. bool editSingleClick : 1;
  11466. bool editDoubleClick : 1;
  11467. bool lossOfFocusDiscardsChanges : 1;
  11468. bool leftOfOwnerComp : 1;
  11469. bool updateFromTextEditorContents();
  11470. void callChangeListeners();
  11471. Label (const Label&);
  11472. Label& operator= (const Label&);
  11473. };
  11474. #endif // __JUCE_LABEL_JUCEHEADER__
  11475. /*** End of inlined file: juce_Label.h ***/
  11476. class ComboBox;
  11477. class JUCE_API ComboBoxListener
  11478. {
  11479. public:
  11480. virtual ~ComboBoxListener() {}
  11481. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11482. };
  11483. class JUCE_API ComboBox : public Component,
  11484. public SettableTooltipClient,
  11485. private LabelListener,
  11486. private AsyncUpdater,
  11487. private Value::Listener
  11488. {
  11489. public:
  11490. ComboBox (const String& componentName);
  11491. ~ComboBox();
  11492. void setEditableText (const bool isEditable);
  11493. bool isTextEditable() const throw();
  11494. void setJustificationType (const Justification& justification) throw();
  11495. const Justification getJustificationType() const throw();
  11496. void addItem (const String& newItemText,
  11497. const int newItemId) throw();
  11498. void addSeparator() throw();
  11499. void addSectionHeading (const String& headingName) throw();
  11500. void setItemEnabled (const int itemId,
  11501. const bool shouldBeEnabled) throw();
  11502. void changeItemText (const int itemId,
  11503. const String& newText) throw();
  11504. void clear (const bool dontSendChangeMessage = false);
  11505. int getNumItems() const throw();
  11506. const String getItemText (const int index) const throw();
  11507. int getItemId (const int index) const throw();
  11508. int indexOfItemId (const int itemId) const throw();
  11509. int getSelectedId() const throw();
  11510. Value& getSelectedIdAsValue() throw() { return currentId; }
  11511. void setSelectedId (const int newItemId,
  11512. const bool dontSendChangeMessage = false) throw();
  11513. int getSelectedItemIndex() const throw();
  11514. void setSelectedItemIndex (const int newItemIndex,
  11515. const bool dontSendChangeMessage = false) throw();
  11516. const String getText() const throw();
  11517. void setText (const String& newText,
  11518. const bool dontSendChangeMessage = false) throw();
  11519. void showEditor();
  11520. void addListener (ComboBoxListener* const listener) throw();
  11521. void removeListener (ComboBoxListener* const listener) throw();
  11522. void setTextWhenNothingSelected (const String& newMessage) throw();
  11523. const String getTextWhenNothingSelected() const throw();
  11524. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11525. const String getTextWhenNoChoicesAvailable() const throw();
  11526. void setTooltip (const String& newTooltip);
  11527. enum ColourIds
  11528. {
  11529. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11530. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11531. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11532. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11533. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11534. };
  11535. void labelTextChanged (Label*);
  11536. void enablementChanged();
  11537. void colourChanged();
  11538. void focusGained (Component::FocusChangeType cause);
  11539. void focusLost (Component::FocusChangeType cause);
  11540. void handleAsyncUpdate();
  11541. const String getTooltip() { return label->getTooltip(); }
  11542. void mouseDown (const MouseEvent&);
  11543. void mouseDrag (const MouseEvent&);
  11544. void mouseUp (const MouseEvent&);
  11545. void lookAndFeelChanged();
  11546. void paint (Graphics&);
  11547. void resized();
  11548. bool keyStateChanged (const bool isKeyDown);
  11549. bool keyPressed (const KeyPress&);
  11550. void valueChanged (Value&);
  11551. juce_UseDebuggingNewOperator
  11552. private:
  11553. struct ItemInfo
  11554. {
  11555. String name;
  11556. int itemId;
  11557. bool isEnabled : 1, isHeading : 1;
  11558. bool isSeparator() const throw();
  11559. bool isRealItem() const throw();
  11560. };
  11561. OwnedArray <ItemInfo> items;
  11562. Value currentId;
  11563. int lastCurrentId;
  11564. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11565. SortedSet <void*> listeners;
  11566. ScopedPointer<Label> label;
  11567. String textWhenNothingSelected, noChoicesMessage;
  11568. void showPopup();
  11569. ItemInfo* getItemForId (const int itemId) const throw();
  11570. ItemInfo* getItemForIndex (const int index) const throw();
  11571. ComboBox (const ComboBox&);
  11572. ComboBox& operator= (const ComboBox&);
  11573. };
  11574. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11575. /*** End of inlined file: juce_ComboBox.h ***/
  11576. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11577. {
  11578. public:
  11579. AudioDeviceManager();
  11580. ~AudioDeviceManager();
  11581. struct JUCE_API AudioDeviceSetup
  11582. {
  11583. AudioDeviceSetup();
  11584. bool operator== (const AudioDeviceSetup& other) const;
  11585. String outputDeviceName;
  11586. String inputDeviceName;
  11587. double sampleRate;
  11588. int bufferSize;
  11589. BitArray inputChannels;
  11590. bool useDefaultInputChannels;
  11591. BitArray outputChannels;
  11592. bool useDefaultOutputChannels;
  11593. };
  11594. const String initialise (const int numInputChannelsNeeded,
  11595. const int numOutputChannelsNeeded,
  11596. const XmlElement* const savedState,
  11597. const bool selectDefaultDeviceOnFailure,
  11598. const String& preferredDefaultDeviceName = String::empty,
  11599. const AudioDeviceSetup* preferredSetupOptions = 0);
  11600. XmlElement* createStateXml() const;
  11601. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11602. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11603. const bool treatAsChosenDevice);
  11604. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11605. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11606. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11607. void setCurrentAudioDeviceType (const String& type,
  11608. const bool treatAsChosenDevice);
  11609. void closeAudioDevice();
  11610. void restartLastAudioDevice();
  11611. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11612. void removeAudioCallback (AudioIODeviceCallback* callback);
  11613. double getCpuUsage() const;
  11614. void setMidiInputEnabled (const String& midiInputDeviceName,
  11615. const bool enabled);
  11616. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11617. void addMidiInputCallback (const String& midiInputDeviceName,
  11618. MidiInputCallback* callback);
  11619. void removeMidiInputCallback (const String& midiInputDeviceName,
  11620. MidiInputCallback* callback);
  11621. void setDefaultMidiOutput (const String& deviceName);
  11622. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11623. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11624. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11625. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11626. void playTestSound();
  11627. void enableInputLevelMeasurement (const bool enableMeasurement);
  11628. double getCurrentInputLevel() const;
  11629. juce_UseDebuggingNewOperator
  11630. private:
  11631. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11632. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11633. AudioDeviceSetup currentSetup;
  11634. ScopedPointer <AudioIODevice> currentAudioDevice;
  11635. SortedSet <AudioIODeviceCallback*> callbacks;
  11636. int numInputChansNeeded, numOutputChansNeeded;
  11637. String currentDeviceType;
  11638. BitArray inputChannels, outputChannels;
  11639. ScopedPointer <XmlElement> lastExplicitSettings;
  11640. mutable bool listNeedsScanning;
  11641. bool useInputNames;
  11642. int inputLevelMeasurementEnabledCount;
  11643. double inputLevel;
  11644. ScopedPointer <AudioSampleBuffer> testSound;
  11645. int testSoundPosition;
  11646. AudioSampleBuffer tempBuffer;
  11647. StringArray midiInsFromXml;
  11648. OwnedArray <MidiInput> enabledMidiInputs;
  11649. Array <MidiInputCallback*> midiCallbacks;
  11650. Array <MidiInput*> midiCallbackDevices;
  11651. String defaultMidiOutputName;
  11652. ScopedPointer <MidiOutput> defaultMidiOutput;
  11653. CriticalSection audioCallbackLock, midiCallbackLock;
  11654. double cpuUsageMs, timeToCpuScale;
  11655. class CallbackHandler : public AudioIODeviceCallback,
  11656. public MidiInputCallback
  11657. {
  11658. public:
  11659. AudioDeviceManager* owner;
  11660. void audioDeviceIOCallback (const float** inputChannelData,
  11661. int totalNumInputChannels,
  11662. float** outputChannelData,
  11663. int totalNumOutputChannels,
  11664. int numSamples);
  11665. void audioDeviceAboutToStart (AudioIODevice*);
  11666. void audioDeviceStopped();
  11667. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11668. };
  11669. CallbackHandler callbackHandler;
  11670. friend class CallbackHandler;
  11671. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11672. int totalNumInputChannels,
  11673. float** outputChannelData,
  11674. int totalNumOutputChannels,
  11675. int numSamples);
  11676. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11677. void audioDeviceStoppedInt();
  11678. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11679. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11680. const BitArray& ins, const BitArray& outs);
  11681. void stopDevice();
  11682. void updateXml();
  11683. void createDeviceTypesIfNeeded();
  11684. void scanDevicesIfNeeded();
  11685. void deleteCurrentDevice();
  11686. double chooseBestSampleRate (double preferred) const;
  11687. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11688. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11689. AudioDeviceManager (const AudioDeviceManager&);
  11690. AudioDeviceManager& operator= (const AudioDeviceManager&);
  11691. };
  11692. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11693. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11694. #endif
  11695. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11696. #endif
  11697. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11698. #endif
  11699. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11700. #endif
  11701. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11702. #endif
  11703. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11704. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11705. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11706. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11707. class JUCE_API AudioDataConverters
  11708. {
  11709. public:
  11710. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11711. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11712. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11713. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11714. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11715. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11716. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11717. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11718. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11719. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11720. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11721. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11722. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11723. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11724. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11725. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11726. enum DataFormat
  11727. {
  11728. int16LE,
  11729. int16BE,
  11730. int24LE,
  11731. int24BE,
  11732. int32LE,
  11733. int32BE,
  11734. float32LE,
  11735. float32BE,
  11736. };
  11737. static void convertFloatToFormat (const DataFormat destFormat,
  11738. const float* source, void* dest, int numSamples);
  11739. static void convertFormatToFloat (const DataFormat sourceFormat,
  11740. const void* source, float* dest, int numSamples);
  11741. static void interleaveSamples (const float** source, float* dest,
  11742. const int numSamples, const int numChannels);
  11743. static void deinterleaveSamples (const float* source, float** dest,
  11744. const int numSamples, const int numChannels);
  11745. };
  11746. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11747. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11748. #endif
  11749. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11750. #endif
  11751. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11752. #endif
  11753. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11754. #endif
  11755. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11756. /*** Start of inlined file: juce_MidiFile.h ***/
  11757. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11758. #define __JUCE_MIDIFILE_JUCEHEADER__
  11759. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11760. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11761. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11762. class JUCE_API MidiMessageSequence
  11763. {
  11764. public:
  11765. MidiMessageSequence();
  11766. MidiMessageSequence (const MidiMessageSequence& other);
  11767. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11768. ~MidiMessageSequence();
  11769. class MidiEventHolder
  11770. {
  11771. public:
  11772. ~MidiEventHolder();
  11773. MidiMessage message;
  11774. MidiEventHolder* noteOffObject;
  11775. juce_UseDebuggingNewOperator
  11776. private:
  11777. friend class MidiMessageSequence;
  11778. MidiEventHolder (const MidiMessage& message);
  11779. };
  11780. void clear();
  11781. int getNumEvents() const;
  11782. MidiEventHolder* getEventPointer (const int index) const;
  11783. double getTimeOfMatchingKeyUp (const int index) const;
  11784. int getIndexOfMatchingKeyUp (const int index) const;
  11785. int getIndexOf (MidiEventHolder* const event) const;
  11786. int getNextIndexAtTime (const double timeStamp) const;
  11787. double getStartTime() const;
  11788. double getEndTime() const;
  11789. double getEventTime (const int index) const;
  11790. void addEvent (const MidiMessage& newMessage,
  11791. double timeAdjustment = 0);
  11792. void deleteEvent (const int index,
  11793. const bool deleteMatchingNoteUp);
  11794. void addSequence (const MidiMessageSequence& other,
  11795. double timeAdjustmentDelta,
  11796. double firstAllowableDestTime,
  11797. double endOfAllowableDestTimes);
  11798. void updateMatchedPairs();
  11799. void extractMidiChannelMessages (const int channelNumberToExtract,
  11800. MidiMessageSequence& destSequence,
  11801. const bool alsoIncludeMetaEvents) const;
  11802. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11803. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11804. void deleteSysExMessages();
  11805. void addTimeToMessages (const double deltaTime);
  11806. void createControllerUpdatesForTime (const int channelNumber,
  11807. const double time,
  11808. OwnedArray<MidiMessage>& resultMessages);
  11809. void swapWith (MidiMessageSequence& other) throw();
  11810. juce_UseDebuggingNewOperator
  11811. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11812. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11813. private:
  11814. friend class MidiFile;
  11815. OwnedArray <MidiEventHolder> list;
  11816. void sort();
  11817. };
  11818. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11819. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  11820. class JUCE_API MidiFile
  11821. {
  11822. public:
  11823. MidiFile() throw();
  11824. ~MidiFile() throw();
  11825. int getNumTracks() const throw();
  11826. const MidiMessageSequence* getTrack (const int index) const throw();
  11827. void addTrack (const MidiMessageSequence& trackSequence) throw();
  11828. void clear() throw();
  11829. short getTimeFormat() const throw();
  11830. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  11831. void setSmpteTimeFormat (const int framesPerSecond,
  11832. const int subframeResolution) throw();
  11833. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  11834. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  11835. double getLastTimestamp() const;
  11836. bool readFrom (InputStream& sourceStream);
  11837. bool writeTo (OutputStream& destStream);
  11838. void convertTimestampTicksToSeconds();
  11839. juce_UseDebuggingNewOperator
  11840. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11841. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11842. private:
  11843. OwnedArray <MidiMessageSequence> tracks;
  11844. short timeFormat;
  11845. MidiFile (const MidiFile&);
  11846. MidiFile& operator= (const MidiFile&);
  11847. void readNextTrack (const char* data, int size);
  11848. void writeTrack (OutputStream& mainOut, const int trackNum);
  11849. };
  11850. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  11851. /*** End of inlined file: juce_MidiFile.h ***/
  11852. #endif
  11853. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11854. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  11855. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11856. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11857. class MidiKeyboardState;
  11858. class JUCE_API MidiKeyboardStateListener
  11859. {
  11860. public:
  11861. MidiKeyboardStateListener() throw() {}
  11862. virtual ~MidiKeyboardStateListener() {}
  11863. virtual void handleNoteOn (MidiKeyboardState* source,
  11864. int midiChannel, int midiNoteNumber, float velocity) = 0;
  11865. virtual void handleNoteOff (MidiKeyboardState* source,
  11866. int midiChannel, int midiNoteNumber) = 0;
  11867. };
  11868. class JUCE_API MidiKeyboardState
  11869. {
  11870. public:
  11871. MidiKeyboardState();
  11872. ~MidiKeyboardState();
  11873. void reset();
  11874. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  11875. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  11876. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  11877. void noteOff (const int midiChannel, const int midiNoteNumber);
  11878. void allNotesOff (const int midiChannel);
  11879. void processNextMidiEvent (const MidiMessage& message);
  11880. void processNextMidiBuffer (MidiBuffer& buffer,
  11881. const int startSample,
  11882. const int numSamples,
  11883. const bool injectIndirectEvents);
  11884. void addListener (MidiKeyboardStateListener* const listener) throw();
  11885. void removeListener (MidiKeyboardStateListener* const listener) throw();
  11886. juce_UseDebuggingNewOperator
  11887. private:
  11888. CriticalSection lock;
  11889. uint16 noteStates [128];
  11890. MidiBuffer eventsToAdd;
  11891. VoidArray listeners;
  11892. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  11893. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  11894. MidiKeyboardState (const MidiKeyboardState&);
  11895. MidiKeyboardState& operator= (const MidiKeyboardState&);
  11896. };
  11897. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11898. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  11899. #endif
  11900. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  11901. #endif
  11902. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11903. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  11904. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11905. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11906. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  11907. public MidiInputCallback
  11908. {
  11909. public:
  11910. MidiMessageCollector();
  11911. ~MidiMessageCollector();
  11912. void reset (const double sampleRate);
  11913. void addMessageToQueue (const MidiMessage& message);
  11914. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  11915. const int numSamples);
  11916. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  11917. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  11918. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11919. juce_UseDebuggingNewOperator
  11920. private:
  11921. double lastCallbackTime;
  11922. CriticalSection midiCallbackLock;
  11923. MidiBuffer incomingMessages;
  11924. double sampleRate;
  11925. MidiMessageCollector (const MidiMessageCollector&);
  11926. MidiMessageCollector& operator= (const MidiMessageCollector&);
  11927. };
  11928. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11929. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  11930. #endif
  11931. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11932. #endif
  11933. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11934. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  11935. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11936. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11937. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  11938. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11939. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11940. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  11941. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11942. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11943. /*** Start of inlined file: juce_AudioProcessor.h ***/
  11944. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11945. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11946. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  11947. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11948. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11949. class AudioProcessor;
  11950. class JUCE_API AudioProcessorEditor : public Component
  11951. {
  11952. protected:
  11953. AudioProcessorEditor (AudioProcessor* const owner);
  11954. public:
  11955. ~AudioProcessorEditor();
  11956. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  11957. private:
  11958. AudioProcessor* const owner;
  11959. };
  11960. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11961. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  11962. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  11963. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11964. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11965. class AudioProcessor;
  11966. class JUCE_API AudioProcessorListener
  11967. {
  11968. public:
  11969. virtual ~AudioProcessorListener() {}
  11970. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  11971. int parameterIndex,
  11972. float newValue) = 0;
  11973. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  11974. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  11975. int parameterIndex);
  11976. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  11977. int parameterIndex);
  11978. };
  11979. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11980. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  11981. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  11982. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11983. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11984. class JUCE_API AudioPlayHead
  11985. {
  11986. protected:
  11987. AudioPlayHead() {}
  11988. public:
  11989. virtual ~AudioPlayHead() {}
  11990. enum FrameRateType
  11991. {
  11992. fps24 = 0,
  11993. fps25 = 1,
  11994. fps2997 = 2,
  11995. fps30 = 3,
  11996. fps2997drop = 4,
  11997. fps30drop = 5,
  11998. fpsUnknown = 99
  11999. };
  12000. struct CurrentPositionInfo
  12001. {
  12002. double bpm;
  12003. int timeSigNumerator;
  12004. int timeSigDenominator;
  12005. double timeInSeconds;
  12006. double editOriginTime;
  12007. double ppqPosition;
  12008. double ppqPositionOfLastBarStart;
  12009. FrameRateType frameRate;
  12010. bool isPlaying;
  12011. bool isRecording;
  12012. };
  12013. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12014. };
  12015. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12016. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12017. class JUCE_API AudioProcessor
  12018. {
  12019. protected:
  12020. AudioProcessor();
  12021. public:
  12022. virtual ~AudioProcessor();
  12023. virtual const String getName() const = 0;
  12024. virtual void prepareToPlay (double sampleRate,
  12025. int estimatedSamplesPerBlock) = 0;
  12026. virtual void releaseResources() = 0;
  12027. virtual void processBlock (AudioSampleBuffer& buffer,
  12028. MidiBuffer& midiMessages) = 0;
  12029. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12030. double getSampleRate() const throw() { return sampleRate; }
  12031. int getBlockSize() const throw() { return blockSize; }
  12032. int getNumInputChannels() const throw() { return numInputChannels; }
  12033. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12034. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12035. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12036. virtual bool isInputChannelStereoPair (int index) const = 0;
  12037. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12038. int getLatencySamples() const throw() { return latencySamples; }
  12039. void setLatencySamples (const int newLatency);
  12040. virtual bool acceptsMidi() const = 0;
  12041. virtual bool producesMidi() const = 0;
  12042. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12043. void suspendProcessing (const bool shouldBeSuspended);
  12044. bool isSuspended() const throw() { return suspended; }
  12045. virtual void reset();
  12046. bool isNonRealtime() const throw() { return nonRealtime; }
  12047. void setNonRealtime (const bool isNonRealtime) throw();
  12048. virtual AudioProcessorEditor* createEditor() = 0;
  12049. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12050. AudioProcessorEditor* createEditorIfNeeded();
  12051. virtual int getNumParameters() = 0;
  12052. virtual const String getParameterName (int parameterIndex) = 0;
  12053. virtual float getParameter (int parameterIndex) = 0;
  12054. virtual const String getParameterText (int parameterIndex) = 0;
  12055. virtual void setParameter (int parameterIndex,
  12056. float newValue) = 0;
  12057. void setParameterNotifyingHost (int parameterIndex,
  12058. float newValue);
  12059. virtual bool isParameterAutomatable (int parameterIndex) const;
  12060. virtual bool isMetaParameter (int parameterIndex) const;
  12061. void beginParameterChangeGesture (int parameterIndex);
  12062. void endParameterChangeGesture (int parameterIndex);
  12063. void updateHostDisplay();
  12064. virtual int getNumPrograms() = 0;
  12065. virtual int getCurrentProgram() = 0;
  12066. virtual void setCurrentProgram (int index) = 0;
  12067. virtual const String getProgramName (int index) = 0;
  12068. virtual void changeProgramName (int index, const String& newName) = 0;
  12069. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12070. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12071. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12072. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12073. void addListener (AudioProcessorListener* const newListener) throw();
  12074. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12075. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12076. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12077. void setPlayConfigDetails (const int numIns, const int numOuts,
  12078. const double sampleRate,
  12079. const int blockSize) throw();
  12080. juce_UseDebuggingNewOperator
  12081. protected:
  12082. static void copyXmlToBinary (const XmlElement& xml,
  12083. JUCE_NAMESPACE::MemoryBlock& destData);
  12084. static XmlElement* getXmlFromBinary (const void* data,
  12085. const int sizeInBytes);
  12086. AudioPlayHead* playHead;
  12087. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12088. private:
  12089. VoidArray listeners;
  12090. AudioProcessorEditor* activeEditor;
  12091. double sampleRate;
  12092. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12093. bool suspended, nonRealtime;
  12094. CriticalSection callbackLock, listenerLock;
  12095. #ifdef JUCE_DEBUG
  12096. BitArray changingParams;
  12097. #endif
  12098. AudioProcessor (const AudioProcessor&);
  12099. AudioProcessor& operator= (const AudioProcessor&);
  12100. };
  12101. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12102. /*** End of inlined file: juce_AudioProcessor.h ***/
  12103. /*** Start of inlined file: juce_PluginDescription.h ***/
  12104. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12105. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12106. class JUCE_API PluginDescription
  12107. {
  12108. public:
  12109. PluginDescription() throw();
  12110. PluginDescription (const PluginDescription& other) throw();
  12111. PluginDescription& operator= (const PluginDescription& other) throw();
  12112. ~PluginDescription() throw();
  12113. String name;
  12114. String pluginFormatName;
  12115. String category;
  12116. String manufacturerName;
  12117. String version;
  12118. String fileOrIdentifier;
  12119. Time lastFileModTime;
  12120. int uid;
  12121. bool isInstrument;
  12122. int numInputChannels;
  12123. int numOutputChannels;
  12124. bool isDuplicateOf (const PluginDescription& other) const;
  12125. const String createIdentifierString() const throw();
  12126. XmlElement* createXml() const;
  12127. bool loadFromXml (const XmlElement& xml);
  12128. juce_UseDebuggingNewOperator
  12129. };
  12130. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12131. /*** End of inlined file: juce_PluginDescription.h ***/
  12132. class JUCE_API AudioPluginInstance : public AudioProcessor
  12133. {
  12134. public:
  12135. virtual ~AudioPluginInstance();
  12136. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12137. juce_UseDebuggingNewOperator
  12138. protected:
  12139. AudioPluginInstance();
  12140. AudioPluginInstance (const AudioPluginInstance&);
  12141. AudioPluginInstance& operator= (const AudioPluginInstance&);
  12142. };
  12143. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12144. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12145. class PluginDescription;
  12146. class JUCE_API AudioPluginFormat
  12147. {
  12148. public:
  12149. virtual ~AudioPluginFormat();
  12150. virtual const String getName() const = 0;
  12151. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12152. const String& fileOrIdentifier) = 0;
  12153. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12154. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12155. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12156. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12157. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12158. const bool recursive) = 0;
  12159. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12160. juce_UseDebuggingNewOperator
  12161. protected:
  12162. AudioPluginFormat() throw();
  12163. AudioPluginFormat (const AudioPluginFormat&);
  12164. AudioPluginFormat& operator= (const AudioPluginFormat&);
  12165. };
  12166. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12167. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12168. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12169. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12170. {
  12171. public:
  12172. AudioUnitPluginFormat();
  12173. ~AudioUnitPluginFormat();
  12174. const String getName() const { return "AudioUnit"; }
  12175. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12176. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12177. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12178. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12179. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12180. bool doesPluginStillExist (const PluginDescription& desc);
  12181. const FileSearchPath getDefaultLocationsToSearch();
  12182. juce_UseDebuggingNewOperator
  12183. private:
  12184. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12185. AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12186. };
  12187. #endif
  12188. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12189. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12190. #endif
  12191. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12192. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12193. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12194. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12195. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12196. // Sorry, this file is just a placeholder at the moment!...
  12197. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12198. {
  12199. public:
  12200. DirectXPluginFormat();
  12201. ~DirectXPluginFormat();
  12202. const String getName() const { return "DirectX"; }
  12203. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12204. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12205. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12206. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12207. const FileSearchPath getDefaultLocationsToSearch();
  12208. juce_UseDebuggingNewOperator
  12209. private:
  12210. DirectXPluginFormat (const DirectXPluginFormat&);
  12211. DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12212. };
  12213. #endif
  12214. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12215. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12216. #endif
  12217. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12218. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12219. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12220. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12221. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12222. // Sorry, this file is just a placeholder at the moment!...
  12223. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12224. {
  12225. public:
  12226. LADSPAPluginFormat();
  12227. ~LADSPAPluginFormat();
  12228. const String getName() const { return "LADSPA"; }
  12229. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12230. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12231. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12232. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12233. const FileSearchPath getDefaultLocationsToSearch();
  12234. juce_UseDebuggingNewOperator
  12235. private:
  12236. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12237. LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12238. };
  12239. #endif
  12240. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12241. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12242. #endif
  12243. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12244. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12245. #ifdef __aeffect__
  12246. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12247. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12248. class VSTMidiEventList
  12249. {
  12250. public:
  12251. VSTMidiEventList()
  12252. : numEventsUsed (0), numEventsAllocated (0)
  12253. {
  12254. }
  12255. ~VSTMidiEventList()
  12256. {
  12257. freeEvents();
  12258. }
  12259. void clear()
  12260. {
  12261. numEventsUsed = 0;
  12262. if (events != 0)
  12263. events->numEvents = 0;
  12264. }
  12265. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12266. {
  12267. ensureSize (numEventsUsed + 1);
  12268. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12269. events->numEvents = ++numEventsUsed;
  12270. if (numBytes <= 4)
  12271. {
  12272. if (e->type == kVstSysExType)
  12273. {
  12274. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12275. e->type = kVstMidiType;
  12276. e->byteSize = sizeof (VstMidiEvent);
  12277. e->noteLength = 0;
  12278. e->noteOffset = 0;
  12279. e->detune = 0;
  12280. e->noteOffVelocity = 0;
  12281. }
  12282. e->deltaFrames = frameOffset;
  12283. memcpy (e->midiData, midiData, numBytes);
  12284. }
  12285. else
  12286. {
  12287. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12288. if (se->type == kVstSysExType)
  12289. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12290. else
  12291. se->sysexDump = (char*) juce_malloc (numBytes);
  12292. memcpy (se->sysexDump, midiData, numBytes);
  12293. se->type = kVstSysExType;
  12294. se->byteSize = sizeof (VstMidiSysexEvent);
  12295. se->deltaFrames = frameOffset;
  12296. se->flags = 0;
  12297. se->dumpBytes = numBytes;
  12298. se->resvd1 = 0;
  12299. se->resvd2 = 0;
  12300. }
  12301. }
  12302. // Handy method to pull the events out of an event buffer supplied by the host
  12303. // or plugin.
  12304. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12305. {
  12306. for (int i = 0; i < events->numEvents; ++i)
  12307. {
  12308. const VstEvent* const e = events->events[i];
  12309. if (e != 0)
  12310. {
  12311. if (e->type == kVstMidiType)
  12312. {
  12313. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12314. 4, e->deltaFrames);
  12315. }
  12316. else if (e->type == kVstSysExType)
  12317. {
  12318. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12319. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12320. e->deltaFrames);
  12321. }
  12322. }
  12323. }
  12324. }
  12325. void ensureSize (int numEventsNeeded)
  12326. {
  12327. if (numEventsNeeded > numEventsAllocated)
  12328. {
  12329. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12330. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12331. if (events == 0)
  12332. events.calloc (size, 1);
  12333. else
  12334. events.realloc (size, 1);
  12335. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12336. {
  12337. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12338. (int) sizeof (VstMidiSysexEvent)));
  12339. e->type = kVstMidiType;
  12340. e->byteSize = sizeof (VstMidiEvent);
  12341. events->events[i] = (VstEvent*) e;
  12342. }
  12343. numEventsAllocated = numEventsNeeded;
  12344. }
  12345. }
  12346. void freeEvents()
  12347. {
  12348. if (events != 0)
  12349. {
  12350. for (int i = numEventsAllocated; --i >= 0;)
  12351. {
  12352. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12353. if (e->type == kVstSysExType)
  12354. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12355. juce_free (e);
  12356. }
  12357. events.free();
  12358. numEventsUsed = 0;
  12359. numEventsAllocated = 0;
  12360. }
  12361. }
  12362. HeapBlock <VstEvents> events;
  12363. private:
  12364. int numEventsUsed, numEventsAllocated;
  12365. };
  12366. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12367. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12368. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12369. #endif
  12370. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12371. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12372. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12373. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12374. #if JUCE_PLUGINHOST_VST
  12375. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12376. {
  12377. public:
  12378. VSTPluginFormat();
  12379. ~VSTPluginFormat();
  12380. const String getName() const { return "VST"; }
  12381. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12382. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12383. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12384. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12385. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12386. bool doesPluginStillExist (const PluginDescription& desc);
  12387. const FileSearchPath getDefaultLocationsToSearch();
  12388. juce_UseDebuggingNewOperator
  12389. private:
  12390. VSTPluginFormat (const VSTPluginFormat&);
  12391. VSTPluginFormat& operator= (const VSTPluginFormat&);
  12392. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12393. };
  12394. #endif
  12395. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12396. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12397. #endif
  12398. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12399. #endif
  12400. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12401. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12402. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12403. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12404. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12405. {
  12406. public:
  12407. AudioPluginFormatManager() throw();
  12408. ~AudioPluginFormatManager() throw();
  12409. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12410. void addDefaultFormats();
  12411. int getNumFormats() throw();
  12412. AudioPluginFormat* getFormat (const int index) throw();
  12413. void addFormat (AudioPluginFormat* const format) throw();
  12414. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12415. String& errorMessage) const;
  12416. bool doesPluginStillExist (const PluginDescription& description) const;
  12417. juce_UseDebuggingNewOperator
  12418. private:
  12419. OwnedArray <AudioPluginFormat> formats;
  12420. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12421. AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12422. };
  12423. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12424. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12425. #endif
  12426. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12427. #endif
  12428. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12429. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12430. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12431. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12432. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12433. {
  12434. public:
  12435. KnownPluginList();
  12436. ~KnownPluginList();
  12437. void clear();
  12438. int getNumTypes() const throw() { return types.size(); }
  12439. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12440. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12441. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12442. bool addType (const PluginDescription& type);
  12443. void removeType (const int index) throw();
  12444. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12445. const bool dontRescanIfAlreadyInList,
  12446. OwnedArray <PluginDescription>& typesFound,
  12447. AudioPluginFormat& formatToUse);
  12448. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12449. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12450. OwnedArray <PluginDescription>& typesFound);
  12451. enum SortMethod
  12452. {
  12453. defaultOrder = 0,
  12454. sortAlphabetically,
  12455. sortByCategory,
  12456. sortByManufacturer,
  12457. sortByFileSystemLocation
  12458. };
  12459. void addToMenu (PopupMenu& menu,
  12460. const SortMethod sortMethod) const;
  12461. int getIndexChosenByMenu (const int menuResultCode) const;
  12462. void sort (const SortMethod method);
  12463. XmlElement* createXml() const;
  12464. void recreateFromXml (const XmlElement& xml);
  12465. juce_UseDebuggingNewOperator
  12466. private:
  12467. OwnedArray <PluginDescription> types;
  12468. KnownPluginList (const KnownPluginList&);
  12469. KnownPluginList& operator= (const KnownPluginList&);
  12470. };
  12471. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12472. /*** End of inlined file: juce_KnownPluginList.h ***/
  12473. #endif
  12474. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12475. #endif
  12476. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12477. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12478. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12479. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12480. class JUCE_API PluginDirectoryScanner
  12481. {
  12482. public:
  12483. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12484. AudioPluginFormat& formatToLookFor,
  12485. FileSearchPath directoriesToSearch,
  12486. const bool searchRecursively,
  12487. const File& deadMansPedalFile);
  12488. ~PluginDirectoryScanner();
  12489. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12490. const String getNextPluginFileThatWillBeScanned() const throw();
  12491. float getProgress() const { return progress; }
  12492. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12493. juce_UseDebuggingNewOperator
  12494. private:
  12495. KnownPluginList& list;
  12496. AudioPluginFormat& format;
  12497. StringArray filesOrIdentifiersToScan;
  12498. File deadMansPedalFile;
  12499. StringArray failedFiles;
  12500. int nextIndex;
  12501. float progress;
  12502. const StringArray getDeadMansPedalFile() throw();
  12503. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12504. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12505. PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12506. };
  12507. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12508. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12509. #endif
  12510. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12511. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12512. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12513. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12514. /*** Start of inlined file: juce_ListBox.h ***/
  12515. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12516. #define __JUCE_LISTBOX_JUCEHEADER__
  12517. class ListViewport;
  12518. class JUCE_API ListBoxModel
  12519. {
  12520. public:
  12521. virtual ~ListBoxModel() {}
  12522. virtual int getNumRows() = 0;
  12523. virtual void paintListBoxItem (int rowNumber,
  12524. Graphics& g,
  12525. int width, int height,
  12526. bool rowIsSelected) = 0;
  12527. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12528. Component* existingComponentToUpdate);
  12529. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12530. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12531. virtual void backgroundClicked();
  12532. virtual void selectedRowsChanged (int lastRowSelected);
  12533. virtual void deleteKeyPressed (int lastRowSelected);
  12534. virtual void returnKeyPressed (int lastRowSelected);
  12535. virtual void listWasScrolled();
  12536. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12537. virtual const String getTooltipForRow (int row);
  12538. };
  12539. class JUCE_API ListBox : public Component,
  12540. public SettableTooltipClient
  12541. {
  12542. public:
  12543. ListBox (const String& componentName,
  12544. ListBoxModel* const model);
  12545. ~ListBox();
  12546. void setModel (ListBoxModel* const newModel);
  12547. ListBoxModel* getModel() const throw() { return model; }
  12548. void updateContent();
  12549. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12550. void setMouseMoveSelectsRows (bool shouldSelect);
  12551. void selectRow (const int rowNumber,
  12552. bool dontScrollToShowThisRow = false,
  12553. bool deselectOthersFirst = true);
  12554. void selectRangeOfRows (int firstRow,
  12555. int lastRow);
  12556. void deselectRow (const int rowNumber);
  12557. void deselectAllRows();
  12558. void flipRowSelection (const int rowNumber);
  12559. const SparseSet<int> getSelectedRows() const;
  12560. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12561. const bool sendNotificationEventToModel = true);
  12562. bool isRowSelected (const int rowNumber) const;
  12563. int getNumSelectedRows() const;
  12564. int getSelectedRow (const int index = 0) const;
  12565. int getLastRowSelected() const;
  12566. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12567. const ModifierKeys& modifiers);
  12568. void setVerticalPosition (const double newProportion);
  12569. double getVerticalPosition() const;
  12570. void scrollToEnsureRowIsOnscreen (const int row);
  12571. ScrollBar* getVerticalScrollBar() const throw();
  12572. ScrollBar* getHorizontalScrollBar() const throw();
  12573. int getRowContainingPosition (const int x, const int y) const throw();
  12574. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12575. const Rectangle<int> getRowPosition (const int rowNumber,
  12576. const bool relativeToComponentTopLeft) const throw();
  12577. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12578. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12579. int getVisibleRowWidth() const throw();
  12580. void setRowHeight (const int newHeight);
  12581. int getRowHeight() const throw() { return rowHeight; }
  12582. int getNumRowsOnScreen() const throw();
  12583. enum ColourIds
  12584. {
  12585. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12586. Make this transparent if you don't want the background to be filled. */
  12587. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12588. Make this transparent to not have an outline. */
  12589. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12590. };
  12591. void setOutlineThickness (const int outlineThickness);
  12592. int getOutlineThickness() const throw() { return outlineThickness; }
  12593. void setHeaderComponent (Component* const newHeaderComponent);
  12594. void setMinimumContentWidth (const int newMinimumWidth);
  12595. int getVisibleContentWidth() const throw();
  12596. void repaintRow (const int rowNumber) throw();
  12597. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12598. Viewport* getViewport() const throw();
  12599. bool keyPressed (const KeyPress& key);
  12600. bool keyStateChanged (const bool isKeyDown);
  12601. void paint (Graphics& g);
  12602. void paintOverChildren (Graphics& g);
  12603. void resized();
  12604. void visibilityChanged();
  12605. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12606. void mouseMove (const MouseEvent&);
  12607. void mouseExit (const MouseEvent&);
  12608. void mouseUp (const MouseEvent&);
  12609. void colourChanged();
  12610. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12611. juce_UseDebuggingNewOperator
  12612. private:
  12613. friend class ListViewport;
  12614. friend class TableListBox;
  12615. ListBoxModel* model;
  12616. ListViewport* viewport;
  12617. Component* headerComponent;
  12618. int totalItems, rowHeight, minimumRowWidth;
  12619. int outlineThickness;
  12620. int lastRowSelected;
  12621. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12622. SparseSet <int> selected;
  12623. void selectRowInternal (const int rowNumber,
  12624. bool dontScrollToShowThisRow,
  12625. bool deselectOthersFirst,
  12626. bool isMouseClick);
  12627. ListBox (const ListBox&);
  12628. ListBox& operator= (const ListBox&);
  12629. };
  12630. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12631. /*** End of inlined file: juce_ListBox.h ***/
  12632. /*** Start of inlined file: juce_TextButton.h ***/
  12633. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12634. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12635. class JUCE_API TextButton : public Button
  12636. {
  12637. public:
  12638. TextButton (const String& buttonName,
  12639. const String& toolTip = String::empty);
  12640. ~TextButton();
  12641. enum ColourIds
  12642. {
  12643. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12644. 'off'). The look-and-feel class might re-interpret this to add
  12645. effects, etc. */
  12646. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12647. 'on'). The look-and-feel class might re-interpret this to add
  12648. effects, etc. */
  12649. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12650. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12651. };
  12652. void changeWidthToFitText (const int newHeight = -1);
  12653. virtual const Font getFont();
  12654. juce_UseDebuggingNewOperator
  12655. protected:
  12656. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12657. void colourChanged();
  12658. private:
  12659. TextButton (const TextButton&);
  12660. TextButton& operator= (const TextButton&);
  12661. };
  12662. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12663. /*** End of inlined file: juce_TextButton.h ***/
  12664. class JUCE_API PluginListComponent : public Component,
  12665. public ListBoxModel,
  12666. public ChangeListener,
  12667. public ButtonListener,
  12668. public Timer
  12669. {
  12670. public:
  12671. PluginListComponent (KnownPluginList& listToRepresent,
  12672. const File& deadMansPedalFile,
  12673. PropertiesFile* const propertiesToUse);
  12674. ~PluginListComponent();
  12675. void resized();
  12676. bool isInterestedInFileDrag (const StringArray& files);
  12677. void filesDropped (const StringArray& files, int, int);
  12678. int getNumRows();
  12679. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12680. void deleteKeyPressed (int lastRowSelected);
  12681. void buttonClicked (Button* b);
  12682. void changeListenerCallback (void*);
  12683. void timerCallback();
  12684. juce_UseDebuggingNewOperator
  12685. private:
  12686. KnownPluginList& list;
  12687. File deadMansPedalFile;
  12688. ListBox* listBox;
  12689. TextButton* optionsButton;
  12690. PropertiesFile* propertiesToUse;
  12691. int typeToScan;
  12692. void scanFor (AudioPluginFormat* format);
  12693. PluginListComponent (const PluginListComponent&);
  12694. PluginListComponent& operator= (const PluginListComponent&);
  12695. };
  12696. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12697. /*** End of inlined file: juce_PluginListComponent.h ***/
  12698. #endif
  12699. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12700. #endif
  12701. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12702. #endif
  12703. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12704. #endif
  12705. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12706. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12707. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12708. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12709. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12710. public AsyncUpdater
  12711. {
  12712. public:
  12713. AudioProcessorGraph();
  12714. ~AudioProcessorGraph();
  12715. class JUCE_API Node : public ReferenceCountedObject
  12716. {
  12717. public:
  12718. ~Node();
  12719. const uint32 id;
  12720. AudioProcessor* const processor;
  12721. NamedValueSet properties;
  12722. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12723. juce_UseDebuggingNewOperator
  12724. private:
  12725. friend class AudioProcessorGraph;
  12726. bool isPrepared;
  12727. Node (const uint32 id, AudioProcessor* const processor);
  12728. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12729. void unprepare();
  12730. Node (const Node&);
  12731. Node& operator= (const Node&);
  12732. };
  12733. struct JUCE_API Connection
  12734. {
  12735. public:
  12736. uint32 sourceNodeId;
  12737. int sourceChannelIndex;
  12738. uint32 destNodeId;
  12739. int destChannelIndex;
  12740. juce_UseDebuggingNewOperator
  12741. private:
  12742. };
  12743. void clear();
  12744. int getNumNodes() const { return nodes.size(); }
  12745. Node* getNode (const int index) const { return nodes [index]; }
  12746. Node* getNodeForId (const uint32 nodeId) const;
  12747. Node* addNode (AudioProcessor* const newProcessor,
  12748. uint32 nodeId = 0);
  12749. bool removeNode (const uint32 nodeId);
  12750. int getNumConnections() const { return connections.size(); }
  12751. const Connection* getConnection (const int index) const { return connections [index]; }
  12752. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12753. const int sourceChannelIndex,
  12754. const uint32 destNodeId,
  12755. const int destChannelIndex) const;
  12756. bool isConnected (const uint32 possibleSourceNodeId,
  12757. const uint32 possibleDestNodeId) const;
  12758. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12759. const uint32 destNodeId, const int destChannelIndex) const;
  12760. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12761. const uint32 destNodeId, const int destChannelIndex);
  12762. void removeConnection (const int index);
  12763. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12764. const uint32 destNodeId, const int destChannelIndex);
  12765. bool disconnectNode (const uint32 nodeId);
  12766. bool removeIllegalConnections();
  12767. static const int midiChannelIndex;
  12768. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12769. {
  12770. public:
  12771. enum IODeviceType
  12772. {
  12773. audioInputNode, /**< In this mode, the processor has output channels
  12774. representing all the audio input channels that are
  12775. coming into its parent audio graph. */
  12776. audioOutputNode, /**< In this mode, the processor has input channels
  12777. representing all the audio output channels that are
  12778. going out of its parent audio graph. */
  12779. midiInputNode, /**< In this mode, the processor has a midi output which
  12780. delivers the same midi data that is arriving at its
  12781. parent graph. */
  12782. midiOutputNode /**< In this mode, the processor has a midi input and
  12783. any data sent to it will be passed out of the parent
  12784. graph. */
  12785. };
  12786. IODeviceType getType() const { return type; }
  12787. AudioProcessorGraph* getParentGraph() const { return graph; }
  12788. bool isInput() const;
  12789. bool isOutput() const;
  12790. AudioGraphIOProcessor (const IODeviceType type);
  12791. ~AudioGraphIOProcessor();
  12792. const String getName() const;
  12793. void fillInPluginDescription (PluginDescription& d) const;
  12794. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12795. void releaseResources();
  12796. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12797. const String getInputChannelName (const int channelIndex) const;
  12798. const String getOutputChannelName (const int channelIndex) const;
  12799. bool isInputChannelStereoPair (int index) const;
  12800. bool isOutputChannelStereoPair (int index) const;
  12801. bool acceptsMidi() const;
  12802. bool producesMidi() const;
  12803. AudioProcessorEditor* createEditor();
  12804. int getNumParameters();
  12805. const String getParameterName (int);
  12806. float getParameter (int);
  12807. const String getParameterText (int);
  12808. void setParameter (int, float);
  12809. int getNumPrograms();
  12810. int getCurrentProgram();
  12811. void setCurrentProgram (int);
  12812. const String getProgramName (int);
  12813. void changeProgramName (int, const String&);
  12814. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12815. void setStateInformation (const void* data, int sizeInBytes);
  12816. void setParentGraph (AudioProcessorGraph* const graph);
  12817. juce_UseDebuggingNewOperator
  12818. private:
  12819. const IODeviceType type;
  12820. AudioProcessorGraph* graph;
  12821. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  12822. AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  12823. };
  12824. // AudioProcessor methods:
  12825. const String getName() const;
  12826. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12827. void releaseResources();
  12828. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12829. const String getInputChannelName (const int channelIndex) const;
  12830. const String getOutputChannelName (const int channelIndex) const;
  12831. bool isInputChannelStereoPair (int index) const;
  12832. bool isOutputChannelStereoPair (int index) const;
  12833. bool acceptsMidi() const;
  12834. bool producesMidi() const;
  12835. AudioProcessorEditor* createEditor() { return 0; }
  12836. int getNumParameters() { return 0; }
  12837. const String getParameterName (int) { return String::empty; }
  12838. float getParameter (int) { return 0; }
  12839. const String getParameterText (int) { return String::empty; }
  12840. void setParameter (int, float) { }
  12841. int getNumPrograms() { return 0; }
  12842. int getCurrentProgram() { return 0; }
  12843. void setCurrentProgram (int) { }
  12844. const String getProgramName (int) { return String::empty; }
  12845. void changeProgramName (int, const String&) { }
  12846. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12847. void setStateInformation (const void* data, int sizeInBytes);
  12848. void handleAsyncUpdate();
  12849. juce_UseDebuggingNewOperator
  12850. private:
  12851. ReferenceCountedArray <Node> nodes;
  12852. OwnedArray <Connection> connections;
  12853. int lastNodeId;
  12854. AudioSampleBuffer renderingBuffers;
  12855. OwnedArray <MidiBuffer> midiBuffers;
  12856. CriticalSection renderLock;
  12857. VoidArray renderingOps;
  12858. friend class AudioGraphIOProcessor;
  12859. AudioSampleBuffer* currentAudioInputBuffer;
  12860. AudioSampleBuffer currentAudioOutputBuffer;
  12861. MidiBuffer* currentMidiInputBuffer;
  12862. MidiBuffer currentMidiOutputBuffer;
  12863. void clearRenderingSequence();
  12864. void buildRenderingSequence();
  12865. bool isAnInputTo (const uint32 possibleInputId,
  12866. const uint32 possibleDestinationId,
  12867. const int recursionCheck) const;
  12868. AudioProcessorGraph (const AudioProcessorGraph&);
  12869. AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  12870. };
  12871. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12872. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  12873. #endif
  12874. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12875. #endif
  12876. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12877. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  12878. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12879. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12880. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  12881. public MidiInputCallback
  12882. {
  12883. public:
  12884. AudioProcessorPlayer();
  12885. virtual ~AudioProcessorPlayer();
  12886. void setProcessor (AudioProcessor* const processorToPlay);
  12887. AudioProcessor* getCurrentProcessor() const { return processor; }
  12888. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  12889. void audioDeviceIOCallback (const float** inputChannelData,
  12890. int totalNumInputChannels,
  12891. float** outputChannelData,
  12892. int totalNumOutputChannels,
  12893. int numSamples);
  12894. void audioDeviceAboutToStart (AudioIODevice* device);
  12895. void audioDeviceStopped();
  12896. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12897. juce_UseDebuggingNewOperator
  12898. private:
  12899. AudioProcessor* processor;
  12900. CriticalSection lock;
  12901. double sampleRate;
  12902. int blockSize;
  12903. bool isPrepared;
  12904. int numInputChans, numOutputChans;
  12905. float* channels [128];
  12906. AudioSampleBuffer tempBuffer;
  12907. MidiBuffer incomingMidi;
  12908. MidiMessageCollector messageCollector;
  12909. AudioProcessorPlayer (const AudioProcessorPlayer&);
  12910. AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  12911. };
  12912. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12913. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  12914. #endif
  12915. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12916. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  12917. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12918. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12919. /*** Start of inlined file: juce_PropertyPanel.h ***/
  12920. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  12921. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  12922. /*** Start of inlined file: juce_PropertyComponent.h ***/
  12923. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12924. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12925. class EditableProperty;
  12926. class JUCE_API PropertyComponent : public Component,
  12927. public SettableTooltipClient
  12928. {
  12929. public:
  12930. PropertyComponent (const String& propertyName,
  12931. const int preferredHeight = 25);
  12932. ~PropertyComponent();
  12933. int getPreferredHeight() const throw() { return preferredHeight; }
  12934. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  12935. virtual void refresh() = 0;
  12936. void paint (Graphics& g);
  12937. void resized();
  12938. void enablementChanged();
  12939. juce_UseDebuggingNewOperator
  12940. protected:
  12941. int preferredHeight;
  12942. };
  12943. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12944. /*** End of inlined file: juce_PropertyComponent.h ***/
  12945. class JUCE_API PropertyPanel : public Component
  12946. {
  12947. public:
  12948. PropertyPanel();
  12949. ~PropertyPanel();
  12950. void clear();
  12951. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  12952. void addSection (const String& sectionTitle,
  12953. const Array <PropertyComponent*>& newPropertyComponents,
  12954. const bool shouldSectionInitiallyBeOpen = true);
  12955. void refreshAll() const;
  12956. const StringArray getSectionNames() const;
  12957. bool isSectionOpen (const int sectionIndex) const;
  12958. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  12959. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  12960. XmlElement* getOpennessState() const;
  12961. void restoreOpennessState (const XmlElement& newState);
  12962. void setMessageWhenEmpty (const String& newMessage);
  12963. const String& getMessageWhenEmpty() const;
  12964. void paint (Graphics& g);
  12965. void resized();
  12966. juce_UseDebuggingNewOperator
  12967. private:
  12968. Viewport* viewport;
  12969. Component* propertyHolderComponent;
  12970. String messageWhenEmpty;
  12971. void updatePropHolderLayout() const;
  12972. void updatePropHolderLayout (const int width) const;
  12973. };
  12974. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  12975. /*** End of inlined file: juce_PropertyPanel.h ***/
  12976. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  12977. {
  12978. public:
  12979. GenericAudioProcessorEditor (AudioProcessor* const owner);
  12980. ~GenericAudioProcessorEditor();
  12981. void paint (Graphics& g);
  12982. void resized();
  12983. juce_UseDebuggingNewOperator
  12984. private:
  12985. PropertyPanel* panel;
  12986. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  12987. GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  12988. };
  12989. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12990. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  12991. #endif
  12992. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12993. /*** Start of inlined file: juce_Sampler.h ***/
  12994. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12995. #define __JUCE_SAMPLER_JUCEHEADER__
  12996. /*** Start of inlined file: juce_Synthesiser.h ***/
  12997. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  12998. #define __JUCE_SYNTHESISER_JUCEHEADER__
  12999. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13000. {
  13001. protected:
  13002. SynthesiserSound();
  13003. public:
  13004. virtual ~SynthesiserSound();
  13005. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13006. virtual bool appliesToChannel (const int midiChannel) = 0;
  13007. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13008. juce_UseDebuggingNewOperator
  13009. };
  13010. class JUCE_API SynthesiserVoice
  13011. {
  13012. public:
  13013. SynthesiserVoice();
  13014. virtual ~SynthesiserVoice();
  13015. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13016. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13017. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13018. virtual void startNote (const int midiNoteNumber,
  13019. const float velocity,
  13020. SynthesiserSound* sound,
  13021. const int currentPitchWheelPosition) = 0;
  13022. virtual void stopNote (const bool allowTailOff) = 0;
  13023. virtual void pitchWheelMoved (const int newValue) = 0;
  13024. virtual void controllerMoved (const int controllerNumber,
  13025. const int newValue) = 0;
  13026. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13027. int startSample,
  13028. int numSamples) = 0;
  13029. bool isPlayingChannel (const int midiChannel) const;
  13030. void setCurrentPlaybackSampleRate (const double newRate);
  13031. juce_UseDebuggingNewOperator
  13032. protected:
  13033. double getSampleRate() const { return currentSampleRate; }
  13034. void clearCurrentNote();
  13035. private:
  13036. friend class Synthesiser;
  13037. double currentSampleRate;
  13038. int currentlyPlayingNote;
  13039. uint32 noteOnTime;
  13040. SynthesiserSound::Ptr currentlyPlayingSound;
  13041. };
  13042. class JUCE_API Synthesiser
  13043. {
  13044. public:
  13045. Synthesiser();
  13046. virtual ~Synthesiser();
  13047. void clearVoices();
  13048. int getNumVoices() const { return voices.size(); }
  13049. SynthesiserVoice* getVoice (const int index) const;
  13050. void addVoice (SynthesiserVoice* const newVoice);
  13051. void removeVoice (const int index);
  13052. void clearSounds();
  13053. int getNumSounds() const { return sounds.size(); }
  13054. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13055. void addSound (const SynthesiserSound::Ptr& newSound);
  13056. void removeSound (const int index);
  13057. void setNoteStealingEnabled (const bool shouldStealNotes);
  13058. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13059. virtual void noteOn (const int midiChannel,
  13060. const int midiNoteNumber,
  13061. const float velocity);
  13062. virtual void noteOff (const int midiChannel,
  13063. const int midiNoteNumber,
  13064. const bool allowTailOff);
  13065. virtual void allNotesOff (const int midiChannel,
  13066. const bool allowTailOff);
  13067. virtual void handlePitchWheel (const int midiChannel,
  13068. const int wheelValue);
  13069. virtual void handleController (const int midiChannel,
  13070. const int controllerNumber,
  13071. const int controllerValue);
  13072. void setCurrentPlaybackSampleRate (const double sampleRate);
  13073. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13074. const MidiBuffer& inputMidi,
  13075. int startSample,
  13076. int numSamples);
  13077. juce_UseDebuggingNewOperator
  13078. protected:
  13079. CriticalSection lock;
  13080. OwnedArray <SynthesiserVoice> voices;
  13081. ReferenceCountedArray <SynthesiserSound> sounds;
  13082. int lastPitchWheelValues [16];
  13083. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13084. const bool stealIfNoneAvailable) const;
  13085. void startVoice (SynthesiserVoice* const voice,
  13086. SynthesiserSound* const sound,
  13087. const int midiChannel,
  13088. const int midiNoteNumber,
  13089. const float velocity);
  13090. int findFreeVoice (const bool) const { return 0; }
  13091. private:
  13092. double sampleRate;
  13093. uint32 lastNoteOnCounter;
  13094. bool shouldStealNotes;
  13095. Synthesiser (const Synthesiser&);
  13096. Synthesiser& operator= (const Synthesiser&);
  13097. };
  13098. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13099. /*** End of inlined file: juce_Synthesiser.h ***/
  13100. class JUCE_API SamplerSound : public SynthesiserSound
  13101. {
  13102. public:
  13103. SamplerSound (const String& name,
  13104. AudioFormatReader& source,
  13105. const BitArray& midiNotes,
  13106. const int midiNoteForNormalPitch,
  13107. const double attackTimeSecs,
  13108. const double releaseTimeSecs,
  13109. const double maxSampleLengthSeconds);
  13110. ~SamplerSound();
  13111. const String& getName() const { return name; }
  13112. AudioSampleBuffer* getAudioData() const { return data; }
  13113. bool appliesToNote (const int midiNoteNumber);
  13114. bool appliesToChannel (const int midiChannel);
  13115. juce_UseDebuggingNewOperator
  13116. private:
  13117. friend class SamplerVoice;
  13118. String name;
  13119. ScopedPointer <AudioSampleBuffer> data;
  13120. double sourceSampleRate;
  13121. BitArray midiNotes;
  13122. int length, attackSamples, releaseSamples;
  13123. int midiRootNote;
  13124. };
  13125. class JUCE_API SamplerVoice : public SynthesiserVoice
  13126. {
  13127. public:
  13128. SamplerVoice();
  13129. ~SamplerVoice();
  13130. bool canPlaySound (SynthesiserSound* sound);
  13131. void startNote (const int midiNoteNumber,
  13132. const float velocity,
  13133. SynthesiserSound* sound,
  13134. const int currentPitchWheelPosition);
  13135. void stopNote (const bool allowTailOff);
  13136. void pitchWheelMoved (const int newValue);
  13137. void controllerMoved (const int controllerNumber,
  13138. const int newValue);
  13139. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13140. juce_UseDebuggingNewOperator
  13141. private:
  13142. double pitchRatio;
  13143. double sourceSamplePosition;
  13144. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13145. bool isInAttack, isInRelease;
  13146. };
  13147. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13148. /*** End of inlined file: juce_Sampler.h ***/
  13149. #endif
  13150. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13151. #endif
  13152. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13153. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13154. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13155. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13156. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13157. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13158. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13159. class JUCE_API ActionListenerList : public MessageListener
  13160. {
  13161. public:
  13162. ActionListenerList() throw();
  13163. ~ActionListenerList() throw();
  13164. void addActionListener (ActionListener* const listener) throw();
  13165. void removeActionListener (ActionListener* const listener) throw();
  13166. void removeAllActionListeners() throw();
  13167. void sendActionMessage (const String& message) const;
  13168. void handleMessage (const Message&);
  13169. juce_UseDebuggingNewOperator
  13170. private:
  13171. SortedSet <void*> actionListeners_;
  13172. CriticalSection actionListenerLock_;
  13173. ActionListenerList (const ActionListenerList&);
  13174. ActionListenerList& operator= (const ActionListenerList&);
  13175. };
  13176. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13177. /*** End of inlined file: juce_ActionListenerList.h ***/
  13178. class JUCE_API ActionBroadcaster
  13179. {
  13180. public:
  13181. ActionBroadcaster() throw();
  13182. virtual ~ActionBroadcaster();
  13183. void addActionListener (ActionListener* const listener);
  13184. void removeActionListener (ActionListener* const listener);
  13185. void removeAllActionListeners();
  13186. void sendActionMessage (const String& message) const;
  13187. private:
  13188. ActionListenerList actionListenerList;
  13189. ActionBroadcaster (const ActionBroadcaster&);
  13190. ActionBroadcaster& operator= (const ActionBroadcaster&);
  13191. };
  13192. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13193. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13194. #endif
  13195. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13196. #endif
  13197. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13198. #endif
  13199. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13200. #endif
  13201. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13202. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13203. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13204. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13205. class JUCE_API CallbackMessage : public Message
  13206. {
  13207. public:
  13208. CallbackMessage() throw();
  13209. ~CallbackMessage() throw();
  13210. virtual void messageCallback() = 0;
  13211. void post();
  13212. juce_UseDebuggingNewOperator
  13213. private:
  13214. CallbackMessage (const CallbackMessage&);
  13215. CallbackMessage& operator= (const CallbackMessage&);
  13216. };
  13217. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13218. /*** End of inlined file: juce_CallbackMessage.h ***/
  13219. #endif
  13220. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13221. #endif
  13222. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13223. #endif
  13224. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13225. #endif
  13226. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13227. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13228. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13229. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13230. class InterprocessConnectionServer;
  13231. class JUCE_API InterprocessConnection : public Thread,
  13232. private MessageListener
  13233. {
  13234. public:
  13235. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13236. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13237. ~InterprocessConnection();
  13238. bool connectToSocket (const String& hostName,
  13239. const int portNumber,
  13240. const int timeOutMillisecs);
  13241. bool connectToPipe (const String& pipeName,
  13242. const int pipeReceiveMessageTimeoutMs = -1);
  13243. bool createPipe (const String& pipeName,
  13244. const int pipeReceiveMessageTimeoutMs = -1);
  13245. void disconnect();
  13246. bool isConnected() const;
  13247. StreamingSocket* getSocket() const throw() { return socket; }
  13248. NamedPipe* getPipe() const throw() { return pipe; }
  13249. const String getConnectedHostName() const;
  13250. bool sendMessage (const MemoryBlock& message);
  13251. virtual void connectionMade() = 0;
  13252. virtual void connectionLost() = 0;
  13253. virtual void messageReceived (const MemoryBlock& message) = 0;
  13254. juce_UseDebuggingNewOperator
  13255. private:
  13256. CriticalSection pipeAndSocketLock;
  13257. ScopedPointer <StreamingSocket> socket;
  13258. ScopedPointer <NamedPipe> pipe;
  13259. bool callbackConnectionState;
  13260. const bool useMessageThread;
  13261. const uint32 magicMessageHeader;
  13262. int pipeReceiveMessageTimeout;
  13263. friend class InterprocessConnectionServer;
  13264. void initialiseWithSocket (StreamingSocket* const socket_);
  13265. void initialiseWithPipe (NamedPipe* const pipe_);
  13266. void handleMessage (const Message& message);
  13267. void connectionMadeInt();
  13268. void connectionLostInt();
  13269. void deliverDataInt (const MemoryBlock& data);
  13270. bool readNextMessageInt();
  13271. void run();
  13272. InterprocessConnection (const InterprocessConnection&);
  13273. InterprocessConnection& operator= (const InterprocessConnection&);
  13274. };
  13275. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13276. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13277. #endif
  13278. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13279. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13280. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13281. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13282. class JUCE_API InterprocessConnectionServer : private Thread
  13283. {
  13284. public:
  13285. InterprocessConnectionServer();
  13286. ~InterprocessConnectionServer();
  13287. bool beginWaitingForSocket (const int portNumber);
  13288. void stop();
  13289. protected:
  13290. virtual InterprocessConnection* createConnectionObject() = 0;
  13291. public:
  13292. juce_UseDebuggingNewOperator
  13293. private:
  13294. ScopedPointer <StreamingSocket> socket;
  13295. void run();
  13296. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13297. InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13298. };
  13299. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13300. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13301. #endif
  13302. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13303. #endif
  13304. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13305. #endif
  13306. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13307. /*** Start of inlined file: juce_MessageManager.h ***/
  13308. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13309. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13310. class Component;
  13311. class MessageManagerLock;
  13312. typedef void* (MessageCallbackFunction) (void* userData);
  13313. class JUCE_API MessageManager
  13314. {
  13315. public:
  13316. static MessageManager* getInstance() throw();
  13317. void runDispatchLoop();
  13318. void stopDispatchLoop();
  13319. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13320. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13321. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13322. void* userData);
  13323. bool isThisTheMessageThread() const throw();
  13324. void setCurrentThreadAsMessageThread();
  13325. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13326. bool currentThreadHasLockedMessageManager() const throw();
  13327. static void broadcastMessage (const String& messageText) throw();
  13328. void registerBroadcastListener (ActionListener* listener) throw();
  13329. void deregisterBroadcastListener (ActionListener* listener) throw();
  13330. void deliverMessage (void*);
  13331. void deliverBroadcastMessage (const String&);
  13332. ~MessageManager() throw();
  13333. juce_UseDebuggingNewOperator
  13334. private:
  13335. MessageManager() throw();
  13336. friend class MessageListener;
  13337. friend class ChangeBroadcaster;
  13338. friend class ActionBroadcaster;
  13339. friend class CallbackMessage;
  13340. static MessageManager* instance;
  13341. SortedSet <const MessageListener*> messageListeners;
  13342. ScopedPointer <ActionListenerList> broadcastListeners;
  13343. friend class JUCEApplication;
  13344. bool quitMessagePosted, quitMessageReceived;
  13345. Thread::ThreadID messageThreadId;
  13346. VoidArray modalComponents;
  13347. static void* exitModalLoopCallback (void*);
  13348. void postMessageToQueue (Message* const message);
  13349. void postCallbackMessage (Message* const message);
  13350. static void doPlatformSpecificInitialisation();
  13351. static void doPlatformSpecificShutdown();
  13352. friend class MessageManagerLock;
  13353. Thread::ThreadID volatile threadWithLock;
  13354. CriticalSection lockingLock;
  13355. MessageManager (const MessageManager&);
  13356. MessageManager& operator= (const MessageManager&);
  13357. };
  13358. class JUCE_API MessageManagerLock
  13359. {
  13360. public:
  13361. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13362. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13363. ~MessageManagerLock() throw();
  13364. bool lockWasGained() const throw() { return locked; }
  13365. private:
  13366. class SharedEvents;
  13367. class BlockingMessage;
  13368. friend class SharedEvents;
  13369. friend class BlockingMessage;
  13370. SharedEvents* sharedEvents;
  13371. bool locked;
  13372. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13373. MessageManagerLock (const MessageManagerLock&);
  13374. MessageManagerLock& operator= (const MessageManagerLock&);
  13375. };
  13376. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13377. /*** End of inlined file: juce_MessageManager.h ***/
  13378. #endif
  13379. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13380. /*** Start of inlined file: juce_MultiTimer.h ***/
  13381. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13382. #define __JUCE_MULTITIMER_JUCEHEADER__
  13383. class JUCE_API MultiTimer
  13384. {
  13385. protected:
  13386. MultiTimer() throw();
  13387. MultiTimer (const MultiTimer& other) throw();
  13388. public:
  13389. virtual ~MultiTimer();
  13390. virtual void timerCallback (const int timerId) = 0;
  13391. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13392. void stopTimer (const int timerId) throw();
  13393. bool isTimerRunning (const int timerId) const throw();
  13394. int getTimerInterval (const int timerId) const throw();
  13395. private:
  13396. class MultiTimerCallback;
  13397. CriticalSection timerListLock;
  13398. OwnedArray <MultiTimerCallback> timers;
  13399. MultiTimer& operator= (const MultiTimer&);
  13400. };
  13401. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13402. /*** End of inlined file: juce_MultiTimer.h ***/
  13403. #endif
  13404. #ifndef __JUCE_TIMER_JUCEHEADER__
  13405. #endif
  13406. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13407. /*** Start of inlined file: juce_ArrowButton.h ***/
  13408. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13409. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13410. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13411. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13412. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13413. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13414. {
  13415. public:
  13416. DropShadowEffect();
  13417. ~DropShadowEffect();
  13418. void setShadowProperties (const float newRadius,
  13419. const float newOpacity,
  13420. const int newShadowOffsetX,
  13421. const int newShadowOffsetY);
  13422. void applyEffect (Image& sourceImage, Graphics& destContext);
  13423. juce_UseDebuggingNewOperator
  13424. private:
  13425. int offsetX, offsetY;
  13426. float radius, opacity;
  13427. };
  13428. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13429. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13430. class JUCE_API ArrowButton : public Button
  13431. {
  13432. public:
  13433. ArrowButton (const String& buttonName,
  13434. float arrowDirection,
  13435. const Colour& arrowColour);
  13436. ~ArrowButton();
  13437. juce_UseDebuggingNewOperator
  13438. protected:
  13439. void paintButton (Graphics& g,
  13440. bool isMouseOverButton,
  13441. bool isButtonDown);
  13442. void buttonStateChanged();
  13443. private:
  13444. Colour colour;
  13445. DropShadowEffect shadow;
  13446. Path path;
  13447. int offset;
  13448. ArrowButton (const ArrowButton&);
  13449. ArrowButton& operator= (const ArrowButton&);
  13450. };
  13451. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13452. /*** End of inlined file: juce_ArrowButton.h ***/
  13453. #endif
  13454. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13455. #endif
  13456. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13457. /*** Start of inlined file: juce_DrawableButton.h ***/
  13458. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13459. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13460. /*** Start of inlined file: juce_Drawable.h ***/
  13461. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13462. #define __JUCE_DRAWABLE_JUCEHEADER__
  13463. class JUCE_API Drawable
  13464. {
  13465. protected:
  13466. Drawable();
  13467. public:
  13468. virtual ~Drawable();
  13469. virtual Drawable* createCopy() const = 0;
  13470. void draw (Graphics& g, const float opacity,
  13471. const AffineTransform& transform = AffineTransform::identity) const;
  13472. void drawAt (Graphics& g,
  13473. const float x,
  13474. const float y,
  13475. const float opacity) const;
  13476. void drawWithin (Graphics& g,
  13477. const int destX,
  13478. const int destY,
  13479. const int destWidth,
  13480. const int destHeight,
  13481. const RectanglePlacement& placement,
  13482. const float opacity) const;
  13483. class RenderingContext
  13484. {
  13485. public:
  13486. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13487. Graphics& g;
  13488. AffineTransform transform;
  13489. float opacity;
  13490. private:
  13491. RenderingContext& operator= (const RenderingContext&);
  13492. };
  13493. virtual void render (const RenderingContext& context) const = 0;
  13494. virtual const Rectangle<float> getBounds() const = 0;
  13495. virtual bool hitTest (float x, float y) const = 0;
  13496. const String& getName() const throw() { return name; }
  13497. void setName (const String& newName) throw() { name = newName; }
  13498. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13499. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13500. static Drawable* createFromImageFile (const File& file);
  13501. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13502. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13503. virtual ValueTree createValueTree() const throw() = 0;
  13504. juce_UseDebuggingNewOperator
  13505. private:
  13506. Drawable (const Drawable&);
  13507. Drawable& operator= (const Drawable&);
  13508. String name;
  13509. };
  13510. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13511. /*** End of inlined file: juce_Drawable.h ***/
  13512. class JUCE_API DrawableButton : public Button
  13513. {
  13514. public:
  13515. enum ButtonStyle
  13516. {
  13517. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13518. ImageRaw, /**< The button will just display the images in their normal size and position.
  13519. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13520. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13521. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13522. };
  13523. DrawableButton (const String& buttonName,
  13524. const ButtonStyle buttonStyle);
  13525. ~DrawableButton();
  13526. void setImages (const Drawable* normalImage,
  13527. const Drawable* overImage = 0,
  13528. const Drawable* downImage = 0,
  13529. const Drawable* disabledImage = 0,
  13530. const Drawable* normalImageOn = 0,
  13531. const Drawable* overImageOn = 0,
  13532. const Drawable* downImageOn = 0,
  13533. const Drawable* disabledImageOn = 0);
  13534. void setButtonStyle (const ButtonStyle newStyle);
  13535. void setBackgroundColours (const Colour& toggledOffColour,
  13536. const Colour& toggledOnColour);
  13537. const Colour& getBackgroundColour() const throw();
  13538. void setEdgeIndent (const int numPixelsIndent);
  13539. const Drawable* getCurrentImage() const throw();
  13540. const Drawable* getNormalImage() const throw();
  13541. const Drawable* getOverImage() const throw();
  13542. const Drawable* getDownImage() const throw();
  13543. juce_UseDebuggingNewOperator
  13544. protected:
  13545. void paintButton (Graphics& g,
  13546. bool isMouseOverButton,
  13547. bool isButtonDown);
  13548. private:
  13549. ButtonStyle style;
  13550. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13551. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13552. Colour backgroundOff, backgroundOn;
  13553. int edgeIndent;
  13554. void deleteImages();
  13555. DrawableButton (const DrawableButton&);
  13556. DrawableButton& operator= (const DrawableButton&);
  13557. };
  13558. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13559. /*** End of inlined file: juce_DrawableButton.h ***/
  13560. #endif
  13561. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13562. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13563. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13564. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13565. class JUCE_API HyperlinkButton : public Button
  13566. {
  13567. public:
  13568. HyperlinkButton (const String& linkText,
  13569. const URL& linkURL);
  13570. ~HyperlinkButton();
  13571. void setFont (const Font& newFont,
  13572. const bool resizeToMatchComponentHeight,
  13573. const Justification& justificationType = Justification::horizontallyCentred);
  13574. enum ColourIds
  13575. {
  13576. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13577. };
  13578. void setURL (const URL& newURL) throw();
  13579. const URL& getURL() const throw() { return url; }
  13580. void changeWidthToFitText();
  13581. juce_UseDebuggingNewOperator
  13582. protected:
  13583. void clicked();
  13584. void colourChanged();
  13585. void paintButton (Graphics& g,
  13586. bool isMouseOverButton,
  13587. bool isButtonDown);
  13588. private:
  13589. URL url;
  13590. Font font;
  13591. bool resizeFont;
  13592. Justification justification;
  13593. const Font getFontToUse() const;
  13594. HyperlinkButton (const HyperlinkButton&);
  13595. HyperlinkButton& operator= (const HyperlinkButton&);
  13596. };
  13597. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13598. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13599. #endif
  13600. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13601. /*** Start of inlined file: juce_ImageButton.h ***/
  13602. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13603. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13604. class JUCE_API ImageButton : public Button
  13605. {
  13606. public:
  13607. ImageButton (const String& name);
  13608. ~ImageButton();
  13609. void setImages (const bool resizeButtonNowToFitThisImage,
  13610. const bool rescaleImagesWhenButtonSizeChanges,
  13611. const bool preserveImageProportions,
  13612. Image* const normalImage,
  13613. const float imageOpacityWhenNormal,
  13614. const Colour& overlayColourWhenNormal,
  13615. Image* const overImage,
  13616. const float imageOpacityWhenOver,
  13617. const Colour& overlayColourWhenOver,
  13618. Image* const downImage,
  13619. const float imageOpacityWhenDown,
  13620. const Colour& overlayColourWhenDown,
  13621. const float hitTestAlphaThreshold = 0.0f);
  13622. Image* getNormalImage() const throw();
  13623. Image* getOverImage() const throw();
  13624. Image* getDownImage() const throw();
  13625. juce_UseDebuggingNewOperator
  13626. protected:
  13627. bool hitTest (int x, int y);
  13628. void paintButton (Graphics& g,
  13629. bool isMouseOverButton,
  13630. bool isButtonDown);
  13631. private:
  13632. bool scaleImageToFit, preserveProportions;
  13633. unsigned char alphaThreshold;
  13634. int imageX, imageY, imageW, imageH;
  13635. Image* normalImage;
  13636. Image* overImage;
  13637. Image* downImage;
  13638. float normalOpacity, overOpacity, downOpacity;
  13639. Colour normalOverlay, overOverlay, downOverlay;
  13640. Image* getCurrentImage() const;
  13641. void deleteImages();
  13642. ImageButton (const ImageButton&);
  13643. ImageButton& operator= (const ImageButton&);
  13644. };
  13645. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13646. /*** End of inlined file: juce_ImageButton.h ***/
  13647. #endif
  13648. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13649. /*** Start of inlined file: juce_ShapeButton.h ***/
  13650. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13651. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13652. class JUCE_API ShapeButton : public Button
  13653. {
  13654. public:
  13655. ShapeButton (const String& name,
  13656. const Colour& normalColour,
  13657. const Colour& overColour,
  13658. const Colour& downColour);
  13659. ~ShapeButton();
  13660. void setShape (const Path& newShape,
  13661. const bool resizeNowToFitThisShape,
  13662. const bool maintainShapeProportions,
  13663. const bool hasDropShadow);
  13664. void setColours (const Colour& normalColour,
  13665. const Colour& overColour,
  13666. const Colour& downColour);
  13667. void setOutline (const Colour& outlineColour,
  13668. const float outlineStrokeWidth);
  13669. juce_UseDebuggingNewOperator
  13670. protected:
  13671. void paintButton (Graphics& g,
  13672. bool isMouseOverButton,
  13673. bool isButtonDown);
  13674. private:
  13675. Colour normalColour, overColour, downColour, outlineColour;
  13676. DropShadowEffect shadow;
  13677. Path shape;
  13678. bool maintainShapeProportions;
  13679. float outlineWidth;
  13680. ShapeButton (const ShapeButton&);
  13681. ShapeButton& operator= (const ShapeButton&);
  13682. };
  13683. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13684. /*** End of inlined file: juce_ShapeButton.h ***/
  13685. #endif
  13686. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13687. #endif
  13688. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13689. /*** Start of inlined file: juce_ToggleButton.h ***/
  13690. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13691. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13692. class JUCE_API ToggleButton : public Button
  13693. {
  13694. public:
  13695. ToggleButton (const String& buttonText);
  13696. ~ToggleButton();
  13697. void changeWidthToFitText();
  13698. enum ColourIds
  13699. {
  13700. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13701. };
  13702. juce_UseDebuggingNewOperator
  13703. protected:
  13704. void paintButton (Graphics& g,
  13705. bool isMouseOverButton,
  13706. bool isButtonDown);
  13707. void colourChanged();
  13708. private:
  13709. ToggleButton (const ToggleButton&);
  13710. ToggleButton& operator= (const ToggleButton&);
  13711. };
  13712. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13713. /*** End of inlined file: juce_ToggleButton.h ***/
  13714. #endif
  13715. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13716. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13717. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13718. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13719. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13720. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13721. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13722. /*** Start of inlined file: juce_Toolbar.h ***/
  13723. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13724. #define __JUCE_TOOLBAR_JUCEHEADER__
  13725. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13726. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13727. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13728. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13729. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13730. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13731. class JUCE_API DragAndDropTarget
  13732. {
  13733. public:
  13734. virtual ~DragAndDropTarget() {}
  13735. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13736. Component* sourceComponent) = 0;
  13737. virtual void itemDragEnter (const String& sourceDescription,
  13738. Component* sourceComponent,
  13739. int x,
  13740. int y);
  13741. virtual void itemDragMove (const String& sourceDescription,
  13742. Component* sourceComponent,
  13743. int x,
  13744. int y);
  13745. virtual void itemDragExit (const String& sourceDescription,
  13746. Component* sourceComponent);
  13747. virtual void itemDropped (const String& sourceDescription,
  13748. Component* sourceComponent,
  13749. int x,
  13750. int y) = 0;
  13751. virtual bool shouldDrawDragImageWhenOver();
  13752. };
  13753. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13754. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13755. class JUCE_API DragAndDropContainer
  13756. {
  13757. public:
  13758. DragAndDropContainer();
  13759. virtual ~DragAndDropContainer();
  13760. void startDragging (const String& sourceDescription,
  13761. Component* sourceComponent,
  13762. Image* dragImage = 0,
  13763. const bool allowDraggingToOtherJuceWindows = false,
  13764. const Point<int>* imageOffsetFromMouse = 0);
  13765. bool isDragAndDropActive() const;
  13766. const String getCurrentDragDescription() const;
  13767. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13768. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  13769. static bool performExternalDragDropOfText (const String& text);
  13770. juce_UseDebuggingNewOperator
  13771. protected:
  13772. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13773. Component* dragSourceComponent,
  13774. StringArray& files,
  13775. bool& canMoveFiles);
  13776. private:
  13777. friend class DragImageComponent;
  13778. ScopedPointer <Component> dragImageComponent;
  13779. String currentDragDesc;
  13780. };
  13781. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13782. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  13783. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  13784. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13785. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13786. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13787. private Timer
  13788. {
  13789. public:
  13790. ComponentAnimator();
  13791. ~ComponentAnimator();
  13792. void animateComponent (Component* const component,
  13793. const Rectangle<int>& finalPosition,
  13794. const int millisecondsToSpendMoving,
  13795. const double startSpeed = 1.0,
  13796. const double endSpeed = 1.0);
  13797. void cancelAnimation (Component* const component,
  13798. const bool moveComponentToItsFinalPosition);
  13799. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13800. const Rectangle<int> getComponentDestination (Component* const component);
  13801. bool isAnimating (Component* component) const;
  13802. juce_UseDebuggingNewOperator
  13803. private:
  13804. VoidArray tasks;
  13805. uint32 lastTime;
  13806. void* findTaskFor (Component* const component) const;
  13807. void timerCallback();
  13808. };
  13809. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13810. /*** End of inlined file: juce_ComponentAnimator.h ***/
  13811. class ToolbarItemComponent;
  13812. class ToolbarItemFactory;
  13813. class MissingItemsComponent;
  13814. class JUCE_API Toolbar : public Component,
  13815. public DragAndDropContainer,
  13816. public DragAndDropTarget,
  13817. private ButtonListener
  13818. {
  13819. public:
  13820. Toolbar();
  13821. ~Toolbar();
  13822. void setVertical (const bool shouldBeVertical);
  13823. bool isVertical() const throw() { return vertical; }
  13824. int getThickness() const throw();
  13825. int getLength() const throw();
  13826. void clear();
  13827. void addItem (ToolbarItemFactory& factory,
  13828. const int itemId,
  13829. const int insertIndex = -1);
  13830. void removeToolbarItem (const int itemIndex);
  13831. int getNumItems() const throw();
  13832. int getItemId (const int itemIndex) const throw();
  13833. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  13834. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  13835. enum ToolbarItemStyle
  13836. {
  13837. iconsOnly, /**< Means that the toolbar should just contain icons. */
  13838. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  13839. textOnly /**< Means that the toolbar only display text labels for each item. */
  13840. };
  13841. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13842. void setStyle (const ToolbarItemStyle& newStyle);
  13843. enum CustomisationFlags
  13844. {
  13845. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  13846. show the "icons only" option on its choice of toolbar styles. */
  13847. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  13848. show the "icons with text" option on its choice of toolbar styles. */
  13849. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  13850. show the "text only" option on its choice of toolbar styles. */
  13851. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  13852. show a button to reset the toolbar to its default set of items. */
  13853. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  13854. };
  13855. void showCustomisationDialog (ToolbarItemFactory& factory,
  13856. const int optionFlags = allCustomisationOptionsEnabled);
  13857. void setEditingActive (const bool editingEnabled);
  13858. enum ColourIds
  13859. {
  13860. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  13861. more control over this, override LookAndFeel::paintToolbarBackground(). */
  13862. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  13863. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  13864. over them. */
  13865. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  13866. held down on them. */
  13867. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  13868. when the style is set to iconsWithText or textOnly. */
  13869. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  13870. the customisation dialog is active and the mouse moves over them. */
  13871. };
  13872. const String toString() const;
  13873. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  13874. const String& savedVersion);
  13875. void paint (Graphics& g);
  13876. void resized();
  13877. void buttonClicked (Button*);
  13878. void mouseDown (const MouseEvent&);
  13879. bool isInterestedInDragSource (const String&, Component*);
  13880. void itemDragMove (const String&, Component*, int, int);
  13881. void itemDragExit (const String&, Component*);
  13882. void itemDropped (const String&, Component*, int, int);
  13883. void updateAllItemPositions (const bool animate);
  13884. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  13885. juce_UseDebuggingNewOperator
  13886. private:
  13887. Button* missingItemsButton;
  13888. bool vertical, isEditingActive;
  13889. ToolbarItemStyle toolbarStyle;
  13890. ComponentAnimator animator;
  13891. friend class MissingItemsComponent;
  13892. Array <ToolbarItemComponent*> items;
  13893. friend class ItemDragAndDropOverlayComponent;
  13894. static const tchar* const toolbarDragDescriptor;
  13895. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  13896. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  13897. Toolbar (const Toolbar&);
  13898. Toolbar& operator= (const Toolbar&);
  13899. };
  13900. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  13901. /*** End of inlined file: juce_Toolbar.h ***/
  13902. class ItemDragAndDropOverlayComponent;
  13903. class JUCE_API ToolbarItemComponent : public Button
  13904. {
  13905. public:
  13906. ToolbarItemComponent (const int itemId,
  13907. const String& labelText,
  13908. const bool isBeingUsedAsAButton);
  13909. ~ToolbarItemComponent();
  13910. int getItemId() const throw() { return itemId; }
  13911. Toolbar* getToolbar() const;
  13912. bool isToolbarVertical() const;
  13913. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13914. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  13915. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  13916. virtual bool getToolbarItemSizes (int toolbarThickness,
  13917. bool isToolbarVertical,
  13918. int& preferredSize,
  13919. int& minSize,
  13920. int& maxSize) = 0;
  13921. virtual void paintButtonArea (Graphics& g,
  13922. int width, int height,
  13923. bool isMouseOver, bool isMouseDown) = 0;
  13924. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  13925. enum ToolbarEditingMode
  13926. {
  13927. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  13928. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  13929. customisation mode, and the items can be dragged around. */
  13930. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  13931. dragged onto a toolbar to add it to that bar.*/
  13932. };
  13933. void setEditingMode (const ToolbarEditingMode newMode);
  13934. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  13935. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  13936. void resized();
  13937. juce_UseDebuggingNewOperator
  13938. private:
  13939. friend class Toolbar;
  13940. friend class ItemDragAndDropOverlayComponent;
  13941. const int itemId;
  13942. ToolbarEditingMode mode;
  13943. Toolbar::ToolbarItemStyle toolbarStyle;
  13944. ScopedPointer <Component> overlayComp;
  13945. int dragOffsetX, dragOffsetY;
  13946. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  13947. Rectangle<int> contentArea;
  13948. ToolbarItemComponent (const ToolbarItemComponent&);
  13949. ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  13950. };
  13951. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13952. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  13953. class JUCE_API ToolbarButton : public ToolbarItemComponent
  13954. {
  13955. public:
  13956. ToolbarButton (const int itemId,
  13957. const String& labelText,
  13958. Drawable* const normalImage,
  13959. Drawable* const toggledOnImage);
  13960. ~ToolbarButton();
  13961. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  13962. int& minSize, int& maxSize);
  13963. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  13964. void contentAreaChanged (const Rectangle<int>& newBounds);
  13965. juce_UseDebuggingNewOperator
  13966. private:
  13967. ScopedPointer <Drawable> normalImage, toggledOnImage;
  13968. ToolbarButton (const ToolbarButton&);
  13969. ToolbarButton& operator= (const ToolbarButton&);
  13970. };
  13971. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13972. /*** End of inlined file: juce_ToolbarButton.h ***/
  13973. #endif
  13974. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13975. /*** Start of inlined file: juce_CodeDocument.h ***/
  13976. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13977. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  13978. class CodeDocumentLine;
  13979. class JUCE_API CodeDocument
  13980. {
  13981. public:
  13982. CodeDocument();
  13983. ~CodeDocument();
  13984. class JUCE_API Position
  13985. {
  13986. public:
  13987. Position() throw();
  13988. Position (const CodeDocument* const ownerDocument,
  13989. const int line, const int indexInLine) throw();
  13990. Position (const CodeDocument* const ownerDocument,
  13991. const int charactersFromStartOfDocument) throw();
  13992. Position (const Position& other) throw();
  13993. ~Position() throw();
  13994. Position& operator= (const Position& other) throw();
  13995. bool operator== (const Position& other) const throw();
  13996. bool operator!= (const Position& other) const throw();
  13997. void setPosition (const int charactersFromStartOfDocument) throw();
  13998. int getPosition() const throw() { return characterPos; }
  13999. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14000. int getLineNumber() const throw() { return line; }
  14001. int getIndexInLine() const throw() { return indexInLine; }
  14002. void setPositionMaintained (const bool isMaintained) throw();
  14003. void moveBy (int characterDelta) throw();
  14004. const Position movedBy (const int characterDelta) const throw();
  14005. const Position movedByLines (const int deltaLines) const throw();
  14006. const tchar getCharacter() const throw();
  14007. const String getLineText() const throw();
  14008. private:
  14009. CodeDocument* owner;
  14010. int characterPos, line, indexInLine;
  14011. bool positionMaintained;
  14012. };
  14013. const String getAllContent() const throw();
  14014. const String getTextBetween (const Position& start, const Position& end) const throw();
  14015. const String getLine (const int lineIndex) const throw();
  14016. int getNumCharacters() const throw();
  14017. int getNumLines() const throw() { return lines.size(); }
  14018. int getMaximumLineLength() throw();
  14019. void deleteSection (const Position& startPosition, const Position& endPosition);
  14020. void insertText (const Position& position, const String& text);
  14021. void replaceAllContent (const String& newContent);
  14022. bool loadFromStream (InputStream& stream);
  14023. bool writeToStream (OutputStream& stream);
  14024. const String getNewLineCharacters() const throw() { return newLineChars; }
  14025. void setNewLineCharacters (const String& newLine) throw();
  14026. void newTransaction();
  14027. void undo();
  14028. void redo();
  14029. void clearUndoHistory();
  14030. UndoManager& getUndoManager() throw() { return undoManager; }
  14031. void setSavePoint() throw();
  14032. bool hasChangedSinceSavePoint() const throw();
  14033. const Position findWordBreakAfter (const Position& position) const throw();
  14034. const Position findWordBreakBefore (const Position& position) const throw();
  14035. class JUCE_API Listener
  14036. {
  14037. public:
  14038. Listener() {}
  14039. virtual ~Listener() {}
  14040. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14041. const Position& affectedTextEnd) = 0;
  14042. };
  14043. void addListener (Listener* const listener) throw();
  14044. void removeListener (Listener* const listener) throw();
  14045. class Iterator
  14046. {
  14047. public:
  14048. Iterator (CodeDocument* const document);
  14049. Iterator (const Iterator& other);
  14050. Iterator& operator= (const Iterator& other) throw();
  14051. ~Iterator() throw();
  14052. juce_wchar nextChar();
  14053. juce_wchar peekNextChar() const;
  14054. void skip();
  14055. int getPosition() const throw() { return position; }
  14056. void skipWhitespace();
  14057. void skipToEndOfLine();
  14058. int getLine() const throw() { return line; }
  14059. bool isEOF() const throw();
  14060. private:
  14061. CodeDocument* document;
  14062. CodeDocumentLine* currentLine;
  14063. int line, position;
  14064. };
  14065. juce_UseDebuggingNewOperator
  14066. private:
  14067. friend class CodeDocumentInsertAction;
  14068. friend class CodeDocumentDeleteAction;
  14069. friend class Iterator;
  14070. friend class Position;
  14071. OwnedArray <CodeDocumentLine> lines;
  14072. Array <Position*> positionsToMaintain;
  14073. UndoManager undoManager;
  14074. int currentActionIndex, indexOfSavedState;
  14075. int maximumLineLength;
  14076. VoidArray listeners;
  14077. String newLineChars;
  14078. void sendListenerChangeMessage (const int startLine, const int endLine);
  14079. void insert (const String& text, const int insertPos, const bool undoable);
  14080. void remove (const int startPos, const int endPos, const bool undoable);
  14081. void checkLastLineStatus();
  14082. CodeDocument (const CodeDocument&);
  14083. CodeDocument& operator= (const CodeDocument&);
  14084. };
  14085. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14086. /*** End of inlined file: juce_CodeDocument.h ***/
  14087. #endif
  14088. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14089. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14090. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14091. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14092. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14093. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14094. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14095. class JUCE_API CodeTokeniser
  14096. {
  14097. public:
  14098. CodeTokeniser() {}
  14099. virtual ~CodeTokeniser() {}
  14100. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14101. virtual const StringArray getTokenTypes() = 0;
  14102. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14103. juce_UseDebuggingNewOperator
  14104. };
  14105. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14106. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14107. class JUCE_API CodeEditorComponent : public Component,
  14108. public TextInputTarget,
  14109. public Timer,
  14110. public ScrollBarListener,
  14111. public CodeDocument::Listener,
  14112. public AsyncUpdater
  14113. {
  14114. public:
  14115. CodeEditorComponent (CodeDocument& document,
  14116. CodeTokeniser* const codeTokeniser);
  14117. ~CodeEditorComponent();
  14118. CodeDocument& getDocument() const throw() { return document; }
  14119. void loadContent (const String& newContent);
  14120. float getCharWidth() const throw() { return charWidth; }
  14121. int getLineHeight() const throw() { return lineHeight; }
  14122. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14123. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14124. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14125. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14126. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14127. const CodeDocument::Position getPositionAt (int x, int y);
  14128. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14129. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14130. void cursorDown (const bool selecting);
  14131. void cursorUp (const bool selecting);
  14132. void pageDown (const bool selecting);
  14133. void pageUp (const bool selecting);
  14134. void scrollDown();
  14135. void scrollUp();
  14136. void scrollToLine (int newFirstLineOnScreen);
  14137. void scrollBy (int deltaLines);
  14138. void scrollToColumn (int newFirstColumnOnScreen);
  14139. void scrollToKeepCaretOnScreen();
  14140. void goToStartOfDocument (const bool selecting);
  14141. void goToStartOfLine (const bool selecting);
  14142. void goToEndOfDocument (const bool selecting);
  14143. void goToEndOfLine (const bool selecting);
  14144. void deselectAll();
  14145. void selectAll();
  14146. void insertTextAtCaret (const String& textToInsert);
  14147. void insertTabAtCaret();
  14148. void cut();
  14149. void copy();
  14150. void copyThenCut();
  14151. void paste();
  14152. void backspace (const bool moveInWholeWordSteps);
  14153. void deleteForward (const bool moveInWholeWordSteps);
  14154. void undo();
  14155. void redo();
  14156. const Range<int> getHighlightedRegion() const;
  14157. void setHighlightedRegion (const Range<int>& newRange);
  14158. const String getTextInRange (const Range<int>& range) const;
  14159. void setTabSize (const int numSpacesPerTab,
  14160. const bool insertSpacesInsteadOfTabCharacters) throw();
  14161. int getTabSize() const throw() { return spacesPerTab; }
  14162. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14163. void setFont (const Font& newFont);
  14164. void resetToDefaultColours();
  14165. void setColourForTokenType (const int tokenType, const Colour& colour);
  14166. const Colour getColourForTokenType (const int tokenType) const throw();
  14167. enum ColourIds
  14168. {
  14169. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14170. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14171. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14172. selected text. */
  14173. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14174. enabled. */
  14175. };
  14176. void setScrollbarThickness (const int thickness) throw();
  14177. void resized();
  14178. void paint (Graphics& g);
  14179. bool keyPressed (const KeyPress& key);
  14180. void mouseDown (const MouseEvent& e);
  14181. void mouseDrag (const MouseEvent& e);
  14182. void mouseUp (const MouseEvent& e);
  14183. void mouseDoubleClick (const MouseEvent& e);
  14184. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14185. void timerCallback();
  14186. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14187. void handleAsyncUpdate();
  14188. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14189. const CodeDocument::Position& affectedTextEnd);
  14190. juce_UseDebuggingNewOperator
  14191. private:
  14192. CodeDocument& document;
  14193. Font font;
  14194. int firstLineOnScreen, gutter, spacesPerTab;
  14195. float charWidth;
  14196. int lineHeight, linesOnScreen, columnsOnScreen;
  14197. int scrollbarThickness, columnToTryToMaintain;
  14198. bool useSpacesForTabs;
  14199. double xOffset;
  14200. CodeDocument::Position caretPos;
  14201. CodeDocument::Position selectionStart, selectionEnd;
  14202. Component* caret;
  14203. ScrollBar* verticalScrollBar;
  14204. ScrollBar* horizontalScrollBar;
  14205. enum DragType
  14206. {
  14207. notDragging,
  14208. draggingSelectionStart,
  14209. draggingSelectionEnd
  14210. };
  14211. DragType dragType;
  14212. CodeTokeniser* codeTokeniser;
  14213. Array <Colour> coloursForTokenCategories;
  14214. class CodeEditorLine;
  14215. OwnedArray <CodeEditorLine> lines;
  14216. void rebuildLineTokens();
  14217. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14218. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14219. void updateCachedIterators (int maxLineNum);
  14220. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14221. void moveLineDelta (const int delta, const bool selecting);
  14222. void updateScrollBars();
  14223. void scrollToLineInternal (int line);
  14224. void scrollToColumnInternal (double column);
  14225. void newTransaction();
  14226. int indexToColumn (int line, int index) const throw();
  14227. int columnToIndex (int line, int column) const throw();
  14228. CodeEditorComponent (const CodeEditorComponent&);
  14229. CodeEditorComponent& operator= (const CodeEditorComponent&);
  14230. };
  14231. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14232. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14233. #endif
  14234. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14235. #endif
  14236. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14237. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14238. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14239. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14240. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14241. {
  14242. public:
  14243. CPlusPlusCodeTokeniser();
  14244. ~CPlusPlusCodeTokeniser();
  14245. enum TokenType
  14246. {
  14247. tokenType_error = 0,
  14248. tokenType_comment,
  14249. tokenType_builtInKeyword,
  14250. tokenType_identifier,
  14251. tokenType_integerLiteral,
  14252. tokenType_floatLiteral,
  14253. tokenType_stringLiteral,
  14254. tokenType_operator,
  14255. tokenType_bracket,
  14256. tokenType_punctuation,
  14257. tokenType_preprocessor
  14258. };
  14259. int readNextToken (CodeDocument::Iterator& source);
  14260. const StringArray getTokenTypes();
  14261. const Colour getDefaultColour (const int tokenType);
  14262. juce_UseDebuggingNewOperator
  14263. };
  14264. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14265. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14266. #endif
  14267. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14268. #endif
  14269. #ifndef __JUCE_LABEL_JUCEHEADER__
  14270. #endif
  14271. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14272. #endif
  14273. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14274. /*** Start of inlined file: juce_ProgressBar.h ***/
  14275. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14276. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14277. class JUCE_API ProgressBar : public Component,
  14278. public SettableTooltipClient,
  14279. private Timer
  14280. {
  14281. public:
  14282. ProgressBar (double& progress);
  14283. ~ProgressBar();
  14284. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14285. void setTextToDisplay (const String& text);
  14286. enum ColourIds
  14287. {
  14288. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14289. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14290. classes will probably use variations on this colour. */
  14291. };
  14292. juce_UseDebuggingNewOperator
  14293. protected:
  14294. void paint (Graphics& g);
  14295. void lookAndFeelChanged();
  14296. void visibilityChanged();
  14297. void colourChanged();
  14298. private:
  14299. double& progress;
  14300. double currentValue;
  14301. bool displayPercentage;
  14302. String displayedMessage, currentMessage;
  14303. uint32 lastCallbackTime;
  14304. void timerCallback();
  14305. ProgressBar (const ProgressBar&);
  14306. ProgressBar& operator= (const ProgressBar&);
  14307. };
  14308. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14309. /*** End of inlined file: juce_ProgressBar.h ***/
  14310. #endif
  14311. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14312. /*** Start of inlined file: juce_Slider.h ***/
  14313. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14314. #define __JUCE_SLIDER_JUCEHEADER__
  14315. /*** Start of inlined file: juce_SliderListener.h ***/
  14316. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14317. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14318. class Slider;
  14319. class JUCE_API SliderListener
  14320. {
  14321. public:
  14322. virtual ~SliderListener() {}
  14323. virtual void sliderValueChanged (Slider* slider) = 0;
  14324. virtual void sliderDragStarted (Slider* slider);
  14325. virtual void sliderDragEnded (Slider* slider);
  14326. };
  14327. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14328. /*** End of inlined file: juce_SliderListener.h ***/
  14329. class JUCE_API Slider : public Component,
  14330. public SettableTooltipClient,
  14331. private AsyncUpdater,
  14332. private ButtonListener,
  14333. private LabelListener,
  14334. private Value::Listener
  14335. {
  14336. public:
  14337. Slider (const String& componentName);
  14338. ~Slider();
  14339. enum SliderStyle
  14340. {
  14341. LinearHorizontal, /**< A traditional horizontal slider. */
  14342. LinearVertical, /**< A traditional vertical slider. */
  14343. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14344. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14345. @see setRotaryParameters */
  14346. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14347. @see setRotaryParameters */
  14348. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14349. @see setRotaryParameters */
  14350. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14351. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14352. @see setMinValue, setMaxValue */
  14353. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14354. @see setMinValue, setMaxValue */
  14355. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14356. value, with the current value being somewhere between them.
  14357. @see setMinValue, setMaxValue */
  14358. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14359. value, with the current value being somewhere between them.
  14360. @see setMinValue, setMaxValue */
  14361. };
  14362. void setSliderStyle (const SliderStyle newStyle);
  14363. SliderStyle getSliderStyle() const { return style; }
  14364. void setRotaryParameters (const float startAngleRadians,
  14365. const float endAngleRadians,
  14366. const bool stopAtEnd);
  14367. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14368. void setVelocityBasedMode (const bool isVelocityBased);
  14369. bool getVelocityBasedMode() const { return isVelocityBased; }
  14370. void setVelocityModeParameters (const double sensitivity = 1.0,
  14371. const int threshold = 1,
  14372. const double offset = 0.0,
  14373. const bool userCanPressKeyToSwapMode = true);
  14374. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14375. int getVelocityThreshold() const { return velocityModeThreshold; }
  14376. double getVelocityOffset() const { return velocityModeOffset; }
  14377. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14378. void setSkewFactor (const double factor);
  14379. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14380. double getSkewFactor() const { return skewFactor; }
  14381. enum IncDecButtonMode
  14382. {
  14383. incDecButtonsNotDraggable,
  14384. incDecButtonsDraggable_AutoDirection,
  14385. incDecButtonsDraggable_Horizontal,
  14386. incDecButtonsDraggable_Vertical
  14387. };
  14388. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14389. enum TextEntryBoxPosition
  14390. {
  14391. NoTextBox, /**< Doesn't display a text box. */
  14392. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14393. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14394. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14395. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14396. };
  14397. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14398. const bool isReadOnly,
  14399. const int textEntryBoxWidth,
  14400. const int textEntryBoxHeight);
  14401. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14402. int getTextBoxWidth() const { return textBoxWidth; }
  14403. int getTextBoxHeight() const { return textBoxHeight; }
  14404. void setTextBoxIsEditable (const bool shouldBeEditable);
  14405. bool isTextBoxEditable() const { return editableText; }
  14406. void showTextBox();
  14407. void hideTextBox (const bool discardCurrentEditorContents);
  14408. void setValue (double newValue,
  14409. const bool sendUpdateMessage = true,
  14410. const bool sendMessageSynchronously = false);
  14411. double getValue() const;
  14412. Value& getValueObject() { return currentValue; }
  14413. void setRange (const double newMinimum,
  14414. const double newMaximum,
  14415. const double newInterval = 0);
  14416. double getMaximum() const { return maximum; }
  14417. double getMinimum() const { return minimum; }
  14418. double getInterval() const { return interval; }
  14419. double getMinValue() const;
  14420. Value& getMinValueObject() { return valueMin; }
  14421. void setMinValue (double newValue,
  14422. const bool sendUpdateMessage = true,
  14423. const bool sendMessageSynchronously = false,
  14424. const bool allowNudgingOfOtherValues = false);
  14425. double getMaxValue() const;
  14426. Value& getMaxValueObject() { return valueMax; }
  14427. void setMaxValue (double newValue,
  14428. const bool sendUpdateMessage = true,
  14429. const bool sendMessageSynchronously = false,
  14430. const bool allowNudgingOfOtherValues = false);
  14431. void addListener (SliderListener* const listener);
  14432. void removeListener (SliderListener* const listener);
  14433. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14434. const double valueToSetOnDoubleClick);
  14435. double getDoubleClickReturnValue (bool& isEnabled) const;
  14436. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14437. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14438. void setPopupDisplayEnabled (const bool isEnabled,
  14439. Component* const parentComponentToUse);
  14440. void setPopupMenuEnabled (const bool menuEnabled);
  14441. void setScrollWheelEnabled (const bool enabled);
  14442. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14443. virtual void startedDragging();
  14444. virtual void stoppedDragging();
  14445. virtual void valueChanged();
  14446. /** Callback to indicate that the user has just moved the slider.
  14447. Note - the valueChanged() method has changed its format and now no longer has
  14448. any parameters. Update your code to use the new version.
  14449. This version has been left here with an int as its return value to cause
  14450. a syntax error if you've got existing code that uses the old version.
  14451. */
  14452. virtual int valueChanged (double) { jassertfalse; return 0; }
  14453. virtual double getValueFromText (const String& text);
  14454. virtual const String getTextFromValue (double value);
  14455. void setTextValueSuffix (const String& suffix);
  14456. virtual double proportionOfLengthToValue (double proportion);
  14457. virtual double valueToProportionOfLength (double value);
  14458. float getPositionOfValue (const double value);
  14459. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14460. void updateText();
  14461. bool isHorizontal() const;
  14462. bool isVertical() const;
  14463. enum ColourIds
  14464. {
  14465. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14466. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14467. and feel class how this is used. */
  14468. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14469. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14470. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14471. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14472. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14473. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14474. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14475. };
  14476. juce_UseDebuggingNewOperator
  14477. protected:
  14478. void labelTextChanged (Label*);
  14479. void paint (Graphics& g);
  14480. void resized();
  14481. void mouseDown (const MouseEvent& e);
  14482. void mouseUp (const MouseEvent& e);
  14483. void mouseDrag (const MouseEvent& e);
  14484. void mouseDoubleClick (const MouseEvent& e);
  14485. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14486. void modifierKeysChanged (const ModifierKeys& modifiers);
  14487. void buttonClicked (Button* button);
  14488. void lookAndFeelChanged();
  14489. void enablementChanged();
  14490. void focusOfChildComponentChanged (FocusChangeType cause);
  14491. void handleAsyncUpdate();
  14492. void colourChanged();
  14493. void valueChanged (Value& value);
  14494. private:
  14495. SortedSet <void*> listeners;
  14496. Value currentValue, valueMin, valueMax;
  14497. double lastCurrentValue, lastValueMin, lastValueMax;
  14498. double minimum, maximum, interval, doubleClickReturnValue;
  14499. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14500. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14501. int velocityModeThreshold;
  14502. float rotaryStart, rotaryEnd;
  14503. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14504. int mouseDragStartX, mouseDragStartY;
  14505. int sliderRegionStart, sliderRegionSize;
  14506. int sliderBeingDragged;
  14507. int pixelsForFullDragExtent;
  14508. Rectangle<int> sliderRect;
  14509. String textSuffix;
  14510. SliderStyle style;
  14511. TextEntryBoxPosition textBoxPos;
  14512. int textBoxWidth, textBoxHeight;
  14513. IncDecButtonMode incDecButtonMode;
  14514. bool editableText : 1, doubleClickToValue : 1;
  14515. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14516. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14517. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14518. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14519. Font font;
  14520. Label* valueBox;
  14521. Button* incButton;
  14522. Button* decButton;
  14523. ScopedPointer <Component> popupDisplay;
  14524. Component* parentForPopupDisplay;
  14525. float getLinearSliderPos (const double value);
  14526. void restoreMouseIfHidden();
  14527. void sendDragStart();
  14528. void sendDragEnd();
  14529. double constrainedValue (double value) const;
  14530. void triggerChangeMessage (const bool synchronous);
  14531. bool incDecDragDirectionIsHorizontal() const;
  14532. Slider (const Slider&);
  14533. Slider& operator= (const Slider&);
  14534. };
  14535. #endif // __JUCE_SLIDER_JUCEHEADER__
  14536. /*** End of inlined file: juce_Slider.h ***/
  14537. #endif
  14538. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14539. #endif
  14540. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14541. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14542. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14543. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14544. class TableHeaderComponent;
  14545. class JUCE_API TableHeaderListener
  14546. {
  14547. public:
  14548. TableHeaderListener() {}
  14549. virtual ~TableHeaderListener() {}
  14550. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14551. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14552. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14553. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14554. int columnIdNowBeingDragged);
  14555. };
  14556. class JUCE_API TableHeaderComponent : public Component,
  14557. private AsyncUpdater
  14558. {
  14559. public:
  14560. TableHeaderComponent();
  14561. ~TableHeaderComponent();
  14562. enum ColumnPropertyFlags
  14563. {
  14564. visible = 1, /**< If this is set, the column will be shown; if not, it will be hidden until the user enables it with the pop-up menu. */
  14565. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14566. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14567. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14568. sortable = 16, /**< If this is set, then clicking on the column header will set it to be the sort column, and clicking again will reverse the order. */
  14569. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14570. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14571. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14572. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14573. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14574. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14575. };
  14576. void addColumn (const String& columnName,
  14577. const int columnId,
  14578. const int width,
  14579. const int minimumWidth = 30,
  14580. const int maximumWidth = -1,
  14581. const int propertyFlags = defaultFlags,
  14582. const int insertIndex = -1);
  14583. void removeColumn (const int columnIdToRemove);
  14584. void removeAllColumns();
  14585. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14586. const String getColumnName (const int columnId) const;
  14587. void setColumnName (const int columnId, const String& newName);
  14588. void moveColumn (const int columnId, int newVisibleIndex);
  14589. int getColumnWidth (const int columnId) const;
  14590. void setColumnWidth (const int columnId, const int newWidth);
  14591. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14592. bool isColumnVisible (const int columnId) const;
  14593. void setSortColumnId (const int columnId, const bool sortForwards);
  14594. int getSortColumnId() const;
  14595. bool isSortedForwards() const;
  14596. void reSortTable();
  14597. int getTotalWidth() const;
  14598. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14599. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14600. const Rectangle<int> getColumnPosition (const int index) const;
  14601. int getColumnIdAtX (const int xToFind) const;
  14602. void setStretchToFitActive (const bool shouldStretchToFit);
  14603. bool isStretchToFitActive() const;
  14604. void resizeAllColumnsToFit (int targetTotalWidth);
  14605. void setPopupMenuActive (const bool hasMenu);
  14606. bool isPopupMenuActive() const;
  14607. const String toString() const;
  14608. void restoreFromString (const String& storedVersion);
  14609. void addListener (TableHeaderListener* const newListener);
  14610. void removeListener (TableHeaderListener* const listenerToRemove);
  14611. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14612. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14613. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14614. void paint (Graphics& g);
  14615. void resized();
  14616. void mouseMove (const MouseEvent&);
  14617. void mouseEnter (const MouseEvent&);
  14618. void mouseExit (const MouseEvent&);
  14619. void mouseDown (const MouseEvent&);
  14620. void mouseDrag (const MouseEvent&);
  14621. void mouseUp (const MouseEvent&);
  14622. const MouseCursor getMouseCursor();
  14623. virtual void showColumnChooserMenu (const int columnIdClicked);
  14624. juce_UseDebuggingNewOperator
  14625. private:
  14626. struct ColumnInfo
  14627. {
  14628. String name;
  14629. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14630. double lastDeliberateWidth;
  14631. bool isVisible() const;
  14632. };
  14633. OwnedArray <ColumnInfo> columns;
  14634. Array <TableHeaderListener*> listeners;
  14635. ScopedPointer <Component> dragOverlayComp;
  14636. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14637. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14638. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14639. ColumnInfo* getInfoForId (const int columnId) const;
  14640. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14641. void sendColumnsChanged();
  14642. void handleAsyncUpdate();
  14643. void beginDrag (const MouseEvent&);
  14644. void endDrag (const int finalIndex);
  14645. int getResizeDraggerAt (const int mouseX) const;
  14646. void updateColumnUnderMouse (int x, int y);
  14647. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14648. TableHeaderComponent (const TableHeaderComponent&);
  14649. TableHeaderComponent operator= (const TableHeaderComponent&);
  14650. };
  14651. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14652. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14653. #endif
  14654. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14655. /*** Start of inlined file: juce_TableListBox.h ***/
  14656. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14657. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14658. class JUCE_API TableListBoxModel
  14659. {
  14660. public:
  14661. TableListBoxModel() {}
  14662. virtual ~TableListBoxModel() {}
  14663. virtual int getNumRows() = 0;
  14664. virtual void paintRowBackground (Graphics& g,
  14665. int rowNumber,
  14666. int width, int height,
  14667. bool rowIsSelected) = 0;
  14668. virtual void paintCell (Graphics& g,
  14669. int rowNumber,
  14670. int columnId,
  14671. int width, int height,
  14672. bool rowIsSelected) = 0;
  14673. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14674. Component* existingComponentToUpdate);
  14675. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14676. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14677. virtual void backgroundClicked();
  14678. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14679. virtual int getColumnAutoSizeWidth (int columnId);
  14680. virtual const String getCellTooltip (int rowNumber, int columnId);
  14681. virtual void selectedRowsChanged (int lastRowSelected);
  14682. virtual void deleteKeyPressed (int lastRowSelected);
  14683. virtual void returnKeyPressed (int lastRowSelected);
  14684. virtual void listWasScrolled();
  14685. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14686. };
  14687. class JUCE_API TableListBox : public ListBox,
  14688. private ListBoxModel,
  14689. private TableHeaderListener
  14690. {
  14691. public:
  14692. TableListBox (const String& componentName,
  14693. TableListBoxModel* const model);
  14694. ~TableListBox();
  14695. void setModel (TableListBoxModel* const newModel);
  14696. TableListBoxModel* getModel() const { return model; }
  14697. TableHeaderComponent* getHeader() const { return header; }
  14698. void setHeaderHeight (const int newHeight);
  14699. int getHeaderHeight() const;
  14700. void autoSizeColumn (const int columnId);
  14701. void autoSizeAllColumns();
  14702. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14703. bool isAutoSizeMenuOptionShown() const;
  14704. const Rectangle<int> getCellPosition (const int columnId,
  14705. const int rowNumber,
  14706. const bool relativeToComponentTopLeft) const;
  14707. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14708. int getNumRows();
  14709. void paintListBoxItem (int, Graphics&, int, int, bool);
  14710. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14711. void selectedRowsChanged (int lastRowSelected);
  14712. void deleteKeyPressed (int currentSelectedRow);
  14713. void returnKeyPressed (int currentSelectedRow);
  14714. void backgroundClicked();
  14715. void listWasScrolled();
  14716. void tableColumnsChanged (TableHeaderComponent*);
  14717. void tableColumnsResized (TableHeaderComponent*);
  14718. void tableSortOrderChanged (TableHeaderComponent*);
  14719. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14720. void resized();
  14721. juce_UseDebuggingNewOperator
  14722. private:
  14723. TableHeaderComponent* header;
  14724. TableListBoxModel* model;
  14725. int columnIdNowBeingDragged;
  14726. bool autoSizeOptionsShown;
  14727. void updateColumnComponents() const;
  14728. TableListBox (const TableListBox&);
  14729. TableListBox& operator= (const TableListBox&);
  14730. };
  14731. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14732. /*** End of inlined file: juce_TableListBox.h ***/
  14733. #endif
  14734. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14735. #endif
  14736. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14737. #endif
  14738. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14739. #endif
  14740. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14741. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14742. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14743. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14744. class JUCE_API ToolbarItemFactory
  14745. {
  14746. public:
  14747. ToolbarItemFactory();
  14748. virtual ~ToolbarItemFactory();
  14749. enum SpecialItemIds
  14750. {
  14751. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14752. can be placed between sets of items to break them into groups. */
  14753. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14754. items.*/
  14755. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14756. either side of it, filling any available space. */
  14757. };
  14758. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14759. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14760. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14761. };
  14762. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14763. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14764. #endif
  14765. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14766. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  14767. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14768. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14769. class JUCE_API ToolbarItemPalette : public Component,
  14770. public DragAndDropContainer
  14771. {
  14772. public:
  14773. ToolbarItemPalette (ToolbarItemFactory& factory,
  14774. Toolbar* const toolbar);
  14775. ~ToolbarItemPalette();
  14776. void resized();
  14777. juce_UseDebuggingNewOperator
  14778. private:
  14779. ToolbarItemFactory& factory;
  14780. Toolbar* toolbar;
  14781. Viewport* viewport;
  14782. friend class Toolbar;
  14783. void replaceComponent (ToolbarItemComponent* const comp);
  14784. ToolbarItemPalette (const ToolbarItemPalette&);
  14785. ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14786. };
  14787. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14788. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  14789. #endif
  14790. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14791. /*** Start of inlined file: juce_TreeView.h ***/
  14792. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14793. #define __JUCE_TREEVIEW_JUCEHEADER__
  14794. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  14795. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14796. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14797. class JUCE_API FileDragAndDropTarget
  14798. {
  14799. public:
  14800. virtual ~FileDragAndDropTarget() {}
  14801. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14802. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14803. virtual void fileDragMove (const StringArray& files, int x, int y);
  14804. virtual void fileDragExit (const StringArray& files);
  14805. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14806. };
  14807. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14808. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  14809. class TreeView;
  14810. class JUCE_API TreeViewItem
  14811. {
  14812. public:
  14813. TreeViewItem();
  14814. virtual ~TreeViewItem();
  14815. int getNumSubItems() const throw();
  14816. TreeViewItem* getSubItem (const int index) const throw();
  14817. void clearSubItems();
  14818. void addSubItem (TreeViewItem* const newItem,
  14819. const int insertPosition = -1);
  14820. void removeSubItem (const int index,
  14821. const bool deleteItem = true);
  14822. TreeView* getOwnerView() const throw() { return ownerView; }
  14823. TreeViewItem* getParentItem() const throw() { return parentItem; }
  14824. bool isOpen() const throw();
  14825. void setOpen (const bool shouldBeOpen);
  14826. bool isSelected() const throw();
  14827. void setSelected (const bool shouldBeSelected,
  14828. const bool deselectOtherItemsFirst);
  14829. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  14830. void treeHasChanged() const throw();
  14831. void repaintItem() const;
  14832. int getRowNumberInTree() const throw();
  14833. bool areAllParentsOpen() const throw();
  14834. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  14835. virtual bool mightContainSubItems() = 0;
  14836. virtual const String getUniqueName() const;
  14837. virtual void itemOpennessChanged (bool isNowOpen);
  14838. virtual int getItemWidth() const { return -1; }
  14839. virtual int getItemHeight() const { return 20; }
  14840. virtual bool canBeSelected() const { return true; }
  14841. virtual Component* createItemComponent() { return 0; }
  14842. virtual void paintItem (Graphics& g, int width, int height);
  14843. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  14844. virtual void itemClicked (const MouseEvent& e);
  14845. virtual void itemDoubleClicked (const MouseEvent& e);
  14846. virtual void itemSelectionChanged (bool isNowSelected);
  14847. virtual const String getTooltip();
  14848. virtual const String getDragSourceDescription();
  14849. virtual bool isInterestedInFileDrag (const StringArray& files);
  14850. virtual void filesDropped (const StringArray& files, int insertIndex);
  14851. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14852. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  14853. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  14854. XmlElement* getOpennessState() const throw();
  14855. void restoreOpennessState (const XmlElement& xml) throw();
  14856. int getIndexInParent() const throw();
  14857. bool isLastOfSiblings() const throw();
  14858. const String getItemIdentifierString() const;
  14859. juce_UseDebuggingNewOperator
  14860. private:
  14861. TreeView* ownerView;
  14862. TreeViewItem* parentItem;
  14863. OwnedArray <TreeViewItem> subItems;
  14864. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  14865. int uid;
  14866. bool selected : 1;
  14867. bool redrawNeeded : 1;
  14868. bool drawLinesInside : 1;
  14869. bool drawsInLeftMargin : 1;
  14870. unsigned int openness : 2;
  14871. friend class TreeView;
  14872. friend class TreeViewContentComponent;
  14873. void updatePositions (int newY);
  14874. int getIndentX() const throw();
  14875. void setOwnerView (TreeView* const newOwner) throw();
  14876. void paintRecursively (Graphics& g, int width);
  14877. TreeViewItem* getTopLevelItem() throw();
  14878. TreeViewItem* findItemRecursively (int y) throw();
  14879. TreeViewItem* getDeepestOpenParentItem() throw();
  14880. int getNumRows() const throw();
  14881. TreeViewItem* getItemOnRow (int index) throw();
  14882. void deselectAllRecursively();
  14883. int countSelectedItemsRecursively() const throw();
  14884. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  14885. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  14886. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  14887. TreeViewItem (const TreeViewItem&);
  14888. TreeViewItem& operator= (const TreeViewItem&);
  14889. };
  14890. class JUCE_API TreeView : public Component,
  14891. public SettableTooltipClient,
  14892. public FileDragAndDropTarget,
  14893. public DragAndDropTarget,
  14894. private AsyncUpdater
  14895. {
  14896. public:
  14897. TreeView (const String& componentName = String::empty);
  14898. ~TreeView();
  14899. void setRootItem (TreeViewItem* const newRootItem);
  14900. TreeViewItem* getRootItem() const throw() { return rootItem; }
  14901. void deleteRootItem();
  14902. void setRootItemVisible (const bool shouldBeVisible);
  14903. bool isRootItemVisible() const throw() { return rootItemVisible; }
  14904. void setDefaultOpenness (const bool isOpenByDefault);
  14905. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  14906. void setMultiSelectEnabled (const bool canMultiSelect);
  14907. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  14908. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  14909. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  14910. void clearSelectedItems();
  14911. int getNumSelectedItems() const throw();
  14912. TreeViewItem* getSelectedItem (const int index) const throw();
  14913. int getNumRowsInTree() const;
  14914. TreeViewItem* getItemOnRow (int index) const;
  14915. TreeViewItem* getItemAt (int yPosition) const throw();
  14916. void scrollToKeepItemVisible (TreeViewItem* item);
  14917. Viewport* getViewport() const throw() { return viewport; }
  14918. int getIndentSize() const throw() { return indentSize; }
  14919. void setIndentSize (const int newIndentSize);
  14920. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  14921. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  14922. void restoreOpennessState (const XmlElement& newState);
  14923. enum ColourIds
  14924. {
  14925. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  14926. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  14927. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  14928. };
  14929. void paint (Graphics& g);
  14930. void resized();
  14931. bool keyPressed (const KeyPress& key);
  14932. void colourChanged();
  14933. void enablementChanged();
  14934. bool isInterestedInFileDrag (const StringArray& files);
  14935. void fileDragEnter (const StringArray& files, int x, int y);
  14936. void fileDragMove (const StringArray& files, int x, int y);
  14937. void fileDragExit (const StringArray& files);
  14938. void filesDropped (const StringArray& files, int x, int y);
  14939. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14940. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14941. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14942. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  14943. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14944. juce_UseDebuggingNewOperator
  14945. private:
  14946. friend class TreeViewItem;
  14947. friend class TreeViewContentComponent;
  14948. Viewport* viewport;
  14949. CriticalSection nodeAlterationLock;
  14950. TreeViewItem* rootItem;
  14951. Component* dragInsertPointHighlight;
  14952. Component* dragTargetGroupHighlight;
  14953. int indentSize;
  14954. bool defaultOpenness : 1;
  14955. bool needsRecalculating : 1;
  14956. bool rootItemVisible : 1;
  14957. bool multiSelectEnabled : 1;
  14958. bool openCloseButtonsVisible : 1;
  14959. void itemsChanged() throw();
  14960. void handleAsyncUpdate();
  14961. void moveSelectedRow (int delta);
  14962. void updateButtonUnderMouse (const MouseEvent& e);
  14963. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  14964. void hideDragHighlight() throw();
  14965. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14966. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14967. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  14968. const StringArray& files, const String& sourceDescription,
  14969. Component* sourceComponent) const throw();
  14970. TreeView (const TreeView&);
  14971. TreeView& operator= (const TreeView&);
  14972. };
  14973. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  14974. /*** End of inlined file: juce_TreeView.h ***/
  14975. #endif
  14976. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14977. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  14978. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14979. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14980. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  14981. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14982. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14983. /*** Start of inlined file: juce_FileFilter.h ***/
  14984. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  14985. #define __JUCE_FILEFILTER_JUCEHEADER__
  14986. class JUCE_API FileFilter
  14987. {
  14988. public:
  14989. FileFilter (const String& filterDescription);
  14990. virtual ~FileFilter();
  14991. const String& getDescription() const throw();
  14992. virtual bool isFileSuitable (const File& file) const = 0;
  14993. virtual bool isDirectorySuitable (const File& file) const = 0;
  14994. protected:
  14995. String description;
  14996. };
  14997. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  14998. /*** End of inlined file: juce_FileFilter.h ***/
  14999. /*** Start of inlined file: juce_Image.h ***/
  15000. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15001. #define __JUCE_IMAGE_JUCEHEADER__
  15002. class JUCE_API Image
  15003. {
  15004. public:
  15005. enum PixelFormat
  15006. {
  15007. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15008. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15009. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15010. };
  15011. Image (const PixelFormat format,
  15012. const int imageWidth,
  15013. const int imageHeight,
  15014. const bool clearImage);
  15015. Image (const Image& other);
  15016. virtual ~Image();
  15017. static Image* createNativeImage (const PixelFormat format,
  15018. const int imageWidth,
  15019. const int imageHeight,
  15020. const bool clearImage);
  15021. int getWidth() const throw() { return imageWidth; }
  15022. int getHeight() const throw() { return imageHeight; }
  15023. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15024. PixelFormat getFormat() const throw() { return format; }
  15025. bool isARGB() const throw() { return format == ARGB; }
  15026. bool isRGB() const throw() { return format == RGB; }
  15027. bool hasAlphaChannel() const throw() { return format != RGB; }
  15028. virtual void clear (int x, int y, int w, int h,
  15029. const Colour& colourToClearTo = Colour (0x00000000));
  15030. virtual Image* createCopy (int newWidth = -1,
  15031. int newHeight = -1,
  15032. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15033. virtual Image* createCopyOfAlphaChannel() const;
  15034. virtual const Colour getPixelAt (const int x, const int y) const;
  15035. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  15036. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  15037. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  15038. virtual void desaturate();
  15039. class BitmapData
  15040. {
  15041. public:
  15042. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  15043. BitmapData (const Image& image, int x, int y, int w, int h);
  15044. ~BitmapData();
  15045. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  15046. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  15047. uint8* data;
  15048. int lineStride, pixelStride, width, height;
  15049. private:
  15050. BitmapData (const BitmapData&);
  15051. BitmapData& operator= (const BitmapData&);
  15052. };
  15053. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15054. const uint8* sourcePixelData, int sourceLineStride);
  15055. virtual void moveImageSection (int destX, int destY,
  15056. int sourceX, int sourceY,
  15057. int width, int height);
  15058. void createSolidAreaMask (RectangleList& result,
  15059. const float alphaThreshold = 0.5f) const;
  15060. juce_UseDebuggingNewOperator
  15061. virtual LowLevelGraphicsContext* createLowLevelContext();
  15062. protected:
  15063. friend class BitmapData;
  15064. const PixelFormat format;
  15065. const int imageWidth, imageHeight;
  15066. Image (const PixelFormat format,
  15067. const int imageWidth,
  15068. const int imageHeight);
  15069. int pixelStride, lineStride;
  15070. HeapBlock <uint8> imageDataAllocated;
  15071. uint8* imageData;
  15072. private:
  15073. Image& operator= (const Image&);
  15074. };
  15075. #endif // __JUCE_IMAGE_JUCEHEADER__
  15076. /*** End of inlined file: juce_Image.h ***/
  15077. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15078. public TimeSliceClient
  15079. {
  15080. public:
  15081. DirectoryContentsList (const FileFilter* const fileFilter,
  15082. TimeSliceThread& threadToUse);
  15083. ~DirectoryContentsList();
  15084. void setDirectory (const File& directory,
  15085. const bool includeDirectories,
  15086. const bool includeFiles);
  15087. const File& getDirectory() const;
  15088. void clear();
  15089. void refresh();
  15090. bool isStillLoading() const;
  15091. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15092. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15093. struct FileInfo
  15094. {
  15095. String filename;
  15096. int64 fileSize;
  15097. Time modificationTime;
  15098. Time creationTime;
  15099. bool isDirectory;
  15100. bool isReadOnly;
  15101. };
  15102. int getNumFiles() const;
  15103. bool getFileInfo (const int index,
  15104. FileInfo& resultInfo) const;
  15105. const File getFile (const int index) const;
  15106. const FileFilter* getFilter() const { return fileFilter; }
  15107. bool useTimeSlice();
  15108. TimeSliceThread& getTimeSliceThread() { return thread; }
  15109. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15110. const DirectoryContentsList::FileInfo* const second);
  15111. juce_UseDebuggingNewOperator
  15112. private:
  15113. File root;
  15114. const FileFilter* fileFilter;
  15115. TimeSliceThread& thread;
  15116. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15117. CriticalSection fileListLock;
  15118. OwnedArray <FileInfo> files;
  15119. void* volatile fileFindHandle;
  15120. bool volatile shouldStop;
  15121. void changed();
  15122. bool checkNextFile (bool& hasChanged);
  15123. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15124. const int64 fileSize, const Time& modTime,
  15125. const Time& creationTime, const bool isReadOnly);
  15126. DirectoryContentsList (const DirectoryContentsList&);
  15127. DirectoryContentsList& operator= (const DirectoryContentsList&);
  15128. };
  15129. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15130. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15131. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15132. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15133. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15134. class JUCE_API FileBrowserListener
  15135. {
  15136. public:
  15137. virtual ~FileBrowserListener();
  15138. virtual void selectionChanged() = 0;
  15139. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15140. virtual void fileDoubleClicked (const File& file) = 0;
  15141. };
  15142. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15143. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15144. class JUCE_API DirectoryContentsDisplayComponent
  15145. {
  15146. public:
  15147. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15148. virtual ~DirectoryContentsDisplayComponent();
  15149. virtual int getNumSelectedFiles() const = 0;
  15150. virtual const File getSelectedFile (int index) const = 0;
  15151. virtual void scrollToTop() = 0;
  15152. void addListener (FileBrowserListener* const listener) throw();
  15153. void removeListener (FileBrowserListener* const listener) throw();
  15154. enum ColourIds
  15155. {
  15156. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15157. textColourId = 0x1000541, /**< The colour for the text. */
  15158. };
  15159. void sendSelectionChangeMessage();
  15160. void sendDoubleClickMessage (const File& file);
  15161. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15162. juce_UseDebuggingNewOperator
  15163. protected:
  15164. DirectoryContentsList& fileList;
  15165. SortedSet <void*> listeners;
  15166. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15167. DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15168. };
  15169. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15170. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15171. #endif
  15172. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15173. #endif
  15174. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15175. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15176. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15177. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15178. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15179. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15180. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15181. class JUCE_API FilePreviewComponent : public Component
  15182. {
  15183. public:
  15184. FilePreviewComponent();
  15185. ~FilePreviewComponent();
  15186. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15187. juce_UseDebuggingNewOperator
  15188. private:
  15189. FilePreviewComponent (const FilePreviewComponent&);
  15190. FilePreviewComponent& operator= (const FilePreviewComponent&);
  15191. };
  15192. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15193. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15194. class JUCE_API FileBrowserComponent : public Component,
  15195. public ChangeBroadcaster,
  15196. private FileBrowserListener,
  15197. private TextEditorListener,
  15198. private ButtonListener,
  15199. private ComboBoxListener,
  15200. private FileFilter
  15201. {
  15202. public:
  15203. enum FileChooserFlags
  15204. {
  15205. openMode = 1, /**< specifies that the component should allow the user to
  15206. choose an existing file with the intention of opening it. */
  15207. saveMode = 2, /**< specifies that the component should allow the user to specify
  15208. the name of a file that will be used to save something. */
  15209. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15210. conjunction with canSelectDirectories). */
  15211. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15212. conjuction with canSelectFiles). */
  15213. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15214. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15215. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15216. };
  15217. FileBrowserComponent (int flags,
  15218. const File& initialFileOrDirectory,
  15219. const FileFilter* fileFilter,
  15220. FilePreviewComponent* previewComp);
  15221. ~FileBrowserComponent();
  15222. int getNumSelectedFiles() const throw();
  15223. const File getSelectedFile (int index) const throw();
  15224. bool currentFileIsValid() const;
  15225. const File getHighlightedFile() const throw();
  15226. const File getRoot() const;
  15227. void setRoot (const File& newRootDirectory);
  15228. void goUp();
  15229. void refresh();
  15230. virtual const String getActionVerb() const;
  15231. bool isSaveMode() const throw();
  15232. void addListener (FileBrowserListener* const listener) throw();
  15233. void removeListener (FileBrowserListener* const listener) throw();
  15234. void resized();
  15235. void buttonClicked (Button* b);
  15236. void comboBoxChanged (ComboBox*);
  15237. void textEditorTextChanged (TextEditor& editor);
  15238. void textEditorReturnKeyPressed (TextEditor& editor);
  15239. void textEditorEscapeKeyPressed (TextEditor& editor);
  15240. void textEditorFocusLost (TextEditor& editor);
  15241. bool keyPressed (const KeyPress& key);
  15242. void selectionChanged();
  15243. void fileClicked (const File& f, const MouseEvent& e);
  15244. void fileDoubleClicked (const File& f);
  15245. bool isFileSuitable (const File& file) const;
  15246. bool isDirectorySuitable (const File&) const;
  15247. FilePreviewComponent* getPreviewComponent() const throw();
  15248. juce_UseDebuggingNewOperator
  15249. protected:
  15250. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15251. private:
  15252. ScopedPointer <DirectoryContentsList> fileList;
  15253. const FileFilter* fileFilter;
  15254. int flags;
  15255. File currentRoot;
  15256. Array<File> chosenFiles;
  15257. SortedSet <void*> listeners;
  15258. DirectoryContentsDisplayComponent* fileListComponent;
  15259. FilePreviewComponent* previewComp;
  15260. ComboBox* currentPathBox;
  15261. TextEditor* filenameBox;
  15262. Button* goUpButton;
  15263. TimeSliceThread thread;
  15264. void sendListenerChangeMessage();
  15265. bool isFileOrDirSuitable (const File& f) const;
  15266. FileBrowserComponent (const FileBrowserComponent&);
  15267. FileBrowserComponent& operator= (const FileBrowserComponent&);
  15268. };
  15269. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15270. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15271. #endif
  15272. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15273. #endif
  15274. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15275. /*** Start of inlined file: juce_FileChooser.h ***/
  15276. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15277. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15278. class JUCE_API FileChooser
  15279. {
  15280. public:
  15281. FileChooser (const String& dialogBoxTitle,
  15282. const File& initialFileOrDirectory = File::nonexistent,
  15283. const String& filePatternsAllowed = String::empty,
  15284. const bool useOSNativeDialogBox = true);
  15285. ~FileChooser();
  15286. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15287. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15288. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15289. bool browseForDirectory();
  15290. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15291. const File getResult() const;
  15292. const Array<File>& getResults() const;
  15293. juce_UseDebuggingNewOperator
  15294. private:
  15295. String title, filters;
  15296. File startingFile;
  15297. Array<File> results;
  15298. bool useNativeDialogBox;
  15299. bool showDialog (const bool selectsDirectories,
  15300. const bool selectsFiles,
  15301. const bool isSave,
  15302. const bool warnAboutOverwritingExistingFiles,
  15303. const bool selectMultipleFiles,
  15304. FilePreviewComponent* const previewComponent);
  15305. static void showPlatformDialog (Array<File>& results,
  15306. const String& title,
  15307. const File& file,
  15308. const String& filters,
  15309. bool selectsDirectories,
  15310. bool selectsFiles,
  15311. bool isSave,
  15312. bool warnAboutOverwritingExistingFiles,
  15313. bool selectMultipleFiles,
  15314. FilePreviewComponent* previewComponent);
  15315. };
  15316. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15317. /*** End of inlined file: juce_FileChooser.h ***/
  15318. #endif
  15319. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15320. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15321. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15322. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15323. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15324. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15325. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15326. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15327. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15328. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15329. /*** Start of inlined file: juce_DropShadower.h ***/
  15330. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15331. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15332. class JUCE_API DropShadower : public ComponentListener
  15333. {
  15334. public:
  15335. DropShadower (const float alpha = 0.5f,
  15336. const int xOffset = 1,
  15337. const int yOffset = 5,
  15338. const float blurRadius = 10.0f);
  15339. virtual ~DropShadower();
  15340. void setOwner (Component* componentToFollow);
  15341. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15342. void componentBroughtToFront (Component& component);
  15343. void componentChildrenChanged (Component& component);
  15344. void componentParentHierarchyChanged (Component& component);
  15345. void componentVisibilityChanged (Component& component);
  15346. juce_UseDebuggingNewOperator
  15347. private:
  15348. Component* owner;
  15349. int numShadows;
  15350. Component* shadowWindows[4];
  15351. Image* shadowImageSections[12];
  15352. const int shadowEdge, xOffset, yOffset;
  15353. const float alpha, blurRadius;
  15354. bool inDestructor, reentrant;
  15355. void updateShadows();
  15356. void setShadowImage (Image* const src,
  15357. const int num,
  15358. const int w, const int h,
  15359. const int sx, const int sy);
  15360. void bringShadowWindowsToFront();
  15361. void deleteShadowWindows();
  15362. DropShadower (const DropShadower&);
  15363. DropShadower& operator= (const DropShadower&);
  15364. };
  15365. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15366. /*** End of inlined file: juce_DropShadower.h ***/
  15367. class JUCE_API TopLevelWindow : public Component
  15368. {
  15369. public:
  15370. TopLevelWindow (const String& name,
  15371. const bool addToDesktop);
  15372. ~TopLevelWindow();
  15373. bool isActiveWindow() const throw() { return windowIsActive_; }
  15374. void centreAroundComponent (Component* componentToCentreAround,
  15375. const int width, const int height);
  15376. void setDropShadowEnabled (const bool useShadow);
  15377. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15378. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15379. static int getNumTopLevelWindows() throw();
  15380. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15381. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15382. juce_UseDebuggingNewOperator
  15383. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15384. protected:
  15385. virtual void activeWindowStatusChanged();
  15386. void focusOfChildComponentChanged (FocusChangeType cause);
  15387. void parentHierarchyChanged();
  15388. void visibilityChanged();
  15389. virtual int getDesktopWindowStyleFlags() const;
  15390. void recreateDesktopWindow();
  15391. private:
  15392. friend class TopLevelWindowManager;
  15393. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15394. ScopedPointer <DropShadower> shadower;
  15395. void setWindowActive (const bool isNowActive) throw();
  15396. TopLevelWindow (const TopLevelWindow&);
  15397. TopLevelWindow& operator= (const TopLevelWindow&);
  15398. };
  15399. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15400. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15401. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15402. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15403. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15404. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15405. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15406. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15407. class JUCE_API ComponentBoundsConstrainer
  15408. {
  15409. public:
  15410. ComponentBoundsConstrainer() throw();
  15411. virtual ~ComponentBoundsConstrainer();
  15412. void setMinimumWidth (const int minimumWidth) throw();
  15413. int getMinimumWidth() const throw() { return minW; }
  15414. void setMaximumWidth (const int maximumWidth) throw();
  15415. int getMaximumWidth() const throw() { return maxW; }
  15416. void setMinimumHeight (const int minimumHeight) throw();
  15417. int getMinimumHeight() const throw() { return minH; }
  15418. void setMaximumHeight (const int maximumHeight) throw();
  15419. int getMaximumHeight() const throw() { return maxH; }
  15420. void setMinimumSize (const int minimumWidth,
  15421. const int minimumHeight) throw();
  15422. void setMaximumSize (const int maximumWidth,
  15423. const int maximumHeight) throw();
  15424. void setSizeLimits (const int minimumWidth,
  15425. const int minimumHeight,
  15426. const int maximumWidth,
  15427. const int maximumHeight) throw();
  15428. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15429. const int minimumWhenOffTheLeft,
  15430. const int minimumWhenOffTheBottom,
  15431. const int minimumWhenOffTheRight) throw();
  15432. void setFixedAspectRatio (const double widthOverHeight) throw();
  15433. double getFixedAspectRatio() const throw();
  15434. virtual void checkBounds (Rectangle<int>& bounds,
  15435. const Rectangle<int>& previousBounds,
  15436. const Rectangle<int>& limits,
  15437. const bool isStretchingTop,
  15438. const bool isStretchingLeft,
  15439. const bool isStretchingBottom,
  15440. const bool isStretchingRight);
  15441. virtual void resizeStart();
  15442. virtual void resizeEnd();
  15443. void setBoundsForComponent (Component* const component,
  15444. const Rectangle<int>& bounds,
  15445. const bool isStretchingTop,
  15446. const bool isStretchingLeft,
  15447. const bool isStretchingBottom,
  15448. const bool isStretchingRight);
  15449. void checkComponentBounds (Component* component);
  15450. virtual void applyBoundsToComponent (Component* component,
  15451. const Rectangle<int>& bounds);
  15452. juce_UseDebuggingNewOperator
  15453. private:
  15454. int minW, maxW, minH, maxH;
  15455. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15456. double aspectRatio;
  15457. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15458. ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15459. };
  15460. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15461. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15462. class JUCE_API ComponentDragger
  15463. {
  15464. public:
  15465. ComponentDragger();
  15466. virtual ~ComponentDragger();
  15467. void startDraggingComponent (Component* const componentToDrag,
  15468. ComponentBoundsConstrainer* constrainer);
  15469. void dragComponent (Component* const componentToDrag,
  15470. const MouseEvent& e);
  15471. juce_UseDebuggingNewOperator
  15472. private:
  15473. ComponentBoundsConstrainer* constrainer;
  15474. Point<int> originalPos;
  15475. };
  15476. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15477. /*** End of inlined file: juce_ComponentDragger.h ***/
  15478. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15479. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15480. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15481. class JUCE_API ResizableBorderComponent : public Component
  15482. {
  15483. public:
  15484. ResizableBorderComponent (Component* const componentToResize,
  15485. ComponentBoundsConstrainer* const constrainer);
  15486. ~ResizableBorderComponent();
  15487. void setBorderThickness (const BorderSize& newBorderSize) throw();
  15488. const BorderSize getBorderThickness() const throw();
  15489. juce_UseDebuggingNewOperator
  15490. protected:
  15491. void paint (Graphics& g);
  15492. void mouseEnter (const MouseEvent& e);
  15493. void mouseMove (const MouseEvent& e);
  15494. void mouseDown (const MouseEvent& e);
  15495. void mouseDrag (const MouseEvent& e);
  15496. void mouseUp (const MouseEvent& e);
  15497. bool hitTest (int x, int y);
  15498. private:
  15499. Component* const component;
  15500. ComponentBoundsConstrainer* constrainer;
  15501. BorderSize borderSize;
  15502. int originalX, originalY, originalW, originalH;
  15503. int mouseZone;
  15504. void updateMouseZone (const MouseEvent& e) throw();
  15505. ResizableBorderComponent (const ResizableBorderComponent&);
  15506. ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15507. };
  15508. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15509. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15510. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15511. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15512. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15513. class JUCE_API ResizableCornerComponent : public Component
  15514. {
  15515. public:
  15516. ResizableCornerComponent (Component* const componentToResize,
  15517. ComponentBoundsConstrainer* const constrainer);
  15518. ~ResizableCornerComponent();
  15519. juce_UseDebuggingNewOperator
  15520. protected:
  15521. void paint (Graphics& g);
  15522. void mouseDown (const MouseEvent& e);
  15523. void mouseDrag (const MouseEvent& e);
  15524. void mouseUp (const MouseEvent& e);
  15525. bool hitTest (int x, int y);
  15526. private:
  15527. Component* const component;
  15528. ComponentBoundsConstrainer* constrainer;
  15529. int originalX, originalY, originalW, originalH;
  15530. ResizableCornerComponent (const ResizableCornerComponent&);
  15531. ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15532. };
  15533. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15534. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15535. class JUCE_API ResizableWindow : public TopLevelWindow
  15536. {
  15537. public:
  15538. ResizableWindow (const String& name,
  15539. const bool addToDesktop);
  15540. ResizableWindow (const String& name,
  15541. const Colour& backgroundColour,
  15542. const bool addToDesktop);
  15543. ~ResizableWindow();
  15544. const Colour getBackgroundColour() const throw();
  15545. void setBackgroundColour (const Colour& newColour);
  15546. void setResizable (const bool shouldBeResizable,
  15547. const bool useBottomRightCornerResizer);
  15548. bool isResizable() const throw();
  15549. void setResizeLimits (const int newMinimumWidth,
  15550. const int newMinimumHeight,
  15551. const int newMaximumWidth,
  15552. const int newMaximumHeight) throw();
  15553. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15554. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15555. void setBoundsConstrained (const Rectangle<int>& bounds);
  15556. bool isFullScreen() const;
  15557. void setFullScreen (const bool shouldBeFullScreen);
  15558. bool isMinimised() const;
  15559. void setMinimised (const bool shouldMinimise);
  15560. const String getWindowStateAsString();
  15561. bool restoreWindowStateFromString (const String& previousState);
  15562. Component* getContentComponent() const throw() { return contentComponent; }
  15563. void setContentComponent (Component* const newContentComponent,
  15564. const bool deleteOldOne = true,
  15565. const bool resizeToFit = false);
  15566. void setContentComponentSize (int width, int height);
  15567. enum ColourIds
  15568. {
  15569. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15570. };
  15571. juce_UseDebuggingNewOperator
  15572. protected:
  15573. void paint (Graphics& g);
  15574. void moved();
  15575. void resized();
  15576. void mouseDown (const MouseEvent& e);
  15577. void mouseDrag (const MouseEvent& e);
  15578. void lookAndFeelChanged();
  15579. void childBoundsChanged (Component* child);
  15580. void parentSizeChanged();
  15581. void visibilityChanged();
  15582. void activeWindowStatusChanged();
  15583. int getDesktopWindowStyleFlags() const;
  15584. virtual const BorderSize getBorderThickness();
  15585. virtual const BorderSize getContentComponentBorder();
  15586. #ifdef JUCE_DEBUG
  15587. void addChildComponent (Component* const child, int zOrder = -1);
  15588. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15589. #endif
  15590. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15591. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15592. private:
  15593. ScopedPointer <Component> contentComponent;
  15594. bool resizeToFitContent, fullscreen;
  15595. ComponentDragger dragger;
  15596. Rectangle<int> lastNonFullScreenPos;
  15597. ComponentBoundsConstrainer defaultConstrainer;
  15598. ComponentBoundsConstrainer* constrainer;
  15599. #ifdef JUCE_DEBUG
  15600. bool hasBeenResized;
  15601. #endif
  15602. void updateLastPos();
  15603. ResizableWindow (const ResizableWindow&);
  15604. ResizableWindow& operator= (const ResizableWindow&);
  15605. // (xxx remove these eventually)
  15606. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15607. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15608. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15609. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15610. };
  15611. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15612. /*** End of inlined file: juce_ResizableWindow.h ***/
  15613. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15614. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15615. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15616. class JUCE_API PositionedGlyph
  15617. {
  15618. public:
  15619. juce_wchar getCharacter() const { return character; }
  15620. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15621. float getLeft() const { return x; }
  15622. float getRight() const { return x + w; }
  15623. float getBaselineY() const { return y; }
  15624. float getTop() const { return y - font.getAscent(); }
  15625. float getBottom() const { return y + font.getDescent(); }
  15626. void moveBy (const float deltaX,
  15627. const float deltaY);
  15628. void draw (const Graphics& g) const;
  15629. void draw (const Graphics& g, const AffineTransform& transform) const;
  15630. void createPath (Path& path) const;
  15631. bool hitTest (float x, float y) const;
  15632. juce_UseDebuggingNewOperator
  15633. private:
  15634. friend class GlyphArrangement;
  15635. float x, y, w;
  15636. Font font;
  15637. juce_wchar character;
  15638. int glyph;
  15639. PositionedGlyph();
  15640. };
  15641. class JUCE_API GlyphArrangement
  15642. {
  15643. public:
  15644. GlyphArrangement();
  15645. GlyphArrangement (const GlyphArrangement& other);
  15646. GlyphArrangement& operator= (const GlyphArrangement& other);
  15647. ~GlyphArrangement();
  15648. int getNumGlyphs() const { return glyphs.size(); }
  15649. PositionedGlyph& getGlyph (const int index) const;
  15650. void clear();
  15651. void addLineOfText (const Font& font,
  15652. const String& text,
  15653. const float x,
  15654. const float y);
  15655. void addCurtailedLineOfText (const Font& font,
  15656. const String& text,
  15657. float x,
  15658. const float y,
  15659. const float maxWidthPixels,
  15660. const bool useEllipsis);
  15661. void addJustifiedText (const Font& font,
  15662. const String& text,
  15663. float x, float y,
  15664. const float maxLineWidth,
  15665. const Justification& horizontalLayout);
  15666. void addFittedText (const Font& font,
  15667. const String& text,
  15668. const float x, const float y,
  15669. const float width, const float height,
  15670. const Justification& layout,
  15671. int maximumLinesToUse,
  15672. const float minimumHorizontalScale = 0.7f);
  15673. void addGlyphArrangement (const GlyphArrangement& other);
  15674. void draw (const Graphics& g) const;
  15675. void draw (const Graphics& g, const AffineTransform& transform) const;
  15676. void createPath (Path& path) const;
  15677. int findGlyphIndexAt (float x, float y) const;
  15678. void getBoundingBox (int startIndex,
  15679. int numGlyphs,
  15680. float& left,
  15681. float& top,
  15682. float& right,
  15683. float& bottom,
  15684. const bool includeWhitespace) const;
  15685. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15686. const float deltaX,
  15687. const float deltaY);
  15688. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15689. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15690. const float horizontalScaleFactor);
  15691. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15692. const float x,
  15693. const float y,
  15694. const float width,
  15695. const float height,
  15696. const Justification& justification);
  15697. juce_UseDebuggingNewOperator
  15698. private:
  15699. OwnedArray <PositionedGlyph> glyphs;
  15700. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15701. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15702. const Justification& justification, float minimumHorizontalScale);
  15703. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15704. };
  15705. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15706. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15707. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15708. public ButtonListener,
  15709. public FileBrowserListener
  15710. {
  15711. public:
  15712. FileChooserDialogBox (const String& title,
  15713. const String& instructions,
  15714. FileBrowserComponent& browserComponent,
  15715. const bool warnAboutOverwritingExistingFiles,
  15716. const Colour& backgroundColour);
  15717. ~FileChooserDialogBox();
  15718. bool show (int width = 0,int height = 0);
  15719. enum ColourIds
  15720. {
  15721. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15722. };
  15723. void buttonClicked (Button* button);
  15724. void closeButtonPressed();
  15725. void selectionChanged();
  15726. void fileClicked (const File& file, const MouseEvent& e);
  15727. void fileDoubleClicked (const File& file);
  15728. juce_UseDebuggingNewOperator
  15729. private:
  15730. class ContentComponent : public Component
  15731. {
  15732. public:
  15733. ContentComponent();
  15734. ~ContentComponent();
  15735. void paint (Graphics& g);
  15736. void resized();
  15737. String instructions;
  15738. GlyphArrangement text;
  15739. FileBrowserComponent* chooserComponent;
  15740. FilePreviewComponent* previewComponent;
  15741. TextButton* okButton;
  15742. TextButton* cancelButton;
  15743. };
  15744. ContentComponent* content;
  15745. const bool warnAboutOverwritingExistingFiles;
  15746. FileChooserDialogBox (const FileChooserDialogBox&);
  15747. FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15748. };
  15749. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15750. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15751. #endif
  15752. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15753. #endif
  15754. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15755. /*** Start of inlined file: juce_FileListComponent.h ***/
  15756. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15757. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15758. class JUCE_API FileListComponent : public ListBox,
  15759. public DirectoryContentsDisplayComponent,
  15760. private ListBoxModel,
  15761. private ChangeListener
  15762. {
  15763. public:
  15764. FileListComponent (DirectoryContentsList& listToShow);
  15765. ~FileListComponent();
  15766. int getNumSelectedFiles() const;
  15767. const File getSelectedFile (int index = 0) const;
  15768. void scrollToTop();
  15769. void changeListenerCallback (void*);
  15770. int getNumRows();
  15771. void paintListBoxItem (int, Graphics&, int, int, bool);
  15772. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15773. void selectedRowsChanged (int lastRowSelected);
  15774. void deleteKeyPressed (int currentSelectedRow);
  15775. void returnKeyPressed (int currentSelectedRow);
  15776. juce_UseDebuggingNewOperator
  15777. private:
  15778. FileListComponent (const FileListComponent&);
  15779. FileListComponent& operator= (const FileListComponent&);
  15780. File lastDirectory;
  15781. };
  15782. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15783. /*** End of inlined file: juce_FileListComponent.h ***/
  15784. #endif
  15785. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15786. /*** Start of inlined file: juce_FilenameComponent.h ***/
  15787. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15788. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15789. class FilenameComponent;
  15790. class JUCE_API FilenameComponentListener
  15791. {
  15792. public:
  15793. virtual ~FilenameComponentListener() {}
  15794. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15795. };
  15796. class JUCE_API FilenameComponent : public Component,
  15797. public SettableTooltipClient,
  15798. public FileDragAndDropTarget,
  15799. private AsyncUpdater,
  15800. private ButtonListener,
  15801. private ComboBoxListener
  15802. {
  15803. public:
  15804. FilenameComponent (const String& name,
  15805. const File& currentFile,
  15806. const bool canEditFilename,
  15807. const bool isDirectory,
  15808. const bool isForSaving,
  15809. const String& fileBrowserWildcard,
  15810. const String& enforcedSuffix,
  15811. const String& textWhenNothingSelected);
  15812. ~FilenameComponent();
  15813. const File getCurrentFile() const;
  15814. void setCurrentFile (File newFile,
  15815. const bool addToRecentlyUsedList,
  15816. const bool sendChangeNotification = true);
  15817. void setFilenameIsEditable (const bool shouldBeEditable);
  15818. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15819. const StringArray getRecentlyUsedFilenames() const;
  15820. void setRecentlyUsedFilenames (const StringArray& filenames);
  15821. void addRecentlyUsedFile (const File& file);
  15822. void setMaxNumberOfRecentFiles (const int newMaximum);
  15823. void setBrowseButtonText (const String& browseButtonText);
  15824. void addListener (FilenameComponentListener* const listener) throw();
  15825. void removeListener (FilenameComponentListener* const listener) throw();
  15826. void setTooltip (const String& newTooltip);
  15827. void paintOverChildren (Graphics& g);
  15828. void resized();
  15829. void lookAndFeelChanged();
  15830. bool isInterestedInFileDrag (const StringArray& files);
  15831. void filesDropped (const StringArray& files, int, int);
  15832. void fileDragEnter (const StringArray& files, int, int);
  15833. void fileDragExit (const StringArray& files);
  15834. juce_UseDebuggingNewOperator
  15835. private:
  15836. ComboBox* filenameBox;
  15837. String lastFilename;
  15838. Button* browseButton;
  15839. int maxRecentFiles;
  15840. bool isDir, isSaving, isFileDragOver;
  15841. String wildcard, enforcedSuffix, browseButtonText;
  15842. SortedSet <void*> listeners;
  15843. File defaultBrowseFile;
  15844. void comboBoxChanged (ComboBox*);
  15845. void buttonClicked (Button* button);
  15846. void handleAsyncUpdate();
  15847. FilenameComponent (const FilenameComponent&);
  15848. FilenameComponent& operator= (const FilenameComponent&);
  15849. };
  15850. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15851. /*** End of inlined file: juce_FilenameComponent.h ***/
  15852. #endif
  15853. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15854. #endif
  15855. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15856. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  15857. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15858. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15859. class JUCE_API FileSearchPathListComponent : public Component,
  15860. public SettableTooltipClient,
  15861. public FileDragAndDropTarget,
  15862. private ButtonListener,
  15863. private ListBoxModel
  15864. {
  15865. public:
  15866. FileSearchPathListComponent();
  15867. ~FileSearchPathListComponent();
  15868. const FileSearchPath& getPath() const throw() { return path; }
  15869. void setPath (const FileSearchPath& newPath);
  15870. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15871. enum ColourIds
  15872. {
  15873. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  15874. Make this transparent if you don't want the background to be filled. */
  15875. };
  15876. int getNumRows();
  15877. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  15878. void deleteKeyPressed (int lastRowSelected);
  15879. void returnKeyPressed (int lastRowSelected);
  15880. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  15881. void selectedRowsChanged (int lastRowSelected);
  15882. void resized();
  15883. void paint (Graphics& g);
  15884. bool isInterestedInFileDrag (const StringArray& files);
  15885. void filesDropped (const StringArray& files, int, int);
  15886. void buttonClicked (Button* button);
  15887. juce_UseDebuggingNewOperator
  15888. private:
  15889. FileSearchPath path;
  15890. File defaultBrowseTarget;
  15891. ListBox* listBox;
  15892. Button* addButton;
  15893. Button* removeButton;
  15894. Button* changeButton;
  15895. Button* upButton;
  15896. Button* downButton;
  15897. void changed() throw();
  15898. void updateButtons() throw();
  15899. FileSearchPathListComponent (const FileSearchPathListComponent&);
  15900. FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  15901. };
  15902. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15903. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  15904. #endif
  15905. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15906. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  15907. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15908. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15909. class JUCE_API FileTreeComponent : public TreeView,
  15910. public DirectoryContentsDisplayComponent
  15911. {
  15912. public:
  15913. FileTreeComponent (DirectoryContentsList& listToShow);
  15914. ~FileTreeComponent();
  15915. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  15916. const File getSelectedFile (int index = 0) const;
  15917. void scrollToTop();
  15918. void setDragAndDropDescription (const String& description) throw();
  15919. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  15920. juce_UseDebuggingNewOperator
  15921. private:
  15922. String dragAndDropDescription;
  15923. FileTreeComponent (const FileTreeComponent&);
  15924. FileTreeComponent& operator= (const FileTreeComponent&);
  15925. };
  15926. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15927. /*** End of inlined file: juce_FileTreeComponent.h ***/
  15928. #endif
  15929. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15930. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  15931. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15932. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15933. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  15934. private Timer
  15935. {
  15936. public:
  15937. ImagePreviewComponent();
  15938. ~ImagePreviewComponent();
  15939. void selectedFileChanged (const File& newSelectedFile);
  15940. void paint (Graphics& g);
  15941. void timerCallback();
  15942. juce_UseDebuggingNewOperator
  15943. private:
  15944. File fileToLoad;
  15945. ScopedPointer <Image> currentThumbnail;
  15946. String currentDetails;
  15947. void getThumbSize (int& w, int& h) const;
  15948. ImagePreviewComponent (const ImagePreviewComponent&);
  15949. ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  15950. };
  15951. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15952. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  15953. #endif
  15954. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15955. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  15956. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15957. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15958. class JUCE_API WildcardFileFilter : public FileFilter
  15959. {
  15960. public:
  15961. WildcardFileFilter (const String& fileWildcardPatterns,
  15962. const String& directoryWildcardPatterns,
  15963. const String& description);
  15964. ~WildcardFileFilter();
  15965. bool isFileSuitable (const File& file) const;
  15966. bool isDirectorySuitable (const File& file) const;
  15967. juce_UseDebuggingNewOperator
  15968. private:
  15969. StringArray fileWildcards, directoryWildcards;
  15970. static void parse (const String& pattern, StringArray& result) throw();
  15971. static bool match (const File& file, const StringArray& wildcards) throw();
  15972. };
  15973. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15974. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  15975. #endif
  15976. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  15977. #endif
  15978. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15979. /*** Start of inlined file: juce_ComponentDeletionWatcher.h ***/
  15980. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15981. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15982. class JUCE_API ComponentDeletionWatcher
  15983. {
  15984. public:
  15985. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  15986. ~ComponentDeletionWatcher() throw();
  15987. bool hasBeenDeleted() const throw();
  15988. const Component* getComponent() const throw();
  15989. juce_UseDebuggingNewOperator
  15990. private:
  15991. const Component* const componentToWatch;
  15992. const uint32 componentUID;
  15993. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  15994. ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  15995. };
  15996. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15997. /*** End of inlined file: juce_ComponentDeletionWatcher.h ***/
  15998. #endif
  15999. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16000. #endif
  16001. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16002. #endif
  16003. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16004. #endif
  16005. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16006. #endif
  16007. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16008. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16009. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16010. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16011. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16012. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16013. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16014. class JUCE_API KeyPressMappingSet : public KeyListener,
  16015. public ChangeBroadcaster,
  16016. public FocusChangeListener
  16017. {
  16018. public:
  16019. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16020. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16021. ~KeyPressMappingSet();
  16022. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16023. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16024. void addKeyPress (const CommandID commandID,
  16025. const KeyPress& newKeyPress,
  16026. int insertIndex = -1) throw();
  16027. void resetToDefaultMappings() throw();
  16028. void resetToDefaultMapping (const CommandID commandID) throw();
  16029. void clearAllKeyPresses() throw();
  16030. void clearAllKeyPresses (const CommandID commandID) throw();
  16031. void removeKeyPress (const CommandID commandID,
  16032. const int keyPressIndex) throw();
  16033. void removeKeyPress (const KeyPress& keypress) throw();
  16034. bool containsMapping (const CommandID commandID,
  16035. const KeyPress& keyPress) const throw();
  16036. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16037. bool restoreFromXml (const XmlElement& xmlVersion);
  16038. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16039. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16040. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16041. void globalFocusChanged (Component* focusedComponent);
  16042. juce_UseDebuggingNewOperator
  16043. private:
  16044. ApplicationCommandManager* commandManager;
  16045. struct CommandMapping
  16046. {
  16047. CommandID commandID;
  16048. Array <KeyPress> keypresses;
  16049. bool wantsKeyUpDownCallbacks;
  16050. };
  16051. OwnedArray <CommandMapping> mappings;
  16052. struct KeyPressTime
  16053. {
  16054. KeyPress key;
  16055. uint32 timeWhenPressed;
  16056. };
  16057. OwnedArray <KeyPressTime> keysDown;
  16058. void handleMessage (const Message& message);
  16059. void invokeCommand (const CommandID commandID,
  16060. const KeyPress& keyPress,
  16061. const bool isKeyDown,
  16062. const int millisecsSinceKeyPressed,
  16063. Component* const originatingComponent) const;
  16064. KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16065. };
  16066. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16067. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16068. class JUCE_API KeyMappingEditorComponent : public Component,
  16069. public TreeViewItem,
  16070. public ChangeListener,
  16071. private ButtonListener
  16072. {
  16073. public:
  16074. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16075. const bool showResetToDefaultButton);
  16076. virtual ~KeyMappingEditorComponent();
  16077. void setColours (const Colour& mainBackground,
  16078. const Colour& textColour);
  16079. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16080. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16081. virtual bool isCommandReadOnly (const CommandID commandID);
  16082. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16083. enum ColourIds
  16084. {
  16085. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16086. textColourId = 0x100ad01, /**< The colour for the text. */
  16087. };
  16088. void parentHierarchyChanged();
  16089. void resized();
  16090. void changeListenerCallback (void*);
  16091. bool mightContainSubItems();
  16092. const String getUniqueName() const;
  16093. void buttonClicked (Button* button);
  16094. juce_UseDebuggingNewOperator
  16095. private:
  16096. KeyPressMappingSet* mappings;
  16097. TreeView* tree;
  16098. friend class KeyMappingTreeViewItem;
  16099. friend class KeyCategoryTreeViewItem;
  16100. friend class KeyMappingItemComponent;
  16101. friend class KeyMappingChangeButton;
  16102. TextButton* resetButton;
  16103. void assignNewKey (const CommandID commandID, int index);
  16104. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16105. KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16106. };
  16107. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16108. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16109. #endif
  16110. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16111. #endif
  16112. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16113. #endif
  16114. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16115. #endif
  16116. #ifndef __JUCE_TEXTINPUTTARGET_JUCEHEADER__
  16117. #endif
  16118. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16119. #endif
  16120. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16121. #endif
  16122. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16123. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16124. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16125. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16126. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16127. {
  16128. public:
  16129. ComponentMovementWatcher (Component* const component);
  16130. ~ComponentMovementWatcher();
  16131. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16132. virtual void componentPeerChanged() = 0;
  16133. juce_UseDebuggingNewOperator
  16134. void componentParentHierarchyChanged (Component& component);
  16135. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16136. private:
  16137. Component::SafePointer<Component> component;
  16138. ComponentPeer* lastPeer;
  16139. VoidArray registeredParentComps;
  16140. bool reentrant;
  16141. Rectangle<int> lastBounds;
  16142. void unregister() throw();
  16143. void registerWithParentComps() throw();
  16144. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16145. ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16146. };
  16147. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16148. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16149. #endif
  16150. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16151. /*** Start of inlined file: juce_GroupComponent.h ***/
  16152. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16153. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16154. class JUCE_API GroupComponent : public Component
  16155. {
  16156. public:
  16157. GroupComponent (const String& componentName,
  16158. const String& labelText);
  16159. ~GroupComponent();
  16160. void setText (const String& newText) throw();
  16161. const String getText() const throw();
  16162. void setTextLabelPosition (const Justification& justification);
  16163. const Justification getTextLabelPosition() const throw() { return justification; }
  16164. enum ColourIds
  16165. {
  16166. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16167. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16168. };
  16169. void paint (Graphics& g);
  16170. void enablementChanged();
  16171. void colourChanged();
  16172. private:
  16173. String text;
  16174. Justification justification;
  16175. GroupComponent (const GroupComponent&);
  16176. GroupComponent& operator= (const GroupComponent&);
  16177. };
  16178. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16179. /*** End of inlined file: juce_GroupComponent.h ***/
  16180. #endif
  16181. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16182. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16183. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16184. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16185. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16186. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16187. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16188. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16189. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16190. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16191. class TabbedButtonBar;
  16192. class JUCE_API TabBarButton : public Button
  16193. {
  16194. public:
  16195. TabBarButton (const String& name,
  16196. TabbedButtonBar* const ownerBar,
  16197. const int tabIndex);
  16198. ~TabBarButton();
  16199. virtual int getBestTabLength (const int depth);
  16200. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16201. void clicked (const ModifierKeys& mods);
  16202. bool hitTest (int x, int y);
  16203. juce_UseDebuggingNewOperator
  16204. protected:
  16205. friend class TabbedButtonBar;
  16206. TabbedButtonBar* const owner;
  16207. int tabIndex, overlapPixels;
  16208. DropShadowEffect shadow;
  16209. void getActiveArea (int& x, int& y, int& w, int& h);
  16210. private:
  16211. TabBarButton (const TabBarButton&);
  16212. TabBarButton& operator= (const TabBarButton&);
  16213. };
  16214. class JUCE_API TabbedButtonBar : public Component,
  16215. public ChangeBroadcaster,
  16216. public ButtonListener
  16217. {
  16218. public:
  16219. enum Orientation
  16220. {
  16221. TabsAtTop,
  16222. TabsAtBottom,
  16223. TabsAtLeft,
  16224. TabsAtRight
  16225. };
  16226. TabbedButtonBar (const Orientation orientation);
  16227. ~TabbedButtonBar();
  16228. void setOrientation (const Orientation orientation);
  16229. Orientation getOrientation() const throw() { return orientation; }
  16230. void clearTabs();
  16231. void addTab (const String& tabName,
  16232. const Colour& tabBackgroundColour,
  16233. int insertIndex = -1);
  16234. void setTabName (const int tabIndex,
  16235. const String& newName);
  16236. void removeTab (const int tabIndex);
  16237. void moveTab (const int currentIndex,
  16238. const int newIndex);
  16239. int getNumTabs() const;
  16240. const StringArray getTabNames() const;
  16241. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16242. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16243. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16244. TabBarButton* getTabButton (const int index) const;
  16245. virtual void currentTabChanged (const int newCurrentTabIndex,
  16246. const String& newCurrentTabName);
  16247. virtual void popupMenuClickOnTab (const int tabIndex,
  16248. const String& tabName);
  16249. const Colour getTabBackgroundColour (const int tabIndex);
  16250. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16251. enum ColourIds
  16252. {
  16253. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16254. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16255. the look and feel will choose an appropriate colour. */
  16256. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16257. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16258. this isn't specified, the look and feel will choose an appropriate
  16259. colour. */
  16260. };
  16261. void resized();
  16262. void buttonClicked (Button* button);
  16263. void lookAndFeelChanged();
  16264. juce_UseDebuggingNewOperator
  16265. protected:
  16266. virtual TabBarButton* createTabButton (const String& tabName,
  16267. const int tabIndex);
  16268. private:
  16269. Orientation orientation;
  16270. StringArray tabs;
  16271. Array <Colour> tabColours;
  16272. int currentTabIndex;
  16273. Component* behindFrontTab;
  16274. Button* extraTabsButton;
  16275. TabbedButtonBar (const TabbedButtonBar&);
  16276. TabbedButtonBar& operator= (const TabbedButtonBar&);
  16277. };
  16278. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16279. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16280. class JUCE_API TabbedComponent : public Component
  16281. {
  16282. public:
  16283. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16284. ~TabbedComponent();
  16285. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16286. TabbedButtonBar::Orientation getOrientation() const throw();
  16287. void setTabBarDepth (const int newDepth);
  16288. int getTabBarDepth() const throw() { return tabDepth; }
  16289. void setOutline (const int newThickness);
  16290. void setIndent (const int indentThickness);
  16291. void clearTabs();
  16292. void addTab (const String& tabName,
  16293. const Colour& tabBackgroundColour,
  16294. Component* const contentComponent,
  16295. const bool deleteComponentWhenNotNeeded,
  16296. const int insertIndex = -1);
  16297. void setTabName (const int tabIndex,
  16298. const String& newName);
  16299. void removeTab (const int tabIndex);
  16300. int getNumTabs() const;
  16301. const StringArray getTabNames() const;
  16302. Component* getTabContentComponent (const int tabIndex) const throw();
  16303. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16304. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16305. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16306. int getCurrentTabIndex() const;
  16307. const String& getCurrentTabName() const;
  16308. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16309. virtual void currentTabChanged (const int newCurrentTabIndex,
  16310. const String& newCurrentTabName);
  16311. virtual void popupMenuClickOnTab (const int tabIndex,
  16312. const String& tabName);
  16313. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16314. enum ColourIds
  16315. {
  16316. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16317. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16318. (See setOutline) */
  16319. };
  16320. void paint (Graphics& g);
  16321. void resized();
  16322. void lookAndFeelChanged();
  16323. juce_UseDebuggingNewOperator
  16324. protected:
  16325. TabbedButtonBar* tabs;
  16326. virtual TabBarButton* createTabButton (const String& tabName,
  16327. const int tabIndex);
  16328. private:
  16329. Array <Component*> contentComponents;
  16330. Component* panelComponent;
  16331. int tabDepth;
  16332. int outlineThickness, edgeIndent;
  16333. friend class TabCompButtonBar;
  16334. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16335. TabbedComponent (const TabbedComponent&);
  16336. TabbedComponent& operator= (const TabbedComponent&);
  16337. };
  16338. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16339. /*** End of inlined file: juce_TabbedComponent.h ***/
  16340. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16341. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16342. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16343. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16344. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16345. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16346. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16347. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16348. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16349. class MenuBarModel;
  16350. class JUCE_API MenuBarModelListener
  16351. {
  16352. public:
  16353. virtual ~MenuBarModelListener() {}
  16354. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16355. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16356. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16357. };
  16358. class JUCE_API MenuBarModel : private AsyncUpdater,
  16359. private ApplicationCommandManagerListener
  16360. {
  16361. public:
  16362. MenuBarModel() throw();
  16363. virtual ~MenuBarModel();
  16364. void menuItemsChanged();
  16365. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16366. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16367. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16368. virtual const StringArray getMenuBarNames() = 0;
  16369. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16370. const String& menuName) = 0;
  16371. virtual void menuItemSelected (int menuItemID,
  16372. int topLevelMenuIndex) = 0;
  16373. #if JUCE_MAC || DOXYGEN
  16374. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16375. const PopupMenu* extraAppleMenuItems = 0);
  16376. static MenuBarModel* getMacMainMenu();
  16377. #endif
  16378. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16379. void applicationCommandListChanged();
  16380. void handleAsyncUpdate();
  16381. juce_UseDebuggingNewOperator
  16382. private:
  16383. ApplicationCommandManager* manager;
  16384. SortedSet <void*> listeners;
  16385. MenuBarModel (const MenuBarModel&);
  16386. MenuBarModel& operator= (const MenuBarModel&);
  16387. };
  16388. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16389. /*** End of inlined file: juce_MenuBarModel.h ***/
  16390. class JUCE_API MenuBarComponent : public Component,
  16391. private MenuBarModelListener,
  16392. private Timer
  16393. {
  16394. public:
  16395. MenuBarComponent (MenuBarModel* const model);
  16396. ~MenuBarComponent();
  16397. void setModel (MenuBarModel* const newModel);
  16398. void showMenu (const int menuIndex);
  16399. void paint (Graphics& g);
  16400. void resized();
  16401. void mouseEnter (const MouseEvent& e);
  16402. void mouseExit (const MouseEvent& e);
  16403. void mouseDown (const MouseEvent& e);
  16404. void mouseDrag (const MouseEvent& e);
  16405. void mouseUp (const MouseEvent& e);
  16406. void mouseMove (const MouseEvent& e);
  16407. void inputAttemptWhenModal();
  16408. void handleCommandMessage (int commandId);
  16409. bool keyPressed (const KeyPress& key);
  16410. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16411. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16412. const ApplicationCommandTarget::InvocationInfo& info);
  16413. juce_UseDebuggingNewOperator
  16414. private:
  16415. MenuBarModel* model;
  16416. StringArray menuNames;
  16417. Array <int> xPositions;
  16418. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16419. int lastMouseX, lastMouseY;
  16420. bool inModalState;
  16421. ScopedPointer <Component> currentPopup;
  16422. int getItemAt (int x, int y);
  16423. void updateItemUnderMouse (const int x, const int y);
  16424. void hideCurrentMenu();
  16425. void timerCallback();
  16426. void repaintMenuItem (int index);
  16427. MenuBarComponent (const MenuBarComponent&);
  16428. MenuBarComponent& operator= (const MenuBarComponent&);
  16429. };
  16430. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16431. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16432. class JUCE_API DocumentWindow : public ResizableWindow
  16433. {
  16434. public:
  16435. enum TitleBarButtons
  16436. {
  16437. minimiseButton = 1,
  16438. maximiseButton = 2,
  16439. closeButton = 4,
  16440. allButtons = 7
  16441. };
  16442. DocumentWindow (const String& name,
  16443. const Colour& backgroundColour,
  16444. const int requiredButtons,
  16445. const bool addToDesktop = true);
  16446. ~DocumentWindow();
  16447. void setName (const String& newName);
  16448. void setIcon (const Image* imageToUse);
  16449. void setTitleBarHeight (const int newHeight);
  16450. int getTitleBarHeight() const;
  16451. void setTitleBarButtonsRequired (const int requiredButtons,
  16452. const bool positionTitleBarButtonsOnLeft);
  16453. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16454. void setMenuBar (MenuBarModel* menuBarModel,
  16455. const int menuBarHeight = 0);
  16456. virtual void closeButtonPressed();
  16457. virtual void minimiseButtonPressed();
  16458. virtual void maximiseButtonPressed();
  16459. Button* getCloseButton() const throw();
  16460. Button* getMinimiseButton() const throw();
  16461. Button* getMaximiseButton() const throw();
  16462. enum ColourIds
  16463. {
  16464. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16465. and feel class how this is used. */
  16466. };
  16467. void paint (Graphics& g);
  16468. void resized();
  16469. void lookAndFeelChanged();
  16470. const BorderSize getBorderThickness();
  16471. const BorderSize getContentComponentBorder();
  16472. void mouseDoubleClick (const MouseEvent& e);
  16473. void userTriedToCloseWindow();
  16474. void activeWindowStatusChanged();
  16475. int getDesktopWindowStyleFlags() const;
  16476. void parentHierarchyChanged();
  16477. const Rectangle<int> getTitleBarArea();
  16478. juce_UseDebuggingNewOperator
  16479. private:
  16480. int titleBarHeight, menuBarHeight, requiredButtons;
  16481. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16482. ScopedPointer <Button> titleBarButtons [3];
  16483. ScopedPointer <Image> titleBarIcon;
  16484. ScopedPointer <MenuBarComponent> menuBar;
  16485. MenuBarModel* menuBarModel;
  16486. class ButtonListenerProxy;
  16487. friend class ScopedPointer <ButtonListenerProxy>;
  16488. ScopedPointer <ButtonListenerProxy> buttonListener;
  16489. void repaintTitleBar();
  16490. DocumentWindow (const DocumentWindow&);
  16491. DocumentWindow& operator= (const DocumentWindow&);
  16492. };
  16493. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16494. /*** End of inlined file: juce_DocumentWindow.h ***/
  16495. class MultiDocumentPanel;
  16496. class MDITabbedComponentInternal;
  16497. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16498. {
  16499. public:
  16500. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16501. ~MultiDocumentPanelWindow();
  16502. void maximiseButtonPressed();
  16503. void closeButtonPressed();
  16504. void activeWindowStatusChanged();
  16505. void broughtToFront();
  16506. juce_UseDebuggingNewOperator
  16507. private:
  16508. void updateOrder();
  16509. MultiDocumentPanel* getOwner() const throw();
  16510. };
  16511. class JUCE_API MultiDocumentPanel : public Component,
  16512. private ComponentListener
  16513. {
  16514. public:
  16515. MultiDocumentPanel();
  16516. ~MultiDocumentPanel();
  16517. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16518. bool addDocument (Component* const component,
  16519. const Colour& backgroundColour,
  16520. const bool deleteWhenRemoved);
  16521. bool closeDocument (Component* component,
  16522. const bool checkItsOkToCloseFirst);
  16523. int getNumDocuments() const throw();
  16524. Component* getDocument (const int index) const throw();
  16525. Component* getActiveDocument() const throw();
  16526. void setActiveDocument (Component* component);
  16527. virtual void activeDocumentChanged();
  16528. void setMaximumNumDocuments (const int maximumNumDocuments);
  16529. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16530. bool isFullscreenWhenOneDocument() const throw();
  16531. enum LayoutMode
  16532. {
  16533. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16534. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16535. };
  16536. void setLayoutMode (const LayoutMode newLayoutMode);
  16537. LayoutMode getLayoutMode() const throw() { return mode; }
  16538. void setBackgroundColour (const Colour& newBackgroundColour);
  16539. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16540. virtual bool tryToCloseDocument (Component* component) = 0;
  16541. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16542. void paint (Graphics& g);
  16543. void resized();
  16544. void componentNameChanged (Component&);
  16545. juce_UseDebuggingNewOperator
  16546. private:
  16547. LayoutMode mode;
  16548. Array <Component*> components;
  16549. TabbedComponent* tabComponent;
  16550. Colour backgroundColour;
  16551. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16552. friend class MultiDocumentPanelWindow;
  16553. friend class MDITabbedComponentInternal;
  16554. Component* getContainerComp (Component* c) const;
  16555. void updateOrder();
  16556. void addWindow (Component* component);
  16557. };
  16558. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16559. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16560. #endif
  16561. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16562. #endif
  16563. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16564. #endif
  16565. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16566. #endif
  16567. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16568. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16569. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16570. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16571. class JUCE_API StretchableLayoutManager
  16572. {
  16573. public:
  16574. StretchableLayoutManager();
  16575. ~StretchableLayoutManager();
  16576. void setItemLayout (const int itemIndex,
  16577. const double minimumSize,
  16578. const double maximumSize,
  16579. const double preferredSize);
  16580. bool getItemLayout (const int itemIndex,
  16581. double& minimumSize,
  16582. double& maximumSize,
  16583. double& preferredSize) const;
  16584. void clearAllItems();
  16585. void layOutComponents (Component** const components,
  16586. int numComponents,
  16587. int x, int y, int width, int height,
  16588. const bool vertically,
  16589. const bool resizeOtherDimension);
  16590. int getItemCurrentPosition (const int itemIndex) const;
  16591. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16592. double getItemCurrentRelativeSize (const int itemIndex) const;
  16593. void setItemPosition (const int itemIndex,
  16594. int newPosition);
  16595. juce_UseDebuggingNewOperator
  16596. private:
  16597. struct ItemLayoutProperties
  16598. {
  16599. int itemIndex;
  16600. int currentSize;
  16601. double minSize, maxSize, preferredSize;
  16602. };
  16603. OwnedArray <ItemLayoutProperties> items;
  16604. int totalSize;
  16605. static int sizeToRealSize (double size, int totalSpace);
  16606. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16607. void setTotalSize (const int newTotalSize);
  16608. int fitComponentsIntoSpace (const int startIndex,
  16609. const int endIndex,
  16610. const int availableSpace,
  16611. int startPos);
  16612. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16613. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16614. void updatePrefSizesToMatchCurrentPositions();
  16615. StretchableLayoutManager (const StretchableLayoutManager&);
  16616. StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16617. };
  16618. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16619. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16620. #endif
  16621. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16622. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16623. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16624. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16625. class JUCE_API StretchableLayoutResizerBar : public Component
  16626. {
  16627. public:
  16628. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16629. const int itemIndexInLayout,
  16630. const bool isBarVertical);
  16631. ~StretchableLayoutResizerBar();
  16632. virtual void hasBeenMoved();
  16633. void paint (Graphics& g);
  16634. void mouseDown (const MouseEvent& e);
  16635. void mouseDrag (const MouseEvent& e);
  16636. juce_UseDebuggingNewOperator
  16637. private:
  16638. StretchableLayoutManager* layout;
  16639. int itemIndex, mouseDownPos;
  16640. bool isVertical;
  16641. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16642. StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16643. };
  16644. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16645. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16646. #endif
  16647. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16648. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16649. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16650. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16651. class StretchableObjectResizer
  16652. {
  16653. public:
  16654. StretchableObjectResizer();
  16655. ~StretchableObjectResizer();
  16656. void addItem (const double currentSize,
  16657. const double minSize,
  16658. const double maxSize,
  16659. const int order = 0);
  16660. void resizeToFit (const double targetSize);
  16661. int getNumItems() const throw() { return items.size(); }
  16662. double getItemSize (const int index) const throw();
  16663. juce_UseDebuggingNewOperator
  16664. private:
  16665. struct Item
  16666. {
  16667. double size;
  16668. double minSize;
  16669. double maxSize;
  16670. int order;
  16671. };
  16672. OwnedArray <Item> items;
  16673. StretchableObjectResizer (const StretchableObjectResizer&);
  16674. StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16675. };
  16676. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16677. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16678. #endif
  16679. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16680. #endif
  16681. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16682. #endif
  16683. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16684. #endif
  16685. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16686. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16687. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16688. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16689. /*** Start of inlined file: juce_AlertWindow.h ***/
  16690. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16691. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16692. /*** Start of inlined file: juce_TextLayout.h ***/
  16693. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16694. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16695. class Graphics;
  16696. class JUCE_API TextLayout
  16697. {
  16698. public:
  16699. TextLayout() throw();
  16700. TextLayout (const TextLayout& other) throw();
  16701. TextLayout (const String& text, const Font& font) throw();
  16702. ~TextLayout() throw();
  16703. TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16704. void clear() throw();
  16705. void appendText (const String& textToAppend,
  16706. const Font& fontToUse) throw();
  16707. void setText (const String& newText,
  16708. const Font& fontToUse) throw();
  16709. void layout (int maximumWidth,
  16710. const Justification& justification,
  16711. const bool attemptToBalanceLineLengths) throw();
  16712. int getWidth() const throw();
  16713. int getHeight() const throw();
  16714. int getNumLines() const throw() { return totalLines; }
  16715. int getLineWidth (const int lineNumber) const throw();
  16716. void draw (Graphics& g,
  16717. const int topLeftX,
  16718. const int topLeftY) const throw();
  16719. void drawWithin (Graphics& g,
  16720. int x, int y, int w, int h,
  16721. const Justification& layoutFlags) const throw();
  16722. juce_UseDebuggingNewOperator
  16723. private:
  16724. class Token;
  16725. friend class OwnedArray <Token>;
  16726. OwnedArray <Token> tokens;
  16727. int totalLines;
  16728. };
  16729. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16730. /*** End of inlined file: juce_TextLayout.h ***/
  16731. class JUCE_API AlertWindow : public TopLevelWindow,
  16732. private ButtonListener
  16733. {
  16734. public:
  16735. enum AlertIconType
  16736. {
  16737. NoIcon, /**< No icon will be shown on the dialog box. */
  16738. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16739. user to answer a question. */
  16740. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16741. warning about something and shouldn't be ignored. */
  16742. InfoIcon /**< An icon that indicates that the dialog box is just
  16743. giving the user some information, which doesn't require
  16744. a response from them. */
  16745. };
  16746. AlertWindow (const String& title,
  16747. const String& message,
  16748. AlertIconType iconType,
  16749. Component* associatedComponent = 0);
  16750. ~AlertWindow();
  16751. AlertIconType getAlertType() const throw() { return alertIconType; }
  16752. void setMessage (const String& message);
  16753. void addButton (const String& name,
  16754. const int returnValue,
  16755. const KeyPress& shortcutKey1 = KeyPress(),
  16756. const KeyPress& shortcutKey2 = KeyPress());
  16757. int getNumButtons() const;
  16758. void addTextEditor (const String& name,
  16759. const String& initialContents,
  16760. const String& onScreenLabel = String::empty,
  16761. const bool isPasswordBox = false);
  16762. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16763. void addComboBox (const String& name,
  16764. const StringArray& items,
  16765. const String& onScreenLabel = String::empty);
  16766. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16767. void addTextBlock (const String& text);
  16768. void addProgressBarComponent (double& progressValue);
  16769. void addCustomComponent (Component* const component);
  16770. int getNumCustomComponents() const;
  16771. Component* getCustomComponent (const int index) const;
  16772. Component* removeCustomComponent (const int index);
  16773. bool containsAnyExtraComponents() const;
  16774. // easy-to-use message box functions:
  16775. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16776. const String& title,
  16777. const String& message,
  16778. const String& buttonText = String::empty,
  16779. Component* associatedComponent = 0);
  16780. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16781. const String& title,
  16782. const String& message,
  16783. const String& button1Text = String::empty,
  16784. const String& button2Text = String::empty,
  16785. Component* associatedComponent = 0);
  16786. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16787. const String& title,
  16788. const String& message,
  16789. const String& button1Text = String::empty,
  16790. const String& button2Text = String::empty,
  16791. const String& button3Text = String::empty,
  16792. Component* associatedComponent = 0);
  16793. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16794. const String& bodyText,
  16795. bool isOkCancel);
  16796. enum ColourIds
  16797. {
  16798. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16799. textColourId = 0x1001810, /**< The colour for the text. */
  16800. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16801. };
  16802. juce_UseDebuggingNewOperator
  16803. protected:
  16804. void paint (Graphics& g);
  16805. void mouseDown (const MouseEvent& e);
  16806. void mouseDrag (const MouseEvent& e);
  16807. bool keyPressed (const KeyPress& key);
  16808. void buttonClicked (Button* button);
  16809. void lookAndFeelChanged();
  16810. void userTriedToCloseWindow();
  16811. int getDesktopWindowStyleFlags() const;
  16812. private:
  16813. String text;
  16814. TextLayout textLayout;
  16815. AlertIconType alertIconType;
  16816. ComponentBoundsConstrainer constrainer;
  16817. ComponentDragger dragger;
  16818. Rectangle<int> textArea;
  16819. VoidArray buttons, textBoxes, comboBoxes;
  16820. VoidArray progressBars, customComps, textBlocks, allComps;
  16821. StringArray textboxNames, comboBoxNames;
  16822. Font font;
  16823. Component* associatedComponent;
  16824. void updateLayout (const bool onlyIncreaseSize);
  16825. // disable copy constructor
  16826. AlertWindow (const AlertWindow&);
  16827. AlertWindow& operator= (const AlertWindow&);
  16828. };
  16829. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  16830. /*** End of inlined file: juce_AlertWindow.h ***/
  16831. class ToggleButton;
  16832. class TextButton;
  16833. class AlertWindow;
  16834. class TextLayout;
  16835. class ScrollBar;
  16836. class BubbleComponent;
  16837. class ComboBox;
  16838. class Button;
  16839. class FilenameComponent;
  16840. class DocumentWindow;
  16841. class ResizableWindow;
  16842. class GroupComponent;
  16843. class MenuBarComponent;
  16844. class DropShadower;
  16845. class GlyphArrangement;
  16846. class PropertyComponent;
  16847. class TableHeaderComponent;
  16848. class Toolbar;
  16849. class ToolbarItemComponent;
  16850. class PopupMenu;
  16851. class ProgressBar;
  16852. class FileBrowserComponent;
  16853. class DirectoryContentsDisplayComponent;
  16854. class FilePreviewComponent;
  16855. class ImageButton;
  16856. class JUCE_API LookAndFeel
  16857. {
  16858. public:
  16859. LookAndFeel();
  16860. virtual ~LookAndFeel();
  16861. static LookAndFeel& getDefaultLookAndFeel() throw();
  16862. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  16863. const Colour findColour (const int colourId) const throw();
  16864. void setColour (const int colourId, const Colour& colour) throw();
  16865. bool isColourSpecified (const int colourId) const throw();
  16866. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  16867. void setDefaultSansSerifTypefaceName (const String& newName);
  16868. virtual const MouseCursor getMouseCursorFor (Component& component);
  16869. virtual void drawButtonBackground (Graphics& g,
  16870. Button& button,
  16871. const Colour& backgroundColour,
  16872. bool isMouseOverButton,
  16873. bool isButtonDown);
  16874. virtual const Font getFontForTextButton (TextButton& button);
  16875. virtual void drawButtonText (Graphics& g,
  16876. TextButton& button,
  16877. bool isMouseOverButton,
  16878. bool isButtonDown);
  16879. virtual void drawToggleButton (Graphics& g,
  16880. ToggleButton& button,
  16881. bool isMouseOverButton,
  16882. bool isButtonDown);
  16883. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  16884. virtual void drawTickBox (Graphics& g,
  16885. Component& component,
  16886. float x, float y, float w, float h,
  16887. const bool ticked,
  16888. const bool isEnabled,
  16889. const bool isMouseOverButton,
  16890. const bool isButtonDown);
  16891. virtual AlertWindow* createAlertWindow (const String& title,
  16892. const String& message,
  16893. const String& button1,
  16894. const String& button2,
  16895. const String& button3,
  16896. AlertWindow::AlertIconType iconType,
  16897. int numButtons,
  16898. Component* associatedComponent);
  16899. virtual void drawAlertBox (Graphics& g,
  16900. AlertWindow& alert,
  16901. const Rectangle<int>& textArea,
  16902. TextLayout& textLayout);
  16903. virtual int getAlertBoxWindowFlags();
  16904. virtual int getAlertWindowButtonHeight();
  16905. virtual const Font getAlertWindowFont();
  16906. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  16907. int width, int height,
  16908. double progress, const String& textToShow);
  16909. // Draws a small image that spins to indicate that something's happening..
  16910. // This method should use the current time to animate itself, so just keep
  16911. // repainting it every so often.
  16912. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  16913. int x, int y, int w, int h);
  16914. virtual void drawScrollbarButton (Graphics& g,
  16915. ScrollBar& scrollbar,
  16916. int width, int height,
  16917. int buttonDirection,
  16918. bool isScrollbarVertical,
  16919. bool isMouseOverButton,
  16920. bool isButtonDown);
  16921. virtual void drawScrollbar (Graphics& g,
  16922. ScrollBar& scrollbar,
  16923. int x, int y,
  16924. int width, int height,
  16925. bool isScrollbarVertical,
  16926. int thumbStartPosition,
  16927. int thumbSize,
  16928. bool isMouseOver,
  16929. bool isMouseDown);
  16930. virtual ImageEffectFilter* getScrollbarEffect();
  16931. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  16932. virtual int getDefaultScrollbarWidth();
  16933. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  16934. virtual const Path getTickShape (const float height);
  16935. virtual const Path getCrossShape (const float height);
  16936. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  16937. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  16938. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  16939. // these return an image from the ImageCache, so use ImageCache::release() to free it
  16940. virtual Image* getDefaultFolderImage();
  16941. virtual Image* getDefaultDocumentFileImage();
  16942. virtual void createFileChooserHeaderText (const String& title,
  16943. const String& instructions,
  16944. GlyphArrangement& destArrangement,
  16945. int width);
  16946. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  16947. const String& filename, Image* icon,
  16948. const String& fileSizeDescription,
  16949. const String& fileTimeDescription,
  16950. const bool isDirectory,
  16951. const bool isItemSelected,
  16952. const int itemIndex);
  16953. virtual Button* createFileBrowserGoUpButton();
  16954. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  16955. DirectoryContentsDisplayComponent* fileListComponent,
  16956. FilePreviewComponent* previewComp,
  16957. ComboBox* currentPathBox,
  16958. TextEditor* filenameBox,
  16959. Button* goUpButton);
  16960. virtual void drawBubble (Graphics& g,
  16961. float tipX, float tipY,
  16962. float boxX, float boxY, float boxW, float boxH);
  16963. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  16964. virtual void drawPopupMenuItem (Graphics& g,
  16965. int width, int height,
  16966. const bool isSeparator,
  16967. const bool isActive,
  16968. const bool isHighlighted,
  16969. const bool isTicked,
  16970. const bool hasSubMenu,
  16971. const String& text,
  16972. const String& shortcutKeyText,
  16973. Image* image,
  16974. const Colour* const textColour);
  16975. virtual const Font getPopupMenuFont();
  16976. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  16977. int width, int height,
  16978. bool isScrollUpArrow);
  16979. virtual void getIdealPopupMenuItemSize (const String& text,
  16980. const bool isSeparator,
  16981. int standardMenuItemHeight,
  16982. int& idealWidth,
  16983. int& idealHeight);
  16984. virtual int getMenuWindowFlags();
  16985. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  16986. bool isMouseOverBar,
  16987. MenuBarComponent& menuBar);
  16988. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16989. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16990. virtual void drawMenuBarItem (Graphics& g,
  16991. int width, int height,
  16992. int itemIndex,
  16993. const String& itemText,
  16994. bool isMouseOverItem,
  16995. bool isMenuOpen,
  16996. bool isMouseOverBar,
  16997. MenuBarComponent& menuBar);
  16998. virtual void drawComboBox (Graphics& g, int width, int height,
  16999. const bool isButtonDown,
  17000. int buttonX, int buttonY,
  17001. int buttonW, int buttonH,
  17002. ComboBox& box);
  17003. virtual const Font getComboBoxFont (ComboBox& box);
  17004. virtual Label* createComboBoxTextBox (ComboBox& box);
  17005. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17006. virtual void drawLabel (Graphics& g, Label& label);
  17007. virtual void drawLinearSlider (Graphics& g,
  17008. int x, int y,
  17009. int width, int height,
  17010. float sliderPos,
  17011. float minSliderPos,
  17012. float maxSliderPos,
  17013. const Slider::SliderStyle style,
  17014. Slider& slider);
  17015. virtual void drawLinearSliderBackground (Graphics& g,
  17016. int x, int y,
  17017. int width, int height,
  17018. float sliderPos,
  17019. float minSliderPos,
  17020. float maxSliderPos,
  17021. const Slider::SliderStyle style,
  17022. Slider& slider);
  17023. virtual void drawLinearSliderThumb (Graphics& g,
  17024. int x, int y,
  17025. int width, int height,
  17026. float sliderPos,
  17027. float minSliderPos,
  17028. float maxSliderPos,
  17029. const Slider::SliderStyle style,
  17030. Slider& slider);
  17031. virtual int getSliderThumbRadius (Slider& slider);
  17032. virtual void drawRotarySlider (Graphics& g,
  17033. int x, int y,
  17034. int width, int height,
  17035. float sliderPosProportional,
  17036. const float rotaryStartAngle,
  17037. const float rotaryEndAngle,
  17038. Slider& slider);
  17039. virtual Button* createSliderButton (const bool isIncrement);
  17040. virtual Label* createSliderTextBox (Slider& slider);
  17041. virtual ImageEffectFilter* getSliderEffect();
  17042. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17043. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17044. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17045. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17046. ComboBox* filenameBox, Button* browseButton);
  17047. virtual void drawCornerResizer (Graphics& g,
  17048. int w, int h,
  17049. bool isMouseOver,
  17050. bool isMouseDragging);
  17051. virtual void drawResizableFrame (Graphics& g,
  17052. int w, int h,
  17053. const BorderSize& borders);
  17054. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17055. const BorderSize& border,
  17056. ResizableWindow& window);
  17057. virtual void drawResizableWindowBorder (Graphics& g,
  17058. int w, int h,
  17059. const BorderSize& border,
  17060. ResizableWindow& window);
  17061. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17062. Graphics& g, int w, int h,
  17063. int titleSpaceX, int titleSpaceW,
  17064. const Image* icon,
  17065. bool drawTitleTextOnLeft);
  17066. virtual Button* createDocumentWindowButton (int buttonType);
  17067. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17068. int titleBarX, int titleBarY,
  17069. int titleBarW, int titleBarH,
  17070. Button* minimiseButton,
  17071. Button* maximiseButton,
  17072. Button* closeButton,
  17073. bool positionTitleBarButtonsOnLeft);
  17074. virtual int getDefaultMenuBarHeight();
  17075. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17076. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17077. int w, int h,
  17078. bool isVerticalBar,
  17079. bool isMouseOver,
  17080. bool isMouseDragging);
  17081. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17082. const String& text,
  17083. const Justification& position,
  17084. GroupComponent& group);
  17085. virtual void createTabButtonShape (Path& p,
  17086. int width, int height,
  17087. int tabIndex,
  17088. const String& text,
  17089. Button& button,
  17090. TabbedButtonBar::Orientation orientation,
  17091. const bool isMouseOver,
  17092. const bool isMouseDown,
  17093. const bool isFrontTab);
  17094. virtual void fillTabButtonShape (Graphics& g,
  17095. const Path& path,
  17096. const Colour& preferredBackgroundColour,
  17097. int tabIndex,
  17098. const String& text,
  17099. Button& button,
  17100. TabbedButtonBar::Orientation orientation,
  17101. const bool isMouseOver,
  17102. const bool isMouseDown,
  17103. const bool isFrontTab);
  17104. virtual void drawTabButtonText (Graphics& g,
  17105. int x, int y, int w, int h,
  17106. const Colour& preferredBackgroundColour,
  17107. int tabIndex,
  17108. const String& text,
  17109. Button& button,
  17110. TabbedButtonBar::Orientation orientation,
  17111. const bool isMouseOver,
  17112. const bool isMouseDown,
  17113. const bool isFrontTab);
  17114. virtual int getTabButtonOverlap (int tabDepth);
  17115. virtual int getTabButtonSpaceAroundImage();
  17116. virtual int getTabButtonBestWidth (int tabIndex,
  17117. const String& text,
  17118. int tabDepth,
  17119. Button& button);
  17120. virtual void drawTabButton (Graphics& g,
  17121. int w, int h,
  17122. const Colour& preferredColour,
  17123. int tabIndex,
  17124. const String& text,
  17125. Button& button,
  17126. TabbedButtonBar::Orientation orientation,
  17127. const bool isMouseOver,
  17128. const bool isMouseDown,
  17129. const bool isFrontTab);
  17130. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17131. int w, int h,
  17132. TabbedButtonBar& tabBar,
  17133. TabbedButtonBar::Orientation orientation);
  17134. virtual Button* createTabBarExtrasButton();
  17135. virtual void drawImageButton (Graphics& g, Image* image,
  17136. int imageX, int imageY, int imageW, int imageH,
  17137. const Colour& overlayColour,
  17138. float imageOpacity,
  17139. ImageButton& button);
  17140. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17141. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17142. int width, int height,
  17143. bool isMouseOver, bool isMouseDown,
  17144. int columnFlags);
  17145. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17146. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17147. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17148. bool isMouseOver, bool isMouseDown,
  17149. ToolbarItemComponent& component);
  17150. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17151. const String& text, ToolbarItemComponent& component);
  17152. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17153. bool isOpen, int width, int height);
  17154. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17155. PropertyComponent& component);
  17156. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17157. PropertyComponent& component);
  17158. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17159. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17160. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17161. virtual void playAlertSound();
  17162. static void drawGlassSphere (Graphics& g,
  17163. const float x, const float y,
  17164. const float diameter,
  17165. const Colour& colour,
  17166. const float outlineThickness) throw();
  17167. static void drawGlassPointer (Graphics& g,
  17168. const float x, const float y,
  17169. const float diameter,
  17170. const Colour& colour, const float outlineThickness,
  17171. const int direction) throw();
  17172. static void drawGlassLozenge (Graphics& g,
  17173. const float x, const float y,
  17174. const float width, const float height,
  17175. const Colour& colour,
  17176. const float outlineThickness,
  17177. const float cornerSize,
  17178. const bool flatOnLeft, const bool flatOnRight,
  17179. const bool flatOnTop, const bool flatOnBottom) throw();
  17180. juce_UseDebuggingNewOperator
  17181. private:
  17182. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17183. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17184. Array <int> colourIds;
  17185. Array <Colour> colours;
  17186. // default typeface names
  17187. String defaultSans, defaultSerif, defaultFixed;
  17188. void drawShinyButtonShape (Graphics& g,
  17189. float x, float y, float w, float h, float maxCornerSize,
  17190. const Colour& baseColour,
  17191. const float strokeWidth,
  17192. const bool flatOnLeft,
  17193. const bool flatOnRight,
  17194. const bool flatOnTop,
  17195. const bool flatOnBottom) throw();
  17196. LookAndFeel (const LookAndFeel&);
  17197. LookAndFeel& operator= (const LookAndFeel&);
  17198. };
  17199. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17200. /*** End of inlined file: juce_LookAndFeel.h ***/
  17201. #endif
  17202. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17203. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17204. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17205. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17206. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17207. {
  17208. public:
  17209. OldSchoolLookAndFeel();
  17210. virtual ~OldSchoolLookAndFeel();
  17211. virtual void drawButtonBackground (Graphics& g,
  17212. Button& button,
  17213. const Colour& backgroundColour,
  17214. bool isMouseOverButton,
  17215. bool isButtonDown);
  17216. virtual void drawToggleButton (Graphics& g,
  17217. ToggleButton& button,
  17218. bool isMouseOverButton,
  17219. bool isButtonDown);
  17220. virtual void drawTickBox (Graphics& g,
  17221. Component& component,
  17222. float x, float y, float w, float h,
  17223. const bool ticked,
  17224. const bool isEnabled,
  17225. const bool isMouseOverButton,
  17226. const bool isButtonDown);
  17227. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17228. int width, int height,
  17229. double progress, const String& textToShow);
  17230. virtual void drawScrollbarButton (Graphics& g,
  17231. ScrollBar& scrollbar,
  17232. int width, int height,
  17233. int buttonDirection,
  17234. bool isScrollbarVertical,
  17235. bool isMouseOverButton,
  17236. bool isButtonDown);
  17237. virtual void drawScrollbar (Graphics& g,
  17238. ScrollBar& scrollbar,
  17239. int x, int y,
  17240. int width, int height,
  17241. bool isScrollbarVertical,
  17242. int thumbStartPosition,
  17243. int thumbSize,
  17244. bool isMouseOver,
  17245. bool isMouseDown);
  17246. virtual ImageEffectFilter* getScrollbarEffect();
  17247. virtual void drawTextEditorOutline (Graphics& g,
  17248. int width, int height,
  17249. TextEditor& textEditor);
  17250. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17251. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17252. bool isMouseOverBar,
  17253. MenuBarComponent& menuBar);
  17254. virtual void drawComboBox (Graphics& g, int width, int height,
  17255. const bool isButtonDown,
  17256. int buttonX, int buttonY,
  17257. int buttonW, int buttonH,
  17258. ComboBox& box);
  17259. virtual const Font getComboBoxFont (ComboBox& box);
  17260. virtual void drawLinearSlider (Graphics& g,
  17261. int x, int y,
  17262. int width, int height,
  17263. float sliderPos,
  17264. float minSliderPos,
  17265. float maxSliderPos,
  17266. const Slider::SliderStyle style,
  17267. Slider& slider);
  17268. virtual int getSliderThumbRadius (Slider& slider);
  17269. virtual Button* createSliderButton (const bool isIncrement);
  17270. virtual ImageEffectFilter* getSliderEffect();
  17271. virtual void drawCornerResizer (Graphics& g,
  17272. int w, int h,
  17273. bool isMouseOver,
  17274. bool isMouseDragging);
  17275. virtual Button* createDocumentWindowButton (int buttonType);
  17276. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17277. int titleBarX, int titleBarY,
  17278. int titleBarW, int titleBarH,
  17279. Button* minimiseButton,
  17280. Button* maximiseButton,
  17281. Button* closeButton,
  17282. bool positionTitleBarButtonsOnLeft);
  17283. juce_UseDebuggingNewOperator
  17284. private:
  17285. DropShadowEffect scrollbarShadow;
  17286. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17287. OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17288. };
  17289. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17290. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17291. #endif
  17292. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17293. #endif
  17294. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17295. #endif
  17296. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17297. #endif
  17298. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17299. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17300. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17301. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17302. class JUCE_API PopupMenuCustomComponent : public Component,
  17303. public ReferenceCountedObject
  17304. {
  17305. public:
  17306. ~PopupMenuCustomComponent();
  17307. virtual void getIdealSize (int& idealWidth,
  17308. int& idealHeight) = 0;
  17309. void triggerMenuItem();
  17310. bool isItemHighlighted() const throw() { return isHighlighted; }
  17311. protected:
  17312. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17313. private:
  17314. friend class PopupMenu;
  17315. friend class PopupMenu::ItemComponent;
  17316. friend class PopupMenu::Window;
  17317. bool isHighlighted, isTriggeredAutomatically;
  17318. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17319. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17320. };
  17321. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17322. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17323. #endif
  17324. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17325. #endif
  17326. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17327. #endif
  17328. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17329. #endif
  17330. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17331. #endif
  17332. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17333. /*** Start of inlined file: juce_LassoComponent.h ***/
  17334. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17335. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17336. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17337. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17338. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17339. template <class SelectableItemType>
  17340. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17341. {
  17342. public:
  17343. SelectedItemSet()
  17344. {
  17345. }
  17346. SelectedItemSet (const Array <SelectableItemType>& items)
  17347. : selectedItems (items)
  17348. {
  17349. }
  17350. SelectedItemSet (const SelectedItemSet& other)
  17351. : selectedItems (other.selectedItems)
  17352. {
  17353. }
  17354. SelectedItemSet& operator= (const SelectedItemSet& other)
  17355. {
  17356. if (selectedItems != other.selectedItems)
  17357. {
  17358. selectedItems = other.selectedItems;
  17359. changed();
  17360. }
  17361. return *this;
  17362. }
  17363. ~SelectedItemSet()
  17364. {
  17365. }
  17366. void selectOnly (SelectableItemType item)
  17367. {
  17368. if (isSelected (item))
  17369. {
  17370. for (int i = selectedItems.size(); --i >= 0;)
  17371. {
  17372. if (selectedItems.getUnchecked(i) != item)
  17373. {
  17374. deselect (selectedItems.getUnchecked(i));
  17375. i = jmin (i, selectedItems.size());
  17376. }
  17377. }
  17378. }
  17379. else
  17380. {
  17381. deselectAll();
  17382. changed();
  17383. selectedItems.add (item);
  17384. itemSelected (item);
  17385. }
  17386. }
  17387. void addToSelection (SelectableItemType item)
  17388. {
  17389. if (! isSelected (item))
  17390. {
  17391. changed();
  17392. selectedItems.add (item);
  17393. itemSelected (item);
  17394. }
  17395. }
  17396. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17397. const ModifierKeys& modifiers)
  17398. {
  17399. if (modifiers.isShiftDown())
  17400. {
  17401. addToSelection (item);
  17402. }
  17403. else if (modifiers.isCommandDown())
  17404. {
  17405. if (isSelected (item))
  17406. deselect (item);
  17407. else
  17408. addToSelection (item);
  17409. }
  17410. else
  17411. {
  17412. selectOnly (item);
  17413. }
  17414. }
  17415. bool addToSelectionOnMouseDown (SelectableItemType item,
  17416. const ModifierKeys& modifiers)
  17417. {
  17418. if (isSelected (item))
  17419. {
  17420. return ! modifiers.isPopupMenu();
  17421. }
  17422. else
  17423. {
  17424. addToSelectionBasedOnModifiers (item, modifiers);
  17425. return false;
  17426. }
  17427. }
  17428. void addToSelectionOnMouseUp (SelectableItemType item,
  17429. const ModifierKeys& modifiers,
  17430. const bool wasItemDragged,
  17431. const bool resultOfMouseDownSelectMethod)
  17432. {
  17433. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17434. addToSelectionBasedOnModifiers (item, modifiers);
  17435. }
  17436. void deselect (SelectableItemType item)
  17437. {
  17438. const int i = selectedItems.indexOf (item);
  17439. if (i >= 0)
  17440. {
  17441. changed();
  17442. itemDeselected (selectedItems.remove (i));
  17443. }
  17444. }
  17445. void deselectAll()
  17446. {
  17447. if (selectedItems.size() > 0)
  17448. {
  17449. changed();
  17450. for (int i = selectedItems.size(); --i >= 0;)
  17451. {
  17452. itemDeselected (selectedItems.remove (i));
  17453. i = jmin (i, selectedItems.size());
  17454. }
  17455. }
  17456. }
  17457. int getNumSelected() const throw()
  17458. {
  17459. return selectedItems.size();
  17460. }
  17461. SelectableItemType getSelectedItem (const int index) const throw()
  17462. {
  17463. return selectedItems [index];
  17464. }
  17465. bool isSelected (const SelectableItemType item) const throw()
  17466. {
  17467. return selectedItems.contains (item);
  17468. }
  17469. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17470. virtual void itemSelected (SelectableItemType item) {}
  17471. virtual void itemDeselected (SelectableItemType item) {}
  17472. void changed (const bool synchronous = false)
  17473. {
  17474. if (synchronous)
  17475. sendSynchronousChangeMessage (this);
  17476. else
  17477. sendChangeMessage (this);
  17478. }
  17479. juce_UseDebuggingNewOperator
  17480. private:
  17481. Array <SelectableItemType> selectedItems;
  17482. };
  17483. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17484. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17485. template <class SelectableItemType>
  17486. class LassoSource
  17487. {
  17488. public:
  17489. virtual ~LassoSource() {}
  17490. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17491. int x, int y, int width, int height) = 0;
  17492. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17493. };
  17494. template <class SelectableItemType>
  17495. class LassoComponent : public Component
  17496. {
  17497. public:
  17498. LassoComponent (const int outlineThickness_ = 1)
  17499. : source (0),
  17500. outlineThickness (outlineThickness_)
  17501. {
  17502. }
  17503. ~LassoComponent()
  17504. {
  17505. }
  17506. void beginLasso (const MouseEvent& e,
  17507. LassoSource <SelectableItemType>* const lassoSource)
  17508. {
  17509. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17510. jassert (lassoSource != 0); // the source can't be null!
  17511. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17512. source = lassoSource;
  17513. if (lassoSource != 0)
  17514. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17515. setSize (0, 0);
  17516. }
  17517. void dragLasso (const MouseEvent& e)
  17518. {
  17519. if (source != 0)
  17520. {
  17521. const int x1 = e.getMouseDownX();
  17522. const int y1 = e.getMouseDownY();
  17523. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17524. setVisible (true);
  17525. Array <SelectableItemType> itemsInLasso;
  17526. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17527. if (e.mods.isShiftDown())
  17528. {
  17529. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17530. itemsInLasso.addArray (originalSelection);
  17531. }
  17532. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17533. {
  17534. Array <SelectableItemType> originalMinusNew (originalSelection);
  17535. originalMinusNew.removeValuesIn (itemsInLasso);
  17536. itemsInLasso.removeValuesIn (originalSelection);
  17537. itemsInLasso.addArray (originalMinusNew);
  17538. }
  17539. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17540. }
  17541. }
  17542. void endLasso()
  17543. {
  17544. source = 0;
  17545. originalSelection.clear();
  17546. setVisible (false);
  17547. }
  17548. enum ColourIds
  17549. {
  17550. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17551. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17552. };
  17553. void paint (Graphics& g)
  17554. {
  17555. g.fillAll (findColour (lassoFillColourId));
  17556. g.setColour (findColour (lassoOutlineColourId));
  17557. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17558. // this suggests that you've left a lasso comp lying around after the
  17559. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17560. // mouse-up event.
  17561. jassert (isMouseButtonDownAnywhere());
  17562. }
  17563. bool hitTest (int x, int y) { return false; }
  17564. juce_UseDebuggingNewOperator
  17565. private:
  17566. Array <SelectableItemType> originalSelection;
  17567. LassoSource <SelectableItemType>* source;
  17568. int outlineThickness;
  17569. };
  17570. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17571. /*** End of inlined file: juce_LassoComponent.h ***/
  17572. #endif
  17573. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17574. #endif
  17575. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17576. #endif
  17577. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17578. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17579. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17580. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17581. class JUCE_API MouseHoverDetector
  17582. {
  17583. public:
  17584. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17585. virtual ~MouseHoverDetector();
  17586. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17587. void setHoverComponent (Component* const newSourceComponent);
  17588. protected:
  17589. virtual void mouseHovered (int mouseX,
  17590. int mouseY) = 0;
  17591. virtual void mouseMovedAfterHover() = 0;
  17592. private:
  17593. class JUCE_API HoverDetectorInternal : public MouseListener,
  17594. public Timer
  17595. {
  17596. public:
  17597. MouseHoverDetector* owner;
  17598. int lastX, lastY;
  17599. void timerCallback();
  17600. void mouseEnter (const MouseEvent&);
  17601. void mouseExit (const MouseEvent&);
  17602. void mouseDown (const MouseEvent&);
  17603. void mouseUp (const MouseEvent&);
  17604. void mouseMove (const MouseEvent&);
  17605. void mouseWheelMove (const MouseEvent&, float, float);
  17606. } internalTimer;
  17607. friend class HoverDetectorInternal;
  17608. Component* source;
  17609. int hoverTimeMillisecs;
  17610. bool hasJustHovered;
  17611. void hoverTimerCallback();
  17612. void checkJustHoveredCallback();
  17613. MouseHoverDetector (const MouseHoverDetector&);
  17614. MouseHoverDetector& operator= (const MouseHoverDetector&);
  17615. };
  17616. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17617. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17618. #endif
  17619. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17620. #endif
  17621. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17622. #endif
  17623. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17624. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17625. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17626. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17627. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17628. private ButtonListener
  17629. {
  17630. protected:
  17631. BooleanPropertyComponent (const String& propertyName,
  17632. const String& buttonTextWhenTrue,
  17633. const String& buttonTextWhenFalse);
  17634. public:
  17635. BooleanPropertyComponent (const Value& valueToControl,
  17636. const String& propertyName,
  17637. const String& buttonText);
  17638. ~BooleanPropertyComponent();
  17639. virtual void setState (const bool newState);
  17640. virtual bool getState() const;
  17641. void paint (Graphics& g);
  17642. void refresh();
  17643. void buttonClicked (Button*);
  17644. juce_UseDebuggingNewOperator
  17645. private:
  17646. ToggleButton* button;
  17647. String onText, offText;
  17648. void createButton();
  17649. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17650. BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17651. };
  17652. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17653. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17654. #endif
  17655. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17656. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17657. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17658. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17659. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17660. private ButtonListener
  17661. {
  17662. public:
  17663. ButtonPropertyComponent (const String& propertyName,
  17664. const bool triggerOnMouseDown);
  17665. ~ButtonPropertyComponent();
  17666. virtual void buttonClicked() = 0;
  17667. virtual const String getButtonText() const = 0;
  17668. void refresh();
  17669. void buttonClicked (Button*);
  17670. juce_UseDebuggingNewOperator
  17671. private:
  17672. TextButton* button;
  17673. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17674. ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17675. };
  17676. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17677. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17678. #endif
  17679. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17680. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17681. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17682. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17683. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17684. private ComboBoxListener
  17685. {
  17686. protected:
  17687. ChoicePropertyComponent (const String& propertyName);
  17688. public:
  17689. ChoicePropertyComponent (const Value& valueToControl,
  17690. const String& propertyName,
  17691. const StringArray& choices,
  17692. const Array <int>* choiceIDs = 0);
  17693. ~ChoicePropertyComponent();
  17694. virtual void setIndex (const int newIndex);
  17695. virtual int getIndex() const;
  17696. const StringArray& getChoices() const;
  17697. void refresh();
  17698. void comboBoxChanged (ComboBox*);
  17699. juce_UseDebuggingNewOperator
  17700. protected:
  17701. StringArray choices;
  17702. private:
  17703. ComboBox* comboBox;
  17704. void createComboBox (const Array <int>* choiceIDs);
  17705. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17706. ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17707. };
  17708. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17709. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17710. #endif
  17711. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17712. #endif
  17713. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17714. #endif
  17715. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17716. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17717. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17718. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17719. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17720. private SliderListener
  17721. {
  17722. protected:
  17723. SliderPropertyComponent (const String& propertyName,
  17724. const double rangeMin,
  17725. const double rangeMax,
  17726. const double interval,
  17727. const double skewFactor = 1.0);
  17728. public:
  17729. SliderPropertyComponent (Value& valueToControl,
  17730. const String& propertyName,
  17731. const double rangeMin,
  17732. const double rangeMax,
  17733. const double interval,
  17734. const double skewFactor = 1.0);
  17735. ~SliderPropertyComponent();
  17736. virtual void setValue (const double newValue);
  17737. virtual const double getValue() const;
  17738. void refresh();
  17739. void changeListenerCallback (void*);
  17740. void sliderValueChanged (Slider*);
  17741. juce_UseDebuggingNewOperator
  17742. protected:
  17743. Slider* slider;
  17744. SliderPropertyComponent (const SliderPropertyComponent&);
  17745. SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17746. };
  17747. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17748. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  17749. #endif
  17750. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17751. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  17752. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17753. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17754. class JUCE_API TextPropertyComponent : public PropertyComponent
  17755. {
  17756. protected:
  17757. TextPropertyComponent (const String& propertyName,
  17758. const int maxNumChars,
  17759. const bool isMultiLine);
  17760. public:
  17761. TextPropertyComponent (const Value& valueToControl,
  17762. const String& propertyName,
  17763. const int maxNumChars,
  17764. const bool isMultiLine);
  17765. ~TextPropertyComponent();
  17766. virtual void setText (const String& newText);
  17767. virtual const String getText() const;
  17768. void refresh();
  17769. void textWasEdited();
  17770. juce_UseDebuggingNewOperator
  17771. private:
  17772. Label* textEditor;
  17773. void createEditor (const int maxNumChars, const bool isMultiLine);
  17774. TextPropertyComponent (const TextPropertyComponent&);
  17775. TextPropertyComponent& operator= (const TextPropertyComponent&);
  17776. };
  17777. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17778. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  17779. #endif
  17780. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17781. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  17782. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17783. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17784. #if JUCE_WINDOWS || DOXYGEN
  17785. class JUCE_API ActiveXControlComponent : public Component
  17786. {
  17787. public:
  17788. ActiveXControlComponent();
  17789. ~ActiveXControlComponent();
  17790. bool createControl (const void* controlIID);
  17791. void deleteControl();
  17792. bool isControlOpen() const throw() { return control != 0; }
  17793. void* queryInterface (const void* iid) const;
  17794. void setMouseEventsAllowed (const bool eventsCanReachControl);
  17795. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  17796. void paint (Graphics& g);
  17797. void* originalWndProc;
  17798. juce_UseDebuggingNewOperator
  17799. private:
  17800. class ActiveXControlData;
  17801. friend class ActiveXControlData;
  17802. void* control;
  17803. bool mouseEventsAllowed;
  17804. ActiveXControlComponent (const ActiveXControlComponent&);
  17805. ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  17806. void setControlBounds (const Rectangle<int>& bounds) const;
  17807. void setControlVisible (const bool b) const;
  17808. };
  17809. #endif
  17810. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17811. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  17812. #endif
  17813. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17814. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  17815. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17816. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17817. class MidiInputSelectorComponentListBox;
  17818. class JUCE_API AudioDeviceSelectorComponent : public Component,
  17819. public ComboBoxListener,
  17820. public ButtonListener,
  17821. public ChangeListener
  17822. {
  17823. public:
  17824. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  17825. const int minAudioInputChannels,
  17826. const int maxAudioInputChannels,
  17827. const int minAudioOutputChannels,
  17828. const int maxAudioOutputChannels,
  17829. const bool showMidiInputOptions,
  17830. const bool showMidiOutputSelector,
  17831. const bool showChannelsAsStereoPairs,
  17832. const bool hideAdvancedOptionsWithButton);
  17833. ~AudioDeviceSelectorComponent();
  17834. void resized();
  17835. void comboBoxChanged (ComboBox*);
  17836. void buttonClicked (Button*);
  17837. void changeListenerCallback (void*);
  17838. void childBoundsChanged (Component*);
  17839. juce_UseDebuggingNewOperator
  17840. private:
  17841. AudioDeviceManager& deviceManager;
  17842. ComboBox* deviceTypeDropDown;
  17843. Label* deviceTypeDropDownLabel;
  17844. Component* audioDeviceSettingsComp;
  17845. String audioDeviceSettingsCompType;
  17846. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  17847. const bool showChannelsAsStereoPairs;
  17848. const bool hideAdvancedOptionsWithButton;
  17849. MidiInputSelectorComponentListBox* midiInputsList;
  17850. Label* midiInputsLabel;
  17851. ComboBox* midiOutputSelector;
  17852. Label* midiOutputLabel;
  17853. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  17854. AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  17855. };
  17856. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17857. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  17858. #endif
  17859. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17860. /*** Start of inlined file: juce_BubbleComponent.h ***/
  17861. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17862. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17863. class JUCE_API BubbleComponent : public Component
  17864. {
  17865. protected:
  17866. BubbleComponent();
  17867. public:
  17868. ~BubbleComponent();
  17869. enum BubblePlacement
  17870. {
  17871. above = 1,
  17872. below = 2,
  17873. left = 4,
  17874. right = 8
  17875. };
  17876. void setAllowedPlacement (const int newPlacement);
  17877. void setPosition (Component* componentToPointTo);
  17878. void setPosition (const int arrowTipX,
  17879. const int arrowTipY);
  17880. void setPosition (const Rectangle<int>& rectangleToPointTo);
  17881. protected:
  17882. virtual void getContentSize (int& width, int& height) = 0;
  17883. virtual void paintContent (Graphics& g, int width, int height) = 0;
  17884. public:
  17885. void paint (Graphics& g);
  17886. juce_UseDebuggingNewOperator
  17887. private:
  17888. Rectangle<int> content;
  17889. int side, allowablePlacements;
  17890. float arrowTipX, arrowTipY;
  17891. DropShadowEffect shadow;
  17892. BubbleComponent (const BubbleComponent&);
  17893. BubbleComponent& operator= (const BubbleComponent&);
  17894. };
  17895. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17896. /*** End of inlined file: juce_BubbleComponent.h ***/
  17897. #endif
  17898. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17899. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  17900. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17901. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17902. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  17903. private Timer
  17904. {
  17905. public:
  17906. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  17907. ~BubbleMessageComponent();
  17908. void showAt (int x, int y,
  17909. const String& message,
  17910. const int numMillisecondsBeforeRemoving,
  17911. const bool removeWhenMouseClicked = true,
  17912. const bool deleteSelfAfterUse = false);
  17913. void showAt (Component* const component,
  17914. const String& message,
  17915. const int numMillisecondsBeforeRemoving,
  17916. const bool removeWhenMouseClicked = true,
  17917. const bool deleteSelfAfterUse = false);
  17918. void getContentSize (int& w, int& h);
  17919. void paintContent (Graphics& g, int w, int h);
  17920. void timerCallback();
  17921. juce_UseDebuggingNewOperator
  17922. private:
  17923. int fadeOutLength, mouseClickCounter;
  17924. TextLayout textLayout;
  17925. int64 expiryTime;
  17926. bool deleteAfterUse;
  17927. void init (const int numMillisecondsBeforeRemoving,
  17928. const bool removeWhenMouseClicked,
  17929. const bool deleteSelfAfterUse);
  17930. BubbleMessageComponent (const BubbleMessageComponent&);
  17931. BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  17932. };
  17933. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17934. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  17935. #endif
  17936. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17937. /*** Start of inlined file: juce_ColourSelector.h ***/
  17938. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17939. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  17940. class JUCE_API ColourSelector : public Component,
  17941. public ChangeBroadcaster,
  17942. protected SliderListener
  17943. {
  17944. public:
  17945. enum ColourSelectorOptions
  17946. {
  17947. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  17948. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  17949. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  17950. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  17951. };
  17952. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  17953. const int edgeGap = 4,
  17954. const int gapAroundColourSpaceComponent = 7);
  17955. ~ColourSelector();
  17956. const Colour getCurrentColour() const;
  17957. void setCurrentColour (const Colour& newColour);
  17958. virtual int getNumSwatches() const;
  17959. virtual const Colour getSwatchColour (const int index) const;
  17960. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  17961. enum ColourIds
  17962. {
  17963. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  17964. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  17965. };
  17966. juce_UseDebuggingNewOperator
  17967. private:
  17968. friend class ColourSpaceView;
  17969. friend class HueSelectorComp;
  17970. Colour colour;
  17971. float h, s, v;
  17972. Slider* sliders[4];
  17973. Component* colourSpace;
  17974. Component* hueSelector;
  17975. class SwatchComponent;
  17976. OwnedArray <SwatchComponent> swatchComponents;
  17977. const int flags;
  17978. int topSpace, edgeGap;
  17979. void setHue (float newH);
  17980. void setSV (float newS, float newV);
  17981. void updateHSV();
  17982. void update();
  17983. void sliderValueChanged (Slider*);
  17984. void paint (Graphics& g);
  17985. void resized();
  17986. ColourSelector (const ColourSelector&);
  17987. ColourSelector& operator= (const ColourSelector&);
  17988. // this constructor is here temporarily to prevent old code compiling, because the parameters
  17989. // have changed - if you get an error here, update your code to use the new constructor instead..
  17990. // (xxx - note to self: remember to remove this at some point in the future)
  17991. ColourSelector (const bool);
  17992. };
  17993. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  17994. /*** End of inlined file: juce_ColourSelector.h ***/
  17995. #endif
  17996. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  17997. #endif
  17998. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17999. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18000. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18001. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18002. /*** Start of inlined file: juce_MouseInputSource.h ***/
  18003. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__x
  18004. #define __JUCE_MOUSEEVENT_JUCEHEADER__x
  18005. class Component;
  18006. class ComponentPeer;
  18007. class MouseInputSourceInternal;
  18008. class JUCE_API MouseInputSource
  18009. {
  18010. public:
  18011. MouseInputSource (int index, bool isMouseDevice);
  18012. ~MouseInputSource();
  18013. bool isMouse() const;
  18014. bool isTouch() const;
  18015. bool canHover() const;
  18016. bool hasMouseWheel() const;
  18017. int getIndex() const;
  18018. bool isDragging() const;
  18019. const Point<int> getScreenPosition() const;
  18020. const ModifierKeys getCurrentModifiers() const;
  18021. Component* getComponentUnderMouse() const;
  18022. void triggerFakeMove() const;
  18023. int getNumberOfMultipleClicks() const throw();
  18024. const Time getLastMouseDownTime() const throw();
  18025. const Point<int> getLastMouseDownPosition() const throw();
  18026. bool hasMouseMovedSignificantlySincePressed() const throw();
  18027. bool hasMouseCursor() const throw();
  18028. void showMouseCursor (const MouseCursor& cursor);
  18029. void hideCursor();
  18030. void revealCursor();
  18031. bool canDoUnboundedMovement() const throw();
  18032. void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false);
  18033. juce_UseDebuggingNewOperator
  18034. void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
  18035. void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
  18036. private:
  18037. friend class Desktop;
  18038. friend class ComponentPeer;
  18039. friend class MouseInputSourceInternal;
  18040. ScopedPointer<MouseInputSourceInternal> pimpl;
  18041. MouseInputSource (const MouseInputSource&);
  18042. MouseInputSource& operator= (const MouseInputSource&);
  18043. };
  18044. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  18045. /*** End of inlined file: juce_MouseInputSource.h ***/
  18046. class JUCE_API MagnifierComponent : public Component
  18047. {
  18048. public:
  18049. MagnifierComponent (Component* const contentComponent,
  18050. const bool deleteContentCompWhenNoLongerNeeded);
  18051. ~MagnifierComponent();
  18052. Component* getContentComponent() const { return content; }
  18053. void setScaleFactor (double newScaleFactor);
  18054. double getScaleFactor() const { return scaleFactor; }
  18055. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18056. juce_UseDebuggingNewOperator
  18057. void childBoundsChanged (Component*);
  18058. private:
  18059. Component* content;
  18060. Component* holderComp;
  18061. double scaleFactor;
  18062. ComponentPeer* peer;
  18063. bool deleteContent;
  18064. Graphics::ResamplingQuality quality;
  18065. MouseInputSource mouseSource;
  18066. void paint (Graphics& g);
  18067. void mouseDown (const MouseEvent& e);
  18068. void mouseUp (const MouseEvent& e);
  18069. void mouseDrag (const MouseEvent& e);
  18070. void mouseMove (const MouseEvent& e);
  18071. void mouseEnter (const MouseEvent& e);
  18072. void mouseExit (const MouseEvent& e);
  18073. void mouseWheelMove (const MouseEvent& e, float, float);
  18074. void passOnMouseEventToPeer (const MouseEvent& e);
  18075. int scaleInt (const int n) const;
  18076. MagnifierComponent (const MagnifierComponent&);
  18077. MagnifierComponent& operator= (const MagnifierComponent&);
  18078. };
  18079. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18080. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18081. #endif
  18082. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18083. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18084. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18085. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18086. class JUCE_API MidiKeyboardComponent : public Component,
  18087. public MidiKeyboardStateListener,
  18088. public ChangeBroadcaster,
  18089. private Timer,
  18090. private AsyncUpdater
  18091. {
  18092. public:
  18093. enum Orientation
  18094. {
  18095. horizontalKeyboard,
  18096. verticalKeyboardFacingLeft,
  18097. verticalKeyboardFacingRight,
  18098. };
  18099. MidiKeyboardComponent (MidiKeyboardState& state,
  18100. const Orientation orientation);
  18101. ~MidiKeyboardComponent();
  18102. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18103. void setMidiChannel (const int midiChannelNumber);
  18104. int getMidiChannel() const throw() { return midiChannel; }
  18105. void setMidiChannelsToDisplay (const int midiChannelMask);
  18106. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18107. void setKeyWidth (const float widthInPixels);
  18108. float getKeyWidth() const throw() { return keyWidth; }
  18109. void setOrientation (const Orientation newOrientation);
  18110. const Orientation getOrientation() const throw() { return orientation; }
  18111. void setAvailableRange (const int lowestNote,
  18112. const int highestNote);
  18113. int getRangeStart() const throw() { return rangeStart; }
  18114. int getRangeEnd() const throw() { return rangeEnd; }
  18115. void setLowestVisibleKey (int noteNumber);
  18116. int getLowestVisibleKey() const throw() { return firstKey; }
  18117. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18118. void setScrollButtonsVisible (const bool canScroll);
  18119. enum ColourIds
  18120. {
  18121. whiteNoteColourId = 0x1005000,
  18122. blackNoteColourId = 0x1005001,
  18123. keySeparatorLineColourId = 0x1005002,
  18124. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18125. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18126. textLabelColourId = 0x1005005,
  18127. upDownButtonBackgroundColourId = 0x1005006,
  18128. upDownButtonArrowColourId = 0x1005007
  18129. };
  18130. int getKeyStartPosition (const int midiNoteNumber) const;
  18131. void clearKeyMappings();
  18132. void setKeyPressForNote (const KeyPress& key,
  18133. const int midiNoteOffsetFromC);
  18134. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18135. void setKeyPressBaseOctave (const int newOctaveNumber);
  18136. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18137. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18138. void paint (Graphics& g);
  18139. void resized();
  18140. void mouseMove (const MouseEvent& e);
  18141. void mouseDrag (const MouseEvent& e);
  18142. void mouseDown (const MouseEvent& e);
  18143. void mouseUp (const MouseEvent& e);
  18144. void mouseEnter (const MouseEvent& e);
  18145. void mouseExit (const MouseEvent& e);
  18146. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18147. void timerCallback();
  18148. bool keyStateChanged (const bool isKeyDown);
  18149. void focusLost (FocusChangeType cause);
  18150. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18151. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18152. void handleAsyncUpdate();
  18153. void colourChanged();
  18154. juce_UseDebuggingNewOperator
  18155. protected:
  18156. friend class MidiKeyboardUpDownButton;
  18157. virtual void drawWhiteNote (int midiNoteNumber,
  18158. Graphics& g,
  18159. int x, int y, int w, int h,
  18160. bool isDown, bool isOver,
  18161. const Colour& lineColour,
  18162. const Colour& textColour);
  18163. virtual void drawBlackNote (int midiNoteNumber,
  18164. Graphics& g,
  18165. int x, int y, int w, int h,
  18166. bool isDown, bool isOver,
  18167. const Colour& noteFillColour);
  18168. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18169. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18170. const bool isMouseOver,
  18171. const bool isButtonPressed,
  18172. const bool movesOctavesUp);
  18173. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18174. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18175. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18176. int& x, int& w) const;
  18177. private:
  18178. MidiKeyboardState& state;
  18179. int xOffset, blackNoteLength;
  18180. float keyWidth;
  18181. Orientation orientation;
  18182. int midiChannel, midiInChannelMask;
  18183. float velocity;
  18184. int noteUnderMouse, mouseDownNote;
  18185. BitArray keysPressed, keysCurrentlyDrawnDown;
  18186. int rangeStart, rangeEnd, firstKey;
  18187. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18188. Button* scrollDown;
  18189. Button* scrollUp;
  18190. Array <KeyPress> keyPresses;
  18191. Array <int> keyPressNotes;
  18192. int keyMappingOctave;
  18193. int octaveNumForMiddleC;
  18194. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18195. int xyToNote (const Point<int>& pos, float& mousePositionVelocity);
  18196. int remappedXYToNote (const Point<int>& pos, float& mousePositionVelocity) const;
  18197. void resetAnyKeysInUse();
  18198. void updateNoteUnderMouse (const Point<int>& pos);
  18199. void repaintNote (const int midiNoteNumber);
  18200. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18201. MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18202. };
  18203. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18204. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18205. #endif
  18206. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18207. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18208. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18209. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18210. #if ! DOXYGEN
  18211. class NSViewComponentInternal;
  18212. #endif
  18213. #if JUCE_MAC || DOXYGEN
  18214. class JUCE_API NSViewComponent : public Component
  18215. {
  18216. public:
  18217. NSViewComponent();
  18218. ~NSViewComponent();
  18219. void setView (void* nsView);
  18220. void* getView() const;
  18221. void paint (Graphics& g);
  18222. juce_UseDebuggingNewOperator
  18223. private:
  18224. friend class NSViewComponentInternal;
  18225. ScopedPointer <NSViewComponentInternal> info;
  18226. NSViewComponent (const NSViewComponent&);
  18227. NSViewComponent& operator= (const NSViewComponent&);
  18228. };
  18229. #endif
  18230. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18231. /*** End of inlined file: juce_NSViewComponent.h ***/
  18232. #endif
  18233. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18234. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18235. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18236. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18237. // this is used to disable OpenGL, and is defined in juce_Config.h
  18238. #if JUCE_OPENGL || DOXYGEN
  18239. class JUCE_API OpenGLPixelFormat
  18240. {
  18241. public:
  18242. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18243. const int alphaBits = 8,
  18244. const int depthBufferBits = 16,
  18245. const int stencilBufferBits = 0) throw();
  18246. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18247. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18248. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18249. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18250. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18251. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18252. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18253. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18254. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18255. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18256. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18257. static void getAvailablePixelFormats (Component* component,
  18258. OwnedArray <OpenGLPixelFormat>& results);
  18259. bool operator== (const OpenGLPixelFormat&) const throw();
  18260. juce_UseDebuggingNewOperator
  18261. };
  18262. class JUCE_API OpenGLContext
  18263. {
  18264. public:
  18265. virtual ~OpenGLContext();
  18266. virtual bool makeActive() const throw() = 0;
  18267. virtual bool makeInactive() const throw() = 0;
  18268. virtual bool isActive() const throw() = 0;
  18269. virtual void swapBuffers() = 0;
  18270. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18271. virtual int getSwapInterval() const = 0;
  18272. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18273. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18274. virtual void repaint() = 0;
  18275. virtual void* getRawContext() const throw() = 0;
  18276. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18277. const OpenGLPixelFormat& pixelFormat,
  18278. const OpenGLContext* const contextToShareWith);
  18279. static OpenGLContext* getCurrentContext();
  18280. juce_UseDebuggingNewOperator
  18281. protected:
  18282. OpenGLContext() throw();
  18283. };
  18284. class JUCE_API OpenGLComponent : public Component
  18285. {
  18286. public:
  18287. OpenGLComponent();
  18288. ~OpenGLComponent();
  18289. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18290. const OpenGLPixelFormat getPixelFormat() const;
  18291. void shareWith (OpenGLContext* contextToShareListsWith);
  18292. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18293. void swapBuffers();
  18294. virtual void renderOpenGL() = 0;
  18295. virtual void newOpenGLContextCreated() = 0;
  18296. OpenGLContext* getCurrentContext() const throw() { return context; }
  18297. bool makeCurrentContextActive();
  18298. void makeCurrentContextInactive();
  18299. bool isActiveContext() const throw();
  18300. virtual bool renderAndSwapBuffers();
  18301. CriticalSection& getContextLock() throw() { return contextLock; }
  18302. void paint (Graphics& g);
  18303. void* getNativeWindowHandle() const;
  18304. juce_UseDebuggingNewOperator
  18305. private:
  18306. class OpenGLComponentWatcher;
  18307. friend class OpenGLComponentWatcher;
  18308. friend class ScopedPointer <OpenGLComponentWatcher>;
  18309. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18310. OpenGLContext* context;
  18311. OpenGLContext* contextToShareListsWith;
  18312. CriticalSection contextLock;
  18313. OpenGLPixelFormat preferredPixelFormat;
  18314. bool needToUpdateViewport;
  18315. void deleteContext();
  18316. void updateContextPosition();
  18317. void internalRepaint (int x, int y, int w, int h);
  18318. OpenGLComponent (const OpenGLComponent&);
  18319. OpenGLComponent& operator= (const OpenGLComponent&);
  18320. };
  18321. #endif
  18322. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18323. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18324. #endif
  18325. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18326. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18327. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18328. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18329. class JUCE_API PreferencesPanel : public Component,
  18330. private ButtonListener
  18331. {
  18332. public:
  18333. PreferencesPanel();
  18334. ~PreferencesPanel();
  18335. void addSettingsPage (const String& pageTitle,
  18336. const Drawable* normalIcon,
  18337. const Drawable* overIcon,
  18338. const Drawable* downIcon);
  18339. void addSettingsPage (const String& pageTitle,
  18340. const char* imageData,
  18341. const int imageDataSize);
  18342. void showInDialogBox (const String& dialogtitle,
  18343. int dialogWidth,
  18344. int dialogHeight,
  18345. const Colour& backgroundColour = Colours::white);
  18346. virtual Component* createComponentForPage (const String& pageName) = 0;
  18347. void setCurrentPage (const String& pageName);
  18348. void resized();
  18349. void paint (Graphics& g);
  18350. void buttonClicked (Button* button);
  18351. juce_UseDebuggingNewOperator
  18352. private:
  18353. String currentPageName;
  18354. ScopedPointer <Component> currentPage;
  18355. int buttonSize;
  18356. PreferencesPanel (const PreferencesPanel&);
  18357. PreferencesPanel& operator= (const PreferencesPanel&);
  18358. };
  18359. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18360. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18361. #endif
  18362. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18363. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18364. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18365. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18366. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18367. // amalgamated build)
  18368. #if JUCE_WINDOWS
  18369. typedef ActiveXControlComponent QTCompBaseClass;
  18370. #elif JUCE_MAC
  18371. typedef NSViewComponent QTCompBaseClass;
  18372. #endif
  18373. // this is used to disable QuickTime, and is defined in juce_Config.h
  18374. #if JUCE_QUICKTIME || DOXYGEN
  18375. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18376. {
  18377. public:
  18378. QuickTimeMovieComponent();
  18379. ~QuickTimeMovieComponent();
  18380. static bool isQuickTimeAvailable() throw();
  18381. bool loadMovie (const File& movieFile,
  18382. const bool isControllerVisible);
  18383. bool loadMovie (const URL& movieURL,
  18384. const bool isControllerVisible);
  18385. bool loadMovie (InputStream* movieStream,
  18386. const bool isControllerVisible);
  18387. void closeMovie();
  18388. const File getCurrentMovieFile() const;
  18389. bool isMovieOpen() const;
  18390. double getMovieDuration() const;
  18391. void getMovieNormalSize (int& width, int& height) const;
  18392. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18393. const RectanglePlacement& placement);
  18394. void play();
  18395. void stop();
  18396. bool isPlaying() const;
  18397. void goToStart();
  18398. void setPosition (const double seconds);
  18399. double getPosition() const;
  18400. void setSpeed (const float newSpeed);
  18401. void setMovieVolume (const float newVolume);
  18402. float getMovieVolume() const;
  18403. void setLooping (const bool shouldLoop);
  18404. bool isLooping() const;
  18405. bool isControllerVisible() const;
  18406. void paint (Graphics& g);
  18407. juce_UseDebuggingNewOperator
  18408. private:
  18409. File movieFile;
  18410. bool movieLoaded, controllerVisible, looping;
  18411. #if JUCE_WINDOWS
  18412. void parentHierarchyChanged();
  18413. void visibilityChanged();
  18414. void createControlIfNeeded();
  18415. bool isControlCreated() const;
  18416. void* internal;
  18417. #else
  18418. void* movie;
  18419. #endif
  18420. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18421. QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18422. };
  18423. #endif
  18424. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18425. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18426. #endif
  18427. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18428. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18429. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18430. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18431. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18432. class JUCE_API SystemTrayIconComponent : public Component
  18433. {
  18434. public:
  18435. SystemTrayIconComponent();
  18436. ~SystemTrayIconComponent();
  18437. void setIconImage (const Image& newImage);
  18438. void setIconTooltip (const String& tooltip);
  18439. #if JUCE_LINUX
  18440. void paint (Graphics& g);
  18441. #endif
  18442. juce_UseDebuggingNewOperator
  18443. private:
  18444. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18445. SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18446. };
  18447. #endif
  18448. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18449. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18450. #endif
  18451. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18452. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18453. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18454. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18455. #if JUCE_WEB_BROWSER || DOXYGEN
  18456. #if ! DOXYGEN
  18457. class WebBrowserComponentInternal;
  18458. #endif
  18459. class JUCE_API WebBrowserComponent : public Component
  18460. {
  18461. public:
  18462. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18463. ~WebBrowserComponent();
  18464. void goToURL (const String& url,
  18465. const StringArray* headers = 0,
  18466. const MemoryBlock* postData = 0);
  18467. void stop();
  18468. void goBack();
  18469. void goForward();
  18470. void refresh();
  18471. virtual bool pageAboutToLoad (const String& newURL);
  18472. void paint (Graphics& g);
  18473. void resized();
  18474. void parentHierarchyChanged();
  18475. void visibilityChanged();
  18476. juce_UseDebuggingNewOperator
  18477. private:
  18478. WebBrowserComponentInternal* browser;
  18479. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18480. String lastURL;
  18481. StringArray lastHeaders;
  18482. MemoryBlock lastPostData;
  18483. void reloadLastURL();
  18484. void checkWindowAssociation();
  18485. WebBrowserComponent (const WebBrowserComponent&);
  18486. WebBrowserComponent& operator= (const WebBrowserComponent&);
  18487. };
  18488. #endif
  18489. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18490. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18491. #endif
  18492. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18493. #endif
  18494. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18495. /*** Start of inlined file: juce_ComponentPeer.h ***/
  18496. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18497. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  18498. class ComponentBoundsConstrainer;
  18499. class JUCE_API ComponentPeer
  18500. {
  18501. public:
  18502. enum StyleFlags
  18503. {
  18504. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  18505. entry on the taskbar (ignored on MacOSX) */
  18506. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  18507. tooltip, etc. */
  18508. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  18509. through it (may not be possible on some platforms). */
  18510. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  18511. title bar and frame\. if not specified, the window will be
  18512. borderless. */
  18513. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  18514. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  18515. minimise button on it. */
  18516. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  18517. maximise button on it. */
  18518. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  18519. close button on it. */
  18520. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  18521. not be possible on all platforms). */
  18522. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  18523. do its own repainting, but only to repaint when the
  18524. performAnyPendingRepaintsNow() method is called. */
  18525. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  18526. be used for things like plugin windows, to stop them interfering
  18527. with the host's shortcut keys */
  18528. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  18529. };
  18530. ComponentPeer (Component* const component,
  18531. const int styleFlags) throw();
  18532. virtual ~ComponentPeer();
  18533. Component* getComponent() const throw() { return component; }
  18534. int getStyleFlags() const throw() { return styleFlags; }
  18535. virtual void* getNativeHandle() const = 0;
  18536. virtual void setVisible (bool shouldBeVisible) = 0;
  18537. virtual void setTitle (const String& title) = 0;
  18538. virtual void setPosition (int x, int y) = 0;
  18539. virtual void setSize (int w, int h) = 0;
  18540. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  18541. virtual const Rectangle<int> getBounds() const = 0;
  18542. virtual const Point<int> getScreenPosition() const = 0;
  18543. virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
  18544. virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
  18545. virtual void setMinimised (bool shouldBeMinimised) = 0;
  18546. virtual bool isMinimised() const = 0;
  18547. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  18548. virtual bool isFullScreen() const = 0;
  18549. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  18550. const Rectangle<int>& getNonFullScreenBounds() const throw();
  18551. virtual void setIcon (const Image& newIcon) = 0;
  18552. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  18553. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  18554. virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0;
  18555. virtual const BorderSize getFrameSize() const = 0;
  18556. void handleMovedOrResized();
  18557. void handleScreenSizeChange();
  18558. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  18559. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  18560. virtual void toFront (bool makeActive) = 0;
  18561. virtual void toBehind (ComponentPeer* other) = 0;
  18562. void handleBroughtToFront();
  18563. virtual bool isFocused() const = 0;
  18564. virtual void grabFocus() = 0;
  18565. virtual void textInputRequired (const Point<int>& position) = 0;
  18566. void handleFocusGain();
  18567. void handleFocusLoss();
  18568. Component* getLastFocusedSubcomponent() const throw();
  18569. bool handleKeyPress (const int keyCode,
  18570. const juce_wchar textCharacter);
  18571. bool handleKeyUpOrDown (const bool isKeyDown);
  18572. void handleModifierKeysChange();
  18573. TextInputTarget* findCurrentTextInputTarget();
  18574. virtual void repaint (int x, int y, int w, int h) = 0;
  18575. virtual void performAnyPendingRepaintsNow() = 0;
  18576. void handleMouseEvent (const Point<int>& positionWithinPeer, const ModifierKeys& newMods, const int64 time);
  18577. void handleMouseWheel (const Point<int>& positionWithinPeer, const int64 time, float x, float y);
  18578. void handleUserClosingWindow();
  18579. void handleFileDragMove (const StringArray& files, const Point<int>& position);
  18580. void handleFileDragExit (const StringArray& files);
  18581. void handleFileDragDrop (const StringArray& files, const Point<int>& position);
  18582. void clearMaskedRegion() throw();
  18583. void addMaskedRegion (int x, int y, int w, int h) throw();
  18584. static int getNumPeers() throw();
  18585. static ComponentPeer* getPeer (const int index) throw();
  18586. static bool isValidPeer (const ComponentPeer* const peer) throw();
  18587. static void bringModalComponentToFront();
  18588. virtual const StringArray getAvailableRenderingEngines() throw();
  18589. virtual int getCurrentRenderingEngine() throw();
  18590. virtual void setCurrentRenderingEngine (int index) throw();
  18591. juce_UseDebuggingNewOperator
  18592. protected:
  18593. Component* const component;
  18594. const int styleFlags;
  18595. RectangleList maskedRegion;
  18596. Rectangle<int> lastNonFullscreenBounds;
  18597. uint32 lastPaintTime;
  18598. ComponentBoundsConstrainer* constrainer;
  18599. static void updateCurrentModifiers() throw();
  18600. private:
  18601. Component* lastFocusedComponent;
  18602. Component::SafePointer<Component> dragAndDropTargetComponent;
  18603. Component* lastDragAndDropCompUnderMouse;
  18604. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  18605. friend class Component;
  18606. static ComponentPeer* getPeerFor (const Component* const component) throw();
  18607. void setLastDragDropTarget (Component* comp);
  18608. ComponentPeer (const ComponentPeer&);
  18609. ComponentPeer& operator= (const ComponentPeer&);
  18610. };
  18611. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  18612. /*** End of inlined file: juce_ComponentPeer.h ***/
  18613. #endif
  18614. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18615. /*** Start of inlined file: juce_DialogWindow.h ***/
  18616. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18617. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18618. class JUCE_API DialogWindow : public DocumentWindow
  18619. {
  18620. public:
  18621. DialogWindow (const String& name,
  18622. const Colour& backgroundColour,
  18623. const bool escapeKeyTriggersCloseButton,
  18624. const bool addToDesktop = true);
  18625. ~DialogWindow();
  18626. static int showModalDialog (const String& dialogTitle,
  18627. Component* contentComponent,
  18628. Component* componentToCentreAround,
  18629. const Colour& backgroundColour,
  18630. const bool escapeKeyTriggersCloseButton,
  18631. const bool shouldBeResizable = false,
  18632. const bool useBottomRightCornerResizer = false);
  18633. juce_UseDebuggingNewOperator
  18634. protected:
  18635. void resized();
  18636. private:
  18637. bool escapeKeyTriggersCloseButton;
  18638. DialogWindow (const DialogWindow&);
  18639. DialogWindow& operator= (const DialogWindow&);
  18640. };
  18641. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18642. /*** End of inlined file: juce_DialogWindow.h ***/
  18643. #endif
  18644. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18645. #endif
  18646. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18647. #endif
  18648. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18649. /*** Start of inlined file: juce_SplashScreen.h ***/
  18650. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18651. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18652. class JUCE_API SplashScreen : public Component,
  18653. public Timer,
  18654. private DeletedAtShutdown
  18655. {
  18656. public:
  18657. SplashScreen();
  18658. ~SplashScreen();
  18659. void show (const String& title,
  18660. Image* const backgroundImage,
  18661. const int minimumTimeToDisplayFor,
  18662. const bool useDropShadow,
  18663. const bool removeOnMouseClick = true);
  18664. void show (const String& title,
  18665. const int width,
  18666. const int height,
  18667. const int minimumTimeToDisplayFor,
  18668. const bool useDropShadow,
  18669. const bool removeOnMouseClick = true);
  18670. void paint (Graphics& g);
  18671. void timerCallback();
  18672. juce_UseDebuggingNewOperator
  18673. private:
  18674. Image* backgroundImage;
  18675. Time earliestTimeToDelete;
  18676. int originalClickCounter;
  18677. SplashScreen (const SplashScreen&);
  18678. SplashScreen& operator= (const SplashScreen&);
  18679. };
  18680. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18681. /*** End of inlined file: juce_SplashScreen.h ***/
  18682. #endif
  18683. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18684. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18685. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18686. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18687. class JUCE_API ThreadWithProgressWindow : public Thread,
  18688. private Timer
  18689. {
  18690. public:
  18691. ThreadWithProgressWindow (const String& windowTitle,
  18692. const bool hasProgressBar,
  18693. const bool hasCancelButton,
  18694. const int timeOutMsWhenCancelling = 10000,
  18695. const String& cancelButtonText = JUCE_T("Cancel"));
  18696. ~ThreadWithProgressWindow();
  18697. bool runThread (const int threadPriority = 5);
  18698. void setProgress (const double newProgress);
  18699. void setStatusMessage (const String& newStatusMessage);
  18700. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18701. juce_UseDebuggingNewOperator
  18702. private:
  18703. void timerCallback();
  18704. double progress;
  18705. ScopedPointer <AlertWindow> alertWindow;
  18706. String message;
  18707. CriticalSection messageLock;
  18708. const int timeOutMsWhenCancelling;
  18709. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18710. ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18711. };
  18712. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18713. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18714. #endif
  18715. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18716. #endif
  18717. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18718. #endif
  18719. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18720. #endif
  18721. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18722. #endif
  18723. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18724. #endif
  18725. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18726. #endif
  18727. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18728. #endif
  18729. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18730. #endif
  18731. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18732. #endif
  18733. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18734. #endif
  18735. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18736. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18737. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18738. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18739. class JUCE_API LowLevelGraphicsContext
  18740. {
  18741. protected:
  18742. LowLevelGraphicsContext();
  18743. public:
  18744. virtual ~LowLevelGraphicsContext();
  18745. virtual bool isVectorDevice() const = 0;
  18746. virtual void setOrigin (int x, int y) = 0;
  18747. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18748. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18749. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18750. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18751. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18752. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18753. virtual const Rectangle<int> getClipBounds() const = 0;
  18754. virtual bool isClipEmpty() const = 0;
  18755. virtual void saveState() = 0;
  18756. virtual void restoreState() = 0;
  18757. virtual void setFill (const FillType& fillType) = 0;
  18758. virtual void setOpacity (float newOpacity) = 0;
  18759. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18760. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18761. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18762. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18763. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18764. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18765. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18766. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18767. virtual void setFont (const Font& newFont) = 0;
  18768. virtual const Font getFont() = 0;
  18769. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18770. };
  18771. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18772. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18773. #endif
  18774. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18775. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18776. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18777. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18778. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18779. {
  18780. public:
  18781. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18782. const String& documentTitle,
  18783. const int totalWidth,
  18784. const int totalHeight);
  18785. ~LowLevelGraphicsPostScriptRenderer();
  18786. bool isVectorDevice() const;
  18787. void setOrigin (int x, int y);
  18788. bool clipToRectangle (const Rectangle<int>& r);
  18789. bool clipToRectangleList (const RectangleList& clipRegion);
  18790. void excludeClipRectangle (const Rectangle<int>& r);
  18791. void clipToPath (const Path& path, const AffineTransform& transform);
  18792. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18793. void saveState();
  18794. void restoreState();
  18795. bool clipRegionIntersects (const Rectangle<int>& r);
  18796. const Rectangle<int> getClipBounds() const;
  18797. bool isClipEmpty() const;
  18798. void setFill (const FillType& fillType);
  18799. void setOpacity (float opacity);
  18800. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18801. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18802. void fillPath (const Path& path, const AffineTransform& transform);
  18803. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18804. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18805. void drawLine (double x1, double y1, double x2, double y2);
  18806. void drawVerticalLine (const int x, double top, double bottom);
  18807. void drawHorizontalLine (const int x, double top, double bottom);
  18808. const Font getFont();
  18809. void setFont (const Font& newFont);
  18810. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18811. juce_UseDebuggingNewOperator
  18812. protected:
  18813. OutputStream& out;
  18814. int totalWidth, totalHeight;
  18815. bool needToClip;
  18816. Colour lastColour;
  18817. struct SavedState
  18818. {
  18819. SavedState();
  18820. ~SavedState();
  18821. RectangleList clip;
  18822. int xOffset, yOffset;
  18823. FillType fillType;
  18824. Font font;
  18825. private:
  18826. SavedState& operator= (const SavedState&);
  18827. };
  18828. OwnedArray <SavedState> stateStack;
  18829. void writeClip();
  18830. void writeColour (const Colour& colour);
  18831. void writePath (const Path& path) const;
  18832. void writeXY (const float x, const float y) const;
  18833. void writeTransform (const AffineTransform& trans) const;
  18834. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  18835. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18836. LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18837. };
  18838. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18839. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18840. #endif
  18841. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18842. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18843. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18844. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18845. class LLGCSavedState;
  18846. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18847. {
  18848. public:
  18849. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18850. ~LowLevelGraphicsSoftwareRenderer();
  18851. bool isVectorDevice() const;
  18852. void setOrigin (int x, int y);
  18853. bool clipToRectangle (const Rectangle<int>& r);
  18854. bool clipToRectangleList (const RectangleList& clipRegion);
  18855. void excludeClipRectangle (const Rectangle<int>& r);
  18856. void clipToPath (const Path& path, const AffineTransform& transform);
  18857. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18858. bool clipRegionIntersects (const Rectangle<int>& r);
  18859. const Rectangle<int> getClipBounds() const;
  18860. bool isClipEmpty() const;
  18861. void saveState();
  18862. void restoreState();
  18863. void setFill (const FillType& fillType);
  18864. void setOpacity (float opacity);
  18865. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18866. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18867. void fillPath (const Path& path, const AffineTransform& transform);
  18868. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18869. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18870. void drawLine (double x1, double y1, double x2, double y2);
  18871. void drawVerticalLine (const int x, double top, double bottom);
  18872. void drawHorizontalLine (const int x, double top, double bottom);
  18873. void setFont (const Font& newFont);
  18874. const Font getFont();
  18875. void drawGlyph (int glyphNumber, float x, float y);
  18876. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18877. juce_UseDebuggingNewOperator
  18878. protected:
  18879. Image& image;
  18880. ScopedPointer <LLGCSavedState> currentState;
  18881. OwnedArray <LLGCSavedState> stateStack;
  18882. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  18883. LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  18884. };
  18885. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18886. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18887. #endif
  18888. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  18889. #endif
  18890. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  18891. #endif
  18892. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18893. /*** Start of inlined file: juce_DrawableComposite.h ***/
  18894. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18895. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18896. class JUCE_API DrawableComposite : public Drawable
  18897. {
  18898. public:
  18899. DrawableComposite();
  18900. virtual ~DrawableComposite();
  18901. void insertDrawable (Drawable* drawable,
  18902. const AffineTransform& transform = AffineTransform::identity,
  18903. const int index = -1);
  18904. void insertDrawable (const Drawable& drawable,
  18905. const AffineTransform& transform = AffineTransform::identity,
  18906. const int index = -1);
  18907. void removeDrawable (const int index, const bool deleteDrawable = true);
  18908. int getNumDrawables() const throw() { return drawables.size(); }
  18909. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  18910. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  18911. void bringToFront (const int index);
  18912. void render (const Drawable::RenderingContext& context) const;
  18913. const Rectangle<float> getBounds() const;
  18914. bool hitTest (float x, float y) const;
  18915. Drawable* createCopy() const;
  18916. ValueTree createValueTree() const throw();
  18917. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  18918. juce_UseDebuggingNewOperator
  18919. private:
  18920. OwnedArray <Drawable> drawables;
  18921. OwnedArray <AffineTransform> transforms;
  18922. DrawableComposite (const DrawableComposite&);
  18923. DrawableComposite& operator= (const DrawableComposite&);
  18924. };
  18925. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18926. /*** End of inlined file: juce_DrawableComposite.h ***/
  18927. #endif
  18928. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18929. /*** Start of inlined file: juce_DrawableImage.h ***/
  18930. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18931. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18932. class JUCE_API DrawableImage : public Drawable
  18933. {
  18934. public:
  18935. DrawableImage();
  18936. virtual ~DrawableImage();
  18937. void setImage (const Image& imageToCopy);
  18938. void setImage (Image* imageToUse,
  18939. const bool releaseWhenNotNeeded);
  18940. Image* getImage() const throw() { return image; }
  18941. void clearImage();
  18942. void setOpacity (const float newOpacity);
  18943. float getOpacity() const throw() { return opacity; }
  18944. void setOverlayColour (const Colour& newOverlayColour);
  18945. const Colour& getOverlayColour() const throw() { return overlayColour; }
  18946. void render (const Drawable::RenderingContext& context) const;
  18947. const Rectangle<float> getBounds() const;
  18948. bool hitTest (float x, float y) const;
  18949. Drawable* createCopy() const;
  18950. ValueTree createValueTree() const throw();
  18951. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  18952. juce_UseDebuggingNewOperator
  18953. private:
  18954. Image* image;
  18955. bool canDeleteImage;
  18956. float opacity;
  18957. Colour overlayColour;
  18958. DrawableImage (const DrawableImage&);
  18959. DrawableImage& operator= (const DrawableImage&);
  18960. };
  18961. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18962. /*** End of inlined file: juce_DrawableImage.h ***/
  18963. #endif
  18964. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18965. /*** Start of inlined file: juce_DrawablePath.h ***/
  18966. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18967. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  18968. class JUCE_API DrawablePath : public Drawable
  18969. {
  18970. public:
  18971. DrawablePath();
  18972. virtual ~DrawablePath();
  18973. void setPath (const Path& newPath) throw();
  18974. const Path& getPath() const throw() { return path; }
  18975. void setFill (const FillType& newFill) throw();
  18976. const FillType& getFill() const throw() { return mainFill; }
  18977. void setStrokeFill (const FillType& newStrokeFill) throw();
  18978. const FillType& getStrokeFill() const throw() { return strokeFill; }
  18979. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  18980. void setStrokeThickness (const float newThickness) throw();
  18981. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  18982. void render (const Drawable::RenderingContext& context) const;
  18983. const Rectangle<float> getBounds() const;
  18984. bool hitTest (float x, float y) const;
  18985. Drawable* createCopy() const;
  18986. ValueTree createValueTree() const throw();
  18987. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  18988. juce_UseDebuggingNewOperator
  18989. private:
  18990. Path path, stroke;
  18991. FillType mainFill, strokeFill;
  18992. PathStrokeType strokeType;
  18993. void updateOutline();
  18994. DrawablePath (const DrawablePath&);
  18995. DrawablePath& operator= (const DrawablePath&);
  18996. };
  18997. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  18998. /*** End of inlined file: juce_DrawablePath.h ***/
  18999. #endif
  19000. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19001. /*** Start of inlined file: juce_DrawableText.h ***/
  19002. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  19003. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  19004. class JUCE_API DrawableText : public Drawable
  19005. {
  19006. public:
  19007. DrawableText();
  19008. virtual ~DrawableText();
  19009. void setText (const GlyphArrangement& newText);
  19010. void setText (const String& newText, const Font& fontToUse);
  19011. const GlyphArrangement& getText() const throw() { return text; }
  19012. void setColour (const Colour& newColour);
  19013. const Colour& getColour() const throw() { return colour; }
  19014. void render (const Drawable::RenderingContext& context) const;
  19015. const Rectangle<float> getBounds() const;
  19016. bool hitTest (float x, float y) const;
  19017. Drawable* createCopy() const;
  19018. ValueTree createValueTree() const throw();
  19019. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  19020. juce_UseDebuggingNewOperator
  19021. private:
  19022. GlyphArrangement text;
  19023. Colour colour;
  19024. DrawableText (const DrawableText&);
  19025. DrawableText& operator= (const DrawableText&);
  19026. };
  19027. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  19028. /*** End of inlined file: juce_DrawableText.h ***/
  19029. #endif
  19030. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  19031. #endif
  19032. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19033. /*** Start of inlined file: juce_GlowEffect.h ***/
  19034. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  19035. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  19036. class JUCE_API GlowEffect : public ImageEffectFilter
  19037. {
  19038. public:
  19039. GlowEffect();
  19040. ~GlowEffect();
  19041. void setGlowProperties (const float newRadius,
  19042. const Colour& newColour);
  19043. void applyEffect (Image& sourceImage, Graphics& destContext);
  19044. juce_UseDebuggingNewOperator
  19045. private:
  19046. float radius;
  19047. Colour colour;
  19048. };
  19049. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  19050. /*** End of inlined file: juce_GlowEffect.h ***/
  19051. #endif
  19052. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  19053. #endif
  19054. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19055. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  19056. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19057. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19058. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19059. {
  19060. public:
  19061. ReduceOpacityEffect (const float opacity = 1.0f);
  19062. ~ReduceOpacityEffect();
  19063. void setOpacity (const float newOpacity);
  19064. void applyEffect (Image& sourceImage, Graphics& destContext);
  19065. juce_UseDebuggingNewOperator
  19066. private:
  19067. float opacity;
  19068. };
  19069. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19070. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19071. #endif
  19072. #ifndef __JUCE_FONT_JUCEHEADER__
  19073. #endif
  19074. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19075. #endif
  19076. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19077. #endif
  19078. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19079. #endif
  19080. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19081. #endif
  19082. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19083. #endif
  19084. #ifndef __JUCE_LINE_JUCEHEADER__
  19085. #endif
  19086. #ifndef __JUCE_PATH_JUCEHEADER__
  19087. #endif
  19088. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19089. /*** Start of inlined file: juce_PathIterator.h ***/
  19090. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19091. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19092. class JUCE_API PathFlatteningIterator
  19093. {
  19094. public:
  19095. PathFlatteningIterator (const Path& path,
  19096. const AffineTransform& transform = AffineTransform::identity,
  19097. float tolerence = 6.0f) throw();
  19098. ~PathFlatteningIterator() throw();
  19099. bool next() throw();
  19100. float x1;
  19101. float y1;
  19102. float x2;
  19103. float y2;
  19104. bool closesSubPath;
  19105. int subPathIndex;
  19106. bool isLastInSubpath() const { return stackPos == stackBase.getData()
  19107. && (index >= path.numElements
  19108. || points [index] == Path::moveMarker); }
  19109. juce_UseDebuggingNewOperator
  19110. private:
  19111. const Path& path;
  19112. const AffineTransform transform;
  19113. float* points;
  19114. float tolerence, subPathCloseX, subPathCloseY;
  19115. bool isIdentityTransform;
  19116. HeapBlock <float> stackBase;
  19117. float* stackPos;
  19118. int index, stackSize;
  19119. PathFlatteningIterator (const PathFlatteningIterator&);
  19120. PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19121. };
  19122. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19123. /*** End of inlined file: juce_PathIterator.h ***/
  19124. #endif
  19125. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19126. #endif
  19127. #ifndef __JUCE_POINT_JUCEHEADER__
  19128. #endif
  19129. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19130. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19131. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19132. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19133. class JUCE_API PositionedRectangle
  19134. {
  19135. public:
  19136. PositionedRectangle() throw();
  19137. PositionedRectangle (const String& stringVersion) throw();
  19138. PositionedRectangle (const PositionedRectangle& other) throw();
  19139. PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19140. ~PositionedRectangle() throw();
  19141. const String toString() const throw();
  19142. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19143. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19144. double& x,
  19145. double& y,
  19146. double& width,
  19147. double& height) const throw();
  19148. void applyToComponent (Component& comp) const throw();
  19149. void updateFrom (const Rectangle<int>& newPosition,
  19150. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19151. void updateFromDouble (const double x, const double y,
  19152. const double width, const double height,
  19153. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19154. void updateFromComponent (const Component& comp) throw();
  19155. enum AnchorPoint
  19156. {
  19157. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19158. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19159. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19160. };
  19161. enum PositionMode
  19162. {
  19163. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19164. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19165. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19166. proportionOfParentSize = 1 << 6 /**< The x or y co-ordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */
  19167. };
  19168. enum SizeMode
  19169. {
  19170. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19171. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19172. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19173. };
  19174. void setModes (const AnchorPoint xAnchorMode,
  19175. const PositionMode xPositionMode,
  19176. const AnchorPoint yAnchorMode,
  19177. const PositionMode yPositionMode,
  19178. const SizeMode widthMode,
  19179. const SizeMode heightMode,
  19180. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19181. AnchorPoint getAnchorPointX() const throw();
  19182. PositionMode getPositionModeX() const throw();
  19183. double getX() const throw() { return x; }
  19184. void setX (const double newX) throw() { x = newX; }
  19185. AnchorPoint getAnchorPointY() const throw();
  19186. PositionMode getPositionModeY() const throw();
  19187. double getY() const throw() { return y; }
  19188. void setY (const double newY) throw() { y = newY; }
  19189. SizeMode getWidthMode() const throw();
  19190. double getWidth() const throw() { return w; }
  19191. void setWidth (const double newWidth) throw() { w = newWidth; }
  19192. SizeMode getHeightMode() const throw();
  19193. double getHeight() const throw() { return h; }
  19194. void setHeight (const double newHeight) throw() { h = newHeight; }
  19195. bool isPositionAbsolute() const throw();
  19196. bool operator== (const PositionedRectangle& other) const throw();
  19197. bool operator!= (const PositionedRectangle& other) const throw();
  19198. juce_UseDebuggingNewOperator
  19199. private:
  19200. double x, y, w, h;
  19201. uint8 xMode, yMode, wMode, hMode;
  19202. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19203. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19204. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19205. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19206. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19207. const uint8 xMode, const uint8 wMode,
  19208. const int parentPos, const int parentSize) const throw();
  19209. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19210. const uint8 xMode, const uint8 wMode,
  19211. const int parentPos, const int parentSize) const throw();
  19212. };
  19213. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19214. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19215. #endif
  19216. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19217. #endif
  19218. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19219. #endif
  19220. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19221. /*** Start of inlined file: juce_CameraDevice.h ***/
  19222. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19223. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19224. #if JUCE_USE_CAMERA
  19225. class CameraImageListener
  19226. {
  19227. public:
  19228. CameraImageListener() {}
  19229. virtual ~CameraImageListener() {}
  19230. virtual void imageReceived (Image& image) = 0;
  19231. };
  19232. class JUCE_API CameraDevice
  19233. {
  19234. public:
  19235. virtual ~CameraDevice();
  19236. static const StringArray getAvailableDevices();
  19237. static CameraDevice* openDevice (int deviceIndex,
  19238. int minWidth = 128, int minHeight = 64,
  19239. int maxWidth = 1024, int maxHeight = 768);
  19240. const String getName() const { return name; }
  19241. Component* createViewerComponent();
  19242. void startRecordingToFile (const File& file, int quality = 2);
  19243. void stopRecording();
  19244. static const String getFileExtension();
  19245. const Time getTimeOfFirstRecordedFrame() const;
  19246. void addListener (CameraImageListener* listenerToAdd);
  19247. void removeListener (CameraImageListener* listenerToRemove);
  19248. juce_UseDebuggingNewOperator
  19249. protected:
  19250. CameraDevice (const String& name, int index);
  19251. private:
  19252. void* internal;
  19253. bool isRecording;
  19254. String name;
  19255. CameraDevice (const CameraDevice&);
  19256. CameraDevice& operator= (const CameraDevice&);
  19257. };
  19258. #endif
  19259. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19260. /*** End of inlined file: juce_CameraDevice.h ***/
  19261. #endif
  19262. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19263. #endif
  19264. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19265. /*** Start of inlined file: juce_ImageCache.h ***/
  19266. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19267. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19268. struct ImageCacheItem;
  19269. class JUCE_API ImageCache : private DeletedAtShutdown,
  19270. private Timer
  19271. {
  19272. public:
  19273. static Image* getFromFile (const File& file);
  19274. static Image* getFromMemory (const void* imageData,
  19275. const int dataSize);
  19276. static void release (Image* const imageToRelease);
  19277. static void releaseOrDelete (Image* const imageToRelease);
  19278. static bool isImageInCache (Image* const imageToLookFor);
  19279. static void incReferenceCount (Image* const image);
  19280. static Image* getFromHashCode (const int64 hashCode);
  19281. static void addImageToCache (Image* const image,
  19282. const int64 hashCode);
  19283. static void setCacheTimeout (const int millisecs);
  19284. juce_UseDebuggingNewOperator
  19285. private:
  19286. CriticalSection lock;
  19287. OwnedArray <ImageCacheItem> images;
  19288. ImageCache();
  19289. ImageCache (const ImageCache&);
  19290. ImageCache& operator= (const ImageCache&);
  19291. ~ImageCache();
  19292. void timerCallback();
  19293. };
  19294. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19295. /*** End of inlined file: juce_ImageCache.h ***/
  19296. #endif
  19297. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19298. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19299. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19300. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19301. class JUCE_API ImageConvolutionKernel
  19302. {
  19303. public:
  19304. ImageConvolutionKernel (const int size);
  19305. ~ImageConvolutionKernel();
  19306. void clear();
  19307. float getKernelValue (int x, int y) const throw();
  19308. void setKernelValue (int x, int y, float value) throw();
  19309. void setOverallSum (const float desiredTotalSum);
  19310. void rescaleAllValues (const float multiplier);
  19311. void createGaussianBlur (const float blurRadius);
  19312. int getKernelSize() const { return size; }
  19313. void applyToImage (Image& destImage,
  19314. const Image* sourceImage,
  19315. int x,
  19316. int y,
  19317. int width,
  19318. int height) const;
  19319. juce_UseDebuggingNewOperator
  19320. private:
  19321. HeapBlock <float> values;
  19322. const int size;
  19323. // no reason not to implement these one day..
  19324. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19325. ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19326. };
  19327. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19328. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19329. #endif
  19330. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19331. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19332. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19333. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19334. class JUCE_API ImageFileFormat
  19335. {
  19336. protected:
  19337. ImageFileFormat() {}
  19338. public:
  19339. virtual ~ImageFileFormat() {}
  19340. virtual const String getFormatName() = 0;
  19341. virtual bool canUnderstand (InputStream& input) = 0;
  19342. virtual Image* decodeImage (InputStream& input) = 0;
  19343. virtual bool writeImageToStream (const Image& sourceImage,
  19344. OutputStream& destStream) = 0;
  19345. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19346. static Image* loadFrom (InputStream& input);
  19347. static Image* loadFrom (const File& file);
  19348. static Image* loadFrom (const void* rawData,
  19349. const int numBytesOfData);
  19350. };
  19351. class JUCE_API PNGImageFormat : public ImageFileFormat
  19352. {
  19353. public:
  19354. PNGImageFormat();
  19355. ~PNGImageFormat();
  19356. const String getFormatName();
  19357. bool canUnderstand (InputStream& input);
  19358. Image* decodeImage (InputStream& input);
  19359. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19360. };
  19361. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19362. {
  19363. public:
  19364. JPEGImageFormat();
  19365. ~JPEGImageFormat();
  19366. void setQuality (const float newQuality);
  19367. const String getFormatName();
  19368. bool canUnderstand (InputStream& input);
  19369. Image* decodeImage (InputStream& input);
  19370. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19371. private:
  19372. float quality;
  19373. };
  19374. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19375. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19376. #endif
  19377. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19378. #endif
  19379. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19380. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19381. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19382. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19383. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19384. {
  19385. public:
  19386. FileBasedDocument (const String& fileExtension,
  19387. const String& fileWildCard,
  19388. const String& openFileDialogTitle,
  19389. const String& saveFileDialogTitle);
  19390. virtual ~FileBasedDocument();
  19391. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19392. virtual void changed();
  19393. void setChangedFlag (const bool hasChanged);
  19394. bool loadFrom (const File& fileToLoadFrom,
  19395. const bool showMessageOnFailure);
  19396. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19397. enum SaveResult
  19398. {
  19399. savedOk = 0, /**< indicates that a file was saved successfully. */
  19400. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19401. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19402. };
  19403. SaveResult save (const bool askUserForFileIfNotSpecified,
  19404. const bool showMessageOnFailure);
  19405. SaveResult saveIfNeededAndUserAgrees();
  19406. SaveResult saveAs (const File& newFile,
  19407. const bool warnAboutOverwritingExistingFiles,
  19408. const bool askUserForFileIfNotSpecified,
  19409. const bool showMessageOnFailure);
  19410. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19411. const File getFile() const { return documentFile; }
  19412. void setFile (const File& newFile);
  19413. protected:
  19414. virtual const String getDocumentTitle() = 0;
  19415. virtual const String loadDocument (const File& file) = 0;
  19416. virtual const String saveDocument (const File& file) = 0;
  19417. virtual const File getLastDocumentOpened() = 0;
  19418. virtual void setLastDocumentOpened (const File& file) = 0;
  19419. public:
  19420. juce_UseDebuggingNewOperator
  19421. private:
  19422. File documentFile;
  19423. bool changedSinceSave;
  19424. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19425. FileBasedDocument (const FileBasedDocument&);
  19426. FileBasedDocument& operator= (const FileBasedDocument&);
  19427. };
  19428. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19429. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19430. #endif
  19431. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19432. #endif
  19433. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19434. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19435. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19436. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19437. class JUCE_API RecentlyOpenedFilesList
  19438. {
  19439. public:
  19440. RecentlyOpenedFilesList();
  19441. ~RecentlyOpenedFilesList();
  19442. void setMaxNumberOfItems (const int newMaxNumber);
  19443. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19444. int getNumFiles() const;
  19445. const File getFile (const int index) const;
  19446. const StringArray& getAllFilenames() const throw() { return files; }
  19447. void clear();
  19448. void addFile (const File& file);
  19449. void removeNonExistentFiles();
  19450. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19451. const int baseItemId,
  19452. const bool showFullPaths,
  19453. const bool dontAddNonExistentFiles,
  19454. const File** filesToAvoid = 0);
  19455. const String toString() const;
  19456. void restoreFromString (const String& stringifiedVersion);
  19457. juce_UseDebuggingNewOperator
  19458. private:
  19459. StringArray files;
  19460. int maxNumberOfItems;
  19461. };
  19462. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19463. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19464. #endif
  19465. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19466. #endif
  19467. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19468. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19469. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19470. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19471. class JUCE_API SystemClipboard
  19472. {
  19473. public:
  19474. static void copyTextToClipboard (const String& text) throw();
  19475. static const String getTextFromClipboard() throw();
  19476. };
  19477. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19478. /*** End of inlined file: juce_SystemClipboard.h ***/
  19479. #endif
  19480. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19481. #endif
  19482. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19483. #endif
  19484. #endif
  19485. /*** End of inlined file: juce_app_includes.h ***/
  19486. #endif
  19487. #if JUCE_MSVC
  19488. #pragma warning (pop)
  19489. #pragma pack (pop)
  19490. #endif
  19491. END_JUCE_NAMESPACE
  19492. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19493. #ifdef JUCE_NAMESPACE
  19494. // this will obviously save a lot of typing, but can be disabled by
  19495. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19496. using namespace JUCE_NAMESPACE;
  19497. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19498. #define Component JUCE_NAMESPACE::Component
  19499. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19500. #define Point JUCE_NAMESPACE::Point
  19501. #define Button JUCE_NAMESPACE::Button
  19502. #endif
  19503. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19504. #define Rectangle JUCE_NAMESPACE::Rectangle
  19505. #endif
  19506. #endif
  19507. #endif
  19508. #if JUCE_MSVC
  19509. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19510. #ifdef JUCE_DLL
  19511. #ifdef JUCE_DEBUG
  19512. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19513. #else
  19514. #define AUTOLINKEDLIB "JUCE.lib"
  19515. #endif
  19516. #else
  19517. #ifdef JUCE_DEBUG
  19518. #ifdef _WIN64
  19519. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19520. #else
  19521. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19522. #endif
  19523. #else
  19524. #ifdef _WIN64
  19525. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19526. #else
  19527. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19528. #endif
  19529. #endif
  19530. #endif
  19531. #pragma comment(lib, AUTOLINKEDLIB)
  19532. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19533. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19534. #endif
  19535. // Auto-link the other win32 libs that are needed by library calls..
  19536. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19537. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19538. // Auto-links to various win32 libs that are needed by library calls..
  19539. #pragma comment(lib, "kernel32.lib")
  19540. #pragma comment(lib, "user32.lib")
  19541. #pragma comment(lib, "shell32.lib")
  19542. #pragma comment(lib, "gdi32.lib")
  19543. #pragma comment(lib, "vfw32.lib")
  19544. #pragma comment(lib, "comdlg32.lib")
  19545. #pragma comment(lib, "winmm.lib")
  19546. #pragma comment(lib, "wininet.lib")
  19547. #pragma comment(lib, "ole32.lib")
  19548. #pragma comment(lib, "oleaut32.lib")
  19549. #pragma comment(lib, "advapi32.lib")
  19550. #pragma comment(lib, "ws2_32.lib")
  19551. #pragma comment(lib, "comsupp.lib")
  19552. #pragma comment(lib, "version.lib")
  19553. #if JUCE_OPENGL
  19554. #pragma comment(lib, "OpenGL32.Lib")
  19555. #pragma comment(lib, "GlU32.Lib")
  19556. #endif
  19557. #if JUCE_QUICKTIME
  19558. #pragma comment (lib, "QTMLClient.lib")
  19559. #endif
  19560. #if JUCE_USE_CAMERA
  19561. #pragma comment (lib, "Strmiids.lib")
  19562. #pragma comment (lib, "wmvcore.lib")
  19563. #endif
  19564. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19565. #endif
  19566. #endif
  19567. #endif
  19568. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19569. #define START_JUCE_APPLICATION(AppClass) \
  19570. int main (int argc, char* argv[]) \
  19571. { \
  19572. return JUCE_NAMESPACE::JUCEApplication::main (argc, (const char**) argv, new AppClass()); \
  19573. }
  19574. #elif JUCE_WINDOWS
  19575. #ifdef _CONSOLE
  19576. #define START_JUCE_APPLICATION(AppClass) \
  19577. int main (int, char* argv[]) \
  19578. { \
  19579. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19580. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19581. }
  19582. #elif ! defined (_AFXDLL)
  19583. #ifdef _WINDOWS_
  19584. #define START_JUCE_APPLICATION(AppClass) \
  19585. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19586. { \
  19587. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19588. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19589. }
  19590. #else
  19591. #define START_JUCE_APPLICATION(AppClass) \
  19592. int __stdcall WinMain (int, int, const char*, int) \
  19593. { \
  19594. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19595. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19596. }
  19597. #endif
  19598. #endif
  19599. #endif
  19600. #endif // __JUCE_JUCEHEADER__
  19601. /*** End of inlined file: juce.h ***/
  19602. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__