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.

27707 lines
721KB

  1. #ifndef __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  2. #define __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  3. #define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
  4. /********* Start of inlined file: juce.h *********/
  5. #ifndef __JUCE_JUCEHEADER__
  6. #define __JUCE_JUCEHEADER__
  7. #define JUCE_PUBLIC_INCLUDES 1
  8. // (this includes things that need defining outside of the JUCE namespace)
  9. /********* Start of inlined file: juce_StandardHeader.h *********/
  10. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  11. #define __JUCE_STANDARDHEADER_JUCEHEADER__
  12. #define JUCE_MAJOR_VERSION 1
  13. #define JUCE_MINOR_VERSION 51
  14. #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8))
  15. /********* Start of inlined file: juce_TargetPlatform.h *********/
  16. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  17. #define __JUCE_TARGETPLATFORM_JUCEHEADER__
  18. #if (defined (_WIN32) || defined (_WIN64))
  19. #define JUCE_WIN32 1
  20. #define JUCE_WINDOWS 1
  21. #elif defined (LINUX) || defined (__linux__)
  22. #define JUCE_LINUX 1
  23. #elif defined(__APPLE_CPP__) || defined(__APPLE_CC__)
  24. #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
  25. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
  26. #define JUCE_IPHONE 1
  27. #else
  28. #define JUCE_MAC 1
  29. #endif
  30. #else
  31. #error "Unknown platform!"
  32. #endif
  33. #if JUCE_WINDOWS
  34. #ifdef _MSC_VER
  35. #ifdef _WIN64
  36. #define JUCE_64BIT 1
  37. #else
  38. #define JUCE_32BIT 1
  39. #endif
  40. #endif
  41. #ifdef _DEBUG
  42. #define JUCE_DEBUG 1
  43. #endif
  44. #ifdef __MINGW32__
  45. #define JUCE_MINGW 1
  46. #endif
  47. #define JUCE_LITTLE_ENDIAN 1
  48. #define JUCE_INTEL 1
  49. #endif
  50. #if JUCE_MAC
  51. #ifndef NDEBUG
  52. #define JUCE_DEBUG 1
  53. #endif
  54. #ifdef __LITTLE_ENDIAN__
  55. #define JUCE_LITTLE_ENDIAN 1
  56. #else
  57. #define JUCE_BIG_ENDIAN 1
  58. #endif
  59. #if defined (__ppc__) || defined (__ppc64__)
  60. #define JUCE_PPC 1
  61. #else
  62. #define JUCE_INTEL 1
  63. #endif
  64. #ifdef __LP64__
  65. #define JUCE_64BIT 1
  66. #else
  67. #define JUCE_32BIT 1
  68. #endif
  69. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  70. #error "Building for OSX 10.3 is no longer supported!"
  71. #endif
  72. #ifndef MAC_OS_X_VERSION_10_5
  73. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  74. #endif
  75. #endif
  76. #if JUCE_IPHONE
  77. #ifndef NDEBUG
  78. #define JUCE_DEBUG 1
  79. #endif
  80. #ifdef __LITTLE_ENDIAN__
  81. #define JUCE_LITTLE_ENDIAN 1
  82. #else
  83. #define JUCE_BIG_ENDIAN 1
  84. #endif
  85. #endif
  86. #if JUCE_LINUX
  87. #ifdef _DEBUG
  88. #define JUCE_DEBUG 1
  89. #endif
  90. // Allow override for big-endian Linux platforms
  91. #ifndef JUCE_BIG_ENDIAN
  92. #define JUCE_LITTLE_ENDIAN 1
  93. #endif
  94. #if defined (__LP64__) || defined (_LP64)
  95. #define JUCE_64BIT 1
  96. #else
  97. #define JUCE_32BIT 1
  98. #endif
  99. #define JUCE_INTEL 1
  100. #endif
  101. // Compiler type macros.
  102. #ifdef __GNUC__
  103. #define JUCE_GCC 1
  104. #elif defined (_MSC_VER)
  105. #define JUCE_MSVC 1
  106. #if _MSC_VER >= 1400
  107. #define JUCE_USE_INTRINSICS 1
  108. #endif
  109. #else
  110. #error unknown compiler
  111. #endif
  112. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  113. /********* End of inlined file: juce_TargetPlatform.h *********/
  114. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  115. /********* Start of inlined file: juce_Config.h *********/
  116. #ifndef __JUCE_CONFIG_JUCEHEADER__
  117. #define __JUCE_CONFIG_JUCEHEADER__
  118. #ifndef JUCE_NAMESPACE
  119. #define JUCE_NAMESPACE juce
  120. #endif
  121. #ifndef JUCE_FORCE_DEBUG
  122. //#define JUCE_FORCE_DEBUG 1
  123. #endif
  124. #ifndef JUCE_LOG_ASSERTIONS
  125. // #define JUCE_LOG_ASSERTIONS 1
  126. #endif
  127. #ifndef JUCE_ASIO
  128. #define JUCE_ASIO 1
  129. #endif
  130. #ifndef JUCE_WASAPI
  131. // #define JUCE_WASAPI 1
  132. #endif
  133. #ifndef JUCE_DIRECTSOUND
  134. #define JUCE_DIRECTSOUND 1
  135. #endif
  136. #ifndef JUCE_ALSA
  137. #define JUCE_ALSA 1
  138. #endif
  139. #ifndef JUCE_JACK
  140. #define JUCE_JACK 1
  141. #endif
  142. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  143. #define JUCE_QUICKTIME 1
  144. #endif
  145. #ifndef JUCE_OPENGL
  146. #define JUCE_OPENGL 1
  147. #endif
  148. #ifndef JUCE_USE_FLAC
  149. #define JUCE_USE_FLAC 1
  150. #endif
  151. #ifndef JUCE_USE_OGGVORBIS
  152. #define JUCE_USE_OGGVORBIS 1
  153. #endif
  154. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  155. #define JUCE_USE_CDBURNER 1
  156. #endif
  157. #ifndef JUCE_USE_CDREADER
  158. #define JUCE_USE_CDREADER 1
  159. #endif
  160. #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
  161. // #define JUCE_USE_CAMERA 1
  162. #endif
  163. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  164. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  165. #endif
  166. #ifndef JUCE_USE_XINERAMA
  167. #define JUCE_USE_XINERAMA 1
  168. #endif
  169. #ifndef JUCE_USE_XSHM
  170. #define JUCE_USE_XSHM 1
  171. #endif
  172. #ifndef JUCE_PLUGINHOST_VST
  173. // #define JUCE_PLUGINHOST_VST 1
  174. #endif
  175. #ifndef JUCE_PLUGINHOST_AU
  176. // #define JUCE_PLUGINHOST_AU 1
  177. #endif
  178. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  179. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  180. #endif
  181. #ifndef JUCE_WEB_BROWSER
  182. #define JUCE_WEB_BROWSER 1
  183. #endif
  184. #ifndef JUCE_SUPPORT_CARBON
  185. #define JUCE_SUPPORT_CARBON 1
  186. #endif
  187. #ifndef JUCE_INCLUDE_ZLIB_CODE
  188. #define JUCE_INCLUDE_ZLIB_CODE 1
  189. #endif
  190. #ifndef JUCE_INCLUDE_FLAC_CODE
  191. #define JUCE_INCLUDE_FLAC_CODE 1
  192. #endif
  193. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  194. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  195. #endif
  196. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  197. #define JUCE_INCLUDE_PNGLIB_CODE 1
  198. #endif
  199. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  200. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  201. #endif
  202. #ifndef JUCE_CHECK_MEMORY_LEAKS
  203. #define JUCE_CHECK_MEMORY_LEAKS 1
  204. #endif
  205. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  206. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  207. #endif
  208. #ifndef JUCE_STRINGS_ARE_UNICODE
  209. #define JUCE_STRINGS_ARE_UNICODE 1
  210. #endif
  211. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  212. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  213. #undef JUCE_QUICKTIME
  214. #define JUCE_QUICKTIME 0
  215. #undef JUCE_OPENGL
  216. #define JUCE_OPENGL 0
  217. #undef JUCE_USE_CDBURNER
  218. #define JUCE_USE_CDBURNER 0
  219. #undef JUCE_USE_CDREADER
  220. #define JUCE_USE_CDREADER 0
  221. #undef JUCE_WEB_BROWSER
  222. #define JUCE_WEB_BROWSER 0
  223. #undef JUCE_PLUGINHOST_AU
  224. #define JUCE_PLUGINHOST_AU 0
  225. #undef JUCE_PLUGINHOST_VST
  226. #define JUCE_PLUGINHOST_VST 0
  227. #endif
  228. #endif
  229. /********* End of inlined file: juce_Config.h *********/
  230. #ifdef JUCE_NAMESPACE
  231. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  232. #define END_JUCE_NAMESPACE }
  233. #else
  234. #define BEGIN_JUCE_NAMESPACE
  235. #define END_JUCE_NAMESPACE
  236. #endif
  237. /********* Start of inlined file: juce_PlatformDefs.h *********/
  238. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  239. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  240. #ifdef JUCE_FORCE_DEBUG
  241. #undef JUCE_DEBUG
  242. #if JUCE_FORCE_DEBUG
  243. #define JUCE_DEBUG 1
  244. #endif
  245. #endif
  246. #if JUCE_MSVC
  247. #define JUCE_CALLTYPE __stdcall
  248. #else
  249. #define JUCE_CALLTYPE
  250. #endif
  251. // Debugging and assertion macros
  252. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  253. #if JUCE_LOG_ASSERTIONS
  254. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  255. #elif defined (JUCE_DEBUG)
  256. #define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
  257. #else
  258. #define juce_LogCurrentAssertion
  259. #endif
  260. #ifdef JUCE_DEBUG
  261. // If debugging is enabled..
  262. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  263. #define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
  264. // Assertions..
  265. #if JUCE_WINDOWS || DOXYGEN
  266. #if JUCE_USE_INTRINSICS
  267. #pragma intrinsic (__debugbreak)
  268. #define juce_breakDebugger __debugbreak();
  269. #elif JUCE_GCC
  270. #define juce_breakDebugger asm("int $3");
  271. #else
  272. #define juce_breakDebugger { __asm int 3 }
  273. #endif
  274. #elif JUCE_MAC
  275. #define juce_breakDebugger Debugger();
  276. #elif JUCE_IPHONE
  277. #define juce_breakDebugger kill (0, SIGTRAP);
  278. #elif JUCE_LINUX
  279. #define juce_breakDebugger kill (0, SIGTRAP);
  280. #endif
  281. /** This will always cause an assertion failure.
  282. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  283. in juce_Config.h).
  284. @see jassert()
  285. */
  286. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  287. /** Platform-independent assertion macro.
  288. This gets optimised out when not being built with debugging turned on.
  289. Be careful not to call any functions within its arguments that are vital to
  290. the behaviour of the program, because these won't get called in the release
  291. build.
  292. @see jassertfalse
  293. */
  294. #define jassert(expression) { if (! (expression)) jassertfalse }
  295. #else
  296. // If debugging is disabled, these dummy debug and assertion macros are used..
  297. #define DBG(dbgtext)
  298. #define DBG_PRINTF(dbgprintf)
  299. #define jassertfalse { juce_LogCurrentAssertion }
  300. #if JUCE_LOG_ASSERTIONS
  301. #define jassert(expression) { if (! (expression)) jassertfalse }
  302. #else
  303. #define jassert(a) { }
  304. #endif
  305. #endif
  306. #ifndef DOXYGEN
  307. template <bool b> struct JuceStaticAssert;
  308. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  309. #endif
  310. /** A compile-time assertion macro.
  311. If the expression parameter is false, the macro will cause a compile error.
  312. */
  313. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  314. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  315. #define JUCE_TRY try
  316. #define JUCE_CATCH_EXCEPTION \
  317. catch (const std::exception& e) \
  318. { \
  319. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  320. } \
  321. catch (...) \
  322. { \
  323. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  324. }
  325. #define JUCE_CATCH_ALL catch (...) {}
  326. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  327. #else
  328. #define JUCE_TRY
  329. #define JUCE_CATCH_EXCEPTION
  330. #define JUCE_CATCH_ALL
  331. #define JUCE_CATCH_ALL_ASSERT
  332. #endif
  333. // Macros for inlining.
  334. #if JUCE_MSVC
  335. #ifndef JUCE_DEBUG
  336. #define forcedinline __forceinline
  337. #else
  338. #define forcedinline inline
  339. #endif
  340. #else
  341. #ifndef JUCE_DEBUG
  342. #define forcedinline inline __attribute__((always_inline))
  343. #else
  344. #define forcedinline inline
  345. #endif
  346. #endif
  347. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  348. /********* End of inlined file: juce_PlatformDefs.h *********/
  349. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  350. #if JUCE_MSVC
  351. #pragma warning (push)
  352. #pragma warning (disable: 4514 4245 4100)
  353. #endif
  354. #include <cstdlib>
  355. #include <cstdarg>
  356. #include <climits>
  357. #include <limits>
  358. #include <cmath>
  359. #include <cwchar>
  360. #include <stdexcept>
  361. #include <typeinfo>
  362. #include <cstring>
  363. #include <cstdio>
  364. #include <iostream>
  365. #if JUCE_USE_INTRINSICS
  366. #include <intrin.h>
  367. #endif
  368. #if JUCE_MAC || JUCE_IPHONE
  369. #include <libkern/OSAtomic.h>
  370. #endif
  371. #if JUCE_LINUX
  372. #include <signal.h>
  373. #endif
  374. #if JUCE_MSVC && JUCE_DEBUG
  375. #include <crtdbg.h>
  376. #endif
  377. #if JUCE_MSVC
  378. #include <malloc.h>
  379. #pragma warning (pop)
  380. #if ! JUCE_PUBLIC_INCLUDES
  381. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  382. #endif
  383. #endif
  384. // DLL building settings on Win32
  385. #if JUCE_MSVC
  386. #ifdef JUCE_DLL_BUILD
  387. #define JUCE_API __declspec (dllexport)
  388. #pragma warning (disable: 4251)
  389. #elif defined (JUCE_DLL)
  390. #define JUCE_API __declspec (dllimport)
  391. #pragma warning (disable: 4251)
  392. #endif
  393. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  394. #ifdef JUCE_DLL_BUILD
  395. #define JUCE_API __attribute__ ((visibility("default")))
  396. #endif
  397. #endif
  398. #ifndef JUCE_API
  399. #define JUCE_API
  400. #endif
  401. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  402. // Now include some basics that are needed by most of the Juce classes...
  403. BEGIN_JUCE_NAMESPACE
  404. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  405. #if JUCE_LOG_ASSERTIONS
  406. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  407. #endif
  408. /********* Start of inlined file: juce_Memory.h *********/
  409. #ifndef __JUCE_MEMORY_JUCEHEADER__
  410. #define __JUCE_MEMORY_JUCEHEADER__
  411. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  412. #ifndef JUCE_DLL
  413. // Win32 debug non-DLL versions..
  414. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  415. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  416. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  417. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  418. #else
  419. // Win32 debug DLL versions..
  420. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  421. // way all juce calls in the DLL and in the host API will all use the same allocator.
  422. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  423. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  424. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  425. extern JUCE_API void juce_DebugFree (void* const block);
  426. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  427. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  428. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  429. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  430. #endif
  431. #if ! defined (_AFXDLL)
  432. #define juce_UseDebuggingNewOperator \
  433. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  434. static void* operator new (size_t, void* p) { return p; } \
  435. static void operator delete (void* p) { juce_free (p); } \
  436. static void operator delete (void*, void*) { }
  437. #endif
  438. #elif defined (JUCE_DLL)
  439. // Win32 DLL (release) 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_Malloc (const int size);
  443. extern JUCE_API void* juce_Calloc (const int size);
  444. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  445. extern JUCE_API void juce_Free (void* const block);
  446. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  447. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  448. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  449. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  450. #define juce_UseDebuggingNewOperator \
  451. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  452. static void* operator new (size_t, void* p) { return p; } \
  453. static void operator delete (void* p) { juce_free (p); } \
  454. static void operator delete (void*, void*) { }
  455. #else
  456. // Mac, Linux and Win32 (release) versions..
  457. #define juce_malloc(numBytes) malloc (numBytes)
  458. #define juce_calloc(numBytes) calloc (1, numBytes)
  459. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  460. #define juce_free(location) free (location)
  461. #endif
  462. #ifndef juce_UseDebuggingNewOperator
  463. #define juce_UseDebuggingNewOperator
  464. #endif
  465. #if JUCE_MSVC
  466. #define juce_ThreadLocal __declspec(thread)
  467. #else
  468. #define juce_ThreadLocal __thread
  469. #endif
  470. #if JUCE_MINGW
  471. #define alloca __builtin_alloca
  472. #endif
  473. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  474. template <typename Type>
  475. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  476. template <typename Type>
  477. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  478. #endif // __JUCE_MEMORY_JUCEHEADER__
  479. /********* End of inlined file: juce_Memory.h *********/
  480. /********* Start of inlined file: juce_MathsFunctions.h *********/
  481. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  482. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  483. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  484. typedef signed char int8;
  485. typedef unsigned char uint8;
  486. typedef signed short int16;
  487. typedef unsigned short uint16;
  488. typedef signed int int32;
  489. typedef unsigned int uint32;
  490. #if JUCE_MSVC
  491. typedef __int64 int64;
  492. typedef unsigned __int64 uint64;
  493. #define literal64bit(longLiteral) ((__int64) longLiteral)
  494. #else
  495. typedef long long int64;
  496. typedef unsigned long long uint64;
  497. #define literal64bit(longLiteral) (longLiteral##LL)
  498. #endif
  499. #if JUCE_64BIT
  500. typedef int64 pointer_sized_int;
  501. typedef uint64 pointer_sized_uint;
  502. #elif _MSC_VER >= 1300
  503. typedef _W64 int pointer_sized_int;
  504. typedef _W64 unsigned int pointer_sized_uint;
  505. #else
  506. typedef int pointer_sized_int;
  507. typedef unsigned int pointer_sized_uint;
  508. #endif
  509. typedef wchar_t juce_wchar;
  510. // Some indispensible min/max functions
  511. template <typename Type>
  512. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  513. template <typename Type>
  514. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  515. template <typename Type>
  516. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  517. template <typename Type>
  518. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  519. template <typename Type>
  520. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  521. template <typename Type>
  522. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  523. template <typename Type>
  524. inline Type jlimit (const Type lowerLimit,
  525. const Type upperLimit,
  526. const Type valueToConstrain) throw()
  527. {
  528. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  529. return (valueToConstrain < lowerLimit) ? lowerLimit
  530. : ((valueToConstrain > upperLimit) ? upperLimit
  531. : valueToConstrain);
  532. }
  533. template <typename Type>
  534. inline void swapVariables (Type& variable1, Type& variable2)
  535. {
  536. const Type tempVal = variable1;
  537. variable1 = variable2;
  538. variable2 = tempVal;
  539. }
  540. template <typename Type>
  541. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  542. // Some useful maths functions that aren't always present with all compilers and build settings.
  543. inline double juce_hypot (double a, double b)
  544. {
  545. #if JUCE_WINDOWS
  546. return _hypot (a, b);
  547. #else
  548. return hypot (a, b);
  549. #endif
  550. }
  551. inline float juce_hypotf (float a, float b)
  552. {
  553. #if JUCE_WINDOWS
  554. return (float) _hypot (a, b);
  555. #else
  556. return hypotf (a, b);
  557. #endif
  558. }
  559. inline int64 abs64 (const int64 n)
  560. {
  561. return (n >= 0) ? n : -n;
  562. }
  563. const double double_Pi = 3.1415926535897932384626433832795;
  564. const float float_Pi = 3.14159265358979323846f;
  565. template <typename FloatingPointType>
  566. inline bool juce_isfinite (FloatingPointType value)
  567. {
  568. #if JUCE_WINDOWS
  569. return _finite (value);
  570. #else
  571. return std::isfinite (value);
  572. #endif
  573. }
  574. template <typename FloatType>
  575. inline int roundToInt (const FloatType value) throw()
  576. {
  577. union { int asInt[2]; double asDouble; } n;
  578. n.asDouble = ((double) value) + 6755399441055744.0;
  579. #if JUCE_BIG_ENDIAN
  580. return n.asInt [1];
  581. #else
  582. return n.asInt [0];
  583. #endif
  584. }
  585. inline int roundToIntAccurate (const double value) throw()
  586. {
  587. return roundToInt (value + 1.5e-8);
  588. }
  589. inline int roundDoubleToInt (const double value) throw()
  590. {
  591. return roundToInt (value);
  592. }
  593. inline int roundFloatToInt (const float value) throw()
  594. {
  595. return roundToInt (value);
  596. }
  597. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  598. /********* End of inlined file: juce_MathsFunctions.h *********/
  599. /********* Start of inlined file: juce_ByteOrder.h *********/
  600. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  601. #define __JUCE_BYTEORDER_JUCEHEADER__
  602. class JUCE_API ByteOrder
  603. {
  604. public:
  605. static uint16 swap (uint16 value);
  606. static uint32 swap (uint32 value);
  607. static uint64 swap (uint64 value);
  608. static uint16 swapIfBigEndian (const uint16 value);
  609. static uint32 swapIfBigEndian (const uint32 value);
  610. static uint64 swapIfBigEndian (const uint64 value);
  611. static uint16 swapIfLittleEndian (const uint16 value);
  612. static uint32 swapIfLittleEndian (const uint32 value);
  613. static uint64 swapIfLittleEndian (const uint64 value);
  614. static uint32 littleEndianInt (const char* const bytes);
  615. static uint16 littleEndianShort (const char* const bytes);
  616. static uint32 bigEndianInt (const char* const bytes);
  617. static uint16 bigEndianShort (const char* const bytes);
  618. static int littleEndian24Bit (const char* const bytes);
  619. static int bigEndian24Bit (const char* const bytes);
  620. static void littleEndian24BitToChars (const int value, char* const destBytes);
  621. static void bigEndian24BitToChars (const int value, char* const destBytes);
  622. static bool isBigEndian();
  623. };
  624. #if JUCE_USE_INTRINSICS
  625. #pragma intrinsic (_byteswap_ulong)
  626. #endif
  627. inline uint16 ByteOrder::swap (uint16 n)
  628. {
  629. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  630. return (uint16) _byteswap_ushort (n);
  631. #else
  632. return (uint16) ((n << 8) | (n >> 8));
  633. #endif
  634. }
  635. inline uint32 ByteOrder::swap (uint32 n)
  636. {
  637. #if JUCE_MAC || JUCE_IPHONE
  638. return OSSwapInt32 (n);
  639. #elif JUCE_GCC
  640. asm("bswap %%eax" : "=a"(n) : "a"(n));
  641. return n;
  642. #elif JUCE_USE_INTRINSICS
  643. return _byteswap_ulong (n);
  644. #else
  645. __asm {
  646. mov eax, n
  647. bswap eax
  648. mov n, eax
  649. }
  650. return n;
  651. #endif
  652. }
  653. inline uint64 ByteOrder::swap (uint64 value)
  654. {
  655. #if JUCE_MAC || JUCE_IPHONE
  656. return OSSwapInt64 (value);
  657. #elif JUCE_USE_INTRINSICS
  658. return _byteswap_uint64 (value);
  659. #else
  660. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  661. #endif
  662. }
  663. #if JUCE_LITTLE_ENDIAN
  664. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  665. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  666. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  667. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  668. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  669. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  670. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  671. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  672. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  673. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  674. inline bool ByteOrder::isBigEndian() { return false; }
  675. #else
  676. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  677. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  678. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  679. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  680. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  681. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  682. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  683. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  684. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  685. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  686. inline bool ByteOrder::isBigEndian() { return true; }
  687. #endif
  688. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  689. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  690. 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); }
  691. 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); }
  692. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  693. /********* End of inlined file: juce_ByteOrder.h *********/
  694. /********* Start of inlined file: juce_Logger.h *********/
  695. #ifndef __JUCE_LOGGER_JUCEHEADER__
  696. #define __JUCE_LOGGER_JUCEHEADER__
  697. /********* Start of inlined file: juce_String.h *********/
  698. #ifndef __JUCE_STRING_JUCEHEADER__
  699. #define __JUCE_STRING_JUCEHEADER__
  700. /********* Start of inlined file: juce_CharacterFunctions.h *********/
  701. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  702. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  703. #if JUCE_STRINGS_ARE_UNICODE
  704. #define JUCE_T(stringLiteral) (L##stringLiteral)
  705. typedef juce_wchar tchar;
  706. #define juce_tcharToWideChar(c) (c)
  707. #else
  708. #define JUCE_T(stringLiteral) (stringLiteral)
  709. typedef char tchar;
  710. #define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
  711. #endif
  712. #if ! JUCE_DONT_DEFINE_MACROS
  713. #define T(stringLiteral) JUCE_T(stringLiteral)
  714. #endif
  715. class JUCE_API CharacterFunctions
  716. {
  717. public:
  718. static int length (const char* const s) throw();
  719. static int length (const juce_wchar* const s) throw();
  720. static void copy (char* dest, const char* src, const int maxBytes) throw();
  721. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  722. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  723. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  724. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  725. static void append (char* dest, const char* src) throw();
  726. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  727. static int compare (const char* const s1, const char* const s2) throw();
  728. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  729. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  730. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  731. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  732. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  733. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  734. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  735. static const char* find (const char* const haystack, const char* const needle) throw();
  736. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  737. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  738. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  739. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  740. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  741. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  742. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  743. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  744. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  745. static int getIntValue (const char* const s) throw();
  746. static int getIntValue (const juce_wchar* s) throw();
  747. static int64 getInt64Value (const char* s) throw();
  748. static int64 getInt64Value (const juce_wchar* s) throw();
  749. static double getDoubleValue (const char* const s) throw();
  750. static double getDoubleValue (const juce_wchar* const s) throw();
  751. static char toUpperCase (const char character) throw();
  752. static juce_wchar toUpperCase (const juce_wchar character) throw();
  753. static void toUpperCase (char* s) throw();
  754. static void toUpperCase (juce_wchar* s) throw();
  755. static bool isUpperCase (const char character) throw();
  756. static bool isUpperCase (const juce_wchar character) throw();
  757. static char toLowerCase (const char character) throw();
  758. static juce_wchar toLowerCase (const juce_wchar character) throw();
  759. static void toLowerCase (char* s) throw();
  760. static void toLowerCase (juce_wchar* s) throw();
  761. static bool isLowerCase (const char character) throw();
  762. static bool isLowerCase (const juce_wchar character) throw();
  763. static bool isWhitespace (const char character) throw();
  764. static bool isWhitespace (const juce_wchar character) throw();
  765. static bool isDigit (const char character) throw();
  766. static bool isDigit (const juce_wchar character) throw();
  767. static bool isLetter (const char character) throw();
  768. static bool isLetter (const juce_wchar character) throw();
  769. static bool isLetterOrDigit (const char character) throw();
  770. static bool isLetterOrDigit (const juce_wchar character) throw();
  771. static int getHexDigitValue (const tchar digit) throw();
  772. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  773. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  774. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  775. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  776. };
  777. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  778. /********* End of inlined file: juce_CharacterFunctions.h *********/
  779. class JUCE_API String
  780. {
  781. public:
  782. String() throw();
  783. String (const String& other) throw();
  784. String (const char* const text) throw();
  785. String (const char* const text,
  786. const size_t maxChars) throw();
  787. String (const juce_wchar* const unicodeText) throw();
  788. String (const juce_wchar* const unicodeText,
  789. const size_t maxChars) throw();
  790. static const String charToString (const tchar character) throw();
  791. ~String() throw();
  792. static const String empty;
  793. int hashCode() const throw();
  794. int64 hashCode64() const throw();
  795. int length() const throw();
  796. // Assignment and concatenation operators..
  797. const String& operator= (const tchar* const other) throw();
  798. const String& operator= (const String& other) throw();
  799. const String& operator+= (const tchar* const textToAppend) throw();
  800. const String& operator+= (const String& stringToAppend) throw();
  801. const String& operator+= (const char characterToAppend) throw();
  802. const String& operator+= (const juce_wchar characterToAppend) throw();
  803. void append (const tchar* const textToAppend,
  804. const int maxCharsToTake) throw();
  805. const String operator+ (const String& stringToAppend) const throw();
  806. const String operator+ (const tchar* const textToAppend) const throw();
  807. const String operator+ (const tchar characterToAppend) const throw();
  808. String& operator<< (const char n) throw();
  809. String& operator<< (const juce_wchar n) throw();
  810. String& operator<< (const char* const text) throw();
  811. String& operator<< (const juce_wchar* const text) throw();
  812. String& operator<< (const String& text) throw();
  813. String& operator<< (const short number) throw();
  814. String& operator<< (const int number) throw();
  815. String& operator<< (const unsigned int number) throw();
  816. String& operator<< (const long number) throw();
  817. String& operator<< (const unsigned long number) throw();
  818. String& operator<< (const float number) throw();
  819. String& operator<< (const double number) throw();
  820. // Comparison methods..
  821. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  822. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  823. bool operator== (const String& other) const throw();
  824. bool operator== (const tchar* const other) const throw();
  825. bool operator!= (const String& other) const throw();
  826. bool operator!= (const tchar* const other) const throw();
  827. bool equalsIgnoreCase (const String& other) const throw();
  828. bool equalsIgnoreCase (const tchar* const other) const throw();
  829. bool operator> (const String& other) const throw();
  830. bool operator< (const tchar* const other) const throw();
  831. bool operator>= (const String& other) const throw();
  832. bool operator<= (const tchar* const other) const throw();
  833. int compare (const tchar* const other) const throw();
  834. int compareIgnoreCase (const tchar* const other) const throw();
  835. int compareLexicographically (const tchar* const other) const throw();
  836. bool startsWith (const tchar* const text) const throw();
  837. bool startsWithChar (const tchar character) const throw();
  838. bool startsWithIgnoreCase (const tchar* const text) const throw();
  839. bool endsWith (const tchar* const text) const throw();
  840. bool endsWithChar (const tchar character) const throw();
  841. bool endsWithIgnoreCase (const tchar* const text) const throw();
  842. bool contains (const tchar* const text) const throw();
  843. bool containsChar (const tchar character) const throw();
  844. bool containsIgnoreCase (const tchar* const text) const throw();
  845. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  846. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  847. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  848. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  849. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  850. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  851. bool containsNonWhitespaceChars() const throw();
  852. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  853. // Substring location methods..
  854. int indexOfChar (const tchar characterToLookFor) const throw();
  855. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  856. int indexOfAnyOf (const tchar* const charactersToLookFor,
  857. const int startIndex = 0,
  858. const bool ignoreCase = false) const throw();
  859. int indexOf (const tchar* const text) const throw();
  860. int indexOf (const int startIndex,
  861. const tchar* const textToLookFor) const throw();
  862. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  863. int indexOfIgnoreCase (const int startIndex,
  864. const tchar* const textToLookFor) const throw();
  865. int lastIndexOfChar (const tchar character) const throw();
  866. int lastIndexOf (const tchar* const textToLookFor) const throw();
  867. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  868. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  869. const bool ignoreCase = false) const throw();
  870. // Substring extraction and manipulation methods..
  871. /** Returns the character at this index in the string.
  872. No checks are made to see if the index is within a valid range, so be careful!
  873. */
  874. inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  875. tchar& operator[] (const int index) throw();
  876. tchar getLastCharacter() const throw();
  877. const String substring (int startIndex,
  878. int endIndex) const throw();
  879. const String substring (const int startIndex) const throw();
  880. const String dropLastCharacters (const int numberToDrop) const throw();
  881. const String getLastCharacters (const int numCharacters) const throw();
  882. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  883. const bool includeSubStringInResult,
  884. const bool ignoreCase) const throw();
  885. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  886. const bool includeSubStringInResult,
  887. const bool ignoreCase) const throw();
  888. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  889. const bool includeSubStringInResult,
  890. const bool ignoreCase) const throw();
  891. const String upToLastOccurrenceOf (const tchar* substringToFind,
  892. const bool includeSubStringInResult,
  893. const bool ignoreCase) const throw();
  894. const String trim() const throw();
  895. const String trimStart() const throw();
  896. const String trimEnd() const throw();
  897. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  898. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  899. const String toUpperCase() const throw();
  900. const String toLowerCase() const throw();
  901. const String replaceSection (int startIndex,
  902. int numCharactersToReplace,
  903. const tchar* const stringToInsert) const throw();
  904. const String replace (const tchar* const stringToReplace,
  905. const tchar* const stringToInsertInstead,
  906. const bool ignoreCase = false) const throw();
  907. const String replaceCharacter (const tchar characterToReplace,
  908. const tchar characterToInsertInstead) const throw();
  909. const String replaceCharacters (const String& charactersToReplace,
  910. const tchar* const charactersToInsertInstead) const throw();
  911. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  912. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  913. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  914. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  915. bool isQuotedString() const throw();
  916. const String unquoted() const throw();
  917. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  918. void printf (const tchar* const format, ...) throw();
  919. static const String formatted (const tchar* const format, ...) throw();
  920. void vprintf (const tchar* const format, va_list& args) throw();
  921. static const String repeatedString (const tchar* const stringToRepeat,
  922. int numberOfTimesToRepeat) throw();
  923. static const String createStringFromData (const void* const data,
  924. const int size) throw();
  925. // Numeric conversions..
  926. explicit String (const int decimalInteger) throw();
  927. explicit String (const unsigned int decimalInteger) throw();
  928. explicit String (const short decimalInteger) throw();
  929. explicit String (const unsigned short decimalInteger) throw();
  930. explicit String (const int64 largeIntegerValue) throw();
  931. explicit String (const uint64 largeIntegerValue) throw();
  932. explicit String (const float floatValue,
  933. const int numberOfDecimalPlaces = 0) throw();
  934. explicit String (const double doubleValue,
  935. const int numberOfDecimalPlaces = 0) throw();
  936. int getIntValue() const throw();
  937. int64 getLargeIntValue() const throw();
  938. int getTrailingIntValue() const throw();
  939. float getFloatValue() const throw();
  940. double getDoubleValue() const throw();
  941. int getHexValue32() const throw();
  942. int64 getHexValue64() const throw();
  943. static const String toHexString (const int number) throw();
  944. static const String toHexString (const int64 number) throw();
  945. static const String toHexString (const short number) throw();
  946. static const String toHexString (const unsigned char* data,
  947. const int size,
  948. const int groupSize = 1) throw();
  949. // Casting to character arrays..
  950. #if JUCE_STRINGS_ARE_UNICODE
  951. operator const char*() const throw();
  952. inline operator const juce_wchar*() const throw() { return text->text; }
  953. #else
  954. inline operator const char*() const throw() { return text->text; }
  955. operator const juce_wchar*() const throw();
  956. #endif
  957. void copyToBuffer (char* const destBuffer,
  958. const int maxCharsToCopy) const throw();
  959. void copyToBuffer (juce_wchar* const destBuffer,
  960. const int maxCharsToCopy) const throw();
  961. int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
  962. const char* toUTF8() const throw();
  963. static const String fromUTF8 (const uint8* const utf8buffer,
  964. int bufferSizeBytes = -1) throw();
  965. void preallocateStorage (const size_t numCharsNeeded) throw();
  966. class JUCE_API Concatenator
  967. {
  968. public:
  969. Concatenator (String& stringToAppendTo);
  970. ~Concatenator();
  971. void append (const String& s);
  972. private:
  973. String& result;
  974. int nextIndex;
  975. Concatenator (const Concatenator&);
  976. const Concatenator& operator= (const Concatenator&);
  977. };
  978. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  979. private:
  980. struct InternalRefCountedStringHolder
  981. {
  982. int refCount;
  983. int allocatedNumChars;
  984. #if JUCE_STRINGS_ARE_UNICODE
  985. wchar_t text[1];
  986. #else
  987. char text[1];
  988. #endif
  989. };
  990. InternalRefCountedStringHolder* text;
  991. static InternalRefCountedStringHolder emptyString;
  992. // internal constructor that preallocates a certain amount of memory
  993. String (const int numChars, const int dummyVariable) throw();
  994. void deleteInternal() throw();
  995. void createInternal (const int numChars) throw();
  996. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  997. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  998. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  999. void dupeInternalIfMultiplyReferenced() throw();
  1000. };
  1001. const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
  1002. const String& string2) throw();
  1003. const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
  1004. const String& string2) throw();
  1005. #endif // __JUCE_STRING_JUCEHEADER__
  1006. /********* End of inlined file: juce_String.h *********/
  1007. class JUCE_API Logger
  1008. {
  1009. public:
  1010. virtual ~Logger();
  1011. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1012. const bool deleteOldLogger = false);
  1013. static void JUCE_CALLTYPE writeToLog (const String& message);
  1014. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1015. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1016. protected:
  1017. Logger();
  1018. virtual void logMessage (const String& message) = 0;
  1019. };
  1020. #endif // __JUCE_LOGGER_JUCEHEADER__
  1021. /********* End of inlined file: juce_Logger.h *********/
  1022. END_JUCE_NAMESPACE
  1023. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1024. /********* End of inlined file: juce_StandardHeader.h *********/
  1025. BEGIN_JUCE_NAMESPACE
  1026. #if JUCE_MSVC
  1027. // this is set explicitly in case the app is using a different packing size.
  1028. #pragma pack (push, 8)
  1029. #pragma warning (push)
  1030. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1031. #endif
  1032. // this is where all the class header files get brought in..
  1033. /********* Start of inlined file: juce_core_includes.h *********/
  1034. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1035. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1036. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1037. /********* Start of inlined file: juce_Array.h *********/
  1038. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1039. #define __JUCE_ARRAY_JUCEHEADER__
  1040. /********* Start of inlined file: juce_ArrayAllocationBase.h *********/
  1041. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1042. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1043. /********* Start of inlined file: juce_HeapBlock.h *********/
  1044. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1045. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1046. template <class ElementType>
  1047. class HeapBlock
  1048. {
  1049. public:
  1050. HeapBlock() throw() : data (0)
  1051. {
  1052. }
  1053. HeapBlock (const size_t numElements)
  1054. : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType)))
  1055. {
  1056. }
  1057. ~HeapBlock()
  1058. {
  1059. ::juce_free (data);
  1060. }
  1061. inline operator ElementType*() const throw() { return data; }
  1062. inline operator void*() const throw() { return (void*) data; }
  1063. inline ElementType* operator->() const throw() { return data; }
  1064. template <class CastType>
  1065. inline operator CastType*() const throw() { return (CastType*) data; }
  1066. template <typename IndexType>
  1067. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1068. template <typename IndexType>
  1069. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1070. inline ElementType** operator&() const throw() { return (ElementType**) &data; }
  1071. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1072. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1073. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1074. {
  1075. ::juce_free (data);
  1076. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1077. }
  1078. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1079. {
  1080. ::juce_free (data);
  1081. data = (ElementType*) ::juce_calloc (newNumElements * elementSize);
  1082. }
  1083. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1084. {
  1085. ::juce_free (data);
  1086. if (initialiseToZero)
  1087. data = (ElementType*) ::juce_calloc (newNumElements * sizeof (ElementType));
  1088. else
  1089. data = (ElementType*) ::juce_malloc (newNumElements * sizeof (ElementType));
  1090. }
  1091. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1092. {
  1093. if (data == 0)
  1094. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1095. else
  1096. data = (ElementType*) ::juce_realloc (data, newNumElements * elementSize);
  1097. }
  1098. void free()
  1099. {
  1100. ::juce_free (data);
  1101. data = 0;
  1102. }
  1103. void swapWith (HeapBlock <ElementType>& other) throw()
  1104. {
  1105. swapVariables (data, other.data);
  1106. }
  1107. private:
  1108. ElementType* data;
  1109. HeapBlock (const HeapBlock&);
  1110. const HeapBlock& operator= (const HeapBlock&);
  1111. };
  1112. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1113. /********* End of inlined file: juce_HeapBlock.h *********/
  1114. template <class ElementType>
  1115. class ArrayAllocationBase
  1116. {
  1117. public:
  1118. ArrayAllocationBase() throw()
  1119. : numAllocated (0)
  1120. {
  1121. }
  1122. ~ArrayAllocationBase()
  1123. {
  1124. }
  1125. void setAllocatedSize (const int numElements)
  1126. {
  1127. if (numAllocated != numElements)
  1128. {
  1129. if (numElements > 0)
  1130. elements.realloc (numElements);
  1131. else
  1132. elements.free();
  1133. numAllocated = numElements;
  1134. }
  1135. }
  1136. void ensureAllocatedSize (const int minNumElements)
  1137. {
  1138. if (minNumElements > numAllocated)
  1139. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1140. }
  1141. void shrinkToNoMoreThan (const int maxNumElements)
  1142. {
  1143. if (maxNumElements < numAllocated)
  1144. setAllocatedSize (maxNumElements);
  1145. }
  1146. void swapWith (ArrayAllocationBase <ElementType>& other) throw()
  1147. {
  1148. elements.swapWith (other.elements);
  1149. swapVariables (numAllocated, other.numAllocated);
  1150. }
  1151. HeapBlock <ElementType> elements;
  1152. int numAllocated;
  1153. private:
  1154. ArrayAllocationBase (const ArrayAllocationBase&);
  1155. const ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1156. };
  1157. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1158. /********* End of inlined file: juce_ArrayAllocationBase.h *********/
  1159. /********* Start of inlined file: juce_ElementComparator.h *********/
  1160. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1161. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1162. template <class ElementType, class ElementComparator>
  1163. static void sortArray (ElementComparator& comparator,
  1164. ElementType* const array,
  1165. int firstElement,
  1166. int lastElement,
  1167. const bool retainOrderOfEquivalentItems)
  1168. {
  1169. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1170. // avoids getting warning messages about the parameter being unused
  1171. if (lastElement > firstElement)
  1172. {
  1173. if (retainOrderOfEquivalentItems)
  1174. {
  1175. for (int i = firstElement; i < lastElement; ++i)
  1176. {
  1177. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1178. {
  1179. const ElementType temp = array [i];
  1180. array [i] = array[i + 1];
  1181. array [i + 1] = temp;
  1182. if (i > firstElement)
  1183. i -= 2;
  1184. }
  1185. }
  1186. }
  1187. else
  1188. {
  1189. int fromStack[30], toStack[30];
  1190. int stackIndex = 0;
  1191. for (;;)
  1192. {
  1193. const int size = (lastElement - firstElement) + 1;
  1194. if (size <= 8)
  1195. {
  1196. int j = lastElement;
  1197. int maxIndex;
  1198. while (j > firstElement)
  1199. {
  1200. maxIndex = firstElement;
  1201. for (int k = firstElement + 1; k <= j; ++k)
  1202. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1203. maxIndex = k;
  1204. const ElementType temp = array [maxIndex];
  1205. array [maxIndex] = array[j];
  1206. array [j] = temp;
  1207. --j;
  1208. }
  1209. }
  1210. else
  1211. {
  1212. const int mid = firstElement + (size >> 1);
  1213. ElementType temp = array [mid];
  1214. array [mid] = array [firstElement];
  1215. array [firstElement] = temp;
  1216. int i = firstElement;
  1217. int j = lastElement + 1;
  1218. for (;;)
  1219. {
  1220. while (++i <= lastElement
  1221. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1222. {}
  1223. while (--j > firstElement
  1224. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1225. {}
  1226. if (j < i)
  1227. break;
  1228. temp = array[i];
  1229. array[i] = array[j];
  1230. array[j] = temp;
  1231. }
  1232. temp = array [firstElement];
  1233. array [firstElement] = array[j];
  1234. array [j] = temp;
  1235. if (j - 1 - firstElement >= lastElement - i)
  1236. {
  1237. if (firstElement + 1 < j)
  1238. {
  1239. fromStack [stackIndex] = firstElement;
  1240. toStack [stackIndex] = j - 1;
  1241. ++stackIndex;
  1242. }
  1243. if (i < lastElement)
  1244. {
  1245. firstElement = i;
  1246. continue;
  1247. }
  1248. }
  1249. else
  1250. {
  1251. if (i < lastElement)
  1252. {
  1253. fromStack [stackIndex] = i;
  1254. toStack [stackIndex] = lastElement;
  1255. ++stackIndex;
  1256. }
  1257. if (firstElement + 1 < j)
  1258. {
  1259. lastElement = j - 1;
  1260. continue;
  1261. }
  1262. }
  1263. }
  1264. if (--stackIndex < 0)
  1265. break;
  1266. jassert (stackIndex < numElementsInArray (fromStack));
  1267. firstElement = fromStack [stackIndex];
  1268. lastElement = toStack [stackIndex];
  1269. }
  1270. }
  1271. }
  1272. }
  1273. template <class ElementType, class ElementComparator>
  1274. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1275. ElementType* const array,
  1276. const ElementType newElement,
  1277. int firstElement,
  1278. int lastElement)
  1279. {
  1280. jassert (firstElement <= lastElement);
  1281. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1282. // avoids getting warning messages about the parameter being unused
  1283. while (firstElement < lastElement)
  1284. {
  1285. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1286. {
  1287. ++firstElement;
  1288. break;
  1289. }
  1290. else
  1291. {
  1292. const int halfway = (firstElement + lastElement) >> 1;
  1293. if (halfway == firstElement)
  1294. {
  1295. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1296. ++firstElement;
  1297. break;
  1298. }
  1299. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1300. {
  1301. firstElement = halfway;
  1302. }
  1303. else
  1304. {
  1305. lastElement = halfway;
  1306. }
  1307. }
  1308. }
  1309. return firstElement;
  1310. }
  1311. template <class ElementType>
  1312. class IntegerElementComparator
  1313. {
  1314. public:
  1315. static int compareElements (const ElementType first,
  1316. const ElementType second) throw()
  1317. {
  1318. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1319. }
  1320. };
  1321. template <class ElementType>
  1322. class FloatElementComparator
  1323. {
  1324. public:
  1325. static int compareElements (const ElementType first,
  1326. const ElementType second) throw()
  1327. {
  1328. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1329. }
  1330. };
  1331. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1332. /********* End of inlined file: juce_ElementComparator.h *********/
  1333. /********* Start of inlined file: juce_CriticalSection.h *********/
  1334. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1335. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1336. class JUCE_API CriticalSection
  1337. {
  1338. public:
  1339. CriticalSection() throw();
  1340. ~CriticalSection() throw();
  1341. void enter() const throw();
  1342. bool tryEnter() const throw();
  1343. void exit() const throw();
  1344. juce_UseDebuggingNewOperator
  1345. private:
  1346. #if JUCE_WIN32
  1347. #if JUCE_64BIT
  1348. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1349. // block of memory here that's big enough to be used internally as a windows critical
  1350. // section object.
  1351. uint8 internal [44];
  1352. #else
  1353. uint8 internal [24];
  1354. #endif
  1355. #else
  1356. mutable pthread_mutex_t internal;
  1357. #endif
  1358. CriticalSection (const CriticalSection&);
  1359. const CriticalSection& operator= (const CriticalSection&);
  1360. };
  1361. class JUCE_API DummyCriticalSection
  1362. {
  1363. public:
  1364. inline DummyCriticalSection() throw() {}
  1365. inline ~DummyCriticalSection() throw() {}
  1366. inline void enter() const throw() {}
  1367. inline void exit() const throw() {}
  1368. };
  1369. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1370. /********* End of inlined file: juce_CriticalSection.h *********/
  1371. template <typename ElementType,
  1372. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1373. class Array
  1374. {
  1375. public:
  1376. Array() throw()
  1377. : numUsed (0)
  1378. {
  1379. }
  1380. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1381. {
  1382. other.lockArray();
  1383. numUsed = other.numUsed;
  1384. data.setAllocatedSize (other.numUsed);
  1385. for (int i = 0; i < numUsed; ++i)
  1386. new (data.elements + i) ElementType (other.data.elements[i]);
  1387. other.unlockArray();
  1388. }
  1389. explicit Array (const ElementType* values)
  1390. : numUsed (0)
  1391. {
  1392. while (*values != 0)
  1393. add (*values++);
  1394. }
  1395. Array (const ElementType* values, int numValues)
  1396. : numUsed (numValues)
  1397. {
  1398. data.setAllocatedSize (numValues);
  1399. for (int i = 0; i < numValues; ++i)
  1400. new (data.elements + i) ElementType (values[i]);
  1401. }
  1402. ~Array()
  1403. {
  1404. for (int i = 0; i < numUsed; ++i)
  1405. data.elements[i].~ElementType();
  1406. }
  1407. Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
  1408. {
  1409. if (this != &other)
  1410. {
  1411. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1412. swapWithArray (otherCopy);
  1413. }
  1414. return *this;
  1415. }
  1416. template <class OtherArrayType>
  1417. bool operator== (const OtherArrayType& other) const
  1418. {
  1419. lock.enter();
  1420. if (numUsed != other.numUsed)
  1421. {
  1422. lock.exit();
  1423. return false;
  1424. }
  1425. for (int i = numUsed; --i >= 0;)
  1426. {
  1427. if (data.elements [i] != other.data.elements [i])
  1428. {
  1429. lock.exit();
  1430. return false;
  1431. }
  1432. }
  1433. lock.exit();
  1434. return true;
  1435. }
  1436. template <class OtherArrayType>
  1437. bool operator!= (const OtherArrayType& other) const
  1438. {
  1439. return ! operator== (other);
  1440. }
  1441. void clear()
  1442. {
  1443. lock.enter();
  1444. for (int i = 0; i < numUsed; ++i)
  1445. data.elements[i].~ElementType();
  1446. data.setAllocatedSize (0);
  1447. numUsed = 0;
  1448. lock.exit();
  1449. }
  1450. void clearQuick()
  1451. {
  1452. lock.enter();
  1453. for (int i = 0; i < numUsed; ++i)
  1454. data.elements[i].~ElementType();
  1455. numUsed = 0;
  1456. lock.exit();
  1457. }
  1458. inline int size() const throw()
  1459. {
  1460. return numUsed;
  1461. }
  1462. inline ElementType operator[] (const int index) const
  1463. {
  1464. lock.enter();
  1465. const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
  1466. ? data.elements [index]
  1467. : ElementType());
  1468. lock.exit();
  1469. return result;
  1470. }
  1471. inline const ElementType getUnchecked (const int index) const
  1472. {
  1473. lock.enter();
  1474. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1475. const ElementType result (data.elements [index]);
  1476. lock.exit();
  1477. return result;
  1478. }
  1479. inline ElementType& getReference (const int index) const throw()
  1480. {
  1481. lock.enter();
  1482. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1483. ElementType& result = data.elements [index];
  1484. lock.exit();
  1485. return result;
  1486. }
  1487. inline ElementType getFirst() const
  1488. {
  1489. lock.enter();
  1490. const ElementType result ((numUsed > 0) ? data.elements [0]
  1491. : ElementType());
  1492. lock.exit();
  1493. return result;
  1494. }
  1495. inline ElementType getLast() const
  1496. {
  1497. lock.enter();
  1498. const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
  1499. : ElementType());
  1500. lock.exit();
  1501. return result;
  1502. }
  1503. int indexOf (const ElementType& elementToLookFor) const
  1504. {
  1505. int result = -1;
  1506. lock.enter();
  1507. const ElementType* e = data.elements;
  1508. for (int i = numUsed; --i >= 0;)
  1509. {
  1510. if (elementToLookFor == *e)
  1511. {
  1512. result = (int) (e - data.elements);
  1513. break;
  1514. }
  1515. ++e;
  1516. }
  1517. lock.exit();
  1518. return result;
  1519. }
  1520. bool contains (const ElementType& elementToLookFor) const
  1521. {
  1522. lock.enter();
  1523. const ElementType* e = data.elements;
  1524. int num = numUsed;
  1525. while (num > 0)
  1526. {
  1527. if (elementToLookFor == *e)
  1528. {
  1529. lock.exit();
  1530. return true;
  1531. }
  1532. --num;
  1533. ++e;
  1534. }
  1535. lock.exit();
  1536. return false;
  1537. }
  1538. void add (const ElementType& newElement)
  1539. {
  1540. lock.enter();
  1541. data.ensureAllocatedSize (numUsed + 1);
  1542. new (data.elements + numUsed++) ElementType (newElement);
  1543. lock.exit();
  1544. }
  1545. void insert (int indexToInsertAt, const ElementType& newElement)
  1546. {
  1547. lock.enter();
  1548. data.ensureAllocatedSize (numUsed + 1);
  1549. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1550. {
  1551. ElementType* const insertPos = data.elements + indexToInsertAt;
  1552. const int numberToMove = numUsed - indexToInsertAt;
  1553. if (numberToMove > 0)
  1554. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1555. new (insertPos) ElementType (newElement);
  1556. ++numUsed;
  1557. }
  1558. else
  1559. {
  1560. new (data.elements + numUsed++) ElementType (newElement);
  1561. }
  1562. lock.exit();
  1563. }
  1564. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1565. int numberOfTimesToInsertIt)
  1566. {
  1567. if (numberOfTimesToInsertIt > 0)
  1568. {
  1569. lock.enter();
  1570. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1571. ElementType* insertPos;
  1572. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1573. {
  1574. insertPos = data.elements + indexToInsertAt;
  1575. const int numberToMove = numUsed - indexToInsertAt;
  1576. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1577. }
  1578. else
  1579. {
  1580. insertPos = data.elements + numUsed;
  1581. }
  1582. numUsed += numberOfTimesToInsertIt;
  1583. while (--numberOfTimesToInsertIt >= 0)
  1584. new (insertPos++) ElementType (newElement);
  1585. lock.exit();
  1586. }
  1587. }
  1588. void insertArray (int indexToInsertAt,
  1589. const ElementType* newElements,
  1590. int numberOfElements)
  1591. {
  1592. if (numberOfElements > 0)
  1593. {
  1594. lock.enter();
  1595. data.ensureAllocatedSize (numUsed + numberOfElements);
  1596. ElementType* insertPos;
  1597. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1598. {
  1599. insertPos = data.elements + indexToInsertAt;
  1600. const int numberToMove = numUsed - indexToInsertAt;
  1601. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1602. }
  1603. else
  1604. {
  1605. insertPos = data.elements + numUsed;
  1606. }
  1607. numUsed += numberOfElements;
  1608. while (--numberOfElements >= 0)
  1609. new (insertPos++) ElementType (*newElements++);
  1610. lock.exit();
  1611. }
  1612. }
  1613. void addIfNotAlreadyThere (const ElementType& newElement)
  1614. {
  1615. lock.enter();
  1616. if (! contains (newElement))
  1617. add (newElement);
  1618. lock.exit();
  1619. }
  1620. void set (const int indexToChange, const ElementType& newValue)
  1621. {
  1622. jassert (indexToChange >= 0);
  1623. lock.enter();
  1624. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1625. {
  1626. data.elements [indexToChange] = newValue;
  1627. }
  1628. else if (indexToChange >= 0)
  1629. {
  1630. data.ensureAllocatedSize (numUsed + 1);
  1631. new (data.elements + numUsed++) ElementType (newValue);
  1632. }
  1633. lock.exit();
  1634. }
  1635. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1636. {
  1637. lock.enter();
  1638. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1639. data.elements [indexToChange] = newValue;
  1640. lock.exit();
  1641. }
  1642. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1643. {
  1644. lock.enter();
  1645. if (numElementsToAdd > 0)
  1646. {
  1647. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1648. while (--numElementsToAdd >= 0)
  1649. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1650. }
  1651. lock.exit();
  1652. }
  1653. void swapWithArray (Array <ElementType>& otherArray) throw()
  1654. {
  1655. lock.enter();
  1656. otherArray.lock.enter();
  1657. data.swapWith (otherArray.data);
  1658. swapVariables (numUsed, otherArray.numUsed);
  1659. otherArray.lock.exit();
  1660. lock.exit();
  1661. }
  1662. template <class OtherArrayType>
  1663. void addArray (const OtherArrayType& arrayToAddFrom,
  1664. int startIndex = 0,
  1665. int numElementsToAdd = -1)
  1666. {
  1667. arrayToAddFrom.lockArray();
  1668. lock.enter();
  1669. if (startIndex < 0)
  1670. {
  1671. jassertfalse
  1672. startIndex = 0;
  1673. }
  1674. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1675. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1676. while (--numElementsToAdd >= 0)
  1677. add (arrayToAddFrom.getUnchecked (startIndex++));
  1678. lock.exit();
  1679. arrayToAddFrom.unlockArray();
  1680. }
  1681. template <class ElementComparator>
  1682. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1683. {
  1684. lock.enter();
  1685. insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
  1686. lock.exit();
  1687. }
  1688. template <class ElementComparator>
  1689. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1690. {
  1691. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1692. // avoids getting warning messages about the parameter being unused
  1693. lock.enter();
  1694. int start = 0;
  1695. int end = numUsed;
  1696. for (;;)
  1697. {
  1698. if (start >= end)
  1699. {
  1700. lock.exit();
  1701. return -1;
  1702. }
  1703. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1704. {
  1705. lock.exit();
  1706. return start;
  1707. }
  1708. else
  1709. {
  1710. const int halfway = (start + end) >> 1;
  1711. if (halfway == start)
  1712. {
  1713. lock.exit();
  1714. return -1;
  1715. }
  1716. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1717. start = halfway;
  1718. else
  1719. end = halfway;
  1720. }
  1721. }
  1722. }
  1723. ElementType remove (const int indexToRemove)
  1724. {
  1725. lock.enter();
  1726. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1727. {
  1728. --numUsed;
  1729. ElementType* const e = data.elements + indexToRemove;
  1730. ElementType removed (*e);
  1731. e->~ElementType();
  1732. const int numberToShift = numUsed - indexToRemove;
  1733. if (numberToShift > 0)
  1734. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1735. if ((numUsed << 1) < data.numAllocated)
  1736. minimiseStorageOverheads();
  1737. lock.exit();
  1738. return removed;
  1739. }
  1740. else
  1741. {
  1742. lock.exit();
  1743. return ElementType();
  1744. }
  1745. }
  1746. void removeValue (const ElementType& valueToRemove)
  1747. {
  1748. lock.enter();
  1749. ElementType* e = data.elements;
  1750. for (int i = numUsed; --i >= 0;)
  1751. {
  1752. if (valueToRemove == *e)
  1753. {
  1754. remove ((int) (e - data.elements));
  1755. break;
  1756. }
  1757. ++e;
  1758. }
  1759. lock.exit();
  1760. }
  1761. void removeRange (int startIndex, int numberToRemove)
  1762. {
  1763. lock.enter();
  1764. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1765. startIndex = jlimit (0, numUsed, startIndex);
  1766. if (endIndex > startIndex)
  1767. {
  1768. ElementType* e = data.elements + startIndex;
  1769. numberToRemove = endIndex - startIndex;
  1770. for (int i = 0; i < numberToRemove; ++i)
  1771. e[i].~ElementType();
  1772. const int numToShift = numUsed - endIndex;
  1773. if (numToShift > 0)
  1774. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1775. numUsed -= numberToRemove;
  1776. if ((numUsed << 1) < data.numAllocated)
  1777. minimiseStorageOverheads();
  1778. }
  1779. lock.exit();
  1780. }
  1781. void removeLast (int howManyToRemove = 1)
  1782. {
  1783. lock.enter();
  1784. if (howManyToRemove > numUsed)
  1785. howManyToRemove = numUsed;
  1786. for (int i = 0; i < howManyToRemove; ++i)
  1787. data.elements [numUsed - i].~ElementType();
  1788. numUsed -= howManyToRemove;
  1789. if ((numUsed << 1) < data.numAllocated)
  1790. minimiseStorageOverheads();
  1791. lock.exit();
  1792. }
  1793. template <class OtherArrayType>
  1794. void removeValuesIn (const OtherArrayType& otherArray)
  1795. {
  1796. otherArray.lockArray();
  1797. lock.enter();
  1798. if (this == &otherArray)
  1799. {
  1800. clear();
  1801. }
  1802. else
  1803. {
  1804. if (otherArray.size() > 0)
  1805. {
  1806. for (int i = numUsed; --i >= 0;)
  1807. if (otherArray.contains (data.elements [i]))
  1808. remove (i);
  1809. }
  1810. }
  1811. lock.exit();
  1812. otherArray.unlockArray();
  1813. }
  1814. template <class OtherArrayType>
  1815. void removeValuesNotIn (const OtherArrayType& otherArray)
  1816. {
  1817. otherArray.lockArray();
  1818. lock.enter();
  1819. if (this != &otherArray)
  1820. {
  1821. if (otherArray.size() <= 0)
  1822. {
  1823. clear();
  1824. }
  1825. else
  1826. {
  1827. for (int i = numUsed; --i >= 0;)
  1828. if (! otherArray.contains (data.elements [i]))
  1829. remove (i);
  1830. }
  1831. }
  1832. lock.exit();
  1833. otherArray.unlockArray();
  1834. }
  1835. void swap (const int index1,
  1836. const int index2)
  1837. {
  1838. lock.enter();
  1839. if (((unsigned int) index1) < (unsigned int) numUsed
  1840. && ((unsigned int) index2) < (unsigned int) numUsed)
  1841. {
  1842. swapVariables (data.elements [index1],
  1843. data.elements [index2]);
  1844. }
  1845. lock.exit();
  1846. }
  1847. void move (const int currentIndex, int newIndex) throw()
  1848. {
  1849. if (currentIndex != newIndex)
  1850. {
  1851. lock.enter();
  1852. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1853. {
  1854. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1855. newIndex = numUsed - 1;
  1856. char tempCopy [sizeof (ElementType)];
  1857. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1858. if (newIndex > currentIndex)
  1859. {
  1860. memmove (data.elements + currentIndex,
  1861. data.elements + currentIndex + 1,
  1862. (newIndex - currentIndex) * sizeof (ElementType));
  1863. }
  1864. else
  1865. {
  1866. memmove (data.elements + newIndex + 1,
  1867. data.elements + newIndex,
  1868. (currentIndex - newIndex) * sizeof (ElementType));
  1869. }
  1870. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1871. }
  1872. lock.exit();
  1873. }
  1874. }
  1875. void minimiseStorageOverheads()
  1876. {
  1877. lock.enter();
  1878. data.shrinkToNoMoreThan (numUsed);
  1879. lock.exit();
  1880. }
  1881. void ensureStorageAllocated (const int minNumElements)
  1882. {
  1883. lock.enter();
  1884. data.ensureAllocatedSize (minNumElements);
  1885. lock.exit();
  1886. }
  1887. template <class ElementComparator>
  1888. void sort (ElementComparator& comparator,
  1889. const bool retainOrderOfEquivalentItems = false) const
  1890. {
  1891. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1892. // avoids getting warning messages about the parameter being unused
  1893. lock.enter();
  1894. sortArray (comparator, (ElementType*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  1895. lock.exit();
  1896. }
  1897. void lockArray() const throw()
  1898. {
  1899. lock.enter();
  1900. }
  1901. void unlockArray() const throw()
  1902. {
  1903. lock.exit();
  1904. }
  1905. juce_UseDebuggingNewOperator
  1906. private:
  1907. ArrayAllocationBase <ElementType> data;
  1908. int numUsed;
  1909. TypeOfCriticalSectionToUse lock;
  1910. };
  1911. #endif // __JUCE_ARRAY_JUCEHEADER__
  1912. /********* End of inlined file: juce_Array.h *********/
  1913. #endif
  1914. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1915. #endif
  1916. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1917. /********* Start of inlined file: juce_BitArray.h *********/
  1918. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1919. #define __JUCE_BITARRAY_JUCEHEADER__
  1920. class MemoryBlock;
  1921. class JUCE_API BitArray
  1922. {
  1923. public:
  1924. BitArray() throw();
  1925. BitArray (const unsigned int value) throw();
  1926. BitArray (const int value) throw();
  1927. BitArray (int64 value) throw();
  1928. BitArray (const BitArray& other) throw();
  1929. ~BitArray() throw();
  1930. BitArray& operator= (const BitArray& other) throw();
  1931. bool operator== (const BitArray& other) const throw();
  1932. bool operator!= (const BitArray& other) const throw();
  1933. void clear() throw();
  1934. void clearBit (const int bitNumber) throw();
  1935. void setBit (const int bitNumber) throw();
  1936. void setBit (const int bitNumber,
  1937. const bool shouldBeSet) throw();
  1938. void setRange (int startBit,
  1939. int numBits,
  1940. const bool shouldBeSet) throw();
  1941. void insertBit (const int bitNumber,
  1942. const bool shouldBeSet) throw();
  1943. bool operator[] (const int bit) const throw();
  1944. bool isEmpty() const throw();
  1945. const BitArray getBitRange (int startBit, int numBits) const throw();
  1946. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1947. void setBitRangeAsInt (int startBit, int numBits,
  1948. unsigned int valueToSet) throw();
  1949. void orWith (const BitArray& other) throw();
  1950. void andWith (const BitArray& other) throw();
  1951. void xorWith (const BitArray& other) throw();
  1952. void add (const BitArray& other) throw();
  1953. void subtract (const BitArray& other) throw();
  1954. void multiplyBy (const BitArray& other) throw();
  1955. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1956. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1957. void modulo (const BitArray& divisor) throw();
  1958. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1959. void inverseModulo (const BitArray& modulus) throw();
  1960. void shiftBits (int howManyBitsLeft,
  1961. int startBit = 0) throw();
  1962. int compare (const BitArray& other) const throw();
  1963. int compareAbsolute (const BitArray& other) const throw();
  1964. bool isNegative() const throw();
  1965. void setNegative (const bool shouldBeNegative) throw();
  1966. void negate() throw();
  1967. int countNumberOfSetBits() const throw();
  1968. int findNextSetBit (int startIndex = 0) const throw();
  1969. int findNextClearBit (int startIndex = 0) const throw();
  1970. int getHighestBit() const throw();
  1971. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1972. void parseString (const String& text,
  1973. const int base) throw();
  1974. const MemoryBlock toMemoryBlock() const throw();
  1975. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1976. juce_UseDebuggingNewOperator
  1977. private:
  1978. void ensureSize (const int numVals) throw();
  1979. HeapBlock <unsigned int> values;
  1980. int numValues, highestBit;
  1981. bool negative;
  1982. };
  1983. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1984. /********* End of inlined file: juce_BitArray.h *********/
  1985. #endif
  1986. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1987. /********* Start of inlined file: juce_DynamicObject.h *********/
  1988. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1989. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  1990. /********* Start of inlined file: juce_NamedValueSet.h *********/
  1991. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  1992. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  1993. /********* Start of inlined file: juce_Variant.h *********/
  1994. #ifndef __JUCE_VARIANT_JUCEHEADER__
  1995. #define __JUCE_VARIANT_JUCEHEADER__
  1996. /********* Start of inlined file: juce_OutputStream.h *********/
  1997. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1998. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  1999. /********* Start of inlined file: juce_InputStream.h *********/
  2000. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2001. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2002. /********* Start of inlined file: juce_MemoryBlock.h *********/
  2003. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2004. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2005. class JUCE_API MemoryBlock
  2006. {
  2007. public:
  2008. MemoryBlock() throw();
  2009. MemoryBlock (const size_t initialSize,
  2010. const bool initialiseToZero = false) throw();
  2011. MemoryBlock (const MemoryBlock& other) throw();
  2012. MemoryBlock (const void* const dataToInitialiseFrom,
  2013. const size_t sizeInBytes) throw();
  2014. ~MemoryBlock() throw();
  2015. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2016. bool operator== (const MemoryBlock& other) const throw();
  2017. bool operator!= (const MemoryBlock& other) const throw();
  2018. bool matches (const void* data, size_t dataSize) const throw();
  2019. template <class DataType>
  2020. operator DataType*() const throw() { return (DataType*) data; }
  2021. void* getData() const throw() { return data; }
  2022. template <typename Type>
  2023. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2024. size_t getSize() const throw() { return size; }
  2025. void setSize (const size_t newSize,
  2026. const bool initialiseNewSpaceToZero = false) throw();
  2027. void ensureSize (const size_t minimumSize,
  2028. const bool initialiseNewSpaceToZero = false) throw();
  2029. void fillWith (const uint8 valueToUse) throw();
  2030. void append (const void* const data,
  2031. const size_t numBytes) throw();
  2032. void swapWith (MemoryBlock& other) throw();
  2033. void copyFrom (const void* srcData,
  2034. int destinationOffset,
  2035. size_t numBytes) throw();
  2036. void copyTo (void* destData,
  2037. int sourceOffset,
  2038. size_t numBytes) const throw();
  2039. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2040. const String toString() const throw();
  2041. void loadFromHexString (const String& sourceHexString) throw();
  2042. void setBitRange (size_t bitRangeStart,
  2043. size_t numBits,
  2044. int binaryNumberToApply) throw();
  2045. int getBitRange (size_t bitRangeStart,
  2046. size_t numBitsToRead) const throw();
  2047. const String toBase64Encoding() const throw();
  2048. bool fromBase64Encoding (const String& encodedString) throw();
  2049. juce_UseDebuggingNewOperator
  2050. private:
  2051. HeapBlock <char> data;
  2052. size_t size;
  2053. };
  2054. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2055. /********* End of inlined file: juce_MemoryBlock.h *********/
  2056. class JUCE_API InputStream
  2057. {
  2058. public:
  2059. virtual ~InputStream() {}
  2060. virtual int64 getTotalLength() = 0;
  2061. virtual bool isExhausted() = 0;
  2062. virtual int read (void* destBuffer,
  2063. int maxBytesToRead) = 0;
  2064. virtual char readByte();
  2065. virtual bool readBool();
  2066. virtual short readShort();
  2067. virtual short readShortBigEndian();
  2068. virtual int readInt();
  2069. virtual int readIntBigEndian();
  2070. virtual int64 readInt64();
  2071. virtual int64 readInt64BigEndian();
  2072. virtual float readFloat();
  2073. virtual float readFloatBigEndian();
  2074. virtual double readDouble();
  2075. virtual double readDoubleBigEndian();
  2076. virtual int readCompressedInt();
  2077. virtual const String readNextLine();
  2078. virtual const String readString();
  2079. virtual const String readEntireStreamAsString();
  2080. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2081. int maxNumBytesToRead = -1);
  2082. virtual int64 getPosition() = 0;
  2083. virtual bool setPosition (int64 newPosition) = 0;
  2084. virtual void skipNextBytes (int64 numBytesToSkip);
  2085. juce_UseDebuggingNewOperator
  2086. protected:
  2087. InputStream() throw() {}
  2088. };
  2089. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2090. /********* End of inlined file: juce_InputStream.h *********/
  2091. class JUCE_API OutputStream
  2092. {
  2093. public:
  2094. virtual ~OutputStream();
  2095. virtual void flush() = 0;
  2096. virtual bool setPosition (int64 newPosition) = 0;
  2097. virtual int64 getPosition() = 0;
  2098. virtual bool write (const void* dataToWrite,
  2099. int howManyBytes) = 0;
  2100. virtual void writeByte (char byte);
  2101. virtual void writeBool (bool boolValue);
  2102. virtual void writeShort (short value);
  2103. virtual void writeShortBigEndian (short value);
  2104. virtual void writeInt (int value);
  2105. virtual void writeIntBigEndian (int value);
  2106. virtual void writeInt64 (int64 value);
  2107. virtual void writeInt64BigEndian (int64 value);
  2108. virtual void writeFloat (float value);
  2109. virtual void writeFloatBigEndian (float value);
  2110. virtual void writeDouble (double value);
  2111. virtual void writeDoubleBigEndian (double value);
  2112. virtual void writeCompressedInt (int value);
  2113. virtual void writeString (const String& text);
  2114. virtual void writeText (const String& text,
  2115. const bool asUnicode,
  2116. const bool writeUnicodeHeaderBytes);
  2117. virtual void printf (const char* format, ...);
  2118. virtual int writeFromInputStream (InputStream& source,
  2119. int maxNumBytesToWrite);
  2120. virtual OutputStream& operator<< (const int number);
  2121. virtual OutputStream& operator<< (const double number);
  2122. virtual OutputStream& operator<< (const char character);
  2123. virtual OutputStream& operator<< (const char* const text);
  2124. virtual OutputStream& operator<< (const juce_wchar* const text);
  2125. virtual OutputStream& operator<< (const String& text);
  2126. juce_UseDebuggingNewOperator
  2127. protected:
  2128. OutputStream() throw();
  2129. };
  2130. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2131. /********* End of inlined file: juce_OutputStream.h *********/
  2132. class JUCE_API DynamicObject;
  2133. class JUCE_API var
  2134. {
  2135. public:
  2136. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2137. var() throw();
  2138. ~var() throw();
  2139. static const var null;
  2140. var (const var& valueToCopy);
  2141. var (const int value) throw();
  2142. var (const bool value) throw();
  2143. var (const double value) throw();
  2144. var (const char* const value);
  2145. var (const juce_wchar* const value);
  2146. var (const String& value);
  2147. var (DynamicObject* const object);
  2148. var (MethodFunction method) throw();
  2149. var& operator= (const var& valueToCopy);
  2150. var& operator= (int value);
  2151. var& operator= (bool value);
  2152. var& operator= (double value);
  2153. var& operator= (const char* value);
  2154. var& operator= (const juce_wchar* value);
  2155. var& operator= (const String& value);
  2156. var& operator= (DynamicObject* object);
  2157. var& operator= (MethodFunction method);
  2158. void swapWith (var& other) throw();
  2159. operator int() const;
  2160. operator bool() const;
  2161. operator float() const;
  2162. operator double() const;
  2163. operator const String() const;
  2164. const String toString() const;
  2165. DynamicObject* getObject() const;
  2166. bool isVoid() const throw() { return type == voidType; }
  2167. bool isInt() const throw() { return type == intType; }
  2168. bool isBool() const throw() { return type == boolType; }
  2169. bool isDouble() const throw() { return type == doubleType; }
  2170. bool isString() const throw() { return type == stringType; }
  2171. bool isObject() const throw() { return type == objectType; }
  2172. bool isMethod() const throw() { return type == methodType; }
  2173. bool operator== (const var& other) const throw();
  2174. bool operator!= (const var& other) const throw();
  2175. void writeToStream (OutputStream& output) const;
  2176. static const var readFromStream (InputStream& input);
  2177. class JUCE_API identifier
  2178. {
  2179. public:
  2180. identifier() throw();
  2181. identifier (const char* const name);
  2182. identifier (const String& name);
  2183. ~identifier();
  2184. bool operator== (const identifier& other) const throw()
  2185. {
  2186. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2187. return hashCode == other.hashCode;
  2188. }
  2189. String name;
  2190. int hashCode;
  2191. };
  2192. const var operator[] (const identifier& propertyName) const;
  2193. const var call (const identifier& method) const;
  2194. const var call (const identifier& method, const var& arg1) const;
  2195. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2196. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2197. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2198. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2199. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2200. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2201. juce_UseDebuggingNewOperator
  2202. private:
  2203. enum Type
  2204. {
  2205. voidType = 0,
  2206. intType,
  2207. boolType,
  2208. doubleType,
  2209. stringType,
  2210. objectType,
  2211. methodType
  2212. };
  2213. union ValueUnion
  2214. {
  2215. int intValue;
  2216. bool boolValue;
  2217. double doubleValue;
  2218. String* stringValue;
  2219. DynamicObject* objectValue;
  2220. MethodFunction methodValue;
  2221. };
  2222. Type type;
  2223. ValueUnion value;
  2224. };
  2225. #endif // __JUCE_VARIANT_JUCEHEADER__
  2226. /********* End of inlined file: juce_Variant.h *********/
  2227. class JUCE_API NamedValueSet
  2228. {
  2229. public:
  2230. NamedValueSet() throw();
  2231. NamedValueSet (const NamedValueSet& other);
  2232. NamedValueSet& operator= (const NamedValueSet& other);
  2233. ~NamedValueSet();
  2234. int size() const throw();
  2235. const var& operator[] (const var::identifier& name) const;
  2236. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2237. var* getItem (const var::identifier& name) const;
  2238. bool set (const var::identifier& name, const var& newValue);
  2239. bool contains (const var::identifier& name) const;
  2240. bool remove (const var::identifier& name);
  2241. const var::identifier getName (int index) const;
  2242. void clear();
  2243. juce_UseDebuggingNewOperator
  2244. private:
  2245. struct NamedValue
  2246. {
  2247. NamedValue() throw();
  2248. NamedValue (const var::identifier& name, const var& value);
  2249. var::identifier name;
  2250. var value;
  2251. };
  2252. Array <NamedValue> values;
  2253. };
  2254. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2255. /********* End of inlined file: juce_NamedValueSet.h *********/
  2256. /********* Start of inlined file: juce_ReferenceCountedObject.h *********/
  2257. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2258. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2259. /********* Start of inlined file: juce_Atomic.h *********/
  2260. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2261. #define __JUCE_ATOMIC_JUCEHEADER__
  2262. class JUCE_API Atomic
  2263. {
  2264. public:
  2265. static void increment (int32& variable);
  2266. static int32 incrementAndReturn (int32& variable);
  2267. static void decrement (int32& variable);
  2268. static int32 decrementAndReturn (int32& variable);
  2269. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2270. };
  2271. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2272. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2273. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2274. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2275. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2276. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2277. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2278. #elif JUCE_LINUX // Linux...
  2279. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2280. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2281. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2282. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2283. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2284. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2285. #elif JUCE_USE_INTRINSICS // Windows...
  2286. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2287. // declared in juce_win32_Threads.cpp)
  2288. #pragma intrinsic (_InterlockedIncrement)
  2289. #pragma intrinsic (_InterlockedDecrement)
  2290. #pragma intrinsic (_InterlockedCompareExchange)
  2291. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2292. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2293. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2294. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2295. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2296. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2297. #endif
  2298. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2299. /********* End of inlined file: juce_Atomic.h *********/
  2300. class JUCE_API ReferenceCountedObject
  2301. {
  2302. public:
  2303. inline void incReferenceCount() throw()
  2304. {
  2305. Atomic::increment (refCounts);
  2306. jassert (refCounts > 0);
  2307. }
  2308. inline void decReferenceCount() throw()
  2309. {
  2310. jassert (refCounts > 0);
  2311. if (Atomic::decrementAndReturn (refCounts) == 0)
  2312. delete this;
  2313. }
  2314. inline int getReferenceCount() const throw()
  2315. {
  2316. return refCounts;
  2317. }
  2318. protected:
  2319. ReferenceCountedObject()
  2320. : refCounts (0)
  2321. {
  2322. }
  2323. virtual ~ReferenceCountedObject()
  2324. {
  2325. // it's dangerous to delete an object that's still referenced by something else!
  2326. jassert (refCounts == 0);
  2327. }
  2328. private:
  2329. int refCounts;
  2330. };
  2331. template <class ReferenceCountedObjectClass>
  2332. class ReferenceCountedObjectPtr
  2333. {
  2334. public:
  2335. inline ReferenceCountedObjectPtr() throw()
  2336. : referencedObject (0)
  2337. {
  2338. }
  2339. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2340. : referencedObject (refCountedObject)
  2341. {
  2342. if (refCountedObject != 0)
  2343. refCountedObject->incReferenceCount();
  2344. }
  2345. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2346. : referencedObject (other.referencedObject)
  2347. {
  2348. if (referencedObject != 0)
  2349. referencedObject->incReferenceCount();
  2350. }
  2351. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2352. {
  2353. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2354. if (newObject != referencedObject)
  2355. {
  2356. if (newObject != 0)
  2357. newObject->incReferenceCount();
  2358. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2359. referencedObject = newObject;
  2360. if (oldObject != 0)
  2361. oldObject->decReferenceCount();
  2362. }
  2363. return *this;
  2364. }
  2365. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2366. {
  2367. if (referencedObject != newObject)
  2368. {
  2369. if (newObject != 0)
  2370. newObject->incReferenceCount();
  2371. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2372. referencedObject = newObject;
  2373. if (oldObject != 0)
  2374. oldObject->decReferenceCount();
  2375. }
  2376. return *this;
  2377. }
  2378. inline ~ReferenceCountedObjectPtr()
  2379. {
  2380. if (referencedObject != 0)
  2381. referencedObject->decReferenceCount();
  2382. }
  2383. inline operator ReferenceCountedObjectClass*() const throw()
  2384. {
  2385. return referencedObject;
  2386. }
  2387. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2388. {
  2389. return referencedObject == object;
  2390. }
  2391. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2392. {
  2393. return referencedObject != object;
  2394. }
  2395. // the -> operator is called on the referenced object
  2396. inline ReferenceCountedObjectClass* operator->() const throw()
  2397. {
  2398. return referencedObject;
  2399. }
  2400. private:
  2401. ReferenceCountedObjectClass* referencedObject;
  2402. };
  2403. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2404. /********* End of inlined file: juce_ReferenceCountedObject.h *********/
  2405. class JUCE_API DynamicObject : public ReferenceCountedObject
  2406. {
  2407. public:
  2408. DynamicObject();
  2409. virtual ~DynamicObject();
  2410. virtual bool hasProperty (const var::identifier& propertyName) const;
  2411. virtual const var getProperty (const var::identifier& propertyName) const;
  2412. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2413. virtual void removeProperty (const var::identifier& propertyName);
  2414. virtual bool hasMethod (const var::identifier& methodName) const;
  2415. virtual const var invokeMethod (const var::identifier& methodName,
  2416. const var* parameters,
  2417. int numParameters);
  2418. void setMethod (const var::identifier& methodName,
  2419. var::MethodFunction methodFunction);
  2420. void clear();
  2421. juce_UseDebuggingNewOperator
  2422. private:
  2423. NamedValueSet properties;
  2424. };
  2425. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2426. /********* End of inlined file: juce_DynamicObject.h *********/
  2427. #endif
  2428. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2429. #endif
  2430. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2431. #endif
  2432. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2433. #endif
  2434. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2435. #endif
  2436. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2437. /********* Start of inlined file: juce_OwnedArray.h *********/
  2438. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2439. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2440. /********* Start of inlined file: juce_ScopedPointer.h *********/
  2441. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2442. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2443. template <class ObjectType>
  2444. class JUCE_API ScopedPointer
  2445. {
  2446. public:
  2447. inline ScopedPointer() throw() : object (0)
  2448. {
  2449. }
  2450. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2451. : object (objectToTakePossessionOf)
  2452. {
  2453. }
  2454. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2455. : object (objectToTransferFrom.object)
  2456. {
  2457. objectToTransferFrom.object = 0;
  2458. }
  2459. inline ~ScopedPointer() { delete object; }
  2460. const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2461. {
  2462. if (this != objectToTransferFrom.getAddress())
  2463. {
  2464. // Two ScopedPointers should never be able to refer to the same object - if
  2465. // this happens, you must have done something dodgy!
  2466. jassert (object != objectToTransferFrom.object);
  2467. ObjectType* const oldObject = object;
  2468. object = objectToTransferFrom.object;
  2469. objectToTransferFrom.object = 0;
  2470. delete oldObject;
  2471. }
  2472. return *this;
  2473. }
  2474. const ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2475. {
  2476. if (object != newObjectToTakePossessionOf)
  2477. {
  2478. ObjectType* const oldObject = object;
  2479. object = newObjectToTakePossessionOf;
  2480. delete oldObject;
  2481. }
  2482. return *this;
  2483. }
  2484. inline operator ObjectType*() const throw() { return object; }
  2485. inline ObjectType& operator*() const throw() { return *object; }
  2486. inline ObjectType* operator->() const throw() { return object; }
  2487. template <class CastType>
  2488. inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
  2489. inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
  2490. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2491. inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
  2492. inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
  2493. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2494. {
  2495. // Two ScopedPointers should never be able to refer to the same object - if
  2496. // this happens, you must have done something dodgy!
  2497. jassert (object != other.object);
  2498. swapVariables (object, other.object);
  2499. }
  2500. private:
  2501. ObjectType* object;
  2502. // (Required as an alternative to the overloaded & operator).
  2503. ScopedPointer* getAddress() const throw() { return this; }
  2504. };
  2505. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2506. /********* End of inlined file: juce_ScopedPointer.h *********/
  2507. template <class ObjectClass,
  2508. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2509. class OwnedArray
  2510. {
  2511. public:
  2512. OwnedArray() throw()
  2513. : numUsed (0)
  2514. {
  2515. }
  2516. ~OwnedArray()
  2517. {
  2518. clear (true);
  2519. }
  2520. void clear (const bool deleteObjects = true)
  2521. {
  2522. lock.enter();
  2523. if (deleteObjects)
  2524. {
  2525. while (numUsed > 0)
  2526. delete data.elements [--numUsed];
  2527. }
  2528. data.setAllocatedSize (0);
  2529. numUsed = 0;
  2530. lock.exit();
  2531. }
  2532. inline int size() const throw()
  2533. {
  2534. return numUsed;
  2535. }
  2536. inline ObjectClass* operator[] (const int index) const throw()
  2537. {
  2538. lock.enter();
  2539. ObjectClass* const result = (((unsigned int) index) < (unsigned int) numUsed)
  2540. ? data.elements [index]
  2541. : (ObjectClass*) 0;
  2542. lock.exit();
  2543. return result;
  2544. }
  2545. inline ObjectClass* getUnchecked (const int index) const throw()
  2546. {
  2547. lock.enter();
  2548. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2549. ObjectClass* const result = data.elements [index];
  2550. lock.exit();
  2551. return result;
  2552. }
  2553. inline ObjectClass* getFirst() const throw()
  2554. {
  2555. lock.enter();
  2556. ObjectClass* const result = (numUsed > 0) ? data.elements [0]
  2557. : (ObjectClass*) 0;
  2558. lock.exit();
  2559. return result;
  2560. }
  2561. inline ObjectClass* getLast() const throw()
  2562. {
  2563. lock.enter();
  2564. ObjectClass* const result = (numUsed > 0) ? data.elements [numUsed - 1]
  2565. : (ObjectClass*) 0;
  2566. lock.exit();
  2567. return result;
  2568. }
  2569. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2570. {
  2571. int result = -1;
  2572. lock.enter();
  2573. ObjectClass* const* e = data.elements;
  2574. for (int i = numUsed; --i >= 0;)
  2575. {
  2576. if (objectToLookFor == *e)
  2577. {
  2578. result = (int) (e - data.elements);
  2579. break;
  2580. }
  2581. ++e;
  2582. }
  2583. lock.exit();
  2584. return result;
  2585. }
  2586. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2587. {
  2588. lock.enter();
  2589. ObjectClass* const* e = data.elements;
  2590. int i = numUsed;
  2591. while (i >= 4)
  2592. {
  2593. if (objectToLookFor == *e
  2594. || objectToLookFor == *++e
  2595. || objectToLookFor == *++e
  2596. || objectToLookFor == *++e)
  2597. {
  2598. lock.exit();
  2599. return true;
  2600. }
  2601. i -= 4;
  2602. ++e;
  2603. }
  2604. while (i > 0)
  2605. {
  2606. if (objectToLookFor == *e)
  2607. {
  2608. lock.exit();
  2609. return true;
  2610. }
  2611. --i;
  2612. ++e;
  2613. }
  2614. lock.exit();
  2615. return false;
  2616. }
  2617. void add (const ObjectClass* const newObject) throw()
  2618. {
  2619. lock.enter();
  2620. data.ensureAllocatedSize (numUsed + 1);
  2621. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2622. lock.exit();
  2623. }
  2624. void insert (int indexToInsertAt,
  2625. const ObjectClass* const newObject) throw()
  2626. {
  2627. if (indexToInsertAt >= 0)
  2628. {
  2629. lock.enter();
  2630. if (indexToInsertAt > numUsed)
  2631. indexToInsertAt = numUsed;
  2632. data.ensureAllocatedSize (numUsed + 1);
  2633. ObjectClass** const e = data.elements + indexToInsertAt;
  2634. const int numToMove = numUsed - indexToInsertAt;
  2635. if (numToMove > 0)
  2636. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2637. *e = const_cast <ObjectClass*> (newObject);
  2638. ++numUsed;
  2639. lock.exit();
  2640. }
  2641. else
  2642. {
  2643. add (newObject);
  2644. }
  2645. }
  2646. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2647. {
  2648. lock.enter();
  2649. if (! contains (newObject))
  2650. add (newObject);
  2651. lock.exit();
  2652. }
  2653. void set (const int indexToChange,
  2654. const ObjectClass* const newObject,
  2655. const bool deleteOldElement = true)
  2656. {
  2657. if (indexToChange >= 0)
  2658. {
  2659. ScopedPointer <ObjectClass> toDelete;
  2660. lock.enter();
  2661. if (indexToChange < numUsed)
  2662. {
  2663. if (deleteOldElement)
  2664. {
  2665. toDelete = data.elements [indexToChange];
  2666. if (toDelete == newObject)
  2667. toDelete = 0;
  2668. }
  2669. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2670. }
  2671. else
  2672. {
  2673. data.ensureAllocatedSize (numUsed + 1);
  2674. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2675. }
  2676. lock.exit();
  2677. }
  2678. }
  2679. template <class ElementComparator>
  2680. void addSorted (ElementComparator& comparator,
  2681. ObjectClass* const newObject) throw()
  2682. {
  2683. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2684. // avoids getting warning messages about the parameter being unused
  2685. lock.enter();
  2686. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  2687. lock.exit();
  2688. }
  2689. template <class ElementComparator>
  2690. int indexOfSorted (ElementComparator& comparator,
  2691. const ObjectClass* const objectToLookFor) const throw()
  2692. {
  2693. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2694. // avoids getting warning messages about the parameter being unused
  2695. lock.enter();
  2696. int start = 0;
  2697. int end = numUsed;
  2698. for (;;)
  2699. {
  2700. if (start >= end)
  2701. {
  2702. lock.exit();
  2703. return -1;
  2704. }
  2705. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2706. {
  2707. lock.exit();
  2708. return start;
  2709. }
  2710. else
  2711. {
  2712. const int halfway = (start + end) >> 1;
  2713. if (halfway == start)
  2714. {
  2715. lock.exit();
  2716. return -1;
  2717. }
  2718. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2719. start = halfway;
  2720. else
  2721. end = halfway;
  2722. }
  2723. }
  2724. }
  2725. void remove (const int indexToRemove,
  2726. const bool deleteObject = true)
  2727. {
  2728. ScopedPointer <ObjectClass> toDelete;
  2729. lock.enter();
  2730. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2731. {
  2732. ObjectClass** const e = data.elements + indexToRemove;
  2733. if (deleteObject)
  2734. toDelete = *e;
  2735. --numUsed;
  2736. const int numToShift = numUsed - indexToRemove;
  2737. if (numToShift > 0)
  2738. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2739. if ((numUsed << 1) < data.numAllocated)
  2740. minimiseStorageOverheads();
  2741. }
  2742. lock.exit();
  2743. }
  2744. void removeObject (const ObjectClass* const objectToRemove,
  2745. const bool deleteObject = true)
  2746. {
  2747. lock.enter();
  2748. ObjectClass** e = data.elements;
  2749. for (int i = numUsed; --i >= 0;)
  2750. {
  2751. if (objectToRemove == *e)
  2752. {
  2753. remove ((int) (e - data.elements), deleteObject);
  2754. break;
  2755. }
  2756. ++e;
  2757. }
  2758. lock.exit();
  2759. }
  2760. void removeRange (int startIndex,
  2761. const int numberToRemove,
  2762. const bool deleteObjects = true)
  2763. {
  2764. lock.enter();
  2765. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2766. startIndex = jlimit (0, numUsed, startIndex);
  2767. if (endIndex > startIndex)
  2768. {
  2769. if (deleteObjects)
  2770. {
  2771. for (int i = startIndex; i < endIndex; ++i)
  2772. {
  2773. delete data.elements [i];
  2774. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2775. }
  2776. }
  2777. const int rangeSize = endIndex - startIndex;
  2778. ObjectClass** e = data.elements + startIndex;
  2779. int numToShift = numUsed - endIndex;
  2780. numUsed -= rangeSize;
  2781. while (--numToShift >= 0)
  2782. {
  2783. *e = e [rangeSize];
  2784. ++e;
  2785. }
  2786. if ((numUsed << 1) < data.numAllocated)
  2787. minimiseStorageOverheads();
  2788. }
  2789. lock.exit();
  2790. }
  2791. void removeLast (int howManyToRemove = 1,
  2792. const bool deleteObjects = true)
  2793. {
  2794. lock.enter();
  2795. if (howManyToRemove >= numUsed)
  2796. {
  2797. clear (deleteObjects);
  2798. }
  2799. else
  2800. {
  2801. while (--howManyToRemove >= 0)
  2802. remove (numUsed - 1, deleteObjects);
  2803. }
  2804. lock.exit();
  2805. }
  2806. void swap (const int index1,
  2807. const int index2) throw()
  2808. {
  2809. lock.enter();
  2810. if (((unsigned int) index1) < (unsigned int) numUsed
  2811. && ((unsigned int) index2) < (unsigned int) numUsed)
  2812. {
  2813. swapVariables (data.elements [index1],
  2814. data.elements [index2]);
  2815. }
  2816. lock.exit();
  2817. }
  2818. void move (const int currentIndex,
  2819. int newIndex) throw()
  2820. {
  2821. if (currentIndex != newIndex)
  2822. {
  2823. lock.enter();
  2824. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2825. {
  2826. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2827. newIndex = numUsed - 1;
  2828. ObjectClass* const value = data.elements [currentIndex];
  2829. if (newIndex > currentIndex)
  2830. {
  2831. memmove (data.elements + currentIndex,
  2832. data.elements + currentIndex + 1,
  2833. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2834. }
  2835. else
  2836. {
  2837. memmove (data.elements + newIndex + 1,
  2838. data.elements + newIndex,
  2839. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2840. }
  2841. data.elements [newIndex] = value;
  2842. }
  2843. lock.exit();
  2844. }
  2845. }
  2846. void swapWithArray (OwnedArray <ObjectClass>& otherArray) throw()
  2847. {
  2848. lock.enter();
  2849. otherArray.lock.enter();
  2850. data.swapWith (otherArray.data);
  2851. swapVariables (numUsed, otherArray.numUsed);
  2852. otherArray.lock.exit();
  2853. lock.exit();
  2854. }
  2855. void minimiseStorageOverheads() throw()
  2856. {
  2857. lock.enter();
  2858. data.shrinkToNoMoreThan (numUsed);
  2859. lock.exit();
  2860. }
  2861. void ensureStorageAllocated (const int minNumElements) throw()
  2862. {
  2863. lock.enter();
  2864. data.ensureAllocatedSize (minNumElements);
  2865. lock.exit();
  2866. }
  2867. template <class ElementComparator>
  2868. void sort (ElementComparator& comparator,
  2869. const bool retainOrderOfEquivalentItems = false) const throw()
  2870. {
  2871. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2872. // avoids getting warning messages about the parameter being unused
  2873. lock.enter();
  2874. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  2875. lock.exit();
  2876. }
  2877. void lockArray() const throw()
  2878. {
  2879. lock.enter();
  2880. }
  2881. void unlockArray() const throw()
  2882. {
  2883. lock.exit();
  2884. }
  2885. juce_UseDebuggingNewOperator
  2886. private:
  2887. ArrayAllocationBase <ObjectClass*> data;
  2888. int numUsed;
  2889. TypeOfCriticalSectionToUse lock;
  2890. // disallow copy constructor and assignment
  2891. OwnedArray (const OwnedArray&);
  2892. const OwnedArray& operator= (const OwnedArray&);
  2893. };
  2894. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2895. /********* End of inlined file: juce_OwnedArray.h *********/
  2896. #endif
  2897. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2898. /********* Start of inlined file: juce_PropertySet.h *********/
  2899. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2900. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2901. /********* Start of inlined file: juce_StringPairArray.h *********/
  2902. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2903. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2904. /********* Start of inlined file: juce_StringArray.h *********/
  2905. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2906. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2907. #ifndef DOXYGEN
  2908. // (used in StringArray::appendNumbersToDuplicates)
  2909. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2910. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2911. #endif
  2912. class JUCE_API StringArray
  2913. {
  2914. public:
  2915. StringArray() throw();
  2916. StringArray (const StringArray& other);
  2917. StringArray (const juce_wchar** const strings,
  2918. const int numberOfStrings);
  2919. StringArray (const char** const strings,
  2920. const int numberOfStrings);
  2921. explicit StringArray (const juce_wchar** const strings);
  2922. explicit StringArray (const char** const strings);
  2923. ~StringArray();
  2924. const StringArray& operator= (const StringArray& other);
  2925. bool operator== (const StringArray& other) const;
  2926. bool operator!= (const StringArray& other) const;
  2927. inline int size() const throw() { return strings.size(); };
  2928. const String& operator[] (const int index) const throw();
  2929. bool contains (const String& stringToLookFor,
  2930. const bool ignoreCase = false) const;
  2931. int indexOf (const String& stringToLookFor,
  2932. const bool ignoreCase = false,
  2933. int startIndex = 0) const;
  2934. void add (const String& stringToAdd);
  2935. void insert (const int index, const String& stringToAdd);
  2936. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2937. void set (const int index, const String& newString);
  2938. void addArray (const StringArray& other,
  2939. int startIndex = 0,
  2940. int numElementsToAdd = -1);
  2941. int addTokens (const tchar* const stringToTokenise,
  2942. const bool preserveQuotedStrings);
  2943. int addTokens (const tchar* const stringToTokenise,
  2944. const tchar* breakCharacters,
  2945. const tchar* quoteCharacters);
  2946. int addLines (const tchar* stringToBreakUp);
  2947. void clear();
  2948. void remove (const int index);
  2949. void removeString (const String& stringToRemove,
  2950. const bool ignoreCase = false);
  2951. void removeDuplicates (const bool ignoreCase);
  2952. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2953. void move (const int currentIndex, int newIndex) throw();
  2954. void trim();
  2955. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2956. const bool appendNumberToFirstInstance,
  2957. const tchar* const preNumberString = defaultPreNumberString,
  2958. const tchar* const postNumberString = defaultPostNumberString);
  2959. const String joinIntoString (const String& separatorString,
  2960. int startIndex = 0,
  2961. int numberOfElements = -1) const;
  2962. void sort (const bool ignoreCase);
  2963. void minimiseStorageOverheads();
  2964. juce_UseDebuggingNewOperator
  2965. private:
  2966. Array <String> strings;
  2967. };
  2968. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2969. /********* End of inlined file: juce_StringArray.h *********/
  2970. class JUCE_API StringPairArray
  2971. {
  2972. public:
  2973. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2974. StringPairArray (const StringPairArray& other) throw();
  2975. ~StringPairArray() throw();
  2976. const StringPairArray& operator= (const StringPairArray& other) throw();
  2977. bool operator== (const StringPairArray& other) const throw();
  2978. bool operator!= (const StringPairArray& other) const throw();
  2979. const String& operator[] (const String& key) const throw();
  2980. const String getValue (const String& key, const String& defaultReturnValue) const;
  2981. const StringArray& getAllKeys() const throw() { return keys; }
  2982. const StringArray& getAllValues() const throw() { return values; }
  2983. inline int size() const throw() { return keys.size(); };
  2984. void set (const String& key,
  2985. const String& value) throw();
  2986. void addArray (const StringPairArray& other);
  2987. void clear() throw();
  2988. void remove (const String& key) throw();
  2989. void remove (const int index) throw();
  2990. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2991. const String getDescription() const;
  2992. void minimiseStorageOverheads() throw();
  2993. juce_UseDebuggingNewOperator
  2994. private:
  2995. StringArray keys, values;
  2996. bool ignoreCase;
  2997. };
  2998. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2999. /********* End of inlined file: juce_StringPairArray.h *********/
  3000. /********* Start of inlined file: juce_XmlElement.h *********/
  3001. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3002. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3003. /********* Start of inlined file: juce_File.h *********/
  3004. #ifndef __JUCE_FILE_JUCEHEADER__
  3005. #define __JUCE_FILE_JUCEHEADER__
  3006. /********* Start of inlined file: juce_Time.h *********/
  3007. #ifndef __JUCE_TIME_JUCEHEADER__
  3008. #define __JUCE_TIME_JUCEHEADER__
  3009. /********* Start of inlined file: juce_RelativeTime.h *********/
  3010. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3011. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3012. class JUCE_API RelativeTime
  3013. {
  3014. public:
  3015. explicit RelativeTime (const double seconds = 0.0) throw();
  3016. RelativeTime (const RelativeTime& other) throw();
  3017. const RelativeTime& operator= (const RelativeTime& other) throw();
  3018. ~RelativeTime() throw();
  3019. static const RelativeTime milliseconds (const int milliseconds) throw();
  3020. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  3021. static const RelativeTime minutes (const double numberOfMinutes) throw();
  3022. static const RelativeTime hours (const double numberOfHours) throw();
  3023. static const RelativeTime days (const double numberOfDays) throw();
  3024. static const RelativeTime weeks (const double numberOfWeeks) throw();
  3025. int64 inMilliseconds() const throw();
  3026. double inSeconds() const throw() { return seconds; }
  3027. double inMinutes() const throw();
  3028. double inHours() const throw();
  3029. double inDays() const throw();
  3030. double inWeeks() const throw();
  3031. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  3032. bool operator== (const RelativeTime& other) const throw();
  3033. bool operator!= (const RelativeTime& other) const throw();
  3034. bool operator> (const RelativeTime& other) const throw();
  3035. bool operator< (const RelativeTime& other) const throw();
  3036. bool operator>= (const RelativeTime& other) const throw();
  3037. bool operator<= (const RelativeTime& other) const throw();
  3038. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3039. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3040. const RelativeTime operator+ (const double secondsToAdd) const throw();
  3041. const RelativeTime operator- (const double secondsToSubtract) const throw();
  3042. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3043. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3044. const RelativeTime& operator+= (const double secondsToAdd) throw();
  3045. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  3046. juce_UseDebuggingNewOperator
  3047. private:
  3048. double seconds;
  3049. };
  3050. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3051. /********* End of inlined file: juce_RelativeTime.h *********/
  3052. class JUCE_API Time
  3053. {
  3054. public:
  3055. Time() throw();
  3056. Time (const Time& other) throw();
  3057. Time (const int64 millisecondsSinceEpoch) throw();
  3058. Time (const int year,
  3059. const int month,
  3060. const int day,
  3061. const int hours,
  3062. const int minutes,
  3063. const int seconds = 0,
  3064. const int milliseconds = 0,
  3065. const bool useLocalTime = true) throw();
  3066. ~Time() throw();
  3067. const Time& operator= (const Time& other) throw();
  3068. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3069. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3070. int getYear() const throw();
  3071. int getMonth() const throw();
  3072. const String getMonthName (const bool threeLetterVersion) const throw();
  3073. int getDayOfMonth() const throw();
  3074. int getDayOfWeek() const throw();
  3075. const String getWeekdayName (const bool threeLetterVersion) const throw();
  3076. int getHours() const throw();
  3077. bool isAfternoon() const throw();
  3078. int getHoursInAmPmFormat() const throw();
  3079. int getMinutes() const throw();
  3080. int getSeconds() const throw();
  3081. int getMilliseconds() const throw();
  3082. bool isDaylightSavingTime() const throw();
  3083. const String getTimeZone() const throw();
  3084. const String toString (const bool includeDate,
  3085. const bool includeTime,
  3086. const bool includeSeconds = true,
  3087. const bool use24HourClock = false) const throw();
  3088. const String formatted (const tchar* const format) const throw();
  3089. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3090. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3091. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3092. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3093. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3094. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3095. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3096. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3097. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3098. bool setSystemTimeToThisTime() const throw();
  3099. static const String getWeekdayName (int dayNumber,
  3100. const bool threeLetterVersion) throw();
  3101. static const String getMonthName (int monthNumber,
  3102. const bool threeLetterVersion) throw();
  3103. // Static methods for getting system timers directly..
  3104. static int64 currentTimeMillis() throw();
  3105. static uint32 getMillisecondCounter() throw();
  3106. static double getMillisecondCounterHiRes() throw();
  3107. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  3108. static uint32 getApproximateMillisecondCounter() throw();
  3109. // High-resolution timers..
  3110. static int64 getHighResolutionTicks() throw();
  3111. static int64 getHighResolutionTicksPerSecond() throw();
  3112. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  3113. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  3114. private:
  3115. int64 millisSinceEpoch;
  3116. };
  3117. #endif // __JUCE_TIME_JUCEHEADER__
  3118. /********* End of inlined file: juce_Time.h *********/
  3119. class FileInputStream;
  3120. class FileOutputStream;
  3121. class JUCE_API File
  3122. {
  3123. public:
  3124. File() {}
  3125. File (const String& path);
  3126. File (const File& other);
  3127. ~File() {}
  3128. const File& operator= (const String& newFilePath);
  3129. const File& operator= (const File& otherFile);
  3130. static const File nonexistent;
  3131. bool exists() const;
  3132. bool existsAsFile() const;
  3133. bool isDirectory() const;
  3134. int64 getSize() const;
  3135. static const String descriptionOfSizeInBytes (const int64 bytes);
  3136. const String& getFullPathName() const { return fullPath; }
  3137. const String getFileName() const;
  3138. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3139. const String getFileExtension() const;
  3140. bool hasFileExtension (const String& extensionToTest) const;
  3141. const File withFileExtension (const String& newExtension) const;
  3142. const String getFileNameWithoutExtension() const;
  3143. int hashCode() const;
  3144. int64 hashCode64() const;
  3145. const File getChildFile (String relativePath) const;
  3146. const File getSiblingFile (const String& siblingFileName) const;
  3147. const File getParentDirectory() const;
  3148. bool isAChildOf (const File& potentialParentDirectory) const;
  3149. const File getNonexistentChildFile (const String& prefix,
  3150. const String& suffix,
  3151. bool putNumbersInBrackets = true) const;
  3152. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3153. bool operator== (const File& otherFile) const;
  3154. bool operator!= (const File& otherFile) const;
  3155. bool hasWriteAccess() const;
  3156. bool setReadOnly (const bool shouldBeReadOnly,
  3157. const bool applyRecursively = false) const;
  3158. bool isHidden() const;
  3159. const File getLinkedTarget() const;
  3160. const Time getLastModificationTime() const;
  3161. const Time getLastAccessTime() const;
  3162. const Time getCreationTime() const;
  3163. bool setLastModificationTime (const Time& newTime) const;
  3164. bool setLastAccessTime (const Time& newTime) const;
  3165. bool setCreationTime (const Time& newTime) const;
  3166. const String getVersion() const;
  3167. bool create() const;
  3168. bool createDirectory() const;
  3169. bool deleteFile() const;
  3170. bool deleteRecursively() const;
  3171. bool moveToTrash() const;
  3172. bool moveFileTo (const File& targetLocation) const;
  3173. bool copyFileTo (const File& targetLocation) const;
  3174. bool copyDirectoryTo (const File& newDirectory) const;
  3175. enum TypesOfFileToFind
  3176. {
  3177. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3178. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3179. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3180. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3181. };
  3182. int findChildFiles (Array<File>& results,
  3183. const int whatToLookFor,
  3184. const bool searchRecursively,
  3185. const String& wildCardPattern = JUCE_T("*")) const;
  3186. int getNumberOfChildFiles (const int whatToLookFor,
  3187. const String& wildCardPattern = JUCE_T("*")) const;
  3188. bool containsSubDirectories() const;
  3189. FileInputStream* createInputStream() const;
  3190. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3191. bool loadFileAsData (MemoryBlock& result) const;
  3192. const String loadFileAsString() const;
  3193. bool appendData (const void* const dataToAppend,
  3194. const int numberOfBytes) const;
  3195. bool replaceWithData (const void* const dataToWrite,
  3196. const int numberOfBytes) const;
  3197. bool appendText (const String& textToAppend,
  3198. const bool asUnicode = false,
  3199. const bool writeUnicodeHeaderBytes = false) const;
  3200. bool replaceWithText (const String& textToWrite,
  3201. const bool asUnicode = false,
  3202. const bool writeUnicodeHeaderBytes = false) const;
  3203. static void findFileSystemRoots (Array<File>& results);
  3204. const String getVolumeLabel() const;
  3205. int getVolumeSerialNumber() const;
  3206. int64 getBytesFreeOnVolume() const;
  3207. int64 getVolumeTotalSize() const;
  3208. bool isOnCDRomDrive() const;
  3209. bool isOnHardDisk() const;
  3210. bool isOnRemovableDrive() const;
  3211. bool startAsProcess (const String& parameters = String::empty) const;
  3212. void revealToUser() const;
  3213. enum SpecialLocationType
  3214. {
  3215. userHomeDirectory,
  3216. userDocumentsDirectory,
  3217. userDesktopDirectory,
  3218. userApplicationDataDirectory,
  3219. commonApplicationDataDirectory,
  3220. tempDirectory,
  3221. currentExecutableFile,
  3222. currentApplicationFile,
  3223. invokedExecutableFile,
  3224. globalApplicationsDirectory,
  3225. userMusicDirectory,
  3226. userMoviesDirectory,
  3227. };
  3228. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3229. static const File createTempFile (const String& fileNameEnding);
  3230. static const File getCurrentWorkingDirectory();
  3231. bool setAsCurrentWorkingDirectory() const;
  3232. static const tchar separator;
  3233. static const tchar* separatorString;
  3234. static const String createLegalFileName (const String& fileNameToFix);
  3235. static const String createLegalPathName (const String& pathNameToFix);
  3236. static bool areFileNamesCaseSensitive();
  3237. static bool isAbsolutePath (const String& path);
  3238. static const File createFileWithoutCheckingPath (const String& path);
  3239. juce_UseDebuggingNewOperator
  3240. private:
  3241. String fullPath;
  3242. // internal way of contructing a file without checking the path
  3243. friend class DirectoryIterator;
  3244. File (const String&, int);
  3245. const String getPathUpToLastSlash() const;
  3246. };
  3247. #endif // __JUCE_FILE_JUCEHEADER__
  3248. /********* End of inlined file: juce_File.h *********/
  3249. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3250. \
  3251. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3252. childElementVariableName != 0; \
  3253. childElementVariableName = childElementVariableName->getNextElement())
  3254. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3255. \
  3256. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3257. childElementVariableName != 0; \
  3258. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3259. class JUCE_API XmlElement
  3260. {
  3261. public:
  3262. XmlElement (const String& tagName) throw();
  3263. XmlElement (const XmlElement& other) throw();
  3264. const XmlElement& operator= (const XmlElement& other) throw();
  3265. ~XmlElement() throw();
  3266. bool isEquivalentTo (const XmlElement* const other,
  3267. const bool ignoreOrderOfAttributes) const throw();
  3268. const String createDocument (const String& dtdToUse,
  3269. const bool allOnOneLine = false,
  3270. const bool includeXmlHeader = true,
  3271. const String& encodingType = JUCE_T("UTF-8"),
  3272. const int lineWrapLength = 60) const throw();
  3273. void writeToStream (OutputStream& output,
  3274. const String& dtdToUse,
  3275. const bool allOnOneLine = false,
  3276. const bool includeXmlHeader = true,
  3277. const String& encodingType = JUCE_T("UTF-8"),
  3278. const int lineWrapLength = 60) const throw();
  3279. bool writeToFile (const File& destinationFile,
  3280. const String& dtdToUse,
  3281. const String& encodingType = JUCE_T("UTF-8"),
  3282. const int lineWrapLength = 60) const throw();
  3283. inline const String& getTagName() const throw() { return tagName; }
  3284. bool hasTagName (const String& possibleTagName) const throw();
  3285. int getNumAttributes() const throw();
  3286. const String& getAttributeName (const int attributeIndex) const throw();
  3287. const String& getAttributeValue (const int attributeIndex) const throw();
  3288. // Attribute-handling methods..
  3289. bool hasAttribute (const String& attributeName) const throw();
  3290. const String getStringAttribute (const String& attributeName,
  3291. const String& defaultReturnValue = String::empty) const throw();
  3292. bool compareAttribute (const String& attributeName,
  3293. const String& stringToCompareAgainst,
  3294. const bool ignoreCase = false) const throw();
  3295. int getIntAttribute (const String& attributeName,
  3296. const int defaultReturnValue = 0) const throw();
  3297. double getDoubleAttribute (const String& attributeName,
  3298. const double defaultReturnValue = 0.0) const throw();
  3299. bool getBoolAttribute (const String& attributeName,
  3300. const bool defaultReturnValue = false) const throw();
  3301. void setAttribute (const String& attributeName,
  3302. const String& newValue) throw();
  3303. void setAttribute (const String& attributeName,
  3304. const int newValue) throw();
  3305. void setAttribute (const String& attributeName,
  3306. const double newValue) throw();
  3307. void removeAttribute (const String& attributeName) throw();
  3308. void removeAllAttributes() throw();
  3309. // Child element methods..
  3310. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3311. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3312. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3313. int getNumChildElements() const throw();
  3314. XmlElement* getChildElement (const int index) const throw();
  3315. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3316. void addChildElement (XmlElement* const newChildElement) throw();
  3317. void insertChildElement (XmlElement* const newChildNode,
  3318. int indexToInsertAt) throw();
  3319. bool replaceChildElement (XmlElement* const currentChildElement,
  3320. XmlElement* const newChildNode) throw();
  3321. void removeChildElement (XmlElement* const childToRemove,
  3322. const bool shouldDeleteTheChild) throw();
  3323. void deleteAllChildElements() throw();
  3324. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3325. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3326. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3327. template <class ElementComparator>
  3328. void sortChildElements (ElementComparator& comparator,
  3329. const bool retainOrderOfEquivalentItems = false) throw()
  3330. {
  3331. const int num = getNumChildElements();
  3332. if (num > 1)
  3333. {
  3334. HeapBlock <XmlElement*> elems (num);
  3335. getChildElementsAsArray (elems);
  3336. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3337. reorderChildElements (elems, num);
  3338. }
  3339. }
  3340. bool isTextElement() const throw();
  3341. const String getText() const throw();
  3342. void setText (const String& newText) throw();
  3343. const String getAllSubText() const throw();
  3344. const String getChildElementAllSubText (const String& childTagName,
  3345. const String& defaultReturnValue) const throw();
  3346. void addTextElement (const String& text) throw();
  3347. void deleteAllTextElements() throw();
  3348. static XmlElement* createTextElement (const String& text) throw();
  3349. juce_UseDebuggingNewOperator
  3350. private:
  3351. friend class XmlDocument;
  3352. String tagName;
  3353. XmlElement* firstChildElement;
  3354. XmlElement* nextElement;
  3355. struct XmlAttributeNode
  3356. {
  3357. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3358. XmlAttributeNode (const String& name, const String& value) throw();
  3359. String name, value;
  3360. XmlAttributeNode* next;
  3361. private:
  3362. const XmlAttributeNode& operator= (const XmlAttributeNode&);
  3363. };
  3364. XmlAttributeNode* attributes;
  3365. XmlElement (int) throw(); // for internal use
  3366. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3367. void writeElementAsText (OutputStream& out,
  3368. const int indentationLevel,
  3369. const int lineWrapLength) const throw();
  3370. void getChildElementsAsArray (XmlElement**) const throw();
  3371. void reorderChildElements (XmlElement** const, const int) throw();
  3372. };
  3373. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3374. /********* End of inlined file: juce_XmlElement.h *********/
  3375. class JUCE_API PropertySet
  3376. {
  3377. public:
  3378. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3379. PropertySet (const PropertySet& other) throw();
  3380. const PropertySet& operator= (const PropertySet& other) throw();
  3381. virtual ~PropertySet();
  3382. const String getValue (const String& keyName,
  3383. const String& defaultReturnValue = String::empty) const throw();
  3384. int getIntValue (const String& keyName,
  3385. const int defaultReturnValue = 0) const throw();
  3386. double getDoubleValue (const String& keyName,
  3387. const double defaultReturnValue = 0.0) const throw();
  3388. bool getBoolValue (const String& keyName,
  3389. const bool defaultReturnValue = false) const throw();
  3390. XmlElement* getXmlValue (const String& keyName) const;
  3391. void setValue (const String& keyName, const String& value) throw();
  3392. void setValue (const String& keyName, const tchar* const value) throw();
  3393. void setValue (const String& keyName, const int value) throw();
  3394. void setValue (const String& keyName, const double value) throw();
  3395. void setValue (const String& keyName, const bool value) throw();
  3396. void setValue (const String& keyName, const XmlElement* const xml);
  3397. void removeValue (const String& keyName) throw();
  3398. bool containsKey (const String& keyName) const throw();
  3399. void clear();
  3400. StringPairArray& getAllProperties() throw() { return properties; }
  3401. const CriticalSection& getLock() const throw() { return lock; }
  3402. XmlElement* createXml (const String& nodeName) const throw();
  3403. void restoreFromXml (const XmlElement& xml) throw();
  3404. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3405. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3406. juce_UseDebuggingNewOperator
  3407. protected:
  3408. virtual void propertyChanged();
  3409. private:
  3410. StringPairArray properties;
  3411. PropertySet* fallbackProperties;
  3412. CriticalSection lock;
  3413. bool ignoreCaseOfKeys;
  3414. };
  3415. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3416. /********* End of inlined file: juce_PropertySet.h *********/
  3417. #endif
  3418. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3419. /********* Start of inlined file: juce_ReferenceCountedArray.h *********/
  3420. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3421. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3422. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3423. class ReferenceCountedArray
  3424. {
  3425. public:
  3426. ReferenceCountedArray() throw()
  3427. : numUsed (0)
  3428. {
  3429. }
  3430. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3431. {
  3432. other.lockArray();
  3433. numUsed = other.numUsed;
  3434. data.setAllocatedSize (numUsed);
  3435. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3436. for (int i = numUsed; --i >= 0;)
  3437. if (data.elements[i] != 0)
  3438. data.elements[i]->incReferenceCount();
  3439. other.unlockArray();
  3440. }
  3441. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3442. {
  3443. if (this != &other)
  3444. {
  3445. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3446. swapWithArray (other);
  3447. }
  3448. return *this;
  3449. }
  3450. ~ReferenceCountedArray()
  3451. {
  3452. clear();
  3453. }
  3454. void clear()
  3455. {
  3456. lock.enter();
  3457. while (numUsed > 0)
  3458. if (data.elements [--numUsed] != 0)
  3459. data.elements [numUsed]->decReferenceCount();
  3460. jassert (numUsed == 0);
  3461. data.setAllocatedSize (0);
  3462. lock.exit();
  3463. }
  3464. inline int size() const throw()
  3465. {
  3466. return numUsed;
  3467. }
  3468. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3469. {
  3470. lock.enter();
  3471. const ReferenceCountedObjectPtr<ObjectClass> result ((((unsigned int) index) < (unsigned int) numUsed)
  3472. ? data.elements [index]
  3473. : (ObjectClass*) 0);
  3474. lock.exit();
  3475. return result;
  3476. }
  3477. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3478. {
  3479. lock.enter();
  3480. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3481. const ReferenceCountedObjectPtr<ObjectClass> result (data.elements [index]);
  3482. lock.exit();
  3483. return result;
  3484. }
  3485. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3486. {
  3487. lock.enter();
  3488. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [0]
  3489. : (ObjectClass*) 0);
  3490. lock.exit();
  3491. return result;
  3492. }
  3493. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3494. {
  3495. lock.enter();
  3496. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [numUsed - 1]
  3497. : (ObjectClass*) 0);
  3498. lock.exit();
  3499. return result;
  3500. }
  3501. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3502. {
  3503. int result = -1;
  3504. lock.enter();
  3505. ObjectClass** e = data.elements;
  3506. for (int i = numUsed; --i >= 0;)
  3507. {
  3508. if (objectToLookFor == *e)
  3509. {
  3510. result = (int) (e - data.elements);
  3511. break;
  3512. }
  3513. ++e;
  3514. }
  3515. lock.exit();
  3516. return result;
  3517. }
  3518. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3519. {
  3520. lock.enter();
  3521. ObjectClass** e = data.elements;
  3522. for (int i = numUsed; --i >= 0;)
  3523. {
  3524. if (objectToLookFor == *e)
  3525. {
  3526. lock.exit();
  3527. return true;
  3528. }
  3529. ++e;
  3530. }
  3531. lock.exit();
  3532. return false;
  3533. }
  3534. void add (ObjectClass* const newObject) throw()
  3535. {
  3536. lock.enter();
  3537. data.ensureAllocatedSize (numUsed + 1);
  3538. data.elements [numUsed++] = newObject;
  3539. if (newObject != 0)
  3540. newObject->incReferenceCount();
  3541. lock.exit();
  3542. }
  3543. void insert (int indexToInsertAt,
  3544. ObjectClass* const newObject) throw()
  3545. {
  3546. if (indexToInsertAt >= 0)
  3547. {
  3548. lock.enter();
  3549. if (indexToInsertAt > numUsed)
  3550. indexToInsertAt = numUsed;
  3551. data.ensureAllocatedSize (numUsed + 1);
  3552. ObjectClass** const e = data.elements + indexToInsertAt;
  3553. const int numToMove = numUsed - indexToInsertAt;
  3554. if (numToMove > 0)
  3555. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3556. *e = newObject;
  3557. if (newObject != 0)
  3558. newObject->incReferenceCount();
  3559. ++numUsed;
  3560. lock.exit();
  3561. }
  3562. else
  3563. {
  3564. add (newObject);
  3565. }
  3566. }
  3567. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3568. {
  3569. lock.enter();
  3570. if (! contains (newObject))
  3571. add (newObject);
  3572. lock.exit();
  3573. }
  3574. void set (const int indexToChange,
  3575. ObjectClass* const newObject)
  3576. {
  3577. if (indexToChange >= 0)
  3578. {
  3579. lock.enter();
  3580. if (newObject != 0)
  3581. newObject->incReferenceCount();
  3582. if (indexToChange < numUsed)
  3583. {
  3584. if (data.elements [indexToChange] != 0)
  3585. data.elements [indexToChange]->decReferenceCount();
  3586. data.elements [indexToChange] = newObject;
  3587. }
  3588. else
  3589. {
  3590. data.ensureAllocatedSize (numUsed + 1);
  3591. data.elements [numUsed++] = newObject;
  3592. }
  3593. lock.exit();
  3594. }
  3595. }
  3596. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3597. int startIndex = 0,
  3598. int numElementsToAdd = -1) throw()
  3599. {
  3600. arrayToAddFrom.lockArray();
  3601. lock.enter();
  3602. if (startIndex < 0)
  3603. {
  3604. jassertfalse
  3605. startIndex = 0;
  3606. }
  3607. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3608. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3609. if (numElementsToAdd > 0)
  3610. {
  3611. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3612. while (--numElementsToAdd >= 0)
  3613. add (arrayToAddFrom.getUnchecked (startIndex++));
  3614. }
  3615. lock.exit();
  3616. arrayToAddFrom.unlockArray();
  3617. }
  3618. template <class ElementComparator>
  3619. void addSorted (ElementComparator& comparator,
  3620. ObjectClass* newObject) throw()
  3621. {
  3622. lock.enter();
  3623. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  3624. lock.exit();
  3625. }
  3626. template <class ElementComparator>
  3627. void addOrReplaceSorted (ElementComparator& comparator,
  3628. ObjectClass* newObject) throw()
  3629. {
  3630. lock.enter();
  3631. const int index = findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed);
  3632. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3633. set (index - 1, newObject); // replace an existing object that matches
  3634. else
  3635. insert (index, newObject); // no match, so insert the new one
  3636. lock.exit();
  3637. }
  3638. void remove (const int indexToRemove)
  3639. {
  3640. lock.enter();
  3641. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3642. {
  3643. ObjectClass** const e = data.elements + indexToRemove;
  3644. if (*e != 0)
  3645. (*e)->decReferenceCount();
  3646. --numUsed;
  3647. const int numberToShift = numUsed - indexToRemove;
  3648. if (numberToShift > 0)
  3649. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3650. if ((numUsed << 1) < data.numAllocated)
  3651. minimiseStorageOverheads();
  3652. }
  3653. lock.exit();
  3654. }
  3655. void removeObject (ObjectClass* const objectToRemove)
  3656. {
  3657. lock.enter();
  3658. remove (indexOf (objectToRemove));
  3659. lock.exit();
  3660. }
  3661. void removeRange (const int startIndex,
  3662. const int numberToRemove)
  3663. {
  3664. lock.enter();
  3665. const int start = jlimit (0, numUsed, startIndex);
  3666. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3667. if (end > start)
  3668. {
  3669. int i;
  3670. for (i = start; i < end; ++i)
  3671. {
  3672. if (data.elements[i] != 0)
  3673. {
  3674. data.elements[i]->decReferenceCount();
  3675. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3676. }
  3677. }
  3678. const int rangeSize = end - start;
  3679. ObjectClass** e = data.elements + start;
  3680. i = numUsed - end;
  3681. numUsed -= rangeSize;
  3682. while (--i >= 0)
  3683. {
  3684. *e = e [rangeSize];
  3685. ++e;
  3686. }
  3687. if ((numUsed << 1) < data.numAllocated)
  3688. minimiseStorageOverheads();
  3689. }
  3690. lock.exit();
  3691. }
  3692. void removeLast (int howManyToRemove = 1)
  3693. {
  3694. lock.enter();
  3695. if (howManyToRemove > numUsed)
  3696. howManyToRemove = numUsed;
  3697. while (--howManyToRemove >= 0)
  3698. remove (numUsed - 1);
  3699. lock.exit();
  3700. }
  3701. void swap (const int index1,
  3702. const int index2) throw()
  3703. {
  3704. lock.enter();
  3705. if (((unsigned int) index1) < (unsigned int) numUsed
  3706. && ((unsigned int) index2) < (unsigned int) numUsed)
  3707. {
  3708. swapVariables (data.elements [index1],
  3709. data.elements [index2]);
  3710. }
  3711. lock.exit();
  3712. }
  3713. void move (const int currentIndex,
  3714. int newIndex) throw()
  3715. {
  3716. if (currentIndex != newIndex)
  3717. {
  3718. lock.enter();
  3719. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3720. {
  3721. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3722. newIndex = numUsed - 1;
  3723. ObjectClass* const value = data.elements [currentIndex];
  3724. if (newIndex > currentIndex)
  3725. {
  3726. memmove (data.elements + currentIndex,
  3727. data.elements + currentIndex + 1,
  3728. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3729. }
  3730. else
  3731. {
  3732. memmove (data.elements + newIndex + 1,
  3733. data.elements + newIndex,
  3734. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3735. }
  3736. data.elements [newIndex] = value;
  3737. }
  3738. lock.exit();
  3739. }
  3740. }
  3741. void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
  3742. {
  3743. lock.enter();
  3744. otherArray.lock.enter();
  3745. data.swapWith (otherArray.data);
  3746. swapVariables (numUsed, otherArray.numUsed);
  3747. otherArray.lock.exit();
  3748. lock.exit();
  3749. }
  3750. bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3751. {
  3752. other.lockArray();
  3753. lock.enter();
  3754. bool result = numUsed == other.numUsed;
  3755. if (result)
  3756. {
  3757. for (int i = numUsed; --i >= 0;)
  3758. {
  3759. if (data.elements [i] != other.data.elements [i])
  3760. {
  3761. result = false;
  3762. break;
  3763. }
  3764. }
  3765. }
  3766. lock.exit();
  3767. other.unlockArray();
  3768. return result;
  3769. }
  3770. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3771. {
  3772. return ! operator== (other);
  3773. }
  3774. template <class ElementComparator>
  3775. void sort (ElementComparator& comparator,
  3776. const bool retainOrderOfEquivalentItems = false) const throw()
  3777. {
  3778. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3779. // avoids getting warning messages about the parameter being unused
  3780. lock.enter();
  3781. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  3782. lock.exit();
  3783. }
  3784. void minimiseStorageOverheads() throw()
  3785. {
  3786. lock.enter();
  3787. data.shrinkToNoMoreThan (numUsed);
  3788. lock.exit();
  3789. }
  3790. void lockArray() const throw()
  3791. {
  3792. lock.enter();
  3793. }
  3794. void unlockArray() const throw()
  3795. {
  3796. lock.exit();
  3797. }
  3798. juce_UseDebuggingNewOperator
  3799. private:
  3800. ArrayAllocationBase <ObjectClass*> data;
  3801. int numUsed;
  3802. TypeOfCriticalSectionToUse lock;
  3803. };
  3804. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3805. /********* End of inlined file: juce_ReferenceCountedArray.h *********/
  3806. #endif
  3807. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3808. #endif
  3809. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3810. #endif
  3811. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3812. /********* Start of inlined file: juce_SortedSet.h *********/
  3813. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3814. #define __JUCE_SORTEDSET_JUCEHEADER__
  3815. #if JUCE_MSVC
  3816. #pragma warning (push)
  3817. #pragma warning (disable: 4512)
  3818. #endif
  3819. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3820. class SortedSet
  3821. {
  3822. public:
  3823. SortedSet() throw()
  3824. : numUsed (0)
  3825. {
  3826. }
  3827. SortedSet (const SortedSet<ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3828. {
  3829. other.lockSet();
  3830. numUsed = other.numUsed;
  3831. data.setAllocatedSize (other.numUsed);
  3832. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3833. other.unlockSet();
  3834. }
  3835. ~SortedSet() throw()
  3836. {
  3837. }
  3838. SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3839. {
  3840. if (this != &other)
  3841. {
  3842. other.lockSet();
  3843. lock.enter();
  3844. data.ensureAllocatedSize (other.size());
  3845. numUsed = other.numUsed;
  3846. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3847. minimiseStorageOverheads();
  3848. lock.exit();
  3849. other.unlockSet();
  3850. }
  3851. return *this;
  3852. }
  3853. bool operator== (const SortedSet<ElementType>& other) const throw()
  3854. {
  3855. lock.enter();
  3856. if (numUsed != other.numUsed)
  3857. {
  3858. lock.exit();
  3859. return false;
  3860. }
  3861. for (int i = numUsed; --i >= 0;)
  3862. {
  3863. if (data.elements [i] != other.data.elements [i])
  3864. {
  3865. lock.exit();
  3866. return false;
  3867. }
  3868. }
  3869. lock.exit();
  3870. return true;
  3871. }
  3872. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3873. {
  3874. return ! operator== (other);
  3875. }
  3876. void clear() throw()
  3877. {
  3878. lock.enter();
  3879. data.setAllocatedSize (0);
  3880. numUsed = 0;
  3881. lock.exit();
  3882. }
  3883. void clearQuick() throw()
  3884. {
  3885. lock.enter();
  3886. numUsed = 0;
  3887. lock.exit();
  3888. }
  3889. inline int size() const throw()
  3890. {
  3891. return numUsed;
  3892. }
  3893. inline ElementType operator[] (const int index) const throw()
  3894. {
  3895. lock.enter();
  3896. const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
  3897. ? data.elements [index]
  3898. : (ElementType) 0;
  3899. lock.exit();
  3900. return result;
  3901. }
  3902. inline ElementType getUnchecked (const int index) const throw()
  3903. {
  3904. lock.enter();
  3905. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3906. const ElementType result = data.elements [index];
  3907. lock.exit();
  3908. return result;
  3909. }
  3910. inline ElementType getFirst() const throw()
  3911. {
  3912. lock.enter();
  3913. const ElementType result = (numUsed > 0) ? data.elements [0]
  3914. : (ElementType) 0;
  3915. lock.exit();
  3916. return result;
  3917. }
  3918. inline ElementType getLast() const throw()
  3919. {
  3920. lock.enter();
  3921. const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
  3922. : (ElementType) 0;
  3923. lock.exit();
  3924. return result;
  3925. }
  3926. int indexOf (const ElementType elementToLookFor) const throw()
  3927. {
  3928. lock.enter();
  3929. int start = 0;
  3930. int end = numUsed;
  3931. for (;;)
  3932. {
  3933. if (start >= end)
  3934. {
  3935. lock.exit();
  3936. return -1;
  3937. }
  3938. else if (elementToLookFor == data.elements [start])
  3939. {
  3940. lock.exit();
  3941. return start;
  3942. }
  3943. else
  3944. {
  3945. const int halfway = (start + end) >> 1;
  3946. if (halfway == start)
  3947. {
  3948. lock.exit();
  3949. return -1;
  3950. }
  3951. else if (elementToLookFor >= data.elements [halfway])
  3952. start = halfway;
  3953. else
  3954. end = halfway;
  3955. }
  3956. }
  3957. }
  3958. bool contains (const ElementType elementToLookFor) const throw()
  3959. {
  3960. lock.enter();
  3961. int start = 0;
  3962. int end = numUsed;
  3963. for (;;)
  3964. {
  3965. if (start >= end)
  3966. {
  3967. lock.exit();
  3968. return false;
  3969. }
  3970. else if (elementToLookFor == data.elements [start])
  3971. {
  3972. lock.exit();
  3973. return true;
  3974. }
  3975. else
  3976. {
  3977. const int halfway = (start + end) >> 1;
  3978. if (halfway == start)
  3979. {
  3980. lock.exit();
  3981. return false;
  3982. }
  3983. else if (elementToLookFor >= data.elements [halfway])
  3984. start = halfway;
  3985. else
  3986. end = halfway;
  3987. }
  3988. }
  3989. }
  3990. void add (const ElementType newElement) throw()
  3991. {
  3992. lock.enter();
  3993. int start = 0;
  3994. int end = numUsed;
  3995. for (;;)
  3996. {
  3997. if (start >= end)
  3998. {
  3999. jassert (start <= end);
  4000. insertInternal (start, newElement);
  4001. break;
  4002. }
  4003. else if (newElement == data.elements [start])
  4004. {
  4005. break;
  4006. }
  4007. else
  4008. {
  4009. const int halfway = (start + end) >> 1;
  4010. if (halfway == start)
  4011. {
  4012. if (newElement >= data.elements [halfway])
  4013. insertInternal (start + 1, newElement);
  4014. else
  4015. insertInternal (start, newElement);
  4016. break;
  4017. }
  4018. else if (newElement >= data.elements [halfway])
  4019. start = halfway;
  4020. else
  4021. end = halfway;
  4022. }
  4023. }
  4024. lock.exit();
  4025. }
  4026. void addArray (const ElementType* elementsToAdd,
  4027. int numElementsToAdd) throw()
  4028. {
  4029. lock.enter();
  4030. while (--numElementsToAdd >= 0)
  4031. add (*elementsToAdd++);
  4032. lock.exit();
  4033. }
  4034. template <class OtherSetType>
  4035. void addSet (const OtherSetType& setToAddFrom,
  4036. int startIndex = 0,
  4037. int numElementsToAdd = -1) throw()
  4038. {
  4039. setToAddFrom.lockSet();
  4040. lock.enter();
  4041. jassert (this != &setToAddFrom);
  4042. if (this != &setToAddFrom)
  4043. {
  4044. if (startIndex < 0)
  4045. {
  4046. jassertfalse
  4047. startIndex = 0;
  4048. }
  4049. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4050. numElementsToAdd = setToAddFrom.size() - startIndex;
  4051. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4052. }
  4053. lock.exit();
  4054. setToAddFrom.unlockSet();
  4055. }
  4056. ElementType remove (const int indexToRemove) throw()
  4057. {
  4058. lock.enter();
  4059. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4060. {
  4061. --numUsed;
  4062. ElementType* const e = data.elements + indexToRemove;
  4063. ElementType const removed = *e;
  4064. const int numberToShift = numUsed - indexToRemove;
  4065. if (numberToShift > 0)
  4066. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4067. if ((numUsed << 1) < data.numAllocated)
  4068. minimiseStorageOverheads();
  4069. lock.exit();
  4070. return removed;
  4071. }
  4072. else
  4073. {
  4074. lock.exit();
  4075. return 0;
  4076. }
  4077. }
  4078. void removeValue (const ElementType valueToRemove) throw()
  4079. {
  4080. lock.enter();
  4081. remove (indexOf (valueToRemove));
  4082. lock.exit();
  4083. }
  4084. template <class OtherSetType>
  4085. void removeValuesIn (const OtherSetType& otherSet) throw()
  4086. {
  4087. otherSet.lockSet();
  4088. lock.enter();
  4089. if (this == &otherSet)
  4090. {
  4091. clear();
  4092. }
  4093. else
  4094. {
  4095. if (otherSet.size() > 0)
  4096. {
  4097. for (int i = numUsed; --i >= 0;)
  4098. if (otherSet.contains (data.elements [i]))
  4099. remove (i);
  4100. }
  4101. }
  4102. lock.exit();
  4103. otherSet.unlockSet();
  4104. }
  4105. template <class OtherSetType>
  4106. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4107. {
  4108. otherSet.lockSet();
  4109. lock.enter();
  4110. if (this != &otherSet)
  4111. {
  4112. if (otherSet.size() <= 0)
  4113. {
  4114. clear();
  4115. }
  4116. else
  4117. {
  4118. for (int i = numUsed; --i >= 0;)
  4119. if (! otherSet.contains (data.elements [i]))
  4120. remove (i);
  4121. }
  4122. }
  4123. lock.exit();
  4124. otherSet.lockSet();
  4125. }
  4126. void minimiseStorageOverheads() throw()
  4127. {
  4128. lock.enter();
  4129. data.shrinkToNoMoreThan (numUsed);
  4130. lock.exit();
  4131. }
  4132. void lockSet() const throw()
  4133. {
  4134. lock.enter();
  4135. }
  4136. void unlockSet() const throw()
  4137. {
  4138. lock.exit();
  4139. }
  4140. juce_UseDebuggingNewOperator
  4141. private:
  4142. ArrayAllocationBase <ElementType> data;
  4143. int numUsed;
  4144. TypeOfCriticalSectionToUse lock;
  4145. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4146. {
  4147. data.ensureAllocatedSize (numUsed + 1);
  4148. ElementType* const insertPos = data.elements + indexToInsertAt;
  4149. const int numberToMove = numUsed - indexToInsertAt;
  4150. if (numberToMove > 0)
  4151. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4152. *insertPos = newElement;
  4153. ++numUsed;
  4154. }
  4155. };
  4156. #if JUCE_MSVC
  4157. #pragma warning (pop)
  4158. #endif
  4159. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4160. /********* End of inlined file: juce_SortedSet.h *********/
  4161. #endif
  4162. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4163. /********* Start of inlined file: juce_SparseSet.h *********/
  4164. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4165. #define __JUCE_SPARSESET_JUCEHEADER__
  4166. template <class Type>
  4167. class SparseSet
  4168. {
  4169. public:
  4170. SparseSet() throw()
  4171. {
  4172. }
  4173. SparseSet (const SparseSet<Type>& other) throw()
  4174. : values (other.values)
  4175. {
  4176. }
  4177. ~SparseSet() throw()
  4178. {
  4179. }
  4180. void clear() throw()
  4181. {
  4182. values.clear();
  4183. }
  4184. bool isEmpty() const throw()
  4185. {
  4186. return values.size() == 0;
  4187. }
  4188. Type size() const throw()
  4189. {
  4190. Type num = 0;
  4191. for (int i = 0; i < values.size(); i += 2)
  4192. num += values[i + 1] - values[i];
  4193. return num;
  4194. }
  4195. Type operator[] (int index) const throw()
  4196. {
  4197. for (int i = 0; i < values.size(); i += 2)
  4198. {
  4199. const Type s = values.getUnchecked(i);
  4200. const Type e = values.getUnchecked(i + 1);
  4201. if (index < e - s)
  4202. return s + index;
  4203. index -= e - s;
  4204. }
  4205. return (Type) 0;
  4206. }
  4207. bool contains (const Type valueToLookFor) const throw()
  4208. {
  4209. bool on = false;
  4210. for (int i = 0; i < values.size(); ++i)
  4211. {
  4212. if (values.getUnchecked(i) > valueToLookFor)
  4213. return on;
  4214. on = ! on;
  4215. }
  4216. return false;
  4217. }
  4218. int getNumRanges() const throw()
  4219. {
  4220. return values.size() >> 1;
  4221. }
  4222. bool getRange (const int rangeIndex,
  4223. Type& startValue,
  4224. Type& numValues) const throw()
  4225. {
  4226. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4227. {
  4228. startValue = values [rangeIndex << 1];
  4229. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4230. return true;
  4231. }
  4232. return false;
  4233. }
  4234. bool getTotalRange (Type& lowestValue,
  4235. Type& highestValue) const throw()
  4236. {
  4237. if (values.size() > 0)
  4238. {
  4239. lowestValue = values.getUnchecked (0);
  4240. highestValue = values.getUnchecked (values.size() - 1);
  4241. return true;
  4242. }
  4243. return false;
  4244. }
  4245. void addRange (const Type firstValue,
  4246. const Type numValuesToAdd) throw()
  4247. {
  4248. jassert (numValuesToAdd >= 0);
  4249. if (numValuesToAdd > 0)
  4250. {
  4251. removeRange (firstValue, numValuesToAdd);
  4252. IntegerElementComparator<Type> sorter;
  4253. values.addSorted (sorter, firstValue);
  4254. values.addSorted (sorter, firstValue + numValuesToAdd);
  4255. simplify();
  4256. }
  4257. }
  4258. void removeRange (const Type firstValue,
  4259. const Type numValuesToRemove) throw()
  4260. {
  4261. jassert (numValuesToRemove >= 0);
  4262. if (numValuesToRemove >= 0
  4263. && firstValue < values.getLast())
  4264. {
  4265. const bool onAtStart = contains (firstValue - 1);
  4266. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4267. const bool onAtEnd = contains (lastValue);
  4268. for (int i = values.size(); --i >= 0;)
  4269. {
  4270. if (values.getUnchecked(i) <= lastValue)
  4271. {
  4272. while (values.getUnchecked(i) >= firstValue)
  4273. {
  4274. values.remove (i);
  4275. if (--i < 0)
  4276. break;
  4277. }
  4278. break;
  4279. }
  4280. }
  4281. IntegerElementComparator<Type> sorter;
  4282. if (onAtStart)
  4283. values.addSorted (sorter, firstValue);
  4284. if (onAtEnd)
  4285. values.addSorted (sorter, lastValue);
  4286. simplify();
  4287. }
  4288. }
  4289. void invertRange (const Type firstValue,
  4290. const Type numValues)
  4291. {
  4292. SparseSet newItems;
  4293. newItems.addRange (firstValue, numValues);
  4294. int i;
  4295. for (i = getNumRanges(); --i >= 0;)
  4296. {
  4297. const int start = values [i << 1];
  4298. const int end = values [(i << 1) + 1];
  4299. newItems.removeRange (start, end);
  4300. }
  4301. removeRange (firstValue, numValues);
  4302. for (i = newItems.getNumRanges(); --i >= 0;)
  4303. {
  4304. const int start = newItems.values [i << 1];
  4305. const int end = newItems.values [(i << 1) + 1];
  4306. addRange (start, end);
  4307. }
  4308. }
  4309. bool overlapsRange (const Type firstValue,
  4310. const Type numValues) throw()
  4311. {
  4312. jassert (numValues >= 0);
  4313. if (numValues > 0)
  4314. {
  4315. for (int i = getNumRanges(); --i >= 0;)
  4316. {
  4317. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4318. return false;
  4319. if (firstValue + numValues > values.getUnchecked (i << 1))
  4320. return true;
  4321. }
  4322. }
  4323. return false;
  4324. }
  4325. bool containsRange (const Type firstValue,
  4326. const Type numValues) throw()
  4327. {
  4328. jassert (numValues >= 0);
  4329. if (numValues > 0)
  4330. {
  4331. for (int i = getNumRanges(); --i >= 0;)
  4332. {
  4333. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4334. return false;
  4335. if (firstValue >= values.getUnchecked (i << 1)
  4336. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4337. return true;
  4338. }
  4339. }
  4340. return false;
  4341. }
  4342. bool operator== (const SparseSet<Type>& other) throw()
  4343. {
  4344. return values == other.values;
  4345. }
  4346. bool operator!= (const SparseSet<Type>& other) throw()
  4347. {
  4348. return values != other.values;
  4349. }
  4350. juce_UseDebuggingNewOperator
  4351. private:
  4352. // alternating start/end values of ranges of values that are present.
  4353. Array<Type> values;
  4354. void simplify() throw()
  4355. {
  4356. jassert ((values.size() & 1) == 0);
  4357. for (int i = values.size(); --i > 0;)
  4358. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4359. values.removeRange (i - 1, 2);
  4360. }
  4361. };
  4362. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4363. /********* End of inlined file: juce_SparseSet.h *********/
  4364. #endif
  4365. #ifndef __JUCE_VALUE_JUCEHEADER__
  4366. /********* Start of inlined file: juce_Value.h *********/
  4367. #ifndef __JUCE_VALUE_JUCEHEADER__
  4368. #define __JUCE_VALUE_JUCEHEADER__
  4369. /********* Start of inlined file: juce_AsyncUpdater.h *********/
  4370. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4371. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4372. /********* Start of inlined file: juce_MessageListener.h *********/
  4373. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4374. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4375. /********* Start of inlined file: juce_Message.h *********/
  4376. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4377. #define __JUCE_MESSAGE_JUCEHEADER__
  4378. class MessageListener;
  4379. class MessageManager;
  4380. class JUCE_API Message
  4381. {
  4382. public:
  4383. Message() throw();
  4384. Message (const int intParameter1,
  4385. const int intParameter2,
  4386. const int intParameter3,
  4387. void* const pointerParameter) throw();
  4388. virtual ~Message() throw();
  4389. // These values can be used for carrying simple data that the application needs to
  4390. // pass around. For more complex messages, just create a subclass.
  4391. int intParameter1; /**< user-defined integer value. */
  4392. int intParameter2; /**< user-defined integer value. */
  4393. int intParameter3; /**< user-defined integer value. */
  4394. void* pointerParameter; /**< user-defined pointer value. */
  4395. juce_UseDebuggingNewOperator
  4396. private:
  4397. friend class MessageListener;
  4398. friend class MessageManager;
  4399. MessageListener* messageRecipient;
  4400. Message (const Message&);
  4401. const Message& operator= (const Message&);
  4402. };
  4403. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4404. /********* End of inlined file: juce_Message.h *********/
  4405. class JUCE_API MessageListener
  4406. {
  4407. protected:
  4408. MessageListener() throw();
  4409. public:
  4410. virtual ~MessageListener();
  4411. virtual void handleMessage (const Message& message) = 0;
  4412. void postMessage (Message* const message) const throw();
  4413. bool isValidMessageListener() const throw();
  4414. };
  4415. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4416. /********* End of inlined file: juce_MessageListener.h *********/
  4417. class JUCE_API AsyncUpdater
  4418. {
  4419. public:
  4420. AsyncUpdater() throw();
  4421. virtual ~AsyncUpdater();
  4422. void triggerAsyncUpdate() throw();
  4423. void cancelPendingUpdate() throw();
  4424. void handleUpdateNowIfNeeded();
  4425. virtual void handleAsyncUpdate() = 0;
  4426. private:
  4427. class AsyncUpdaterInternal : public MessageListener
  4428. {
  4429. public:
  4430. AsyncUpdaterInternal() throw() {}
  4431. ~AsyncUpdaterInternal() {}
  4432. void handleMessage (const Message&);
  4433. AsyncUpdater* owner;
  4434. private:
  4435. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4436. const AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4437. };
  4438. AsyncUpdaterInternal internalAsyncHandler;
  4439. bool asyncMessagePending;
  4440. };
  4441. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4442. /********* End of inlined file: juce_AsyncUpdater.h *********/
  4443. class JUCE_API Value
  4444. {
  4445. public:
  4446. Value();
  4447. Value (const Value& other);
  4448. Value (const var& initialValue);
  4449. ~Value();
  4450. const var getValue() const;
  4451. operator const var() const;
  4452. const String toString() const;
  4453. void setValue (const var& newValue);
  4454. const Value& operator= (const var& newValue);
  4455. void referTo (const Value& valueToReferTo);
  4456. bool refersToSameSourceAs (const Value& other) const;
  4457. bool operator== (const Value& other) const;
  4458. bool operator!= (const Value& other) const;
  4459. class JUCE_API Listener
  4460. {
  4461. public:
  4462. Listener() {}
  4463. virtual ~Listener() {}
  4464. virtual void valueChanged (Value& value) = 0;
  4465. };
  4466. void addListener (Listener* const listener);
  4467. void removeListener (Listener* const listener);
  4468. class JUCE_API ValueSource : public ReferenceCountedObject,
  4469. public AsyncUpdater
  4470. {
  4471. public:
  4472. ValueSource();
  4473. virtual ~ValueSource();
  4474. virtual const var getValue() const = 0;
  4475. virtual void setValue (const var& newValue) = 0;
  4476. void sendChangeMessage (const bool dispatchSynchronously);
  4477. juce_UseDebuggingNewOperator
  4478. protected:
  4479. friend class Value;
  4480. SortedSet <Value*> valuesWithListeners;
  4481. void handleAsyncUpdate();
  4482. ValueSource (const ValueSource&);
  4483. const ValueSource& operator= (const ValueSource&);
  4484. };
  4485. explicit Value (ValueSource* const valueSource);
  4486. ValueSource& getValueSource() { return *value; }
  4487. juce_UseDebuggingNewOperator
  4488. private:
  4489. friend class ValueSource;
  4490. ReferenceCountedObjectPtr <ValueSource> value;
  4491. SortedSet <Listener*> listeners;
  4492. void callListeners();
  4493. // This is disallowed to avoid confusion about whether it should
  4494. // do a by-value or by-reference copy.
  4495. const Value& operator= (const Value& other);
  4496. };
  4497. #endif // __JUCE_VALUE_JUCEHEADER__
  4498. /********* End of inlined file: juce_Value.h *********/
  4499. #endif
  4500. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4501. /********* Start of inlined file: juce_ValueTree.h *********/
  4502. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4503. #define __JUCE_VALUETREE_JUCEHEADER__
  4504. /********* Start of inlined file: juce_UndoManager.h *********/
  4505. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4506. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4507. /********* Start of inlined file: juce_ChangeBroadcaster.h *********/
  4508. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4509. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4510. /********* Start of inlined file: juce_ChangeListenerList.h *********/
  4511. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4512. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4513. /********* Start of inlined file: juce_ChangeListener.h *********/
  4514. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4515. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4516. class JUCE_API ChangeListener
  4517. {
  4518. public:
  4519. virtual ~ChangeListener() {}
  4520. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4521. };
  4522. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4523. /********* End of inlined file: juce_ChangeListener.h *********/
  4524. /********* Start of inlined file: juce_ScopedLock.h *********/
  4525. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4526. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4527. class JUCE_API ScopedLock
  4528. {
  4529. public:
  4530. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4531. inline ~ScopedLock() throw() { lock_.exit(); }
  4532. private:
  4533. const CriticalSection& lock_;
  4534. ScopedLock (const ScopedLock&);
  4535. const ScopedLock& operator= (const ScopedLock&);
  4536. };
  4537. class ScopedUnlock
  4538. {
  4539. public:
  4540. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4541. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4542. private:
  4543. const CriticalSection& lock_;
  4544. ScopedUnlock (const ScopedLock&);
  4545. const ScopedUnlock& operator= (const ScopedUnlock&);
  4546. };
  4547. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4548. /********* End of inlined file: juce_ScopedLock.h *********/
  4549. class JUCE_API ChangeListenerList : public MessageListener
  4550. {
  4551. public:
  4552. ChangeListenerList() throw();
  4553. ~ChangeListenerList() throw();
  4554. void addChangeListener (ChangeListener* const listener) throw();
  4555. void removeChangeListener (ChangeListener* const listener) throw();
  4556. void removeAllChangeListeners() throw();
  4557. void sendChangeMessage (void* objectThatHasChanged) throw();
  4558. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4559. void dispatchPendingMessages();
  4560. void handleMessage (const Message&);
  4561. juce_UseDebuggingNewOperator
  4562. private:
  4563. SortedSet <void*> listeners;
  4564. CriticalSection lock;
  4565. void* lastChangedObject;
  4566. bool messagePending;
  4567. ChangeListenerList (const ChangeListenerList&);
  4568. const ChangeListenerList& operator= (const ChangeListenerList&);
  4569. };
  4570. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4571. /********* End of inlined file: juce_ChangeListenerList.h *********/
  4572. class JUCE_API ChangeBroadcaster
  4573. {
  4574. public:
  4575. ChangeBroadcaster() throw();
  4576. virtual ~ChangeBroadcaster();
  4577. void addChangeListener (ChangeListener* const listener) throw();
  4578. void removeChangeListener (ChangeListener* const listener) throw();
  4579. void removeAllChangeListeners() throw();
  4580. void sendChangeMessage (void* objectThatHasChanged) throw();
  4581. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4582. void dispatchPendingMessages();
  4583. private:
  4584. ChangeListenerList changeListenerList;
  4585. ChangeBroadcaster (const ChangeBroadcaster&);
  4586. const ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4587. };
  4588. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4589. /********* End of inlined file: juce_ChangeBroadcaster.h *********/
  4590. /********* Start of inlined file: juce_UndoableAction.h *********/
  4591. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4592. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4593. class JUCE_API UndoableAction
  4594. {
  4595. protected:
  4596. UndoableAction() throw() {}
  4597. public:
  4598. virtual ~UndoableAction() {}
  4599. virtual bool perform() = 0;
  4600. virtual bool undo() = 0;
  4601. virtual int getSizeInUnits() { return 10; }
  4602. };
  4603. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4604. /********* End of inlined file: juce_UndoableAction.h *********/
  4605. class JUCE_API UndoManager : public ChangeBroadcaster
  4606. {
  4607. public:
  4608. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4609. const int minimumTransactionsToKeep = 30);
  4610. ~UndoManager();
  4611. void clearUndoHistory();
  4612. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4613. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4614. const int minimumTransactionsToKeep);
  4615. bool perform (UndoableAction* const action,
  4616. const String& actionName = String::empty);
  4617. void beginNewTransaction (const String& actionName = String::empty);
  4618. void setCurrentTransactionName (const String& newName);
  4619. bool canUndo() const;
  4620. const String getUndoDescription() const;
  4621. bool undo();
  4622. bool undoCurrentTransactionOnly();
  4623. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4624. int getNumActionsInCurrentTransaction() const;
  4625. bool canRedo() const;
  4626. const String getRedoDescription() const;
  4627. bool redo();
  4628. juce_UseDebuggingNewOperator
  4629. private:
  4630. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4631. StringArray transactionNames;
  4632. String currentTransactionName;
  4633. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4634. bool newTransaction, reentrancyCheck;
  4635. // disallow copy constructor
  4636. UndoManager (const UndoManager&);
  4637. const UndoManager& operator= (const UndoManager&);
  4638. };
  4639. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4640. /********* End of inlined file: juce_UndoManager.h *********/
  4641. class JUCE_API ValueTree
  4642. {
  4643. public:
  4644. ValueTree (const String& type);
  4645. ValueTree (const ValueTree& other);
  4646. const ValueTree& operator= (const ValueTree& other);
  4647. ~ValueTree();
  4648. bool operator== (const ValueTree& other) const;
  4649. bool operator!= (const ValueTree& other) const;
  4650. bool isValid() const { return object != 0; }
  4651. ValueTree createCopy() const;
  4652. const String getType() const;
  4653. bool hasType (const String& typeName) const;
  4654. const var& getProperty (const var::identifier& name) const;
  4655. const var& operator[] (const var::identifier& name) const;
  4656. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4657. bool hasProperty (const var::identifier& name) const;
  4658. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4659. void removeAllProperties (UndoManager* const undoManager);
  4660. int getNumProperties() const;
  4661. const var::identifier getPropertyName (int index) const;
  4662. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4663. int getNumChildren() const;
  4664. ValueTree getChild (int index) const;
  4665. ValueTree getChildWithName (const String& type) const;
  4666. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4667. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4668. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4669. void removeChild (const int childIndex, UndoManager* const undoManager);
  4670. void removeAllChildren (UndoManager* const undoManager);
  4671. bool isAChildOf (const ValueTree& possibleParent) const;
  4672. ValueTree getParent() const;
  4673. XmlElement* createXml() const;
  4674. static ValueTree fromXml (const XmlElement& xml);
  4675. void writeToStream (OutputStream& output);
  4676. static ValueTree readFromStream (InputStream& input);
  4677. class JUCE_API Listener
  4678. {
  4679. public:
  4680. virtual ~Listener() {}
  4681. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4682. const var::identifier& property) = 0;
  4683. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4684. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4685. };
  4686. void addListener (Listener* listener);
  4687. void removeListener (Listener* listener);
  4688. template <typename ElementComparator>
  4689. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4690. {
  4691. if (object != 0)
  4692. {
  4693. ComparatorAdapter <ElementComparator> adapter (comparator);
  4694. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4695. object->sendChildChangeMessage();
  4696. }
  4697. }
  4698. juce_UseDebuggingNewOperator
  4699. private:
  4700. friend class ValueTreeSetPropertyAction;
  4701. friend class ValueTreeChildChangeAction;
  4702. class JUCE_API SharedObject : public ReferenceCountedObject
  4703. {
  4704. public:
  4705. SharedObject (const String& type);
  4706. SharedObject (const SharedObject& other);
  4707. ~SharedObject();
  4708. const String type;
  4709. NamedValueSet properties;
  4710. ReferenceCountedArray <SharedObject> children;
  4711. SortedSet <ValueTree*> valueTreesWithListeners;
  4712. SharedObject* parent;
  4713. void sendPropertyChangeMessage (const var::identifier& property);
  4714. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4715. void sendChildChangeMessage();
  4716. void sendChildChangeMessage (ValueTree& tree);
  4717. void sendParentChangeMessage();
  4718. const var& getProperty (const var::identifier& name) const;
  4719. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4720. bool hasProperty (const var::identifier& name) const;
  4721. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4722. void removeAllProperties (UndoManager* const undoManager);
  4723. bool isAChildOf (const SharedObject* const possibleParent) const;
  4724. ValueTree getChildWithName (const String& type) const;
  4725. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4726. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4727. void removeChild (const int childIndex, UndoManager* const undoManager);
  4728. void removeAllChildren (UndoManager* const undoManager);
  4729. XmlElement* createXml() const;
  4730. juce_UseDebuggingNewOperator
  4731. private:
  4732. const SharedObject& operator= (const SharedObject&);
  4733. };
  4734. template <typename ElementComparator>
  4735. class ComparatorAdapter
  4736. {
  4737. public:
  4738. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4739. int compareElements (SharedObject* const first, SharedObject* const second)
  4740. {
  4741. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4742. }
  4743. private:
  4744. ElementComparator& comparator;
  4745. };
  4746. friend class SharedObject;
  4747. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4748. ReferenceCountedObjectPtr <SharedObject> object;
  4749. SortedSet <Listener*> listeners;
  4750. void deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4751. void deliverChildChangeMessage (ValueTree& tree);
  4752. void deliverParentChangeMessage (ValueTree& tree);
  4753. ValueTree (SharedObject* const object_);
  4754. };
  4755. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4756. /********* End of inlined file: juce_ValueTree.h *********/
  4757. #endif
  4758. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4759. #endif
  4760. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4761. /********* Start of inlined file: juce_VoidArray.h *********/
  4762. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4763. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4764. typedef Array <void*> VoidArray;
  4765. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4766. /********* End of inlined file: juce_VoidArray.h *********/
  4767. #endif
  4768. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4769. #endif
  4770. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4771. #endif
  4772. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4773. /********* Start of inlined file: juce_FileLogger.h *********/
  4774. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4775. #define __JUCE_FILELOGGER_JUCEHEADER__
  4776. class JUCE_API FileLogger : public Logger
  4777. {
  4778. public:
  4779. FileLogger (const File& fileToWriteTo,
  4780. const String& welcomeMessage,
  4781. const int maxInitialFileSizeBytes = 128 * 1024);
  4782. ~FileLogger();
  4783. void logMessage (const String& message);
  4784. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4785. const String& logFileName,
  4786. const String& welcomeMessage,
  4787. const int maxInitialFileSizeBytes = 128 * 1024);
  4788. juce_UseDebuggingNewOperator
  4789. private:
  4790. File logFile;
  4791. CriticalSection logLock;
  4792. ScopedPointer <FileOutputStream> logStream;
  4793. void trimFileSize (int maxFileSizeBytes) const;
  4794. FileLogger (const FileLogger&);
  4795. const FileLogger& operator= (const FileLogger&);
  4796. };
  4797. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4798. /********* End of inlined file: juce_FileLogger.h *********/
  4799. #endif
  4800. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4801. /********* Start of inlined file: juce_Initialisation.h *********/
  4802. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4803. #define __JUCE_INITIALISATION_JUCEHEADER__
  4804. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4805. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4806. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4807. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4808. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4809. /********* End of inlined file: juce_Initialisation.h *********/
  4810. #endif
  4811. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4812. #endif
  4813. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4814. #endif
  4815. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4816. #endif
  4817. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4818. /********* Start of inlined file: juce_PerformanceCounter.h *********/
  4819. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4820. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4821. class JUCE_API PerformanceCounter
  4822. {
  4823. public:
  4824. PerformanceCounter (const String& counterName,
  4825. int runsPerPrintout = 100,
  4826. const File& loggingFile = File::nonexistent);
  4827. ~PerformanceCounter();
  4828. void start();
  4829. void stop();
  4830. void printStatistics();
  4831. juce_UseDebuggingNewOperator
  4832. private:
  4833. String name;
  4834. int numRuns, runsPerPrint;
  4835. double totalTime;
  4836. int64 started;
  4837. File outputFile;
  4838. };
  4839. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4840. /********* End of inlined file: juce_PerformanceCounter.h *********/
  4841. #endif
  4842. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4843. #endif
  4844. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4845. /********* Start of inlined file: juce_PlatformUtilities.h *********/
  4846. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4847. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4848. class JUCE_API PlatformUtilities
  4849. {
  4850. public:
  4851. static void beep();
  4852. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4853. const String& emailSubject,
  4854. const String& bodyText,
  4855. const StringArray& filesToAttach);
  4856. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4857. static const String cfStringToJuceString (CFStringRef cfString);
  4858. static CFStringRef juceStringToCFString (const String& s);
  4859. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4860. static const String makePathFromFSRef (FSRef* file);
  4861. static const String convertToPrecomposedUnicode (const String& s);
  4862. static OSType getTypeOfFile (const String& filename);
  4863. static bool isBundle (const String& filename);
  4864. static void addItemToDock (const File& file);
  4865. static int getOSXMinorVersionNumber();
  4866. #endif
  4867. #if JUCE_WINDOWS || DOXYGEN
  4868. // Some registry helper functions:
  4869. static const String getRegistryValue (const String& regValuePath,
  4870. const String& defaultValue = String::empty);
  4871. static void setRegistryValue (const String& regValuePath,
  4872. const String& value);
  4873. static bool registryValueExists (const String& regValuePath);
  4874. static void deleteRegistryValue (const String& regValuePath);
  4875. static void deleteRegistryKey (const String& regKeyPath);
  4876. static void registerFileAssociation (const String& fileExtension,
  4877. const String& symbolicDescription,
  4878. const String& fullDescription,
  4879. const File& targetExecutable,
  4880. int iconResourceNumber);
  4881. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  4882. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  4883. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  4884. #endif
  4885. static void fpuReset();
  4886. #if JUCE_LINUX || JUCE_WINDOWS
  4887. static void* loadDynamicLibrary (const String& pathOrFilename);
  4888. static void freeDynamicLibrary (void* libraryHandle);
  4889. static void* getProcedureEntryPoint (void* libraryHandle,
  4890. const String& procedureName);
  4891. #endif
  4892. #if JUCE_LINUX || DOXYGEN
  4893. #endif
  4894. };
  4895. #if JUCE_MAC || JUCE_IPHONE
  4896. class ScopedAutoReleasePool
  4897. {
  4898. public:
  4899. ScopedAutoReleasePool();
  4900. ~ScopedAutoReleasePool();
  4901. private:
  4902. void* pool;
  4903. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  4904. const ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  4905. };
  4906. #endif
  4907. #if JUCE_LINUX
  4908. class ScopedXLock
  4909. {
  4910. public:
  4911. ScopedXLock();
  4912. ~ScopedXLock();
  4913. };
  4914. #endif
  4915. #if JUCE_MAC
  4916. class JUCE_API AppleRemoteDevice
  4917. {
  4918. public:
  4919. AppleRemoteDevice();
  4920. virtual ~AppleRemoteDevice();
  4921. enum ButtonType
  4922. {
  4923. menuButton = 0, /**< The menu button (if it's held for a short time). */
  4924. playButton, /**< The play button. */
  4925. plusButton, /**< The plus or volume-up button. */
  4926. minusButton, /**< The minus or volume-down button. */
  4927. rightButton, /**< The right button (if it's held for a short time). */
  4928. leftButton, /**< The left button (if it's held for a short time). */
  4929. rightButton_Long, /**< The right button (if it's held for a long time). */
  4930. leftButton_Long, /**< The menu button (if it's held for a long time). */
  4931. menuButton_Long, /**< The menu button (if it's held for a long time). */
  4932. playButtonSleepMode,
  4933. switched
  4934. };
  4935. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  4936. bool start (const bool inExclusiveMode);
  4937. void stop();
  4938. bool isActive() const;
  4939. int getRemoteId() const { return remoteId; }
  4940. juce_UseDebuggingNewOperator
  4941. void handleCallbackInternal();
  4942. private:
  4943. void* device;
  4944. void* queue;
  4945. int remoteId;
  4946. bool open (const bool openInExclusiveMode);
  4947. AppleRemoteDevice (const AppleRemoteDevice&);
  4948. const AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  4949. };
  4950. #endif
  4951. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4952. /********* End of inlined file: juce_PlatformUtilities.h *********/
  4953. #endif
  4954. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4955. /********* Start of inlined file: juce_Random.h *********/
  4956. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4957. #define __JUCE_RANDOM_JUCEHEADER__
  4958. class JUCE_API Random
  4959. {
  4960. public:
  4961. Random (const int64 seedValue) throw();
  4962. ~Random() throw();
  4963. int nextInt() throw();
  4964. int nextInt (const int maxValue) throw();
  4965. int64 nextInt64() throw();
  4966. float nextFloat() throw();
  4967. double nextDouble() throw();
  4968. bool nextBool() throw();
  4969. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  4970. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  4971. static Random& getSystemRandom() throw();
  4972. void setSeed (const int64 newSeed) throw();
  4973. void setSeedRandomly();
  4974. juce_UseDebuggingNewOperator
  4975. private:
  4976. int64 seed;
  4977. };
  4978. #endif // __JUCE_RANDOM_JUCEHEADER__
  4979. /********* End of inlined file: juce_Random.h *********/
  4980. #endif
  4981. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  4982. #endif
  4983. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  4984. /********* Start of inlined file: juce_Singleton.h *********/
  4985. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  4986. #define __JUCE_SINGLETON_JUCEHEADER__
  4987. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  4988. \
  4989. static classname* _singletonInstance; \
  4990. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  4991. \
  4992. static classname* getInstance() \
  4993. { \
  4994. if (_singletonInstance == 0) \
  4995. {\
  4996. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  4997. \
  4998. if (_singletonInstance == 0) \
  4999. { \
  5000. static bool alreadyInside = false; \
  5001. static bool createdOnceAlready = false; \
  5002. \
  5003. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5004. jassert (! problem); \
  5005. if (! problem) \
  5006. { \
  5007. createdOnceAlready = true; \
  5008. alreadyInside = true; \
  5009. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5010. alreadyInside = false; \
  5011. \
  5012. _singletonInstance = newObject; \
  5013. } \
  5014. } \
  5015. } \
  5016. \
  5017. return _singletonInstance; \
  5018. } \
  5019. \
  5020. static inline classname* getInstanceWithoutCreating() throw() \
  5021. { \
  5022. return _singletonInstance; \
  5023. } \
  5024. \
  5025. static void deleteInstance() \
  5026. { \
  5027. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5028. if (_singletonInstance != 0) \
  5029. { \
  5030. classname* const old = _singletonInstance; \
  5031. _singletonInstance = 0; \
  5032. delete old; \
  5033. } \
  5034. } \
  5035. \
  5036. void clearSingletonInstance() throw() \
  5037. { \
  5038. if (_singletonInstance == this) \
  5039. _singletonInstance = 0; \
  5040. }
  5041. #define juce_ImplementSingleton(classname) \
  5042. \
  5043. classname* classname::_singletonInstance = 0; \
  5044. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5045. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5046. \
  5047. static classname* _singletonInstance; \
  5048. \
  5049. static classname* getInstance() \
  5050. { \
  5051. if (_singletonInstance == 0) \
  5052. { \
  5053. static bool alreadyInside = false; \
  5054. static bool createdOnceAlready = false; \
  5055. \
  5056. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5057. jassert (! problem); \
  5058. if (! problem) \
  5059. { \
  5060. createdOnceAlready = true; \
  5061. alreadyInside = true; \
  5062. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5063. alreadyInside = false; \
  5064. \
  5065. _singletonInstance = newObject; \
  5066. } \
  5067. } \
  5068. \
  5069. return _singletonInstance; \
  5070. } \
  5071. \
  5072. static inline classname* getInstanceWithoutCreating() throw() \
  5073. { \
  5074. return _singletonInstance; \
  5075. } \
  5076. \
  5077. static void deleteInstance() \
  5078. { \
  5079. if (_singletonInstance != 0) \
  5080. { \
  5081. classname* const old = _singletonInstance; \
  5082. _singletonInstance = 0; \
  5083. delete old; \
  5084. } \
  5085. } \
  5086. \
  5087. void clearSingletonInstance() throw() \
  5088. { \
  5089. if (_singletonInstance == this) \
  5090. _singletonInstance = 0; \
  5091. }
  5092. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5093. \
  5094. static classname* _singletonInstance; \
  5095. \
  5096. static classname* getInstance() \
  5097. { \
  5098. if (_singletonInstance == 0) \
  5099. _singletonInstance = new classname(); \
  5100. \
  5101. return _singletonInstance; \
  5102. } \
  5103. \
  5104. static inline classname* getInstanceWithoutCreating() throw() \
  5105. { \
  5106. return _singletonInstance; \
  5107. } \
  5108. \
  5109. static void deleteInstance() \
  5110. { \
  5111. if (_singletonInstance != 0) \
  5112. { \
  5113. classname* const old = _singletonInstance; \
  5114. _singletonInstance = 0; \
  5115. delete old; \
  5116. } \
  5117. } \
  5118. \
  5119. void clearSingletonInstance() throw() \
  5120. { \
  5121. if (_singletonInstance == this) \
  5122. _singletonInstance = 0; \
  5123. }
  5124. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5125. \
  5126. classname* classname::_singletonInstance = 0;
  5127. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5128. /********* End of inlined file: juce_Singleton.h *********/
  5129. #endif
  5130. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5131. #endif
  5132. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5133. /********* Start of inlined file: juce_SystemStats.h *********/
  5134. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5135. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5136. class JUCE_API SystemStats
  5137. {
  5138. public:
  5139. static const String getJUCEVersion() throw();
  5140. enum OperatingSystemType
  5141. {
  5142. UnknownOS = 0,
  5143. MacOSX = 0x1000,
  5144. Linux = 0x2000,
  5145. Win95 = 0x4001,
  5146. Win98 = 0x4002,
  5147. WinNT351 = 0x4103,
  5148. WinNT40 = 0x4104,
  5149. Win2000 = 0x4105,
  5150. WinXP = 0x4106,
  5151. WinVista = 0x4107,
  5152. Windows7 = 0x4108,
  5153. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5154. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5155. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5156. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5157. };
  5158. static OperatingSystemType getOperatingSystemType() throw();
  5159. static const String getOperatingSystemName() throw();
  5160. static bool isOperatingSystem64Bit() throw();
  5161. static const String getLogonName();
  5162. static const String getFullUserName();
  5163. // CPU and memory information..
  5164. static int getCpuSpeedInMegaherz() throw();
  5165. static const String getCpuVendor() throw();
  5166. static bool hasMMX() throw();
  5167. static bool hasSSE() throw();
  5168. static bool hasSSE2() throw();
  5169. static bool has3DNow() throw();
  5170. static int getNumCpus() throw();
  5171. static int64 getClockCycleCounter() throw();
  5172. static int getMemorySizeInMegabytes() throw();
  5173. static int getPageSize() throw();
  5174. static int getMACAddresses (int64* addresses, int maxNum,
  5175. #if JUCE_MAC
  5176. const bool littleEndian = true) throw();
  5177. #else
  5178. const bool littleEndian = false) throw();
  5179. #endif
  5180. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5181. static void initialiseStats() throw();
  5182. };
  5183. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5184. /********* End of inlined file: juce_SystemStats.h *********/
  5185. #endif
  5186. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5187. #endif
  5188. #ifndef __JUCE_TIME_JUCEHEADER__
  5189. #endif
  5190. #ifndef __JUCE_UUID_JUCEHEADER__
  5191. /********* Start of inlined file: juce_Uuid.h *********/
  5192. #ifndef __JUCE_UUID_JUCEHEADER__
  5193. #define __JUCE_UUID_JUCEHEADER__
  5194. class JUCE_API Uuid
  5195. {
  5196. public:
  5197. Uuid();
  5198. ~Uuid() throw();
  5199. Uuid (const Uuid& other);
  5200. Uuid& operator= (const Uuid& other);
  5201. bool isNull() const throw();
  5202. bool operator== (const Uuid& other) const;
  5203. bool operator!= (const Uuid& other) const;
  5204. const String toString() const;
  5205. Uuid (const String& uuidString);
  5206. Uuid& operator= (const String& uuidString);
  5207. const uint8* getRawData() const throw() { return value.asBytes; }
  5208. Uuid (const uint8* const rawData);
  5209. Uuid& operator= (const uint8* const rawData);
  5210. juce_UseDebuggingNewOperator
  5211. private:
  5212. union
  5213. {
  5214. uint8 asBytes [16];
  5215. int asInt[4];
  5216. int64 asInt64[2];
  5217. } value;
  5218. };
  5219. #endif // __JUCE_UUID_JUCEHEADER__
  5220. /********* End of inlined file: juce_Uuid.h *********/
  5221. #endif
  5222. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5223. /********* Start of inlined file: juce_BlowFish.h *********/
  5224. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5225. #define __JUCE_BLOWFISH_JUCEHEADER__
  5226. class JUCE_API BlowFish
  5227. {
  5228. public:
  5229. BlowFish (const uint8* keyData, int keyBytes);
  5230. BlowFish (const BlowFish& other);
  5231. const BlowFish& operator= (const BlowFish& other);
  5232. ~BlowFish();
  5233. void encrypt (uint32& data1, uint32& data2) const;
  5234. void decrypt (uint32& data1, uint32& data2) const;
  5235. juce_UseDebuggingNewOperator
  5236. private:
  5237. uint32 p[18];
  5238. HeapBlock <uint32> s[4];
  5239. uint32 F (uint32 x) const;
  5240. };
  5241. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5242. /********* End of inlined file: juce_BlowFish.h *********/
  5243. #endif
  5244. #ifndef __JUCE_MD5_JUCEHEADER__
  5245. /********* Start of inlined file: juce_MD5.h *********/
  5246. #ifndef __JUCE_MD5_JUCEHEADER__
  5247. #define __JUCE_MD5_JUCEHEADER__
  5248. class JUCE_API MD5
  5249. {
  5250. public:
  5251. MD5();
  5252. MD5 (const MD5& other);
  5253. const MD5& operator= (const MD5& other);
  5254. MD5 (const MemoryBlock& data);
  5255. MD5 (const char* data, const size_t numBytes);
  5256. MD5 (const String& text);
  5257. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5258. MD5 (const File& file);
  5259. ~MD5();
  5260. const MemoryBlock getRawChecksumData() const;
  5261. const String toHexString() const;
  5262. bool operator== (const MD5& other) const;
  5263. bool operator!= (const MD5& other) const;
  5264. juce_UseDebuggingNewOperator
  5265. private:
  5266. uint8 result [16];
  5267. struct ProcessContext
  5268. {
  5269. uint8 buffer [64];
  5270. uint32 state [4];
  5271. uint32 count [2];
  5272. ProcessContext();
  5273. void processBlock (const uint8* const data, size_t dataSize);
  5274. void transform (const uint8* const buffer);
  5275. void finish (uint8* const result);
  5276. };
  5277. void processStream (InputStream& input, int64 numBytesToRead);
  5278. };
  5279. #endif // __JUCE_MD5_JUCEHEADER__
  5280. /********* End of inlined file: juce_MD5.h *********/
  5281. #endif
  5282. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5283. /********* Start of inlined file: juce_Primes.h *********/
  5284. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5285. #define __JUCE_PRIMES_JUCEHEADER__
  5286. class JUCE_API Primes
  5287. {
  5288. public:
  5289. static const BitArray createProbablePrime (int bitLength,
  5290. int certainty,
  5291. const int* randomSeeds = 0,
  5292. int numRandomSeeds = 0) throw();
  5293. static bool isProbablyPrime (const BitArray& number,
  5294. int certainty) throw();
  5295. };
  5296. #endif // __JUCE_PRIMES_JUCEHEADER__
  5297. /********* End of inlined file: juce_Primes.h *********/
  5298. #endif
  5299. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5300. /********* Start of inlined file: juce_RSAKey.h *********/
  5301. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5302. #define __JUCE_RSAKEY_JUCEHEADER__
  5303. class JUCE_API RSAKey
  5304. {
  5305. public:
  5306. RSAKey() throw();
  5307. RSAKey (const String& stringRepresentation) throw();
  5308. ~RSAKey() throw();
  5309. const String toString() const throw();
  5310. bool applyToValue (BitArray& value) const throw();
  5311. static void createKeyPair (RSAKey& publicKey,
  5312. RSAKey& privateKey,
  5313. const int numBits,
  5314. const int* randomSeeds = 0,
  5315. const int numRandomSeeds = 0) throw();
  5316. juce_UseDebuggingNewOperator
  5317. protected:
  5318. BitArray part1, part2;
  5319. };
  5320. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5321. /********* End of inlined file: juce_RSAKey.h *********/
  5322. #endif
  5323. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5324. /********* Start of inlined file: juce_DirectoryIterator.h *********/
  5325. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5326. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5327. class JUCE_API DirectoryIterator
  5328. {
  5329. public:
  5330. DirectoryIterator (const File& directory,
  5331. bool isRecursive,
  5332. const String& wildCard = JUCE_T("*"),
  5333. const int whatToLookFor = File::findFiles);
  5334. ~DirectoryIterator();
  5335. bool next();
  5336. const File getFile() const;
  5337. float getEstimatedProgress() const;
  5338. juce_UseDebuggingNewOperator
  5339. private:
  5340. Array <File> filesFound;
  5341. Array <File> dirsFound;
  5342. String wildCard;
  5343. int index;
  5344. const int whatToLookFor;
  5345. ScopedPointer <DirectoryIterator> subIterator;
  5346. DirectoryIterator (const DirectoryIterator&);
  5347. const DirectoryIterator& operator= (const DirectoryIterator&);
  5348. };
  5349. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5350. /********* End of inlined file: juce_DirectoryIterator.h *********/
  5351. #endif
  5352. #ifndef __JUCE_FILE_JUCEHEADER__
  5353. #endif
  5354. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5355. /********* Start of inlined file: juce_FileInputStream.h *********/
  5356. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5357. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5358. class JUCE_API FileInputStream : public InputStream
  5359. {
  5360. public:
  5361. FileInputStream (const File& fileToRead);
  5362. ~FileInputStream();
  5363. const File& getFile() const throw() { return file; }
  5364. int64 getTotalLength();
  5365. int read (void* destBuffer, int maxBytesToRead);
  5366. bool isExhausted();
  5367. int64 getPosition();
  5368. bool setPosition (int64 pos);
  5369. juce_UseDebuggingNewOperator
  5370. private:
  5371. File file;
  5372. void* fileHandle;
  5373. int64 currentPosition, totalSize;
  5374. bool needToSeek;
  5375. FileInputStream (const FileInputStream&);
  5376. const FileInputStream& operator= (const FileInputStream&);
  5377. };
  5378. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5379. /********* End of inlined file: juce_FileInputStream.h *********/
  5380. #endif
  5381. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5382. /********* Start of inlined file: juce_FileOutputStream.h *********/
  5383. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5384. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5385. class JUCE_API FileOutputStream : public OutputStream
  5386. {
  5387. public:
  5388. FileOutputStream (const File& fileToWriteTo,
  5389. const int bufferSizeToUse = 16384);
  5390. ~FileOutputStream();
  5391. const File& getFile() const { return file; }
  5392. bool failedToOpen() const { return fileHandle == 0; }
  5393. void flush();
  5394. int64 getPosition();
  5395. bool setPosition (int64 pos);
  5396. bool write (const void* data, int numBytes);
  5397. juce_UseDebuggingNewOperator
  5398. private:
  5399. File file;
  5400. void* fileHandle;
  5401. int64 currentPosition;
  5402. int bufferSize, bytesInBuffer;
  5403. HeapBlock <char> buffer;
  5404. };
  5405. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5406. /********* End of inlined file: juce_FileOutputStream.h *********/
  5407. #endif
  5408. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5409. /********* Start of inlined file: juce_FileSearchPath.h *********/
  5410. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5411. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5412. class JUCE_API FileSearchPath
  5413. {
  5414. public:
  5415. FileSearchPath();
  5416. FileSearchPath (const String& path);
  5417. FileSearchPath (const FileSearchPath& other);
  5418. ~FileSearchPath();
  5419. const FileSearchPath& operator= (const String& path);
  5420. int getNumPaths() const;
  5421. const File operator[] (const int index) const;
  5422. const String toString() const;
  5423. void add (const File& directoryToAdd,
  5424. const int insertIndex = -1);
  5425. void addIfNotAlreadyThere (const File& directoryToAdd);
  5426. void remove (const int indexToRemove);
  5427. void addPath (const FileSearchPath& other);
  5428. void removeRedundantPaths();
  5429. void removeNonExistentPaths();
  5430. int findChildFiles (Array<File>& results,
  5431. const int whatToLookFor,
  5432. const bool searchRecursively,
  5433. const String& wildCardPattern = JUCE_T("*")) const;
  5434. bool isFileInPath (const File& fileToCheck,
  5435. const bool checkRecursively) const;
  5436. juce_UseDebuggingNewOperator
  5437. private:
  5438. StringArray directories;
  5439. void init (const String& path);
  5440. };
  5441. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5442. /********* End of inlined file: juce_FileSearchPath.h *********/
  5443. #endif
  5444. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5445. /********* Start of inlined file: juce_NamedPipe.h *********/
  5446. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5447. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5448. class JUCE_API NamedPipe
  5449. {
  5450. public:
  5451. NamedPipe();
  5452. ~NamedPipe();
  5453. bool openExisting (const String& pipeName);
  5454. bool createNewPipe (const String& pipeName);
  5455. void close();
  5456. bool isOpen() const;
  5457. const String getName() const;
  5458. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5459. int write (const void* sourceBuffer, int numBytesToWrite,
  5460. int timeOutMilliseconds = 2000);
  5461. void cancelPendingReads();
  5462. juce_UseDebuggingNewOperator
  5463. private:
  5464. void* internal;
  5465. String currentPipeName;
  5466. NamedPipe (const NamedPipe&);
  5467. const NamedPipe& operator= (const NamedPipe&);
  5468. bool openInternal (const String& pipeName, const bool createPipe);
  5469. };
  5470. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5471. /********* End of inlined file: juce_NamedPipe.h *********/
  5472. #endif
  5473. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5474. /********* Start of inlined file: juce_TemporaryFile.h *********/
  5475. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5476. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5477. class JUCE_API TemporaryFile
  5478. {
  5479. public:
  5480. enum OptionFlags
  5481. {
  5482. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5483. i.e. its name should start with a dot. */
  5484. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5485. the file is unique, they should go in brackets rather
  5486. than just being appended (see File::getNonexistentSibling() )*/
  5487. };
  5488. TemporaryFile (const String& suffix = String::empty,
  5489. const int optionFlags = 0);
  5490. TemporaryFile (const File& targetFile,
  5491. const int optionFlags = 0);
  5492. ~TemporaryFile();
  5493. const File getFile() const { return temporaryFile; }
  5494. const File getTargetFile() const { return targetFile; }
  5495. bool overwriteTargetFileWithTemporary() const;
  5496. juce_UseDebuggingNewOperator
  5497. private:
  5498. File temporaryFile, targetFile;
  5499. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5500. TemporaryFile (const TemporaryFile&);
  5501. const TemporaryFile& operator= (const TemporaryFile&);
  5502. };
  5503. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5504. /********* End of inlined file: juce_TemporaryFile.h *********/
  5505. #endif
  5506. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5507. /********* Start of inlined file: juce_ZipFile.h *********/
  5508. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5509. #define __JUCE_ZIPFILE_JUCEHEADER__
  5510. /********* Start of inlined file: juce_InputSource.h *********/
  5511. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5512. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5513. class JUCE_API InputSource
  5514. {
  5515. public:
  5516. InputSource() throw() {}
  5517. virtual ~InputSource() {}
  5518. virtual InputStream* createInputStream() = 0;
  5519. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5520. virtual int64 hashCode() const = 0;
  5521. juce_UseDebuggingNewOperator
  5522. };
  5523. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5524. /********* End of inlined file: juce_InputSource.h *********/
  5525. class JUCE_API ZipFile
  5526. {
  5527. public:
  5528. ZipFile (InputStream* const inputStream,
  5529. const bool deleteStreamWhenDestroyed) throw();
  5530. ZipFile (const File& file);
  5531. ZipFile (InputSource* const inputSource);
  5532. ~ZipFile() throw();
  5533. struct ZipEntry
  5534. {
  5535. String filename;
  5536. unsigned int uncompressedSize;
  5537. Time fileTime;
  5538. };
  5539. int getNumEntries() const throw();
  5540. const ZipEntry* getEntry (const int index) const throw();
  5541. int getIndexOfFileName (const String& fileName) const throw();
  5542. const ZipEntry* getEntry (const String& fileName) const throw();
  5543. void sortEntriesByFilename();
  5544. InputStream* createStreamForEntry (const int index);
  5545. void uncompressTo (const File& targetDirectory,
  5546. const bool shouldOverwriteFiles = true);
  5547. juce_UseDebuggingNewOperator
  5548. private:
  5549. class ZipInputStream;
  5550. class ZipFilenameComparator;
  5551. class ZipEntryInfo;
  5552. OwnedArray <ZipEntryInfo> entries;
  5553. CriticalSection lock;
  5554. InputStream* inputStream;
  5555. ScopedPointer <InputStream> streamToDelete;
  5556. ScopedPointer <InputSource> inputSource;
  5557. #ifdef JUCE_DEBUG
  5558. int numOpenStreams;
  5559. #endif
  5560. void init();
  5561. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5562. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5563. ZipFile (const ZipFile&);
  5564. const ZipFile& operator= (const ZipFile&);
  5565. };
  5566. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5567. /********* End of inlined file: juce_ZipFile.h *********/
  5568. #endif
  5569. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5570. /********* Start of inlined file: juce_Socket.h *********/
  5571. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5572. #define __JUCE_SOCKET_JUCEHEADER__
  5573. class JUCE_API StreamingSocket
  5574. {
  5575. public:
  5576. StreamingSocket();
  5577. ~StreamingSocket();
  5578. bool bindToPort (const int localPortNumber);
  5579. bool connect (const String& remoteHostname,
  5580. const int remotePortNumber,
  5581. const int timeOutMillisecs = 3000);
  5582. bool isConnected() const throw() { return connected; }
  5583. void close();
  5584. const String& getHostName() const throw() { return hostName; }
  5585. int getPort() const throw() { return portNumber; }
  5586. bool isLocal() const throw();
  5587. int waitUntilReady (const bool readyForReading,
  5588. const int timeoutMsecs) const;
  5589. int read (void* destBuffer, const int maxBytesToRead,
  5590. const bool blockUntilSpecifiedAmountHasArrived);
  5591. int write (const void* sourceBuffer, const int numBytesToWrite);
  5592. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5593. StreamingSocket* waitForNextConnection() const;
  5594. juce_UseDebuggingNewOperator
  5595. private:
  5596. String hostName;
  5597. int volatile portNumber, handle;
  5598. bool connected, isListener;
  5599. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5600. StreamingSocket (const StreamingSocket&);
  5601. const StreamingSocket& operator= (const StreamingSocket&);
  5602. };
  5603. class JUCE_API DatagramSocket
  5604. {
  5605. public:
  5606. DatagramSocket (const int localPortNumber,
  5607. const bool enableBroadcasting = false);
  5608. ~DatagramSocket();
  5609. bool bindToPort (const int localPortNumber);
  5610. bool connect (const String& remoteHostname,
  5611. const int remotePortNumber,
  5612. const int timeOutMillisecs = 3000);
  5613. bool isConnected() const throw() { return connected; }
  5614. void close();
  5615. const String& getHostName() const throw() { return hostName; }
  5616. int getPort() const throw() { return portNumber; }
  5617. bool isLocal() const throw();
  5618. int waitUntilReady (const bool readyForReading,
  5619. const int timeoutMsecs) const;
  5620. int read (void* destBuffer, const int maxBytesToRead,
  5621. const bool blockUntilSpecifiedAmountHasArrived);
  5622. int write (const void* sourceBuffer, const int numBytesToWrite);
  5623. DatagramSocket* waitForNextConnection() const;
  5624. juce_UseDebuggingNewOperator
  5625. private:
  5626. String hostName;
  5627. int volatile portNumber, handle;
  5628. bool connected, allowBroadcast;
  5629. void* serverAddress;
  5630. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5631. DatagramSocket (const DatagramSocket&);
  5632. const DatagramSocket& operator= (const DatagramSocket&);
  5633. };
  5634. #endif // __JUCE_SOCKET_JUCEHEADER__
  5635. /********* End of inlined file: juce_Socket.h *********/
  5636. #endif
  5637. #ifndef __JUCE_URL_JUCEHEADER__
  5638. /********* Start of inlined file: juce_URL.h *********/
  5639. #ifndef __JUCE_URL_JUCEHEADER__
  5640. #define __JUCE_URL_JUCEHEADER__
  5641. class JUCE_API URL
  5642. {
  5643. public:
  5644. URL();
  5645. URL (const String& url);
  5646. URL (const URL& other);
  5647. ~URL();
  5648. const URL& operator= (const URL& other);
  5649. const String toString (const bool includeGetParameters) const;
  5650. bool isWellFormed() const;
  5651. const String getDomain() const;
  5652. const String getSubPath() const;
  5653. const String getScheme() const;
  5654. const URL withNewSubPath (const String& newPath) const;
  5655. const URL withParameter (const String& parameterName,
  5656. const String& parameterValue) const;
  5657. const URL withFileToUpload (const String& parameterName,
  5658. const File& fileToUpload,
  5659. const String& mimeType) const;
  5660. const StringPairArray& getParameters() const;
  5661. const StringPairArray& getFilesToUpload() const;
  5662. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5663. const URL withPOSTData (const String& postData) const;
  5664. const String getPostData() const { return postData; }
  5665. bool launchInDefaultBrowser() const;
  5666. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5667. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5668. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5669. InputStream* createInputStream (const bool usePostCommand,
  5670. OpenStreamProgressCallback* const progressCallback = 0,
  5671. void* const progressCallbackContext = 0,
  5672. const String& extraHeaders = String::empty,
  5673. const int connectionTimeOutMs = 0) const;
  5674. bool readEntireBinaryStream (MemoryBlock& destData,
  5675. const bool usePostCommand = false) const;
  5676. const String readEntireTextStream (const bool usePostCommand = false) const;
  5677. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5678. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5679. const bool isParameter);
  5680. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5681. juce_UseDebuggingNewOperator
  5682. private:
  5683. String url, postData;
  5684. StringPairArray parameters, filesToUpload, mimeTypes;
  5685. };
  5686. #endif // __JUCE_URL_JUCEHEADER__
  5687. /********* End of inlined file: juce_URL.h *********/
  5688. #endif
  5689. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5690. /********* Start of inlined file: juce_BufferedInputStream.h *********/
  5691. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5692. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5693. class JUCE_API BufferedInputStream : public InputStream
  5694. {
  5695. public:
  5696. BufferedInputStream (InputStream* const sourceStream,
  5697. const int bufferSize,
  5698. const bool deleteSourceWhenDestroyed);
  5699. ~BufferedInputStream();
  5700. int64 getTotalLength();
  5701. int64 getPosition();
  5702. bool setPosition (int64 newPosition);
  5703. int read (void* destBuffer, int maxBytesToRead);
  5704. const String readString();
  5705. bool isExhausted();
  5706. juce_UseDebuggingNewOperator
  5707. private:
  5708. InputStream* const source;
  5709. ScopedPointer <InputStream> sourceToDelete;
  5710. int bufferSize;
  5711. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5712. HeapBlock <char> buffer;
  5713. void ensureBuffered();
  5714. BufferedInputStream (const BufferedInputStream&);
  5715. const BufferedInputStream& operator= (const BufferedInputStream&);
  5716. };
  5717. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5718. /********* End of inlined file: juce_BufferedInputStream.h *********/
  5719. #endif
  5720. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5721. /********* Start of inlined file: juce_FileInputSource.h *********/
  5722. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5723. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5724. class JUCE_API FileInputSource : public InputSource
  5725. {
  5726. public:
  5727. FileInputSource (const File& file);
  5728. ~FileInputSource();
  5729. InputStream* createInputStream();
  5730. InputStream* createInputStreamFor (const String& relatedItemPath);
  5731. int64 hashCode() const;
  5732. juce_UseDebuggingNewOperator
  5733. private:
  5734. const File file;
  5735. FileInputSource (const FileInputSource&);
  5736. const FileInputSource& operator= (const FileInputSource&);
  5737. };
  5738. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5739. /********* End of inlined file: juce_FileInputSource.h *********/
  5740. #endif
  5741. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5742. /********* Start of inlined file: juce_GZIPCompressorOutputStream.h *********/
  5743. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5744. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5745. class GZIPCompressorHelper;
  5746. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5747. {
  5748. public:
  5749. GZIPCompressorOutputStream (OutputStream* const destStream,
  5750. int compressionLevel = 0,
  5751. const bool deleteDestStreamWhenDestroyed = false,
  5752. const bool noWrap = false);
  5753. ~GZIPCompressorOutputStream();
  5754. void flush();
  5755. int64 getPosition();
  5756. bool setPosition (int64 newPosition);
  5757. bool write (const void* destBuffer, int howMany);
  5758. juce_UseDebuggingNewOperator
  5759. private:
  5760. OutputStream* const destStream;
  5761. ScopedPointer <OutputStream> streamToDelete;
  5762. HeapBlock <uint8> buffer;
  5763. ScopedPointer <GZIPCompressorHelper> helper;
  5764. bool doNextBlock();
  5765. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5766. const GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5767. };
  5768. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5769. /********* End of inlined file: juce_GZIPCompressorOutputStream.h *********/
  5770. #endif
  5771. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5772. /********* Start of inlined file: juce_GZIPDecompressorInputStream.h *********/
  5773. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5774. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5775. class GZIPDecompressHelper;
  5776. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5777. {
  5778. public:
  5779. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5780. const bool deleteSourceWhenDestroyed,
  5781. const bool noWrap = false,
  5782. const int64 uncompressedStreamLength = -1);
  5783. ~GZIPDecompressorInputStream();
  5784. int64 getPosition();
  5785. bool setPosition (int64 pos);
  5786. int64 getTotalLength();
  5787. bool isExhausted();
  5788. int read (void* destBuffer, int maxBytesToRead);
  5789. juce_UseDebuggingNewOperator
  5790. private:
  5791. InputStream* const sourceStream;
  5792. ScopedPointer <InputStream> streamToDelete;
  5793. const int64 uncompressedStreamLength;
  5794. const bool noWrap;
  5795. bool isEof;
  5796. int activeBufferSize;
  5797. int64 originalSourcePos, currentPos;
  5798. HeapBlock <uint8> buffer;
  5799. ScopedPointer <GZIPDecompressHelper> helper;
  5800. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5801. const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5802. };
  5803. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5804. /********* End of inlined file: juce_GZIPDecompressorInputStream.h *********/
  5805. #endif
  5806. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5807. #endif
  5808. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5809. #endif
  5810. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5811. /********* Start of inlined file: juce_MemoryInputStream.h *********/
  5812. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5813. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5814. class JUCE_API MemoryInputStream : public InputStream
  5815. {
  5816. public:
  5817. MemoryInputStream (const void* const sourceData,
  5818. const size_t sourceDataSize,
  5819. const bool keepInternalCopyOfData);
  5820. ~MemoryInputStream();
  5821. int64 getPosition();
  5822. bool setPosition (int64 pos);
  5823. int64 getTotalLength();
  5824. bool isExhausted();
  5825. int read (void* destBuffer, int maxBytesToRead);
  5826. juce_UseDebuggingNewOperator
  5827. private:
  5828. const char* data;
  5829. size_t dataSize, position;
  5830. MemoryBlock internalCopy;
  5831. };
  5832. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5833. /********* End of inlined file: juce_MemoryInputStream.h *********/
  5834. #endif
  5835. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5836. /********* Start of inlined file: juce_MemoryOutputStream.h *********/
  5837. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5838. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5839. class JUCE_API MemoryOutputStream : public OutputStream
  5840. {
  5841. public:
  5842. MemoryOutputStream (const size_t initialSize = 256,
  5843. const size_t granularity = 256,
  5844. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5845. ~MemoryOutputStream() throw();
  5846. const char* getData() throw();
  5847. size_t getDataSize() const throw();
  5848. void reset() throw();
  5849. void flush();
  5850. bool write (const void* buffer, int howMany);
  5851. int64 getPosition();
  5852. bool setPosition (int64 newPosition);
  5853. juce_UseDebuggingNewOperator
  5854. private:
  5855. MemoryBlock* data;
  5856. ScopedPointer <MemoryBlock> dataToDelete;
  5857. size_t position, size, blockSize;
  5858. };
  5859. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5860. /********* End of inlined file: juce_MemoryOutputStream.h *********/
  5861. #endif
  5862. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  5863. #endif
  5864. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5865. /********* Start of inlined file: juce_SubregionStream.h *********/
  5866. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5867. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5868. class JUCE_API SubregionStream : public InputStream
  5869. {
  5870. public:
  5871. SubregionStream (InputStream* const sourceStream,
  5872. const int64 startPositionInSourceStream,
  5873. const int64 lengthOfSourceStream,
  5874. const bool deleteSourceWhenDestroyed) throw();
  5875. ~SubregionStream() throw();
  5876. int64 getTotalLength();
  5877. int64 getPosition();
  5878. bool setPosition (int64 newPosition);
  5879. int read (void* destBuffer, int maxBytesToRead);
  5880. bool isExhausted();
  5881. juce_UseDebuggingNewOperator
  5882. private:
  5883. InputStream* const source;
  5884. ScopedPointer <InputStream> sourceToDelete;
  5885. const int64 startPositionInSourceStream, lengthOfSourceStream;
  5886. SubregionStream (const SubregionStream&);
  5887. const SubregionStream& operator= (const SubregionStream&);
  5888. };
  5889. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5890. /********* End of inlined file: juce_SubregionStream.h *********/
  5891. #endif
  5892. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  5893. #endif
  5894. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5895. /********* Start of inlined file: juce_LocalisedStrings.h *********/
  5896. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5897. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5898. #define TRANS(stringLiteral) \
  5899. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  5900. class JUCE_API LocalisedStrings
  5901. {
  5902. public:
  5903. LocalisedStrings (const String& fileContents);
  5904. LocalisedStrings (const File& fileToLoad);
  5905. ~LocalisedStrings();
  5906. static void setCurrentMappings (LocalisedStrings* newTranslations);
  5907. static LocalisedStrings* getCurrentMappings();
  5908. static const String translateWithCurrentMappings (const String& text);
  5909. static const String translateWithCurrentMappings (const char* text);
  5910. const String translate (const String& text) const;
  5911. const String getLanguageName() const { return languageName; }
  5912. const StringArray getCountryCodes() const { return countryCodes; }
  5913. void setIgnoresCase (const bool shouldIgnoreCase);
  5914. juce_UseDebuggingNewOperator
  5915. private:
  5916. String languageName;
  5917. StringArray countryCodes;
  5918. StringPairArray translations;
  5919. void loadFromText (const String& fileContents);
  5920. };
  5921. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5922. /********* End of inlined file: juce_LocalisedStrings.h *********/
  5923. #endif
  5924. #ifndef __JUCE_STRING_JUCEHEADER__
  5925. #endif
  5926. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  5927. #endif
  5928. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  5929. #endif
  5930. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5931. /********* Start of inlined file: juce_XmlDocument.h *********/
  5932. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5933. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  5934. class JUCE_API XmlDocument
  5935. {
  5936. public:
  5937. XmlDocument (const String& documentText) throw();
  5938. XmlDocument (const File& file);
  5939. ~XmlDocument() throw();
  5940. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  5941. const String& getLastParseError() const throw();
  5942. void setInputSource (InputSource* const newSource) throw();
  5943. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  5944. juce_UseDebuggingNewOperator
  5945. private:
  5946. String originalText;
  5947. const tchar* input;
  5948. bool outOfData, errorOccurred;
  5949. bool identifierLookupTable [128];
  5950. String lastError, dtdText;
  5951. StringArray tokenisedDTD;
  5952. bool needToLoadDTD, ignoreEmptyTextElements;
  5953. ScopedPointer <InputSource> inputSource;
  5954. void setLastError (const String& desc, const bool carryOn) throw();
  5955. void skipHeader() throw();
  5956. void skipNextWhiteSpace() throw();
  5957. tchar readNextChar() throw();
  5958. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  5959. void readChildElements (XmlElement* parent) throw();
  5960. int findNextTokenLength() throw();
  5961. void readQuotedString (String& result) throw();
  5962. void readEntity (String& result) throw();
  5963. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  5964. bool isXmlIdentifierChar (const tchar c) const throw();
  5965. const String getFileContents (const String& filename) const;
  5966. const String expandEntity (const String& entity);
  5967. const String expandExternalEntity (const String& entity);
  5968. const String getParameterEntity (const String& entity);
  5969. };
  5970. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  5971. /********* End of inlined file: juce_XmlDocument.h *********/
  5972. #endif
  5973. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  5974. #endif
  5975. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  5976. #endif
  5977. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5978. /********* Start of inlined file: juce_InterProcessLock.h *********/
  5979. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5980. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  5981. class JUCE_API InterProcessLock
  5982. {
  5983. public:
  5984. InterProcessLock (const String& name);
  5985. ~InterProcessLock();
  5986. bool enter (int timeOutMillisecs = -1);
  5987. void exit();
  5988. juce_UseDebuggingNewOperator
  5989. private:
  5990. #if JUCE_WINDOWS
  5991. void* internal;
  5992. // #elif JUCE_64BIT
  5993. // long long internal;
  5994. #else
  5995. int internal;
  5996. #endif
  5997. String name;
  5998. int reentrancyLevel;
  5999. InterProcessLock (const InterProcessLock&);
  6000. const InterProcessLock& operator= (const InterProcessLock&);
  6001. };
  6002. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6003. /********* End of inlined file: juce_InterProcessLock.h *********/
  6004. #endif
  6005. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6006. /********* Start of inlined file: juce_Process.h *********/
  6007. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6008. #define __JUCE_PROCESS_JUCEHEADER__
  6009. class JUCE_API Process
  6010. {
  6011. public:
  6012. enum ProcessPriority
  6013. {
  6014. LowPriority = 0,
  6015. NormalPriority = 1,
  6016. HighPriority = 2,
  6017. RealtimePriority = 3
  6018. };
  6019. static void setPriority (const ProcessPriority priority);
  6020. static void terminate();
  6021. static bool isForegroundProcess();
  6022. static void raisePrivilege();
  6023. static void lowerPrivilege();
  6024. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6025. };
  6026. #endif // __JUCE_PROCESS_JUCEHEADER__
  6027. /********* End of inlined file: juce_Process.h *********/
  6028. #endif
  6029. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6030. /********* Start of inlined file: juce_ReadWriteLock.h *********/
  6031. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6032. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6033. /********* Start of inlined file: juce_WaitableEvent.h *********/
  6034. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6035. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6036. class JUCE_API WaitableEvent
  6037. {
  6038. public:
  6039. WaitableEvent() throw();
  6040. ~WaitableEvent() throw();
  6041. bool wait (const int timeOutMilliseconds = -1) const throw();
  6042. void signal() const throw();
  6043. void reset() const throw();
  6044. juce_UseDebuggingNewOperator
  6045. private:
  6046. void* internal;
  6047. WaitableEvent (const WaitableEvent&);
  6048. const WaitableEvent& operator= (const WaitableEvent&);
  6049. };
  6050. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6051. /********* End of inlined file: juce_WaitableEvent.h *********/
  6052. /********* Start of inlined file: juce_Thread.h *********/
  6053. #ifndef __JUCE_THREAD_JUCEHEADER__
  6054. #define __JUCE_THREAD_JUCEHEADER__
  6055. class JUCE_API Thread
  6056. {
  6057. public:
  6058. Thread (const String& threadName);
  6059. virtual ~Thread();
  6060. virtual void run() = 0;
  6061. // Thread control functions..
  6062. void startThread();
  6063. void startThread (const int priority);
  6064. void stopThread (const int timeOutMilliseconds);
  6065. bool isThreadRunning() const;
  6066. void signalThreadShouldExit();
  6067. inline bool threadShouldExit() const { return threadShouldExit_; }
  6068. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6069. bool setPriority (const int priority);
  6070. static bool setCurrentThreadPriority (const int priority);
  6071. void setAffinityMask (const uint32 affinityMask);
  6072. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6073. // this can be called from any thread that needs to pause..
  6074. static void JUCE_CALLTYPE sleep (int milliseconds);
  6075. static void JUCE_CALLTYPE yield();
  6076. bool wait (const int timeOutMilliseconds) const;
  6077. void notify() const;
  6078. typedef void* ThreadID;
  6079. static ThreadID getCurrentThreadId();
  6080. static Thread* getCurrentThread();
  6081. ThreadID getThreadId() const { return threadId_; }
  6082. const String getThreadName() const { return threadName_; }
  6083. static int getNumRunningThreads();
  6084. static void stopAllThreads (const int timeoutInMillisecs);
  6085. juce_UseDebuggingNewOperator
  6086. private:
  6087. const String threadName_;
  6088. void* volatile threadHandle_;
  6089. CriticalSection startStopLock;
  6090. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6091. int threadPriority_;
  6092. ThreadID threadId_;
  6093. uint32 affinityMask_;
  6094. bool volatile threadShouldExit_;
  6095. friend void JUCE_API juce_threadEntryPoint (void*);
  6096. static void threadEntryPoint (Thread* thread);
  6097. Thread (const Thread&);
  6098. const Thread& operator= (const Thread&);
  6099. };
  6100. #endif // __JUCE_THREAD_JUCEHEADER__
  6101. /********* End of inlined file: juce_Thread.h *********/
  6102. class JUCE_API ReadWriteLock
  6103. {
  6104. public:
  6105. ReadWriteLock() throw();
  6106. ~ReadWriteLock() throw();
  6107. void enterRead() const throw();
  6108. void exitRead() const throw();
  6109. void enterWrite() const throw();
  6110. bool tryEnterWrite() const throw();
  6111. void exitWrite() const throw();
  6112. juce_UseDebuggingNewOperator
  6113. private:
  6114. CriticalSection accessLock;
  6115. WaitableEvent waitEvent;
  6116. mutable int numWaitingWriters, numWriters;
  6117. mutable Thread::ThreadID writerThreadId;
  6118. mutable Array <Thread::ThreadID> readerThreads;
  6119. ReadWriteLock (const ReadWriteLock&);
  6120. const ReadWriteLock& operator= (const ReadWriteLock&);
  6121. };
  6122. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6123. /********* End of inlined file: juce_ReadWriteLock.h *********/
  6124. #endif
  6125. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6126. #endif
  6127. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6128. /********* Start of inlined file: juce_ScopedReadLock.h *********/
  6129. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6130. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6131. class JUCE_API ScopedReadLock
  6132. {
  6133. public:
  6134. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6135. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6136. private:
  6137. const ReadWriteLock& lock_;
  6138. ScopedReadLock (const ScopedReadLock&);
  6139. const ScopedReadLock& operator= (const ScopedReadLock&);
  6140. };
  6141. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6142. /********* End of inlined file: juce_ScopedReadLock.h *********/
  6143. #endif
  6144. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6145. /********* Start of inlined file: juce_ScopedTryLock.h *********/
  6146. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6147. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6148. class JUCE_API ScopedTryLock
  6149. {
  6150. public:
  6151. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6152. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6153. bool isLocked() const throw() { return lockWasSuccessful; }
  6154. private:
  6155. const CriticalSection& lock_;
  6156. const bool lockWasSuccessful;
  6157. ScopedTryLock (const ScopedTryLock&);
  6158. const ScopedTryLock& operator= (const ScopedTryLock&);
  6159. };
  6160. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6161. /********* End of inlined file: juce_ScopedTryLock.h *********/
  6162. #endif
  6163. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6164. /********* Start of inlined file: juce_ScopedWriteLock.h *********/
  6165. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6166. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6167. class JUCE_API ScopedWriteLock
  6168. {
  6169. public:
  6170. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6171. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6172. private:
  6173. const ReadWriteLock& lock_;
  6174. ScopedWriteLock (const ScopedWriteLock&);
  6175. const ScopedWriteLock& operator= (const ScopedWriteLock&);
  6176. };
  6177. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6178. /********* End of inlined file: juce_ScopedWriteLock.h *********/
  6179. #endif
  6180. #ifndef __JUCE_THREAD_JUCEHEADER__
  6181. #endif
  6182. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6183. /********* Start of inlined file: juce_ThreadPool.h *********/
  6184. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6185. #define __JUCE_THREADPOOL_JUCEHEADER__
  6186. class ThreadPool;
  6187. class ThreadPoolThread;
  6188. class JUCE_API ThreadPoolJob
  6189. {
  6190. public:
  6191. ThreadPoolJob (const String& name);
  6192. virtual ~ThreadPoolJob();
  6193. const String getJobName() const;
  6194. void setJobName (const String& newName);
  6195. enum JobStatus
  6196. {
  6197. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6198. removed from the pool. */
  6199. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6200. should be automatically deleted by the pool. */
  6201. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6202. again when a thread is free. */
  6203. };
  6204. virtual JobStatus runJob() = 0;
  6205. bool isRunning() const { return isActive; }
  6206. bool shouldExit() const { return shouldStop; }
  6207. void signalJobShouldExit();
  6208. juce_UseDebuggingNewOperator
  6209. private:
  6210. friend class ThreadPool;
  6211. friend class ThreadPoolThread;
  6212. String jobName;
  6213. ThreadPool* pool;
  6214. bool shouldStop, isActive, shouldBeDeleted;
  6215. ThreadPoolJob (const ThreadPoolJob&);
  6216. const ThreadPoolJob& operator= (const ThreadPoolJob&);
  6217. };
  6218. class JUCE_API ThreadPool
  6219. {
  6220. public:
  6221. ThreadPool (const int numberOfThreads,
  6222. const bool startThreadsOnlyWhenNeeded = true,
  6223. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6224. ~ThreadPool();
  6225. class JUCE_API JobSelector
  6226. {
  6227. public:
  6228. virtual ~JobSelector() {}
  6229. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6230. };
  6231. void addJob (ThreadPoolJob* const job);
  6232. bool removeJob (ThreadPoolJob* const job,
  6233. const bool interruptIfRunning,
  6234. const int timeOutMilliseconds);
  6235. bool removeAllJobs (const bool interruptRunningJobs,
  6236. const int timeOutMilliseconds,
  6237. const bool deleteInactiveJobs = false,
  6238. JobSelector* selectedJobsToRemove = 0);
  6239. int getNumJobs() const;
  6240. ThreadPoolJob* getJob (const int index) const;
  6241. bool contains (const ThreadPoolJob* const job) const;
  6242. bool isJobRunning (const ThreadPoolJob* const job) const;
  6243. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6244. const int timeOutMilliseconds) const;
  6245. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6246. bool setThreadPriorities (const int newPriority);
  6247. juce_UseDebuggingNewOperator
  6248. private:
  6249. const int threadStopTimeout;
  6250. int priority;
  6251. class ThreadPoolThread;
  6252. OwnedArray <ThreadPoolThread> threads;
  6253. Array <ThreadPoolJob*> jobs;
  6254. CriticalSection lock;
  6255. uint32 lastJobEndTime;
  6256. WaitableEvent jobFinishedSignal;
  6257. friend class ThreadPoolThread;
  6258. bool runNextJob();
  6259. ThreadPool (const ThreadPool&);
  6260. const ThreadPool& operator= (const ThreadPool&);
  6261. };
  6262. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6263. /********* End of inlined file: juce_ThreadPool.h *********/
  6264. #endif
  6265. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6266. /********* Start of inlined file: juce_TimeSliceThread.h *********/
  6267. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6268. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6269. class JUCE_API TimeSliceClient
  6270. {
  6271. public:
  6272. virtual ~TimeSliceClient() {}
  6273. virtual bool useTimeSlice() = 0;
  6274. };
  6275. class JUCE_API TimeSliceThread : public Thread
  6276. {
  6277. public:
  6278. TimeSliceThread (const String& threadName);
  6279. ~TimeSliceThread();
  6280. void addTimeSliceClient (TimeSliceClient* const client);
  6281. void removeTimeSliceClient (TimeSliceClient* const client);
  6282. int getNumClients() const;
  6283. TimeSliceClient* getClient (const int index) const;
  6284. void run();
  6285. juce_UseDebuggingNewOperator
  6286. private:
  6287. CriticalSection callbackLock, listLock;
  6288. Array <TimeSliceClient*> clients;
  6289. int index;
  6290. TimeSliceClient* clientBeingCalled;
  6291. bool clientsChanged;
  6292. TimeSliceThread (const TimeSliceThread&);
  6293. const TimeSliceThread& operator= (const TimeSliceThread&);
  6294. };
  6295. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6296. /********* End of inlined file: juce_TimeSliceThread.h *********/
  6297. #endif
  6298. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6299. #endif
  6300. #endif
  6301. /********* End of inlined file: juce_core_includes.h *********/
  6302. // if you're compiling a command-line app, you might want to just include the core headers,
  6303. // so you can set this macro before including juce.h
  6304. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6305. /********* Start of inlined file: juce_app_includes.h *********/
  6306. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6307. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6308. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6309. /********* Start of inlined file: juce_Application.h *********/
  6310. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6311. #define __JUCE_APPLICATION_JUCEHEADER__
  6312. /********* Start of inlined file: juce_ApplicationCommandTarget.h *********/
  6313. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6314. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6315. /********* Start of inlined file: juce_Component.h *********/
  6316. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6317. #define __JUCE_COMPONENT_JUCEHEADER__
  6318. /********* Start of inlined file: juce_MouseCursor.h *********/
  6319. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6320. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6321. class Image;
  6322. class SharedMouseCursorInternal;
  6323. class ComponentPeer;
  6324. class Component;
  6325. class JUCE_API MouseCursor
  6326. {
  6327. public:
  6328. enum StandardCursorType
  6329. {
  6330. NoCursor = 0, /**< An invisible cursor. */
  6331. NormalCursor, /**< The stardard arrow cursor. */
  6332. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6333. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6334. CrosshairCursor, /**< A pair of crosshairs. */
  6335. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6336. that you're dragging a copy of something. */
  6337. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6338. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6339. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6340. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6341. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6342. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6343. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6344. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6345. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6346. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6347. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6348. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6349. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6350. };
  6351. MouseCursor() throw();
  6352. MouseCursor (const StandardCursorType type) throw();
  6353. MouseCursor (const Image& image,
  6354. const int hotSpotX,
  6355. const int hotSpotY) throw();
  6356. MouseCursor (const MouseCursor& other) throw();
  6357. const MouseCursor& operator= (const MouseCursor& other) throw();
  6358. ~MouseCursor() throw();
  6359. bool operator== (const MouseCursor& other) const throw();
  6360. bool operator!= (const MouseCursor& other) const throw();
  6361. static void showWaitCursor() throw();
  6362. static void hideWaitCursor() throw();
  6363. juce_UseDebuggingNewOperator
  6364. private:
  6365. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6366. friend class Component;
  6367. void showInWindow (ComponentPeer* window) const throw();
  6368. void showInAllWindows() const throw();
  6369. void* getHandle() const throw();
  6370. };
  6371. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6372. /********* End of inlined file: juce_MouseCursor.h *********/
  6373. /********* Start of inlined file: juce_MouseListener.h *********/
  6374. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6375. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6376. /********* Start of inlined file: juce_MouseEvent.h *********/
  6377. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6378. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6379. class Component;
  6380. /********* Start of inlined file: juce_ModifierKeys.h *********/
  6381. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6382. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6383. class JUCE_API ModifierKeys
  6384. {
  6385. public:
  6386. ModifierKeys (const int flags = 0) throw();
  6387. ModifierKeys (const ModifierKeys& other) throw();
  6388. const ModifierKeys& operator= (const ModifierKeys& other) throw();
  6389. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6390. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6391. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6392. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6393. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6394. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6395. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6396. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6397. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6398. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6399. enum Flags
  6400. {
  6401. shiftModifier = 1,
  6402. ctrlModifier = 2,
  6403. altModifier = 4,
  6404. leftButtonModifier = 16,
  6405. rightButtonModifier = 32,
  6406. middleButtonModifier = 64,
  6407. #if JUCE_MAC
  6408. commandModifier = 8,
  6409. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6410. #else
  6411. commandModifier = ctrlModifier,
  6412. popupMenuClickModifier = rightButtonModifier,
  6413. #endif
  6414. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6415. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6416. };
  6417. inline int getRawFlags() const throw() { return flags; }
  6418. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6419. int getNumMouseButtonsDown() const throw();
  6420. static const ModifierKeys getCurrentModifiers() throw();
  6421. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6422. private:
  6423. int flags;
  6424. static int currentModifierFlags;
  6425. friend class ComponentPeer;
  6426. static void updateCurrentModifiers() throw();
  6427. };
  6428. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6429. /********* End of inlined file: juce_ModifierKeys.h *********/
  6430. class JUCE_API MouseEvent
  6431. {
  6432. public:
  6433. MouseEvent (const int x, const int y,
  6434. const ModifierKeys& modifiers,
  6435. Component* const originator,
  6436. const Time& eventTime,
  6437. const int mouseDownX,
  6438. const int mouseDownY,
  6439. const Time& mouseDownTime,
  6440. const int numberOfClicks,
  6441. const bool mouseWasDragged) throw();
  6442. ~MouseEvent() throw();
  6443. int x;
  6444. int y;
  6445. ModifierKeys mods;
  6446. Component* eventComponent;
  6447. Component* originalComponent;
  6448. Time eventTime;
  6449. int getMouseDownX() const throw();
  6450. int getMouseDownY() const throw();
  6451. int getDistanceFromDragStart() const throw();
  6452. int getDistanceFromDragStartX() const throw();
  6453. int getDistanceFromDragStartY() const throw();
  6454. bool mouseWasClicked() const throw();
  6455. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6456. int getLengthOfMousePress() const throw();
  6457. int getScreenX() const throw();
  6458. int getScreenY() const throw();
  6459. int getMouseDownScreenX() const throw();
  6460. int getMouseDownScreenY() const throw();
  6461. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6462. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6463. static int getDoubleClickTimeout() throw();
  6464. juce_UseDebuggingNewOperator
  6465. private:
  6466. int mouseDownX, mouseDownY;
  6467. Time mouseDownTime;
  6468. int numberOfClicks;
  6469. bool wasMovedSinceMouseDown;
  6470. };
  6471. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6472. /********* End of inlined file: juce_MouseEvent.h *********/
  6473. class JUCE_API MouseListener
  6474. {
  6475. public:
  6476. virtual ~MouseListener() {}
  6477. virtual void mouseMove (const MouseEvent& e);
  6478. virtual void mouseEnter (const MouseEvent& e);
  6479. virtual void mouseExit (const MouseEvent& e);
  6480. virtual void mouseDown (const MouseEvent& e);
  6481. virtual void mouseDrag (const MouseEvent& e);
  6482. virtual void mouseUp (const MouseEvent& e);
  6483. virtual void mouseDoubleClick (const MouseEvent& e);
  6484. virtual void mouseWheelMove (const MouseEvent& e,
  6485. float wheelIncrementX,
  6486. float wheelIncrementY);
  6487. };
  6488. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6489. /********* End of inlined file: juce_MouseListener.h *********/
  6490. /********* Start of inlined file: juce_ComponentListener.h *********/
  6491. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6492. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6493. class Component;
  6494. class JUCE_API ComponentListener
  6495. {
  6496. public:
  6497. virtual ~ComponentListener() {}
  6498. virtual void componentMovedOrResized (Component& component,
  6499. bool wasMoved,
  6500. bool wasResized);
  6501. virtual void componentBroughtToFront (Component& component);
  6502. virtual void componentVisibilityChanged (Component& component);
  6503. virtual void componentChildrenChanged (Component& component);
  6504. virtual void componentParentHierarchyChanged (Component& component);
  6505. virtual void componentNameChanged (Component& component);
  6506. };
  6507. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6508. /********* End of inlined file: juce_ComponentListener.h *********/
  6509. /********* Start of inlined file: juce_KeyListener.h *********/
  6510. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6511. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6512. /********* Start of inlined file: juce_KeyPress.h *********/
  6513. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6514. #define __JUCE_KEYPRESS_JUCEHEADER__
  6515. class JUCE_API KeyPress
  6516. {
  6517. public:
  6518. KeyPress() throw();
  6519. KeyPress (const int keyCode,
  6520. const ModifierKeys& modifiers,
  6521. const juce_wchar textCharacter) throw();
  6522. KeyPress (const int keyCode) throw();
  6523. KeyPress (const KeyPress& other) throw();
  6524. const KeyPress& operator= (const KeyPress& other) throw();
  6525. bool operator== (const KeyPress& other) const throw();
  6526. bool operator!= (const KeyPress& other) const throw();
  6527. bool isValid() const throw() { return keyCode != 0; }
  6528. int getKeyCode() const throw() { return keyCode; }
  6529. const ModifierKeys getModifiers() const throw() { return mods; }
  6530. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6531. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6532. static const KeyPress createFromDescription (const String& textVersion) throw();
  6533. const String getTextDescription() const throw();
  6534. bool isCurrentlyDown() const throw();
  6535. static bool isKeyCurrentlyDown (int keyCode) throw();
  6536. // Key codes
  6537. //
  6538. // Note that the actual values of these are platform-specific and may change
  6539. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6540. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6541. //
  6542. static const int spaceKey; /**< key-code for the space bar */
  6543. static const int escapeKey; /**< key-code for the escape key */
  6544. static const int returnKey; /**< key-code for the return key*/
  6545. static const int tabKey; /**< key-code for the tab key*/
  6546. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6547. static const int backspaceKey; /**< key-code for the backspace key */
  6548. static const int insertKey; /**< key-code for the insert key */
  6549. static const int upKey; /**< key-code for the cursor-up key */
  6550. static const int downKey; /**< key-code for the cursor-down key */
  6551. static const int leftKey; /**< key-code for the cursor-left key */
  6552. static const int rightKey; /**< key-code for the cursor-right key */
  6553. static const int pageUpKey; /**< key-code for the page-up key */
  6554. static const int pageDownKey; /**< key-code for the page-down key */
  6555. static const int homeKey; /**< key-code for the home key */
  6556. static const int endKey; /**< key-code for the end key */
  6557. static const int F1Key; /**< key-code for the F1 key */
  6558. static const int F2Key; /**< key-code for the F2 key */
  6559. static const int F3Key; /**< key-code for the F3 key */
  6560. static const int F4Key; /**< key-code for the F4 key */
  6561. static const int F5Key; /**< key-code for the F5 key */
  6562. static const int F6Key; /**< key-code for the F6 key */
  6563. static const int F7Key; /**< key-code for the F7 key */
  6564. static const int F8Key; /**< key-code for the F8 key */
  6565. static const int F9Key; /**< key-code for the F9 key */
  6566. static const int F10Key; /**< key-code for the F10 key */
  6567. static const int F11Key; /**< key-code for the F11 key */
  6568. static const int F12Key; /**< key-code for the F12 key */
  6569. static const int F13Key; /**< key-code for the F13 key */
  6570. static const int F14Key; /**< key-code for the F14 key */
  6571. static const int F15Key; /**< key-code for the F15 key */
  6572. static const int F16Key; /**< key-code for the F16 key */
  6573. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6574. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6575. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6576. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6577. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6578. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6579. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6580. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6581. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6582. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6583. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6584. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6585. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6586. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6587. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6588. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6589. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6590. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6591. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6592. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6593. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6594. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6595. juce_UseDebuggingNewOperator
  6596. private:
  6597. int keyCode;
  6598. ModifierKeys mods;
  6599. juce_wchar textCharacter;
  6600. };
  6601. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6602. /********* End of inlined file: juce_KeyPress.h *********/
  6603. class Component;
  6604. class JUCE_API KeyListener
  6605. {
  6606. public:
  6607. virtual ~KeyListener() {}
  6608. virtual bool keyPressed (const KeyPress& key,
  6609. Component* originatingComponent) = 0;
  6610. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6611. };
  6612. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6613. /********* End of inlined file: juce_KeyListener.h *********/
  6614. /********* Start of inlined file: juce_KeyboardFocusTraverser.h *********/
  6615. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6616. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6617. class Component;
  6618. class JUCE_API KeyboardFocusTraverser
  6619. {
  6620. public:
  6621. KeyboardFocusTraverser();
  6622. virtual ~KeyboardFocusTraverser();
  6623. virtual Component* getNextComponent (Component* current);
  6624. virtual Component* getPreviousComponent (Component* current);
  6625. virtual Component* getDefaultComponent (Component* parentComponent);
  6626. };
  6627. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6628. /********* End of inlined file: juce_KeyboardFocusTraverser.h *********/
  6629. /********* Start of inlined file: juce_ImageEffectFilter.h *********/
  6630. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6631. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6632. /********* Start of inlined file: juce_Graphics.h *********/
  6633. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6634. #define __JUCE_GRAPHICS_JUCEHEADER__
  6635. /********* Start of inlined file: juce_Font.h *********/
  6636. #ifndef __JUCE_FONT_JUCEHEADER__
  6637. #define __JUCE_FONT_JUCEHEADER__
  6638. /********* Start of inlined file: juce_Typeface.h *********/
  6639. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6640. #define __JUCE_TYPEFACE_JUCEHEADER__
  6641. /********* Start of inlined file: juce_Path.h *********/
  6642. #ifndef __JUCE_PATH_JUCEHEADER__
  6643. #define __JUCE_PATH_JUCEHEADER__
  6644. /********* Start of inlined file: juce_AffineTransform.h *********/
  6645. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6646. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6647. class JUCE_API AffineTransform
  6648. {
  6649. public:
  6650. AffineTransform() throw();
  6651. AffineTransform (const AffineTransform& other) throw();
  6652. AffineTransform (const float mat00, const float mat01, const float mat02,
  6653. const float mat10, const float mat11, const float mat12) throw();
  6654. const AffineTransform& operator= (const AffineTransform& other) throw();
  6655. bool operator== (const AffineTransform& other) const throw();
  6656. bool operator!= (const AffineTransform& other) const throw();
  6657. static const AffineTransform identity;
  6658. void transformPoint (float& x,
  6659. float& y) const throw();
  6660. void transformPoint (double& x,
  6661. double& y) const throw();
  6662. const AffineTransform translated (const float deltaX,
  6663. const float deltaY) const throw();
  6664. static const AffineTransform translation (const float deltaX,
  6665. const float deltaY) throw();
  6666. const AffineTransform rotated (const float angleInRadians) const throw();
  6667. const AffineTransform rotated (const float angleInRadians,
  6668. const float pivotX,
  6669. const float pivotY) const throw();
  6670. static const AffineTransform rotation (const float angleInRadians) throw();
  6671. static const AffineTransform rotation (const float angleInRadians,
  6672. const float pivotX,
  6673. const float pivotY) throw();
  6674. const AffineTransform scaled (const float factorX,
  6675. const float factorY) const throw();
  6676. static const AffineTransform scale (const float factorX,
  6677. const float factorY) throw();
  6678. const AffineTransform sheared (const float shearX,
  6679. const float shearY) const throw();
  6680. const AffineTransform inverted() const throw();
  6681. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6682. bool isIdentity() const throw();
  6683. bool isSingularity() const throw();
  6684. bool isOnlyTranslation() const throw();
  6685. float getTranslationX() const throw() { return mat02; }
  6686. float getTranslationY() const throw() { return mat12; }
  6687. juce_UseDebuggingNewOperator
  6688. float mat00, mat01, mat02;
  6689. float mat10, mat11, mat12;
  6690. private:
  6691. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6692. const float mat10, const float mat11, const float mat12) const throw();
  6693. };
  6694. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6695. /********* End of inlined file: juce_AffineTransform.h *********/
  6696. /********* Start of inlined file: juce_Point.h *********/
  6697. #ifndef __JUCE_POINT_JUCEHEADER__
  6698. #define __JUCE_POINT_JUCEHEADER__
  6699. class JUCE_API Point
  6700. {
  6701. public:
  6702. Point() throw();
  6703. Point (const Point& other) throw();
  6704. Point (const float x, const float y) throw();
  6705. const Point& operator= (const Point& other) throw();
  6706. ~Point() throw();
  6707. inline float getX() const throw() { return x; }
  6708. inline float getY() const throw() { return y; }
  6709. void setXY (const float x,
  6710. const float y) throw();
  6711. void applyTransform (const AffineTransform& transform) throw();
  6712. juce_UseDebuggingNewOperator
  6713. private:
  6714. float x, y;
  6715. };
  6716. #endif // __JUCE_POINT_JUCEHEADER__
  6717. /********* End of inlined file: juce_Point.h *********/
  6718. /********* Start of inlined file: juce_Rectangle.h *********/
  6719. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6720. #define __JUCE_RECTANGLE_JUCEHEADER__
  6721. class JUCE_API Rectangle
  6722. {
  6723. public:
  6724. Rectangle() throw();
  6725. Rectangle (const Rectangle& other) throw();
  6726. Rectangle (const int x, const int y,
  6727. const int width, const int height) throw();
  6728. Rectangle (const int width, const int height) throw();
  6729. ~Rectangle() throw();
  6730. inline int getX() const throw() { return x; }
  6731. inline int getY() const throw() { return y; }
  6732. inline int getWidth() const throw() { return w; }
  6733. inline int getHeight() const throw() { return h; }
  6734. inline int getRight() const throw() { return x + w; }
  6735. inline int getBottom() const throw() { return y + h; }
  6736. inline int getCentreX() const throw() { return x + (w >> 1); }
  6737. inline int getCentreY() const throw() { return y + (h >> 1); }
  6738. bool isEmpty() const throw();
  6739. void setPosition (const int x, const int y) throw();
  6740. void setSize (const int w, const int h) throw();
  6741. void setBounds (const int newX, const int newY,
  6742. const int newWidth, const int newHeight) throw();
  6743. void setWidth (const int newWidth) throw();
  6744. void setHeight (const int newHeight) throw();
  6745. void setLeft (const int newLeft) throw();
  6746. void setTop (const int newTop) throw();
  6747. void setRight (const int newRight) throw();
  6748. void setBottom (const int newBottom) throw();
  6749. void translate (const int deltaX,
  6750. const int deltaY) throw();
  6751. const Rectangle translated (const int deltaX,
  6752. const int deltaY) const throw();
  6753. void expand (const int deltaX,
  6754. const int deltaY) throw();
  6755. const Rectangle expanded (const int deltaX,
  6756. const int deltaY) const throw();
  6757. void reduce (const int deltaX,
  6758. const int deltaY) throw();
  6759. const Rectangle reduced (const int deltaX,
  6760. const int deltaY) const throw();
  6761. bool operator== (const Rectangle& other) const throw();
  6762. bool operator!= (const Rectangle& other) const throw();
  6763. bool contains (const int x, const int y) const throw();
  6764. bool contains (const Rectangle& other) const throw();
  6765. bool intersects (const Rectangle& other) const throw();
  6766. const Rectangle getIntersection (const Rectangle& other) const throw();
  6767. bool intersectRectangle (int& x, int& y, int& w, int& h) const throw();
  6768. const Rectangle getUnion (const Rectangle& other) const throw();
  6769. bool enlargeIfAdjacent (const Rectangle& other) throw();
  6770. bool reduceIfPartlyContainedIn (const Rectangle& other) throw();
  6771. static bool intersectRectangles (int& x1, int& y1, int& w1, int& h1,
  6772. int x2, int y2, int w2, int h2) throw();
  6773. const String toString() const throw();
  6774. static const Rectangle fromString (const String& stringVersion);
  6775. juce_UseDebuggingNewOperator
  6776. private:
  6777. friend class RectangleList;
  6778. int x, y, w, h;
  6779. };
  6780. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  6781. /********* End of inlined file: juce_Rectangle.h *********/
  6782. /********* Start of inlined file: juce_Justification.h *********/
  6783. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  6784. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  6785. class JUCE_API Justification
  6786. {
  6787. public:
  6788. inline Justification (const int flags_) throw() : flags (flags_) {}
  6789. Justification (const Justification& other) throw();
  6790. const Justification& operator= (const Justification& other) throw();
  6791. inline int getFlags() const throw() { return flags; }
  6792. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6793. int getOnlyVerticalFlags() const throw();
  6794. int getOnlyHorizontalFlags() const throw();
  6795. void applyToRectangle (int& x, int& y,
  6796. const int w, const int h,
  6797. const int spaceX, const int spaceY,
  6798. const int spaceW, const int spaceH) const throw();
  6799. enum
  6800. {
  6801. left = 1,
  6802. right = 2,
  6803. horizontallyCentred = 4,
  6804. top = 8,
  6805. bottom = 16,
  6806. verticallyCentred = 32,
  6807. horizontallyJustified = 64,
  6808. centred = 36,
  6809. centredLeft = 33,
  6810. centredRight = 34,
  6811. centredTop = 12,
  6812. centredBottom = 20,
  6813. topLeft = 9,
  6814. topRight = 10,
  6815. bottomLeft = 17,
  6816. bottomRight = 18
  6817. };
  6818. private:
  6819. int flags;
  6820. };
  6821. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  6822. /********* End of inlined file: juce_Justification.h *********/
  6823. /********* Start of inlined file: juce_EdgeTable.h *********/
  6824. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  6825. #define __JUCE_EDGETABLE_JUCEHEADER__
  6826. class Path;
  6827. class RectangleList;
  6828. class Image;
  6829. class JUCE_API EdgeTable
  6830. {
  6831. public:
  6832. EdgeTable (const Rectangle& clipLimits,
  6833. const Path& pathToAdd,
  6834. const AffineTransform& transform) throw();
  6835. EdgeTable (const Rectangle& rectangleToAdd) throw();
  6836. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  6837. EdgeTable (const float x, const float y,
  6838. const float w, const float h) throw();
  6839. EdgeTable (const EdgeTable& other) throw();
  6840. const EdgeTable& operator= (const EdgeTable& other) throw();
  6841. ~EdgeTable() throw();
  6842. void clipToRectangle (const Rectangle& r) throw();
  6843. void excludeRectangle (const Rectangle& r) throw();
  6844. void clipToEdgeTable (const EdgeTable& other);
  6845. void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
  6846. bool isEmpty() throw();
  6847. const Rectangle& getMaximumBounds() const throw() { return bounds; }
  6848. void translate (float dx, int dy) throw();
  6849. void optimiseTable() throw();
  6850. template <class EdgeTableIterationCallback>
  6851. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  6852. {
  6853. const int* lineStart = table;
  6854. for (int y = 0; y < bounds.getHeight(); ++y)
  6855. {
  6856. const int* line = lineStart;
  6857. lineStart += lineStrideElements;
  6858. int numPoints = line[0];
  6859. if (--numPoints > 0)
  6860. {
  6861. int x = *++line;
  6862. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  6863. int levelAccumulator = 0;
  6864. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  6865. while (--numPoints >= 0)
  6866. {
  6867. const int level = *++line;
  6868. jassert (((unsigned int) level) < (unsigned int) 256);
  6869. const int endX = *++line;
  6870. jassert (endX >= x);
  6871. const int endOfRun = (endX >> 8);
  6872. if (endOfRun == (x >> 8))
  6873. {
  6874. // small segment within the same pixel, so just save it for the next
  6875. // time round..
  6876. levelAccumulator += (endX - x) * level;
  6877. }
  6878. else
  6879. {
  6880. // plot the fist pixel of this segment, including any accumulated
  6881. // levels from smaller segments that haven't been drawn yet
  6882. levelAccumulator += (0xff - (x & 0xff)) * level;
  6883. levelAccumulator >>= 8;
  6884. x >>= 8;
  6885. if (levelAccumulator > 0)
  6886. {
  6887. if (levelAccumulator >> 8)
  6888. levelAccumulator = 0xff;
  6889. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  6890. }
  6891. // if there's a run of similar pixels, do it all in one go..
  6892. if (level > 0)
  6893. {
  6894. jassert (endOfRun <= bounds.getRight());
  6895. const int numPix = endOfRun - ++x;
  6896. if (numPix > 0)
  6897. iterationCallback.handleEdgeTableLine (x, numPix, level);
  6898. }
  6899. // save the bit at the end to be drawn next time round the loop.
  6900. levelAccumulator = (endX & 0xff) * level;
  6901. }
  6902. x = endX;
  6903. }
  6904. if (levelAccumulator > 0)
  6905. {
  6906. levelAccumulator >>= 8;
  6907. if (levelAccumulator >> 8)
  6908. levelAccumulator = 0xff;
  6909. x >>= 8;
  6910. jassert (x >= bounds.getX() && x < bounds.getRight());
  6911. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  6912. }
  6913. }
  6914. }
  6915. }
  6916. juce_UseDebuggingNewOperator
  6917. private:
  6918. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  6919. HeapBlock <int> table;
  6920. Rectangle bounds;
  6921. int maxEdgesPerLine, lineStrideElements;
  6922. bool needToCheckEmptinesss;
  6923. void addEdgePoint (const int x, const int y, const int winding) throw();
  6924. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  6925. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  6926. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  6927. void sanitiseLevels (const bool useNonZeroWinding) throw();
  6928. };
  6929. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  6930. /********* End of inlined file: juce_EdgeTable.h *********/
  6931. class Image;
  6932. class JUCE_API Path
  6933. {
  6934. public:
  6935. Path() throw();
  6936. Path (const Path& other) throw();
  6937. ~Path() throw();
  6938. const Path& operator= (const Path& other) throw();
  6939. bool isEmpty() const throw();
  6940. void getBounds (float& x, float& y,
  6941. float& w, float& h) const throw();
  6942. void getBoundsTransformed (const AffineTransform& transform,
  6943. float& x, float& y,
  6944. float& w, float& h) const throw();
  6945. bool contains (const float x,
  6946. const float y,
  6947. const float tolerence = 10.0f) const throw();
  6948. bool intersectsLine (const float x1, const float y1,
  6949. const float x2, const float y2,
  6950. const float tolerence = 10.0f) throw();
  6951. void clear() throw();
  6952. void startNewSubPath (const float startX,
  6953. const float startY) throw();
  6954. void closeSubPath() throw();
  6955. void lineTo (const float endX,
  6956. const float endY) throw();
  6957. void quadraticTo (const float controlPointX,
  6958. const float controlPointY,
  6959. const float endPointX,
  6960. const float endPointY) throw();
  6961. void cubicTo (const float controlPoint1X,
  6962. const float controlPoint1Y,
  6963. const float controlPoint2X,
  6964. const float controlPoint2Y,
  6965. const float endPointX,
  6966. const float endPointY) throw();
  6967. const Point getCurrentPosition() const;
  6968. void addRectangle (const float x, const float y,
  6969. const float w, const float h) throw();
  6970. void addRectangle (const Rectangle& rectangle) throw();
  6971. void addRoundedRectangle (const float x, const float y,
  6972. const float w, const float h,
  6973. float cornerSize) throw();
  6974. void addRoundedRectangle (const float x, const float y,
  6975. const float w, const float h,
  6976. float cornerSizeX,
  6977. float cornerSizeY) throw();
  6978. void addTriangle (const float x1, const float y1,
  6979. const float x2, const float y2,
  6980. const float x3, const float y3) throw();
  6981. void addQuadrilateral (const float x1, const float y1,
  6982. const float x2, const float y2,
  6983. const float x3, const float y3,
  6984. const float x4, const float y4) throw();
  6985. void addEllipse (const float x, const float y,
  6986. const float width, const float height) throw();
  6987. void addArc (const float x, const float y,
  6988. const float width, const float height,
  6989. const float fromRadians,
  6990. const float toRadians,
  6991. const bool startAsNewSubPath = false) throw();
  6992. void addCentredArc (const float centreX, const float centreY,
  6993. const float radiusX, const float radiusY,
  6994. const float rotationOfEllipse,
  6995. const float fromRadians,
  6996. const float toRadians,
  6997. const bool startAsNewSubPath = false) throw();
  6998. void addPieSegment (const float x, const float y,
  6999. const float width, const float height,
  7000. const float fromRadians,
  7001. const float toRadians,
  7002. const float innerCircleProportionalSize);
  7003. void addLineSegment (const float startX, const float startY,
  7004. const float endX, const float endY,
  7005. float lineThickness) throw();
  7006. void addArrow (const float startX, const float startY,
  7007. const float endX, const float endY,
  7008. float lineThickness,
  7009. float arrowheadWidth,
  7010. float arrowheadLength) throw();
  7011. void addStar (const float centreX,
  7012. const float centreY,
  7013. const int numberOfPoints,
  7014. const float innerRadius,
  7015. const float outerRadius,
  7016. const float startAngle = 0.0f);
  7017. void addBubble (float bodyX, float bodyY,
  7018. float bodyW, float bodyH,
  7019. float cornerSize,
  7020. float arrowTipX,
  7021. float arrowTipY,
  7022. int whichSide,
  7023. float arrowPositionAlongEdgeProportional,
  7024. float arrowWidth);
  7025. void addPath (const Path& pathToAppend) throw();
  7026. void addPath (const Path& pathToAppend,
  7027. const AffineTransform& transformToApply) throw();
  7028. void swapWithPath (Path& other);
  7029. void applyTransform (const AffineTransform& transform) throw();
  7030. void scaleToFit (const float x, const float y,
  7031. const float width, const float height,
  7032. const bool preserveProportions) throw();
  7033. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7034. const float width, const float height,
  7035. const bool preserveProportions,
  7036. const Justification& justificationType = Justification::centred) const throw();
  7037. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7038. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7039. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7040. class JUCE_API Iterator
  7041. {
  7042. public:
  7043. Iterator (const Path& path);
  7044. ~Iterator();
  7045. bool next();
  7046. enum PathElementType
  7047. {
  7048. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7049. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7050. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7051. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7052. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7053. };
  7054. PathElementType elementType;
  7055. float x1, y1, x2, y2, x3, y3;
  7056. private:
  7057. const Path& path;
  7058. int index;
  7059. Iterator (const Iterator&);
  7060. const Iterator& operator= (const Iterator&);
  7061. };
  7062. void loadPathFromStream (InputStream& source);
  7063. void loadPathFromData (const unsigned char* const data,
  7064. const int numberOfBytes) throw();
  7065. void writePathToStream (OutputStream& destination) const;
  7066. const String toString() const;
  7067. void restoreFromString (const String& stringVersion);
  7068. juce_UseDebuggingNewOperator
  7069. private:
  7070. friend class PathFlatteningIterator;
  7071. friend class Path::Iterator;
  7072. ArrayAllocationBase <float> data;
  7073. int numElements;
  7074. float pathXMin, pathXMax, pathYMin, pathYMax;
  7075. bool useNonZeroWinding;
  7076. static const float lineMarker;
  7077. static const float moveMarker;
  7078. static const float quadMarker;
  7079. static const float cubicMarker;
  7080. static const float closeSubPathMarker;
  7081. };
  7082. #endif // __JUCE_PATH_JUCEHEADER__
  7083. /********* End of inlined file: juce_Path.h *********/
  7084. class Font;
  7085. class JUCE_API Typeface : public ReferenceCountedObject
  7086. {
  7087. public:
  7088. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7089. const String getName() const throw() { return name; }
  7090. static const Ptr createSystemTypefaceFor (const Font& font);
  7091. virtual ~Typeface();
  7092. virtual float getAscent() const = 0;
  7093. virtual float getDescent() const = 0;
  7094. virtual float getStringWidth (const String& text) = 0;
  7095. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7096. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7097. juce_UseDebuggingNewOperator
  7098. protected:
  7099. String name;
  7100. Typeface (const String& name) throw();
  7101. private:
  7102. Typeface (const Typeface&);
  7103. const Typeface& operator= (const Typeface&);
  7104. };
  7105. class JUCE_API CustomTypeface : public Typeface
  7106. {
  7107. public:
  7108. CustomTypeface();
  7109. CustomTypeface (InputStream& serialisedTypefaceStream);
  7110. ~CustomTypeface();
  7111. void clear();
  7112. void setCharacteristics (const String& name, const float ascent,
  7113. const bool isBold, const bool isItalic,
  7114. const juce_wchar defaultCharacter) throw();
  7115. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7116. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7117. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7118. bool writeToStream (OutputStream& outputStream);
  7119. // The following methods implement the basic Typeface behaviour.
  7120. float getAscent() const;
  7121. float getDescent() const;
  7122. float getStringWidth (const String& text);
  7123. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7124. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7125. int getGlyphForCharacter (juce_wchar character);
  7126. juce_UseDebuggingNewOperator
  7127. protected:
  7128. juce_wchar defaultCharacter;
  7129. float ascent;
  7130. bool isBold, isItalic;
  7131. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7132. private:
  7133. class GlyphInfo;
  7134. friend class OwnedArray<GlyphInfo>;
  7135. OwnedArray <GlyphInfo> glyphs;
  7136. short lookupTable [128];
  7137. CustomTypeface (const CustomTypeface&);
  7138. const CustomTypeface& operator= (const CustomTypeface&);
  7139. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7140. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7141. };
  7142. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7143. /********* End of inlined file: juce_Typeface.h *********/
  7144. class LowLevelGraphicsContext;
  7145. class JUCE_API Font
  7146. {
  7147. public:
  7148. enum FontStyleFlags
  7149. {
  7150. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7151. bold = 1, /**< boldens the font. @see setStyleFlags */
  7152. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7153. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7154. };
  7155. Font (const float fontHeight,
  7156. const int styleFlags = plain) throw();
  7157. Font (const String& typefaceName,
  7158. const float fontHeight,
  7159. const int styleFlags) throw();
  7160. Font (const Font& other) throw();
  7161. Font (const Typeface::Ptr& typeface) throw();
  7162. Font() throw();
  7163. const Font& operator= (const Font& other) throw();
  7164. bool operator== (const Font& other) const throw();
  7165. bool operator!= (const Font& other) const throw();
  7166. ~Font() throw();
  7167. void setTypefaceName (const String& faceName) throw();
  7168. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7169. static const String getDefaultSansSerifFontName() throw();
  7170. static const String getDefaultSerifFontName() throw();
  7171. static const String getDefaultMonospacedFontName() throw();
  7172. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7173. float getHeight() const throw() { return font->height; }
  7174. void setHeight (float newHeight) throw();
  7175. void setHeightWithoutChangingWidth (float newHeight) throw();
  7176. float getAscent() const throw();
  7177. float getDescent() const throw();
  7178. int getStyleFlags() const throw() { return font->styleFlags; }
  7179. void setStyleFlags (const int newFlags) throw();
  7180. void setBold (const bool shouldBeBold) throw();
  7181. bool isBold() const throw();
  7182. void setItalic (const bool shouldBeItalic) throw();
  7183. bool isItalic() const throw();
  7184. void setUnderline (const bool shouldBeUnderlined) throw();
  7185. bool isUnderlined() const throw();
  7186. void setHorizontalScale (const float scaleFactor) throw();
  7187. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7188. void setExtraKerningFactor (const float extraKerning) throw();
  7189. float getExtraKerningFactor() const throw() { return font->kerning; }
  7190. void setSizeAndStyle (float newHeight,
  7191. const int newStyleFlags,
  7192. const float newHorizontalScale,
  7193. const float newKerningAmount) throw();
  7194. int getStringWidth (const String& text) const throw();
  7195. float getStringWidthFloat (const String& text) const throw();
  7196. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7197. Typeface* getTypeface() const throw();
  7198. static void findFonts (OwnedArray<Font>& results) throw();
  7199. static const StringArray findAllTypefaceNames() throw();
  7200. static const String getFallbackFontName() throw();
  7201. static void setFallbackFontName (const String& name) throw();
  7202. juce_UseDebuggingNewOperator
  7203. private:
  7204. friend class FontGlyphAlphaMap;
  7205. friend class TypefaceCache;
  7206. class SharedFontInternal : public ReferenceCountedObject
  7207. {
  7208. public:
  7209. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7210. const float kerning, const float ascent, const int styleFlags,
  7211. Typeface* const typeface) throw();
  7212. SharedFontInternal (const SharedFontInternal& other) throw();
  7213. String typefaceName;
  7214. float height, horizontalScale, kerning, ascent;
  7215. int styleFlags;
  7216. Typeface::Ptr typeface;
  7217. };
  7218. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7219. void dupeInternalIfShared() throw();
  7220. };
  7221. #endif // __JUCE_FONT_JUCEHEADER__
  7222. /********* End of inlined file: juce_Font.h *********/
  7223. /********* Start of inlined file: juce_PathStrokeType.h *********/
  7224. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7225. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7226. class JUCE_API PathStrokeType
  7227. {
  7228. public:
  7229. enum JointStyle
  7230. {
  7231. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7232. Note that for angles that curve back on themselves, drawing a
  7233. mitre could require extending the point too far away from the
  7234. path, so a mitre limit is imposed and any corners that exceed it
  7235. are drawn as bevelled instead. */
  7236. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7237. beveled /**< Indicates that corners should be drawn with a line flattening their
  7238. outside edge. */
  7239. };
  7240. enum EndCapStyle
  7241. {
  7242. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7243. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7244. the thickness of the stroke. */
  7245. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7246. };
  7247. PathStrokeType (const float strokeThickness,
  7248. const JointStyle jointStyle = mitered,
  7249. const EndCapStyle endStyle = butt) throw();
  7250. PathStrokeType (const PathStrokeType& other) throw();
  7251. const PathStrokeType& operator= (const PathStrokeType& other) throw();
  7252. ~PathStrokeType() throw();
  7253. void createStrokedPath (Path& destPath,
  7254. const Path& sourcePath,
  7255. const AffineTransform& transform = AffineTransform::identity,
  7256. const float extraAccuracy = 1.0f) const throw();
  7257. void createDashedStroke (Path& destPath,
  7258. const Path& sourcePath,
  7259. const float* dashLengths,
  7260. int numDashLengths,
  7261. const AffineTransform& transform = AffineTransform::identity,
  7262. const float extraAccuracy = 1.0f) const throw();
  7263. float getStrokeThickness() const throw() { return thickness; }
  7264. JointStyle getJointStyle() const throw() { return jointStyle; }
  7265. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7266. juce_UseDebuggingNewOperator
  7267. bool operator== (const PathStrokeType& other) const throw();
  7268. bool operator!= (const PathStrokeType& other) const throw();
  7269. private:
  7270. float thickness;
  7271. JointStyle jointStyle;
  7272. EndCapStyle endStyle;
  7273. };
  7274. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7275. /********* End of inlined file: juce_PathStrokeType.h *********/
  7276. /********* Start of inlined file: juce_Line.h *********/
  7277. #ifndef __JUCE_LINE_JUCEHEADER__
  7278. #define __JUCE_LINE_JUCEHEADER__
  7279. class JUCE_API Line
  7280. {
  7281. public:
  7282. Line() throw();
  7283. Line (const Line& other) throw();
  7284. Line (const float startX,
  7285. const float startY,
  7286. const float endX,
  7287. const float endY) throw();
  7288. Line (const Point& start,
  7289. const Point& end) throw();
  7290. const Line& operator= (const Line& other) throw();
  7291. ~Line() throw();
  7292. inline float getStartX() const throw() { return startX; }
  7293. inline float getStartY() const throw() { return startY; }
  7294. inline float getEndX() const throw() { return endX; }
  7295. inline float getEndY() const throw() { return endY; }
  7296. const Point getStart() const throw();
  7297. const Point getEnd() const throw();
  7298. void setStart (const float newStartX,
  7299. const float newStartY) throw();
  7300. void setEnd (const float newEndX,
  7301. const float newEndY) throw();
  7302. void setStart (const Point& newStart) throw();
  7303. void setEnd (const Point& newEnd) throw();
  7304. void applyTransform (const AffineTransform& transform) throw();
  7305. float getLength() const throw();
  7306. bool isVertical() const throw();
  7307. bool isHorizontal() const throw();
  7308. float getAngle() const throw();
  7309. bool operator== (const Line& other) const throw();
  7310. bool operator!= (const Line& other) const throw();
  7311. bool intersects (const Line& line,
  7312. float& intersectionX,
  7313. float& intersectionY) const throw();
  7314. const Point getPointAlongLine (const float distanceFromStart) const throw();
  7315. const Point getPointAlongLine (const float distanceFromStart,
  7316. const float perpendicularDistance) const throw();
  7317. const Point getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7318. float getDistanceFromLine (const float x,
  7319. const float y) const throw();
  7320. float findNearestPointTo (const float x,
  7321. const float y) const throw();
  7322. bool isPointAbove (const float x, const float y) const throw();
  7323. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7324. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7325. bool clipToPath (const Path& path,
  7326. const bool keepSectionOutsidePath) throw();
  7327. juce_UseDebuggingNewOperator
  7328. private:
  7329. float startX, startY, endX, endY;
  7330. };
  7331. #endif // __JUCE_LINE_JUCEHEADER__
  7332. /********* End of inlined file: juce_Line.h *********/
  7333. /********* Start of inlined file: juce_Colours.h *********/
  7334. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7335. #define __JUCE_COLOURS_JUCEHEADER__
  7336. /********* Start of inlined file: juce_Colour.h *********/
  7337. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7338. #define __JUCE_COLOUR_JUCEHEADER__
  7339. /********* Start of inlined file: juce_PixelFormats.h *********/
  7340. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7341. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7342. #if JUCE_MSVC
  7343. #pragma pack (push, 1)
  7344. #define PACKED
  7345. #elif JUCE_GCC
  7346. #define PACKED __attribute__((packed))
  7347. #else
  7348. #define PACKED
  7349. #endif
  7350. class PixelRGB;
  7351. class PixelAlpha;
  7352. class JUCE_API PixelARGB
  7353. {
  7354. public:
  7355. PixelARGB() throw() {}
  7356. ~PixelARGB() throw() {}
  7357. PixelARGB (const uint32 argb_) throw()
  7358. : argb (argb_)
  7359. {
  7360. }
  7361. forcedinline uint32 getARGB() const throw() { return argb; }
  7362. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7363. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7364. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7365. forcedinline uint8 getRed() const throw() { return components.r; }
  7366. forcedinline uint8 getGreen() const throw() { return components.g; }
  7367. forcedinline uint8 getBlue() const throw() { return components.b; }
  7368. forcedinline void blend (const PixelARGB& src) throw()
  7369. {
  7370. uint32 sargb = src.getARGB();
  7371. const uint32 alpha = 0x100 - (sargb >> 24);
  7372. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7373. sargb += 0xff00ff00 & (getAG() * alpha);
  7374. argb = sargb;
  7375. }
  7376. forcedinline void blend (const PixelAlpha& src) throw();
  7377. forcedinline void blend (const PixelRGB& src) throw();
  7378. template <class Pixel>
  7379. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7380. {
  7381. ++extraAlpha;
  7382. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7383. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7384. const uint32 alpha = 0x100 - (sargb >> 24);
  7385. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7386. sargb += 0xff00ff00 & (getAG() * alpha);
  7387. argb = sargb;
  7388. }
  7389. template <class Pixel>
  7390. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7391. {
  7392. uint32 drb = getRB();
  7393. drb += (((src.getRB() - drb) * amount) >> 8);
  7394. drb &= 0x00ff00ff;
  7395. uint32 dag = getAG();
  7396. dag += (((src.getAG() - dag) * amount) >> 8);
  7397. dag &= 0x00ff00ff;
  7398. dag <<= 8;
  7399. dag |= drb;
  7400. argb = dag;
  7401. }
  7402. template <class Pixel>
  7403. forcedinline void set (const Pixel& src) throw()
  7404. {
  7405. argb = src.getARGB();
  7406. }
  7407. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7408. {
  7409. components.a = newAlpha;
  7410. }
  7411. forcedinline void multiplyAlpha (int multiplier) throw()
  7412. {
  7413. ++multiplier;
  7414. argb = ((multiplier * getAG()) & 0xff00ff00)
  7415. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7416. }
  7417. forcedinline void multiplyAlpha (const float multiplier) throw()
  7418. {
  7419. multiplyAlpha ((int) (multiplier * 256.0f));
  7420. }
  7421. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7422. {
  7423. components.b = b;
  7424. components.g = g;
  7425. components.r = r;
  7426. components.a = a;
  7427. }
  7428. forcedinline void premultiply() throw()
  7429. {
  7430. const uint32 alpha = components.a;
  7431. if (alpha < 0xff)
  7432. {
  7433. if (alpha == 0)
  7434. {
  7435. components.b = 0;
  7436. components.g = 0;
  7437. components.r = 0;
  7438. }
  7439. else
  7440. {
  7441. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7442. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7443. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7444. }
  7445. }
  7446. }
  7447. forcedinline void unpremultiply() throw()
  7448. {
  7449. const uint32 alpha = components.a;
  7450. if (alpha < 0xff)
  7451. {
  7452. if (alpha == 0)
  7453. {
  7454. components.b = 0;
  7455. components.g = 0;
  7456. components.r = 0;
  7457. }
  7458. else
  7459. {
  7460. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7461. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7462. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7463. }
  7464. }
  7465. }
  7466. forcedinline void desaturate() throw()
  7467. {
  7468. if (components.a < 0xff && components.a > 0)
  7469. {
  7470. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7471. components.r = components.g = components.b
  7472. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7473. }
  7474. else
  7475. {
  7476. components.r = components.g = components.b
  7477. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7478. }
  7479. }
  7480. #if JUCE_BIG_ENDIAN
  7481. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7482. #else
  7483. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7484. #endif
  7485. private:
  7486. union
  7487. {
  7488. uint32 argb;
  7489. struct
  7490. {
  7491. #if JUCE_BIG_ENDIAN
  7492. uint8 a : 8, r : 8, g : 8, b : 8;
  7493. #else
  7494. uint8 b, g, r, a;
  7495. #endif
  7496. } PACKED components;
  7497. };
  7498. } PACKED;
  7499. class JUCE_API PixelRGB
  7500. {
  7501. public:
  7502. PixelRGB() throw() {}
  7503. ~PixelRGB() throw() {}
  7504. PixelRGB (const uint32 argb) throw()
  7505. {
  7506. r = (uint8) (argb >> 16);
  7507. g = (uint8) (argb >> 8);
  7508. b = (uint8) (argb);
  7509. }
  7510. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7511. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7512. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7513. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7514. forcedinline uint8 getRed() const throw() { return r; }
  7515. forcedinline uint8 getGreen() const throw() { return g; }
  7516. forcedinline uint8 getBlue() const throw() { return b; }
  7517. forcedinline void blend (const PixelARGB& src) throw()
  7518. {
  7519. uint32 sargb = src.getARGB();
  7520. const uint32 alpha = 0x100 - (sargb >> 24);
  7521. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7522. sargb += 0x0000ff00 & (g * alpha);
  7523. r = (uint8) (sargb >> 16);
  7524. g = (uint8) (sargb >> 8);
  7525. b = (uint8) sargb;
  7526. }
  7527. forcedinline void blend (const PixelRGB& src) throw()
  7528. {
  7529. set (src);
  7530. }
  7531. forcedinline void blend (const PixelAlpha& src) throw();
  7532. template <class Pixel>
  7533. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7534. {
  7535. ++extraAlpha;
  7536. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7537. const uint32 sag = extraAlpha * src.getAG();
  7538. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7539. const uint32 alpha = 0x100 - (sargb >> 24);
  7540. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7541. sargb += 0x0000ff00 & (g * alpha);
  7542. b = (uint8) sargb;
  7543. g = (uint8) (sargb >> 8);
  7544. r = (uint8) (sargb >> 16);
  7545. }
  7546. template <class Pixel>
  7547. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7548. {
  7549. uint32 drb = getRB();
  7550. drb += (((src.getRB() - drb) * amount) >> 8);
  7551. uint32 dag = getAG();
  7552. dag += (((src.getAG() - dag) * amount) >> 8);
  7553. b = (uint8) drb;
  7554. g = (uint8) dag;
  7555. r = (uint8) (drb >> 16);
  7556. }
  7557. template <class Pixel>
  7558. forcedinline void set (const Pixel& src) throw()
  7559. {
  7560. b = src.getBlue();
  7561. g = src.getGreen();
  7562. r = src.getRed();
  7563. }
  7564. forcedinline void setAlpha (const uint8) throw() {}
  7565. forcedinline void multiplyAlpha (int) throw() {}
  7566. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7567. {
  7568. r = r_;
  7569. g = g_;
  7570. b = b_;
  7571. }
  7572. forcedinline void premultiply() throw() {}
  7573. forcedinline void unpremultiply() throw() {}
  7574. forcedinline void desaturate() throw()
  7575. {
  7576. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7577. }
  7578. #if JUCE_MAC
  7579. enum { indexR = 0, indexG = 1, indexB = 2 };
  7580. #else
  7581. enum { indexR = 2, indexG = 1, indexB = 0 };
  7582. #endif
  7583. private:
  7584. #if JUCE_MAC
  7585. uint8 r, g, b;
  7586. #else
  7587. uint8 b, g, r;
  7588. #endif
  7589. } PACKED;
  7590. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7591. {
  7592. set (src);
  7593. }
  7594. class JUCE_API PixelAlpha
  7595. {
  7596. public:
  7597. PixelAlpha() throw() {}
  7598. ~PixelAlpha() throw() {}
  7599. PixelAlpha (const uint32 argb) throw()
  7600. {
  7601. a = (uint8) (argb >> 24);
  7602. }
  7603. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7604. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7605. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7606. forcedinline uint8 getAlpha() const throw() { return a; }
  7607. forcedinline uint8 getRed() const throw() { return 0; }
  7608. forcedinline uint8 getGreen() const throw() { return 0; }
  7609. forcedinline uint8 getBlue() const throw() { return 0; }
  7610. template <class Pixel>
  7611. forcedinline void blend (const Pixel& src) throw()
  7612. {
  7613. const int srcA = src.getAlpha();
  7614. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7615. }
  7616. template <class Pixel>
  7617. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7618. {
  7619. ++extraAlpha;
  7620. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  7621. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  7622. }
  7623. template <class Pixel>
  7624. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7625. {
  7626. a += ((src,getAlpha() - a) * amount) >> 8;
  7627. }
  7628. template <class Pixel>
  7629. forcedinline void set (const Pixel& src) throw()
  7630. {
  7631. a = src.getAlpha();
  7632. }
  7633. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7634. {
  7635. a = newAlpha;
  7636. }
  7637. forcedinline void multiplyAlpha (int multiplier) throw()
  7638. {
  7639. ++multiplier;
  7640. a = (uint8) ((a * multiplier) >> 8);
  7641. }
  7642. forcedinline void multiplyAlpha (const float multiplier) throw()
  7643. {
  7644. a = (uint8) (a * multiplier);
  7645. }
  7646. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  7647. {
  7648. a = a_;
  7649. }
  7650. forcedinline void premultiply() throw()
  7651. {
  7652. }
  7653. forcedinline void unpremultiply() throw()
  7654. {
  7655. }
  7656. forcedinline void desaturate() throw()
  7657. {
  7658. }
  7659. private:
  7660. uint8 a : 8;
  7661. } PACKED;
  7662. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  7663. {
  7664. blend (PixelARGB (src.getARGB()));
  7665. }
  7666. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  7667. {
  7668. uint32 sargb = src.getARGB();
  7669. const uint32 alpha = 0x100 - (sargb >> 24);
  7670. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7671. sargb += 0xff00ff00 & (getAG() * alpha);
  7672. argb = sargb;
  7673. }
  7674. #if JUCE_MSVC
  7675. #pragma pack (pop)
  7676. #endif
  7677. #undef PACKED
  7678. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  7679. /********* End of inlined file: juce_PixelFormats.h *********/
  7680. class JUCE_API Colour
  7681. {
  7682. public:
  7683. Colour() throw();
  7684. Colour (const Colour& other) throw();
  7685. explicit Colour (const uint32 argb) throw();
  7686. Colour (const uint8 red,
  7687. const uint8 green,
  7688. const uint8 blue) throw();
  7689. static const Colour fromRGB (const uint8 red,
  7690. const uint8 green,
  7691. const uint8 blue) throw();
  7692. Colour (const uint8 red,
  7693. const uint8 green,
  7694. const uint8 blue,
  7695. const uint8 alpha) throw();
  7696. static const Colour fromRGBA (const uint8 red,
  7697. const uint8 green,
  7698. const uint8 blue,
  7699. const uint8 alpha) throw();
  7700. Colour (const uint8 red,
  7701. const uint8 green,
  7702. const uint8 blue,
  7703. const float alpha) throw();
  7704. static const Colour fromRGBAFloat (const uint8 red,
  7705. const uint8 green,
  7706. const uint8 blue,
  7707. const float alpha) throw();
  7708. Colour (const float hue,
  7709. const float saturation,
  7710. const float brightness,
  7711. const uint8 alpha) throw();
  7712. Colour (const float hue,
  7713. const float saturation,
  7714. const float brightness,
  7715. const float alpha) throw();
  7716. static const Colour fromHSV (const float hue,
  7717. const float saturation,
  7718. const float brightness,
  7719. const float alpha) throw();
  7720. ~Colour() throw();
  7721. const Colour& operator= (const Colour& other) throw();
  7722. bool operator== (const Colour& other) const throw();
  7723. bool operator!= (const Colour& other) const throw();
  7724. uint8 getRed() const throw() { return argb.getRed(); }
  7725. uint8 getGreen() const throw() { return argb.getGreen(); }
  7726. uint8 getBlue() const throw() { return argb.getBlue(); }
  7727. float getFloatRed() const throw();
  7728. float getFloatGreen() const throw();
  7729. float getFloatBlue() const throw();
  7730. const PixelARGB getPixelARGB() const throw();
  7731. uint32 getARGB() const throw();
  7732. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  7733. float getFloatAlpha() const throw();
  7734. bool isOpaque() const throw();
  7735. bool isTransparent() const throw();
  7736. const Colour withAlpha (const uint8 newAlpha) const throw();
  7737. const Colour withAlpha (const float newAlpha) const throw();
  7738. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  7739. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  7740. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  7741. float getHue() const throw();
  7742. float getSaturation() const throw();
  7743. float getBrightness() const throw();
  7744. void getHSB (float& hue,
  7745. float& saturation,
  7746. float& brightness) const throw();
  7747. const Colour withHue (const float newHue) const throw();
  7748. const Colour withSaturation (const float newSaturation) const throw();
  7749. const Colour withBrightness (const float newBrightness) const throw();
  7750. const Colour withRotatedHue (const float amountToRotate) const throw();
  7751. const Colour withMultipliedSaturation (const float multiplier) const throw();
  7752. const Colour withMultipliedBrightness (const float amount) const throw();
  7753. const Colour brighter (float amountBrighter = 0.4f) const throw();
  7754. const Colour darker (float amountDarker = 0.4f) const throw();
  7755. const Colour contrasting (const float amount = 1.0f) const throw();
  7756. static const Colour contrasting (const Colour& colour1,
  7757. const Colour& colour2) throw();
  7758. static const Colour greyLevel (const float brightness) throw();
  7759. const String toString() const throw();
  7760. static const Colour fromString (const String& encodedColourString);
  7761. juce_UseDebuggingNewOperator
  7762. private:
  7763. PixelARGB argb;
  7764. };
  7765. #endif // __JUCE_COLOUR_JUCEHEADER__
  7766. /********* End of inlined file: juce_Colour.h *********/
  7767. class Colours
  7768. {
  7769. public:
  7770. static JUCE_API const Colour
  7771. transparentBlack, /**< ARGB = 0x00000000 */
  7772. transparentWhite, /**< ARGB = 0x00ffffff */
  7773. black, /**< ARGB = 0xff000000 */
  7774. white, /**< ARGB = 0xffffffff */
  7775. blue, /**< ARGB = 0xff0000ff */
  7776. grey, /**< ARGB = 0xff808080 */
  7777. green, /**< ARGB = 0xff008000 */
  7778. red, /**< ARGB = 0xffff0000 */
  7779. yellow, /**< ARGB = 0xffffff00 */
  7780. aliceblue, antiquewhite, aqua, aquamarine,
  7781. azure, beige, bisque, blanchedalmond,
  7782. blueviolet, brown, burlywood, cadetblue,
  7783. chartreuse, chocolate, coral, cornflowerblue,
  7784. cornsilk, crimson, cyan, darkblue,
  7785. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  7786. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  7787. darkorchid, darkred, darksalmon, darkseagreen,
  7788. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  7789. deeppink, deepskyblue, dimgrey, dodgerblue,
  7790. firebrick, floralwhite, forestgreen, fuchsia,
  7791. gainsboro, gold, goldenrod, greenyellow,
  7792. honeydew, hotpink, indianred, indigo,
  7793. ivory, khaki, lavender, lavenderblush,
  7794. lemonchiffon, lightblue, lightcoral, lightcyan,
  7795. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  7796. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  7797. lightsteelblue, lightyellow, lime, limegreen,
  7798. linen, magenta, maroon, mediumaquamarine,
  7799. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  7800. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  7801. midnightblue, mintcream, mistyrose, navajowhite,
  7802. navy, oldlace, olive, olivedrab,
  7803. orange, orangered, orchid, palegoldenrod,
  7804. palegreen, paleturquoise, palevioletred, papayawhip,
  7805. peachpuff, peru, pink, plum,
  7806. powderblue, purple, rosybrown, royalblue,
  7807. saddlebrown, salmon, sandybrown, seagreen,
  7808. seashell, sienna, silver, skyblue,
  7809. slateblue, slategrey, snow, springgreen,
  7810. steelblue, tan, teal, thistle,
  7811. tomato, turquoise, violet, wheat,
  7812. whitesmoke, yellowgreen;
  7813. static JUCE_API const Colour findColourForName (const String& colourName,
  7814. const Colour& defaultColour);
  7815. private:
  7816. // this isn't a class you should ever instantiate - it's just here for the
  7817. // static values in it.
  7818. Colours();
  7819. };
  7820. #endif // __JUCE_COLOURS_JUCEHEADER__
  7821. /********* End of inlined file: juce_Colours.h *********/
  7822. /********* Start of inlined file: juce_FillType.h *********/
  7823. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  7824. #define __JUCE_FILLTYPE_JUCEHEADER__
  7825. /********* Start of inlined file: juce_ColourGradient.h *********/
  7826. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  7827. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  7828. class JUCE_API ColourGradient
  7829. {
  7830. public:
  7831. ColourGradient (const Colour& colour1,
  7832. const float x1,
  7833. const float y1,
  7834. const Colour& colour2,
  7835. const float x2,
  7836. const float y2,
  7837. const bool isRadial) throw();
  7838. ColourGradient() throw();
  7839. ~ColourGradient() throw();
  7840. void clearColours() throw();
  7841. void addColour (const double proportionAlongGradient,
  7842. const Colour& colour) throw();
  7843. void multiplyOpacity (const float multiplier) throw();
  7844. int getNumColours() const throw();
  7845. double getColourPosition (const int index) const throw();
  7846. const Colour getColour (const int index) const throw();
  7847. const Colour getColourAtPosition (const float position) const throw();
  7848. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  7849. bool isOpaque() const throw();
  7850. bool isInvisible() const throw();
  7851. float x1;
  7852. float y1;
  7853. float x2;
  7854. float y2;
  7855. bool isRadial;
  7856. juce_UseDebuggingNewOperator
  7857. private:
  7858. Array <uint32> colours;
  7859. };
  7860. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  7861. /********* End of inlined file: juce_ColourGradient.h *********/
  7862. class Image;
  7863. class JUCE_API FillType
  7864. {
  7865. public:
  7866. FillType() throw();
  7867. FillType (const Colour& colour) throw();
  7868. FillType (const ColourGradient& gradient) throw();
  7869. FillType (const Image& image, const AffineTransform& transform) throw();
  7870. FillType (const FillType& other) throw();
  7871. const FillType& operator= (const FillType& other) throw();
  7872. ~FillType() throw();
  7873. bool isColour() const throw() { return gradient == 0 && image == 0; }
  7874. bool isGradient() const throw() { return gradient != 0; }
  7875. bool isTiledImage() const throw() { return image != 0; }
  7876. void setColour (const Colour& newColour) throw();
  7877. void setGradient (const ColourGradient& newGradient) throw();
  7878. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  7879. void setOpacity (const float newOpacity) throw();
  7880. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  7881. Colour colour;
  7882. ScopedPointer <ColourGradient> gradient;
  7883. const Image* image;
  7884. AffineTransform transform;
  7885. juce_UseDebuggingNewOperator
  7886. };
  7887. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  7888. /********* End of inlined file: juce_FillType.h *********/
  7889. /********* Start of inlined file: juce_RectanglePlacement.h *********/
  7890. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7891. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7892. class JUCE_API RectanglePlacement
  7893. {
  7894. public:
  7895. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  7896. RectanglePlacement (const RectanglePlacement& other) throw();
  7897. const RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  7898. enum
  7899. {
  7900. xLeft = 1,
  7901. xRight = 2,
  7902. xMid = 4,
  7903. yTop = 8,
  7904. yBottom = 16,
  7905. yMid = 32,
  7906. stretchToFit = 64,
  7907. fillDestination = 128,
  7908. onlyReduceInSize = 256,
  7909. onlyIncreaseInSize = 512,
  7910. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  7911. centred = 4 + 32
  7912. };
  7913. inline int getFlags() const throw() { return flags; }
  7914. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7915. void applyTo (double& sourceX,
  7916. double& sourceY,
  7917. double& sourceW,
  7918. double& sourceH,
  7919. const double destinationX,
  7920. const double destinationY,
  7921. const double destinationW,
  7922. const double destinationH) const throw();
  7923. const AffineTransform getTransformToFit (float sourceX,
  7924. float sourceY,
  7925. float sourceW,
  7926. float sourceH,
  7927. const float destinationX,
  7928. const float destinationY,
  7929. const float destinationW,
  7930. const float destinationH) const throw();
  7931. private:
  7932. int flags;
  7933. };
  7934. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7935. /********* End of inlined file: juce_RectanglePlacement.h *********/
  7936. class LowLevelGraphicsContext;
  7937. class Image;
  7938. class RectangleList;
  7939. class JUCE_API Graphics
  7940. {
  7941. public:
  7942. Graphics (Image& imageToDrawOnto) throw();
  7943. ~Graphics() throw();
  7944. void setColour (const Colour& newColour) throw();
  7945. void setOpacity (const float newOpacity) throw();
  7946. void setGradientFill (const ColourGradient& gradient) throw();
  7947. void setTiledImageFill (const Image& imageToUse,
  7948. const int anchorX,
  7949. const int anchorY,
  7950. const float opacity) throw();
  7951. void setFillType (const FillType& newFill) throw();
  7952. void setFont (const Font& newFont) throw();
  7953. void setFont (const float newFontHeight,
  7954. const int fontStyleFlags = Font::plain) throw();
  7955. void drawSingleLineText (const String& text,
  7956. const int startX,
  7957. const int baselineY) const throw();
  7958. void drawMultiLineText (const String& text,
  7959. const int startX,
  7960. const int baselineY,
  7961. const int maximumLineWidth) const throw();
  7962. void drawTextAsPath (const String& text,
  7963. const AffineTransform& transform) const throw();
  7964. void drawText (const String& text,
  7965. const int x,
  7966. const int y,
  7967. const int width,
  7968. const int height,
  7969. const Justification& justificationType,
  7970. const bool useEllipsesIfTooBig) const throw();
  7971. void drawFittedText (const String& text,
  7972. const int x,
  7973. const int y,
  7974. const int width,
  7975. const int height,
  7976. const Justification& justificationFlags,
  7977. const int maximumNumberOfLines,
  7978. const float minimumHorizontalScale = 0.7f) const throw();
  7979. void fillAll() const throw();
  7980. void fillAll (const Colour& colourToUse) const throw();
  7981. void fillRect (int x,
  7982. int y,
  7983. int width,
  7984. int height) const throw();
  7985. void fillRect (const Rectangle& rectangle) const throw();
  7986. void fillRect (const float x,
  7987. const float y,
  7988. const float width,
  7989. const float height) const throw();
  7990. void fillRoundedRectangle (const float x,
  7991. const float y,
  7992. const float width,
  7993. const float height,
  7994. const float cornerSize) const throw();
  7995. void fillRoundedRectangle (const Rectangle& rectangle,
  7996. const float cornerSize) const throw();
  7997. void fillCheckerBoard (int x, int y,
  7998. int width, int height,
  7999. const int checkWidth,
  8000. const int checkHeight,
  8001. const Colour& colour1,
  8002. const Colour& colour2) const throw();
  8003. void drawRect (const int x,
  8004. const int y,
  8005. const int width,
  8006. const int height,
  8007. const int lineThickness = 1) const throw();
  8008. void drawRect (const float x,
  8009. const float y,
  8010. const float width,
  8011. const float height,
  8012. const float lineThickness = 1.0f) const throw();
  8013. void drawRect (const Rectangle& rectangle,
  8014. const int lineThickness = 1) const throw();
  8015. void drawRoundedRectangle (const float x,
  8016. const float y,
  8017. const float width,
  8018. const float height,
  8019. const float cornerSize,
  8020. const float lineThickness) const throw();
  8021. void drawRoundedRectangle (const Rectangle& rectangle,
  8022. const float cornerSize,
  8023. const float lineThickness) const throw();
  8024. void drawBevel (const int x,
  8025. const int y,
  8026. const int width,
  8027. const int height,
  8028. const int bevelThickness,
  8029. const Colour& topLeftColour = Colours::white,
  8030. const Colour& bottomRightColour = Colours::black,
  8031. const bool useGradient = true,
  8032. const bool sharpEdgeOnOutside = true) const throw();
  8033. void setPixel (int x, int y) const throw();
  8034. void fillEllipse (const float x,
  8035. const float y,
  8036. const float width,
  8037. const float height) const throw();
  8038. void drawEllipse (const float x,
  8039. const float y,
  8040. const float width,
  8041. const float height,
  8042. const float lineThickness) const throw();
  8043. void drawLine (float startX,
  8044. float startY,
  8045. float endX,
  8046. float endY) const throw();
  8047. void drawLine (const float startX,
  8048. const float startY,
  8049. const float endX,
  8050. const float endY,
  8051. const float lineThickness) const throw();
  8052. void drawLine (const Line& line) const throw();
  8053. void drawLine (const Line& line,
  8054. const float lineThickness) const throw();
  8055. void drawDashedLine (const float startX,
  8056. const float startY,
  8057. const float endX,
  8058. const float endY,
  8059. const float* const dashLengths,
  8060. const int numDashLengths,
  8061. const float lineThickness = 1.0f) const throw();
  8062. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8063. void drawHorizontalLine (const int y, float left, float right) const throw();
  8064. void fillPath (const Path& path,
  8065. const AffineTransform& transform = AffineTransform::identity) const throw();
  8066. void strokePath (const Path& path,
  8067. const PathStrokeType& strokeType,
  8068. const AffineTransform& transform = AffineTransform::identity) const throw();
  8069. void drawArrow (const float startX,
  8070. const float startY,
  8071. const float endX,
  8072. const float endY,
  8073. const float lineThickness,
  8074. const float arrowheadWidth,
  8075. const float arrowheadLength) const throw();
  8076. enum ResamplingQuality
  8077. {
  8078. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8079. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8080. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8081. };
  8082. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8083. void drawImageAt (const Image* const imageToDraw,
  8084. const int topLeftX,
  8085. const int topLeftY,
  8086. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8087. void drawImage (const Image* const imageToDraw,
  8088. int destX,
  8089. int destY,
  8090. int destWidth,
  8091. int destHeight,
  8092. int sourceX,
  8093. int sourceY,
  8094. int sourceWidth,
  8095. int sourceHeight,
  8096. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8097. void drawImageTransformed (const Image* const imageToDraw,
  8098. const Rectangle& imageSubRegion,
  8099. const AffineTransform& transform,
  8100. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8101. void drawImageWithin (const Image* const imageToDraw,
  8102. const int destX,
  8103. const int destY,
  8104. const int destWidth,
  8105. const int destHeight,
  8106. const RectanglePlacement& placementWithinTarget,
  8107. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8108. const Rectangle getClipBounds() const throw();
  8109. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8110. bool reduceClipRegion (const int x, const int y,
  8111. const int width, const int height) throw();
  8112. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8113. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8114. bool reduceClipRegion (const Image& image, const Rectangle& sourceClipRegion,
  8115. const AffineTransform& transform) throw();
  8116. void excludeClipRegion (const int x, const int y,
  8117. const int width, const int height) throw();
  8118. bool isClipEmpty() const throw();
  8119. void saveState() throw();
  8120. void restoreState() throw();
  8121. void setOrigin (const int newOriginX,
  8122. const int newOriginY) throw();
  8123. void resetToDefaultState() throw();
  8124. bool isVectorDevice() const throw();
  8125. juce_UseDebuggingNewOperator
  8126. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8127. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8128. private:
  8129. LowLevelGraphicsContext* const context;
  8130. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8131. bool saveStatePending;
  8132. void saveStateIfPending() throw();
  8133. const Graphics& operator= (const Graphics& other);
  8134. Graphics (const Graphics&);
  8135. };
  8136. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8137. /********* End of inlined file: juce_Graphics.h *********/
  8138. class JUCE_API ImageEffectFilter
  8139. {
  8140. public:
  8141. virtual void applyEffect (Image& sourceImage,
  8142. Graphics& destContext) = 0;
  8143. virtual ~ImageEffectFilter() {}
  8144. };
  8145. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8146. /********* End of inlined file: juce_ImageEffectFilter.h *********/
  8147. /********* Start of inlined file: juce_RectangleList.h *********/
  8148. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8149. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8150. class JUCE_API RectangleList
  8151. {
  8152. public:
  8153. RectangleList() throw();
  8154. RectangleList (const RectangleList& other) throw();
  8155. RectangleList (const Rectangle& rect) throw();
  8156. const RectangleList& operator= (const RectangleList& other) throw();
  8157. ~RectangleList() throw();
  8158. bool isEmpty() const throw();
  8159. int getNumRectangles() const throw() { return rects.size(); }
  8160. const Rectangle getRectangle (const int index) const throw();
  8161. void clear() throw();
  8162. void add (const int x, const int y,
  8163. const int w, const int h) throw();
  8164. void add (const Rectangle& rect) throw();
  8165. void addWithoutMerging (const Rectangle& rect) throw();
  8166. void add (const RectangleList& other) throw();
  8167. void subtract (const Rectangle& rect) throw();
  8168. void subtract (const RectangleList& otherList) throw();
  8169. bool clipTo (const Rectangle& rect) throw();
  8170. bool clipTo (const RectangleList& other) throw();
  8171. bool getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const throw();
  8172. void swapWith (RectangleList& otherList) throw();
  8173. bool containsPoint (const int x, const int y) const throw();
  8174. bool containsRectangle (const Rectangle& rectangleToCheck) const throw();
  8175. bool intersectsRectangle (const Rectangle& rectangleToCheck) const throw();
  8176. bool intersects (const RectangleList& other) const throw();
  8177. const Rectangle getBounds() const throw();
  8178. void consolidate() throw();
  8179. void offsetAll (const int dx, const int dy) throw();
  8180. const Path toPath() const throw();
  8181. class Iterator
  8182. {
  8183. public:
  8184. Iterator (const RectangleList& list) throw();
  8185. ~Iterator() throw();
  8186. bool next() throw();
  8187. const Rectangle* getRectangle() const throw() { return current; }
  8188. juce_UseDebuggingNewOperator
  8189. private:
  8190. const Rectangle* current;
  8191. const RectangleList& owner;
  8192. int index;
  8193. Iterator (const Iterator&);
  8194. const Iterator& operator= (const Iterator&);
  8195. };
  8196. juce_UseDebuggingNewOperator
  8197. private:
  8198. friend class Iterator;
  8199. Array <Rectangle> rects;
  8200. };
  8201. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8202. /********* End of inlined file: juce_RectangleList.h *********/
  8203. /********* Start of inlined file: juce_BorderSize.h *********/
  8204. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8205. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8206. class JUCE_API BorderSize
  8207. {
  8208. public:
  8209. BorderSize() throw();
  8210. BorderSize (const BorderSize& other) throw();
  8211. BorderSize (const int topGap,
  8212. const int leftGap,
  8213. const int bottomGap,
  8214. const int rightGap) throw();
  8215. BorderSize (const int allGaps) throw();
  8216. ~BorderSize() throw();
  8217. int getTop() const throw() { return top; }
  8218. int getLeft() const throw() { return left; }
  8219. int getBottom() const throw() { return bottom; }
  8220. int getRight() const throw() { return right; }
  8221. int getTopAndBottom() const throw() { return top + bottom; }
  8222. int getLeftAndRight() const throw() { return left + right; }
  8223. void setTop (const int newTopGap) throw();
  8224. void setLeft (const int newLeftGap) throw();
  8225. void setBottom (const int newBottomGap) throw();
  8226. void setRight (const int newRightGap) throw();
  8227. const Rectangle subtractedFrom (const Rectangle& original) const throw();
  8228. void subtractFrom (Rectangle& rectangle) const throw();
  8229. const Rectangle addedTo (const Rectangle& original) const throw();
  8230. void addTo (Rectangle& original) const throw();
  8231. bool operator== (const BorderSize& other) const throw();
  8232. bool operator!= (const BorderSize& other) const throw();
  8233. juce_UseDebuggingNewOperator
  8234. private:
  8235. int top, left, bottom, right;
  8236. };
  8237. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8238. /********* End of inlined file: juce_BorderSize.h *********/
  8239. /********* Start of inlined file: juce_ComponentPeer.h *********/
  8240. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  8241. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  8242. class Component;
  8243. class Graphics;
  8244. class ComponentBoundsConstrainer;
  8245. class ComponentDeletionWatcher;
  8246. class JUCE_API ComponentPeer : public MessageListener
  8247. {
  8248. public:
  8249. enum StyleFlags
  8250. {
  8251. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  8252. entry on the taskbar (ignored on MacOSX) */
  8253. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  8254. tooltip, etc. */
  8255. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  8256. through it (may not be possible on some platforms). */
  8257. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  8258. title bar and frame\. if not specified, the window will be
  8259. borderless. */
  8260. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  8261. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  8262. minimise button on it. */
  8263. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  8264. maximise button on it. */
  8265. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  8266. close button on it. */
  8267. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  8268. not be possible on all platforms). */
  8269. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  8270. do its own repainting, but only to repaint when the
  8271. performAnyPendingRepaintsNow() method is called. */
  8272. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  8273. be used for things like plugin windows, to stop them interfering
  8274. with the host's shortcut keys */
  8275. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  8276. };
  8277. ComponentPeer (Component* const component,
  8278. const int styleFlags) throw();
  8279. virtual ~ComponentPeer();
  8280. Component* getComponent() const throw() { return component; }
  8281. int getStyleFlags() const throw() { return styleFlags; }
  8282. virtual void* getNativeHandle() const = 0;
  8283. virtual void setVisible (bool shouldBeVisible) = 0;
  8284. virtual void setTitle (const String& title) = 0;
  8285. virtual void setPosition (int x, int y) = 0;
  8286. virtual void setSize (int w, int h) = 0;
  8287. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  8288. virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
  8289. virtual int getScreenX() const = 0;
  8290. virtual int getScreenY() const = 0;
  8291. virtual void relativePositionToGlobal (int& x, int& y) = 0;
  8292. virtual void globalPositionToRelative (int& x, int& y) = 0;
  8293. virtual void setMinimised (bool shouldBeMinimised) = 0;
  8294. virtual bool isMinimised() const = 0;
  8295. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  8296. virtual bool isFullScreen() const = 0;
  8297. void setNonFullScreenBounds (const Rectangle& newBounds) throw();
  8298. const Rectangle& getNonFullScreenBounds() const throw();
  8299. virtual void setIcon (const Image& newIcon) = 0;
  8300. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  8301. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  8302. virtual bool contains (int x, int y, bool trueIfInAChildWindow) const = 0;
  8303. virtual const BorderSize getFrameSize() const = 0;
  8304. void handleMovedOrResized();
  8305. void handleScreenSizeChange();
  8306. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  8307. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  8308. virtual void toFront (bool makeActive) = 0;
  8309. virtual void toBehind (ComponentPeer* other) = 0;
  8310. void handleBroughtToFront();
  8311. virtual bool isFocused() const = 0;
  8312. virtual void grabFocus() = 0;
  8313. virtual void textInputRequired (int x, int y) = 0;
  8314. void handleFocusGain();
  8315. void handleFocusLoss();
  8316. Component* getLastFocusedSubcomponent() const throw();
  8317. bool handleKeyPress (const int keyCode,
  8318. const juce_wchar textCharacter);
  8319. bool handleKeyUpOrDown (const bool isKeyDown);
  8320. void handleModifierKeysChange();
  8321. virtual void repaint (int x, int y, int w, int h) = 0;
  8322. virtual void performAnyPendingRepaintsNow() = 0;
  8323. void handleMouseEnter (int x, int y, const int64 time);
  8324. void handleMouseMove (int x, int y, const int64 time);
  8325. void handleMouseDown (int x, int y, const int64 time);
  8326. void handleMouseDrag (int x, int y, const int64 time);
  8327. void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8328. void handleMouseExit (int x, int y, const int64 time);
  8329. void handleMouseWheel (const int amountX, const int amountY, const int64 time);
  8330. void sendFakeMouseMove() throw();
  8331. void handleUserClosingWindow();
  8332. void handleFileDragMove (const StringArray& files, int x, int y);
  8333. void handleFileDragExit (const StringArray& files);
  8334. void handleFileDragDrop (const StringArray& files, int x, int y);
  8335. void clearMaskedRegion() throw();
  8336. void addMaskedRegion (int x, int y, int w, int h) throw();
  8337. static int getNumPeers() throw();
  8338. static ComponentPeer* getPeer (const int index) throw();
  8339. static bool isValidPeer (const ComponentPeer* const peer) throw();
  8340. static void bringModalComponentToFront();
  8341. virtual const StringArray getAvailableRenderingEngines() throw();
  8342. virtual int getCurrentRenderingEngine() throw();
  8343. virtual void setCurrentRenderingEngine (int index) throw();
  8344. juce_UseDebuggingNewOperator
  8345. protected:
  8346. Component* const component;
  8347. const int styleFlags;
  8348. RectangleList maskedRegion;
  8349. Rectangle lastNonFullscreenBounds;
  8350. uint32 lastPaintTime;
  8351. ComponentBoundsConstrainer* constrainer;
  8352. static void updateCurrentModifiers() throw();
  8353. void handleMessage (const Message& message);
  8354. private:
  8355. Component* lastFocusedComponent;
  8356. ScopedPointer <ComponentDeletionWatcher> dragAndDropTargetComponent;
  8357. Component* lastDragAndDropCompUnderMouse;
  8358. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  8359. friend class Component;
  8360. static ComponentPeer* getPeerFor (const Component* const component) throw();
  8361. void setLastDragDropTarget (Component* comp);
  8362. ComponentPeer (const ComponentPeer&);
  8363. const ComponentPeer& operator= (const ComponentPeer&);
  8364. };
  8365. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  8366. /********* End of inlined file: juce_ComponentPeer.h *********/
  8367. class LookAndFeel;
  8368. class JUCE_API Component : public MouseListener,
  8369. protected MessageListener
  8370. {
  8371. public:
  8372. Component() throw();
  8373. virtual ~Component();
  8374. Component (const String& componentName) throw();
  8375. const String& getName() const throw() { return componentName_; }
  8376. virtual void setName (const String& newName);
  8377. bool isValidComponent() const throw();
  8378. virtual void setVisible (bool shouldBeVisible);
  8379. bool isVisible() const throw() { return flags.visibleFlag; }
  8380. virtual void visibilityChanged();
  8381. bool isShowing() const throw();
  8382. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8383. const int deltaXToMove = 0,
  8384. const int deltaYToMove = 0,
  8385. const float scaleFactorAtEnd = 1.0f);
  8386. virtual void addToDesktop (int windowStyleFlags,
  8387. void* nativeWindowToAttachTo = 0);
  8388. void removeFromDesktop();
  8389. bool isOnDesktop() const throw();
  8390. ComponentPeer* getPeer() const throw();
  8391. virtual void userTriedToCloseWindow();
  8392. virtual void minimisationStateChanged (bool isNowMinimised);
  8393. void toFront (const bool shouldAlsoGainFocus);
  8394. void toBack();
  8395. void toBehind (Component* const other);
  8396. void setAlwaysOnTop (const bool shouldStayOnTop);
  8397. bool isAlwaysOnTop() const throw();
  8398. inline int getX() const throw() { return bounds_.getX(); }
  8399. inline int getY() const throw() { return bounds_.getY(); }
  8400. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8401. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8402. int getRight() const throw() { return bounds_.getRight(); }
  8403. int getBottom() const throw() { return bounds_.getBottom(); }
  8404. const Rectangle& getBounds() const throw() { return bounds_; }
  8405. void getVisibleArea (RectangleList& result,
  8406. const bool includeSiblings) const;
  8407. int getScreenX() const throw();
  8408. int getScreenY() const throw();
  8409. void relativePositionToGlobal (int& x, int& y) const throw();
  8410. void globalPositionToRelative (int& x, int& y) const throw();
  8411. void relativePositionToOtherComponent (const Component* const targetComponent,
  8412. int& x, int& y) const throw();
  8413. void setTopLeftPosition (const int x, const int y);
  8414. void setTopRightPosition (const int x, const int y);
  8415. void setSize (const int newWidth, const int newHeight);
  8416. void setBounds (int x, int y, int width, int height);
  8417. void setBounds (const Rectangle& newBounds);
  8418. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8419. const float proportionalWidth, const float proportionalHeight);
  8420. void setBoundsInset (const BorderSize& borders);
  8421. void setBoundsToFit (int x, int y, int width, int height,
  8422. const Justification& justification,
  8423. const bool onlyReduceInSize);
  8424. void setCentrePosition (const int x, const int y);
  8425. void setCentreRelative (const float x, const float y);
  8426. void centreWithSize (const int width, const int height);
  8427. int proportionOfWidth (const float proportion) const throw();
  8428. int proportionOfHeight (const float proportion) const throw();
  8429. int getParentWidth() const throw();
  8430. int getParentHeight() const throw();
  8431. const Rectangle getParentMonitorArea() const throw();
  8432. int getNumChildComponents() const throw();
  8433. Component* getChildComponent (const int index) const throw();
  8434. int getIndexOfChildComponent (const Component* const child) const throw();
  8435. void addChildComponent (Component* const child,
  8436. int zOrder = -1);
  8437. void addAndMakeVisible (Component* const child,
  8438. int zOrder = -1);
  8439. void removeChildComponent (Component* const childToRemove);
  8440. Component* removeChildComponent (const int childIndexToRemove);
  8441. void removeAllChildren();
  8442. void deleteAllChildren();
  8443. Component* getParentComponent() const throw() { return parentComponent_; }
  8444. template <class TargetClass>
  8445. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8446. {
  8447. (void) dummyParameter;
  8448. Component* p = parentComponent_;
  8449. while (p != 0)
  8450. {
  8451. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8452. if (target != 0)
  8453. return target;
  8454. p = p->parentComponent_;
  8455. }
  8456. return 0;
  8457. }
  8458. Component* getTopLevelComponent() const throw();
  8459. bool isParentOf (const Component* possibleChild) const throw();
  8460. virtual void parentHierarchyChanged();
  8461. virtual void childrenChanged();
  8462. virtual bool hitTest (int x, int y);
  8463. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8464. const bool allowClicksOnChildComponents) throw();
  8465. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8466. bool& allowsClicksOnChildComponents) const throw();
  8467. virtual bool contains (int x, int y);
  8468. bool reallyContains (int x, int y,
  8469. const bool returnTrueIfWithinAChild);
  8470. Component* getComponentAt (const int x, const int y);
  8471. void repaint() throw();
  8472. void repaint (const int x, const int y,
  8473. const int width, const int height) throw();
  8474. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8475. Image* createComponentSnapshot (const Rectangle& areaToGrab,
  8476. const bool clipImageToComponentBounds = true);
  8477. void paintEntireComponent (Graphics& context);
  8478. void setComponentEffect (ImageEffectFilter* const newEffect);
  8479. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8480. LookAndFeel& getLookAndFeel() const throw();
  8481. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8482. virtual void lookAndFeelChanged();
  8483. void sendLookAndFeelChange();
  8484. void setOpaque (const bool shouldBeOpaque) throw();
  8485. bool isOpaque() const throw();
  8486. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8487. bool isBroughtToFrontOnMouseClick() const throw();
  8488. // Keyboard focus methods
  8489. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8490. bool getWantsKeyboardFocus() const throw();
  8491. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8492. bool getMouseClickGrabsKeyboardFocus() const throw();
  8493. void grabKeyboardFocus();
  8494. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8495. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8496. void moveKeyboardFocusToSibling (const bool moveToNext);
  8497. virtual KeyboardFocusTraverser* createFocusTraverser();
  8498. int getExplicitFocusOrder() const throw();
  8499. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8500. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8501. bool isFocusContainer() const throw();
  8502. bool isEnabled() const throw();
  8503. void setEnabled (const bool shouldBeEnabled);
  8504. virtual void enablementChanged();
  8505. void setMouseCursor (const MouseCursor& cursorType) throw();
  8506. virtual const MouseCursor getMouseCursor();
  8507. void updateMouseCursor() const throw();
  8508. virtual void paint (Graphics& g);
  8509. virtual void paintOverChildren (Graphics& g);
  8510. virtual void mouseMove (const MouseEvent& e);
  8511. virtual void mouseEnter (const MouseEvent& e);
  8512. virtual void mouseExit (const MouseEvent& e);
  8513. virtual void mouseDown (const MouseEvent& e);
  8514. virtual void mouseDrag (const MouseEvent& e);
  8515. virtual void mouseUp (const MouseEvent& e);
  8516. virtual void mouseDoubleClick (const MouseEvent& e);
  8517. virtual void mouseWheelMove (const MouseEvent& e,
  8518. float wheelIncrementX,
  8519. float wheelIncrementY);
  8520. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8521. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8522. void addMouseListener (MouseListener* const newListener,
  8523. const bool wantsEventsForAllNestedChildComponents) throw();
  8524. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8525. void addKeyListener (KeyListener* const newListener) throw();
  8526. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8527. virtual bool keyPressed (const KeyPress& key);
  8528. virtual bool keyStateChanged (const bool isKeyDown);
  8529. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8530. enum FocusChangeType
  8531. {
  8532. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8533. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8534. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8535. };
  8536. virtual void focusGained (FocusChangeType cause);
  8537. virtual void focusLost (FocusChangeType cause);
  8538. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8539. bool isMouseOver() const throw();
  8540. bool isMouseButtonDown() const throw();
  8541. bool isMouseOverOrDragging() const throw();
  8542. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8543. void getMouseXYRelative (int& x, int& y) const throw();
  8544. static Component* JUCE_CALLTYPE getComponentUnderMouse() throw();
  8545. void enableUnboundedMouseMovement (bool shouldUnboundedMovementBeEnabled,
  8546. bool keepCursorVisibleUntilOffscreen = false) throw();
  8547. virtual void resized();
  8548. virtual void moved();
  8549. virtual void childBoundsChanged (Component* child);
  8550. virtual void parentSizeChanged();
  8551. virtual void broughtToFront();
  8552. void addComponentListener (ComponentListener* const newListener) throw();
  8553. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8554. void postCommandMessage (const int commandId) throw();
  8555. virtual void handleCommandMessage (int commandId);
  8556. int runModalLoop();
  8557. void enterModalState (const bool takeKeyboardFocus = true);
  8558. void exitModalState (const int returnValue);
  8559. bool isCurrentlyModal() const throw();
  8560. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8561. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8562. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8563. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8564. virtual void inputAttemptWhenModal();
  8565. NamedValueSet& getProperties() throw() { return properties; }
  8566. const NamedValueSet& getProperties() const throw() { return properties; }
  8567. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8568. void setColour (const int colourId, const Colour& colour);
  8569. void removeColour (const int colourId);
  8570. bool isColourSpecified (const int colourId) const throw();
  8571. void copyAllExplicitColoursTo (Component& target) const throw();
  8572. virtual void colourChanged();
  8573. void* getWindowHandle() const throw();
  8574. uint32 getComponentUID() const throw() { return componentUID; }
  8575. juce_UseDebuggingNewOperator
  8576. private:
  8577. friend class ComponentPeer;
  8578. friend class InternalDragRepeater;
  8579. static Component* currentlyFocusedComponent;
  8580. static Component* componentUnderMouse;
  8581. String componentName_;
  8582. Component* parentComponent_;
  8583. uint32 componentUID;
  8584. Rectangle bounds_;
  8585. int numDeepMouseListeners;
  8586. Array <Component*> childComponentList_;
  8587. LookAndFeel* lookAndFeel_;
  8588. MouseCursor cursor_;
  8589. ImageEffectFilter* effect_;
  8590. Image* bufferedImage_;
  8591. VoidArray* mouseListeners_;
  8592. VoidArray* keyListeners_;
  8593. VoidArray* componentListeners_;
  8594. NamedValueSet properties;
  8595. struct ComponentFlags
  8596. {
  8597. bool hasHeavyweightPeerFlag : 1;
  8598. bool visibleFlag : 1;
  8599. bool opaqueFlag : 1;
  8600. bool ignoresMouseClicksFlag : 1;
  8601. bool allowChildMouseClicksFlag : 1;
  8602. bool wantsFocusFlag : 1;
  8603. bool isFocusContainerFlag : 1;
  8604. bool dontFocusOnMouseClickFlag : 1;
  8605. bool alwaysOnTopFlag : 1;
  8606. bool bufferToImageFlag : 1;
  8607. bool bringToFrontOnClickFlag : 1;
  8608. bool repaintOnMouseActivityFlag : 1;
  8609. bool draggingFlag : 1;
  8610. bool mouseOverFlag : 1;
  8611. bool mouseInsideFlag : 1;
  8612. bool currentlyModalFlag : 1;
  8613. bool isDisabledFlag : 1;
  8614. bool childCompFocusedFlag : 1;
  8615. #ifdef JUCE_DEBUG
  8616. bool isInsidePaintCall : 1;
  8617. #endif
  8618. };
  8619. union
  8620. {
  8621. uint32 componentFlags_;
  8622. ComponentFlags flags;
  8623. };
  8624. void internalMouseEnter (int x, int y, const int64 time);
  8625. void internalMouseExit (int x, int y, const int64 time);
  8626. void internalMouseDown (int x, int y, const int64 time);
  8627. void internalMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8628. void internalMouseDrag (int x, int y, const int64 time);
  8629. void internalMouseMove (int x, int y, const int64 time);
  8630. void internalMouseWheel (const int intAmountX, const int intAmountY, const int64 time);
  8631. void internalBroughtToFront();
  8632. void internalFocusGain (const FocusChangeType cause);
  8633. void internalFocusLoss (const FocusChangeType cause);
  8634. void internalChildFocusChange (FocusChangeType cause);
  8635. void internalModalInputAttempt();
  8636. void internalModifierKeysChanged();
  8637. void internalChildrenChanged();
  8638. void internalHierarchyChanged();
  8639. void internalUpdateMouseCursor (const bool forcedUpdate) throw();
  8640. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8641. void repaintParent() throw();
  8642. void sendFakeMouseMove() const;
  8643. void takeKeyboardFocus (const FocusChangeType cause);
  8644. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8645. static void giveAwayFocus();
  8646. void sendEnablementChangeMessage();
  8647. static void* runModalLoopCallback (void*);
  8648. static void bringModalComponentToFront();
  8649. void subtractObscuredRegions (RectangleList& result,
  8650. const int deltaX, const int deltaY,
  8651. const Rectangle& clipRect,
  8652. const Component* const compToAvoid) const throw();
  8653. void clipObscuredRegions (Graphics& g, const Rectangle& clipRect,
  8654. const int deltaX, const int deltaY) const throw();
  8655. // how much of the component is not off the edges of its parents
  8656. const Rectangle getUnclippedArea() const;
  8657. void sendVisibilityChangeMessage();
  8658. // This is included here just to cause a compile error if your code is still handling
  8659. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8660. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8661. // implement its methods instead of this Component method).
  8662. virtual void filesDropped (const StringArray&, int, int) {}
  8663. // components aren't allowed to have copy constructors, as this would mess up parent
  8664. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8665. // this one to avoid compiler warnings.
  8666. Component (const Component&);
  8667. const Component& operator= (const Component&);
  8668. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8669. // subclass to use the new parameters to keyStateChanged)
  8670. virtual void keyStateChanged() {};
  8671. protected:
  8672. virtual void internalRepaint (int x, int y, int w, int h);
  8673. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8674. void handleMessage (const Message&);
  8675. };
  8676. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8677. /********* End of inlined file: juce_Component.h *********/
  8678. /********* Start of inlined file: juce_ApplicationCommandInfo.h *********/
  8679. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8680. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8681. /********* Start of inlined file: juce_ApplicationCommandID.h *********/
  8682. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8683. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8684. typedef int CommandID;
  8685. namespace StandardApplicationCommandIDs
  8686. {
  8687. static const CommandID quit = 0x1001;
  8688. static const CommandID del = 0x1002;
  8689. static const CommandID cut = 0x1003;
  8690. static const CommandID copy = 0x1004;
  8691. static const CommandID paste = 0x1005;
  8692. static const CommandID selectAll = 0x1006;
  8693. static const CommandID deselectAll = 0x1007;
  8694. }
  8695. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8696. /********* End of inlined file: juce_ApplicationCommandID.h *********/
  8697. struct JUCE_API ApplicationCommandInfo
  8698. {
  8699. ApplicationCommandInfo (const CommandID commandID) throw();
  8700. void setInfo (const String& shortName,
  8701. const String& description,
  8702. const String& categoryName,
  8703. const int flags) throw();
  8704. void setActive (const bool isActive) throw();
  8705. void setTicked (const bool isTicked) throw();
  8706. void addDefaultKeypress (const int keyCode,
  8707. const ModifierKeys& modifiers) throw();
  8708. CommandID commandID;
  8709. String shortName;
  8710. String description;
  8711. String categoryName;
  8712. Array <KeyPress> defaultKeypresses;
  8713. enum CommandFlags
  8714. {
  8715. isDisabled = 1 << 0,
  8716. isTicked = 1 << 1,
  8717. wantsKeyUpDownCallbacks = 1 << 2,
  8718. hiddenFromKeyEditor = 1 << 3,
  8719. readOnlyInKeyEditor = 1 << 4,
  8720. dontTriggerVisualFeedback = 1 << 5
  8721. };
  8722. int flags;
  8723. };
  8724. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8725. /********* End of inlined file: juce_ApplicationCommandInfo.h *********/
  8726. class JUCE_API ApplicationCommandTarget
  8727. {
  8728. public:
  8729. ApplicationCommandTarget();
  8730. virtual ~ApplicationCommandTarget();
  8731. struct JUCE_API InvocationInfo
  8732. {
  8733. InvocationInfo (const CommandID commandID) throw();
  8734. CommandID commandID;
  8735. int commandFlags;
  8736. enum InvocationMethod
  8737. {
  8738. direct = 0, /**< The command is being invoked directly by a piece of code. */
  8739. fromKeyPress, /**< The command is being invoked by a key-press. */
  8740. fromMenu, /**< The command is being invoked by a menu selection. */
  8741. fromButton /**< The command is being invoked by a button click. */
  8742. };
  8743. InvocationMethod invocationMethod;
  8744. Component* originatingComponent;
  8745. KeyPress keyPress;
  8746. bool isKeyDown;
  8747. int millisecsSinceKeyPressed;
  8748. };
  8749. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  8750. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  8751. virtual void getCommandInfo (const CommandID commandID,
  8752. ApplicationCommandInfo& result) = 0;
  8753. virtual bool perform (const InvocationInfo& info) = 0;
  8754. bool invoke (const InvocationInfo& invocationInfo,
  8755. const bool asynchronously);
  8756. bool invokeDirectly (const CommandID commandID,
  8757. const bool asynchronously);
  8758. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  8759. bool isCommandActive (const CommandID commandID);
  8760. ApplicationCommandTarget* findFirstTargetParentComponent();
  8761. juce_UseDebuggingNewOperator
  8762. private:
  8763. // (for async invocation of commands)
  8764. class CommandTargetMessageInvoker : public MessageListener
  8765. {
  8766. public:
  8767. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  8768. ~CommandTargetMessageInvoker();
  8769. void handleMessage (const Message& message);
  8770. private:
  8771. ApplicationCommandTarget* const owner;
  8772. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  8773. const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  8774. };
  8775. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  8776. friend class CommandTargetMessageInvoker;
  8777. bool tryToInvoke (const InvocationInfo& info, const bool async);
  8778. ApplicationCommandTarget (const ApplicationCommandTarget&);
  8779. const ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  8780. };
  8781. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  8782. /********* End of inlined file: juce_ApplicationCommandTarget.h *********/
  8783. /********* Start of inlined file: juce_ActionListener.h *********/
  8784. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  8785. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  8786. class JUCE_API ActionListener
  8787. {
  8788. public:
  8789. virtual ~ActionListener() {}
  8790. virtual void actionListenerCallback (const String& message) = 0;
  8791. };
  8792. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  8793. /********* End of inlined file: juce_ActionListener.h *********/
  8794. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  8795. private ActionListener
  8796. {
  8797. protected:
  8798. JUCEApplication();
  8799. public:
  8800. virtual ~JUCEApplication();
  8801. static JUCEApplication* getInstance() throw();
  8802. virtual void initialise (const String& commandLineParameters) = 0;
  8803. bool isInitialising() const throw();
  8804. virtual void shutdown() = 0;
  8805. virtual const String getApplicationName() = 0;
  8806. virtual const String getApplicationVersion();
  8807. virtual bool moreThanOneInstanceAllowed();
  8808. virtual void anotherInstanceStarted (const String& commandLine);
  8809. virtual void systemRequestedQuit();
  8810. virtual void unhandledException (const std::exception* e,
  8811. const String& sourceFilename,
  8812. const int lineNumber);
  8813. static void quit();
  8814. void setApplicationReturnValue (const int newReturnValue) throw();
  8815. int getApplicationReturnValue() const throw() { return appReturnValue; }
  8816. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  8817. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  8818. static int main (String& commandLine, JUCEApplication* const newApp);
  8819. static int main (int argc, char* argv[], JUCEApplication* const newApp);
  8820. static void sendUnhandledException (const std::exception* const e,
  8821. const char* const sourceFile,
  8822. const int lineNumber);
  8823. ApplicationCommandTarget* getNextCommandTarget();
  8824. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  8825. void getAllCommands (Array <CommandID>& commands);
  8826. bool perform (const InvocationInfo& info);
  8827. void actionListenerCallback (const String& message);
  8828. private:
  8829. String commandLineParameters;
  8830. int appReturnValue;
  8831. bool stillInitialising;
  8832. InterProcessLock* appLock;
  8833. JUCEApplication (const JUCEApplication&);
  8834. const JUCEApplication& operator= (const JUCEApplication&);
  8835. public:
  8836. bool initialiseApp (String& commandLine);
  8837. static int shutdownAppAndClearUp();
  8838. };
  8839. #endif // __JUCE_APPLICATION_JUCEHEADER__
  8840. /********* End of inlined file: juce_Application.h *********/
  8841. #endif
  8842. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8843. #endif
  8844. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8845. #endif
  8846. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8847. /********* Start of inlined file: juce_ApplicationCommandManager.h *********/
  8848. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8849. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8850. /********* Start of inlined file: juce_Desktop.h *********/
  8851. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  8852. #define __JUCE_DESKTOP_JUCEHEADER__
  8853. /********* Start of inlined file: juce_DeletedAtShutdown.h *********/
  8854. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8855. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8856. class JUCE_API DeletedAtShutdown
  8857. {
  8858. protected:
  8859. DeletedAtShutdown();
  8860. virtual ~DeletedAtShutdown();
  8861. public:
  8862. static void deleteAll();
  8863. private:
  8864. DeletedAtShutdown (const DeletedAtShutdown&);
  8865. const DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  8866. };
  8867. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8868. /********* End of inlined file: juce_DeletedAtShutdown.h *********/
  8869. /********* Start of inlined file: juce_Timer.h *********/
  8870. #ifndef __JUCE_TIMER_JUCEHEADER__
  8871. #define __JUCE_TIMER_JUCEHEADER__
  8872. class InternalTimerThread;
  8873. class JUCE_API Timer
  8874. {
  8875. protected:
  8876. Timer() throw();
  8877. Timer (const Timer& other) throw();
  8878. public:
  8879. virtual ~Timer();
  8880. virtual void timerCallback() = 0;
  8881. void startTimer (const int intervalInMilliseconds) throw();
  8882. void stopTimer() throw();
  8883. bool isTimerRunning() const throw() { return periodMs > 0; }
  8884. int getTimerInterval() const throw() { return periodMs; }
  8885. private:
  8886. friend class InternalTimerThread;
  8887. int countdownMs, periodMs;
  8888. Timer* previous;
  8889. Timer* next;
  8890. const Timer& operator= (const Timer&);
  8891. };
  8892. #endif // __JUCE_TIMER_JUCEHEADER__
  8893. /********* End of inlined file: juce_Timer.h *********/
  8894. class JUCE_API FocusChangeListener
  8895. {
  8896. public:
  8897. virtual ~FocusChangeListener() {}
  8898. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  8899. };
  8900. class JUCE_API Desktop : private DeletedAtShutdown,
  8901. private Timer,
  8902. private AsyncUpdater
  8903. {
  8904. public:
  8905. static Desktop& JUCE_CALLTYPE getInstance() throw();
  8906. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  8907. const Rectangle getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  8908. const Rectangle getMonitorAreaContaining (int x, int y, const bool clippedToWorkArea = true) const throw();
  8909. static void getMousePosition (int& x, int& y) throw();
  8910. static void setMousePosition (int x, int y) throw();
  8911. static void getLastMouseDownPosition (int& x, int& y) throw();
  8912. static int getMouseButtonClickCounter() throw();
  8913. static void setScreenSaverEnabled (const bool isEnabled) throw();
  8914. static bool isScreenSaverEnabled() throw();
  8915. void addGlobalMouseListener (MouseListener* const listener) throw();
  8916. void removeGlobalMouseListener (MouseListener* const listener) throw();
  8917. void addFocusChangeListener (FocusChangeListener* const listener) throw();
  8918. void removeFocusChangeListener (FocusChangeListener* const listener) throw();
  8919. void setKioskModeComponent (Component* componentToUse,
  8920. const bool allowMenusAndBars = true);
  8921. Component* getKioskModeComponent() const { return kioskModeComponent; }
  8922. int getNumComponents() const throw();
  8923. Component* getComponent (const int index) const throw();
  8924. Component* findComponentAt (const int screenX,
  8925. const int screenY) const;
  8926. juce_UseDebuggingNewOperator
  8927. void refreshMonitorSizes() throw();
  8928. static bool canUseSemiTransparentWindows() throw();
  8929. private:
  8930. friend class Component;
  8931. friend class ComponentPeer;
  8932. SortedSet <void*> mouseListeners, focusListeners;
  8933. Array <Component*> desktopComponents;
  8934. friend class DeletedAtShutdown;
  8935. friend class TopLevelWindowManager;
  8936. Desktop() throw();
  8937. ~Desktop() throw();
  8938. Array <Rectangle> monitorCoordsClipped, monitorCoordsUnclipped;
  8939. int lastFakeMouseMoveX, lastFakeMouseMoveY, mouseClickCounter;
  8940. bool mouseMovedSignificantlySincePressed;
  8941. struct RecentMouseDown
  8942. {
  8943. int x, y;
  8944. int64 time;
  8945. Component* component;
  8946. };
  8947. RecentMouseDown mouseDowns[4];
  8948. void incrementMouseClickCounter() throw();
  8949. void registerMouseDown (int x, int y, int64 time, Component* component) throw();
  8950. void registerMouseDrag (int x, int y) throw();
  8951. const Time getLastMouseDownTime() const throw();
  8952. int getNumberOfMultipleClicks() const throw();
  8953. Component* kioskModeComponent;
  8954. Rectangle kioskComponentOriginalBounds;
  8955. void timerCallback();
  8956. void sendMouseMove();
  8957. void resetTimer() throw();
  8958. int getNumDisplayMonitors() const throw();
  8959. const Rectangle getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  8960. void addDesktopComponent (Component* const c) throw();
  8961. void removeDesktopComponent (Component* const c) throw();
  8962. void componentBroughtToFront (Component* const c) throw();
  8963. void triggerFocusCallback() throw();
  8964. void handleAsyncUpdate();
  8965. Desktop (const Desktop&);
  8966. const Desktop& operator= (const Desktop&);
  8967. };
  8968. #endif // __JUCE_DESKTOP_JUCEHEADER__
  8969. /********* End of inlined file: juce_Desktop.h *********/
  8970. class KeyPressMappingSet;
  8971. class ApplicationCommandManagerListener;
  8972. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  8973. private FocusChangeListener
  8974. {
  8975. public:
  8976. ApplicationCommandManager();
  8977. virtual ~ApplicationCommandManager();
  8978. void clearCommands();
  8979. void registerCommand (const ApplicationCommandInfo& newCommand);
  8980. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  8981. void removeCommand (const CommandID commandID);
  8982. void commandStatusChanged();
  8983. int getNumCommands() const throw() { return commands.size(); }
  8984. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  8985. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  8986. const String getNameOfCommand (const CommandID commandID) const throw();
  8987. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  8988. const StringArray getCommandCategories() const throw();
  8989. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  8990. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  8991. bool invokeDirectly (const CommandID commandID,
  8992. const bool asynchronously);
  8993. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  8994. const bool asynchronously);
  8995. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  8996. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  8997. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  8998. ApplicationCommandInfo& upToDateInfo);
  8999. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9000. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9001. static ApplicationCommandTarget* findDefaultComponentTarget();
  9002. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9003. juce_UseDebuggingNewOperator
  9004. private:
  9005. OwnedArray <ApplicationCommandInfo> commands;
  9006. SortedSet <void*> listeners;
  9007. ScopedPointer <KeyPressMappingSet> keyMappings;
  9008. ApplicationCommandTarget* firstTarget;
  9009. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) const;
  9010. void handleAsyncUpdate();
  9011. void globalFocusChanged (Component*);
  9012. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9013. // version of this method.
  9014. virtual short getFirstCommandTarget() { return 0; }
  9015. };
  9016. class JUCE_API ApplicationCommandManagerListener
  9017. {
  9018. public:
  9019. virtual ~ApplicationCommandManagerListener() {}
  9020. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9021. virtual void applicationCommandListChanged() = 0;
  9022. };
  9023. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9024. /********* End of inlined file: juce_ApplicationCommandManager.h *********/
  9025. #endif
  9026. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9027. #endif
  9028. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9029. /********* Start of inlined file: juce_ApplicationProperties.h *********/
  9030. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9031. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9032. /********* Start of inlined file: juce_PropertiesFile.h *********/
  9033. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9034. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9035. class JUCE_API PropertiesFile : public PropertySet,
  9036. public ChangeBroadcaster,
  9037. private Timer
  9038. {
  9039. public:
  9040. enum FileFormatOptions
  9041. {
  9042. ignoreCaseOfKeyNames = 1,
  9043. storeAsBinary = 2,
  9044. storeAsCompressedBinary = 4,
  9045. storeAsXML = 8
  9046. };
  9047. PropertiesFile (const File& file,
  9048. const int millisecondsBeforeSaving,
  9049. const int options);
  9050. ~PropertiesFile();
  9051. bool saveIfNeeded();
  9052. bool save();
  9053. bool needsToBeSaved() const;
  9054. const File getFile() const { return file; }
  9055. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9056. const String& fileNameSuffix,
  9057. const String& folderName,
  9058. const bool commonToAllUsers,
  9059. const int millisecondsBeforeSaving,
  9060. const int propertiesFileOptions);
  9061. static const File getDefaultAppSettingsFile (const String& applicationName,
  9062. const String& fileNameSuffix,
  9063. const String& folderName,
  9064. const bool commonToAllUsers);
  9065. juce_UseDebuggingNewOperator
  9066. protected:
  9067. virtual void propertyChanged();
  9068. private:
  9069. File file;
  9070. int timerInterval;
  9071. const int options;
  9072. bool needsWriting;
  9073. void timerCallback();
  9074. PropertiesFile (const PropertiesFile&);
  9075. const PropertiesFile& operator= (const PropertiesFile&);
  9076. };
  9077. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9078. /********* End of inlined file: juce_PropertiesFile.h *********/
  9079. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9080. {
  9081. public:
  9082. ApplicationProperties() throw();
  9083. ~ApplicationProperties();
  9084. juce_DeclareSingleton (ApplicationProperties, false)
  9085. void setStorageParameters (const String& applicationName,
  9086. const String& fileNameSuffix,
  9087. const String& folderName,
  9088. const int millisecondsBeforeSaving,
  9089. const int propertiesFileOptions) throw();
  9090. bool testWriteAccess (const bool testUserSettings,
  9091. const bool testCommonSettings,
  9092. const bool showWarningDialogOnFailure);
  9093. PropertiesFile* getUserSettings() throw();
  9094. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9095. bool saveIfNeeded();
  9096. void closeFiles();
  9097. juce_UseDebuggingNewOperator
  9098. private:
  9099. ScopedPointer <PropertiesFile> userProps, commonProps;
  9100. String appName, fileSuffix, folderName;
  9101. int msBeforeSaving, options;
  9102. int commonSettingsAreReadOnly;
  9103. ApplicationProperties (const ApplicationProperties&);
  9104. const ApplicationProperties& operator= (const ApplicationProperties&);
  9105. void openFiles() throw();
  9106. };
  9107. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9108. /********* End of inlined file: juce_ApplicationProperties.h *********/
  9109. #endif
  9110. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9111. /********* Start of inlined file: juce_AiffAudioFormat.h *********/
  9112. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9113. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9114. /********* Start of inlined file: juce_AudioFormat.h *********/
  9115. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9116. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9117. /********* Start of inlined file: juce_AudioFormatReader.h *********/
  9118. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9119. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9120. class AudioFormat;
  9121. class JUCE_API AudioFormatReader
  9122. {
  9123. protected:
  9124. AudioFormatReader (InputStream* const sourceStream,
  9125. const String& formatName);
  9126. public:
  9127. virtual ~AudioFormatReader();
  9128. const String getFormatName() const throw() { return formatName; }
  9129. bool read (int** destSamples,
  9130. int numDestChannels,
  9131. int64 startSampleInSource,
  9132. int numSamplesToRead,
  9133. const bool fillLeftoverChannelsWithCopies);
  9134. virtual void readMaxLevels (int64 startSample,
  9135. int64 numSamples,
  9136. float& lowestLeft,
  9137. float& highestLeft,
  9138. float& lowestRight,
  9139. float& highestRight);
  9140. int64 searchForLevel (int64 startSample,
  9141. int64 numSamplesToSearch,
  9142. const double magnitudeRangeMinimum,
  9143. const double magnitudeRangeMaximum,
  9144. const int minimumConsecutiveSamples);
  9145. double sampleRate;
  9146. unsigned int bitsPerSample;
  9147. int64 lengthInSamples;
  9148. unsigned int numChannels;
  9149. bool usesFloatingPointData;
  9150. StringPairArray metadataValues;
  9151. InputStream* input;
  9152. virtual bool readSamples (int** destSamples,
  9153. int numDestChannels,
  9154. int startOffsetInDestBuffer,
  9155. int64 startSampleInFile,
  9156. int numSamples) = 0;
  9157. juce_UseDebuggingNewOperator
  9158. private:
  9159. String formatName;
  9160. AudioFormatReader (const AudioFormatReader&);
  9161. const AudioFormatReader& operator= (const AudioFormatReader&);
  9162. };
  9163. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9164. /********* End of inlined file: juce_AudioFormatReader.h *********/
  9165. /********* Start of inlined file: juce_AudioFormatWriter.h *********/
  9166. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9167. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9168. /********* Start of inlined file: juce_AudioSource.h *********/
  9169. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9170. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9171. /********* Start of inlined file: juce_AudioSampleBuffer.h *********/
  9172. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9173. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9174. class AudioFormatReader;
  9175. class AudioFormatWriter;
  9176. class JUCE_API AudioSampleBuffer
  9177. {
  9178. public:
  9179. AudioSampleBuffer (const int numChannels,
  9180. const int numSamples) throw();
  9181. AudioSampleBuffer (float** dataToReferTo,
  9182. const int numChannels,
  9183. const int numSamples) throw();
  9184. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9185. const AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9186. virtual ~AudioSampleBuffer() throw();
  9187. int getNumChannels() const throw() { return numChannels; }
  9188. int getNumSamples() const throw() { return size; }
  9189. float* getSampleData (const int channelNumber) const throw()
  9190. {
  9191. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9192. return channels [channelNumber];
  9193. }
  9194. float* getSampleData (const int channelNumber,
  9195. const int sampleOffset) const throw()
  9196. {
  9197. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9198. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9199. return channels [channelNumber] + sampleOffset;
  9200. }
  9201. float** getArrayOfChannels() const throw() { return channels; }
  9202. void setSize (const int newNumChannels,
  9203. const int newNumSamples,
  9204. const bool keepExistingContent = false,
  9205. const bool clearExtraSpace = false,
  9206. const bool avoidReallocating = false) throw();
  9207. void setDataToReferTo (float** dataToReferTo,
  9208. const int numChannels,
  9209. const int numSamples) throw();
  9210. void clear() throw();
  9211. void clear (const int startSample,
  9212. const int numSamples) throw();
  9213. void clear (const int channel,
  9214. const int startSample,
  9215. const int numSamples) throw();
  9216. void applyGain (const int channel,
  9217. const int startSample,
  9218. int numSamples,
  9219. const float gain) throw();
  9220. void applyGain (const int startSample,
  9221. const int numSamples,
  9222. const float gain) throw();
  9223. void applyGainRamp (const int channel,
  9224. const int startSample,
  9225. int numSamples,
  9226. float startGain,
  9227. float endGain) throw();
  9228. void addFrom (const int destChannel,
  9229. const int destStartSample,
  9230. const AudioSampleBuffer& source,
  9231. const int sourceChannel,
  9232. const int sourceStartSample,
  9233. int numSamples,
  9234. const float gainToApplyToSource = 1.0f) throw();
  9235. void addFrom (const int destChannel,
  9236. const int destStartSample,
  9237. const float* source,
  9238. int numSamples,
  9239. const float gainToApplyToSource = 1.0f) throw();
  9240. void addFromWithRamp (const int destChannel,
  9241. const int destStartSample,
  9242. const float* source,
  9243. int numSamples,
  9244. float startGain,
  9245. float endGain) throw();
  9246. void copyFrom (const int destChannel,
  9247. const int destStartSample,
  9248. const AudioSampleBuffer& source,
  9249. const int sourceChannel,
  9250. const int sourceStartSample,
  9251. int numSamples) throw();
  9252. void copyFrom (const int destChannel,
  9253. const int destStartSample,
  9254. const float* source,
  9255. int numSamples) throw();
  9256. void copyFrom (const int destChannel,
  9257. const int destStartSample,
  9258. const float* source,
  9259. int numSamples,
  9260. const float gain) throw();
  9261. void copyFromWithRamp (const int destChannel,
  9262. const int destStartSample,
  9263. const float* source,
  9264. int numSamples,
  9265. float startGain,
  9266. float endGain) throw();
  9267. void findMinMax (const int channel,
  9268. const int startSample,
  9269. int numSamples,
  9270. float& minVal,
  9271. float& maxVal) const throw();
  9272. float getMagnitude (const int channel,
  9273. const int startSample,
  9274. const int numSamples) const throw();
  9275. float getMagnitude (const int startSample,
  9276. const int numSamples) const throw();
  9277. float getRMSLevel (const int channel,
  9278. const int startSample,
  9279. const int numSamples) const throw();
  9280. void readFromAudioReader (AudioFormatReader* reader,
  9281. const int startSample,
  9282. const int numSamples,
  9283. const int readerStartSample,
  9284. const bool useReaderLeftChan,
  9285. const bool useReaderRightChan) throw();
  9286. void writeToAudioWriter (AudioFormatWriter* writer,
  9287. const int startSample,
  9288. const int numSamples) const throw();
  9289. juce_UseDebuggingNewOperator
  9290. private:
  9291. int numChannels, size;
  9292. size_t allocatedBytes;
  9293. float** channels;
  9294. HeapBlock <char> allocatedData;
  9295. float* preallocatedChannelSpace [32];
  9296. void allocateData();
  9297. void allocateChannels (float** const dataToReferTo);
  9298. };
  9299. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9300. /********* End of inlined file: juce_AudioSampleBuffer.h *********/
  9301. struct JUCE_API AudioSourceChannelInfo
  9302. {
  9303. AudioSampleBuffer* buffer;
  9304. int startSample;
  9305. int numSamples;
  9306. void clearActiveBufferRegion() const
  9307. {
  9308. if (buffer != 0)
  9309. buffer->clear (startSample, numSamples);
  9310. }
  9311. };
  9312. class JUCE_API AudioSource
  9313. {
  9314. protected:
  9315. AudioSource() throw() {}
  9316. public:
  9317. virtual ~AudioSource() {}
  9318. virtual void prepareToPlay (int samplesPerBlockExpected,
  9319. double sampleRate) = 0;
  9320. virtual void releaseResources() = 0;
  9321. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9322. };
  9323. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9324. /********* End of inlined file: juce_AudioSource.h *********/
  9325. class JUCE_API AudioFormatWriter
  9326. {
  9327. protected:
  9328. AudioFormatWriter (OutputStream* const destStream,
  9329. const String& formatName,
  9330. const double sampleRate,
  9331. const unsigned int numberOfChannels,
  9332. const unsigned int bitsPerSample);
  9333. public:
  9334. virtual ~AudioFormatWriter();
  9335. const String getFormatName() const throw() { return formatName; }
  9336. virtual bool write (const int** samplesToWrite,
  9337. int numSamples) = 0;
  9338. bool writeFromAudioReader (AudioFormatReader& reader,
  9339. int64 startSample,
  9340. int64 numSamplesToRead);
  9341. bool writeFromAudioSource (AudioSource& source,
  9342. int numSamplesToRead,
  9343. const int samplesPerBlock = 2048);
  9344. double getSampleRate() const throw() { return sampleRate; }
  9345. int getNumChannels() const throw() { return numChannels; }
  9346. int getBitsPerSample() const throw() { return bitsPerSample; }
  9347. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9348. juce_UseDebuggingNewOperator
  9349. protected:
  9350. double sampleRate;
  9351. unsigned int numChannels;
  9352. unsigned int bitsPerSample;
  9353. bool usesFloatingPointData;
  9354. OutputStream* output;
  9355. private:
  9356. String formatName;
  9357. };
  9358. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9359. /********* End of inlined file: juce_AudioFormatWriter.h *********/
  9360. class JUCE_API AudioFormat
  9361. {
  9362. public:
  9363. virtual ~AudioFormat();
  9364. const String& getFormatName() const;
  9365. const StringArray& getFileExtensions() const;
  9366. virtual bool canHandleFile (const File& fileToTest);
  9367. virtual const Array <int> getPossibleSampleRates() = 0;
  9368. virtual const Array <int> getPossibleBitDepths() = 0;
  9369. virtual bool canDoStereo() = 0;
  9370. virtual bool canDoMono() = 0;
  9371. virtual bool isCompressed();
  9372. virtual const StringArray getQualityOptions();
  9373. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9374. const bool deleteStreamIfOpeningFails) = 0;
  9375. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9376. double sampleRateToUse,
  9377. unsigned int numberOfChannels,
  9378. int bitsPerSample,
  9379. const StringPairArray& metadataValues,
  9380. int qualityOptionIndex) = 0;
  9381. protected:
  9382. AudioFormat (const String& formatName,
  9383. const tchar** const fileExtensions);
  9384. private:
  9385. String formatName;
  9386. StringArray fileExtensions;
  9387. };
  9388. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9389. /********* End of inlined file: juce_AudioFormat.h *********/
  9390. class JUCE_API AiffAudioFormat : public AudioFormat
  9391. {
  9392. public:
  9393. AiffAudioFormat();
  9394. ~AiffAudioFormat();
  9395. const Array <int> getPossibleSampleRates();
  9396. const Array <int> getPossibleBitDepths();
  9397. bool canDoStereo();
  9398. bool canDoMono();
  9399. #if JUCE_MAC
  9400. bool canHandleFile (const File& fileToTest);
  9401. #endif
  9402. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9403. const bool deleteStreamIfOpeningFails);
  9404. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9405. double sampleRateToUse,
  9406. unsigned int numberOfChannels,
  9407. int bitsPerSample,
  9408. const StringPairArray& metadataValues,
  9409. int qualityOptionIndex);
  9410. juce_UseDebuggingNewOperator
  9411. };
  9412. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9413. /********* End of inlined file: juce_AiffAudioFormat.h *********/
  9414. #endif
  9415. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9416. /********* Start of inlined file: juce_AudioCDBurner.h *********/
  9417. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9418. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9419. #if JUCE_USE_CDBURNER
  9420. class AudioCDBurner
  9421. {
  9422. public:
  9423. static const StringArray findAvailableDevices();
  9424. static AudioCDBurner* openDevice (const int deviceIndex);
  9425. ~AudioCDBurner();
  9426. bool isDiskPresent() const;
  9427. int getNumAvailableAudioBlocks() const;
  9428. bool addAudioTrack (AudioSource* source, int numSamples);
  9429. class BurnProgressListener
  9430. {
  9431. public:
  9432. BurnProgressListener() throw() {}
  9433. virtual ~BurnProgressListener() {}
  9434. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9435. };
  9436. const String burn (BurnProgressListener* listener,
  9437. const bool ejectDiscAfterwards,
  9438. const bool peformFakeBurnForTesting);
  9439. juce_UseDebuggingNewOperator
  9440. private:
  9441. AudioCDBurner (const int deviceIndex);
  9442. void* internal;
  9443. };
  9444. #endif
  9445. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9446. /********* End of inlined file: juce_AudioCDBurner.h *********/
  9447. #endif
  9448. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9449. /********* Start of inlined file: juce_AudioCDReader.h *********/
  9450. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9451. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9452. #if JUCE_USE_CDREADER
  9453. #if JUCE_MAC
  9454. #endif
  9455. class JUCE_API AudioCDReader : public AudioFormatReader
  9456. {
  9457. public:
  9458. static const StringArray getAvailableCDNames();
  9459. static AudioCDReader* createReaderForCD (const int index);
  9460. ~AudioCDReader();
  9461. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9462. int64 startSampleInFile, int numSamples);
  9463. bool isCDStillPresent() const;
  9464. int getNumTracks() const;
  9465. int getPositionOfTrackStart (int trackNum) const;
  9466. bool isTrackAudio (int trackNum) const;
  9467. void refreshTrackLengths();
  9468. void enableIndexScanning (bool enabled);
  9469. int getLastIndex() const;
  9470. const Array <int> findIndexesInTrack (const int trackNumber);
  9471. int getCDDBId();
  9472. void ejectDisk();
  9473. juce_UseDebuggingNewOperator
  9474. private:
  9475. #if JUCE_MAC
  9476. File volumeDir;
  9477. Array<File> tracks;
  9478. Array<int> trackStartSamples;
  9479. int currentReaderTrack;
  9480. ScopedPointer <AudioFormatReader> reader;
  9481. AudioCDReader (const File& volume);
  9482. public:
  9483. static int compareElements (const File&, const File&);
  9484. private:
  9485. #elif JUCE_WINDOWS
  9486. int numTracks;
  9487. int trackStarts[100];
  9488. bool audioTracks [100];
  9489. void* handle;
  9490. bool indexingEnabled;
  9491. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9492. MemoryBlock buffer;
  9493. AudioCDReader (void* handle);
  9494. int getIndexAt (int samplePos);
  9495. #elif JUCE_LINUX
  9496. AudioCDReader();
  9497. #endif
  9498. AudioCDReader (const AudioCDReader&);
  9499. const AudioCDReader& operator= (const AudioCDReader&);
  9500. };
  9501. #endif
  9502. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9503. /********* End of inlined file: juce_AudioCDReader.h *********/
  9504. #endif
  9505. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9506. #endif
  9507. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9508. /********* Start of inlined file: juce_AudioFormatManager.h *********/
  9509. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9510. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9511. class JUCE_API AudioFormatManager
  9512. {
  9513. public:
  9514. AudioFormatManager();
  9515. ~AudioFormatManager();
  9516. juce_DeclareSingleton (AudioFormatManager, false);
  9517. void registerFormat (AudioFormat* newFormat,
  9518. const bool makeThisTheDefaultFormat);
  9519. void registerBasicFormats();
  9520. void clearFormats();
  9521. int getNumKnownFormats() const;
  9522. AudioFormat* getKnownFormat (const int index) const;
  9523. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9524. AudioFormat* getDefaultFormat() const;
  9525. const String getWildcardForAllFormats() const;
  9526. AudioFormatReader* createReaderFor (const File& audioFile);
  9527. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9528. juce_UseDebuggingNewOperator
  9529. private:
  9530. VoidArray knownFormats;
  9531. int defaultFormatIndex;
  9532. };
  9533. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9534. /********* End of inlined file: juce_AudioFormatManager.h *********/
  9535. #endif
  9536. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9537. #endif
  9538. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9539. #endif
  9540. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9541. /********* Start of inlined file: juce_AudioSubsectionReader.h *********/
  9542. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9543. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9544. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9545. {
  9546. public:
  9547. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9548. const int64 subsectionStartSample,
  9549. const int64 subsectionLength,
  9550. const bool deleteSourceWhenDeleted);
  9551. ~AudioSubsectionReader();
  9552. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9553. int64 startSampleInFile, int numSamples);
  9554. void readMaxLevels (int64 startSample,
  9555. int64 numSamples,
  9556. float& lowestLeft,
  9557. float& highestLeft,
  9558. float& lowestRight,
  9559. float& highestRight);
  9560. juce_UseDebuggingNewOperator
  9561. private:
  9562. AudioFormatReader* const source;
  9563. int64 startSample, length;
  9564. const bool deleteSourceWhenDeleted;
  9565. AudioSubsectionReader (const AudioSubsectionReader&);
  9566. const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9567. };
  9568. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9569. /********* End of inlined file: juce_AudioSubsectionReader.h *********/
  9570. #endif
  9571. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9572. /********* Start of inlined file: juce_AudioThumbnail.h *********/
  9573. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9574. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9575. class AudioThumbnailCache;
  9576. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9577. public TimeSliceClient,
  9578. private Timer
  9579. {
  9580. public:
  9581. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9582. AudioFormatManager& formatManagerToUse,
  9583. AudioThumbnailCache& cacheToUse);
  9584. ~AudioThumbnail();
  9585. void setSource (InputSource* const newSource);
  9586. void loadFrom (InputStream& input);
  9587. void saveTo (OutputStream& output) const;
  9588. int getNumChannels() const throw();
  9589. double getTotalLength() const throw();
  9590. void drawChannel (Graphics& g,
  9591. int x, int y, int w, int h,
  9592. double startTimeSeconds,
  9593. double endTimeSeconds,
  9594. int channelNum,
  9595. const float verticalZoomFactor);
  9596. bool isFullyLoaded() const throw();
  9597. bool useTimeSlice();
  9598. void timerCallback();
  9599. juce_UseDebuggingNewOperator
  9600. private:
  9601. AudioFormatManager& formatManagerToUse;
  9602. AudioThumbnailCache& cache;
  9603. ScopedPointer <InputSource> source;
  9604. CriticalSection readerLock;
  9605. ScopedPointer <AudioFormatReader> reader;
  9606. MemoryBlock data, cachedLevels;
  9607. int orginalSamplesPerThumbnailSample;
  9608. int numChannelsCached, numSamplesCached;
  9609. double cachedStart, cachedTimePerPixel;
  9610. bool cacheNeedsRefilling;
  9611. void clear();
  9612. AudioFormatReader* createReader() const;
  9613. void generateSection (AudioFormatReader& reader,
  9614. int64 startSample,
  9615. int numSamples);
  9616. char* getChannelData (int channel) const;
  9617. void refillCache (const int numSamples,
  9618. double startTime,
  9619. const double timePerPixel);
  9620. friend class AudioThumbnailCache;
  9621. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9622. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9623. // returns true if more needs to be read
  9624. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9625. };
  9626. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9627. /********* End of inlined file: juce_AudioThumbnail.h *********/
  9628. #endif
  9629. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9630. /********* Start of inlined file: juce_AudioThumbnailCache.h *********/
  9631. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9632. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9633. struct ThumbnailCacheEntry;
  9634. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9635. {
  9636. public:
  9637. AudioThumbnailCache (const int maxNumThumbsToStore);
  9638. ~AudioThumbnailCache();
  9639. void clear();
  9640. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9641. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9642. juce_UseDebuggingNewOperator
  9643. private:
  9644. OwnedArray <ThumbnailCacheEntry> thumbs;
  9645. int maxNumThumbsToStore;
  9646. friend class AudioThumbnail;
  9647. void addThumbnail (AudioThumbnail* const thumb);
  9648. void removeThumbnail (AudioThumbnail* const thumb);
  9649. };
  9650. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9651. /********* End of inlined file: juce_AudioThumbnailCache.h *********/
  9652. #endif
  9653. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9654. /********* Start of inlined file: juce_FlacAudioFormat.h *********/
  9655. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9656. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9657. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9658. class JUCE_API FlacAudioFormat : public AudioFormat
  9659. {
  9660. public:
  9661. FlacAudioFormat();
  9662. ~FlacAudioFormat();
  9663. const Array <int> getPossibleSampleRates();
  9664. const Array <int> getPossibleBitDepths();
  9665. bool canDoStereo();
  9666. bool canDoMono();
  9667. bool isCompressed();
  9668. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9669. const bool deleteStreamIfOpeningFails);
  9670. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9671. double sampleRateToUse,
  9672. unsigned int numberOfChannels,
  9673. int bitsPerSample,
  9674. const StringPairArray& metadataValues,
  9675. int qualityOptionIndex);
  9676. juce_UseDebuggingNewOperator
  9677. };
  9678. #endif
  9679. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9680. /********* End of inlined file: juce_FlacAudioFormat.h *********/
  9681. #endif
  9682. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9683. /********* Start of inlined file: juce_OggVorbisAudioFormat.h *********/
  9684. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9685. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9686. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9687. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9688. {
  9689. public:
  9690. OggVorbisAudioFormat();
  9691. ~OggVorbisAudioFormat();
  9692. const Array <int> getPossibleSampleRates();
  9693. const Array <int> getPossibleBitDepths();
  9694. bool canDoStereo();
  9695. bool canDoMono();
  9696. bool isCompressed();
  9697. const StringArray getQualityOptions();
  9698. int estimateOggFileQuality (const File& source);
  9699. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9700. const bool deleteStreamIfOpeningFails);
  9701. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9702. double sampleRateToUse,
  9703. unsigned int numberOfChannels,
  9704. int bitsPerSample,
  9705. const StringPairArray& metadataValues,
  9706. int qualityOptionIndex);
  9707. juce_UseDebuggingNewOperator
  9708. };
  9709. #endif
  9710. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9711. /********* End of inlined file: juce_OggVorbisAudioFormat.h *********/
  9712. #endif
  9713. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9714. /********* Start of inlined file: juce_QuickTimeAudioFormat.h *********/
  9715. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9716. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9717. #if JUCE_QUICKTIME
  9718. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  9719. {
  9720. public:
  9721. QuickTimeAudioFormat();
  9722. ~QuickTimeAudioFormat();
  9723. const Array <int> getPossibleSampleRates();
  9724. const Array <int> getPossibleBitDepths();
  9725. bool canDoStereo();
  9726. bool canDoMono();
  9727. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9728. const bool deleteStreamIfOpeningFails);
  9729. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9730. double sampleRateToUse,
  9731. unsigned int numberOfChannels,
  9732. int bitsPerSample,
  9733. const StringPairArray& metadataValues,
  9734. int qualityOptionIndex);
  9735. juce_UseDebuggingNewOperator
  9736. };
  9737. #endif
  9738. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9739. /********* End of inlined file: juce_QuickTimeAudioFormat.h *********/
  9740. #endif
  9741. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9742. /********* Start of inlined file: juce_WavAudioFormat.h *********/
  9743. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9744. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9745. class JUCE_API WavAudioFormat : public AudioFormat
  9746. {
  9747. public:
  9748. WavAudioFormat();
  9749. ~WavAudioFormat();
  9750. static const tchar* const bwavDescription;
  9751. static const tchar* const bwavOriginator;
  9752. static const tchar* const bwavOriginatorRef;
  9753. static const tchar* const bwavOriginationDate;
  9754. static const tchar* const bwavOriginationTime;
  9755. static const tchar* const bwavTimeReference;
  9756. static const tchar* const bwavCodingHistory;
  9757. static const StringPairArray createBWAVMetadata (const String& description,
  9758. const String& originator,
  9759. const String& originatorRef,
  9760. const Time& dateAndTime,
  9761. const int64 timeReferenceSamples,
  9762. const String& codingHistory);
  9763. const Array <int> getPossibleSampleRates();
  9764. const Array <int> getPossibleBitDepths();
  9765. bool canDoStereo();
  9766. bool canDoMono();
  9767. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9768. const bool deleteStreamIfOpeningFails);
  9769. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9770. double sampleRateToUse,
  9771. unsigned int numberOfChannels,
  9772. int bitsPerSample,
  9773. const StringPairArray& metadataValues,
  9774. int qualityOptionIndex);
  9775. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  9776. juce_UseDebuggingNewOperator
  9777. };
  9778. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9779. /********* End of inlined file: juce_WavAudioFormat.h *********/
  9780. #endif
  9781. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9782. /********* Start of inlined file: juce_AudioFormatReaderSource.h *********/
  9783. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9784. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9785. /********* Start of inlined file: juce_PositionableAudioSource.h *********/
  9786. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9787. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9788. class JUCE_API PositionableAudioSource : public AudioSource
  9789. {
  9790. protected:
  9791. PositionableAudioSource() throw() {}
  9792. public:
  9793. ~PositionableAudioSource() {}
  9794. virtual void setNextReadPosition (int newPosition) = 0;
  9795. virtual int getNextReadPosition() const = 0;
  9796. virtual int getTotalLength() const = 0;
  9797. virtual bool isLooping() const = 0;
  9798. };
  9799. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9800. /********* End of inlined file: juce_PositionableAudioSource.h *********/
  9801. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  9802. {
  9803. public:
  9804. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  9805. const bool deleteReaderWhenThisIsDeleted);
  9806. ~AudioFormatReaderSource();
  9807. void setLooping (const bool shouldLoop) throw();
  9808. bool isLooping() const { return looping; }
  9809. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  9810. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9811. void releaseResources();
  9812. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9813. void setNextReadPosition (int newPosition);
  9814. int getNextReadPosition() const;
  9815. int getTotalLength() const;
  9816. juce_UseDebuggingNewOperator
  9817. private:
  9818. AudioFormatReader* reader;
  9819. bool deleteReader;
  9820. int volatile nextPlayPos;
  9821. bool volatile looping;
  9822. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  9823. AudioFormatReaderSource (const AudioFormatReaderSource&);
  9824. const AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  9825. };
  9826. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9827. /********* End of inlined file: juce_AudioFormatReaderSource.h *********/
  9828. #endif
  9829. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9830. #endif
  9831. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9832. /********* Start of inlined file: juce_AudioSourcePlayer.h *********/
  9833. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9834. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9835. /********* Start of inlined file: juce_AudioIODevice.h *********/
  9836. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9837. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9838. class AudioIODevice;
  9839. class JUCE_API AudioIODeviceCallback
  9840. {
  9841. public:
  9842. virtual ~AudioIODeviceCallback() {}
  9843. virtual void audioDeviceIOCallback (const float** inputChannelData,
  9844. int numInputChannels,
  9845. float** outputChannelData,
  9846. int numOutputChannels,
  9847. int numSamples) = 0;
  9848. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  9849. virtual void audioDeviceStopped() = 0;
  9850. };
  9851. class JUCE_API AudioIODevice
  9852. {
  9853. public:
  9854. virtual ~AudioIODevice();
  9855. const String& getName() const throw() { return name; }
  9856. const String& getTypeName() const throw() { return typeName; }
  9857. virtual const StringArray getOutputChannelNames() = 0;
  9858. virtual const StringArray getInputChannelNames() = 0;
  9859. virtual int getNumSampleRates() = 0;
  9860. virtual double getSampleRate (int index) = 0;
  9861. virtual int getNumBufferSizesAvailable() = 0;
  9862. virtual int getBufferSizeSamples (int index) = 0;
  9863. virtual int getDefaultBufferSize() = 0;
  9864. virtual const String open (const BitArray& inputChannels,
  9865. const BitArray& outputChannels,
  9866. double sampleRate,
  9867. int bufferSizeSamples) = 0;
  9868. virtual void close() = 0;
  9869. virtual bool isOpen() = 0;
  9870. virtual void start (AudioIODeviceCallback* callback) = 0;
  9871. virtual void stop() = 0;
  9872. virtual bool isPlaying() = 0;
  9873. virtual const String getLastError() = 0;
  9874. virtual int getCurrentBufferSizeSamples() = 0;
  9875. virtual double getCurrentSampleRate() = 0;
  9876. virtual int getCurrentBitDepth() = 0;
  9877. virtual const BitArray getActiveOutputChannels() const = 0;
  9878. virtual const BitArray getActiveInputChannels() const = 0;
  9879. virtual int getOutputLatencyInSamples() = 0;
  9880. virtual int getInputLatencyInSamples() = 0;
  9881. virtual bool hasControlPanel() const;
  9882. virtual bool showControlPanel();
  9883. protected:
  9884. AudioIODevice (const String& deviceName,
  9885. const String& typeName);
  9886. String name, typeName;
  9887. };
  9888. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9889. /********* End of inlined file: juce_AudioIODevice.h *********/
  9890. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  9891. {
  9892. public:
  9893. AudioSourcePlayer();
  9894. virtual ~AudioSourcePlayer();
  9895. void setSource (AudioSource* newSource);
  9896. AudioSource* getCurrentSource() const throw() { return source; }
  9897. void setGain (const float newGain) throw();
  9898. void audioDeviceIOCallback (const float** inputChannelData,
  9899. int totalNumInputChannels,
  9900. float** outputChannelData,
  9901. int totalNumOutputChannels,
  9902. int numSamples);
  9903. void audioDeviceAboutToStart (AudioIODevice* device);
  9904. void audioDeviceStopped();
  9905. juce_UseDebuggingNewOperator
  9906. private:
  9907. CriticalSection readLock;
  9908. AudioSource* source;
  9909. double sampleRate;
  9910. int bufferSize;
  9911. float* channels [128];
  9912. float* outputChans [128];
  9913. const float* inputChans [128];
  9914. AudioSampleBuffer tempBuffer;
  9915. float lastGain, gain;
  9916. AudioSourcePlayer (const AudioSourcePlayer&);
  9917. const AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  9918. };
  9919. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9920. /********* End of inlined file: juce_AudioSourcePlayer.h *********/
  9921. #endif
  9922. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9923. /********* Start of inlined file: juce_AudioTransportSource.h *********/
  9924. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9925. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9926. /********* Start of inlined file: juce_BufferingAudioSource.h *********/
  9927. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  9928. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  9929. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  9930. {
  9931. public:
  9932. BufferingAudioSource (PositionableAudioSource* source,
  9933. const bool deleteSourceWhenDeleted,
  9934. int numberOfSamplesToBuffer);
  9935. ~BufferingAudioSource();
  9936. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9937. void releaseResources();
  9938. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9939. void setNextReadPosition (int newPosition);
  9940. int getNextReadPosition() const;
  9941. int getTotalLength() const { return source->getTotalLength(); }
  9942. bool isLooping() const { return source->isLooping(); }
  9943. juce_UseDebuggingNewOperator
  9944. private:
  9945. PositionableAudioSource* source;
  9946. bool deleteSourceWhenDeleted;
  9947. int numberOfSamplesToBuffer;
  9948. AudioSampleBuffer buffer;
  9949. CriticalSection bufferStartPosLock;
  9950. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  9951. bool wasSourceLooping;
  9952. double volatile sampleRate;
  9953. friend class SharedBufferingAudioSourceThread;
  9954. bool readNextBufferChunk();
  9955. void readBufferSection (int start, int length, int bufferOffset);
  9956. BufferingAudioSource (const BufferingAudioSource&);
  9957. const BufferingAudioSource& operator= (const BufferingAudioSource&);
  9958. };
  9959. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  9960. /********* End of inlined file: juce_BufferingAudioSource.h *********/
  9961. /********* Start of inlined file: juce_ResamplingAudioSource.h *********/
  9962. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  9963. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  9964. class JUCE_API ResamplingAudioSource : public AudioSource
  9965. {
  9966. public:
  9967. ResamplingAudioSource (AudioSource* const inputSource,
  9968. const bool deleteInputWhenDeleted);
  9969. ~ResamplingAudioSource();
  9970. void setResamplingRatio (const double samplesInPerOutputSample);
  9971. double getResamplingRatio() const throw() { return ratio; }
  9972. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9973. void releaseResources();
  9974. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9975. juce_UseDebuggingNewOperator
  9976. private:
  9977. AudioSource* const input;
  9978. const bool deleteInputWhenDeleted;
  9979. double ratio, lastRatio;
  9980. AudioSampleBuffer buffer;
  9981. int bufferPos, sampsInBuffer;
  9982. double subSampleOffset;
  9983. double coefficients[6];
  9984. CriticalSection ratioLock;
  9985. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  9986. void createLowPass (const double proportionalRate);
  9987. struct FilterState
  9988. {
  9989. double x1, x2, y1, y2;
  9990. };
  9991. FilterState filterStates[2];
  9992. void resetFilters();
  9993. void applyFilter (float* samples, int num, FilterState& fs);
  9994. ResamplingAudioSource (const ResamplingAudioSource&);
  9995. const ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  9996. };
  9997. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  9998. /********* End of inlined file: juce_ResamplingAudioSource.h *********/
  9999. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10000. public ChangeBroadcaster
  10001. {
  10002. public:
  10003. AudioTransportSource();
  10004. ~AudioTransportSource();
  10005. void setSource (PositionableAudioSource* const newSource,
  10006. int readAheadBufferSize = 0,
  10007. double sourceSampleRateToCorrectFor = 0.0);
  10008. void setPosition (double newPosition);
  10009. double getCurrentPosition() const;
  10010. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10011. void start();
  10012. void stop();
  10013. bool isPlaying() const throw() { return playing; }
  10014. void setGain (const float newGain) throw();
  10015. float getGain() const throw() { return gain; }
  10016. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10017. void releaseResources();
  10018. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10019. void setNextReadPosition (int newPosition);
  10020. int getNextReadPosition() const;
  10021. int getTotalLength() const;
  10022. bool isLooping() const;
  10023. juce_UseDebuggingNewOperator
  10024. private:
  10025. PositionableAudioSource* source;
  10026. ResamplingAudioSource* resamplerSource;
  10027. BufferingAudioSource* bufferingSource;
  10028. PositionableAudioSource* positionableSource;
  10029. AudioSource* masterSource;
  10030. CriticalSection callbackLock;
  10031. float volatile gain, lastGain;
  10032. bool volatile playing, stopped;
  10033. double sampleRate, sourceSampleRate;
  10034. int blockSize, readAheadBufferSize;
  10035. bool isPrepared, inputStreamEOF;
  10036. AudioTransportSource (const AudioTransportSource&);
  10037. const AudioTransportSource& operator= (const AudioTransportSource&);
  10038. };
  10039. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10040. /********* End of inlined file: juce_AudioTransportSource.h *********/
  10041. #endif
  10042. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10043. #endif
  10044. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10045. /********* Start of inlined file: juce_ChannelRemappingAudioSource.h *********/
  10046. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10047. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10048. class ChannelRemappingAudioSource : public AudioSource
  10049. {
  10050. public:
  10051. ChannelRemappingAudioSource (AudioSource* const source,
  10052. const bool deleteSourceWhenDeleted);
  10053. ~ChannelRemappingAudioSource();
  10054. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10055. void clearAllMappings() throw();
  10056. void setInputChannelMapping (const int destChannelIndex,
  10057. const int sourceChannelIndex) throw();
  10058. void setOutputChannelMapping (const int sourceChannelIndex,
  10059. const int destChannelIndex) throw();
  10060. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10061. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10062. XmlElement* createXml() const throw();
  10063. void restoreFromXml (const XmlElement& e) throw();
  10064. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10065. void releaseResources();
  10066. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10067. juce_UseDebuggingNewOperator
  10068. private:
  10069. int requiredNumberOfChannels;
  10070. Array <int> remappedInputs, remappedOutputs;
  10071. AudioSource* const source;
  10072. const bool deleteSourceWhenDeleted;
  10073. AudioSampleBuffer buffer;
  10074. AudioSourceChannelInfo remappedInfo;
  10075. CriticalSection lock;
  10076. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10077. const ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10078. };
  10079. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10080. /********* End of inlined file: juce_ChannelRemappingAudioSource.h *********/
  10081. #endif
  10082. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10083. /********* Start of inlined file: juce_IIRFilterAudioSource.h *********/
  10084. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10085. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10086. /********* Start of inlined file: juce_IIRFilter.h *********/
  10087. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10088. #define __JUCE_IIRFILTER_JUCEHEADER__
  10089. class JUCE_API IIRFilter
  10090. {
  10091. public:
  10092. IIRFilter() throw();
  10093. IIRFilter (const IIRFilter& other) throw();
  10094. ~IIRFilter() throw();
  10095. void reset() throw();
  10096. void processSamples (float* const samples,
  10097. const int numSamples) throw();
  10098. float processSingleSampleRaw (const float sample) throw();
  10099. void makeLowPass (const double sampleRate,
  10100. const double frequency) throw();
  10101. void makeHighPass (const double sampleRate,
  10102. const double frequency) throw();
  10103. void makeLowShelf (const double sampleRate,
  10104. const double cutOffFrequency,
  10105. const double Q,
  10106. const float gainFactor) throw();
  10107. void makeHighShelf (const double sampleRate,
  10108. const double cutOffFrequency,
  10109. const double Q,
  10110. const float gainFactor) throw();
  10111. void makeBandPass (const double sampleRate,
  10112. const double centreFrequency,
  10113. const double Q,
  10114. const float gainFactor) throw();
  10115. void makeInactive() throw();
  10116. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10117. juce_UseDebuggingNewOperator
  10118. protected:
  10119. CriticalSection processLock;
  10120. void setCoefficients (double c1, double c2, double c3,
  10121. double c4, double c5, double c6) throw();
  10122. bool active;
  10123. float coefficients[6];
  10124. float x1, x2, y1, y2;
  10125. // (use the copyCoefficientsFrom() method instead of this operator)
  10126. const IIRFilter& operator= (const IIRFilter&);
  10127. };
  10128. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10129. /********* End of inlined file: juce_IIRFilter.h *********/
  10130. class JUCE_API IIRFilterAudioSource : public AudioSource
  10131. {
  10132. public:
  10133. IIRFilterAudioSource (AudioSource* const inputSource,
  10134. const bool deleteInputWhenDeleted);
  10135. ~IIRFilterAudioSource();
  10136. void setFilterParameters (const IIRFilter& newSettings);
  10137. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10138. void releaseResources();
  10139. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10140. juce_UseDebuggingNewOperator
  10141. private:
  10142. AudioSource* const input;
  10143. const bool deleteInputWhenDeleted;
  10144. OwnedArray <IIRFilter> iirFilters;
  10145. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10146. const IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10147. };
  10148. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10149. /********* End of inlined file: juce_IIRFilterAudioSource.h *********/
  10150. #endif
  10151. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10152. /********* Start of inlined file: juce_MixerAudioSource.h *********/
  10153. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10154. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10155. class JUCE_API MixerAudioSource : public AudioSource
  10156. {
  10157. public:
  10158. MixerAudioSource();
  10159. ~MixerAudioSource();
  10160. void addInputSource (AudioSource* newInput,
  10161. const bool deleteWhenRemoved);
  10162. void removeInputSource (AudioSource* input,
  10163. const bool deleteSource);
  10164. void removeAllInputs();
  10165. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10166. void releaseResources();
  10167. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10168. juce_UseDebuggingNewOperator
  10169. private:
  10170. VoidArray inputs;
  10171. BitArray inputsToDelete;
  10172. CriticalSection lock;
  10173. AudioSampleBuffer tempBuffer;
  10174. double currentSampleRate;
  10175. int bufferSizeExpected;
  10176. MixerAudioSource (const MixerAudioSource&);
  10177. const MixerAudioSource& operator= (const MixerAudioSource&);
  10178. };
  10179. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10180. /********* End of inlined file: juce_MixerAudioSource.h *********/
  10181. #endif
  10182. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10183. #endif
  10184. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10185. #endif
  10186. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10187. /********* Start of inlined file: juce_ToneGeneratorAudioSource.h *********/
  10188. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10189. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10190. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10191. {
  10192. public:
  10193. ToneGeneratorAudioSource();
  10194. ~ToneGeneratorAudioSource();
  10195. void setAmplitude (const float newAmplitude);
  10196. void setFrequency (const double newFrequencyHz);
  10197. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10198. void releaseResources();
  10199. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10200. juce_UseDebuggingNewOperator
  10201. private:
  10202. double frequency, sampleRate;
  10203. double currentPhase, phasePerSample;
  10204. float amplitude;
  10205. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10206. const ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10207. };
  10208. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10209. /********* End of inlined file: juce_ToneGeneratorAudioSource.h *********/
  10210. #endif
  10211. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10212. /********* Start of inlined file: juce_AudioDeviceManager.h *********/
  10213. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10214. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10215. /********* Start of inlined file: juce_AudioIODeviceType.h *********/
  10216. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10217. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10218. class AudioDeviceManager;
  10219. class Component;
  10220. class JUCE_API AudioIODeviceType
  10221. {
  10222. public:
  10223. const String& getTypeName() const throw() { return typeName; }
  10224. virtual void scanForDevices() = 0;
  10225. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10226. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10227. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10228. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10229. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10230. const String& inputDeviceName) = 0;
  10231. struct DeviceSetupDetails
  10232. {
  10233. AudioDeviceManager* manager;
  10234. int minNumInputChannels, maxNumInputChannels;
  10235. int minNumOutputChannels, maxNumOutputChannels;
  10236. bool useStereoPairs;
  10237. };
  10238. virtual ~AudioIODeviceType();
  10239. protected:
  10240. AudioIODeviceType (const tchar* const typeName);
  10241. private:
  10242. String typeName;
  10243. AudioIODeviceType (const AudioIODeviceType&);
  10244. const AudioIODeviceType& operator= (const AudioIODeviceType&);
  10245. };
  10246. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10247. /********* End of inlined file: juce_AudioIODeviceType.h *********/
  10248. /********* Start of inlined file: juce_MidiInput.h *********/
  10249. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10250. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10251. /********* Start of inlined file: juce_MidiMessage.h *********/
  10252. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10253. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10254. class JUCE_API MidiMessage
  10255. {
  10256. public:
  10257. MidiMessage (const int byte1,
  10258. const int byte2,
  10259. const int byte3,
  10260. const double timeStamp = 0) throw();
  10261. MidiMessage (const int byte1,
  10262. const int byte2,
  10263. const double timeStamp = 0) throw();
  10264. MidiMessage (const int byte1,
  10265. const double timeStamp = 0) throw();
  10266. MidiMessage (const uint8* const data,
  10267. const int dataSize,
  10268. const double timeStamp = 0) throw();
  10269. MidiMessage (const uint8* data,
  10270. int size,
  10271. int& numBytesUsed,
  10272. uint8 lastStatusByte,
  10273. double timeStamp = 0) throw();
  10274. MidiMessage (const MidiMessage& other) throw();
  10275. MidiMessage (const MidiMessage& other,
  10276. const double newTimeStamp) throw();
  10277. ~MidiMessage() throw();
  10278. const MidiMessage& operator= (const MidiMessage& other) throw();
  10279. uint8* getRawData() const throw() { return data; }
  10280. int getRawDataSize() const throw() { return size; }
  10281. double getTimeStamp() const throw() { return timeStamp; }
  10282. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10283. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10284. int getChannel() const throw();
  10285. bool isForChannel (const int channelNumber) const throw();
  10286. void setChannel (const int newChannelNumber) throw();
  10287. bool isSysEx() const throw();
  10288. const uint8* getSysExData() const throw();
  10289. int getSysExDataSize() const throw();
  10290. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10291. static const MidiMessage noteOn (const int channel,
  10292. const int noteNumber,
  10293. const float velocity) throw();
  10294. static const MidiMessage noteOn (const int channel,
  10295. const int noteNumber,
  10296. const uint8 velocity) throw();
  10297. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10298. static const MidiMessage noteOff (const int channel,
  10299. const int noteNumber) throw();
  10300. bool isNoteOnOrOff() const throw();
  10301. int getNoteNumber() const throw();
  10302. void setNoteNumber (const int newNoteNumber) throw();
  10303. uint8 getVelocity() const throw();
  10304. float getFloatVelocity() const throw();
  10305. void setVelocity (const float newVelocity) throw();
  10306. void multiplyVelocity (const float scaleFactor) throw();
  10307. bool isProgramChange() const throw();
  10308. int getProgramChangeNumber() const throw();
  10309. static const MidiMessage programChange (const int channel,
  10310. const int programNumber) throw();
  10311. bool isPitchWheel() const throw();
  10312. int getPitchWheelValue() const throw();
  10313. static const MidiMessage pitchWheel (const int channel,
  10314. const int position) throw();
  10315. bool isAftertouch() const throw();
  10316. int getAfterTouchValue() const throw();
  10317. static const MidiMessage aftertouchChange (const int channel,
  10318. const int noteNumber,
  10319. const int aftertouchAmount) throw();
  10320. bool isChannelPressure() const throw();
  10321. int getChannelPressureValue() const throw();
  10322. static const MidiMessage channelPressureChange (const int channel,
  10323. const int pressure) throw();
  10324. bool isController() const throw();
  10325. int getControllerNumber() const throw();
  10326. int getControllerValue() const throw();
  10327. static const MidiMessage controllerEvent (const int channel,
  10328. const int controllerType,
  10329. const int value) throw();
  10330. bool isAllNotesOff() const throw();
  10331. bool isAllSoundOff() const throw();
  10332. static const MidiMessage allNotesOff (const int channel) throw();
  10333. static const MidiMessage allSoundOff (const int channel) throw();
  10334. static const MidiMessage allControllersOff (const int channel) throw();
  10335. bool isMetaEvent() const throw();
  10336. int getMetaEventType() const throw();
  10337. const uint8* getMetaEventData() const throw();
  10338. int getMetaEventLength() const throw();
  10339. bool isTrackMetaEvent() const throw();
  10340. bool isEndOfTrackMetaEvent() const throw();
  10341. static const MidiMessage endOfTrack() throw();
  10342. bool isTrackNameEvent() const throw();
  10343. bool isTextMetaEvent() const throw();
  10344. const String getTextFromTextMetaEvent() const throw();
  10345. bool isTempoMetaEvent() const throw();
  10346. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10347. double getTempoSecondsPerQuarterNote() const throw();
  10348. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10349. bool isTimeSignatureMetaEvent() const throw();
  10350. void getTimeSignatureInfo (int& numerator,
  10351. int& denominator) const throw();
  10352. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10353. const int denominator) throw();
  10354. bool isKeySignatureMetaEvent() const throw();
  10355. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10356. bool isMidiChannelMetaEvent() const throw();
  10357. int getMidiChannelMetaEventChannel() const throw();
  10358. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10359. bool isActiveSense() const throw();
  10360. bool isMidiStart() const throw();
  10361. static const MidiMessage midiStart() throw();
  10362. bool isMidiContinue() const throw();
  10363. static const MidiMessage midiContinue() throw();
  10364. bool isMidiStop() const throw();
  10365. static const MidiMessage midiStop() throw();
  10366. bool isMidiClock() const throw();
  10367. static const MidiMessage midiClock() throw();
  10368. bool isSongPositionPointer() const throw();
  10369. int getSongPositionPointerMidiBeat() const throw();
  10370. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10371. bool isQuarterFrame() const throw();
  10372. int getQuarterFrameSequenceNumber() const throw();
  10373. int getQuarterFrameValue() const throw();
  10374. static const MidiMessage quarterFrame (const int sequenceNumber,
  10375. const int value) throw();
  10376. enum SmpteTimecodeType
  10377. {
  10378. fps24 = 0,
  10379. fps25 = 1,
  10380. fps30drop = 2,
  10381. fps30 = 3
  10382. };
  10383. bool isFullFrame() const throw();
  10384. void getFullFrameParameters (int& hours,
  10385. int& minutes,
  10386. int& seconds,
  10387. int& frames,
  10388. SmpteTimecodeType& timecodeType) const throw();
  10389. static const MidiMessage fullFrame (const int hours,
  10390. const int minutes,
  10391. const int seconds,
  10392. const int frames,
  10393. SmpteTimecodeType timecodeType);
  10394. enum MidiMachineControlCommand
  10395. {
  10396. mmc_stop = 1,
  10397. mmc_play = 2,
  10398. mmc_deferredplay = 3,
  10399. mmc_fastforward = 4,
  10400. mmc_rewind = 5,
  10401. mmc_recordStart = 6,
  10402. mmc_recordStop = 7,
  10403. mmc_pause = 9
  10404. };
  10405. bool isMidiMachineControlMessage() const throw();
  10406. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10407. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10408. bool isMidiMachineControlGoto (int& hours,
  10409. int& minutes,
  10410. int& seconds,
  10411. int& frames) const throw();
  10412. static const MidiMessage midiMachineControlGoto (int hours,
  10413. int minutes,
  10414. int seconds,
  10415. int frames);
  10416. static const MidiMessage masterVolume (const float volume) throw();
  10417. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10418. const int dataSize) throw();
  10419. static int readVariableLengthVal (const uint8* data,
  10420. int& numBytesUsed) throw();
  10421. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10422. static const String getMidiNoteName (int noteNumber,
  10423. bool useSharps,
  10424. bool includeOctaveNumber,
  10425. int octaveNumForMiddleC) throw();
  10426. static const double getMidiNoteInHertz (int noteNumber) throw();
  10427. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10428. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10429. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10430. static const String getControllerName (int controllerNumber) throw();
  10431. juce_UseDebuggingNewOperator
  10432. private:
  10433. double timeStamp;
  10434. uint8* data;
  10435. int message, size;
  10436. };
  10437. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10438. /********* End of inlined file: juce_MidiMessage.h *********/
  10439. class MidiInput;
  10440. class JUCE_API MidiInputCallback
  10441. {
  10442. public:
  10443. virtual ~MidiInputCallback() {}
  10444. virtual void handleIncomingMidiMessage (MidiInput* source,
  10445. const MidiMessage& message) = 0;
  10446. virtual void handlePartialSysexMessage (MidiInput* source,
  10447. const uint8* messageData,
  10448. const int numBytesSoFar,
  10449. const double timestamp)
  10450. {
  10451. // (this bit is just to avoid compiler warnings about unused variables)
  10452. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10453. }
  10454. };
  10455. class JUCE_API MidiInput
  10456. {
  10457. public:
  10458. static const StringArray getDevices();
  10459. static int getDefaultDeviceIndex();
  10460. static MidiInput* openDevice (int deviceIndex,
  10461. MidiInputCallback* callback);
  10462. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10463. static MidiInput* createNewDevice (const String& deviceName,
  10464. MidiInputCallback* callback);
  10465. #endif
  10466. virtual ~MidiInput();
  10467. virtual const String getName() const throw() { return name; }
  10468. virtual void setName (const String& newName) throw() { name = newName; }
  10469. virtual void start();
  10470. virtual void stop();
  10471. juce_UseDebuggingNewOperator
  10472. protected:
  10473. String name;
  10474. void* internal;
  10475. MidiInput (const String& name);
  10476. MidiInput (const MidiInput&);
  10477. };
  10478. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10479. /********* End of inlined file: juce_MidiInput.h *********/
  10480. /********* Start of inlined file: juce_MidiOutput.h *********/
  10481. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10482. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10483. /********* Start of inlined file: juce_MidiBuffer.h *********/
  10484. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10485. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10486. class JUCE_API MidiBuffer
  10487. {
  10488. public:
  10489. MidiBuffer() throw();
  10490. MidiBuffer (const MidiMessage& message) throw();
  10491. MidiBuffer (const MidiBuffer& other) throw();
  10492. const MidiBuffer& operator= (const MidiBuffer& other) throw();
  10493. ~MidiBuffer() throw();
  10494. void clear() throw();
  10495. void clear (const int start,
  10496. const int numSamples) throw();
  10497. bool isEmpty() const throw();
  10498. int getNumEvents() const throw();
  10499. void addEvent (const MidiMessage& midiMessage,
  10500. const int sampleNumber) throw();
  10501. void addEvent (const uint8* const rawMidiData,
  10502. const int maxBytesOfMidiData,
  10503. const int sampleNumber) throw();
  10504. void addEvents (const MidiBuffer& otherBuffer,
  10505. const int startSample,
  10506. const int numSamples,
  10507. const int sampleDeltaToAdd) throw();
  10508. int getFirstEventTime() const throw();
  10509. int getLastEventTime() const throw();
  10510. void swap (MidiBuffer& other);
  10511. class Iterator
  10512. {
  10513. public:
  10514. Iterator (const MidiBuffer& buffer) throw();
  10515. ~Iterator() throw();
  10516. void setNextSamplePosition (const int samplePosition) throw();
  10517. bool getNextEvent (MidiMessage& result,
  10518. int& samplePosition) throw();
  10519. bool getNextEvent (const uint8* &midiData,
  10520. int& numBytesOfMidiData,
  10521. int& samplePosition) throw();
  10522. juce_UseDebuggingNewOperator
  10523. private:
  10524. const MidiBuffer& buffer;
  10525. const uint8* data;
  10526. Iterator (const Iterator&);
  10527. const Iterator& operator= (const Iterator&);
  10528. };
  10529. juce_UseDebuggingNewOperator
  10530. private:
  10531. friend class MidiBuffer::Iterator;
  10532. MemoryBlock data;
  10533. int bytesUsed;
  10534. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10535. };
  10536. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10537. /********* End of inlined file: juce_MidiBuffer.h *********/
  10538. class JUCE_API MidiOutput : private Thread
  10539. {
  10540. public:
  10541. static const StringArray getDevices();
  10542. static int getDefaultDeviceIndex();
  10543. static MidiOutput* openDevice (int deviceIndex);
  10544. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10545. static MidiOutput* createNewDevice (const String& deviceName);
  10546. #endif
  10547. virtual ~MidiOutput();
  10548. virtual void sendMessageNow (const MidiMessage& message);
  10549. virtual void reset();
  10550. virtual bool getVolume (float& leftVol,
  10551. float& rightVol);
  10552. virtual void setVolume (float leftVol,
  10553. float rightVol);
  10554. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10555. const double millisecondCounterToStartAt,
  10556. double samplesPerSecondForBuffer) throw();
  10557. virtual void clearAllPendingMessages() throw();
  10558. virtual void startBackgroundThread() throw();
  10559. virtual void stopBackgroundThread() throw();
  10560. juce_UseDebuggingNewOperator
  10561. protected:
  10562. void* internal;
  10563. struct PendingMessage
  10564. {
  10565. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10566. MidiMessage message;
  10567. PendingMessage* next;
  10568. juce_UseDebuggingNewOperator
  10569. };
  10570. CriticalSection lock;
  10571. PendingMessage* firstMessage;
  10572. MidiOutput() throw();
  10573. MidiOutput (const MidiOutput&);
  10574. void run();
  10575. };
  10576. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10577. /********* End of inlined file: juce_MidiOutput.h *********/
  10578. /********* Start of inlined file: juce_ComboBox.h *********/
  10579. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10580. #define __JUCE_COMBOBOX_JUCEHEADER__
  10581. /********* Start of inlined file: juce_Label.h *********/
  10582. #ifndef __JUCE_LABEL_JUCEHEADER__
  10583. #define __JUCE_LABEL_JUCEHEADER__
  10584. /********* Start of inlined file: juce_ComponentDeletionWatcher.h *********/
  10585. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10586. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10587. class JUCE_API ComponentDeletionWatcher
  10588. {
  10589. public:
  10590. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  10591. ~ComponentDeletionWatcher() throw();
  10592. bool hasBeenDeleted() const throw();
  10593. const Component* getComponent() const throw();
  10594. juce_UseDebuggingNewOperator
  10595. private:
  10596. const Component* const componentToWatch;
  10597. const uint32 componentUID;
  10598. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  10599. const ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  10600. };
  10601. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10602. /********* End of inlined file: juce_ComponentDeletionWatcher.h *********/
  10603. /********* Start of inlined file: juce_TextEditor.h *********/
  10604. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10605. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10606. /********* Start of inlined file: juce_Viewport.h *********/
  10607. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10608. #define __JUCE_VIEWPORT_JUCEHEADER__
  10609. /********* Start of inlined file: juce_ScrollBar.h *********/
  10610. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10611. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10612. /********* Start of inlined file: juce_Button.h *********/
  10613. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10614. #define __JUCE_BUTTON_JUCEHEADER__
  10615. /********* Start of inlined file: juce_TooltipWindow.h *********/
  10616. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10617. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10618. /********* Start of inlined file: juce_TooltipClient.h *********/
  10619. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10620. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10621. class JUCE_API TooltipClient
  10622. {
  10623. public:
  10624. virtual ~TooltipClient() {}
  10625. virtual const String getTooltip() = 0;
  10626. };
  10627. class JUCE_API SettableTooltipClient : public TooltipClient
  10628. {
  10629. public:
  10630. virtual ~SettableTooltipClient() {}
  10631. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10632. virtual const String getTooltip() { return tooltipString; }
  10633. juce_UseDebuggingNewOperator
  10634. protected:
  10635. String tooltipString;
  10636. };
  10637. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10638. /********* End of inlined file: juce_TooltipClient.h *********/
  10639. class JUCE_API TooltipWindow : public Component,
  10640. private Timer
  10641. {
  10642. public:
  10643. TooltipWindow (Component* parentComponent = 0,
  10644. const int millisecondsBeforeTipAppears = 700);
  10645. ~TooltipWindow();
  10646. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10647. enum ColourIds
  10648. {
  10649. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10650. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10651. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10652. };
  10653. juce_UseDebuggingNewOperator
  10654. private:
  10655. int millisecondsBeforeTipAppears;
  10656. int mouseX, mouseY, mouseClicks;
  10657. unsigned int lastCompChangeTime, lastHideTime;
  10658. Component* lastComponentUnderMouse;
  10659. bool changedCompsSinceShown;
  10660. String tipShowing, lastTipUnderMouse;
  10661. void paint (Graphics& g);
  10662. void mouseEnter (const MouseEvent& e);
  10663. void timerCallback();
  10664. static const String getTipFor (Component* const c);
  10665. void showFor (const String& tip);
  10666. void hide();
  10667. TooltipWindow (const TooltipWindow&);
  10668. const TooltipWindow& operator= (const TooltipWindow&);
  10669. };
  10670. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10671. /********* End of inlined file: juce_TooltipWindow.h *********/
  10672. class Button;
  10673. class JUCE_API ButtonListener
  10674. {
  10675. public:
  10676. virtual ~ButtonListener() {}
  10677. virtual void buttonClicked (Button* button) = 0;
  10678. virtual void buttonStateChanged (Button*) {}
  10679. };
  10680. class JUCE_API Button : public Component,
  10681. public SettableTooltipClient,
  10682. public ApplicationCommandManagerListener,
  10683. public Value::Listener,
  10684. private KeyListener
  10685. {
  10686. protected:
  10687. Button (const String& buttonName);
  10688. public:
  10689. virtual ~Button();
  10690. void setButtonText (const String& newText);
  10691. const String getButtonText() const { return text; }
  10692. bool isDown() const throw();
  10693. bool isOver() const throw();
  10694. void setToggleState (const bool shouldBeOn,
  10695. const bool sendChangeNotification);
  10696. bool getToggleState() const throw() { return isOn.getValue(); }
  10697. Value& getToggleStateValue() { return isOn; }
  10698. void setClickingTogglesState (const bool shouldToggle) throw();
  10699. bool getClickingTogglesState() const throw();
  10700. void setRadioGroupId (const int newGroupId);
  10701. int getRadioGroupId() const throw() { return radioGroupId; }
  10702. void addButtonListener (ButtonListener* const newListener);
  10703. void removeButtonListener (ButtonListener* const listener);
  10704. virtual void triggerClick();
  10705. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10706. const int commandID,
  10707. const bool generateTooltip);
  10708. int getCommandID() const throw() { return commandID; }
  10709. void addShortcut (const KeyPress& key);
  10710. void clearShortcuts();
  10711. bool isRegisteredForShortcut (const KeyPress& key) const;
  10712. void setRepeatSpeed (const int initialDelayInMillisecs,
  10713. const int repeatDelayInMillisecs,
  10714. const int minimumDelayInMillisecs = -1) throw();
  10715. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  10716. uint32 getMillisecondsSinceButtonDown() const throw();
  10717. void setVisible (bool shouldBeVisible);
  10718. void setTooltip (const String& newTooltip);
  10719. // (implementation of the TooltipClient method)
  10720. const String getTooltip();
  10721. enum ConnectedEdgeFlags
  10722. {
  10723. ConnectedOnLeft = 1,
  10724. ConnectedOnRight = 2,
  10725. ConnectedOnTop = 4,
  10726. ConnectedOnBottom = 8
  10727. };
  10728. void setConnectedEdges (const int connectedEdgeFlags);
  10729. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  10730. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  10731. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  10732. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  10733. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  10734. enum ButtonState
  10735. {
  10736. buttonNormal,
  10737. buttonOver,
  10738. buttonDown
  10739. };
  10740. void setState (const ButtonState newState);
  10741. juce_UseDebuggingNewOperator
  10742. protected:
  10743. virtual void clicked();
  10744. virtual void clicked (const ModifierKeys& modifiers);
  10745. virtual void paintButton (Graphics& g,
  10746. bool isMouseOverButton,
  10747. bool isButtonDown) = 0;
  10748. virtual void buttonStateChanged();
  10749. virtual void internalClickCallback (const ModifierKeys& modifiers);
  10750. void handleCommandMessage (int commandId);
  10751. void mouseEnter (const MouseEvent& e);
  10752. void mouseExit (const MouseEvent& e);
  10753. void mouseDown (const MouseEvent& e);
  10754. void mouseDrag (const MouseEvent& e);
  10755. void mouseUp (const MouseEvent& e);
  10756. bool keyPressed (const KeyPress& key);
  10757. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  10758. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  10759. void paint (Graphics& g);
  10760. void parentHierarchyChanged();
  10761. void focusGained (FocusChangeType cause);
  10762. void focusLost (FocusChangeType cause);
  10763. void enablementChanged();
  10764. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  10765. void applicationCommandListChanged();
  10766. void valueChanged (Value& value);
  10767. private:
  10768. Array <KeyPress> shortcuts;
  10769. Component* keySource;
  10770. String text;
  10771. SortedSet <void*> buttonListeners;
  10772. class RepeatTimer;
  10773. friend class ScopedPointer <RepeatTimer>;
  10774. ScopedPointer <RepeatTimer> repeatTimer;
  10775. uint32 buttonPressTime, lastTimeCallbackTime;
  10776. ApplicationCommandManager* commandManagerToUse;
  10777. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  10778. int radioGroupId, commandID, connectedEdgeFlags;
  10779. ButtonState buttonState;
  10780. Value isOn;
  10781. bool lastToggleState : 1;
  10782. bool clickTogglesState : 1;
  10783. bool needsToRelease : 1;
  10784. bool needsRepainting : 1;
  10785. bool isKeyDown : 1;
  10786. bool triggerOnMouseDown : 1;
  10787. bool generateTooltip : 1;
  10788. void repeatTimerCallback();
  10789. RepeatTimer& getRepeatTimer();
  10790. ButtonState updateState (const MouseEvent* const e);
  10791. bool isShortcutPressed() const;
  10792. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  10793. void flashButtonState();
  10794. void sendClickMessage (const ModifierKeys& modifiers);
  10795. void sendStateMessage();
  10796. Button (const Button&);
  10797. const Button& operator= (const Button&);
  10798. };
  10799. #endif // __JUCE_BUTTON_JUCEHEADER__
  10800. /********* End of inlined file: juce_Button.h *********/
  10801. class ScrollBar;
  10802. class JUCE_API ScrollBarListener
  10803. {
  10804. public:
  10805. virtual ~ScrollBarListener() {}
  10806. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  10807. const double newRangeStart) = 0;
  10808. };
  10809. class JUCE_API ScrollBar : public Component,
  10810. public AsyncUpdater,
  10811. private Timer
  10812. {
  10813. public:
  10814. ScrollBar (const bool isVertical,
  10815. const bool buttonsAreVisible = true);
  10816. ~ScrollBar();
  10817. bool isVertical() const throw() { return vertical; }
  10818. void setOrientation (const bool shouldBeVertical) throw();
  10819. void setButtonVisibility (const bool buttonsAreVisible);
  10820. void setAutoHide (const bool shouldHideWhenFullRange);
  10821. void setRangeLimits (const double minimum,
  10822. const double maximum) throw();
  10823. double getMinimumRangeLimit() const throw() { return minimum; }
  10824. double getMaximumRangeLimit() const throw() { return maximum; }
  10825. void setCurrentRange (double newStart,
  10826. double newSize) throw();
  10827. void setCurrentRangeStart (double newStart) throw();
  10828. double getCurrentRangeStart() const throw() { return rangeStart; }
  10829. double getCurrentRangeSize() const throw() { return rangeSize; }
  10830. void setSingleStepSize (const double newSingleStepSize) throw();
  10831. void moveScrollbarInSteps (const int howManySteps) throw();
  10832. void moveScrollbarInPages (const int howManyPages) throw();
  10833. void scrollToTop() throw();
  10834. void scrollToBottom() throw();
  10835. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  10836. const int repeatDelayInMillisecs,
  10837. const int minimumDelayInMillisecs = -1) throw();
  10838. enum ColourIds
  10839. {
  10840. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  10841. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  10842. 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. */
  10843. };
  10844. void addListener (ScrollBarListener* const listener) throw();
  10845. void removeListener (ScrollBarListener* const listener) throw();
  10846. bool keyPressed (const KeyPress& key);
  10847. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10848. void lookAndFeelChanged();
  10849. void handleAsyncUpdate();
  10850. void mouseDown (const MouseEvent& e);
  10851. void mouseDrag (const MouseEvent& e);
  10852. void mouseUp (const MouseEvent& e);
  10853. void paint (Graphics& g);
  10854. void resized();
  10855. juce_UseDebuggingNewOperator
  10856. private:
  10857. double minimum, maximum;
  10858. double rangeStart, rangeSize;
  10859. double singleStepSize, dragStartRange;
  10860. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  10861. int dragStartMousePos, lastMousePos;
  10862. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  10863. bool vertical, isDraggingThumb, alwaysVisible;
  10864. Button* upButton;
  10865. Button* downButton;
  10866. SortedSet <void*> listeners;
  10867. void updateThumbPosition() throw();
  10868. void timerCallback();
  10869. ScrollBar (const ScrollBar&);
  10870. const ScrollBar& operator= (const ScrollBar&);
  10871. };
  10872. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  10873. /********* End of inlined file: juce_ScrollBar.h *********/
  10874. class JUCE_API Viewport : public Component,
  10875. private ComponentListener,
  10876. private ScrollBarListener
  10877. {
  10878. public:
  10879. Viewport (const String& componentName = String::empty);
  10880. ~Viewport();
  10881. void setViewedComponent (Component* const newViewedComponent);
  10882. Component* getViewedComponent() const throw() { return contentComp; }
  10883. void setViewPosition (const int xPixelsOffset,
  10884. const int yPixelsOffset);
  10885. void setViewPositionProportionately (const double proportionX,
  10886. const double proportionY);
  10887. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  10888. int getViewPositionX() const throw() { return lastVX; }
  10889. int getViewPositionY() const throw() { return lastVY; }
  10890. int getViewWidth() const throw() { return lastVW; }
  10891. int getViewHeight() const throw() { return lastVH; }
  10892. int getMaximumVisibleWidth() const throw();
  10893. int getMaximumVisibleHeight() const throw();
  10894. virtual void visibleAreaChanged (int visibleX, int visibleY,
  10895. int visibleW, int visibleH);
  10896. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  10897. const bool showHorizontalScrollbarIfNeeded);
  10898. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  10899. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  10900. void setScrollBarThickness (const int thickness);
  10901. int getScrollBarThickness() const throw();
  10902. void setSingleStepSizes (const int stepX, const int stepY);
  10903. void setScrollBarButtonVisibility (const bool buttonsVisible);
  10904. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  10905. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  10906. juce_UseDebuggingNewOperator
  10907. void resized();
  10908. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  10909. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10910. bool keyPressed (const KeyPress& key);
  10911. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  10912. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10913. private:
  10914. Component* contentComp;
  10915. int lastVX, lastVY, lastVW, lastVH;
  10916. int scrollBarThickness;
  10917. int singleStepX, singleStepY;
  10918. bool showHScrollbar, showVScrollbar;
  10919. Component* contentHolder;
  10920. ScrollBar* verticalScrollBar;
  10921. ScrollBar* horizontalScrollBar;
  10922. void updateVisibleRegion();
  10923. Viewport (const Viewport&);
  10924. const Viewport& operator= (const Viewport&);
  10925. };
  10926. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  10927. /********* End of inlined file: juce_Viewport.h *********/
  10928. /********* Start of inlined file: juce_PopupMenu.h *********/
  10929. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  10930. #define __JUCE_POPUPMENU_JUCEHEADER__
  10931. /********* Start of inlined file: juce_PopupMenuCustomComponent.h *********/
  10932. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10933. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10934. class JUCE_API PopupMenuCustomComponent : public Component
  10935. {
  10936. public:
  10937. ~PopupMenuCustomComponent();
  10938. virtual void getIdealSize (int& idealWidth,
  10939. int& idealHeight) = 0;
  10940. void triggerMenuItem();
  10941. bool isItemHighlighted() const throw() { return isHighlighted; }
  10942. protected:
  10943. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  10944. private:
  10945. friend class MenuItemInfo;
  10946. friend class MenuItemComponent;
  10947. friend class PopupMenuWindow;
  10948. int refCount_;
  10949. bool isHighlighted, isTriggeredAutomatically;
  10950. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  10951. const PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  10952. };
  10953. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10954. /********* End of inlined file: juce_PopupMenuCustomComponent.h *********/
  10955. class JUCE_API PopupMenu
  10956. {
  10957. public:
  10958. PopupMenu();
  10959. PopupMenu (const PopupMenu& other);
  10960. ~PopupMenu();
  10961. const PopupMenu& operator= (const PopupMenu& other);
  10962. void clear();
  10963. void addItem (const int itemResultId,
  10964. const String& itemText,
  10965. const bool isActive = true,
  10966. const bool isTicked = false,
  10967. const Image* const iconToUse = 0);
  10968. void addCommandItem (ApplicationCommandManager* commandManager,
  10969. const int commandID,
  10970. const String& displayName = String::empty);
  10971. void addColouredItem (const int itemResultId,
  10972. const String& itemText,
  10973. const Colour& itemTextColour,
  10974. const bool isActive = true,
  10975. const bool isTicked = false,
  10976. const Image* const iconToUse = 0);
  10977. void addCustomItem (const int itemResultId,
  10978. PopupMenuCustomComponent* const customComponent);
  10979. void addCustomItem (const int itemResultId,
  10980. Component* customComponent,
  10981. int idealWidth, int idealHeight,
  10982. const bool triggerMenuItemAutomaticallyWhenClicked);
  10983. void addSubMenu (const String& subMenuName,
  10984. const PopupMenu& subMenu,
  10985. const bool isActive = true,
  10986. Image* const iconToUse = 0,
  10987. const bool isTicked = false);
  10988. void addSeparator();
  10989. void addSectionHeader (const String& title);
  10990. int getNumItems() const;
  10991. bool containsCommandItem (const int commandID) const;
  10992. bool containsAnyActiveItems() const;
  10993. int show (const int itemIdThatMustBeVisible = 0,
  10994. const int minimumWidth = 0,
  10995. const int maximumNumColumns = 0,
  10996. const int standardItemHeight = 0);
  10997. int showAt (const int screenX,
  10998. const int screenY,
  10999. const int itemIdThatMustBeVisible = 0,
  11000. const int minimumWidth = 0,
  11001. const int maximumNumColumns = 0,
  11002. const int standardItemHeight = 0);
  11003. int showAt (Component* componentToAttachTo,
  11004. const int itemIdThatMustBeVisible = 0,
  11005. const int minimumWidth = 0,
  11006. const int maximumNumColumns = 0,
  11007. const int standardItemHeight = 0);
  11008. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11009. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11010. enum ColourIds
  11011. {
  11012. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11013. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11014. colour is specified when the item is added). */
  11015. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11016. addSectionHeader() method). */
  11017. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11018. highlighted menu item. */
  11019. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11020. highlighted item. */
  11021. };
  11022. class JUCE_API MenuItemIterator
  11023. {
  11024. public:
  11025. MenuItemIterator (const PopupMenu& menu);
  11026. ~MenuItemIterator();
  11027. bool next();
  11028. String itemName;
  11029. const PopupMenu* subMenu;
  11030. int itemId;
  11031. bool isSeparator;
  11032. bool isTicked;
  11033. bool isEnabled;
  11034. bool isCustomComponent;
  11035. bool isSectionHeader;
  11036. const Colour* customColour;
  11037. const Image* customImage;
  11038. ApplicationCommandManager* commandManager;
  11039. juce_UseDebuggingNewOperator
  11040. private:
  11041. const PopupMenu& menu;
  11042. int index;
  11043. MenuItemIterator (const MenuItemIterator&);
  11044. const MenuItemIterator& operator= (const MenuItemIterator&);
  11045. };
  11046. juce_UseDebuggingNewOperator
  11047. private:
  11048. friend class PopupMenuWindow;
  11049. friend class MenuItemIterator;
  11050. VoidArray items;
  11051. LookAndFeel* lookAndFeel;
  11052. bool separatorPending;
  11053. void addSeparatorIfPending();
  11054. int showMenu (const int x, const int y, const int w, const int h,
  11055. const int itemIdThatMustBeVisible,
  11056. const int minimumWidth,
  11057. const int maximumNumColumns,
  11058. const int standardItemHeight,
  11059. const bool alignToRectangle,
  11060. Component* const componentAttachedTo);
  11061. friend class MenuBarComponent;
  11062. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11063. const int itemIdThatMustBeVisible,
  11064. const int minimumWidth,
  11065. const int maximumNumColumns,
  11066. const int standardItemHeight,
  11067. const bool alignToRectangle,
  11068. Component* menuBarComponent,
  11069. ApplicationCommandManager** managerOfChosenCommand,
  11070. Component* const componentAttachedTo);
  11071. };
  11072. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11073. /********* End of inlined file: juce_PopupMenu.h *********/
  11074. class TextEditor;
  11075. class TextHolderComponent;
  11076. class JUCE_API TextEditorListener
  11077. {
  11078. public:
  11079. virtual ~TextEditorListener() {}
  11080. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11081. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11082. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11083. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11084. };
  11085. class JUCE_API TextEditor : public Component,
  11086. public SettableTooltipClient
  11087. {
  11088. public:
  11089. TextEditor (const String& componentName = String::empty,
  11090. const tchar passwordCharacter = 0);
  11091. virtual ~TextEditor();
  11092. void setMultiLine (const bool shouldBeMultiLine,
  11093. const bool shouldWordWrap = true);
  11094. bool isMultiLine() const;
  11095. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11096. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11097. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11098. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11099. void setReadOnly (const bool shouldBeReadOnly);
  11100. bool isReadOnly() const;
  11101. void setCaretVisible (const bool shouldBeVisible);
  11102. bool isCaretVisible() const { return caretVisible; }
  11103. void setScrollbarsShown (bool shouldBeEnabled);
  11104. bool areScrollbarsShown() const { return scrollbarVisible; }
  11105. void setPasswordCharacter (const tchar passwordCharacter);
  11106. tchar getPasswordCharacter() const { return passwordCharacter; }
  11107. void setPopupMenuEnabled (const bool menuEnabled);
  11108. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11109. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11110. enum ColourIds
  11111. {
  11112. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11113. transparent if necessary. */
  11114. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11115. that because the editor can contain multiple colours, calling this
  11116. method won't change the colour of existing text - to do that, call
  11117. applyFontToAllText() after calling this method.*/
  11118. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11119. the text - this can be transparent if you don't want to show any
  11120. highlighting.*/
  11121. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11122. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11123. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11124. the edge of the component. */
  11125. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11126. the edge of the component when it has focus. */
  11127. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11128. around the edge of the editor. */
  11129. };
  11130. void setFont (const Font& newFont);
  11131. void applyFontToAllText (const Font& newFont);
  11132. const Font getFont() const;
  11133. void setSelectAllWhenFocused (const bool b);
  11134. void setInputRestrictions (const int maxTextLength,
  11135. const String& allowedCharacters = String::empty);
  11136. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11137. void setScrollBarThickness (const int newThicknessPixels);
  11138. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11139. void addListener (TextEditorListener* const newListener);
  11140. void removeListener (TextEditorListener* const listenerToRemove);
  11141. const String getText() const;
  11142. const String getTextSubstring (const int startCharacter, const int endCharacter) const;
  11143. bool isEmpty() const;
  11144. void setText (const String& newText,
  11145. const bool sendTextChangeMessage = true);
  11146. Value& getTextValue();
  11147. void insertTextAtCursor (String textToInsert);
  11148. void clear();
  11149. void cut();
  11150. void copy();
  11151. void paste();
  11152. void setCaretPosition (const int newIndex);
  11153. int getCaretPosition() const;
  11154. void scrollEditorToPositionCaret (const int desiredCaretX,
  11155. const int desiredCaretY);
  11156. const Rectangle getCaretRectangle();
  11157. void setHighlightedRegion (int startIndex,
  11158. int numberOfCharactersToHighlight);
  11159. int getHighlightedRegionStart() const { return selectionStart; }
  11160. int getHighlightedRegionLength() const { return jmax (0, selectionEnd - selectionStart); }
  11161. const String getHighlightedText() const;
  11162. int getTextIndexAt (const int x, const int y);
  11163. int getTotalNumChars() const;
  11164. int getTextWidth() const;
  11165. int getTextHeight() const;
  11166. void setIndents (const int newLeftIndent, const int newTopIndent);
  11167. void setBorder (const BorderSize& border);
  11168. const BorderSize getBorder() const;
  11169. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11170. void paint (Graphics& g);
  11171. void paintOverChildren (Graphics& g);
  11172. void mouseDown (const MouseEvent& e);
  11173. void mouseUp (const MouseEvent& e);
  11174. void mouseDrag (const MouseEvent& e);
  11175. void mouseDoubleClick (const MouseEvent& e);
  11176. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11177. bool keyPressed (const KeyPress& key);
  11178. bool keyStateChanged (const bool isKeyDown);
  11179. void focusGained (FocusChangeType cause);
  11180. void focusLost (FocusChangeType cause);
  11181. void resized();
  11182. void enablementChanged();
  11183. void colourChanged();
  11184. juce_UseDebuggingNewOperator
  11185. protected:
  11186. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11187. const MouseEvent* mouseClickEvent);
  11188. virtual void performPopupMenuAction (const int menuItemID);
  11189. void scrollToMakeSureCursorIsVisible();
  11190. void moveCaret (int newCaretPos);
  11191. void moveCursorTo (const int newPosition, const bool isSelecting);
  11192. void textChanged();
  11193. void newTransaction();
  11194. void doUndoRedo (const bool isRedo);
  11195. virtual void returnPressed();
  11196. virtual void escapePressed();
  11197. void handleCommandMessage (int commandId);
  11198. private:
  11199. ScopedPointer <Viewport> viewport;
  11200. TextHolderComponent* textHolder;
  11201. BorderSize borderSize;
  11202. bool readOnly : 1;
  11203. bool multiline : 1;
  11204. bool wordWrap : 1;
  11205. bool returnKeyStartsNewLine : 1;
  11206. bool caretVisible : 1;
  11207. bool popupMenuEnabled : 1;
  11208. bool selectAllTextWhenFocused : 1;
  11209. bool scrollbarVisible : 1;
  11210. bool wasFocused : 1;
  11211. bool caretFlashState : 1;
  11212. bool keepCursorOnScreen : 1;
  11213. bool tabKeyUsed : 1;
  11214. bool menuActive : 1;
  11215. bool valueTextNeedsUpdating : 1;
  11216. UndoManager undoManager;
  11217. float cursorX, cursorY, cursorHeight;
  11218. int maxTextLength;
  11219. int selectionStart, selectionEnd;
  11220. int leftIndent, topIndent;
  11221. unsigned int lastTransactionTime;
  11222. Font currentFont;
  11223. mutable int totalNumChars;
  11224. int caretPosition;
  11225. VoidArray sections;
  11226. String textToShowWhenEmpty;
  11227. Colour colourForTextWhenEmpty;
  11228. tchar passwordCharacter;
  11229. Value textValue;
  11230. enum
  11231. {
  11232. notDragging,
  11233. draggingSelectionStart,
  11234. draggingSelectionEnd
  11235. } dragType;
  11236. String allowedCharacters;
  11237. SortedSet <void*> listeners;
  11238. friend class TextEditorInsertAction;
  11239. friend class TextEditorRemoveAction;
  11240. void coalesceSimilarSections();
  11241. void splitSection (const int sectionIndex, const int charToSplitAt);
  11242. void clearInternal (UndoManager* const um);
  11243. void insert (const String& text,
  11244. const int insertIndex,
  11245. const Font& font,
  11246. const Colour& colour,
  11247. UndoManager* const um,
  11248. const int caretPositionToMoveTo);
  11249. void reinsert (const int insertIndex,
  11250. const VoidArray& sections);
  11251. void remove (const int startIndex,
  11252. int endIndex,
  11253. UndoManager* const um,
  11254. const int caretPositionToMoveTo);
  11255. void getCharPosition (const int index,
  11256. float& x, float& y,
  11257. float& lineHeight) const;
  11258. void updateCaretPosition();
  11259. void textWasChangedByValue();
  11260. int indexAtPosition (const float x,
  11261. const float y);
  11262. int findWordBreakAfter (const int position) const;
  11263. int findWordBreakBefore (const int position) const;
  11264. friend class TextHolderComponent;
  11265. friend class TextEditorViewport;
  11266. void drawContent (Graphics& g);
  11267. void updateTextHolderSize();
  11268. float getWordWrapWidth() const;
  11269. void timerCallbackInt();
  11270. void repaintCaret();
  11271. void repaintText (int textStartIndex, int textEndIndex);
  11272. TextEditor (const TextEditor&);
  11273. const TextEditor& operator= (const TextEditor&);
  11274. };
  11275. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11276. /********* End of inlined file: juce_TextEditor.h *********/
  11277. class Label;
  11278. class JUCE_API LabelListener
  11279. {
  11280. public:
  11281. virtual ~LabelListener() {}
  11282. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11283. };
  11284. class JUCE_API Label : public Component,
  11285. public SettableTooltipClient,
  11286. protected TextEditorListener,
  11287. private ComponentListener,
  11288. private Value::Listener
  11289. {
  11290. public:
  11291. Label (const String& componentName,
  11292. const String& labelText);
  11293. ~Label();
  11294. void setText (const String& newText,
  11295. const bool broadcastChangeMessage);
  11296. const String getText (const bool returnActiveEditorContents = false) const throw();
  11297. Value& getTextValue() { return textValue; }
  11298. void setFont (const Font& newFont) throw();
  11299. const Font& getFont() const throw();
  11300. enum ColourIds
  11301. {
  11302. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11303. textColourId = 0x1000281, /**< The colour for the text. */
  11304. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11305. Leave this transparent to not have an outline. */
  11306. };
  11307. void setJustificationType (const Justification& justification) throw();
  11308. const Justification getJustificationType() const throw() { return justification; }
  11309. void setBorderSize (int horizontalBorder, int verticalBorder);
  11310. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11311. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11312. void attachToComponent (Component* owner,
  11313. const bool onLeft);
  11314. Component* getAttachedComponent() const throw() { return ownerComponent; }
  11315. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11316. void setMinimumHorizontalScale (const float newScale);
  11317. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11318. void addListener (LabelListener* const listener) throw();
  11319. void removeListener (LabelListener* const listener) throw();
  11320. void setEditable (const bool editOnSingleClick,
  11321. const bool editOnDoubleClick = false,
  11322. const bool lossOfFocusDiscardsChanges = false) throw();
  11323. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11324. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11325. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11326. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11327. void showEditor();
  11328. void hideEditor (const bool discardCurrentEditorContents);
  11329. bool isBeingEdited() const throw();
  11330. juce_UseDebuggingNewOperator
  11331. protected:
  11332. virtual TextEditor* createEditorComponent();
  11333. virtual void textWasEdited();
  11334. virtual void textWasChanged();
  11335. virtual void editorShown (TextEditor* editorComponent);
  11336. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11337. void paint (Graphics& g);
  11338. void resized();
  11339. void mouseUp (const MouseEvent& e);
  11340. void mouseDoubleClick (const MouseEvent& e);
  11341. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11342. void componentParentHierarchyChanged (Component& component);
  11343. void componentVisibilityChanged (Component& component);
  11344. void inputAttemptWhenModal();
  11345. void focusGained (FocusChangeType);
  11346. void enablementChanged();
  11347. KeyboardFocusTraverser* createFocusTraverser();
  11348. void textEditorTextChanged (TextEditor& editor);
  11349. void textEditorReturnKeyPressed (TextEditor& editor);
  11350. void textEditorEscapeKeyPressed (TextEditor& editor);
  11351. void textEditorFocusLost (TextEditor& editor);
  11352. void colourChanged();
  11353. void valueChanged (Value&);
  11354. private:
  11355. Value textValue;
  11356. String lastTextValue;
  11357. Font font;
  11358. Justification justification;
  11359. ScopedPointer <TextEditor> editor;
  11360. SortedSet <void*> listeners;
  11361. Component* ownerComponent;
  11362. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  11363. int horizontalBorderSize, verticalBorderSize;
  11364. float minimumHorizontalScale;
  11365. bool editSingleClick : 1;
  11366. bool editDoubleClick : 1;
  11367. bool lossOfFocusDiscardsChanges : 1;
  11368. bool leftOfOwnerComp : 1;
  11369. bool updateFromTextEditorContents();
  11370. void callChangeListeners();
  11371. Label (const Label&);
  11372. const Label& operator= (const Label&);
  11373. };
  11374. #endif // __JUCE_LABEL_JUCEHEADER__
  11375. /********* End of inlined file: juce_Label.h *********/
  11376. class ComboBox;
  11377. class JUCE_API ComboBoxListener
  11378. {
  11379. public:
  11380. virtual ~ComboBoxListener() {}
  11381. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11382. };
  11383. class JUCE_API ComboBox : public Component,
  11384. public SettableTooltipClient,
  11385. private LabelListener,
  11386. private AsyncUpdater,
  11387. private Value::Listener
  11388. {
  11389. public:
  11390. ComboBox (const String& componentName);
  11391. ~ComboBox();
  11392. void setEditableText (const bool isEditable);
  11393. bool isTextEditable() const throw();
  11394. void setJustificationType (const Justification& justification) throw();
  11395. const Justification getJustificationType() const throw();
  11396. void addItem (const String& newItemText,
  11397. const int newItemId) throw();
  11398. void addSeparator() throw();
  11399. void addSectionHeading (const String& headingName) throw();
  11400. void setItemEnabled (const int itemId,
  11401. const bool shouldBeEnabled) throw();
  11402. void changeItemText (const int itemId,
  11403. const String& newText) throw();
  11404. void clear (const bool dontSendChangeMessage = false);
  11405. int getNumItems() const throw();
  11406. const String getItemText (const int index) const throw();
  11407. int getItemId (const int index) const throw();
  11408. int indexOfItemId (const int itemId) const throw();
  11409. int getSelectedId() const throw();
  11410. Value& getSelectedIdAsValue() throw() { return currentId; }
  11411. void setSelectedId (const int newItemId,
  11412. const bool dontSendChangeMessage = false) throw();
  11413. int getSelectedItemIndex() const throw();
  11414. void setSelectedItemIndex (const int newItemIndex,
  11415. const bool dontSendChangeMessage = false) throw();
  11416. const String getText() const throw();
  11417. void setText (const String& newText,
  11418. const bool dontSendChangeMessage = false) throw();
  11419. void showEditor();
  11420. void addListener (ComboBoxListener* const listener) throw();
  11421. void removeListener (ComboBoxListener* const listener) throw();
  11422. void setTextWhenNothingSelected (const String& newMessage) throw();
  11423. const String getTextWhenNothingSelected() const throw();
  11424. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11425. const String getTextWhenNoChoicesAvailable() const throw();
  11426. void setTooltip (const String& newTooltip);
  11427. enum ColourIds
  11428. {
  11429. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11430. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11431. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11432. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11433. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11434. };
  11435. void labelTextChanged (Label*);
  11436. void enablementChanged();
  11437. void colourChanged();
  11438. void focusGained (Component::FocusChangeType cause);
  11439. void focusLost (Component::FocusChangeType cause);
  11440. void handleAsyncUpdate();
  11441. const String getTooltip() { return label->getTooltip(); }
  11442. void mouseDown (const MouseEvent&);
  11443. void mouseDrag (const MouseEvent&);
  11444. void mouseUp (const MouseEvent&);
  11445. void lookAndFeelChanged();
  11446. void paint (Graphics&);
  11447. void resized();
  11448. bool keyStateChanged (const bool isKeyDown);
  11449. bool keyPressed (const KeyPress&);
  11450. void valueChanged (Value&);
  11451. juce_UseDebuggingNewOperator
  11452. private:
  11453. struct ItemInfo
  11454. {
  11455. String name;
  11456. int itemId;
  11457. bool isEnabled : 1, isHeading : 1;
  11458. bool isSeparator() const throw();
  11459. bool isRealItem() const throw();
  11460. };
  11461. OwnedArray <ItemInfo> items;
  11462. Value currentId;
  11463. int lastCurrentId;
  11464. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11465. SortedSet <void*> listeners;
  11466. Label* label;
  11467. String textWhenNothingSelected, noChoicesMessage;
  11468. void showPopup();
  11469. ItemInfo* getItemForId (const int itemId) const throw();
  11470. ItemInfo* getItemForIndex (const int index) const throw();
  11471. ComboBox (const ComboBox&);
  11472. const ComboBox& operator= (const ComboBox&);
  11473. };
  11474. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11475. /********* End of inlined file: juce_ComboBox.h *********/
  11476. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11477. {
  11478. public:
  11479. AudioDeviceManager();
  11480. ~AudioDeviceManager();
  11481. struct JUCE_API AudioDeviceSetup
  11482. {
  11483. AudioDeviceSetup();
  11484. bool operator== (const AudioDeviceSetup& other) const;
  11485. String outputDeviceName;
  11486. String inputDeviceName;
  11487. double sampleRate;
  11488. int bufferSize;
  11489. BitArray inputChannels;
  11490. bool useDefaultInputChannels;
  11491. BitArray outputChannels;
  11492. bool useDefaultOutputChannels;
  11493. };
  11494. const String initialise (const int numInputChannelsNeeded,
  11495. const int numOutputChannelsNeeded,
  11496. const XmlElement* const savedState,
  11497. const bool selectDefaultDeviceOnFailure,
  11498. const String& preferredDefaultDeviceName = String::empty,
  11499. const AudioDeviceSetup* preferredSetupOptions = 0);
  11500. XmlElement* createStateXml() const;
  11501. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11502. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11503. const bool treatAsChosenDevice);
  11504. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11505. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11506. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11507. void setCurrentAudioDeviceType (const String& type,
  11508. const bool treatAsChosenDevice);
  11509. void closeAudioDevice();
  11510. void restartLastAudioDevice();
  11511. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11512. void removeAudioCallback (AudioIODeviceCallback* callback);
  11513. double getCpuUsage() const;
  11514. void setMidiInputEnabled (const String& midiInputDeviceName,
  11515. const bool enabled);
  11516. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11517. void addMidiInputCallback (const String& midiInputDeviceName,
  11518. MidiInputCallback* callback);
  11519. void removeMidiInputCallback (const String& midiInputDeviceName,
  11520. MidiInputCallback* callback);
  11521. void setDefaultMidiOutput (const String& deviceName);
  11522. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11523. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11524. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11525. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11526. void playTestSound();
  11527. void enableInputLevelMeasurement (const bool enableMeasurement);
  11528. double getCurrentInputLevel() const;
  11529. juce_UseDebuggingNewOperator
  11530. private:
  11531. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11532. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11533. AudioDeviceSetup currentSetup;
  11534. ScopedPointer <AudioIODevice> currentAudioDevice;
  11535. SortedSet <AudioIODeviceCallback*> callbacks;
  11536. int numInputChansNeeded, numOutputChansNeeded;
  11537. String currentDeviceType;
  11538. BitArray inputChannels, outputChannels;
  11539. ScopedPointer <XmlElement> lastExplicitSettings;
  11540. mutable bool listNeedsScanning;
  11541. bool useInputNames;
  11542. int inputLevelMeasurementEnabledCount;
  11543. double inputLevel;
  11544. ScopedPointer <AudioSampleBuffer> testSound;
  11545. int testSoundPosition;
  11546. AudioSampleBuffer tempBuffer;
  11547. StringArray midiInsFromXml;
  11548. OwnedArray <MidiInput> enabledMidiInputs;
  11549. Array <MidiInputCallback*> midiCallbacks;
  11550. Array <MidiInput*> midiCallbackDevices;
  11551. String defaultMidiOutputName;
  11552. ScopedPointer <MidiOutput> defaultMidiOutput;
  11553. CriticalSection audioCallbackLock, midiCallbackLock;
  11554. double cpuUsageMs, timeToCpuScale;
  11555. class CallbackHandler : public AudioIODeviceCallback,
  11556. public MidiInputCallback
  11557. {
  11558. public:
  11559. AudioDeviceManager* owner;
  11560. void audioDeviceIOCallback (const float** inputChannelData,
  11561. int totalNumInputChannels,
  11562. float** outputChannelData,
  11563. int totalNumOutputChannels,
  11564. int numSamples);
  11565. void audioDeviceAboutToStart (AudioIODevice*);
  11566. void audioDeviceStopped();
  11567. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11568. };
  11569. CallbackHandler callbackHandler;
  11570. friend class CallbackHandler;
  11571. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11572. int totalNumInputChannels,
  11573. float** outputChannelData,
  11574. int totalNumOutputChannels,
  11575. int numSamples);
  11576. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11577. void audioDeviceStoppedInt();
  11578. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11579. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11580. const BitArray& ins, const BitArray& outs);
  11581. void stopDevice();
  11582. void updateXml();
  11583. void createDeviceTypesIfNeeded();
  11584. void scanDevicesIfNeeded();
  11585. void deleteCurrentDevice();
  11586. double chooseBestSampleRate (double preferred) const;
  11587. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11588. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11589. AudioDeviceManager (const AudioDeviceManager&);
  11590. const AudioDeviceManager& operator= (const AudioDeviceManager&);
  11591. };
  11592. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11593. /********* End of inlined file: juce_AudioDeviceManager.h *********/
  11594. #endif
  11595. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11596. #endif
  11597. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11598. #endif
  11599. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11600. #endif
  11601. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11602. #endif
  11603. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11604. /********* Start of inlined file: juce_AudioDataConverters.h *********/
  11605. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11606. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11607. class JUCE_API AudioDataConverters
  11608. {
  11609. public:
  11610. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11611. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11612. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11613. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11614. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11615. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11616. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11617. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11618. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11619. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11620. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11621. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11622. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11623. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11624. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11625. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11626. enum DataFormat
  11627. {
  11628. int16LE,
  11629. int16BE,
  11630. int24LE,
  11631. int24BE,
  11632. int32LE,
  11633. int32BE,
  11634. float32LE,
  11635. float32BE,
  11636. };
  11637. static void convertFloatToFormat (const DataFormat destFormat,
  11638. const float* source, void* dest, int numSamples);
  11639. static void convertFormatToFloat (const DataFormat sourceFormat,
  11640. const void* source, float* dest, int numSamples);
  11641. static void interleaveSamples (const float** source, float* dest,
  11642. const int numSamples, const int numChannels);
  11643. static void deinterleaveSamples (const float* source, float** dest,
  11644. const int numSamples, const int numChannels);
  11645. };
  11646. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11647. /********* End of inlined file: juce_AudioDataConverters.h *********/
  11648. #endif
  11649. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11650. #endif
  11651. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11652. #endif
  11653. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11654. #endif
  11655. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11656. /********* Start of inlined file: juce_MidiFile.h *********/
  11657. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11658. #define __JUCE_MIDIFILE_JUCEHEADER__
  11659. /********* Start of inlined file: juce_MidiMessageSequence.h *********/
  11660. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11661. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11662. class JUCE_API MidiMessageSequence
  11663. {
  11664. public:
  11665. MidiMessageSequence();
  11666. MidiMessageSequence (const MidiMessageSequence& other);
  11667. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11668. ~MidiMessageSequence();
  11669. class MidiEventHolder
  11670. {
  11671. public:
  11672. ~MidiEventHolder();
  11673. MidiMessage message;
  11674. MidiEventHolder* noteOffObject;
  11675. juce_UseDebuggingNewOperator
  11676. private:
  11677. friend class MidiMessageSequence;
  11678. MidiEventHolder (const MidiMessage& message);
  11679. };
  11680. void clear();
  11681. int getNumEvents() const;
  11682. MidiEventHolder* getEventPointer (const int index) const;
  11683. double getTimeOfMatchingKeyUp (const int index) const;
  11684. int getIndexOfMatchingKeyUp (const int index) const;
  11685. int getIndexOf (MidiEventHolder* const event) const;
  11686. int getNextIndexAtTime (const double timeStamp) const;
  11687. double getStartTime() const;
  11688. double getEndTime() const;
  11689. double getEventTime (const int index) const;
  11690. void addEvent (const MidiMessage& newMessage,
  11691. double timeAdjustment = 0);
  11692. void deleteEvent (const int index,
  11693. const bool deleteMatchingNoteUp);
  11694. void addSequence (const MidiMessageSequence& other,
  11695. double timeAdjustmentDelta,
  11696. double firstAllowableDestTime,
  11697. double endOfAllowableDestTimes);
  11698. void updateMatchedPairs();
  11699. void extractMidiChannelMessages (const int channelNumberToExtract,
  11700. MidiMessageSequence& destSequence,
  11701. const bool alsoIncludeMetaEvents) const;
  11702. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11703. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11704. void deleteSysExMessages();
  11705. void addTimeToMessages (const double deltaTime);
  11706. void createControllerUpdatesForTime (const int channelNumber,
  11707. const double time,
  11708. OwnedArray<MidiMessage>& resultMessages);
  11709. void swapWith (MidiMessageSequence& other) throw();
  11710. juce_UseDebuggingNewOperator
  11711. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11712. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11713. private:
  11714. friend class MidiFile;
  11715. OwnedArray <MidiEventHolder> list;
  11716. void sort();
  11717. };
  11718. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11719. /********* End of inlined file: juce_MidiMessageSequence.h *********/
  11720. class JUCE_API MidiFile
  11721. {
  11722. public:
  11723. MidiFile() throw();
  11724. ~MidiFile() throw();
  11725. int getNumTracks() const throw();
  11726. const MidiMessageSequence* getTrack (const int index) const throw();
  11727. void addTrack (const MidiMessageSequence& trackSequence) throw();
  11728. void clear() throw();
  11729. short getTimeFormat() const throw();
  11730. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  11731. void setSmpteTimeFormat (const int framesPerSecond,
  11732. const int subframeResolution) throw();
  11733. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  11734. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  11735. double getLastTimestamp() const;
  11736. bool readFrom (InputStream& sourceStream);
  11737. bool writeTo (OutputStream& destStream);
  11738. void convertTimestampTicksToSeconds();
  11739. juce_UseDebuggingNewOperator
  11740. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11741. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11742. private:
  11743. OwnedArray <MidiMessageSequence> tracks;
  11744. short timeFormat;
  11745. MidiFile (const MidiFile&);
  11746. const MidiFile& operator= (const MidiFile&);
  11747. void readNextTrack (const char* data, int size);
  11748. void writeTrack (OutputStream& mainOut, const int trackNum);
  11749. };
  11750. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  11751. /********* End of inlined file: juce_MidiFile.h *********/
  11752. #endif
  11753. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11754. /********* Start of inlined file: juce_MidiKeyboardState.h *********/
  11755. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11756. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11757. class MidiKeyboardState;
  11758. class JUCE_API MidiKeyboardStateListener
  11759. {
  11760. public:
  11761. MidiKeyboardStateListener() throw() {}
  11762. virtual ~MidiKeyboardStateListener() {}
  11763. virtual void handleNoteOn (MidiKeyboardState* source,
  11764. int midiChannel, int midiNoteNumber, float velocity) = 0;
  11765. virtual void handleNoteOff (MidiKeyboardState* source,
  11766. int midiChannel, int midiNoteNumber) = 0;
  11767. };
  11768. class JUCE_API MidiKeyboardState
  11769. {
  11770. public:
  11771. MidiKeyboardState();
  11772. ~MidiKeyboardState();
  11773. void reset();
  11774. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  11775. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  11776. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  11777. void noteOff (const int midiChannel, const int midiNoteNumber);
  11778. void allNotesOff (const int midiChannel);
  11779. void processNextMidiEvent (const MidiMessage& message);
  11780. void processNextMidiBuffer (MidiBuffer& buffer,
  11781. const int startSample,
  11782. const int numSamples,
  11783. const bool injectIndirectEvents);
  11784. void addListener (MidiKeyboardStateListener* const listener) throw();
  11785. void removeListener (MidiKeyboardStateListener* const listener) throw();
  11786. juce_UseDebuggingNewOperator
  11787. private:
  11788. CriticalSection lock;
  11789. uint16 noteStates [128];
  11790. MidiBuffer eventsToAdd;
  11791. VoidArray listeners;
  11792. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  11793. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  11794. MidiKeyboardState (const MidiKeyboardState&);
  11795. const MidiKeyboardState& operator= (const MidiKeyboardState&);
  11796. };
  11797. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11798. /********* End of inlined file: juce_MidiKeyboardState.h *********/
  11799. #endif
  11800. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  11801. #endif
  11802. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11803. /********* Start of inlined file: juce_MidiMessageCollector.h *********/
  11804. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11805. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11806. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  11807. public MidiInputCallback
  11808. {
  11809. public:
  11810. MidiMessageCollector();
  11811. ~MidiMessageCollector();
  11812. void reset (const double sampleRate);
  11813. void addMessageToQueue (const MidiMessage& message);
  11814. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  11815. const int numSamples);
  11816. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  11817. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  11818. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11819. juce_UseDebuggingNewOperator
  11820. private:
  11821. double lastCallbackTime;
  11822. CriticalSection midiCallbackLock;
  11823. MidiBuffer incomingMessages;
  11824. double sampleRate;
  11825. MidiMessageCollector (const MidiMessageCollector&);
  11826. const MidiMessageCollector& operator= (const MidiMessageCollector&);
  11827. };
  11828. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11829. /********* End of inlined file: juce_MidiMessageCollector.h *********/
  11830. #endif
  11831. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11832. #endif
  11833. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11834. /********* Start of inlined file: juce_AudioUnitPluginFormat.h *********/
  11835. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11836. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11837. /********* Start of inlined file: juce_AudioPluginFormat.h *********/
  11838. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11839. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11840. /********* Start of inlined file: juce_AudioPluginInstance.h *********/
  11841. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11842. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11843. /********* Start of inlined file: juce_AudioProcessor.h *********/
  11844. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11845. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11846. /********* Start of inlined file: juce_AudioProcessorEditor.h *********/
  11847. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11848. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11849. class AudioProcessor;
  11850. class JUCE_API AudioProcessorEditor : public Component
  11851. {
  11852. protected:
  11853. AudioProcessorEditor (AudioProcessor* const owner);
  11854. public:
  11855. ~AudioProcessorEditor();
  11856. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  11857. private:
  11858. AudioProcessor* const owner;
  11859. };
  11860. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11861. /********* End of inlined file: juce_AudioProcessorEditor.h *********/
  11862. /********* Start of inlined file: juce_AudioProcessorListener.h *********/
  11863. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11864. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11865. class AudioProcessor;
  11866. class JUCE_API AudioProcessorListener
  11867. {
  11868. public:
  11869. virtual ~AudioProcessorListener() {}
  11870. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  11871. int parameterIndex,
  11872. float newValue) = 0;
  11873. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  11874. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  11875. int parameterIndex);
  11876. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  11877. int parameterIndex);
  11878. };
  11879. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11880. /********* End of inlined file: juce_AudioProcessorListener.h *********/
  11881. /********* Start of inlined file: juce_AudioPlayHead.h *********/
  11882. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11883. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11884. class JUCE_API AudioPlayHead
  11885. {
  11886. protected:
  11887. AudioPlayHead() {}
  11888. public:
  11889. virtual ~AudioPlayHead() {}
  11890. enum FrameRateType
  11891. {
  11892. fps24 = 0,
  11893. fps25 = 1,
  11894. fps2997 = 2,
  11895. fps30 = 3,
  11896. fps2997drop = 4,
  11897. fps30drop = 5,
  11898. fpsUnknown = 99
  11899. };
  11900. struct CurrentPositionInfo
  11901. {
  11902. double bpm;
  11903. int timeSigNumerator;
  11904. int timeSigDenominator;
  11905. double timeInSeconds;
  11906. double editOriginTime;
  11907. double ppqPosition;
  11908. double ppqPositionOfLastBarStart;
  11909. FrameRateType frameRate;
  11910. bool isPlaying;
  11911. bool isRecording;
  11912. };
  11913. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  11914. };
  11915. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11916. /********* End of inlined file: juce_AudioPlayHead.h *********/
  11917. class JUCE_API AudioProcessor
  11918. {
  11919. protected:
  11920. AudioProcessor();
  11921. public:
  11922. virtual ~AudioProcessor();
  11923. virtual const String getName() const = 0;
  11924. virtual void prepareToPlay (double sampleRate,
  11925. int estimatedSamplesPerBlock) = 0;
  11926. virtual void releaseResources() = 0;
  11927. virtual void processBlock (AudioSampleBuffer& buffer,
  11928. MidiBuffer& midiMessages) = 0;
  11929. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  11930. double getSampleRate() const throw() { return sampleRate; }
  11931. int getBlockSize() const throw() { return blockSize; }
  11932. int getNumInputChannels() const throw() { return numInputChannels; }
  11933. int getNumOutputChannels() const throw() { return numOutputChannels; }
  11934. virtual const String getInputChannelName (const int channelIndex) const = 0;
  11935. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  11936. virtual bool isInputChannelStereoPair (int index) const = 0;
  11937. virtual bool isOutputChannelStereoPair (int index) const = 0;
  11938. int getLatencySamples() const throw() { return latencySamples; }
  11939. void setLatencySamples (const int newLatency);
  11940. virtual bool acceptsMidi() const = 0;
  11941. virtual bool producesMidi() const = 0;
  11942. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  11943. void suspendProcessing (const bool shouldBeSuspended);
  11944. bool isSuspended() const throw() { return suspended; }
  11945. virtual void reset();
  11946. bool isNonRealtime() const throw() { return nonRealtime; }
  11947. void setNonRealtime (const bool isNonRealtime) throw();
  11948. virtual AudioProcessorEditor* createEditor() = 0;
  11949. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  11950. AudioProcessorEditor* createEditorIfNeeded();
  11951. virtual int getNumParameters() = 0;
  11952. virtual const String getParameterName (int parameterIndex) = 0;
  11953. virtual float getParameter (int parameterIndex) = 0;
  11954. virtual const String getParameterText (int parameterIndex) = 0;
  11955. virtual void setParameter (int parameterIndex,
  11956. float newValue) = 0;
  11957. void setParameterNotifyingHost (int parameterIndex,
  11958. float newValue);
  11959. virtual bool isParameterAutomatable (int parameterIndex) const;
  11960. virtual bool isMetaParameter (int parameterIndex) const;
  11961. void beginParameterChangeGesture (int parameterIndex);
  11962. void endParameterChangeGesture (int parameterIndex);
  11963. void updateHostDisplay();
  11964. virtual int getNumPrograms() = 0;
  11965. virtual int getCurrentProgram() = 0;
  11966. virtual void setCurrentProgram (int index) = 0;
  11967. virtual const String getProgramName (int index) = 0;
  11968. virtual void changeProgramName (int index, const String& newName) = 0;
  11969. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  11970. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  11971. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  11972. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  11973. void addListener (AudioProcessorListener* const newListener) throw();
  11974. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  11975. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  11976. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  11977. void setPlayConfigDetails (const int numIns, const int numOuts,
  11978. const double sampleRate,
  11979. const int blockSize) throw();
  11980. juce_UseDebuggingNewOperator
  11981. protected:
  11982. static void copyXmlToBinary (const XmlElement& xml,
  11983. JUCE_NAMESPACE::MemoryBlock& destData);
  11984. static XmlElement* getXmlFromBinary (const void* data,
  11985. const int sizeInBytes);
  11986. AudioPlayHead* playHead;
  11987. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  11988. private:
  11989. VoidArray listeners;
  11990. AudioProcessorEditor* activeEditor;
  11991. double sampleRate;
  11992. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  11993. bool suspended, nonRealtime;
  11994. CriticalSection callbackLock, listenerLock;
  11995. #ifdef JUCE_DEBUG
  11996. BitArray changingParams;
  11997. #endif
  11998. AudioProcessor (const AudioProcessor&);
  11999. const AudioProcessor& operator= (const AudioProcessor&);
  12000. };
  12001. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12002. /********* End of inlined file: juce_AudioProcessor.h *********/
  12003. /********* Start of inlined file: juce_PluginDescription.h *********/
  12004. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12005. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12006. class JUCE_API PluginDescription
  12007. {
  12008. public:
  12009. PluginDescription() throw();
  12010. PluginDescription (const PluginDescription& other) throw();
  12011. const PluginDescription& operator= (const PluginDescription& other) throw();
  12012. ~PluginDescription() throw();
  12013. String name;
  12014. String pluginFormatName;
  12015. String category;
  12016. String manufacturerName;
  12017. String version;
  12018. String fileOrIdentifier;
  12019. Time lastFileModTime;
  12020. int uid;
  12021. bool isInstrument;
  12022. int numInputChannels;
  12023. int numOutputChannels;
  12024. bool isDuplicateOf (const PluginDescription& other) const;
  12025. const String createIdentifierString() const throw();
  12026. XmlElement* createXml() const;
  12027. bool loadFromXml (const XmlElement& xml);
  12028. juce_UseDebuggingNewOperator
  12029. };
  12030. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12031. /********* End of inlined file: juce_PluginDescription.h *********/
  12032. class JUCE_API AudioPluginInstance : public AudioProcessor
  12033. {
  12034. public:
  12035. virtual ~AudioPluginInstance();
  12036. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12037. juce_UseDebuggingNewOperator
  12038. protected:
  12039. AudioPluginInstance();
  12040. AudioPluginInstance (const AudioPluginInstance&);
  12041. const AudioPluginInstance& operator= (const AudioPluginInstance&);
  12042. };
  12043. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12044. /********* End of inlined file: juce_AudioPluginInstance.h *********/
  12045. class PluginDescription;
  12046. class JUCE_API AudioPluginFormat
  12047. {
  12048. public:
  12049. virtual ~AudioPluginFormat();
  12050. virtual const String getName() const = 0;
  12051. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12052. const String& fileOrIdentifier) = 0;
  12053. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12054. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12055. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12056. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12057. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12058. const bool recursive) = 0;
  12059. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12060. juce_UseDebuggingNewOperator
  12061. protected:
  12062. AudioPluginFormat() throw();
  12063. AudioPluginFormat (const AudioPluginFormat&);
  12064. const AudioPluginFormat& operator= (const AudioPluginFormat&);
  12065. };
  12066. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12067. /********* End of inlined file: juce_AudioPluginFormat.h *********/
  12068. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12069. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12070. {
  12071. public:
  12072. AudioUnitPluginFormat();
  12073. ~AudioUnitPluginFormat();
  12074. const String getName() const { return "AudioUnit"; }
  12075. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12076. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12077. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12078. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12079. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12080. bool doesPluginStillExist (const PluginDescription& desc);
  12081. const FileSearchPath getDefaultLocationsToSearch();
  12082. juce_UseDebuggingNewOperator
  12083. private:
  12084. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12085. const AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12086. };
  12087. #endif
  12088. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12089. /********* End of inlined file: juce_AudioUnitPluginFormat.h *********/
  12090. #endif
  12091. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12092. /********* Start of inlined file: juce_DirectXPluginFormat.h *********/
  12093. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12094. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12095. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12096. // Sorry, this file is just a placeholder at the moment!...
  12097. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12098. {
  12099. public:
  12100. DirectXPluginFormat();
  12101. ~DirectXPluginFormat();
  12102. const String getName() const { return "DirectX"; }
  12103. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12104. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12105. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12106. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12107. const FileSearchPath getDefaultLocationsToSearch();
  12108. juce_UseDebuggingNewOperator
  12109. private:
  12110. DirectXPluginFormat (const DirectXPluginFormat&);
  12111. const DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12112. };
  12113. #endif
  12114. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12115. /********* End of inlined file: juce_DirectXPluginFormat.h *********/
  12116. #endif
  12117. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12118. /********* Start of inlined file: juce_LADSPAPluginFormat.h *********/
  12119. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12120. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12121. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12122. // Sorry, this file is just a placeholder at the moment!...
  12123. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12124. {
  12125. public:
  12126. LADSPAPluginFormat();
  12127. ~LADSPAPluginFormat();
  12128. const String getName() const { return "LADSPA"; }
  12129. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12130. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12131. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12132. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12133. const FileSearchPath getDefaultLocationsToSearch();
  12134. juce_UseDebuggingNewOperator
  12135. private:
  12136. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12137. const LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12138. };
  12139. #endif
  12140. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12141. /********* End of inlined file: juce_LADSPAPluginFormat.h *********/
  12142. #endif
  12143. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12144. /********* Start of inlined file: juce_VSTMidiEventList.h *********/
  12145. #ifdef __aeffect__
  12146. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12147. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12148. class VSTMidiEventList
  12149. {
  12150. public:
  12151. VSTMidiEventList()
  12152. : numEventsUsed (0), numEventsAllocated (0)
  12153. {
  12154. }
  12155. ~VSTMidiEventList()
  12156. {
  12157. freeEvents();
  12158. }
  12159. void clear()
  12160. {
  12161. numEventsUsed = 0;
  12162. if (events != 0)
  12163. events->numEvents = 0;
  12164. }
  12165. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12166. {
  12167. ensureSize (numEventsUsed + 1);
  12168. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12169. events->numEvents = ++numEventsUsed;
  12170. if (numBytes <= 4)
  12171. {
  12172. if (e->type == kVstSysExType)
  12173. {
  12174. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12175. e->type = kVstMidiType;
  12176. e->byteSize = sizeof (VstMidiEvent);
  12177. e->noteLength = 0;
  12178. e->noteOffset = 0;
  12179. e->detune = 0;
  12180. e->noteOffVelocity = 0;
  12181. }
  12182. e->deltaFrames = frameOffset;
  12183. memcpy (e->midiData, midiData, numBytes);
  12184. }
  12185. else
  12186. {
  12187. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12188. if (se->type == kVstSysExType)
  12189. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12190. else
  12191. se->sysexDump = (char*) juce_malloc (numBytes);
  12192. memcpy (se->sysexDump, midiData, numBytes);
  12193. se->type = kVstSysExType;
  12194. se->byteSize = sizeof (VstMidiSysexEvent);
  12195. se->deltaFrames = frameOffset;
  12196. se->flags = 0;
  12197. se->dumpBytes = numBytes;
  12198. se->resvd1 = 0;
  12199. se->resvd2 = 0;
  12200. }
  12201. }
  12202. // Handy method to pull the events out of an event buffer supplied by the host
  12203. // or plugin.
  12204. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12205. {
  12206. for (int i = 0; i < events->numEvents; ++i)
  12207. {
  12208. const VstEvent* const e = events->events[i];
  12209. if (e != 0)
  12210. {
  12211. if (e->type == kVstMidiType)
  12212. {
  12213. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12214. 4, e->deltaFrames);
  12215. }
  12216. else if (e->type == kVstSysExType)
  12217. {
  12218. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12219. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12220. e->deltaFrames);
  12221. }
  12222. }
  12223. }
  12224. }
  12225. void ensureSize (int numEventsNeeded)
  12226. {
  12227. if (numEventsNeeded > numEventsAllocated)
  12228. {
  12229. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12230. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12231. if (events == 0)
  12232. events.calloc (size, 1);
  12233. else
  12234. events.realloc (size, 1);
  12235. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12236. {
  12237. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12238. (int) sizeof (VstMidiSysexEvent)));
  12239. e->type = kVstMidiType;
  12240. e->byteSize = sizeof (VstMidiEvent);
  12241. events->events[i] = (VstEvent*) e;
  12242. }
  12243. numEventsAllocated = numEventsNeeded;
  12244. }
  12245. }
  12246. void freeEvents()
  12247. {
  12248. if (events != 0)
  12249. {
  12250. for (int i = numEventsAllocated; --i >= 0;)
  12251. {
  12252. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12253. if (e->type == kVstSysExType)
  12254. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12255. juce_free (e);
  12256. }
  12257. events.free();
  12258. numEventsUsed = 0;
  12259. numEventsAllocated = 0;
  12260. }
  12261. }
  12262. HeapBlock <VstEvents> events;
  12263. private:
  12264. int numEventsUsed, numEventsAllocated;
  12265. };
  12266. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12267. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12268. /********* End of inlined file: juce_VSTMidiEventList.h *********/
  12269. #endif
  12270. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12271. /********* Start of inlined file: juce_VSTPluginFormat.h *********/
  12272. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12273. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12274. #if JUCE_PLUGINHOST_VST
  12275. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12276. {
  12277. public:
  12278. VSTPluginFormat();
  12279. ~VSTPluginFormat();
  12280. const String getName() const { return "VST"; }
  12281. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12282. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12283. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12284. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12285. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12286. bool doesPluginStillExist (const PluginDescription& desc);
  12287. const FileSearchPath getDefaultLocationsToSearch();
  12288. juce_UseDebuggingNewOperator
  12289. private:
  12290. VSTPluginFormat (const VSTPluginFormat&);
  12291. const VSTPluginFormat& operator= (const VSTPluginFormat&);
  12292. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12293. };
  12294. #endif
  12295. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12296. /********* End of inlined file: juce_VSTPluginFormat.h *********/
  12297. #endif
  12298. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12299. #endif
  12300. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12301. /********* Start of inlined file: juce_AudioPluginFormatManager.h *********/
  12302. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12303. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12304. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12305. {
  12306. public:
  12307. AudioPluginFormatManager() throw();
  12308. ~AudioPluginFormatManager() throw();
  12309. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12310. void addDefaultFormats();
  12311. int getNumFormats() throw();
  12312. AudioPluginFormat* getFormat (const int index) throw();
  12313. void addFormat (AudioPluginFormat* const format) throw();
  12314. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12315. String& errorMessage) const;
  12316. bool doesPluginStillExist (const PluginDescription& description) const;
  12317. juce_UseDebuggingNewOperator
  12318. private:
  12319. OwnedArray <AudioPluginFormat> formats;
  12320. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12321. const AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12322. };
  12323. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12324. /********* End of inlined file: juce_AudioPluginFormatManager.h *********/
  12325. #endif
  12326. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12327. #endif
  12328. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12329. /********* Start of inlined file: juce_KnownPluginList.h *********/
  12330. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12331. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12332. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12333. {
  12334. public:
  12335. KnownPluginList();
  12336. ~KnownPluginList();
  12337. void clear();
  12338. int getNumTypes() const throw() { return types.size(); }
  12339. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12340. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12341. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12342. bool addType (const PluginDescription& type);
  12343. void removeType (const int index) throw();
  12344. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12345. const bool dontRescanIfAlreadyInList,
  12346. OwnedArray <PluginDescription>& typesFound,
  12347. AudioPluginFormat& formatToUse);
  12348. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12349. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12350. OwnedArray <PluginDescription>& typesFound);
  12351. enum SortMethod
  12352. {
  12353. defaultOrder = 0,
  12354. sortAlphabetically,
  12355. sortByCategory,
  12356. sortByManufacturer,
  12357. sortByFileSystemLocation
  12358. };
  12359. void addToMenu (PopupMenu& menu,
  12360. const SortMethod sortMethod) const;
  12361. int getIndexChosenByMenu (const int menuResultCode) const;
  12362. void sort (const SortMethod method);
  12363. XmlElement* createXml() const;
  12364. void recreateFromXml (const XmlElement& xml);
  12365. juce_UseDebuggingNewOperator
  12366. private:
  12367. OwnedArray <PluginDescription> types;
  12368. KnownPluginList (const KnownPluginList&);
  12369. const KnownPluginList& operator= (const KnownPluginList&);
  12370. };
  12371. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12372. /********* End of inlined file: juce_KnownPluginList.h *********/
  12373. #endif
  12374. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12375. #endif
  12376. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12377. /********* Start of inlined file: juce_PluginDirectoryScanner.h *********/
  12378. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12379. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12380. class JUCE_API PluginDirectoryScanner
  12381. {
  12382. public:
  12383. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12384. AudioPluginFormat& formatToLookFor,
  12385. FileSearchPath directoriesToSearch,
  12386. const bool searchRecursively,
  12387. const File& deadMansPedalFile);
  12388. ~PluginDirectoryScanner();
  12389. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12390. const String getNextPluginFileThatWillBeScanned() const throw();
  12391. float getProgress() const { return progress; }
  12392. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12393. juce_UseDebuggingNewOperator
  12394. private:
  12395. KnownPluginList& list;
  12396. AudioPluginFormat& format;
  12397. StringArray filesOrIdentifiersToScan;
  12398. File deadMansPedalFile;
  12399. StringArray failedFiles;
  12400. int nextIndex;
  12401. float progress;
  12402. const StringArray getDeadMansPedalFile() throw();
  12403. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12404. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12405. const PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12406. };
  12407. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12408. /********* End of inlined file: juce_PluginDirectoryScanner.h *********/
  12409. #endif
  12410. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12411. /********* Start of inlined file: juce_PluginListComponent.h *********/
  12412. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12413. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12414. /********* Start of inlined file: juce_ListBox.h *********/
  12415. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12416. #define __JUCE_LISTBOX_JUCEHEADER__
  12417. class ListViewport;
  12418. class JUCE_API ListBoxModel
  12419. {
  12420. public:
  12421. virtual ~ListBoxModel() {}
  12422. virtual int getNumRows() = 0;
  12423. virtual void paintListBoxItem (int rowNumber,
  12424. Graphics& g,
  12425. int width, int height,
  12426. bool rowIsSelected) = 0;
  12427. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12428. Component* existingComponentToUpdate);
  12429. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12430. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12431. virtual void backgroundClicked();
  12432. virtual void selectedRowsChanged (int lastRowSelected);
  12433. virtual void deleteKeyPressed (int lastRowSelected);
  12434. virtual void returnKeyPressed (int lastRowSelected);
  12435. virtual void listWasScrolled();
  12436. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12437. virtual const String getTooltipForRow (int row);
  12438. };
  12439. class JUCE_API ListBox : public Component,
  12440. public SettableTooltipClient
  12441. {
  12442. public:
  12443. ListBox (const String& componentName,
  12444. ListBoxModel* const model);
  12445. ~ListBox();
  12446. void setModel (ListBoxModel* const newModel);
  12447. ListBoxModel* getModel() const throw() { return model; }
  12448. void updateContent();
  12449. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12450. void setMouseMoveSelectsRows (bool shouldSelect);
  12451. void selectRow (const int rowNumber,
  12452. bool dontScrollToShowThisRow = false,
  12453. bool deselectOthersFirst = true);
  12454. void selectRangeOfRows (int firstRow,
  12455. int lastRow);
  12456. void deselectRow (const int rowNumber);
  12457. void deselectAllRows();
  12458. void flipRowSelection (const int rowNumber);
  12459. const SparseSet<int> getSelectedRows() const;
  12460. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12461. const bool sendNotificationEventToModel = true);
  12462. bool isRowSelected (const int rowNumber) const;
  12463. int getNumSelectedRows() const;
  12464. int getSelectedRow (const int index = 0) const;
  12465. int getLastRowSelected() const;
  12466. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12467. const ModifierKeys& modifiers);
  12468. void setVerticalPosition (const double newProportion);
  12469. double getVerticalPosition() const;
  12470. void scrollToEnsureRowIsOnscreen (const int row);
  12471. ScrollBar* getVerticalScrollBar() const throw();
  12472. ScrollBar* getHorizontalScrollBar() const throw();
  12473. int getRowContainingPosition (const int x, const int y) const throw();
  12474. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12475. const Rectangle getRowPosition (const int rowNumber,
  12476. const bool relativeToComponentTopLeft) const throw();
  12477. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12478. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12479. int getVisibleRowWidth() const throw();
  12480. void setRowHeight (const int newHeight);
  12481. int getRowHeight() const throw() { return rowHeight; }
  12482. int getNumRowsOnScreen() const throw();
  12483. enum ColourIds
  12484. {
  12485. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12486. Make this transparent if you don't want the background to be filled. */
  12487. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12488. Make this transparent to not have an outline. */
  12489. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12490. };
  12491. void setOutlineThickness (const int outlineThickness);
  12492. int getOutlineThickness() const throw() { return outlineThickness; }
  12493. void setHeaderComponent (Component* const newHeaderComponent);
  12494. void setMinimumContentWidth (const int newMinimumWidth);
  12495. int getVisibleContentWidth() const throw();
  12496. void repaintRow (const int rowNumber) throw();
  12497. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12498. Viewport* getViewport() const throw();
  12499. bool keyPressed (const KeyPress& key);
  12500. bool keyStateChanged (const bool isKeyDown);
  12501. void paint (Graphics& g);
  12502. void paintOverChildren (Graphics& g);
  12503. void resized();
  12504. void visibilityChanged();
  12505. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12506. void mouseMove (const MouseEvent&);
  12507. void mouseExit (const MouseEvent&);
  12508. void mouseUp (const MouseEvent&);
  12509. void colourChanged();
  12510. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12511. juce_UseDebuggingNewOperator
  12512. private:
  12513. friend class ListViewport;
  12514. friend class TableListBox;
  12515. ListBoxModel* model;
  12516. ListViewport* viewport;
  12517. Component* headerComponent;
  12518. int totalItems, rowHeight, minimumRowWidth;
  12519. int outlineThickness;
  12520. int lastMouseX, lastMouseY, lastRowSelected;
  12521. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12522. SparseSet <int> selected;
  12523. void selectRowInternal (const int rowNumber,
  12524. bool dontScrollToShowThisRow,
  12525. bool deselectOthersFirst,
  12526. bool isMouseClick);
  12527. ListBox (const ListBox&);
  12528. const ListBox& operator= (const ListBox&);
  12529. };
  12530. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12531. /********* End of inlined file: juce_ListBox.h *********/
  12532. /********* Start of inlined file: juce_TextButton.h *********/
  12533. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12534. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12535. class JUCE_API TextButton : public Button
  12536. {
  12537. public:
  12538. TextButton (const String& buttonName,
  12539. const String& toolTip = String::empty);
  12540. ~TextButton();
  12541. enum ColourIds
  12542. {
  12543. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12544. 'off'). The look-and-feel class might re-interpret this to add
  12545. effects, etc. */
  12546. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12547. 'on'). The look-and-feel class might re-interpret this to add
  12548. effects, etc. */
  12549. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12550. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12551. };
  12552. void changeWidthToFitText (const int newHeight = -1);
  12553. virtual const Font getFont();
  12554. juce_UseDebuggingNewOperator
  12555. protected:
  12556. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12557. void colourChanged();
  12558. private:
  12559. TextButton (const TextButton&);
  12560. const TextButton& operator= (const TextButton&);
  12561. };
  12562. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12563. /********* End of inlined file: juce_TextButton.h *********/
  12564. class JUCE_API PluginListComponent : public Component,
  12565. public ListBoxModel,
  12566. public ChangeListener,
  12567. public ButtonListener,
  12568. public Timer
  12569. {
  12570. public:
  12571. PluginListComponent (KnownPluginList& listToRepresent,
  12572. const File& deadMansPedalFile,
  12573. PropertiesFile* const propertiesToUse);
  12574. ~PluginListComponent();
  12575. void resized();
  12576. bool isInterestedInFileDrag (const StringArray& files);
  12577. void filesDropped (const StringArray& files, int, int);
  12578. int getNumRows();
  12579. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12580. void deleteKeyPressed (int lastRowSelected);
  12581. void buttonClicked (Button* b);
  12582. void changeListenerCallback (void*);
  12583. void timerCallback();
  12584. juce_UseDebuggingNewOperator
  12585. private:
  12586. KnownPluginList& list;
  12587. File deadMansPedalFile;
  12588. ListBox* listBox;
  12589. TextButton* optionsButton;
  12590. PropertiesFile* propertiesToUse;
  12591. int typeToScan;
  12592. void scanFor (AudioPluginFormat* format);
  12593. PluginListComponent (const PluginListComponent&);
  12594. const PluginListComponent& operator= (const PluginListComponent&);
  12595. };
  12596. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12597. /********* End of inlined file: juce_PluginListComponent.h *********/
  12598. #endif
  12599. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12600. #endif
  12601. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12602. #endif
  12603. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12604. #endif
  12605. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12606. /********* Start of inlined file: juce_AudioProcessorGraph.h *********/
  12607. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12608. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12609. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12610. public AsyncUpdater
  12611. {
  12612. public:
  12613. AudioProcessorGraph();
  12614. ~AudioProcessorGraph();
  12615. class JUCE_API Node : public ReferenceCountedObject
  12616. {
  12617. public:
  12618. ~Node();
  12619. const uint32 id;
  12620. AudioProcessor* const processor;
  12621. NamedValueSet properties;
  12622. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12623. juce_UseDebuggingNewOperator
  12624. private:
  12625. friend class AudioProcessorGraph;
  12626. bool isPrepared;
  12627. Node (const uint32 id, AudioProcessor* const processor);
  12628. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12629. void unprepare();
  12630. Node (const Node&);
  12631. const Node& operator= (const Node&);
  12632. };
  12633. struct JUCE_API Connection
  12634. {
  12635. public:
  12636. uint32 sourceNodeId;
  12637. int sourceChannelIndex;
  12638. uint32 destNodeId;
  12639. int destChannelIndex;
  12640. juce_UseDebuggingNewOperator
  12641. private:
  12642. };
  12643. void clear();
  12644. int getNumNodes() const { return nodes.size(); }
  12645. Node* getNode (const int index) const { return nodes [index]; }
  12646. Node* getNodeForId (const uint32 nodeId) const;
  12647. Node* addNode (AudioProcessor* const newProcessor,
  12648. uint32 nodeId = 0);
  12649. bool removeNode (const uint32 nodeId);
  12650. int getNumConnections() const { return connections.size(); }
  12651. const Connection* getConnection (const int index) const { return connections [index]; }
  12652. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12653. const int sourceChannelIndex,
  12654. const uint32 destNodeId,
  12655. const int destChannelIndex) const;
  12656. bool isConnected (const uint32 possibleSourceNodeId,
  12657. const uint32 possibleDestNodeId) const;
  12658. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12659. const uint32 destNodeId, const int destChannelIndex) const;
  12660. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12661. const uint32 destNodeId, const int destChannelIndex);
  12662. void removeConnection (const int index);
  12663. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12664. const uint32 destNodeId, const int destChannelIndex);
  12665. bool disconnectNode (const uint32 nodeId);
  12666. bool removeIllegalConnections();
  12667. static const int midiChannelIndex;
  12668. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12669. {
  12670. public:
  12671. enum IODeviceType
  12672. {
  12673. audioInputNode, /**< In this mode, the processor has output channels
  12674. representing all the audio input channels that are
  12675. coming into its parent audio graph. */
  12676. audioOutputNode, /**< In this mode, the processor has input channels
  12677. representing all the audio output channels that are
  12678. going out of its parent audio graph. */
  12679. midiInputNode, /**< In this mode, the processor has a midi output which
  12680. delivers the same midi data that is arriving at its
  12681. parent graph. */
  12682. midiOutputNode /**< In this mode, the processor has a midi input and
  12683. any data sent to it will be passed out of the parent
  12684. graph. */
  12685. };
  12686. IODeviceType getType() const { return type; }
  12687. AudioProcessorGraph* getParentGraph() const { return graph; }
  12688. bool isInput() const;
  12689. bool isOutput() const;
  12690. AudioGraphIOProcessor (const IODeviceType type);
  12691. ~AudioGraphIOProcessor();
  12692. const String getName() const;
  12693. void fillInPluginDescription (PluginDescription& d) const;
  12694. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12695. void releaseResources();
  12696. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12697. const String getInputChannelName (const int channelIndex) const;
  12698. const String getOutputChannelName (const int channelIndex) const;
  12699. bool isInputChannelStereoPair (int index) const;
  12700. bool isOutputChannelStereoPair (int index) const;
  12701. bool acceptsMidi() const;
  12702. bool producesMidi() const;
  12703. AudioProcessorEditor* createEditor();
  12704. int getNumParameters();
  12705. const String getParameterName (int);
  12706. float getParameter (int);
  12707. const String getParameterText (int);
  12708. void setParameter (int, float);
  12709. int getNumPrograms();
  12710. int getCurrentProgram();
  12711. void setCurrentProgram (int);
  12712. const String getProgramName (int);
  12713. void changeProgramName (int, const String&);
  12714. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12715. void setStateInformation (const void* data, int sizeInBytes);
  12716. void setParentGraph (AudioProcessorGraph* const graph);
  12717. juce_UseDebuggingNewOperator
  12718. private:
  12719. const IODeviceType type;
  12720. AudioProcessorGraph* graph;
  12721. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  12722. const AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  12723. };
  12724. // AudioProcessor methods:
  12725. const String getName() const;
  12726. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12727. void releaseResources();
  12728. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12729. const String getInputChannelName (const int channelIndex) const;
  12730. const String getOutputChannelName (const int channelIndex) const;
  12731. bool isInputChannelStereoPair (int index) const;
  12732. bool isOutputChannelStereoPair (int index) const;
  12733. bool acceptsMidi() const;
  12734. bool producesMidi() const;
  12735. AudioProcessorEditor* createEditor() { return 0; }
  12736. int getNumParameters() { return 0; }
  12737. const String getParameterName (int) { return String::empty; }
  12738. float getParameter (int) { return 0; }
  12739. const String getParameterText (int) { return String::empty; }
  12740. void setParameter (int, float) { }
  12741. int getNumPrograms() { return 0; }
  12742. int getCurrentProgram() { return 0; }
  12743. void setCurrentProgram (int) { }
  12744. const String getProgramName (int) { return String::empty; }
  12745. void changeProgramName (int, const String&) { }
  12746. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12747. void setStateInformation (const void* data, int sizeInBytes);
  12748. void handleAsyncUpdate();
  12749. juce_UseDebuggingNewOperator
  12750. private:
  12751. ReferenceCountedArray <Node> nodes;
  12752. OwnedArray <Connection> connections;
  12753. int lastNodeId;
  12754. AudioSampleBuffer renderingBuffers;
  12755. OwnedArray <MidiBuffer> midiBuffers;
  12756. CriticalSection renderLock;
  12757. VoidArray renderingOps;
  12758. friend class AudioGraphIOProcessor;
  12759. AudioSampleBuffer* currentAudioInputBuffer;
  12760. AudioSampleBuffer currentAudioOutputBuffer;
  12761. MidiBuffer* currentMidiInputBuffer;
  12762. MidiBuffer currentMidiOutputBuffer;
  12763. void clearRenderingSequence();
  12764. void buildRenderingSequence();
  12765. bool isAnInputTo (const uint32 possibleInputId,
  12766. const uint32 possibleDestinationId,
  12767. const int recursionCheck) const;
  12768. AudioProcessorGraph (const AudioProcessorGraph&);
  12769. const AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  12770. };
  12771. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12772. /********* End of inlined file: juce_AudioProcessorGraph.h *********/
  12773. #endif
  12774. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12775. #endif
  12776. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12777. /********* Start of inlined file: juce_AudioProcessorPlayer.h *********/
  12778. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12779. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12780. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  12781. public MidiInputCallback
  12782. {
  12783. public:
  12784. AudioProcessorPlayer();
  12785. virtual ~AudioProcessorPlayer();
  12786. void setProcessor (AudioProcessor* const processorToPlay);
  12787. AudioProcessor* getCurrentProcessor() const { return processor; }
  12788. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  12789. void audioDeviceIOCallback (const float** inputChannelData,
  12790. int totalNumInputChannels,
  12791. float** outputChannelData,
  12792. int totalNumOutputChannels,
  12793. int numSamples);
  12794. void audioDeviceAboutToStart (AudioIODevice* device);
  12795. void audioDeviceStopped();
  12796. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12797. juce_UseDebuggingNewOperator
  12798. private:
  12799. AudioProcessor* processor;
  12800. CriticalSection lock;
  12801. double sampleRate;
  12802. int blockSize;
  12803. bool isPrepared;
  12804. int numInputChans, numOutputChans;
  12805. float* channels [128];
  12806. AudioSampleBuffer tempBuffer;
  12807. MidiBuffer incomingMidi;
  12808. MidiMessageCollector messageCollector;
  12809. AudioProcessorPlayer (const AudioProcessorPlayer&);
  12810. const AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  12811. };
  12812. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12813. /********* End of inlined file: juce_AudioProcessorPlayer.h *********/
  12814. #endif
  12815. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12816. /********* Start of inlined file: juce_GenericAudioProcessorEditor.h *********/
  12817. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12818. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12819. /********* Start of inlined file: juce_PropertyPanel.h *********/
  12820. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  12821. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  12822. /********* Start of inlined file: juce_PropertyComponent.h *********/
  12823. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12824. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12825. class EditableProperty;
  12826. class JUCE_API PropertyComponent : public Component,
  12827. public SettableTooltipClient
  12828. {
  12829. public:
  12830. PropertyComponent (const String& propertyName,
  12831. const int preferredHeight = 25);
  12832. ~PropertyComponent();
  12833. int getPreferredHeight() const throw() { return preferredHeight; }
  12834. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  12835. virtual void refresh() = 0;
  12836. void paint (Graphics& g);
  12837. void resized();
  12838. void enablementChanged();
  12839. juce_UseDebuggingNewOperator
  12840. protected:
  12841. int preferredHeight;
  12842. };
  12843. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12844. /********* End of inlined file: juce_PropertyComponent.h *********/
  12845. class JUCE_API PropertyPanel : public Component
  12846. {
  12847. public:
  12848. PropertyPanel();
  12849. ~PropertyPanel();
  12850. void clear();
  12851. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  12852. void addSection (const String& sectionTitle,
  12853. const Array <PropertyComponent*>& newPropertyComponents,
  12854. const bool shouldSectionInitiallyBeOpen = true);
  12855. void refreshAll() const;
  12856. const StringArray getSectionNames() const;
  12857. bool isSectionOpen (const int sectionIndex) const;
  12858. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  12859. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  12860. XmlElement* getOpennessState() const;
  12861. void restoreOpennessState (const XmlElement& newState);
  12862. void setMessageWhenEmpty (const String& newMessage);
  12863. const String& getMessageWhenEmpty() const;
  12864. void paint (Graphics& g);
  12865. void resized();
  12866. juce_UseDebuggingNewOperator
  12867. private:
  12868. Viewport* viewport;
  12869. Component* propertyHolderComponent;
  12870. String messageWhenEmpty;
  12871. void updatePropHolderLayout() const;
  12872. void updatePropHolderLayout (const int width) const;
  12873. };
  12874. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  12875. /********* End of inlined file: juce_PropertyPanel.h *********/
  12876. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  12877. {
  12878. public:
  12879. GenericAudioProcessorEditor (AudioProcessor* const owner);
  12880. ~GenericAudioProcessorEditor();
  12881. void paint (Graphics& g);
  12882. void resized();
  12883. juce_UseDebuggingNewOperator
  12884. private:
  12885. PropertyPanel* panel;
  12886. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  12887. const GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  12888. };
  12889. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12890. /********* End of inlined file: juce_GenericAudioProcessorEditor.h *********/
  12891. #endif
  12892. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12893. /********* Start of inlined file: juce_Sampler.h *********/
  12894. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12895. #define __JUCE_SAMPLER_JUCEHEADER__
  12896. /********* Start of inlined file: juce_Synthesiser.h *********/
  12897. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  12898. #define __JUCE_SYNTHESISER_JUCEHEADER__
  12899. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  12900. {
  12901. protected:
  12902. SynthesiserSound();
  12903. public:
  12904. virtual ~SynthesiserSound();
  12905. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  12906. virtual bool appliesToChannel (const int midiChannel) = 0;
  12907. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  12908. juce_UseDebuggingNewOperator
  12909. };
  12910. class JUCE_API SynthesiserVoice
  12911. {
  12912. public:
  12913. SynthesiserVoice();
  12914. virtual ~SynthesiserVoice();
  12915. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  12916. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  12917. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  12918. virtual void startNote (const int midiNoteNumber,
  12919. const float velocity,
  12920. SynthesiserSound* sound,
  12921. const int currentPitchWheelPosition) = 0;
  12922. virtual void stopNote (const bool allowTailOff) = 0;
  12923. virtual void pitchWheelMoved (const int newValue) = 0;
  12924. virtual void controllerMoved (const int controllerNumber,
  12925. const int newValue) = 0;
  12926. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  12927. int startSample,
  12928. int numSamples) = 0;
  12929. bool isPlayingChannel (const int midiChannel) const;
  12930. void setCurrentPlaybackSampleRate (const double newRate);
  12931. juce_UseDebuggingNewOperator
  12932. protected:
  12933. double getSampleRate() const { return currentSampleRate; }
  12934. void clearCurrentNote();
  12935. private:
  12936. friend class Synthesiser;
  12937. double currentSampleRate;
  12938. int currentlyPlayingNote;
  12939. uint32 noteOnTime;
  12940. SynthesiserSound::Ptr currentlyPlayingSound;
  12941. };
  12942. class JUCE_API Synthesiser
  12943. {
  12944. public:
  12945. Synthesiser();
  12946. virtual ~Synthesiser();
  12947. void clearVoices();
  12948. int getNumVoices() const { return voices.size(); }
  12949. SynthesiserVoice* getVoice (const int index) const;
  12950. void addVoice (SynthesiserVoice* const newVoice);
  12951. void removeVoice (const int index);
  12952. void clearSounds();
  12953. int getNumSounds() const { return sounds.size(); }
  12954. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  12955. void addSound (const SynthesiserSound::Ptr& newSound);
  12956. void removeSound (const int index);
  12957. void setNoteStealingEnabled (const bool shouldStealNotes);
  12958. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  12959. virtual void noteOn (const int midiChannel,
  12960. const int midiNoteNumber,
  12961. const float velocity);
  12962. virtual void noteOff (const int midiChannel,
  12963. const int midiNoteNumber,
  12964. const bool allowTailOff);
  12965. virtual void allNotesOff (const int midiChannel,
  12966. const bool allowTailOff);
  12967. virtual void handlePitchWheel (const int midiChannel,
  12968. const int wheelValue);
  12969. virtual void handleController (const int midiChannel,
  12970. const int controllerNumber,
  12971. const int controllerValue);
  12972. void setCurrentPlaybackSampleRate (const double sampleRate);
  12973. void renderNextBlock (AudioSampleBuffer& outputAudio,
  12974. const MidiBuffer& inputMidi,
  12975. int startSample,
  12976. int numSamples);
  12977. juce_UseDebuggingNewOperator
  12978. protected:
  12979. CriticalSection lock;
  12980. OwnedArray <SynthesiserVoice> voices;
  12981. ReferenceCountedArray <SynthesiserSound> sounds;
  12982. int lastPitchWheelValues [16];
  12983. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  12984. const bool stealIfNoneAvailable) const;
  12985. void startVoice (SynthesiserVoice* const voice,
  12986. SynthesiserSound* const sound,
  12987. const int midiChannel,
  12988. const int midiNoteNumber,
  12989. const float velocity);
  12990. int findFreeVoice (const bool) const { return 0; }
  12991. private:
  12992. double sampleRate;
  12993. uint32 lastNoteOnCounter;
  12994. bool shouldStealNotes;
  12995. Synthesiser (const Synthesiser&);
  12996. const Synthesiser& operator= (const Synthesiser&);
  12997. };
  12998. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  12999. /********* End of inlined file: juce_Synthesiser.h *********/
  13000. class JUCE_API SamplerSound : public SynthesiserSound
  13001. {
  13002. public:
  13003. SamplerSound (const String& name,
  13004. AudioFormatReader& source,
  13005. const BitArray& midiNotes,
  13006. const int midiNoteForNormalPitch,
  13007. const double attackTimeSecs,
  13008. const double releaseTimeSecs,
  13009. const double maxSampleLengthSeconds);
  13010. ~SamplerSound();
  13011. const String& getName() const { return name; }
  13012. AudioSampleBuffer* getAudioData() const { return data; }
  13013. bool appliesToNote (const int midiNoteNumber);
  13014. bool appliesToChannel (const int midiChannel);
  13015. juce_UseDebuggingNewOperator
  13016. private:
  13017. friend class SamplerVoice;
  13018. String name;
  13019. ScopedPointer <AudioSampleBuffer> data;
  13020. double sourceSampleRate;
  13021. BitArray midiNotes;
  13022. int length, attackSamples, releaseSamples;
  13023. int midiRootNote;
  13024. };
  13025. class JUCE_API SamplerVoice : public SynthesiserVoice
  13026. {
  13027. public:
  13028. SamplerVoice();
  13029. ~SamplerVoice();
  13030. bool canPlaySound (SynthesiserSound* sound);
  13031. void startNote (const int midiNoteNumber,
  13032. const float velocity,
  13033. SynthesiserSound* sound,
  13034. const int currentPitchWheelPosition);
  13035. void stopNote (const bool allowTailOff);
  13036. void pitchWheelMoved (const int newValue);
  13037. void controllerMoved (const int controllerNumber,
  13038. const int newValue);
  13039. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13040. juce_UseDebuggingNewOperator
  13041. private:
  13042. double pitchRatio;
  13043. double sourceSamplePosition;
  13044. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13045. bool isInAttack, isInRelease;
  13046. };
  13047. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13048. /********* End of inlined file: juce_Sampler.h *********/
  13049. #endif
  13050. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13051. #endif
  13052. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13053. /********* Start of inlined file: juce_ActionBroadcaster.h *********/
  13054. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13055. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13056. /********* Start of inlined file: juce_ActionListenerList.h *********/
  13057. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13058. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13059. class JUCE_API ActionListenerList : public MessageListener
  13060. {
  13061. public:
  13062. ActionListenerList() throw();
  13063. ~ActionListenerList() throw();
  13064. void addActionListener (ActionListener* const listener) throw();
  13065. void removeActionListener (ActionListener* const listener) throw();
  13066. void removeAllActionListeners() throw();
  13067. void sendActionMessage (const String& message) const;
  13068. void handleMessage (const Message&);
  13069. juce_UseDebuggingNewOperator
  13070. private:
  13071. SortedSet <void*> actionListeners_;
  13072. CriticalSection actionListenerLock_;
  13073. ActionListenerList (const ActionListenerList&);
  13074. const ActionListenerList& operator= (const ActionListenerList&);
  13075. };
  13076. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13077. /********* End of inlined file: juce_ActionListenerList.h *********/
  13078. class JUCE_API ActionBroadcaster
  13079. {
  13080. public:
  13081. ActionBroadcaster() throw();
  13082. virtual ~ActionBroadcaster();
  13083. void addActionListener (ActionListener* const listener);
  13084. void removeActionListener (ActionListener* const listener);
  13085. void removeAllActionListeners();
  13086. void sendActionMessage (const String& message) const;
  13087. private:
  13088. ActionListenerList actionListenerList;
  13089. ActionBroadcaster (const ActionBroadcaster&);
  13090. const ActionBroadcaster& operator= (const ActionBroadcaster&);
  13091. };
  13092. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13093. /********* End of inlined file: juce_ActionBroadcaster.h *********/
  13094. #endif
  13095. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13096. #endif
  13097. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13098. #endif
  13099. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13100. #endif
  13101. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13102. /********* Start of inlined file: juce_CallbackMessage.h *********/
  13103. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13104. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13105. class JUCE_API CallbackMessage : public Message
  13106. {
  13107. public:
  13108. CallbackMessage() throw();
  13109. ~CallbackMessage() throw();
  13110. virtual void messageCallback() = 0;
  13111. void post();
  13112. juce_UseDebuggingNewOperator
  13113. private:
  13114. CallbackMessage (const CallbackMessage&);
  13115. const CallbackMessage& operator= (const CallbackMessage&);
  13116. };
  13117. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13118. /********* End of inlined file: juce_CallbackMessage.h *********/
  13119. #endif
  13120. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13121. #endif
  13122. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13123. #endif
  13124. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13125. #endif
  13126. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13127. /********* Start of inlined file: juce_InterprocessConnection.h *********/
  13128. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13129. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13130. class InterprocessConnectionServer;
  13131. class JUCE_API InterprocessConnection : public Thread,
  13132. private MessageListener
  13133. {
  13134. public:
  13135. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13136. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13137. ~InterprocessConnection();
  13138. bool connectToSocket (const String& hostName,
  13139. const int portNumber,
  13140. const int timeOutMillisecs);
  13141. bool connectToPipe (const String& pipeName,
  13142. const int pipeReceiveMessageTimeoutMs = -1);
  13143. bool createPipe (const String& pipeName,
  13144. const int pipeReceiveMessageTimeoutMs = -1);
  13145. void disconnect();
  13146. bool isConnected() const;
  13147. StreamingSocket* getSocket() const throw() { return socket; }
  13148. NamedPipe* getPipe() const throw() { return pipe; }
  13149. const String getConnectedHostName() const;
  13150. bool sendMessage (const MemoryBlock& message);
  13151. virtual void connectionMade() = 0;
  13152. virtual void connectionLost() = 0;
  13153. virtual void messageReceived (const MemoryBlock& message) = 0;
  13154. juce_UseDebuggingNewOperator
  13155. private:
  13156. CriticalSection pipeAndSocketLock;
  13157. ScopedPointer <StreamingSocket> socket;
  13158. ScopedPointer <NamedPipe> pipe;
  13159. bool callbackConnectionState;
  13160. const bool useMessageThread;
  13161. const uint32 magicMessageHeader;
  13162. int pipeReceiveMessageTimeout;
  13163. friend class InterprocessConnectionServer;
  13164. void initialiseWithSocket (StreamingSocket* const socket_);
  13165. void initialiseWithPipe (NamedPipe* const pipe_);
  13166. void handleMessage (const Message& message);
  13167. void connectionMadeInt();
  13168. void connectionLostInt();
  13169. void deliverDataInt (const MemoryBlock& data);
  13170. bool readNextMessageInt();
  13171. void run();
  13172. InterprocessConnection (const InterprocessConnection&);
  13173. const InterprocessConnection& operator= (const InterprocessConnection&);
  13174. };
  13175. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13176. /********* End of inlined file: juce_InterprocessConnection.h *********/
  13177. #endif
  13178. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13179. /********* Start of inlined file: juce_InterprocessConnectionServer.h *********/
  13180. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13181. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13182. class JUCE_API InterprocessConnectionServer : private Thread
  13183. {
  13184. public:
  13185. InterprocessConnectionServer();
  13186. ~InterprocessConnectionServer();
  13187. bool beginWaitingForSocket (const int portNumber);
  13188. void stop();
  13189. protected:
  13190. virtual InterprocessConnection* createConnectionObject() = 0;
  13191. public:
  13192. juce_UseDebuggingNewOperator
  13193. private:
  13194. ScopedPointer <StreamingSocket> socket;
  13195. void run();
  13196. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13197. const InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13198. };
  13199. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13200. /********* End of inlined file: juce_InterprocessConnectionServer.h *********/
  13201. #endif
  13202. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13203. #endif
  13204. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13205. #endif
  13206. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13207. /********* Start of inlined file: juce_MessageManager.h *********/
  13208. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13209. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13210. class Component;
  13211. class MessageManagerLock;
  13212. typedef void* (MessageCallbackFunction) (void* userData);
  13213. class JUCE_API MessageManager
  13214. {
  13215. public:
  13216. static MessageManager* getInstance() throw();
  13217. void runDispatchLoop();
  13218. void stopDispatchLoop();
  13219. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13220. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13221. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13222. void* userData);
  13223. bool isThisTheMessageThread() const throw();
  13224. void setCurrentMessageThread (const Thread::ThreadID threadId) throw();
  13225. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13226. bool currentThreadHasLockedMessageManager() const throw();
  13227. static void broadcastMessage (const String& messageText) throw();
  13228. void registerBroadcastListener (ActionListener* listener) throw();
  13229. void deregisterBroadcastListener (ActionListener* listener) throw();
  13230. void deliverMessage (void*);
  13231. void deliverBroadcastMessage (const String&);
  13232. ~MessageManager() throw();
  13233. juce_UseDebuggingNewOperator
  13234. private:
  13235. MessageManager() throw();
  13236. friend class MessageListener;
  13237. friend class ChangeBroadcaster;
  13238. friend class ActionBroadcaster;
  13239. friend class CallbackMessage;
  13240. static MessageManager* instance;
  13241. SortedSet <const MessageListener*> messageListeners;
  13242. ScopedPointer <ActionListenerList> broadcastListeners;
  13243. friend class JUCEApplication;
  13244. bool quitMessagePosted, quitMessageReceived;
  13245. Thread::ThreadID messageThreadId;
  13246. VoidArray modalComponents;
  13247. static void* exitModalLoopCallback (void*);
  13248. void postMessageToQueue (Message* const message);
  13249. void postCallbackMessage (Message* const message);
  13250. static void doPlatformSpecificInitialisation();
  13251. static void doPlatformSpecificShutdown();
  13252. friend class MessageManagerLock;
  13253. Thread::ThreadID volatile threadWithLock;
  13254. CriticalSection lockingLock;
  13255. MessageManager (const MessageManager&);
  13256. const MessageManager& operator= (const MessageManager&);
  13257. };
  13258. class JUCE_API MessageManagerLock
  13259. {
  13260. public:
  13261. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13262. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13263. ~MessageManagerLock() throw();
  13264. bool lockWasGained() const throw() { return locked; }
  13265. private:
  13266. bool locked, needsUnlocking;
  13267. void* sharedEvents;
  13268. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13269. MessageManagerLock (const MessageManagerLock&);
  13270. const MessageManagerLock& operator= (const MessageManagerLock&);
  13271. };
  13272. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13273. /********* End of inlined file: juce_MessageManager.h *********/
  13274. #endif
  13275. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13276. /********* Start of inlined file: juce_MultiTimer.h *********/
  13277. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13278. #define __JUCE_MULTITIMER_JUCEHEADER__
  13279. class JUCE_API MultiTimer
  13280. {
  13281. protected:
  13282. MultiTimer() throw();
  13283. MultiTimer (const MultiTimer& other) throw();
  13284. public:
  13285. virtual ~MultiTimer();
  13286. virtual void timerCallback (const int timerId) = 0;
  13287. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13288. void stopTimer (const int timerId) throw();
  13289. bool isTimerRunning (const int timerId) const throw();
  13290. int getTimerInterval (const int timerId) const throw();
  13291. private:
  13292. class MultiTimerCallback;
  13293. CriticalSection timerListLock;
  13294. OwnedArray <MultiTimerCallback> timers;
  13295. const MultiTimer& operator= (const MultiTimer&);
  13296. };
  13297. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13298. /********* End of inlined file: juce_MultiTimer.h *********/
  13299. #endif
  13300. #ifndef __JUCE_TIMER_JUCEHEADER__
  13301. #endif
  13302. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13303. /********* Start of inlined file: juce_ArrowButton.h *********/
  13304. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13305. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13306. /********* Start of inlined file: juce_DropShadowEffect.h *********/
  13307. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13308. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13309. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13310. {
  13311. public:
  13312. DropShadowEffect();
  13313. ~DropShadowEffect();
  13314. void setShadowProperties (const float newRadius,
  13315. const float newOpacity,
  13316. const int newShadowOffsetX,
  13317. const int newShadowOffsetY);
  13318. void applyEffect (Image& sourceImage, Graphics& destContext);
  13319. juce_UseDebuggingNewOperator
  13320. private:
  13321. int offsetX, offsetY;
  13322. float radius, opacity;
  13323. };
  13324. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13325. /********* End of inlined file: juce_DropShadowEffect.h *********/
  13326. class JUCE_API ArrowButton : public Button
  13327. {
  13328. public:
  13329. ArrowButton (const String& buttonName,
  13330. float arrowDirection,
  13331. const Colour& arrowColour);
  13332. ~ArrowButton();
  13333. juce_UseDebuggingNewOperator
  13334. protected:
  13335. void paintButton (Graphics& g,
  13336. bool isMouseOverButton,
  13337. bool isButtonDown);
  13338. void buttonStateChanged();
  13339. private:
  13340. Colour colour;
  13341. DropShadowEffect shadow;
  13342. Path path;
  13343. int offset;
  13344. ArrowButton (const ArrowButton&);
  13345. const ArrowButton& operator= (const ArrowButton&);
  13346. };
  13347. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13348. /********* End of inlined file: juce_ArrowButton.h *********/
  13349. #endif
  13350. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13351. #endif
  13352. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13353. /********* Start of inlined file: juce_DrawableButton.h *********/
  13354. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13355. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13356. /********* Start of inlined file: juce_Drawable.h *********/
  13357. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13358. #define __JUCE_DRAWABLE_JUCEHEADER__
  13359. class JUCE_API Drawable
  13360. {
  13361. protected:
  13362. Drawable();
  13363. public:
  13364. virtual ~Drawable();
  13365. virtual Drawable* createCopy() const = 0;
  13366. void draw (Graphics& g, const float opacity,
  13367. const AffineTransform& transform = AffineTransform::identity) const;
  13368. void drawAt (Graphics& g,
  13369. const float x,
  13370. const float y,
  13371. const float opacity) const;
  13372. void drawWithin (Graphics& g,
  13373. const int destX,
  13374. const int destY,
  13375. const int destWidth,
  13376. const int destHeight,
  13377. const RectanglePlacement& placement,
  13378. const float opacity) const;
  13379. class RenderingContext
  13380. {
  13381. public:
  13382. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13383. Graphics& g;
  13384. AffineTransform transform;
  13385. float opacity;
  13386. private:
  13387. const RenderingContext& operator= (const RenderingContext&);
  13388. };
  13389. virtual void render (const RenderingContext& context) const = 0;
  13390. virtual void getBounds (float& x, float& y, float& width, float& height) const = 0;
  13391. virtual bool hitTest (float x, float y) const = 0;
  13392. const String& getName() const throw() { return name; }
  13393. void setName (const String& newName) throw() { name = newName; }
  13394. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13395. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13396. static Drawable* createFromImageFile (const File& file);
  13397. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13398. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13399. virtual ValueTree createValueTree() const throw() = 0;
  13400. juce_UseDebuggingNewOperator
  13401. private:
  13402. Drawable (const Drawable&);
  13403. const Drawable& operator= (const Drawable&);
  13404. String name;
  13405. };
  13406. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13407. /********* End of inlined file: juce_Drawable.h *********/
  13408. class JUCE_API DrawableButton : public Button
  13409. {
  13410. public:
  13411. enum ButtonStyle
  13412. {
  13413. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13414. ImageRaw, /**< The button will just display the images in their normal size and position.
  13415. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13416. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13417. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13418. };
  13419. DrawableButton (const String& buttonName,
  13420. const ButtonStyle buttonStyle);
  13421. ~DrawableButton();
  13422. void setImages (const Drawable* normalImage,
  13423. const Drawable* overImage = 0,
  13424. const Drawable* downImage = 0,
  13425. const Drawable* disabledImage = 0,
  13426. const Drawable* normalImageOn = 0,
  13427. const Drawable* overImageOn = 0,
  13428. const Drawable* downImageOn = 0,
  13429. const Drawable* disabledImageOn = 0);
  13430. void setButtonStyle (const ButtonStyle newStyle);
  13431. void setBackgroundColours (const Colour& toggledOffColour,
  13432. const Colour& toggledOnColour);
  13433. const Colour& getBackgroundColour() const throw();
  13434. void setEdgeIndent (const int numPixelsIndent);
  13435. const Drawable* getCurrentImage() const throw();
  13436. const Drawable* getNormalImage() const throw();
  13437. const Drawable* getOverImage() const throw();
  13438. const Drawable* getDownImage() const throw();
  13439. juce_UseDebuggingNewOperator
  13440. protected:
  13441. void paintButton (Graphics& g,
  13442. bool isMouseOverButton,
  13443. bool isButtonDown);
  13444. private:
  13445. ButtonStyle style;
  13446. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13447. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13448. Colour backgroundOff, backgroundOn;
  13449. int edgeIndent;
  13450. void deleteImages();
  13451. DrawableButton (const DrawableButton&);
  13452. const DrawableButton& operator= (const DrawableButton&);
  13453. };
  13454. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13455. /********* End of inlined file: juce_DrawableButton.h *********/
  13456. #endif
  13457. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13458. /********* Start of inlined file: juce_HyperlinkButton.h *********/
  13459. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13460. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13461. class JUCE_API HyperlinkButton : public Button
  13462. {
  13463. public:
  13464. HyperlinkButton (const String& linkText,
  13465. const URL& linkURL);
  13466. ~HyperlinkButton();
  13467. void setFont (const Font& newFont,
  13468. const bool resizeToMatchComponentHeight,
  13469. const Justification& justificationType = Justification::horizontallyCentred);
  13470. enum ColourIds
  13471. {
  13472. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13473. };
  13474. void setURL (const URL& newURL) throw();
  13475. const URL& getURL() const throw() { return url; }
  13476. void changeWidthToFitText();
  13477. juce_UseDebuggingNewOperator
  13478. protected:
  13479. void clicked();
  13480. void colourChanged();
  13481. void paintButton (Graphics& g,
  13482. bool isMouseOverButton,
  13483. bool isButtonDown);
  13484. private:
  13485. URL url;
  13486. Font font;
  13487. bool resizeFont;
  13488. Justification justification;
  13489. const Font getFontToUse() const;
  13490. HyperlinkButton (const HyperlinkButton&);
  13491. const HyperlinkButton& operator= (const HyperlinkButton&);
  13492. };
  13493. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13494. /********* End of inlined file: juce_HyperlinkButton.h *********/
  13495. #endif
  13496. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13497. /********* Start of inlined file: juce_ImageButton.h *********/
  13498. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13499. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13500. class JUCE_API ImageButton : public Button
  13501. {
  13502. public:
  13503. ImageButton (const String& name);
  13504. ~ImageButton();
  13505. void setImages (const bool resizeButtonNowToFitThisImage,
  13506. const bool rescaleImagesWhenButtonSizeChanges,
  13507. const bool preserveImageProportions,
  13508. Image* const normalImage,
  13509. const float imageOpacityWhenNormal,
  13510. const Colour& overlayColourWhenNormal,
  13511. Image* const overImage,
  13512. const float imageOpacityWhenOver,
  13513. const Colour& overlayColourWhenOver,
  13514. Image* const downImage,
  13515. const float imageOpacityWhenDown,
  13516. const Colour& overlayColourWhenDown,
  13517. const float hitTestAlphaThreshold = 0.0f);
  13518. Image* getNormalImage() const throw();
  13519. Image* getOverImage() const throw();
  13520. Image* getDownImage() const throw();
  13521. juce_UseDebuggingNewOperator
  13522. protected:
  13523. bool hitTest (int x, int y);
  13524. void paintButton (Graphics& g,
  13525. bool isMouseOverButton,
  13526. bool isButtonDown);
  13527. private:
  13528. bool scaleImageToFit, preserveProportions;
  13529. unsigned char alphaThreshold;
  13530. int imageX, imageY, imageW, imageH;
  13531. Image* normalImage;
  13532. Image* overImage;
  13533. Image* downImage;
  13534. float normalOpacity, overOpacity, downOpacity;
  13535. Colour normalOverlay, overOverlay, downOverlay;
  13536. Image* getCurrentImage() const;
  13537. void deleteImages();
  13538. ImageButton (const ImageButton&);
  13539. const ImageButton& operator= (const ImageButton&);
  13540. };
  13541. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13542. /********* End of inlined file: juce_ImageButton.h *********/
  13543. #endif
  13544. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13545. /********* Start of inlined file: juce_ShapeButton.h *********/
  13546. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13547. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13548. class JUCE_API ShapeButton : public Button
  13549. {
  13550. public:
  13551. ShapeButton (const String& name,
  13552. const Colour& normalColour,
  13553. const Colour& overColour,
  13554. const Colour& downColour);
  13555. ~ShapeButton();
  13556. void setShape (const Path& newShape,
  13557. const bool resizeNowToFitThisShape,
  13558. const bool maintainShapeProportions,
  13559. const bool hasDropShadow);
  13560. void setColours (const Colour& normalColour,
  13561. const Colour& overColour,
  13562. const Colour& downColour);
  13563. void setOutline (const Colour& outlineColour,
  13564. const float outlineStrokeWidth);
  13565. juce_UseDebuggingNewOperator
  13566. protected:
  13567. void paintButton (Graphics& g,
  13568. bool isMouseOverButton,
  13569. bool isButtonDown);
  13570. private:
  13571. Colour normalColour, overColour, downColour, outlineColour;
  13572. DropShadowEffect shadow;
  13573. Path shape;
  13574. bool maintainShapeProportions;
  13575. float outlineWidth;
  13576. ShapeButton (const ShapeButton&);
  13577. const ShapeButton& operator= (const ShapeButton&);
  13578. };
  13579. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13580. /********* End of inlined file: juce_ShapeButton.h *********/
  13581. #endif
  13582. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13583. #endif
  13584. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13585. /********* Start of inlined file: juce_ToggleButton.h *********/
  13586. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13587. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13588. class JUCE_API ToggleButton : public Button
  13589. {
  13590. public:
  13591. ToggleButton (const String& buttonText);
  13592. ~ToggleButton();
  13593. void changeWidthToFitText();
  13594. enum ColourIds
  13595. {
  13596. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13597. };
  13598. juce_UseDebuggingNewOperator
  13599. protected:
  13600. void paintButton (Graphics& g,
  13601. bool isMouseOverButton,
  13602. bool isButtonDown);
  13603. void colourChanged();
  13604. private:
  13605. ToggleButton (const ToggleButton&);
  13606. const ToggleButton& operator= (const ToggleButton&);
  13607. };
  13608. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13609. /********* End of inlined file: juce_ToggleButton.h *********/
  13610. #endif
  13611. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13612. /********* Start of inlined file: juce_ToolbarButton.h *********/
  13613. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13614. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13615. /********* Start of inlined file: juce_ToolbarItemComponent.h *********/
  13616. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13617. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13618. /********* Start of inlined file: juce_Toolbar.h *********/
  13619. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13620. #define __JUCE_TOOLBAR_JUCEHEADER__
  13621. /********* Start of inlined file: juce_DragAndDropContainer.h *********/
  13622. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13623. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13624. /********* Start of inlined file: juce_DragAndDropTarget.h *********/
  13625. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13626. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13627. class JUCE_API DragAndDropTarget
  13628. {
  13629. public:
  13630. virtual ~DragAndDropTarget() {}
  13631. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13632. Component* sourceComponent) = 0;
  13633. virtual void itemDragEnter (const String& sourceDescription,
  13634. Component* sourceComponent,
  13635. int x,
  13636. int y);
  13637. virtual void itemDragMove (const String& sourceDescription,
  13638. Component* sourceComponent,
  13639. int x,
  13640. int y);
  13641. virtual void itemDragExit (const String& sourceDescription,
  13642. Component* sourceComponent);
  13643. virtual void itemDropped (const String& sourceDescription,
  13644. Component* sourceComponent,
  13645. int x,
  13646. int y) = 0;
  13647. virtual bool shouldDrawDragImageWhenOver();
  13648. };
  13649. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13650. /********* End of inlined file: juce_DragAndDropTarget.h *********/
  13651. class JUCE_API DragAndDropContainer
  13652. {
  13653. public:
  13654. DragAndDropContainer();
  13655. virtual ~DragAndDropContainer();
  13656. void startDragging (const String& sourceDescription,
  13657. Component* sourceComponent,
  13658. Image* dragImage = 0,
  13659. const bool allowDraggingToOtherJuceWindows = false,
  13660. const Point* imageOffsetFromMouse = 0);
  13661. bool isDragAndDropActive() const;
  13662. const String getCurrentDragDescription() const;
  13663. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13664. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  13665. static bool performExternalDragDropOfText (const String& text);
  13666. juce_UseDebuggingNewOperator
  13667. protected:
  13668. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13669. Component* dragSourceComponent,
  13670. StringArray& files,
  13671. bool& canMoveFiles);
  13672. private:
  13673. friend class DragImageComponent;
  13674. ScopedPointer <Component> dragImageComponent;
  13675. String currentDragDesc;
  13676. };
  13677. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13678. /********* End of inlined file: juce_DragAndDropContainer.h *********/
  13679. /********* Start of inlined file: juce_ComponentAnimator.h *********/
  13680. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13681. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13682. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13683. private Timer
  13684. {
  13685. public:
  13686. ComponentAnimator();
  13687. ~ComponentAnimator();
  13688. void animateComponent (Component* const component,
  13689. const Rectangle& finalPosition,
  13690. const int millisecondsToSpendMoving,
  13691. const double startSpeed = 1.0,
  13692. const double endSpeed = 1.0);
  13693. void cancelAnimation (Component* const component,
  13694. const bool moveComponentToItsFinalPosition);
  13695. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13696. const Rectangle getComponentDestination (Component* const component);
  13697. bool isAnimating (Component* component) const;
  13698. juce_UseDebuggingNewOperator
  13699. private:
  13700. VoidArray tasks;
  13701. uint32 lastTime;
  13702. void* findTaskFor (Component* const component) const;
  13703. void timerCallback();
  13704. };
  13705. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13706. /********* End of inlined file: juce_ComponentAnimator.h *********/
  13707. class ToolbarItemComponent;
  13708. class ToolbarItemFactory;
  13709. class MissingItemsComponent;
  13710. class JUCE_API Toolbar : public Component,
  13711. public DragAndDropContainer,
  13712. public DragAndDropTarget,
  13713. private ButtonListener
  13714. {
  13715. public:
  13716. Toolbar();
  13717. ~Toolbar();
  13718. void setVertical (const bool shouldBeVertical);
  13719. bool isVertical() const throw() { return vertical; }
  13720. int getThickness() const throw();
  13721. int getLength() const throw();
  13722. void clear();
  13723. void addItem (ToolbarItemFactory& factory,
  13724. const int itemId,
  13725. const int insertIndex = -1);
  13726. void removeToolbarItem (const int itemIndex);
  13727. int getNumItems() const throw();
  13728. int getItemId (const int itemIndex) const throw();
  13729. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  13730. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  13731. enum ToolbarItemStyle
  13732. {
  13733. iconsOnly, /**< Means that the toolbar should just contain icons. */
  13734. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  13735. textOnly /**< Means that the toolbar only display text labels for each item. */
  13736. };
  13737. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13738. void setStyle (const ToolbarItemStyle& newStyle);
  13739. enum CustomisationFlags
  13740. {
  13741. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  13742. show the "icons only" option on its choice of toolbar styles. */
  13743. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  13744. show the "icons with text" option on its choice of toolbar styles. */
  13745. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  13746. show the "text only" option on its choice of toolbar styles. */
  13747. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  13748. show a button to reset the toolbar to its default set of items. */
  13749. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  13750. };
  13751. void showCustomisationDialog (ToolbarItemFactory& factory,
  13752. const int optionFlags = allCustomisationOptionsEnabled);
  13753. void setEditingActive (const bool editingEnabled);
  13754. enum ColourIds
  13755. {
  13756. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  13757. more control over this, override LookAndFeel::paintToolbarBackground(). */
  13758. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  13759. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  13760. over them. */
  13761. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  13762. held down on them. */
  13763. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  13764. when the style is set to iconsWithText or textOnly. */
  13765. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  13766. the customisation dialog is active and the mouse moves over them. */
  13767. };
  13768. const String toString() const;
  13769. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  13770. const String& savedVersion);
  13771. void paint (Graphics& g);
  13772. void resized();
  13773. void buttonClicked (Button*);
  13774. void mouseDown (const MouseEvent&);
  13775. bool isInterestedInDragSource (const String&, Component*);
  13776. void itemDragMove (const String&, Component*, int, int);
  13777. void itemDragExit (const String&, Component*);
  13778. void itemDropped (const String&, Component*, int, int);
  13779. void updateAllItemPositions (const bool animate);
  13780. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  13781. juce_UseDebuggingNewOperator
  13782. private:
  13783. Button* missingItemsButton;
  13784. bool vertical, isEditingActive;
  13785. ToolbarItemStyle toolbarStyle;
  13786. ComponentAnimator animator;
  13787. friend class MissingItemsComponent;
  13788. Array <ToolbarItemComponent*> items;
  13789. friend class ItemDragAndDropOverlayComponent;
  13790. static const tchar* const toolbarDragDescriptor;
  13791. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  13792. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  13793. Toolbar (const Toolbar&);
  13794. const Toolbar& operator= (const Toolbar&);
  13795. };
  13796. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  13797. /********* End of inlined file: juce_Toolbar.h *********/
  13798. class ItemDragAndDropOverlayComponent;
  13799. class JUCE_API ToolbarItemComponent : public Button
  13800. {
  13801. public:
  13802. ToolbarItemComponent (const int itemId,
  13803. const String& labelText,
  13804. const bool isBeingUsedAsAButton);
  13805. ~ToolbarItemComponent();
  13806. int getItemId() const throw() { return itemId; }
  13807. Toolbar* getToolbar() const;
  13808. bool isToolbarVertical() const;
  13809. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13810. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  13811. const Rectangle getContentArea() const throw() { return contentArea; }
  13812. virtual bool getToolbarItemSizes (int toolbarThickness,
  13813. bool isToolbarVertical,
  13814. int& preferredSize,
  13815. int& minSize,
  13816. int& maxSize) = 0;
  13817. virtual void paintButtonArea (Graphics& g,
  13818. int width, int height,
  13819. bool isMouseOver, bool isMouseDown) = 0;
  13820. virtual void contentAreaChanged (const Rectangle& newBounds) = 0;
  13821. enum ToolbarEditingMode
  13822. {
  13823. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  13824. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  13825. customisation mode, and the items can be dragged around. */
  13826. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  13827. dragged onto a toolbar to add it to that bar.*/
  13828. };
  13829. void setEditingMode (const ToolbarEditingMode newMode);
  13830. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  13831. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  13832. void resized();
  13833. juce_UseDebuggingNewOperator
  13834. private:
  13835. friend class Toolbar;
  13836. friend class ItemDragAndDropOverlayComponent;
  13837. const int itemId;
  13838. ToolbarEditingMode mode;
  13839. Toolbar::ToolbarItemStyle toolbarStyle;
  13840. ScopedPointer <Component> overlayComp;
  13841. int dragOffsetX, dragOffsetY;
  13842. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  13843. Rectangle contentArea;
  13844. ToolbarItemComponent (const ToolbarItemComponent&);
  13845. const ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  13846. };
  13847. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13848. /********* End of inlined file: juce_ToolbarItemComponent.h *********/
  13849. class JUCE_API ToolbarButton : public ToolbarItemComponent
  13850. {
  13851. public:
  13852. ToolbarButton (const int itemId,
  13853. const String& labelText,
  13854. Drawable* const normalImage,
  13855. Drawable* const toggledOnImage);
  13856. ~ToolbarButton();
  13857. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  13858. int& minSize, int& maxSize);
  13859. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  13860. void contentAreaChanged (const Rectangle& newBounds);
  13861. juce_UseDebuggingNewOperator
  13862. private:
  13863. ScopedPointer <Drawable> normalImage, toggledOnImage;
  13864. ToolbarButton (const ToolbarButton&);
  13865. const ToolbarButton& operator= (const ToolbarButton&);
  13866. };
  13867. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13868. /********* End of inlined file: juce_ToolbarButton.h *********/
  13869. #endif
  13870. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13871. /********* Start of inlined file: juce_CodeDocument.h *********/
  13872. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13873. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  13874. class CodeDocumentLine;
  13875. class JUCE_API CodeDocument
  13876. {
  13877. public:
  13878. CodeDocument();
  13879. ~CodeDocument();
  13880. class JUCE_API Position
  13881. {
  13882. public:
  13883. Position() throw();
  13884. Position (const CodeDocument* const ownerDocument,
  13885. const int line, const int indexInLine) throw();
  13886. Position (const CodeDocument* const ownerDocument,
  13887. const int charactersFromStartOfDocument) throw();
  13888. Position (const Position& other) throw();
  13889. ~Position() throw();
  13890. const Position& operator= (const Position& other) throw();
  13891. bool operator== (const Position& other) const throw();
  13892. bool operator!= (const Position& other) const throw();
  13893. void setPosition (const int charactersFromStartOfDocument) throw();
  13894. int getPosition() const throw() { return characterPos; }
  13895. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  13896. int getLineNumber() const throw() { return line; }
  13897. int getIndexInLine() const throw() { return indexInLine; }
  13898. void setPositionMaintained (const bool isMaintained) throw();
  13899. void moveBy (int characterDelta) throw();
  13900. const Position movedBy (const int characterDelta) const throw();
  13901. const Position movedByLines (const int deltaLines) const throw();
  13902. const tchar getCharacter() const throw();
  13903. const String getLineText() const throw();
  13904. private:
  13905. CodeDocument* owner;
  13906. int characterPos, line, indexInLine;
  13907. bool positionMaintained;
  13908. };
  13909. const String getAllContent() const throw();
  13910. const String getTextBetween (const Position& start, const Position& end) const throw();
  13911. const String getLine (const int lineIndex) const throw();
  13912. int getNumCharacters() const throw();
  13913. int getNumLines() const throw() { return lines.size(); }
  13914. int getMaximumLineLength() throw();
  13915. void deleteSection (const Position& startPosition, const Position& endPosition);
  13916. void insertText (const Position& position, const String& text);
  13917. void replaceAllContent (const String& newContent);
  13918. const String getNewLineCharacters() const throw() { return newLineChars; }
  13919. void setNewLineCharacters (const String& newLine) throw();
  13920. void newTransaction();
  13921. void undo();
  13922. void redo();
  13923. void clearUndoHistory();
  13924. UndoManager& getUndoManager() throw() { return undoManager; }
  13925. void setSavePoint() throw();
  13926. bool hasChangedSinceSavePoint() const throw();
  13927. const Position findWordBreakAfter (const Position& position) const throw();
  13928. const Position findWordBreakBefore (const Position& position) const throw();
  13929. class JUCE_API Listener
  13930. {
  13931. public:
  13932. Listener() {}
  13933. virtual ~Listener() {}
  13934. virtual void codeDocumentChanged (const Position& affectedTextStart,
  13935. const Position& affectedTextEnd) = 0;
  13936. };
  13937. void addListener (Listener* const listener) throw();
  13938. void removeListener (Listener* const listener) throw();
  13939. class Iterator
  13940. {
  13941. public:
  13942. Iterator (CodeDocument* const document);
  13943. Iterator (const Iterator& other);
  13944. const Iterator& operator= (const Iterator& other) throw();
  13945. ~Iterator() throw();
  13946. juce_wchar nextChar();
  13947. juce_wchar peekNextChar() const;
  13948. void skip();
  13949. int getPosition() const throw() { return position; }
  13950. void skipWhitespace();
  13951. void skipToEndOfLine();
  13952. int getLine() const throw() { return line; }
  13953. bool isEOF() const throw();
  13954. private:
  13955. CodeDocument* document;
  13956. CodeDocumentLine* currentLine;
  13957. int line, position;
  13958. };
  13959. juce_UseDebuggingNewOperator
  13960. private:
  13961. friend class CodeDocumentInsertAction;
  13962. friend class CodeDocumentDeleteAction;
  13963. friend class Iterator;
  13964. friend class Position;
  13965. OwnedArray <CodeDocumentLine> lines;
  13966. Array <Position*> positionsToMaintain;
  13967. UndoManager undoManager;
  13968. int currentActionIndex, indexOfSavedState;
  13969. int maximumLineLength;
  13970. VoidArray listeners;
  13971. String newLineChars;
  13972. void sendListenerChangeMessage (const int startLine, const int endLine);
  13973. void insert (const String& text, const int insertPos, const bool undoable);
  13974. void remove (const int startPos, const int endPos, const bool undoable);
  13975. void checkLastLineStatus();
  13976. CodeDocument (const CodeDocument&);
  13977. const CodeDocument& operator= (const CodeDocument&);
  13978. };
  13979. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  13980. /********* End of inlined file: juce_CodeDocument.h *********/
  13981. #endif
  13982. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  13983. /********* Start of inlined file: juce_CodeEditorComponent.h *********/
  13984. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  13985. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  13986. /********* Start of inlined file: juce_CodeTokeniser.h *********/
  13987. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  13988. #define __JUCE_CODETOKENISER_JUCEHEADER__
  13989. class JUCE_API CodeTokeniser
  13990. {
  13991. public:
  13992. CodeTokeniser() {}
  13993. virtual ~CodeTokeniser() {}
  13994. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  13995. virtual const StringArray getTokenTypes() = 0;
  13996. virtual const Colour getDefaultColour (const int tokenType) = 0;
  13997. juce_UseDebuggingNewOperator
  13998. };
  13999. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14000. /********* End of inlined file: juce_CodeTokeniser.h *********/
  14001. class JUCE_API CodeEditorComponent : public Component,
  14002. public Timer,
  14003. public ScrollBarListener,
  14004. public CodeDocument::Listener,
  14005. public AsyncUpdater
  14006. {
  14007. public:
  14008. CodeEditorComponent (CodeDocument& document,
  14009. CodeTokeniser* const codeTokeniser);
  14010. ~CodeEditorComponent();
  14011. CodeDocument& getDocument() const throw() { return document; }
  14012. void loadContent (const String& newContent);
  14013. float getCharWidth() const throw() { return charWidth; }
  14014. int getLineHeight() const throw() { return lineHeight; }
  14015. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14016. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14017. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14018. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14019. const Rectangle getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14020. const CodeDocument::Position getPositionAt (int x, int y);
  14021. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14022. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14023. void cursorDown (const bool selecting);
  14024. void cursorUp (const bool selecting);
  14025. void pageDown (const bool selecting);
  14026. void pageUp (const bool selecting);
  14027. void scrollDown();
  14028. void scrollUp();
  14029. void scrollToLine (int newFirstLineOnScreen);
  14030. void scrollBy (int deltaLines);
  14031. void scrollToColumn (int newFirstColumnOnScreen);
  14032. void scrollToKeepCaretOnScreen();
  14033. void goToStartOfDocument (const bool selecting);
  14034. void goToStartOfLine (const bool selecting);
  14035. void goToEndOfDocument (const bool selecting);
  14036. void goToEndOfLine (const bool selecting);
  14037. void deselectAll();
  14038. void selectAll();
  14039. void insertTextAtCaret (const String& textToInsert);
  14040. void insertTabAtCaret();
  14041. void cut();
  14042. void copy();
  14043. void copyThenCut();
  14044. void paste();
  14045. void backspace (const bool moveInWholeWordSteps);
  14046. void deleteForward (const bool moveInWholeWordSteps);
  14047. void undo();
  14048. void redo();
  14049. void setTabSize (const int numSpacesPerTab,
  14050. const bool insertSpacesInsteadOfTabCharacters) throw();
  14051. int getTabSize() const throw() { return spacesPerTab; }
  14052. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14053. void setFont (const Font& newFont);
  14054. void resetToDefaultColours();
  14055. void setColourForTokenType (const int tokenType, const Colour& colour);
  14056. const Colour getColourForTokenType (const int tokenType) const throw();
  14057. enum ColourIds
  14058. {
  14059. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14060. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14061. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14062. selected text. */
  14063. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14064. enabled. */
  14065. };
  14066. void setScrollbarThickness (const int thickness) throw();
  14067. void resized();
  14068. void paint (Graphics& g);
  14069. bool keyPressed (const KeyPress& key);
  14070. void mouseDown (const MouseEvent& e);
  14071. void mouseDrag (const MouseEvent& e);
  14072. void mouseUp (const MouseEvent& e);
  14073. void mouseDoubleClick (const MouseEvent& e);
  14074. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14075. void timerCallback();
  14076. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14077. void handleAsyncUpdate();
  14078. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14079. const CodeDocument::Position& affectedTextEnd);
  14080. juce_UseDebuggingNewOperator
  14081. private:
  14082. CodeDocument& document;
  14083. Font font;
  14084. int firstLineOnScreen, gutter, spacesPerTab;
  14085. float charWidth;
  14086. int lineHeight, linesOnScreen, columnsOnScreen;
  14087. int scrollbarThickness, columnToTryToMaintain;
  14088. bool useSpacesForTabs;
  14089. double xOffset;
  14090. CodeDocument::Position caretPos;
  14091. CodeDocument::Position selectionStart, selectionEnd;
  14092. Component* caret;
  14093. ScrollBar* verticalScrollBar;
  14094. ScrollBar* horizontalScrollBar;
  14095. enum DragType
  14096. {
  14097. notDragging,
  14098. draggingSelectionStart,
  14099. draggingSelectionEnd
  14100. };
  14101. DragType dragType;
  14102. CodeTokeniser* codeTokeniser;
  14103. Array <Colour> coloursForTokenCategories;
  14104. class CodeEditorLine;
  14105. OwnedArray <CodeEditorLine> lines;
  14106. void rebuildLineTokens();
  14107. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14108. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14109. void updateCachedIterators (int maxLineNum);
  14110. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14111. void moveLineDelta (const int delta, const bool selecting);
  14112. void updateScrollBars();
  14113. void scrollToLineInternal (int line);
  14114. void scrollToColumnInternal (double column);
  14115. void newTransaction();
  14116. int indexToColumn (int line, int index) const throw();
  14117. int columnToIndex (int line, int column) const throw();
  14118. CodeEditorComponent (const CodeEditorComponent&);
  14119. const CodeEditorComponent& operator= (const CodeEditorComponent&);
  14120. };
  14121. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14122. /********* End of inlined file: juce_CodeEditorComponent.h *********/
  14123. #endif
  14124. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14125. #endif
  14126. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14127. /********* Start of inlined file: juce_CPlusPlusCodeTokeniser.h *********/
  14128. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14129. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14130. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14131. {
  14132. public:
  14133. CPlusPlusCodeTokeniser();
  14134. ~CPlusPlusCodeTokeniser();
  14135. enum TokenType
  14136. {
  14137. tokenType_error = 0,
  14138. tokenType_comment,
  14139. tokenType_builtInKeyword,
  14140. tokenType_identifier,
  14141. tokenType_integerLiteral,
  14142. tokenType_floatLiteral,
  14143. tokenType_stringLiteral,
  14144. tokenType_operator,
  14145. tokenType_bracket,
  14146. tokenType_punctuation,
  14147. tokenType_preprocessor
  14148. };
  14149. int readNextToken (CodeDocument::Iterator& source);
  14150. const StringArray getTokenTypes();
  14151. const Colour getDefaultColour (const int tokenType);
  14152. juce_UseDebuggingNewOperator
  14153. };
  14154. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14155. /********* End of inlined file: juce_CPlusPlusCodeTokeniser.h *********/
  14156. #endif
  14157. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14158. #endif
  14159. #ifndef __JUCE_LABEL_JUCEHEADER__
  14160. #endif
  14161. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14162. #endif
  14163. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14164. /********* Start of inlined file: juce_ProgressBar.h *********/
  14165. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14166. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14167. class JUCE_API ProgressBar : public Component,
  14168. public SettableTooltipClient,
  14169. private Timer
  14170. {
  14171. public:
  14172. ProgressBar (double& progress);
  14173. ~ProgressBar();
  14174. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14175. void setTextToDisplay (const String& text);
  14176. enum ColourIds
  14177. {
  14178. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14179. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14180. classes will probably use variations on this colour. */
  14181. };
  14182. juce_UseDebuggingNewOperator
  14183. protected:
  14184. void paint (Graphics& g);
  14185. void lookAndFeelChanged();
  14186. void visibilityChanged();
  14187. void colourChanged();
  14188. private:
  14189. double& progress;
  14190. double currentValue;
  14191. bool displayPercentage;
  14192. String displayedMessage, currentMessage;
  14193. uint32 lastCallbackTime;
  14194. void timerCallback();
  14195. ProgressBar (const ProgressBar&);
  14196. const ProgressBar& operator= (const ProgressBar&);
  14197. };
  14198. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14199. /********* End of inlined file: juce_ProgressBar.h *********/
  14200. #endif
  14201. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14202. /********* Start of inlined file: juce_Slider.h *********/
  14203. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14204. #define __JUCE_SLIDER_JUCEHEADER__
  14205. /********* Start of inlined file: juce_SliderListener.h *********/
  14206. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14207. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14208. class Slider;
  14209. class JUCE_API SliderListener
  14210. {
  14211. public:
  14212. virtual ~SliderListener() {}
  14213. virtual void sliderValueChanged (Slider* slider) = 0;
  14214. virtual void sliderDragStarted (Slider* slider);
  14215. virtual void sliderDragEnded (Slider* slider);
  14216. };
  14217. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14218. /********* End of inlined file: juce_SliderListener.h *********/
  14219. class JUCE_API Slider : public Component,
  14220. public SettableTooltipClient,
  14221. private AsyncUpdater,
  14222. private ButtonListener,
  14223. private LabelListener,
  14224. private Value::Listener
  14225. {
  14226. public:
  14227. Slider (const String& componentName);
  14228. ~Slider();
  14229. enum SliderStyle
  14230. {
  14231. LinearHorizontal, /**< A traditional horizontal slider. */
  14232. LinearVertical, /**< A traditional vertical slider. */
  14233. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14234. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14235. @see setRotaryParameters */
  14236. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14237. @see setRotaryParameters */
  14238. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14239. @see setRotaryParameters */
  14240. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14241. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14242. @see setMinValue, setMaxValue */
  14243. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14244. @see setMinValue, setMaxValue */
  14245. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14246. value, with the current value being somewhere between them.
  14247. @see setMinValue, setMaxValue */
  14248. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14249. value, with the current value being somewhere between them.
  14250. @see setMinValue, setMaxValue */
  14251. };
  14252. void setSliderStyle (const SliderStyle newStyle);
  14253. SliderStyle getSliderStyle() const { return style; }
  14254. void setRotaryParameters (const float startAngleRadians,
  14255. const float endAngleRadians,
  14256. const bool stopAtEnd);
  14257. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14258. void setVelocityBasedMode (const bool isVelocityBased);
  14259. bool getVelocityBasedMode() const { return isVelocityBased; }
  14260. void setVelocityModeParameters (const double sensitivity = 1.0,
  14261. const int threshold = 1,
  14262. const double offset = 0.0,
  14263. const bool userCanPressKeyToSwapMode = true);
  14264. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14265. int getVelocityThreshold() const { return velocityModeThreshold; }
  14266. double getVelocityOffset() const { return velocityModeOffset; }
  14267. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14268. void setSkewFactor (const double factor);
  14269. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14270. double getSkewFactor() const { return skewFactor; }
  14271. enum IncDecButtonMode
  14272. {
  14273. incDecButtonsNotDraggable,
  14274. incDecButtonsDraggable_AutoDirection,
  14275. incDecButtonsDraggable_Horizontal,
  14276. incDecButtonsDraggable_Vertical
  14277. };
  14278. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14279. enum TextEntryBoxPosition
  14280. {
  14281. NoTextBox, /**< Doesn't display a text box. */
  14282. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14283. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14284. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14285. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14286. };
  14287. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14288. const bool isReadOnly,
  14289. const int textEntryBoxWidth,
  14290. const int textEntryBoxHeight);
  14291. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14292. int getTextBoxWidth() const { return textBoxWidth; }
  14293. int getTextBoxHeight() const { return textBoxHeight; }
  14294. void setTextBoxIsEditable (const bool shouldBeEditable);
  14295. bool isTextBoxEditable() const { return editableText; }
  14296. void showTextBox();
  14297. void hideTextBox (const bool discardCurrentEditorContents);
  14298. void setValue (double newValue,
  14299. const bool sendUpdateMessage = true,
  14300. const bool sendMessageSynchronously = false);
  14301. double getValue() const;
  14302. Value& getValueObject() { return currentValue; }
  14303. void setRange (const double newMinimum,
  14304. const double newMaximum,
  14305. const double newInterval = 0);
  14306. double getMaximum() const { return maximum; }
  14307. double getMinimum() const { return minimum; }
  14308. double getInterval() const { return interval; }
  14309. double getMinValue() const;
  14310. Value& getMinValueObject() { return valueMin; }
  14311. void setMinValue (double newValue,
  14312. const bool sendUpdateMessage = true,
  14313. const bool sendMessageSynchronously = false,
  14314. const bool allowNudgingOfOtherValues = false);
  14315. double getMaxValue() const;
  14316. Value& getMaxValueObject() { return valueMax; }
  14317. void setMaxValue (double newValue,
  14318. const bool sendUpdateMessage = true,
  14319. const bool sendMessageSynchronously = false,
  14320. const bool allowNudgingOfOtherValues = false);
  14321. void addListener (SliderListener* const listener);
  14322. void removeListener (SliderListener* const listener);
  14323. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14324. const double valueToSetOnDoubleClick);
  14325. double getDoubleClickReturnValue (bool& isEnabled) const;
  14326. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14327. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14328. void setPopupDisplayEnabled (const bool isEnabled,
  14329. Component* const parentComponentToUse);
  14330. void setPopupMenuEnabled (const bool menuEnabled);
  14331. void setScrollWheelEnabled (const bool enabled);
  14332. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14333. virtual void startedDragging();
  14334. virtual void stoppedDragging();
  14335. virtual void valueChanged();
  14336. /** Callback to indicate that the user has just moved the slider.
  14337. Note - the valueChanged() method has changed its format and now no longer has
  14338. any parameters. Update your code to use the new version.
  14339. This version has been left here with an int as its return value to cause
  14340. a syntax error if you've got existing code that uses the old version.
  14341. */
  14342. virtual int valueChanged (double) { jassertfalse; return 0; }
  14343. virtual double getValueFromText (const String& text);
  14344. virtual const String getTextFromValue (double value);
  14345. void setTextValueSuffix (const String& suffix);
  14346. virtual double proportionOfLengthToValue (double proportion);
  14347. virtual double valueToProportionOfLength (double value);
  14348. float getPositionOfValue (const double value);
  14349. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14350. void updateText();
  14351. bool isHorizontal() const;
  14352. bool isVertical() const;
  14353. enum ColourIds
  14354. {
  14355. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14356. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14357. and feel class how this is used. */
  14358. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14359. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14360. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14361. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14362. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14363. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14364. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14365. };
  14366. juce_UseDebuggingNewOperator
  14367. protected:
  14368. void labelTextChanged (Label*);
  14369. void paint (Graphics& g);
  14370. void resized();
  14371. void mouseDown (const MouseEvent& e);
  14372. void mouseUp (const MouseEvent& e);
  14373. void mouseDrag (const MouseEvent& e);
  14374. void mouseDoubleClick (const MouseEvent& e);
  14375. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14376. void modifierKeysChanged (const ModifierKeys& modifiers);
  14377. void buttonClicked (Button* button);
  14378. void lookAndFeelChanged();
  14379. void enablementChanged();
  14380. void focusOfChildComponentChanged (FocusChangeType cause);
  14381. void handleAsyncUpdate();
  14382. void colourChanged();
  14383. void valueChanged (Value& value);
  14384. private:
  14385. SortedSet <void*> listeners;
  14386. Value currentValue, valueMin, valueMax;
  14387. double lastCurrentValue, lastValueMin, lastValueMax;
  14388. double minimum, maximum, interval, doubleClickReturnValue;
  14389. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14390. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14391. int velocityModeThreshold;
  14392. float rotaryStart, rotaryEnd;
  14393. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14394. int mouseDragStartX, mouseDragStartY;
  14395. int sliderRegionStart, sliderRegionSize;
  14396. int sliderBeingDragged;
  14397. int pixelsForFullDragExtent;
  14398. Rectangle sliderRect;
  14399. String textSuffix;
  14400. SliderStyle style;
  14401. TextEntryBoxPosition textBoxPos;
  14402. int textBoxWidth, textBoxHeight;
  14403. IncDecButtonMode incDecButtonMode;
  14404. bool editableText : 1, doubleClickToValue : 1;
  14405. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14406. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14407. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14408. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14409. Font font;
  14410. Label* valueBox;
  14411. Button* incButton;
  14412. Button* decButton;
  14413. ScopedPointer <Component> popupDisplay;
  14414. Component* parentForPopupDisplay;
  14415. float getLinearSliderPos (const double value);
  14416. void restoreMouseIfHidden();
  14417. void sendDragStart();
  14418. void sendDragEnd();
  14419. double constrainedValue (double value) const;
  14420. void triggerChangeMessage (const bool synchronous);
  14421. bool incDecDragDirectionIsHorizontal() const;
  14422. Slider (const Slider&);
  14423. const Slider& operator= (const Slider&);
  14424. };
  14425. #endif // __JUCE_SLIDER_JUCEHEADER__
  14426. /********* End of inlined file: juce_Slider.h *********/
  14427. #endif
  14428. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14429. #endif
  14430. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14431. /********* Start of inlined file: juce_TableHeaderComponent.h *********/
  14432. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14433. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14434. class TableHeaderComponent;
  14435. class JUCE_API TableHeaderListener
  14436. {
  14437. public:
  14438. TableHeaderListener() {}
  14439. virtual ~TableHeaderListener() {}
  14440. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14441. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14442. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14443. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14444. int columnIdNowBeingDragged);
  14445. };
  14446. class JUCE_API TableHeaderComponent : public Component,
  14447. private AsyncUpdater
  14448. {
  14449. public:
  14450. TableHeaderComponent();
  14451. ~TableHeaderComponent();
  14452. enum ColumnPropertyFlags
  14453. {
  14454. 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. */
  14455. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14456. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14457. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14458. 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. */
  14459. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14460. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14461. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14462. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14463. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14464. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14465. };
  14466. void addColumn (const String& columnName,
  14467. const int columnId,
  14468. const int width,
  14469. const int minimumWidth = 30,
  14470. const int maximumWidth = -1,
  14471. const int propertyFlags = defaultFlags,
  14472. const int insertIndex = -1);
  14473. void removeColumn (const int columnIdToRemove);
  14474. void removeAllColumns();
  14475. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14476. const String getColumnName (const int columnId) const;
  14477. void setColumnName (const int columnId, const String& newName);
  14478. void moveColumn (const int columnId, int newVisibleIndex);
  14479. int getColumnWidth (const int columnId) const;
  14480. void setColumnWidth (const int columnId, const int newWidth);
  14481. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14482. bool isColumnVisible (const int columnId) const;
  14483. void setSortColumnId (const int columnId, const bool sortForwards);
  14484. int getSortColumnId() const;
  14485. bool isSortedForwards() const;
  14486. void reSortTable();
  14487. int getTotalWidth() const;
  14488. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14489. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14490. const Rectangle getColumnPosition (const int index) const;
  14491. int getColumnIdAtX (const int xToFind) const;
  14492. void setStretchToFitActive (const bool shouldStretchToFit);
  14493. bool isStretchToFitActive() const;
  14494. void resizeAllColumnsToFit (int targetTotalWidth);
  14495. void setPopupMenuActive (const bool hasMenu);
  14496. bool isPopupMenuActive() const;
  14497. const String toString() const;
  14498. void restoreFromString (const String& storedVersion);
  14499. void addListener (TableHeaderListener* const newListener);
  14500. void removeListener (TableHeaderListener* const listenerToRemove);
  14501. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14502. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14503. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14504. void paint (Graphics& g);
  14505. void resized();
  14506. void mouseMove (const MouseEvent&);
  14507. void mouseEnter (const MouseEvent&);
  14508. void mouseExit (const MouseEvent&);
  14509. void mouseDown (const MouseEvent&);
  14510. void mouseDrag (const MouseEvent&);
  14511. void mouseUp (const MouseEvent&);
  14512. const MouseCursor getMouseCursor();
  14513. virtual void showColumnChooserMenu (const int columnIdClicked);
  14514. juce_UseDebuggingNewOperator
  14515. private:
  14516. struct ColumnInfo
  14517. {
  14518. String name;
  14519. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14520. double lastDeliberateWidth;
  14521. bool isVisible() const;
  14522. };
  14523. OwnedArray <ColumnInfo> columns;
  14524. Array <TableHeaderListener*> listeners;
  14525. ScopedPointer <Component> dragOverlayComp;
  14526. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14527. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14528. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14529. ColumnInfo* getInfoForId (const int columnId) const;
  14530. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14531. void sendColumnsChanged();
  14532. void handleAsyncUpdate();
  14533. void beginDrag (const MouseEvent&);
  14534. void endDrag (const int finalIndex);
  14535. int getResizeDraggerAt (const int mouseX) const;
  14536. void updateColumnUnderMouse (int x, int y);
  14537. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14538. TableHeaderComponent (const TableHeaderComponent&);
  14539. const TableHeaderComponent operator= (const TableHeaderComponent&);
  14540. };
  14541. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14542. /********* End of inlined file: juce_TableHeaderComponent.h *********/
  14543. #endif
  14544. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14545. /********* Start of inlined file: juce_TableListBox.h *********/
  14546. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14547. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14548. class JUCE_API TableListBoxModel
  14549. {
  14550. public:
  14551. TableListBoxModel() {}
  14552. virtual ~TableListBoxModel() {}
  14553. virtual int getNumRows() = 0;
  14554. virtual void paintRowBackground (Graphics& g,
  14555. int rowNumber,
  14556. int width, int height,
  14557. bool rowIsSelected) = 0;
  14558. virtual void paintCell (Graphics& g,
  14559. int rowNumber,
  14560. int columnId,
  14561. int width, int height,
  14562. bool rowIsSelected) = 0;
  14563. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14564. Component* existingComponentToUpdate);
  14565. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14566. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14567. virtual void backgroundClicked();
  14568. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14569. virtual int getColumnAutoSizeWidth (int columnId);
  14570. virtual const String getCellTooltip (int rowNumber, int columnId);
  14571. virtual void selectedRowsChanged (int lastRowSelected);
  14572. virtual void deleteKeyPressed (int lastRowSelected);
  14573. virtual void returnKeyPressed (int lastRowSelected);
  14574. virtual void listWasScrolled();
  14575. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14576. };
  14577. class JUCE_API TableListBox : public ListBox,
  14578. private ListBoxModel,
  14579. private TableHeaderListener
  14580. {
  14581. public:
  14582. TableListBox (const String& componentName,
  14583. TableListBoxModel* const model);
  14584. ~TableListBox();
  14585. void setModel (TableListBoxModel* const newModel);
  14586. TableListBoxModel* getModel() const { return model; }
  14587. TableHeaderComponent* getHeader() const { return header; }
  14588. void setHeaderHeight (const int newHeight);
  14589. int getHeaderHeight() const;
  14590. void autoSizeColumn (const int columnId);
  14591. void autoSizeAllColumns();
  14592. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14593. bool isAutoSizeMenuOptionShown() const;
  14594. const Rectangle getCellPosition (const int columnId,
  14595. const int rowNumber,
  14596. const bool relativeToComponentTopLeft) const;
  14597. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14598. int getNumRows();
  14599. void paintListBoxItem (int, Graphics&, int, int, bool);
  14600. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14601. void selectedRowsChanged (int lastRowSelected);
  14602. void deleteKeyPressed (int currentSelectedRow);
  14603. void returnKeyPressed (int currentSelectedRow);
  14604. void backgroundClicked();
  14605. void listWasScrolled();
  14606. void tableColumnsChanged (TableHeaderComponent*);
  14607. void tableColumnsResized (TableHeaderComponent*);
  14608. void tableSortOrderChanged (TableHeaderComponent*);
  14609. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14610. void resized();
  14611. juce_UseDebuggingNewOperator
  14612. private:
  14613. TableHeaderComponent* header;
  14614. TableListBoxModel* model;
  14615. int columnIdNowBeingDragged;
  14616. bool autoSizeOptionsShown;
  14617. void updateColumnComponents() const;
  14618. TableListBox (const TableListBox&);
  14619. const TableListBox& operator= (const TableListBox&);
  14620. };
  14621. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14622. /********* End of inlined file: juce_TableListBox.h *********/
  14623. #endif
  14624. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14625. #endif
  14626. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14627. #endif
  14628. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14629. #endif
  14630. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14631. /********* Start of inlined file: juce_ToolbarItemFactory.h *********/
  14632. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14633. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14634. class JUCE_API ToolbarItemFactory
  14635. {
  14636. public:
  14637. ToolbarItemFactory();
  14638. virtual ~ToolbarItemFactory();
  14639. enum SpecialItemIds
  14640. {
  14641. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14642. can be placed between sets of items to break them into groups. */
  14643. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14644. items.*/
  14645. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14646. either side of it, filling any available space. */
  14647. };
  14648. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14649. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14650. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14651. };
  14652. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14653. /********* End of inlined file: juce_ToolbarItemFactory.h *********/
  14654. #endif
  14655. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14656. /********* Start of inlined file: juce_ToolbarItemPalette.h *********/
  14657. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14658. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14659. class JUCE_API ToolbarItemPalette : public Component,
  14660. public DragAndDropContainer
  14661. {
  14662. public:
  14663. ToolbarItemPalette (ToolbarItemFactory& factory,
  14664. Toolbar* const toolbar);
  14665. ~ToolbarItemPalette();
  14666. void resized();
  14667. juce_UseDebuggingNewOperator
  14668. private:
  14669. ToolbarItemFactory& factory;
  14670. Toolbar* toolbar;
  14671. Viewport* viewport;
  14672. friend class Toolbar;
  14673. void replaceComponent (ToolbarItemComponent* const comp);
  14674. ToolbarItemPalette (const ToolbarItemPalette&);
  14675. const ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14676. };
  14677. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14678. /********* End of inlined file: juce_ToolbarItemPalette.h *********/
  14679. #endif
  14680. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14681. /********* Start of inlined file: juce_TreeView.h *********/
  14682. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14683. #define __JUCE_TREEVIEW_JUCEHEADER__
  14684. /********* Start of inlined file: juce_FileDragAndDropTarget.h *********/
  14685. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14686. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14687. class JUCE_API FileDragAndDropTarget
  14688. {
  14689. public:
  14690. virtual ~FileDragAndDropTarget() {}
  14691. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14692. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14693. virtual void fileDragMove (const StringArray& files, int x, int y);
  14694. virtual void fileDragExit (const StringArray& files);
  14695. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14696. };
  14697. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14698. /********* End of inlined file: juce_FileDragAndDropTarget.h *********/
  14699. class TreeView;
  14700. class JUCE_API TreeViewItem
  14701. {
  14702. public:
  14703. TreeViewItem();
  14704. virtual ~TreeViewItem();
  14705. int getNumSubItems() const throw();
  14706. TreeViewItem* getSubItem (const int index) const throw();
  14707. void clearSubItems();
  14708. void addSubItem (TreeViewItem* const newItem,
  14709. const int insertPosition = -1);
  14710. void removeSubItem (const int index,
  14711. const bool deleteItem = true);
  14712. TreeView* getOwnerView() const throw() { return ownerView; }
  14713. TreeViewItem* getParentItem() const throw() { return parentItem; }
  14714. bool isOpen() const throw();
  14715. void setOpen (const bool shouldBeOpen);
  14716. bool isSelected() const throw();
  14717. void setSelected (const bool shouldBeSelected,
  14718. const bool deselectOtherItemsFirst);
  14719. const Rectangle getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  14720. void treeHasChanged() const throw();
  14721. void repaintItem() const;
  14722. int getRowNumberInTree() const throw();
  14723. bool areAllParentsOpen() const throw();
  14724. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  14725. virtual bool mightContainSubItems() = 0;
  14726. virtual const String getUniqueName() const;
  14727. virtual void itemOpennessChanged (bool isNowOpen);
  14728. virtual int getItemWidth() const { return -1; }
  14729. virtual int getItemHeight() const { return 20; }
  14730. virtual bool canBeSelected() const { return true; }
  14731. virtual Component* createItemComponent() { return 0; }
  14732. virtual void paintItem (Graphics& g, int width, int height);
  14733. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  14734. virtual void itemClicked (const MouseEvent& e);
  14735. virtual void itemDoubleClicked (const MouseEvent& e);
  14736. virtual void itemSelectionChanged (bool isNowSelected);
  14737. virtual const String getTooltip();
  14738. virtual const String getDragSourceDescription();
  14739. virtual bool isInterestedInFileDrag (const StringArray& files);
  14740. virtual void filesDropped (const StringArray& files, int insertIndex);
  14741. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14742. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  14743. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  14744. XmlElement* getOpennessState() const throw();
  14745. void restoreOpennessState (const XmlElement& xml) throw();
  14746. int getIndexInParent() const throw();
  14747. bool isLastOfSiblings() const throw();
  14748. const String getItemIdentifierString() const;
  14749. juce_UseDebuggingNewOperator
  14750. private:
  14751. TreeView* ownerView;
  14752. TreeViewItem* parentItem;
  14753. OwnedArray <TreeViewItem> subItems;
  14754. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  14755. int uid;
  14756. bool selected : 1;
  14757. bool redrawNeeded : 1;
  14758. bool drawLinesInside : 1;
  14759. bool drawsInLeftMargin : 1;
  14760. unsigned int openness : 2;
  14761. friend class TreeView;
  14762. friend class TreeViewContentComponent;
  14763. void updatePositions (int newY);
  14764. int getIndentX() const throw();
  14765. void setOwnerView (TreeView* const newOwner) throw();
  14766. void paintRecursively (Graphics& g, int width);
  14767. TreeViewItem* getTopLevelItem() throw();
  14768. TreeViewItem* findItemRecursively (int y) throw();
  14769. TreeViewItem* getDeepestOpenParentItem() throw();
  14770. int getNumRows() const throw();
  14771. TreeViewItem* getItemOnRow (int index) throw();
  14772. void deselectAllRecursively();
  14773. int countSelectedItemsRecursively() const throw();
  14774. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  14775. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  14776. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  14777. TreeViewItem (const TreeViewItem&);
  14778. const TreeViewItem& operator= (const TreeViewItem&);
  14779. };
  14780. class JUCE_API TreeView : public Component,
  14781. public SettableTooltipClient,
  14782. public FileDragAndDropTarget,
  14783. public DragAndDropTarget,
  14784. private AsyncUpdater
  14785. {
  14786. public:
  14787. TreeView (const String& componentName = String::empty);
  14788. ~TreeView();
  14789. void setRootItem (TreeViewItem* const newRootItem);
  14790. TreeViewItem* getRootItem() const throw() { return rootItem; }
  14791. void deleteRootItem();
  14792. void setRootItemVisible (const bool shouldBeVisible);
  14793. bool isRootItemVisible() const throw() { return rootItemVisible; }
  14794. void setDefaultOpenness (const bool isOpenByDefault);
  14795. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  14796. void setMultiSelectEnabled (const bool canMultiSelect);
  14797. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  14798. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  14799. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  14800. void clearSelectedItems();
  14801. int getNumSelectedItems() const throw();
  14802. TreeViewItem* getSelectedItem (const int index) const throw();
  14803. int getNumRowsInTree() const;
  14804. TreeViewItem* getItemOnRow (int index) const;
  14805. TreeViewItem* getItemAt (int yPosition) const throw();
  14806. void scrollToKeepItemVisible (TreeViewItem* item);
  14807. Viewport* getViewport() const throw() { return viewport; }
  14808. int getIndentSize() const throw() { return indentSize; }
  14809. void setIndentSize (const int newIndentSize);
  14810. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  14811. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  14812. void restoreOpennessState (const XmlElement& newState);
  14813. enum ColourIds
  14814. {
  14815. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  14816. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  14817. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  14818. };
  14819. void paint (Graphics& g);
  14820. void resized();
  14821. bool keyPressed (const KeyPress& key);
  14822. void colourChanged();
  14823. void enablementChanged();
  14824. bool isInterestedInFileDrag (const StringArray& files);
  14825. void fileDragEnter (const StringArray& files, int x, int y);
  14826. void fileDragMove (const StringArray& files, int x, int y);
  14827. void fileDragExit (const StringArray& files);
  14828. void filesDropped (const StringArray& files, int x, int y);
  14829. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14830. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14831. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14832. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  14833. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14834. juce_UseDebuggingNewOperator
  14835. private:
  14836. friend class TreeViewItem;
  14837. friend class TreeViewContentComponent;
  14838. Viewport* viewport;
  14839. CriticalSection nodeAlterationLock;
  14840. TreeViewItem* rootItem;
  14841. Component* dragInsertPointHighlight;
  14842. Component* dragTargetGroupHighlight;
  14843. int indentSize;
  14844. bool defaultOpenness : 1;
  14845. bool needsRecalculating : 1;
  14846. bool rootItemVisible : 1;
  14847. bool multiSelectEnabled : 1;
  14848. bool openCloseButtonsVisible : 1;
  14849. void itemsChanged() throw();
  14850. void handleAsyncUpdate();
  14851. void moveSelectedRow (int delta);
  14852. void updateButtonUnderMouse (const MouseEvent& e);
  14853. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  14854. void hideDragHighlight() throw();
  14855. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14856. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14857. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  14858. const StringArray& files, const String& sourceDescription,
  14859. Component* sourceComponent) const throw();
  14860. TreeView (const TreeView&);
  14861. const TreeView& operator= (const TreeView&);
  14862. };
  14863. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  14864. /********* End of inlined file: juce_TreeView.h *********/
  14865. #endif
  14866. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14867. /********* Start of inlined file: juce_DirectoryContentsDisplayComponent.h *********/
  14868. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14869. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14870. /********* Start of inlined file: juce_DirectoryContentsList.h *********/
  14871. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14872. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14873. /********* Start of inlined file: juce_FileFilter.h *********/
  14874. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  14875. #define __JUCE_FILEFILTER_JUCEHEADER__
  14876. class JUCE_API FileFilter
  14877. {
  14878. public:
  14879. FileFilter (const String& filterDescription);
  14880. virtual ~FileFilter();
  14881. const String& getDescription() const throw();
  14882. virtual bool isFileSuitable (const File& file) const = 0;
  14883. virtual bool isDirectorySuitable (const File& file) const = 0;
  14884. protected:
  14885. String description;
  14886. };
  14887. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  14888. /********* End of inlined file: juce_FileFilter.h *********/
  14889. /********* Start of inlined file: juce_Image.h *********/
  14890. #ifndef __JUCE_IMAGE_JUCEHEADER__
  14891. #define __JUCE_IMAGE_JUCEHEADER__
  14892. class JUCE_API Image
  14893. {
  14894. public:
  14895. enum PixelFormat
  14896. {
  14897. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  14898. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  14899. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  14900. };
  14901. Image (const PixelFormat format,
  14902. const int imageWidth,
  14903. const int imageHeight,
  14904. const bool clearImage);
  14905. Image (const Image& other);
  14906. virtual ~Image();
  14907. static Image* createNativeImage (const PixelFormat format,
  14908. const int imageWidth,
  14909. const int imageHeight,
  14910. const bool clearImage);
  14911. int getWidth() const throw() { return imageWidth; }
  14912. int getHeight() const throw() { return imageHeight; }
  14913. const Rectangle getBounds() const throw() { return Rectangle (0, 0, imageWidth, imageHeight); }
  14914. PixelFormat getFormat() const throw() { return format; }
  14915. bool isARGB() const throw() { return format == ARGB; }
  14916. bool isRGB() const throw() { return format == RGB; }
  14917. bool hasAlphaChannel() const throw() { return format != RGB; }
  14918. virtual void clear (int x, int y, int w, int h,
  14919. const Colour& colourToClearTo = Colour (0x00000000));
  14920. virtual Image* createCopy (int newWidth = -1,
  14921. int newHeight = -1,
  14922. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  14923. virtual Image* createCopyOfAlphaChannel() const;
  14924. virtual const Colour getPixelAt (const int x, const int y) const;
  14925. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  14926. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  14927. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  14928. virtual void desaturate();
  14929. class BitmapData
  14930. {
  14931. public:
  14932. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  14933. BitmapData (const Image& image, int x, int y, int w, int h);
  14934. ~BitmapData();
  14935. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  14936. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  14937. uint8* data;
  14938. int lineStride, pixelStride, width, height;
  14939. private:
  14940. BitmapData (const BitmapData&);
  14941. const BitmapData& operator= (const BitmapData&);
  14942. };
  14943. virtual void setPixelData (int destX, int destY, int destW, int destH,
  14944. const uint8* sourcePixelData, int sourceLineStride);
  14945. virtual void moveImageSection (int destX, int destY,
  14946. int sourceX, int sourceY,
  14947. int width, int height);
  14948. void createSolidAreaMask (RectangleList& result,
  14949. const float alphaThreshold = 0.5f) const;
  14950. juce_UseDebuggingNewOperator
  14951. virtual LowLevelGraphicsContext* createLowLevelContext();
  14952. protected:
  14953. friend class BitmapData;
  14954. const PixelFormat format;
  14955. const int imageWidth, imageHeight;
  14956. Image (const PixelFormat format,
  14957. const int imageWidth,
  14958. const int imageHeight);
  14959. int pixelStride, lineStride;
  14960. HeapBlock <uint8> imageDataAllocated;
  14961. uint8* imageData;
  14962. private:
  14963. const Image& operator= (const Image&);
  14964. };
  14965. #endif // __JUCE_IMAGE_JUCEHEADER__
  14966. /********* End of inlined file: juce_Image.h *********/
  14967. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  14968. public TimeSliceClient
  14969. {
  14970. public:
  14971. DirectoryContentsList (const FileFilter* const fileFilter,
  14972. TimeSliceThread& threadToUse);
  14973. ~DirectoryContentsList();
  14974. void setDirectory (const File& directory,
  14975. const bool includeDirectories,
  14976. const bool includeFiles);
  14977. const File& getDirectory() const;
  14978. void clear();
  14979. void refresh();
  14980. bool isStillLoading() const;
  14981. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  14982. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  14983. struct FileInfo
  14984. {
  14985. String filename;
  14986. int64 fileSize;
  14987. Time modificationTime;
  14988. Time creationTime;
  14989. bool isDirectory;
  14990. bool isReadOnly;
  14991. };
  14992. int getNumFiles() const;
  14993. bool getFileInfo (const int index,
  14994. FileInfo& resultInfo) const;
  14995. const File getFile (const int index) const;
  14996. const FileFilter* getFilter() const { return fileFilter; }
  14997. bool useTimeSlice();
  14998. TimeSliceThread& getTimeSliceThread() { return thread; }
  14999. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15000. const DirectoryContentsList::FileInfo* const second);
  15001. juce_UseDebuggingNewOperator
  15002. private:
  15003. File root;
  15004. const FileFilter* fileFilter;
  15005. TimeSliceThread& thread;
  15006. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15007. CriticalSection fileListLock;
  15008. OwnedArray <FileInfo> files;
  15009. void* volatile fileFindHandle;
  15010. bool volatile shouldStop;
  15011. void changed();
  15012. bool checkNextFile (bool& hasChanged);
  15013. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15014. const int64 fileSize, const Time& modTime,
  15015. const Time& creationTime, const bool isReadOnly);
  15016. DirectoryContentsList (const DirectoryContentsList&);
  15017. const DirectoryContentsList& operator= (const DirectoryContentsList&);
  15018. };
  15019. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15020. /********* End of inlined file: juce_DirectoryContentsList.h *********/
  15021. /********* Start of inlined file: juce_FileBrowserListener.h *********/
  15022. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15023. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15024. class JUCE_API FileBrowserListener
  15025. {
  15026. public:
  15027. virtual ~FileBrowserListener();
  15028. virtual void selectionChanged() = 0;
  15029. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15030. virtual void fileDoubleClicked (const File& file) = 0;
  15031. };
  15032. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15033. /********* End of inlined file: juce_FileBrowserListener.h *********/
  15034. class JUCE_API DirectoryContentsDisplayComponent
  15035. {
  15036. public:
  15037. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15038. virtual ~DirectoryContentsDisplayComponent();
  15039. virtual int getNumSelectedFiles() const = 0;
  15040. virtual const File getSelectedFile (int index) const = 0;
  15041. virtual void scrollToTop() = 0;
  15042. void addListener (FileBrowserListener* const listener) throw();
  15043. void removeListener (FileBrowserListener* const listener) throw();
  15044. enum ColourIds
  15045. {
  15046. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15047. textColourId = 0x1000541, /**< The colour for the text. */
  15048. };
  15049. void sendSelectionChangeMessage();
  15050. void sendDoubleClickMessage (const File& file);
  15051. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15052. juce_UseDebuggingNewOperator
  15053. protected:
  15054. DirectoryContentsList& fileList;
  15055. SortedSet <void*> listeners;
  15056. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15057. const DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15058. };
  15059. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15060. /********* End of inlined file: juce_DirectoryContentsDisplayComponent.h *********/
  15061. #endif
  15062. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15063. #endif
  15064. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15065. /********* Start of inlined file: juce_FileBrowserComponent.h *********/
  15066. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15067. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15068. /********* Start of inlined file: juce_FilePreviewComponent.h *********/
  15069. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15070. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15071. class JUCE_API FilePreviewComponent : public Component
  15072. {
  15073. public:
  15074. FilePreviewComponent();
  15075. ~FilePreviewComponent();
  15076. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15077. juce_UseDebuggingNewOperator
  15078. private:
  15079. FilePreviewComponent (const FilePreviewComponent&);
  15080. const FilePreviewComponent& operator= (const FilePreviewComponent&);
  15081. };
  15082. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15083. /********* End of inlined file: juce_FilePreviewComponent.h *********/
  15084. class JUCE_API FileBrowserComponent : public Component,
  15085. public ChangeBroadcaster,
  15086. private FileBrowserListener,
  15087. private TextEditorListener,
  15088. private ButtonListener,
  15089. private ComboBoxListener,
  15090. private FileFilter
  15091. {
  15092. public:
  15093. enum FileChooserFlags
  15094. {
  15095. openMode = 1, /**< specifies that the component should allow the user to
  15096. choose an existing file with the intention of opening it. */
  15097. saveMode = 2, /**< specifies that the component should allow the user to specify
  15098. the name of a file that will be used to save something. */
  15099. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15100. conjunction with canSelectDirectories). */
  15101. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15102. conjuction with canSelectFiles). */
  15103. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15104. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15105. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15106. };
  15107. FileBrowserComponent (int flags,
  15108. const File& initialFileOrDirectory,
  15109. const FileFilter* fileFilter,
  15110. FilePreviewComponent* previewComp);
  15111. ~FileBrowserComponent();
  15112. int getNumSelectedFiles() const throw();
  15113. const File getSelectedFile (int index) const throw();
  15114. bool currentFileIsValid() const;
  15115. const File getHighlightedFile() const throw();
  15116. const File getRoot() const;
  15117. void setRoot (const File& newRootDirectory);
  15118. void goUp();
  15119. void refresh();
  15120. virtual const String getActionVerb() const;
  15121. bool isSaveMode() const throw();
  15122. void addListener (FileBrowserListener* const listener) throw();
  15123. void removeListener (FileBrowserListener* const listener) throw();
  15124. void resized();
  15125. void buttonClicked (Button* b);
  15126. void comboBoxChanged (ComboBox*);
  15127. void textEditorTextChanged (TextEditor& editor);
  15128. void textEditorReturnKeyPressed (TextEditor& editor);
  15129. void textEditorEscapeKeyPressed (TextEditor& editor);
  15130. void textEditorFocusLost (TextEditor& editor);
  15131. bool keyPressed (const KeyPress& key);
  15132. void selectionChanged();
  15133. void fileClicked (const File& f, const MouseEvent& e);
  15134. void fileDoubleClicked (const File& f);
  15135. bool isFileSuitable (const File& file) const;
  15136. bool isDirectorySuitable (const File&) const;
  15137. FilePreviewComponent* getPreviewComponent() const throw();
  15138. juce_UseDebuggingNewOperator
  15139. protected:
  15140. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15141. private:
  15142. ScopedPointer <DirectoryContentsList> fileList;
  15143. const FileFilter* fileFilter;
  15144. int flags;
  15145. File currentRoot;
  15146. Array<File> chosenFiles;
  15147. SortedSet <void*> listeners;
  15148. DirectoryContentsDisplayComponent* fileListComponent;
  15149. FilePreviewComponent* previewComp;
  15150. ComboBox* currentPathBox;
  15151. TextEditor* filenameBox;
  15152. Button* goUpButton;
  15153. TimeSliceThread thread;
  15154. void sendListenerChangeMessage();
  15155. bool isFileOrDirSuitable (const File& f) const;
  15156. FileBrowserComponent (const FileBrowserComponent&);
  15157. const FileBrowserComponent& operator= (const FileBrowserComponent&);
  15158. };
  15159. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15160. /********* End of inlined file: juce_FileBrowserComponent.h *********/
  15161. #endif
  15162. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15163. #endif
  15164. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15165. /********* Start of inlined file: juce_FileChooser.h *********/
  15166. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15167. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15168. class JUCE_API FileChooser
  15169. {
  15170. public:
  15171. FileChooser (const String& dialogBoxTitle,
  15172. const File& initialFileOrDirectory = File::nonexistent,
  15173. const String& filePatternsAllowed = String::empty,
  15174. const bool useOSNativeDialogBox = true);
  15175. ~FileChooser();
  15176. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15177. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15178. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15179. bool browseForDirectory();
  15180. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15181. const File getResult() const;
  15182. const Array<File>& getResults() const;
  15183. juce_UseDebuggingNewOperator
  15184. private:
  15185. String title, filters;
  15186. File startingFile;
  15187. Array<File> results;
  15188. bool useNativeDialogBox;
  15189. bool showDialog (const bool selectsDirectories,
  15190. const bool selectsFiles,
  15191. const bool isSave,
  15192. const bool warnAboutOverwritingExistingFiles,
  15193. const bool selectMultipleFiles,
  15194. FilePreviewComponent* const previewComponent);
  15195. static void showPlatformDialog (Array<File>& results,
  15196. const String& title,
  15197. const File& file,
  15198. const String& filters,
  15199. bool selectsDirectories,
  15200. bool selectsFiles,
  15201. bool isSave,
  15202. bool warnAboutOverwritingExistingFiles,
  15203. bool selectMultipleFiles,
  15204. FilePreviewComponent* previewComponent);
  15205. };
  15206. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15207. /********* End of inlined file: juce_FileChooser.h *********/
  15208. #endif
  15209. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15210. /********* Start of inlined file: juce_FileChooserDialogBox.h *********/
  15211. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15212. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15213. /********* Start of inlined file: juce_ResizableWindow.h *********/
  15214. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15215. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15216. /********* Start of inlined file: juce_TopLevelWindow.h *********/
  15217. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15218. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15219. /********* Start of inlined file: juce_DropShadower.h *********/
  15220. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15221. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15222. class JUCE_API DropShadower : public ComponentListener
  15223. {
  15224. public:
  15225. DropShadower (const float alpha = 0.5f,
  15226. const int xOffset = 1,
  15227. const int yOffset = 5,
  15228. const float blurRadius = 10.0f);
  15229. virtual ~DropShadower();
  15230. void setOwner (Component* componentToFollow);
  15231. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15232. void componentBroughtToFront (Component& component);
  15233. void componentChildrenChanged (Component& component);
  15234. void componentParentHierarchyChanged (Component& component);
  15235. void componentVisibilityChanged (Component& component);
  15236. juce_UseDebuggingNewOperator
  15237. private:
  15238. Component* owner;
  15239. int numShadows;
  15240. Component* shadowWindows[4];
  15241. Image* shadowImageSections[12];
  15242. const int shadowEdge, xOffset, yOffset;
  15243. const float alpha, blurRadius;
  15244. bool inDestructor, reentrant;
  15245. void updateShadows();
  15246. void setShadowImage (Image* const src,
  15247. const int num,
  15248. const int w, const int h,
  15249. const int sx, const int sy);
  15250. void bringShadowWindowsToFront();
  15251. void deleteShadowWindows();
  15252. DropShadower (const DropShadower&);
  15253. const DropShadower& operator= (const DropShadower&);
  15254. };
  15255. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15256. /********* End of inlined file: juce_DropShadower.h *********/
  15257. class JUCE_API TopLevelWindow : public Component
  15258. {
  15259. public:
  15260. TopLevelWindow (const String& name,
  15261. const bool addToDesktop);
  15262. ~TopLevelWindow();
  15263. bool isActiveWindow() const throw() { return windowIsActive_; }
  15264. void centreAroundComponent (Component* componentToCentreAround,
  15265. const int width, const int height);
  15266. void setDropShadowEnabled (const bool useShadow);
  15267. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15268. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15269. static int getNumTopLevelWindows() throw();
  15270. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15271. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15272. juce_UseDebuggingNewOperator
  15273. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15274. protected:
  15275. virtual void activeWindowStatusChanged();
  15276. void focusOfChildComponentChanged (FocusChangeType cause);
  15277. void parentHierarchyChanged();
  15278. void visibilityChanged();
  15279. virtual int getDesktopWindowStyleFlags() const;
  15280. void recreateDesktopWindow();
  15281. private:
  15282. friend class TopLevelWindowManager;
  15283. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15284. ScopedPointer <DropShadower> shadower;
  15285. void setWindowActive (const bool isNowActive) throw();
  15286. TopLevelWindow (const TopLevelWindow&);
  15287. const TopLevelWindow& operator= (const TopLevelWindow&);
  15288. };
  15289. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15290. /********* End of inlined file: juce_TopLevelWindow.h *********/
  15291. /********* Start of inlined file: juce_ComponentDragger.h *********/
  15292. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15293. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15294. /********* Start of inlined file: juce_ComponentBoundsConstrainer.h *********/
  15295. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15296. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15297. class JUCE_API ComponentBoundsConstrainer
  15298. {
  15299. public:
  15300. ComponentBoundsConstrainer() throw();
  15301. virtual ~ComponentBoundsConstrainer();
  15302. void setMinimumWidth (const int minimumWidth) throw();
  15303. int getMinimumWidth() const throw() { return minW; }
  15304. void setMaximumWidth (const int maximumWidth) throw();
  15305. int getMaximumWidth() const throw() { return maxW; }
  15306. void setMinimumHeight (const int minimumHeight) throw();
  15307. int getMinimumHeight() const throw() { return minH; }
  15308. void setMaximumHeight (const int maximumHeight) throw();
  15309. int getMaximumHeight() const throw() { return maxH; }
  15310. void setMinimumSize (const int minimumWidth,
  15311. const int minimumHeight) throw();
  15312. void setMaximumSize (const int maximumWidth,
  15313. const int maximumHeight) throw();
  15314. void setSizeLimits (const int minimumWidth,
  15315. const int minimumHeight,
  15316. const int maximumWidth,
  15317. const int maximumHeight) throw();
  15318. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15319. const int minimumWhenOffTheLeft,
  15320. const int minimumWhenOffTheBottom,
  15321. const int minimumWhenOffTheRight) throw();
  15322. void setFixedAspectRatio (const double widthOverHeight) throw();
  15323. double getFixedAspectRatio() const throw();
  15324. virtual void checkBounds (int& x, int& y, int& w, int& h,
  15325. const Rectangle& previousBounds,
  15326. const Rectangle& limits,
  15327. const bool isStretchingTop,
  15328. const bool isStretchingLeft,
  15329. const bool isStretchingBottom,
  15330. const bool isStretchingRight);
  15331. virtual void resizeStart();
  15332. virtual void resizeEnd();
  15333. void setBoundsForComponent (Component* const component,
  15334. int x, int y, int w, int h,
  15335. const bool isStretchingTop,
  15336. const bool isStretchingLeft,
  15337. const bool isStretchingBottom,
  15338. const bool isStretchingRight);
  15339. void checkComponentBounds (Component* component);
  15340. virtual void applyBoundsToComponent (Component* component,
  15341. int x, int y, int w, int h);
  15342. juce_UseDebuggingNewOperator
  15343. private:
  15344. int minW, maxW, minH, maxH;
  15345. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15346. double aspectRatio;
  15347. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15348. const ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15349. };
  15350. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15351. /********* End of inlined file: juce_ComponentBoundsConstrainer.h *********/
  15352. class JUCE_API ComponentDragger
  15353. {
  15354. public:
  15355. ComponentDragger();
  15356. virtual ~ComponentDragger();
  15357. void startDraggingComponent (Component* const componentToDrag,
  15358. ComponentBoundsConstrainer* constrainer);
  15359. void dragComponent (Component* const componentToDrag,
  15360. const MouseEvent& e);
  15361. juce_UseDebuggingNewOperator
  15362. private:
  15363. ComponentBoundsConstrainer* constrainer;
  15364. int originalX, originalY;
  15365. };
  15366. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15367. /********* End of inlined file: juce_ComponentDragger.h *********/
  15368. /********* Start of inlined file: juce_ResizableBorderComponent.h *********/
  15369. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15370. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15371. class JUCE_API ResizableBorderComponent : public Component
  15372. {
  15373. public:
  15374. ResizableBorderComponent (Component* const componentToResize,
  15375. ComponentBoundsConstrainer* const constrainer);
  15376. ~ResizableBorderComponent();
  15377. void setBorderThickness (const BorderSize& newBorderSize) throw();
  15378. const BorderSize getBorderThickness() const throw();
  15379. juce_UseDebuggingNewOperator
  15380. protected:
  15381. void paint (Graphics& g);
  15382. void mouseEnter (const MouseEvent& e);
  15383. void mouseMove (const MouseEvent& e);
  15384. void mouseDown (const MouseEvent& e);
  15385. void mouseDrag (const MouseEvent& e);
  15386. void mouseUp (const MouseEvent& e);
  15387. bool hitTest (int x, int y);
  15388. private:
  15389. Component* const component;
  15390. ComponentBoundsConstrainer* constrainer;
  15391. BorderSize borderSize;
  15392. int originalX, originalY, originalW, originalH;
  15393. int mouseZone;
  15394. void updateMouseZone (const MouseEvent& e) throw();
  15395. ResizableBorderComponent (const ResizableBorderComponent&);
  15396. const ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15397. };
  15398. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15399. /********* End of inlined file: juce_ResizableBorderComponent.h *********/
  15400. /********* Start of inlined file: juce_ResizableCornerComponent.h *********/
  15401. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15402. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15403. class JUCE_API ResizableCornerComponent : public Component
  15404. {
  15405. public:
  15406. ResizableCornerComponent (Component* const componentToResize,
  15407. ComponentBoundsConstrainer* const constrainer);
  15408. ~ResizableCornerComponent();
  15409. juce_UseDebuggingNewOperator
  15410. protected:
  15411. void paint (Graphics& g);
  15412. void mouseDown (const MouseEvent& e);
  15413. void mouseDrag (const MouseEvent& e);
  15414. void mouseUp (const MouseEvent& e);
  15415. bool hitTest (int x, int y);
  15416. private:
  15417. Component* const component;
  15418. ComponentBoundsConstrainer* constrainer;
  15419. int originalX, originalY, originalW, originalH;
  15420. ResizableCornerComponent (const ResizableCornerComponent&);
  15421. const ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15422. };
  15423. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15424. /********* End of inlined file: juce_ResizableCornerComponent.h *********/
  15425. class JUCE_API ResizableWindow : public TopLevelWindow
  15426. {
  15427. public:
  15428. ResizableWindow (const String& name,
  15429. const bool addToDesktop);
  15430. ResizableWindow (const String& name,
  15431. const Colour& backgroundColour,
  15432. const bool addToDesktop);
  15433. ~ResizableWindow();
  15434. const Colour getBackgroundColour() const throw();
  15435. void setBackgroundColour (const Colour& newColour);
  15436. void setResizable (const bool shouldBeResizable,
  15437. const bool useBottomRightCornerResizer);
  15438. bool isResizable() const throw();
  15439. void setResizeLimits (const int newMinimumWidth,
  15440. const int newMinimumHeight,
  15441. const int newMaximumWidth,
  15442. const int newMaximumHeight) throw();
  15443. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15444. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15445. void setBoundsConstrained (int x, int y, int width, int height);
  15446. bool isFullScreen() const;
  15447. void setFullScreen (const bool shouldBeFullScreen);
  15448. bool isMinimised() const;
  15449. void setMinimised (const bool shouldMinimise);
  15450. const String getWindowStateAsString();
  15451. bool restoreWindowStateFromString (const String& previousState);
  15452. Component* getContentComponent() const throw() { return contentComponent; }
  15453. void setContentComponent (Component* const newContentComponent,
  15454. const bool deleteOldOne = true,
  15455. const bool resizeToFit = false);
  15456. void setContentComponentSize (int width, int height);
  15457. enum ColourIds
  15458. {
  15459. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15460. };
  15461. juce_UseDebuggingNewOperator
  15462. protected:
  15463. void paint (Graphics& g);
  15464. void moved();
  15465. void resized();
  15466. void mouseDown (const MouseEvent& e);
  15467. void mouseDrag (const MouseEvent& e);
  15468. void lookAndFeelChanged();
  15469. void childBoundsChanged (Component* child);
  15470. void parentSizeChanged();
  15471. void visibilityChanged();
  15472. void activeWindowStatusChanged();
  15473. int getDesktopWindowStyleFlags() const;
  15474. virtual const BorderSize getBorderThickness();
  15475. virtual const BorderSize getContentComponentBorder();
  15476. #ifdef JUCE_DEBUG
  15477. void addChildComponent (Component* const child, int zOrder = -1);
  15478. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15479. #endif
  15480. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15481. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15482. private:
  15483. ScopedPointer <Component> contentComponent;
  15484. bool resizeToFitContent, fullscreen;
  15485. ComponentDragger dragger;
  15486. Rectangle lastNonFullScreenPos;
  15487. ComponentBoundsConstrainer defaultConstrainer;
  15488. ComponentBoundsConstrainer* constrainer;
  15489. #ifdef JUCE_DEBUG
  15490. bool hasBeenResized;
  15491. #endif
  15492. void updateLastPos();
  15493. ResizableWindow (const ResizableWindow&);
  15494. const ResizableWindow& operator= (const ResizableWindow&);
  15495. // (xxx remove these eventually)
  15496. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15497. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15498. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15499. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15500. };
  15501. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15502. /********* End of inlined file: juce_ResizableWindow.h *********/
  15503. /********* Start of inlined file: juce_GlyphArrangement.h *********/
  15504. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15505. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15506. class JUCE_API PositionedGlyph
  15507. {
  15508. public:
  15509. juce_wchar getCharacter() const { return character; }
  15510. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15511. float getLeft() const { return x; }
  15512. float getRight() const { return x + w; }
  15513. float getBaselineY() const { return y; }
  15514. float getTop() const { return y - font.getAscent(); }
  15515. float getBottom() const { return y + font.getDescent(); }
  15516. void moveBy (const float deltaX,
  15517. const float deltaY);
  15518. void draw (const Graphics& g) const;
  15519. void draw (const Graphics& g, const AffineTransform& transform) const;
  15520. void createPath (Path& path) const;
  15521. bool hitTest (float x, float y) const;
  15522. juce_UseDebuggingNewOperator
  15523. private:
  15524. friend class GlyphArrangement;
  15525. float x, y, w;
  15526. Font font;
  15527. juce_wchar character;
  15528. int glyph;
  15529. PositionedGlyph();
  15530. };
  15531. class JUCE_API GlyphArrangement
  15532. {
  15533. public:
  15534. GlyphArrangement();
  15535. GlyphArrangement (const GlyphArrangement& other);
  15536. const GlyphArrangement& operator= (const GlyphArrangement& other);
  15537. ~GlyphArrangement();
  15538. int getNumGlyphs() const { return glyphs.size(); }
  15539. PositionedGlyph& getGlyph (const int index) const;
  15540. void clear();
  15541. void addLineOfText (const Font& font,
  15542. const String& text,
  15543. const float x,
  15544. const float y);
  15545. void addCurtailedLineOfText (const Font& font,
  15546. const String& text,
  15547. float x,
  15548. const float y,
  15549. const float maxWidthPixels,
  15550. const bool useEllipsis);
  15551. void addJustifiedText (const Font& font,
  15552. const String& text,
  15553. float x, float y,
  15554. const float maxLineWidth,
  15555. const Justification& horizontalLayout);
  15556. void addFittedText (const Font& font,
  15557. const String& text,
  15558. const float x, const float y,
  15559. const float width, const float height,
  15560. const Justification& layout,
  15561. int maximumLinesToUse,
  15562. const float minimumHorizontalScale = 0.7f);
  15563. void addGlyphArrangement (const GlyphArrangement& other);
  15564. void draw (const Graphics& g) const;
  15565. void draw (const Graphics& g, const AffineTransform& transform) const;
  15566. void createPath (Path& path) const;
  15567. int findGlyphIndexAt (float x, float y) const;
  15568. void getBoundingBox (int startIndex,
  15569. int numGlyphs,
  15570. float& left,
  15571. float& top,
  15572. float& right,
  15573. float& bottom,
  15574. const bool includeWhitespace) const;
  15575. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15576. const float deltaX,
  15577. const float deltaY);
  15578. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15579. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15580. const float horizontalScaleFactor);
  15581. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15582. const float x,
  15583. const float y,
  15584. const float width,
  15585. const float height,
  15586. const Justification& justification);
  15587. juce_UseDebuggingNewOperator
  15588. private:
  15589. OwnedArray <PositionedGlyph> glyphs;
  15590. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15591. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15592. const Justification& justification, float minimumHorizontalScale);
  15593. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15594. };
  15595. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15596. /********* End of inlined file: juce_GlyphArrangement.h *********/
  15597. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15598. public ButtonListener,
  15599. public FileBrowserListener
  15600. {
  15601. public:
  15602. FileChooserDialogBox (const String& title,
  15603. const String& instructions,
  15604. FileBrowserComponent& browserComponent,
  15605. const bool warnAboutOverwritingExistingFiles,
  15606. const Colour& backgroundColour);
  15607. ~FileChooserDialogBox();
  15608. bool show (int width = 0,int height = 0);
  15609. enum ColourIds
  15610. {
  15611. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15612. };
  15613. void buttonClicked (Button* button);
  15614. void closeButtonPressed();
  15615. void selectionChanged();
  15616. void fileClicked (const File& file, const MouseEvent& e);
  15617. void fileDoubleClicked (const File& file);
  15618. juce_UseDebuggingNewOperator
  15619. private:
  15620. class ContentComponent : public Component
  15621. {
  15622. public:
  15623. ContentComponent();
  15624. ~ContentComponent();
  15625. void paint (Graphics& g);
  15626. void resized();
  15627. String instructions;
  15628. GlyphArrangement text;
  15629. FileBrowserComponent* chooserComponent;
  15630. FilePreviewComponent* previewComponent;
  15631. TextButton* okButton;
  15632. TextButton* cancelButton;
  15633. };
  15634. ContentComponent* content;
  15635. const bool warnAboutOverwritingExistingFiles;
  15636. FileChooserDialogBox (const FileChooserDialogBox&);
  15637. const FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15638. };
  15639. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15640. /********* End of inlined file: juce_FileChooserDialogBox.h *********/
  15641. #endif
  15642. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15643. #endif
  15644. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15645. /********* Start of inlined file: juce_FileListComponent.h *********/
  15646. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15647. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15648. class JUCE_API FileListComponent : public ListBox,
  15649. public DirectoryContentsDisplayComponent,
  15650. private ListBoxModel,
  15651. private ChangeListener
  15652. {
  15653. public:
  15654. FileListComponent (DirectoryContentsList& listToShow);
  15655. ~FileListComponent();
  15656. int getNumSelectedFiles() const;
  15657. const File getSelectedFile (int index = 0) const;
  15658. void scrollToTop();
  15659. void changeListenerCallback (void*);
  15660. int getNumRows();
  15661. void paintListBoxItem (int, Graphics&, int, int, bool);
  15662. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15663. void selectedRowsChanged (int lastRowSelected);
  15664. void deleteKeyPressed (int currentSelectedRow);
  15665. void returnKeyPressed (int currentSelectedRow);
  15666. juce_UseDebuggingNewOperator
  15667. private:
  15668. FileListComponent (const FileListComponent&);
  15669. const FileListComponent& operator= (const FileListComponent&);
  15670. File lastDirectory;
  15671. };
  15672. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15673. /********* End of inlined file: juce_FileListComponent.h *********/
  15674. #endif
  15675. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15676. /********* Start of inlined file: juce_FilenameComponent.h *********/
  15677. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15678. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15679. class FilenameComponent;
  15680. class JUCE_API FilenameComponentListener
  15681. {
  15682. public:
  15683. virtual ~FilenameComponentListener() {}
  15684. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15685. };
  15686. class JUCE_API FilenameComponent : public Component,
  15687. public SettableTooltipClient,
  15688. public FileDragAndDropTarget,
  15689. private AsyncUpdater,
  15690. private ButtonListener,
  15691. private ComboBoxListener
  15692. {
  15693. public:
  15694. FilenameComponent (const String& name,
  15695. const File& currentFile,
  15696. const bool canEditFilename,
  15697. const bool isDirectory,
  15698. const bool isForSaving,
  15699. const String& fileBrowserWildcard,
  15700. const String& enforcedSuffix,
  15701. const String& textWhenNothingSelected);
  15702. ~FilenameComponent();
  15703. const File getCurrentFile() const;
  15704. void setCurrentFile (File newFile,
  15705. const bool addToRecentlyUsedList,
  15706. const bool sendChangeNotification = true);
  15707. void setFilenameIsEditable (const bool shouldBeEditable);
  15708. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15709. const StringArray getRecentlyUsedFilenames() const;
  15710. void setRecentlyUsedFilenames (const StringArray& filenames);
  15711. void addRecentlyUsedFile (const File& file);
  15712. void setMaxNumberOfRecentFiles (const int newMaximum);
  15713. void setBrowseButtonText (const String& browseButtonText);
  15714. void addListener (FilenameComponentListener* const listener) throw();
  15715. void removeListener (FilenameComponentListener* const listener) throw();
  15716. void setTooltip (const String& newTooltip);
  15717. void paintOverChildren (Graphics& g);
  15718. void resized();
  15719. void lookAndFeelChanged();
  15720. bool isInterestedInFileDrag (const StringArray& files);
  15721. void filesDropped (const StringArray& files, int, int);
  15722. void fileDragEnter (const StringArray& files, int, int);
  15723. void fileDragExit (const StringArray& files);
  15724. juce_UseDebuggingNewOperator
  15725. private:
  15726. ComboBox* filenameBox;
  15727. String lastFilename;
  15728. Button* browseButton;
  15729. int maxRecentFiles;
  15730. bool isDir, isSaving, isFileDragOver;
  15731. String wildcard, enforcedSuffix, browseButtonText;
  15732. SortedSet <void*> listeners;
  15733. File defaultBrowseFile;
  15734. void comboBoxChanged (ComboBox*);
  15735. void buttonClicked (Button* button);
  15736. void handleAsyncUpdate();
  15737. FilenameComponent (const FilenameComponent&);
  15738. const FilenameComponent& operator= (const FilenameComponent&);
  15739. };
  15740. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15741. /********* End of inlined file: juce_FilenameComponent.h *********/
  15742. #endif
  15743. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15744. #endif
  15745. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15746. /********* Start of inlined file: juce_FileSearchPathListComponent.h *********/
  15747. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15748. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15749. class JUCE_API FileSearchPathListComponent : public Component,
  15750. public SettableTooltipClient,
  15751. public FileDragAndDropTarget,
  15752. private ButtonListener,
  15753. private ListBoxModel
  15754. {
  15755. public:
  15756. FileSearchPathListComponent();
  15757. ~FileSearchPathListComponent();
  15758. const FileSearchPath& getPath() const throw() { return path; }
  15759. void setPath (const FileSearchPath& newPath);
  15760. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15761. enum ColourIds
  15762. {
  15763. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  15764. Make this transparent if you don't want the background to be filled. */
  15765. };
  15766. int getNumRows();
  15767. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  15768. void deleteKeyPressed (int lastRowSelected);
  15769. void returnKeyPressed (int lastRowSelected);
  15770. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  15771. void selectedRowsChanged (int lastRowSelected);
  15772. void resized();
  15773. void paint (Graphics& g);
  15774. bool isInterestedInFileDrag (const StringArray& files);
  15775. void filesDropped (const StringArray& files, int, int);
  15776. void buttonClicked (Button* button);
  15777. juce_UseDebuggingNewOperator
  15778. private:
  15779. FileSearchPath path;
  15780. File defaultBrowseTarget;
  15781. ListBox* listBox;
  15782. Button* addButton;
  15783. Button* removeButton;
  15784. Button* changeButton;
  15785. Button* upButton;
  15786. Button* downButton;
  15787. void changed() throw();
  15788. void updateButtons() throw();
  15789. FileSearchPathListComponent (const FileSearchPathListComponent&);
  15790. const FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  15791. };
  15792. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15793. /********* End of inlined file: juce_FileSearchPathListComponent.h *********/
  15794. #endif
  15795. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15796. /********* Start of inlined file: juce_FileTreeComponent.h *********/
  15797. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15798. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15799. class JUCE_API FileTreeComponent : public TreeView,
  15800. public DirectoryContentsDisplayComponent
  15801. {
  15802. public:
  15803. FileTreeComponent (DirectoryContentsList& listToShow);
  15804. ~FileTreeComponent();
  15805. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  15806. const File getSelectedFile (int index = 0) const;
  15807. void scrollToTop();
  15808. void setDragAndDropDescription (const String& description) throw();
  15809. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  15810. juce_UseDebuggingNewOperator
  15811. private:
  15812. String dragAndDropDescription;
  15813. FileTreeComponent (const FileTreeComponent&);
  15814. const FileTreeComponent& operator= (const FileTreeComponent&);
  15815. };
  15816. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15817. /********* End of inlined file: juce_FileTreeComponent.h *********/
  15818. #endif
  15819. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15820. /********* Start of inlined file: juce_ImagePreviewComponent.h *********/
  15821. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15822. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15823. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  15824. private Timer
  15825. {
  15826. public:
  15827. ImagePreviewComponent();
  15828. ~ImagePreviewComponent();
  15829. void selectedFileChanged (const File& newSelectedFile);
  15830. void paint (Graphics& g);
  15831. void timerCallback();
  15832. juce_UseDebuggingNewOperator
  15833. private:
  15834. File fileToLoad;
  15835. ScopedPointer <Image> currentThumbnail;
  15836. String currentDetails;
  15837. void getThumbSize (int& w, int& h) const;
  15838. ImagePreviewComponent (const ImagePreviewComponent&);
  15839. const ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  15840. };
  15841. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15842. /********* End of inlined file: juce_ImagePreviewComponent.h *********/
  15843. #endif
  15844. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15845. /********* Start of inlined file: juce_WildcardFileFilter.h *********/
  15846. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15847. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15848. class JUCE_API WildcardFileFilter : public FileFilter
  15849. {
  15850. public:
  15851. WildcardFileFilter (const String& fileWildcardPatterns,
  15852. const String& directoryWildcardPatterns,
  15853. const String& description);
  15854. ~WildcardFileFilter();
  15855. bool isFileSuitable (const File& file) const;
  15856. bool isDirectorySuitable (const File& file) const;
  15857. juce_UseDebuggingNewOperator
  15858. private:
  15859. StringArray fileWildcards, directoryWildcards;
  15860. static void parse (const String& pattern, StringArray& result) throw();
  15861. static bool match (const File& file, const StringArray& wildcards) throw();
  15862. };
  15863. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15864. /********* End of inlined file: juce_WildcardFileFilter.h *********/
  15865. #endif
  15866. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  15867. #endif
  15868. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15869. #endif
  15870. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  15871. #endif
  15872. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  15873. #endif
  15874. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  15875. #endif
  15876. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  15877. #endif
  15878. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15879. /********* Start of inlined file: juce_KeyMappingEditorComponent.h *********/
  15880. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15881. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15882. /********* Start of inlined file: juce_KeyPressMappingSet.h *********/
  15883. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15884. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15885. class JUCE_API KeyPressMappingSet : public KeyListener,
  15886. public ChangeBroadcaster,
  15887. public FocusChangeListener
  15888. {
  15889. public:
  15890. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  15891. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  15892. ~KeyPressMappingSet();
  15893. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  15894. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  15895. void addKeyPress (const CommandID commandID,
  15896. const KeyPress& newKeyPress,
  15897. int insertIndex = -1) throw();
  15898. void resetToDefaultMappings() throw();
  15899. void resetToDefaultMapping (const CommandID commandID) throw();
  15900. void clearAllKeyPresses() throw();
  15901. void clearAllKeyPresses (const CommandID commandID) throw();
  15902. void removeKeyPress (const CommandID commandID,
  15903. const int keyPressIndex) throw();
  15904. void removeKeyPress (const KeyPress& keypress) throw();
  15905. bool containsMapping (const CommandID commandID,
  15906. const KeyPress& keyPress) const throw();
  15907. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  15908. bool restoreFromXml (const XmlElement& xmlVersion);
  15909. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  15910. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  15911. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  15912. void globalFocusChanged (Component* focusedComponent);
  15913. juce_UseDebuggingNewOperator
  15914. private:
  15915. ApplicationCommandManager* commandManager;
  15916. struct CommandMapping
  15917. {
  15918. CommandID commandID;
  15919. Array <KeyPress> keypresses;
  15920. bool wantsKeyUpDownCallbacks;
  15921. };
  15922. OwnedArray <CommandMapping> mappings;
  15923. struct KeyPressTime
  15924. {
  15925. KeyPress key;
  15926. uint32 timeWhenPressed;
  15927. };
  15928. OwnedArray <KeyPressTime> keysDown;
  15929. void handleMessage (const Message& message);
  15930. void invokeCommand (const CommandID commandID,
  15931. const KeyPress& keyPress,
  15932. const bool isKeyDown,
  15933. const int millisecsSinceKeyPressed,
  15934. Component* const originatingComponent) const;
  15935. const KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  15936. };
  15937. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15938. /********* End of inlined file: juce_KeyPressMappingSet.h *********/
  15939. class JUCE_API KeyMappingEditorComponent : public Component,
  15940. public TreeViewItem,
  15941. public ChangeListener,
  15942. private ButtonListener
  15943. {
  15944. public:
  15945. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  15946. const bool showResetToDefaultButton);
  15947. virtual ~KeyMappingEditorComponent();
  15948. void setColours (const Colour& mainBackground,
  15949. const Colour& textColour);
  15950. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  15951. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  15952. virtual bool isCommandReadOnly (const CommandID commandID);
  15953. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  15954. enum ColourIds
  15955. {
  15956. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  15957. textColourId = 0x100ad01, /**< The colour for the text. */
  15958. };
  15959. void parentHierarchyChanged();
  15960. void resized();
  15961. void changeListenerCallback (void*);
  15962. bool mightContainSubItems();
  15963. const String getUniqueName() const;
  15964. void buttonClicked (Button* button);
  15965. juce_UseDebuggingNewOperator
  15966. private:
  15967. KeyPressMappingSet* mappings;
  15968. TreeView* tree;
  15969. friend class KeyMappingTreeViewItem;
  15970. friend class KeyCategoryTreeViewItem;
  15971. friend class KeyMappingItemComponent;
  15972. friend class KeyMappingChangeButton;
  15973. TextButton* resetButton;
  15974. void assignNewKey (const CommandID commandID, int index);
  15975. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  15976. const KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  15977. };
  15978. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15979. /********* End of inlined file: juce_KeyMappingEditorComponent.h *********/
  15980. #endif
  15981. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  15982. #endif
  15983. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15984. #endif
  15985. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  15986. #endif
  15987. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  15988. #endif
  15989. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15990. #endif
  15991. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  15992. /********* Start of inlined file: juce_ComponentMovementWatcher.h *********/
  15993. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  15994. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  15995. class JUCE_API ComponentMovementWatcher : public ComponentListener
  15996. {
  15997. public:
  15998. ComponentMovementWatcher (Component* const component);
  15999. ~ComponentMovementWatcher();
  16000. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16001. virtual void componentPeerChanged() = 0;
  16002. juce_UseDebuggingNewOperator
  16003. void componentParentHierarchyChanged (Component& component);
  16004. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16005. private:
  16006. Component* const component;
  16007. ComponentPeer* lastPeer;
  16008. VoidArray registeredParentComps;
  16009. bool reentrant;
  16010. int lastX, lastY, lastWidth, lastHeight;
  16011. #ifdef JUCE_DEBUG
  16012. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  16013. #endif
  16014. void unregister() throw();
  16015. void registerWithParentComps() throw();
  16016. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16017. const ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16018. };
  16019. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16020. /********* End of inlined file: juce_ComponentMovementWatcher.h *********/
  16021. #endif
  16022. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16023. /********* Start of inlined file: juce_GroupComponent.h *********/
  16024. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16025. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16026. class JUCE_API GroupComponent : public Component
  16027. {
  16028. public:
  16029. GroupComponent (const String& componentName,
  16030. const String& labelText);
  16031. ~GroupComponent();
  16032. void setText (const String& newText) throw();
  16033. const String getText() const throw();
  16034. void setTextLabelPosition (const Justification& justification);
  16035. const Justification getTextLabelPosition() const throw() { return justification; }
  16036. enum ColourIds
  16037. {
  16038. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16039. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16040. };
  16041. void paint (Graphics& g);
  16042. void enablementChanged();
  16043. void colourChanged();
  16044. private:
  16045. String text;
  16046. Justification justification;
  16047. GroupComponent (const GroupComponent&);
  16048. const GroupComponent& operator= (const GroupComponent&);
  16049. };
  16050. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16051. /********* End of inlined file: juce_GroupComponent.h *********/
  16052. #endif
  16053. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16054. /********* Start of inlined file: juce_MultiDocumentPanel.h *********/
  16055. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16056. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16057. /********* Start of inlined file: juce_TabbedComponent.h *********/
  16058. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16059. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16060. /********* Start of inlined file: juce_TabbedButtonBar.h *********/
  16061. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16062. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16063. class TabbedButtonBar;
  16064. class JUCE_API TabBarButton : public Button
  16065. {
  16066. public:
  16067. TabBarButton (const String& name,
  16068. TabbedButtonBar* const ownerBar,
  16069. const int tabIndex);
  16070. ~TabBarButton();
  16071. virtual int getBestTabLength (const int depth);
  16072. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16073. void clicked (const ModifierKeys& mods);
  16074. bool hitTest (int x, int y);
  16075. juce_UseDebuggingNewOperator
  16076. protected:
  16077. friend class TabbedButtonBar;
  16078. TabbedButtonBar* const owner;
  16079. int tabIndex, overlapPixels;
  16080. DropShadowEffect shadow;
  16081. void getActiveArea (int& x, int& y, int& w, int& h);
  16082. private:
  16083. TabBarButton (const TabBarButton&);
  16084. const TabBarButton& operator= (const TabBarButton&);
  16085. };
  16086. class JUCE_API TabbedButtonBar : public Component,
  16087. public ChangeBroadcaster,
  16088. public ButtonListener
  16089. {
  16090. public:
  16091. enum Orientation
  16092. {
  16093. TabsAtTop,
  16094. TabsAtBottom,
  16095. TabsAtLeft,
  16096. TabsAtRight
  16097. };
  16098. TabbedButtonBar (const Orientation orientation);
  16099. ~TabbedButtonBar();
  16100. void setOrientation (const Orientation orientation);
  16101. Orientation getOrientation() const throw() { return orientation; }
  16102. void clearTabs();
  16103. void addTab (const String& tabName,
  16104. const Colour& tabBackgroundColour,
  16105. int insertIndex = -1);
  16106. void setTabName (const int tabIndex,
  16107. const String& newName);
  16108. void removeTab (const int tabIndex);
  16109. void moveTab (const int currentIndex,
  16110. const int newIndex);
  16111. int getNumTabs() const;
  16112. const StringArray getTabNames() const;
  16113. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16114. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16115. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16116. TabBarButton* getTabButton (const int index) const;
  16117. virtual void currentTabChanged (const int newCurrentTabIndex,
  16118. const String& newCurrentTabName);
  16119. virtual void popupMenuClickOnTab (const int tabIndex,
  16120. const String& tabName);
  16121. const Colour getTabBackgroundColour (const int tabIndex);
  16122. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16123. enum ColourIds
  16124. {
  16125. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16126. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16127. the look and feel will choose an appropriate colour. */
  16128. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16129. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16130. this isn't specified, the look and feel will choose an appropriate
  16131. colour. */
  16132. };
  16133. void resized();
  16134. void buttonClicked (Button* button);
  16135. void lookAndFeelChanged();
  16136. juce_UseDebuggingNewOperator
  16137. protected:
  16138. virtual TabBarButton* createTabButton (const String& tabName,
  16139. const int tabIndex);
  16140. private:
  16141. Orientation orientation;
  16142. StringArray tabs;
  16143. Array <Colour> tabColours;
  16144. int currentTabIndex;
  16145. Component* behindFrontTab;
  16146. Button* extraTabsButton;
  16147. TabbedButtonBar (const TabbedButtonBar&);
  16148. const TabbedButtonBar& operator= (const TabbedButtonBar&);
  16149. };
  16150. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16151. /********* End of inlined file: juce_TabbedButtonBar.h *********/
  16152. class JUCE_API TabbedComponent : public Component
  16153. {
  16154. public:
  16155. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16156. ~TabbedComponent();
  16157. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16158. TabbedButtonBar::Orientation getOrientation() const throw();
  16159. void setTabBarDepth (const int newDepth);
  16160. int getTabBarDepth() const throw() { return tabDepth; }
  16161. void setOutline (const int newThickness);
  16162. void setIndent (const int indentThickness);
  16163. void clearTabs();
  16164. void addTab (const String& tabName,
  16165. const Colour& tabBackgroundColour,
  16166. Component* const contentComponent,
  16167. const bool deleteComponentWhenNotNeeded,
  16168. const int insertIndex = -1);
  16169. void setTabName (const int tabIndex,
  16170. const String& newName);
  16171. void removeTab (const int tabIndex);
  16172. int getNumTabs() const;
  16173. const StringArray getTabNames() const;
  16174. Component* getTabContentComponent (const int tabIndex) const throw();
  16175. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16176. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16177. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16178. int getCurrentTabIndex() const;
  16179. const String& getCurrentTabName() const;
  16180. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16181. virtual void currentTabChanged (const int newCurrentTabIndex,
  16182. const String& newCurrentTabName);
  16183. virtual void popupMenuClickOnTab (const int tabIndex,
  16184. const String& tabName);
  16185. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16186. enum ColourIds
  16187. {
  16188. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16189. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16190. (See setOutline) */
  16191. };
  16192. void paint (Graphics& g);
  16193. void resized();
  16194. void lookAndFeelChanged();
  16195. juce_UseDebuggingNewOperator
  16196. protected:
  16197. TabbedButtonBar* tabs;
  16198. virtual TabBarButton* createTabButton (const String& tabName,
  16199. const int tabIndex);
  16200. private:
  16201. Array <Component*> contentComponents;
  16202. Component* panelComponent;
  16203. int tabDepth;
  16204. int outlineThickness, edgeIndent;
  16205. friend class TabCompButtonBar;
  16206. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16207. TabbedComponent (const TabbedComponent&);
  16208. const TabbedComponent& operator= (const TabbedComponent&);
  16209. };
  16210. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16211. /********* End of inlined file: juce_TabbedComponent.h *********/
  16212. /********* Start of inlined file: juce_DocumentWindow.h *********/
  16213. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16214. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16215. /********* Start of inlined file: juce_MenuBarComponent.h *********/
  16216. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16217. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16218. /********* Start of inlined file: juce_MenuBarModel.h *********/
  16219. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16220. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16221. class MenuBarModel;
  16222. class JUCE_API MenuBarModelListener
  16223. {
  16224. public:
  16225. virtual ~MenuBarModelListener() {}
  16226. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16227. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16228. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16229. };
  16230. class JUCE_API MenuBarModel : private AsyncUpdater,
  16231. private ApplicationCommandManagerListener
  16232. {
  16233. public:
  16234. MenuBarModel() throw();
  16235. virtual ~MenuBarModel();
  16236. void menuItemsChanged();
  16237. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16238. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16239. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16240. virtual const StringArray getMenuBarNames() = 0;
  16241. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16242. const String& menuName) = 0;
  16243. virtual void menuItemSelected (int menuItemID,
  16244. int topLevelMenuIndex) = 0;
  16245. #if JUCE_MAC || DOXYGEN
  16246. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16247. const PopupMenu* extraAppleMenuItems = 0);
  16248. static MenuBarModel* getMacMainMenu();
  16249. #endif
  16250. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16251. void applicationCommandListChanged();
  16252. void handleAsyncUpdate();
  16253. juce_UseDebuggingNewOperator
  16254. private:
  16255. ApplicationCommandManager* manager;
  16256. SortedSet <void*> listeners;
  16257. MenuBarModel (const MenuBarModel&);
  16258. const MenuBarModel& operator= (const MenuBarModel&);
  16259. };
  16260. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16261. /********* End of inlined file: juce_MenuBarModel.h *********/
  16262. class JUCE_API MenuBarComponent : public Component,
  16263. private MenuBarModelListener,
  16264. private Timer
  16265. {
  16266. public:
  16267. MenuBarComponent (MenuBarModel* const model);
  16268. ~MenuBarComponent();
  16269. void setModel (MenuBarModel* const newModel);
  16270. void showMenu (const int menuIndex);
  16271. void paint (Graphics& g);
  16272. void resized();
  16273. void mouseEnter (const MouseEvent& e);
  16274. void mouseExit (const MouseEvent& e);
  16275. void mouseDown (const MouseEvent& e);
  16276. void mouseDrag (const MouseEvent& e);
  16277. void mouseUp (const MouseEvent& e);
  16278. void mouseMove (const MouseEvent& e);
  16279. void inputAttemptWhenModal();
  16280. void handleCommandMessage (int commandId);
  16281. bool keyPressed (const KeyPress& key);
  16282. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16283. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16284. const ApplicationCommandTarget::InvocationInfo& info);
  16285. juce_UseDebuggingNewOperator
  16286. private:
  16287. MenuBarModel* model;
  16288. StringArray menuNames;
  16289. Array <int> xPositions;
  16290. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16291. int lastMouseX, lastMouseY;
  16292. bool inModalState;
  16293. ScopedPointer <Component> currentPopup;
  16294. int getItemAt (int x, int y);
  16295. void updateItemUnderMouse (const int x, const int y);
  16296. void hideCurrentMenu();
  16297. void timerCallback();
  16298. void repaintMenuItem (int index);
  16299. MenuBarComponent (const MenuBarComponent&);
  16300. const MenuBarComponent& operator= (const MenuBarComponent&);
  16301. };
  16302. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16303. /********* End of inlined file: juce_MenuBarComponent.h *********/
  16304. class JUCE_API DocumentWindow : public ResizableWindow
  16305. {
  16306. public:
  16307. enum TitleBarButtons
  16308. {
  16309. minimiseButton = 1,
  16310. maximiseButton = 2,
  16311. closeButton = 4,
  16312. allButtons = 7
  16313. };
  16314. DocumentWindow (const String& name,
  16315. const Colour& backgroundColour,
  16316. const int requiredButtons,
  16317. const bool addToDesktop = true);
  16318. ~DocumentWindow();
  16319. void setName (const String& newName);
  16320. void setIcon (const Image* imageToUse);
  16321. void setTitleBarHeight (const int newHeight);
  16322. int getTitleBarHeight() const;
  16323. void setTitleBarButtonsRequired (const int requiredButtons,
  16324. const bool positionTitleBarButtonsOnLeft);
  16325. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16326. void setMenuBar (MenuBarModel* menuBarModel,
  16327. const int menuBarHeight = 0);
  16328. virtual void closeButtonPressed();
  16329. virtual void minimiseButtonPressed();
  16330. virtual void maximiseButtonPressed();
  16331. Button* getCloseButton() const throw();
  16332. Button* getMinimiseButton() const throw();
  16333. Button* getMaximiseButton() const throw();
  16334. enum ColourIds
  16335. {
  16336. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16337. and feel class how this is used. */
  16338. };
  16339. void paint (Graphics& g);
  16340. void resized();
  16341. void lookAndFeelChanged();
  16342. const BorderSize getBorderThickness();
  16343. const BorderSize getContentComponentBorder();
  16344. void mouseDoubleClick (const MouseEvent& e);
  16345. void userTriedToCloseWindow();
  16346. void activeWindowStatusChanged();
  16347. int getDesktopWindowStyleFlags() const;
  16348. void parentHierarchyChanged();
  16349. const Rectangle getTitleBarArea();
  16350. juce_UseDebuggingNewOperator
  16351. private:
  16352. int titleBarHeight, menuBarHeight, requiredButtons;
  16353. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16354. ScopedPointer <Button> titleBarButtons [3];
  16355. ScopedPointer <Image> titleBarIcon;
  16356. ScopedPointer <MenuBarComponent> menuBar;
  16357. MenuBarModel* menuBarModel;
  16358. class ButtonListenerProxy;
  16359. friend class ScopedPointer <ButtonListenerProxy>;
  16360. ScopedPointer <ButtonListenerProxy> buttonListener;
  16361. void repaintTitleBar();
  16362. DocumentWindow (const DocumentWindow&);
  16363. const DocumentWindow& operator= (const DocumentWindow&);
  16364. };
  16365. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16366. /********* End of inlined file: juce_DocumentWindow.h *********/
  16367. class MultiDocumentPanel;
  16368. class MDITabbedComponentInternal;
  16369. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16370. {
  16371. public:
  16372. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16373. ~MultiDocumentPanelWindow();
  16374. void maximiseButtonPressed();
  16375. void closeButtonPressed();
  16376. void activeWindowStatusChanged();
  16377. void broughtToFront();
  16378. juce_UseDebuggingNewOperator
  16379. private:
  16380. void updateOrder();
  16381. MultiDocumentPanel* getOwner() const throw();
  16382. };
  16383. class JUCE_API MultiDocumentPanel : public Component,
  16384. private ComponentListener
  16385. {
  16386. public:
  16387. MultiDocumentPanel();
  16388. ~MultiDocumentPanel();
  16389. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16390. bool addDocument (Component* const component,
  16391. const Colour& backgroundColour,
  16392. const bool deleteWhenRemoved);
  16393. bool closeDocument (Component* component,
  16394. const bool checkItsOkToCloseFirst);
  16395. int getNumDocuments() const throw();
  16396. Component* getDocument (const int index) const throw();
  16397. Component* getActiveDocument() const throw();
  16398. void setActiveDocument (Component* component);
  16399. virtual void activeDocumentChanged();
  16400. void setMaximumNumDocuments (const int maximumNumDocuments);
  16401. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16402. bool isFullscreenWhenOneDocument() const throw();
  16403. enum LayoutMode
  16404. {
  16405. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16406. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16407. };
  16408. void setLayoutMode (const LayoutMode newLayoutMode);
  16409. LayoutMode getLayoutMode() const throw() { return mode; }
  16410. void setBackgroundColour (const Colour& newBackgroundColour);
  16411. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16412. virtual bool tryToCloseDocument (Component* component) = 0;
  16413. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16414. void paint (Graphics& g);
  16415. void resized();
  16416. void componentNameChanged (Component&);
  16417. juce_UseDebuggingNewOperator
  16418. private:
  16419. LayoutMode mode;
  16420. Array <Component*> components;
  16421. TabbedComponent* tabComponent;
  16422. Colour backgroundColour;
  16423. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16424. friend class MultiDocumentPanelWindow;
  16425. friend class MDITabbedComponentInternal;
  16426. Component* getContainerComp (Component* c) const;
  16427. void updateOrder();
  16428. void addWindow (Component* component);
  16429. };
  16430. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16431. /********* End of inlined file: juce_MultiDocumentPanel.h *********/
  16432. #endif
  16433. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16434. #endif
  16435. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16436. #endif
  16437. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16438. #endif
  16439. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16440. /********* Start of inlined file: juce_StretchableLayoutManager.h *********/
  16441. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16442. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16443. class JUCE_API StretchableLayoutManager
  16444. {
  16445. public:
  16446. StretchableLayoutManager();
  16447. ~StretchableLayoutManager();
  16448. void setItemLayout (const int itemIndex,
  16449. const double minimumSize,
  16450. const double maximumSize,
  16451. const double preferredSize);
  16452. bool getItemLayout (const int itemIndex,
  16453. double& minimumSize,
  16454. double& maximumSize,
  16455. double& preferredSize) const;
  16456. void clearAllItems();
  16457. void layOutComponents (Component** const components,
  16458. int numComponents,
  16459. int x, int y, int width, int height,
  16460. const bool vertically,
  16461. const bool resizeOtherDimension);
  16462. int getItemCurrentPosition (const int itemIndex) const;
  16463. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16464. double getItemCurrentRelativeSize (const int itemIndex) const;
  16465. void setItemPosition (const int itemIndex,
  16466. int newPosition);
  16467. juce_UseDebuggingNewOperator
  16468. private:
  16469. struct ItemLayoutProperties
  16470. {
  16471. int itemIndex;
  16472. int currentSize;
  16473. double minSize, maxSize, preferredSize;
  16474. };
  16475. OwnedArray <ItemLayoutProperties> items;
  16476. int totalSize;
  16477. static int sizeToRealSize (double size, int totalSpace);
  16478. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16479. void setTotalSize (const int newTotalSize);
  16480. int fitComponentsIntoSpace (const int startIndex,
  16481. const int endIndex,
  16482. const int availableSpace,
  16483. int startPos);
  16484. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16485. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16486. void updatePrefSizesToMatchCurrentPositions();
  16487. StretchableLayoutManager (const StretchableLayoutManager&);
  16488. const StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16489. };
  16490. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16491. /********* End of inlined file: juce_StretchableLayoutManager.h *********/
  16492. #endif
  16493. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16494. /********* Start of inlined file: juce_StretchableLayoutResizerBar.h *********/
  16495. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16496. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16497. class JUCE_API StretchableLayoutResizerBar : public Component
  16498. {
  16499. public:
  16500. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16501. const int itemIndexInLayout,
  16502. const bool isBarVertical);
  16503. ~StretchableLayoutResizerBar();
  16504. virtual void hasBeenMoved();
  16505. void paint (Graphics& g);
  16506. void mouseDown (const MouseEvent& e);
  16507. void mouseDrag (const MouseEvent& e);
  16508. juce_UseDebuggingNewOperator
  16509. private:
  16510. StretchableLayoutManager* layout;
  16511. int itemIndex, mouseDownPos;
  16512. bool isVertical;
  16513. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16514. const StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16515. };
  16516. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16517. /********* End of inlined file: juce_StretchableLayoutResizerBar.h *********/
  16518. #endif
  16519. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16520. /********* Start of inlined file: juce_StretchableObjectResizer.h *********/
  16521. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16522. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16523. class StretchableObjectResizer
  16524. {
  16525. public:
  16526. StretchableObjectResizer();
  16527. ~StretchableObjectResizer();
  16528. void addItem (const double currentSize,
  16529. const double minSize,
  16530. const double maxSize,
  16531. const int order = 0);
  16532. void resizeToFit (const double targetSize);
  16533. int getNumItems() const throw() { return items.size(); }
  16534. double getItemSize (const int index) const throw();
  16535. juce_UseDebuggingNewOperator
  16536. private:
  16537. struct Item
  16538. {
  16539. double size;
  16540. double minSize;
  16541. double maxSize;
  16542. int order;
  16543. };
  16544. OwnedArray <Item> items;
  16545. StretchableObjectResizer (const StretchableObjectResizer&);
  16546. const StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16547. };
  16548. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16549. /********* End of inlined file: juce_StretchableObjectResizer.h *********/
  16550. #endif
  16551. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16552. #endif
  16553. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16554. #endif
  16555. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16556. #endif
  16557. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16558. /********* Start of inlined file: juce_LookAndFeel.h *********/
  16559. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16560. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16561. /********* Start of inlined file: juce_AlertWindow.h *********/
  16562. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16563. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16564. /********* Start of inlined file: juce_TextLayout.h *********/
  16565. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16566. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16567. class Graphics;
  16568. class JUCE_API TextLayout
  16569. {
  16570. public:
  16571. TextLayout() throw();
  16572. TextLayout (const TextLayout& other) throw();
  16573. TextLayout (const String& text, const Font& font) throw();
  16574. ~TextLayout() throw();
  16575. const TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16576. void clear() throw();
  16577. void appendText (const String& textToAppend,
  16578. const Font& fontToUse) throw();
  16579. void setText (const String& newText,
  16580. const Font& fontToUse) throw();
  16581. void layout (int maximumWidth,
  16582. const Justification& justification,
  16583. const bool attemptToBalanceLineLengths) throw();
  16584. int getWidth() const throw();
  16585. int getHeight() const throw();
  16586. int getNumLines() const throw() { return totalLines; }
  16587. int getLineWidth (const int lineNumber) const throw();
  16588. void draw (Graphics& g,
  16589. const int topLeftX,
  16590. const int topLeftY) const throw();
  16591. void drawWithin (Graphics& g,
  16592. int x, int y, int w, int h,
  16593. const Justification& layoutFlags) const throw();
  16594. juce_UseDebuggingNewOperator
  16595. private:
  16596. class Token;
  16597. friend class OwnedArray <Token>;
  16598. OwnedArray <Token> tokens;
  16599. int totalLines;
  16600. };
  16601. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16602. /********* End of inlined file: juce_TextLayout.h *********/
  16603. class JUCE_API AlertWindow : public TopLevelWindow,
  16604. private ButtonListener
  16605. {
  16606. public:
  16607. enum AlertIconType
  16608. {
  16609. NoIcon, /**< No icon will be shown on the dialog box. */
  16610. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16611. user to answer a question. */
  16612. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16613. warning about something and shouldn't be ignored. */
  16614. InfoIcon /**< An icon that indicates that the dialog box is just
  16615. giving the user some information, which doesn't require
  16616. a response from them. */
  16617. };
  16618. AlertWindow (const String& title,
  16619. const String& message,
  16620. AlertIconType iconType,
  16621. Component* associatedComponent = 0);
  16622. ~AlertWindow();
  16623. AlertIconType getAlertType() const throw() { return alertIconType; }
  16624. void setMessage (const String& message);
  16625. void addButton (const String& name,
  16626. const int returnValue,
  16627. const KeyPress& shortcutKey1 = KeyPress(),
  16628. const KeyPress& shortcutKey2 = KeyPress());
  16629. int getNumButtons() const;
  16630. void addTextEditor (const String& name,
  16631. const String& initialContents,
  16632. const String& onScreenLabel = String::empty,
  16633. const bool isPasswordBox = false);
  16634. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16635. void addComboBox (const String& name,
  16636. const StringArray& items,
  16637. const String& onScreenLabel = String::empty);
  16638. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16639. void addTextBlock (const String& text);
  16640. void addProgressBarComponent (double& progressValue);
  16641. void addCustomComponent (Component* const component);
  16642. int getNumCustomComponents() const;
  16643. Component* getCustomComponent (const int index) const;
  16644. Component* removeCustomComponent (const int index);
  16645. bool containsAnyExtraComponents() const;
  16646. // easy-to-use message box functions:
  16647. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16648. const String& title,
  16649. const String& message,
  16650. const String& buttonText = String::empty,
  16651. Component* associatedComponent = 0);
  16652. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16653. const String& title,
  16654. const String& message,
  16655. const String& button1Text = String::empty,
  16656. const String& button2Text = String::empty,
  16657. Component* associatedComponent = 0);
  16658. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16659. const String& title,
  16660. const String& message,
  16661. const String& button1Text = String::empty,
  16662. const String& button2Text = String::empty,
  16663. const String& button3Text = String::empty,
  16664. Component* associatedComponent = 0);
  16665. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16666. const String& bodyText,
  16667. bool isOkCancel);
  16668. enum ColourIds
  16669. {
  16670. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16671. textColourId = 0x1001810, /**< The colour for the text. */
  16672. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16673. };
  16674. juce_UseDebuggingNewOperator
  16675. protected:
  16676. void paint (Graphics& g);
  16677. void mouseDown (const MouseEvent& e);
  16678. void mouseDrag (const MouseEvent& e);
  16679. bool keyPressed (const KeyPress& key);
  16680. void buttonClicked (Button* button);
  16681. void lookAndFeelChanged();
  16682. void userTriedToCloseWindow();
  16683. int getDesktopWindowStyleFlags() const;
  16684. private:
  16685. String text;
  16686. TextLayout textLayout;
  16687. AlertIconType alertIconType;
  16688. ComponentBoundsConstrainer constrainer;
  16689. ComponentDragger dragger;
  16690. Rectangle textArea;
  16691. VoidArray buttons, textBoxes, comboBoxes;
  16692. VoidArray progressBars, customComps, textBlocks, allComps;
  16693. StringArray textboxNames, comboBoxNames;
  16694. Font font;
  16695. Component* associatedComponent;
  16696. void updateLayout (const bool onlyIncreaseSize);
  16697. // disable copy constructor
  16698. AlertWindow (const AlertWindow&);
  16699. const AlertWindow& operator= (const AlertWindow&);
  16700. };
  16701. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  16702. /********* End of inlined file: juce_AlertWindow.h *********/
  16703. class ToggleButton;
  16704. class TextButton;
  16705. class AlertWindow;
  16706. class TextLayout;
  16707. class ScrollBar;
  16708. class BubbleComponent;
  16709. class ComboBox;
  16710. class Button;
  16711. class FilenameComponent;
  16712. class DocumentWindow;
  16713. class ResizableWindow;
  16714. class GroupComponent;
  16715. class MenuBarComponent;
  16716. class DropShadower;
  16717. class GlyphArrangement;
  16718. class PropertyComponent;
  16719. class TableHeaderComponent;
  16720. class Toolbar;
  16721. class ToolbarItemComponent;
  16722. class PopupMenu;
  16723. class ProgressBar;
  16724. class FileBrowserComponent;
  16725. class DirectoryContentsDisplayComponent;
  16726. class FilePreviewComponent;
  16727. class ImageButton;
  16728. class JUCE_API LookAndFeel
  16729. {
  16730. public:
  16731. LookAndFeel();
  16732. virtual ~LookAndFeel();
  16733. static LookAndFeel& getDefaultLookAndFeel() throw();
  16734. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  16735. const Colour findColour (const int colourId) const throw();
  16736. void setColour (const int colourId, const Colour& colour) throw();
  16737. bool isColourSpecified (const int colourId) const throw();
  16738. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  16739. void setDefaultSansSerifTypefaceName (const String& newName);
  16740. virtual const MouseCursor getMouseCursorFor (Component& component);
  16741. virtual void drawButtonBackground (Graphics& g,
  16742. Button& button,
  16743. const Colour& backgroundColour,
  16744. bool isMouseOverButton,
  16745. bool isButtonDown);
  16746. virtual const Font getFontForTextButton (TextButton& button);
  16747. virtual void drawButtonText (Graphics& g,
  16748. TextButton& button,
  16749. bool isMouseOverButton,
  16750. bool isButtonDown);
  16751. virtual void drawToggleButton (Graphics& g,
  16752. ToggleButton& button,
  16753. bool isMouseOverButton,
  16754. bool isButtonDown);
  16755. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  16756. virtual void drawTickBox (Graphics& g,
  16757. Component& component,
  16758. float x, float y, float w, float h,
  16759. const bool ticked,
  16760. const bool isEnabled,
  16761. const bool isMouseOverButton,
  16762. const bool isButtonDown);
  16763. virtual AlertWindow* createAlertWindow (const String& title,
  16764. const String& message,
  16765. const String& button1,
  16766. const String& button2,
  16767. const String& button3,
  16768. AlertWindow::AlertIconType iconType,
  16769. int numButtons,
  16770. Component* associatedComponent);
  16771. virtual void drawAlertBox (Graphics& g,
  16772. AlertWindow& alert,
  16773. const Rectangle& textArea,
  16774. TextLayout& textLayout);
  16775. virtual int getAlertBoxWindowFlags();
  16776. virtual int getAlertWindowButtonHeight();
  16777. virtual const Font getAlertWindowFont();
  16778. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  16779. int width, int height,
  16780. double progress, const String& textToShow);
  16781. // Draws a small image that spins to indicate that something's happening..
  16782. // This method should use the current time to animate itself, so just keep
  16783. // repainting it every so often.
  16784. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  16785. int x, int y, int w, int h);
  16786. virtual void drawScrollbarButton (Graphics& g,
  16787. ScrollBar& scrollbar,
  16788. int width, int height,
  16789. int buttonDirection,
  16790. bool isScrollbarVertical,
  16791. bool isMouseOverButton,
  16792. bool isButtonDown);
  16793. virtual void drawScrollbar (Graphics& g,
  16794. ScrollBar& scrollbar,
  16795. int x, int y,
  16796. int width, int height,
  16797. bool isScrollbarVertical,
  16798. int thumbStartPosition,
  16799. int thumbSize,
  16800. bool isMouseOver,
  16801. bool isMouseDown);
  16802. virtual ImageEffectFilter* getScrollbarEffect();
  16803. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  16804. virtual int getDefaultScrollbarWidth();
  16805. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  16806. virtual const Path getTickShape (const float height);
  16807. virtual const Path getCrossShape (const float height);
  16808. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  16809. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  16810. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  16811. // these return an image from the ImageCache, so use ImageCache::release() to free it
  16812. virtual Image* getDefaultFolderImage();
  16813. virtual Image* getDefaultDocumentFileImage();
  16814. virtual void createFileChooserHeaderText (const String& title,
  16815. const String& instructions,
  16816. GlyphArrangement& destArrangement,
  16817. int width);
  16818. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  16819. const String& filename, Image* icon,
  16820. const String& fileSizeDescription,
  16821. const String& fileTimeDescription,
  16822. const bool isDirectory,
  16823. const bool isItemSelected,
  16824. const int itemIndex);
  16825. virtual Button* createFileBrowserGoUpButton();
  16826. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  16827. DirectoryContentsDisplayComponent* fileListComponent,
  16828. FilePreviewComponent* previewComp,
  16829. ComboBox* currentPathBox,
  16830. TextEditor* filenameBox,
  16831. Button* goUpButton);
  16832. virtual void drawBubble (Graphics& g,
  16833. float tipX, float tipY,
  16834. float boxX, float boxY, float boxW, float boxH);
  16835. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  16836. virtual void drawPopupMenuItem (Graphics& g,
  16837. int width, int height,
  16838. const bool isSeparator,
  16839. const bool isActive,
  16840. const bool isHighlighted,
  16841. const bool isTicked,
  16842. const bool hasSubMenu,
  16843. const String& text,
  16844. const String& shortcutKeyText,
  16845. Image* image,
  16846. const Colour* const textColour);
  16847. virtual const Font getPopupMenuFont();
  16848. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  16849. int width, int height,
  16850. bool isScrollUpArrow);
  16851. virtual void getIdealPopupMenuItemSize (const String& text,
  16852. const bool isSeparator,
  16853. int standardMenuItemHeight,
  16854. int& idealWidth,
  16855. int& idealHeight);
  16856. virtual int getMenuWindowFlags();
  16857. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  16858. bool isMouseOverBar,
  16859. MenuBarComponent& menuBar);
  16860. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16861. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16862. virtual void drawMenuBarItem (Graphics& g,
  16863. int width, int height,
  16864. int itemIndex,
  16865. const String& itemText,
  16866. bool isMouseOverItem,
  16867. bool isMenuOpen,
  16868. bool isMouseOverBar,
  16869. MenuBarComponent& menuBar);
  16870. virtual void drawComboBox (Graphics& g, int width, int height,
  16871. const bool isButtonDown,
  16872. int buttonX, int buttonY,
  16873. int buttonW, int buttonH,
  16874. ComboBox& box);
  16875. virtual const Font getComboBoxFont (ComboBox& box);
  16876. virtual Label* createComboBoxTextBox (ComboBox& box);
  16877. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  16878. virtual void drawLabel (Graphics& g, Label& label);
  16879. virtual void drawLinearSlider (Graphics& g,
  16880. int x, int y,
  16881. int width, int height,
  16882. float sliderPos,
  16883. float minSliderPos,
  16884. float maxSliderPos,
  16885. const Slider::SliderStyle style,
  16886. Slider& slider);
  16887. virtual void drawLinearSliderBackground (Graphics& g,
  16888. int x, int y,
  16889. int width, int height,
  16890. float sliderPos,
  16891. float minSliderPos,
  16892. float maxSliderPos,
  16893. const Slider::SliderStyle style,
  16894. Slider& slider);
  16895. virtual void drawLinearSliderThumb (Graphics& g,
  16896. int x, int y,
  16897. int width, int height,
  16898. float sliderPos,
  16899. float minSliderPos,
  16900. float maxSliderPos,
  16901. const Slider::SliderStyle style,
  16902. Slider& slider);
  16903. virtual int getSliderThumbRadius (Slider& slider);
  16904. virtual void drawRotarySlider (Graphics& g,
  16905. int x, int y,
  16906. int width, int height,
  16907. float sliderPosProportional,
  16908. const float rotaryStartAngle,
  16909. const float rotaryEndAngle,
  16910. Slider& slider);
  16911. virtual Button* createSliderButton (const bool isIncrement);
  16912. virtual Label* createSliderTextBox (Slider& slider);
  16913. virtual ImageEffectFilter* getSliderEffect();
  16914. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  16915. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  16916. virtual Button* createFilenameComponentBrowseButton (const String& text);
  16917. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  16918. ComboBox* filenameBox, Button* browseButton);
  16919. virtual void drawCornerResizer (Graphics& g,
  16920. int w, int h,
  16921. bool isMouseOver,
  16922. bool isMouseDragging);
  16923. virtual void drawResizableFrame (Graphics& g,
  16924. int w, int h,
  16925. const BorderSize& borders);
  16926. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  16927. const BorderSize& border,
  16928. ResizableWindow& window);
  16929. virtual void drawResizableWindowBorder (Graphics& g,
  16930. int w, int h,
  16931. const BorderSize& border,
  16932. ResizableWindow& window);
  16933. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  16934. Graphics& g, int w, int h,
  16935. int titleSpaceX, int titleSpaceW,
  16936. const Image* icon,
  16937. bool drawTitleTextOnLeft);
  16938. virtual Button* createDocumentWindowButton (int buttonType);
  16939. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  16940. int titleBarX, int titleBarY,
  16941. int titleBarW, int titleBarH,
  16942. Button* minimiseButton,
  16943. Button* maximiseButton,
  16944. Button* closeButton,
  16945. bool positionTitleBarButtonsOnLeft);
  16946. virtual int getDefaultMenuBarHeight();
  16947. virtual DropShadower* createDropShadowerForComponent (Component* component);
  16948. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  16949. int w, int h,
  16950. bool isVerticalBar,
  16951. bool isMouseOver,
  16952. bool isMouseDragging);
  16953. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  16954. const String& text,
  16955. const Justification& position,
  16956. GroupComponent& group);
  16957. virtual void createTabButtonShape (Path& p,
  16958. int width, int height,
  16959. int tabIndex,
  16960. const String& text,
  16961. Button& button,
  16962. TabbedButtonBar::Orientation orientation,
  16963. const bool isMouseOver,
  16964. const bool isMouseDown,
  16965. const bool isFrontTab);
  16966. virtual void fillTabButtonShape (Graphics& g,
  16967. const Path& path,
  16968. const Colour& preferredBackgroundColour,
  16969. int tabIndex,
  16970. const String& text,
  16971. Button& button,
  16972. TabbedButtonBar::Orientation orientation,
  16973. const bool isMouseOver,
  16974. const bool isMouseDown,
  16975. const bool isFrontTab);
  16976. virtual void drawTabButtonText (Graphics& g,
  16977. int x, int y, int w, int h,
  16978. const Colour& preferredBackgroundColour,
  16979. int tabIndex,
  16980. const String& text,
  16981. Button& button,
  16982. TabbedButtonBar::Orientation orientation,
  16983. const bool isMouseOver,
  16984. const bool isMouseDown,
  16985. const bool isFrontTab);
  16986. virtual int getTabButtonOverlap (int tabDepth);
  16987. virtual int getTabButtonSpaceAroundImage();
  16988. virtual int getTabButtonBestWidth (int tabIndex,
  16989. const String& text,
  16990. int tabDepth,
  16991. Button& button);
  16992. virtual void drawTabButton (Graphics& g,
  16993. int w, int h,
  16994. const Colour& preferredColour,
  16995. int tabIndex,
  16996. const String& text,
  16997. Button& button,
  16998. TabbedButtonBar::Orientation orientation,
  16999. const bool isMouseOver,
  17000. const bool isMouseDown,
  17001. const bool isFrontTab);
  17002. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17003. int w, int h,
  17004. TabbedButtonBar& tabBar,
  17005. TabbedButtonBar::Orientation orientation);
  17006. virtual Button* createTabBarExtrasButton();
  17007. virtual void drawImageButton (Graphics& g, Image* image,
  17008. int imageX, int imageY, int imageW, int imageH,
  17009. const Colour& overlayColour,
  17010. float imageOpacity,
  17011. ImageButton& button);
  17012. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17013. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17014. int width, int height,
  17015. bool isMouseOver, bool isMouseDown,
  17016. int columnFlags);
  17017. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17018. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17019. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17020. bool isMouseOver, bool isMouseDown,
  17021. ToolbarItemComponent& component);
  17022. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17023. const String& text, ToolbarItemComponent& component);
  17024. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17025. bool isOpen, int width, int height);
  17026. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17027. PropertyComponent& component);
  17028. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17029. PropertyComponent& component);
  17030. virtual const Rectangle getPropertyComponentContentPosition (PropertyComponent& component);
  17031. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17032. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17033. virtual void playAlertSound();
  17034. static void drawGlassSphere (Graphics& g,
  17035. const float x, const float y,
  17036. const float diameter,
  17037. const Colour& colour,
  17038. const float outlineThickness) throw();
  17039. static void drawGlassPointer (Graphics& g,
  17040. const float x, const float y,
  17041. const float diameter,
  17042. const Colour& colour, const float outlineThickness,
  17043. const int direction) throw();
  17044. static void drawGlassLozenge (Graphics& g,
  17045. const float x, const float y,
  17046. const float width, const float height,
  17047. const Colour& colour,
  17048. const float outlineThickness,
  17049. const float cornerSize,
  17050. const bool flatOnLeft, const bool flatOnRight,
  17051. const bool flatOnTop, const bool flatOnBottom) throw();
  17052. juce_UseDebuggingNewOperator
  17053. private:
  17054. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17055. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17056. Array <int> colourIds;
  17057. Array <Colour> colours;
  17058. // default typeface names
  17059. String defaultSans, defaultSerif, defaultFixed;
  17060. void drawShinyButtonShape (Graphics& g,
  17061. float x, float y, float w, float h, float maxCornerSize,
  17062. const Colour& baseColour,
  17063. const float strokeWidth,
  17064. const bool flatOnLeft,
  17065. const bool flatOnRight,
  17066. const bool flatOnTop,
  17067. const bool flatOnBottom) throw();
  17068. LookAndFeel (const LookAndFeel&);
  17069. const LookAndFeel& operator= (const LookAndFeel&);
  17070. };
  17071. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17072. /********* End of inlined file: juce_LookAndFeel.h *********/
  17073. #endif
  17074. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17075. /********* Start of inlined file: juce_OldSchoolLookAndFeel.h *********/
  17076. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17077. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17078. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17079. {
  17080. public:
  17081. OldSchoolLookAndFeel();
  17082. virtual ~OldSchoolLookAndFeel();
  17083. virtual void drawButtonBackground (Graphics& g,
  17084. Button& button,
  17085. const Colour& backgroundColour,
  17086. bool isMouseOverButton,
  17087. bool isButtonDown);
  17088. virtual void drawToggleButton (Graphics& g,
  17089. ToggleButton& button,
  17090. bool isMouseOverButton,
  17091. bool isButtonDown);
  17092. virtual void drawTickBox (Graphics& g,
  17093. Component& component,
  17094. int x, int y, int w, int h,
  17095. const bool ticked,
  17096. const bool isEnabled,
  17097. const bool isMouseOverButton,
  17098. const bool isButtonDown);
  17099. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17100. int width, int height,
  17101. double progress, const String& textToShow);
  17102. virtual void drawScrollbarButton (Graphics& g,
  17103. ScrollBar& scrollbar,
  17104. int width, int height,
  17105. int buttonDirection,
  17106. bool isScrollbarVertical,
  17107. bool isMouseOverButton,
  17108. bool isButtonDown);
  17109. virtual void drawScrollbar (Graphics& g,
  17110. ScrollBar& scrollbar,
  17111. int x, int y,
  17112. int width, int height,
  17113. bool isScrollbarVertical,
  17114. int thumbStartPosition,
  17115. int thumbSize,
  17116. bool isMouseOver,
  17117. bool isMouseDown);
  17118. virtual ImageEffectFilter* getScrollbarEffect();
  17119. virtual void drawTextEditorOutline (Graphics& g,
  17120. int width, int height,
  17121. TextEditor& textEditor);
  17122. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17123. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17124. bool isMouseOverBar,
  17125. MenuBarComponent& menuBar);
  17126. virtual void drawComboBox (Graphics& g, int width, int height,
  17127. const bool isButtonDown,
  17128. int buttonX, int buttonY,
  17129. int buttonW, int buttonH,
  17130. ComboBox& box);
  17131. virtual const Font getComboBoxFont (ComboBox& box);
  17132. virtual void drawLinearSlider (Graphics& g,
  17133. int x, int y,
  17134. int width, int height,
  17135. float sliderPos,
  17136. float minSliderPos,
  17137. float maxSliderPos,
  17138. const Slider::SliderStyle style,
  17139. Slider& slider);
  17140. virtual int getSliderThumbRadius (Slider& slider);
  17141. virtual Button* createSliderButton (const bool isIncrement);
  17142. virtual ImageEffectFilter* getSliderEffect();
  17143. virtual void drawCornerResizer (Graphics& g,
  17144. int w, int h,
  17145. bool isMouseOver,
  17146. bool isMouseDragging);
  17147. virtual Button* createDocumentWindowButton (int buttonType);
  17148. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17149. int titleBarX, int titleBarY,
  17150. int titleBarW, int titleBarH,
  17151. Button* minimiseButton,
  17152. Button* maximiseButton,
  17153. Button* closeButton,
  17154. bool positionTitleBarButtonsOnLeft);
  17155. juce_UseDebuggingNewOperator
  17156. private:
  17157. DropShadowEffect scrollbarShadow;
  17158. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17159. const OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17160. };
  17161. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17162. /********* End of inlined file: juce_OldSchoolLookAndFeel.h *********/
  17163. #endif
  17164. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17165. #endif
  17166. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17167. #endif
  17168. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17169. #endif
  17170. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17171. #endif
  17172. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17173. #endif
  17174. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17175. #endif
  17176. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17177. #endif
  17178. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17179. #endif
  17180. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17181. /********* Start of inlined file: juce_LassoComponent.h *********/
  17182. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17183. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17184. /********* Start of inlined file: juce_SelectedItemSet.h *********/
  17185. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17186. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17187. template <class SelectableItemType>
  17188. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17189. {
  17190. public:
  17191. SelectedItemSet()
  17192. {
  17193. }
  17194. SelectedItemSet (const Array <SelectableItemType>& items)
  17195. : selectedItems (items)
  17196. {
  17197. }
  17198. SelectedItemSet (const SelectedItemSet& other)
  17199. : selectedItems (other.selectedItems)
  17200. {
  17201. }
  17202. const SelectedItemSet& operator= (const SelectedItemSet& other)
  17203. {
  17204. if (selectedItems != other.selectedItems)
  17205. {
  17206. selectedItems = other.selectedItems;
  17207. changed();
  17208. }
  17209. return *this;
  17210. }
  17211. ~SelectedItemSet()
  17212. {
  17213. }
  17214. void selectOnly (SelectableItemType item)
  17215. {
  17216. if (isSelected (item))
  17217. {
  17218. for (int i = selectedItems.size(); --i >= 0;)
  17219. {
  17220. if (selectedItems.getUnchecked(i) != item)
  17221. {
  17222. deselect (selectedItems.getUnchecked(i));
  17223. i = jmin (i, selectedItems.size());
  17224. }
  17225. }
  17226. }
  17227. else
  17228. {
  17229. deselectAll();
  17230. changed();
  17231. selectedItems.add (item);
  17232. itemSelected (item);
  17233. }
  17234. }
  17235. void addToSelection (SelectableItemType item)
  17236. {
  17237. if (! isSelected (item))
  17238. {
  17239. changed();
  17240. selectedItems.add (item);
  17241. itemSelected (item);
  17242. }
  17243. }
  17244. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17245. const ModifierKeys& modifiers)
  17246. {
  17247. if (modifiers.isShiftDown())
  17248. {
  17249. addToSelection (item);
  17250. }
  17251. else if (modifiers.isCommandDown())
  17252. {
  17253. if (isSelected (item))
  17254. deselect (item);
  17255. else
  17256. addToSelection (item);
  17257. }
  17258. else
  17259. {
  17260. selectOnly (item);
  17261. }
  17262. }
  17263. bool addToSelectionOnMouseDown (SelectableItemType item,
  17264. const ModifierKeys& modifiers)
  17265. {
  17266. if (isSelected (item))
  17267. {
  17268. return ! modifiers.isPopupMenu();
  17269. }
  17270. else
  17271. {
  17272. addToSelectionBasedOnModifiers (item, modifiers);
  17273. return false;
  17274. }
  17275. }
  17276. void addToSelectionOnMouseUp (SelectableItemType item,
  17277. const ModifierKeys& modifiers,
  17278. const bool wasItemDragged,
  17279. const bool resultOfMouseDownSelectMethod)
  17280. {
  17281. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17282. addToSelectionBasedOnModifiers (item, modifiers);
  17283. }
  17284. void deselect (SelectableItemType item)
  17285. {
  17286. const int i = selectedItems.indexOf (item);
  17287. if (i >= 0)
  17288. {
  17289. changed();
  17290. itemDeselected (selectedItems.remove (i));
  17291. }
  17292. }
  17293. void deselectAll()
  17294. {
  17295. if (selectedItems.size() > 0)
  17296. {
  17297. changed();
  17298. for (int i = selectedItems.size(); --i >= 0;)
  17299. {
  17300. itemDeselected (selectedItems.remove (i));
  17301. i = jmin (i, selectedItems.size());
  17302. }
  17303. }
  17304. }
  17305. int getNumSelected() const throw()
  17306. {
  17307. return selectedItems.size();
  17308. }
  17309. SelectableItemType getSelectedItem (const int index) const throw()
  17310. {
  17311. return selectedItems [index];
  17312. }
  17313. bool isSelected (const SelectableItemType item) const throw()
  17314. {
  17315. return selectedItems.contains (item);
  17316. }
  17317. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17318. virtual void itemSelected (SelectableItemType item) {}
  17319. virtual void itemDeselected (SelectableItemType item) {}
  17320. void changed (const bool synchronous = false)
  17321. {
  17322. if (synchronous)
  17323. sendSynchronousChangeMessage (this);
  17324. else
  17325. sendChangeMessage (this);
  17326. }
  17327. juce_UseDebuggingNewOperator
  17328. private:
  17329. Array <SelectableItemType> selectedItems;
  17330. };
  17331. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17332. /********* End of inlined file: juce_SelectedItemSet.h *********/
  17333. template <class SelectableItemType>
  17334. class LassoSource
  17335. {
  17336. public:
  17337. virtual ~LassoSource() {}
  17338. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17339. int x, int y, int width, int height) = 0;
  17340. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17341. };
  17342. template <class SelectableItemType>
  17343. class LassoComponent : public Component
  17344. {
  17345. public:
  17346. LassoComponent (const int outlineThickness_ = 1)
  17347. : source (0),
  17348. outlineThickness (outlineThickness_)
  17349. {
  17350. }
  17351. ~LassoComponent()
  17352. {
  17353. }
  17354. void beginLasso (const MouseEvent& e,
  17355. LassoSource <SelectableItemType>* const lassoSource)
  17356. {
  17357. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17358. jassert (lassoSource != 0); // the source can't be null!
  17359. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17360. source = lassoSource;
  17361. if (lassoSource != 0)
  17362. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17363. setSize (0, 0);
  17364. }
  17365. void dragLasso (const MouseEvent& e)
  17366. {
  17367. if (source != 0)
  17368. {
  17369. const int x1 = e.getMouseDownX();
  17370. const int y1 = e.getMouseDownY();
  17371. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17372. setVisible (true);
  17373. Array <SelectableItemType> itemsInLasso;
  17374. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17375. if (e.mods.isShiftDown())
  17376. {
  17377. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17378. itemsInLasso.addArray (originalSelection);
  17379. }
  17380. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17381. {
  17382. Array <SelectableItemType> originalMinusNew (originalSelection);
  17383. originalMinusNew.removeValuesIn (itemsInLasso);
  17384. itemsInLasso.removeValuesIn (originalSelection);
  17385. itemsInLasso.addArray (originalMinusNew);
  17386. }
  17387. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17388. }
  17389. }
  17390. void endLasso()
  17391. {
  17392. source = 0;
  17393. originalSelection.clear();
  17394. setVisible (false);
  17395. }
  17396. enum ColourIds
  17397. {
  17398. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17399. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17400. };
  17401. void paint (Graphics& g)
  17402. {
  17403. g.fillAll (findColour (lassoFillColourId));
  17404. g.setColour (findColour (lassoOutlineColourId));
  17405. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17406. // this suggests that you've left a lasso comp lying around after the
  17407. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17408. // mouse-up event.
  17409. jassert (isMouseButtonDownAnywhere());
  17410. }
  17411. bool hitTest (int x, int y) { return false; }
  17412. juce_UseDebuggingNewOperator
  17413. private:
  17414. Array <SelectableItemType> originalSelection;
  17415. LassoSource <SelectableItemType>* source;
  17416. int outlineThickness;
  17417. };
  17418. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17419. /********* End of inlined file: juce_LassoComponent.h *********/
  17420. #endif
  17421. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17422. #endif
  17423. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17424. #endif
  17425. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17426. /********* Start of inlined file: juce_MouseHoverDetector.h *********/
  17427. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17428. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17429. class JUCE_API MouseHoverDetector
  17430. {
  17431. public:
  17432. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17433. virtual ~MouseHoverDetector();
  17434. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17435. void setHoverComponent (Component* const newSourceComponent);
  17436. protected:
  17437. virtual void mouseHovered (int mouseX,
  17438. int mouseY) = 0;
  17439. virtual void mouseMovedAfterHover() = 0;
  17440. private:
  17441. class JUCE_API HoverDetectorInternal : public MouseListener,
  17442. public Timer
  17443. {
  17444. public:
  17445. MouseHoverDetector* owner;
  17446. int lastX, lastY;
  17447. void timerCallback();
  17448. void mouseEnter (const MouseEvent&);
  17449. void mouseExit (const MouseEvent&);
  17450. void mouseDown (const MouseEvent&);
  17451. void mouseUp (const MouseEvent&);
  17452. void mouseMove (const MouseEvent&);
  17453. void mouseWheelMove (const MouseEvent&, float, float);
  17454. } internalTimer;
  17455. friend class HoverDetectorInternal;
  17456. Component* source;
  17457. int hoverTimeMillisecs;
  17458. bool hasJustHovered;
  17459. void hoverTimerCallback();
  17460. void checkJustHoveredCallback();
  17461. MouseHoverDetector (const MouseHoverDetector&);
  17462. const MouseHoverDetector& operator= (const MouseHoverDetector&);
  17463. };
  17464. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17465. /********* End of inlined file: juce_MouseHoverDetector.h *********/
  17466. #endif
  17467. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17468. #endif
  17469. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17470. #endif
  17471. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17472. /********* Start of inlined file: juce_BooleanPropertyComponent.h *********/
  17473. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17474. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17475. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17476. private ButtonListener
  17477. {
  17478. protected:
  17479. BooleanPropertyComponent (const String& propertyName,
  17480. const String& buttonTextWhenTrue,
  17481. const String& buttonTextWhenFalse);
  17482. public:
  17483. BooleanPropertyComponent (const Value& valueToControl,
  17484. const String& propertyName,
  17485. const String& buttonText);
  17486. ~BooleanPropertyComponent();
  17487. virtual void setState (const bool newState);
  17488. virtual bool getState() const;
  17489. void paint (Graphics& g);
  17490. void refresh();
  17491. void buttonClicked (Button*);
  17492. juce_UseDebuggingNewOperator
  17493. private:
  17494. ToggleButton* button;
  17495. String onText, offText;
  17496. void createButton();
  17497. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17498. const BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17499. };
  17500. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17501. /********* End of inlined file: juce_BooleanPropertyComponent.h *********/
  17502. #endif
  17503. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17504. /********* Start of inlined file: juce_ButtonPropertyComponent.h *********/
  17505. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17506. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17507. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17508. private ButtonListener
  17509. {
  17510. public:
  17511. ButtonPropertyComponent (const String& propertyName,
  17512. const bool triggerOnMouseDown);
  17513. ~ButtonPropertyComponent();
  17514. virtual void buttonClicked() = 0;
  17515. virtual const String getButtonText() const = 0;
  17516. void refresh();
  17517. void buttonClicked (Button*);
  17518. juce_UseDebuggingNewOperator
  17519. private:
  17520. TextButton* button;
  17521. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17522. const ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17523. };
  17524. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17525. /********* End of inlined file: juce_ButtonPropertyComponent.h *********/
  17526. #endif
  17527. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17528. /********* Start of inlined file: juce_ChoicePropertyComponent.h *********/
  17529. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17530. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17531. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17532. private ComboBoxListener
  17533. {
  17534. protected:
  17535. ChoicePropertyComponent (const String& propertyName);
  17536. public:
  17537. ChoicePropertyComponent (const Value& valueToControl,
  17538. const String& propertyName,
  17539. const StringArray& choices,
  17540. const Array <int>* choiceIDs = 0);
  17541. ~ChoicePropertyComponent();
  17542. virtual void setIndex (const int newIndex);
  17543. virtual int getIndex() const;
  17544. const StringArray& getChoices() const;
  17545. void refresh();
  17546. void comboBoxChanged (ComboBox*);
  17547. juce_UseDebuggingNewOperator
  17548. protected:
  17549. StringArray choices;
  17550. private:
  17551. ComboBox* comboBox;
  17552. void createComboBox (const Array <int>* choiceIDs);
  17553. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17554. const ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17555. };
  17556. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17557. /********* End of inlined file: juce_ChoicePropertyComponent.h *********/
  17558. #endif
  17559. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17560. #endif
  17561. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17562. #endif
  17563. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17564. /********* Start of inlined file: juce_SliderPropertyComponent.h *********/
  17565. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17566. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17567. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17568. private SliderListener
  17569. {
  17570. protected:
  17571. SliderPropertyComponent (const String& propertyName,
  17572. const double rangeMin,
  17573. const double rangeMax,
  17574. const double interval,
  17575. const double skewFactor = 1.0);
  17576. public:
  17577. SliderPropertyComponent (Value& valueToControl,
  17578. const String& propertyName,
  17579. const double rangeMin,
  17580. const double rangeMax,
  17581. const double interval,
  17582. const double skewFactor = 1.0);
  17583. ~SliderPropertyComponent();
  17584. virtual void setValue (const double newValue);
  17585. virtual const double getValue() const;
  17586. void refresh();
  17587. void changeListenerCallback (void*);
  17588. void sliderValueChanged (Slider*);
  17589. juce_UseDebuggingNewOperator
  17590. protected:
  17591. Slider* slider;
  17592. SliderPropertyComponent (const SliderPropertyComponent&);
  17593. const SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17594. };
  17595. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17596. /********* End of inlined file: juce_SliderPropertyComponent.h *********/
  17597. #endif
  17598. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17599. /********* Start of inlined file: juce_TextPropertyComponent.h *********/
  17600. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17601. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17602. class JUCE_API TextPropertyComponent : public PropertyComponent
  17603. {
  17604. protected:
  17605. TextPropertyComponent (const String& propertyName,
  17606. const int maxNumChars,
  17607. const bool isMultiLine);
  17608. public:
  17609. TextPropertyComponent (const Value& valueToControl,
  17610. const String& propertyName,
  17611. const int maxNumChars,
  17612. const bool isMultiLine);
  17613. ~TextPropertyComponent();
  17614. virtual void setText (const String& newText);
  17615. virtual const String getText() const;
  17616. void refresh();
  17617. void textWasEdited();
  17618. juce_UseDebuggingNewOperator
  17619. private:
  17620. Label* textEditor;
  17621. void createEditor (const int maxNumChars, const bool isMultiLine);
  17622. TextPropertyComponent (const TextPropertyComponent&);
  17623. const TextPropertyComponent& operator= (const TextPropertyComponent&);
  17624. };
  17625. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17626. /********* End of inlined file: juce_TextPropertyComponent.h *********/
  17627. #endif
  17628. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17629. /********* Start of inlined file: juce_ActiveXControlComponent.h *********/
  17630. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17631. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17632. #if JUCE_WINDOWS || DOXYGEN
  17633. class JUCE_API ActiveXControlComponent : public Component
  17634. {
  17635. public:
  17636. ActiveXControlComponent();
  17637. ~ActiveXControlComponent();
  17638. bool createControl (const void* controlIID);
  17639. void deleteControl();
  17640. bool isControlOpen() const throw() { return control != 0; }
  17641. void* queryInterface (const void* iid) const;
  17642. void setMouseEventsAllowed (const bool eventsCanReachControl);
  17643. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  17644. void paint (Graphics& g);
  17645. void* originalWndProc;
  17646. juce_UseDebuggingNewOperator
  17647. private:
  17648. friend class ActiveXControlData;
  17649. void* control;
  17650. bool mouseEventsAllowed;
  17651. ActiveXControlComponent (const ActiveXControlComponent&);
  17652. const ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  17653. void setControlBounds (const Rectangle& bounds) const;
  17654. void setControlVisible (const bool b) const;
  17655. };
  17656. #endif
  17657. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17658. /********* End of inlined file: juce_ActiveXControlComponent.h *********/
  17659. #endif
  17660. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17661. /********* Start of inlined file: juce_AudioDeviceSelectorComponent.h *********/
  17662. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17663. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17664. class MidiInputSelectorComponentListBox;
  17665. class JUCE_API AudioDeviceSelectorComponent : public Component,
  17666. public ComboBoxListener,
  17667. public ButtonListener,
  17668. public ChangeListener
  17669. {
  17670. public:
  17671. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  17672. const int minAudioInputChannels,
  17673. const int maxAudioInputChannels,
  17674. const int minAudioOutputChannels,
  17675. const int maxAudioOutputChannels,
  17676. const bool showMidiInputOptions,
  17677. const bool showMidiOutputSelector,
  17678. const bool showChannelsAsStereoPairs,
  17679. const bool hideAdvancedOptionsWithButton);
  17680. ~AudioDeviceSelectorComponent();
  17681. void resized();
  17682. void comboBoxChanged (ComboBox*);
  17683. void buttonClicked (Button*);
  17684. void changeListenerCallback (void*);
  17685. void childBoundsChanged (Component*);
  17686. juce_UseDebuggingNewOperator
  17687. private:
  17688. AudioDeviceManager& deviceManager;
  17689. ComboBox* deviceTypeDropDown;
  17690. Label* deviceTypeDropDownLabel;
  17691. Component* audioDeviceSettingsComp;
  17692. String audioDeviceSettingsCompType;
  17693. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  17694. const bool showChannelsAsStereoPairs;
  17695. const bool hideAdvancedOptionsWithButton;
  17696. MidiInputSelectorComponentListBox* midiInputsList;
  17697. Label* midiInputsLabel;
  17698. ComboBox* midiOutputSelector;
  17699. Label* midiOutputLabel;
  17700. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  17701. const AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  17702. };
  17703. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17704. /********* End of inlined file: juce_AudioDeviceSelectorComponent.h *********/
  17705. #endif
  17706. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17707. /********* Start of inlined file: juce_BubbleComponent.h *********/
  17708. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17709. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17710. class JUCE_API BubbleComponent : public Component
  17711. {
  17712. protected:
  17713. BubbleComponent();
  17714. public:
  17715. ~BubbleComponent();
  17716. enum BubblePlacement
  17717. {
  17718. above = 1,
  17719. below = 2,
  17720. left = 4,
  17721. right = 8
  17722. };
  17723. void setAllowedPlacement (const int newPlacement);
  17724. void setPosition (Component* componentToPointTo);
  17725. void setPosition (const int arrowTipX,
  17726. const int arrowTipY);
  17727. void setPosition (const Rectangle& rectangleToPointTo);
  17728. protected:
  17729. virtual void getContentSize (int& width, int& height) = 0;
  17730. virtual void paintContent (Graphics& g, int width, int height) = 0;
  17731. public:
  17732. void paint (Graphics& g);
  17733. juce_UseDebuggingNewOperator
  17734. private:
  17735. Rectangle content;
  17736. int side, allowablePlacements;
  17737. float arrowTipX, arrowTipY;
  17738. DropShadowEffect shadow;
  17739. BubbleComponent (const BubbleComponent&);
  17740. const BubbleComponent& operator= (const BubbleComponent&);
  17741. };
  17742. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17743. /********* End of inlined file: juce_BubbleComponent.h *********/
  17744. #endif
  17745. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17746. /********* Start of inlined file: juce_BubbleMessageComponent.h *********/
  17747. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17748. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17749. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  17750. private Timer
  17751. {
  17752. public:
  17753. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  17754. ~BubbleMessageComponent();
  17755. void showAt (int x, int y,
  17756. const String& message,
  17757. const int numMillisecondsBeforeRemoving,
  17758. const bool removeWhenMouseClicked = true,
  17759. const bool deleteSelfAfterUse = false);
  17760. void showAt (Component* const component,
  17761. const String& message,
  17762. const int numMillisecondsBeforeRemoving,
  17763. const bool removeWhenMouseClicked = true,
  17764. const bool deleteSelfAfterUse = false);
  17765. void getContentSize (int& w, int& h);
  17766. void paintContent (Graphics& g, int w, int h);
  17767. void timerCallback();
  17768. juce_UseDebuggingNewOperator
  17769. private:
  17770. int fadeOutLength, mouseClickCounter;
  17771. TextLayout textLayout;
  17772. int64 expiryTime;
  17773. bool deleteAfterUse;
  17774. void init (const int numMillisecondsBeforeRemoving,
  17775. const bool removeWhenMouseClicked,
  17776. const bool deleteSelfAfterUse);
  17777. BubbleMessageComponent (const BubbleMessageComponent&);
  17778. const BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  17779. };
  17780. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17781. /********* End of inlined file: juce_BubbleMessageComponent.h *********/
  17782. #endif
  17783. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17784. /********* Start of inlined file: juce_ColourSelector.h *********/
  17785. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17786. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  17787. class JUCE_API ColourSelector : public Component,
  17788. public ChangeBroadcaster,
  17789. protected SliderListener
  17790. {
  17791. public:
  17792. enum ColourSelectorOptions
  17793. {
  17794. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  17795. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  17796. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  17797. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  17798. };
  17799. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  17800. const int edgeGap = 4,
  17801. const int gapAroundColourSpaceComponent = 7);
  17802. ~ColourSelector();
  17803. const Colour getCurrentColour() const;
  17804. void setCurrentColour (const Colour& newColour);
  17805. virtual int getNumSwatches() const;
  17806. virtual const Colour getSwatchColour (const int index) const;
  17807. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  17808. enum ColourIds
  17809. {
  17810. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  17811. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  17812. };
  17813. juce_UseDebuggingNewOperator
  17814. private:
  17815. friend class ColourSpaceView;
  17816. friend class HueSelectorComp;
  17817. Colour colour;
  17818. float h, s, v;
  17819. Slider* sliders[4];
  17820. Component* colourSpace;
  17821. Component* hueSelector;
  17822. class SwatchComponent;
  17823. OwnedArray <SwatchComponent> swatchComponents;
  17824. const int flags;
  17825. int topSpace, edgeGap;
  17826. void setHue (float newH);
  17827. void setSV (float newS, float newV);
  17828. void updateHSV();
  17829. void update();
  17830. void sliderValueChanged (Slider*);
  17831. void paint (Graphics& g);
  17832. void resized();
  17833. ColourSelector (const ColourSelector&);
  17834. const ColourSelector& operator= (const ColourSelector&);
  17835. // this constructor is here temporarily to prevent old code compiling, because the parameters
  17836. // have changed - if you get an error here, update your code to use the new constructor instead..
  17837. // (xxx - note to self: remember to remove this at some point in the future)
  17838. ColourSelector (const bool);
  17839. };
  17840. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  17841. /********* End of inlined file: juce_ColourSelector.h *********/
  17842. #endif
  17843. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  17844. #endif
  17845. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17846. /********* Start of inlined file: juce_MagnifierComponent.h *********/
  17847. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17848. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17849. class JUCE_API MagnifierComponent : public Component
  17850. {
  17851. public:
  17852. MagnifierComponent (Component* const contentComponent,
  17853. const bool deleteContentCompWhenNoLongerNeeded);
  17854. ~MagnifierComponent();
  17855. Component* getContentComponent() const { return content; }
  17856. void setScaleFactor (double newScaleFactor);
  17857. double getScaleFactor() const { return scaleFactor; }
  17858. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  17859. juce_UseDebuggingNewOperator
  17860. void childBoundsChanged (Component*);
  17861. private:
  17862. Component* content;
  17863. Component* holderComp;
  17864. double scaleFactor;
  17865. ComponentPeer* peer;
  17866. bool deleteContent;
  17867. Graphics::ResamplingQuality quality;
  17868. void paint (Graphics& g);
  17869. void mouseDown (const MouseEvent& e);
  17870. void mouseUp (const MouseEvent& e);
  17871. void mouseDrag (const MouseEvent& e);
  17872. void mouseMove (const MouseEvent& e);
  17873. void mouseEnter (const MouseEvent& e);
  17874. void mouseExit (const MouseEvent& e);
  17875. void mouseWheelMove (const MouseEvent& e, float, float);
  17876. int scaleInt (const int n) const;
  17877. MagnifierComponent (const MagnifierComponent&);
  17878. const MagnifierComponent& operator= (const MagnifierComponent&);
  17879. };
  17880. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17881. /********* End of inlined file: juce_MagnifierComponent.h *********/
  17882. #endif
  17883. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17884. /********* Start of inlined file: juce_MidiKeyboardComponent.h *********/
  17885. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17886. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17887. class JUCE_API MidiKeyboardComponent : public Component,
  17888. public MidiKeyboardStateListener,
  17889. public ChangeBroadcaster,
  17890. private Timer,
  17891. private AsyncUpdater
  17892. {
  17893. public:
  17894. enum Orientation
  17895. {
  17896. horizontalKeyboard,
  17897. verticalKeyboardFacingLeft,
  17898. verticalKeyboardFacingRight,
  17899. };
  17900. MidiKeyboardComponent (MidiKeyboardState& state,
  17901. const Orientation orientation);
  17902. ~MidiKeyboardComponent();
  17903. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  17904. void setMidiChannel (const int midiChannelNumber);
  17905. int getMidiChannel() const throw() { return midiChannel; }
  17906. void setMidiChannelsToDisplay (const int midiChannelMask);
  17907. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  17908. void setKeyWidth (const float widthInPixels);
  17909. float getKeyWidth() const throw() { return keyWidth; }
  17910. void setOrientation (const Orientation newOrientation);
  17911. const Orientation getOrientation() const throw() { return orientation; }
  17912. void setAvailableRange (const int lowestNote,
  17913. const int highestNote);
  17914. int getRangeStart() const throw() { return rangeStart; }
  17915. int getRangeEnd() const throw() { return rangeEnd; }
  17916. void setLowestVisibleKey (int noteNumber);
  17917. int getLowestVisibleKey() const throw() { return firstKey; }
  17918. int getBlackNoteLength() const throw() { return blackNoteLength; }
  17919. void setScrollButtonsVisible (const bool canScroll);
  17920. enum ColourIds
  17921. {
  17922. whiteNoteColourId = 0x1005000,
  17923. blackNoteColourId = 0x1005001,
  17924. keySeparatorLineColourId = 0x1005002,
  17925. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  17926. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  17927. textLabelColourId = 0x1005005,
  17928. upDownButtonBackgroundColourId = 0x1005006,
  17929. upDownButtonArrowColourId = 0x1005007
  17930. };
  17931. int getKeyStartPosition (const int midiNoteNumber) const;
  17932. void clearKeyMappings();
  17933. void setKeyPressForNote (const KeyPress& key,
  17934. const int midiNoteOffsetFromC);
  17935. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  17936. void setKeyPressBaseOctave (const int newOctaveNumber);
  17937. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  17938. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  17939. void paint (Graphics& g);
  17940. void resized();
  17941. void mouseMove (const MouseEvent& e);
  17942. void mouseDrag (const MouseEvent& e);
  17943. void mouseDown (const MouseEvent& e);
  17944. void mouseUp (const MouseEvent& e);
  17945. void mouseEnter (const MouseEvent& e);
  17946. void mouseExit (const MouseEvent& e);
  17947. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  17948. void timerCallback();
  17949. bool keyStateChanged (const bool isKeyDown);
  17950. void focusLost (FocusChangeType cause);
  17951. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  17952. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  17953. void handleAsyncUpdate();
  17954. void colourChanged();
  17955. juce_UseDebuggingNewOperator
  17956. protected:
  17957. friend class MidiKeyboardUpDownButton;
  17958. virtual void drawWhiteNote (int midiNoteNumber,
  17959. Graphics& g,
  17960. int x, int y, int w, int h,
  17961. bool isDown, bool isOver,
  17962. const Colour& lineColour,
  17963. const Colour& textColour);
  17964. virtual void drawBlackNote (int midiNoteNumber,
  17965. Graphics& g,
  17966. int x, int y, int w, int h,
  17967. bool isDown, bool isOver,
  17968. const Colour& noteFillColour);
  17969. virtual const String getWhiteNoteText (const int midiNoteNumber);
  17970. virtual void drawUpDownButton (Graphics& g, int w, int h,
  17971. const bool isMouseOver,
  17972. const bool isButtonPressed,
  17973. const bool movesOctavesUp);
  17974. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  17975. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  17976. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  17977. int& x, int& w) const;
  17978. private:
  17979. MidiKeyboardState& state;
  17980. int xOffset, blackNoteLength;
  17981. float keyWidth;
  17982. Orientation orientation;
  17983. int midiChannel, midiInChannelMask;
  17984. float velocity;
  17985. int noteUnderMouse, mouseDownNote;
  17986. BitArray keysPressed, keysCurrentlyDrawnDown;
  17987. int rangeStart, rangeEnd, firstKey;
  17988. bool canScroll, mouseDragging, useMousePositionForVelocity;
  17989. Button* scrollDown;
  17990. Button* scrollUp;
  17991. Array <KeyPress> keyPresses;
  17992. Array <int> keyPressNotes;
  17993. int keyMappingOctave;
  17994. int octaveNumForMiddleC;
  17995. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  17996. int xyToNote (int x, int y, float& mousePositionVelocity);
  17997. int remappedXYToNote (int x, int y, float& mousePositionVelocity) const;
  17998. void resetAnyKeysInUse();
  17999. void updateNoteUnderMouse (int x, int y);
  18000. void repaintNote (const int midiNoteNumber);
  18001. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18002. const MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18003. };
  18004. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18005. /********* End of inlined file: juce_MidiKeyboardComponent.h *********/
  18006. #endif
  18007. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18008. /********* Start of inlined file: juce_NSViewComponent.h *********/
  18009. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18010. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18011. #if ! DOXYGEN
  18012. class NSViewComponentInternal;
  18013. #endif
  18014. #if JUCE_MAC || DOXYGEN
  18015. class JUCE_API NSViewComponent : public Component
  18016. {
  18017. public:
  18018. NSViewComponent();
  18019. ~NSViewComponent();
  18020. void setView (void* nsView);
  18021. void* getView() const;
  18022. void paint (Graphics& g);
  18023. juce_UseDebuggingNewOperator
  18024. private:
  18025. friend class NSViewComponentInternal;
  18026. ScopedPointer <NSViewComponentInternal> info;
  18027. NSViewComponent (const NSViewComponent&);
  18028. const NSViewComponent& operator= (const NSViewComponent&);
  18029. };
  18030. #endif
  18031. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18032. /********* End of inlined file: juce_NSViewComponent.h *********/
  18033. #endif
  18034. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18035. /********* Start of inlined file: juce_OpenGLComponent.h *********/
  18036. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18037. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18038. // this is used to disable OpenGL, and is defined in juce_Config.h
  18039. #if JUCE_OPENGL || DOXYGEN
  18040. class JUCE_API OpenGLPixelFormat
  18041. {
  18042. public:
  18043. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18044. const int alphaBits = 8,
  18045. const int depthBufferBits = 16,
  18046. const int stencilBufferBits = 0) throw();
  18047. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18048. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18049. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18050. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18051. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18052. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18053. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18054. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18055. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18056. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18057. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18058. static void getAvailablePixelFormats (Component* component,
  18059. OwnedArray <OpenGLPixelFormat>& results);
  18060. bool operator== (const OpenGLPixelFormat&) const throw();
  18061. juce_UseDebuggingNewOperator
  18062. };
  18063. class JUCE_API OpenGLContext
  18064. {
  18065. public:
  18066. virtual ~OpenGLContext();
  18067. virtual bool makeActive() const throw() = 0;
  18068. virtual bool makeInactive() const throw() = 0;
  18069. virtual bool isActive() const throw() = 0;
  18070. virtual void swapBuffers() = 0;
  18071. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18072. virtual int getSwapInterval() const = 0;
  18073. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18074. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18075. virtual void repaint() = 0;
  18076. virtual void* getRawContext() const throw() = 0;
  18077. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18078. const OpenGLPixelFormat& pixelFormat,
  18079. const OpenGLContext* const contextToShareWith);
  18080. static OpenGLContext* getCurrentContext();
  18081. juce_UseDebuggingNewOperator
  18082. protected:
  18083. OpenGLContext() throw();
  18084. };
  18085. class JUCE_API OpenGLComponent : public Component
  18086. {
  18087. public:
  18088. OpenGLComponent();
  18089. ~OpenGLComponent();
  18090. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18091. const OpenGLPixelFormat getPixelFormat() const;
  18092. void shareWith (OpenGLContext* contextToShareListsWith);
  18093. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18094. void swapBuffers();
  18095. virtual void renderOpenGL() = 0;
  18096. virtual void newOpenGLContextCreated() = 0;
  18097. OpenGLContext* getCurrentContext() const throw() { return context; }
  18098. bool makeCurrentContextActive();
  18099. void makeCurrentContextInactive();
  18100. bool isActiveContext() const throw();
  18101. virtual bool renderAndSwapBuffers();
  18102. CriticalSection& getContextLock() throw() { return contextLock; }
  18103. void paint (Graphics& g);
  18104. void* getNativeWindowHandle() const;
  18105. juce_UseDebuggingNewOperator
  18106. private:
  18107. class OpenGLComponentWatcher;
  18108. friend class ScopedPointer <OpenGLComponentWatcher>;
  18109. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18110. OpenGLContext* context;
  18111. OpenGLContext* contextToShareListsWith;
  18112. CriticalSection contextLock;
  18113. OpenGLPixelFormat preferredPixelFormat;
  18114. bool needToUpdateViewport;
  18115. void deleteContext();
  18116. void updateContextPosition();
  18117. void internalRepaint (int x, int y, int w, int h);
  18118. OpenGLComponent (const OpenGLComponent&);
  18119. const OpenGLComponent& operator= (const OpenGLComponent&);
  18120. };
  18121. #endif
  18122. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18123. /********* End of inlined file: juce_OpenGLComponent.h *********/
  18124. #endif
  18125. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18126. /********* Start of inlined file: juce_PreferencesPanel.h *********/
  18127. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18128. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18129. class JUCE_API PreferencesPanel : public Component,
  18130. private ButtonListener
  18131. {
  18132. public:
  18133. PreferencesPanel();
  18134. ~PreferencesPanel();
  18135. void addSettingsPage (const String& pageTitle,
  18136. const Drawable* normalIcon,
  18137. const Drawable* overIcon,
  18138. const Drawable* downIcon);
  18139. void addSettingsPage (const String& pageTitle,
  18140. const char* imageData,
  18141. const int imageDataSize);
  18142. void showInDialogBox (const String& dialogtitle,
  18143. int dialogWidth,
  18144. int dialogHeight,
  18145. const Colour& backgroundColour = Colours::white);
  18146. virtual Component* createComponentForPage (const String& pageName) = 0;
  18147. void setCurrentPage (const String& pageName);
  18148. void resized();
  18149. void paint (Graphics& g);
  18150. void buttonClicked (Button* button);
  18151. juce_UseDebuggingNewOperator
  18152. private:
  18153. String currentPageName;
  18154. ScopedPointer <Component> currentPage;
  18155. int buttonSize;
  18156. PreferencesPanel (const PreferencesPanel&);
  18157. const PreferencesPanel& operator= (const PreferencesPanel&);
  18158. };
  18159. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18160. /********* End of inlined file: juce_PreferencesPanel.h *********/
  18161. #endif
  18162. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18163. /********* Start of inlined file: juce_QuickTimeMovieComponent.h *********/
  18164. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18165. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18166. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18167. // amalgamated build)
  18168. #if JUCE_WINDOWS
  18169. typedef ActiveXControlComponent QTCompBaseClass;
  18170. #elif JUCE_MAC
  18171. typedef NSViewComponent QTCompBaseClass;
  18172. #endif
  18173. // this is used to disable QuickTime, and is defined in juce_Config.h
  18174. #if JUCE_QUICKTIME || DOXYGEN
  18175. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18176. {
  18177. public:
  18178. QuickTimeMovieComponent();
  18179. ~QuickTimeMovieComponent();
  18180. static bool isQuickTimeAvailable() throw();
  18181. bool loadMovie (const File& movieFile,
  18182. const bool isControllerVisible);
  18183. bool loadMovie (const URL& movieURL,
  18184. const bool isControllerVisible);
  18185. bool loadMovie (InputStream* movieStream,
  18186. const bool isControllerVisible);
  18187. void closeMovie();
  18188. const File getCurrentMovieFile() const;
  18189. bool isMovieOpen() const;
  18190. double getMovieDuration() const;
  18191. void getMovieNormalSize (int& width, int& height) const;
  18192. void setBoundsWithCorrectAspectRatio (const Rectangle& spaceToFitWithin,
  18193. const RectanglePlacement& placement);
  18194. void play();
  18195. void stop();
  18196. bool isPlaying() const;
  18197. void goToStart();
  18198. void setPosition (const double seconds);
  18199. double getPosition() const;
  18200. void setSpeed (const float newSpeed);
  18201. void setMovieVolume (const float newVolume);
  18202. float getMovieVolume() const;
  18203. void setLooping (const bool shouldLoop);
  18204. bool isLooping() const;
  18205. bool isControllerVisible() const;
  18206. void paint (Graphics& g);
  18207. juce_UseDebuggingNewOperator
  18208. private:
  18209. File movieFile;
  18210. bool movieLoaded, controllerVisible, looping;
  18211. #if JUCE_WINDOWS
  18212. void parentHierarchyChanged();
  18213. void visibilityChanged();
  18214. void createControlIfNeeded();
  18215. bool isControlCreated() const;
  18216. void* internal;
  18217. #else
  18218. void* movie;
  18219. #endif
  18220. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18221. const QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18222. };
  18223. #endif
  18224. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18225. /********* End of inlined file: juce_QuickTimeMovieComponent.h *********/
  18226. #endif
  18227. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18228. /********* Start of inlined file: juce_SystemTrayIconComponent.h *********/
  18229. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18230. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18231. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18232. class JUCE_API SystemTrayIconComponent : public Component
  18233. {
  18234. public:
  18235. SystemTrayIconComponent();
  18236. ~SystemTrayIconComponent();
  18237. void setIconImage (const Image& newImage);
  18238. void setIconTooltip (const String& tooltip);
  18239. #if JUCE_LINUX
  18240. void paint (Graphics& g);
  18241. #endif
  18242. juce_UseDebuggingNewOperator
  18243. private:
  18244. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18245. const SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18246. };
  18247. #endif
  18248. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18249. /********* End of inlined file: juce_SystemTrayIconComponent.h *********/
  18250. #endif
  18251. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18252. /********* Start of inlined file: juce_WebBrowserComponent.h *********/
  18253. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18254. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18255. #if JUCE_WEB_BROWSER || DOXYGEN
  18256. #if ! DOXYGEN
  18257. class WebBrowserComponentInternal;
  18258. #endif
  18259. class JUCE_API WebBrowserComponent : public Component
  18260. {
  18261. public:
  18262. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18263. ~WebBrowserComponent();
  18264. void goToURL (const String& url,
  18265. const StringArray* headers = 0,
  18266. const MemoryBlock* postData = 0);
  18267. void stop();
  18268. void goBack();
  18269. void goForward();
  18270. void refresh();
  18271. virtual bool pageAboutToLoad (const String& newURL);
  18272. void paint (Graphics& g);
  18273. void resized();
  18274. void parentHierarchyChanged();
  18275. void visibilityChanged();
  18276. juce_UseDebuggingNewOperator
  18277. private:
  18278. WebBrowserComponentInternal* browser;
  18279. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18280. String lastURL;
  18281. StringArray lastHeaders;
  18282. MemoryBlock lastPostData;
  18283. void reloadLastURL();
  18284. void checkWindowAssociation();
  18285. WebBrowserComponent (const WebBrowserComponent&);
  18286. const WebBrowserComponent& operator= (const WebBrowserComponent&);
  18287. };
  18288. #endif
  18289. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18290. /********* End of inlined file: juce_WebBrowserComponent.h *********/
  18291. #endif
  18292. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18293. #endif
  18294. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18295. #endif
  18296. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18297. /********* Start of inlined file: juce_DialogWindow.h *********/
  18298. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18299. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18300. class JUCE_API DialogWindow : public DocumentWindow
  18301. {
  18302. public:
  18303. DialogWindow (const String& name,
  18304. const Colour& backgroundColour,
  18305. const bool escapeKeyTriggersCloseButton,
  18306. const bool addToDesktop = true);
  18307. ~DialogWindow();
  18308. static int showModalDialog (const String& dialogTitle,
  18309. Component* contentComponent,
  18310. Component* componentToCentreAround,
  18311. const Colour& backgroundColour,
  18312. const bool escapeKeyTriggersCloseButton,
  18313. const bool shouldBeResizable = false,
  18314. const bool useBottomRightCornerResizer = false);
  18315. juce_UseDebuggingNewOperator
  18316. protected:
  18317. void resized();
  18318. private:
  18319. bool escapeKeyTriggersCloseButton;
  18320. DialogWindow (const DialogWindow&);
  18321. const DialogWindow& operator= (const DialogWindow&);
  18322. };
  18323. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18324. /********* End of inlined file: juce_DialogWindow.h *********/
  18325. #endif
  18326. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18327. #endif
  18328. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18329. #endif
  18330. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18331. /********* Start of inlined file: juce_SplashScreen.h *********/
  18332. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18333. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18334. class JUCE_API SplashScreen : public Component,
  18335. public Timer,
  18336. private DeletedAtShutdown
  18337. {
  18338. public:
  18339. SplashScreen();
  18340. ~SplashScreen();
  18341. void show (const String& title,
  18342. Image* const backgroundImage,
  18343. const int minimumTimeToDisplayFor,
  18344. const bool useDropShadow,
  18345. const bool removeOnMouseClick = true);
  18346. void show (const String& title,
  18347. const int width,
  18348. const int height,
  18349. const int minimumTimeToDisplayFor,
  18350. const bool useDropShadow,
  18351. const bool removeOnMouseClick = true);
  18352. void paint (Graphics& g);
  18353. void timerCallback();
  18354. juce_UseDebuggingNewOperator
  18355. private:
  18356. Image* backgroundImage;
  18357. Time earliestTimeToDelete;
  18358. int originalClickCounter;
  18359. SplashScreen (const SplashScreen&);
  18360. const SplashScreen& operator= (const SplashScreen&);
  18361. };
  18362. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18363. /********* End of inlined file: juce_SplashScreen.h *********/
  18364. #endif
  18365. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18366. /********* Start of inlined file: juce_ThreadWithProgressWindow.h *********/
  18367. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18368. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18369. class JUCE_API ThreadWithProgressWindow : public Thread,
  18370. private Timer
  18371. {
  18372. public:
  18373. ThreadWithProgressWindow (const String& windowTitle,
  18374. const bool hasProgressBar,
  18375. const bool hasCancelButton,
  18376. const int timeOutMsWhenCancelling = 10000,
  18377. const String& cancelButtonText = JUCE_T("Cancel"));
  18378. ~ThreadWithProgressWindow();
  18379. bool runThread (const int threadPriority = 5);
  18380. void setProgress (const double newProgress);
  18381. void setStatusMessage (const String& newStatusMessage);
  18382. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18383. juce_UseDebuggingNewOperator
  18384. private:
  18385. void timerCallback();
  18386. double progress;
  18387. ScopedPointer <AlertWindow> alertWindow;
  18388. String message;
  18389. CriticalSection messageLock;
  18390. const int timeOutMsWhenCancelling;
  18391. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18392. const ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18393. };
  18394. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18395. /********* End of inlined file: juce_ThreadWithProgressWindow.h *********/
  18396. #endif
  18397. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18398. #endif
  18399. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18400. #endif
  18401. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18402. #endif
  18403. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18404. #endif
  18405. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18406. #endif
  18407. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18408. #endif
  18409. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18410. #endif
  18411. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18412. #endif
  18413. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18414. #endif
  18415. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18416. #endif
  18417. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18418. /********* Start of inlined file: juce_LowLevelGraphicsContext.h *********/
  18419. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18420. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18421. class JUCE_API LowLevelGraphicsContext
  18422. {
  18423. protected:
  18424. LowLevelGraphicsContext();
  18425. public:
  18426. virtual ~LowLevelGraphicsContext();
  18427. virtual bool isVectorDevice() const = 0;
  18428. virtual void setOrigin (int x, int y) = 0;
  18429. virtual bool clipToRectangle (const Rectangle& r) = 0;
  18430. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18431. virtual void excludeClipRectangle (const Rectangle& r) = 0;
  18432. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18433. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform) = 0;
  18434. virtual bool clipRegionIntersects (const Rectangle& r) = 0;
  18435. virtual const Rectangle getClipBounds() const = 0;
  18436. virtual bool isClipEmpty() const = 0;
  18437. virtual void saveState() = 0;
  18438. virtual void restoreState() = 0;
  18439. virtual void setFill (const FillType& fillType) = 0;
  18440. virtual void setOpacity (float newOpacity) = 0;
  18441. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18442. virtual void fillRect (const Rectangle& r, const bool replaceExistingContents) = 0;
  18443. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18444. virtual void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18445. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18446. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18447. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18448. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18449. virtual void setFont (const Font& newFont) = 0;
  18450. virtual const Font getFont() = 0;
  18451. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18452. };
  18453. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18454. /********* End of inlined file: juce_LowLevelGraphicsContext.h *********/
  18455. #endif
  18456. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18457. /********* Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h *********/
  18458. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18459. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18460. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18461. {
  18462. public:
  18463. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18464. const String& documentTitle,
  18465. const int totalWidth,
  18466. const int totalHeight);
  18467. ~LowLevelGraphicsPostScriptRenderer();
  18468. bool isVectorDevice() const;
  18469. void setOrigin (int x, int y);
  18470. bool clipToRectangle (const Rectangle& r);
  18471. bool clipToRectangleList (const RectangleList& clipRegion);
  18472. void excludeClipRectangle (const Rectangle& r);
  18473. void clipToPath (const Path& path, const AffineTransform& transform);
  18474. void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform);
  18475. void saveState();
  18476. void restoreState();
  18477. bool clipRegionIntersects (const Rectangle& r);
  18478. const Rectangle getClipBounds() const;
  18479. bool isClipEmpty() const;
  18480. void setFill (const FillType& fillType);
  18481. void setOpacity (float opacity);
  18482. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18483. void fillRect (const Rectangle& r, const bool replaceExistingContents);
  18484. void fillPath (const Path& path, const AffineTransform& transform);
  18485. void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18486. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18487. void drawLine (double x1, double y1, double x2, double y2);
  18488. void drawVerticalLine (const int x, double top, double bottom);
  18489. void drawHorizontalLine (const int x, double top, double bottom);
  18490. const Font getFont();
  18491. void setFont (const Font& newFont);
  18492. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18493. juce_UseDebuggingNewOperator
  18494. protected:
  18495. OutputStream& out;
  18496. int totalWidth, totalHeight;
  18497. bool needToClip;
  18498. Colour lastColour;
  18499. struct SavedState
  18500. {
  18501. SavedState();
  18502. ~SavedState();
  18503. RectangleList clip;
  18504. int xOffset, yOffset;
  18505. FillType fillType;
  18506. Font font;
  18507. private:
  18508. const SavedState& operator= (const SavedState&);
  18509. };
  18510. OwnedArray <SavedState> stateStack;
  18511. void writeClip();
  18512. void writeColour (const Colour& colour);
  18513. void writePath (const Path& path) const;
  18514. void writeXY (const float x, const float y) const;
  18515. void writeTransform (const AffineTransform& trans) const;
  18516. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  18517. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18518. const LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18519. };
  18520. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18521. /********* End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h *********/
  18522. #endif
  18523. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18524. /********* Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h *********/
  18525. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18526. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18527. class LLGCSavedState;
  18528. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18529. {
  18530. public:
  18531. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18532. ~LowLevelGraphicsSoftwareRenderer();
  18533. bool isVectorDevice() const;
  18534. void setOrigin (int x, int y);
  18535. bool clipToRectangle (const Rectangle& r);
  18536. bool clipToRectangleList (const RectangleList& clipRegion);
  18537. void excludeClipRectangle (const Rectangle& r);
  18538. void clipToPath (const Path& path, const AffineTransform& transform);
  18539. void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform);
  18540. bool clipRegionIntersects (const Rectangle& r);
  18541. const Rectangle getClipBounds() const;
  18542. bool isClipEmpty() const;
  18543. void saveState();
  18544. void restoreState();
  18545. void setFill (const FillType& fillType);
  18546. void setOpacity (float opacity);
  18547. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18548. void fillRect (const Rectangle& r, const bool replaceExistingContents);
  18549. void fillPath (const Path& path, const AffineTransform& transform);
  18550. void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18551. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18552. void drawLine (double x1, double y1, double x2, double y2);
  18553. void drawVerticalLine (const int x, double top, double bottom);
  18554. void drawHorizontalLine (const int x, double top, double bottom);
  18555. void setFont (const Font& newFont);
  18556. const Font getFont();
  18557. void drawGlyph (int glyphNumber, float x, float y);
  18558. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18559. juce_UseDebuggingNewOperator
  18560. protected:
  18561. Image& image;
  18562. ScopedPointer <LLGCSavedState> currentState;
  18563. OwnedArray <LLGCSavedState> stateStack;
  18564. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  18565. const LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  18566. };
  18567. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18568. /********* End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h *********/
  18569. #endif
  18570. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  18571. #endif
  18572. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  18573. #endif
  18574. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18575. /********* Start of inlined file: juce_DrawableComposite.h *********/
  18576. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18577. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18578. class JUCE_API DrawableComposite : public Drawable
  18579. {
  18580. public:
  18581. DrawableComposite();
  18582. virtual ~DrawableComposite();
  18583. void insertDrawable (Drawable* drawable,
  18584. const AffineTransform& transform = AffineTransform::identity,
  18585. const int index = -1);
  18586. void insertDrawable (const Drawable& drawable,
  18587. const AffineTransform& transform = AffineTransform::identity,
  18588. const int index = -1);
  18589. void removeDrawable (const int index, const bool deleteDrawable = true);
  18590. int getNumDrawables() const throw() { return drawables.size(); }
  18591. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  18592. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  18593. void bringToFront (const int index);
  18594. void render (const Drawable::RenderingContext& context) const;
  18595. void getBounds (float& x, float& y, float& width, float& height) const;
  18596. bool hitTest (float x, float y) const;
  18597. Drawable* createCopy() const;
  18598. ValueTree createValueTree() const throw();
  18599. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  18600. juce_UseDebuggingNewOperator
  18601. private:
  18602. OwnedArray <Drawable> drawables;
  18603. OwnedArray <AffineTransform> transforms;
  18604. DrawableComposite (const DrawableComposite&);
  18605. const DrawableComposite& operator= (const DrawableComposite&);
  18606. };
  18607. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18608. /********* End of inlined file: juce_DrawableComposite.h *********/
  18609. #endif
  18610. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18611. /********* Start of inlined file: juce_DrawableImage.h *********/
  18612. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18613. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18614. class JUCE_API DrawableImage : public Drawable
  18615. {
  18616. public:
  18617. DrawableImage();
  18618. virtual ~DrawableImage();
  18619. void setImage (const Image& imageToCopy);
  18620. void setImage (Image* imageToUse,
  18621. const bool releaseWhenNotNeeded);
  18622. Image* getImage() const throw() { return image; }
  18623. void clearImage();
  18624. void setOpacity (const float newOpacity);
  18625. float getOpacity() const throw() { return opacity; }
  18626. void setOverlayColour (const Colour& newOverlayColour);
  18627. const Colour& getOverlayColour() const throw() { return overlayColour; }
  18628. void render (const Drawable::RenderingContext& context) const;
  18629. void getBounds (float& x, float& y, float& width, float& height) const;
  18630. bool hitTest (float x, float y) const;
  18631. Drawable* createCopy() const;
  18632. ValueTree createValueTree() const throw();
  18633. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  18634. juce_UseDebuggingNewOperator
  18635. private:
  18636. Image* image;
  18637. bool canDeleteImage;
  18638. float opacity;
  18639. Colour overlayColour;
  18640. DrawableImage (const DrawableImage&);
  18641. const DrawableImage& operator= (const DrawableImage&);
  18642. };
  18643. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18644. /********* End of inlined file: juce_DrawableImage.h *********/
  18645. #endif
  18646. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18647. /********* Start of inlined file: juce_DrawablePath.h *********/
  18648. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18649. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  18650. class JUCE_API DrawablePath : public Drawable
  18651. {
  18652. public:
  18653. DrawablePath();
  18654. virtual ~DrawablePath();
  18655. void setPath (const Path& newPath) throw();
  18656. const Path& getPath() const throw() { return path; }
  18657. void setFill (const FillType& newFill) throw();
  18658. const FillType& getFill() const throw() { return mainFill; }
  18659. void setStrokeFill (const FillType& newStrokeFill) throw();
  18660. const FillType& getStrokeFill() const throw() { return strokeFill; }
  18661. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  18662. void setStrokeThickness (const float newThickness) throw();
  18663. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  18664. void render (const Drawable::RenderingContext& context) const;
  18665. void getBounds (float& x, float& y, float& width, float& height) const;
  18666. bool hitTest (float x, float y) const;
  18667. Drawable* createCopy() const;
  18668. ValueTree createValueTree() const throw();
  18669. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  18670. juce_UseDebuggingNewOperator
  18671. private:
  18672. Path path, stroke;
  18673. FillType mainFill, strokeFill;
  18674. PathStrokeType strokeType;
  18675. void updateOutline();
  18676. DrawablePath (const DrawablePath&);
  18677. const DrawablePath& operator= (const DrawablePath&);
  18678. };
  18679. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  18680. /********* End of inlined file: juce_DrawablePath.h *********/
  18681. #endif
  18682. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18683. /********* Start of inlined file: juce_DrawableText.h *********/
  18684. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18685. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  18686. class JUCE_API DrawableText : public Drawable
  18687. {
  18688. public:
  18689. DrawableText();
  18690. virtual ~DrawableText();
  18691. void setText (const GlyphArrangement& newText);
  18692. void setText (const String& newText, const Font& fontToUse);
  18693. const GlyphArrangement& getText() const throw() { return text; }
  18694. void setColour (const Colour& newColour);
  18695. const Colour& getColour() const throw() { return colour; }
  18696. void render (const Drawable::RenderingContext& context) const;
  18697. void getBounds (float& x, float& y, float& width, float& height) const;
  18698. bool hitTest (float x, float y) const;
  18699. Drawable* createCopy() const;
  18700. ValueTree createValueTree() const throw();
  18701. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  18702. juce_UseDebuggingNewOperator
  18703. private:
  18704. GlyphArrangement text;
  18705. Colour colour;
  18706. DrawableText (const DrawableText&);
  18707. const DrawableText& operator= (const DrawableText&);
  18708. };
  18709. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  18710. /********* End of inlined file: juce_DrawableText.h *********/
  18711. #endif
  18712. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  18713. #endif
  18714. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18715. /********* Start of inlined file: juce_GlowEffect.h *********/
  18716. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18717. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  18718. class JUCE_API GlowEffect : public ImageEffectFilter
  18719. {
  18720. public:
  18721. GlowEffect();
  18722. ~GlowEffect();
  18723. void setGlowProperties (const float newRadius,
  18724. const Colour& newColour);
  18725. void applyEffect (Image& sourceImage, Graphics& destContext);
  18726. juce_UseDebuggingNewOperator
  18727. private:
  18728. float radius;
  18729. Colour colour;
  18730. };
  18731. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  18732. /********* End of inlined file: juce_GlowEffect.h *********/
  18733. #endif
  18734. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  18735. #endif
  18736. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18737. /********* Start of inlined file: juce_ReduceOpacityEffect.h *********/
  18738. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18739. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18740. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  18741. {
  18742. public:
  18743. ReduceOpacityEffect (const float opacity = 1.0f);
  18744. ~ReduceOpacityEffect();
  18745. void setOpacity (const float newOpacity);
  18746. void applyEffect (Image& sourceImage, Graphics& destContext);
  18747. juce_UseDebuggingNewOperator
  18748. private:
  18749. float opacity;
  18750. };
  18751. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18752. /********* End of inlined file: juce_ReduceOpacityEffect.h *********/
  18753. #endif
  18754. #ifndef __JUCE_FONT_JUCEHEADER__
  18755. #endif
  18756. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  18757. #endif
  18758. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  18759. #endif
  18760. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  18761. #endif
  18762. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  18763. #endif
  18764. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  18765. #endif
  18766. #ifndef __JUCE_LINE_JUCEHEADER__
  18767. #endif
  18768. #ifndef __JUCE_PATH_JUCEHEADER__
  18769. #endif
  18770. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  18771. /********* Start of inlined file: juce_PathIterator.h *********/
  18772. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  18773. #define __JUCE_PATHITERATOR_JUCEHEADER__
  18774. class JUCE_API PathFlatteningIterator
  18775. {
  18776. public:
  18777. PathFlatteningIterator (const Path& path,
  18778. const AffineTransform& transform = AffineTransform::identity,
  18779. float tolerence = 6.0f) throw();
  18780. ~PathFlatteningIterator() throw();
  18781. bool next() throw();
  18782. float x1;
  18783. float y1;
  18784. float x2;
  18785. float y2;
  18786. bool closesSubPath;
  18787. int subPathIndex;
  18788. bool isLastInSubpath() const { return stackPos == stackBase
  18789. && (index >= path.numElements
  18790. || points [index] == Path::moveMarker); }
  18791. juce_UseDebuggingNewOperator
  18792. private:
  18793. const Path& path;
  18794. const AffineTransform transform;
  18795. float* points;
  18796. float tolerence, subPathCloseX, subPathCloseY;
  18797. bool isIdentityTransform;
  18798. HeapBlock <float> stackBase;
  18799. float* stackPos;
  18800. int index, stackSize;
  18801. PathFlatteningIterator (const PathFlatteningIterator&);
  18802. const PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  18803. };
  18804. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  18805. /********* End of inlined file: juce_PathIterator.h *********/
  18806. #endif
  18807. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  18808. #endif
  18809. #ifndef __JUCE_POINT_JUCEHEADER__
  18810. #endif
  18811. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18812. /********* Start of inlined file: juce_PositionedRectangle.h *********/
  18813. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18814. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18815. class JUCE_API PositionedRectangle
  18816. {
  18817. public:
  18818. PositionedRectangle() throw();
  18819. PositionedRectangle (const String& stringVersion) throw();
  18820. PositionedRectangle (const PositionedRectangle& other) throw();
  18821. const PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  18822. ~PositionedRectangle() throw();
  18823. const String toString() const throw();
  18824. const Rectangle getRectangle (const Rectangle& targetSpaceToBeRelativeTo) const throw();
  18825. void getRectangleDouble (const Rectangle& targetSpaceToBeRelativeTo,
  18826. double& x,
  18827. double& y,
  18828. double& width,
  18829. double& height) const throw();
  18830. void applyToComponent (Component& comp) const throw();
  18831. void updateFrom (const Rectangle& newPosition,
  18832. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18833. void updateFromDouble (const double x, const double y,
  18834. const double width, const double height,
  18835. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18836. void updateFromComponent (const Component& comp) throw();
  18837. enum AnchorPoint
  18838. {
  18839. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  18840. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  18841. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  18842. };
  18843. enum PositionMode
  18844. {
  18845. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  18846. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  18847. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  18848. 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. */
  18849. };
  18850. enum SizeMode
  18851. {
  18852. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  18853. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  18854. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  18855. };
  18856. void setModes (const AnchorPoint xAnchorMode,
  18857. const PositionMode xPositionMode,
  18858. const AnchorPoint yAnchorMode,
  18859. const PositionMode yPositionMode,
  18860. const SizeMode widthMode,
  18861. const SizeMode heightMode,
  18862. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18863. AnchorPoint getAnchorPointX() const throw();
  18864. PositionMode getPositionModeX() const throw();
  18865. double getX() const throw() { return x; }
  18866. void setX (const double newX) throw() { x = newX; }
  18867. AnchorPoint getAnchorPointY() const throw();
  18868. PositionMode getPositionModeY() const throw();
  18869. double getY() const throw() { return y; }
  18870. void setY (const double newY) throw() { y = newY; }
  18871. SizeMode getWidthMode() const throw();
  18872. double getWidth() const throw() { return w; }
  18873. void setWidth (const double newWidth) throw() { w = newWidth; }
  18874. SizeMode getHeightMode() const throw();
  18875. double getHeight() const throw() { return h; }
  18876. void setHeight (const double newHeight) throw() { h = newHeight; }
  18877. bool isPositionAbsolute() const throw();
  18878. const bool operator== (const PositionedRectangle& other) const throw();
  18879. const bool operator!= (const PositionedRectangle& other) const throw();
  18880. juce_UseDebuggingNewOperator
  18881. private:
  18882. double x, y, w, h;
  18883. uint8 xMode, yMode, wMode, hMode;
  18884. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  18885. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  18886. void decodePosString (const String& s, uint8& mode, double& value) throw();
  18887. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  18888. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  18889. const uint8 xMode, const uint8 wMode,
  18890. const int parentPos, const int parentSize) const throw();
  18891. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  18892. const uint8 xMode, const uint8 wMode,
  18893. const int parentPos, const int parentSize) const throw();
  18894. };
  18895. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18896. /********* End of inlined file: juce_PositionedRectangle.h *********/
  18897. #endif
  18898. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  18899. #endif
  18900. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  18901. #endif
  18902. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  18903. /********* Start of inlined file: juce_CameraDevice.h *********/
  18904. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  18905. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  18906. #if JUCE_USE_CAMERA
  18907. class CameraImageListener
  18908. {
  18909. public:
  18910. CameraImageListener() {}
  18911. virtual ~CameraImageListener() {}
  18912. virtual void imageReceived (Image& image) = 0;
  18913. };
  18914. class JUCE_API CameraDevice
  18915. {
  18916. public:
  18917. virtual ~CameraDevice();
  18918. static const StringArray getAvailableDevices();
  18919. static CameraDevice* openDevice (int deviceIndex,
  18920. int minWidth = 128, int minHeight = 64,
  18921. int maxWidth = 1024, int maxHeight = 768);
  18922. const String getName() const { return name; }
  18923. Component* createViewerComponent();
  18924. void startRecordingToFile (const File& file);
  18925. void stopRecording();
  18926. static const String getFileExtension();
  18927. const Time getTimeOfFirstRecordedFrame() const;
  18928. void addListener (CameraImageListener* listenerToAdd);
  18929. void removeListener (CameraImageListener* listenerToRemove);
  18930. juce_UseDebuggingNewOperator
  18931. protected:
  18932. CameraDevice (const String& name, int index);
  18933. private:
  18934. void* internal;
  18935. bool isRecording;
  18936. String name;
  18937. CameraDevice (const CameraDevice&);
  18938. const CameraDevice& operator= (const CameraDevice&);
  18939. };
  18940. #endif
  18941. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  18942. /********* End of inlined file: juce_CameraDevice.h *********/
  18943. #endif
  18944. #ifndef __JUCE_IMAGE_JUCEHEADER__
  18945. #endif
  18946. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  18947. /********* Start of inlined file: juce_ImageCache.h *********/
  18948. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  18949. #define __JUCE_IMAGECACHE_JUCEHEADER__
  18950. struct ImageCacheItem;
  18951. class JUCE_API ImageCache : private DeletedAtShutdown,
  18952. private Timer
  18953. {
  18954. public:
  18955. static Image* getFromFile (const File& file);
  18956. static Image* getFromMemory (const void* imageData,
  18957. const int dataSize);
  18958. static void release (Image* const imageToRelease);
  18959. static void releaseOrDelete (Image* const imageToRelease);
  18960. static bool isImageInCache (Image* const imageToLookFor);
  18961. static void incReferenceCount (Image* const image);
  18962. static Image* getFromHashCode (const int64 hashCode);
  18963. static void addImageToCache (Image* const image,
  18964. const int64 hashCode);
  18965. static void setCacheTimeout (const int millisecs);
  18966. juce_UseDebuggingNewOperator
  18967. private:
  18968. CriticalSection lock;
  18969. OwnedArray <ImageCacheItem> images;
  18970. ImageCache();
  18971. ImageCache (const ImageCache&);
  18972. const ImageCache& operator= (const ImageCache&);
  18973. ~ImageCache();
  18974. void timerCallback();
  18975. };
  18976. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  18977. /********* End of inlined file: juce_ImageCache.h *********/
  18978. #endif
  18979. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  18980. /********* Start of inlined file: juce_ImageConvolutionKernel.h *********/
  18981. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  18982. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  18983. class JUCE_API ImageConvolutionKernel
  18984. {
  18985. public:
  18986. ImageConvolutionKernel (const int size);
  18987. ~ImageConvolutionKernel();
  18988. void clear();
  18989. void setKernelValue (const int x,
  18990. const int y,
  18991. const float value);
  18992. void setOverallSum (const float desiredTotalSum);
  18993. void rescaleAllValues (const float multiplier);
  18994. void createGaussianBlur (const float blurRadius);
  18995. int getKernelSize() const { return size; }
  18996. float** getValues() const { return values; }
  18997. void applyToImage (Image& destImage,
  18998. const Image* sourceImage,
  18999. int x,
  19000. int y,
  19001. int width,
  19002. int height) const;
  19003. juce_UseDebuggingNewOperator
  19004. private:
  19005. HeapBlock <float> values;
  19006. const int size;
  19007. // no reason not to implement these one day..
  19008. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19009. const ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19010. };
  19011. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19012. /********* End of inlined file: juce_ImageConvolutionKernel.h *********/
  19013. #endif
  19014. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19015. /********* Start of inlined file: juce_ImageFileFormat.h *********/
  19016. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19017. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19018. class JUCE_API ImageFileFormat
  19019. {
  19020. protected:
  19021. ImageFileFormat() {}
  19022. public:
  19023. virtual ~ImageFileFormat() {}
  19024. virtual const String getFormatName() = 0;
  19025. virtual bool canUnderstand (InputStream& input) = 0;
  19026. virtual Image* decodeImage (InputStream& input) = 0;
  19027. virtual bool writeImageToStream (const Image& sourceImage,
  19028. OutputStream& destStream) = 0;
  19029. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19030. static Image* loadFrom (InputStream& input);
  19031. static Image* loadFrom (const File& file);
  19032. static Image* loadFrom (const void* rawData,
  19033. const int numBytesOfData);
  19034. };
  19035. class JUCE_API PNGImageFormat : public ImageFileFormat
  19036. {
  19037. public:
  19038. PNGImageFormat();
  19039. ~PNGImageFormat();
  19040. const String getFormatName();
  19041. bool canUnderstand (InputStream& input);
  19042. Image* decodeImage (InputStream& input);
  19043. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19044. };
  19045. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19046. {
  19047. public:
  19048. JPEGImageFormat();
  19049. ~JPEGImageFormat();
  19050. void setQuality (const float newQuality);
  19051. const String getFormatName();
  19052. bool canUnderstand (InputStream& input);
  19053. Image* decodeImage (InputStream& input);
  19054. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19055. private:
  19056. float quality;
  19057. };
  19058. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19059. /********* End of inlined file: juce_ImageFileFormat.h *********/
  19060. #endif
  19061. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19062. #endif
  19063. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19064. /********* Start of inlined file: juce_FileBasedDocument.h *********/
  19065. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19066. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19067. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19068. {
  19069. public:
  19070. FileBasedDocument (const String& fileExtension,
  19071. const String& fileWildCard,
  19072. const String& openFileDialogTitle,
  19073. const String& saveFileDialogTitle);
  19074. virtual ~FileBasedDocument();
  19075. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19076. virtual void changed();
  19077. void setChangedFlag (const bool hasChanged);
  19078. bool loadFrom (const File& fileToLoadFrom,
  19079. const bool showMessageOnFailure);
  19080. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19081. enum SaveResult
  19082. {
  19083. savedOk = 0, /**< indicates that a file was saved successfully. */
  19084. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19085. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19086. };
  19087. SaveResult save (const bool askUserForFileIfNotSpecified,
  19088. const bool showMessageOnFailure);
  19089. SaveResult saveIfNeededAndUserAgrees();
  19090. SaveResult saveAs (const File& newFile,
  19091. const bool warnAboutOverwritingExistingFiles,
  19092. const bool askUserForFileIfNotSpecified,
  19093. const bool showMessageOnFailure);
  19094. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19095. const File getFile() const { return documentFile; }
  19096. void setFile (const File& newFile);
  19097. protected:
  19098. virtual const String getDocumentTitle() = 0;
  19099. virtual const String loadDocument (const File& file) = 0;
  19100. virtual const String saveDocument (const File& file) = 0;
  19101. virtual const File getLastDocumentOpened() = 0;
  19102. virtual void setLastDocumentOpened (const File& file) = 0;
  19103. public:
  19104. juce_UseDebuggingNewOperator
  19105. private:
  19106. File documentFile;
  19107. bool changedSinceSave;
  19108. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19109. FileBasedDocument (const FileBasedDocument&);
  19110. const FileBasedDocument& operator= (const FileBasedDocument&);
  19111. };
  19112. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19113. /********* End of inlined file: juce_FileBasedDocument.h *********/
  19114. #endif
  19115. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19116. #endif
  19117. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19118. /********* Start of inlined file: juce_RecentlyOpenedFilesList.h *********/
  19119. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19120. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19121. class JUCE_API RecentlyOpenedFilesList
  19122. {
  19123. public:
  19124. RecentlyOpenedFilesList();
  19125. ~RecentlyOpenedFilesList();
  19126. void setMaxNumberOfItems (const int newMaxNumber);
  19127. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19128. int getNumFiles() const;
  19129. const File getFile (const int index) const;
  19130. const StringArray& getAllFilenames() const throw() { return files; }
  19131. void clear();
  19132. void addFile (const File& file);
  19133. void removeNonExistentFiles();
  19134. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19135. const int baseItemId,
  19136. const bool showFullPaths,
  19137. const bool dontAddNonExistentFiles,
  19138. const File** filesToAvoid = 0);
  19139. const String toString() const;
  19140. void restoreFromString (const String& stringifiedVersion);
  19141. juce_UseDebuggingNewOperator
  19142. private:
  19143. StringArray files;
  19144. int maxNumberOfItems;
  19145. };
  19146. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19147. /********* End of inlined file: juce_RecentlyOpenedFilesList.h *********/
  19148. #endif
  19149. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19150. #endif
  19151. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19152. /********* Start of inlined file: juce_SystemClipboard.h *********/
  19153. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19154. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19155. class JUCE_API SystemClipboard
  19156. {
  19157. public:
  19158. static void copyTextToClipboard (const String& text) throw();
  19159. static const String getTextFromClipboard() throw();
  19160. };
  19161. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19162. /********* End of inlined file: juce_SystemClipboard.h *********/
  19163. #endif
  19164. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19165. #endif
  19166. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19167. #endif
  19168. #endif
  19169. /********* End of inlined file: juce_app_includes.h *********/
  19170. #endif
  19171. #if JUCE_MSVC
  19172. #pragma warning (pop)
  19173. #pragma pack (pop)
  19174. #endif
  19175. END_JUCE_NAMESPACE
  19176. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19177. #ifdef JUCE_NAMESPACE
  19178. // this will obviously save a lot of typing, but can be disabled by
  19179. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19180. using namespace JUCE_NAMESPACE;
  19181. #if JUCE_MAC && ! JUCE_DONT_DEFINE_MACROS
  19182. #define Component JUCE_NAMESPACE::Component
  19183. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19184. #define Point JUCE_NAMESPACE::Point
  19185. #define Button JUCE_NAMESPACE::Button
  19186. #endif
  19187. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19188. #define Rectangle JUCE_NAMESPACE::Rectangle
  19189. #endif
  19190. #endif
  19191. #endif
  19192. #if JUCE_MSVC
  19193. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19194. #ifdef JUCE_DLL
  19195. #ifdef JUCE_DEBUG
  19196. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19197. #else
  19198. #define AUTOLINKEDLIB "JUCE.lib"
  19199. #endif
  19200. #else
  19201. #ifdef JUCE_DEBUG
  19202. #ifdef _WIN64
  19203. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19204. #else
  19205. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19206. #endif
  19207. #else
  19208. #ifdef _WIN64
  19209. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19210. #else
  19211. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19212. #endif
  19213. #endif
  19214. #endif
  19215. #pragma comment(lib, AUTOLINKEDLIB)
  19216. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19217. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19218. #endif
  19219. // Auto-link the other win32 libs that are needed by library calls..
  19220. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19221. /********* Start of inlined file: juce_win32_AutoLinkLibraries.h *********/
  19222. // Auto-links to various win32 libs that are needed by library calls..
  19223. #pragma comment(lib, "kernel32.lib")
  19224. #pragma comment(lib, "user32.lib")
  19225. #pragma comment(lib, "shell32.lib")
  19226. #pragma comment(lib, "gdi32.lib")
  19227. #pragma comment(lib, "vfw32.lib")
  19228. #pragma comment(lib, "comdlg32.lib")
  19229. #pragma comment(lib, "winmm.lib")
  19230. #pragma comment(lib, "wininet.lib")
  19231. #pragma comment(lib, "ole32.lib")
  19232. #pragma comment(lib, "oleaut32.lib")
  19233. #pragma comment(lib, "advapi32.lib")
  19234. #pragma comment(lib, "ws2_32.lib")
  19235. #pragma comment(lib, "comsupp.lib")
  19236. #pragma comment(lib, "version.lib")
  19237. #if JUCE_OPENGL
  19238. #pragma comment(lib, "OpenGL32.Lib")
  19239. #pragma comment(lib, "GlU32.Lib")
  19240. #endif
  19241. #if JUCE_QUICKTIME
  19242. #pragma comment (lib, "QTMLClient.lib")
  19243. #endif
  19244. #if JUCE_USE_CAMERA
  19245. #pragma comment (lib, "Strmiids.lib")
  19246. #endif
  19247. /********* End of inlined file: juce_win32_AutoLinkLibraries.h *********/
  19248. #endif
  19249. #endif
  19250. #endif
  19251. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19252. #define START_JUCE_APPLICATION(AppClass) \
  19253. int main (int argc, char* argv[]) \
  19254. { \
  19255. return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
  19256. }
  19257. #elif JUCE_WINDOWS
  19258. #ifdef _CONSOLE
  19259. #define START_JUCE_APPLICATION(AppClass) \
  19260. int main (int, char* argv[]) \
  19261. { \
  19262. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19263. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19264. }
  19265. #elif ! defined (_AFXDLL)
  19266. #ifdef _WINDOWS_
  19267. #define START_JUCE_APPLICATION(AppClass) \
  19268. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19269. { \
  19270. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19271. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19272. }
  19273. #else
  19274. #define START_JUCE_APPLICATION(AppClass) \
  19275. int __stdcall WinMain (int, int, const char*, int) \
  19276. { \
  19277. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19278. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19279. }
  19280. #endif
  19281. #endif
  19282. #endif
  19283. #endif // __JUCE_JUCEHEADER__
  19284. /********* End of inlined file: juce.h *********/
  19285. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__