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.

27761 lines
722KB

  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 50
  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 <cmath>
  358. #include <cwchar>
  359. #include <stdexcept>
  360. #include <typeinfo>
  361. #include <cstring>
  362. #include <cstdio>
  363. #include <iostream>
  364. #if JUCE_USE_INTRINSICS
  365. #include <intrin.h>
  366. #endif
  367. #if JUCE_MAC
  368. #include <libkern/OSAtomic.h>
  369. #endif
  370. #if JUCE_LINUX
  371. #include <signal.h>
  372. #endif
  373. #if JUCE_MSVC && JUCE_DEBUG
  374. #include <crtdbg.h>
  375. #endif
  376. #if JUCE_MSVC
  377. #include <malloc.h>
  378. #pragma warning (pop)
  379. #if ! JUCE_PUBLIC_INCLUDES
  380. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  381. #endif
  382. #endif
  383. // DLL building settings on Win32
  384. #if JUCE_MSVC
  385. #ifdef JUCE_DLL_BUILD
  386. #define JUCE_API __declspec (dllexport)
  387. #pragma warning (disable: 4251)
  388. #elif defined (JUCE_DLL)
  389. #define JUCE_API __declspec (dllimport)
  390. #pragma warning (disable: 4251)
  391. #endif
  392. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  393. #ifdef JUCE_DLL_BUILD
  394. #define JUCE_API __attribute__ ((visibility("default")))
  395. #endif
  396. #endif
  397. #ifndef JUCE_API
  398. #define JUCE_API
  399. #endif
  400. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  401. // Now include some basics that are needed by most of the Juce classes...
  402. BEGIN_JUCE_NAMESPACE
  403. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  404. #if JUCE_LOG_ASSERTIONS
  405. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  406. #endif
  407. /********* Start of inlined file: juce_Memory.h *********/
  408. #ifndef __JUCE_MEMORY_JUCEHEADER__
  409. #define __JUCE_MEMORY_JUCEHEADER__
  410. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  411. #ifndef JUCE_DLL
  412. // Win32 debug non-DLL versions..
  413. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  414. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  415. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  416. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  417. #else
  418. // Win32 debug DLL versions..
  419. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  420. // way all juce calls in the DLL and in the host API will all use the same allocator.
  421. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  422. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  423. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  424. extern JUCE_API void juce_DebugFree (void* const block);
  425. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  426. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  427. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  428. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  429. #endif
  430. #if ! defined (_AFXDLL)
  431. #define juce_UseDebuggingNewOperator \
  432. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  433. static void* operator new (size_t, void* p) { return p; } \
  434. static void operator delete (void* p) { juce_free (p); } \
  435. static void operator delete (void*, void*) { }
  436. #endif
  437. #elif defined (JUCE_DLL)
  438. // Win32 DLL (release) versions..
  439. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  440. // way all juce calls in the DLL and in the host API will all use the same allocator.
  441. extern JUCE_API void* juce_Malloc (const int size);
  442. extern JUCE_API void* juce_Calloc (const int size);
  443. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  444. extern JUCE_API void juce_Free (void* const block);
  445. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  446. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  447. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  448. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  449. #define juce_UseDebuggingNewOperator \
  450. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  451. static void* operator new (size_t, void* p) { return p; } \
  452. static void operator delete (void* p) { juce_free (p); } \
  453. static void operator delete (void*, void*) { }
  454. #else
  455. // Mac, Linux and Win32 (release) versions..
  456. #define juce_malloc(numBytes) malloc (numBytes)
  457. #define juce_calloc(numBytes) calloc (1, numBytes)
  458. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  459. #define juce_free(location) free (location)
  460. #endif
  461. #ifndef juce_UseDebuggingNewOperator
  462. #define juce_UseDebuggingNewOperator
  463. #endif
  464. #if JUCE_MSVC
  465. #define juce_ThreadLocal __declspec(thread)
  466. #else
  467. #define juce_ThreadLocal __thread
  468. #endif
  469. #if JUCE_MINGW
  470. #define alloca __builtin_alloca
  471. #endif
  472. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  473. template <typename Type>
  474. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  475. template <typename Type>
  476. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  477. #endif // __JUCE_MEMORY_JUCEHEADER__
  478. /********* End of inlined file: juce_Memory.h *********/
  479. /********* Start of inlined file: juce_MathsFunctions.h *********/
  480. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  481. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  482. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  483. typedef signed char int8;
  484. typedef unsigned char uint8;
  485. typedef signed short int16;
  486. typedef unsigned short uint16;
  487. typedef signed int int32;
  488. typedef unsigned int uint32;
  489. #if JUCE_MSVC
  490. typedef __int64 int64;
  491. typedef unsigned __int64 uint64;
  492. #define literal64bit(longLiteral) ((__int64) longLiteral)
  493. #else
  494. typedef long long int64;
  495. typedef unsigned long long uint64;
  496. #define literal64bit(longLiteral) (longLiteral##LL)
  497. #endif
  498. #if JUCE_64BIT
  499. typedef int64 pointer_sized_int;
  500. typedef uint64 pointer_sized_uint;
  501. #elif _MSC_VER >= 1300
  502. typedef _W64 int pointer_sized_int;
  503. typedef _W64 unsigned int pointer_sized_uint;
  504. #else
  505. typedef int pointer_sized_int;
  506. typedef unsigned int pointer_sized_uint;
  507. #endif
  508. typedef wchar_t juce_wchar;
  509. // Some indispensible min/max functions
  510. template <typename Type>
  511. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  512. template <typename Type>
  513. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  514. template <typename Type>
  515. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  516. template <typename Type>
  517. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  518. template <typename Type>
  519. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  520. template <typename Type>
  521. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  522. template <typename Type>
  523. inline Type jlimit (const Type lowerLimit,
  524. const Type upperLimit,
  525. const Type valueToConstrain) throw()
  526. {
  527. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  528. return (valueToConstrain < lowerLimit) ? lowerLimit
  529. : ((valueToConstrain > upperLimit) ? upperLimit
  530. : valueToConstrain);
  531. }
  532. template <typename Type>
  533. inline void swapVariables (Type& variable1, Type& variable2)
  534. {
  535. const Type tempVal = variable1;
  536. variable1 = variable2;
  537. variable2 = tempVal;
  538. }
  539. template <typename Type>
  540. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  541. // Some useful maths functions that aren't always present with all compilers and build settings.
  542. inline double juce_hypot (double a, double b)
  543. {
  544. #if JUCE_WINDOWS
  545. return _hypot (a, b);
  546. #else
  547. return hypot (a, b);
  548. #endif
  549. }
  550. inline float juce_hypotf (float a, float b)
  551. {
  552. #if JUCE_WINDOWS
  553. return (float) _hypot (a, b);
  554. #else
  555. return hypotf (a, b);
  556. #endif
  557. }
  558. inline int64 abs64 (const int64 n)
  559. {
  560. return (n >= 0) ? n : -n;
  561. }
  562. const double double_Pi = 3.1415926535897932384626433832795;
  563. const float float_Pi = 3.14159265358979323846f;
  564. template <typename FloatingPointType>
  565. inline bool juce_isfinite (FloatingPointType value)
  566. {
  567. #if JUCE_WINDOWS
  568. return _finite (value);
  569. #else
  570. return std::isfinite (value);
  571. #endif
  572. }
  573. template <typename FloatType>
  574. inline int roundToInt (const FloatType value) throw()
  575. {
  576. union { int asInt[2]; double asDouble; } n;
  577. n.asDouble = ((double) value) + 6755399441055744.0;
  578. #if JUCE_BIG_ENDIAN
  579. return n.asInt [1];
  580. #else
  581. return n.asInt [0];
  582. #endif
  583. }
  584. inline int roundToIntAccurate (const double value) throw()
  585. {
  586. return roundToInt (value + 1.5e-8);
  587. }
  588. inline int roundDoubleToInt (const double value) throw()
  589. {
  590. return roundToInt (value);
  591. }
  592. inline int roundFloatToInt (const float value) throw()
  593. {
  594. return roundToInt (value);
  595. }
  596. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  597. /********* End of inlined file: juce_MathsFunctions.h *********/
  598. /********* Start of inlined file: juce_ByteOrder.h *********/
  599. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  600. #define __JUCE_BYTEORDER_JUCEHEADER__
  601. class JUCE_API ByteOrder
  602. {
  603. public:
  604. static uint16 swap (uint16 value);
  605. static uint32 swap (uint32 value);
  606. static uint64 swap (uint64 value);
  607. static uint16 swapIfBigEndian (const uint16 value);
  608. static uint32 swapIfBigEndian (const uint32 value);
  609. static uint64 swapIfBigEndian (const uint64 value);
  610. static uint16 swapIfLittleEndian (const uint16 value);
  611. static uint32 swapIfLittleEndian (const uint32 value);
  612. static uint64 swapIfLittleEndian (const uint64 value);
  613. static uint32 littleEndianInt (const char* const bytes);
  614. static uint16 littleEndianShort (const char* const bytes);
  615. static uint32 bigEndianInt (const char* const bytes);
  616. static uint16 bigEndianShort (const char* const bytes);
  617. static int littleEndian24Bit (const char* const bytes);
  618. static int bigEndian24Bit (const char* const bytes);
  619. static void littleEndian24BitToChars (const int value, char* const destBytes);
  620. static void bigEndian24BitToChars (const int value, char* const destBytes);
  621. static bool isBigEndian();
  622. };
  623. #if JUCE_USE_INTRINSICS
  624. #pragma intrinsic (_byteswap_ulong)
  625. #endif
  626. inline uint16 ByteOrder::swap (uint16 n)
  627. {
  628. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  629. return (uint16) _byteswap_ushort (n);
  630. #else
  631. return (uint16) ((n << 8) | (n >> 8));
  632. #endif
  633. }
  634. inline uint32 ByteOrder::swap (uint32 n)
  635. {
  636. #if JUCE_MAC || JUCE_IPHONE
  637. return OSSwapInt32 (n);
  638. #elif JUCE_GCC
  639. asm("bswap %%eax" : "=a"(n) : "a"(n));
  640. return n;
  641. #elif JUCE_USE_INTRINSICS
  642. return _byteswap_ulong (n);
  643. #else
  644. __asm {
  645. mov eax, n
  646. bswap eax
  647. mov n, eax
  648. }
  649. return n;
  650. #endif
  651. }
  652. inline uint64 ByteOrder::swap (uint64 value)
  653. {
  654. #if JUCE_MAC || JUCE_IPHONE
  655. return OSSwapInt64 (value);
  656. #elif JUCE_USE_INTRINSICS
  657. return _byteswap_uint64 (value);
  658. #else
  659. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  660. #endif
  661. }
  662. #if JUCE_LITTLE_ENDIAN
  663. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  664. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  665. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  666. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  667. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  668. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  669. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  670. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  671. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  672. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  673. inline bool ByteOrder::isBigEndian() { return false; }
  674. #else
  675. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  676. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  677. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  678. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  679. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  680. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  681. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  682. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  683. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  684. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  685. inline bool ByteOrder::isBigEndian() { return true; }
  686. #endif
  687. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  688. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  689. 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); }
  690. 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); }
  691. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  692. /********* End of inlined file: juce_ByteOrder.h *********/
  693. /********* Start of inlined file: juce_Logger.h *********/
  694. #ifndef __JUCE_LOGGER_JUCEHEADER__
  695. #define __JUCE_LOGGER_JUCEHEADER__
  696. /********* Start of inlined file: juce_String.h *********/
  697. #ifndef __JUCE_STRING_JUCEHEADER__
  698. #define __JUCE_STRING_JUCEHEADER__
  699. /********* Start of inlined file: juce_CharacterFunctions.h *********/
  700. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  701. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  702. #if JUCE_STRINGS_ARE_UNICODE
  703. #define JUCE_T(stringLiteral) (L##stringLiteral)
  704. typedef juce_wchar tchar;
  705. #define juce_tcharToWideChar(c) (c)
  706. #else
  707. #define JUCE_T(stringLiteral) (stringLiteral)
  708. typedef char tchar;
  709. #define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
  710. #endif
  711. #if ! JUCE_DONT_DEFINE_MACROS
  712. #define T(stringLiteral) JUCE_T(stringLiteral)
  713. #endif
  714. class JUCE_API CharacterFunctions
  715. {
  716. public:
  717. static int length (const char* const s) throw();
  718. static int length (const juce_wchar* const s) throw();
  719. static void copy (char* dest, const char* src, const int maxBytes) throw();
  720. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  721. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  722. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  723. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  724. static void append (char* dest, const char* src) throw();
  725. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  726. static int compare (const char* const s1, const char* const s2) throw();
  727. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  728. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  729. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  730. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  731. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  732. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  733. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  734. static const char* find (const char* const haystack, const char* const needle) throw();
  735. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  736. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  737. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  738. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  739. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  740. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  741. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  742. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  743. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  744. static int getIntValue (const char* const s) throw();
  745. static int getIntValue (const juce_wchar* s) throw();
  746. static int64 getInt64Value (const char* s) throw();
  747. static int64 getInt64Value (const juce_wchar* s) throw();
  748. static double getDoubleValue (const char* const s) throw();
  749. static double getDoubleValue (const juce_wchar* const s) throw();
  750. static char toUpperCase (const char character) throw();
  751. static juce_wchar toUpperCase (const juce_wchar character) throw();
  752. static void toUpperCase (char* s) throw();
  753. static void toUpperCase (juce_wchar* s) throw();
  754. static bool isUpperCase (const char character) throw();
  755. static bool isUpperCase (const juce_wchar character) throw();
  756. static char toLowerCase (const char character) throw();
  757. static juce_wchar toLowerCase (const juce_wchar character) throw();
  758. static void toLowerCase (char* s) throw();
  759. static void toLowerCase (juce_wchar* s) throw();
  760. static bool isLowerCase (const char character) throw();
  761. static bool isLowerCase (const juce_wchar character) throw();
  762. static bool isWhitespace (const char character) throw();
  763. static bool isWhitespace (const juce_wchar character) throw();
  764. static bool isDigit (const char character) throw();
  765. static bool isDigit (const juce_wchar character) throw();
  766. static bool isLetter (const char character) throw();
  767. static bool isLetter (const juce_wchar character) throw();
  768. static bool isLetterOrDigit (const char character) throw();
  769. static bool isLetterOrDigit (const juce_wchar character) throw();
  770. static int getHexDigitValue (const tchar digit) throw();
  771. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  772. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  773. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  774. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  775. };
  776. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  777. /********* End of inlined file: juce_CharacterFunctions.h *********/
  778. class JUCE_API String
  779. {
  780. public:
  781. String() throw();
  782. String (const String& other) throw();
  783. String (const char* const text) throw();
  784. String (const char* const text,
  785. const size_t maxChars) throw();
  786. String (const juce_wchar* const unicodeText) throw();
  787. String (const juce_wchar* const unicodeText,
  788. const size_t maxChars) throw();
  789. static const String charToString (const tchar character) throw();
  790. ~String() throw();
  791. static const String empty;
  792. int hashCode() const throw();
  793. int64 hashCode64() const throw();
  794. int length() const throw();
  795. // Assignment and concatenation operators..
  796. const String& operator= (const tchar* const other) throw();
  797. const String& operator= (const String& other) throw();
  798. const String& operator+= (const tchar* const textToAppend) throw();
  799. const String& operator+= (const String& stringToAppend) throw();
  800. const String& operator+= (const char characterToAppend) throw();
  801. const String& operator+= (const juce_wchar characterToAppend) throw();
  802. void append (const tchar* const textToAppend,
  803. const int maxCharsToTake) throw();
  804. const String operator+ (const String& stringToAppend) const throw();
  805. const String operator+ (const tchar* const textToAppend) const throw();
  806. const String operator+ (const tchar characterToAppend) const throw();
  807. String& operator<< (const char n) throw();
  808. String& operator<< (const juce_wchar n) throw();
  809. String& operator<< (const char* const text) throw();
  810. String& operator<< (const juce_wchar* const text) throw();
  811. String& operator<< (const String& text) throw();
  812. String& operator<< (const short number) throw();
  813. String& operator<< (const int number) throw();
  814. String& operator<< (const unsigned int number) throw();
  815. String& operator<< (const long number) throw();
  816. String& operator<< (const unsigned long number) throw();
  817. String& operator<< (const float number) throw();
  818. String& operator<< (const double number) throw();
  819. // Comparison methods..
  820. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  821. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  822. bool operator== (const String& other) const throw();
  823. bool operator== (const tchar* const other) const throw();
  824. bool operator!= (const String& other) const throw();
  825. bool operator!= (const tchar* const other) const throw();
  826. bool equalsIgnoreCase (const String& other) const throw();
  827. bool equalsIgnoreCase (const tchar* const other) const throw();
  828. bool operator> (const String& other) const throw();
  829. bool operator< (const tchar* const other) const throw();
  830. bool operator>= (const String& other) const throw();
  831. bool operator<= (const tchar* const other) const throw();
  832. int compare (const tchar* const other) const throw();
  833. int compareIgnoreCase (const tchar* const other) const throw();
  834. int compareLexicographically (const tchar* const other) const throw();
  835. bool startsWith (const tchar* const text) const throw();
  836. bool startsWithChar (const tchar character) const throw();
  837. bool startsWithIgnoreCase (const tchar* const text) const throw();
  838. bool endsWith (const tchar* const text) const throw();
  839. bool endsWithChar (const tchar character) const throw();
  840. bool endsWithIgnoreCase (const tchar* const text) const throw();
  841. bool contains (const tchar* const text) const throw();
  842. bool containsChar (const tchar character) const throw();
  843. bool containsIgnoreCase (const tchar* const text) const throw();
  844. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  845. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  846. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  847. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  848. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  849. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  850. bool containsNonWhitespaceChars() const throw();
  851. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  852. // Substring location methods..
  853. int indexOfChar (const tchar characterToLookFor) const throw();
  854. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  855. int indexOfAnyOf (const tchar* const charactersToLookFor,
  856. const int startIndex = 0,
  857. const bool ignoreCase = false) const throw();
  858. int indexOf (const tchar* const text) const throw();
  859. int indexOf (const int startIndex,
  860. const tchar* const textToLookFor) const throw();
  861. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  862. int indexOfIgnoreCase (const int startIndex,
  863. const tchar* const textToLookFor) const throw();
  864. int lastIndexOfChar (const tchar character) const throw();
  865. int lastIndexOf (const tchar* const textToLookFor) const throw();
  866. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  867. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  868. const bool ignoreCase = false) const throw();
  869. // Substring extraction and manipulation methods..
  870. /** Returns the character at this index in the string.
  871. No checks are made to see if the index is within a valid range, so be careful!
  872. */
  873. inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  874. tchar& operator[] (const int index) throw();
  875. tchar getLastCharacter() const throw();
  876. const String substring (int startIndex,
  877. int endIndex) const throw();
  878. const String substring (const int startIndex) const throw();
  879. const String dropLastCharacters (const int numberToDrop) const throw();
  880. const String getLastCharacters (const int numCharacters) const throw();
  881. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  882. const bool includeSubStringInResult,
  883. const bool ignoreCase) const throw();
  884. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  885. const bool includeSubStringInResult,
  886. const bool ignoreCase) const throw();
  887. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  888. const bool includeSubStringInResult,
  889. const bool ignoreCase) const throw();
  890. const String upToLastOccurrenceOf (const tchar* substringToFind,
  891. const bool includeSubStringInResult,
  892. const bool ignoreCase) const throw();
  893. const String trim() const throw();
  894. const String trimStart() const throw();
  895. const String trimEnd() const throw();
  896. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  897. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  898. const String toUpperCase() const throw();
  899. const String toLowerCase() const throw();
  900. const String replaceSection (int startIndex,
  901. int numCharactersToReplace,
  902. const tchar* const stringToInsert) const throw();
  903. const String replace (const tchar* const stringToReplace,
  904. const tchar* const stringToInsertInstead,
  905. const bool ignoreCase = false) const throw();
  906. const String replaceCharacter (const tchar characterToReplace,
  907. const tchar characterToInsertInstead) const throw();
  908. const String replaceCharacters (const String& charactersToReplace,
  909. const tchar* const charactersToInsertInstead) const throw();
  910. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  911. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  912. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  913. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  914. bool isQuotedString() const throw();
  915. const String unquoted() const throw();
  916. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  917. void printf (const tchar* const format, ...) throw();
  918. static const String formatted (const tchar* const format, ...) throw();
  919. void vprintf (const tchar* const format, va_list& args) throw();
  920. static const String repeatedString (const tchar* const stringToRepeat,
  921. int numberOfTimesToRepeat) throw();
  922. static const String createStringFromData (const void* const data,
  923. const int size) throw();
  924. // Numeric conversions..
  925. explicit String (const int decimalInteger) throw();
  926. explicit String (const unsigned int decimalInteger) throw();
  927. explicit String (const short decimalInteger) throw();
  928. explicit String (const unsigned short decimalInteger) throw();
  929. explicit String (const int64 largeIntegerValue) throw();
  930. explicit String (const uint64 largeIntegerValue) throw();
  931. explicit String (const float floatValue,
  932. const int numberOfDecimalPlaces = 0) throw();
  933. explicit String (const double doubleValue,
  934. const int numberOfDecimalPlaces = 0) throw();
  935. int getIntValue() const throw();
  936. int64 getLargeIntValue() const throw();
  937. int getTrailingIntValue() const throw();
  938. float getFloatValue() const throw();
  939. double getDoubleValue() const throw();
  940. int getHexValue32() const throw();
  941. int64 getHexValue64() const throw();
  942. static const String toHexString (const int number) throw();
  943. static const String toHexString (const int64 number) throw();
  944. static const String toHexString (const short number) throw();
  945. static const String toHexString (const unsigned char* data,
  946. const int size,
  947. const int groupSize = 1) throw();
  948. // Casting to character arrays..
  949. #if JUCE_STRINGS_ARE_UNICODE
  950. operator const char*() const throw();
  951. inline operator const juce_wchar*() const throw() { return text->text; }
  952. #else
  953. inline operator const char*() const throw() { return text->text; }
  954. operator const juce_wchar*() const throw();
  955. #endif
  956. void copyToBuffer (char* const destBuffer,
  957. const int maxCharsToCopy) const throw();
  958. void copyToBuffer (juce_wchar* const destBuffer,
  959. const int maxCharsToCopy) const throw();
  960. int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
  961. const char* toUTF8() const throw();
  962. static const String fromUTF8 (const uint8* const utf8buffer,
  963. int bufferSizeBytes = -1) throw();
  964. void preallocateStorage (const size_t numCharsNeeded) throw();
  965. class JUCE_API Concatenator
  966. {
  967. public:
  968. Concatenator (String& stringToAppendTo);
  969. ~Concatenator();
  970. void append (const String& s);
  971. private:
  972. String& result;
  973. int nextIndex;
  974. Concatenator (const Concatenator&);
  975. const Concatenator& operator= (const Concatenator&);
  976. };
  977. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  978. private:
  979. struct InternalRefCountedStringHolder
  980. {
  981. int refCount;
  982. int allocatedNumChars;
  983. #if JUCE_STRINGS_ARE_UNICODE
  984. wchar_t text[1];
  985. #else
  986. char text[1];
  987. #endif
  988. };
  989. InternalRefCountedStringHolder* text;
  990. static InternalRefCountedStringHolder emptyString;
  991. // internal constructor that preallocates a certain amount of memory
  992. String (const int numChars, const int dummyVariable) throw();
  993. void deleteInternal() throw();
  994. void createInternal (const int numChars) throw();
  995. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  996. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  997. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  998. void dupeInternalIfMultiplyReferenced() throw();
  999. };
  1000. const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
  1001. const String& string2) throw();
  1002. const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
  1003. const String& string2) throw();
  1004. #endif // __JUCE_STRING_JUCEHEADER__
  1005. /********* End of inlined file: juce_String.h *********/
  1006. class JUCE_API Logger
  1007. {
  1008. public:
  1009. virtual ~Logger();
  1010. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1011. const bool deleteOldLogger = false);
  1012. static void JUCE_CALLTYPE writeToLog (const String& message);
  1013. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1014. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1015. protected:
  1016. Logger();
  1017. virtual void logMessage (const String& message) = 0;
  1018. };
  1019. #endif // __JUCE_LOGGER_JUCEHEADER__
  1020. /********* End of inlined file: juce_Logger.h *********/
  1021. END_JUCE_NAMESPACE
  1022. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1023. /********* End of inlined file: juce_StandardHeader.h *********/
  1024. BEGIN_JUCE_NAMESPACE
  1025. #if JUCE_MSVC
  1026. // this is set explicitly in case the app is using a different packing size.
  1027. #pragma pack (push, 8)
  1028. #pragma warning (push)
  1029. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1030. #endif
  1031. #if JUCE_MAC || JUCE_IPHONE
  1032. #pragma align=natural
  1033. #endif
  1034. // this is where all the class header files get brought in..
  1035. /********* Start of inlined file: juce_core_includes.h *********/
  1036. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1037. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1038. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1039. /********* Start of inlined file: juce_Array.h *********/
  1040. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1041. #define __JUCE_ARRAY_JUCEHEADER__
  1042. /********* Start of inlined file: juce_ArrayAllocationBase.h *********/
  1043. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1044. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1045. /********* Start of inlined file: juce_HeapBlock.h *********/
  1046. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1047. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1048. template <class ElementType>
  1049. class HeapBlock
  1050. {
  1051. public:
  1052. HeapBlock() throw() : data (0)
  1053. {
  1054. }
  1055. HeapBlock (const size_t numElements)
  1056. : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType)))
  1057. {
  1058. }
  1059. ~HeapBlock()
  1060. {
  1061. ::juce_free (data);
  1062. }
  1063. inline operator ElementType*() const throw() { return data; }
  1064. inline operator void*() const throw() { return (void*) data; }
  1065. inline ElementType* operator->() const throw() { return data; }
  1066. template <class CastType>
  1067. inline operator CastType*() const throw() { return (CastType*) data; }
  1068. template <typename IndexType>
  1069. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1070. template <typename IndexType>
  1071. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1072. inline ElementType** operator&() const throw() { return (ElementType**) &data; }
  1073. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1074. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1075. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1076. {
  1077. ::juce_free (data);
  1078. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1079. }
  1080. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1081. {
  1082. ::juce_free (data);
  1083. data = (ElementType*) ::juce_calloc (newNumElements * elementSize);
  1084. }
  1085. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1086. {
  1087. ::juce_free (data);
  1088. if (initialiseToZero)
  1089. data = (ElementType*) ::juce_calloc (newNumElements * sizeof (ElementType));
  1090. else
  1091. data = (ElementType*) ::juce_malloc (newNumElements * sizeof (ElementType));
  1092. }
  1093. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1094. {
  1095. if (data == 0)
  1096. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1097. else
  1098. data = (ElementType*) ::juce_realloc (data, newNumElements * elementSize);
  1099. }
  1100. void free()
  1101. {
  1102. ::juce_free (data);
  1103. data = 0;
  1104. }
  1105. void swapWith (HeapBlock <ElementType>& other) throw()
  1106. {
  1107. swapVariables (data, other.data);
  1108. }
  1109. private:
  1110. ElementType* data;
  1111. HeapBlock (const HeapBlock&);
  1112. const HeapBlock& operator= (const HeapBlock&);
  1113. };
  1114. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1115. /********* End of inlined file: juce_HeapBlock.h *********/
  1116. template <class ElementType>
  1117. class ArrayAllocationBase
  1118. {
  1119. public:
  1120. ArrayAllocationBase() throw()
  1121. : numAllocated (0)
  1122. {
  1123. }
  1124. ~ArrayAllocationBase()
  1125. {
  1126. }
  1127. void setAllocatedSize (const int numElements)
  1128. {
  1129. if (numAllocated != numElements)
  1130. {
  1131. if (numElements > 0)
  1132. elements.realloc (numElements);
  1133. else
  1134. elements.free();
  1135. numAllocated = numElements;
  1136. }
  1137. }
  1138. void ensureAllocatedSize (const int minNumElements)
  1139. {
  1140. if (minNumElements > numAllocated)
  1141. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1142. }
  1143. void shrinkToNoMoreThan (const int maxNumElements)
  1144. {
  1145. if (maxNumElements < numAllocated)
  1146. setAllocatedSize (maxNumElements);
  1147. }
  1148. void swapWith (ArrayAllocationBase <ElementType>& other) throw()
  1149. {
  1150. elements.swapWith (other.elements);
  1151. swapVariables (numAllocated, other.numAllocated);
  1152. }
  1153. HeapBlock <ElementType> elements;
  1154. int numAllocated;
  1155. private:
  1156. ArrayAllocationBase (const ArrayAllocationBase&);
  1157. const ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1158. };
  1159. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1160. /********* End of inlined file: juce_ArrayAllocationBase.h *********/
  1161. /********* Start of inlined file: juce_ElementComparator.h *********/
  1162. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1163. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1164. template <class ElementType, class ElementComparator>
  1165. static void sortArray (ElementComparator& comparator,
  1166. ElementType* const array,
  1167. int firstElement,
  1168. int lastElement,
  1169. const bool retainOrderOfEquivalentItems)
  1170. {
  1171. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1172. // avoids getting warning messages about the parameter being unused
  1173. if (lastElement > firstElement)
  1174. {
  1175. if (retainOrderOfEquivalentItems)
  1176. {
  1177. for (int i = firstElement; i < lastElement; ++i)
  1178. {
  1179. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1180. {
  1181. const ElementType temp = array [i];
  1182. array [i] = array[i + 1];
  1183. array [i + 1] = temp;
  1184. if (i > firstElement)
  1185. i -= 2;
  1186. }
  1187. }
  1188. }
  1189. else
  1190. {
  1191. int fromStack[30], toStack[30];
  1192. int stackIndex = 0;
  1193. for (;;)
  1194. {
  1195. const int size = (lastElement - firstElement) + 1;
  1196. if (size <= 8)
  1197. {
  1198. int j = lastElement;
  1199. int maxIndex;
  1200. while (j > firstElement)
  1201. {
  1202. maxIndex = firstElement;
  1203. for (int k = firstElement + 1; k <= j; ++k)
  1204. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1205. maxIndex = k;
  1206. const ElementType temp = array [maxIndex];
  1207. array [maxIndex] = array[j];
  1208. array [j] = temp;
  1209. --j;
  1210. }
  1211. }
  1212. else
  1213. {
  1214. const int mid = firstElement + (size >> 1);
  1215. ElementType temp = array [mid];
  1216. array [mid] = array [firstElement];
  1217. array [firstElement] = temp;
  1218. int i = firstElement;
  1219. int j = lastElement + 1;
  1220. for (;;)
  1221. {
  1222. while (++i <= lastElement
  1223. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1224. {}
  1225. while (--j > firstElement
  1226. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1227. {}
  1228. if (j < i)
  1229. break;
  1230. temp = array[i];
  1231. array[i] = array[j];
  1232. array[j] = temp;
  1233. }
  1234. temp = array [firstElement];
  1235. array [firstElement] = array[j];
  1236. array [j] = temp;
  1237. if (j - 1 - firstElement >= lastElement - i)
  1238. {
  1239. if (firstElement + 1 < j)
  1240. {
  1241. fromStack [stackIndex] = firstElement;
  1242. toStack [stackIndex] = j - 1;
  1243. ++stackIndex;
  1244. }
  1245. if (i < lastElement)
  1246. {
  1247. firstElement = i;
  1248. continue;
  1249. }
  1250. }
  1251. else
  1252. {
  1253. if (i < lastElement)
  1254. {
  1255. fromStack [stackIndex] = i;
  1256. toStack [stackIndex] = lastElement;
  1257. ++stackIndex;
  1258. }
  1259. if (firstElement + 1 < j)
  1260. {
  1261. lastElement = j - 1;
  1262. continue;
  1263. }
  1264. }
  1265. }
  1266. if (--stackIndex < 0)
  1267. break;
  1268. jassert (stackIndex < numElementsInArray (fromStack));
  1269. firstElement = fromStack [stackIndex];
  1270. lastElement = toStack [stackIndex];
  1271. }
  1272. }
  1273. }
  1274. }
  1275. template <class ElementType, class ElementComparator>
  1276. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1277. ElementType* const array,
  1278. const ElementType newElement,
  1279. int firstElement,
  1280. int lastElement)
  1281. {
  1282. jassert (firstElement <= lastElement);
  1283. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1284. // avoids getting warning messages about the parameter being unused
  1285. while (firstElement < lastElement)
  1286. {
  1287. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1288. {
  1289. ++firstElement;
  1290. break;
  1291. }
  1292. else
  1293. {
  1294. const int halfway = (firstElement + lastElement) >> 1;
  1295. if (halfway == firstElement)
  1296. {
  1297. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1298. ++firstElement;
  1299. break;
  1300. }
  1301. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1302. {
  1303. firstElement = halfway;
  1304. }
  1305. else
  1306. {
  1307. lastElement = halfway;
  1308. }
  1309. }
  1310. }
  1311. return firstElement;
  1312. }
  1313. template <class ElementType>
  1314. class IntegerElementComparator
  1315. {
  1316. public:
  1317. static int compareElements (const ElementType first,
  1318. const ElementType second) throw()
  1319. {
  1320. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1321. }
  1322. };
  1323. template <class ElementType>
  1324. class FloatElementComparator
  1325. {
  1326. public:
  1327. static int compareElements (const ElementType first,
  1328. const ElementType second) throw()
  1329. {
  1330. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1331. }
  1332. };
  1333. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1334. /********* End of inlined file: juce_ElementComparator.h *********/
  1335. /********* Start of inlined file: juce_CriticalSection.h *********/
  1336. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1337. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1338. class JUCE_API CriticalSection
  1339. {
  1340. public:
  1341. CriticalSection() throw();
  1342. ~CriticalSection() throw();
  1343. void enter() const throw();
  1344. bool tryEnter() const throw();
  1345. void exit() const throw();
  1346. juce_UseDebuggingNewOperator
  1347. private:
  1348. #if JUCE_WIN32
  1349. #if JUCE_64BIT
  1350. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1351. // block of memory here that's big enough to be used internally as a windows critical
  1352. // section object.
  1353. uint8 internal [44];
  1354. #else
  1355. uint8 internal [24];
  1356. #endif
  1357. #else
  1358. mutable pthread_mutex_t internal;
  1359. #endif
  1360. CriticalSection (const CriticalSection&);
  1361. const CriticalSection& operator= (const CriticalSection&);
  1362. };
  1363. class JUCE_API DummyCriticalSection
  1364. {
  1365. public:
  1366. inline DummyCriticalSection() throw() {}
  1367. inline ~DummyCriticalSection() throw() {}
  1368. inline void enter() const throw() {}
  1369. inline void exit() const throw() {}
  1370. };
  1371. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1372. /********* End of inlined file: juce_CriticalSection.h *********/
  1373. template <typename ElementType,
  1374. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1375. class Array
  1376. {
  1377. public:
  1378. Array() throw()
  1379. : numUsed (0)
  1380. {
  1381. }
  1382. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1383. {
  1384. other.lockArray();
  1385. numUsed = other.numUsed;
  1386. data.setAllocatedSize (other.numUsed);
  1387. for (int i = 0; i < numUsed; ++i)
  1388. new (data.elements + i) ElementType (other.data.elements[i]);
  1389. other.unlockArray();
  1390. }
  1391. explicit Array (const ElementType* values)
  1392. : numUsed (0)
  1393. {
  1394. while (*values != 0)
  1395. add (*values++);
  1396. }
  1397. Array (const ElementType* values, int numValues)
  1398. : numUsed (numValues)
  1399. {
  1400. data.setAllocatedSize (numValues);
  1401. for (int i = 0; i < numValues; ++i)
  1402. new (data.elements + i) ElementType (values[i]);
  1403. }
  1404. ~Array()
  1405. {
  1406. for (int i = 0; i < numUsed; ++i)
  1407. data.elements[i].~ElementType();
  1408. }
  1409. Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
  1410. {
  1411. if (this != &other)
  1412. {
  1413. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1414. swapWithArray (otherCopy);
  1415. }
  1416. return *this;
  1417. }
  1418. template <class OtherArrayType>
  1419. bool operator== (const OtherArrayType& other) const
  1420. {
  1421. lock.enter();
  1422. if (numUsed != other.numUsed)
  1423. {
  1424. lock.exit();
  1425. return false;
  1426. }
  1427. for (int i = numUsed; --i >= 0;)
  1428. {
  1429. if (data.elements [i] != other.data.elements [i])
  1430. {
  1431. lock.exit();
  1432. return false;
  1433. }
  1434. }
  1435. lock.exit();
  1436. return true;
  1437. }
  1438. template <class OtherArrayType>
  1439. bool operator!= (const OtherArrayType& other) const
  1440. {
  1441. return ! operator== (other);
  1442. }
  1443. void clear()
  1444. {
  1445. lock.enter();
  1446. for (int i = 0; i < numUsed; ++i)
  1447. data.elements[i].~ElementType();
  1448. data.setAllocatedSize (0);
  1449. numUsed = 0;
  1450. lock.exit();
  1451. }
  1452. void clearQuick()
  1453. {
  1454. lock.enter();
  1455. for (int i = 0; i < numUsed; ++i)
  1456. data.elements[i].~ElementType();
  1457. numUsed = 0;
  1458. lock.exit();
  1459. }
  1460. inline int size() const throw()
  1461. {
  1462. return numUsed;
  1463. }
  1464. inline ElementType operator[] (const int index) const
  1465. {
  1466. lock.enter();
  1467. const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
  1468. ? data.elements [index]
  1469. : ElementType());
  1470. lock.exit();
  1471. return result;
  1472. }
  1473. inline const ElementType getUnchecked (const int index) const
  1474. {
  1475. lock.enter();
  1476. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1477. const ElementType result (data.elements [index]);
  1478. lock.exit();
  1479. return result;
  1480. }
  1481. inline ElementType& getReference (const int index) const throw()
  1482. {
  1483. lock.enter();
  1484. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1485. ElementType& result = data.elements [index];
  1486. lock.exit();
  1487. return result;
  1488. }
  1489. inline ElementType getFirst() const
  1490. {
  1491. lock.enter();
  1492. const ElementType result ((numUsed > 0) ? data.elements [0]
  1493. : ElementType());
  1494. lock.exit();
  1495. return result;
  1496. }
  1497. inline ElementType getLast() const
  1498. {
  1499. lock.enter();
  1500. const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
  1501. : ElementType());
  1502. lock.exit();
  1503. return result;
  1504. }
  1505. int indexOf (const ElementType& elementToLookFor) const
  1506. {
  1507. int result = -1;
  1508. lock.enter();
  1509. const ElementType* e = data.elements;
  1510. for (int i = numUsed; --i >= 0;)
  1511. {
  1512. if (elementToLookFor == *e)
  1513. {
  1514. result = (int) (e - data.elements);
  1515. break;
  1516. }
  1517. ++e;
  1518. }
  1519. lock.exit();
  1520. return result;
  1521. }
  1522. bool contains (const ElementType& elementToLookFor) const
  1523. {
  1524. lock.enter();
  1525. const ElementType* e = data.elements;
  1526. int num = numUsed;
  1527. while (num > 0)
  1528. {
  1529. if (elementToLookFor == *e)
  1530. {
  1531. lock.exit();
  1532. return true;
  1533. }
  1534. --num;
  1535. ++e;
  1536. }
  1537. lock.exit();
  1538. return false;
  1539. }
  1540. void add (const ElementType& newElement)
  1541. {
  1542. lock.enter();
  1543. data.ensureAllocatedSize (numUsed + 1);
  1544. new (data.elements + numUsed++) ElementType (newElement);
  1545. lock.exit();
  1546. }
  1547. void insert (int indexToInsertAt, const ElementType& newElement)
  1548. {
  1549. lock.enter();
  1550. data.ensureAllocatedSize (numUsed + 1);
  1551. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1552. {
  1553. ElementType* const insertPos = data.elements + indexToInsertAt;
  1554. const int numberToMove = numUsed - indexToInsertAt;
  1555. if (numberToMove > 0)
  1556. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1557. new (insertPos) ElementType (newElement);
  1558. ++numUsed;
  1559. }
  1560. else
  1561. {
  1562. new (data.elements + numUsed++) ElementType (newElement);
  1563. }
  1564. lock.exit();
  1565. }
  1566. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1567. int numberOfTimesToInsertIt)
  1568. {
  1569. if (numberOfTimesToInsertIt > 0)
  1570. {
  1571. lock.enter();
  1572. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1573. ElementType* insertPos;
  1574. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1575. {
  1576. insertPos = data.elements + indexToInsertAt;
  1577. const int numberToMove = numUsed - indexToInsertAt;
  1578. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1579. }
  1580. else
  1581. {
  1582. insertPos = data.elements + numUsed;
  1583. }
  1584. numUsed += numberOfTimesToInsertIt;
  1585. while (--numberOfTimesToInsertIt >= 0)
  1586. new (insertPos++) ElementType (newElement);
  1587. lock.exit();
  1588. }
  1589. }
  1590. void insertArray (int indexToInsertAt,
  1591. const ElementType* newElements,
  1592. int numberOfElements)
  1593. {
  1594. if (numberOfElements > 0)
  1595. {
  1596. lock.enter();
  1597. data.ensureAllocatedSize (numUsed + numberOfElements);
  1598. ElementType* insertPos;
  1599. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1600. {
  1601. insertPos = data.elements + indexToInsertAt;
  1602. const int numberToMove = numUsed - indexToInsertAt;
  1603. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1604. }
  1605. else
  1606. {
  1607. insertPos = data.elements + numUsed;
  1608. }
  1609. numUsed += numberOfElements;
  1610. while (--numberOfElements >= 0)
  1611. new (insertPos++) ElementType (*newElements++);
  1612. lock.exit();
  1613. }
  1614. }
  1615. void addIfNotAlreadyThere (const ElementType& newElement)
  1616. {
  1617. lock.enter();
  1618. if (! contains (newElement))
  1619. add (newElement);
  1620. lock.exit();
  1621. }
  1622. void set (const int indexToChange, const ElementType& newValue)
  1623. {
  1624. jassert (indexToChange >= 0);
  1625. lock.enter();
  1626. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1627. {
  1628. data.elements [indexToChange] = newValue;
  1629. }
  1630. else if (indexToChange >= 0)
  1631. {
  1632. data.ensureAllocatedSize (numUsed + 1);
  1633. new (data.elements + numUsed++) ElementType (newValue);
  1634. }
  1635. lock.exit();
  1636. }
  1637. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1638. {
  1639. lock.enter();
  1640. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1641. data.elements [indexToChange] = newValue;
  1642. lock.exit();
  1643. }
  1644. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1645. {
  1646. lock.enter();
  1647. if (numElementsToAdd > 0)
  1648. {
  1649. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1650. while (--numElementsToAdd >= 0)
  1651. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1652. }
  1653. lock.exit();
  1654. }
  1655. void swapWithArray (Array <ElementType>& otherArray) throw()
  1656. {
  1657. lock.enter();
  1658. otherArray.lock.enter();
  1659. data.swapWith (otherArray.data);
  1660. swapVariables (numUsed, otherArray.numUsed);
  1661. otherArray.lock.exit();
  1662. lock.exit();
  1663. }
  1664. template <class OtherArrayType>
  1665. void addArray (const OtherArrayType& arrayToAddFrom,
  1666. int startIndex = 0,
  1667. int numElementsToAdd = -1)
  1668. {
  1669. arrayToAddFrom.lockArray();
  1670. lock.enter();
  1671. if (startIndex < 0)
  1672. {
  1673. jassertfalse
  1674. startIndex = 0;
  1675. }
  1676. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1677. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1678. while (--numElementsToAdd >= 0)
  1679. add (arrayToAddFrom.getUnchecked (startIndex++));
  1680. lock.exit();
  1681. arrayToAddFrom.unlockArray();
  1682. }
  1683. template <class ElementComparator>
  1684. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1685. {
  1686. lock.enter();
  1687. insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
  1688. lock.exit();
  1689. }
  1690. template <class ElementComparator>
  1691. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1692. {
  1693. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1694. // avoids getting warning messages about the parameter being unused
  1695. lock.enter();
  1696. int start = 0;
  1697. int end = numUsed;
  1698. for (;;)
  1699. {
  1700. if (start >= end)
  1701. {
  1702. lock.exit();
  1703. return -1;
  1704. }
  1705. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1706. {
  1707. lock.exit();
  1708. return start;
  1709. }
  1710. else
  1711. {
  1712. const int halfway = (start + end) >> 1;
  1713. if (halfway == start)
  1714. {
  1715. lock.exit();
  1716. return -1;
  1717. }
  1718. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1719. start = halfway;
  1720. else
  1721. end = halfway;
  1722. }
  1723. }
  1724. }
  1725. ElementType remove (const int indexToRemove)
  1726. {
  1727. lock.enter();
  1728. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1729. {
  1730. --numUsed;
  1731. ElementType* const e = data.elements + indexToRemove;
  1732. ElementType removed (*e);
  1733. e->~ElementType();
  1734. const int numberToShift = numUsed - indexToRemove;
  1735. if (numberToShift > 0)
  1736. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1737. if ((numUsed << 1) < data.numAllocated)
  1738. minimiseStorageOverheads();
  1739. lock.exit();
  1740. return removed;
  1741. }
  1742. else
  1743. {
  1744. lock.exit();
  1745. return ElementType();
  1746. }
  1747. }
  1748. void removeValue (const ElementType& valueToRemove)
  1749. {
  1750. lock.enter();
  1751. ElementType* e = data.elements;
  1752. for (int i = numUsed; --i >= 0;)
  1753. {
  1754. if (valueToRemove == *e)
  1755. {
  1756. remove ((int) (e - data.elements));
  1757. break;
  1758. }
  1759. ++e;
  1760. }
  1761. lock.exit();
  1762. }
  1763. void removeRange (int startIndex, int numberToRemove)
  1764. {
  1765. lock.enter();
  1766. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1767. startIndex = jlimit (0, numUsed, startIndex);
  1768. if (endIndex > startIndex)
  1769. {
  1770. ElementType* e = data.elements + startIndex;
  1771. numberToRemove = endIndex - startIndex;
  1772. for (int i = 0; i < numberToRemove; ++i)
  1773. e[i].~ElementType();
  1774. const int numToShift = numUsed - endIndex;
  1775. if (numToShift > 0)
  1776. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1777. numUsed -= numberToRemove;
  1778. if ((numUsed << 1) < data.numAllocated)
  1779. minimiseStorageOverheads();
  1780. }
  1781. lock.exit();
  1782. }
  1783. void removeLast (int howManyToRemove = 1)
  1784. {
  1785. lock.enter();
  1786. if (howManyToRemove > numUsed)
  1787. howManyToRemove = numUsed;
  1788. for (int i = 0; i < howManyToRemove; ++i)
  1789. data.elements [numUsed - i].~ElementType();
  1790. numUsed -= howManyToRemove;
  1791. if ((numUsed << 1) < data.numAllocated)
  1792. minimiseStorageOverheads();
  1793. lock.exit();
  1794. }
  1795. template <class OtherArrayType>
  1796. void removeValuesIn (const OtherArrayType& otherArray)
  1797. {
  1798. otherArray.lockArray();
  1799. lock.enter();
  1800. if (this == &otherArray)
  1801. {
  1802. clear();
  1803. }
  1804. else
  1805. {
  1806. if (otherArray.size() > 0)
  1807. {
  1808. for (int i = numUsed; --i >= 0;)
  1809. if (otherArray.contains (data.elements [i]))
  1810. remove (i);
  1811. }
  1812. }
  1813. lock.exit();
  1814. otherArray.unlockArray();
  1815. }
  1816. template <class OtherArrayType>
  1817. void removeValuesNotIn (const OtherArrayType& otherArray)
  1818. {
  1819. otherArray.lockArray();
  1820. lock.enter();
  1821. if (this != &otherArray)
  1822. {
  1823. if (otherArray.size() <= 0)
  1824. {
  1825. clear();
  1826. }
  1827. else
  1828. {
  1829. for (int i = numUsed; --i >= 0;)
  1830. if (! otherArray.contains (data.elements [i]))
  1831. remove (i);
  1832. }
  1833. }
  1834. lock.exit();
  1835. otherArray.unlockArray();
  1836. }
  1837. void swap (const int index1,
  1838. const int index2)
  1839. {
  1840. lock.enter();
  1841. if (((unsigned int) index1) < (unsigned int) numUsed
  1842. && ((unsigned int) index2) < (unsigned int) numUsed)
  1843. {
  1844. swapVariables (data.elements [index1],
  1845. data.elements [index2]);
  1846. }
  1847. lock.exit();
  1848. }
  1849. void move (const int currentIndex, int newIndex) throw()
  1850. {
  1851. if (currentIndex != newIndex)
  1852. {
  1853. lock.enter();
  1854. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1855. {
  1856. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1857. newIndex = numUsed - 1;
  1858. char tempCopy [sizeof (ElementType)];
  1859. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1860. if (newIndex > currentIndex)
  1861. {
  1862. memmove (data.elements + currentIndex,
  1863. data.elements + currentIndex + 1,
  1864. (newIndex - currentIndex) * sizeof (ElementType));
  1865. }
  1866. else
  1867. {
  1868. memmove (data.elements + newIndex + 1,
  1869. data.elements + newIndex,
  1870. (currentIndex - newIndex) * sizeof (ElementType));
  1871. }
  1872. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1873. }
  1874. lock.exit();
  1875. }
  1876. }
  1877. void minimiseStorageOverheads()
  1878. {
  1879. lock.enter();
  1880. data.shrinkToNoMoreThan (numUsed);
  1881. lock.exit();
  1882. }
  1883. void ensureStorageAllocated (const int minNumElements)
  1884. {
  1885. lock.enter();
  1886. data.ensureAllocatedSize (minNumElements);
  1887. lock.exit();
  1888. }
  1889. template <class ElementComparator>
  1890. void sort (ElementComparator& comparator,
  1891. const bool retainOrderOfEquivalentItems = false) const
  1892. {
  1893. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1894. // avoids getting warning messages about the parameter being unused
  1895. lock.enter();
  1896. sortArray (comparator, (ElementType*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  1897. lock.exit();
  1898. }
  1899. void lockArray() const throw()
  1900. {
  1901. lock.enter();
  1902. }
  1903. void unlockArray() const throw()
  1904. {
  1905. lock.exit();
  1906. }
  1907. juce_UseDebuggingNewOperator
  1908. private:
  1909. ArrayAllocationBase <ElementType> data;
  1910. int numUsed;
  1911. TypeOfCriticalSectionToUse lock;
  1912. };
  1913. #endif // __JUCE_ARRAY_JUCEHEADER__
  1914. /********* End of inlined file: juce_Array.h *********/
  1915. #endif
  1916. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1917. #endif
  1918. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1919. /********* Start of inlined file: juce_BitArray.h *********/
  1920. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1921. #define __JUCE_BITARRAY_JUCEHEADER__
  1922. class MemoryBlock;
  1923. class JUCE_API BitArray
  1924. {
  1925. public:
  1926. BitArray() throw();
  1927. BitArray (const unsigned int value) throw();
  1928. BitArray (const int value) throw();
  1929. BitArray (int64 value) throw();
  1930. BitArray (const BitArray& other) throw();
  1931. ~BitArray() throw();
  1932. BitArray& operator= (const BitArray& other) throw();
  1933. bool operator== (const BitArray& other) const throw();
  1934. bool operator!= (const BitArray& other) const throw();
  1935. void clear() throw();
  1936. void clearBit (const int bitNumber) throw();
  1937. void setBit (const int bitNumber) throw();
  1938. void setBit (const int bitNumber,
  1939. const bool shouldBeSet) throw();
  1940. void setRange (int startBit,
  1941. int numBits,
  1942. const bool shouldBeSet) throw();
  1943. void insertBit (const int bitNumber,
  1944. const bool shouldBeSet) throw();
  1945. bool operator[] (const int bit) const throw();
  1946. bool isEmpty() const throw();
  1947. const BitArray getBitRange (int startBit, int numBits) const throw();
  1948. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1949. void setBitRangeAsInt (int startBit, int numBits,
  1950. unsigned int valueToSet) throw();
  1951. void orWith (const BitArray& other) throw();
  1952. void andWith (const BitArray& other) throw();
  1953. void xorWith (const BitArray& other) throw();
  1954. void add (const BitArray& other) throw();
  1955. void subtract (const BitArray& other) throw();
  1956. void multiplyBy (const BitArray& other) throw();
  1957. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1958. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1959. void modulo (const BitArray& divisor) throw();
  1960. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1961. void inverseModulo (const BitArray& modulus) throw();
  1962. void shiftBits (int howManyBitsLeft,
  1963. int startBit = 0) throw();
  1964. int compare (const BitArray& other) const throw();
  1965. int compareAbsolute (const BitArray& other) const throw();
  1966. bool isNegative() const throw();
  1967. void setNegative (const bool shouldBeNegative) throw();
  1968. void negate() throw();
  1969. int countNumberOfSetBits() const throw();
  1970. int findNextSetBit (int startIndex = 0) const throw();
  1971. int findNextClearBit (int startIndex = 0) const throw();
  1972. int getHighestBit() const throw();
  1973. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1974. void parseString (const String& text,
  1975. const int base) throw();
  1976. const MemoryBlock toMemoryBlock() const throw();
  1977. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1978. juce_UseDebuggingNewOperator
  1979. private:
  1980. void ensureSize (const int numVals) throw();
  1981. HeapBlock <unsigned int> values;
  1982. int numValues, highestBit;
  1983. bool negative;
  1984. };
  1985. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1986. /********* End of inlined file: juce_BitArray.h *********/
  1987. #endif
  1988. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1989. #endif
  1990. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1991. #endif
  1992. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1993. /********* Start of inlined file: juce_MemoryBlock.h *********/
  1994. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  1995. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  1996. class JUCE_API MemoryBlock
  1997. {
  1998. public:
  1999. MemoryBlock() throw();
  2000. MemoryBlock (const size_t initialSize,
  2001. const bool initialiseToZero = false) throw();
  2002. MemoryBlock (const MemoryBlock& other) throw();
  2003. MemoryBlock (const void* const dataToInitialiseFrom,
  2004. const size_t sizeInBytes) throw();
  2005. ~MemoryBlock() throw();
  2006. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2007. bool operator== (const MemoryBlock& other) const throw();
  2008. bool operator!= (const MemoryBlock& other) const throw();
  2009. template <class DataType>
  2010. operator DataType*() const throw() { return (DataType*) data; }
  2011. void* getData() const throw() { return data; }
  2012. template <typename Type>
  2013. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2014. size_t getSize() const throw() { return size; }
  2015. void setSize (const size_t newSize,
  2016. const bool initialiseNewSpaceToZero = false) throw();
  2017. void ensureSize (const size_t minimumSize,
  2018. const bool initialiseNewSpaceToZero = false) throw();
  2019. void fillWith (const uint8 valueToUse) throw();
  2020. void append (const void* const data,
  2021. const size_t numBytes) throw();
  2022. void swapWith (MemoryBlock& other) throw();
  2023. void copyFrom (const void* srcData,
  2024. int destinationOffset,
  2025. size_t numBytes) throw();
  2026. void copyTo (void* destData,
  2027. int sourceOffset,
  2028. size_t numBytes) const throw();
  2029. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2030. const String toString() const throw();
  2031. void loadFromHexString (const String& sourceHexString) throw();
  2032. void setBitRange (size_t bitRangeStart,
  2033. size_t numBits,
  2034. int binaryNumberToApply) throw();
  2035. int getBitRange (size_t bitRangeStart,
  2036. size_t numBitsToRead) const throw();
  2037. const String toBase64Encoding() const throw();
  2038. bool fromBase64Encoding (const String& encodedString) throw();
  2039. juce_UseDebuggingNewOperator
  2040. private:
  2041. HeapBlock <char> data;
  2042. size_t size;
  2043. };
  2044. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2045. /********* End of inlined file: juce_MemoryBlock.h *********/
  2046. #endif
  2047. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2048. /********* Start of inlined file: juce_OwnedArray.h *********/
  2049. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2050. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2051. /********* Start of inlined file: juce_ScopedPointer.h *********/
  2052. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2053. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2054. template <class ObjectType>
  2055. class JUCE_API ScopedPointer
  2056. {
  2057. public:
  2058. inline ScopedPointer() throw() : object (0)
  2059. {
  2060. }
  2061. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2062. : object (objectToTakePossessionOf)
  2063. {
  2064. }
  2065. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2066. : object (objectToTransferFrom.object)
  2067. {
  2068. objectToTransferFrom.object = 0;
  2069. }
  2070. inline ~ScopedPointer() { delete object; }
  2071. const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2072. {
  2073. if (this != objectToTransferFrom.getAddress())
  2074. {
  2075. // Two ScopedPointers should never be able to refer to the same object - if
  2076. // this happens, you must have done something dodgy!
  2077. jassert (object != objectToTransferFrom.object);
  2078. ObjectType* const oldObject = object;
  2079. object = objectToTransferFrom.object;
  2080. objectToTransferFrom.object = 0;
  2081. delete oldObject;
  2082. }
  2083. return *this;
  2084. }
  2085. const ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2086. {
  2087. if (object != newObjectToTakePossessionOf)
  2088. {
  2089. ObjectType* const oldObject = object;
  2090. object = newObjectToTakePossessionOf;
  2091. delete oldObject;
  2092. }
  2093. return *this;
  2094. }
  2095. inline operator ObjectType*() const throw() { return object; }
  2096. inline ObjectType& operator*() const throw() { return *object; }
  2097. inline ObjectType* operator->() const throw() { return object; }
  2098. template <class CastType>
  2099. inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
  2100. inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
  2101. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2102. inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
  2103. inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
  2104. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2105. {
  2106. // Two ScopedPointers should never be able to refer to the same object - if
  2107. // this happens, you must have done something dodgy!
  2108. jassert (object != other.object);
  2109. swapVariables (object, other.object);
  2110. }
  2111. private:
  2112. ObjectType* object;
  2113. // (Required as an alternative to the overloaded & operator).
  2114. ScopedPointer* getAddress() const throw() { return this; }
  2115. };
  2116. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2117. /********* End of inlined file: juce_ScopedPointer.h *********/
  2118. template <class ObjectClass,
  2119. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2120. class OwnedArray
  2121. {
  2122. public:
  2123. OwnedArray() throw()
  2124. : numUsed (0)
  2125. {
  2126. }
  2127. ~OwnedArray()
  2128. {
  2129. clear (true);
  2130. }
  2131. void clear (const bool deleteObjects = true)
  2132. {
  2133. lock.enter();
  2134. if (deleteObjects)
  2135. {
  2136. while (numUsed > 0)
  2137. delete data.elements [--numUsed];
  2138. }
  2139. data.setAllocatedSize (0);
  2140. numUsed = 0;
  2141. lock.exit();
  2142. }
  2143. inline int size() const throw()
  2144. {
  2145. return numUsed;
  2146. }
  2147. inline ObjectClass* operator[] (const int index) const throw()
  2148. {
  2149. lock.enter();
  2150. ObjectClass* const result = (((unsigned int) index) < (unsigned int) numUsed)
  2151. ? data.elements [index]
  2152. : (ObjectClass*) 0;
  2153. lock.exit();
  2154. return result;
  2155. }
  2156. inline ObjectClass* getUnchecked (const int index) const throw()
  2157. {
  2158. lock.enter();
  2159. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2160. ObjectClass* const result = data.elements [index];
  2161. lock.exit();
  2162. return result;
  2163. }
  2164. inline ObjectClass* getFirst() const throw()
  2165. {
  2166. lock.enter();
  2167. ObjectClass* const result = (numUsed > 0) ? data.elements [0]
  2168. : (ObjectClass*) 0;
  2169. lock.exit();
  2170. return result;
  2171. }
  2172. inline ObjectClass* getLast() const throw()
  2173. {
  2174. lock.enter();
  2175. ObjectClass* const result = (numUsed > 0) ? data.elements [numUsed - 1]
  2176. : (ObjectClass*) 0;
  2177. lock.exit();
  2178. return result;
  2179. }
  2180. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2181. {
  2182. int result = -1;
  2183. lock.enter();
  2184. ObjectClass* const* e = data.elements;
  2185. for (int i = numUsed; --i >= 0;)
  2186. {
  2187. if (objectToLookFor == *e)
  2188. {
  2189. result = (int) (e - data.elements);
  2190. break;
  2191. }
  2192. ++e;
  2193. }
  2194. lock.exit();
  2195. return result;
  2196. }
  2197. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2198. {
  2199. lock.enter();
  2200. ObjectClass* const* e = data.elements;
  2201. int i = numUsed;
  2202. while (i >= 4)
  2203. {
  2204. if (objectToLookFor == *e
  2205. || objectToLookFor == *++e
  2206. || objectToLookFor == *++e
  2207. || objectToLookFor == *++e)
  2208. {
  2209. lock.exit();
  2210. return true;
  2211. }
  2212. i -= 4;
  2213. ++e;
  2214. }
  2215. while (i > 0)
  2216. {
  2217. if (objectToLookFor == *e)
  2218. {
  2219. lock.exit();
  2220. return true;
  2221. }
  2222. --i;
  2223. ++e;
  2224. }
  2225. lock.exit();
  2226. return false;
  2227. }
  2228. void add (const ObjectClass* const newObject) throw()
  2229. {
  2230. lock.enter();
  2231. data.ensureAllocatedSize (numUsed + 1);
  2232. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2233. lock.exit();
  2234. }
  2235. void insert (int indexToInsertAt,
  2236. const ObjectClass* const newObject) throw()
  2237. {
  2238. if (indexToInsertAt >= 0)
  2239. {
  2240. lock.enter();
  2241. if (indexToInsertAt > numUsed)
  2242. indexToInsertAt = numUsed;
  2243. data.ensureAllocatedSize (numUsed + 1);
  2244. ObjectClass** const e = data.elements + indexToInsertAt;
  2245. const int numToMove = numUsed - indexToInsertAt;
  2246. if (numToMove > 0)
  2247. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2248. *e = const_cast <ObjectClass*> (newObject);
  2249. ++numUsed;
  2250. lock.exit();
  2251. }
  2252. else
  2253. {
  2254. add (newObject);
  2255. }
  2256. }
  2257. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2258. {
  2259. lock.enter();
  2260. if (! contains (newObject))
  2261. add (newObject);
  2262. lock.exit();
  2263. }
  2264. void set (const int indexToChange,
  2265. const ObjectClass* const newObject,
  2266. const bool deleteOldElement = true)
  2267. {
  2268. if (indexToChange >= 0)
  2269. {
  2270. ScopedPointer <ObjectClass> toDelete;
  2271. lock.enter();
  2272. if (indexToChange < numUsed)
  2273. {
  2274. if (deleteOldElement)
  2275. {
  2276. toDelete = data.elements [indexToChange];
  2277. if (toDelete == newObject)
  2278. toDelete = 0;
  2279. }
  2280. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2281. }
  2282. else
  2283. {
  2284. data.ensureAllocatedSize (numUsed + 1);
  2285. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2286. }
  2287. lock.exit();
  2288. }
  2289. }
  2290. template <class ElementComparator>
  2291. void addSorted (ElementComparator& comparator,
  2292. ObjectClass* const newObject) throw()
  2293. {
  2294. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2295. // avoids getting warning messages about the parameter being unused
  2296. lock.enter();
  2297. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  2298. lock.exit();
  2299. }
  2300. template <class ElementComparator>
  2301. int indexOfSorted (ElementComparator& comparator,
  2302. const ObjectClass* const objectToLookFor) const throw()
  2303. {
  2304. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2305. // avoids getting warning messages about the parameter being unused
  2306. lock.enter();
  2307. int start = 0;
  2308. int end = numUsed;
  2309. for (;;)
  2310. {
  2311. if (start >= end)
  2312. {
  2313. lock.exit();
  2314. return -1;
  2315. }
  2316. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2317. {
  2318. lock.exit();
  2319. return start;
  2320. }
  2321. else
  2322. {
  2323. const int halfway = (start + end) >> 1;
  2324. if (halfway == start)
  2325. {
  2326. lock.exit();
  2327. return -1;
  2328. }
  2329. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2330. start = halfway;
  2331. else
  2332. end = halfway;
  2333. }
  2334. }
  2335. }
  2336. void remove (const int indexToRemove,
  2337. const bool deleteObject = true)
  2338. {
  2339. ScopedPointer <ObjectClass> toDelete;
  2340. lock.enter();
  2341. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2342. {
  2343. ObjectClass** const e = data.elements + indexToRemove;
  2344. if (deleteObject)
  2345. toDelete = *e;
  2346. --numUsed;
  2347. const int numToShift = numUsed - indexToRemove;
  2348. if (numToShift > 0)
  2349. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2350. if ((numUsed << 1) < data.numAllocated)
  2351. minimiseStorageOverheads();
  2352. }
  2353. lock.exit();
  2354. }
  2355. void removeObject (const ObjectClass* const objectToRemove,
  2356. const bool deleteObject = true)
  2357. {
  2358. lock.enter();
  2359. ObjectClass** e = data.elements;
  2360. for (int i = numUsed; --i >= 0;)
  2361. {
  2362. if (objectToRemove == *e)
  2363. {
  2364. remove ((int) (e - data.elements), deleteObject);
  2365. break;
  2366. }
  2367. ++e;
  2368. }
  2369. lock.exit();
  2370. }
  2371. void removeRange (int startIndex,
  2372. const int numberToRemove,
  2373. const bool deleteObjects = true)
  2374. {
  2375. lock.enter();
  2376. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2377. startIndex = jlimit (0, numUsed, startIndex);
  2378. if (endIndex > startIndex)
  2379. {
  2380. if (deleteObjects)
  2381. {
  2382. for (int i = startIndex; i < endIndex; ++i)
  2383. {
  2384. delete data.elements [i];
  2385. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2386. }
  2387. }
  2388. const int rangeSize = endIndex - startIndex;
  2389. ObjectClass** e = data.elements + startIndex;
  2390. int numToShift = numUsed - endIndex;
  2391. numUsed -= rangeSize;
  2392. while (--numToShift >= 0)
  2393. {
  2394. *e = e [rangeSize];
  2395. ++e;
  2396. }
  2397. if ((numUsed << 1) < data.numAllocated)
  2398. minimiseStorageOverheads();
  2399. }
  2400. lock.exit();
  2401. }
  2402. void removeLast (int howManyToRemove = 1,
  2403. const bool deleteObjects = true)
  2404. {
  2405. lock.enter();
  2406. if (howManyToRemove >= numUsed)
  2407. {
  2408. clear (deleteObjects);
  2409. }
  2410. else
  2411. {
  2412. while (--howManyToRemove >= 0)
  2413. remove (numUsed - 1, deleteObjects);
  2414. }
  2415. lock.exit();
  2416. }
  2417. void swap (const int index1,
  2418. const int index2) throw()
  2419. {
  2420. lock.enter();
  2421. if (((unsigned int) index1) < (unsigned int) numUsed
  2422. && ((unsigned int) index2) < (unsigned int) numUsed)
  2423. {
  2424. swapVariables (data.elements [index1],
  2425. data.elements [index2]);
  2426. }
  2427. lock.exit();
  2428. }
  2429. void move (const int currentIndex,
  2430. int newIndex) throw()
  2431. {
  2432. if (currentIndex != newIndex)
  2433. {
  2434. lock.enter();
  2435. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2436. {
  2437. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2438. newIndex = numUsed - 1;
  2439. ObjectClass* const value = data.elements [currentIndex];
  2440. if (newIndex > currentIndex)
  2441. {
  2442. memmove (data.elements + currentIndex,
  2443. data.elements + currentIndex + 1,
  2444. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2445. }
  2446. else
  2447. {
  2448. memmove (data.elements + newIndex + 1,
  2449. data.elements + newIndex,
  2450. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2451. }
  2452. data.elements [newIndex] = value;
  2453. }
  2454. lock.exit();
  2455. }
  2456. }
  2457. void swapWithArray (OwnedArray <ObjectClass>& otherArray) throw()
  2458. {
  2459. lock.enter();
  2460. otherArray.lock.enter();
  2461. data.swapWith (otherArray.data);
  2462. swapVariables (numUsed, otherArray.numUsed);
  2463. otherArray.lock.exit();
  2464. lock.exit();
  2465. }
  2466. void minimiseStorageOverheads() throw()
  2467. {
  2468. lock.enter();
  2469. data.shrinkToNoMoreThan (numUsed);
  2470. lock.exit();
  2471. }
  2472. void ensureStorageAllocated (const int minNumElements) throw()
  2473. {
  2474. lock.enter();
  2475. data.ensureAllocatedSize (minNumElements);
  2476. lock.exit();
  2477. }
  2478. template <class ElementComparator>
  2479. void sort (ElementComparator& comparator,
  2480. const bool retainOrderOfEquivalentItems = false) const throw()
  2481. {
  2482. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2483. // avoids getting warning messages about the parameter being unused
  2484. lock.enter();
  2485. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  2486. lock.exit();
  2487. }
  2488. void lockArray() const throw()
  2489. {
  2490. lock.enter();
  2491. }
  2492. void unlockArray() const throw()
  2493. {
  2494. lock.exit();
  2495. }
  2496. juce_UseDebuggingNewOperator
  2497. private:
  2498. ArrayAllocationBase <ObjectClass*> data;
  2499. int numUsed;
  2500. TypeOfCriticalSectionToUse lock;
  2501. // disallow copy constructor and assignment
  2502. OwnedArray (const OwnedArray&);
  2503. const OwnedArray& operator= (const OwnedArray&);
  2504. };
  2505. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2506. /********* End of inlined file: juce_OwnedArray.h *********/
  2507. #endif
  2508. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2509. /********* Start of inlined file: juce_PropertySet.h *********/
  2510. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2511. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2512. /********* Start of inlined file: juce_StringPairArray.h *********/
  2513. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2514. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2515. /********* Start of inlined file: juce_StringArray.h *********/
  2516. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2517. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2518. #ifndef DOXYGEN
  2519. // (used in StringArray::appendNumbersToDuplicates)
  2520. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2521. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2522. #endif
  2523. class JUCE_API StringArray
  2524. {
  2525. public:
  2526. StringArray() throw();
  2527. StringArray (const StringArray& other);
  2528. StringArray (const juce_wchar** const strings,
  2529. const int numberOfStrings);
  2530. StringArray (const char** const strings,
  2531. const int numberOfStrings);
  2532. explicit StringArray (const juce_wchar** const strings);
  2533. explicit StringArray (const char** const strings);
  2534. ~StringArray();
  2535. const StringArray& operator= (const StringArray& other);
  2536. bool operator== (const StringArray& other) const;
  2537. bool operator!= (const StringArray& other) const;
  2538. inline int size() const throw() { return strings.size(); };
  2539. const String& operator[] (const int index) const throw();
  2540. bool contains (const String& stringToLookFor,
  2541. const bool ignoreCase = false) const;
  2542. int indexOf (const String& stringToLookFor,
  2543. const bool ignoreCase = false,
  2544. int startIndex = 0) const;
  2545. void add (const String& stringToAdd);
  2546. void insert (const int index, const String& stringToAdd);
  2547. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2548. void set (const int index, const String& newString);
  2549. void addArray (const StringArray& other,
  2550. int startIndex = 0,
  2551. int numElementsToAdd = -1);
  2552. int addTokens (const tchar* const stringToTokenise,
  2553. const bool preserveQuotedStrings);
  2554. int addTokens (const tchar* const stringToTokenise,
  2555. const tchar* breakCharacters,
  2556. const tchar* quoteCharacters);
  2557. int addLines (const tchar* stringToBreakUp);
  2558. void clear();
  2559. void remove (const int index);
  2560. void removeString (const String& stringToRemove,
  2561. const bool ignoreCase = false);
  2562. void removeDuplicates (const bool ignoreCase);
  2563. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2564. void move (const int currentIndex, int newIndex) throw();
  2565. void trim();
  2566. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2567. const bool appendNumberToFirstInstance,
  2568. const tchar* const preNumberString = defaultPreNumberString,
  2569. const tchar* const postNumberString = defaultPostNumberString);
  2570. const String joinIntoString (const String& separatorString,
  2571. int startIndex = 0,
  2572. int numberOfElements = -1) const;
  2573. void sort (const bool ignoreCase);
  2574. void minimiseStorageOverheads();
  2575. juce_UseDebuggingNewOperator
  2576. private:
  2577. Array <String> strings;
  2578. };
  2579. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2580. /********* End of inlined file: juce_StringArray.h *********/
  2581. class JUCE_API StringPairArray
  2582. {
  2583. public:
  2584. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  2585. StringPairArray (const StringPairArray& other) throw();
  2586. ~StringPairArray() throw();
  2587. const StringPairArray& operator= (const StringPairArray& other) throw();
  2588. bool operator== (const StringPairArray& other) const throw();
  2589. bool operator!= (const StringPairArray& other) const throw();
  2590. const String& operator[] (const String& key) const throw();
  2591. const String getValue (const String& key, const String& defaultReturnValue) const;
  2592. const StringArray& getAllKeys() const throw() { return keys; }
  2593. const StringArray& getAllValues() const throw() { return values; }
  2594. inline int size() const throw() { return keys.size(); };
  2595. void set (const String& key,
  2596. const String& value) throw();
  2597. void addArray (const StringPairArray& other);
  2598. void clear() throw();
  2599. void remove (const String& key) throw();
  2600. void remove (const int index) throw();
  2601. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  2602. const String getDescription() const;
  2603. void minimiseStorageOverheads() throw();
  2604. juce_UseDebuggingNewOperator
  2605. private:
  2606. StringArray keys, values;
  2607. bool ignoreCase;
  2608. };
  2609. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2610. /********* End of inlined file: juce_StringPairArray.h *********/
  2611. /********* Start of inlined file: juce_XmlElement.h *********/
  2612. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  2613. #define __JUCE_XMLELEMENT_JUCEHEADER__
  2614. /********* Start of inlined file: juce_OutputStream.h *********/
  2615. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2616. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2617. /********* Start of inlined file: juce_InputStream.h *********/
  2618. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2619. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2620. class JUCE_API InputStream
  2621. {
  2622. public:
  2623. virtual ~InputStream() {}
  2624. virtual int64 getTotalLength() = 0;
  2625. virtual bool isExhausted() = 0;
  2626. virtual int read (void* destBuffer,
  2627. int maxBytesToRead) = 0;
  2628. virtual char readByte();
  2629. virtual bool readBool();
  2630. virtual short readShort();
  2631. virtual short readShortBigEndian();
  2632. virtual int readInt();
  2633. virtual int readIntBigEndian();
  2634. virtual int64 readInt64();
  2635. virtual int64 readInt64BigEndian();
  2636. virtual float readFloat();
  2637. virtual float readFloatBigEndian();
  2638. virtual double readDouble();
  2639. virtual double readDoubleBigEndian();
  2640. virtual int readCompressedInt();
  2641. virtual const String readNextLine();
  2642. virtual const String readString();
  2643. virtual const String readEntireStreamAsString();
  2644. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2645. int maxNumBytesToRead = -1);
  2646. virtual int64 getPosition() = 0;
  2647. virtual bool setPosition (int64 newPosition) = 0;
  2648. virtual void skipNextBytes (int64 numBytesToSkip);
  2649. juce_UseDebuggingNewOperator
  2650. protected:
  2651. InputStream() throw() {}
  2652. };
  2653. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2654. /********* End of inlined file: juce_InputStream.h *********/
  2655. class JUCE_API OutputStream
  2656. {
  2657. public:
  2658. virtual ~OutputStream();
  2659. virtual void flush() = 0;
  2660. virtual bool setPosition (int64 newPosition) = 0;
  2661. virtual int64 getPosition() = 0;
  2662. virtual bool write (const void* dataToWrite,
  2663. int howManyBytes) = 0;
  2664. virtual void writeByte (char byte);
  2665. virtual void writeBool (bool boolValue);
  2666. virtual void writeShort (short value);
  2667. virtual void writeShortBigEndian (short value);
  2668. virtual void writeInt (int value);
  2669. virtual void writeIntBigEndian (int value);
  2670. virtual void writeInt64 (int64 value);
  2671. virtual void writeInt64BigEndian (int64 value);
  2672. virtual void writeFloat (float value);
  2673. virtual void writeFloatBigEndian (float value);
  2674. virtual void writeDouble (double value);
  2675. virtual void writeDoubleBigEndian (double value);
  2676. virtual void writeCompressedInt (int value);
  2677. virtual void writeString (const String& text);
  2678. virtual void writeText (const String& text,
  2679. const bool asUnicode,
  2680. const bool writeUnicodeHeaderBytes);
  2681. virtual void printf (const char* format, ...);
  2682. virtual int writeFromInputStream (InputStream& source,
  2683. int maxNumBytesToWrite);
  2684. virtual OutputStream& operator<< (const int number);
  2685. virtual OutputStream& operator<< (const double number);
  2686. virtual OutputStream& operator<< (const char character);
  2687. virtual OutputStream& operator<< (const char* const text);
  2688. virtual OutputStream& operator<< (const juce_wchar* const text);
  2689. virtual OutputStream& operator<< (const String& text);
  2690. juce_UseDebuggingNewOperator
  2691. protected:
  2692. OutputStream() throw();
  2693. };
  2694. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2695. /********* End of inlined file: juce_OutputStream.h *********/
  2696. /********* Start of inlined file: juce_File.h *********/
  2697. #ifndef __JUCE_FILE_JUCEHEADER__
  2698. #define __JUCE_FILE_JUCEHEADER__
  2699. /********* Start of inlined file: juce_Time.h *********/
  2700. #ifndef __JUCE_TIME_JUCEHEADER__
  2701. #define __JUCE_TIME_JUCEHEADER__
  2702. /********* Start of inlined file: juce_RelativeTime.h *********/
  2703. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  2704. #define __JUCE_RELATIVETIME_JUCEHEADER__
  2705. class JUCE_API RelativeTime
  2706. {
  2707. public:
  2708. explicit RelativeTime (const double seconds = 0.0) throw();
  2709. RelativeTime (const RelativeTime& other) throw();
  2710. const RelativeTime& operator= (const RelativeTime& other) throw();
  2711. ~RelativeTime() throw();
  2712. static const RelativeTime milliseconds (const int milliseconds) throw();
  2713. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  2714. static const RelativeTime minutes (const double numberOfMinutes) throw();
  2715. static const RelativeTime hours (const double numberOfHours) throw();
  2716. static const RelativeTime days (const double numberOfDays) throw();
  2717. static const RelativeTime weeks (const double numberOfWeeks) throw();
  2718. int64 inMilliseconds() const throw();
  2719. double inSeconds() const throw() { return seconds; }
  2720. double inMinutes() const throw();
  2721. double inHours() const throw();
  2722. double inDays() const throw();
  2723. double inWeeks() const throw();
  2724. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  2725. bool operator== (const RelativeTime& other) const throw();
  2726. bool operator!= (const RelativeTime& other) const throw();
  2727. bool operator> (const RelativeTime& other) const throw();
  2728. bool operator< (const RelativeTime& other) const throw();
  2729. bool operator>= (const RelativeTime& other) const throw();
  2730. bool operator<= (const RelativeTime& other) const throw();
  2731. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  2732. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  2733. const RelativeTime operator+ (const double secondsToAdd) const throw();
  2734. const RelativeTime operator- (const double secondsToSubtract) const throw();
  2735. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  2736. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  2737. const RelativeTime& operator+= (const double secondsToAdd) throw();
  2738. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  2739. juce_UseDebuggingNewOperator
  2740. private:
  2741. double seconds;
  2742. };
  2743. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  2744. /********* End of inlined file: juce_RelativeTime.h *********/
  2745. class JUCE_API Time
  2746. {
  2747. public:
  2748. Time() throw();
  2749. Time (const Time& other) throw();
  2750. Time (const int64 millisecondsSinceEpoch) throw();
  2751. Time (const int year,
  2752. const int month,
  2753. const int day,
  2754. const int hours,
  2755. const int minutes,
  2756. const int seconds = 0,
  2757. const int milliseconds = 0,
  2758. const bool useLocalTime = true) throw();
  2759. ~Time() throw();
  2760. const Time& operator= (const Time& other) throw();
  2761. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  2762. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  2763. int getYear() const throw();
  2764. int getMonth() const throw();
  2765. const String getMonthName (const bool threeLetterVersion) const throw();
  2766. int getDayOfMonth() const throw();
  2767. int getDayOfWeek() const throw();
  2768. const String getWeekdayName (const bool threeLetterVersion) const throw();
  2769. int getHours() const throw();
  2770. bool isAfternoon() const throw();
  2771. int getHoursInAmPmFormat() const throw();
  2772. int getMinutes() const throw();
  2773. int getSeconds() const throw();
  2774. int getMilliseconds() const throw();
  2775. bool isDaylightSavingTime() const throw();
  2776. const String getTimeZone() const throw();
  2777. const String toString (const bool includeDate,
  2778. const bool includeTime,
  2779. const bool includeSeconds = true,
  2780. const bool use24HourClock = false) const throw();
  2781. const String formatted (const tchar* const format) const throw();
  2782. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  2783. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  2784. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  2785. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  2786. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  2787. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  2788. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  2789. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  2790. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  2791. bool setSystemTimeToThisTime() const throw();
  2792. static const String getWeekdayName (int dayNumber,
  2793. const bool threeLetterVersion) throw();
  2794. static const String getMonthName (int monthNumber,
  2795. const bool threeLetterVersion) throw();
  2796. // Static methods for getting system timers directly..
  2797. static int64 currentTimeMillis() throw();
  2798. static uint32 getMillisecondCounter() throw();
  2799. static double getMillisecondCounterHiRes() throw();
  2800. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  2801. static uint32 getApproximateMillisecondCounter() throw();
  2802. // High-resolution timers..
  2803. static int64 getHighResolutionTicks() throw();
  2804. static int64 getHighResolutionTicksPerSecond() throw();
  2805. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  2806. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  2807. private:
  2808. int64 millisSinceEpoch;
  2809. };
  2810. #endif // __JUCE_TIME_JUCEHEADER__
  2811. /********* End of inlined file: juce_Time.h *********/
  2812. class FileInputStream;
  2813. class FileOutputStream;
  2814. class JUCE_API File
  2815. {
  2816. public:
  2817. File() {}
  2818. File (const String& path);
  2819. File (const File& other);
  2820. ~File() {}
  2821. const File& operator= (const String& newFilePath);
  2822. const File& operator= (const File& otherFile);
  2823. static const File nonexistent;
  2824. bool exists() const;
  2825. bool existsAsFile() const;
  2826. bool isDirectory() const;
  2827. int64 getSize() const;
  2828. static const String descriptionOfSizeInBytes (const int64 bytes);
  2829. const String& getFullPathName() const { return fullPath; }
  2830. const String getFileName() const;
  2831. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  2832. const String getFileExtension() const;
  2833. bool hasFileExtension (const String& extensionToTest) const;
  2834. const File withFileExtension (const String& newExtension) const;
  2835. const String getFileNameWithoutExtension() const;
  2836. int hashCode() const;
  2837. int64 hashCode64() const;
  2838. const File getChildFile (String relativePath) const;
  2839. const File getSiblingFile (const String& siblingFileName) const;
  2840. const File getParentDirectory() const;
  2841. bool isAChildOf (const File& potentialParentDirectory) const;
  2842. const File getNonexistentChildFile (const String& prefix,
  2843. const String& suffix,
  2844. bool putNumbersInBrackets = true) const;
  2845. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  2846. bool operator== (const File& otherFile) const;
  2847. bool operator!= (const File& otherFile) const;
  2848. bool hasWriteAccess() const;
  2849. bool setReadOnly (const bool shouldBeReadOnly,
  2850. const bool applyRecursively = false) const;
  2851. bool isHidden() const;
  2852. const File getLinkedTarget() const;
  2853. const Time getLastModificationTime() const;
  2854. const Time getLastAccessTime() const;
  2855. const Time getCreationTime() const;
  2856. bool setLastModificationTime (const Time& newTime) const;
  2857. bool setLastAccessTime (const Time& newTime) const;
  2858. bool setCreationTime (const Time& newTime) const;
  2859. const String getVersion() const;
  2860. bool create() const;
  2861. bool createDirectory() const;
  2862. bool deleteFile() const;
  2863. bool deleteRecursively() const;
  2864. bool moveToTrash() const;
  2865. bool moveFileTo (const File& targetLocation) const;
  2866. bool copyFileTo (const File& targetLocation) const;
  2867. bool copyDirectoryTo (const File& newDirectory) const;
  2868. enum TypesOfFileToFind
  2869. {
  2870. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  2871. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  2872. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  2873. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  2874. };
  2875. int findChildFiles (OwnedArray<File>& results,
  2876. const int whatToLookFor,
  2877. const bool searchRecursively,
  2878. const String& wildCardPattern = JUCE_T("*")) const;
  2879. int getNumberOfChildFiles (const int whatToLookFor,
  2880. const String& wildCardPattern = JUCE_T("*")) const;
  2881. bool containsSubDirectories() const;
  2882. FileInputStream* createInputStream() const;
  2883. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  2884. bool loadFileAsData (MemoryBlock& result) const;
  2885. const String loadFileAsString() const;
  2886. bool appendData (const void* const dataToAppend,
  2887. const int numberOfBytes) const;
  2888. bool replaceWithData (const void* const dataToWrite,
  2889. const int numberOfBytes) const;
  2890. bool appendText (const String& textToAppend,
  2891. const bool asUnicode = false,
  2892. const bool writeUnicodeHeaderBytes = false) const;
  2893. bool replaceWithText (const String& textToWrite,
  2894. const bool asUnicode = false,
  2895. const bool writeUnicodeHeaderBytes = false) const;
  2896. static void findFileSystemRoots (OwnedArray<File>& results);
  2897. const String getVolumeLabel() const;
  2898. int getVolumeSerialNumber() const;
  2899. int64 getBytesFreeOnVolume() const;
  2900. int64 getVolumeTotalSize() const;
  2901. bool isOnCDRomDrive() const;
  2902. bool isOnHardDisk() const;
  2903. bool isOnRemovableDrive() const;
  2904. bool startAsProcess (const String& parameters = String::empty) const;
  2905. void revealToUser() const;
  2906. enum SpecialLocationType
  2907. {
  2908. userHomeDirectory,
  2909. userDocumentsDirectory,
  2910. userDesktopDirectory,
  2911. userApplicationDataDirectory,
  2912. commonApplicationDataDirectory,
  2913. tempDirectory,
  2914. currentExecutableFile,
  2915. currentApplicationFile,
  2916. invokedExecutableFile,
  2917. globalApplicationsDirectory,
  2918. userMusicDirectory,
  2919. userMoviesDirectory,
  2920. };
  2921. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  2922. static const File createTempFile (const String& fileNameEnding);
  2923. static const File getCurrentWorkingDirectory();
  2924. bool setAsCurrentWorkingDirectory() const;
  2925. static const tchar separator;
  2926. static const tchar* separatorString;
  2927. static const String createLegalFileName (const String& fileNameToFix);
  2928. static const String createLegalPathName (const String& pathNameToFix);
  2929. static bool areFileNamesCaseSensitive();
  2930. static bool isAbsolutePath (const String& path);
  2931. juce_UseDebuggingNewOperator
  2932. private:
  2933. String fullPath;
  2934. // internal way of contructing a file without checking the path
  2935. friend class DirectoryIterator;
  2936. File (const String&, int);
  2937. const String getPathUpToLastSlash() const;
  2938. };
  2939. #endif // __JUCE_FILE_JUCEHEADER__
  2940. /********* End of inlined file: juce_File.h *********/
  2941. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  2942. \
  2943. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  2944. childElementVariableName != 0; \
  2945. childElementVariableName = childElementVariableName->getNextElement())
  2946. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  2947. \
  2948. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  2949. childElementVariableName != 0; \
  2950. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  2951. class JUCE_API XmlElement
  2952. {
  2953. public:
  2954. XmlElement (const String& tagName) throw();
  2955. XmlElement (const XmlElement& other) throw();
  2956. const XmlElement& operator= (const XmlElement& other) throw();
  2957. ~XmlElement() throw();
  2958. bool isEquivalentTo (const XmlElement* const other,
  2959. const bool ignoreOrderOfAttributes) const throw();
  2960. const String createDocument (const String& dtdToUse,
  2961. const bool allOnOneLine = false,
  2962. const bool includeXmlHeader = true,
  2963. const tchar* const encodingType = JUCE_T("UTF-8"),
  2964. const int lineWrapLength = 60) const throw();
  2965. void writeToStream (OutputStream& output,
  2966. const String& dtdToUse,
  2967. const bool allOnOneLine = false,
  2968. const bool includeXmlHeader = true,
  2969. const tchar* const encodingType = JUCE_T("UTF-8"),
  2970. const int lineWrapLength = 60) const throw();
  2971. bool writeToFile (const File& destinationFile,
  2972. const String& dtdToUse,
  2973. const tchar* const encodingType = JUCE_T("UTF-8"),
  2974. const int lineWrapLength = 60) const throw();
  2975. inline const String& getTagName() const throw() { return tagName; }
  2976. bool hasTagName (const tchar* const possibleTagName) const throw();
  2977. int getNumAttributes() const throw();
  2978. const String& getAttributeName (const int attributeIndex) const throw();
  2979. const String& getAttributeValue (const int attributeIndex) const throw();
  2980. // Attribute-handling methods..
  2981. bool hasAttribute (const tchar* const attributeName) const throw();
  2982. const String getStringAttribute (const tchar* const attributeName,
  2983. const tchar* const defaultReturnValue = 0) const throw();
  2984. bool compareAttribute (const tchar* const attributeName,
  2985. const tchar* const stringToCompareAgainst,
  2986. const bool ignoreCase = false) const throw();
  2987. int getIntAttribute (const tchar* const attributeName,
  2988. const int defaultReturnValue = 0) const throw();
  2989. double getDoubleAttribute (const tchar* const attributeName,
  2990. const double defaultReturnValue = 0.0) const throw();
  2991. bool getBoolAttribute (const tchar* const attributeName,
  2992. const bool defaultReturnValue = false) const throw();
  2993. void setAttribute (const tchar* const attributeName,
  2994. const String& newValue) throw();
  2995. void setAttribute (const tchar* const attributeName,
  2996. const tchar* const newValue) throw();
  2997. void setAttribute (const tchar* const attributeName,
  2998. const int newValue) throw();
  2999. void setAttribute (const tchar* const attributeName,
  3000. const double newValue) throw();
  3001. void removeAttribute (const tchar* const attributeName) throw();
  3002. void removeAllAttributes() throw();
  3003. // Child element methods..
  3004. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3005. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3006. XmlElement* getNextElementWithTagName (const tchar* const requiredTagName) const;
  3007. int getNumChildElements() const throw();
  3008. XmlElement* getChildElement (const int index) const throw();
  3009. XmlElement* getChildByName (const tchar* const tagNameToLookFor) const throw();
  3010. void addChildElement (XmlElement* const newChildElement) throw();
  3011. void insertChildElement (XmlElement* const newChildNode,
  3012. int indexToInsertAt) throw();
  3013. bool replaceChildElement (XmlElement* const currentChildElement,
  3014. XmlElement* const newChildNode) throw();
  3015. void removeChildElement (XmlElement* const childToRemove,
  3016. const bool shouldDeleteTheChild) throw();
  3017. void deleteAllChildElements() throw();
  3018. void deleteAllChildElementsWithTagName (const tchar* const tagName) throw();
  3019. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3020. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3021. template <class ElementComparator>
  3022. void sortChildElements (ElementComparator& comparator,
  3023. const bool retainOrderOfEquivalentItems = false) throw()
  3024. {
  3025. const int num = getNumChildElements();
  3026. if (num > 1)
  3027. {
  3028. HeapBlock <XmlElement*> elems (num);
  3029. getChildElementsAsArray (elems);
  3030. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3031. reorderChildElements (elems, num);
  3032. }
  3033. }
  3034. bool isTextElement() const throw();
  3035. const String getText() const throw();
  3036. void setText (const String& newText) throw();
  3037. const String getAllSubText() const throw();
  3038. const String getChildElementAllSubText (const tchar* const childTagName,
  3039. const String& defaultReturnValue) const throw();
  3040. void addTextElement (const String& text) throw();
  3041. void deleteAllTextElements() throw();
  3042. static XmlElement* createTextElement (const String& text) throw();
  3043. juce_UseDebuggingNewOperator
  3044. private:
  3045. friend class XmlDocument;
  3046. String tagName;
  3047. XmlElement* firstChildElement;
  3048. XmlElement* nextElement;
  3049. struct XmlAttributeNode
  3050. {
  3051. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3052. XmlAttributeNode (const String& name, const String& value) throw();
  3053. String name, value;
  3054. XmlAttributeNode* next;
  3055. private:
  3056. const XmlAttributeNode& operator= (const XmlAttributeNode&);
  3057. };
  3058. XmlAttributeNode* attributes;
  3059. XmlElement (int) throw(); // for internal use
  3060. XmlElement (const tchar* const tagNameText, const int nameLen) throw();
  3061. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3062. void writeElementAsText (OutputStream& out,
  3063. const int indentationLevel,
  3064. const int lineWrapLength) const throw();
  3065. void getChildElementsAsArray (XmlElement**) const throw();
  3066. void reorderChildElements (XmlElement** const, const int) throw();
  3067. };
  3068. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3069. /********* End of inlined file: juce_XmlElement.h *********/
  3070. class JUCE_API PropertySet
  3071. {
  3072. public:
  3073. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3074. PropertySet (const PropertySet& other) throw();
  3075. const PropertySet& operator= (const PropertySet& other) throw();
  3076. virtual ~PropertySet();
  3077. const String getValue (const String& keyName,
  3078. const String& defaultReturnValue = String::empty) const throw();
  3079. int getIntValue (const String& keyName,
  3080. const int defaultReturnValue = 0) const throw();
  3081. double getDoubleValue (const String& keyName,
  3082. const double defaultReturnValue = 0.0) const throw();
  3083. bool getBoolValue (const String& keyName,
  3084. const bool defaultReturnValue = false) const throw();
  3085. XmlElement* getXmlValue (const String& keyName) const;
  3086. void setValue (const String& keyName, const String& value) throw();
  3087. void setValue (const String& keyName, const tchar* const value) throw();
  3088. void setValue (const String& keyName, const int value) throw();
  3089. void setValue (const String& keyName, const double value) throw();
  3090. void setValue (const String& keyName, const bool value) throw();
  3091. void setValue (const String& keyName, const XmlElement* const xml);
  3092. void removeValue (const String& keyName) throw();
  3093. bool containsKey (const String& keyName) const throw();
  3094. void clear();
  3095. StringPairArray& getAllProperties() throw() { return properties; }
  3096. const CriticalSection& getLock() const throw() { return lock; }
  3097. XmlElement* createXml (const String& nodeName) const throw();
  3098. void restoreFromXml (const XmlElement& xml) throw();
  3099. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3100. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3101. juce_UseDebuggingNewOperator
  3102. protected:
  3103. virtual void propertyChanged();
  3104. private:
  3105. StringPairArray properties;
  3106. PropertySet* fallbackProperties;
  3107. CriticalSection lock;
  3108. bool ignoreCaseOfKeys;
  3109. };
  3110. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3111. /********* End of inlined file: juce_PropertySet.h *********/
  3112. #endif
  3113. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3114. /********* Start of inlined file: juce_ReferenceCountedArray.h *********/
  3115. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3116. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3117. /********* Start of inlined file: juce_ReferenceCountedObject.h *********/
  3118. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3119. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3120. /********* Start of inlined file: juce_Atomic.h *********/
  3121. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  3122. #define __JUCE_ATOMIC_JUCEHEADER__
  3123. class JUCE_API Atomic
  3124. {
  3125. public:
  3126. static void increment (int& variable);
  3127. static int incrementAndReturn (int& variable);
  3128. static void decrement (int& variable);
  3129. static int decrementAndReturn (int& variable);
  3130. };
  3131. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  3132. #include <libkern/OSAtomic.h>
  3133. inline void Atomic::increment (int& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  3134. inline int Atomic::incrementAndReturn (int& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  3135. inline void Atomic::decrement (int& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  3136. inline int Atomic::decrementAndReturn (int& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  3137. #elif JUCE_GCC
  3138. #if JUCE_USE_GCC_ATOMIC_INTRINSICS // Linux with intrinsics...
  3139. inline void Atomic::increment (int& variable) { __sync_add_and_fetch (&variable, 1); }
  3140. inline int Atomic::incrementAndReturn (int& variable) { return __sync_add_and_fetch (&variable, 1); }
  3141. inline void Atomic::decrement (int& variable) { __sync_add_and_fetch (&variable, -1); }
  3142. inline int Atomic::decrementAndReturn (int& variable) { return __sync_add_and_fetch (&variable, -1); }
  3143. #else // Linux without intrinsics...
  3144. inline void Atomic::increment (int& variable)
  3145. {
  3146. __asm__ __volatile__ (
  3147. #if JUCE_64BIT
  3148. "lock incl (%%rax)"
  3149. :
  3150. : "a" (&variable)
  3151. : "cc", "memory");
  3152. #else
  3153. "lock incl %0"
  3154. : "=m" (variable)
  3155. : "m" (variable));
  3156. #endif
  3157. }
  3158. inline int Atomic::incrementAndReturn (int& variable)
  3159. {
  3160. int result;
  3161. __asm__ __volatile__ (
  3162. #if JUCE_64BIT
  3163. "lock xaddl %%ebx, (%%rax) \n\
  3164. incl %%ebx"
  3165. : "=b" (result)
  3166. : "a" (&variable), "b" (1)
  3167. : "cc", "memory");
  3168. #else
  3169. "lock xaddl %%eax, (%%ecx) \n\
  3170. incl %%eax"
  3171. : "=a" (result)
  3172. : "c" (&variable), "a" (1)
  3173. : "memory");
  3174. #endif
  3175. return result;
  3176. }
  3177. inline void Atomic::decrement (int& variable)
  3178. {
  3179. __asm__ __volatile__ (
  3180. #if JUCE_64BIT
  3181. "lock decl (%%rax)"
  3182. :
  3183. : "a" (&variable)
  3184. : "cc", "memory");
  3185. #else
  3186. "lock decl %0"
  3187. : "=m" (variable)
  3188. : "m" (variable));
  3189. #endif
  3190. }
  3191. inline int Atomic::decrementAndReturn (int& variable)
  3192. {
  3193. int result;
  3194. __asm__ __volatile__ (
  3195. #if JUCE_64BIT
  3196. "lock xaddl %%ebx, (%%rax) \n\
  3197. decl %%ebx"
  3198. : "=b" (result)
  3199. : "a" (&variable), "b" (-1)
  3200. : "cc", "memory");
  3201. #else
  3202. "lock xaddl %%eax, (%%ecx) \n\
  3203. decl %%eax"
  3204. : "=a" (result)
  3205. : "c" (&variable), "a" (-1)
  3206. : "memory");
  3207. #endif
  3208. return result;
  3209. }
  3210. #endif
  3211. #elif JUCE_USE_INTRINSICS // Windows with intrinsics...
  3212. #pragma intrinsic (_InterlockedIncrement)
  3213. #pragma intrinsic (_InterlockedDecrement)
  3214. inline void Atomic::increment (int& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  3215. inline int Atomic::incrementAndReturn (int& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  3216. inline void Atomic::decrement (int& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  3217. inline int Atomic::decrementAndReturn (int& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  3218. #else // Windows without intrinsics...
  3219. inline void Atomic::increment (int& variable)
  3220. {
  3221. __asm {
  3222. mov ecx, dword ptr [variable]
  3223. lock inc dword ptr [ecx]
  3224. }
  3225. }
  3226. inline int Atomic::incrementAndReturn (int& variable)
  3227. {
  3228. int result;
  3229. __asm {
  3230. mov ecx, dword ptr [variable]
  3231. mov eax, 1
  3232. lock xadd dword ptr [ecx], eax
  3233. inc eax
  3234. mov result, eax
  3235. }
  3236. return result;
  3237. }
  3238. inline void Atomic::decrement (int& variable)
  3239. {
  3240. __asm {
  3241. mov ecx, dword ptr [variable]
  3242. lock dec dword ptr [ecx]
  3243. }
  3244. }
  3245. inline int Atomic::decrementAndReturn (int& variable)
  3246. {
  3247. int result;
  3248. __asm {
  3249. mov ecx, dword ptr [variable]
  3250. mov eax, -1
  3251. lock xadd dword ptr [ecx], eax
  3252. dec eax
  3253. mov result, eax
  3254. }
  3255. return result;
  3256. }
  3257. #endif
  3258. #endif // __JUCE_ATOMIC_JUCEHEADER__
  3259. /********* End of inlined file: juce_Atomic.h *********/
  3260. class JUCE_API ReferenceCountedObject
  3261. {
  3262. public:
  3263. inline void incReferenceCount() throw()
  3264. {
  3265. Atomic::increment (refCounts);
  3266. jassert (refCounts > 0);
  3267. }
  3268. inline void decReferenceCount() throw()
  3269. {
  3270. jassert (refCounts > 0);
  3271. if (Atomic::decrementAndReturn (refCounts) == 0)
  3272. delete this;
  3273. }
  3274. inline int getReferenceCount() const throw()
  3275. {
  3276. return refCounts;
  3277. }
  3278. protected:
  3279. ReferenceCountedObject()
  3280. : refCounts (0)
  3281. {
  3282. }
  3283. virtual ~ReferenceCountedObject()
  3284. {
  3285. // it's dangerous to delete an object that's still referenced by something else!
  3286. jassert (refCounts == 0);
  3287. }
  3288. private:
  3289. int refCounts;
  3290. };
  3291. template <class ReferenceCountedObjectClass>
  3292. class ReferenceCountedObjectPtr
  3293. {
  3294. public:
  3295. inline ReferenceCountedObjectPtr() throw()
  3296. : referencedObject (0)
  3297. {
  3298. }
  3299. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  3300. : referencedObject (refCountedObject)
  3301. {
  3302. if (refCountedObject != 0)
  3303. refCountedObject->incReferenceCount();
  3304. }
  3305. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  3306. : referencedObject (other.referencedObject)
  3307. {
  3308. if (referencedObject != 0)
  3309. referencedObject->incReferenceCount();
  3310. }
  3311. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  3312. {
  3313. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  3314. if (newObject != referencedObject)
  3315. {
  3316. if (newObject != 0)
  3317. newObject->incReferenceCount();
  3318. ReferenceCountedObjectClass* const oldObject = referencedObject;
  3319. referencedObject = newObject;
  3320. if (oldObject != 0)
  3321. oldObject->decReferenceCount();
  3322. }
  3323. return *this;
  3324. }
  3325. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  3326. {
  3327. if (referencedObject != newObject)
  3328. {
  3329. if (newObject != 0)
  3330. newObject->incReferenceCount();
  3331. ReferenceCountedObjectClass* const oldObject = referencedObject;
  3332. referencedObject = newObject;
  3333. if (oldObject != 0)
  3334. oldObject->decReferenceCount();
  3335. }
  3336. return *this;
  3337. }
  3338. inline ~ReferenceCountedObjectPtr()
  3339. {
  3340. if (referencedObject != 0)
  3341. referencedObject->decReferenceCount();
  3342. }
  3343. inline operator ReferenceCountedObjectClass*() const throw()
  3344. {
  3345. return referencedObject;
  3346. }
  3347. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  3348. {
  3349. return referencedObject == object;
  3350. }
  3351. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  3352. {
  3353. return referencedObject != object;
  3354. }
  3355. // the -> operator is called on the referenced object
  3356. inline ReferenceCountedObjectClass* operator->() const throw()
  3357. {
  3358. return referencedObject;
  3359. }
  3360. private:
  3361. ReferenceCountedObjectClass* referencedObject;
  3362. };
  3363. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3364. /********* End of inlined file: juce_ReferenceCountedObject.h *********/
  3365. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3366. class ReferenceCountedArray
  3367. {
  3368. public:
  3369. ReferenceCountedArray() throw()
  3370. : numUsed (0)
  3371. {
  3372. }
  3373. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3374. {
  3375. other.lockArray();
  3376. numUsed = other.numUsed;
  3377. data.setAllocatedSize (numUsed);
  3378. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3379. for (int i = numUsed; --i >= 0;)
  3380. if (data.elements[i] != 0)
  3381. data.elements[i]->incReferenceCount();
  3382. other.unlockArray();
  3383. }
  3384. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3385. {
  3386. if (this != &other)
  3387. {
  3388. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3389. swapWithArray (other);
  3390. }
  3391. return *this;
  3392. }
  3393. ~ReferenceCountedArray()
  3394. {
  3395. clear();
  3396. }
  3397. void clear()
  3398. {
  3399. lock.enter();
  3400. while (numUsed > 0)
  3401. if (data.elements [--numUsed] != 0)
  3402. data.elements [numUsed]->decReferenceCount();
  3403. jassert (numUsed == 0);
  3404. data.setAllocatedSize (0);
  3405. lock.exit();
  3406. }
  3407. inline int size() const throw()
  3408. {
  3409. return numUsed;
  3410. }
  3411. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3412. {
  3413. lock.enter();
  3414. const ReferenceCountedObjectPtr<ObjectClass> result ((((unsigned int) index) < (unsigned int) numUsed)
  3415. ? data.elements [index]
  3416. : (ObjectClass*) 0);
  3417. lock.exit();
  3418. return result;
  3419. }
  3420. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3421. {
  3422. lock.enter();
  3423. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3424. const ReferenceCountedObjectPtr<ObjectClass> result (data.elements [index]);
  3425. lock.exit();
  3426. return result;
  3427. }
  3428. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3429. {
  3430. lock.enter();
  3431. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [0]
  3432. : (ObjectClass*) 0);
  3433. lock.exit();
  3434. return result;
  3435. }
  3436. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3437. {
  3438. lock.enter();
  3439. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [numUsed - 1]
  3440. : (ObjectClass*) 0);
  3441. lock.exit();
  3442. return result;
  3443. }
  3444. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3445. {
  3446. int result = -1;
  3447. lock.enter();
  3448. ObjectClass** e = data.elements;
  3449. for (int i = numUsed; --i >= 0;)
  3450. {
  3451. if (objectToLookFor == *e)
  3452. {
  3453. result = (int) (e - data.elements);
  3454. break;
  3455. }
  3456. ++e;
  3457. }
  3458. lock.exit();
  3459. return result;
  3460. }
  3461. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3462. {
  3463. lock.enter();
  3464. ObjectClass** e = data.elements;
  3465. for (int i = numUsed; --i >= 0;)
  3466. {
  3467. if (objectToLookFor == *e)
  3468. {
  3469. lock.exit();
  3470. return true;
  3471. }
  3472. ++e;
  3473. }
  3474. lock.exit();
  3475. return false;
  3476. }
  3477. void add (ObjectClass* const newObject) throw()
  3478. {
  3479. lock.enter();
  3480. data.ensureAllocatedSize (numUsed + 1);
  3481. data.elements [numUsed++] = newObject;
  3482. if (newObject != 0)
  3483. newObject->incReferenceCount();
  3484. lock.exit();
  3485. }
  3486. void insert (int indexToInsertAt,
  3487. ObjectClass* const newObject) throw()
  3488. {
  3489. if (indexToInsertAt >= 0)
  3490. {
  3491. lock.enter();
  3492. if (indexToInsertAt > numUsed)
  3493. indexToInsertAt = numUsed;
  3494. data.ensureAllocatedSize (numUsed + 1);
  3495. ObjectClass** const e = data.elements + indexToInsertAt;
  3496. const int numToMove = numUsed - indexToInsertAt;
  3497. if (numToMove > 0)
  3498. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3499. *e = newObject;
  3500. if (newObject != 0)
  3501. newObject->incReferenceCount();
  3502. ++numUsed;
  3503. lock.exit();
  3504. }
  3505. else
  3506. {
  3507. add (newObject);
  3508. }
  3509. }
  3510. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3511. {
  3512. lock.enter();
  3513. if (! contains (newObject))
  3514. add (newObject);
  3515. lock.exit();
  3516. }
  3517. void set (const int indexToChange,
  3518. ObjectClass* const newObject)
  3519. {
  3520. if (indexToChange >= 0)
  3521. {
  3522. lock.enter();
  3523. if (newObject != 0)
  3524. newObject->incReferenceCount();
  3525. if (indexToChange < numUsed)
  3526. {
  3527. if (data.elements [indexToChange] != 0)
  3528. data.elements [indexToChange]->decReferenceCount();
  3529. data.elements [indexToChange] = newObject;
  3530. }
  3531. else
  3532. {
  3533. data.ensureAllocatedSize (numUsed + 1);
  3534. data.elements [numUsed++] = newObject;
  3535. }
  3536. lock.exit();
  3537. }
  3538. }
  3539. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3540. int startIndex = 0,
  3541. int numElementsToAdd = -1) throw()
  3542. {
  3543. arrayToAddFrom.lockArray();
  3544. lock.enter();
  3545. if (startIndex < 0)
  3546. {
  3547. jassertfalse
  3548. startIndex = 0;
  3549. }
  3550. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3551. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3552. if (numElementsToAdd > 0)
  3553. {
  3554. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3555. while (--numElementsToAdd >= 0)
  3556. add (arrayToAddFrom.getUnchecked (startIndex++));
  3557. }
  3558. lock.exit();
  3559. arrayToAddFrom.unlockArray();
  3560. }
  3561. template <class ElementComparator>
  3562. void addSorted (ElementComparator& comparator,
  3563. ObjectClass* newObject) throw()
  3564. {
  3565. lock.enter();
  3566. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  3567. lock.exit();
  3568. }
  3569. template <class ElementComparator>
  3570. void addOrReplaceSorted (ElementComparator& comparator,
  3571. ObjectClass* newObject) throw()
  3572. {
  3573. lock.enter();
  3574. const int index = findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed);
  3575. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3576. set (index - 1, newObject); // replace an existing object that matches
  3577. else
  3578. insert (index, newObject); // no match, so insert the new one
  3579. lock.exit();
  3580. }
  3581. void remove (const int indexToRemove)
  3582. {
  3583. lock.enter();
  3584. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3585. {
  3586. ObjectClass** const e = data.elements + indexToRemove;
  3587. if (*e != 0)
  3588. (*e)->decReferenceCount();
  3589. --numUsed;
  3590. const int numberToShift = numUsed - indexToRemove;
  3591. if (numberToShift > 0)
  3592. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3593. if ((numUsed << 1) < data.numAllocated)
  3594. minimiseStorageOverheads();
  3595. }
  3596. lock.exit();
  3597. }
  3598. void removeObject (ObjectClass* const objectToRemove)
  3599. {
  3600. lock.enter();
  3601. remove (indexOf (objectToRemove));
  3602. lock.exit();
  3603. }
  3604. void removeRange (const int startIndex,
  3605. const int numberToRemove)
  3606. {
  3607. lock.enter();
  3608. const int start = jlimit (0, numUsed, startIndex);
  3609. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3610. if (end > start)
  3611. {
  3612. int i;
  3613. for (i = start; i < end; ++i)
  3614. {
  3615. if (data.elements[i] != 0)
  3616. {
  3617. data.elements[i]->decReferenceCount();
  3618. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3619. }
  3620. }
  3621. const int rangeSize = end - start;
  3622. ObjectClass** e = data.elements + start;
  3623. i = numUsed - end;
  3624. numUsed -= rangeSize;
  3625. while (--i >= 0)
  3626. {
  3627. *e = e [rangeSize];
  3628. ++e;
  3629. }
  3630. if ((numUsed << 1) < data.numAllocated)
  3631. minimiseStorageOverheads();
  3632. }
  3633. lock.exit();
  3634. }
  3635. void removeLast (int howManyToRemove = 1)
  3636. {
  3637. lock.enter();
  3638. if (howManyToRemove > numUsed)
  3639. howManyToRemove = numUsed;
  3640. while (--howManyToRemove >= 0)
  3641. remove (numUsed - 1);
  3642. lock.exit();
  3643. }
  3644. void swap (const int index1,
  3645. const int index2) throw()
  3646. {
  3647. lock.enter();
  3648. if (((unsigned int) index1) < (unsigned int) numUsed
  3649. && ((unsigned int) index2) < (unsigned int) numUsed)
  3650. {
  3651. swapVariables (data.elements [index1],
  3652. data.elements [index2]);
  3653. }
  3654. lock.exit();
  3655. }
  3656. void move (const int currentIndex,
  3657. int newIndex) throw()
  3658. {
  3659. if (currentIndex != newIndex)
  3660. {
  3661. lock.enter();
  3662. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3663. {
  3664. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3665. newIndex = numUsed - 1;
  3666. ObjectClass* const value = data.elements [currentIndex];
  3667. if (newIndex > currentIndex)
  3668. {
  3669. memmove (data.elements + currentIndex,
  3670. data.elements + currentIndex + 1,
  3671. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3672. }
  3673. else
  3674. {
  3675. memmove (data.elements + newIndex + 1,
  3676. data.elements + newIndex,
  3677. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3678. }
  3679. data.elements [newIndex] = value;
  3680. }
  3681. lock.exit();
  3682. }
  3683. }
  3684. void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
  3685. {
  3686. lock.enter();
  3687. otherArray.lock.enter();
  3688. data.swapWith (otherArray.data);
  3689. swapVariables (numUsed, otherArray.numUsed);
  3690. otherArray.lock.exit();
  3691. lock.exit();
  3692. }
  3693. bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3694. {
  3695. other.lockArray();
  3696. lock.enter();
  3697. bool result = numUsed == other.numUsed;
  3698. if (result)
  3699. {
  3700. for (int i = numUsed; --i >= 0;)
  3701. {
  3702. if (data.elements [i] != other.data.elements [i])
  3703. {
  3704. result = false;
  3705. break;
  3706. }
  3707. }
  3708. }
  3709. lock.exit();
  3710. other.unlockArray();
  3711. return result;
  3712. }
  3713. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3714. {
  3715. return ! operator== (other);
  3716. }
  3717. template <class ElementComparator>
  3718. void sort (ElementComparator& comparator,
  3719. const bool retainOrderOfEquivalentItems = false) const throw()
  3720. {
  3721. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3722. // avoids getting warning messages about the parameter being unused
  3723. lock.enter();
  3724. sortArray (comparator, (ObjectClass*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  3725. lock.exit();
  3726. }
  3727. void minimiseStorageOverheads() throw()
  3728. {
  3729. lock.enter();
  3730. data.shrinkToNoMoreThan (numUsed);
  3731. lock.exit();
  3732. }
  3733. void lockArray() const throw()
  3734. {
  3735. lock.enter();
  3736. }
  3737. void unlockArray() const throw()
  3738. {
  3739. lock.exit();
  3740. }
  3741. juce_UseDebuggingNewOperator
  3742. private:
  3743. ArrayAllocationBase <ObjectClass*> data;
  3744. int numUsed;
  3745. TypeOfCriticalSectionToUse lock;
  3746. };
  3747. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3748. /********* End of inlined file: juce_ReferenceCountedArray.h *********/
  3749. #endif
  3750. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3751. #endif
  3752. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3753. #endif
  3754. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3755. /********* Start of inlined file: juce_SortedSet.h *********/
  3756. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3757. #define __JUCE_SORTEDSET_JUCEHEADER__
  3758. #if JUCE_MSVC
  3759. #pragma warning (push)
  3760. #pragma warning (disable: 4512)
  3761. #endif
  3762. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3763. class SortedSet
  3764. {
  3765. public:
  3766. SortedSet() throw()
  3767. : numUsed (0)
  3768. {
  3769. }
  3770. SortedSet (const SortedSet<ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3771. {
  3772. other.lockSet();
  3773. numUsed = other.numUsed;
  3774. data.setAllocatedSize (other.numUsed);
  3775. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3776. other.unlockSet();
  3777. }
  3778. ~SortedSet() throw()
  3779. {
  3780. }
  3781. SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3782. {
  3783. if (this != &other)
  3784. {
  3785. other.lockSet();
  3786. lock.enter();
  3787. data.ensureAllocatedSize (other.size());
  3788. numUsed = other.numUsed;
  3789. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3790. minimiseStorageOverheads();
  3791. lock.exit();
  3792. other.unlockSet();
  3793. }
  3794. return *this;
  3795. }
  3796. bool operator== (const SortedSet<ElementType>& other) const throw()
  3797. {
  3798. lock.enter();
  3799. if (numUsed != other.numUsed)
  3800. {
  3801. lock.exit();
  3802. return false;
  3803. }
  3804. for (int i = numUsed; --i >= 0;)
  3805. {
  3806. if (data.elements [i] != other.data.elements [i])
  3807. {
  3808. lock.exit();
  3809. return false;
  3810. }
  3811. }
  3812. lock.exit();
  3813. return true;
  3814. }
  3815. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3816. {
  3817. return ! operator== (other);
  3818. }
  3819. void clear() throw()
  3820. {
  3821. lock.enter();
  3822. data.setAllocatedSize (0);
  3823. numUsed = 0;
  3824. lock.exit();
  3825. }
  3826. void clearQuick() throw()
  3827. {
  3828. lock.enter();
  3829. numUsed = 0;
  3830. lock.exit();
  3831. }
  3832. inline int size() const throw()
  3833. {
  3834. return numUsed;
  3835. }
  3836. inline ElementType operator[] (const int index) const throw()
  3837. {
  3838. lock.enter();
  3839. const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
  3840. ? data.elements [index]
  3841. : (ElementType) 0;
  3842. lock.exit();
  3843. return result;
  3844. }
  3845. inline ElementType getUnchecked (const int index) const throw()
  3846. {
  3847. lock.enter();
  3848. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3849. const ElementType result = data.elements [index];
  3850. lock.exit();
  3851. return result;
  3852. }
  3853. inline ElementType getFirst() const throw()
  3854. {
  3855. lock.enter();
  3856. const ElementType result = (numUsed > 0) ? data.elements [0]
  3857. : (ElementType) 0;
  3858. lock.exit();
  3859. return result;
  3860. }
  3861. inline ElementType getLast() const throw()
  3862. {
  3863. lock.enter();
  3864. const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
  3865. : (ElementType) 0;
  3866. lock.exit();
  3867. return result;
  3868. }
  3869. int indexOf (const ElementType elementToLookFor) const throw()
  3870. {
  3871. lock.enter();
  3872. int start = 0;
  3873. int end = numUsed;
  3874. for (;;)
  3875. {
  3876. if (start >= end)
  3877. {
  3878. lock.exit();
  3879. return -1;
  3880. }
  3881. else if (elementToLookFor == data.elements [start])
  3882. {
  3883. lock.exit();
  3884. return start;
  3885. }
  3886. else
  3887. {
  3888. const int halfway = (start + end) >> 1;
  3889. if (halfway == start)
  3890. {
  3891. lock.exit();
  3892. return -1;
  3893. }
  3894. else if (elementToLookFor >= data.elements [halfway])
  3895. start = halfway;
  3896. else
  3897. end = halfway;
  3898. }
  3899. }
  3900. }
  3901. bool contains (const ElementType elementToLookFor) const throw()
  3902. {
  3903. lock.enter();
  3904. int start = 0;
  3905. int end = numUsed;
  3906. for (;;)
  3907. {
  3908. if (start >= end)
  3909. {
  3910. lock.exit();
  3911. return false;
  3912. }
  3913. else if (elementToLookFor == data.elements [start])
  3914. {
  3915. lock.exit();
  3916. return true;
  3917. }
  3918. else
  3919. {
  3920. const int halfway = (start + end) >> 1;
  3921. if (halfway == start)
  3922. {
  3923. lock.exit();
  3924. return false;
  3925. }
  3926. else if (elementToLookFor >= data.elements [halfway])
  3927. start = halfway;
  3928. else
  3929. end = halfway;
  3930. }
  3931. }
  3932. }
  3933. void add (const ElementType newElement) throw()
  3934. {
  3935. lock.enter();
  3936. int start = 0;
  3937. int end = numUsed;
  3938. for (;;)
  3939. {
  3940. if (start >= end)
  3941. {
  3942. jassert (start <= end);
  3943. insertInternal (start, newElement);
  3944. break;
  3945. }
  3946. else if (newElement == data.elements [start])
  3947. {
  3948. break;
  3949. }
  3950. else
  3951. {
  3952. const int halfway = (start + end) >> 1;
  3953. if (halfway == start)
  3954. {
  3955. if (newElement >= data.elements [halfway])
  3956. insertInternal (start + 1, newElement);
  3957. else
  3958. insertInternal (start, newElement);
  3959. break;
  3960. }
  3961. else if (newElement >= data.elements [halfway])
  3962. start = halfway;
  3963. else
  3964. end = halfway;
  3965. }
  3966. }
  3967. lock.exit();
  3968. }
  3969. void addArray (const ElementType* elementsToAdd,
  3970. int numElementsToAdd) throw()
  3971. {
  3972. lock.enter();
  3973. while (--numElementsToAdd >= 0)
  3974. add (*elementsToAdd++);
  3975. lock.exit();
  3976. }
  3977. template <class OtherSetType>
  3978. void addSet (const OtherSetType& setToAddFrom,
  3979. int startIndex = 0,
  3980. int numElementsToAdd = -1) throw()
  3981. {
  3982. setToAddFrom.lockSet();
  3983. lock.enter();
  3984. jassert (this != &setToAddFrom);
  3985. if (this != &setToAddFrom)
  3986. {
  3987. if (startIndex < 0)
  3988. {
  3989. jassertfalse
  3990. startIndex = 0;
  3991. }
  3992. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  3993. numElementsToAdd = setToAddFrom.size() - startIndex;
  3994. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  3995. }
  3996. lock.exit();
  3997. setToAddFrom.unlockSet();
  3998. }
  3999. ElementType remove (const int indexToRemove) throw()
  4000. {
  4001. lock.enter();
  4002. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4003. {
  4004. --numUsed;
  4005. ElementType* const e = data.elements + indexToRemove;
  4006. ElementType const removed = *e;
  4007. const int numberToShift = numUsed - indexToRemove;
  4008. if (numberToShift > 0)
  4009. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4010. if ((numUsed << 1) < data.numAllocated)
  4011. minimiseStorageOverheads();
  4012. lock.exit();
  4013. return removed;
  4014. }
  4015. else
  4016. {
  4017. lock.exit();
  4018. return 0;
  4019. }
  4020. }
  4021. void removeValue (const ElementType valueToRemove) throw()
  4022. {
  4023. lock.enter();
  4024. remove (indexOf (valueToRemove));
  4025. lock.exit();
  4026. }
  4027. template <class OtherSetType>
  4028. void removeValuesIn (const OtherSetType& otherSet) throw()
  4029. {
  4030. otherSet.lockSet();
  4031. lock.enter();
  4032. if (this == &otherSet)
  4033. {
  4034. clear();
  4035. }
  4036. else
  4037. {
  4038. if (otherSet.size() > 0)
  4039. {
  4040. for (int i = numUsed; --i >= 0;)
  4041. if (otherSet.contains (data.elements [i]))
  4042. remove (i);
  4043. }
  4044. }
  4045. lock.exit();
  4046. otherSet.unlockSet();
  4047. }
  4048. template <class OtherSetType>
  4049. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4050. {
  4051. otherSet.lockSet();
  4052. lock.enter();
  4053. if (this != &otherSet)
  4054. {
  4055. if (otherSet.size() <= 0)
  4056. {
  4057. clear();
  4058. }
  4059. else
  4060. {
  4061. for (int i = numUsed; --i >= 0;)
  4062. if (! otherSet.contains (data.elements [i]))
  4063. remove (i);
  4064. }
  4065. }
  4066. lock.exit();
  4067. otherSet.lockSet();
  4068. }
  4069. void minimiseStorageOverheads() throw()
  4070. {
  4071. lock.enter();
  4072. data.shrinkToNoMoreThan (numUsed);
  4073. lock.exit();
  4074. }
  4075. void lockSet() const throw()
  4076. {
  4077. lock.enter();
  4078. }
  4079. void unlockSet() const throw()
  4080. {
  4081. lock.exit();
  4082. }
  4083. juce_UseDebuggingNewOperator
  4084. private:
  4085. ArrayAllocationBase <ElementType> data;
  4086. int numUsed;
  4087. TypeOfCriticalSectionToUse lock;
  4088. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4089. {
  4090. data.ensureAllocatedSize (numUsed + 1);
  4091. ElementType* const insertPos = data.elements + indexToInsertAt;
  4092. const int numberToMove = numUsed - indexToInsertAt;
  4093. if (numberToMove > 0)
  4094. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4095. *insertPos = newElement;
  4096. ++numUsed;
  4097. }
  4098. };
  4099. #if JUCE_MSVC
  4100. #pragma warning (pop)
  4101. #endif
  4102. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4103. /********* End of inlined file: juce_SortedSet.h *********/
  4104. #endif
  4105. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4106. /********* Start of inlined file: juce_SparseSet.h *********/
  4107. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4108. #define __JUCE_SPARSESET_JUCEHEADER__
  4109. template <class Type>
  4110. class SparseSet
  4111. {
  4112. public:
  4113. SparseSet() throw()
  4114. {
  4115. }
  4116. SparseSet (const SparseSet<Type>& other) throw()
  4117. : values (other.values)
  4118. {
  4119. }
  4120. ~SparseSet() throw()
  4121. {
  4122. }
  4123. void clear() throw()
  4124. {
  4125. values.clear();
  4126. }
  4127. bool isEmpty() const throw()
  4128. {
  4129. return values.size() == 0;
  4130. }
  4131. Type size() const throw()
  4132. {
  4133. Type num = 0;
  4134. for (int i = 0; i < values.size(); i += 2)
  4135. num += values[i + 1] - values[i];
  4136. return num;
  4137. }
  4138. Type operator[] (int index) const throw()
  4139. {
  4140. for (int i = 0; i < values.size(); i += 2)
  4141. {
  4142. const Type s = values.getUnchecked(i);
  4143. const Type e = values.getUnchecked(i + 1);
  4144. if (index < e - s)
  4145. return s + index;
  4146. index -= e - s;
  4147. }
  4148. return (Type) 0;
  4149. }
  4150. bool contains (const Type valueToLookFor) const throw()
  4151. {
  4152. bool on = false;
  4153. for (int i = 0; i < values.size(); ++i)
  4154. {
  4155. if (values.getUnchecked(i) > valueToLookFor)
  4156. return on;
  4157. on = ! on;
  4158. }
  4159. return false;
  4160. }
  4161. int getNumRanges() const throw()
  4162. {
  4163. return values.size() >> 1;
  4164. }
  4165. bool getRange (const int rangeIndex,
  4166. Type& startValue,
  4167. Type& numValues) const throw()
  4168. {
  4169. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4170. {
  4171. startValue = values [rangeIndex << 1];
  4172. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4173. return true;
  4174. }
  4175. return false;
  4176. }
  4177. bool getTotalRange (Type& lowestValue,
  4178. Type& highestValue) const throw()
  4179. {
  4180. if (values.size() > 0)
  4181. {
  4182. lowestValue = values.getUnchecked (0);
  4183. highestValue = values.getUnchecked (values.size() - 1);
  4184. return true;
  4185. }
  4186. return false;
  4187. }
  4188. void addRange (const Type firstValue,
  4189. const Type numValuesToAdd) throw()
  4190. {
  4191. jassert (numValuesToAdd >= 0);
  4192. if (numValuesToAdd > 0)
  4193. {
  4194. removeRange (firstValue, numValuesToAdd);
  4195. IntegerElementComparator<Type> sorter;
  4196. values.addSorted (sorter, firstValue);
  4197. values.addSorted (sorter, firstValue + numValuesToAdd);
  4198. simplify();
  4199. }
  4200. }
  4201. void removeRange (const Type firstValue,
  4202. const Type numValuesToRemove) throw()
  4203. {
  4204. jassert (numValuesToRemove >= 0);
  4205. if (numValuesToRemove >= 0
  4206. && firstValue < values.getLast())
  4207. {
  4208. const bool onAtStart = contains (firstValue - 1);
  4209. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4210. const bool onAtEnd = contains (lastValue);
  4211. for (int i = values.size(); --i >= 0;)
  4212. {
  4213. if (values.getUnchecked(i) <= lastValue)
  4214. {
  4215. while (values.getUnchecked(i) >= firstValue)
  4216. {
  4217. values.remove (i);
  4218. if (--i < 0)
  4219. break;
  4220. }
  4221. break;
  4222. }
  4223. }
  4224. IntegerElementComparator<Type> sorter;
  4225. if (onAtStart)
  4226. values.addSorted (sorter, firstValue);
  4227. if (onAtEnd)
  4228. values.addSorted (sorter, lastValue);
  4229. simplify();
  4230. }
  4231. }
  4232. void invertRange (const Type firstValue,
  4233. const Type numValues)
  4234. {
  4235. SparseSet newItems;
  4236. newItems.addRange (firstValue, numValues);
  4237. int i;
  4238. for (i = getNumRanges(); --i >= 0;)
  4239. {
  4240. const int start = values [i << 1];
  4241. const int end = values [(i << 1) + 1];
  4242. newItems.removeRange (start, end);
  4243. }
  4244. removeRange (firstValue, numValues);
  4245. for (i = newItems.getNumRanges(); --i >= 0;)
  4246. {
  4247. const int start = newItems.values [i << 1];
  4248. const int end = newItems.values [(i << 1) + 1];
  4249. addRange (start, end);
  4250. }
  4251. }
  4252. bool overlapsRange (const Type firstValue,
  4253. const Type numValues) throw()
  4254. {
  4255. jassert (numValues >= 0);
  4256. if (numValues > 0)
  4257. {
  4258. for (int i = getNumRanges(); --i >= 0;)
  4259. {
  4260. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4261. return false;
  4262. if (firstValue + numValues > values.getUnchecked (i << 1))
  4263. return true;
  4264. }
  4265. }
  4266. return false;
  4267. }
  4268. bool containsRange (const Type firstValue,
  4269. const Type numValues) throw()
  4270. {
  4271. jassert (numValues >= 0);
  4272. if (numValues > 0)
  4273. {
  4274. for (int i = getNumRanges(); --i >= 0;)
  4275. {
  4276. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4277. return false;
  4278. if (firstValue >= values.getUnchecked (i << 1)
  4279. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4280. return true;
  4281. }
  4282. }
  4283. return false;
  4284. }
  4285. bool operator== (const SparseSet<Type>& other) throw()
  4286. {
  4287. return values == other.values;
  4288. }
  4289. bool operator!= (const SparseSet<Type>& other) throw()
  4290. {
  4291. return values != other.values;
  4292. }
  4293. juce_UseDebuggingNewOperator
  4294. private:
  4295. // alternating start/end values of ranges of values that are present.
  4296. Array<Type> values;
  4297. void simplify() throw()
  4298. {
  4299. jassert ((values.size() & 1) == 0);
  4300. for (int i = values.size(); --i > 0;)
  4301. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4302. values.removeRange (i - 1, 2);
  4303. }
  4304. };
  4305. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4306. /********* End of inlined file: juce_SparseSet.h *********/
  4307. #endif
  4308. #ifndef __JUCE_VALUE_JUCEHEADER__
  4309. /********* Start of inlined file: juce_Value.h *********/
  4310. #ifndef __JUCE_VALUE_JUCEHEADER__
  4311. #define __JUCE_VALUE_JUCEHEADER__
  4312. /********* Start of inlined file: juce_Variant.h *********/
  4313. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4314. #define __JUCE_VARIANT_JUCEHEADER__
  4315. class JUCE_API DynamicObject;
  4316. class JUCE_API var
  4317. {
  4318. public:
  4319. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  4320. var() throw();
  4321. ~var();
  4322. var (const var& valueToCopy);
  4323. var (const int value) throw();
  4324. var (const bool value) throw();
  4325. var (const double value) throw();
  4326. var (const char* const value);
  4327. var (const juce_wchar* const value);
  4328. var (const String& value);
  4329. var (DynamicObject* const object);
  4330. var (MethodFunction method) throw();
  4331. var& operator= (const var& valueToCopy);
  4332. var& operator= (int value);
  4333. var& operator= (bool value);
  4334. var& operator= (double value);
  4335. var& operator= (const char* value);
  4336. var& operator= (const juce_wchar* value);
  4337. var& operator= (const String& value);
  4338. var& operator= (DynamicObject* object);
  4339. var& operator= (MethodFunction method);
  4340. void swapWith (var& other) throw();
  4341. operator int() const;
  4342. operator bool() const;
  4343. operator float() const;
  4344. operator double() const;
  4345. operator const String() const;
  4346. const String toString() const;
  4347. DynamicObject* getObject() const;
  4348. bool isVoid() const throw() { return type == voidType; }
  4349. bool isInt() const throw() { return type == intType; }
  4350. bool isBool() const throw() { return type == boolType; }
  4351. bool isDouble() const throw() { return type == doubleType; }
  4352. bool isString() const throw() { return type == stringType; }
  4353. bool isObject() const throw() { return type == objectType; }
  4354. bool isMethod() const throw() { return type == methodType; }
  4355. bool operator== (const var& other) const throw();
  4356. bool operator!= (const var& other) const throw();
  4357. void writeToStream (OutputStream& output) const;
  4358. static const var readFromStream (InputStream& input);
  4359. class JUCE_API identifier
  4360. {
  4361. public:
  4362. identifier (const char* const name);
  4363. identifier (const String& name);
  4364. ~identifier();
  4365. bool operator== (const identifier& other) const throw()
  4366. {
  4367. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  4368. return hashCode == other.hashCode;
  4369. }
  4370. String name;
  4371. int hashCode;
  4372. };
  4373. const var operator[] (const identifier& propertyName) const;
  4374. const var call (const identifier& method) const;
  4375. const var call (const identifier& method, const var& arg1) const;
  4376. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  4377. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  4378. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  4379. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  4380. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  4381. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  4382. juce_UseDebuggingNewOperator
  4383. private:
  4384. enum Type
  4385. {
  4386. voidType = 0,
  4387. intType,
  4388. boolType,
  4389. doubleType,
  4390. stringType,
  4391. objectType,
  4392. methodType
  4393. };
  4394. union ValueUnion
  4395. {
  4396. int intValue;
  4397. bool boolValue;
  4398. double doubleValue;
  4399. String* stringValue;
  4400. DynamicObject* objectValue;
  4401. MethodFunction methodValue;
  4402. };
  4403. Type type;
  4404. ValueUnion value;
  4405. };
  4406. class JUCE_API DynamicObject : public ReferenceCountedObject
  4407. {
  4408. public:
  4409. DynamicObject();
  4410. virtual ~DynamicObject();
  4411. virtual bool hasProperty (const var::identifier& propertyName) const;
  4412. virtual const var getProperty (const var::identifier& propertyName) const;
  4413. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  4414. virtual void removeProperty (const var::identifier& propertyName);
  4415. virtual bool hasMethod (const var::identifier& methodName) const;
  4416. virtual const var invokeMethod (const var::identifier& methodName,
  4417. const var* parameters,
  4418. int numParameters);
  4419. void setMethod (const var::identifier& methodName,
  4420. var::MethodFunction methodFunction);
  4421. void clear();
  4422. juce_UseDebuggingNewOperator
  4423. private:
  4424. Array <int> propertyIds;
  4425. OwnedArray <var> propertyValues;
  4426. };
  4427. #endif // __JUCE_VARIANT_JUCEHEADER__
  4428. /********* End of inlined file: juce_Variant.h *********/
  4429. /********* Start of inlined file: juce_AsyncUpdater.h *********/
  4430. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4431. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4432. /********* Start of inlined file: juce_MessageListener.h *********/
  4433. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4434. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4435. /********* Start of inlined file: juce_Message.h *********/
  4436. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4437. #define __JUCE_MESSAGE_JUCEHEADER__
  4438. class MessageListener;
  4439. class MessageManager;
  4440. class JUCE_API Message
  4441. {
  4442. public:
  4443. Message() throw();
  4444. Message (const int intParameter1,
  4445. const int intParameter2,
  4446. const int intParameter3,
  4447. void* const pointerParameter) throw();
  4448. virtual ~Message() throw();
  4449. // These values can be used for carrying simple data that the application needs to
  4450. // pass around. For more complex messages, just create a subclass.
  4451. int intParameter1; /**< user-defined integer value. */
  4452. int intParameter2; /**< user-defined integer value. */
  4453. int intParameter3; /**< user-defined integer value. */
  4454. void* pointerParameter; /**< user-defined pointer value. */
  4455. juce_UseDebuggingNewOperator
  4456. private:
  4457. friend class MessageListener;
  4458. friend class MessageManager;
  4459. MessageListener* messageRecipient;
  4460. Message (const Message&);
  4461. const Message& operator= (const Message&);
  4462. };
  4463. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4464. /********* End of inlined file: juce_Message.h *********/
  4465. class JUCE_API MessageListener
  4466. {
  4467. protected:
  4468. MessageListener() throw();
  4469. public:
  4470. virtual ~MessageListener();
  4471. virtual void handleMessage (const Message& message) = 0;
  4472. void postMessage (Message* const message) const throw();
  4473. bool isValidMessageListener() const throw();
  4474. };
  4475. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4476. /********* End of inlined file: juce_MessageListener.h *********/
  4477. class JUCE_API AsyncUpdater
  4478. {
  4479. public:
  4480. AsyncUpdater() throw();
  4481. virtual ~AsyncUpdater();
  4482. void triggerAsyncUpdate() throw();
  4483. void cancelPendingUpdate() throw();
  4484. void handleUpdateNowIfNeeded();
  4485. virtual void handleAsyncUpdate() = 0;
  4486. private:
  4487. class AsyncUpdaterInternal : public MessageListener
  4488. {
  4489. public:
  4490. AsyncUpdaterInternal() throw() {}
  4491. ~AsyncUpdaterInternal() {}
  4492. void handleMessage (const Message&);
  4493. AsyncUpdater* owner;
  4494. private:
  4495. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4496. const AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4497. };
  4498. AsyncUpdaterInternal internalAsyncHandler;
  4499. bool asyncMessagePending;
  4500. };
  4501. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4502. /********* End of inlined file: juce_AsyncUpdater.h *********/
  4503. class JUCE_API Value
  4504. {
  4505. public:
  4506. Value();
  4507. Value (const Value& other);
  4508. Value (const var& initialValue);
  4509. ~Value();
  4510. const var getValue() const;
  4511. operator const var() const;
  4512. const String toString() const;
  4513. void setValue (const var& newValue);
  4514. const Value& operator= (const var& newValue);
  4515. void referTo (const Value& valueToReferTo);
  4516. bool refersToSameSourceAs (const Value& other) const;
  4517. bool operator== (const Value& other) const;
  4518. bool operator!= (const Value& other) const;
  4519. class JUCE_API Listener
  4520. {
  4521. public:
  4522. Listener() {}
  4523. virtual ~Listener() {}
  4524. virtual void valueChanged (Value& value) = 0;
  4525. };
  4526. void addListener (Listener* const listener);
  4527. void removeListener (Listener* const listener);
  4528. class JUCE_API ValueSource : public ReferenceCountedObject,
  4529. public AsyncUpdater
  4530. {
  4531. public:
  4532. ValueSource();
  4533. virtual ~ValueSource();
  4534. virtual const var getValue() const = 0;
  4535. virtual void setValue (const var& newValue) = 0;
  4536. void sendChangeMessage (const bool dispatchSynchronously);
  4537. juce_UseDebuggingNewOperator
  4538. protected:
  4539. friend class Value;
  4540. SortedSet <Value*> valuesWithListeners;
  4541. void handleAsyncUpdate();
  4542. ValueSource (const ValueSource&);
  4543. const ValueSource& operator= (const ValueSource&);
  4544. };
  4545. explicit Value (ValueSource* const valueSource);
  4546. ValueSource& getValueSource() { return *value; }
  4547. juce_UseDebuggingNewOperator
  4548. private:
  4549. friend class ValueSource;
  4550. ReferenceCountedObjectPtr <ValueSource> value;
  4551. SortedSet <Listener*> listeners;
  4552. void callListeners();
  4553. // This is disallowed to avoid confusion about whether it should
  4554. // do a by-value or by-reference copy.
  4555. const Value& operator= (const Value& other);
  4556. };
  4557. #endif // __JUCE_VALUE_JUCEHEADER__
  4558. /********* End of inlined file: juce_Value.h *********/
  4559. #endif
  4560. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4561. /********* Start of inlined file: juce_ValueTree.h *********/
  4562. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4563. #define __JUCE_VALUETREE_JUCEHEADER__
  4564. /********* Start of inlined file: juce_UndoManager.h *********/
  4565. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4566. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4567. /********* Start of inlined file: juce_ChangeBroadcaster.h *********/
  4568. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4569. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4570. /********* Start of inlined file: juce_ChangeListenerList.h *********/
  4571. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4572. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4573. /********* Start of inlined file: juce_ChangeListener.h *********/
  4574. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4575. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4576. class JUCE_API ChangeListener
  4577. {
  4578. public:
  4579. virtual ~ChangeListener() {}
  4580. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4581. };
  4582. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4583. /********* End of inlined file: juce_ChangeListener.h *********/
  4584. /********* Start of inlined file: juce_ScopedLock.h *********/
  4585. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4586. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4587. class JUCE_API ScopedLock
  4588. {
  4589. public:
  4590. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4591. inline ~ScopedLock() throw() { lock_.exit(); }
  4592. private:
  4593. const CriticalSection& lock_;
  4594. ScopedLock (const ScopedLock&);
  4595. const ScopedLock& operator= (const ScopedLock&);
  4596. };
  4597. class ScopedUnlock
  4598. {
  4599. public:
  4600. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4601. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4602. private:
  4603. const CriticalSection& lock_;
  4604. ScopedUnlock (const ScopedLock&);
  4605. const ScopedUnlock& operator= (const ScopedUnlock&);
  4606. };
  4607. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4608. /********* End of inlined file: juce_ScopedLock.h *********/
  4609. class JUCE_API ChangeListenerList : public MessageListener
  4610. {
  4611. public:
  4612. ChangeListenerList() throw();
  4613. ~ChangeListenerList() throw();
  4614. void addChangeListener (ChangeListener* const listener) throw();
  4615. void removeChangeListener (ChangeListener* const listener) throw();
  4616. void removeAllChangeListeners() throw();
  4617. void sendChangeMessage (void* objectThatHasChanged) throw();
  4618. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4619. void dispatchPendingMessages();
  4620. void handleMessage (const Message&);
  4621. juce_UseDebuggingNewOperator
  4622. private:
  4623. SortedSet <void*> listeners;
  4624. CriticalSection lock;
  4625. void* lastChangedObject;
  4626. bool messagePending;
  4627. ChangeListenerList (const ChangeListenerList&);
  4628. const ChangeListenerList& operator= (const ChangeListenerList&);
  4629. };
  4630. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4631. /********* End of inlined file: juce_ChangeListenerList.h *********/
  4632. class JUCE_API ChangeBroadcaster
  4633. {
  4634. public:
  4635. ChangeBroadcaster() throw();
  4636. virtual ~ChangeBroadcaster();
  4637. void addChangeListener (ChangeListener* const listener) throw();
  4638. void removeChangeListener (ChangeListener* const listener) throw();
  4639. void removeAllChangeListeners() throw();
  4640. void sendChangeMessage (void* objectThatHasChanged) throw();
  4641. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4642. void dispatchPendingMessages();
  4643. private:
  4644. ChangeListenerList changeListenerList;
  4645. ChangeBroadcaster (const ChangeBroadcaster&);
  4646. const ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4647. };
  4648. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4649. /********* End of inlined file: juce_ChangeBroadcaster.h *********/
  4650. /********* Start of inlined file: juce_UndoableAction.h *********/
  4651. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4652. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4653. class JUCE_API UndoableAction
  4654. {
  4655. protected:
  4656. UndoableAction() throw() {}
  4657. public:
  4658. virtual ~UndoableAction() {}
  4659. virtual bool perform() = 0;
  4660. virtual bool undo() = 0;
  4661. virtual int getSizeInUnits() { return 10; }
  4662. };
  4663. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4664. /********* End of inlined file: juce_UndoableAction.h *********/
  4665. class JUCE_API UndoManager : public ChangeBroadcaster
  4666. {
  4667. public:
  4668. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4669. const int minimumTransactionsToKeep = 30);
  4670. ~UndoManager();
  4671. void clearUndoHistory();
  4672. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4673. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4674. const int minimumTransactionsToKeep);
  4675. bool perform (UndoableAction* const action,
  4676. const String& actionName = String::empty);
  4677. void beginNewTransaction (const String& actionName = String::empty);
  4678. void setCurrentTransactionName (const String& newName);
  4679. bool canUndo() const;
  4680. const String getUndoDescription() const;
  4681. bool undo();
  4682. bool undoCurrentTransactionOnly();
  4683. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4684. int getNumActionsInCurrentTransaction() const;
  4685. bool canRedo() const;
  4686. const String getRedoDescription() const;
  4687. bool redo();
  4688. juce_UseDebuggingNewOperator
  4689. private:
  4690. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4691. StringArray transactionNames;
  4692. String currentTransactionName;
  4693. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4694. bool newTransaction, reentrancyCheck;
  4695. // disallow copy constructor
  4696. UndoManager (const UndoManager&);
  4697. const UndoManager& operator= (const UndoManager&);
  4698. };
  4699. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4700. /********* End of inlined file: juce_UndoManager.h *********/
  4701. class JUCE_API ValueTree
  4702. {
  4703. public:
  4704. ValueTree (const String& type);
  4705. ValueTree (const ValueTree& other);
  4706. const ValueTree& operator= (const ValueTree& other);
  4707. ~ValueTree();
  4708. bool operator== (const ValueTree& other) const;
  4709. bool operator!= (const ValueTree& other) const;
  4710. bool isValid() const { return object != 0; }
  4711. ValueTree createCopy() const;
  4712. const String getType() const;
  4713. bool hasType (const String& typeName) const;
  4714. const var getProperty (const var::identifier& name) const;
  4715. const var operator[] (const var::identifier& name) const;
  4716. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4717. bool hasProperty (const var::identifier& name) const;
  4718. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4719. void removeAllProperties (UndoManager* const undoManager);
  4720. int getNumProperties() const;
  4721. const var::identifier getPropertyName (int index) const;
  4722. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4723. int getNumChildren() const;
  4724. ValueTree getChild (int index) const;
  4725. ValueTree getChildWithName (const String& type) const;
  4726. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4727. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4728. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4729. void removeChild (const int childIndex, UndoManager* const undoManager);
  4730. void removeAllChildren (UndoManager* const undoManager);
  4731. bool isAChildOf (const ValueTree& possibleParent) const;
  4732. ValueTree getParent() const;
  4733. XmlElement* createXml() const;
  4734. static ValueTree fromXml (const XmlElement& xml);
  4735. void writeToStream (OutputStream& output);
  4736. static ValueTree readFromStream (InputStream& input);
  4737. class JUCE_API Listener
  4738. {
  4739. public:
  4740. virtual ~Listener() {}
  4741. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4742. const var::identifier& property) = 0;
  4743. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4744. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4745. };
  4746. void addListener (Listener* listener);
  4747. void removeListener (Listener* listener);
  4748. juce_UseDebuggingNewOperator
  4749. private:
  4750. friend class ValueTreeSetPropertyAction;
  4751. friend class ValueTreeChildChangeAction;
  4752. class JUCE_API SharedObject : public ReferenceCountedObject
  4753. {
  4754. public:
  4755. SharedObject (const String& type);
  4756. SharedObject (const SharedObject& other);
  4757. ~SharedObject();
  4758. struct Property
  4759. {
  4760. Property (const var::identifier& name, const var& value);
  4761. var::identifier name;
  4762. var value;
  4763. };
  4764. const String type;
  4765. OwnedArray <Property> properties;
  4766. ReferenceCountedArray <SharedObject> children;
  4767. SortedSet <ValueTree*> valueTreesWithListeners;
  4768. SharedObject* parent;
  4769. void sendPropertyChangeMessage (const var::identifier& property);
  4770. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4771. void sendChildChangeMessage();
  4772. void sendChildChangeMessage (ValueTree& tree);
  4773. void sendParentChangeMessage();
  4774. const var getProperty (const var::identifier& name) const;
  4775. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4776. bool hasProperty (const var::identifier& name) const;
  4777. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4778. void removeAllProperties (UndoManager* const undoManager);
  4779. bool isAChildOf (const SharedObject* const possibleParent) const;
  4780. ValueTree getChildWithName (const String& type) const;
  4781. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4782. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4783. void removeChild (const int childIndex, UndoManager* const undoManager);
  4784. void removeAllChildren (UndoManager* const undoManager);
  4785. XmlElement* createXml() const;
  4786. juce_UseDebuggingNewOperator
  4787. private:
  4788. const SharedObject& operator= (const SharedObject&);
  4789. };
  4790. friend class SharedObject;
  4791. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4792. ReferenceCountedObjectPtr <SharedObject> object;
  4793. SortedSet <Listener*> listeners;
  4794. void deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4795. void deliverChildChangeMessage (ValueTree& tree);
  4796. void deliverParentChangeMessage (ValueTree& tree);
  4797. ValueTree (SharedObject* const object_);
  4798. };
  4799. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4800. /********* End of inlined file: juce_ValueTree.h *********/
  4801. #endif
  4802. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4803. #endif
  4804. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4805. /********* Start of inlined file: juce_VoidArray.h *********/
  4806. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4807. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4808. typedef Array <void*> VoidArray;
  4809. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4810. /********* End of inlined file: juce_VoidArray.h *********/
  4811. #endif
  4812. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4813. #endif
  4814. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4815. #endif
  4816. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4817. /********* Start of inlined file: juce_FileLogger.h *********/
  4818. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4819. #define __JUCE_FILELOGGER_JUCEHEADER__
  4820. class JUCE_API FileLogger : public Logger
  4821. {
  4822. public:
  4823. FileLogger (const File& fileToWriteTo,
  4824. const String& welcomeMessage,
  4825. const int maxInitialFileSizeBytes = 128 * 1024);
  4826. ~FileLogger();
  4827. void logMessage (const String& message);
  4828. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4829. const String& logFileName,
  4830. const String& welcomeMessage,
  4831. const int maxInitialFileSizeBytes = 128 * 1024);
  4832. juce_UseDebuggingNewOperator
  4833. private:
  4834. File logFile;
  4835. CriticalSection logLock;
  4836. ScopedPointer <FileOutputStream> logStream;
  4837. void trimFileSize (int maxFileSizeBytes) const;
  4838. FileLogger (const FileLogger&);
  4839. const FileLogger& operator= (const FileLogger&);
  4840. };
  4841. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4842. /********* End of inlined file: juce_FileLogger.h *********/
  4843. #endif
  4844. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4845. /********* Start of inlined file: juce_Initialisation.h *********/
  4846. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4847. #define __JUCE_INITIALISATION_JUCEHEADER__
  4848. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4849. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4850. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4851. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4852. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4853. /********* End of inlined file: juce_Initialisation.h *********/
  4854. #endif
  4855. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4856. #endif
  4857. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4858. #endif
  4859. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4860. #endif
  4861. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4862. /********* Start of inlined file: juce_PerformanceCounter.h *********/
  4863. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4864. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4865. class JUCE_API PerformanceCounter
  4866. {
  4867. public:
  4868. PerformanceCounter (const String& counterName,
  4869. int runsPerPrintout = 100,
  4870. const File& loggingFile = File::nonexistent);
  4871. ~PerformanceCounter();
  4872. void start();
  4873. void stop();
  4874. void printStatistics();
  4875. juce_UseDebuggingNewOperator
  4876. private:
  4877. String name;
  4878. int numRuns, runsPerPrint;
  4879. double totalTime;
  4880. int64 started;
  4881. File outputFile;
  4882. };
  4883. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4884. /********* End of inlined file: juce_PerformanceCounter.h *********/
  4885. #endif
  4886. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4887. #endif
  4888. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4889. /********* Start of inlined file: juce_PlatformUtilities.h *********/
  4890. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4891. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4892. class JUCE_API PlatformUtilities
  4893. {
  4894. public:
  4895. static void beep();
  4896. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4897. const String& emailSubject,
  4898. const String& bodyText,
  4899. const StringArray& filesToAttach);
  4900. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4901. static const String cfStringToJuceString (CFStringRef cfString);
  4902. static CFStringRef juceStringToCFString (const String& s);
  4903. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4904. static const String makePathFromFSRef (FSRef* file);
  4905. static const String convertToPrecomposedUnicode (const String& s);
  4906. static OSType getTypeOfFile (const String& filename);
  4907. static bool isBundle (const String& filename);
  4908. static void addItemToDock (const File& file);
  4909. static int getOSXMinorVersionNumber();
  4910. #endif
  4911. #if JUCE_WINDOWS || DOXYGEN
  4912. // Some registry helper functions:
  4913. static const String getRegistryValue (const String& regValuePath,
  4914. const String& defaultValue = String::empty);
  4915. static void setRegistryValue (const String& regValuePath,
  4916. const String& value);
  4917. static bool registryValueExists (const String& regValuePath);
  4918. static void deleteRegistryValue (const String& regValuePath);
  4919. static void deleteRegistryKey (const String& regKeyPath);
  4920. static void registerFileAssociation (const String& fileExtension,
  4921. const String& symbolicDescription,
  4922. const String& fullDescription,
  4923. const File& targetExecutable,
  4924. int iconResourceNumber);
  4925. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  4926. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  4927. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  4928. #endif
  4929. static void fpuReset();
  4930. #if JUCE_LINUX || JUCE_WINDOWS
  4931. static void* loadDynamicLibrary (const String& pathOrFilename);
  4932. static void freeDynamicLibrary (void* libraryHandle);
  4933. static void* getProcedureEntryPoint (void* libraryHandle,
  4934. const String& procedureName);
  4935. #endif
  4936. #if JUCE_LINUX || DOXYGEN
  4937. #endif
  4938. };
  4939. #if JUCE_MAC || JUCE_IPHONE
  4940. class ScopedAutoReleasePool
  4941. {
  4942. public:
  4943. ScopedAutoReleasePool();
  4944. ~ScopedAutoReleasePool();
  4945. private:
  4946. void* pool;
  4947. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  4948. const ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  4949. };
  4950. #endif
  4951. #if JUCE_LINUX
  4952. class ScopedXLock
  4953. {
  4954. public:
  4955. ScopedXLock();
  4956. ~ScopedXLock();
  4957. };
  4958. #endif
  4959. #if JUCE_MAC
  4960. class JUCE_API AppleRemoteDevice
  4961. {
  4962. public:
  4963. AppleRemoteDevice();
  4964. virtual ~AppleRemoteDevice();
  4965. enum ButtonType
  4966. {
  4967. menuButton = 0, /**< The menu button (if it's held for a short time). */
  4968. playButton, /**< The play button. */
  4969. plusButton, /**< The plus or volume-up button. */
  4970. minusButton, /**< The minus or volume-down button. */
  4971. rightButton, /**< The right button (if it's held for a short time). */
  4972. leftButton, /**< The left button (if it's held for a short time). */
  4973. rightButton_Long, /**< The right button (if it's held for a long time). */
  4974. leftButton_Long, /**< The menu button (if it's held for a long time). */
  4975. menuButton_Long, /**< The menu button (if it's held for a long time). */
  4976. playButtonSleepMode,
  4977. switched
  4978. };
  4979. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  4980. bool start (const bool inExclusiveMode);
  4981. void stop();
  4982. bool isActive() const;
  4983. int getRemoteId() const { return remoteId; }
  4984. juce_UseDebuggingNewOperator
  4985. void handleCallbackInternal();
  4986. private:
  4987. void* device;
  4988. void* queue;
  4989. int remoteId;
  4990. bool open (const bool openInExclusiveMode);
  4991. AppleRemoteDevice (const AppleRemoteDevice&);
  4992. const AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  4993. };
  4994. #endif
  4995. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4996. /********* End of inlined file: juce_PlatformUtilities.h *********/
  4997. #endif
  4998. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4999. /********* Start of inlined file: juce_Random.h *********/
  5000. #ifndef __JUCE_RANDOM_JUCEHEADER__
  5001. #define __JUCE_RANDOM_JUCEHEADER__
  5002. class JUCE_API Random
  5003. {
  5004. public:
  5005. Random (const int64 seedValue) throw();
  5006. ~Random() throw();
  5007. int nextInt() throw();
  5008. int nextInt (const int maxValue) throw();
  5009. int64 nextInt64() throw();
  5010. float nextFloat() throw();
  5011. double nextDouble() throw();
  5012. bool nextBool() throw();
  5013. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  5014. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  5015. static Random& getSystemRandom() throw();
  5016. void setSeed (const int64 newSeed) throw();
  5017. void setSeedRandomly();
  5018. juce_UseDebuggingNewOperator
  5019. private:
  5020. int64 seed;
  5021. };
  5022. #endif // __JUCE_RANDOM_JUCEHEADER__
  5023. /********* End of inlined file: juce_Random.h *********/
  5024. #endif
  5025. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5026. #endif
  5027. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5028. /********* Start of inlined file: juce_Singleton.h *********/
  5029. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5030. #define __JUCE_SINGLETON_JUCEHEADER__
  5031. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5032. \
  5033. static classname* _singletonInstance; \
  5034. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5035. \
  5036. static classname* getInstance() \
  5037. { \
  5038. if (_singletonInstance == 0) \
  5039. {\
  5040. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5041. \
  5042. if (_singletonInstance == 0) \
  5043. { \
  5044. static bool alreadyInside = false; \
  5045. static bool createdOnceAlready = false; \
  5046. \
  5047. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5048. jassert (! problem); \
  5049. if (! problem) \
  5050. { \
  5051. createdOnceAlready = true; \
  5052. alreadyInside = true; \
  5053. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5054. alreadyInside = false; \
  5055. \
  5056. _singletonInstance = newObject; \
  5057. } \
  5058. } \
  5059. } \
  5060. \
  5061. return _singletonInstance; \
  5062. } \
  5063. \
  5064. static inline classname* getInstanceWithoutCreating() throw() \
  5065. { \
  5066. return _singletonInstance; \
  5067. } \
  5068. \
  5069. static void deleteInstance() \
  5070. { \
  5071. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5072. if (_singletonInstance != 0) \
  5073. { \
  5074. classname* const old = _singletonInstance; \
  5075. _singletonInstance = 0; \
  5076. delete old; \
  5077. } \
  5078. } \
  5079. \
  5080. void clearSingletonInstance() throw() \
  5081. { \
  5082. if (_singletonInstance == this) \
  5083. _singletonInstance = 0; \
  5084. }
  5085. #define juce_ImplementSingleton(classname) \
  5086. \
  5087. classname* classname::_singletonInstance = 0; \
  5088. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5089. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5090. \
  5091. static classname* _singletonInstance; \
  5092. \
  5093. static classname* getInstance() \
  5094. { \
  5095. if (_singletonInstance == 0) \
  5096. { \
  5097. static bool alreadyInside = false; \
  5098. static bool createdOnceAlready = false; \
  5099. \
  5100. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5101. jassert (! problem); \
  5102. if (! problem) \
  5103. { \
  5104. createdOnceAlready = true; \
  5105. alreadyInside = true; \
  5106. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5107. alreadyInside = false; \
  5108. \
  5109. _singletonInstance = newObject; \
  5110. } \
  5111. } \
  5112. \
  5113. return _singletonInstance; \
  5114. } \
  5115. \
  5116. static inline classname* getInstanceWithoutCreating() throw() \
  5117. { \
  5118. return _singletonInstance; \
  5119. } \
  5120. \
  5121. static void deleteInstance() \
  5122. { \
  5123. if (_singletonInstance != 0) \
  5124. { \
  5125. classname* const old = _singletonInstance; \
  5126. _singletonInstance = 0; \
  5127. delete old; \
  5128. } \
  5129. } \
  5130. \
  5131. void clearSingletonInstance() throw() \
  5132. { \
  5133. if (_singletonInstance == this) \
  5134. _singletonInstance = 0; \
  5135. }
  5136. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5137. \
  5138. static classname* _singletonInstance; \
  5139. \
  5140. static classname* getInstance() \
  5141. { \
  5142. if (_singletonInstance == 0) \
  5143. _singletonInstance = new classname(); \
  5144. \
  5145. return _singletonInstance; \
  5146. } \
  5147. \
  5148. static inline classname* getInstanceWithoutCreating() throw() \
  5149. { \
  5150. return _singletonInstance; \
  5151. } \
  5152. \
  5153. static void deleteInstance() \
  5154. { \
  5155. if (_singletonInstance != 0) \
  5156. { \
  5157. classname* const old = _singletonInstance; \
  5158. _singletonInstance = 0; \
  5159. delete old; \
  5160. } \
  5161. } \
  5162. \
  5163. void clearSingletonInstance() throw() \
  5164. { \
  5165. if (_singletonInstance == this) \
  5166. _singletonInstance = 0; \
  5167. }
  5168. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5169. \
  5170. classname* classname::_singletonInstance = 0;
  5171. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5172. /********* End of inlined file: juce_Singleton.h *********/
  5173. #endif
  5174. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5175. #endif
  5176. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5177. /********* Start of inlined file: juce_SystemStats.h *********/
  5178. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5179. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5180. class JUCE_API SystemStats
  5181. {
  5182. public:
  5183. static const String getJUCEVersion() throw();
  5184. enum OperatingSystemType
  5185. {
  5186. UnknownOS = 0,
  5187. MacOSX = 0x1000,
  5188. Linux = 0x2000,
  5189. Win95 = 0x4001,
  5190. Win98 = 0x4002,
  5191. WinNT351 = 0x4103,
  5192. WinNT40 = 0x4104,
  5193. Win2000 = 0x4105,
  5194. WinXP = 0x4106,
  5195. WinVista = 0x4107,
  5196. Windows7 = 0x4108,
  5197. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5198. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5199. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5200. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5201. };
  5202. static OperatingSystemType getOperatingSystemType() throw();
  5203. static const String getOperatingSystemName() throw();
  5204. static bool isOperatingSystem64Bit() throw();
  5205. // CPU and memory information..
  5206. static int getCpuSpeedInMegaherz() throw();
  5207. static const String getCpuVendor() throw();
  5208. static bool hasMMX() throw();
  5209. static bool hasSSE() throw();
  5210. static bool hasSSE2() throw();
  5211. static bool has3DNow() throw();
  5212. static int getNumCpus() throw();
  5213. static int64 getClockCycleCounter() throw();
  5214. static int getMemorySizeInMegabytes() throw();
  5215. static int getPageSize() throw();
  5216. static int getMACAddresses (int64* addresses, int maxNum,
  5217. #if JUCE_MAC
  5218. const bool littleEndian = true) throw();
  5219. #else
  5220. const bool littleEndian = false) throw();
  5221. #endif
  5222. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5223. static void initialiseStats() throw();
  5224. };
  5225. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5226. /********* End of inlined file: juce_SystemStats.h *********/
  5227. #endif
  5228. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5229. #endif
  5230. #ifndef __JUCE_TIME_JUCEHEADER__
  5231. #endif
  5232. #ifndef __JUCE_UUID_JUCEHEADER__
  5233. /********* Start of inlined file: juce_Uuid.h *********/
  5234. #ifndef __JUCE_UUID_JUCEHEADER__
  5235. #define __JUCE_UUID_JUCEHEADER__
  5236. class JUCE_API Uuid
  5237. {
  5238. public:
  5239. Uuid();
  5240. ~Uuid() throw();
  5241. Uuid (const Uuid& other);
  5242. Uuid& operator= (const Uuid& other);
  5243. bool isNull() const throw();
  5244. bool operator== (const Uuid& other) const;
  5245. bool operator!= (const Uuid& other) const;
  5246. const String toString() const;
  5247. Uuid (const String& uuidString);
  5248. Uuid& operator= (const String& uuidString);
  5249. const uint8* getRawData() const throw() { return value.asBytes; }
  5250. Uuid (const uint8* const rawData);
  5251. Uuid& operator= (const uint8* const rawData);
  5252. juce_UseDebuggingNewOperator
  5253. private:
  5254. union
  5255. {
  5256. uint8 asBytes [16];
  5257. int asInt[4];
  5258. int64 asInt64[2];
  5259. } value;
  5260. };
  5261. #endif // __JUCE_UUID_JUCEHEADER__
  5262. /********* End of inlined file: juce_Uuid.h *********/
  5263. #endif
  5264. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5265. /********* Start of inlined file: juce_BlowFish.h *********/
  5266. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5267. #define __JUCE_BLOWFISH_JUCEHEADER__
  5268. class JUCE_API BlowFish
  5269. {
  5270. public:
  5271. BlowFish (const uint8* keyData, int keyBytes);
  5272. BlowFish (const BlowFish& other);
  5273. const BlowFish& operator= (const BlowFish& other);
  5274. ~BlowFish();
  5275. void encrypt (uint32& data1, uint32& data2) const;
  5276. void decrypt (uint32& data1, uint32& data2) const;
  5277. juce_UseDebuggingNewOperator
  5278. private:
  5279. uint32 p[18];
  5280. HeapBlock <uint32> s[4];
  5281. uint32 F (uint32 x) const;
  5282. };
  5283. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5284. /********* End of inlined file: juce_BlowFish.h *********/
  5285. #endif
  5286. #ifndef __JUCE_MD5_JUCEHEADER__
  5287. /********* Start of inlined file: juce_MD5.h *********/
  5288. #ifndef __JUCE_MD5_JUCEHEADER__
  5289. #define __JUCE_MD5_JUCEHEADER__
  5290. class JUCE_API MD5
  5291. {
  5292. public:
  5293. MD5();
  5294. MD5 (const MD5& other);
  5295. const MD5& operator= (const MD5& other);
  5296. MD5 (const MemoryBlock& data);
  5297. MD5 (const char* data, const size_t numBytes);
  5298. MD5 (const String& text);
  5299. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5300. MD5 (const File& file);
  5301. ~MD5();
  5302. const MemoryBlock getRawChecksumData() const;
  5303. const String toHexString() const;
  5304. bool operator== (const MD5& other) const;
  5305. bool operator!= (const MD5& other) const;
  5306. juce_UseDebuggingNewOperator
  5307. private:
  5308. uint8 result [16];
  5309. struct ProcessContext
  5310. {
  5311. uint8 buffer [64];
  5312. uint32 state [4];
  5313. uint32 count [2];
  5314. ProcessContext();
  5315. void processBlock (const uint8* const data, size_t dataSize);
  5316. void transform (const uint8* const buffer);
  5317. void finish (uint8* const result);
  5318. };
  5319. void processStream (InputStream& input, int64 numBytesToRead);
  5320. };
  5321. #endif // __JUCE_MD5_JUCEHEADER__
  5322. /********* End of inlined file: juce_MD5.h *********/
  5323. #endif
  5324. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5325. /********* Start of inlined file: juce_Primes.h *********/
  5326. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5327. #define __JUCE_PRIMES_JUCEHEADER__
  5328. class JUCE_API Primes
  5329. {
  5330. public:
  5331. static const BitArray createProbablePrime (int bitLength,
  5332. int certainty,
  5333. const int* randomSeeds = 0,
  5334. int numRandomSeeds = 0) throw();
  5335. static bool isProbablyPrime (const BitArray& number,
  5336. int certainty) throw();
  5337. };
  5338. #endif // __JUCE_PRIMES_JUCEHEADER__
  5339. /********* End of inlined file: juce_Primes.h *********/
  5340. #endif
  5341. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5342. /********* Start of inlined file: juce_RSAKey.h *********/
  5343. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5344. #define __JUCE_RSAKEY_JUCEHEADER__
  5345. class JUCE_API RSAKey
  5346. {
  5347. public:
  5348. RSAKey() throw();
  5349. RSAKey (const String& stringRepresentation) throw();
  5350. ~RSAKey() throw();
  5351. const String toString() const throw();
  5352. bool applyToValue (BitArray& value) const throw();
  5353. static void createKeyPair (RSAKey& publicKey,
  5354. RSAKey& privateKey,
  5355. const int numBits,
  5356. const int* randomSeeds = 0,
  5357. const int numRandomSeeds = 0) throw();
  5358. juce_UseDebuggingNewOperator
  5359. protected:
  5360. BitArray part1, part2;
  5361. };
  5362. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5363. /********* End of inlined file: juce_RSAKey.h *********/
  5364. #endif
  5365. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5366. /********* Start of inlined file: juce_DirectoryIterator.h *********/
  5367. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5368. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5369. class JUCE_API DirectoryIterator
  5370. {
  5371. public:
  5372. DirectoryIterator (const File& directory,
  5373. bool isRecursive,
  5374. const String& wildCard = JUCE_T("*"),
  5375. const int whatToLookFor = File::findFiles);
  5376. ~DirectoryIterator();
  5377. bool next();
  5378. const File getFile() const;
  5379. float getEstimatedProgress() const;
  5380. juce_UseDebuggingNewOperator
  5381. private:
  5382. OwnedArray <File> filesFound;
  5383. OwnedArray <File> dirsFound;
  5384. String wildCard;
  5385. int index;
  5386. const int whatToLookFor;
  5387. ScopedPointer <DirectoryIterator> subIterator;
  5388. DirectoryIterator (const DirectoryIterator&);
  5389. const DirectoryIterator& operator= (const DirectoryIterator&);
  5390. };
  5391. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5392. /********* End of inlined file: juce_DirectoryIterator.h *********/
  5393. #endif
  5394. #ifndef __JUCE_FILE_JUCEHEADER__
  5395. #endif
  5396. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5397. /********* Start of inlined file: juce_FileInputStream.h *********/
  5398. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5399. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5400. class JUCE_API FileInputStream : public InputStream
  5401. {
  5402. public:
  5403. FileInputStream (const File& fileToRead);
  5404. ~FileInputStream();
  5405. const File& getFile() const throw() { return file; }
  5406. int64 getTotalLength();
  5407. int read (void* destBuffer, int maxBytesToRead);
  5408. bool isExhausted();
  5409. int64 getPosition();
  5410. bool setPosition (int64 pos);
  5411. juce_UseDebuggingNewOperator
  5412. private:
  5413. File file;
  5414. void* fileHandle;
  5415. int64 currentPosition, totalSize;
  5416. bool needToSeek;
  5417. FileInputStream (const FileInputStream&);
  5418. const FileInputStream& operator= (const FileInputStream&);
  5419. };
  5420. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5421. /********* End of inlined file: juce_FileInputStream.h *********/
  5422. #endif
  5423. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5424. /********* Start of inlined file: juce_FileOutputStream.h *********/
  5425. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5426. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5427. class JUCE_API FileOutputStream : public OutputStream
  5428. {
  5429. public:
  5430. FileOutputStream (const File& fileToWriteTo,
  5431. const int bufferSizeToUse = 16384);
  5432. ~FileOutputStream();
  5433. const File& getFile() const { return file; }
  5434. bool failedToOpen() const { return fileHandle == 0; }
  5435. void flush();
  5436. int64 getPosition();
  5437. bool setPosition (int64 pos);
  5438. bool write (const void* data, int numBytes);
  5439. juce_UseDebuggingNewOperator
  5440. private:
  5441. File file;
  5442. void* fileHandle;
  5443. int64 currentPosition;
  5444. int bufferSize, bytesInBuffer;
  5445. HeapBlock <char> buffer;
  5446. };
  5447. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5448. /********* End of inlined file: juce_FileOutputStream.h *********/
  5449. #endif
  5450. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5451. /********* Start of inlined file: juce_FileSearchPath.h *********/
  5452. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5453. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5454. class JUCE_API FileSearchPath
  5455. {
  5456. public:
  5457. FileSearchPath();
  5458. FileSearchPath (const String& path);
  5459. FileSearchPath (const FileSearchPath& other);
  5460. ~FileSearchPath();
  5461. const FileSearchPath& operator= (const String& path);
  5462. int getNumPaths() const;
  5463. const File operator[] (const int index) const;
  5464. const String toString() const;
  5465. void add (const File& directoryToAdd,
  5466. const int insertIndex = -1);
  5467. void addIfNotAlreadyThere (const File& directoryToAdd);
  5468. void remove (const int indexToRemove);
  5469. void addPath (const FileSearchPath& other);
  5470. void removeRedundantPaths();
  5471. void removeNonExistentPaths();
  5472. int findChildFiles (OwnedArray<File>& results,
  5473. const int whatToLookFor,
  5474. const bool searchRecursively,
  5475. const String& wildCardPattern = JUCE_T("*")) const;
  5476. bool isFileInPath (const File& fileToCheck,
  5477. const bool checkRecursively) const;
  5478. juce_UseDebuggingNewOperator
  5479. private:
  5480. StringArray directories;
  5481. void init (const String& path);
  5482. };
  5483. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5484. /********* End of inlined file: juce_FileSearchPath.h *********/
  5485. #endif
  5486. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5487. /********* Start of inlined file: juce_NamedPipe.h *********/
  5488. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5489. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5490. class JUCE_API NamedPipe
  5491. {
  5492. public:
  5493. NamedPipe();
  5494. ~NamedPipe();
  5495. bool openExisting (const String& pipeName);
  5496. bool createNewPipe (const String& pipeName);
  5497. void close();
  5498. bool isOpen() const;
  5499. const String getName() const;
  5500. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5501. int write (const void* sourceBuffer, int numBytesToWrite,
  5502. int timeOutMilliseconds = 2000);
  5503. void cancelPendingReads();
  5504. juce_UseDebuggingNewOperator
  5505. private:
  5506. void* internal;
  5507. String currentPipeName;
  5508. NamedPipe (const NamedPipe&);
  5509. const NamedPipe& operator= (const NamedPipe&);
  5510. bool openInternal (const String& pipeName, const bool createPipe);
  5511. };
  5512. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5513. /********* End of inlined file: juce_NamedPipe.h *********/
  5514. #endif
  5515. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5516. /********* Start of inlined file: juce_TemporaryFile.h *********/
  5517. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5518. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5519. class JUCE_API TemporaryFile
  5520. {
  5521. public:
  5522. enum OptionFlags
  5523. {
  5524. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5525. i.e. its name should start with a dot. */
  5526. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5527. the file is unique, they should go in brackets rather
  5528. than just being appended (see File::getNonexistentSibling() )*/
  5529. };
  5530. TemporaryFile (const String& suffix = String::empty,
  5531. const int optionFlags = 0);
  5532. TemporaryFile (const File& targetFile,
  5533. const int optionFlags = 0);
  5534. ~TemporaryFile();
  5535. const File getFile() const { return temporaryFile; }
  5536. const File getTargetFile() const { return targetFile; }
  5537. bool overwriteTargetFileWithTemporary() const;
  5538. juce_UseDebuggingNewOperator
  5539. private:
  5540. File temporaryFile, targetFile;
  5541. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5542. TemporaryFile (const TemporaryFile&);
  5543. const TemporaryFile& operator= (const TemporaryFile&);
  5544. };
  5545. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5546. /********* End of inlined file: juce_TemporaryFile.h *********/
  5547. #endif
  5548. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5549. /********* Start of inlined file: juce_ZipFile.h *********/
  5550. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5551. #define __JUCE_ZIPFILE_JUCEHEADER__
  5552. /********* Start of inlined file: juce_InputSource.h *********/
  5553. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5554. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5555. class JUCE_API InputSource
  5556. {
  5557. public:
  5558. InputSource() throw() {}
  5559. virtual ~InputSource() {}
  5560. virtual InputStream* createInputStream() = 0;
  5561. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5562. virtual int64 hashCode() const = 0;
  5563. juce_UseDebuggingNewOperator
  5564. };
  5565. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5566. /********* End of inlined file: juce_InputSource.h *********/
  5567. class JUCE_API ZipFile
  5568. {
  5569. public:
  5570. ZipFile (InputStream* const inputStream,
  5571. const bool deleteStreamWhenDestroyed) throw();
  5572. ZipFile (const File& file);
  5573. ZipFile (InputSource* const inputSource);
  5574. ~ZipFile() throw();
  5575. struct ZipEntry
  5576. {
  5577. String filename;
  5578. unsigned int uncompressedSize;
  5579. Time fileTime;
  5580. };
  5581. int getNumEntries() const throw();
  5582. const ZipEntry* getEntry (const int index) const throw();
  5583. int getIndexOfFileName (const String& fileName) const throw();
  5584. const ZipEntry* getEntry (const String& fileName) const throw();
  5585. void sortEntriesByFilename();
  5586. InputStream* createStreamForEntry (const int index);
  5587. void uncompressTo (const File& targetDirectory,
  5588. const bool shouldOverwriteFiles = true);
  5589. juce_UseDebuggingNewOperator
  5590. private:
  5591. class ZipInputStream;
  5592. class ZipFilenameComparator;
  5593. class ZipEntryInfo;
  5594. OwnedArray <ZipEntryInfo> entries;
  5595. CriticalSection lock;
  5596. InputStream* inputStream;
  5597. ScopedPointer <InputStream> streamToDelete;
  5598. ScopedPointer <InputSource> inputSource;
  5599. #ifdef JUCE_DEBUG
  5600. int numOpenStreams;
  5601. #endif
  5602. void init();
  5603. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5604. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5605. ZipFile (const ZipFile&);
  5606. const ZipFile& operator= (const ZipFile&);
  5607. };
  5608. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5609. /********* End of inlined file: juce_ZipFile.h *********/
  5610. #endif
  5611. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5612. /********* Start of inlined file: juce_Socket.h *********/
  5613. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5614. #define __JUCE_SOCKET_JUCEHEADER__
  5615. class JUCE_API StreamingSocket
  5616. {
  5617. public:
  5618. StreamingSocket();
  5619. ~StreamingSocket();
  5620. bool bindToPort (const int localPortNumber);
  5621. bool connect (const String& remoteHostname,
  5622. const int remotePortNumber,
  5623. const int timeOutMillisecs = 3000);
  5624. bool isConnected() const throw() { return connected; }
  5625. void close();
  5626. const String& getHostName() const throw() { return hostName; }
  5627. int getPort() const throw() { return portNumber; }
  5628. bool isLocal() const throw();
  5629. int waitUntilReady (const bool readyForReading,
  5630. const int timeoutMsecs) const;
  5631. int read (void* destBuffer, const int maxBytesToRead,
  5632. const bool blockUntilSpecifiedAmountHasArrived);
  5633. int write (const void* sourceBuffer, const int numBytesToWrite);
  5634. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5635. StreamingSocket* waitForNextConnection() const;
  5636. juce_UseDebuggingNewOperator
  5637. private:
  5638. String hostName;
  5639. int volatile portNumber, handle;
  5640. bool connected, isListener;
  5641. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5642. StreamingSocket (const StreamingSocket&);
  5643. const StreamingSocket& operator= (const StreamingSocket&);
  5644. };
  5645. class JUCE_API DatagramSocket
  5646. {
  5647. public:
  5648. DatagramSocket (const int localPortNumber,
  5649. const bool enableBroadcasting = false);
  5650. ~DatagramSocket();
  5651. bool bindToPort (const int localPortNumber);
  5652. bool connect (const String& remoteHostname,
  5653. const int remotePortNumber,
  5654. const int timeOutMillisecs = 3000);
  5655. bool isConnected() const throw() { return connected; }
  5656. void close();
  5657. const String& getHostName() const throw() { return hostName; }
  5658. int getPort() const throw() { return portNumber; }
  5659. bool isLocal() const throw();
  5660. int waitUntilReady (const bool readyForReading,
  5661. const int timeoutMsecs) const;
  5662. int read (void* destBuffer, const int maxBytesToRead,
  5663. const bool blockUntilSpecifiedAmountHasArrived);
  5664. int write (const void* sourceBuffer, const int numBytesToWrite);
  5665. DatagramSocket* waitForNextConnection() const;
  5666. juce_UseDebuggingNewOperator
  5667. private:
  5668. String hostName;
  5669. int volatile portNumber, handle;
  5670. bool connected, allowBroadcast;
  5671. void* serverAddress;
  5672. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5673. DatagramSocket (const DatagramSocket&);
  5674. const DatagramSocket& operator= (const DatagramSocket&);
  5675. };
  5676. #endif // __JUCE_SOCKET_JUCEHEADER__
  5677. /********* End of inlined file: juce_Socket.h *********/
  5678. #endif
  5679. #ifndef __JUCE_URL_JUCEHEADER__
  5680. /********* Start of inlined file: juce_URL.h *********/
  5681. #ifndef __JUCE_URL_JUCEHEADER__
  5682. #define __JUCE_URL_JUCEHEADER__
  5683. class JUCE_API URL
  5684. {
  5685. public:
  5686. URL();
  5687. URL (const String& url);
  5688. URL (const URL& other);
  5689. ~URL();
  5690. const URL& operator= (const URL& other);
  5691. const String toString (const bool includeGetParameters) const;
  5692. bool isWellFormed() const;
  5693. const String getDomain() const;
  5694. const String getSubPath() const;
  5695. const String getScheme() const;
  5696. const URL withNewSubPath (const String& newPath) const;
  5697. const URL withParameter (const String& parameterName,
  5698. const String& parameterValue) const;
  5699. const URL withFileToUpload (const String& parameterName,
  5700. const File& fileToUpload,
  5701. const String& mimeType) const;
  5702. const StringPairArray& getParameters() const;
  5703. const StringPairArray& getFilesToUpload() const;
  5704. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5705. const URL withPOSTData (const String& postData) const;
  5706. const String getPostData() const { return postData; }
  5707. bool launchInDefaultBrowser() const;
  5708. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5709. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5710. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5711. InputStream* createInputStream (const bool usePostCommand,
  5712. OpenStreamProgressCallback* const progressCallback = 0,
  5713. void* const progressCallbackContext = 0,
  5714. const String& extraHeaders = String::empty,
  5715. const int connectionTimeOutMs = 0) const;
  5716. bool readEntireBinaryStream (MemoryBlock& destData,
  5717. const bool usePostCommand = false) const;
  5718. const String readEntireTextStream (const bool usePostCommand = false) const;
  5719. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5720. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5721. const bool isParameter);
  5722. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5723. juce_UseDebuggingNewOperator
  5724. private:
  5725. String url, postData;
  5726. StringPairArray parameters, filesToUpload, mimeTypes;
  5727. };
  5728. #endif // __JUCE_URL_JUCEHEADER__
  5729. /********* End of inlined file: juce_URL.h *********/
  5730. #endif
  5731. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5732. /********* Start of inlined file: juce_BufferedInputStream.h *********/
  5733. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5734. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5735. class JUCE_API BufferedInputStream : public InputStream
  5736. {
  5737. public:
  5738. BufferedInputStream (InputStream* const sourceStream,
  5739. const int bufferSize,
  5740. const bool deleteSourceWhenDestroyed);
  5741. ~BufferedInputStream();
  5742. int64 getTotalLength();
  5743. int64 getPosition();
  5744. bool setPosition (int64 newPosition);
  5745. int read (void* destBuffer, int maxBytesToRead);
  5746. const String readString();
  5747. bool isExhausted();
  5748. juce_UseDebuggingNewOperator
  5749. private:
  5750. InputStream* const source;
  5751. ScopedPointer <InputStream> sourceToDelete;
  5752. int bufferSize;
  5753. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5754. HeapBlock <char> buffer;
  5755. void ensureBuffered();
  5756. BufferedInputStream (const BufferedInputStream&);
  5757. const BufferedInputStream& operator= (const BufferedInputStream&);
  5758. };
  5759. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5760. /********* End of inlined file: juce_BufferedInputStream.h *********/
  5761. #endif
  5762. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5763. /********* Start of inlined file: juce_FileInputSource.h *********/
  5764. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5765. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5766. class JUCE_API FileInputSource : public InputSource
  5767. {
  5768. public:
  5769. FileInputSource (const File& file);
  5770. ~FileInputSource();
  5771. InputStream* createInputStream();
  5772. InputStream* createInputStreamFor (const String& relatedItemPath);
  5773. int64 hashCode() const;
  5774. juce_UseDebuggingNewOperator
  5775. private:
  5776. const File file;
  5777. FileInputSource (const FileInputSource&);
  5778. const FileInputSource& operator= (const FileInputSource&);
  5779. };
  5780. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5781. /********* End of inlined file: juce_FileInputSource.h *********/
  5782. #endif
  5783. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5784. /********* Start of inlined file: juce_GZIPCompressorOutputStream.h *********/
  5785. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5786. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5787. class GZIPCompressorHelper;
  5788. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5789. {
  5790. public:
  5791. GZIPCompressorOutputStream (OutputStream* const destStream,
  5792. int compressionLevel = 0,
  5793. const bool deleteDestStreamWhenDestroyed = false,
  5794. const bool noWrap = false);
  5795. ~GZIPCompressorOutputStream();
  5796. void flush();
  5797. int64 getPosition();
  5798. bool setPosition (int64 newPosition);
  5799. bool write (const void* destBuffer, int howMany);
  5800. juce_UseDebuggingNewOperator
  5801. private:
  5802. OutputStream* const destStream;
  5803. ScopedPointer <OutputStream> streamToDelete;
  5804. HeapBlock <uint8> buffer;
  5805. ScopedPointer <GZIPCompressorHelper> helper;
  5806. bool doNextBlock();
  5807. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5808. const GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5809. };
  5810. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5811. /********* End of inlined file: juce_GZIPCompressorOutputStream.h *********/
  5812. #endif
  5813. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5814. /********* Start of inlined file: juce_GZIPDecompressorInputStream.h *********/
  5815. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5816. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5817. class GZIPDecompressHelper;
  5818. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5819. {
  5820. public:
  5821. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5822. const bool deleteSourceWhenDestroyed,
  5823. const bool noWrap = false,
  5824. const int64 uncompressedStreamLength = -1);
  5825. ~GZIPDecompressorInputStream();
  5826. int64 getPosition();
  5827. bool setPosition (int64 pos);
  5828. int64 getTotalLength();
  5829. bool isExhausted();
  5830. int read (void* destBuffer, int maxBytesToRead);
  5831. juce_UseDebuggingNewOperator
  5832. private:
  5833. InputStream* const sourceStream;
  5834. ScopedPointer <InputStream> streamToDelete;
  5835. const int64 uncompressedStreamLength;
  5836. const bool noWrap;
  5837. bool isEof;
  5838. int activeBufferSize;
  5839. int64 originalSourcePos, currentPos;
  5840. HeapBlock <uint8> buffer;
  5841. ScopedPointer <GZIPDecompressHelper> helper;
  5842. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5843. const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5844. };
  5845. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5846. /********* End of inlined file: juce_GZIPDecompressorInputStream.h *********/
  5847. #endif
  5848. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5849. #endif
  5850. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5851. #endif
  5852. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5853. /********* Start of inlined file: juce_MemoryInputStream.h *********/
  5854. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5855. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5856. class JUCE_API MemoryInputStream : public InputStream
  5857. {
  5858. public:
  5859. MemoryInputStream (const void* const sourceData,
  5860. const size_t sourceDataSize,
  5861. const bool keepInternalCopyOfData);
  5862. ~MemoryInputStream();
  5863. int64 getPosition();
  5864. bool setPosition (int64 pos);
  5865. int64 getTotalLength();
  5866. bool isExhausted();
  5867. int read (void* destBuffer, int maxBytesToRead);
  5868. juce_UseDebuggingNewOperator
  5869. private:
  5870. const char* data;
  5871. size_t dataSize, position;
  5872. MemoryBlock internalCopy;
  5873. };
  5874. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5875. /********* End of inlined file: juce_MemoryInputStream.h *********/
  5876. #endif
  5877. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5878. /********* Start of inlined file: juce_MemoryOutputStream.h *********/
  5879. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5880. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5881. class JUCE_API MemoryOutputStream : public OutputStream
  5882. {
  5883. public:
  5884. MemoryOutputStream (const size_t initialSize = 256,
  5885. const size_t granularity = 256,
  5886. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5887. ~MemoryOutputStream() throw();
  5888. const char* getData() throw();
  5889. size_t getDataSize() const throw();
  5890. void reset() throw();
  5891. void flush();
  5892. bool write (const void* buffer, int howMany);
  5893. int64 getPosition();
  5894. bool setPosition (int64 newPosition);
  5895. juce_UseDebuggingNewOperator
  5896. private:
  5897. MemoryBlock* data;
  5898. ScopedPointer <MemoryBlock> dataToDelete;
  5899. size_t position, size, blockSize;
  5900. };
  5901. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5902. /********* End of inlined file: juce_MemoryOutputStream.h *********/
  5903. #endif
  5904. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  5905. #endif
  5906. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5907. /********* Start of inlined file: juce_SubregionStream.h *********/
  5908. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5909. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5910. class JUCE_API SubregionStream : public InputStream
  5911. {
  5912. public:
  5913. SubregionStream (InputStream* const sourceStream,
  5914. const int64 startPositionInSourceStream,
  5915. const int64 lengthOfSourceStream,
  5916. const bool deleteSourceWhenDestroyed) throw();
  5917. ~SubregionStream() throw();
  5918. int64 getTotalLength();
  5919. int64 getPosition();
  5920. bool setPosition (int64 newPosition);
  5921. int read (void* destBuffer, int maxBytesToRead);
  5922. bool isExhausted();
  5923. juce_UseDebuggingNewOperator
  5924. private:
  5925. InputStream* const source;
  5926. ScopedPointer <InputStream> sourceToDelete;
  5927. const int64 startPositionInSourceStream, lengthOfSourceStream;
  5928. SubregionStream (const SubregionStream&);
  5929. const SubregionStream& operator= (const SubregionStream&);
  5930. };
  5931. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5932. /********* End of inlined file: juce_SubregionStream.h *********/
  5933. #endif
  5934. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  5935. #endif
  5936. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5937. /********* Start of inlined file: juce_LocalisedStrings.h *********/
  5938. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5939. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5940. #define TRANS(stringLiteral) \
  5941. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  5942. class JUCE_API LocalisedStrings
  5943. {
  5944. public:
  5945. LocalisedStrings (const String& fileContents);
  5946. LocalisedStrings (const File& fileToLoad);
  5947. ~LocalisedStrings();
  5948. static void setCurrentMappings (LocalisedStrings* newTranslations);
  5949. static LocalisedStrings* getCurrentMappings();
  5950. static const String translateWithCurrentMappings (const String& text);
  5951. static const String translateWithCurrentMappings (const char* text);
  5952. const String translate (const String& text) const;
  5953. const String getLanguageName() const { return languageName; }
  5954. const StringArray getCountryCodes() const { return countryCodes; }
  5955. void setIgnoresCase (const bool shouldIgnoreCase);
  5956. juce_UseDebuggingNewOperator
  5957. private:
  5958. String languageName;
  5959. StringArray countryCodes;
  5960. StringPairArray translations;
  5961. void loadFromText (const String& fileContents);
  5962. };
  5963. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5964. /********* End of inlined file: juce_LocalisedStrings.h *********/
  5965. #endif
  5966. #ifndef __JUCE_STRING_JUCEHEADER__
  5967. #endif
  5968. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  5969. #endif
  5970. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  5971. #endif
  5972. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5973. /********* Start of inlined file: juce_XmlDocument.h *********/
  5974. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5975. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  5976. class JUCE_API XmlDocument
  5977. {
  5978. public:
  5979. XmlDocument (const String& documentText) throw();
  5980. XmlDocument (const File& file);
  5981. ~XmlDocument() throw();
  5982. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  5983. const String& getLastParseError() const throw();
  5984. void setInputSource (InputSource* const newSource) throw();
  5985. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  5986. juce_UseDebuggingNewOperator
  5987. private:
  5988. String originalText;
  5989. const tchar* input;
  5990. bool outOfData, errorOccurred;
  5991. bool identifierLookupTable [128];
  5992. String lastError, dtdText;
  5993. StringArray tokenisedDTD;
  5994. bool needToLoadDTD, ignoreEmptyTextElements;
  5995. ScopedPointer <InputSource> inputSource;
  5996. void setLastError (const String& desc, const bool carryOn) throw();
  5997. void skipHeader() throw();
  5998. void skipNextWhiteSpace() throw();
  5999. tchar readNextChar() throw();
  6000. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  6001. void readChildElements (XmlElement* parent) throw();
  6002. int findNextTokenLength() throw();
  6003. void readQuotedString (String& result) throw();
  6004. void readEntity (String& result) throw();
  6005. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  6006. bool isXmlIdentifierChar (const tchar c) const throw();
  6007. const String getFileContents (const String& filename) const;
  6008. const String expandEntity (const String& entity);
  6009. const String expandExternalEntity (const String& entity);
  6010. const String getParameterEntity (const String& entity);
  6011. };
  6012. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6013. /********* End of inlined file: juce_XmlDocument.h *********/
  6014. #endif
  6015. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6016. #endif
  6017. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6018. #endif
  6019. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6020. /********* Start of inlined file: juce_InterProcessLock.h *********/
  6021. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6022. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6023. class JUCE_API InterProcessLock
  6024. {
  6025. public:
  6026. InterProcessLock (const String& name);
  6027. ~InterProcessLock();
  6028. bool enter (int timeOutMillisecs = -1);
  6029. void exit();
  6030. juce_UseDebuggingNewOperator
  6031. private:
  6032. #if JUCE_WINDOWS
  6033. void* internal;
  6034. // #elif JUCE_64BIT
  6035. // long long internal;
  6036. #else
  6037. int internal;
  6038. #endif
  6039. String name;
  6040. int reentrancyLevel;
  6041. InterProcessLock (const InterProcessLock&);
  6042. const InterProcessLock& operator= (const InterProcessLock&);
  6043. };
  6044. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6045. /********* End of inlined file: juce_InterProcessLock.h *********/
  6046. #endif
  6047. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6048. /********* Start of inlined file: juce_Process.h *********/
  6049. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6050. #define __JUCE_PROCESS_JUCEHEADER__
  6051. class JUCE_API Process
  6052. {
  6053. public:
  6054. enum ProcessPriority
  6055. {
  6056. LowPriority = 0,
  6057. NormalPriority = 1,
  6058. HighPriority = 2,
  6059. RealtimePriority = 3
  6060. };
  6061. static void setPriority (const ProcessPriority priority);
  6062. static void terminate();
  6063. static bool isForegroundProcess();
  6064. static void raisePrivilege();
  6065. static void lowerPrivilege();
  6066. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6067. };
  6068. #endif // __JUCE_PROCESS_JUCEHEADER__
  6069. /********* End of inlined file: juce_Process.h *********/
  6070. #endif
  6071. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6072. /********* Start of inlined file: juce_ReadWriteLock.h *********/
  6073. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6074. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6075. /********* Start of inlined file: juce_WaitableEvent.h *********/
  6076. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6077. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6078. class JUCE_API WaitableEvent
  6079. {
  6080. public:
  6081. WaitableEvent() throw();
  6082. ~WaitableEvent() throw();
  6083. bool wait (const int timeOutMilliseconds = -1) const throw();
  6084. void signal() const throw();
  6085. void reset() const throw();
  6086. juce_UseDebuggingNewOperator
  6087. private:
  6088. void* internal;
  6089. WaitableEvent (const WaitableEvent&);
  6090. const WaitableEvent& operator= (const WaitableEvent&);
  6091. };
  6092. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6093. /********* End of inlined file: juce_WaitableEvent.h *********/
  6094. /********* Start of inlined file: juce_Thread.h *********/
  6095. #ifndef __JUCE_THREAD_JUCEHEADER__
  6096. #define __JUCE_THREAD_JUCEHEADER__
  6097. class JUCE_API Thread
  6098. {
  6099. public:
  6100. Thread (const String& threadName);
  6101. virtual ~Thread();
  6102. virtual void run() = 0;
  6103. // Thread control functions..
  6104. void startThread();
  6105. void startThread (const int priority);
  6106. void stopThread (const int timeOutMilliseconds);
  6107. bool isThreadRunning() const;
  6108. void signalThreadShouldExit();
  6109. inline bool threadShouldExit() const { return threadShouldExit_; }
  6110. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6111. bool setPriority (const int priority);
  6112. static bool setCurrentThreadPriority (const int priority);
  6113. void setAffinityMask (const uint32 affinityMask);
  6114. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6115. // this can be called from any thread that needs to pause..
  6116. static void JUCE_CALLTYPE sleep (int milliseconds);
  6117. static void JUCE_CALLTYPE yield();
  6118. bool wait (const int timeOutMilliseconds) const;
  6119. void notify() const;
  6120. typedef void* ThreadID;
  6121. static ThreadID getCurrentThreadId();
  6122. static Thread* getCurrentThread();
  6123. ThreadID getThreadId() const { return threadId_; }
  6124. const String getThreadName() const { return threadName_; }
  6125. static int getNumRunningThreads();
  6126. static void stopAllThreads (const int timeoutInMillisecs);
  6127. juce_UseDebuggingNewOperator
  6128. private:
  6129. const String threadName_;
  6130. void* volatile threadHandle_;
  6131. CriticalSection startStopLock;
  6132. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6133. int threadPriority_;
  6134. ThreadID threadId_;
  6135. uint32 affinityMask_;
  6136. bool volatile threadShouldExit_;
  6137. friend void JUCE_API juce_threadEntryPoint (void*);
  6138. static void threadEntryPoint (Thread* thread);
  6139. Thread (const Thread&);
  6140. const Thread& operator= (const Thread&);
  6141. };
  6142. #endif // __JUCE_THREAD_JUCEHEADER__
  6143. /********* End of inlined file: juce_Thread.h *********/
  6144. class JUCE_API ReadWriteLock
  6145. {
  6146. public:
  6147. ReadWriteLock() throw();
  6148. ~ReadWriteLock() throw();
  6149. void enterRead() const throw();
  6150. void exitRead() const throw();
  6151. void enterWrite() const throw();
  6152. bool tryEnterWrite() const throw();
  6153. void exitWrite() const throw();
  6154. juce_UseDebuggingNewOperator
  6155. private:
  6156. CriticalSection accessLock;
  6157. WaitableEvent waitEvent;
  6158. mutable int numWaitingWriters, numWriters;
  6159. mutable Thread::ThreadID writerThreadId;
  6160. mutable Array <Thread::ThreadID> readerThreads;
  6161. ReadWriteLock (const ReadWriteLock&);
  6162. const ReadWriteLock& operator= (const ReadWriteLock&);
  6163. };
  6164. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6165. /********* End of inlined file: juce_ReadWriteLock.h *********/
  6166. #endif
  6167. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6168. #endif
  6169. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6170. /********* Start of inlined file: juce_ScopedReadLock.h *********/
  6171. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6172. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6173. class JUCE_API ScopedReadLock
  6174. {
  6175. public:
  6176. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6177. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6178. private:
  6179. const ReadWriteLock& lock_;
  6180. ScopedReadLock (const ScopedReadLock&);
  6181. const ScopedReadLock& operator= (const ScopedReadLock&);
  6182. };
  6183. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6184. /********* End of inlined file: juce_ScopedReadLock.h *********/
  6185. #endif
  6186. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6187. /********* Start of inlined file: juce_ScopedTryLock.h *********/
  6188. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6189. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6190. class JUCE_API ScopedTryLock
  6191. {
  6192. public:
  6193. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6194. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6195. bool isLocked() const throw() { return lockWasSuccessful; }
  6196. private:
  6197. const CriticalSection& lock_;
  6198. const bool lockWasSuccessful;
  6199. ScopedTryLock (const ScopedTryLock&);
  6200. const ScopedTryLock& operator= (const ScopedTryLock&);
  6201. };
  6202. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6203. /********* End of inlined file: juce_ScopedTryLock.h *********/
  6204. #endif
  6205. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6206. /********* Start of inlined file: juce_ScopedWriteLock.h *********/
  6207. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6208. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6209. class JUCE_API ScopedWriteLock
  6210. {
  6211. public:
  6212. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6213. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6214. private:
  6215. const ReadWriteLock& lock_;
  6216. ScopedWriteLock (const ScopedWriteLock&);
  6217. const ScopedWriteLock& operator= (const ScopedWriteLock&);
  6218. };
  6219. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6220. /********* End of inlined file: juce_ScopedWriteLock.h *********/
  6221. #endif
  6222. #ifndef __JUCE_THREAD_JUCEHEADER__
  6223. #endif
  6224. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6225. /********* Start of inlined file: juce_ThreadPool.h *********/
  6226. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6227. #define __JUCE_THREADPOOL_JUCEHEADER__
  6228. class ThreadPool;
  6229. class ThreadPoolThread;
  6230. class JUCE_API ThreadPoolJob
  6231. {
  6232. public:
  6233. ThreadPoolJob (const String& name);
  6234. virtual ~ThreadPoolJob();
  6235. const String getJobName() const;
  6236. void setJobName (const String& newName);
  6237. enum JobStatus
  6238. {
  6239. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6240. removed from the pool. */
  6241. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6242. should be automatically deleted by the pool. */
  6243. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6244. again when a thread is free. */
  6245. };
  6246. virtual JobStatus runJob() = 0;
  6247. bool isRunning() const { return isActive; }
  6248. bool shouldExit() const { return shouldStop; }
  6249. void signalJobShouldExit();
  6250. juce_UseDebuggingNewOperator
  6251. private:
  6252. friend class ThreadPool;
  6253. friend class ThreadPoolThread;
  6254. String jobName;
  6255. ThreadPool* pool;
  6256. bool shouldStop, isActive, shouldBeDeleted;
  6257. ThreadPoolJob (const ThreadPoolJob&);
  6258. const ThreadPoolJob& operator= (const ThreadPoolJob&);
  6259. };
  6260. class JUCE_API ThreadPool
  6261. {
  6262. public:
  6263. ThreadPool (const int numberOfThreads,
  6264. const bool startThreadsOnlyWhenNeeded = true,
  6265. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6266. ~ThreadPool();
  6267. class JUCE_API JobSelector
  6268. {
  6269. public:
  6270. virtual ~JobSelector() {}
  6271. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6272. };
  6273. void addJob (ThreadPoolJob* const job);
  6274. bool removeJob (ThreadPoolJob* const job,
  6275. const bool interruptIfRunning,
  6276. const int timeOutMilliseconds);
  6277. bool removeAllJobs (const bool interruptRunningJobs,
  6278. const int timeOutMilliseconds,
  6279. const bool deleteInactiveJobs = false,
  6280. JobSelector* selectedJobsToRemove = 0);
  6281. int getNumJobs() const;
  6282. ThreadPoolJob* getJob (const int index) const;
  6283. bool contains (const ThreadPoolJob* const job) const;
  6284. bool isJobRunning (const ThreadPoolJob* const job) const;
  6285. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6286. const int timeOutMilliseconds) const;
  6287. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6288. bool setThreadPriorities (const int newPriority);
  6289. juce_UseDebuggingNewOperator
  6290. private:
  6291. const int numThreads, threadStopTimeout;
  6292. int priority;
  6293. HeapBlock <Thread*> threads;
  6294. VoidArray jobs;
  6295. CriticalSection lock;
  6296. uint32 lastJobEndTime;
  6297. WaitableEvent jobFinishedSignal;
  6298. friend class ThreadPoolThread;
  6299. bool runNextJob();
  6300. ThreadPool (const ThreadPool&);
  6301. const ThreadPool& operator= (const ThreadPool&);
  6302. };
  6303. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6304. /********* End of inlined file: juce_ThreadPool.h *********/
  6305. #endif
  6306. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6307. /********* Start of inlined file: juce_TimeSliceThread.h *********/
  6308. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6309. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6310. class JUCE_API TimeSliceClient
  6311. {
  6312. public:
  6313. virtual ~TimeSliceClient() {}
  6314. virtual bool useTimeSlice() = 0;
  6315. };
  6316. class JUCE_API TimeSliceThread : public Thread
  6317. {
  6318. public:
  6319. TimeSliceThread (const String& threadName);
  6320. ~TimeSliceThread();
  6321. void addTimeSliceClient (TimeSliceClient* const client);
  6322. void removeTimeSliceClient (TimeSliceClient* const client);
  6323. int getNumClients() const;
  6324. TimeSliceClient* getClient (const int index) const;
  6325. void run();
  6326. juce_UseDebuggingNewOperator
  6327. private:
  6328. CriticalSection callbackLock, listLock;
  6329. Array <TimeSliceClient*> clients;
  6330. int index;
  6331. TimeSliceClient* clientBeingCalled;
  6332. bool clientsChanged;
  6333. TimeSliceThread (const TimeSliceThread&);
  6334. const TimeSliceThread& operator= (const TimeSliceThread&);
  6335. };
  6336. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6337. /********* End of inlined file: juce_TimeSliceThread.h *********/
  6338. #endif
  6339. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6340. #endif
  6341. #endif
  6342. /********* End of inlined file: juce_core_includes.h *********/
  6343. // if you're compiling a command-line app, you might want to just include the core headers,
  6344. // so you can set this macro before including juce.h
  6345. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6346. /********* Start of inlined file: juce_app_includes.h *********/
  6347. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6348. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6349. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6350. /********* Start of inlined file: juce_Application.h *********/
  6351. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6352. #define __JUCE_APPLICATION_JUCEHEADER__
  6353. /********* Start of inlined file: juce_ApplicationCommandTarget.h *********/
  6354. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6355. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6356. /********* Start of inlined file: juce_Component.h *********/
  6357. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6358. #define __JUCE_COMPONENT_JUCEHEADER__
  6359. /********* Start of inlined file: juce_MouseCursor.h *********/
  6360. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6361. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6362. class Image;
  6363. class SharedMouseCursorInternal;
  6364. class ComponentPeer;
  6365. class Component;
  6366. class JUCE_API MouseCursor
  6367. {
  6368. public:
  6369. enum StandardCursorType
  6370. {
  6371. NoCursor = 0, /**< An invisible cursor. */
  6372. NormalCursor, /**< The stardard arrow cursor. */
  6373. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6374. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6375. CrosshairCursor, /**< A pair of crosshairs. */
  6376. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6377. that you're dragging a copy of something. */
  6378. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6379. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6380. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6381. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6382. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6383. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6384. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6385. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6386. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6387. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6388. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6389. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6390. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6391. };
  6392. MouseCursor() throw();
  6393. MouseCursor (const StandardCursorType type) throw();
  6394. MouseCursor (const Image& image,
  6395. const int hotSpotX,
  6396. const int hotSpotY) throw();
  6397. MouseCursor (const MouseCursor& other) throw();
  6398. const MouseCursor& operator= (const MouseCursor& other) throw();
  6399. ~MouseCursor() throw();
  6400. bool operator== (const MouseCursor& other) const throw();
  6401. bool operator!= (const MouseCursor& other) const throw();
  6402. static void showWaitCursor() throw();
  6403. static void hideWaitCursor() throw();
  6404. juce_UseDebuggingNewOperator
  6405. private:
  6406. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6407. friend class Component;
  6408. void showInWindow (ComponentPeer* window) const throw();
  6409. void showInAllWindows() const throw();
  6410. void* getHandle() const throw();
  6411. };
  6412. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6413. /********* End of inlined file: juce_MouseCursor.h *********/
  6414. /********* Start of inlined file: juce_MouseListener.h *********/
  6415. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6416. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6417. /********* Start of inlined file: juce_MouseEvent.h *********/
  6418. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6419. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6420. class Component;
  6421. /********* Start of inlined file: juce_ModifierKeys.h *********/
  6422. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6423. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6424. class JUCE_API ModifierKeys
  6425. {
  6426. public:
  6427. ModifierKeys (const int flags = 0) throw();
  6428. ModifierKeys (const ModifierKeys& other) throw();
  6429. const ModifierKeys& operator= (const ModifierKeys& other) throw();
  6430. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6431. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6432. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6433. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6434. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6435. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6436. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6437. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6438. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6439. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6440. enum Flags
  6441. {
  6442. shiftModifier = 1,
  6443. ctrlModifier = 2,
  6444. altModifier = 4,
  6445. leftButtonModifier = 16,
  6446. rightButtonModifier = 32,
  6447. middleButtonModifier = 64,
  6448. #if JUCE_MAC
  6449. commandModifier = 8,
  6450. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6451. #else
  6452. commandModifier = ctrlModifier,
  6453. popupMenuClickModifier = rightButtonModifier,
  6454. #endif
  6455. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6456. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6457. };
  6458. inline int getRawFlags() const throw() { return flags; }
  6459. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6460. static const ModifierKeys getCurrentModifiers() throw();
  6461. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6462. private:
  6463. int flags;
  6464. static int currentModifierFlags;
  6465. friend class ComponentPeer;
  6466. static void updateCurrentModifiers() throw();
  6467. };
  6468. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6469. /********* End of inlined file: juce_ModifierKeys.h *********/
  6470. class JUCE_API MouseEvent
  6471. {
  6472. public:
  6473. MouseEvent (const int x, const int y,
  6474. const ModifierKeys& modifiers,
  6475. Component* const originator,
  6476. const Time& eventTime,
  6477. const int mouseDownX,
  6478. const int mouseDownY,
  6479. const Time& mouseDownTime,
  6480. const int numberOfClicks,
  6481. const bool mouseWasDragged) throw();
  6482. ~MouseEvent() throw();
  6483. int x;
  6484. int y;
  6485. ModifierKeys mods;
  6486. Component* eventComponent;
  6487. Component* originalComponent;
  6488. Time eventTime;
  6489. int getMouseDownX() const throw();
  6490. int getMouseDownY() const throw();
  6491. int getDistanceFromDragStart() const throw();
  6492. int getDistanceFromDragStartX() const throw();
  6493. int getDistanceFromDragStartY() const throw();
  6494. bool mouseWasClicked() const throw();
  6495. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6496. int getLengthOfMousePress() const throw();
  6497. int getScreenX() const throw();
  6498. int getScreenY() const throw();
  6499. int getMouseDownScreenX() const throw();
  6500. int getMouseDownScreenY() const throw();
  6501. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6502. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6503. static int getDoubleClickTimeout() throw();
  6504. juce_UseDebuggingNewOperator
  6505. private:
  6506. int mouseDownX, mouseDownY;
  6507. Time mouseDownTime;
  6508. int numberOfClicks;
  6509. bool wasMovedSinceMouseDown;
  6510. };
  6511. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6512. /********* End of inlined file: juce_MouseEvent.h *********/
  6513. class JUCE_API MouseListener
  6514. {
  6515. public:
  6516. virtual ~MouseListener() {}
  6517. virtual void mouseMove (const MouseEvent& e);
  6518. virtual void mouseEnter (const MouseEvent& e);
  6519. virtual void mouseExit (const MouseEvent& e);
  6520. virtual void mouseDown (const MouseEvent& e);
  6521. virtual void mouseDrag (const MouseEvent& e);
  6522. virtual void mouseUp (const MouseEvent& e);
  6523. virtual void mouseDoubleClick (const MouseEvent& e);
  6524. virtual void mouseWheelMove (const MouseEvent& e,
  6525. float wheelIncrementX,
  6526. float wheelIncrementY);
  6527. };
  6528. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6529. /********* End of inlined file: juce_MouseListener.h *********/
  6530. /********* Start of inlined file: juce_ComponentListener.h *********/
  6531. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6532. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6533. class Component;
  6534. class JUCE_API ComponentListener
  6535. {
  6536. public:
  6537. virtual ~ComponentListener() {}
  6538. virtual void componentMovedOrResized (Component& component,
  6539. bool wasMoved,
  6540. bool wasResized);
  6541. virtual void componentBroughtToFront (Component& component);
  6542. virtual void componentVisibilityChanged (Component& component);
  6543. virtual void componentChildrenChanged (Component& component);
  6544. virtual void componentParentHierarchyChanged (Component& component);
  6545. virtual void componentNameChanged (Component& component);
  6546. };
  6547. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6548. /********* End of inlined file: juce_ComponentListener.h *********/
  6549. /********* Start of inlined file: juce_KeyListener.h *********/
  6550. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6551. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6552. /********* Start of inlined file: juce_KeyPress.h *********/
  6553. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6554. #define __JUCE_KEYPRESS_JUCEHEADER__
  6555. class JUCE_API KeyPress
  6556. {
  6557. public:
  6558. KeyPress() throw();
  6559. KeyPress (const int keyCode,
  6560. const ModifierKeys& modifiers,
  6561. const juce_wchar textCharacter) throw();
  6562. KeyPress (const int keyCode) throw();
  6563. KeyPress (const KeyPress& other) throw();
  6564. const KeyPress& operator= (const KeyPress& other) throw();
  6565. bool operator== (const KeyPress& other) const throw();
  6566. bool operator!= (const KeyPress& other) const throw();
  6567. bool isValid() const throw() { return keyCode != 0; }
  6568. int getKeyCode() const throw() { return keyCode; }
  6569. const ModifierKeys getModifiers() const throw() { return mods; }
  6570. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6571. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6572. static const KeyPress createFromDescription (const String& textVersion) throw();
  6573. const String getTextDescription() const throw();
  6574. bool isCurrentlyDown() const throw();
  6575. static bool isKeyCurrentlyDown (int keyCode) throw();
  6576. // Key codes
  6577. //
  6578. // Note that the actual values of these are platform-specific and may change
  6579. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6580. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6581. //
  6582. static const int spaceKey; /**< key-code for the space bar */
  6583. static const int escapeKey; /**< key-code for the escape key */
  6584. static const int returnKey; /**< key-code for the return key*/
  6585. static const int tabKey; /**< key-code for the tab key*/
  6586. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6587. static const int backspaceKey; /**< key-code for the backspace key */
  6588. static const int insertKey; /**< key-code for the insert key */
  6589. static const int upKey; /**< key-code for the cursor-up key */
  6590. static const int downKey; /**< key-code for the cursor-down key */
  6591. static const int leftKey; /**< key-code for the cursor-left key */
  6592. static const int rightKey; /**< key-code for the cursor-right key */
  6593. static const int pageUpKey; /**< key-code for the page-up key */
  6594. static const int pageDownKey; /**< key-code for the page-down key */
  6595. static const int homeKey; /**< key-code for the home key */
  6596. static const int endKey; /**< key-code for the end key */
  6597. static const int F1Key; /**< key-code for the F1 key */
  6598. static const int F2Key; /**< key-code for the F2 key */
  6599. static const int F3Key; /**< key-code for the F3 key */
  6600. static const int F4Key; /**< key-code for the F4 key */
  6601. static const int F5Key; /**< key-code for the F5 key */
  6602. static const int F6Key; /**< key-code for the F6 key */
  6603. static const int F7Key; /**< key-code for the F7 key */
  6604. static const int F8Key; /**< key-code for the F8 key */
  6605. static const int F9Key; /**< key-code for the F9 key */
  6606. static const int F10Key; /**< key-code for the F10 key */
  6607. static const int F11Key; /**< key-code for the F11 key */
  6608. static const int F12Key; /**< key-code for the F12 key */
  6609. static const int F13Key; /**< key-code for the F13 key */
  6610. static const int F14Key; /**< key-code for the F14 key */
  6611. static const int F15Key; /**< key-code for the F15 key */
  6612. static const int F16Key; /**< key-code for the F16 key */
  6613. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6614. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6615. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6616. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6617. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6618. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6619. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6620. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6621. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6622. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6623. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6624. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6625. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6626. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6627. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6628. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6629. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6630. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6631. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6632. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6633. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6634. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6635. juce_UseDebuggingNewOperator
  6636. private:
  6637. int keyCode;
  6638. ModifierKeys mods;
  6639. juce_wchar textCharacter;
  6640. };
  6641. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6642. /********* End of inlined file: juce_KeyPress.h *********/
  6643. class Component;
  6644. class JUCE_API KeyListener
  6645. {
  6646. public:
  6647. virtual ~KeyListener() {}
  6648. virtual bool keyPressed (const KeyPress& key,
  6649. Component* originatingComponent) = 0;
  6650. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6651. };
  6652. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6653. /********* End of inlined file: juce_KeyListener.h *********/
  6654. /********* Start of inlined file: juce_KeyboardFocusTraverser.h *********/
  6655. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6656. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6657. class Component;
  6658. class JUCE_API KeyboardFocusTraverser
  6659. {
  6660. public:
  6661. KeyboardFocusTraverser();
  6662. virtual ~KeyboardFocusTraverser();
  6663. virtual Component* getNextComponent (Component* current);
  6664. virtual Component* getPreviousComponent (Component* current);
  6665. virtual Component* getDefaultComponent (Component* parentComponent);
  6666. };
  6667. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6668. /********* End of inlined file: juce_KeyboardFocusTraverser.h *********/
  6669. /********* Start of inlined file: juce_ImageEffectFilter.h *********/
  6670. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6671. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6672. /********* Start of inlined file: juce_Graphics.h *********/
  6673. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6674. #define __JUCE_GRAPHICS_JUCEHEADER__
  6675. /********* Start of inlined file: juce_Font.h *********/
  6676. #ifndef __JUCE_FONT_JUCEHEADER__
  6677. #define __JUCE_FONT_JUCEHEADER__
  6678. /********* Start of inlined file: juce_Typeface.h *********/
  6679. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6680. #define __JUCE_TYPEFACE_JUCEHEADER__
  6681. /********* Start of inlined file: juce_Path.h *********/
  6682. #ifndef __JUCE_PATH_JUCEHEADER__
  6683. #define __JUCE_PATH_JUCEHEADER__
  6684. /********* Start of inlined file: juce_AffineTransform.h *********/
  6685. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6686. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6687. class JUCE_API AffineTransform
  6688. {
  6689. public:
  6690. AffineTransform() throw();
  6691. AffineTransform (const AffineTransform& other) throw();
  6692. AffineTransform (const float mat00, const float mat01, const float mat02,
  6693. const float mat10, const float mat11, const float mat12) throw();
  6694. const AffineTransform& operator= (const AffineTransform& other) throw();
  6695. bool operator== (const AffineTransform& other) const throw();
  6696. bool operator!= (const AffineTransform& other) const throw();
  6697. static const AffineTransform identity;
  6698. void transformPoint (float& x,
  6699. float& y) const throw();
  6700. void transformPoint (double& x,
  6701. double& y) const throw();
  6702. const AffineTransform translated (const float deltaX,
  6703. const float deltaY) const throw();
  6704. static const AffineTransform translation (const float deltaX,
  6705. const float deltaY) throw();
  6706. const AffineTransform rotated (const float angleInRadians) const throw();
  6707. const AffineTransform rotated (const float angleInRadians,
  6708. const float pivotX,
  6709. const float pivotY) const throw();
  6710. static const AffineTransform rotation (const float angleInRadians) throw();
  6711. static const AffineTransform rotation (const float angleInRadians,
  6712. const float pivotX,
  6713. const float pivotY) throw();
  6714. const AffineTransform scaled (const float factorX,
  6715. const float factorY) const throw();
  6716. static const AffineTransform scale (const float factorX,
  6717. const float factorY) throw();
  6718. const AffineTransform sheared (const float shearX,
  6719. const float shearY) const throw();
  6720. const AffineTransform inverted() const throw();
  6721. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6722. bool isIdentity() const throw();
  6723. bool isSingularity() const throw();
  6724. bool isOnlyTranslation() const throw();
  6725. float getTranslationX() const throw() { return mat02; }
  6726. float getTranslationY() const throw() { return mat12; }
  6727. juce_UseDebuggingNewOperator
  6728. float mat00, mat01, mat02;
  6729. float mat10, mat11, mat12;
  6730. private:
  6731. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6732. const float mat10, const float mat11, const float mat12) const throw();
  6733. };
  6734. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6735. /********* End of inlined file: juce_AffineTransform.h *********/
  6736. /********* Start of inlined file: juce_Point.h *********/
  6737. #ifndef __JUCE_POINT_JUCEHEADER__
  6738. #define __JUCE_POINT_JUCEHEADER__
  6739. class JUCE_API Point
  6740. {
  6741. public:
  6742. Point() throw();
  6743. Point (const Point& other) throw();
  6744. Point (const float x, const float y) throw();
  6745. const Point& operator= (const Point& other) throw();
  6746. ~Point() throw();
  6747. inline float getX() const throw() { return x; }
  6748. inline float getY() const throw() { return y; }
  6749. void setXY (const float x,
  6750. const float y) throw();
  6751. void applyTransform (const AffineTransform& transform) throw();
  6752. juce_UseDebuggingNewOperator
  6753. private:
  6754. float x, y;
  6755. };
  6756. #endif // __JUCE_POINT_JUCEHEADER__
  6757. /********* End of inlined file: juce_Point.h *********/
  6758. /********* Start of inlined file: juce_Rectangle.h *********/
  6759. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6760. #define __JUCE_RECTANGLE_JUCEHEADER__
  6761. class JUCE_API Rectangle
  6762. {
  6763. public:
  6764. Rectangle() throw();
  6765. Rectangle (const Rectangle& other) throw();
  6766. Rectangle (const int x, const int y,
  6767. const int width, const int height) throw();
  6768. Rectangle (const int width, const int height) throw();
  6769. ~Rectangle() throw();
  6770. inline int getX() const throw() { return x; }
  6771. inline int getY() const throw() { return y; }
  6772. inline int getWidth() const throw() { return w; }
  6773. inline int getHeight() const throw() { return h; }
  6774. inline int getRight() const throw() { return x + w; }
  6775. inline int getBottom() const throw() { return y + h; }
  6776. inline int getCentreX() const throw() { return x + (w >> 1); }
  6777. inline int getCentreY() const throw() { return y + (h >> 1); }
  6778. bool isEmpty() const throw();
  6779. void setPosition (const int x, const int y) throw();
  6780. void setSize (const int w, const int h) throw();
  6781. void setBounds (const int newX, const int newY,
  6782. const int newWidth, const int newHeight) throw();
  6783. void setWidth (const int newWidth) throw();
  6784. void setHeight (const int newHeight) throw();
  6785. void setLeft (const int newLeft) throw();
  6786. void setTop (const int newTop) throw();
  6787. void setRight (const int newRight) throw();
  6788. void setBottom (const int newBottom) throw();
  6789. void translate (const int deltaX,
  6790. const int deltaY) throw();
  6791. const Rectangle translated (const int deltaX,
  6792. const int deltaY) const throw();
  6793. void expand (const int deltaX,
  6794. const int deltaY) throw();
  6795. const Rectangle expanded (const int deltaX,
  6796. const int deltaY) const throw();
  6797. void reduce (const int deltaX,
  6798. const int deltaY) throw();
  6799. const Rectangle reduced (const int deltaX,
  6800. const int deltaY) const throw();
  6801. bool operator== (const Rectangle& other) const throw();
  6802. bool operator!= (const Rectangle& other) const throw();
  6803. bool contains (const int x, const int y) const throw();
  6804. bool contains (const Rectangle& other) const throw();
  6805. bool intersects (const Rectangle& other) const throw();
  6806. const Rectangle getIntersection (const Rectangle& other) const throw();
  6807. bool intersectRectangle (int& x, int& y, int& w, int& h) const throw();
  6808. const Rectangle getUnion (const Rectangle& other) const throw();
  6809. bool enlargeIfAdjacent (const Rectangle& other) throw();
  6810. bool reduceIfPartlyContainedIn (const Rectangle& other) throw();
  6811. static bool intersectRectangles (int& x1, int& y1, int& w1, int& h1,
  6812. int x2, int y2, int w2, int h2) throw();
  6813. const String toString() const throw();
  6814. static const Rectangle fromString (const String& stringVersion);
  6815. juce_UseDebuggingNewOperator
  6816. private:
  6817. friend class RectangleList;
  6818. int x, y, w, h;
  6819. };
  6820. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  6821. /********* End of inlined file: juce_Rectangle.h *********/
  6822. /********* Start of inlined file: juce_Justification.h *********/
  6823. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  6824. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  6825. class JUCE_API Justification
  6826. {
  6827. public:
  6828. inline Justification (const int flags_) throw() : flags (flags_) {}
  6829. Justification (const Justification& other) throw();
  6830. const Justification& operator= (const Justification& other) throw();
  6831. inline int getFlags() const throw() { return flags; }
  6832. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6833. int getOnlyVerticalFlags() const throw();
  6834. int getOnlyHorizontalFlags() const throw();
  6835. void applyToRectangle (int& x, int& y,
  6836. const int w, const int h,
  6837. const int spaceX, const int spaceY,
  6838. const int spaceW, const int spaceH) const throw();
  6839. enum
  6840. {
  6841. left = 1,
  6842. right = 2,
  6843. horizontallyCentred = 4,
  6844. top = 8,
  6845. bottom = 16,
  6846. verticallyCentred = 32,
  6847. horizontallyJustified = 64,
  6848. centred = 36,
  6849. centredLeft = 33,
  6850. centredRight = 34,
  6851. centredTop = 12,
  6852. centredBottom = 20,
  6853. topLeft = 9,
  6854. topRight = 10,
  6855. bottomLeft = 17,
  6856. bottomRight = 18
  6857. };
  6858. private:
  6859. int flags;
  6860. };
  6861. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  6862. /********* End of inlined file: juce_Justification.h *********/
  6863. /********* Start of inlined file: juce_EdgeTable.h *********/
  6864. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  6865. #define __JUCE_EDGETABLE_JUCEHEADER__
  6866. class Path;
  6867. class RectangleList;
  6868. class Image;
  6869. class JUCE_API EdgeTable
  6870. {
  6871. public:
  6872. EdgeTable (const Rectangle& clipLimits,
  6873. const Path& pathToAdd,
  6874. const AffineTransform& transform) throw();
  6875. EdgeTable (const Rectangle& rectangleToAdd) throw();
  6876. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  6877. EdgeTable (const float x, const float y,
  6878. const float w, const float h) throw();
  6879. EdgeTable (const EdgeTable& other) throw();
  6880. const EdgeTable& operator= (const EdgeTable& other) throw();
  6881. ~EdgeTable() throw();
  6882. void clipToRectangle (const Rectangle& r) throw();
  6883. void excludeRectangle (const Rectangle& r) throw();
  6884. void clipToEdgeTable (const EdgeTable& other);
  6885. void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
  6886. bool isEmpty() throw();
  6887. const Rectangle& getMaximumBounds() const throw() { return bounds; }
  6888. void translate (float dx, int dy) throw();
  6889. void optimiseTable() throw();
  6890. template <class EdgeTableIterationCallback>
  6891. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  6892. {
  6893. const int* lineStart = table;
  6894. for (int y = 0; y < bounds.getHeight(); ++y)
  6895. {
  6896. const int* line = lineStart;
  6897. lineStart += lineStrideElements;
  6898. int numPoints = line[0];
  6899. if (--numPoints > 0)
  6900. {
  6901. int x = *++line;
  6902. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  6903. int levelAccumulator = 0;
  6904. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  6905. while (--numPoints >= 0)
  6906. {
  6907. const int level = *++line;
  6908. jassert (((unsigned int) level) < (unsigned int) 256);
  6909. const int endX = *++line;
  6910. jassert (endX >= x);
  6911. const int endOfRun = (endX >> 8);
  6912. if (endOfRun == (x >> 8))
  6913. {
  6914. // small segment within the same pixel, so just save it for the next
  6915. // time round..
  6916. levelAccumulator += (endX - x) * level;
  6917. }
  6918. else
  6919. {
  6920. // plot the fist pixel of this segment, including any accumulated
  6921. // levels from smaller segments that haven't been drawn yet
  6922. levelAccumulator += (0xff - (x & 0xff)) * level;
  6923. levelAccumulator >>= 8;
  6924. x >>= 8;
  6925. if (levelAccumulator > 0)
  6926. {
  6927. if (levelAccumulator >> 8)
  6928. levelAccumulator = 0xff;
  6929. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  6930. }
  6931. // if there's a run of similar pixels, do it all in one go..
  6932. if (level > 0)
  6933. {
  6934. jassert (endOfRun <= bounds.getRight());
  6935. const int numPix = endOfRun - ++x;
  6936. if (numPix > 0)
  6937. iterationCallback.handleEdgeTableLine (x, numPix, level);
  6938. }
  6939. // save the bit at the end to be drawn next time round the loop.
  6940. levelAccumulator = (endX & 0xff) * level;
  6941. }
  6942. x = endX;
  6943. }
  6944. if (levelAccumulator > 0)
  6945. {
  6946. levelAccumulator >>= 8;
  6947. if (levelAccumulator >> 8)
  6948. levelAccumulator = 0xff;
  6949. x >>= 8;
  6950. jassert (x >= bounds.getX() && x < bounds.getRight());
  6951. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  6952. }
  6953. }
  6954. }
  6955. }
  6956. juce_UseDebuggingNewOperator
  6957. private:
  6958. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  6959. HeapBlock <int> table;
  6960. Rectangle bounds;
  6961. int maxEdgesPerLine, lineStrideElements;
  6962. bool needToCheckEmptinesss;
  6963. void addEdgePoint (const int x, const int y, const int winding) throw();
  6964. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  6965. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  6966. void sanitiseLevels (const bool useNonZeroWinding) throw();
  6967. };
  6968. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  6969. /********* End of inlined file: juce_EdgeTable.h *********/
  6970. class Image;
  6971. class JUCE_API Path
  6972. {
  6973. public:
  6974. Path() throw();
  6975. Path (const Path& other) throw();
  6976. ~Path() throw();
  6977. const Path& operator= (const Path& other) throw();
  6978. bool isEmpty() const throw();
  6979. void getBounds (float& x, float& y,
  6980. float& w, float& h) const throw();
  6981. void getBoundsTransformed (const AffineTransform& transform,
  6982. float& x, float& y,
  6983. float& w, float& h) const throw();
  6984. bool contains (const float x,
  6985. const float y,
  6986. const float tolerence = 10.0f) const throw();
  6987. bool intersectsLine (const float x1, const float y1,
  6988. const float x2, const float y2,
  6989. const float tolerence = 10.0f) throw();
  6990. void clear() throw();
  6991. void startNewSubPath (const float startX,
  6992. const float startY) throw();
  6993. void closeSubPath() throw();
  6994. void lineTo (const float endX,
  6995. const float endY) throw();
  6996. void quadraticTo (const float controlPointX,
  6997. const float controlPointY,
  6998. const float endPointX,
  6999. const float endPointY) throw();
  7000. void cubicTo (const float controlPoint1X,
  7001. const float controlPoint1Y,
  7002. const float controlPoint2X,
  7003. const float controlPoint2Y,
  7004. const float endPointX,
  7005. const float endPointY) throw();
  7006. const Point getCurrentPosition() const;
  7007. void addRectangle (const float x, const float y,
  7008. const float w, const float h) throw();
  7009. void addRectangle (const Rectangle& rectangle) throw();
  7010. void addRoundedRectangle (const float x, const float y,
  7011. const float w, const float h,
  7012. float cornerSize) throw();
  7013. void addRoundedRectangle (const float x, const float y,
  7014. const float w, const float h,
  7015. float cornerSizeX,
  7016. float cornerSizeY) throw();
  7017. void addTriangle (const float x1, const float y1,
  7018. const float x2, const float y2,
  7019. const float x3, const float y3) throw();
  7020. void addQuadrilateral (const float x1, const float y1,
  7021. const float x2, const float y2,
  7022. const float x3, const float y3,
  7023. const float x4, const float y4) throw();
  7024. void addEllipse (const float x, const float y,
  7025. const float width, const float height) throw();
  7026. void addArc (const float x, const float y,
  7027. const float width, const float height,
  7028. const float fromRadians,
  7029. const float toRadians,
  7030. const bool startAsNewSubPath = false) throw();
  7031. void addCentredArc (const float centreX, const float centreY,
  7032. const float radiusX, const float radiusY,
  7033. const float rotationOfEllipse,
  7034. const float fromRadians,
  7035. const float toRadians,
  7036. const bool startAsNewSubPath = false) throw();
  7037. void addPieSegment (const float x, const float y,
  7038. const float width, const float height,
  7039. const float fromRadians,
  7040. const float toRadians,
  7041. const float innerCircleProportionalSize);
  7042. void addLineSegment (const float startX, const float startY,
  7043. const float endX, const float endY,
  7044. float lineThickness) throw();
  7045. void addArrow (const float startX, const float startY,
  7046. const float endX, const float endY,
  7047. float lineThickness,
  7048. float arrowheadWidth,
  7049. float arrowheadLength) throw();
  7050. void addStar (const float centreX,
  7051. const float centreY,
  7052. const int numberOfPoints,
  7053. const float innerRadius,
  7054. const float outerRadius,
  7055. const float startAngle = 0.0f);
  7056. void addBubble (float bodyX, float bodyY,
  7057. float bodyW, float bodyH,
  7058. float cornerSize,
  7059. float arrowTipX,
  7060. float arrowTipY,
  7061. int whichSide,
  7062. float arrowPositionAlongEdgeProportional,
  7063. float arrowWidth);
  7064. void addPath (const Path& pathToAppend) throw();
  7065. void addPath (const Path& pathToAppend,
  7066. const AffineTransform& transformToApply) throw();
  7067. void swapWithPath (Path& other);
  7068. void applyTransform (const AffineTransform& transform) throw();
  7069. void scaleToFit (const float x, const float y,
  7070. const float width, const float height,
  7071. const bool preserveProportions) throw();
  7072. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7073. const float width, const float height,
  7074. const bool preserveProportions,
  7075. const Justification& justificationType = Justification::centred) const throw();
  7076. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7077. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7078. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7079. class JUCE_API Iterator
  7080. {
  7081. public:
  7082. Iterator (const Path& path);
  7083. ~Iterator();
  7084. bool next();
  7085. enum PathElementType
  7086. {
  7087. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7088. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7089. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7090. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7091. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7092. };
  7093. PathElementType elementType;
  7094. float x1, y1, x2, y2, x3, y3;
  7095. private:
  7096. const Path& path;
  7097. int index;
  7098. Iterator (const Iterator&);
  7099. const Iterator& operator= (const Iterator&);
  7100. };
  7101. void loadPathFromStream (InputStream& source);
  7102. void loadPathFromData (const unsigned char* const data,
  7103. const int numberOfBytes) throw();
  7104. void writePathToStream (OutputStream& destination) const;
  7105. const String toString() const;
  7106. void restoreFromString (const String& stringVersion);
  7107. juce_UseDebuggingNewOperator
  7108. private:
  7109. friend class PathFlatteningIterator;
  7110. friend class Path::Iterator;
  7111. ArrayAllocationBase <float> data;
  7112. int numElements;
  7113. float pathXMin, pathXMax, pathYMin, pathYMax;
  7114. bool useNonZeroWinding;
  7115. static const float lineMarker;
  7116. static const float moveMarker;
  7117. static const float quadMarker;
  7118. static const float cubicMarker;
  7119. static const float closeSubPathMarker;
  7120. };
  7121. #endif // __JUCE_PATH_JUCEHEADER__
  7122. /********* End of inlined file: juce_Path.h *********/
  7123. class Font;
  7124. class CustomTypefaceGlyphInfo;
  7125. class JUCE_API Typeface : public ReferenceCountedObject
  7126. {
  7127. public:
  7128. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7129. const String getName() const throw() { return name; }
  7130. static const Ptr createSystemTypefaceFor (const Font& font);
  7131. virtual ~Typeface();
  7132. virtual float getAscent() const = 0;
  7133. virtual float getDescent() const = 0;
  7134. virtual float getStringWidth (const String& text) = 0;
  7135. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7136. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7137. juce_UseDebuggingNewOperator
  7138. protected:
  7139. String name;
  7140. Typeface (const String& name) throw();
  7141. private:
  7142. Typeface (const Typeface&);
  7143. const Typeface& operator= (const Typeface&);
  7144. };
  7145. class JUCE_API CustomTypeface : public Typeface
  7146. {
  7147. public:
  7148. CustomTypeface();
  7149. CustomTypeface (InputStream& serialisedTypefaceStream);
  7150. ~CustomTypeface();
  7151. void clear();
  7152. void setCharacteristics (const String& name, const float ascent,
  7153. const bool isBold, const bool isItalic,
  7154. const juce_wchar defaultCharacter) throw();
  7155. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7156. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7157. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7158. bool writeToStream (OutputStream& outputStream);
  7159. // The following methods implement the basic Typeface behaviour.
  7160. float getAscent() const;
  7161. float getDescent() const;
  7162. float getStringWidth (const String& text);
  7163. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7164. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7165. int getGlyphForCharacter (juce_wchar character);
  7166. juce_UseDebuggingNewOperator
  7167. protected:
  7168. juce_wchar defaultCharacter;
  7169. float ascent;
  7170. bool isBold, isItalic;
  7171. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7172. private:
  7173. OwnedArray <CustomTypefaceGlyphInfo> glyphs;
  7174. short lookupTable [128];
  7175. CustomTypeface (const CustomTypeface&);
  7176. const CustomTypeface& operator= (const CustomTypeface&);
  7177. CustomTypefaceGlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7178. CustomTypefaceGlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7179. };
  7180. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7181. /********* End of inlined file: juce_Typeface.h *********/
  7182. class LowLevelGraphicsContext;
  7183. class JUCE_API Font
  7184. {
  7185. public:
  7186. enum FontStyleFlags
  7187. {
  7188. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7189. bold = 1, /**< boldens the font. @see setStyleFlags */
  7190. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7191. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7192. };
  7193. Font (const float fontHeight,
  7194. const int styleFlags = plain) throw();
  7195. Font (const String& typefaceName,
  7196. const float fontHeight,
  7197. const int styleFlags) throw();
  7198. Font (const Font& other) throw();
  7199. Font (const Typeface::Ptr& typeface) throw();
  7200. Font() throw();
  7201. const Font& operator= (const Font& other) throw();
  7202. bool operator== (const Font& other) const throw();
  7203. bool operator!= (const Font& other) const throw();
  7204. ~Font() throw();
  7205. void setTypefaceName (const String& faceName) throw();
  7206. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7207. static const String getDefaultSansSerifFontName() throw();
  7208. static const String getDefaultSerifFontName() throw();
  7209. static const String getDefaultMonospacedFontName() throw();
  7210. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7211. float getHeight() const throw() { return font->height; }
  7212. void setHeight (float newHeight) throw();
  7213. void setHeightWithoutChangingWidth (float newHeight) throw();
  7214. float getAscent() const throw();
  7215. float getDescent() const throw();
  7216. int getStyleFlags() const throw() { return font->styleFlags; }
  7217. void setStyleFlags (const int newFlags) throw();
  7218. void setBold (const bool shouldBeBold) throw();
  7219. bool isBold() const throw();
  7220. void setItalic (const bool shouldBeItalic) throw();
  7221. bool isItalic() const throw();
  7222. void setUnderline (const bool shouldBeUnderlined) throw();
  7223. bool isUnderlined() const throw();
  7224. void setHorizontalScale (const float scaleFactor) throw();
  7225. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7226. void setExtraKerningFactor (const float extraKerning) throw();
  7227. float getExtraKerningFactor() const throw() { return font->kerning; }
  7228. void setSizeAndStyle (float newHeight,
  7229. const int newStyleFlags,
  7230. const float newHorizontalScale,
  7231. const float newKerningAmount) throw();
  7232. int getStringWidth (const String& text) const throw();
  7233. float getStringWidthFloat (const String& text) const throw();
  7234. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7235. Typeface* getTypeface() const throw();
  7236. static void findFonts (OwnedArray<Font>& results) throw();
  7237. static const StringArray findAllTypefaceNames() throw();
  7238. static const String getFallbackFontName() throw();
  7239. static void setFallbackFontName (const String& name) throw();
  7240. juce_UseDebuggingNewOperator
  7241. private:
  7242. friend class FontGlyphAlphaMap;
  7243. friend class TypefaceCache;
  7244. class SharedFontInternal : public ReferenceCountedObject
  7245. {
  7246. public:
  7247. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7248. const float kerning, const float ascent, const int styleFlags,
  7249. Typeface* const typeface) throw();
  7250. SharedFontInternal (const SharedFontInternal& other) throw();
  7251. String typefaceName;
  7252. float height, horizontalScale, kerning, ascent;
  7253. int styleFlags;
  7254. Typeface::Ptr typeface;
  7255. };
  7256. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7257. void dupeInternalIfShared() throw();
  7258. };
  7259. #endif // __JUCE_FONT_JUCEHEADER__
  7260. /********* End of inlined file: juce_Font.h *********/
  7261. /********* Start of inlined file: juce_PathStrokeType.h *********/
  7262. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7263. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7264. class JUCE_API PathStrokeType
  7265. {
  7266. public:
  7267. enum JointStyle
  7268. {
  7269. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7270. Note that for angles that curve back on themselves, drawing a
  7271. mitre could require extending the point too far away from the
  7272. path, so a mitre limit is imposed and any corners that exceed it
  7273. are drawn as bevelled instead. */
  7274. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7275. beveled /**< Indicates that corners should be drawn with a line flattening their
  7276. outside edge. */
  7277. };
  7278. enum EndCapStyle
  7279. {
  7280. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7281. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7282. the thickness of the stroke. */
  7283. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7284. };
  7285. PathStrokeType (const float strokeThickness,
  7286. const JointStyle jointStyle = mitered,
  7287. const EndCapStyle endStyle = butt) throw();
  7288. PathStrokeType (const PathStrokeType& other) throw();
  7289. const PathStrokeType& operator= (const PathStrokeType& other) throw();
  7290. ~PathStrokeType() throw();
  7291. void createStrokedPath (Path& destPath,
  7292. const Path& sourcePath,
  7293. const AffineTransform& transform = AffineTransform::identity,
  7294. const float extraAccuracy = 1.0f) const throw();
  7295. void createDashedStroke (Path& destPath,
  7296. const Path& sourcePath,
  7297. const float* dashLengths,
  7298. int numDashLengths,
  7299. const AffineTransform& transform = AffineTransform::identity,
  7300. const float extraAccuracy = 1.0f) const throw();
  7301. float getStrokeThickness() const throw() { return thickness; }
  7302. JointStyle getJointStyle() const throw() { return jointStyle; }
  7303. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7304. juce_UseDebuggingNewOperator
  7305. bool operator== (const PathStrokeType& other) const throw();
  7306. bool operator!= (const PathStrokeType& other) const throw();
  7307. private:
  7308. float thickness;
  7309. JointStyle jointStyle;
  7310. EndCapStyle endStyle;
  7311. };
  7312. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7313. /********* End of inlined file: juce_PathStrokeType.h *********/
  7314. /********* Start of inlined file: juce_Line.h *********/
  7315. #ifndef __JUCE_LINE_JUCEHEADER__
  7316. #define __JUCE_LINE_JUCEHEADER__
  7317. class JUCE_API Line
  7318. {
  7319. public:
  7320. Line() throw();
  7321. Line (const Line& other) throw();
  7322. Line (const float startX,
  7323. const float startY,
  7324. const float endX,
  7325. const float endY) throw();
  7326. Line (const Point& start,
  7327. const Point& end) throw();
  7328. const Line& operator= (const Line& other) throw();
  7329. ~Line() throw();
  7330. inline float getStartX() const throw() { return startX; }
  7331. inline float getStartY() const throw() { return startY; }
  7332. inline float getEndX() const throw() { return endX; }
  7333. inline float getEndY() const throw() { return endY; }
  7334. const Point getStart() const throw();
  7335. const Point getEnd() const throw();
  7336. void setStart (const float newStartX,
  7337. const float newStartY) throw();
  7338. void setEnd (const float newEndX,
  7339. const float newEndY) throw();
  7340. void setStart (const Point& newStart) throw();
  7341. void setEnd (const Point& newEnd) throw();
  7342. void applyTransform (const AffineTransform& transform) throw();
  7343. float getLength() const throw();
  7344. bool isVertical() const throw();
  7345. bool isHorizontal() const throw();
  7346. float getAngle() const throw();
  7347. bool operator== (const Line& other) const throw();
  7348. bool operator!= (const Line& other) const throw();
  7349. bool intersects (const Line& line,
  7350. float& intersectionX,
  7351. float& intersectionY) const throw();
  7352. const Point getPointAlongLine (const float distanceFromStart) const throw();
  7353. const Point getPointAlongLine (const float distanceFromStart,
  7354. const float perpendicularDistance) const throw();
  7355. const Point getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7356. float getDistanceFromLine (const float x,
  7357. const float y) const throw();
  7358. float findNearestPointTo (const float x,
  7359. const float y) const throw();
  7360. bool isPointAbove (const float x, const float y) const throw();
  7361. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7362. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7363. bool clipToPath (const Path& path,
  7364. const bool keepSectionOutsidePath) throw();
  7365. juce_UseDebuggingNewOperator
  7366. private:
  7367. float startX, startY, endX, endY;
  7368. };
  7369. #endif // __JUCE_LINE_JUCEHEADER__
  7370. /********* End of inlined file: juce_Line.h *********/
  7371. /********* Start of inlined file: juce_Colours.h *********/
  7372. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7373. #define __JUCE_COLOURS_JUCEHEADER__
  7374. /********* Start of inlined file: juce_Colour.h *********/
  7375. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7376. #define __JUCE_COLOUR_JUCEHEADER__
  7377. /********* Start of inlined file: juce_PixelFormats.h *********/
  7378. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7379. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7380. #if JUCE_MSVC
  7381. #pragma pack (push, 1)
  7382. #define PACKED
  7383. #elif JUCE_GCC
  7384. #define PACKED __attribute__((packed))
  7385. #else
  7386. #define PACKED
  7387. #endif
  7388. class PixelRGB;
  7389. class PixelAlpha;
  7390. class JUCE_API PixelARGB
  7391. {
  7392. public:
  7393. PixelARGB() throw() {}
  7394. ~PixelARGB() throw() {}
  7395. PixelARGB (const uint32 argb_) throw()
  7396. : argb (argb_)
  7397. {
  7398. }
  7399. forcedinline uint32 getARGB() const throw() { return argb; }
  7400. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7401. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7402. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7403. forcedinline uint8 getRed() const throw() { return components.r; }
  7404. forcedinline uint8 getGreen() const throw() { return components.g; }
  7405. forcedinline uint8 getBlue() const throw() { return components.b; }
  7406. forcedinline void blend (const PixelARGB& src) throw()
  7407. {
  7408. uint32 sargb = src.getARGB();
  7409. const uint32 alpha = 0x100 - (sargb >> 24);
  7410. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7411. sargb += 0xff00ff00 & (getAG() * alpha);
  7412. argb = sargb;
  7413. }
  7414. forcedinline void blend (const PixelAlpha& src) throw();
  7415. forcedinline void blend (const PixelRGB& src) throw();
  7416. template <class Pixel>
  7417. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7418. {
  7419. ++extraAlpha;
  7420. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7421. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7422. const uint32 alpha = 0x100 - (sargb >> 24);
  7423. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7424. sargb += 0xff00ff00 & (getAG() * alpha);
  7425. argb = sargb;
  7426. }
  7427. template <class Pixel>
  7428. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7429. {
  7430. uint32 drb = getRB();
  7431. drb += (((src.getRB() - drb) * amount) >> 8);
  7432. drb &= 0x00ff00ff;
  7433. uint32 dag = getAG();
  7434. dag += (((src.getAG() - dag) * amount) >> 8);
  7435. dag &= 0x00ff00ff;
  7436. dag <<= 8;
  7437. dag |= drb;
  7438. argb = dag;
  7439. }
  7440. template <class Pixel>
  7441. forcedinline void set (const Pixel& src) throw()
  7442. {
  7443. argb = src.getARGB();
  7444. }
  7445. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7446. {
  7447. components.a = newAlpha;
  7448. }
  7449. forcedinline void multiplyAlpha (int multiplier) throw()
  7450. {
  7451. ++multiplier;
  7452. argb = ((multiplier * getAG()) & 0xff00ff00)
  7453. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7454. }
  7455. forcedinline void multiplyAlpha (const float multiplier) throw()
  7456. {
  7457. multiplyAlpha ((int) (multiplier * 256.0f));
  7458. }
  7459. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7460. {
  7461. components.b = b;
  7462. components.g = g;
  7463. components.r = r;
  7464. components.a = a;
  7465. }
  7466. forcedinline void premultiply() throw()
  7467. {
  7468. const uint32 alpha = components.a;
  7469. if (alpha < 0xff)
  7470. {
  7471. if (alpha == 0)
  7472. {
  7473. components.b = 0;
  7474. components.g = 0;
  7475. components.r = 0;
  7476. }
  7477. else
  7478. {
  7479. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7480. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7481. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7482. }
  7483. }
  7484. }
  7485. forcedinline void unpremultiply() throw()
  7486. {
  7487. const uint32 alpha = components.a;
  7488. if (alpha < 0xff)
  7489. {
  7490. if (alpha == 0)
  7491. {
  7492. components.b = 0;
  7493. components.g = 0;
  7494. components.r = 0;
  7495. }
  7496. else
  7497. {
  7498. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7499. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7500. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7501. }
  7502. }
  7503. }
  7504. forcedinline void desaturate() throw()
  7505. {
  7506. if (components.a < 0xff && components.a > 0)
  7507. {
  7508. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7509. components.r = components.g = components.b
  7510. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7511. }
  7512. else
  7513. {
  7514. components.r = components.g = components.b
  7515. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7516. }
  7517. }
  7518. #if JUCE_BIG_ENDIAN
  7519. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7520. #else
  7521. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7522. #endif
  7523. private:
  7524. union
  7525. {
  7526. uint32 argb;
  7527. struct
  7528. {
  7529. #if JUCE_BIG_ENDIAN
  7530. uint8 a : 8, r : 8, g : 8, b : 8;
  7531. #else
  7532. uint8 b, g, r, a;
  7533. #endif
  7534. } PACKED components;
  7535. };
  7536. } PACKED;
  7537. class JUCE_API PixelRGB
  7538. {
  7539. public:
  7540. PixelRGB() throw() {}
  7541. ~PixelRGB() throw() {}
  7542. PixelRGB (const uint32 argb) throw()
  7543. {
  7544. r = (uint8) (argb >> 16);
  7545. g = (uint8) (argb >> 8);
  7546. b = (uint8) (argb);
  7547. }
  7548. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7549. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7550. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7551. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7552. forcedinline uint8 getRed() const throw() { return r; }
  7553. forcedinline uint8 getGreen() const throw() { return g; }
  7554. forcedinline uint8 getBlue() const throw() { return b; }
  7555. forcedinline void blend (const PixelARGB& src) throw()
  7556. {
  7557. uint32 sargb = src.getARGB();
  7558. const uint32 alpha = 0x100 - (sargb >> 24);
  7559. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7560. sargb += 0x0000ff00 & (g * alpha);
  7561. r = (uint8) (sargb >> 16);
  7562. g = (uint8) (sargb >> 8);
  7563. b = (uint8) sargb;
  7564. }
  7565. forcedinline void blend (const PixelRGB& src) throw()
  7566. {
  7567. set (src);
  7568. }
  7569. forcedinline void blend (const PixelAlpha& src) throw();
  7570. template <class Pixel>
  7571. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7572. {
  7573. ++extraAlpha;
  7574. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7575. const uint32 sag = extraAlpha * src.getAG();
  7576. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7577. const uint32 alpha = 0x100 - (sargb >> 24);
  7578. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7579. sargb += 0x0000ff00 & (g * alpha);
  7580. b = (uint8) sargb;
  7581. g = (uint8) (sargb >> 8);
  7582. r = (uint8) (sargb >> 16);
  7583. }
  7584. template <class Pixel>
  7585. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7586. {
  7587. uint32 drb = getRB();
  7588. drb += (((src.getRB() - drb) * amount) >> 8);
  7589. uint32 dag = getAG();
  7590. dag += (((src.getAG() - dag) * amount) >> 8);
  7591. b = (uint8) drb;
  7592. g = (uint8) dag;
  7593. r = (uint8) (drb >> 16);
  7594. }
  7595. template <class Pixel>
  7596. forcedinline void set (const Pixel& src) throw()
  7597. {
  7598. b = src.getBlue();
  7599. g = src.getGreen();
  7600. r = src.getRed();
  7601. }
  7602. forcedinline void setAlpha (const uint8) throw() {}
  7603. forcedinline void multiplyAlpha (int) throw() {}
  7604. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7605. {
  7606. r = r_;
  7607. g = g_;
  7608. b = b_;
  7609. }
  7610. forcedinline void premultiply() throw() {}
  7611. forcedinline void unpremultiply() throw() {}
  7612. forcedinline void desaturate() throw()
  7613. {
  7614. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7615. }
  7616. #if JUCE_MAC
  7617. enum { indexR = 0, indexG = 1, indexB = 2 };
  7618. #else
  7619. enum { indexR = 2, indexG = 1, indexB = 0 };
  7620. #endif
  7621. private:
  7622. #if JUCE_MAC
  7623. uint8 r, g, b;
  7624. #else
  7625. uint8 b, g, r;
  7626. #endif
  7627. } PACKED;
  7628. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7629. {
  7630. set (src);
  7631. }
  7632. class JUCE_API PixelAlpha
  7633. {
  7634. public:
  7635. PixelAlpha() throw() {}
  7636. ~PixelAlpha() throw() {}
  7637. PixelAlpha (const uint32 argb) throw()
  7638. {
  7639. a = (uint8) (argb >> 24);
  7640. }
  7641. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7642. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7643. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7644. forcedinline uint8 getAlpha() const throw() { return a; }
  7645. forcedinline uint8 getRed() const throw() { return 0; }
  7646. forcedinline uint8 getGreen() const throw() { return 0; }
  7647. forcedinline uint8 getBlue() const throw() { return 0; }
  7648. template <class Pixel>
  7649. forcedinline void blend (const Pixel& src) throw()
  7650. {
  7651. const int srcA = src.getAlpha();
  7652. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7653. }
  7654. template <class Pixel>
  7655. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7656. {
  7657. ++extraAlpha;
  7658. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  7659. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  7660. }
  7661. template <class Pixel>
  7662. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7663. {
  7664. a += ((src,getAlpha() - a) * amount) >> 8;
  7665. }
  7666. template <class Pixel>
  7667. forcedinline void set (const Pixel& src) throw()
  7668. {
  7669. a = src.getAlpha();
  7670. }
  7671. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7672. {
  7673. a = newAlpha;
  7674. }
  7675. forcedinline void multiplyAlpha (int multiplier) throw()
  7676. {
  7677. ++multiplier;
  7678. a = (uint8) ((a * multiplier) >> 8);
  7679. }
  7680. forcedinline void multiplyAlpha (const float multiplier) throw()
  7681. {
  7682. a = (uint8) (a * multiplier);
  7683. }
  7684. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  7685. {
  7686. a = a_;
  7687. }
  7688. forcedinline void premultiply() throw()
  7689. {
  7690. }
  7691. forcedinline void unpremultiply() throw()
  7692. {
  7693. }
  7694. forcedinline void desaturate() throw()
  7695. {
  7696. }
  7697. private:
  7698. uint8 a : 8;
  7699. } PACKED;
  7700. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  7701. {
  7702. blend (PixelARGB (src.getARGB()));
  7703. }
  7704. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  7705. {
  7706. uint32 sargb = src.getARGB();
  7707. const uint32 alpha = 0x100 - (sargb >> 24);
  7708. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7709. sargb += 0xff00ff00 & (getAG() * alpha);
  7710. argb = sargb;
  7711. }
  7712. #if JUCE_MSVC
  7713. #pragma pack (pop)
  7714. #endif
  7715. #undef PACKED
  7716. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  7717. /********* End of inlined file: juce_PixelFormats.h *********/
  7718. class JUCE_API Colour
  7719. {
  7720. public:
  7721. Colour() throw();
  7722. Colour (const Colour& other) throw();
  7723. explicit Colour (const uint32 argb) throw();
  7724. Colour (const uint8 red,
  7725. const uint8 green,
  7726. const uint8 blue) throw();
  7727. static const Colour fromRGB (const uint8 red,
  7728. const uint8 green,
  7729. const uint8 blue) throw();
  7730. Colour (const uint8 red,
  7731. const uint8 green,
  7732. const uint8 blue,
  7733. const uint8 alpha) throw();
  7734. static const Colour fromRGBA (const uint8 red,
  7735. const uint8 green,
  7736. const uint8 blue,
  7737. const uint8 alpha) throw();
  7738. Colour (const uint8 red,
  7739. const uint8 green,
  7740. const uint8 blue,
  7741. const float alpha) throw();
  7742. static const Colour fromRGBAFloat (const uint8 red,
  7743. const uint8 green,
  7744. const uint8 blue,
  7745. const float alpha) throw();
  7746. Colour (const float hue,
  7747. const float saturation,
  7748. const float brightness,
  7749. const uint8 alpha) throw();
  7750. Colour (const float hue,
  7751. const float saturation,
  7752. const float brightness,
  7753. const float alpha) throw();
  7754. static const Colour fromHSV (const float hue,
  7755. const float saturation,
  7756. const float brightness,
  7757. const float alpha) throw();
  7758. ~Colour() throw();
  7759. const Colour& operator= (const Colour& other) throw();
  7760. bool operator== (const Colour& other) const throw();
  7761. bool operator!= (const Colour& other) const throw();
  7762. uint8 getRed() const throw() { return argb.getRed(); }
  7763. uint8 getGreen() const throw() { return argb.getGreen(); }
  7764. uint8 getBlue() const throw() { return argb.getBlue(); }
  7765. float getFloatRed() const throw();
  7766. float getFloatGreen() const throw();
  7767. float getFloatBlue() const throw();
  7768. const PixelARGB getPixelARGB() const throw();
  7769. uint32 getARGB() const throw();
  7770. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  7771. float getFloatAlpha() const throw();
  7772. bool isOpaque() const throw();
  7773. bool isTransparent() const throw();
  7774. const Colour withAlpha (const uint8 newAlpha) const throw();
  7775. const Colour withAlpha (const float newAlpha) const throw();
  7776. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  7777. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  7778. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  7779. float getHue() const throw();
  7780. float getSaturation() const throw();
  7781. float getBrightness() const throw();
  7782. void getHSB (float& hue,
  7783. float& saturation,
  7784. float& brightness) const throw();
  7785. const Colour withHue (const float newHue) const throw();
  7786. const Colour withSaturation (const float newSaturation) const throw();
  7787. const Colour withBrightness (const float newBrightness) const throw();
  7788. const Colour withRotatedHue (const float amountToRotate) const throw();
  7789. const Colour withMultipliedSaturation (const float multiplier) const throw();
  7790. const Colour withMultipliedBrightness (const float amount) const throw();
  7791. const Colour brighter (float amountBrighter = 0.4f) const throw();
  7792. const Colour darker (float amountDarker = 0.4f) const throw();
  7793. const Colour contrasting (const float amount = 1.0f) const throw();
  7794. static const Colour contrasting (const Colour& colour1,
  7795. const Colour& colour2) throw();
  7796. static const Colour greyLevel (const float brightness) throw();
  7797. const String toString() const throw();
  7798. static const Colour fromString (const String& encodedColourString);
  7799. juce_UseDebuggingNewOperator
  7800. private:
  7801. PixelARGB argb;
  7802. };
  7803. #endif // __JUCE_COLOUR_JUCEHEADER__
  7804. /********* End of inlined file: juce_Colour.h *********/
  7805. class Colours
  7806. {
  7807. public:
  7808. static JUCE_API const Colour
  7809. transparentBlack, /**< ARGB = 0x00000000 */
  7810. transparentWhite, /**< ARGB = 0x00ffffff */
  7811. black, /**< ARGB = 0xff000000 */
  7812. white, /**< ARGB = 0xffffffff */
  7813. blue, /**< ARGB = 0xff0000ff */
  7814. grey, /**< ARGB = 0xff808080 */
  7815. green, /**< ARGB = 0xff008000 */
  7816. red, /**< ARGB = 0xffff0000 */
  7817. yellow, /**< ARGB = 0xffffff00 */
  7818. aliceblue, antiquewhite, aqua, aquamarine,
  7819. azure, beige, bisque, blanchedalmond,
  7820. blueviolet, brown, burlywood, cadetblue,
  7821. chartreuse, chocolate, coral, cornflowerblue,
  7822. cornsilk, crimson, cyan, darkblue,
  7823. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  7824. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  7825. darkorchid, darkred, darksalmon, darkseagreen,
  7826. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  7827. deeppink, deepskyblue, dimgrey, dodgerblue,
  7828. firebrick, floralwhite, forestgreen, fuchsia,
  7829. gainsboro, gold, goldenrod, greenyellow,
  7830. honeydew, hotpink, indianred, indigo,
  7831. ivory, khaki, lavender, lavenderblush,
  7832. lemonchiffon, lightblue, lightcoral, lightcyan,
  7833. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  7834. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  7835. lightsteelblue, lightyellow, lime, limegreen,
  7836. linen, magenta, maroon, mediumaquamarine,
  7837. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  7838. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  7839. midnightblue, mintcream, mistyrose, navajowhite,
  7840. navy, oldlace, olive, olivedrab,
  7841. orange, orangered, orchid, palegoldenrod,
  7842. palegreen, paleturquoise, palevioletred, papayawhip,
  7843. peachpuff, peru, pink, plum,
  7844. powderblue, purple, rosybrown, royalblue,
  7845. saddlebrown, salmon, sandybrown, seagreen,
  7846. seashell, sienna, silver, skyblue,
  7847. slateblue, slategrey, snow, springgreen,
  7848. steelblue, tan, teal, thistle,
  7849. tomato, turquoise, violet, wheat,
  7850. whitesmoke, yellowgreen;
  7851. static JUCE_API const Colour findColourForName (const String& colourName,
  7852. const Colour& defaultColour);
  7853. private:
  7854. // this isn't a class you should ever instantiate - it's just here for the
  7855. // static values in it.
  7856. Colours();
  7857. };
  7858. #endif // __JUCE_COLOURS_JUCEHEADER__
  7859. /********* End of inlined file: juce_Colours.h *********/
  7860. /********* Start of inlined file: juce_FillType.h *********/
  7861. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  7862. #define __JUCE_FILLTYPE_JUCEHEADER__
  7863. /********* Start of inlined file: juce_ColourGradient.h *********/
  7864. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  7865. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  7866. class JUCE_API ColourGradient
  7867. {
  7868. public:
  7869. ColourGradient (const Colour& colour1,
  7870. const float x1,
  7871. const float y1,
  7872. const Colour& colour2,
  7873. const float x2,
  7874. const float y2,
  7875. const bool isRadial) throw();
  7876. ColourGradient() throw();
  7877. ~ColourGradient() throw();
  7878. void clearColours() throw();
  7879. void addColour (const double proportionAlongGradient,
  7880. const Colour& colour) throw();
  7881. void multiplyOpacity (const float multiplier) throw();
  7882. int getNumColours() const throw();
  7883. double getColourPosition (const int index) const throw();
  7884. const Colour getColour (const int index) const throw();
  7885. const Colour getColourAtPosition (const float position) const throw();
  7886. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  7887. bool isOpaque() const throw();
  7888. bool isInvisible() const throw();
  7889. float x1;
  7890. float y1;
  7891. float x2;
  7892. float y2;
  7893. bool isRadial;
  7894. juce_UseDebuggingNewOperator
  7895. private:
  7896. Array <uint32> colours;
  7897. };
  7898. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  7899. /********* End of inlined file: juce_ColourGradient.h *********/
  7900. class Image;
  7901. class JUCE_API FillType
  7902. {
  7903. public:
  7904. FillType() throw();
  7905. FillType (const Colour& colour) throw();
  7906. FillType (const ColourGradient& gradient) throw();
  7907. FillType (const Image& image, const AffineTransform& transform) throw();
  7908. FillType (const FillType& other) throw();
  7909. const FillType& operator= (const FillType& other) throw();
  7910. ~FillType() throw();
  7911. bool isColour() const throw() { return gradient == 0 && image == 0; }
  7912. bool isGradient() const throw() { return gradient != 0; }
  7913. bool isTiledImage() const throw() { return image != 0; }
  7914. void setColour (const Colour& newColour) throw();
  7915. void setGradient (const ColourGradient& newGradient) throw();
  7916. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  7917. void setOpacity (const float newOpacity) throw();
  7918. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  7919. Colour colour;
  7920. ScopedPointer <ColourGradient> gradient;
  7921. const Image* image;
  7922. AffineTransform transform;
  7923. juce_UseDebuggingNewOperator
  7924. };
  7925. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  7926. /********* End of inlined file: juce_FillType.h *********/
  7927. /********* Start of inlined file: juce_RectanglePlacement.h *********/
  7928. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7929. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7930. class JUCE_API RectanglePlacement
  7931. {
  7932. public:
  7933. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  7934. RectanglePlacement (const RectanglePlacement& other) throw();
  7935. const RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  7936. enum
  7937. {
  7938. xLeft = 1,
  7939. xRight = 2,
  7940. xMid = 4,
  7941. yTop = 8,
  7942. yBottom = 16,
  7943. yMid = 32,
  7944. stretchToFit = 64,
  7945. fillDestination = 128,
  7946. onlyReduceInSize = 256,
  7947. onlyIncreaseInSize = 512,
  7948. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  7949. centred = 4 + 32
  7950. };
  7951. inline int getFlags() const throw() { return flags; }
  7952. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7953. void applyTo (double& sourceX,
  7954. double& sourceY,
  7955. double& sourceW,
  7956. double& sourceH,
  7957. const double destinationX,
  7958. const double destinationY,
  7959. const double destinationW,
  7960. const double destinationH) const throw();
  7961. const AffineTransform getTransformToFit (float sourceX,
  7962. float sourceY,
  7963. float sourceW,
  7964. float sourceH,
  7965. const float destinationX,
  7966. const float destinationY,
  7967. const float destinationW,
  7968. const float destinationH) const throw();
  7969. private:
  7970. int flags;
  7971. };
  7972. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  7973. /********* End of inlined file: juce_RectanglePlacement.h *********/
  7974. class LowLevelGraphicsContext;
  7975. class Image;
  7976. class RectangleList;
  7977. class JUCE_API Graphics
  7978. {
  7979. public:
  7980. Graphics (Image& imageToDrawOnto) throw();
  7981. ~Graphics() throw();
  7982. void setColour (const Colour& newColour) throw();
  7983. void setOpacity (const float newOpacity) throw();
  7984. void setGradientFill (const ColourGradient& gradient) throw();
  7985. void setTiledImageFill (const Image& imageToUse,
  7986. const int anchorX,
  7987. const int anchorY,
  7988. const float opacity) throw();
  7989. void setFillType (const FillType& newFill) throw();
  7990. void setFont (const Font& newFont) throw();
  7991. void setFont (const float newFontHeight,
  7992. const int fontStyleFlags = Font::plain) throw();
  7993. void drawSingleLineText (const String& text,
  7994. const int startX,
  7995. const int baselineY) const throw();
  7996. void drawMultiLineText (const String& text,
  7997. const int startX,
  7998. const int baselineY,
  7999. const int maximumLineWidth) const throw();
  8000. void drawTextAsPath (const String& text,
  8001. const AffineTransform& transform) const throw();
  8002. void drawText (const String& text,
  8003. const int x,
  8004. const int y,
  8005. const int width,
  8006. const int height,
  8007. const Justification& justificationType,
  8008. const bool useEllipsesIfTooBig) const throw();
  8009. void drawFittedText (const String& text,
  8010. const int x,
  8011. const int y,
  8012. const int width,
  8013. const int height,
  8014. const Justification& justificationFlags,
  8015. const int maximumNumberOfLines,
  8016. const float minimumHorizontalScale = 0.7f) const throw();
  8017. void fillAll() const throw();
  8018. void fillAll (const Colour& colourToUse) const throw();
  8019. void fillRect (int x,
  8020. int y,
  8021. int width,
  8022. int height) const throw();
  8023. void fillRect (const Rectangle& rectangle) const throw();
  8024. void fillRect (const float x,
  8025. const float y,
  8026. const float width,
  8027. const float height) const throw();
  8028. void fillRoundedRectangle (const float x,
  8029. const float y,
  8030. const float width,
  8031. const float height,
  8032. const float cornerSize) const throw();
  8033. void fillRoundedRectangle (const Rectangle& rectangle,
  8034. const float cornerSize) const throw();
  8035. void fillCheckerBoard (int x, int y,
  8036. int width, int height,
  8037. const int checkWidth,
  8038. const int checkHeight,
  8039. const Colour& colour1,
  8040. const Colour& colour2) const throw();
  8041. void drawRect (const int x,
  8042. const int y,
  8043. const int width,
  8044. const int height,
  8045. const int lineThickness = 1) const throw();
  8046. void drawRect (const float x,
  8047. const float y,
  8048. const float width,
  8049. const float height,
  8050. const float lineThickness = 1.0f) const throw();
  8051. void drawRect (const Rectangle& rectangle,
  8052. const int lineThickness = 1) const throw();
  8053. void drawRoundedRectangle (const float x,
  8054. const float y,
  8055. const float width,
  8056. const float height,
  8057. const float cornerSize,
  8058. const float lineThickness) const throw();
  8059. void drawRoundedRectangle (const Rectangle& rectangle,
  8060. const float cornerSize,
  8061. const float lineThickness) const throw();
  8062. void drawBevel (const int x,
  8063. const int y,
  8064. const int width,
  8065. const int height,
  8066. const int bevelThickness,
  8067. const Colour& topLeftColour = Colours::white,
  8068. const Colour& bottomRightColour = Colours::black,
  8069. const bool useGradient = true,
  8070. const bool sharpEdgeOnOutside = true) const throw();
  8071. void setPixel (int x, int y) const throw();
  8072. void fillEllipse (const float x,
  8073. const float y,
  8074. const float width,
  8075. const float height) const throw();
  8076. void drawEllipse (const float x,
  8077. const float y,
  8078. const float width,
  8079. const float height,
  8080. const float lineThickness) const throw();
  8081. void drawLine (float startX,
  8082. float startY,
  8083. float endX,
  8084. float endY) const throw();
  8085. void drawLine (const float startX,
  8086. const float startY,
  8087. const float endX,
  8088. const float endY,
  8089. const float lineThickness) const throw();
  8090. void drawLine (const Line& line) const throw();
  8091. void drawLine (const Line& line,
  8092. const float lineThickness) const throw();
  8093. void drawDashedLine (const float startX,
  8094. const float startY,
  8095. const float endX,
  8096. const float endY,
  8097. const float* const dashLengths,
  8098. const int numDashLengths,
  8099. const float lineThickness = 1.0f) const throw();
  8100. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8101. void drawHorizontalLine (const int y, float left, float right) const throw();
  8102. void fillPath (const Path& path,
  8103. const AffineTransform& transform = AffineTransform::identity) const throw();
  8104. void strokePath (const Path& path,
  8105. const PathStrokeType& strokeType,
  8106. const AffineTransform& transform = AffineTransform::identity) const throw();
  8107. void drawArrow (const float startX,
  8108. const float startY,
  8109. const float endX,
  8110. const float endY,
  8111. const float lineThickness,
  8112. const float arrowheadWidth,
  8113. const float arrowheadLength) const throw();
  8114. enum ResamplingQuality
  8115. {
  8116. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8117. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8118. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8119. };
  8120. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8121. void drawImageAt (const Image* const imageToDraw,
  8122. const int topLeftX,
  8123. const int topLeftY,
  8124. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8125. void drawImage (const Image* const imageToDraw,
  8126. int destX,
  8127. int destY,
  8128. int destWidth,
  8129. int destHeight,
  8130. int sourceX,
  8131. int sourceY,
  8132. int sourceWidth,
  8133. int sourceHeight,
  8134. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8135. void drawImageTransformed (const Image* const imageToDraw,
  8136. const Rectangle& imageSubRegion,
  8137. const AffineTransform& transform,
  8138. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8139. void drawImageWithin (const Image* const imageToDraw,
  8140. const int destX,
  8141. const int destY,
  8142. const int destWidth,
  8143. const int destHeight,
  8144. const RectanglePlacement& placementWithinTarget,
  8145. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8146. const Rectangle getClipBounds() const throw();
  8147. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8148. bool reduceClipRegion (const int x, const int y,
  8149. const int width, const int height) throw();
  8150. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8151. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8152. bool reduceClipRegion (const Image& image, const Rectangle& sourceClipRegion,
  8153. const AffineTransform& transform) throw();
  8154. void excludeClipRegion (const int x, const int y,
  8155. const int width, const int height) throw();
  8156. bool isClipEmpty() const throw();
  8157. void saveState() throw();
  8158. void restoreState() throw();
  8159. void setOrigin (const int newOriginX,
  8160. const int newOriginY) throw();
  8161. void resetToDefaultState() throw();
  8162. bool isVectorDevice() const throw();
  8163. juce_UseDebuggingNewOperator
  8164. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8165. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8166. private:
  8167. LowLevelGraphicsContext* const context;
  8168. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8169. bool saveStatePending;
  8170. void saveStateIfPending() throw();
  8171. const Graphics& operator= (const Graphics& other);
  8172. Graphics (const Graphics&);
  8173. };
  8174. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8175. /********* End of inlined file: juce_Graphics.h *********/
  8176. class JUCE_API ImageEffectFilter
  8177. {
  8178. public:
  8179. virtual void applyEffect (Image& sourceImage,
  8180. Graphics& destContext) = 0;
  8181. virtual ~ImageEffectFilter() {}
  8182. };
  8183. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8184. /********* End of inlined file: juce_ImageEffectFilter.h *********/
  8185. /********* Start of inlined file: juce_RectangleList.h *********/
  8186. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8187. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8188. class JUCE_API RectangleList
  8189. {
  8190. public:
  8191. RectangleList() throw();
  8192. RectangleList (const RectangleList& other) throw();
  8193. RectangleList (const Rectangle& rect) throw();
  8194. const RectangleList& operator= (const RectangleList& other) throw();
  8195. ~RectangleList() throw();
  8196. bool isEmpty() const throw();
  8197. int getNumRectangles() const throw() { return rects.size(); }
  8198. const Rectangle getRectangle (const int index) const throw();
  8199. void clear() throw();
  8200. void add (const int x, const int y,
  8201. const int w, const int h) throw();
  8202. void add (const Rectangle& rect) throw();
  8203. void addWithoutMerging (const Rectangle& rect) throw();
  8204. void add (const RectangleList& other) throw();
  8205. void subtract (const Rectangle& rect) throw();
  8206. void subtract (const RectangleList& otherList) throw();
  8207. bool clipTo (const Rectangle& rect) throw();
  8208. bool clipTo (const RectangleList& other) throw();
  8209. bool getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const throw();
  8210. void swapWith (RectangleList& otherList) throw();
  8211. bool containsPoint (const int x, const int y) const throw();
  8212. bool containsRectangle (const Rectangle& rectangleToCheck) const throw();
  8213. bool intersectsRectangle (const Rectangle& rectangleToCheck) const throw();
  8214. bool intersects (const RectangleList& other) const throw();
  8215. const Rectangle getBounds() const throw();
  8216. void consolidate() throw();
  8217. void offsetAll (const int dx, const int dy) throw();
  8218. const Path toPath() const throw();
  8219. class Iterator
  8220. {
  8221. public:
  8222. Iterator (const RectangleList& list) throw();
  8223. ~Iterator() throw();
  8224. bool next() throw();
  8225. const Rectangle* getRectangle() const throw() { return current; }
  8226. juce_UseDebuggingNewOperator
  8227. private:
  8228. const Rectangle* current;
  8229. const RectangleList& owner;
  8230. int index;
  8231. Iterator (const Iterator&);
  8232. const Iterator& operator= (const Iterator&);
  8233. };
  8234. juce_UseDebuggingNewOperator
  8235. private:
  8236. friend class Iterator;
  8237. Array <Rectangle> rects;
  8238. };
  8239. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8240. /********* End of inlined file: juce_RectangleList.h *********/
  8241. /********* Start of inlined file: juce_BorderSize.h *********/
  8242. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8243. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8244. class JUCE_API BorderSize
  8245. {
  8246. public:
  8247. BorderSize() throw();
  8248. BorderSize (const BorderSize& other) throw();
  8249. BorderSize (const int topGap,
  8250. const int leftGap,
  8251. const int bottomGap,
  8252. const int rightGap) throw();
  8253. BorderSize (const int allGaps) throw();
  8254. ~BorderSize() throw();
  8255. int getTop() const throw() { return top; }
  8256. int getLeft() const throw() { return left; }
  8257. int getBottom() const throw() { return bottom; }
  8258. int getRight() const throw() { return right; }
  8259. int getTopAndBottom() const throw() { return top + bottom; }
  8260. int getLeftAndRight() const throw() { return left + right; }
  8261. void setTop (const int newTopGap) throw();
  8262. void setLeft (const int newLeftGap) throw();
  8263. void setBottom (const int newBottomGap) throw();
  8264. void setRight (const int newRightGap) throw();
  8265. const Rectangle subtractedFrom (const Rectangle& original) const throw();
  8266. void subtractFrom (Rectangle& rectangle) const throw();
  8267. const Rectangle addedTo (const Rectangle& original) const throw();
  8268. void addTo (Rectangle& original) const throw();
  8269. bool operator== (const BorderSize& other) const throw();
  8270. bool operator!= (const BorderSize& other) const throw();
  8271. juce_UseDebuggingNewOperator
  8272. private:
  8273. int top, left, bottom, right;
  8274. };
  8275. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8276. /********* End of inlined file: juce_BorderSize.h *********/
  8277. /********* Start of inlined file: juce_ComponentPeer.h *********/
  8278. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  8279. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  8280. class Component;
  8281. class Graphics;
  8282. class ComponentBoundsConstrainer;
  8283. class ComponentDeletionWatcher;
  8284. class JUCE_API ComponentPeer : public MessageListener
  8285. {
  8286. public:
  8287. enum StyleFlags
  8288. {
  8289. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  8290. entry on the taskbar (ignored on MacOSX) */
  8291. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  8292. tooltip, etc. */
  8293. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  8294. through it (may not be possible on some platforms). */
  8295. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  8296. title bar and frame\. if not specified, the window will be
  8297. borderless. */
  8298. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  8299. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  8300. minimise button on it. */
  8301. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  8302. maximise button on it. */
  8303. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  8304. close button on it. */
  8305. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  8306. not be possible on all platforms). */
  8307. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  8308. do its own repainting, but only to repaint when the
  8309. performAnyPendingRepaintsNow() method is called. */
  8310. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  8311. be used for things like plugin windows, to stop them interfering
  8312. with the host's shortcut keys */
  8313. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  8314. };
  8315. ComponentPeer (Component* const component,
  8316. const int styleFlags) throw();
  8317. virtual ~ComponentPeer();
  8318. Component* getComponent() const throw() { return component; }
  8319. int getStyleFlags() const throw() { return styleFlags; }
  8320. virtual void* getNativeHandle() const = 0;
  8321. virtual void setVisible (bool shouldBeVisible) = 0;
  8322. virtual void setTitle (const String& title) = 0;
  8323. virtual void setPosition (int x, int y) = 0;
  8324. virtual void setSize (int w, int h) = 0;
  8325. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  8326. virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
  8327. virtual int getScreenX() const = 0;
  8328. virtual int getScreenY() const = 0;
  8329. virtual void relativePositionToGlobal (int& x, int& y) = 0;
  8330. virtual void globalPositionToRelative (int& x, int& y) = 0;
  8331. virtual void setMinimised (bool shouldBeMinimised) = 0;
  8332. virtual bool isMinimised() const = 0;
  8333. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  8334. virtual bool isFullScreen() const = 0;
  8335. void setNonFullScreenBounds (const Rectangle& newBounds) throw();
  8336. const Rectangle& getNonFullScreenBounds() const throw();
  8337. virtual void setIcon (const Image& newIcon) = 0;
  8338. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  8339. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  8340. virtual bool contains (int x, int y, bool trueIfInAChildWindow) const = 0;
  8341. virtual const BorderSize getFrameSize() const = 0;
  8342. void handleMovedOrResized();
  8343. void handleScreenSizeChange();
  8344. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  8345. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  8346. virtual void toFront (bool makeActive) = 0;
  8347. virtual void toBehind (ComponentPeer* other) = 0;
  8348. void handleBroughtToFront();
  8349. virtual bool isFocused() const = 0;
  8350. virtual void grabFocus() = 0;
  8351. virtual void textInputRequired (int x, int y) = 0;
  8352. void handleFocusGain();
  8353. void handleFocusLoss();
  8354. Component* getLastFocusedSubcomponent() const throw();
  8355. bool handleKeyPress (const int keyCode,
  8356. const juce_wchar textCharacter);
  8357. bool handleKeyUpOrDown (const bool isKeyDown);
  8358. void handleModifierKeysChange();
  8359. virtual void repaint (int x, int y, int w, int h) = 0;
  8360. virtual void performAnyPendingRepaintsNow() = 0;
  8361. void handleMouseEnter (int x, int y, const int64 time);
  8362. void handleMouseMove (int x, int y, const int64 time);
  8363. void handleMouseDown (int x, int y, const int64 time);
  8364. void handleMouseDrag (int x, int y, const int64 time);
  8365. void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8366. void handleMouseExit (int x, int y, const int64 time);
  8367. void handleMouseWheel (const int amountX, const int amountY, const int64 time);
  8368. void sendFakeMouseMove() throw();
  8369. void handleUserClosingWindow();
  8370. void handleFileDragMove (const StringArray& files, int x, int y);
  8371. void handleFileDragExit (const StringArray& files);
  8372. void handleFileDragDrop (const StringArray& files, int x, int y);
  8373. void clearMaskedRegion() throw();
  8374. void addMaskedRegion (int x, int y, int w, int h) throw();
  8375. static int getNumPeers() throw();
  8376. static ComponentPeer* getPeer (const int index) throw();
  8377. static bool isValidPeer (const ComponentPeer* const peer) throw();
  8378. static void bringModalComponentToFront();
  8379. virtual const StringArray getAvailableRenderingEngines() throw();
  8380. virtual int getCurrentRenderingEngine() throw();
  8381. virtual void setCurrentRenderingEngine (int index) throw();
  8382. juce_UseDebuggingNewOperator
  8383. protected:
  8384. Component* const component;
  8385. const int styleFlags;
  8386. RectangleList maskedRegion;
  8387. Rectangle lastNonFullscreenBounds;
  8388. uint32 lastPaintTime;
  8389. ComponentBoundsConstrainer* constrainer;
  8390. static void updateCurrentModifiers() throw();
  8391. void handleMessage (const Message& message);
  8392. private:
  8393. Component* lastFocusedComponent;
  8394. ScopedPointer <ComponentDeletionWatcher> dragAndDropTargetComponent;
  8395. Component* lastDragAndDropCompUnderMouse;
  8396. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  8397. friend class Component;
  8398. static ComponentPeer* getPeerFor (const Component* const component) throw();
  8399. void setLastDragDropTarget (Component* comp);
  8400. ComponentPeer (const ComponentPeer&);
  8401. const ComponentPeer& operator= (const ComponentPeer&);
  8402. };
  8403. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  8404. /********* End of inlined file: juce_ComponentPeer.h *********/
  8405. class LookAndFeel;
  8406. class JUCE_API Component : public MouseListener,
  8407. protected MessageListener
  8408. {
  8409. public:
  8410. Component() throw();
  8411. virtual ~Component();
  8412. Component (const String& componentName) throw();
  8413. const String& getName() const throw() { return componentName_; }
  8414. virtual void setName (const String& newName);
  8415. bool isValidComponent() const throw();
  8416. virtual void setVisible (bool shouldBeVisible);
  8417. bool isVisible() const throw() { return flags.visibleFlag; }
  8418. virtual void visibilityChanged();
  8419. bool isShowing() const throw();
  8420. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8421. const int deltaXToMove = 0,
  8422. const int deltaYToMove = 0,
  8423. const float scaleFactorAtEnd = 1.0f);
  8424. virtual void addToDesktop (int windowStyleFlags,
  8425. void* nativeWindowToAttachTo = 0);
  8426. void removeFromDesktop();
  8427. bool isOnDesktop() const throw();
  8428. ComponentPeer* getPeer() const throw();
  8429. virtual void userTriedToCloseWindow();
  8430. virtual void minimisationStateChanged (bool isNowMinimised);
  8431. void toFront (const bool shouldAlsoGainFocus);
  8432. void toBack();
  8433. void toBehind (Component* const other);
  8434. void setAlwaysOnTop (const bool shouldStayOnTop);
  8435. bool isAlwaysOnTop() const throw();
  8436. inline int getX() const throw() { return bounds_.getX(); }
  8437. inline int getY() const throw() { return bounds_.getY(); }
  8438. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8439. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8440. int getRight() const throw() { return bounds_.getRight(); }
  8441. int getBottom() const throw() { return bounds_.getBottom(); }
  8442. const Rectangle& getBounds() const throw() { return bounds_; }
  8443. void getVisibleArea (RectangleList& result,
  8444. const bool includeSiblings) const;
  8445. int getScreenX() const throw();
  8446. int getScreenY() const throw();
  8447. void relativePositionToGlobal (int& x, int& y) const throw();
  8448. void globalPositionToRelative (int& x, int& y) const throw();
  8449. void relativePositionToOtherComponent (const Component* const targetComponent,
  8450. int& x, int& y) const throw();
  8451. void setTopLeftPosition (const int x, const int y);
  8452. void setTopRightPosition (const int x, const int y);
  8453. void setSize (const int newWidth, const int newHeight);
  8454. void setBounds (int x, int y, int width, int height);
  8455. void setBounds (const Rectangle& newBounds);
  8456. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8457. const float proportionalWidth, const float proportionalHeight);
  8458. void setBoundsInset (const BorderSize& borders);
  8459. void setBoundsToFit (int x, int y, int width, int height,
  8460. const Justification& justification,
  8461. const bool onlyReduceInSize);
  8462. void setCentrePosition (const int x, const int y);
  8463. void setCentreRelative (const float x, const float y);
  8464. void centreWithSize (const int width, const int height);
  8465. int proportionOfWidth (const float proportion) const throw();
  8466. int proportionOfHeight (const float proportion) const throw();
  8467. int getParentWidth() const throw();
  8468. int getParentHeight() const throw();
  8469. const Rectangle getParentMonitorArea() const throw();
  8470. int getNumChildComponents() const throw();
  8471. Component* getChildComponent (const int index) const throw();
  8472. int getIndexOfChildComponent (const Component* const child) const throw();
  8473. void addChildComponent (Component* const child,
  8474. int zOrder = -1);
  8475. void addAndMakeVisible (Component* const child,
  8476. int zOrder = -1);
  8477. void removeChildComponent (Component* const childToRemove);
  8478. Component* removeChildComponent (const int childIndexToRemove);
  8479. void removeAllChildren();
  8480. void deleteAllChildren();
  8481. Component* getParentComponent() const throw() { return parentComponent_; }
  8482. template <class TargetClass>
  8483. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8484. {
  8485. (void) dummyParameter;
  8486. Component* p = parentComponent_;
  8487. while (p != 0)
  8488. {
  8489. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8490. if (target != 0)
  8491. return target;
  8492. p = p->parentComponent_;
  8493. }
  8494. return 0;
  8495. }
  8496. Component* getTopLevelComponent() const throw();
  8497. bool isParentOf (const Component* possibleChild) const throw();
  8498. virtual void parentHierarchyChanged();
  8499. virtual void childrenChanged();
  8500. virtual bool hitTest (int x, int y);
  8501. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8502. const bool allowClicksOnChildComponents) throw();
  8503. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8504. bool& allowsClicksOnChildComponents) const throw();
  8505. virtual bool contains (int x, int y);
  8506. bool reallyContains (int x, int y,
  8507. const bool returnTrueIfWithinAChild);
  8508. Component* getComponentAt (const int x, const int y);
  8509. void repaint() throw();
  8510. void repaint (const int x, const int y,
  8511. const int width, const int height) throw();
  8512. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8513. Image* createComponentSnapshot (const Rectangle& areaToGrab,
  8514. const bool clipImageToComponentBounds = true);
  8515. void paintEntireComponent (Graphics& context);
  8516. void setComponentEffect (ImageEffectFilter* const newEffect);
  8517. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8518. LookAndFeel& getLookAndFeel() const throw();
  8519. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8520. virtual void lookAndFeelChanged();
  8521. void sendLookAndFeelChange();
  8522. void setOpaque (const bool shouldBeOpaque) throw();
  8523. bool isOpaque() const throw();
  8524. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8525. bool isBroughtToFrontOnMouseClick() const throw();
  8526. // Keyboard focus methods
  8527. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8528. bool getWantsKeyboardFocus() const throw();
  8529. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8530. bool getMouseClickGrabsKeyboardFocus() const throw();
  8531. void grabKeyboardFocus();
  8532. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8533. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8534. void moveKeyboardFocusToSibling (const bool moveToNext);
  8535. virtual KeyboardFocusTraverser* createFocusTraverser();
  8536. int getExplicitFocusOrder() const throw();
  8537. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8538. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8539. bool isFocusContainer() const throw();
  8540. bool isEnabled() const throw();
  8541. void setEnabled (const bool shouldBeEnabled);
  8542. virtual void enablementChanged();
  8543. void setMouseCursor (const MouseCursor& cursorType) throw();
  8544. virtual const MouseCursor getMouseCursor();
  8545. void updateMouseCursor() const throw();
  8546. virtual void paint (Graphics& g);
  8547. virtual void paintOverChildren (Graphics& g);
  8548. virtual void mouseMove (const MouseEvent& e);
  8549. virtual void mouseEnter (const MouseEvent& e);
  8550. virtual void mouseExit (const MouseEvent& e);
  8551. virtual void mouseDown (const MouseEvent& e);
  8552. virtual void mouseDrag (const MouseEvent& e);
  8553. virtual void mouseUp (const MouseEvent& e);
  8554. virtual void mouseDoubleClick (const MouseEvent& e);
  8555. virtual void mouseWheelMove (const MouseEvent& e,
  8556. float wheelIncrementX,
  8557. float wheelIncrementY);
  8558. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8559. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8560. void addMouseListener (MouseListener* const newListener,
  8561. const bool wantsEventsForAllNestedChildComponents) throw();
  8562. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8563. void addKeyListener (KeyListener* const newListener) throw();
  8564. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8565. virtual bool keyPressed (const KeyPress& key);
  8566. virtual bool keyStateChanged (const bool isKeyDown);
  8567. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8568. enum FocusChangeType
  8569. {
  8570. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8571. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8572. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8573. };
  8574. virtual void focusGained (FocusChangeType cause);
  8575. virtual void focusLost (FocusChangeType cause);
  8576. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8577. bool isMouseOver() const throw();
  8578. bool isMouseButtonDown() const throw();
  8579. bool isMouseOverOrDragging() const throw();
  8580. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8581. void getMouseXYRelative (int& x, int& y) const throw();
  8582. static Component* JUCE_CALLTYPE getComponentUnderMouse() throw();
  8583. void enableUnboundedMouseMovement (bool shouldUnboundedMovementBeEnabled,
  8584. bool keepCursorVisibleUntilOffscreen = false) throw();
  8585. virtual void resized();
  8586. virtual void moved();
  8587. virtual void childBoundsChanged (Component* child);
  8588. virtual void parentSizeChanged();
  8589. virtual void broughtToFront();
  8590. void addComponentListener (ComponentListener* const newListener) throw();
  8591. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8592. void postCommandMessage (const int commandId) throw();
  8593. virtual void handleCommandMessage (int commandId);
  8594. int runModalLoop();
  8595. void enterModalState (const bool takeKeyboardFocus = true);
  8596. void exitModalState (const int returnValue);
  8597. bool isCurrentlyModal() const throw();
  8598. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8599. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8600. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8601. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8602. virtual void inputAttemptWhenModal();
  8603. const String getComponentProperty (const String& keyName,
  8604. const bool useParentComponentIfNotFound,
  8605. const String& defaultReturnValue = String::empty) const throw();
  8606. int getComponentPropertyInt (const String& keyName,
  8607. const bool useParentComponentIfNotFound,
  8608. const int defaultReturnValue = 0) const throw();
  8609. double getComponentPropertyDouble (const String& keyName,
  8610. const bool useParentComponentIfNotFound,
  8611. const double defaultReturnValue = 0.0) const throw();
  8612. bool getComponentPropertyBool (const String& keyName,
  8613. const bool useParentComponentIfNotFound,
  8614. const bool defaultReturnValue = false) const throw();
  8615. const Colour getComponentPropertyColour (const String& keyName,
  8616. const bool useParentComponentIfNotFound,
  8617. const Colour& defaultReturnValue = Colours::black) const throw();
  8618. void setComponentProperty (const String& keyName, const String& value) throw();
  8619. void setComponentProperty (const String& keyName, const int value) throw();
  8620. void setComponentProperty (const String& keyName, const double value) throw();
  8621. void setComponentProperty (const String& keyName, const bool value) throw();
  8622. void setComponentProperty (const String& keyName, const Colour& newColour) throw();
  8623. void removeComponentProperty (const String& keyName) throw();
  8624. PropertySet* getComponentProperties() const throw() { return propertySet_; }
  8625. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8626. void setColour (const int colourId, const Colour& colour);
  8627. void removeColour (const int colourId);
  8628. bool isColourSpecified (const int colourId) const throw();
  8629. void copyAllExplicitColoursTo (Component& target) const throw();
  8630. virtual void colourChanged();
  8631. void* getWindowHandle() const throw();
  8632. uint32 getComponentUID() const throw() { return componentUID; }
  8633. juce_UseDebuggingNewOperator
  8634. private:
  8635. friend class ComponentPeer;
  8636. friend class InternalDragRepeater;
  8637. static Component* currentlyFocusedComponent;
  8638. static Component* componentUnderMouse;
  8639. String componentName_;
  8640. Component* parentComponent_;
  8641. uint32 componentUID;
  8642. Rectangle bounds_;
  8643. int numDeepMouseListeners;
  8644. Array <Component*> childComponentList_;
  8645. LookAndFeel* lookAndFeel_;
  8646. MouseCursor cursor_;
  8647. ImageEffectFilter* effect_;
  8648. Image* bufferedImage_;
  8649. VoidArray* mouseListeners_;
  8650. VoidArray* keyListeners_;
  8651. VoidArray* componentListeners_;
  8652. PropertySet* propertySet_;
  8653. struct ComponentFlags
  8654. {
  8655. bool hasHeavyweightPeerFlag : 1;
  8656. bool visibleFlag : 1;
  8657. bool opaqueFlag : 1;
  8658. bool ignoresMouseClicksFlag : 1;
  8659. bool allowChildMouseClicksFlag : 1;
  8660. bool wantsFocusFlag : 1;
  8661. bool isFocusContainerFlag : 1;
  8662. bool dontFocusOnMouseClickFlag : 1;
  8663. bool alwaysOnTopFlag : 1;
  8664. bool bufferToImageFlag : 1;
  8665. bool bringToFrontOnClickFlag : 1;
  8666. bool repaintOnMouseActivityFlag : 1;
  8667. bool draggingFlag : 1;
  8668. bool mouseOverFlag : 1;
  8669. bool mouseInsideFlag : 1;
  8670. bool currentlyModalFlag : 1;
  8671. bool isDisabledFlag : 1;
  8672. bool childCompFocusedFlag : 1;
  8673. #ifdef JUCE_DEBUG
  8674. bool isInsidePaintCall : 1;
  8675. #endif
  8676. };
  8677. union
  8678. {
  8679. uint32 componentFlags_;
  8680. ComponentFlags flags;
  8681. };
  8682. void internalMouseEnter (int x, int y, const int64 time);
  8683. void internalMouseExit (int x, int y, const int64 time);
  8684. void internalMouseDown (int x, int y);
  8685. void internalMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8686. void internalMouseDrag (int x, int y, const int64 time);
  8687. void internalMouseMove (int x, int y, const int64 time);
  8688. void internalMouseWheel (const int intAmountX, const int intAmountY, const int64 time);
  8689. void internalBroughtToFront();
  8690. void internalFocusGain (const FocusChangeType cause);
  8691. void internalFocusLoss (const FocusChangeType cause);
  8692. void internalChildFocusChange (FocusChangeType cause);
  8693. void internalModalInputAttempt();
  8694. void internalModifierKeysChanged();
  8695. void internalChildrenChanged();
  8696. void internalHierarchyChanged();
  8697. void internalUpdateMouseCursor (const bool forcedUpdate) throw();
  8698. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8699. void repaintParent() throw();
  8700. void sendFakeMouseMove() const;
  8701. void takeKeyboardFocus (const FocusChangeType cause);
  8702. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8703. static void giveAwayFocus();
  8704. void sendEnablementChangeMessage();
  8705. static void* runModalLoopCallback (void*);
  8706. static void bringModalComponentToFront();
  8707. void subtractObscuredRegions (RectangleList& result,
  8708. const int deltaX, const int deltaY,
  8709. const Rectangle& clipRect,
  8710. const Component* const compToAvoid) const throw();
  8711. void clipObscuredRegions (Graphics& g, const Rectangle& clipRect,
  8712. const int deltaX, const int deltaY) const throw();
  8713. // how much of the component is not off the edges of its parents
  8714. const Rectangle getUnclippedArea() const;
  8715. void sendVisibilityChangeMessage();
  8716. // This is included here just to cause a compile error if your code is still handling
  8717. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8718. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8719. // implement its methods instead of this Component method).
  8720. virtual void filesDropped (const StringArray&, int, int) {}
  8721. // components aren't allowed to have copy constructors, as this would mess up parent
  8722. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8723. // this one to avoid compiler warnings.
  8724. Component (const Component&);
  8725. const Component& operator= (const Component&);
  8726. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8727. // subclass to use the new parameters to keyStateChanged)
  8728. virtual void keyStateChanged() {};
  8729. protected:
  8730. virtual void internalRepaint (int x, int y, int w, int h);
  8731. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8732. void handleMessage (const Message&);
  8733. };
  8734. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8735. /********* End of inlined file: juce_Component.h *********/
  8736. /********* Start of inlined file: juce_ApplicationCommandInfo.h *********/
  8737. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8738. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8739. /********* Start of inlined file: juce_ApplicationCommandID.h *********/
  8740. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8741. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8742. typedef int CommandID;
  8743. namespace StandardApplicationCommandIDs
  8744. {
  8745. static const CommandID quit = 0x1001;
  8746. static const CommandID del = 0x1002;
  8747. static const CommandID cut = 0x1003;
  8748. static const CommandID copy = 0x1004;
  8749. static const CommandID paste = 0x1005;
  8750. static const CommandID selectAll = 0x1006;
  8751. static const CommandID deselectAll = 0x1007;
  8752. }
  8753. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8754. /********* End of inlined file: juce_ApplicationCommandID.h *********/
  8755. struct JUCE_API ApplicationCommandInfo
  8756. {
  8757. ApplicationCommandInfo (const CommandID commandID) throw();
  8758. void setInfo (const String& shortName,
  8759. const String& description,
  8760. const String& categoryName,
  8761. const int flags) throw();
  8762. void setActive (const bool isActive) throw();
  8763. void setTicked (const bool isTicked) throw();
  8764. void addDefaultKeypress (const int keyCode,
  8765. const ModifierKeys& modifiers) throw();
  8766. CommandID commandID;
  8767. String shortName;
  8768. String description;
  8769. String categoryName;
  8770. Array <KeyPress> defaultKeypresses;
  8771. enum CommandFlags
  8772. {
  8773. isDisabled = 1 << 0,
  8774. isTicked = 1 << 1,
  8775. wantsKeyUpDownCallbacks = 1 << 2,
  8776. hiddenFromKeyEditor = 1 << 3,
  8777. readOnlyInKeyEditor = 1 << 4,
  8778. dontTriggerVisualFeedback = 1 << 5
  8779. };
  8780. int flags;
  8781. };
  8782. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8783. /********* End of inlined file: juce_ApplicationCommandInfo.h *********/
  8784. class JUCE_API ApplicationCommandTarget
  8785. {
  8786. public:
  8787. ApplicationCommandTarget();
  8788. virtual ~ApplicationCommandTarget();
  8789. struct JUCE_API InvocationInfo
  8790. {
  8791. InvocationInfo (const CommandID commandID) throw();
  8792. CommandID commandID;
  8793. int commandFlags;
  8794. enum InvocationMethod
  8795. {
  8796. direct = 0, /**< The command is being invoked directly by a piece of code. */
  8797. fromKeyPress, /**< The command is being invoked by a key-press. */
  8798. fromMenu, /**< The command is being invoked by a menu selection. */
  8799. fromButton /**< The command is being invoked by a button click. */
  8800. };
  8801. InvocationMethod invocationMethod;
  8802. Component* originatingComponent;
  8803. KeyPress keyPress;
  8804. bool isKeyDown;
  8805. int millisecsSinceKeyPressed;
  8806. };
  8807. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  8808. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  8809. virtual void getCommandInfo (const CommandID commandID,
  8810. ApplicationCommandInfo& result) = 0;
  8811. virtual bool perform (const InvocationInfo& info) = 0;
  8812. bool invoke (const InvocationInfo& invocationInfo,
  8813. const bool asynchronously);
  8814. bool invokeDirectly (const CommandID commandID,
  8815. const bool asynchronously);
  8816. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  8817. bool isCommandActive (const CommandID commandID);
  8818. ApplicationCommandTarget* findFirstTargetParentComponent();
  8819. juce_UseDebuggingNewOperator
  8820. private:
  8821. // (for async invocation of commands)
  8822. class CommandTargetMessageInvoker : public MessageListener
  8823. {
  8824. public:
  8825. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  8826. ~CommandTargetMessageInvoker();
  8827. void handleMessage (const Message& message);
  8828. private:
  8829. ApplicationCommandTarget* const owner;
  8830. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  8831. const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  8832. };
  8833. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  8834. friend class CommandTargetMessageInvoker;
  8835. bool tryToInvoke (const InvocationInfo& info, const bool async);
  8836. ApplicationCommandTarget (const ApplicationCommandTarget&);
  8837. const ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  8838. };
  8839. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  8840. /********* End of inlined file: juce_ApplicationCommandTarget.h *********/
  8841. /********* Start of inlined file: juce_ActionListener.h *********/
  8842. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  8843. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  8844. class JUCE_API ActionListener
  8845. {
  8846. public:
  8847. virtual ~ActionListener() {}
  8848. virtual void actionListenerCallback (const String& message) = 0;
  8849. };
  8850. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  8851. /********* End of inlined file: juce_ActionListener.h *********/
  8852. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  8853. private ActionListener
  8854. {
  8855. protected:
  8856. JUCEApplication();
  8857. public:
  8858. virtual ~JUCEApplication();
  8859. static JUCEApplication* getInstance() throw();
  8860. virtual void initialise (const String& commandLineParameters) = 0;
  8861. bool isInitialising() const throw();
  8862. virtual void shutdown() = 0;
  8863. virtual const String getApplicationName() = 0;
  8864. virtual const String getApplicationVersion();
  8865. virtual bool moreThanOneInstanceAllowed();
  8866. virtual void anotherInstanceStarted (const String& commandLine);
  8867. virtual void systemRequestedQuit();
  8868. virtual void unhandledException (const std::exception* e,
  8869. const String& sourceFilename,
  8870. const int lineNumber);
  8871. static void quit();
  8872. void setApplicationReturnValue (const int newReturnValue) throw();
  8873. int getApplicationReturnValue() const throw() { return appReturnValue; }
  8874. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  8875. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  8876. static int main (String& commandLine, JUCEApplication* const newApp);
  8877. static int main (int argc, char* argv[], JUCEApplication* const newApp);
  8878. static void sendUnhandledException (const std::exception* const e,
  8879. const char* const sourceFile,
  8880. const int lineNumber);
  8881. ApplicationCommandTarget* getNextCommandTarget();
  8882. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  8883. void getAllCommands (Array <CommandID>& commands);
  8884. bool perform (const InvocationInfo& info);
  8885. void actionListenerCallback (const String& message);
  8886. private:
  8887. String commandLineParameters;
  8888. int appReturnValue;
  8889. bool stillInitialising;
  8890. InterProcessLock* appLock;
  8891. JUCEApplication (const JUCEApplication&);
  8892. const JUCEApplication& operator= (const JUCEApplication&);
  8893. public:
  8894. bool initialiseApp (String& commandLine);
  8895. static int shutdownAppAndClearUp();
  8896. };
  8897. #endif // __JUCE_APPLICATION_JUCEHEADER__
  8898. /********* End of inlined file: juce_Application.h *********/
  8899. #endif
  8900. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8901. #endif
  8902. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8903. #endif
  8904. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8905. /********* Start of inlined file: juce_ApplicationCommandManager.h *********/
  8906. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8907. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  8908. /********* Start of inlined file: juce_Desktop.h *********/
  8909. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  8910. #define __JUCE_DESKTOP_JUCEHEADER__
  8911. /********* Start of inlined file: juce_DeletedAtShutdown.h *********/
  8912. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8913. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8914. class JUCE_API DeletedAtShutdown
  8915. {
  8916. protected:
  8917. DeletedAtShutdown();
  8918. virtual ~DeletedAtShutdown();
  8919. public:
  8920. static void deleteAll();
  8921. private:
  8922. DeletedAtShutdown (const DeletedAtShutdown&);
  8923. const DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  8924. };
  8925. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  8926. /********* End of inlined file: juce_DeletedAtShutdown.h *********/
  8927. /********* Start of inlined file: juce_Timer.h *********/
  8928. #ifndef __JUCE_TIMER_JUCEHEADER__
  8929. #define __JUCE_TIMER_JUCEHEADER__
  8930. class InternalTimerThread;
  8931. class JUCE_API Timer
  8932. {
  8933. protected:
  8934. Timer() throw();
  8935. Timer (const Timer& other) throw();
  8936. public:
  8937. virtual ~Timer();
  8938. virtual void timerCallback() = 0;
  8939. void startTimer (const int intervalInMilliseconds) throw();
  8940. void stopTimer() throw();
  8941. bool isTimerRunning() const throw() { return periodMs > 0; }
  8942. int getTimerInterval() const throw() { return periodMs; }
  8943. private:
  8944. friend class InternalTimerThread;
  8945. int countdownMs, periodMs;
  8946. Timer* previous;
  8947. Timer* next;
  8948. const Timer& operator= (const Timer&);
  8949. };
  8950. #endif // __JUCE_TIMER_JUCEHEADER__
  8951. /********* End of inlined file: juce_Timer.h *********/
  8952. class JUCE_API FocusChangeListener
  8953. {
  8954. public:
  8955. virtual ~FocusChangeListener() {}
  8956. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  8957. };
  8958. class JUCE_API Desktop : private DeletedAtShutdown,
  8959. private Timer,
  8960. private AsyncUpdater
  8961. {
  8962. public:
  8963. static Desktop& JUCE_CALLTYPE getInstance() throw();
  8964. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  8965. const Rectangle getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  8966. const Rectangle getMonitorAreaContaining (int x, int y, const bool clippedToWorkArea = true) const throw();
  8967. static void getMousePosition (int& x, int& y) throw();
  8968. static void setMousePosition (int x, int y) throw();
  8969. static void getLastMouseDownPosition (int& x, int& y) throw();
  8970. static int getMouseButtonClickCounter() throw();
  8971. static void setScreenSaverEnabled (const bool isEnabled) throw();
  8972. static bool isScreenSaverEnabled() throw();
  8973. void addGlobalMouseListener (MouseListener* const listener) throw();
  8974. void removeGlobalMouseListener (MouseListener* const listener) throw();
  8975. void addFocusChangeListener (FocusChangeListener* const listener) throw();
  8976. void removeFocusChangeListener (FocusChangeListener* const listener) throw();
  8977. void setKioskModeComponent (Component* componentToUse,
  8978. const bool allowMenusAndBars = true);
  8979. Component* getKioskModeComponent() const { return kioskModeComponent; }
  8980. int getNumComponents() const throw();
  8981. Component* getComponent (const int index) const throw();
  8982. Component* findComponentAt (const int screenX,
  8983. const int screenY) const;
  8984. juce_UseDebuggingNewOperator
  8985. void refreshMonitorSizes() throw();
  8986. static bool canUseSemiTransparentWindows() throw();
  8987. private:
  8988. friend class Component;
  8989. friend class ComponentPeer;
  8990. SortedSet <void*> mouseListeners, focusListeners;
  8991. Array <Component*> desktopComponents;
  8992. friend class DeletedAtShutdown;
  8993. friend class TopLevelWindowManager;
  8994. Desktop() throw();
  8995. ~Desktop() throw();
  8996. Array <Rectangle> monitorCoordsClipped, monitorCoordsUnclipped;
  8997. int lastMouseX, lastMouseY;
  8998. Component* kioskModeComponent;
  8999. Rectangle kioskComponentOriginalBounds;
  9000. void timerCallback();
  9001. void sendMouseMove();
  9002. void resetTimer() throw();
  9003. int getNumDisplayMonitors() const throw();
  9004. const Rectangle getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9005. void addDesktopComponent (Component* const c) throw();
  9006. void removeDesktopComponent (Component* const c) throw();
  9007. void componentBroughtToFront (Component* const c) throw();
  9008. void triggerFocusCallback() throw();
  9009. void handleAsyncUpdate();
  9010. Desktop (const Desktop&);
  9011. const Desktop& operator= (const Desktop&);
  9012. };
  9013. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9014. /********* End of inlined file: juce_Desktop.h *********/
  9015. class KeyPressMappingSet;
  9016. class ApplicationCommandManagerListener;
  9017. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9018. private FocusChangeListener
  9019. {
  9020. public:
  9021. ApplicationCommandManager();
  9022. virtual ~ApplicationCommandManager();
  9023. void clearCommands();
  9024. void registerCommand (const ApplicationCommandInfo& newCommand);
  9025. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9026. void removeCommand (const CommandID commandID);
  9027. void commandStatusChanged();
  9028. int getNumCommands() const throw() { return commands.size(); }
  9029. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9030. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9031. const String getNameOfCommand (const CommandID commandID) const throw();
  9032. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9033. const StringArray getCommandCategories() const throw();
  9034. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9035. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9036. bool invokeDirectly (const CommandID commandID,
  9037. const bool asynchronously);
  9038. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9039. const bool asynchronously);
  9040. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9041. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9042. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9043. ApplicationCommandInfo& upToDateInfo);
  9044. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9045. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9046. static ApplicationCommandTarget* findDefaultComponentTarget();
  9047. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9048. juce_UseDebuggingNewOperator
  9049. private:
  9050. OwnedArray <ApplicationCommandInfo> commands;
  9051. SortedSet <void*> listeners;
  9052. ScopedPointer <KeyPressMappingSet> keyMappings;
  9053. ApplicationCommandTarget* firstTarget;
  9054. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) const;
  9055. void handleAsyncUpdate();
  9056. void globalFocusChanged (Component*);
  9057. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9058. // version of this method.
  9059. virtual short getFirstCommandTarget() { return 0; }
  9060. };
  9061. class JUCE_API ApplicationCommandManagerListener
  9062. {
  9063. public:
  9064. virtual ~ApplicationCommandManagerListener() {}
  9065. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9066. virtual void applicationCommandListChanged() = 0;
  9067. };
  9068. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9069. /********* End of inlined file: juce_ApplicationCommandManager.h *********/
  9070. #endif
  9071. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9072. #endif
  9073. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9074. /********* Start of inlined file: juce_ApplicationProperties.h *********/
  9075. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9076. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9077. /********* Start of inlined file: juce_PropertiesFile.h *********/
  9078. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9079. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9080. class JUCE_API PropertiesFile : public PropertySet,
  9081. public ChangeBroadcaster,
  9082. private Timer
  9083. {
  9084. public:
  9085. enum FileFormatOptions
  9086. {
  9087. ignoreCaseOfKeyNames = 1,
  9088. storeAsBinary = 2,
  9089. storeAsCompressedBinary = 4,
  9090. storeAsXML = 8
  9091. };
  9092. PropertiesFile (const File& file,
  9093. const int millisecondsBeforeSaving,
  9094. const int options);
  9095. ~PropertiesFile();
  9096. bool saveIfNeeded();
  9097. bool save();
  9098. bool needsToBeSaved() const;
  9099. const File getFile() const { return file; }
  9100. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9101. const String& fileNameSuffix,
  9102. const String& folderName,
  9103. const bool commonToAllUsers,
  9104. const int millisecondsBeforeSaving,
  9105. const int propertiesFileOptions);
  9106. static const File getDefaultAppSettingsFile (const String& applicationName,
  9107. const String& fileNameSuffix,
  9108. const String& folderName,
  9109. const bool commonToAllUsers);
  9110. juce_UseDebuggingNewOperator
  9111. protected:
  9112. virtual void propertyChanged();
  9113. private:
  9114. File file;
  9115. int timerInterval;
  9116. const int options;
  9117. bool needsWriting;
  9118. void timerCallback();
  9119. PropertiesFile (const PropertiesFile&);
  9120. const PropertiesFile& operator= (const PropertiesFile&);
  9121. };
  9122. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9123. /********* End of inlined file: juce_PropertiesFile.h *********/
  9124. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9125. {
  9126. public:
  9127. ApplicationProperties() throw();
  9128. ~ApplicationProperties();
  9129. juce_DeclareSingleton (ApplicationProperties, false)
  9130. void setStorageParameters (const String& applicationName,
  9131. const String& fileNameSuffix,
  9132. const String& folderName,
  9133. const int millisecondsBeforeSaving,
  9134. const int propertiesFileOptions) throw();
  9135. bool testWriteAccess (const bool testUserSettings,
  9136. const bool testCommonSettings,
  9137. const bool showWarningDialogOnFailure);
  9138. PropertiesFile* getUserSettings() throw();
  9139. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9140. bool saveIfNeeded();
  9141. void closeFiles();
  9142. juce_UseDebuggingNewOperator
  9143. private:
  9144. ScopedPointer <PropertiesFile> userProps, commonProps;
  9145. String appName, fileSuffix, folderName;
  9146. int msBeforeSaving, options;
  9147. int commonSettingsAreReadOnly;
  9148. ApplicationProperties (const ApplicationProperties&);
  9149. const ApplicationProperties& operator= (const ApplicationProperties&);
  9150. void openFiles() throw();
  9151. };
  9152. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9153. /********* End of inlined file: juce_ApplicationProperties.h *********/
  9154. #endif
  9155. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9156. /********* Start of inlined file: juce_AiffAudioFormat.h *********/
  9157. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9158. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9159. /********* Start of inlined file: juce_AudioFormat.h *********/
  9160. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9161. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9162. /********* Start of inlined file: juce_AudioFormatReader.h *********/
  9163. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9164. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9165. class AudioFormat;
  9166. class JUCE_API AudioFormatReader
  9167. {
  9168. protected:
  9169. AudioFormatReader (InputStream* const sourceStream,
  9170. const String& formatName);
  9171. public:
  9172. virtual ~AudioFormatReader();
  9173. const String getFormatName() const throw() { return formatName; }
  9174. bool read (int** destSamples,
  9175. int numDestChannels,
  9176. int64 startSampleInSource,
  9177. int numSamplesToRead,
  9178. const bool fillLeftoverChannelsWithCopies);
  9179. virtual void readMaxLevels (int64 startSample,
  9180. int64 numSamples,
  9181. float& lowestLeft,
  9182. float& highestLeft,
  9183. float& lowestRight,
  9184. float& highestRight);
  9185. int64 searchForLevel (int64 startSample,
  9186. int64 numSamplesToSearch,
  9187. const double magnitudeRangeMinimum,
  9188. const double magnitudeRangeMaximum,
  9189. const int minimumConsecutiveSamples);
  9190. double sampleRate;
  9191. unsigned int bitsPerSample;
  9192. int64 lengthInSamples;
  9193. unsigned int numChannels;
  9194. bool usesFloatingPointData;
  9195. StringPairArray metadataValues;
  9196. InputStream* input;
  9197. virtual bool readSamples (int** destSamples,
  9198. int numDestChannels,
  9199. int startOffsetInDestBuffer,
  9200. int64 startSampleInFile,
  9201. int numSamples) = 0;
  9202. juce_UseDebuggingNewOperator
  9203. private:
  9204. String formatName;
  9205. AudioFormatReader (const AudioFormatReader&);
  9206. const AudioFormatReader& operator= (const AudioFormatReader&);
  9207. };
  9208. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9209. /********* End of inlined file: juce_AudioFormatReader.h *********/
  9210. /********* Start of inlined file: juce_AudioFormatWriter.h *********/
  9211. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9212. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9213. /********* Start of inlined file: juce_AudioSource.h *********/
  9214. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9215. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9216. /********* Start of inlined file: juce_AudioSampleBuffer.h *********/
  9217. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9218. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9219. class AudioFormatReader;
  9220. class AudioFormatWriter;
  9221. class JUCE_API AudioSampleBuffer
  9222. {
  9223. public:
  9224. AudioSampleBuffer (const int numChannels,
  9225. const int numSamples) throw();
  9226. AudioSampleBuffer (float** dataToReferTo,
  9227. const int numChannels,
  9228. const int numSamples) throw();
  9229. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9230. const AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9231. virtual ~AudioSampleBuffer() throw();
  9232. int getNumChannels() const throw() { return numChannels; }
  9233. int getNumSamples() const throw() { return size; }
  9234. float* getSampleData (const int channelNumber) const throw()
  9235. {
  9236. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9237. return channels [channelNumber];
  9238. }
  9239. float* getSampleData (const int channelNumber,
  9240. const int sampleOffset) const throw()
  9241. {
  9242. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9243. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9244. return channels [channelNumber] + sampleOffset;
  9245. }
  9246. float** getArrayOfChannels() const throw() { return channels; }
  9247. void setSize (const int newNumChannels,
  9248. const int newNumSamples,
  9249. const bool keepExistingContent = false,
  9250. const bool clearExtraSpace = false,
  9251. const bool avoidReallocating = false) throw();
  9252. void setDataToReferTo (float** dataToReferTo,
  9253. const int numChannels,
  9254. const int numSamples) throw();
  9255. void clear() throw();
  9256. void clear (const int startSample,
  9257. const int numSamples) throw();
  9258. void clear (const int channel,
  9259. const int startSample,
  9260. const int numSamples) throw();
  9261. void applyGain (const int channel,
  9262. const int startSample,
  9263. int numSamples,
  9264. const float gain) throw();
  9265. void applyGain (const int startSample,
  9266. const int numSamples,
  9267. const float gain) throw();
  9268. void applyGainRamp (const int channel,
  9269. const int startSample,
  9270. int numSamples,
  9271. float startGain,
  9272. float endGain) throw();
  9273. void addFrom (const int destChannel,
  9274. const int destStartSample,
  9275. const AudioSampleBuffer& source,
  9276. const int sourceChannel,
  9277. const int sourceStartSample,
  9278. int numSamples,
  9279. const float gainToApplyToSource = 1.0f) throw();
  9280. void addFrom (const int destChannel,
  9281. const int destStartSample,
  9282. const float* source,
  9283. int numSamples,
  9284. const float gainToApplyToSource = 1.0f) throw();
  9285. void addFromWithRamp (const int destChannel,
  9286. const int destStartSample,
  9287. const float* source,
  9288. int numSamples,
  9289. float startGain,
  9290. float endGain) throw();
  9291. void copyFrom (const int destChannel,
  9292. const int destStartSample,
  9293. const AudioSampleBuffer& source,
  9294. const int sourceChannel,
  9295. const int sourceStartSample,
  9296. int numSamples) throw();
  9297. void copyFrom (const int destChannel,
  9298. const int destStartSample,
  9299. const float* source,
  9300. int numSamples) throw();
  9301. void copyFrom (const int destChannel,
  9302. const int destStartSample,
  9303. const float* source,
  9304. int numSamples,
  9305. const float gain) throw();
  9306. void copyFromWithRamp (const int destChannel,
  9307. const int destStartSample,
  9308. const float* source,
  9309. int numSamples,
  9310. float startGain,
  9311. float endGain) throw();
  9312. void findMinMax (const int channel,
  9313. const int startSample,
  9314. int numSamples,
  9315. float& minVal,
  9316. float& maxVal) const throw();
  9317. float getMagnitude (const int channel,
  9318. const int startSample,
  9319. const int numSamples) const throw();
  9320. float getMagnitude (const int startSample,
  9321. const int numSamples) const throw();
  9322. float getRMSLevel (const int channel,
  9323. const int startSample,
  9324. const int numSamples) const throw();
  9325. void readFromAudioReader (AudioFormatReader* reader,
  9326. const int startSample,
  9327. const int numSamples,
  9328. const int readerStartSample,
  9329. const bool useReaderLeftChan,
  9330. const bool useReaderRightChan) throw();
  9331. void writeToAudioWriter (AudioFormatWriter* writer,
  9332. const int startSample,
  9333. const int numSamples) const throw();
  9334. juce_UseDebuggingNewOperator
  9335. private:
  9336. int numChannels, size;
  9337. size_t allocatedBytes;
  9338. float** channels;
  9339. HeapBlock <char> allocatedData;
  9340. float* preallocatedChannelSpace [32];
  9341. void allocateData();
  9342. void allocateChannels (float** const dataToReferTo);
  9343. };
  9344. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9345. /********* End of inlined file: juce_AudioSampleBuffer.h *********/
  9346. struct JUCE_API AudioSourceChannelInfo
  9347. {
  9348. AudioSampleBuffer* buffer;
  9349. int startSample;
  9350. int numSamples;
  9351. void clearActiveBufferRegion() const
  9352. {
  9353. if (buffer != 0)
  9354. buffer->clear (startSample, numSamples);
  9355. }
  9356. };
  9357. class JUCE_API AudioSource
  9358. {
  9359. protected:
  9360. AudioSource() throw() {}
  9361. public:
  9362. virtual ~AudioSource() {}
  9363. virtual void prepareToPlay (int samplesPerBlockExpected,
  9364. double sampleRate) = 0;
  9365. virtual void releaseResources() = 0;
  9366. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9367. };
  9368. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9369. /********* End of inlined file: juce_AudioSource.h *********/
  9370. class JUCE_API AudioFormatWriter
  9371. {
  9372. protected:
  9373. AudioFormatWriter (OutputStream* const destStream,
  9374. const String& formatName,
  9375. const double sampleRate,
  9376. const unsigned int numberOfChannels,
  9377. const unsigned int bitsPerSample);
  9378. public:
  9379. virtual ~AudioFormatWriter();
  9380. const String getFormatName() const throw() { return formatName; }
  9381. virtual bool write (const int** samplesToWrite,
  9382. int numSamples) = 0;
  9383. bool writeFromAudioReader (AudioFormatReader& reader,
  9384. int64 startSample,
  9385. int64 numSamplesToRead);
  9386. bool writeFromAudioSource (AudioSource& source,
  9387. int numSamplesToRead,
  9388. const int samplesPerBlock = 2048);
  9389. double getSampleRate() const throw() { return sampleRate; }
  9390. int getNumChannels() const throw() { return numChannels; }
  9391. int getBitsPerSample() const throw() { return bitsPerSample; }
  9392. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9393. juce_UseDebuggingNewOperator
  9394. protected:
  9395. double sampleRate;
  9396. unsigned int numChannels;
  9397. unsigned int bitsPerSample;
  9398. bool usesFloatingPointData;
  9399. OutputStream* output;
  9400. private:
  9401. String formatName;
  9402. };
  9403. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9404. /********* End of inlined file: juce_AudioFormatWriter.h *********/
  9405. class JUCE_API AudioFormat
  9406. {
  9407. public:
  9408. virtual ~AudioFormat();
  9409. const String& getFormatName() const;
  9410. const StringArray& getFileExtensions() const;
  9411. virtual bool canHandleFile (const File& fileToTest);
  9412. virtual const Array <int> getPossibleSampleRates() = 0;
  9413. virtual const Array <int> getPossibleBitDepths() = 0;
  9414. virtual bool canDoStereo() = 0;
  9415. virtual bool canDoMono() = 0;
  9416. virtual bool isCompressed();
  9417. virtual const StringArray getQualityOptions();
  9418. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9419. const bool deleteStreamIfOpeningFails) = 0;
  9420. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9421. double sampleRateToUse,
  9422. unsigned int numberOfChannels,
  9423. int bitsPerSample,
  9424. const StringPairArray& metadataValues,
  9425. int qualityOptionIndex) = 0;
  9426. protected:
  9427. AudioFormat (const String& formatName,
  9428. const tchar** const fileExtensions);
  9429. private:
  9430. String formatName;
  9431. StringArray fileExtensions;
  9432. };
  9433. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9434. /********* End of inlined file: juce_AudioFormat.h *********/
  9435. class JUCE_API AiffAudioFormat : public AudioFormat
  9436. {
  9437. public:
  9438. AiffAudioFormat();
  9439. ~AiffAudioFormat();
  9440. const Array <int> getPossibleSampleRates();
  9441. const Array <int> getPossibleBitDepths();
  9442. bool canDoStereo();
  9443. bool canDoMono();
  9444. #if JUCE_MAC
  9445. bool canHandleFile (const File& fileToTest);
  9446. #endif
  9447. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9448. const bool deleteStreamIfOpeningFails);
  9449. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9450. double sampleRateToUse,
  9451. unsigned int numberOfChannels,
  9452. int bitsPerSample,
  9453. const StringPairArray& metadataValues,
  9454. int qualityOptionIndex);
  9455. juce_UseDebuggingNewOperator
  9456. };
  9457. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9458. /********* End of inlined file: juce_AiffAudioFormat.h *********/
  9459. #endif
  9460. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9461. /********* Start of inlined file: juce_AudioCDBurner.h *********/
  9462. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9463. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9464. #if JUCE_USE_CDBURNER
  9465. class AudioCDBurner
  9466. {
  9467. public:
  9468. static const StringArray findAvailableDevices();
  9469. static AudioCDBurner* openDevice (const int deviceIndex);
  9470. ~AudioCDBurner();
  9471. bool isDiskPresent() const;
  9472. int getNumAvailableAudioBlocks() const;
  9473. bool addAudioTrack (AudioSource* source, int numSamples);
  9474. class BurnProgressListener
  9475. {
  9476. public:
  9477. BurnProgressListener() throw() {}
  9478. virtual ~BurnProgressListener() {}
  9479. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9480. };
  9481. const String burn (BurnProgressListener* listener,
  9482. const bool ejectDiscAfterwards,
  9483. const bool peformFakeBurnForTesting);
  9484. juce_UseDebuggingNewOperator
  9485. private:
  9486. AudioCDBurner (const int deviceIndex);
  9487. void* internal;
  9488. };
  9489. #endif
  9490. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9491. /********* End of inlined file: juce_AudioCDBurner.h *********/
  9492. #endif
  9493. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9494. /********* Start of inlined file: juce_AudioCDReader.h *********/
  9495. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9496. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9497. #if JUCE_USE_CDREADER
  9498. #if JUCE_MAC
  9499. #endif
  9500. class JUCE_API AudioCDReader : public AudioFormatReader
  9501. {
  9502. public:
  9503. static const StringArray getAvailableCDNames();
  9504. static AudioCDReader* createReaderForCD (const int index);
  9505. ~AudioCDReader();
  9506. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9507. int64 startSampleInFile, int numSamples);
  9508. bool isCDStillPresent() const;
  9509. int getNumTracks() const;
  9510. int getPositionOfTrackStart (int trackNum) const;
  9511. bool isTrackAudio (int trackNum) const;
  9512. void refreshTrackLengths();
  9513. void enableIndexScanning (bool enabled);
  9514. int getLastIndex() const;
  9515. const Array <int> findIndexesInTrack (const int trackNumber);
  9516. int getCDDBId();
  9517. void ejectDisk();
  9518. juce_UseDebuggingNewOperator
  9519. private:
  9520. #if JUCE_MAC
  9521. File volumeDir;
  9522. OwnedArray<File> tracks;
  9523. Array <int> trackStartSamples;
  9524. int currentReaderTrack;
  9525. ScopedPointer <AudioFormatReader> reader;
  9526. AudioCDReader (const File& volume);
  9527. public:
  9528. static int compareElements (const File* const, const File* const) throw();
  9529. private:
  9530. #elif JUCE_WINDOWS
  9531. int numTracks;
  9532. int trackStarts[100];
  9533. bool audioTracks [100];
  9534. void* handle;
  9535. bool indexingEnabled;
  9536. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9537. MemoryBlock buffer;
  9538. AudioCDReader (void* handle);
  9539. int getIndexAt (int samplePos);
  9540. #elif JUCE_LINUX
  9541. AudioCDReader();
  9542. #endif
  9543. AudioCDReader (const AudioCDReader&);
  9544. const AudioCDReader& operator= (const AudioCDReader&);
  9545. };
  9546. #endif
  9547. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9548. /********* End of inlined file: juce_AudioCDReader.h *********/
  9549. #endif
  9550. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9551. #endif
  9552. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9553. /********* Start of inlined file: juce_AudioFormatManager.h *********/
  9554. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9555. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9556. class JUCE_API AudioFormatManager
  9557. {
  9558. public:
  9559. AudioFormatManager();
  9560. ~AudioFormatManager();
  9561. juce_DeclareSingleton (AudioFormatManager, false);
  9562. void registerFormat (AudioFormat* newFormat,
  9563. const bool makeThisTheDefaultFormat);
  9564. void registerBasicFormats();
  9565. void clearFormats();
  9566. int getNumKnownFormats() const;
  9567. AudioFormat* getKnownFormat (const int index) const;
  9568. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9569. AudioFormat* getDefaultFormat() const;
  9570. const String getWildcardForAllFormats() const;
  9571. AudioFormatReader* createReaderFor (const File& audioFile);
  9572. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9573. juce_UseDebuggingNewOperator
  9574. private:
  9575. VoidArray knownFormats;
  9576. int defaultFormatIndex;
  9577. };
  9578. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9579. /********* End of inlined file: juce_AudioFormatManager.h *********/
  9580. #endif
  9581. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9582. #endif
  9583. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9584. #endif
  9585. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9586. /********* Start of inlined file: juce_AudioSubsectionReader.h *********/
  9587. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9588. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9589. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9590. {
  9591. public:
  9592. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9593. const int64 subsectionStartSample,
  9594. const int64 subsectionLength,
  9595. const bool deleteSourceWhenDeleted);
  9596. ~AudioSubsectionReader();
  9597. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9598. int64 startSampleInFile, int numSamples);
  9599. void readMaxLevels (int64 startSample,
  9600. int64 numSamples,
  9601. float& lowestLeft,
  9602. float& highestLeft,
  9603. float& lowestRight,
  9604. float& highestRight);
  9605. juce_UseDebuggingNewOperator
  9606. private:
  9607. AudioFormatReader* const source;
  9608. int64 startSample, length;
  9609. const bool deleteSourceWhenDeleted;
  9610. AudioSubsectionReader (const AudioSubsectionReader&);
  9611. const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9612. };
  9613. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9614. /********* End of inlined file: juce_AudioSubsectionReader.h *********/
  9615. #endif
  9616. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9617. /********* Start of inlined file: juce_AudioThumbnail.h *********/
  9618. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9619. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9620. class AudioThumbnailCache;
  9621. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9622. public TimeSliceClient,
  9623. private Timer
  9624. {
  9625. public:
  9626. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9627. AudioFormatManager& formatManagerToUse,
  9628. AudioThumbnailCache& cacheToUse);
  9629. ~AudioThumbnail();
  9630. void setSource (InputSource* const newSource);
  9631. void loadFrom (InputStream& input);
  9632. void saveTo (OutputStream& output) const;
  9633. int getNumChannels() const throw();
  9634. double getTotalLength() const throw();
  9635. void drawChannel (Graphics& g,
  9636. int x, int y, int w, int h,
  9637. double startTimeSeconds,
  9638. double endTimeSeconds,
  9639. int channelNum,
  9640. const float verticalZoomFactor);
  9641. bool isFullyLoaded() const throw();
  9642. bool useTimeSlice();
  9643. void timerCallback();
  9644. juce_UseDebuggingNewOperator
  9645. private:
  9646. AudioFormatManager& formatManagerToUse;
  9647. AudioThumbnailCache& cache;
  9648. ScopedPointer <InputSource> source;
  9649. CriticalSection readerLock;
  9650. ScopedPointer <AudioFormatReader> reader;
  9651. MemoryBlock data, cachedLevels;
  9652. int orginalSamplesPerThumbnailSample;
  9653. int numChannelsCached, numSamplesCached;
  9654. double cachedStart, cachedTimePerPixel;
  9655. bool cacheNeedsRefilling;
  9656. void clear();
  9657. AudioFormatReader* createReader() const;
  9658. void generateSection (AudioFormatReader& reader,
  9659. int64 startSample,
  9660. int numSamples);
  9661. char* getChannelData (int channel) const;
  9662. void refillCache (const int numSamples,
  9663. double startTime,
  9664. const double timePerPixel);
  9665. friend class AudioThumbnailCache;
  9666. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9667. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9668. // returns true if more needs to be read
  9669. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9670. };
  9671. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9672. /********* End of inlined file: juce_AudioThumbnail.h *********/
  9673. #endif
  9674. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9675. /********* Start of inlined file: juce_AudioThumbnailCache.h *********/
  9676. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9677. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9678. struct ThumbnailCacheEntry;
  9679. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9680. {
  9681. public:
  9682. AudioThumbnailCache (const int maxNumThumbsToStore);
  9683. ~AudioThumbnailCache();
  9684. void clear();
  9685. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9686. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9687. juce_UseDebuggingNewOperator
  9688. private:
  9689. OwnedArray <ThumbnailCacheEntry> thumbs;
  9690. int maxNumThumbsToStore;
  9691. friend class AudioThumbnail;
  9692. void addThumbnail (AudioThumbnail* const thumb);
  9693. void removeThumbnail (AudioThumbnail* const thumb);
  9694. };
  9695. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9696. /********* End of inlined file: juce_AudioThumbnailCache.h *********/
  9697. #endif
  9698. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9699. /********* Start of inlined file: juce_FlacAudioFormat.h *********/
  9700. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9701. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9702. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9703. class JUCE_API FlacAudioFormat : public AudioFormat
  9704. {
  9705. public:
  9706. FlacAudioFormat();
  9707. ~FlacAudioFormat();
  9708. const Array <int> getPossibleSampleRates();
  9709. const Array <int> getPossibleBitDepths();
  9710. bool canDoStereo();
  9711. bool canDoMono();
  9712. bool isCompressed();
  9713. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9714. const bool deleteStreamIfOpeningFails);
  9715. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9716. double sampleRateToUse,
  9717. unsigned int numberOfChannels,
  9718. int bitsPerSample,
  9719. const StringPairArray& metadataValues,
  9720. int qualityOptionIndex);
  9721. juce_UseDebuggingNewOperator
  9722. };
  9723. #endif
  9724. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9725. /********* End of inlined file: juce_FlacAudioFormat.h *********/
  9726. #endif
  9727. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9728. /********* Start of inlined file: juce_OggVorbisAudioFormat.h *********/
  9729. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9730. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9731. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9732. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9733. {
  9734. public:
  9735. OggVorbisAudioFormat();
  9736. ~OggVorbisAudioFormat();
  9737. const Array <int> getPossibleSampleRates();
  9738. const Array <int> getPossibleBitDepths();
  9739. bool canDoStereo();
  9740. bool canDoMono();
  9741. bool isCompressed();
  9742. const StringArray getQualityOptions();
  9743. int estimateOggFileQuality (const File& source);
  9744. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9745. const bool deleteStreamIfOpeningFails);
  9746. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9747. double sampleRateToUse,
  9748. unsigned int numberOfChannels,
  9749. int bitsPerSample,
  9750. const StringPairArray& metadataValues,
  9751. int qualityOptionIndex);
  9752. juce_UseDebuggingNewOperator
  9753. };
  9754. #endif
  9755. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9756. /********* End of inlined file: juce_OggVorbisAudioFormat.h *********/
  9757. #endif
  9758. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9759. /********* Start of inlined file: juce_QuickTimeAudioFormat.h *********/
  9760. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9761. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9762. #if JUCE_QUICKTIME
  9763. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  9764. {
  9765. public:
  9766. QuickTimeAudioFormat();
  9767. ~QuickTimeAudioFormat();
  9768. const Array <int> getPossibleSampleRates();
  9769. const Array <int> getPossibleBitDepths();
  9770. bool canDoStereo();
  9771. bool canDoMono();
  9772. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9773. const bool deleteStreamIfOpeningFails);
  9774. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9775. double sampleRateToUse,
  9776. unsigned int numberOfChannels,
  9777. int bitsPerSample,
  9778. const StringPairArray& metadataValues,
  9779. int qualityOptionIndex);
  9780. juce_UseDebuggingNewOperator
  9781. };
  9782. #endif
  9783. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9784. /********* End of inlined file: juce_QuickTimeAudioFormat.h *********/
  9785. #endif
  9786. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9787. /********* Start of inlined file: juce_WavAudioFormat.h *********/
  9788. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9789. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9790. class JUCE_API WavAudioFormat : public AudioFormat
  9791. {
  9792. public:
  9793. WavAudioFormat();
  9794. ~WavAudioFormat();
  9795. static const tchar* const bwavDescription;
  9796. static const tchar* const bwavOriginator;
  9797. static const tchar* const bwavOriginatorRef;
  9798. static const tchar* const bwavOriginationDate;
  9799. static const tchar* const bwavOriginationTime;
  9800. static const tchar* const bwavTimeReference;
  9801. static const tchar* const bwavCodingHistory;
  9802. static const StringPairArray createBWAVMetadata (const String& description,
  9803. const String& originator,
  9804. const String& originatorRef,
  9805. const Time& dateAndTime,
  9806. const int64 timeReferenceSamples,
  9807. const String& codingHistory);
  9808. const Array <int> getPossibleSampleRates();
  9809. const Array <int> getPossibleBitDepths();
  9810. bool canDoStereo();
  9811. bool canDoMono();
  9812. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9813. const bool deleteStreamIfOpeningFails);
  9814. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9815. double sampleRateToUse,
  9816. unsigned int numberOfChannels,
  9817. int bitsPerSample,
  9818. const StringPairArray& metadataValues,
  9819. int qualityOptionIndex);
  9820. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  9821. juce_UseDebuggingNewOperator
  9822. };
  9823. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9824. /********* End of inlined file: juce_WavAudioFormat.h *********/
  9825. #endif
  9826. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9827. /********* Start of inlined file: juce_AudioFormatReaderSource.h *********/
  9828. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9829. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9830. /********* Start of inlined file: juce_PositionableAudioSource.h *********/
  9831. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9832. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9833. class JUCE_API PositionableAudioSource : public AudioSource
  9834. {
  9835. protected:
  9836. PositionableAudioSource() throw() {}
  9837. public:
  9838. ~PositionableAudioSource() {}
  9839. virtual void setNextReadPosition (int newPosition) = 0;
  9840. virtual int getNextReadPosition() const = 0;
  9841. virtual int getTotalLength() const = 0;
  9842. virtual bool isLooping() const = 0;
  9843. };
  9844. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  9845. /********* End of inlined file: juce_PositionableAudioSource.h *********/
  9846. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  9847. {
  9848. public:
  9849. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  9850. const bool deleteReaderWhenThisIsDeleted);
  9851. ~AudioFormatReaderSource();
  9852. void setLooping (const bool shouldLoop) throw();
  9853. bool isLooping() const { return looping; }
  9854. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  9855. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9856. void releaseResources();
  9857. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9858. void setNextReadPosition (int newPosition);
  9859. int getNextReadPosition() const;
  9860. int getTotalLength() const;
  9861. juce_UseDebuggingNewOperator
  9862. private:
  9863. AudioFormatReader* reader;
  9864. bool deleteReader;
  9865. int volatile nextPlayPos;
  9866. bool volatile looping;
  9867. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  9868. AudioFormatReaderSource (const AudioFormatReaderSource&);
  9869. const AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  9870. };
  9871. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  9872. /********* End of inlined file: juce_AudioFormatReaderSource.h *********/
  9873. #endif
  9874. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9875. #endif
  9876. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9877. /********* Start of inlined file: juce_AudioSourcePlayer.h *********/
  9878. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9879. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9880. /********* Start of inlined file: juce_AudioIODevice.h *********/
  9881. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9882. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9883. class AudioIODevice;
  9884. class JUCE_API AudioIODeviceCallback
  9885. {
  9886. public:
  9887. virtual ~AudioIODeviceCallback() {}
  9888. virtual void audioDeviceIOCallback (const float** inputChannelData,
  9889. int numInputChannels,
  9890. float** outputChannelData,
  9891. int numOutputChannels,
  9892. int numSamples) = 0;
  9893. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  9894. virtual void audioDeviceStopped() = 0;
  9895. };
  9896. class JUCE_API AudioIODevice
  9897. {
  9898. public:
  9899. virtual ~AudioIODevice();
  9900. const String& getName() const throw() { return name; }
  9901. const String& getTypeName() const throw() { return typeName; }
  9902. virtual const StringArray getOutputChannelNames() = 0;
  9903. virtual const StringArray getInputChannelNames() = 0;
  9904. virtual int getNumSampleRates() = 0;
  9905. virtual double getSampleRate (int index) = 0;
  9906. virtual int getNumBufferSizesAvailable() = 0;
  9907. virtual int getBufferSizeSamples (int index) = 0;
  9908. virtual int getDefaultBufferSize() = 0;
  9909. virtual const String open (const BitArray& inputChannels,
  9910. const BitArray& outputChannels,
  9911. double sampleRate,
  9912. int bufferSizeSamples) = 0;
  9913. virtual void close() = 0;
  9914. virtual bool isOpen() = 0;
  9915. virtual void start (AudioIODeviceCallback* callback) = 0;
  9916. virtual void stop() = 0;
  9917. virtual bool isPlaying() = 0;
  9918. virtual const String getLastError() = 0;
  9919. virtual int getCurrentBufferSizeSamples() = 0;
  9920. virtual double getCurrentSampleRate() = 0;
  9921. virtual int getCurrentBitDepth() = 0;
  9922. virtual const BitArray getActiveOutputChannels() const = 0;
  9923. virtual const BitArray getActiveInputChannels() const = 0;
  9924. virtual int getOutputLatencyInSamples() = 0;
  9925. virtual int getInputLatencyInSamples() = 0;
  9926. virtual bool hasControlPanel() const;
  9927. virtual bool showControlPanel();
  9928. protected:
  9929. AudioIODevice (const String& deviceName,
  9930. const String& typeName);
  9931. String name, typeName;
  9932. };
  9933. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  9934. /********* End of inlined file: juce_AudioIODevice.h *********/
  9935. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  9936. {
  9937. public:
  9938. AudioSourcePlayer();
  9939. virtual ~AudioSourcePlayer();
  9940. void setSource (AudioSource* newSource);
  9941. AudioSource* getCurrentSource() const throw() { return source; }
  9942. void setGain (const float newGain) throw();
  9943. void audioDeviceIOCallback (const float** inputChannelData,
  9944. int totalNumInputChannels,
  9945. float** outputChannelData,
  9946. int totalNumOutputChannels,
  9947. int numSamples);
  9948. void audioDeviceAboutToStart (AudioIODevice* device);
  9949. void audioDeviceStopped();
  9950. juce_UseDebuggingNewOperator
  9951. private:
  9952. CriticalSection readLock;
  9953. AudioSource* source;
  9954. double sampleRate;
  9955. int bufferSize;
  9956. float* channels [128];
  9957. float* outputChans [128];
  9958. const float* inputChans [128];
  9959. AudioSampleBuffer tempBuffer;
  9960. float lastGain, gain;
  9961. AudioSourcePlayer (const AudioSourcePlayer&);
  9962. const AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  9963. };
  9964. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  9965. /********* End of inlined file: juce_AudioSourcePlayer.h *********/
  9966. #endif
  9967. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9968. /********* Start of inlined file: juce_AudioTransportSource.h *********/
  9969. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9970. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  9971. /********* Start of inlined file: juce_BufferingAudioSource.h *********/
  9972. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  9973. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  9974. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  9975. {
  9976. public:
  9977. BufferingAudioSource (PositionableAudioSource* source,
  9978. const bool deleteSourceWhenDeleted,
  9979. int numberOfSamplesToBuffer);
  9980. ~BufferingAudioSource();
  9981. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  9982. void releaseResources();
  9983. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  9984. void setNextReadPosition (int newPosition);
  9985. int getNextReadPosition() const;
  9986. int getTotalLength() const { return source->getTotalLength(); }
  9987. bool isLooping() const { return source->isLooping(); }
  9988. juce_UseDebuggingNewOperator
  9989. private:
  9990. PositionableAudioSource* source;
  9991. bool deleteSourceWhenDeleted;
  9992. int numberOfSamplesToBuffer;
  9993. AudioSampleBuffer buffer;
  9994. CriticalSection bufferStartPosLock;
  9995. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  9996. bool wasSourceLooping;
  9997. double volatile sampleRate;
  9998. friend class SharedBufferingAudioSourceThread;
  9999. bool readNextBufferChunk();
  10000. void readBufferSection (int start, int length, int bufferOffset);
  10001. BufferingAudioSource (const BufferingAudioSource&);
  10002. const BufferingAudioSource& operator= (const BufferingAudioSource&);
  10003. };
  10004. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10005. /********* End of inlined file: juce_BufferingAudioSource.h *********/
  10006. /********* Start of inlined file: juce_ResamplingAudioSource.h *********/
  10007. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10008. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10009. class JUCE_API ResamplingAudioSource : public AudioSource
  10010. {
  10011. public:
  10012. ResamplingAudioSource (AudioSource* const inputSource,
  10013. const bool deleteInputWhenDeleted);
  10014. ~ResamplingAudioSource();
  10015. void setResamplingRatio (const double samplesInPerOutputSample);
  10016. double getResamplingRatio() const throw() { return ratio; }
  10017. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10018. void releaseResources();
  10019. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10020. juce_UseDebuggingNewOperator
  10021. private:
  10022. AudioSource* const input;
  10023. const bool deleteInputWhenDeleted;
  10024. double ratio, lastRatio;
  10025. AudioSampleBuffer buffer;
  10026. int bufferPos, sampsInBuffer;
  10027. double subSampleOffset;
  10028. double coefficients[6];
  10029. CriticalSection ratioLock;
  10030. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10031. void createLowPass (const double proportionalRate);
  10032. struct FilterState
  10033. {
  10034. double x1, x2, y1, y2;
  10035. };
  10036. FilterState filterStates[2];
  10037. void resetFilters();
  10038. void applyFilter (float* samples, int num, FilterState& fs);
  10039. ResamplingAudioSource (const ResamplingAudioSource&);
  10040. const ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10041. };
  10042. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10043. /********* End of inlined file: juce_ResamplingAudioSource.h *********/
  10044. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10045. public ChangeBroadcaster
  10046. {
  10047. public:
  10048. AudioTransportSource();
  10049. ~AudioTransportSource();
  10050. void setSource (PositionableAudioSource* const newSource,
  10051. int readAheadBufferSize = 0,
  10052. double sourceSampleRateToCorrectFor = 0.0);
  10053. void setPosition (double newPosition);
  10054. double getCurrentPosition() const;
  10055. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10056. void start();
  10057. void stop();
  10058. bool isPlaying() const throw() { return playing; }
  10059. void setGain (const float newGain) throw();
  10060. float getGain() const throw() { return gain; }
  10061. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10062. void releaseResources();
  10063. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10064. void setNextReadPosition (int newPosition);
  10065. int getNextReadPosition() const;
  10066. int getTotalLength() const;
  10067. bool isLooping() const;
  10068. juce_UseDebuggingNewOperator
  10069. private:
  10070. PositionableAudioSource* source;
  10071. ResamplingAudioSource* resamplerSource;
  10072. BufferingAudioSource* bufferingSource;
  10073. PositionableAudioSource* positionableSource;
  10074. AudioSource* masterSource;
  10075. CriticalSection callbackLock;
  10076. float volatile gain, lastGain;
  10077. bool volatile playing, stopped;
  10078. double sampleRate, sourceSampleRate;
  10079. int blockSize, readAheadBufferSize;
  10080. bool isPrepared, inputStreamEOF;
  10081. AudioTransportSource (const AudioTransportSource&);
  10082. const AudioTransportSource& operator= (const AudioTransportSource&);
  10083. };
  10084. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10085. /********* End of inlined file: juce_AudioTransportSource.h *********/
  10086. #endif
  10087. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10088. #endif
  10089. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10090. /********* Start of inlined file: juce_ChannelRemappingAudioSource.h *********/
  10091. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10092. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10093. class ChannelRemappingAudioSource : public AudioSource
  10094. {
  10095. public:
  10096. ChannelRemappingAudioSource (AudioSource* const source,
  10097. const bool deleteSourceWhenDeleted);
  10098. ~ChannelRemappingAudioSource();
  10099. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10100. void clearAllMappings() throw();
  10101. void setInputChannelMapping (const int destChannelIndex,
  10102. const int sourceChannelIndex) throw();
  10103. void setOutputChannelMapping (const int sourceChannelIndex,
  10104. const int destChannelIndex) throw();
  10105. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10106. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10107. XmlElement* createXml() const throw();
  10108. void restoreFromXml (const XmlElement& e) throw();
  10109. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10110. void releaseResources();
  10111. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10112. juce_UseDebuggingNewOperator
  10113. private:
  10114. int requiredNumberOfChannels;
  10115. Array <int> remappedInputs, remappedOutputs;
  10116. AudioSource* const source;
  10117. const bool deleteSourceWhenDeleted;
  10118. AudioSampleBuffer buffer;
  10119. AudioSourceChannelInfo remappedInfo;
  10120. CriticalSection lock;
  10121. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10122. const ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10123. };
  10124. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10125. /********* End of inlined file: juce_ChannelRemappingAudioSource.h *********/
  10126. #endif
  10127. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10128. /********* Start of inlined file: juce_IIRFilterAudioSource.h *********/
  10129. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10130. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10131. /********* Start of inlined file: juce_IIRFilter.h *********/
  10132. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10133. #define __JUCE_IIRFILTER_JUCEHEADER__
  10134. class JUCE_API IIRFilter
  10135. {
  10136. public:
  10137. IIRFilter() throw();
  10138. IIRFilter (const IIRFilter& other) throw();
  10139. ~IIRFilter() throw();
  10140. void reset() throw();
  10141. void processSamples (float* const samples,
  10142. const int numSamples) throw();
  10143. float processSingleSampleRaw (const float sample) throw();
  10144. void makeLowPass (const double sampleRate,
  10145. const double frequency) throw();
  10146. void makeHighPass (const double sampleRate,
  10147. const double frequency) throw();
  10148. void makeLowShelf (const double sampleRate,
  10149. const double cutOffFrequency,
  10150. const double Q,
  10151. const float gainFactor) throw();
  10152. void makeHighShelf (const double sampleRate,
  10153. const double cutOffFrequency,
  10154. const double Q,
  10155. const float gainFactor) throw();
  10156. void makeBandPass (const double sampleRate,
  10157. const double centreFrequency,
  10158. const double Q,
  10159. const float gainFactor) throw();
  10160. void makeInactive() throw();
  10161. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10162. juce_UseDebuggingNewOperator
  10163. protected:
  10164. CriticalSection processLock;
  10165. void setCoefficients (double c1, double c2, double c3,
  10166. double c4, double c5, double c6) throw();
  10167. bool active;
  10168. float coefficients[6];
  10169. float x1, x2, y1, y2;
  10170. // (use the copyCoefficientsFrom() method instead of this operator)
  10171. const IIRFilter& operator= (const IIRFilter&);
  10172. };
  10173. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10174. /********* End of inlined file: juce_IIRFilter.h *********/
  10175. class JUCE_API IIRFilterAudioSource : public AudioSource
  10176. {
  10177. public:
  10178. IIRFilterAudioSource (AudioSource* const inputSource,
  10179. const bool deleteInputWhenDeleted);
  10180. ~IIRFilterAudioSource();
  10181. void setFilterParameters (const IIRFilter& newSettings);
  10182. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10183. void releaseResources();
  10184. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10185. juce_UseDebuggingNewOperator
  10186. private:
  10187. AudioSource* const input;
  10188. const bool deleteInputWhenDeleted;
  10189. OwnedArray <IIRFilter> iirFilters;
  10190. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10191. const IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10192. };
  10193. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10194. /********* End of inlined file: juce_IIRFilterAudioSource.h *********/
  10195. #endif
  10196. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10197. /********* Start of inlined file: juce_MixerAudioSource.h *********/
  10198. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10199. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10200. class JUCE_API MixerAudioSource : public AudioSource
  10201. {
  10202. public:
  10203. MixerAudioSource();
  10204. ~MixerAudioSource();
  10205. void addInputSource (AudioSource* newInput,
  10206. const bool deleteWhenRemoved);
  10207. void removeInputSource (AudioSource* input,
  10208. const bool deleteSource);
  10209. void removeAllInputs();
  10210. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10211. void releaseResources();
  10212. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10213. juce_UseDebuggingNewOperator
  10214. private:
  10215. VoidArray inputs;
  10216. BitArray inputsToDelete;
  10217. CriticalSection lock;
  10218. AudioSampleBuffer tempBuffer;
  10219. double currentSampleRate;
  10220. int bufferSizeExpected;
  10221. MixerAudioSource (const MixerAudioSource&);
  10222. const MixerAudioSource& operator= (const MixerAudioSource&);
  10223. };
  10224. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10225. /********* End of inlined file: juce_MixerAudioSource.h *********/
  10226. #endif
  10227. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10228. #endif
  10229. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10230. #endif
  10231. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10232. /********* Start of inlined file: juce_ToneGeneratorAudioSource.h *********/
  10233. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10234. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10235. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10236. {
  10237. public:
  10238. ToneGeneratorAudioSource();
  10239. ~ToneGeneratorAudioSource();
  10240. void setAmplitude (const float newAmplitude);
  10241. void setFrequency (const double newFrequencyHz);
  10242. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10243. void releaseResources();
  10244. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10245. juce_UseDebuggingNewOperator
  10246. private:
  10247. double frequency, sampleRate;
  10248. double currentPhase, phasePerSample;
  10249. float amplitude;
  10250. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10251. const ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10252. };
  10253. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10254. /********* End of inlined file: juce_ToneGeneratorAudioSource.h *********/
  10255. #endif
  10256. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10257. /********* Start of inlined file: juce_AudioDeviceManager.h *********/
  10258. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10259. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10260. /********* Start of inlined file: juce_AudioIODeviceType.h *********/
  10261. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10262. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10263. class AudioDeviceManager;
  10264. class Component;
  10265. class JUCE_API AudioIODeviceType
  10266. {
  10267. public:
  10268. const String& getTypeName() const throw() { return typeName; }
  10269. virtual void scanForDevices() = 0;
  10270. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10271. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10272. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10273. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10274. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10275. const String& inputDeviceName) = 0;
  10276. struct DeviceSetupDetails
  10277. {
  10278. AudioDeviceManager* manager;
  10279. int minNumInputChannels, maxNumInputChannels;
  10280. int minNumOutputChannels, maxNumOutputChannels;
  10281. bool useStereoPairs;
  10282. };
  10283. virtual ~AudioIODeviceType();
  10284. protected:
  10285. AudioIODeviceType (const tchar* const typeName);
  10286. private:
  10287. String typeName;
  10288. AudioIODeviceType (const AudioIODeviceType&);
  10289. const AudioIODeviceType& operator= (const AudioIODeviceType&);
  10290. };
  10291. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10292. /********* End of inlined file: juce_AudioIODeviceType.h *********/
  10293. /********* Start of inlined file: juce_MidiInput.h *********/
  10294. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10295. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10296. /********* Start of inlined file: juce_MidiMessage.h *********/
  10297. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10298. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10299. class JUCE_API MidiMessage
  10300. {
  10301. public:
  10302. MidiMessage (const int byte1,
  10303. const int byte2,
  10304. const int byte3,
  10305. const double timeStamp = 0) throw();
  10306. MidiMessage (const int byte1,
  10307. const int byte2,
  10308. const double timeStamp = 0) throw();
  10309. MidiMessage (const int byte1,
  10310. const double timeStamp = 0) throw();
  10311. MidiMessage (const uint8* const data,
  10312. const int dataSize,
  10313. const double timeStamp = 0) throw();
  10314. MidiMessage (const uint8* data,
  10315. int size,
  10316. int& numBytesUsed,
  10317. uint8 lastStatusByte,
  10318. double timeStamp = 0) throw();
  10319. MidiMessage (const MidiMessage& other) throw();
  10320. MidiMessage (const MidiMessage& other,
  10321. const double newTimeStamp) throw();
  10322. ~MidiMessage() throw();
  10323. const MidiMessage& operator= (const MidiMessage& other) throw();
  10324. uint8* getRawData() const throw() { return data; }
  10325. int getRawDataSize() const throw() { return size; }
  10326. double getTimeStamp() const throw() { return timeStamp; }
  10327. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10328. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10329. int getChannel() const throw();
  10330. bool isForChannel (const int channelNumber) const throw();
  10331. void setChannel (const int newChannelNumber) throw();
  10332. bool isSysEx() const throw();
  10333. const uint8* getSysExData() const throw();
  10334. int getSysExDataSize() const throw();
  10335. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10336. static const MidiMessage noteOn (const int channel,
  10337. const int noteNumber,
  10338. const float velocity) throw();
  10339. static const MidiMessage noteOn (const int channel,
  10340. const int noteNumber,
  10341. const uint8 velocity) throw();
  10342. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10343. static const MidiMessage noteOff (const int channel,
  10344. const int noteNumber) throw();
  10345. bool isNoteOnOrOff() const throw();
  10346. int getNoteNumber() const throw();
  10347. void setNoteNumber (const int newNoteNumber) throw();
  10348. uint8 getVelocity() const throw();
  10349. float getFloatVelocity() const throw();
  10350. void setVelocity (const float newVelocity) throw();
  10351. void multiplyVelocity (const float scaleFactor) throw();
  10352. bool isProgramChange() const throw();
  10353. int getProgramChangeNumber() const throw();
  10354. static const MidiMessage programChange (const int channel,
  10355. const int programNumber) throw();
  10356. bool isPitchWheel() const throw();
  10357. int getPitchWheelValue() const throw();
  10358. static const MidiMessage pitchWheel (const int channel,
  10359. const int position) throw();
  10360. bool isAftertouch() const throw();
  10361. int getAfterTouchValue() const throw();
  10362. static const MidiMessage aftertouchChange (const int channel,
  10363. const int noteNumber,
  10364. const int aftertouchAmount) throw();
  10365. bool isChannelPressure() const throw();
  10366. int getChannelPressureValue() const throw();
  10367. static const MidiMessage channelPressureChange (const int channel,
  10368. const int pressure) throw();
  10369. bool isController() const throw();
  10370. int getControllerNumber() const throw();
  10371. int getControllerValue() const throw();
  10372. static const MidiMessage controllerEvent (const int channel,
  10373. const int controllerType,
  10374. const int value) throw();
  10375. bool isAllNotesOff() const throw();
  10376. bool isAllSoundOff() const throw();
  10377. static const MidiMessage allNotesOff (const int channel) throw();
  10378. static const MidiMessage allSoundOff (const int channel) throw();
  10379. static const MidiMessage allControllersOff (const int channel) throw();
  10380. bool isMetaEvent() const throw();
  10381. int getMetaEventType() const throw();
  10382. const uint8* getMetaEventData() const throw();
  10383. int getMetaEventLength() const throw();
  10384. bool isTrackMetaEvent() const throw();
  10385. bool isEndOfTrackMetaEvent() const throw();
  10386. static const MidiMessage endOfTrack() throw();
  10387. bool isTrackNameEvent() const throw();
  10388. bool isTextMetaEvent() const throw();
  10389. const String getTextFromTextMetaEvent() const throw();
  10390. bool isTempoMetaEvent() const throw();
  10391. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10392. double getTempoSecondsPerQuarterNote() const throw();
  10393. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10394. bool isTimeSignatureMetaEvent() const throw();
  10395. void getTimeSignatureInfo (int& numerator,
  10396. int& denominator) const throw();
  10397. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10398. const int denominator) throw();
  10399. bool isKeySignatureMetaEvent() const throw();
  10400. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10401. bool isMidiChannelMetaEvent() const throw();
  10402. int getMidiChannelMetaEventChannel() const throw();
  10403. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10404. bool isActiveSense() const throw();
  10405. bool isMidiStart() const throw();
  10406. static const MidiMessage midiStart() throw();
  10407. bool isMidiContinue() const throw();
  10408. static const MidiMessage midiContinue() throw();
  10409. bool isMidiStop() const throw();
  10410. static const MidiMessage midiStop() throw();
  10411. bool isMidiClock() const throw();
  10412. static const MidiMessage midiClock() throw();
  10413. bool isSongPositionPointer() const throw();
  10414. int getSongPositionPointerMidiBeat() const throw();
  10415. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10416. bool isQuarterFrame() const throw();
  10417. int getQuarterFrameSequenceNumber() const throw();
  10418. int getQuarterFrameValue() const throw();
  10419. static const MidiMessage quarterFrame (const int sequenceNumber,
  10420. const int value) throw();
  10421. enum SmpteTimecodeType
  10422. {
  10423. fps24 = 0,
  10424. fps25 = 1,
  10425. fps30drop = 2,
  10426. fps30 = 3
  10427. };
  10428. bool isFullFrame() const throw();
  10429. void getFullFrameParameters (int& hours,
  10430. int& minutes,
  10431. int& seconds,
  10432. int& frames,
  10433. SmpteTimecodeType& timecodeType) const throw();
  10434. static const MidiMessage fullFrame (const int hours,
  10435. const int minutes,
  10436. const int seconds,
  10437. const int frames,
  10438. SmpteTimecodeType timecodeType);
  10439. enum MidiMachineControlCommand
  10440. {
  10441. mmc_stop = 1,
  10442. mmc_play = 2,
  10443. mmc_deferredplay = 3,
  10444. mmc_fastforward = 4,
  10445. mmc_rewind = 5,
  10446. mmc_recordStart = 6,
  10447. mmc_recordStop = 7,
  10448. mmc_pause = 9
  10449. };
  10450. bool isMidiMachineControlMessage() const throw();
  10451. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10452. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10453. bool isMidiMachineControlGoto (int& hours,
  10454. int& minutes,
  10455. int& seconds,
  10456. int& frames) const throw();
  10457. static const MidiMessage midiMachineControlGoto (int hours,
  10458. int minutes,
  10459. int seconds,
  10460. int frames);
  10461. static const MidiMessage masterVolume (const float volume) throw();
  10462. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10463. const int dataSize) throw();
  10464. static int readVariableLengthVal (const uint8* data,
  10465. int& numBytesUsed) throw();
  10466. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10467. static const String getMidiNoteName (int noteNumber,
  10468. bool useSharps,
  10469. bool includeOctaveNumber,
  10470. int octaveNumForMiddleC) throw();
  10471. static const double getMidiNoteInHertz (int noteNumber) throw();
  10472. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10473. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10474. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10475. static const String getControllerName (int controllerNumber) throw();
  10476. juce_UseDebuggingNewOperator
  10477. private:
  10478. double timeStamp;
  10479. uint8* data;
  10480. int message, size;
  10481. };
  10482. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10483. /********* End of inlined file: juce_MidiMessage.h *********/
  10484. class MidiInput;
  10485. class JUCE_API MidiInputCallback
  10486. {
  10487. public:
  10488. virtual ~MidiInputCallback() {}
  10489. virtual void handleIncomingMidiMessage (MidiInput* source,
  10490. const MidiMessage& message) = 0;
  10491. virtual void handlePartialSysexMessage (MidiInput* source,
  10492. const uint8* messageData,
  10493. const int numBytesSoFar,
  10494. const double timestamp)
  10495. {
  10496. // (this bit is just to avoid compiler warnings about unused variables)
  10497. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10498. }
  10499. };
  10500. class JUCE_API MidiInput
  10501. {
  10502. public:
  10503. static const StringArray getDevices();
  10504. static int getDefaultDeviceIndex();
  10505. static MidiInput* openDevice (int deviceIndex,
  10506. MidiInputCallback* callback);
  10507. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10508. static MidiInput* createNewDevice (const String& deviceName,
  10509. MidiInputCallback* callback);
  10510. #endif
  10511. virtual ~MidiInput();
  10512. virtual const String getName() const throw() { return name; }
  10513. virtual void setName (const String& newName) throw() { name = newName; }
  10514. virtual void start();
  10515. virtual void stop();
  10516. juce_UseDebuggingNewOperator
  10517. protected:
  10518. String name;
  10519. void* internal;
  10520. MidiInput (const String& name);
  10521. MidiInput (const MidiInput&);
  10522. };
  10523. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10524. /********* End of inlined file: juce_MidiInput.h *********/
  10525. /********* Start of inlined file: juce_MidiOutput.h *********/
  10526. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10527. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10528. /********* Start of inlined file: juce_MidiBuffer.h *********/
  10529. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10530. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10531. class JUCE_API MidiBuffer
  10532. {
  10533. public:
  10534. MidiBuffer() throw();
  10535. MidiBuffer (const MidiMessage& message) throw();
  10536. MidiBuffer (const MidiBuffer& other) throw();
  10537. const MidiBuffer& operator= (const MidiBuffer& other) throw();
  10538. ~MidiBuffer() throw();
  10539. void clear() throw();
  10540. void clear (const int start,
  10541. const int numSamples) throw();
  10542. bool isEmpty() const throw();
  10543. int getNumEvents() const throw();
  10544. void addEvent (const MidiMessage& midiMessage,
  10545. const int sampleNumber) throw();
  10546. void addEvent (const uint8* const rawMidiData,
  10547. const int maxBytesOfMidiData,
  10548. const int sampleNumber) throw();
  10549. void addEvents (const MidiBuffer& otherBuffer,
  10550. const int startSample,
  10551. const int numSamples,
  10552. const int sampleDeltaToAdd) throw();
  10553. int getFirstEventTime() const throw();
  10554. int getLastEventTime() const throw();
  10555. void swap (MidiBuffer& other);
  10556. class Iterator
  10557. {
  10558. public:
  10559. Iterator (const MidiBuffer& buffer) throw();
  10560. ~Iterator() throw();
  10561. void setNextSamplePosition (const int samplePosition) throw();
  10562. bool getNextEvent (MidiMessage& result,
  10563. int& samplePosition) throw();
  10564. bool getNextEvent (const uint8* &midiData,
  10565. int& numBytesOfMidiData,
  10566. int& samplePosition) throw();
  10567. juce_UseDebuggingNewOperator
  10568. private:
  10569. const MidiBuffer& buffer;
  10570. const uint8* data;
  10571. Iterator (const Iterator&);
  10572. const Iterator& operator= (const Iterator&);
  10573. };
  10574. juce_UseDebuggingNewOperator
  10575. private:
  10576. friend class MidiBuffer::Iterator;
  10577. MemoryBlock data;
  10578. int bytesUsed;
  10579. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10580. };
  10581. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10582. /********* End of inlined file: juce_MidiBuffer.h *********/
  10583. class JUCE_API MidiOutput : private Thread
  10584. {
  10585. public:
  10586. static const StringArray getDevices();
  10587. static int getDefaultDeviceIndex();
  10588. static MidiOutput* openDevice (int deviceIndex);
  10589. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10590. static MidiOutput* createNewDevice (const String& deviceName);
  10591. #endif
  10592. virtual ~MidiOutput();
  10593. virtual void sendMessageNow (const MidiMessage& message);
  10594. virtual void reset();
  10595. virtual bool getVolume (float& leftVol,
  10596. float& rightVol);
  10597. virtual void setVolume (float leftVol,
  10598. float rightVol);
  10599. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10600. const double millisecondCounterToStartAt,
  10601. double samplesPerSecondForBuffer) throw();
  10602. virtual void clearAllPendingMessages() throw();
  10603. virtual void startBackgroundThread() throw();
  10604. virtual void stopBackgroundThread() throw();
  10605. juce_UseDebuggingNewOperator
  10606. protected:
  10607. void* internal;
  10608. struct PendingMessage
  10609. {
  10610. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10611. MidiMessage message;
  10612. PendingMessage* next;
  10613. juce_UseDebuggingNewOperator
  10614. };
  10615. CriticalSection lock;
  10616. PendingMessage* firstMessage;
  10617. MidiOutput() throw();
  10618. MidiOutput (const MidiOutput&);
  10619. void run();
  10620. };
  10621. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10622. /********* End of inlined file: juce_MidiOutput.h *********/
  10623. /********* Start of inlined file: juce_ComboBox.h *********/
  10624. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10625. #define __JUCE_COMBOBOX_JUCEHEADER__
  10626. /********* Start of inlined file: juce_Label.h *********/
  10627. #ifndef __JUCE_LABEL_JUCEHEADER__
  10628. #define __JUCE_LABEL_JUCEHEADER__
  10629. /********* Start of inlined file: juce_ComponentDeletionWatcher.h *********/
  10630. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10631. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10632. class JUCE_API ComponentDeletionWatcher
  10633. {
  10634. public:
  10635. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  10636. ~ComponentDeletionWatcher() throw();
  10637. bool hasBeenDeleted() const throw();
  10638. const Component* getComponent() const throw();
  10639. juce_UseDebuggingNewOperator
  10640. private:
  10641. const Component* const componentToWatch;
  10642. const uint32 componentUID;
  10643. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  10644. const ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  10645. };
  10646. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10647. /********* End of inlined file: juce_ComponentDeletionWatcher.h *********/
  10648. /********* Start of inlined file: juce_TextEditor.h *********/
  10649. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10650. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10651. /********* Start of inlined file: juce_Viewport.h *********/
  10652. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10653. #define __JUCE_VIEWPORT_JUCEHEADER__
  10654. /********* Start of inlined file: juce_ScrollBar.h *********/
  10655. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10656. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10657. /********* Start of inlined file: juce_Button.h *********/
  10658. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10659. #define __JUCE_BUTTON_JUCEHEADER__
  10660. /********* Start of inlined file: juce_TooltipWindow.h *********/
  10661. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10662. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10663. /********* Start of inlined file: juce_TooltipClient.h *********/
  10664. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10665. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10666. class JUCE_API TooltipClient
  10667. {
  10668. public:
  10669. virtual ~TooltipClient() {}
  10670. virtual const String getTooltip() = 0;
  10671. };
  10672. class JUCE_API SettableTooltipClient : public TooltipClient
  10673. {
  10674. public:
  10675. virtual ~SettableTooltipClient() {}
  10676. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10677. virtual const String getTooltip() { return tooltipString; }
  10678. juce_UseDebuggingNewOperator
  10679. protected:
  10680. String tooltipString;
  10681. };
  10682. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10683. /********* End of inlined file: juce_TooltipClient.h *********/
  10684. class JUCE_API TooltipWindow : public Component,
  10685. private Timer
  10686. {
  10687. public:
  10688. TooltipWindow (Component* parentComponent = 0,
  10689. const int millisecondsBeforeTipAppears = 700);
  10690. ~TooltipWindow();
  10691. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10692. enum ColourIds
  10693. {
  10694. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10695. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10696. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10697. };
  10698. juce_UseDebuggingNewOperator
  10699. private:
  10700. int millisecondsBeforeTipAppears;
  10701. int mouseX, mouseY, mouseClicks;
  10702. unsigned int lastCompChangeTime, lastHideTime;
  10703. Component* lastComponentUnderMouse;
  10704. bool changedCompsSinceShown;
  10705. String tipShowing, lastTipUnderMouse;
  10706. void paint (Graphics& g);
  10707. void mouseEnter (const MouseEvent& e);
  10708. void timerCallback();
  10709. static const String getTipFor (Component* const c);
  10710. void showFor (const String& tip);
  10711. void hide();
  10712. TooltipWindow (const TooltipWindow&);
  10713. const TooltipWindow& operator= (const TooltipWindow&);
  10714. };
  10715. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10716. /********* End of inlined file: juce_TooltipWindow.h *********/
  10717. class Button;
  10718. class JUCE_API ButtonListener
  10719. {
  10720. public:
  10721. virtual ~ButtonListener() {}
  10722. virtual void buttonClicked (Button* button) = 0;
  10723. virtual void buttonStateChanged (Button*) {}
  10724. };
  10725. class JUCE_API Button : public Component,
  10726. public SettableTooltipClient,
  10727. public ApplicationCommandManagerListener,
  10728. public Value::Listener,
  10729. private KeyListener
  10730. {
  10731. protected:
  10732. Button (const String& buttonName);
  10733. public:
  10734. virtual ~Button();
  10735. void setButtonText (const String& newText) throw();
  10736. const String getButtonText() const throw() { return text; }
  10737. bool isDown() const throw();
  10738. bool isOver() const throw();
  10739. void setToggleState (const bool shouldBeOn,
  10740. const bool sendChangeNotification);
  10741. bool getToggleState() const throw() { return isOn.getValue(); }
  10742. Value& getToggleStateValue() { return isOn; }
  10743. void setClickingTogglesState (const bool shouldToggle) throw();
  10744. bool getClickingTogglesState() const throw();
  10745. void setRadioGroupId (const int newGroupId);
  10746. int getRadioGroupId() const throw() { return radioGroupId; }
  10747. void addButtonListener (ButtonListener* const newListener) throw();
  10748. void removeButtonListener (ButtonListener* const listener) throw();
  10749. virtual void triggerClick();
  10750. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10751. const int commandID,
  10752. const bool generateTooltip);
  10753. int getCommandID() const throw() { return commandID; }
  10754. void addShortcut (const KeyPress& key);
  10755. void clearShortcuts();
  10756. bool isRegisteredForShortcut (const KeyPress& key) const throw();
  10757. void setRepeatSpeed (const int initialDelayInMillisecs,
  10758. const int repeatDelayInMillisecs,
  10759. const int minimumDelayInMillisecs = -1) throw();
  10760. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  10761. uint32 getMillisecondsSinceButtonDown() const throw();
  10762. void setVisible (bool shouldBeVisible);
  10763. void setTooltip (const String& newTooltip);
  10764. // (implementation of the TooltipClient method)
  10765. const String getTooltip();
  10766. enum ConnectedEdgeFlags
  10767. {
  10768. ConnectedOnLeft = 1,
  10769. ConnectedOnRight = 2,
  10770. ConnectedOnTop = 4,
  10771. ConnectedOnBottom = 8
  10772. };
  10773. void setConnectedEdges (const int connectedEdgeFlags) throw();
  10774. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  10775. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  10776. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  10777. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  10778. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  10779. enum ButtonState
  10780. {
  10781. buttonNormal,
  10782. buttonOver,
  10783. buttonDown
  10784. };
  10785. void setState (const ButtonState newState);
  10786. juce_UseDebuggingNewOperator
  10787. protected:
  10788. virtual void clicked();
  10789. virtual void clicked (const ModifierKeys& modifiers);
  10790. virtual void paintButton (Graphics& g,
  10791. bool isMouseOverButton,
  10792. bool isButtonDown) = 0;
  10793. virtual void buttonStateChanged();
  10794. virtual void internalClickCallback (const ModifierKeys& modifiers);
  10795. void handleCommandMessage (int commandId);
  10796. void mouseEnter (const MouseEvent& e);
  10797. void mouseExit (const MouseEvent& e);
  10798. void mouseDown (const MouseEvent& e);
  10799. void mouseDrag (const MouseEvent& e);
  10800. void mouseUp (const MouseEvent& e);
  10801. bool keyPressed (const KeyPress& key);
  10802. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  10803. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  10804. void paint (Graphics& g);
  10805. void parentHierarchyChanged();
  10806. void focusGained (FocusChangeType cause);
  10807. void focusLost (FocusChangeType cause);
  10808. void enablementChanged();
  10809. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  10810. void applicationCommandListChanged();
  10811. void valueChanged (Value& value);
  10812. private:
  10813. Array <KeyPress> shortcuts;
  10814. Component* keySource;
  10815. String text;
  10816. SortedSet <void*> buttonListeners;
  10817. friend class InternalButtonRepeatTimer;
  10818. ScopedPointer <Timer> repeatTimer;
  10819. uint32 buttonPressTime, lastTimeCallbackTime;
  10820. ApplicationCommandManager* commandManagerToUse;
  10821. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  10822. int radioGroupId, commandID, connectedEdgeFlags;
  10823. ButtonState buttonState;
  10824. Value isOn;
  10825. bool lastToggleState : 1;
  10826. bool clickTogglesState : 1;
  10827. bool needsToRelease : 1;
  10828. bool needsRepainting : 1;
  10829. bool isKeyDown : 1;
  10830. bool triggerOnMouseDown : 1;
  10831. bool generateTooltip : 1;
  10832. void repeatTimerCallback() throw();
  10833. Timer& getRepeatTimer() throw();
  10834. ButtonState updateState (const MouseEvent* const e) throw();
  10835. bool isShortcutPressed() const throw();
  10836. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  10837. void flashButtonState() throw();
  10838. void sendClickMessage (const ModifierKeys& modifiers);
  10839. void sendStateMessage();
  10840. Button (const Button&);
  10841. const Button& operator= (const Button&);
  10842. };
  10843. #endif // __JUCE_BUTTON_JUCEHEADER__
  10844. /********* End of inlined file: juce_Button.h *********/
  10845. class ScrollBar;
  10846. class JUCE_API ScrollBarListener
  10847. {
  10848. public:
  10849. virtual ~ScrollBarListener() {}
  10850. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  10851. const double newRangeStart) = 0;
  10852. };
  10853. class JUCE_API ScrollBar : public Component,
  10854. public AsyncUpdater,
  10855. private Timer
  10856. {
  10857. public:
  10858. ScrollBar (const bool isVertical,
  10859. const bool buttonsAreVisible = true);
  10860. ~ScrollBar();
  10861. bool isVertical() const throw() { return vertical; }
  10862. void setOrientation (const bool shouldBeVertical) throw();
  10863. void setButtonVisibility (const bool buttonsAreVisible);
  10864. void setAutoHide (const bool shouldHideWhenFullRange);
  10865. void setRangeLimits (const double minimum,
  10866. const double maximum) throw();
  10867. double getMinimumRangeLimit() const throw() { return minimum; }
  10868. double getMaximumRangeLimit() const throw() { return maximum; }
  10869. void setCurrentRange (double newStart,
  10870. double newSize) throw();
  10871. void setCurrentRangeStart (double newStart) throw();
  10872. double getCurrentRangeStart() const throw() { return rangeStart; }
  10873. double getCurrentRangeSize() const throw() { return rangeSize; }
  10874. void setSingleStepSize (const double newSingleStepSize) throw();
  10875. void moveScrollbarInSteps (const int howManySteps) throw();
  10876. void moveScrollbarInPages (const int howManyPages) throw();
  10877. void scrollToTop() throw();
  10878. void scrollToBottom() throw();
  10879. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  10880. const int repeatDelayInMillisecs,
  10881. const int minimumDelayInMillisecs = -1) throw();
  10882. enum ColourIds
  10883. {
  10884. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  10885. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  10886. 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. */
  10887. };
  10888. void addListener (ScrollBarListener* const listener) throw();
  10889. void removeListener (ScrollBarListener* const listener) throw();
  10890. bool keyPressed (const KeyPress& key);
  10891. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10892. void lookAndFeelChanged();
  10893. void handleAsyncUpdate();
  10894. void mouseDown (const MouseEvent& e);
  10895. void mouseDrag (const MouseEvent& e);
  10896. void mouseUp (const MouseEvent& e);
  10897. void paint (Graphics& g);
  10898. void resized();
  10899. juce_UseDebuggingNewOperator
  10900. private:
  10901. double minimum, maximum;
  10902. double rangeStart, rangeSize;
  10903. double singleStepSize, dragStartRange;
  10904. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  10905. int dragStartMousePos, lastMousePos;
  10906. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  10907. bool vertical, isDraggingThumb, alwaysVisible;
  10908. Button* upButton;
  10909. Button* downButton;
  10910. SortedSet <void*> listeners;
  10911. void updateThumbPosition() throw();
  10912. void timerCallback();
  10913. ScrollBar (const ScrollBar&);
  10914. const ScrollBar& operator= (const ScrollBar&);
  10915. };
  10916. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  10917. /********* End of inlined file: juce_ScrollBar.h *********/
  10918. class JUCE_API Viewport : public Component,
  10919. private ComponentListener,
  10920. private ScrollBarListener
  10921. {
  10922. public:
  10923. Viewport (const String& componentName = String::empty);
  10924. ~Viewport();
  10925. void setViewedComponent (Component* const newViewedComponent);
  10926. Component* getViewedComponent() const throw() { return contentComp; }
  10927. void setViewPosition (const int xPixelsOffset,
  10928. const int yPixelsOffset);
  10929. void setViewPositionProportionately (const double proportionX,
  10930. const double proportionY);
  10931. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  10932. int getViewPositionX() const throw() { return lastVX; }
  10933. int getViewPositionY() const throw() { return lastVY; }
  10934. int getViewWidth() const throw() { return lastVW; }
  10935. int getViewHeight() const throw() { return lastVH; }
  10936. int getMaximumVisibleWidth() const throw();
  10937. int getMaximumVisibleHeight() const throw();
  10938. virtual void visibleAreaChanged (int visibleX, int visibleY,
  10939. int visibleW, int visibleH);
  10940. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  10941. const bool showHorizontalScrollbarIfNeeded);
  10942. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  10943. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  10944. void setScrollBarThickness (const int thickness);
  10945. int getScrollBarThickness() const throw();
  10946. void setSingleStepSizes (const int stepX, const int stepY);
  10947. void setScrollBarButtonVisibility (const bool buttonsVisible);
  10948. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  10949. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  10950. juce_UseDebuggingNewOperator
  10951. void resized();
  10952. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  10953. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10954. bool keyPressed (const KeyPress& key);
  10955. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  10956. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  10957. private:
  10958. Component* contentComp;
  10959. int lastVX, lastVY, lastVW, lastVH;
  10960. int scrollBarThickness;
  10961. int singleStepX, singleStepY;
  10962. bool showHScrollbar, showVScrollbar;
  10963. Component* contentHolder;
  10964. ScrollBar* verticalScrollBar;
  10965. ScrollBar* horizontalScrollBar;
  10966. void updateVisibleRegion();
  10967. Viewport (const Viewport&);
  10968. const Viewport& operator= (const Viewport&);
  10969. };
  10970. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  10971. /********* End of inlined file: juce_Viewport.h *********/
  10972. /********* Start of inlined file: juce_PopupMenu.h *********/
  10973. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  10974. #define __JUCE_POPUPMENU_JUCEHEADER__
  10975. /********* Start of inlined file: juce_PopupMenuCustomComponent.h *********/
  10976. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10977. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10978. class JUCE_API PopupMenuCustomComponent : public Component
  10979. {
  10980. public:
  10981. ~PopupMenuCustomComponent();
  10982. virtual void getIdealSize (int& idealWidth,
  10983. int& idealHeight) = 0;
  10984. void triggerMenuItem();
  10985. bool isItemHighlighted() const throw() { return isHighlighted; }
  10986. protected:
  10987. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  10988. private:
  10989. friend class MenuItemInfo;
  10990. friend class MenuItemComponent;
  10991. friend class PopupMenuWindow;
  10992. int refCount_;
  10993. bool isHighlighted, isTriggeredAutomatically;
  10994. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  10995. const PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  10996. };
  10997. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  10998. /********* End of inlined file: juce_PopupMenuCustomComponent.h *********/
  10999. class JUCE_API PopupMenu
  11000. {
  11001. public:
  11002. PopupMenu();
  11003. PopupMenu (const PopupMenu& other);
  11004. ~PopupMenu();
  11005. const PopupMenu& operator= (const PopupMenu& other);
  11006. void clear();
  11007. void addItem (const int itemResultId,
  11008. const String& itemText,
  11009. const bool isActive = true,
  11010. const bool isTicked = false,
  11011. const Image* const iconToUse = 0);
  11012. void addCommandItem (ApplicationCommandManager* commandManager,
  11013. const int commandID,
  11014. const String& displayName = String::empty);
  11015. void addColouredItem (const int itemResultId,
  11016. const String& itemText,
  11017. const Colour& itemTextColour,
  11018. const bool isActive = true,
  11019. const bool isTicked = false,
  11020. const Image* const iconToUse = 0);
  11021. void addCustomItem (const int itemResultId,
  11022. PopupMenuCustomComponent* const customComponent);
  11023. void addCustomItem (const int itemResultId,
  11024. Component* customComponent,
  11025. int idealWidth, int idealHeight,
  11026. const bool triggerMenuItemAutomaticallyWhenClicked);
  11027. void addSubMenu (const String& subMenuName,
  11028. const PopupMenu& subMenu,
  11029. const bool isActive = true,
  11030. Image* const iconToUse = 0,
  11031. const bool isTicked = false);
  11032. void addSeparator();
  11033. void addSectionHeader (const String& title);
  11034. int getNumItems() const;
  11035. bool containsCommandItem (const int commandID) const;
  11036. bool containsAnyActiveItems() const;
  11037. int show (const int itemIdThatMustBeVisible = 0,
  11038. const int minimumWidth = 0,
  11039. const int maximumNumColumns = 0,
  11040. const int standardItemHeight = 0);
  11041. int showAt (const int screenX,
  11042. const int screenY,
  11043. const int itemIdThatMustBeVisible = 0,
  11044. const int minimumWidth = 0,
  11045. const int maximumNumColumns = 0,
  11046. const int standardItemHeight = 0);
  11047. int showAt (Component* componentToAttachTo,
  11048. const int itemIdThatMustBeVisible = 0,
  11049. const int minimumWidth = 0,
  11050. const int maximumNumColumns = 0,
  11051. const int standardItemHeight = 0);
  11052. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11053. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11054. enum ColourIds
  11055. {
  11056. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11057. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11058. colour is specified when the item is added). */
  11059. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11060. addSectionHeader() method). */
  11061. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11062. highlighted menu item. */
  11063. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11064. highlighted item. */
  11065. };
  11066. class JUCE_API MenuItemIterator
  11067. {
  11068. public:
  11069. MenuItemIterator (const PopupMenu& menu);
  11070. ~MenuItemIterator();
  11071. bool next();
  11072. String itemName;
  11073. const PopupMenu* subMenu;
  11074. int itemId;
  11075. bool isSeparator;
  11076. bool isTicked;
  11077. bool isEnabled;
  11078. bool isCustomComponent;
  11079. bool isSectionHeader;
  11080. const Colour* customColour;
  11081. const Image* customImage;
  11082. ApplicationCommandManager* commandManager;
  11083. juce_UseDebuggingNewOperator
  11084. private:
  11085. const PopupMenu& menu;
  11086. int index;
  11087. MenuItemIterator (const MenuItemIterator&);
  11088. const MenuItemIterator& operator= (const MenuItemIterator&);
  11089. };
  11090. juce_UseDebuggingNewOperator
  11091. private:
  11092. friend class PopupMenuWindow;
  11093. friend class MenuItemIterator;
  11094. VoidArray items;
  11095. LookAndFeel* lookAndFeel;
  11096. bool separatorPending;
  11097. void addSeparatorIfPending();
  11098. int showMenu (const int x, const int y, const int w, const int h,
  11099. const int itemIdThatMustBeVisible,
  11100. const int minimumWidth,
  11101. const int maximumNumColumns,
  11102. const int standardItemHeight,
  11103. const bool alignToRectangle,
  11104. Component* const componentAttachedTo);
  11105. friend class MenuBarComponent;
  11106. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11107. const int itemIdThatMustBeVisible,
  11108. const int minimumWidth,
  11109. const int maximumNumColumns,
  11110. const int standardItemHeight,
  11111. const bool alignToRectangle,
  11112. Component* menuBarComponent,
  11113. ApplicationCommandManager** managerOfChosenCommand,
  11114. Component* const componentAttachedTo);
  11115. };
  11116. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11117. /********* End of inlined file: juce_PopupMenu.h *********/
  11118. class TextEditor;
  11119. class TextHolderComponent;
  11120. class JUCE_API TextEditorListener
  11121. {
  11122. public:
  11123. virtual ~TextEditorListener() {}
  11124. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11125. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11126. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11127. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11128. };
  11129. class JUCE_API TextEditor : public Component,
  11130. public SettableTooltipClient
  11131. {
  11132. public:
  11133. TextEditor (const String& componentName = String::empty,
  11134. const tchar passwordCharacter = 0);
  11135. virtual ~TextEditor();
  11136. void setMultiLine (const bool shouldBeMultiLine,
  11137. const bool shouldWordWrap = true);
  11138. bool isMultiLine() const;
  11139. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11140. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11141. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11142. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11143. void setReadOnly (const bool shouldBeReadOnly);
  11144. bool isReadOnly() const;
  11145. void setCaretVisible (const bool shouldBeVisible);
  11146. bool isCaretVisible() const { return caretVisible; }
  11147. void setScrollbarsShown (bool shouldBeEnabled);
  11148. bool areScrollbarsShown() const { return scrollbarVisible; }
  11149. void setPasswordCharacter (const tchar passwordCharacter);
  11150. tchar getPasswordCharacter() const { return passwordCharacter; }
  11151. void setPopupMenuEnabled (const bool menuEnabled);
  11152. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11153. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11154. enum ColourIds
  11155. {
  11156. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11157. transparent if necessary. */
  11158. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11159. that because the editor can contain multiple colours, calling this
  11160. method won't change the colour of existing text - to do that, call
  11161. applyFontToAllText() after calling this method.*/
  11162. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11163. the text - this can be transparent if you don't want to show any
  11164. highlighting.*/
  11165. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11166. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11167. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11168. the edge of the component. */
  11169. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11170. the edge of the component when it has focus. */
  11171. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11172. around the edge of the editor. */
  11173. };
  11174. void setFont (const Font& newFont);
  11175. void applyFontToAllText (const Font& newFont);
  11176. const Font getFont() const;
  11177. void setSelectAllWhenFocused (const bool b);
  11178. void setInputRestrictions (const int maxTextLength,
  11179. const String& allowedCharacters = String::empty);
  11180. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11181. void setScrollBarThickness (const int newThicknessPixels);
  11182. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11183. void addListener (TextEditorListener* const newListener);
  11184. void removeListener (TextEditorListener* const listenerToRemove);
  11185. const String getText() const;
  11186. const String getTextSubstring (const int startCharacter, const int endCharacter) const;
  11187. bool isEmpty() const;
  11188. void setText (const String& newText,
  11189. const bool sendTextChangeMessage = true);
  11190. Value& getTextValue();
  11191. void insertTextAtCursor (String textToInsert);
  11192. void clear();
  11193. void cut();
  11194. void copy();
  11195. void paste();
  11196. void setCaretPosition (const int newIndex);
  11197. int getCaretPosition() const;
  11198. void scrollEditorToPositionCaret (const int desiredCaretX,
  11199. const int desiredCaretY);
  11200. const Rectangle getCaretRectangle();
  11201. void setHighlightedRegion (int startIndex,
  11202. int numberOfCharactersToHighlight);
  11203. int getHighlightedRegionStart() const { return selectionStart; }
  11204. int getHighlightedRegionLength() const { return jmax (0, selectionEnd - selectionStart); }
  11205. const String getHighlightedText() const;
  11206. int getTextIndexAt (const int x, const int y);
  11207. int getTotalNumChars() const;
  11208. int getTextWidth() const;
  11209. int getTextHeight() const;
  11210. void setIndents (const int newLeftIndent, const int newTopIndent);
  11211. void setBorder (const BorderSize& border);
  11212. const BorderSize getBorder() const;
  11213. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11214. void paint (Graphics& g);
  11215. void paintOverChildren (Graphics& g);
  11216. void mouseDown (const MouseEvent& e);
  11217. void mouseUp (const MouseEvent& e);
  11218. void mouseDrag (const MouseEvent& e);
  11219. void mouseDoubleClick (const MouseEvent& e);
  11220. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11221. bool keyPressed (const KeyPress& key);
  11222. bool keyStateChanged (const bool isKeyDown);
  11223. void focusGained (FocusChangeType cause);
  11224. void focusLost (FocusChangeType cause);
  11225. void resized();
  11226. void enablementChanged();
  11227. void colourChanged();
  11228. juce_UseDebuggingNewOperator
  11229. protected:
  11230. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11231. const MouseEvent* mouseClickEvent);
  11232. virtual void performPopupMenuAction (const int menuItemID);
  11233. void scrollToMakeSureCursorIsVisible();
  11234. void moveCaret (int newCaretPos);
  11235. void moveCursorTo (const int newPosition, const bool isSelecting);
  11236. void textChanged();
  11237. void newTransaction();
  11238. void doUndoRedo (const bool isRedo);
  11239. virtual void returnPressed();
  11240. virtual void escapePressed();
  11241. void handleCommandMessage (int commandId);
  11242. private:
  11243. ScopedPointer <Viewport> viewport;
  11244. TextHolderComponent* textHolder;
  11245. BorderSize borderSize;
  11246. bool readOnly : 1;
  11247. bool multiline : 1;
  11248. bool wordWrap : 1;
  11249. bool returnKeyStartsNewLine : 1;
  11250. bool caretVisible : 1;
  11251. bool popupMenuEnabled : 1;
  11252. bool selectAllTextWhenFocused : 1;
  11253. bool scrollbarVisible : 1;
  11254. bool wasFocused : 1;
  11255. bool caretFlashState : 1;
  11256. bool keepCursorOnScreen : 1;
  11257. bool tabKeyUsed : 1;
  11258. bool menuActive : 1;
  11259. bool valueTextNeedsUpdating : 1;
  11260. UndoManager undoManager;
  11261. float cursorX, cursorY, cursorHeight;
  11262. int maxTextLength;
  11263. int selectionStart, selectionEnd;
  11264. int leftIndent, topIndent;
  11265. unsigned int lastTransactionTime;
  11266. Font currentFont;
  11267. mutable int totalNumChars;
  11268. int caretPosition;
  11269. VoidArray sections;
  11270. String textToShowWhenEmpty;
  11271. Colour colourForTextWhenEmpty;
  11272. tchar passwordCharacter;
  11273. Value textValue;
  11274. enum
  11275. {
  11276. notDragging,
  11277. draggingSelectionStart,
  11278. draggingSelectionEnd
  11279. } dragType;
  11280. String allowedCharacters;
  11281. SortedSet <void*> listeners;
  11282. friend class TextEditorInsertAction;
  11283. friend class TextEditorRemoveAction;
  11284. void coalesceSimilarSections();
  11285. void splitSection (const int sectionIndex, const int charToSplitAt);
  11286. void clearInternal (UndoManager* const um);
  11287. void insert (const String& text,
  11288. const int insertIndex,
  11289. const Font& font,
  11290. const Colour& colour,
  11291. UndoManager* const um,
  11292. const int caretPositionToMoveTo);
  11293. void reinsert (const int insertIndex,
  11294. const VoidArray& sections);
  11295. void remove (const int startIndex,
  11296. int endIndex,
  11297. UndoManager* const um,
  11298. const int caretPositionToMoveTo);
  11299. void getCharPosition (const int index,
  11300. float& x, float& y,
  11301. float& lineHeight) const;
  11302. void updateCaretPosition();
  11303. void textWasChangedByValue();
  11304. int indexAtPosition (const float x,
  11305. const float y);
  11306. int findWordBreakAfter (const int position) const;
  11307. int findWordBreakBefore (const int position) const;
  11308. friend class TextHolderComponent;
  11309. friend class TextEditorViewport;
  11310. void drawContent (Graphics& g);
  11311. void updateTextHolderSize();
  11312. float getWordWrapWidth() const;
  11313. void timerCallbackInt();
  11314. void repaintCaret();
  11315. void repaintText (int textStartIndex, int textEndIndex);
  11316. TextEditor (const TextEditor&);
  11317. const TextEditor& operator= (const TextEditor&);
  11318. };
  11319. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11320. /********* End of inlined file: juce_TextEditor.h *********/
  11321. class Label;
  11322. class JUCE_API LabelListener
  11323. {
  11324. public:
  11325. virtual ~LabelListener() {}
  11326. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11327. };
  11328. class JUCE_API Label : public Component,
  11329. public SettableTooltipClient,
  11330. protected TextEditorListener,
  11331. private ComponentListener,
  11332. private Value::Listener
  11333. {
  11334. public:
  11335. Label (const String& componentName,
  11336. const String& labelText);
  11337. ~Label();
  11338. void setText (const String& newText,
  11339. const bool broadcastChangeMessage);
  11340. const String getText (const bool returnActiveEditorContents = false) const throw();
  11341. Value& getTextValue() { return textValue; }
  11342. void setFont (const Font& newFont) throw();
  11343. const Font& getFont() const throw();
  11344. enum ColourIds
  11345. {
  11346. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11347. textColourId = 0x1000281, /**< The colour for the text. */
  11348. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11349. Leave this transparent to not have an outline. */
  11350. };
  11351. void setJustificationType (const Justification& justification) throw();
  11352. const Justification getJustificationType() const throw() { return justification; }
  11353. void setBorderSize (int horizontalBorder, int verticalBorder);
  11354. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11355. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11356. void attachToComponent (Component* owner,
  11357. const bool onLeft);
  11358. Component* getAttachedComponent() const throw() { return ownerComponent; }
  11359. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11360. void setMinimumHorizontalScale (const float newScale);
  11361. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11362. void addListener (LabelListener* const listener) throw();
  11363. void removeListener (LabelListener* const listener) throw();
  11364. void setEditable (const bool editOnSingleClick,
  11365. const bool editOnDoubleClick = false,
  11366. const bool lossOfFocusDiscardsChanges = false) throw();
  11367. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11368. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11369. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11370. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11371. void showEditor();
  11372. void hideEditor (const bool discardCurrentEditorContents);
  11373. bool isBeingEdited() const throw();
  11374. juce_UseDebuggingNewOperator
  11375. protected:
  11376. virtual TextEditor* createEditorComponent();
  11377. virtual void textWasEdited();
  11378. virtual void textWasChanged();
  11379. virtual void editorShown (TextEditor* editorComponent);
  11380. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11381. void paint (Graphics& g);
  11382. void resized();
  11383. void mouseUp (const MouseEvent& e);
  11384. void mouseDoubleClick (const MouseEvent& e);
  11385. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11386. void componentParentHierarchyChanged (Component& component);
  11387. void componentVisibilityChanged (Component& component);
  11388. void inputAttemptWhenModal();
  11389. void focusGained (FocusChangeType);
  11390. void enablementChanged();
  11391. KeyboardFocusTraverser* createFocusTraverser();
  11392. void textEditorTextChanged (TextEditor& editor);
  11393. void textEditorReturnKeyPressed (TextEditor& editor);
  11394. void textEditorEscapeKeyPressed (TextEditor& editor);
  11395. void textEditorFocusLost (TextEditor& editor);
  11396. void colourChanged();
  11397. void valueChanged (Value&);
  11398. private:
  11399. Value textValue;
  11400. String lastTextValue;
  11401. Font font;
  11402. Justification justification;
  11403. ScopedPointer <TextEditor> editor;
  11404. SortedSet <void*> listeners;
  11405. Component* ownerComponent;
  11406. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  11407. int horizontalBorderSize, verticalBorderSize;
  11408. float minimumHorizontalScale;
  11409. bool editSingleClick : 1;
  11410. bool editDoubleClick : 1;
  11411. bool lossOfFocusDiscardsChanges : 1;
  11412. bool leftOfOwnerComp : 1;
  11413. bool updateFromTextEditorContents();
  11414. void callChangeListeners();
  11415. Label (const Label&);
  11416. const Label& operator= (const Label&);
  11417. };
  11418. #endif // __JUCE_LABEL_JUCEHEADER__
  11419. /********* End of inlined file: juce_Label.h *********/
  11420. class ComboBox;
  11421. class JUCE_API ComboBoxListener
  11422. {
  11423. public:
  11424. virtual ~ComboBoxListener() {}
  11425. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11426. };
  11427. class JUCE_API ComboBox : public Component,
  11428. public SettableTooltipClient,
  11429. private LabelListener,
  11430. private AsyncUpdater,
  11431. private Value::Listener
  11432. {
  11433. public:
  11434. ComboBox (const String& componentName);
  11435. ~ComboBox();
  11436. void setEditableText (const bool isEditable);
  11437. bool isTextEditable() const throw();
  11438. void setJustificationType (const Justification& justification) throw();
  11439. const Justification getJustificationType() const throw();
  11440. void addItem (const String& newItemText,
  11441. const int newItemId) throw();
  11442. void addSeparator() throw();
  11443. void addSectionHeading (const String& headingName) throw();
  11444. void setItemEnabled (const int itemId,
  11445. const bool shouldBeEnabled) throw();
  11446. void changeItemText (const int itemId,
  11447. const String& newText) throw();
  11448. void clear (const bool dontSendChangeMessage = false);
  11449. int getNumItems() const throw();
  11450. const String getItemText (const int index) const throw();
  11451. int getItemId (const int index) const throw();
  11452. int indexOfItemId (const int itemId) const throw();
  11453. int getSelectedId() const throw();
  11454. Value& getSelectedIdAsValue() throw() { return currentId; }
  11455. void setSelectedId (const int newItemId,
  11456. const bool dontSendChangeMessage = false) throw();
  11457. int getSelectedItemIndex() const throw();
  11458. void setSelectedItemIndex (const int newItemIndex,
  11459. const bool dontSendChangeMessage = false) throw();
  11460. const String getText() const throw();
  11461. void setText (const String& newText,
  11462. const bool dontSendChangeMessage = false) throw();
  11463. void showEditor();
  11464. void addListener (ComboBoxListener* const listener) throw();
  11465. void removeListener (ComboBoxListener* const listener) throw();
  11466. void setTextWhenNothingSelected (const String& newMessage) throw();
  11467. const String getTextWhenNothingSelected() const throw();
  11468. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11469. const String getTextWhenNoChoicesAvailable() const throw();
  11470. void setTooltip (const String& newTooltip);
  11471. enum ColourIds
  11472. {
  11473. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11474. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11475. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11476. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11477. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11478. };
  11479. void labelTextChanged (Label*);
  11480. void enablementChanged();
  11481. void colourChanged();
  11482. void focusGained (Component::FocusChangeType cause);
  11483. void focusLost (Component::FocusChangeType cause);
  11484. void handleAsyncUpdate();
  11485. const String getTooltip() { return label->getTooltip(); }
  11486. void mouseDown (const MouseEvent&);
  11487. void mouseDrag (const MouseEvent&);
  11488. void mouseUp (const MouseEvent&);
  11489. void lookAndFeelChanged();
  11490. void paint (Graphics&);
  11491. void resized();
  11492. bool keyStateChanged (const bool isKeyDown);
  11493. bool keyPressed (const KeyPress&);
  11494. void valueChanged (Value&);
  11495. juce_UseDebuggingNewOperator
  11496. private:
  11497. struct ItemInfo
  11498. {
  11499. String name;
  11500. int itemId;
  11501. bool isEnabled : 1, isHeading : 1;
  11502. bool isSeparator() const throw();
  11503. bool isRealItem() const throw();
  11504. };
  11505. OwnedArray <ItemInfo> items;
  11506. Value currentId;
  11507. int lastCurrentId;
  11508. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11509. SortedSet <void*> listeners;
  11510. Label* label;
  11511. String textWhenNothingSelected, noChoicesMessage;
  11512. void showPopup();
  11513. ItemInfo* getItemForId (const int itemId) const throw();
  11514. ItemInfo* getItemForIndex (const int index) const throw();
  11515. ComboBox (const ComboBox&);
  11516. const ComboBox& operator= (const ComboBox&);
  11517. };
  11518. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11519. /********* End of inlined file: juce_ComboBox.h *********/
  11520. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11521. {
  11522. public:
  11523. AudioDeviceManager();
  11524. ~AudioDeviceManager();
  11525. struct JUCE_API AudioDeviceSetup
  11526. {
  11527. AudioDeviceSetup();
  11528. bool operator== (const AudioDeviceSetup& other) const;
  11529. String outputDeviceName;
  11530. String inputDeviceName;
  11531. double sampleRate;
  11532. int bufferSize;
  11533. BitArray inputChannels;
  11534. bool useDefaultInputChannels;
  11535. BitArray outputChannels;
  11536. bool useDefaultOutputChannels;
  11537. };
  11538. const String initialise (const int numInputChannelsNeeded,
  11539. const int numOutputChannelsNeeded,
  11540. const XmlElement* const savedState,
  11541. const bool selectDefaultDeviceOnFailure,
  11542. const String& preferredDefaultDeviceName = String::empty,
  11543. const AudioDeviceSetup* preferredSetupOptions = 0);
  11544. XmlElement* createStateXml() const;
  11545. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11546. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11547. const bool treatAsChosenDevice);
  11548. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11549. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11550. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11551. void setCurrentAudioDeviceType (const String& type,
  11552. const bool treatAsChosenDevice);
  11553. void closeAudioDevice();
  11554. void restartLastAudioDevice();
  11555. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11556. void removeAudioCallback (AudioIODeviceCallback* callback);
  11557. double getCpuUsage() const;
  11558. void setMidiInputEnabled (const String& midiInputDeviceName,
  11559. const bool enabled);
  11560. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11561. void addMidiInputCallback (const String& midiInputDeviceName,
  11562. MidiInputCallback* callback);
  11563. void removeMidiInputCallback (const String& midiInputDeviceName,
  11564. MidiInputCallback* callback);
  11565. void setDefaultMidiOutput (const String& deviceName);
  11566. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11567. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11568. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11569. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11570. void playTestSound();
  11571. void enableInputLevelMeasurement (const bool enableMeasurement);
  11572. double getCurrentInputLevel() const;
  11573. juce_UseDebuggingNewOperator
  11574. private:
  11575. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11576. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11577. AudioDeviceSetup currentSetup;
  11578. ScopedPointer <AudioIODevice> currentAudioDevice;
  11579. SortedSet <AudioIODeviceCallback*> callbacks;
  11580. int numInputChansNeeded, numOutputChansNeeded;
  11581. String currentDeviceType;
  11582. BitArray inputChannels, outputChannels;
  11583. ScopedPointer <XmlElement> lastExplicitSettings;
  11584. mutable bool listNeedsScanning;
  11585. bool useInputNames;
  11586. int inputLevelMeasurementEnabledCount;
  11587. double inputLevel;
  11588. ScopedPointer <AudioSampleBuffer> testSound;
  11589. int testSoundPosition;
  11590. AudioSampleBuffer tempBuffer;
  11591. StringArray midiInsFromXml;
  11592. OwnedArray <MidiInput> enabledMidiInputs;
  11593. Array <MidiInputCallback*> midiCallbacks;
  11594. Array <MidiInput*> midiCallbackDevices;
  11595. String defaultMidiOutputName;
  11596. ScopedPointer <MidiOutput> defaultMidiOutput;
  11597. CriticalSection audioCallbackLock, midiCallbackLock;
  11598. double cpuUsageMs, timeToCpuScale;
  11599. class CallbackHandler : public AudioIODeviceCallback,
  11600. public MidiInputCallback
  11601. {
  11602. public:
  11603. AudioDeviceManager* owner;
  11604. void audioDeviceIOCallback (const float** inputChannelData,
  11605. int totalNumInputChannels,
  11606. float** outputChannelData,
  11607. int totalNumOutputChannels,
  11608. int numSamples);
  11609. void audioDeviceAboutToStart (AudioIODevice*);
  11610. void audioDeviceStopped();
  11611. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11612. };
  11613. CallbackHandler callbackHandler;
  11614. friend class CallbackHandler;
  11615. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11616. int totalNumInputChannels,
  11617. float** outputChannelData,
  11618. int totalNumOutputChannels,
  11619. int numSamples);
  11620. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11621. void audioDeviceStoppedInt();
  11622. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11623. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11624. const BitArray& ins, const BitArray& outs);
  11625. void stopDevice();
  11626. void updateXml();
  11627. void createDeviceTypesIfNeeded();
  11628. void scanDevicesIfNeeded();
  11629. void deleteCurrentDevice();
  11630. double chooseBestSampleRate (double preferred) const;
  11631. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11632. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11633. AudioDeviceManager (const AudioDeviceManager&);
  11634. const AudioDeviceManager& operator= (const AudioDeviceManager&);
  11635. };
  11636. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11637. /********* End of inlined file: juce_AudioDeviceManager.h *********/
  11638. #endif
  11639. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11640. #endif
  11641. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11642. #endif
  11643. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11644. #endif
  11645. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11646. #endif
  11647. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11648. /********* Start of inlined file: juce_AudioDataConverters.h *********/
  11649. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11650. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11651. class JUCE_API AudioDataConverters
  11652. {
  11653. public:
  11654. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11655. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11656. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11657. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11658. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11659. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11660. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11661. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11662. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11663. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11664. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11665. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11666. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11667. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11668. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11669. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11670. enum DataFormat
  11671. {
  11672. int16LE,
  11673. int16BE,
  11674. int24LE,
  11675. int24BE,
  11676. int32LE,
  11677. int32BE,
  11678. float32LE,
  11679. float32BE,
  11680. };
  11681. static void convertFloatToFormat (const DataFormat destFormat,
  11682. const float* source, void* dest, int numSamples);
  11683. static void convertFormatToFloat (const DataFormat sourceFormat,
  11684. const void* source, float* dest, int numSamples);
  11685. static void interleaveSamples (const float** source, float* dest,
  11686. const int numSamples, const int numChannels);
  11687. static void deinterleaveSamples (const float* source, float** dest,
  11688. const int numSamples, const int numChannels);
  11689. };
  11690. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11691. /********* End of inlined file: juce_AudioDataConverters.h *********/
  11692. #endif
  11693. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11694. #endif
  11695. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11696. #endif
  11697. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11698. #endif
  11699. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11700. /********* Start of inlined file: juce_MidiFile.h *********/
  11701. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11702. #define __JUCE_MIDIFILE_JUCEHEADER__
  11703. /********* Start of inlined file: juce_MidiMessageSequence.h *********/
  11704. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11705. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11706. class JUCE_API MidiMessageSequence
  11707. {
  11708. public:
  11709. MidiMessageSequence();
  11710. MidiMessageSequence (const MidiMessageSequence& other);
  11711. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11712. ~MidiMessageSequence();
  11713. class MidiEventHolder
  11714. {
  11715. public:
  11716. ~MidiEventHolder();
  11717. MidiMessage message;
  11718. MidiEventHolder* noteOffObject;
  11719. juce_UseDebuggingNewOperator
  11720. private:
  11721. friend class MidiMessageSequence;
  11722. MidiEventHolder (const MidiMessage& message);
  11723. };
  11724. void clear();
  11725. int getNumEvents() const;
  11726. MidiEventHolder* getEventPointer (const int index) const;
  11727. double getTimeOfMatchingKeyUp (const int index) const;
  11728. int getIndexOfMatchingKeyUp (const int index) const;
  11729. int getIndexOf (MidiEventHolder* const event) const;
  11730. int getNextIndexAtTime (const double timeStamp) const;
  11731. double getStartTime() const;
  11732. double getEndTime() const;
  11733. double getEventTime (const int index) const;
  11734. void addEvent (const MidiMessage& newMessage,
  11735. double timeAdjustment = 0);
  11736. void deleteEvent (const int index,
  11737. const bool deleteMatchingNoteUp);
  11738. void addSequence (const MidiMessageSequence& other,
  11739. double timeAdjustmentDelta,
  11740. double firstAllowableDestTime,
  11741. double endOfAllowableDestTimes);
  11742. void updateMatchedPairs();
  11743. void extractMidiChannelMessages (const int channelNumberToExtract,
  11744. MidiMessageSequence& destSequence,
  11745. const bool alsoIncludeMetaEvents) const;
  11746. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11747. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11748. void deleteSysExMessages();
  11749. void addTimeToMessages (const double deltaTime);
  11750. void createControllerUpdatesForTime (const int channelNumber,
  11751. const double time,
  11752. OwnedArray<MidiMessage>& resultMessages);
  11753. void swapWith (MidiMessageSequence& other) throw();
  11754. juce_UseDebuggingNewOperator
  11755. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11756. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11757. private:
  11758. friend class MidiComparator;
  11759. friend class MidiFile;
  11760. OwnedArray <MidiEventHolder> list;
  11761. void sort();
  11762. };
  11763. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11764. /********* End of inlined file: juce_MidiMessageSequence.h *********/
  11765. class JUCE_API MidiFile
  11766. {
  11767. public:
  11768. MidiFile() throw();
  11769. ~MidiFile() throw();
  11770. int getNumTracks() const throw();
  11771. const MidiMessageSequence* getTrack (const int index) const throw();
  11772. void addTrack (const MidiMessageSequence& trackSequence) throw();
  11773. void clear() throw();
  11774. short getTimeFormat() const throw();
  11775. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  11776. void setSmpteTimeFormat (const int framesPerSecond,
  11777. const int subframeResolution) throw();
  11778. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  11779. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  11780. double getLastTimestamp() const;
  11781. bool readFrom (InputStream& sourceStream);
  11782. bool writeTo (OutputStream& destStream);
  11783. void convertTimestampTicksToSeconds();
  11784. juce_UseDebuggingNewOperator
  11785. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11786. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11787. private:
  11788. OwnedArray <MidiMessageSequence> tracks;
  11789. short timeFormat;
  11790. MidiFile (const MidiFile&);
  11791. const MidiFile& operator= (const MidiFile&);
  11792. void readNextTrack (const char* data, int size);
  11793. void writeTrack (OutputStream& mainOut, const int trackNum);
  11794. };
  11795. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  11796. /********* End of inlined file: juce_MidiFile.h *********/
  11797. #endif
  11798. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11799. /********* Start of inlined file: juce_MidiKeyboardState.h *********/
  11800. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11801. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11802. class MidiKeyboardState;
  11803. class JUCE_API MidiKeyboardStateListener
  11804. {
  11805. public:
  11806. MidiKeyboardStateListener() throw() {}
  11807. virtual ~MidiKeyboardStateListener() {}
  11808. virtual void handleNoteOn (MidiKeyboardState* source,
  11809. int midiChannel, int midiNoteNumber, float velocity) = 0;
  11810. virtual void handleNoteOff (MidiKeyboardState* source,
  11811. int midiChannel, int midiNoteNumber) = 0;
  11812. };
  11813. class JUCE_API MidiKeyboardState
  11814. {
  11815. public:
  11816. MidiKeyboardState();
  11817. ~MidiKeyboardState();
  11818. void reset();
  11819. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  11820. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  11821. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  11822. void noteOff (const int midiChannel, const int midiNoteNumber);
  11823. void allNotesOff (const int midiChannel);
  11824. void processNextMidiEvent (const MidiMessage& message);
  11825. void processNextMidiBuffer (MidiBuffer& buffer,
  11826. const int startSample,
  11827. const int numSamples,
  11828. const bool injectIndirectEvents);
  11829. void addListener (MidiKeyboardStateListener* const listener) throw();
  11830. void removeListener (MidiKeyboardStateListener* const listener) throw();
  11831. juce_UseDebuggingNewOperator
  11832. private:
  11833. CriticalSection lock;
  11834. uint16 noteStates [128];
  11835. MidiBuffer eventsToAdd;
  11836. VoidArray listeners;
  11837. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  11838. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  11839. MidiKeyboardState (const MidiKeyboardState&);
  11840. const MidiKeyboardState& operator= (const MidiKeyboardState&);
  11841. };
  11842. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11843. /********* End of inlined file: juce_MidiKeyboardState.h *********/
  11844. #endif
  11845. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  11846. #endif
  11847. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11848. /********* Start of inlined file: juce_MidiMessageCollector.h *********/
  11849. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11850. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11851. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  11852. public MidiInputCallback
  11853. {
  11854. public:
  11855. MidiMessageCollector();
  11856. ~MidiMessageCollector();
  11857. void reset (const double sampleRate);
  11858. void addMessageToQueue (const MidiMessage& message);
  11859. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  11860. const int numSamples);
  11861. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  11862. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  11863. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11864. juce_UseDebuggingNewOperator
  11865. private:
  11866. double lastCallbackTime;
  11867. CriticalSection midiCallbackLock;
  11868. MidiBuffer incomingMessages;
  11869. double sampleRate;
  11870. MidiMessageCollector (const MidiMessageCollector&);
  11871. const MidiMessageCollector& operator= (const MidiMessageCollector&);
  11872. };
  11873. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  11874. /********* End of inlined file: juce_MidiMessageCollector.h *********/
  11875. #endif
  11876. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11877. #endif
  11878. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11879. /********* Start of inlined file: juce_AudioUnitPluginFormat.h *********/
  11880. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11881. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  11882. /********* Start of inlined file: juce_AudioPluginFormat.h *********/
  11883. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11884. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  11885. /********* Start of inlined file: juce_AudioPluginInstance.h *********/
  11886. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11887. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  11888. /********* Start of inlined file: juce_AudioProcessor.h *********/
  11889. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11890. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  11891. /********* Start of inlined file: juce_AudioProcessorEditor.h *********/
  11892. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11893. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11894. class AudioProcessor;
  11895. class JUCE_API AudioProcessorEditor : public Component
  11896. {
  11897. protected:
  11898. AudioProcessorEditor (AudioProcessor* const owner);
  11899. public:
  11900. ~AudioProcessorEditor();
  11901. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  11902. private:
  11903. AudioProcessor* const owner;
  11904. };
  11905. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  11906. /********* End of inlined file: juce_AudioProcessorEditor.h *********/
  11907. /********* Start of inlined file: juce_AudioProcessorListener.h *********/
  11908. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11909. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11910. class AudioProcessor;
  11911. class JUCE_API AudioProcessorListener
  11912. {
  11913. public:
  11914. virtual ~AudioProcessorListener() {}
  11915. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  11916. int parameterIndex,
  11917. float newValue) = 0;
  11918. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  11919. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  11920. int parameterIndex);
  11921. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  11922. int parameterIndex);
  11923. };
  11924. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  11925. /********* End of inlined file: juce_AudioProcessorListener.h *********/
  11926. /********* Start of inlined file: juce_AudioPlayHead.h *********/
  11927. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11928. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11929. class JUCE_API AudioPlayHead
  11930. {
  11931. protected:
  11932. AudioPlayHead() {}
  11933. public:
  11934. virtual ~AudioPlayHead() {}
  11935. enum FrameRateType
  11936. {
  11937. fps24 = 0,
  11938. fps25 = 1,
  11939. fps2997 = 2,
  11940. fps30 = 3,
  11941. fps2997drop = 4,
  11942. fps30drop = 5,
  11943. fpsUnknown = 99
  11944. };
  11945. struct CurrentPositionInfo
  11946. {
  11947. double bpm;
  11948. int timeSigNumerator;
  11949. int timeSigDenominator;
  11950. double timeInSeconds;
  11951. double editOriginTime;
  11952. double ppqPosition;
  11953. double ppqPositionOfLastBarStart;
  11954. FrameRateType frameRate;
  11955. bool isPlaying;
  11956. bool isRecording;
  11957. };
  11958. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  11959. };
  11960. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  11961. /********* End of inlined file: juce_AudioPlayHead.h *********/
  11962. class JUCE_API AudioProcessor
  11963. {
  11964. protected:
  11965. AudioProcessor();
  11966. public:
  11967. virtual ~AudioProcessor();
  11968. virtual const String getName() const = 0;
  11969. virtual void prepareToPlay (double sampleRate,
  11970. int estimatedSamplesPerBlock) = 0;
  11971. virtual void releaseResources() = 0;
  11972. virtual void processBlock (AudioSampleBuffer& buffer,
  11973. MidiBuffer& midiMessages) = 0;
  11974. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  11975. double getSampleRate() const throw() { return sampleRate; }
  11976. int getBlockSize() const throw() { return blockSize; }
  11977. int getNumInputChannels() const throw() { return numInputChannels; }
  11978. int getNumOutputChannels() const throw() { return numOutputChannels; }
  11979. virtual const String getInputChannelName (const int channelIndex) const = 0;
  11980. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  11981. virtual bool isInputChannelStereoPair (int index) const = 0;
  11982. virtual bool isOutputChannelStereoPair (int index) const = 0;
  11983. int getLatencySamples() const throw() { return latencySamples; }
  11984. void setLatencySamples (const int newLatency);
  11985. virtual bool acceptsMidi() const = 0;
  11986. virtual bool producesMidi() const = 0;
  11987. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  11988. void suspendProcessing (const bool shouldBeSuspended);
  11989. bool isSuspended() const throw() { return suspended; }
  11990. virtual void reset();
  11991. bool isNonRealtime() const throw() { return nonRealtime; }
  11992. void setNonRealtime (const bool isNonRealtime) throw();
  11993. virtual AudioProcessorEditor* createEditor() = 0;
  11994. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  11995. AudioProcessorEditor* createEditorIfNeeded();
  11996. virtual int getNumParameters() = 0;
  11997. virtual const String getParameterName (int parameterIndex) = 0;
  11998. virtual float getParameter (int parameterIndex) = 0;
  11999. virtual const String getParameterText (int parameterIndex) = 0;
  12000. virtual void setParameter (int parameterIndex,
  12001. float newValue) = 0;
  12002. void setParameterNotifyingHost (int parameterIndex,
  12003. float newValue);
  12004. virtual bool isParameterAutomatable (int parameterIndex) const;
  12005. virtual bool isMetaParameter (int parameterIndex) const;
  12006. void beginParameterChangeGesture (int parameterIndex);
  12007. void endParameterChangeGesture (int parameterIndex);
  12008. void updateHostDisplay();
  12009. virtual int getNumPrograms() = 0;
  12010. virtual int getCurrentProgram() = 0;
  12011. virtual void setCurrentProgram (int index) = 0;
  12012. virtual const String getProgramName (int index) = 0;
  12013. virtual void changeProgramName (int index, const String& newName) = 0;
  12014. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12015. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12016. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12017. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12018. void addListener (AudioProcessorListener* const newListener) throw();
  12019. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12020. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12021. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12022. void setPlayConfigDetails (const int numIns, const int numOuts,
  12023. const double sampleRate,
  12024. const int blockSize) throw();
  12025. juce_UseDebuggingNewOperator
  12026. protected:
  12027. static void copyXmlToBinary (const XmlElement& xml,
  12028. JUCE_NAMESPACE::MemoryBlock& destData);
  12029. static XmlElement* getXmlFromBinary (const void* data,
  12030. const int sizeInBytes);
  12031. AudioPlayHead* playHead;
  12032. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12033. private:
  12034. VoidArray listeners;
  12035. AudioProcessorEditor* activeEditor;
  12036. double sampleRate;
  12037. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12038. bool suspended, nonRealtime;
  12039. CriticalSection callbackLock, listenerLock;
  12040. #ifdef JUCE_DEBUG
  12041. BitArray changingParams;
  12042. #endif
  12043. AudioProcessor (const AudioProcessor&);
  12044. const AudioProcessor& operator= (const AudioProcessor&);
  12045. };
  12046. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12047. /********* End of inlined file: juce_AudioProcessor.h *********/
  12048. /********* Start of inlined file: juce_PluginDescription.h *********/
  12049. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12050. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12051. class JUCE_API PluginDescription
  12052. {
  12053. public:
  12054. PluginDescription() throw();
  12055. PluginDescription (const PluginDescription& other) throw();
  12056. const PluginDescription& operator= (const PluginDescription& other) throw();
  12057. ~PluginDescription() throw();
  12058. String name;
  12059. String pluginFormatName;
  12060. String category;
  12061. String manufacturerName;
  12062. String version;
  12063. String fileOrIdentifier;
  12064. Time lastFileModTime;
  12065. int uid;
  12066. bool isInstrument;
  12067. int numInputChannels;
  12068. int numOutputChannels;
  12069. bool isDuplicateOf (const PluginDescription& other) const;
  12070. const String createIdentifierString() const throw();
  12071. XmlElement* createXml() const;
  12072. bool loadFromXml (const XmlElement& xml);
  12073. juce_UseDebuggingNewOperator
  12074. };
  12075. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12076. /********* End of inlined file: juce_PluginDescription.h *********/
  12077. class JUCE_API AudioPluginInstance : public AudioProcessor
  12078. {
  12079. public:
  12080. virtual ~AudioPluginInstance();
  12081. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12082. juce_UseDebuggingNewOperator
  12083. protected:
  12084. AudioPluginInstance();
  12085. AudioPluginInstance (const AudioPluginInstance&);
  12086. const AudioPluginInstance& operator= (const AudioPluginInstance&);
  12087. };
  12088. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12089. /********* End of inlined file: juce_AudioPluginInstance.h *********/
  12090. class PluginDescription;
  12091. class JUCE_API AudioPluginFormat
  12092. {
  12093. public:
  12094. virtual ~AudioPluginFormat();
  12095. virtual const String getName() const = 0;
  12096. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12097. const String& fileOrIdentifier) = 0;
  12098. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12099. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12100. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12101. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12102. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12103. const bool recursive) = 0;
  12104. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12105. juce_UseDebuggingNewOperator
  12106. protected:
  12107. AudioPluginFormat() throw();
  12108. AudioPluginFormat (const AudioPluginFormat&);
  12109. const AudioPluginFormat& operator= (const AudioPluginFormat&);
  12110. };
  12111. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12112. /********* End of inlined file: juce_AudioPluginFormat.h *********/
  12113. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12114. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12115. {
  12116. public:
  12117. AudioUnitPluginFormat();
  12118. ~AudioUnitPluginFormat();
  12119. const String getName() const { return "AudioUnit"; }
  12120. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12121. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12122. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12123. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12124. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12125. bool doesPluginStillExist (const PluginDescription& desc);
  12126. const FileSearchPath getDefaultLocationsToSearch();
  12127. juce_UseDebuggingNewOperator
  12128. private:
  12129. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12130. const AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12131. };
  12132. #endif
  12133. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12134. /********* End of inlined file: juce_AudioUnitPluginFormat.h *********/
  12135. #endif
  12136. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12137. /********* Start of inlined file: juce_DirectXPluginFormat.h *********/
  12138. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12139. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12140. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12141. // Sorry, this file is just a placeholder at the moment!...
  12142. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12143. {
  12144. public:
  12145. DirectXPluginFormat();
  12146. ~DirectXPluginFormat();
  12147. const String getName() const { return "DirectX"; }
  12148. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12149. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12150. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12151. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12152. const FileSearchPath getDefaultLocationsToSearch();
  12153. juce_UseDebuggingNewOperator
  12154. private:
  12155. DirectXPluginFormat (const DirectXPluginFormat&);
  12156. const DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12157. };
  12158. #endif
  12159. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12160. /********* End of inlined file: juce_DirectXPluginFormat.h *********/
  12161. #endif
  12162. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12163. /********* Start of inlined file: juce_LADSPAPluginFormat.h *********/
  12164. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12165. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12166. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12167. // Sorry, this file is just a placeholder at the moment!...
  12168. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12169. {
  12170. public:
  12171. LADSPAPluginFormat();
  12172. ~LADSPAPluginFormat();
  12173. const String getName() const { return "LADSPA"; }
  12174. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12175. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12176. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12177. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12178. const FileSearchPath getDefaultLocationsToSearch();
  12179. juce_UseDebuggingNewOperator
  12180. private:
  12181. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12182. const LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12183. };
  12184. #endif
  12185. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12186. /********* End of inlined file: juce_LADSPAPluginFormat.h *********/
  12187. #endif
  12188. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12189. /********* Start of inlined file: juce_VSTMidiEventList.h *********/
  12190. #ifdef __aeffect__
  12191. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12192. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12193. class VSTMidiEventList
  12194. {
  12195. public:
  12196. VSTMidiEventList()
  12197. : numEventsUsed (0), numEventsAllocated (0)
  12198. {
  12199. }
  12200. ~VSTMidiEventList()
  12201. {
  12202. freeEvents();
  12203. }
  12204. void clear()
  12205. {
  12206. numEventsUsed = 0;
  12207. if (events != 0)
  12208. events->numEvents = 0;
  12209. }
  12210. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12211. {
  12212. ensureSize (numEventsUsed + 1);
  12213. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12214. events->numEvents = ++numEventsUsed;
  12215. if (numBytes <= 4)
  12216. {
  12217. if (e->type == kVstSysExType)
  12218. {
  12219. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12220. e->type = kVstMidiType;
  12221. e->byteSize = sizeof (VstMidiEvent);
  12222. e->noteLength = 0;
  12223. e->noteOffset = 0;
  12224. e->detune = 0;
  12225. e->noteOffVelocity = 0;
  12226. }
  12227. e->deltaFrames = frameOffset;
  12228. memcpy (e->midiData, midiData, numBytes);
  12229. }
  12230. else
  12231. {
  12232. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12233. if (se->type == kVstSysExType)
  12234. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12235. else
  12236. se->sysexDump = (char*) juce_malloc (numBytes);
  12237. memcpy (se->sysexDump, midiData, numBytes);
  12238. se->type = kVstSysExType;
  12239. se->byteSize = sizeof (VstMidiSysexEvent);
  12240. se->deltaFrames = frameOffset;
  12241. se->flags = 0;
  12242. se->dumpBytes = numBytes;
  12243. se->resvd1 = 0;
  12244. se->resvd2 = 0;
  12245. }
  12246. }
  12247. // Handy method to pull the events out of an event buffer supplied by the host
  12248. // or plugin.
  12249. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12250. {
  12251. for (int i = 0; i < events->numEvents; ++i)
  12252. {
  12253. const VstEvent* const e = events->events[i];
  12254. if (e != 0)
  12255. {
  12256. if (e->type == kVstMidiType)
  12257. {
  12258. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12259. 4, e->deltaFrames);
  12260. }
  12261. else if (e->type == kVstSysExType)
  12262. {
  12263. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12264. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12265. e->deltaFrames);
  12266. }
  12267. }
  12268. }
  12269. }
  12270. void ensureSize (int numEventsNeeded)
  12271. {
  12272. if (numEventsNeeded > numEventsAllocated)
  12273. {
  12274. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12275. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12276. if (events == 0)
  12277. events.calloc (size, 1);
  12278. else
  12279. events.realloc (size, 1);
  12280. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12281. {
  12282. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12283. (int) sizeof (VstMidiSysexEvent)));
  12284. e->type = kVstMidiType;
  12285. e->byteSize = sizeof (VstMidiEvent);
  12286. events->events[i] = (VstEvent*) e;
  12287. }
  12288. numEventsAllocated = numEventsNeeded;
  12289. }
  12290. }
  12291. void freeEvents()
  12292. {
  12293. if (events != 0)
  12294. {
  12295. for (int i = numEventsAllocated; --i >= 0;)
  12296. {
  12297. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12298. if (e->type == kVstSysExType)
  12299. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12300. juce_free (e);
  12301. }
  12302. events.free();
  12303. numEventsUsed = 0;
  12304. numEventsAllocated = 0;
  12305. }
  12306. }
  12307. HeapBlock <VstEvents> events;
  12308. private:
  12309. int numEventsUsed, numEventsAllocated;
  12310. };
  12311. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12312. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12313. /********* End of inlined file: juce_VSTMidiEventList.h *********/
  12314. #endif
  12315. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12316. /********* Start of inlined file: juce_VSTPluginFormat.h *********/
  12317. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12318. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12319. #if JUCE_PLUGINHOST_VST
  12320. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12321. {
  12322. public:
  12323. VSTPluginFormat();
  12324. ~VSTPluginFormat();
  12325. const String getName() const { return "VST"; }
  12326. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12327. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12328. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12329. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12330. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12331. bool doesPluginStillExist (const PluginDescription& desc);
  12332. const FileSearchPath getDefaultLocationsToSearch();
  12333. juce_UseDebuggingNewOperator
  12334. private:
  12335. VSTPluginFormat (const VSTPluginFormat&);
  12336. const VSTPluginFormat& operator= (const VSTPluginFormat&);
  12337. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12338. };
  12339. #endif
  12340. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12341. /********* End of inlined file: juce_VSTPluginFormat.h *********/
  12342. #endif
  12343. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12344. #endif
  12345. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12346. /********* Start of inlined file: juce_AudioPluginFormatManager.h *********/
  12347. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12348. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12349. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12350. {
  12351. public:
  12352. AudioPluginFormatManager() throw();
  12353. ~AudioPluginFormatManager() throw();
  12354. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12355. void addDefaultFormats();
  12356. int getNumFormats() throw();
  12357. AudioPluginFormat* getFormat (const int index) throw();
  12358. void addFormat (AudioPluginFormat* const format) throw();
  12359. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12360. String& errorMessage) const;
  12361. bool doesPluginStillExist (const PluginDescription& description) const;
  12362. juce_UseDebuggingNewOperator
  12363. private:
  12364. OwnedArray <AudioPluginFormat> formats;
  12365. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12366. const AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12367. };
  12368. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12369. /********* End of inlined file: juce_AudioPluginFormatManager.h *********/
  12370. #endif
  12371. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12372. #endif
  12373. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12374. /********* Start of inlined file: juce_KnownPluginList.h *********/
  12375. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12376. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12377. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12378. {
  12379. public:
  12380. KnownPluginList();
  12381. ~KnownPluginList();
  12382. void clear();
  12383. int getNumTypes() const throw() { return types.size(); }
  12384. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12385. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12386. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12387. bool addType (const PluginDescription& type);
  12388. void removeType (const int index) throw();
  12389. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12390. const bool dontRescanIfAlreadyInList,
  12391. OwnedArray <PluginDescription>& typesFound,
  12392. AudioPluginFormat& formatToUse);
  12393. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12394. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12395. OwnedArray <PluginDescription>& typesFound);
  12396. enum SortMethod
  12397. {
  12398. defaultOrder = 0,
  12399. sortAlphabetically,
  12400. sortByCategory,
  12401. sortByManufacturer,
  12402. sortByFileSystemLocation
  12403. };
  12404. void addToMenu (PopupMenu& menu,
  12405. const SortMethod sortMethod) const;
  12406. int getIndexChosenByMenu (const int menuResultCode) const;
  12407. void sort (const SortMethod method);
  12408. XmlElement* createXml() const;
  12409. void recreateFromXml (const XmlElement& xml);
  12410. juce_UseDebuggingNewOperator
  12411. private:
  12412. OwnedArray <PluginDescription> types;
  12413. KnownPluginList (const KnownPluginList&);
  12414. const KnownPluginList& operator= (const KnownPluginList&);
  12415. };
  12416. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12417. /********* End of inlined file: juce_KnownPluginList.h *********/
  12418. #endif
  12419. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12420. #endif
  12421. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12422. /********* Start of inlined file: juce_PluginDirectoryScanner.h *********/
  12423. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12424. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12425. class JUCE_API PluginDirectoryScanner
  12426. {
  12427. public:
  12428. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12429. AudioPluginFormat& formatToLookFor,
  12430. FileSearchPath directoriesToSearch,
  12431. const bool searchRecursively,
  12432. const File& deadMansPedalFile);
  12433. ~PluginDirectoryScanner();
  12434. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12435. const String getNextPluginFileThatWillBeScanned() const throw();
  12436. float getProgress() const { return progress; }
  12437. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12438. juce_UseDebuggingNewOperator
  12439. private:
  12440. KnownPluginList& list;
  12441. AudioPluginFormat& format;
  12442. StringArray filesOrIdentifiersToScan;
  12443. File deadMansPedalFile;
  12444. StringArray failedFiles;
  12445. int nextIndex;
  12446. float progress;
  12447. const StringArray getDeadMansPedalFile() throw();
  12448. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12449. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12450. const PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12451. };
  12452. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12453. /********* End of inlined file: juce_PluginDirectoryScanner.h *********/
  12454. #endif
  12455. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12456. /********* Start of inlined file: juce_PluginListComponent.h *********/
  12457. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12458. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12459. /********* Start of inlined file: juce_ListBox.h *********/
  12460. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12461. #define __JUCE_LISTBOX_JUCEHEADER__
  12462. class ListViewport;
  12463. class JUCE_API ListBoxModel
  12464. {
  12465. public:
  12466. virtual ~ListBoxModel() {}
  12467. virtual int getNumRows() = 0;
  12468. virtual void paintListBoxItem (int rowNumber,
  12469. Graphics& g,
  12470. int width, int height,
  12471. bool rowIsSelected) = 0;
  12472. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12473. Component* existingComponentToUpdate);
  12474. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12475. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12476. virtual void backgroundClicked();
  12477. virtual void selectedRowsChanged (int lastRowSelected);
  12478. virtual void deleteKeyPressed (int lastRowSelected);
  12479. virtual void returnKeyPressed (int lastRowSelected);
  12480. virtual void listWasScrolled();
  12481. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12482. virtual const String getTooltipForRow (int row);
  12483. };
  12484. class JUCE_API ListBox : public Component,
  12485. public SettableTooltipClient
  12486. {
  12487. public:
  12488. ListBox (const String& componentName,
  12489. ListBoxModel* const model);
  12490. ~ListBox();
  12491. void setModel (ListBoxModel* const newModel);
  12492. ListBoxModel* getModel() const throw() { return model; }
  12493. void updateContent();
  12494. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12495. void setMouseMoveSelectsRows (bool shouldSelect);
  12496. void selectRow (const int rowNumber,
  12497. bool dontScrollToShowThisRow = false,
  12498. bool deselectOthersFirst = true);
  12499. void selectRangeOfRows (int firstRow,
  12500. int lastRow);
  12501. void deselectRow (const int rowNumber);
  12502. void deselectAllRows();
  12503. void flipRowSelection (const int rowNumber);
  12504. const SparseSet<int> getSelectedRows() const;
  12505. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12506. const bool sendNotificationEventToModel = true);
  12507. bool isRowSelected (const int rowNumber) const;
  12508. int getNumSelectedRows() const;
  12509. int getSelectedRow (const int index = 0) const;
  12510. int getLastRowSelected() const;
  12511. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12512. const ModifierKeys& modifiers);
  12513. void setVerticalPosition (const double newProportion);
  12514. double getVerticalPosition() const;
  12515. void scrollToEnsureRowIsOnscreen (const int row);
  12516. ScrollBar* getVerticalScrollBar() const throw();
  12517. ScrollBar* getHorizontalScrollBar() const throw();
  12518. int getRowContainingPosition (const int x, const int y) const throw();
  12519. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12520. const Rectangle getRowPosition (const int rowNumber,
  12521. const bool relativeToComponentTopLeft) const throw();
  12522. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12523. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12524. int getVisibleRowWidth() const throw();
  12525. void setRowHeight (const int newHeight);
  12526. int getRowHeight() const throw() { return rowHeight; }
  12527. int getNumRowsOnScreen() const throw();
  12528. enum ColourIds
  12529. {
  12530. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12531. Make this transparent if you don't want the background to be filled. */
  12532. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12533. Make this transparent to not have an outline. */
  12534. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12535. };
  12536. void setOutlineThickness (const int outlineThickness);
  12537. int getOutlineThickness() const throw() { return outlineThickness; }
  12538. void setHeaderComponent (Component* const newHeaderComponent);
  12539. void setMinimumContentWidth (const int newMinimumWidth);
  12540. int getVisibleContentWidth() const throw();
  12541. void repaintRow (const int rowNumber) throw();
  12542. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12543. Viewport* getViewport() const throw();
  12544. bool keyPressed (const KeyPress& key);
  12545. bool keyStateChanged (const bool isKeyDown);
  12546. void paint (Graphics& g);
  12547. void paintOverChildren (Graphics& g);
  12548. void resized();
  12549. void visibilityChanged();
  12550. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12551. void mouseMove (const MouseEvent&);
  12552. void mouseExit (const MouseEvent&);
  12553. void mouseUp (const MouseEvent&);
  12554. void colourChanged();
  12555. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12556. juce_UseDebuggingNewOperator
  12557. private:
  12558. friend class ListViewport;
  12559. friend class TableListBox;
  12560. ListBoxModel* model;
  12561. ListViewport* viewport;
  12562. Component* headerComponent;
  12563. int totalItems, rowHeight, minimumRowWidth;
  12564. int outlineThickness;
  12565. int lastMouseX, lastMouseY, lastRowSelected;
  12566. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12567. SparseSet <int> selected;
  12568. void selectRowInternal (const int rowNumber,
  12569. bool dontScrollToShowThisRow,
  12570. bool deselectOthersFirst,
  12571. bool isMouseClick);
  12572. ListBox (const ListBox&);
  12573. const ListBox& operator= (const ListBox&);
  12574. };
  12575. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12576. /********* End of inlined file: juce_ListBox.h *********/
  12577. /********* Start of inlined file: juce_TextButton.h *********/
  12578. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12579. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12580. class JUCE_API TextButton : public Button
  12581. {
  12582. public:
  12583. TextButton (const String& buttonName,
  12584. const String& toolTip = String::empty);
  12585. ~TextButton();
  12586. enum ColourIds
  12587. {
  12588. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12589. 'off'). The look-and-feel class might re-interpret this to add
  12590. effects, etc. */
  12591. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12592. 'on'). The look-and-feel class might re-interpret this to add
  12593. effects, etc. */
  12594. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12595. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12596. };
  12597. void changeWidthToFitText (const int newHeight = -1);
  12598. virtual const Font getFont();
  12599. juce_UseDebuggingNewOperator
  12600. protected:
  12601. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12602. void colourChanged();
  12603. private:
  12604. TextButton (const TextButton&);
  12605. const TextButton& operator= (const TextButton&);
  12606. };
  12607. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12608. /********* End of inlined file: juce_TextButton.h *********/
  12609. class JUCE_API PluginListComponent : public Component,
  12610. public ListBoxModel,
  12611. public ChangeListener,
  12612. public ButtonListener,
  12613. public Timer
  12614. {
  12615. public:
  12616. PluginListComponent (KnownPluginList& listToRepresent,
  12617. const File& deadMansPedalFile,
  12618. PropertiesFile* const propertiesToUse);
  12619. ~PluginListComponent();
  12620. void resized();
  12621. bool isInterestedInFileDrag (const StringArray& files);
  12622. void filesDropped (const StringArray& files, int, int);
  12623. int getNumRows();
  12624. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12625. void deleteKeyPressed (int lastRowSelected);
  12626. void buttonClicked (Button* b);
  12627. void changeListenerCallback (void*);
  12628. void timerCallback();
  12629. juce_UseDebuggingNewOperator
  12630. private:
  12631. KnownPluginList& list;
  12632. File deadMansPedalFile;
  12633. ListBox* listBox;
  12634. TextButton* optionsButton;
  12635. PropertiesFile* propertiesToUse;
  12636. int typeToScan;
  12637. void scanFor (AudioPluginFormat* format);
  12638. PluginListComponent (const PluginListComponent&);
  12639. const PluginListComponent& operator= (const PluginListComponent&);
  12640. };
  12641. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12642. /********* End of inlined file: juce_PluginListComponent.h *********/
  12643. #endif
  12644. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12645. #endif
  12646. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12647. #endif
  12648. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12649. #endif
  12650. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12651. /********* Start of inlined file: juce_AudioProcessorGraph.h *********/
  12652. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12653. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12654. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12655. public AsyncUpdater
  12656. {
  12657. public:
  12658. AudioProcessorGraph();
  12659. ~AudioProcessorGraph();
  12660. class JUCE_API Node : public ReferenceCountedObject
  12661. {
  12662. public:
  12663. ~Node();
  12664. const uint32 id;
  12665. AudioProcessor* const processor;
  12666. PropertySet properties;
  12667. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12668. juce_UseDebuggingNewOperator
  12669. private:
  12670. friend class AudioProcessorGraph;
  12671. bool isPrepared;
  12672. Node (const uint32 id, AudioProcessor* const processor);
  12673. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12674. void unprepare();
  12675. Node (const Node&);
  12676. const Node& operator= (const Node&);
  12677. };
  12678. struct JUCE_API Connection
  12679. {
  12680. public:
  12681. uint32 sourceNodeId;
  12682. int sourceChannelIndex;
  12683. uint32 destNodeId;
  12684. int destChannelIndex;
  12685. juce_UseDebuggingNewOperator
  12686. private:
  12687. };
  12688. void clear();
  12689. int getNumNodes() const { return nodes.size(); }
  12690. Node* getNode (const int index) const { return nodes [index]; }
  12691. Node* getNodeForId (const uint32 nodeId) const;
  12692. Node* addNode (AudioProcessor* const newProcessor,
  12693. uint32 nodeId = 0);
  12694. bool removeNode (const uint32 nodeId);
  12695. int getNumConnections() const { return connections.size(); }
  12696. const Connection* getConnection (const int index) const { return connections [index]; }
  12697. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12698. const int sourceChannelIndex,
  12699. const uint32 destNodeId,
  12700. const int destChannelIndex) const;
  12701. bool isConnected (const uint32 possibleSourceNodeId,
  12702. const uint32 possibleDestNodeId) const;
  12703. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12704. const uint32 destNodeId, const int destChannelIndex) const;
  12705. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12706. const uint32 destNodeId, const int destChannelIndex);
  12707. void removeConnection (const int index);
  12708. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12709. const uint32 destNodeId, const int destChannelIndex);
  12710. bool disconnectNode (const uint32 nodeId);
  12711. bool removeIllegalConnections();
  12712. static const int midiChannelIndex;
  12713. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12714. {
  12715. public:
  12716. enum IODeviceType
  12717. {
  12718. audioInputNode, /**< In this mode, the processor has output channels
  12719. representing all the audio input channels that are
  12720. coming into its parent audio graph. */
  12721. audioOutputNode, /**< In this mode, the processor has input channels
  12722. representing all the audio output channels that are
  12723. going out of its parent audio graph. */
  12724. midiInputNode, /**< In this mode, the processor has a midi output which
  12725. delivers the same midi data that is arriving at its
  12726. parent graph. */
  12727. midiOutputNode /**< In this mode, the processor has a midi input and
  12728. any data sent to it will be passed out of the parent
  12729. graph. */
  12730. };
  12731. IODeviceType getType() const { return type; }
  12732. AudioProcessorGraph* getParentGraph() const { return graph; }
  12733. bool isInput() const;
  12734. bool isOutput() const;
  12735. AudioGraphIOProcessor (const IODeviceType type);
  12736. ~AudioGraphIOProcessor();
  12737. const String getName() const;
  12738. void fillInPluginDescription (PluginDescription& d) const;
  12739. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12740. void releaseResources();
  12741. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12742. const String getInputChannelName (const int channelIndex) const;
  12743. const String getOutputChannelName (const int channelIndex) const;
  12744. bool isInputChannelStereoPair (int index) const;
  12745. bool isOutputChannelStereoPair (int index) const;
  12746. bool acceptsMidi() const;
  12747. bool producesMidi() const;
  12748. AudioProcessorEditor* createEditor();
  12749. int getNumParameters();
  12750. const String getParameterName (int);
  12751. float getParameter (int);
  12752. const String getParameterText (int);
  12753. void setParameter (int, float);
  12754. int getNumPrograms();
  12755. int getCurrentProgram();
  12756. void setCurrentProgram (int);
  12757. const String getProgramName (int);
  12758. void changeProgramName (int, const String&);
  12759. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12760. void setStateInformation (const void* data, int sizeInBytes);
  12761. void setParentGraph (AudioProcessorGraph* const graph);
  12762. juce_UseDebuggingNewOperator
  12763. private:
  12764. const IODeviceType type;
  12765. AudioProcessorGraph* graph;
  12766. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  12767. const AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  12768. };
  12769. // AudioProcessor methods:
  12770. const String getName() const;
  12771. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12772. void releaseResources();
  12773. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12774. const String getInputChannelName (const int channelIndex) const;
  12775. const String getOutputChannelName (const int channelIndex) const;
  12776. bool isInputChannelStereoPair (int index) const;
  12777. bool isOutputChannelStereoPair (int index) const;
  12778. bool acceptsMidi() const;
  12779. bool producesMidi() const;
  12780. AudioProcessorEditor* createEditor() { return 0; }
  12781. int getNumParameters() { return 0; }
  12782. const String getParameterName (int) { return String::empty; }
  12783. float getParameter (int) { return 0; }
  12784. const String getParameterText (int) { return String::empty; }
  12785. void setParameter (int, float) { }
  12786. int getNumPrograms() { return 0; }
  12787. int getCurrentProgram() { return 0; }
  12788. void setCurrentProgram (int) { }
  12789. const String getProgramName (int) { return String::empty; }
  12790. void changeProgramName (int, const String&) { }
  12791. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12792. void setStateInformation (const void* data, int sizeInBytes);
  12793. void handleAsyncUpdate();
  12794. juce_UseDebuggingNewOperator
  12795. private:
  12796. ReferenceCountedArray <Node> nodes;
  12797. OwnedArray <Connection> connections;
  12798. int lastNodeId;
  12799. AudioSampleBuffer renderingBuffers;
  12800. OwnedArray <MidiBuffer> midiBuffers;
  12801. CriticalSection renderLock;
  12802. VoidArray renderingOps;
  12803. friend class AudioGraphIOProcessor;
  12804. AudioSampleBuffer* currentAudioInputBuffer;
  12805. AudioSampleBuffer currentAudioOutputBuffer;
  12806. MidiBuffer* currentMidiInputBuffer;
  12807. MidiBuffer currentMidiOutputBuffer;
  12808. void clearRenderingSequence();
  12809. void buildRenderingSequence();
  12810. bool isAnInputTo (const uint32 possibleInputId,
  12811. const uint32 possibleDestinationId,
  12812. const int recursionCheck) const;
  12813. AudioProcessorGraph (const AudioProcessorGraph&);
  12814. const AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  12815. };
  12816. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12817. /********* End of inlined file: juce_AudioProcessorGraph.h *********/
  12818. #endif
  12819. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12820. #endif
  12821. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12822. /********* Start of inlined file: juce_AudioProcessorPlayer.h *********/
  12823. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12824. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12825. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  12826. public MidiInputCallback
  12827. {
  12828. public:
  12829. AudioProcessorPlayer();
  12830. virtual ~AudioProcessorPlayer();
  12831. void setProcessor (AudioProcessor* const processorToPlay);
  12832. AudioProcessor* getCurrentProcessor() const { return processor; }
  12833. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  12834. void audioDeviceIOCallback (const float** inputChannelData,
  12835. int totalNumInputChannels,
  12836. float** outputChannelData,
  12837. int totalNumOutputChannels,
  12838. int numSamples);
  12839. void audioDeviceAboutToStart (AudioIODevice* device);
  12840. void audioDeviceStopped();
  12841. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12842. juce_UseDebuggingNewOperator
  12843. private:
  12844. AudioProcessor* processor;
  12845. CriticalSection lock;
  12846. double sampleRate;
  12847. int blockSize;
  12848. bool isPrepared;
  12849. int numInputChans, numOutputChans;
  12850. float* channels [128];
  12851. AudioSampleBuffer tempBuffer;
  12852. MidiBuffer incomingMidi;
  12853. MidiMessageCollector messageCollector;
  12854. AudioProcessorPlayer (const AudioProcessorPlayer&);
  12855. const AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  12856. };
  12857. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  12858. /********* End of inlined file: juce_AudioProcessorPlayer.h *********/
  12859. #endif
  12860. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12861. /********* Start of inlined file: juce_GenericAudioProcessorEditor.h *********/
  12862. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12863. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12864. /********* Start of inlined file: juce_PropertyPanel.h *********/
  12865. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  12866. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  12867. /********* Start of inlined file: juce_PropertyComponent.h *********/
  12868. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12869. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12870. class EditableProperty;
  12871. class JUCE_API PropertyComponent : public Component,
  12872. public SettableTooltipClient
  12873. {
  12874. public:
  12875. PropertyComponent (const String& propertyName,
  12876. const int preferredHeight = 25);
  12877. ~PropertyComponent();
  12878. int getPreferredHeight() const throw() { return preferredHeight; }
  12879. virtual void refresh() = 0;
  12880. void paint (Graphics& g);
  12881. void resized();
  12882. void enablementChanged();
  12883. juce_UseDebuggingNewOperator
  12884. protected:
  12885. int preferredHeight;
  12886. };
  12887. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  12888. /********* End of inlined file: juce_PropertyComponent.h *********/
  12889. class JUCE_API PropertyPanel : public Component
  12890. {
  12891. public:
  12892. PropertyPanel();
  12893. ~PropertyPanel();
  12894. void clear();
  12895. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  12896. void addSection (const String& sectionTitle,
  12897. const Array <PropertyComponent*>& newPropertyComponents,
  12898. const bool shouldSectionInitiallyBeOpen = true);
  12899. void refreshAll() const;
  12900. const StringArray getSectionNames() const;
  12901. bool isSectionOpen (const int sectionIndex) const;
  12902. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  12903. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  12904. XmlElement* getOpennessState() const;
  12905. void restoreOpennessState (const XmlElement& newState);
  12906. void setMessageWhenEmpty (const String& newMessage);
  12907. const String& getMessageWhenEmpty() const;
  12908. void paint (Graphics& g);
  12909. void resized();
  12910. juce_UseDebuggingNewOperator
  12911. private:
  12912. Viewport* viewport;
  12913. Component* propertyHolderComponent;
  12914. String messageWhenEmpty;
  12915. void updatePropHolderLayout() const;
  12916. void updatePropHolderLayout (const int width) const;
  12917. };
  12918. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  12919. /********* End of inlined file: juce_PropertyPanel.h *********/
  12920. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  12921. {
  12922. public:
  12923. GenericAudioProcessorEditor (AudioProcessor* const owner);
  12924. ~GenericAudioProcessorEditor();
  12925. void paint (Graphics& g);
  12926. void resized();
  12927. juce_UseDebuggingNewOperator
  12928. private:
  12929. PropertyPanel* panel;
  12930. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  12931. const GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  12932. };
  12933. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  12934. /********* End of inlined file: juce_GenericAudioProcessorEditor.h *********/
  12935. #endif
  12936. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12937. /********* Start of inlined file: juce_Sampler.h *********/
  12938. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  12939. #define __JUCE_SAMPLER_JUCEHEADER__
  12940. /********* Start of inlined file: juce_Synthesiser.h *********/
  12941. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  12942. #define __JUCE_SYNTHESISER_JUCEHEADER__
  12943. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  12944. {
  12945. protected:
  12946. SynthesiserSound();
  12947. public:
  12948. virtual ~SynthesiserSound();
  12949. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  12950. virtual bool appliesToChannel (const int midiChannel) = 0;
  12951. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  12952. juce_UseDebuggingNewOperator
  12953. };
  12954. class JUCE_API SynthesiserVoice
  12955. {
  12956. public:
  12957. SynthesiserVoice();
  12958. virtual ~SynthesiserVoice();
  12959. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  12960. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  12961. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  12962. virtual void startNote (const int midiNoteNumber,
  12963. const float velocity,
  12964. SynthesiserSound* sound,
  12965. const int currentPitchWheelPosition) = 0;
  12966. virtual void stopNote (const bool allowTailOff) = 0;
  12967. virtual void pitchWheelMoved (const int newValue) = 0;
  12968. virtual void controllerMoved (const int controllerNumber,
  12969. const int newValue) = 0;
  12970. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  12971. int startSample,
  12972. int numSamples) = 0;
  12973. bool isPlayingChannel (const int midiChannel) const;
  12974. void setCurrentPlaybackSampleRate (const double newRate);
  12975. juce_UseDebuggingNewOperator
  12976. protected:
  12977. double getSampleRate() const { return currentSampleRate; }
  12978. void clearCurrentNote();
  12979. private:
  12980. friend class Synthesiser;
  12981. double currentSampleRate;
  12982. int currentlyPlayingNote;
  12983. uint32 noteOnTime;
  12984. SynthesiserSound::Ptr currentlyPlayingSound;
  12985. };
  12986. class JUCE_API Synthesiser
  12987. {
  12988. public:
  12989. Synthesiser();
  12990. virtual ~Synthesiser();
  12991. void clearVoices();
  12992. int getNumVoices() const { return voices.size(); }
  12993. SynthesiserVoice* getVoice (const int index) const;
  12994. void addVoice (SynthesiserVoice* const newVoice);
  12995. void removeVoice (const int index);
  12996. void clearSounds();
  12997. int getNumSounds() const { return sounds.size(); }
  12998. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  12999. void addSound (const SynthesiserSound::Ptr& newSound);
  13000. void removeSound (const int index);
  13001. void setNoteStealingEnabled (const bool shouldStealNotes);
  13002. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13003. virtual void noteOn (const int midiChannel,
  13004. const int midiNoteNumber,
  13005. const float velocity);
  13006. virtual void noteOff (const int midiChannel,
  13007. const int midiNoteNumber,
  13008. const bool allowTailOff);
  13009. virtual void allNotesOff (const int midiChannel,
  13010. const bool allowTailOff);
  13011. virtual void handlePitchWheel (const int midiChannel,
  13012. const int wheelValue);
  13013. virtual void handleController (const int midiChannel,
  13014. const int controllerNumber,
  13015. const int controllerValue);
  13016. void setCurrentPlaybackSampleRate (const double sampleRate);
  13017. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13018. const MidiBuffer& inputMidi,
  13019. int startSample,
  13020. int numSamples);
  13021. juce_UseDebuggingNewOperator
  13022. protected:
  13023. CriticalSection lock;
  13024. OwnedArray <SynthesiserVoice> voices;
  13025. ReferenceCountedArray <SynthesiserSound> sounds;
  13026. int lastPitchWheelValues [16];
  13027. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13028. const bool stealIfNoneAvailable) const;
  13029. void startVoice (SynthesiserVoice* const voice,
  13030. SynthesiserSound* const sound,
  13031. const int midiChannel,
  13032. const int midiNoteNumber,
  13033. const float velocity);
  13034. int findFreeVoice (const bool) const { return 0; }
  13035. private:
  13036. double sampleRate;
  13037. uint32 lastNoteOnCounter;
  13038. bool shouldStealNotes;
  13039. Synthesiser (const Synthesiser&);
  13040. const Synthesiser& operator= (const Synthesiser&);
  13041. };
  13042. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13043. /********* End of inlined file: juce_Synthesiser.h *********/
  13044. class JUCE_API SamplerSound : public SynthesiserSound
  13045. {
  13046. public:
  13047. SamplerSound (const String& name,
  13048. AudioFormatReader& source,
  13049. const BitArray& midiNotes,
  13050. const int midiNoteForNormalPitch,
  13051. const double attackTimeSecs,
  13052. const double releaseTimeSecs,
  13053. const double maxSampleLengthSeconds);
  13054. ~SamplerSound();
  13055. const String& getName() const { return name; }
  13056. AudioSampleBuffer* getAudioData() const { return data; }
  13057. bool appliesToNote (const int midiNoteNumber);
  13058. bool appliesToChannel (const int midiChannel);
  13059. juce_UseDebuggingNewOperator
  13060. private:
  13061. friend class SamplerVoice;
  13062. String name;
  13063. ScopedPointer <AudioSampleBuffer> data;
  13064. double sourceSampleRate;
  13065. BitArray midiNotes;
  13066. int length, attackSamples, releaseSamples;
  13067. int midiRootNote;
  13068. };
  13069. class JUCE_API SamplerVoice : public SynthesiserVoice
  13070. {
  13071. public:
  13072. SamplerVoice();
  13073. ~SamplerVoice();
  13074. bool canPlaySound (SynthesiserSound* sound);
  13075. void startNote (const int midiNoteNumber,
  13076. const float velocity,
  13077. SynthesiserSound* sound,
  13078. const int currentPitchWheelPosition);
  13079. void stopNote (const bool allowTailOff);
  13080. void pitchWheelMoved (const int newValue);
  13081. void controllerMoved (const int controllerNumber,
  13082. const int newValue);
  13083. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13084. juce_UseDebuggingNewOperator
  13085. private:
  13086. double pitchRatio;
  13087. double sourceSamplePosition;
  13088. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13089. bool isInAttack, isInRelease;
  13090. };
  13091. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13092. /********* End of inlined file: juce_Sampler.h *********/
  13093. #endif
  13094. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13095. #endif
  13096. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13097. /********* Start of inlined file: juce_ActionBroadcaster.h *********/
  13098. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13099. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13100. /********* Start of inlined file: juce_ActionListenerList.h *********/
  13101. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13102. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13103. class JUCE_API ActionListenerList : public MessageListener
  13104. {
  13105. public:
  13106. ActionListenerList() throw();
  13107. ~ActionListenerList() throw();
  13108. void addActionListener (ActionListener* const listener) throw();
  13109. void removeActionListener (ActionListener* const listener) throw();
  13110. void removeAllActionListeners() throw();
  13111. void sendActionMessage (const String& message) const;
  13112. void handleMessage (const Message&);
  13113. juce_UseDebuggingNewOperator
  13114. private:
  13115. SortedSet <void*> actionListeners_;
  13116. CriticalSection actionListenerLock_;
  13117. ActionListenerList (const ActionListenerList&);
  13118. const ActionListenerList& operator= (const ActionListenerList&);
  13119. };
  13120. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13121. /********* End of inlined file: juce_ActionListenerList.h *********/
  13122. class JUCE_API ActionBroadcaster
  13123. {
  13124. public:
  13125. ActionBroadcaster() throw();
  13126. virtual ~ActionBroadcaster();
  13127. void addActionListener (ActionListener* const listener);
  13128. void removeActionListener (ActionListener* const listener);
  13129. void removeAllActionListeners();
  13130. void sendActionMessage (const String& message) const;
  13131. private:
  13132. ActionListenerList actionListenerList;
  13133. ActionBroadcaster (const ActionBroadcaster&);
  13134. const ActionBroadcaster& operator= (const ActionBroadcaster&);
  13135. };
  13136. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13137. /********* End of inlined file: juce_ActionBroadcaster.h *********/
  13138. #endif
  13139. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13140. #endif
  13141. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13142. #endif
  13143. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13144. #endif
  13145. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13146. /********* Start of inlined file: juce_CallbackMessage.h *********/
  13147. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13148. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13149. class JUCE_API CallbackMessage : public Message
  13150. {
  13151. public:
  13152. CallbackMessage() throw();
  13153. ~CallbackMessage() throw();
  13154. virtual void messageCallback() = 0;
  13155. void post();
  13156. juce_UseDebuggingNewOperator
  13157. private:
  13158. CallbackMessage (const CallbackMessage&);
  13159. const CallbackMessage& operator= (const CallbackMessage&);
  13160. };
  13161. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13162. /********* End of inlined file: juce_CallbackMessage.h *********/
  13163. #endif
  13164. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13165. #endif
  13166. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13167. #endif
  13168. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13169. #endif
  13170. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13171. /********* Start of inlined file: juce_InterprocessConnection.h *********/
  13172. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13173. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13174. class InterprocessConnectionServer;
  13175. class JUCE_API InterprocessConnection : public Thread,
  13176. private MessageListener
  13177. {
  13178. public:
  13179. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13180. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13181. ~InterprocessConnection();
  13182. bool connectToSocket (const String& hostName,
  13183. const int portNumber,
  13184. const int timeOutMillisecs);
  13185. bool connectToPipe (const String& pipeName,
  13186. const int pipeReceiveMessageTimeoutMs = -1);
  13187. bool createPipe (const String& pipeName,
  13188. const int pipeReceiveMessageTimeoutMs = -1);
  13189. void disconnect();
  13190. bool isConnected() const;
  13191. StreamingSocket* getSocket() const throw() { return socket; }
  13192. NamedPipe* getPipe() const throw() { return pipe; }
  13193. const String getConnectedHostName() const;
  13194. bool sendMessage (const MemoryBlock& message);
  13195. virtual void connectionMade() = 0;
  13196. virtual void connectionLost() = 0;
  13197. virtual void messageReceived (const MemoryBlock& message) = 0;
  13198. juce_UseDebuggingNewOperator
  13199. private:
  13200. CriticalSection pipeAndSocketLock;
  13201. ScopedPointer <StreamingSocket> socket;
  13202. ScopedPointer <NamedPipe> pipe;
  13203. bool callbackConnectionState;
  13204. const bool useMessageThread;
  13205. const uint32 magicMessageHeader;
  13206. int pipeReceiveMessageTimeout;
  13207. friend class InterprocessConnectionServer;
  13208. void initialiseWithSocket (StreamingSocket* const socket_);
  13209. void initialiseWithPipe (NamedPipe* const pipe_);
  13210. void handleMessage (const Message& message);
  13211. void connectionMadeInt();
  13212. void connectionLostInt();
  13213. void deliverDataInt (const MemoryBlock& data);
  13214. bool readNextMessageInt();
  13215. void run();
  13216. InterprocessConnection (const InterprocessConnection&);
  13217. const InterprocessConnection& operator= (const InterprocessConnection&);
  13218. };
  13219. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13220. /********* End of inlined file: juce_InterprocessConnection.h *********/
  13221. #endif
  13222. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13223. /********* Start of inlined file: juce_InterprocessConnectionServer.h *********/
  13224. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13225. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13226. class JUCE_API InterprocessConnectionServer : private Thread
  13227. {
  13228. public:
  13229. InterprocessConnectionServer();
  13230. ~InterprocessConnectionServer();
  13231. bool beginWaitingForSocket (const int portNumber);
  13232. void stop();
  13233. protected:
  13234. virtual InterprocessConnection* createConnectionObject() = 0;
  13235. public:
  13236. juce_UseDebuggingNewOperator
  13237. private:
  13238. ScopedPointer <StreamingSocket> socket;
  13239. void run();
  13240. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13241. const InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13242. };
  13243. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13244. /********* End of inlined file: juce_InterprocessConnectionServer.h *********/
  13245. #endif
  13246. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13247. #endif
  13248. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13249. #endif
  13250. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13251. /********* Start of inlined file: juce_MessageManager.h *********/
  13252. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13253. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13254. class Component;
  13255. class MessageManagerLock;
  13256. typedef void* (MessageCallbackFunction) (void* userData);
  13257. class JUCE_API MessageManager
  13258. {
  13259. public:
  13260. static MessageManager* getInstance() throw();
  13261. void runDispatchLoop();
  13262. void stopDispatchLoop();
  13263. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13264. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13265. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13266. void* userData);
  13267. bool isThisTheMessageThread() const throw();
  13268. void setCurrentMessageThread (const Thread::ThreadID threadId) throw();
  13269. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13270. bool currentThreadHasLockedMessageManager() const throw();
  13271. static void broadcastMessage (const String& messageText) throw();
  13272. void registerBroadcastListener (ActionListener* listener) throw();
  13273. void deregisterBroadcastListener (ActionListener* listener) throw();
  13274. void deliverMessage (void*);
  13275. void deliverBroadcastMessage (const String&);
  13276. ~MessageManager() throw();
  13277. juce_UseDebuggingNewOperator
  13278. private:
  13279. MessageManager() throw();
  13280. friend class MessageListener;
  13281. friend class ChangeBroadcaster;
  13282. friend class ActionBroadcaster;
  13283. friend class CallbackMessage;
  13284. static MessageManager* instance;
  13285. SortedSet <const MessageListener*> messageListeners;
  13286. ScopedPointer <ActionListenerList> broadcastListeners;
  13287. friend class JUCEApplication;
  13288. bool quitMessagePosted, quitMessageReceived;
  13289. Thread::ThreadID messageThreadId;
  13290. VoidArray modalComponents;
  13291. static void* exitModalLoopCallback (void*);
  13292. void postMessageToQueue (Message* const message);
  13293. void postCallbackMessage (Message* const message);
  13294. static void doPlatformSpecificInitialisation();
  13295. static void doPlatformSpecificShutdown();
  13296. friend class MessageManagerLock;
  13297. Thread::ThreadID volatile threadWithLock;
  13298. CriticalSection lockingLock;
  13299. MessageManager (const MessageManager&);
  13300. const MessageManager& operator= (const MessageManager&);
  13301. };
  13302. class JUCE_API MessageManagerLock
  13303. {
  13304. public:
  13305. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13306. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13307. ~MessageManagerLock() throw();
  13308. bool lockWasGained() const throw() { return locked; }
  13309. private:
  13310. bool locked, needsUnlocking;
  13311. void* sharedEvents;
  13312. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13313. MessageManagerLock (const MessageManagerLock&);
  13314. const MessageManagerLock& operator= (const MessageManagerLock&);
  13315. };
  13316. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13317. /********* End of inlined file: juce_MessageManager.h *********/
  13318. #endif
  13319. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13320. /********* Start of inlined file: juce_MultiTimer.h *********/
  13321. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13322. #define __JUCE_MULTITIMER_JUCEHEADER__
  13323. class JUCE_API MultiTimer
  13324. {
  13325. protected:
  13326. MultiTimer() throw();
  13327. MultiTimer (const MultiTimer& other) throw();
  13328. public:
  13329. virtual ~MultiTimer();
  13330. virtual void timerCallback (const int timerId) = 0;
  13331. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13332. void stopTimer (const int timerId) throw();
  13333. bool isTimerRunning (const int timerId) const throw();
  13334. int getTimerInterval (const int timerId) const throw();
  13335. private:
  13336. class MultiTimerCallback;
  13337. CriticalSection timerListLock;
  13338. OwnedArray <MultiTimerCallback> timers;
  13339. const MultiTimer& operator= (const MultiTimer&);
  13340. };
  13341. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13342. /********* End of inlined file: juce_MultiTimer.h *********/
  13343. #endif
  13344. #ifndef __JUCE_TIMER_JUCEHEADER__
  13345. #endif
  13346. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13347. /********* Start of inlined file: juce_ArrowButton.h *********/
  13348. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13349. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13350. /********* Start of inlined file: juce_DropShadowEffect.h *********/
  13351. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13352. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13353. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13354. {
  13355. public:
  13356. DropShadowEffect();
  13357. ~DropShadowEffect();
  13358. void setShadowProperties (const float newRadius,
  13359. const float newOpacity,
  13360. const int newShadowOffsetX,
  13361. const int newShadowOffsetY);
  13362. void applyEffect (Image& sourceImage, Graphics& destContext);
  13363. juce_UseDebuggingNewOperator
  13364. private:
  13365. int offsetX, offsetY;
  13366. float radius, opacity;
  13367. };
  13368. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13369. /********* End of inlined file: juce_DropShadowEffect.h *********/
  13370. class JUCE_API ArrowButton : public Button
  13371. {
  13372. public:
  13373. ArrowButton (const String& buttonName,
  13374. float arrowDirection,
  13375. const Colour& arrowColour);
  13376. ~ArrowButton();
  13377. juce_UseDebuggingNewOperator
  13378. protected:
  13379. void paintButton (Graphics& g,
  13380. bool isMouseOverButton,
  13381. bool isButtonDown);
  13382. void buttonStateChanged();
  13383. private:
  13384. Colour colour;
  13385. DropShadowEffect shadow;
  13386. Path path;
  13387. int offset;
  13388. ArrowButton (const ArrowButton&);
  13389. const ArrowButton& operator= (const ArrowButton&);
  13390. };
  13391. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13392. /********* End of inlined file: juce_ArrowButton.h *********/
  13393. #endif
  13394. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13395. #endif
  13396. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13397. /********* Start of inlined file: juce_DrawableButton.h *********/
  13398. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13399. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13400. /********* Start of inlined file: juce_Drawable.h *********/
  13401. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13402. #define __JUCE_DRAWABLE_JUCEHEADER__
  13403. class JUCE_API Drawable
  13404. {
  13405. protected:
  13406. Drawable();
  13407. public:
  13408. virtual ~Drawable();
  13409. virtual Drawable* createCopy() const = 0;
  13410. void draw (Graphics& g, const float opacity,
  13411. const AffineTransform& transform = AffineTransform::identity) const;
  13412. void drawAt (Graphics& g,
  13413. const float x,
  13414. const float y,
  13415. const float opacity) const;
  13416. void drawWithin (Graphics& g,
  13417. const int destX,
  13418. const int destY,
  13419. const int destWidth,
  13420. const int destHeight,
  13421. const RectanglePlacement& placement,
  13422. const float opacity) const;
  13423. class RenderingContext
  13424. {
  13425. public:
  13426. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13427. Graphics& g;
  13428. AffineTransform transform;
  13429. float opacity;
  13430. private:
  13431. const RenderingContext& operator= (const RenderingContext&);
  13432. };
  13433. virtual void render (const RenderingContext& context) const = 0;
  13434. virtual void getBounds (float& x, float& y, float& width, float& height) const = 0;
  13435. virtual bool hitTest (float x, float y) const = 0;
  13436. const String& getName() const throw() { return name; }
  13437. void setName (const String& newName) throw() { name = newName; }
  13438. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13439. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13440. static Drawable* createFromImageFile (const File& file);
  13441. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13442. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13443. virtual ValueTree createValueTree() const throw() = 0;
  13444. juce_UseDebuggingNewOperator
  13445. private:
  13446. Drawable (const Drawable&);
  13447. const Drawable& operator= (const Drawable&);
  13448. String name;
  13449. };
  13450. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13451. /********* End of inlined file: juce_Drawable.h *********/
  13452. class JUCE_API DrawableButton : public Button
  13453. {
  13454. public:
  13455. enum ButtonStyle
  13456. {
  13457. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13458. ImageRaw, /**< The button will just display the images in their normal size and position.
  13459. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13460. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13461. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13462. };
  13463. DrawableButton (const String& buttonName,
  13464. const ButtonStyle buttonStyle);
  13465. ~DrawableButton();
  13466. void setImages (const Drawable* normalImage,
  13467. const Drawable* overImage = 0,
  13468. const Drawable* downImage = 0,
  13469. const Drawable* disabledImage = 0,
  13470. const Drawable* normalImageOn = 0,
  13471. const Drawable* overImageOn = 0,
  13472. const Drawable* downImageOn = 0,
  13473. const Drawable* disabledImageOn = 0);
  13474. void setButtonStyle (const ButtonStyle newStyle);
  13475. void setBackgroundColours (const Colour& toggledOffColour,
  13476. const Colour& toggledOnColour);
  13477. const Colour& getBackgroundColour() const throw();
  13478. void setEdgeIndent (const int numPixelsIndent);
  13479. const Drawable* getCurrentImage() const throw();
  13480. const Drawable* getNormalImage() const throw();
  13481. const Drawable* getOverImage() const throw();
  13482. const Drawable* getDownImage() const throw();
  13483. juce_UseDebuggingNewOperator
  13484. protected:
  13485. void paintButton (Graphics& g,
  13486. bool isMouseOverButton,
  13487. bool isButtonDown);
  13488. private:
  13489. ButtonStyle style;
  13490. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13491. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13492. Colour backgroundOff, backgroundOn;
  13493. int edgeIndent;
  13494. void deleteImages();
  13495. DrawableButton (const DrawableButton&);
  13496. const DrawableButton& operator= (const DrawableButton&);
  13497. };
  13498. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13499. /********* End of inlined file: juce_DrawableButton.h *********/
  13500. #endif
  13501. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13502. /********* Start of inlined file: juce_HyperlinkButton.h *********/
  13503. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13504. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13505. class JUCE_API HyperlinkButton : public Button
  13506. {
  13507. public:
  13508. HyperlinkButton (const String& linkText,
  13509. const URL& linkURL);
  13510. ~HyperlinkButton();
  13511. void setFont (const Font& newFont,
  13512. const bool resizeToMatchComponentHeight,
  13513. const Justification& justificationType = Justification::horizontallyCentred);
  13514. enum ColourIds
  13515. {
  13516. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13517. };
  13518. void setURL (const URL& newURL) throw();
  13519. const URL& getURL() const throw() { return url; }
  13520. void changeWidthToFitText();
  13521. juce_UseDebuggingNewOperator
  13522. protected:
  13523. void clicked();
  13524. void colourChanged();
  13525. void paintButton (Graphics& g,
  13526. bool isMouseOverButton,
  13527. bool isButtonDown);
  13528. private:
  13529. URL url;
  13530. Font font;
  13531. bool resizeFont;
  13532. Justification justification;
  13533. const Font getFontToUse() const;
  13534. HyperlinkButton (const HyperlinkButton&);
  13535. const HyperlinkButton& operator= (const HyperlinkButton&);
  13536. };
  13537. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13538. /********* End of inlined file: juce_HyperlinkButton.h *********/
  13539. #endif
  13540. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13541. /********* Start of inlined file: juce_ImageButton.h *********/
  13542. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13543. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13544. class JUCE_API ImageButton : public Button
  13545. {
  13546. public:
  13547. ImageButton (const String& name);
  13548. ~ImageButton();
  13549. void setImages (const bool resizeButtonNowToFitThisImage,
  13550. const bool rescaleImagesWhenButtonSizeChanges,
  13551. const bool preserveImageProportions,
  13552. Image* const normalImage,
  13553. const float imageOpacityWhenNormal,
  13554. const Colour& overlayColourWhenNormal,
  13555. Image* const overImage,
  13556. const float imageOpacityWhenOver,
  13557. const Colour& overlayColourWhenOver,
  13558. Image* const downImage,
  13559. const float imageOpacityWhenDown,
  13560. const Colour& overlayColourWhenDown,
  13561. const float hitTestAlphaThreshold = 0.0f);
  13562. Image* getNormalImage() const throw();
  13563. Image* getOverImage() const throw();
  13564. Image* getDownImage() const throw();
  13565. juce_UseDebuggingNewOperator
  13566. protected:
  13567. bool hitTest (int x, int y);
  13568. void paintButton (Graphics& g,
  13569. bool isMouseOverButton,
  13570. bool isButtonDown);
  13571. private:
  13572. bool scaleImageToFit, preserveProportions;
  13573. unsigned char alphaThreshold;
  13574. int imageX, imageY, imageW, imageH;
  13575. Image* normalImage;
  13576. Image* overImage;
  13577. Image* downImage;
  13578. float normalOpacity, overOpacity, downOpacity;
  13579. Colour normalOverlay, overOverlay, downOverlay;
  13580. Image* getCurrentImage() const;
  13581. void deleteImages();
  13582. ImageButton (const ImageButton&);
  13583. const ImageButton& operator= (const ImageButton&);
  13584. };
  13585. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13586. /********* End of inlined file: juce_ImageButton.h *********/
  13587. #endif
  13588. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13589. /********* Start of inlined file: juce_ShapeButton.h *********/
  13590. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13591. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13592. class JUCE_API ShapeButton : public Button
  13593. {
  13594. public:
  13595. ShapeButton (const String& name,
  13596. const Colour& normalColour,
  13597. const Colour& overColour,
  13598. const Colour& downColour);
  13599. ~ShapeButton();
  13600. void setShape (const Path& newShape,
  13601. const bool resizeNowToFitThisShape,
  13602. const bool maintainShapeProportions,
  13603. const bool hasDropShadow);
  13604. void setColours (const Colour& normalColour,
  13605. const Colour& overColour,
  13606. const Colour& downColour);
  13607. void setOutline (const Colour& outlineColour,
  13608. const float outlineStrokeWidth);
  13609. juce_UseDebuggingNewOperator
  13610. protected:
  13611. void paintButton (Graphics& g,
  13612. bool isMouseOverButton,
  13613. bool isButtonDown);
  13614. private:
  13615. Colour normalColour, overColour, downColour, outlineColour;
  13616. DropShadowEffect shadow;
  13617. Path shape;
  13618. bool maintainShapeProportions;
  13619. float outlineWidth;
  13620. ShapeButton (const ShapeButton&);
  13621. const ShapeButton& operator= (const ShapeButton&);
  13622. };
  13623. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13624. /********* End of inlined file: juce_ShapeButton.h *********/
  13625. #endif
  13626. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13627. #endif
  13628. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13629. /********* Start of inlined file: juce_ToggleButton.h *********/
  13630. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13631. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13632. class JUCE_API ToggleButton : public Button
  13633. {
  13634. public:
  13635. ToggleButton (const String& buttonText);
  13636. ~ToggleButton();
  13637. void changeWidthToFitText();
  13638. enum ColourIds
  13639. {
  13640. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13641. };
  13642. juce_UseDebuggingNewOperator
  13643. protected:
  13644. void paintButton (Graphics& g,
  13645. bool isMouseOverButton,
  13646. bool isButtonDown);
  13647. void colourChanged();
  13648. private:
  13649. ToggleButton (const ToggleButton&);
  13650. const ToggleButton& operator= (const ToggleButton&);
  13651. };
  13652. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13653. /********* End of inlined file: juce_ToggleButton.h *********/
  13654. #endif
  13655. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13656. /********* Start of inlined file: juce_ToolbarButton.h *********/
  13657. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13658. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13659. /********* Start of inlined file: juce_ToolbarItemComponent.h *********/
  13660. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13661. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13662. /********* Start of inlined file: juce_Toolbar.h *********/
  13663. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13664. #define __JUCE_TOOLBAR_JUCEHEADER__
  13665. /********* Start of inlined file: juce_DragAndDropContainer.h *********/
  13666. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13667. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13668. /********* Start of inlined file: juce_DragAndDropTarget.h *********/
  13669. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13670. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13671. class JUCE_API DragAndDropTarget
  13672. {
  13673. public:
  13674. virtual ~DragAndDropTarget() {}
  13675. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13676. Component* sourceComponent) = 0;
  13677. virtual void itemDragEnter (const String& sourceDescription,
  13678. Component* sourceComponent,
  13679. int x,
  13680. int y);
  13681. virtual void itemDragMove (const String& sourceDescription,
  13682. Component* sourceComponent,
  13683. int x,
  13684. int y);
  13685. virtual void itemDragExit (const String& sourceDescription,
  13686. Component* sourceComponent);
  13687. virtual void itemDropped (const String& sourceDescription,
  13688. Component* sourceComponent,
  13689. int x,
  13690. int y) = 0;
  13691. virtual bool shouldDrawDragImageWhenOver();
  13692. };
  13693. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13694. /********* End of inlined file: juce_DragAndDropTarget.h *********/
  13695. class JUCE_API DragAndDropContainer
  13696. {
  13697. public:
  13698. DragAndDropContainer();
  13699. virtual ~DragAndDropContainer();
  13700. void startDragging (const String& sourceDescription,
  13701. Component* sourceComponent,
  13702. Image* dragImage = 0,
  13703. const bool allowDraggingToOtherJuceWindows = false,
  13704. const Point* imageOffsetFromMouse = 0);
  13705. bool isDragAndDropActive() const;
  13706. const String getCurrentDragDescription() const;
  13707. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13708. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  13709. static bool performExternalDragDropOfText (const String& text);
  13710. juce_UseDebuggingNewOperator
  13711. protected:
  13712. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13713. Component* dragSourceComponent,
  13714. StringArray& files,
  13715. bool& canMoveFiles);
  13716. private:
  13717. friend class DragImageComponent;
  13718. ScopedPointer <Component> dragImageComponent;
  13719. String currentDragDesc;
  13720. };
  13721. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13722. /********* End of inlined file: juce_DragAndDropContainer.h *********/
  13723. /********* Start of inlined file: juce_ComponentAnimator.h *********/
  13724. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13725. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13726. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13727. private Timer
  13728. {
  13729. public:
  13730. ComponentAnimator();
  13731. ~ComponentAnimator();
  13732. void animateComponent (Component* const component,
  13733. const Rectangle& finalPosition,
  13734. const int millisecondsToSpendMoving,
  13735. const double startSpeed = 1.0,
  13736. const double endSpeed = 1.0);
  13737. void cancelAnimation (Component* const component,
  13738. const bool moveComponentToItsFinalPosition);
  13739. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13740. const Rectangle getComponentDestination (Component* const component);
  13741. bool isAnimating (Component* component) const;
  13742. juce_UseDebuggingNewOperator
  13743. private:
  13744. VoidArray tasks;
  13745. uint32 lastTime;
  13746. void* findTaskFor (Component* const component) const;
  13747. void timerCallback();
  13748. };
  13749. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13750. /********* End of inlined file: juce_ComponentAnimator.h *********/
  13751. class ToolbarItemComponent;
  13752. class ToolbarItemFactory;
  13753. class MissingItemsComponent;
  13754. class JUCE_API Toolbar : public Component,
  13755. public DragAndDropContainer,
  13756. public DragAndDropTarget,
  13757. private ButtonListener
  13758. {
  13759. public:
  13760. Toolbar();
  13761. ~Toolbar();
  13762. void setVertical (const bool shouldBeVertical);
  13763. bool isVertical() const throw() { return vertical; }
  13764. int getThickness() const throw();
  13765. int getLength() const throw();
  13766. void clear();
  13767. void addItem (ToolbarItemFactory& factory,
  13768. const int itemId,
  13769. const int insertIndex = -1);
  13770. void removeToolbarItem (const int itemIndex);
  13771. int getNumItems() const throw();
  13772. int getItemId (const int itemIndex) const throw();
  13773. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  13774. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  13775. enum ToolbarItemStyle
  13776. {
  13777. iconsOnly, /**< Means that the toolbar should just contain icons. */
  13778. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  13779. textOnly /**< Means that the toolbar only display text labels for each item. */
  13780. };
  13781. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13782. void setStyle (const ToolbarItemStyle& newStyle);
  13783. enum CustomisationFlags
  13784. {
  13785. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  13786. show the "icons only" option on its choice of toolbar styles. */
  13787. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  13788. show the "icons with text" option on its choice of toolbar styles. */
  13789. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  13790. show the "text only" option on its choice of toolbar styles. */
  13791. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  13792. show a button to reset the toolbar to its default set of items. */
  13793. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  13794. };
  13795. void showCustomisationDialog (ToolbarItemFactory& factory,
  13796. const int optionFlags = allCustomisationOptionsEnabled);
  13797. void setEditingActive (const bool editingEnabled);
  13798. enum ColourIds
  13799. {
  13800. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  13801. more control over this, override LookAndFeel::paintToolbarBackground(). */
  13802. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  13803. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  13804. over them. */
  13805. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  13806. held down on them. */
  13807. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  13808. when the style is set to iconsWithText or textOnly. */
  13809. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  13810. the customisation dialog is active and the mouse moves over them. */
  13811. };
  13812. const String toString() const;
  13813. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  13814. const String& savedVersion);
  13815. void paint (Graphics& g);
  13816. void resized();
  13817. void buttonClicked (Button*);
  13818. void mouseDown (const MouseEvent&);
  13819. bool isInterestedInDragSource (const String&, Component*);
  13820. void itemDragMove (const String&, Component*, int, int);
  13821. void itemDragExit (const String&, Component*);
  13822. void itemDropped (const String&, Component*, int, int);
  13823. void updateAllItemPositions (const bool animate);
  13824. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  13825. juce_UseDebuggingNewOperator
  13826. private:
  13827. Button* missingItemsButton;
  13828. bool vertical, isEditingActive;
  13829. ToolbarItemStyle toolbarStyle;
  13830. ComponentAnimator animator;
  13831. friend class MissingItemsComponent;
  13832. Array <ToolbarItemComponent*> items;
  13833. friend class ItemDragAndDropOverlayComponent;
  13834. static const tchar* const toolbarDragDescriptor;
  13835. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  13836. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  13837. Toolbar (const Toolbar&);
  13838. const Toolbar& operator= (const Toolbar&);
  13839. };
  13840. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  13841. /********* End of inlined file: juce_Toolbar.h *********/
  13842. class ItemDragAndDropOverlayComponent;
  13843. class JUCE_API ToolbarItemComponent : public Button
  13844. {
  13845. public:
  13846. ToolbarItemComponent (const int itemId,
  13847. const String& labelText,
  13848. const bool isBeingUsedAsAButton);
  13849. ~ToolbarItemComponent();
  13850. int getItemId() const throw() { return itemId; }
  13851. Toolbar* getToolbar() const;
  13852. bool isToolbarVertical() const;
  13853. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13854. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  13855. const Rectangle getContentArea() const throw() { return contentArea; }
  13856. virtual bool getToolbarItemSizes (int toolbarThickness,
  13857. bool isToolbarVertical,
  13858. int& preferredSize,
  13859. int& minSize,
  13860. int& maxSize) = 0;
  13861. virtual void paintButtonArea (Graphics& g,
  13862. int width, int height,
  13863. bool isMouseOver, bool isMouseDown) = 0;
  13864. virtual void contentAreaChanged (const Rectangle& newBounds) = 0;
  13865. enum ToolbarEditingMode
  13866. {
  13867. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  13868. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  13869. customisation mode, and the items can be dragged around. */
  13870. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  13871. dragged onto a toolbar to add it to that bar.*/
  13872. };
  13873. void setEditingMode (const ToolbarEditingMode newMode);
  13874. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  13875. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  13876. void resized();
  13877. juce_UseDebuggingNewOperator
  13878. private:
  13879. friend class Toolbar;
  13880. friend class ItemDragAndDropOverlayComponent;
  13881. const int itemId;
  13882. ToolbarEditingMode mode;
  13883. Toolbar::ToolbarItemStyle toolbarStyle;
  13884. ScopedPointer <Component> overlayComp;
  13885. int dragOffsetX, dragOffsetY;
  13886. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  13887. Rectangle contentArea;
  13888. ToolbarItemComponent (const ToolbarItemComponent&);
  13889. const ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  13890. };
  13891. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13892. /********* End of inlined file: juce_ToolbarItemComponent.h *********/
  13893. class JUCE_API ToolbarButton : public ToolbarItemComponent
  13894. {
  13895. public:
  13896. ToolbarButton (const int itemId,
  13897. const String& labelText,
  13898. Drawable* const normalImage,
  13899. Drawable* const toggledOnImage);
  13900. ~ToolbarButton();
  13901. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  13902. int& minSize, int& maxSize);
  13903. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  13904. void contentAreaChanged (const Rectangle& newBounds);
  13905. juce_UseDebuggingNewOperator
  13906. private:
  13907. ScopedPointer <Drawable> normalImage, toggledOnImage;
  13908. ToolbarButton (const ToolbarButton&);
  13909. const ToolbarButton& operator= (const ToolbarButton&);
  13910. };
  13911. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13912. /********* End of inlined file: juce_ToolbarButton.h *********/
  13913. #endif
  13914. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13915. /********* Start of inlined file: juce_CodeDocument.h *********/
  13916. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  13917. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  13918. class CodeDocumentLine;
  13919. class JUCE_API CodeDocument
  13920. {
  13921. public:
  13922. CodeDocument();
  13923. ~CodeDocument();
  13924. class JUCE_API Position
  13925. {
  13926. public:
  13927. Position() throw();
  13928. Position (const CodeDocument* const ownerDocument,
  13929. const int line, const int indexInLine) throw();
  13930. Position (const CodeDocument* const ownerDocument,
  13931. const int charactersFromStartOfDocument) throw();
  13932. Position (const Position& other) throw();
  13933. ~Position() throw();
  13934. const Position& operator= (const Position& other) throw();
  13935. bool operator== (const Position& other) const throw();
  13936. bool operator!= (const Position& other) const throw();
  13937. void setPosition (const int charactersFromStartOfDocument) throw();
  13938. int getPosition() const throw() { return characterPos; }
  13939. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  13940. int getLineNumber() const throw() { return line; }
  13941. int getIndexInLine() const throw() { return indexInLine; }
  13942. void setPositionMaintained (const bool isMaintained) throw();
  13943. void moveBy (int characterDelta) throw();
  13944. const Position movedBy (const int characterDelta) const throw();
  13945. const Position movedByLines (const int deltaLines) const throw();
  13946. const tchar getCharacter() const throw();
  13947. const String getLineText() const throw();
  13948. private:
  13949. CodeDocument* owner;
  13950. int characterPos, line, indexInLine;
  13951. bool positionMaintained;
  13952. };
  13953. const String getAllContent() const throw();
  13954. const String getTextBetween (const Position& start, const Position& end) const throw();
  13955. const String getLine (const int lineIndex) const throw();
  13956. int getNumCharacters() const throw();
  13957. int getNumLines() const throw() { return lines.size(); }
  13958. int getMaximumLineLength() throw();
  13959. void deleteSection (const Position& startPosition, const Position& endPosition);
  13960. void insertText (const Position& position, const String& text);
  13961. void replaceAllContent (const String& newContent);
  13962. const String getNewLineCharacters() const throw() { return newLineChars; }
  13963. void setNewLineCharacters (const String& newLine) throw();
  13964. void newTransaction();
  13965. void undo();
  13966. void redo();
  13967. void clearUndoHistory();
  13968. UndoManager& getUndoManager() throw() { return undoManager; }
  13969. void setSavePoint() throw();
  13970. bool hasChangedSinceSavePoint() const throw();
  13971. const Position findWordBreakAfter (const Position& position) const throw();
  13972. const Position findWordBreakBefore (const Position& position) const throw();
  13973. class JUCE_API Listener
  13974. {
  13975. public:
  13976. Listener() {}
  13977. virtual ~Listener() {}
  13978. virtual void codeDocumentChanged (const Position& affectedTextStart,
  13979. const Position& affectedTextEnd) = 0;
  13980. };
  13981. void addListener (Listener* const listener) throw();
  13982. void removeListener (Listener* const listener) throw();
  13983. class Iterator
  13984. {
  13985. public:
  13986. Iterator (CodeDocument* const document) throw();
  13987. Iterator (const Iterator& other);
  13988. const Iterator& operator= (const Iterator& other) throw();
  13989. ~Iterator() throw();
  13990. juce_wchar nextChar() throw();
  13991. juce_wchar peekNextChar() const throw();
  13992. void skip() throw();
  13993. int getPosition() const throw() { return position; }
  13994. void skipWhitespace();
  13995. void skipToEndOfLine();
  13996. int getLine() const throw() { return line; }
  13997. bool isEOF() const throw();
  13998. private:
  13999. CodeDocument* document;
  14000. int line, position;
  14001. };
  14002. juce_UseDebuggingNewOperator
  14003. private:
  14004. friend class CodeDocumentInsertAction;
  14005. friend class CodeDocumentDeleteAction;
  14006. friend class Iterator;
  14007. friend class Position;
  14008. OwnedArray <CodeDocumentLine> lines;
  14009. Array <Position*> positionsToMaintain;
  14010. UndoManager undoManager;
  14011. int currentActionIndex, indexOfSavedState;
  14012. int maximumLineLength;
  14013. VoidArray listeners;
  14014. String newLineChars;
  14015. void sendListenerChangeMessage (const int startLine, const int endLine);
  14016. void insert (const String& text, const int insertPos, const bool undoable);
  14017. void remove (const int startPos, const int endPos, const bool undoable);
  14018. CodeDocument (const CodeDocument&);
  14019. const CodeDocument& operator= (const CodeDocument&);
  14020. };
  14021. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14022. /********* End of inlined file: juce_CodeDocument.h *********/
  14023. #endif
  14024. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14025. /********* Start of inlined file: juce_CodeEditorComponent.h *********/
  14026. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14027. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14028. /********* Start of inlined file: juce_CodeTokeniser.h *********/
  14029. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14030. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14031. class JUCE_API CodeTokeniser
  14032. {
  14033. public:
  14034. CodeTokeniser() {}
  14035. virtual ~CodeTokeniser() {}
  14036. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14037. virtual const StringArray getTokenTypes() = 0;
  14038. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14039. juce_UseDebuggingNewOperator
  14040. };
  14041. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14042. /********* End of inlined file: juce_CodeTokeniser.h *********/
  14043. class CodeEditorLine;
  14044. class JUCE_API CodeEditorComponent : public Component,
  14045. public Timer,
  14046. public ScrollBarListener,
  14047. public CodeDocument::Listener,
  14048. public AsyncUpdater
  14049. {
  14050. public:
  14051. CodeEditorComponent (CodeDocument& document,
  14052. CodeTokeniser* const codeTokeniser);
  14053. ~CodeEditorComponent();
  14054. CodeDocument& getDocument() const throw() { return document; }
  14055. void loadContent (const String& newContent);
  14056. float getCharWidth() const throw() { return charWidth; }
  14057. int getLineHeight() const throw() { return lineHeight; }
  14058. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14059. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14060. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14061. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14062. const Rectangle getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14063. const CodeDocument::Position getPositionAt (int x, int y);
  14064. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14065. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14066. void cursorDown (const bool selecting);
  14067. void cursorUp (const bool selecting);
  14068. void pageDown (const bool selecting);
  14069. void pageUp (const bool selecting);
  14070. void scrollDown();
  14071. void scrollUp();
  14072. void scrollToLine (int newFirstLineOnScreen);
  14073. void scrollBy (int deltaLines);
  14074. void scrollToColumn (int newFirstColumnOnScreen);
  14075. void scrollToKeepCaretOnScreen();
  14076. void goToStartOfDocument (const bool selecting);
  14077. void goToStartOfLine (const bool selecting);
  14078. void goToEndOfDocument (const bool selecting);
  14079. void goToEndOfLine (const bool selecting);
  14080. void deselectAll();
  14081. void selectAll();
  14082. void insertTextAtCaret (const String& textToInsert);
  14083. void insertTabAtCaret();
  14084. void cut();
  14085. void copy();
  14086. void copyThenCut();
  14087. void paste();
  14088. void backspace (const bool moveInWholeWordSteps);
  14089. void deleteForward (const bool moveInWholeWordSteps);
  14090. void undo();
  14091. void redo();
  14092. void setTabSize (const int numSpacesPerTab,
  14093. const bool insertSpacesInsteadOfTabCharacters) throw();
  14094. int getTabSize() const throw() { return spacesPerTab; }
  14095. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14096. void setFont (const Font& newFont);
  14097. void resetToDefaultColours();
  14098. void setColourForTokenType (const int tokenType, const Colour& colour);
  14099. const Colour getColourForTokenType (const int tokenType) const throw();
  14100. enum ColourIds
  14101. {
  14102. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14103. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14104. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14105. selected text. */
  14106. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14107. enabled. */
  14108. };
  14109. void setScrollbarThickness (const int thickness) throw();
  14110. void resized();
  14111. void paint (Graphics& g);
  14112. bool keyPressed (const KeyPress& key);
  14113. void mouseDown (const MouseEvent& e);
  14114. void mouseDrag (const MouseEvent& e);
  14115. void mouseUp (const MouseEvent& e);
  14116. void mouseDoubleClick (const MouseEvent& e);
  14117. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14118. void timerCallback();
  14119. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14120. void handleAsyncUpdate();
  14121. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14122. const CodeDocument::Position& affectedTextEnd);
  14123. juce_UseDebuggingNewOperator
  14124. private:
  14125. CodeDocument& document;
  14126. Font font;
  14127. int firstLineOnScreen, gutter, spacesPerTab;
  14128. float charWidth;
  14129. int lineHeight, linesOnScreen, columnsOnScreen;
  14130. int scrollbarThickness;
  14131. bool useSpacesForTabs;
  14132. double xOffset;
  14133. CodeDocument::Position caretPos;
  14134. CodeDocument::Position selectionStart, selectionEnd;
  14135. Component* caret;
  14136. ScrollBar* verticalScrollBar;
  14137. ScrollBar* horizontalScrollBar;
  14138. enum DragType
  14139. {
  14140. notDragging,
  14141. draggingSelectionStart,
  14142. draggingSelectionEnd
  14143. };
  14144. DragType dragType;
  14145. CodeTokeniser* codeTokeniser;
  14146. Array <Colour> coloursForTokenCategories;
  14147. OwnedArray <CodeEditorLine> lines;
  14148. void rebuildLineTokens();
  14149. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14150. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14151. void updateCachedIterators (int maxLineNum);
  14152. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14153. void updateScrollBars();
  14154. void scrollToLineInternal (int line);
  14155. void scrollToColumnInternal (double column);
  14156. void newTransaction();
  14157. int indexToColumn (int line, int index) const throw();
  14158. int columnToIndex (int line, int column) const throw();
  14159. CodeEditorComponent (const CodeEditorComponent&);
  14160. const CodeEditorComponent& operator= (const CodeEditorComponent&);
  14161. };
  14162. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14163. /********* End of inlined file: juce_CodeEditorComponent.h *********/
  14164. #endif
  14165. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14166. #endif
  14167. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14168. /********* Start of inlined file: juce_CPlusPlusCodeTokeniser.h *********/
  14169. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14170. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14171. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14172. {
  14173. public:
  14174. CPlusPlusCodeTokeniser();
  14175. ~CPlusPlusCodeTokeniser();
  14176. enum TokenType
  14177. {
  14178. tokenType_error = 0,
  14179. tokenType_comment,
  14180. tokenType_builtInKeyword,
  14181. tokenType_identifier,
  14182. tokenType_integerLiteral,
  14183. tokenType_floatLiteral,
  14184. tokenType_stringLiteral,
  14185. tokenType_operator,
  14186. tokenType_bracket,
  14187. tokenType_punctuation,
  14188. tokenType_preprocessor
  14189. };
  14190. int readNextToken (CodeDocument::Iterator& source);
  14191. const StringArray getTokenTypes();
  14192. const Colour getDefaultColour (const int tokenType);
  14193. juce_UseDebuggingNewOperator
  14194. };
  14195. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14196. /********* End of inlined file: juce_CPlusPlusCodeTokeniser.h *********/
  14197. #endif
  14198. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14199. #endif
  14200. #ifndef __JUCE_LABEL_JUCEHEADER__
  14201. #endif
  14202. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14203. #endif
  14204. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14205. /********* Start of inlined file: juce_ProgressBar.h *********/
  14206. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14207. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14208. class JUCE_API ProgressBar : public Component,
  14209. public SettableTooltipClient,
  14210. private Timer
  14211. {
  14212. public:
  14213. ProgressBar (double& progress);
  14214. ~ProgressBar();
  14215. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14216. void setTextToDisplay (const String& text);
  14217. enum ColourIds
  14218. {
  14219. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14220. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14221. classes will probably use variations on this colour. */
  14222. };
  14223. juce_UseDebuggingNewOperator
  14224. protected:
  14225. void paint (Graphics& g);
  14226. void lookAndFeelChanged();
  14227. void visibilityChanged();
  14228. void colourChanged();
  14229. private:
  14230. double& progress;
  14231. double currentValue;
  14232. bool displayPercentage;
  14233. String displayedMessage, currentMessage;
  14234. uint32 lastCallbackTime;
  14235. void timerCallback();
  14236. ProgressBar (const ProgressBar&);
  14237. const ProgressBar& operator= (const ProgressBar&);
  14238. };
  14239. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14240. /********* End of inlined file: juce_ProgressBar.h *********/
  14241. #endif
  14242. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14243. /********* Start of inlined file: juce_Slider.h *********/
  14244. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14245. #define __JUCE_SLIDER_JUCEHEADER__
  14246. /********* Start of inlined file: juce_SliderListener.h *********/
  14247. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14248. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14249. class Slider;
  14250. class JUCE_API SliderListener
  14251. {
  14252. public:
  14253. virtual ~SliderListener() {}
  14254. virtual void sliderValueChanged (Slider* slider) = 0;
  14255. virtual void sliderDragStarted (Slider* slider);
  14256. virtual void sliderDragEnded (Slider* slider);
  14257. };
  14258. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14259. /********* End of inlined file: juce_SliderListener.h *********/
  14260. class JUCE_API Slider : public Component,
  14261. public SettableTooltipClient,
  14262. private AsyncUpdater,
  14263. private ButtonListener,
  14264. private LabelListener,
  14265. private Value::Listener
  14266. {
  14267. public:
  14268. Slider (const String& componentName);
  14269. ~Slider();
  14270. enum SliderStyle
  14271. {
  14272. LinearHorizontal, /**< A traditional horizontal slider. */
  14273. LinearVertical, /**< A traditional vertical slider. */
  14274. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14275. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14276. @see setRotaryParameters */
  14277. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14278. @see setRotaryParameters */
  14279. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14280. @see setRotaryParameters */
  14281. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14282. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14283. @see setMinValue, setMaxValue */
  14284. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14285. @see setMinValue, setMaxValue */
  14286. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14287. value, with the current value being somewhere between them.
  14288. @see setMinValue, setMaxValue */
  14289. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14290. value, with the current value being somewhere between them.
  14291. @see setMinValue, setMaxValue */
  14292. };
  14293. void setSliderStyle (const SliderStyle newStyle);
  14294. SliderStyle getSliderStyle() const { return style; }
  14295. void setRotaryParameters (const float startAngleRadians,
  14296. const float endAngleRadians,
  14297. const bool stopAtEnd);
  14298. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14299. void setVelocityBasedMode (const bool isVelocityBased);
  14300. bool getVelocityBasedMode() const { return isVelocityBased; }
  14301. void setVelocityModeParameters (const double sensitivity = 1.0,
  14302. const int threshold = 1,
  14303. const double offset = 0.0,
  14304. const bool userCanPressKeyToSwapMode = true);
  14305. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14306. int getVelocityThreshold() const { return velocityModeThreshold; }
  14307. double getVelocityOffset() const { return velocityModeOffset; }
  14308. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14309. void setSkewFactor (const double factor);
  14310. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14311. double getSkewFactor() const { return skewFactor; }
  14312. enum IncDecButtonMode
  14313. {
  14314. incDecButtonsNotDraggable,
  14315. incDecButtonsDraggable_AutoDirection,
  14316. incDecButtonsDraggable_Horizontal,
  14317. incDecButtonsDraggable_Vertical
  14318. };
  14319. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14320. enum TextEntryBoxPosition
  14321. {
  14322. NoTextBox, /**< Doesn't display a text box. */
  14323. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14324. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14325. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14326. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14327. };
  14328. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14329. const bool isReadOnly,
  14330. const int textEntryBoxWidth,
  14331. const int textEntryBoxHeight);
  14332. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14333. int getTextBoxWidth() const { return textBoxWidth; }
  14334. int getTextBoxHeight() const { return textBoxHeight; }
  14335. void setTextBoxIsEditable (const bool shouldBeEditable);
  14336. bool isTextBoxEditable() const { return editableText; }
  14337. void showTextBox();
  14338. void hideTextBox (const bool discardCurrentEditorContents);
  14339. void setValue (double newValue,
  14340. const bool sendUpdateMessage = true,
  14341. const bool sendMessageSynchronously = false);
  14342. double getValue() const;
  14343. Value& getValueObject() { return currentValue; }
  14344. void setRange (const double newMinimum,
  14345. const double newMaximum,
  14346. const double newInterval = 0);
  14347. double getMaximum() const { return maximum; }
  14348. double getMinimum() const { return minimum; }
  14349. double getInterval() const { return interval; }
  14350. double getMinValue() const;
  14351. Value& getMinValueObject() { return valueMin; }
  14352. void setMinValue (double newValue,
  14353. const bool sendUpdateMessage = true,
  14354. const bool sendMessageSynchronously = false,
  14355. const bool allowNudgingOfOtherValues = false);
  14356. double getMaxValue() const;
  14357. Value& getMaxValueObject() { return valueMax; }
  14358. void setMaxValue (double newValue,
  14359. const bool sendUpdateMessage = true,
  14360. const bool sendMessageSynchronously = false,
  14361. const bool allowNudgingOfOtherValues = false);
  14362. void addListener (SliderListener* const listener);
  14363. void removeListener (SliderListener* const listener);
  14364. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14365. const double valueToSetOnDoubleClick);
  14366. double getDoubleClickReturnValue (bool& isEnabled) const;
  14367. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14368. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14369. void setPopupDisplayEnabled (const bool isEnabled,
  14370. Component* const parentComponentToUse);
  14371. void setPopupMenuEnabled (const bool menuEnabled);
  14372. void setScrollWheelEnabled (const bool enabled);
  14373. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14374. virtual void startedDragging();
  14375. virtual void stoppedDragging();
  14376. virtual void valueChanged();
  14377. /** Callback to indicate that the user has just moved the slider.
  14378. Note - the valueChanged() method has changed its format and now no longer has
  14379. any parameters. Update your code to use the new version.
  14380. This version has been left here with an int as its return value to cause
  14381. a syntax error if you've got existing code that uses the old version.
  14382. */
  14383. virtual int valueChanged (double) { jassertfalse; return 0; }
  14384. virtual double getValueFromText (const String& text);
  14385. virtual const String getTextFromValue (double value);
  14386. void setTextValueSuffix (const String& suffix);
  14387. virtual double proportionOfLengthToValue (double proportion);
  14388. virtual double valueToProportionOfLength (double value);
  14389. float getPositionOfValue (const double value);
  14390. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14391. void updateText();
  14392. bool isHorizontal() const;
  14393. bool isVertical() const;
  14394. enum ColourIds
  14395. {
  14396. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14397. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14398. and feel class how this is used. */
  14399. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14400. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14401. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14402. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14403. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14404. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14405. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14406. };
  14407. juce_UseDebuggingNewOperator
  14408. protected:
  14409. void labelTextChanged (Label*);
  14410. void paint (Graphics& g);
  14411. void resized();
  14412. void mouseDown (const MouseEvent& e);
  14413. void mouseUp (const MouseEvent& e);
  14414. void mouseDrag (const MouseEvent& e);
  14415. void mouseDoubleClick (const MouseEvent& e);
  14416. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14417. void modifierKeysChanged (const ModifierKeys& modifiers);
  14418. void buttonClicked (Button* button);
  14419. void lookAndFeelChanged();
  14420. void enablementChanged();
  14421. void focusOfChildComponentChanged (FocusChangeType cause);
  14422. void handleAsyncUpdate();
  14423. void colourChanged();
  14424. void valueChanged (Value& value);
  14425. private:
  14426. SortedSet <void*> listeners;
  14427. Value currentValue, valueMin, valueMax;
  14428. double lastCurrentValue, lastValueMin, lastValueMax;
  14429. double minimum, maximum, interval, doubleClickReturnValue;
  14430. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14431. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14432. int velocityModeThreshold;
  14433. float rotaryStart, rotaryEnd;
  14434. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14435. int mouseDragStartX, mouseDragStartY;
  14436. int sliderRegionStart, sliderRegionSize;
  14437. int sliderBeingDragged;
  14438. int pixelsForFullDragExtent;
  14439. Rectangle sliderRect;
  14440. String textSuffix;
  14441. SliderStyle style;
  14442. TextEntryBoxPosition textBoxPos;
  14443. int textBoxWidth, textBoxHeight;
  14444. IncDecButtonMode incDecButtonMode;
  14445. bool editableText : 1, doubleClickToValue : 1;
  14446. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14447. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14448. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14449. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14450. Font font;
  14451. Label* valueBox;
  14452. Button* incButton;
  14453. Button* decButton;
  14454. ScopedPointer <Component> popupDisplay;
  14455. Component* parentForPopupDisplay;
  14456. float getLinearSliderPos (const double value);
  14457. void restoreMouseIfHidden();
  14458. void sendDragStart();
  14459. void sendDragEnd();
  14460. double constrainedValue (double value) const;
  14461. void triggerChangeMessage (const bool synchronous);
  14462. bool incDecDragDirectionIsHorizontal() const;
  14463. Slider (const Slider&);
  14464. const Slider& operator= (const Slider&);
  14465. };
  14466. #endif // __JUCE_SLIDER_JUCEHEADER__
  14467. /********* End of inlined file: juce_Slider.h *********/
  14468. #endif
  14469. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14470. #endif
  14471. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14472. /********* Start of inlined file: juce_TableHeaderComponent.h *********/
  14473. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14474. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14475. class TableHeaderComponent;
  14476. class JUCE_API TableHeaderListener
  14477. {
  14478. public:
  14479. TableHeaderListener() {}
  14480. virtual ~TableHeaderListener() {}
  14481. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14482. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14483. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14484. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14485. int columnIdNowBeingDragged);
  14486. };
  14487. class JUCE_API TableHeaderComponent : public Component,
  14488. private AsyncUpdater
  14489. {
  14490. public:
  14491. TableHeaderComponent();
  14492. ~TableHeaderComponent();
  14493. enum ColumnPropertyFlags
  14494. {
  14495. 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. */
  14496. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14497. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14498. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14499. 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. */
  14500. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14501. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14502. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14503. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14504. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14505. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14506. };
  14507. void addColumn (const String& columnName,
  14508. const int columnId,
  14509. const int width,
  14510. const int minimumWidth = 30,
  14511. const int maximumWidth = -1,
  14512. const int propertyFlags = defaultFlags,
  14513. const int insertIndex = -1);
  14514. void removeColumn (const int columnIdToRemove);
  14515. void removeAllColumns();
  14516. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14517. const String getColumnName (const int columnId) const;
  14518. void setColumnName (const int columnId, const String& newName);
  14519. void moveColumn (const int columnId, int newVisibleIndex);
  14520. int getColumnWidth (const int columnId) const;
  14521. void setColumnWidth (const int columnId, const int newWidth);
  14522. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14523. bool isColumnVisible (const int columnId) const;
  14524. void setSortColumnId (const int columnId, const bool sortForwards);
  14525. int getSortColumnId() const;
  14526. bool isSortedForwards() const;
  14527. void reSortTable();
  14528. int getTotalWidth() const;
  14529. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14530. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14531. const Rectangle getColumnPosition (const int index) const;
  14532. int getColumnIdAtX (const int xToFind) const;
  14533. void setStretchToFitActive (const bool shouldStretchToFit);
  14534. bool isStretchToFitActive() const;
  14535. void resizeAllColumnsToFit (int targetTotalWidth);
  14536. void setPopupMenuActive (const bool hasMenu);
  14537. bool isPopupMenuActive() const;
  14538. const String toString() const;
  14539. void restoreFromString (const String& storedVersion);
  14540. void addListener (TableHeaderListener* const newListener);
  14541. void removeListener (TableHeaderListener* const listenerToRemove);
  14542. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14543. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14544. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14545. void paint (Graphics& g);
  14546. void resized();
  14547. void mouseMove (const MouseEvent&);
  14548. void mouseEnter (const MouseEvent&);
  14549. void mouseExit (const MouseEvent&);
  14550. void mouseDown (const MouseEvent&);
  14551. void mouseDrag (const MouseEvent&);
  14552. void mouseUp (const MouseEvent&);
  14553. const MouseCursor getMouseCursor();
  14554. virtual void showColumnChooserMenu (const int columnIdClicked);
  14555. juce_UseDebuggingNewOperator
  14556. private:
  14557. struct ColumnInfo
  14558. {
  14559. String name;
  14560. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14561. double lastDeliberateWidth;
  14562. bool isVisible() const;
  14563. };
  14564. OwnedArray <ColumnInfo> columns;
  14565. Array <TableHeaderListener*> listeners;
  14566. ScopedPointer <Component> dragOverlayComp;
  14567. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14568. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14569. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14570. ColumnInfo* getInfoForId (const int columnId) const;
  14571. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14572. void sendColumnsChanged();
  14573. void handleAsyncUpdate();
  14574. void beginDrag (const MouseEvent&);
  14575. void endDrag (const int finalIndex);
  14576. int getResizeDraggerAt (const int mouseX) const;
  14577. void updateColumnUnderMouse (int x, int y);
  14578. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14579. TableHeaderComponent (const TableHeaderComponent&);
  14580. const TableHeaderComponent operator= (const TableHeaderComponent&);
  14581. };
  14582. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14583. /********* End of inlined file: juce_TableHeaderComponent.h *********/
  14584. #endif
  14585. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14586. /********* Start of inlined file: juce_TableListBox.h *********/
  14587. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14588. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14589. class JUCE_API TableListBoxModel
  14590. {
  14591. public:
  14592. TableListBoxModel() {}
  14593. virtual ~TableListBoxModel() {}
  14594. virtual int getNumRows() = 0;
  14595. virtual void paintRowBackground (Graphics& g,
  14596. int rowNumber,
  14597. int width, int height,
  14598. bool rowIsSelected) = 0;
  14599. virtual void paintCell (Graphics& g,
  14600. int rowNumber,
  14601. int columnId,
  14602. int width, int height,
  14603. bool rowIsSelected) = 0;
  14604. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14605. Component* existingComponentToUpdate);
  14606. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14607. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14608. virtual void backgroundClicked();
  14609. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14610. virtual int getColumnAutoSizeWidth (int columnId);
  14611. virtual const String getCellTooltip (int rowNumber, int columnId);
  14612. virtual void selectedRowsChanged (int lastRowSelected);
  14613. virtual void deleteKeyPressed (int lastRowSelected);
  14614. virtual void returnKeyPressed (int lastRowSelected);
  14615. virtual void listWasScrolled();
  14616. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14617. };
  14618. class JUCE_API TableListBox : public ListBox,
  14619. private ListBoxModel,
  14620. private TableHeaderListener
  14621. {
  14622. public:
  14623. TableListBox (const String& componentName,
  14624. TableListBoxModel* const model);
  14625. ~TableListBox();
  14626. void setModel (TableListBoxModel* const newModel);
  14627. TableListBoxModel* getModel() const { return model; }
  14628. TableHeaderComponent* getHeader() const { return header; }
  14629. void setHeaderHeight (const int newHeight);
  14630. int getHeaderHeight() const;
  14631. void autoSizeColumn (const int columnId);
  14632. void autoSizeAllColumns();
  14633. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14634. bool isAutoSizeMenuOptionShown() const;
  14635. const Rectangle getCellPosition (const int columnId,
  14636. const int rowNumber,
  14637. const bool relativeToComponentTopLeft) const;
  14638. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14639. int getNumRows();
  14640. void paintListBoxItem (int, Graphics&, int, int, bool);
  14641. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14642. void selectedRowsChanged (int lastRowSelected);
  14643. void deleteKeyPressed (int currentSelectedRow);
  14644. void returnKeyPressed (int currentSelectedRow);
  14645. void backgroundClicked();
  14646. void listWasScrolled();
  14647. void tableColumnsChanged (TableHeaderComponent*);
  14648. void tableColumnsResized (TableHeaderComponent*);
  14649. void tableSortOrderChanged (TableHeaderComponent*);
  14650. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14651. void resized();
  14652. juce_UseDebuggingNewOperator
  14653. private:
  14654. TableHeaderComponent* header;
  14655. TableListBoxModel* model;
  14656. int columnIdNowBeingDragged;
  14657. bool autoSizeOptionsShown;
  14658. void updateColumnComponents() const;
  14659. TableListBox (const TableListBox&);
  14660. const TableListBox& operator= (const TableListBox&);
  14661. };
  14662. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14663. /********* End of inlined file: juce_TableListBox.h *********/
  14664. #endif
  14665. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14666. #endif
  14667. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14668. #endif
  14669. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14670. #endif
  14671. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14672. /********* Start of inlined file: juce_ToolbarItemFactory.h *********/
  14673. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14674. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14675. class JUCE_API ToolbarItemFactory
  14676. {
  14677. public:
  14678. ToolbarItemFactory();
  14679. virtual ~ToolbarItemFactory();
  14680. enum SpecialItemIds
  14681. {
  14682. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14683. can be placed between sets of items to break them into groups. */
  14684. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14685. items.*/
  14686. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14687. either side of it, filling any available space. */
  14688. };
  14689. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14690. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14691. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14692. };
  14693. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14694. /********* End of inlined file: juce_ToolbarItemFactory.h *********/
  14695. #endif
  14696. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14697. /********* Start of inlined file: juce_ToolbarItemPalette.h *********/
  14698. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14699. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14700. class JUCE_API ToolbarItemPalette : public Component,
  14701. public DragAndDropContainer
  14702. {
  14703. public:
  14704. ToolbarItemPalette (ToolbarItemFactory& factory,
  14705. Toolbar* const toolbar);
  14706. ~ToolbarItemPalette();
  14707. void resized();
  14708. juce_UseDebuggingNewOperator
  14709. private:
  14710. ToolbarItemFactory& factory;
  14711. Toolbar* toolbar;
  14712. Viewport* viewport;
  14713. friend class Toolbar;
  14714. void replaceComponent (ToolbarItemComponent* const comp);
  14715. ToolbarItemPalette (const ToolbarItemPalette&);
  14716. const ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14717. };
  14718. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14719. /********* End of inlined file: juce_ToolbarItemPalette.h *********/
  14720. #endif
  14721. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14722. /********* Start of inlined file: juce_TreeView.h *********/
  14723. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14724. #define __JUCE_TREEVIEW_JUCEHEADER__
  14725. /********* Start of inlined file: juce_FileDragAndDropTarget.h *********/
  14726. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14727. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14728. class JUCE_API FileDragAndDropTarget
  14729. {
  14730. public:
  14731. virtual ~FileDragAndDropTarget() {}
  14732. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14733. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14734. virtual void fileDragMove (const StringArray& files, int x, int y);
  14735. virtual void fileDragExit (const StringArray& files);
  14736. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14737. };
  14738. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14739. /********* End of inlined file: juce_FileDragAndDropTarget.h *********/
  14740. class TreeView;
  14741. class JUCE_API TreeViewItem
  14742. {
  14743. public:
  14744. TreeViewItem();
  14745. virtual ~TreeViewItem();
  14746. int getNumSubItems() const throw();
  14747. TreeViewItem* getSubItem (const int index) const throw();
  14748. void clearSubItems();
  14749. void addSubItem (TreeViewItem* const newItem,
  14750. const int insertPosition = -1);
  14751. void removeSubItem (const int index,
  14752. const bool deleteItem = true);
  14753. TreeView* getOwnerView() const throw() { return ownerView; }
  14754. TreeViewItem* getParentItem() const throw() { return parentItem; }
  14755. bool isOpen() const throw();
  14756. void setOpen (const bool shouldBeOpen);
  14757. bool isSelected() const throw();
  14758. void setSelected (const bool shouldBeSelected,
  14759. const bool deselectOtherItemsFirst);
  14760. const Rectangle getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  14761. void treeHasChanged() const throw();
  14762. void repaintItem() const;
  14763. int getRowNumberInTree() const throw();
  14764. bool areAllParentsOpen() const throw();
  14765. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  14766. virtual bool mightContainSubItems() = 0;
  14767. virtual const String getUniqueName() const;
  14768. virtual void itemOpennessChanged (bool isNowOpen);
  14769. virtual int getItemWidth() const { return -1; }
  14770. virtual int getItemHeight() const { return 20; }
  14771. virtual bool canBeSelected() const { return true; }
  14772. virtual Component* createItemComponent() { return 0; }
  14773. virtual void paintItem (Graphics& g, int width, int height);
  14774. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  14775. virtual void itemClicked (const MouseEvent& e);
  14776. virtual void itemDoubleClicked (const MouseEvent& e);
  14777. virtual void itemSelectionChanged (bool isNowSelected);
  14778. virtual const String getTooltip();
  14779. virtual const String getDragSourceDescription();
  14780. virtual bool isInterestedInFileDrag (const StringArray& files);
  14781. virtual void filesDropped (const StringArray& files, int insertIndex);
  14782. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14783. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  14784. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  14785. XmlElement* getOpennessState() const throw();
  14786. void restoreOpennessState (const XmlElement& xml) throw();
  14787. int getIndexInParent() const throw();
  14788. bool isLastOfSiblings() const throw();
  14789. const String getItemIdentifierString() const;
  14790. juce_UseDebuggingNewOperator
  14791. private:
  14792. TreeView* ownerView;
  14793. TreeViewItem* parentItem;
  14794. OwnedArray <TreeViewItem> subItems;
  14795. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  14796. int uid;
  14797. bool selected : 1;
  14798. bool redrawNeeded : 1;
  14799. bool drawLinesInside : 1;
  14800. bool drawsInLeftMargin : 1;
  14801. unsigned int openness : 2;
  14802. friend class TreeView;
  14803. friend class TreeViewContentComponent;
  14804. void updatePositions (int newY);
  14805. int getIndentX() const throw();
  14806. void setOwnerView (TreeView* const newOwner) throw();
  14807. void paintRecursively (Graphics& g, int width);
  14808. TreeViewItem* getTopLevelItem() throw();
  14809. TreeViewItem* findItemRecursively (int y) throw();
  14810. TreeViewItem* getDeepestOpenParentItem() throw();
  14811. int getNumRows() const throw();
  14812. TreeViewItem* getItemOnRow (int index) throw();
  14813. void deselectAllRecursively();
  14814. int countSelectedItemsRecursively() const throw();
  14815. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  14816. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  14817. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  14818. TreeViewItem (const TreeViewItem&);
  14819. const TreeViewItem& operator= (const TreeViewItem&);
  14820. };
  14821. class JUCE_API TreeView : public Component,
  14822. public SettableTooltipClient,
  14823. public FileDragAndDropTarget,
  14824. public DragAndDropTarget,
  14825. private AsyncUpdater
  14826. {
  14827. public:
  14828. TreeView (const String& componentName = String::empty);
  14829. ~TreeView();
  14830. void setRootItem (TreeViewItem* const newRootItem);
  14831. TreeViewItem* getRootItem() const throw() { return rootItem; }
  14832. void deleteRootItem();
  14833. void setRootItemVisible (const bool shouldBeVisible);
  14834. bool isRootItemVisible() const throw() { return rootItemVisible; }
  14835. void setDefaultOpenness (const bool isOpenByDefault);
  14836. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  14837. void setMultiSelectEnabled (const bool canMultiSelect);
  14838. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  14839. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  14840. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  14841. void clearSelectedItems();
  14842. int getNumSelectedItems() const throw();
  14843. TreeViewItem* getSelectedItem (const int index) const throw();
  14844. int getNumRowsInTree() const;
  14845. TreeViewItem* getItemOnRow (int index) const;
  14846. TreeViewItem* getItemAt (int yPosition) const throw();
  14847. void scrollToKeepItemVisible (TreeViewItem* item);
  14848. Viewport* getViewport() const throw() { return viewport; }
  14849. int getIndentSize() const throw() { return indentSize; }
  14850. void setIndentSize (const int newIndentSize);
  14851. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  14852. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  14853. void restoreOpennessState (const XmlElement& newState);
  14854. enum ColourIds
  14855. {
  14856. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  14857. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  14858. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  14859. };
  14860. void paint (Graphics& g);
  14861. void resized();
  14862. bool keyPressed (const KeyPress& key);
  14863. void colourChanged();
  14864. void enablementChanged();
  14865. bool isInterestedInFileDrag (const StringArray& files);
  14866. void fileDragEnter (const StringArray& files, int x, int y);
  14867. void fileDragMove (const StringArray& files, int x, int y);
  14868. void fileDragExit (const StringArray& files);
  14869. void filesDropped (const StringArray& files, int x, int y);
  14870. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14871. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14872. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14873. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  14874. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  14875. juce_UseDebuggingNewOperator
  14876. private:
  14877. friend class TreeViewItem;
  14878. friend class TreeViewContentComponent;
  14879. Viewport* viewport;
  14880. CriticalSection nodeAlterationLock;
  14881. TreeViewItem* rootItem;
  14882. Component* dragInsertPointHighlight;
  14883. Component* dragTargetGroupHighlight;
  14884. int indentSize;
  14885. bool defaultOpenness : 1;
  14886. bool needsRecalculating : 1;
  14887. bool rootItemVisible : 1;
  14888. bool multiSelectEnabled : 1;
  14889. bool openCloseButtonsVisible : 1;
  14890. void itemsChanged() throw();
  14891. void handleAsyncUpdate();
  14892. void moveSelectedRow (int delta);
  14893. void updateButtonUnderMouse (const MouseEvent& e);
  14894. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  14895. void hideDragHighlight() throw();
  14896. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14897. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  14898. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  14899. const StringArray& files, const String& sourceDescription,
  14900. Component* sourceComponent) const throw();
  14901. TreeView (const TreeView&);
  14902. const TreeView& operator= (const TreeView&);
  14903. };
  14904. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  14905. /********* End of inlined file: juce_TreeView.h *********/
  14906. #endif
  14907. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14908. /********* Start of inlined file: juce_DirectoryContentsDisplayComponent.h *********/
  14909. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14910. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  14911. /********* Start of inlined file: juce_DirectoryContentsList.h *********/
  14912. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14913. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  14914. /********* Start of inlined file: juce_FileFilter.h *********/
  14915. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  14916. #define __JUCE_FILEFILTER_JUCEHEADER__
  14917. class JUCE_API FileFilter
  14918. {
  14919. public:
  14920. FileFilter (const String& filterDescription);
  14921. virtual ~FileFilter();
  14922. const String& getDescription() const throw();
  14923. virtual bool isFileSuitable (const File& file) const = 0;
  14924. virtual bool isDirectorySuitable (const File& file) const = 0;
  14925. protected:
  14926. String description;
  14927. };
  14928. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  14929. /********* End of inlined file: juce_FileFilter.h *********/
  14930. /********* Start of inlined file: juce_Image.h *********/
  14931. #ifndef __JUCE_IMAGE_JUCEHEADER__
  14932. #define __JUCE_IMAGE_JUCEHEADER__
  14933. class JUCE_API Image
  14934. {
  14935. public:
  14936. enum PixelFormat
  14937. {
  14938. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  14939. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  14940. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  14941. };
  14942. Image (const PixelFormat format,
  14943. const int imageWidth,
  14944. const int imageHeight,
  14945. const bool clearImage);
  14946. Image (const Image& other);
  14947. virtual ~Image();
  14948. static Image* createNativeImage (const PixelFormat format,
  14949. const int imageWidth,
  14950. const int imageHeight,
  14951. const bool clearImage);
  14952. int getWidth() const throw() { return imageWidth; }
  14953. int getHeight() const throw() { return imageHeight; }
  14954. const Rectangle getBounds() const throw() { return Rectangle (0, 0, imageWidth, imageHeight); }
  14955. PixelFormat getFormat() const throw() { return format; }
  14956. bool isARGB() const throw() { return format == ARGB; }
  14957. bool isRGB() const throw() { return format == RGB; }
  14958. bool hasAlphaChannel() const throw() { return format != RGB; }
  14959. virtual void clear (int x, int y, int w, int h,
  14960. const Colour& colourToClearTo = Colour (0x00000000));
  14961. virtual Image* createCopy (int newWidth = -1,
  14962. int newHeight = -1,
  14963. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  14964. virtual Image* createCopyOfAlphaChannel() const;
  14965. virtual const Colour getPixelAt (const int x, const int y) const;
  14966. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  14967. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  14968. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  14969. virtual void desaturate();
  14970. class BitmapData
  14971. {
  14972. public:
  14973. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  14974. BitmapData (const Image& image, int x, int y, int w, int h);
  14975. ~BitmapData();
  14976. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  14977. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  14978. uint8* data;
  14979. int lineStride, pixelStride, width, height;
  14980. private:
  14981. BitmapData (const BitmapData&);
  14982. const BitmapData& operator= (const BitmapData&);
  14983. };
  14984. virtual void setPixelData (int destX, int destY, int destW, int destH,
  14985. const uint8* sourcePixelData, int sourceLineStride);
  14986. virtual void moveImageSection (int destX, int destY,
  14987. int sourceX, int sourceY,
  14988. int width, int height);
  14989. void createSolidAreaMask (RectangleList& result,
  14990. const float alphaThreshold = 0.5f) const;
  14991. juce_UseDebuggingNewOperator
  14992. virtual LowLevelGraphicsContext* createLowLevelContext();
  14993. protected:
  14994. friend class BitmapData;
  14995. const PixelFormat format;
  14996. const int imageWidth, imageHeight;
  14997. Image (const PixelFormat format,
  14998. const int imageWidth,
  14999. const int imageHeight);
  15000. int pixelStride, lineStride;
  15001. HeapBlock <uint8> imageDataAllocated;
  15002. uint8* imageData;
  15003. private:
  15004. const Image& operator= (const Image&);
  15005. };
  15006. #endif // __JUCE_IMAGE_JUCEHEADER__
  15007. /********* End of inlined file: juce_Image.h *********/
  15008. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15009. public TimeSliceClient
  15010. {
  15011. public:
  15012. DirectoryContentsList (const FileFilter* const fileFilter,
  15013. TimeSliceThread& threadToUse);
  15014. ~DirectoryContentsList();
  15015. void setDirectory (const File& directory,
  15016. const bool includeDirectories,
  15017. const bool includeFiles);
  15018. const File& getDirectory() const;
  15019. void clear();
  15020. void refresh();
  15021. bool isStillLoading() const;
  15022. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15023. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15024. struct FileInfo
  15025. {
  15026. String filename;
  15027. int64 fileSize;
  15028. Time modificationTime;
  15029. Time creationTime;
  15030. bool isDirectory;
  15031. bool isReadOnly;
  15032. };
  15033. int getNumFiles() const;
  15034. bool getFileInfo (const int index,
  15035. FileInfo& resultInfo) const;
  15036. const File getFile (const int index) const;
  15037. const FileFilter* getFilter() const { return fileFilter; }
  15038. bool useTimeSlice();
  15039. TimeSliceThread& getTimeSliceThread() { return thread; }
  15040. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15041. const DirectoryContentsList::FileInfo* const second);
  15042. juce_UseDebuggingNewOperator
  15043. private:
  15044. File root;
  15045. const FileFilter* fileFilter;
  15046. TimeSliceThread& thread;
  15047. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15048. CriticalSection fileListLock;
  15049. OwnedArray <FileInfo> files;
  15050. void* volatile fileFindHandle;
  15051. bool volatile shouldStop;
  15052. void changed();
  15053. bool checkNextFile (bool& hasChanged);
  15054. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15055. const int64 fileSize, const Time& modTime,
  15056. const Time& creationTime, const bool isReadOnly);
  15057. DirectoryContentsList (const DirectoryContentsList&);
  15058. const DirectoryContentsList& operator= (const DirectoryContentsList&);
  15059. };
  15060. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15061. /********* End of inlined file: juce_DirectoryContentsList.h *********/
  15062. /********* Start of inlined file: juce_FileBrowserListener.h *********/
  15063. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15064. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15065. class JUCE_API FileBrowserListener
  15066. {
  15067. public:
  15068. virtual ~FileBrowserListener();
  15069. virtual void selectionChanged() = 0;
  15070. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15071. virtual void fileDoubleClicked (const File& file) = 0;
  15072. };
  15073. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15074. /********* End of inlined file: juce_FileBrowserListener.h *********/
  15075. class JUCE_API DirectoryContentsDisplayComponent
  15076. {
  15077. public:
  15078. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15079. virtual ~DirectoryContentsDisplayComponent();
  15080. virtual int getNumSelectedFiles() const = 0;
  15081. virtual const File getSelectedFile (int index) const = 0;
  15082. virtual void scrollToTop() = 0;
  15083. void addListener (FileBrowserListener* const listener) throw();
  15084. void removeListener (FileBrowserListener* const listener) throw();
  15085. enum ColourIds
  15086. {
  15087. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15088. textColourId = 0x1000541, /**< The colour for the text. */
  15089. };
  15090. void sendSelectionChangeMessage();
  15091. void sendDoubleClickMessage (const File& file);
  15092. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15093. juce_UseDebuggingNewOperator
  15094. protected:
  15095. DirectoryContentsList& fileList;
  15096. SortedSet <void*> listeners;
  15097. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15098. const DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15099. };
  15100. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15101. /********* End of inlined file: juce_DirectoryContentsDisplayComponent.h *********/
  15102. #endif
  15103. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15104. #endif
  15105. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15106. /********* Start of inlined file: juce_FileBrowserComponent.h *********/
  15107. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15108. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15109. /********* Start of inlined file: juce_FilePreviewComponent.h *********/
  15110. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15111. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15112. class JUCE_API FilePreviewComponent : public Component
  15113. {
  15114. public:
  15115. FilePreviewComponent();
  15116. ~FilePreviewComponent();
  15117. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15118. juce_UseDebuggingNewOperator
  15119. private:
  15120. FilePreviewComponent (const FilePreviewComponent&);
  15121. const FilePreviewComponent& operator= (const FilePreviewComponent&);
  15122. };
  15123. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15124. /********* End of inlined file: juce_FilePreviewComponent.h *********/
  15125. class JUCE_API FileBrowserComponent : public Component,
  15126. public ChangeBroadcaster,
  15127. private FileBrowserListener,
  15128. private TextEditorListener,
  15129. private ButtonListener,
  15130. private ComboBoxListener,
  15131. private FileFilter
  15132. {
  15133. public:
  15134. enum FileChooserFlags
  15135. {
  15136. openMode = 1, /**< specifies that the component should allow the user to
  15137. choose an existing file with the intention of opening it. */
  15138. saveMode = 2, /**< specifies that the component should allow the user to specify
  15139. the name of a file that will be used to save something. */
  15140. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15141. conjunction with canSelectDirectories). */
  15142. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15143. conjuction with canSelectFiles). */
  15144. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15145. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15146. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15147. };
  15148. FileBrowserComponent (int flags,
  15149. const File& initialFileOrDirectory,
  15150. const FileFilter* fileFilter,
  15151. FilePreviewComponent* previewComp);
  15152. ~FileBrowserComponent();
  15153. int getNumSelectedFiles() const throw();
  15154. const File getSelectedFile (int index) const throw();
  15155. bool currentFileIsValid() const;
  15156. const File getHighlightedFile() const throw();
  15157. const File getRoot() const;
  15158. void setRoot (const File& newRootDirectory);
  15159. void goUp();
  15160. void refresh();
  15161. virtual const String getActionVerb() const;
  15162. bool isSaveMode() const throw();
  15163. void addListener (FileBrowserListener* const listener) throw();
  15164. void removeListener (FileBrowserListener* const listener) throw();
  15165. void resized();
  15166. void buttonClicked (Button* b);
  15167. void comboBoxChanged (ComboBox*);
  15168. void textEditorTextChanged (TextEditor& editor);
  15169. void textEditorReturnKeyPressed (TextEditor& editor);
  15170. void textEditorEscapeKeyPressed (TextEditor& editor);
  15171. void textEditorFocusLost (TextEditor& editor);
  15172. bool keyPressed (const KeyPress& key);
  15173. void selectionChanged();
  15174. void fileClicked (const File& f, const MouseEvent& e);
  15175. void fileDoubleClicked (const File& f);
  15176. bool isFileSuitable (const File& file) const;
  15177. bool isDirectorySuitable (const File&) const;
  15178. FilePreviewComponent* getPreviewComponent() const throw();
  15179. juce_UseDebuggingNewOperator
  15180. protected:
  15181. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15182. private:
  15183. ScopedPointer <DirectoryContentsList> fileList;
  15184. const FileFilter* fileFilter;
  15185. int flags;
  15186. File currentRoot;
  15187. OwnedArray <File> chosenFiles;
  15188. SortedSet <void*> listeners;
  15189. DirectoryContentsDisplayComponent* fileListComponent;
  15190. FilePreviewComponent* previewComp;
  15191. ComboBox* currentPathBox;
  15192. TextEditor* filenameBox;
  15193. Button* goUpButton;
  15194. TimeSliceThread thread;
  15195. void sendListenerChangeMessage();
  15196. bool isFileOrDirSuitable (const File& f) const;
  15197. FileBrowserComponent (const FileBrowserComponent&);
  15198. const FileBrowserComponent& operator= (const FileBrowserComponent&);
  15199. };
  15200. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15201. /********* End of inlined file: juce_FileBrowserComponent.h *********/
  15202. #endif
  15203. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15204. #endif
  15205. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15206. /********* Start of inlined file: juce_FileChooser.h *********/
  15207. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15208. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15209. class JUCE_API FileChooser
  15210. {
  15211. public:
  15212. FileChooser (const String& dialogBoxTitle,
  15213. const File& initialFileOrDirectory = File::nonexistent,
  15214. const String& filePatternsAllowed = String::empty,
  15215. const bool useOSNativeDialogBox = true);
  15216. ~FileChooser();
  15217. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15218. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15219. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15220. bool browseForDirectory();
  15221. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15222. const File getResult() const;
  15223. const OwnedArray <File>& getResults() const;
  15224. juce_UseDebuggingNewOperator
  15225. private:
  15226. String title, filters;
  15227. File startingFile;
  15228. OwnedArray <File> results;
  15229. bool useNativeDialogBox;
  15230. bool showDialog (const bool selectsDirectories,
  15231. const bool selectsFiles,
  15232. const bool isSave,
  15233. const bool warnAboutOverwritingExistingFiles,
  15234. const bool selectMultipleFiles,
  15235. FilePreviewComponent* const previewComponent);
  15236. static void showPlatformDialog (OwnedArray<File>& results,
  15237. const String& title,
  15238. const File& file,
  15239. const String& filters,
  15240. bool selectsDirectories,
  15241. bool selectsFiles,
  15242. bool isSave,
  15243. bool warnAboutOverwritingExistingFiles,
  15244. bool selectMultipleFiles,
  15245. FilePreviewComponent* previewComponent);
  15246. };
  15247. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15248. /********* End of inlined file: juce_FileChooser.h *********/
  15249. #endif
  15250. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15251. /********* Start of inlined file: juce_FileChooserDialogBox.h *********/
  15252. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15253. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15254. /********* Start of inlined file: juce_ResizableWindow.h *********/
  15255. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15256. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15257. /********* Start of inlined file: juce_TopLevelWindow.h *********/
  15258. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15259. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15260. /********* Start of inlined file: juce_DropShadower.h *********/
  15261. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15262. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15263. class JUCE_API DropShadower : public ComponentListener
  15264. {
  15265. public:
  15266. DropShadower (const float alpha = 0.5f,
  15267. const int xOffset = 1,
  15268. const int yOffset = 5,
  15269. const float blurRadius = 10.0f);
  15270. virtual ~DropShadower();
  15271. void setOwner (Component* componentToFollow);
  15272. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15273. void componentBroughtToFront (Component& component);
  15274. void componentChildrenChanged (Component& component);
  15275. void componentParentHierarchyChanged (Component& component);
  15276. void componentVisibilityChanged (Component& component);
  15277. juce_UseDebuggingNewOperator
  15278. private:
  15279. Component* owner;
  15280. int numShadows;
  15281. Component* shadowWindows[4];
  15282. Image* shadowImageSections[12];
  15283. const int shadowEdge, xOffset, yOffset;
  15284. const float alpha, blurRadius;
  15285. bool inDestructor, reentrant;
  15286. void updateShadows();
  15287. void setShadowImage (Image* const src,
  15288. const int num,
  15289. const int w, const int h,
  15290. const int sx, const int sy);
  15291. void bringShadowWindowsToFront();
  15292. void deleteShadowWindows();
  15293. DropShadower (const DropShadower&);
  15294. const DropShadower& operator= (const DropShadower&);
  15295. };
  15296. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15297. /********* End of inlined file: juce_DropShadower.h *********/
  15298. class JUCE_API TopLevelWindow : public Component
  15299. {
  15300. public:
  15301. TopLevelWindow (const String& name,
  15302. const bool addToDesktop);
  15303. ~TopLevelWindow();
  15304. bool isActiveWindow() const throw() { return windowIsActive_; }
  15305. void centreAroundComponent (Component* componentToCentreAround,
  15306. const int width, const int height);
  15307. void setDropShadowEnabled (const bool useShadow);
  15308. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15309. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15310. static int getNumTopLevelWindows() throw();
  15311. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15312. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15313. juce_UseDebuggingNewOperator
  15314. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15315. protected:
  15316. virtual void activeWindowStatusChanged();
  15317. void focusOfChildComponentChanged (FocusChangeType cause);
  15318. void parentHierarchyChanged();
  15319. void visibilityChanged();
  15320. virtual int getDesktopWindowStyleFlags() const;
  15321. void recreateDesktopWindow();
  15322. private:
  15323. friend class TopLevelWindowManager;
  15324. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15325. ScopedPointer <DropShadower> shadower;
  15326. void setWindowActive (const bool isNowActive) throw();
  15327. TopLevelWindow (const TopLevelWindow&);
  15328. const TopLevelWindow& operator= (const TopLevelWindow&);
  15329. };
  15330. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15331. /********* End of inlined file: juce_TopLevelWindow.h *********/
  15332. /********* Start of inlined file: juce_ComponentDragger.h *********/
  15333. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15334. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15335. /********* Start of inlined file: juce_ComponentBoundsConstrainer.h *********/
  15336. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15337. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15338. class JUCE_API ComponentBoundsConstrainer
  15339. {
  15340. public:
  15341. ComponentBoundsConstrainer() throw();
  15342. virtual ~ComponentBoundsConstrainer();
  15343. void setMinimumWidth (const int minimumWidth) throw();
  15344. int getMinimumWidth() const throw() { return minW; }
  15345. void setMaximumWidth (const int maximumWidth) throw();
  15346. int getMaximumWidth() const throw() { return maxW; }
  15347. void setMinimumHeight (const int minimumHeight) throw();
  15348. int getMinimumHeight() const throw() { return minH; }
  15349. void setMaximumHeight (const int maximumHeight) throw();
  15350. int getMaximumHeight() const throw() { return maxH; }
  15351. void setMinimumSize (const int minimumWidth,
  15352. const int minimumHeight) throw();
  15353. void setMaximumSize (const int maximumWidth,
  15354. const int maximumHeight) throw();
  15355. void setSizeLimits (const int minimumWidth,
  15356. const int minimumHeight,
  15357. const int maximumWidth,
  15358. const int maximumHeight) throw();
  15359. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15360. const int minimumWhenOffTheLeft,
  15361. const int minimumWhenOffTheBottom,
  15362. const int minimumWhenOffTheRight) throw();
  15363. void setFixedAspectRatio (const double widthOverHeight) throw();
  15364. double getFixedAspectRatio() const throw();
  15365. virtual void checkBounds (int& x, int& y, int& w, int& h,
  15366. const Rectangle& previousBounds,
  15367. const Rectangle& limits,
  15368. const bool isStretchingTop,
  15369. const bool isStretchingLeft,
  15370. const bool isStretchingBottom,
  15371. const bool isStretchingRight);
  15372. virtual void resizeStart();
  15373. virtual void resizeEnd();
  15374. void setBoundsForComponent (Component* const component,
  15375. int x, int y, int w, int h,
  15376. const bool isStretchingTop,
  15377. const bool isStretchingLeft,
  15378. const bool isStretchingBottom,
  15379. const bool isStretchingRight);
  15380. void checkComponentBounds (Component* component);
  15381. virtual void applyBoundsToComponent (Component* component,
  15382. int x, int y, int w, int h);
  15383. juce_UseDebuggingNewOperator
  15384. private:
  15385. int minW, maxW, minH, maxH;
  15386. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15387. double aspectRatio;
  15388. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15389. const ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15390. };
  15391. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15392. /********* End of inlined file: juce_ComponentBoundsConstrainer.h *********/
  15393. class JUCE_API ComponentDragger
  15394. {
  15395. public:
  15396. ComponentDragger();
  15397. virtual ~ComponentDragger();
  15398. void startDraggingComponent (Component* const componentToDrag,
  15399. ComponentBoundsConstrainer* constrainer);
  15400. void dragComponent (Component* const componentToDrag,
  15401. const MouseEvent& e);
  15402. juce_UseDebuggingNewOperator
  15403. private:
  15404. ComponentBoundsConstrainer* constrainer;
  15405. int originalX, originalY;
  15406. };
  15407. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15408. /********* End of inlined file: juce_ComponentDragger.h *********/
  15409. /********* Start of inlined file: juce_ResizableBorderComponent.h *********/
  15410. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15411. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15412. class JUCE_API ResizableBorderComponent : public Component
  15413. {
  15414. public:
  15415. ResizableBorderComponent (Component* const componentToResize,
  15416. ComponentBoundsConstrainer* const constrainer);
  15417. ~ResizableBorderComponent();
  15418. void setBorderThickness (const BorderSize& newBorderSize) throw();
  15419. const BorderSize getBorderThickness() const throw();
  15420. juce_UseDebuggingNewOperator
  15421. protected:
  15422. void paint (Graphics& g);
  15423. void mouseEnter (const MouseEvent& e);
  15424. void mouseMove (const MouseEvent& e);
  15425. void mouseDown (const MouseEvent& e);
  15426. void mouseDrag (const MouseEvent& e);
  15427. void mouseUp (const MouseEvent& e);
  15428. bool hitTest (int x, int y);
  15429. private:
  15430. Component* const component;
  15431. ComponentBoundsConstrainer* constrainer;
  15432. BorderSize borderSize;
  15433. int originalX, originalY, originalW, originalH;
  15434. int mouseZone;
  15435. void updateMouseZone (const MouseEvent& e) throw();
  15436. ResizableBorderComponent (const ResizableBorderComponent&);
  15437. const ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15438. };
  15439. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15440. /********* End of inlined file: juce_ResizableBorderComponent.h *********/
  15441. /********* Start of inlined file: juce_ResizableCornerComponent.h *********/
  15442. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15443. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15444. class JUCE_API ResizableCornerComponent : public Component
  15445. {
  15446. public:
  15447. ResizableCornerComponent (Component* const componentToResize,
  15448. ComponentBoundsConstrainer* const constrainer);
  15449. ~ResizableCornerComponent();
  15450. juce_UseDebuggingNewOperator
  15451. protected:
  15452. void paint (Graphics& g);
  15453. void mouseDown (const MouseEvent& e);
  15454. void mouseDrag (const MouseEvent& e);
  15455. void mouseUp (const MouseEvent& e);
  15456. bool hitTest (int x, int y);
  15457. private:
  15458. Component* const component;
  15459. ComponentBoundsConstrainer* constrainer;
  15460. int originalX, originalY, originalW, originalH;
  15461. ResizableCornerComponent (const ResizableCornerComponent&);
  15462. const ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15463. };
  15464. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15465. /********* End of inlined file: juce_ResizableCornerComponent.h *********/
  15466. class JUCE_API ResizableWindow : public TopLevelWindow
  15467. {
  15468. public:
  15469. ResizableWindow (const String& name,
  15470. const bool addToDesktop);
  15471. ResizableWindow (const String& name,
  15472. const Colour& backgroundColour,
  15473. const bool addToDesktop);
  15474. ~ResizableWindow();
  15475. const Colour getBackgroundColour() const throw();
  15476. void setBackgroundColour (const Colour& newColour);
  15477. void setResizable (const bool shouldBeResizable,
  15478. const bool useBottomRightCornerResizer);
  15479. bool isResizable() const throw();
  15480. void setResizeLimits (const int newMinimumWidth,
  15481. const int newMinimumHeight,
  15482. const int newMaximumWidth,
  15483. const int newMaximumHeight) throw();
  15484. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15485. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15486. void setBoundsConstrained (int x, int y, int width, int height);
  15487. bool isFullScreen() const;
  15488. void setFullScreen (const bool shouldBeFullScreen);
  15489. bool isMinimised() const;
  15490. void setMinimised (const bool shouldMinimise);
  15491. const String getWindowStateAsString();
  15492. bool restoreWindowStateFromString (const String& previousState);
  15493. Component* getContentComponent() const throw() { return contentComponent; }
  15494. void setContentComponent (Component* const newContentComponent,
  15495. const bool deleteOldOne = true,
  15496. const bool resizeToFit = false);
  15497. void setContentComponentSize (int width, int height);
  15498. enum ColourIds
  15499. {
  15500. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15501. };
  15502. juce_UseDebuggingNewOperator
  15503. protected:
  15504. void paint (Graphics& g);
  15505. void moved();
  15506. void resized();
  15507. void mouseDown (const MouseEvent& e);
  15508. void mouseDrag (const MouseEvent& e);
  15509. void lookAndFeelChanged();
  15510. void childBoundsChanged (Component* child);
  15511. void parentSizeChanged();
  15512. void visibilityChanged();
  15513. void activeWindowStatusChanged();
  15514. int getDesktopWindowStyleFlags() const;
  15515. virtual const BorderSize getBorderThickness();
  15516. virtual const BorderSize getContentComponentBorder();
  15517. #ifdef JUCE_DEBUG
  15518. void addChildComponent (Component* const child, int zOrder = -1);
  15519. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15520. #endif
  15521. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15522. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15523. private:
  15524. ScopedPointer <Component> contentComponent;
  15525. bool resizeToFitContent, fullscreen;
  15526. ComponentDragger dragger;
  15527. Rectangle lastNonFullScreenPos;
  15528. ComponentBoundsConstrainer defaultConstrainer;
  15529. ComponentBoundsConstrainer* constrainer;
  15530. #ifdef JUCE_DEBUG
  15531. bool hasBeenResized;
  15532. #endif
  15533. void updateLastPos();
  15534. ResizableWindow (const ResizableWindow&);
  15535. const ResizableWindow& operator= (const ResizableWindow&);
  15536. // (xxx remove these eventually)
  15537. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15538. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15539. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15540. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15541. };
  15542. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15543. /********* End of inlined file: juce_ResizableWindow.h *********/
  15544. /********* Start of inlined file: juce_GlyphArrangement.h *********/
  15545. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15546. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15547. class JUCE_API PositionedGlyph
  15548. {
  15549. public:
  15550. juce_wchar getCharacter() const { return character; }
  15551. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15552. float getLeft() const { return x; }
  15553. float getRight() const { return x + w; }
  15554. float getBaselineY() const { return y; }
  15555. float getTop() const { return y - font.getAscent(); }
  15556. float getBottom() const { return y + font.getDescent(); }
  15557. void moveBy (const float deltaX,
  15558. const float deltaY);
  15559. void draw (const Graphics& g) const;
  15560. void draw (const Graphics& g, const AffineTransform& transform) const;
  15561. void createPath (Path& path) const;
  15562. bool hitTest (float x, float y) const;
  15563. juce_UseDebuggingNewOperator
  15564. private:
  15565. friend class GlyphArrangement;
  15566. float x, y, w;
  15567. Font font;
  15568. juce_wchar character;
  15569. int glyph;
  15570. PositionedGlyph();
  15571. };
  15572. class JUCE_API GlyphArrangement
  15573. {
  15574. public:
  15575. GlyphArrangement();
  15576. GlyphArrangement (const GlyphArrangement& other);
  15577. const GlyphArrangement& operator= (const GlyphArrangement& other);
  15578. ~GlyphArrangement();
  15579. int getNumGlyphs() const { return glyphs.size(); }
  15580. PositionedGlyph& getGlyph (const int index) const;
  15581. void clear();
  15582. void addLineOfText (const Font& font,
  15583. const String& text,
  15584. const float x,
  15585. const float y);
  15586. void addCurtailedLineOfText (const Font& font,
  15587. const String& text,
  15588. float x,
  15589. const float y,
  15590. const float maxWidthPixels,
  15591. const bool useEllipsis);
  15592. void addJustifiedText (const Font& font,
  15593. const String& text,
  15594. float x, float y,
  15595. const float maxLineWidth,
  15596. const Justification& horizontalLayout);
  15597. void addFittedText (const Font& font,
  15598. const String& text,
  15599. const float x, const float y,
  15600. const float width, const float height,
  15601. const Justification& layout,
  15602. int maximumLinesToUse,
  15603. const float minimumHorizontalScale = 0.7f);
  15604. void addGlyphArrangement (const GlyphArrangement& other);
  15605. void draw (const Graphics& g) const;
  15606. void draw (const Graphics& g, const AffineTransform& transform) const;
  15607. void createPath (Path& path) const;
  15608. int findGlyphIndexAt (float x, float y) const;
  15609. void getBoundingBox (int startIndex,
  15610. int numGlyphs,
  15611. float& left,
  15612. float& top,
  15613. float& right,
  15614. float& bottom,
  15615. const bool includeWhitespace) const;
  15616. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15617. const float deltaX,
  15618. const float deltaY);
  15619. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15620. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15621. const float horizontalScaleFactor);
  15622. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15623. const float x,
  15624. const float y,
  15625. const float width,
  15626. const float height,
  15627. const Justification& justification);
  15628. juce_UseDebuggingNewOperator
  15629. private:
  15630. OwnedArray <PositionedGlyph> glyphs;
  15631. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15632. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15633. const Justification& justification, float minimumHorizontalScale);
  15634. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15635. };
  15636. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15637. /********* End of inlined file: juce_GlyphArrangement.h *********/
  15638. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15639. public ButtonListener,
  15640. public FileBrowserListener
  15641. {
  15642. public:
  15643. FileChooserDialogBox (const String& title,
  15644. const String& instructions,
  15645. FileBrowserComponent& browserComponent,
  15646. const bool warnAboutOverwritingExistingFiles,
  15647. const Colour& backgroundColour);
  15648. ~FileChooserDialogBox();
  15649. bool show (int width = 0,int height = 0);
  15650. enum ColourIds
  15651. {
  15652. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15653. };
  15654. void buttonClicked (Button* button);
  15655. void closeButtonPressed();
  15656. void selectionChanged();
  15657. void fileClicked (const File& file, const MouseEvent& e);
  15658. void fileDoubleClicked (const File& file);
  15659. juce_UseDebuggingNewOperator
  15660. private:
  15661. class ContentComponent : public Component
  15662. {
  15663. public:
  15664. ContentComponent();
  15665. ~ContentComponent();
  15666. void paint (Graphics& g);
  15667. void resized();
  15668. String instructions;
  15669. GlyphArrangement text;
  15670. FileBrowserComponent* chooserComponent;
  15671. FilePreviewComponent* previewComponent;
  15672. TextButton* okButton;
  15673. TextButton* cancelButton;
  15674. };
  15675. ContentComponent* content;
  15676. const bool warnAboutOverwritingExistingFiles;
  15677. FileChooserDialogBox (const FileChooserDialogBox&);
  15678. const FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15679. };
  15680. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15681. /********* End of inlined file: juce_FileChooserDialogBox.h *********/
  15682. #endif
  15683. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15684. #endif
  15685. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15686. /********* Start of inlined file: juce_FileListComponent.h *********/
  15687. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15688. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15689. class JUCE_API FileListComponent : public ListBox,
  15690. public DirectoryContentsDisplayComponent,
  15691. private ListBoxModel,
  15692. private ChangeListener
  15693. {
  15694. public:
  15695. FileListComponent (DirectoryContentsList& listToShow);
  15696. ~FileListComponent();
  15697. int getNumSelectedFiles() const;
  15698. const File getSelectedFile (int index = 0) const;
  15699. void scrollToTop();
  15700. void changeListenerCallback (void*);
  15701. int getNumRows();
  15702. void paintListBoxItem (int, Graphics&, int, int, bool);
  15703. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15704. void selectedRowsChanged (int lastRowSelected);
  15705. void deleteKeyPressed (int currentSelectedRow);
  15706. void returnKeyPressed (int currentSelectedRow);
  15707. juce_UseDebuggingNewOperator
  15708. private:
  15709. FileListComponent (const FileListComponent&);
  15710. const FileListComponent& operator= (const FileListComponent&);
  15711. File lastDirectory;
  15712. };
  15713. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15714. /********* End of inlined file: juce_FileListComponent.h *********/
  15715. #endif
  15716. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15717. /********* Start of inlined file: juce_FilenameComponent.h *********/
  15718. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15719. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15720. class FilenameComponent;
  15721. class JUCE_API FilenameComponentListener
  15722. {
  15723. public:
  15724. virtual ~FilenameComponentListener() {}
  15725. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15726. };
  15727. class JUCE_API FilenameComponent : public Component,
  15728. public SettableTooltipClient,
  15729. public FileDragAndDropTarget,
  15730. private AsyncUpdater,
  15731. private ButtonListener,
  15732. private ComboBoxListener
  15733. {
  15734. public:
  15735. FilenameComponent (const String& name,
  15736. const File& currentFile,
  15737. const bool canEditFilename,
  15738. const bool isDirectory,
  15739. const bool isForSaving,
  15740. const String& fileBrowserWildcard,
  15741. const String& enforcedSuffix,
  15742. const String& textWhenNothingSelected);
  15743. ~FilenameComponent();
  15744. const File getCurrentFile() const;
  15745. void setCurrentFile (File newFile,
  15746. const bool addToRecentlyUsedList,
  15747. const bool sendChangeNotification = true);
  15748. void setFilenameIsEditable (const bool shouldBeEditable);
  15749. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15750. const StringArray getRecentlyUsedFilenames() const;
  15751. void setRecentlyUsedFilenames (const StringArray& filenames);
  15752. void addRecentlyUsedFile (const File& file);
  15753. void setMaxNumberOfRecentFiles (const int newMaximum);
  15754. void setBrowseButtonText (const String& browseButtonText);
  15755. void addListener (FilenameComponentListener* const listener) throw();
  15756. void removeListener (FilenameComponentListener* const listener) throw();
  15757. void setTooltip (const String& newTooltip);
  15758. void paintOverChildren (Graphics& g);
  15759. void resized();
  15760. void lookAndFeelChanged();
  15761. bool isInterestedInFileDrag (const StringArray& files);
  15762. void filesDropped (const StringArray& files, int, int);
  15763. void fileDragEnter (const StringArray& files, int, int);
  15764. void fileDragExit (const StringArray& files);
  15765. juce_UseDebuggingNewOperator
  15766. private:
  15767. ComboBox* filenameBox;
  15768. String lastFilename;
  15769. Button* browseButton;
  15770. int maxRecentFiles;
  15771. bool isDir, isSaving, isFileDragOver;
  15772. String wildcard, enforcedSuffix, browseButtonText;
  15773. SortedSet <void*> listeners;
  15774. File defaultBrowseFile;
  15775. void comboBoxChanged (ComboBox*);
  15776. void buttonClicked (Button* button);
  15777. void handleAsyncUpdate();
  15778. FilenameComponent (const FilenameComponent&);
  15779. const FilenameComponent& operator= (const FilenameComponent&);
  15780. };
  15781. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15782. /********* End of inlined file: juce_FilenameComponent.h *********/
  15783. #endif
  15784. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15785. #endif
  15786. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15787. /********* Start of inlined file: juce_FileSearchPathListComponent.h *********/
  15788. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15789. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15790. class JUCE_API FileSearchPathListComponent : public Component,
  15791. public SettableTooltipClient,
  15792. public FileDragAndDropTarget,
  15793. private ButtonListener,
  15794. private ListBoxModel
  15795. {
  15796. public:
  15797. FileSearchPathListComponent();
  15798. ~FileSearchPathListComponent();
  15799. const FileSearchPath& getPath() const throw() { return path; }
  15800. void setPath (const FileSearchPath& newPath);
  15801. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15802. enum ColourIds
  15803. {
  15804. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  15805. Make this transparent if you don't want the background to be filled. */
  15806. };
  15807. int getNumRows();
  15808. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  15809. void deleteKeyPressed (int lastRowSelected);
  15810. void returnKeyPressed (int lastRowSelected);
  15811. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  15812. void selectedRowsChanged (int lastRowSelected);
  15813. void resized();
  15814. void paint (Graphics& g);
  15815. bool isInterestedInFileDrag (const StringArray& files);
  15816. void filesDropped (const StringArray& files, int, int);
  15817. void buttonClicked (Button* button);
  15818. juce_UseDebuggingNewOperator
  15819. private:
  15820. FileSearchPath path;
  15821. File defaultBrowseTarget;
  15822. ListBox* listBox;
  15823. Button* addButton;
  15824. Button* removeButton;
  15825. Button* changeButton;
  15826. Button* upButton;
  15827. Button* downButton;
  15828. void changed() throw();
  15829. void updateButtons() throw();
  15830. FileSearchPathListComponent (const FileSearchPathListComponent&);
  15831. const FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  15832. };
  15833. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15834. /********* End of inlined file: juce_FileSearchPathListComponent.h *********/
  15835. #endif
  15836. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15837. /********* Start of inlined file: juce_FileTreeComponent.h *********/
  15838. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15839. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15840. class JUCE_API FileTreeComponent : public TreeView,
  15841. public DirectoryContentsDisplayComponent
  15842. {
  15843. public:
  15844. FileTreeComponent (DirectoryContentsList& listToShow);
  15845. ~FileTreeComponent();
  15846. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  15847. const File getSelectedFile (int index = 0) const;
  15848. void scrollToTop();
  15849. void setDragAndDropDescription (const String& description) throw();
  15850. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  15851. juce_UseDebuggingNewOperator
  15852. private:
  15853. String dragAndDropDescription;
  15854. FileTreeComponent (const FileTreeComponent&);
  15855. const FileTreeComponent& operator= (const FileTreeComponent&);
  15856. };
  15857. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  15858. /********* End of inlined file: juce_FileTreeComponent.h *********/
  15859. #endif
  15860. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15861. /********* Start of inlined file: juce_ImagePreviewComponent.h *********/
  15862. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15863. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15864. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  15865. private Timer
  15866. {
  15867. public:
  15868. ImagePreviewComponent();
  15869. ~ImagePreviewComponent();
  15870. void selectedFileChanged (const File& newSelectedFile);
  15871. void paint (Graphics& g);
  15872. void timerCallback();
  15873. juce_UseDebuggingNewOperator
  15874. private:
  15875. File fileToLoad;
  15876. ScopedPointer <Image> currentThumbnail;
  15877. String currentDetails;
  15878. void getThumbSize (int& w, int& h) const;
  15879. ImagePreviewComponent (const ImagePreviewComponent&);
  15880. const ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  15881. };
  15882. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  15883. /********* End of inlined file: juce_ImagePreviewComponent.h *********/
  15884. #endif
  15885. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15886. /********* Start of inlined file: juce_WildcardFileFilter.h *********/
  15887. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15888. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15889. class JUCE_API WildcardFileFilter : public FileFilter
  15890. {
  15891. public:
  15892. WildcardFileFilter (const String& fileWildcardPatterns,
  15893. const String& directoryWildcardPatterns,
  15894. const String& description);
  15895. ~WildcardFileFilter();
  15896. bool isFileSuitable (const File& file) const;
  15897. bool isDirectorySuitable (const File& file) const;
  15898. juce_UseDebuggingNewOperator
  15899. private:
  15900. StringArray fileWildcards, directoryWildcards;
  15901. static void parse (const String& pattern, StringArray& result) throw();
  15902. static bool match (const File& file, const StringArray& wildcards) throw();
  15903. };
  15904. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  15905. /********* End of inlined file: juce_WildcardFileFilter.h *********/
  15906. #endif
  15907. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  15908. #endif
  15909. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  15910. #endif
  15911. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  15912. #endif
  15913. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  15914. #endif
  15915. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  15916. #endif
  15917. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  15918. #endif
  15919. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15920. /********* Start of inlined file: juce_KeyMappingEditorComponent.h *********/
  15921. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15922. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  15923. /********* Start of inlined file: juce_KeyPressMappingSet.h *********/
  15924. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15925. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15926. class JUCE_API KeyPressMappingSet : public KeyListener,
  15927. public ChangeBroadcaster,
  15928. public FocusChangeListener
  15929. {
  15930. public:
  15931. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  15932. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  15933. ~KeyPressMappingSet();
  15934. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  15935. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  15936. void addKeyPress (const CommandID commandID,
  15937. const KeyPress& newKeyPress,
  15938. int insertIndex = -1) throw();
  15939. void resetToDefaultMappings() throw();
  15940. void resetToDefaultMapping (const CommandID commandID) throw();
  15941. void clearAllKeyPresses() throw();
  15942. void clearAllKeyPresses (const CommandID commandID) throw();
  15943. void removeKeyPress (const CommandID commandID,
  15944. const int keyPressIndex) throw();
  15945. void removeKeyPress (const KeyPress& keypress) throw();
  15946. bool containsMapping (const CommandID commandID,
  15947. const KeyPress& keyPress) const throw();
  15948. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  15949. bool restoreFromXml (const XmlElement& xmlVersion);
  15950. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  15951. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  15952. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  15953. void globalFocusChanged (Component* focusedComponent);
  15954. juce_UseDebuggingNewOperator
  15955. private:
  15956. ApplicationCommandManager* commandManager;
  15957. struct CommandMapping
  15958. {
  15959. CommandID commandID;
  15960. Array <KeyPress> keypresses;
  15961. bool wantsKeyUpDownCallbacks;
  15962. };
  15963. OwnedArray <CommandMapping> mappings;
  15964. struct KeyPressTime
  15965. {
  15966. KeyPress key;
  15967. uint32 timeWhenPressed;
  15968. };
  15969. OwnedArray <KeyPressTime> keysDown;
  15970. void handleMessage (const Message& message);
  15971. void invokeCommand (const CommandID commandID,
  15972. const KeyPress& keyPress,
  15973. const bool isKeyDown,
  15974. const int millisecsSinceKeyPressed,
  15975. Component* const originatingComponent) const;
  15976. const KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  15977. };
  15978. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  15979. /********* End of inlined file: juce_KeyPressMappingSet.h *********/
  15980. class JUCE_API KeyMappingEditorComponent : public Component,
  15981. public TreeViewItem,
  15982. public ChangeListener,
  15983. private ButtonListener
  15984. {
  15985. public:
  15986. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  15987. const bool showResetToDefaultButton);
  15988. virtual ~KeyMappingEditorComponent();
  15989. void setColours (const Colour& mainBackground,
  15990. const Colour& textColour);
  15991. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  15992. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  15993. virtual bool isCommandReadOnly (const CommandID commandID);
  15994. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  15995. enum ColourIds
  15996. {
  15997. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  15998. textColourId = 0x100ad01, /**< The colour for the text. */
  15999. };
  16000. void parentHierarchyChanged();
  16001. void resized();
  16002. void changeListenerCallback (void*);
  16003. bool mightContainSubItems();
  16004. const String getUniqueName() const;
  16005. void buttonClicked (Button* button);
  16006. juce_UseDebuggingNewOperator
  16007. private:
  16008. KeyPressMappingSet* mappings;
  16009. TreeView* tree;
  16010. friend class KeyMappingTreeViewItem;
  16011. friend class KeyCategoryTreeViewItem;
  16012. friend class KeyMappingItemComponent;
  16013. friend class KeyMappingChangeButton;
  16014. TextButton* resetButton;
  16015. void assignNewKey (const CommandID commandID, int index);
  16016. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16017. const KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16018. };
  16019. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16020. /********* End of inlined file: juce_KeyMappingEditorComponent.h *********/
  16021. #endif
  16022. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16023. #endif
  16024. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16025. #endif
  16026. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16027. #endif
  16028. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16029. #endif
  16030. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16031. #endif
  16032. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16033. /********* Start of inlined file: juce_ComponentMovementWatcher.h *********/
  16034. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16035. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16036. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16037. {
  16038. public:
  16039. ComponentMovementWatcher (Component* const component);
  16040. ~ComponentMovementWatcher();
  16041. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16042. virtual void componentPeerChanged() = 0;
  16043. juce_UseDebuggingNewOperator
  16044. void componentParentHierarchyChanged (Component& component);
  16045. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16046. private:
  16047. Component* const component;
  16048. ComponentPeer* lastPeer;
  16049. VoidArray registeredParentComps;
  16050. bool reentrant;
  16051. int lastX, lastY, lastWidth, lastHeight;
  16052. #ifdef JUCE_DEBUG
  16053. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  16054. #endif
  16055. void unregister() throw();
  16056. void registerWithParentComps() throw();
  16057. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16058. const ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16059. };
  16060. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16061. /********* End of inlined file: juce_ComponentMovementWatcher.h *********/
  16062. #endif
  16063. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16064. /********* Start of inlined file: juce_GroupComponent.h *********/
  16065. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16066. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16067. class JUCE_API GroupComponent : public Component
  16068. {
  16069. public:
  16070. GroupComponent (const String& componentName,
  16071. const String& labelText);
  16072. ~GroupComponent();
  16073. void setText (const String& newText) throw();
  16074. const String getText() const throw();
  16075. void setTextLabelPosition (const Justification& justification);
  16076. const Justification getTextLabelPosition() const throw() { return justification; }
  16077. enum ColourIds
  16078. {
  16079. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16080. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16081. };
  16082. void paint (Graphics& g);
  16083. void enablementChanged();
  16084. void colourChanged();
  16085. private:
  16086. String text;
  16087. Justification justification;
  16088. GroupComponent (const GroupComponent&);
  16089. const GroupComponent& operator= (const GroupComponent&);
  16090. };
  16091. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16092. /********* End of inlined file: juce_GroupComponent.h *********/
  16093. #endif
  16094. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16095. /********* Start of inlined file: juce_MultiDocumentPanel.h *********/
  16096. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16097. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16098. /********* Start of inlined file: juce_TabbedComponent.h *********/
  16099. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16100. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16101. /********* Start of inlined file: juce_TabbedButtonBar.h *********/
  16102. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16103. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16104. class TabbedButtonBar;
  16105. class JUCE_API TabBarButton : public Button
  16106. {
  16107. public:
  16108. TabBarButton (const String& name,
  16109. TabbedButtonBar* const ownerBar,
  16110. const int tabIndex);
  16111. ~TabBarButton();
  16112. virtual int getBestTabLength (const int depth);
  16113. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16114. void clicked (const ModifierKeys& mods);
  16115. bool hitTest (int x, int y);
  16116. juce_UseDebuggingNewOperator
  16117. protected:
  16118. friend class TabbedButtonBar;
  16119. TabbedButtonBar* const owner;
  16120. int tabIndex, overlapPixels;
  16121. DropShadowEffect shadow;
  16122. void getActiveArea (int& x, int& y, int& w, int& h);
  16123. private:
  16124. TabBarButton (const TabBarButton&);
  16125. const TabBarButton& operator= (const TabBarButton&);
  16126. };
  16127. class JUCE_API TabbedButtonBar : public Component,
  16128. public ChangeBroadcaster,
  16129. public ButtonListener
  16130. {
  16131. public:
  16132. enum Orientation
  16133. {
  16134. TabsAtTop,
  16135. TabsAtBottom,
  16136. TabsAtLeft,
  16137. TabsAtRight
  16138. };
  16139. TabbedButtonBar (const Orientation orientation);
  16140. ~TabbedButtonBar();
  16141. void setOrientation (const Orientation orientation);
  16142. Orientation getOrientation() const throw() { return orientation; }
  16143. void clearTabs();
  16144. void addTab (const String& tabName,
  16145. const Colour& tabBackgroundColour,
  16146. int insertIndex = -1);
  16147. void setTabName (const int tabIndex,
  16148. const String& newName);
  16149. void removeTab (const int tabIndex);
  16150. void moveTab (const int currentIndex,
  16151. const int newIndex);
  16152. int getNumTabs() const;
  16153. const StringArray getTabNames() const;
  16154. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16155. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16156. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16157. TabBarButton* getTabButton (const int index) const;
  16158. virtual void currentTabChanged (const int newCurrentTabIndex,
  16159. const String& newCurrentTabName);
  16160. virtual void popupMenuClickOnTab (const int tabIndex,
  16161. const String& tabName);
  16162. const Colour getTabBackgroundColour (const int tabIndex);
  16163. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16164. enum ColourIds
  16165. {
  16166. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16167. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16168. the look and feel will choose an appropriate colour. */
  16169. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16170. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16171. this isn't specified, the look and feel will choose an appropriate
  16172. colour. */
  16173. };
  16174. void resized();
  16175. void buttonClicked (Button* button);
  16176. void lookAndFeelChanged();
  16177. juce_UseDebuggingNewOperator
  16178. protected:
  16179. virtual TabBarButton* createTabButton (const String& tabName,
  16180. const int tabIndex);
  16181. private:
  16182. Orientation orientation;
  16183. StringArray tabs;
  16184. Array <Colour> tabColours;
  16185. int currentTabIndex;
  16186. Component* behindFrontTab;
  16187. Button* extraTabsButton;
  16188. TabbedButtonBar (const TabbedButtonBar&);
  16189. const TabbedButtonBar& operator= (const TabbedButtonBar&);
  16190. };
  16191. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16192. /********* End of inlined file: juce_TabbedButtonBar.h *********/
  16193. class JUCE_API TabbedComponent : public Component
  16194. {
  16195. public:
  16196. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16197. ~TabbedComponent();
  16198. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16199. TabbedButtonBar::Orientation getOrientation() const throw();
  16200. void setTabBarDepth (const int newDepth);
  16201. int getTabBarDepth() const throw() { return tabDepth; }
  16202. void setOutline (const int newThickness);
  16203. void setIndent (const int indentThickness);
  16204. void clearTabs();
  16205. void addTab (const String& tabName,
  16206. const Colour& tabBackgroundColour,
  16207. Component* const contentComponent,
  16208. const bool deleteComponentWhenNotNeeded,
  16209. const int insertIndex = -1);
  16210. void setTabName (const int tabIndex,
  16211. const String& newName);
  16212. void removeTab (const int tabIndex);
  16213. int getNumTabs() const;
  16214. const StringArray getTabNames() const;
  16215. Component* getTabContentComponent (const int tabIndex) const throw();
  16216. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16217. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16218. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16219. int getCurrentTabIndex() const;
  16220. const String& getCurrentTabName() const;
  16221. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16222. virtual void currentTabChanged (const int newCurrentTabIndex,
  16223. const String& newCurrentTabName);
  16224. virtual void popupMenuClickOnTab (const int tabIndex,
  16225. const String& tabName);
  16226. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16227. enum ColourIds
  16228. {
  16229. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16230. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16231. (See setOutline) */
  16232. };
  16233. void paint (Graphics& g);
  16234. void resized();
  16235. void lookAndFeelChanged();
  16236. juce_UseDebuggingNewOperator
  16237. protected:
  16238. TabbedButtonBar* tabs;
  16239. virtual TabBarButton* createTabButton (const String& tabName,
  16240. const int tabIndex);
  16241. private:
  16242. Array <Component*> contentComponents;
  16243. Component* panelComponent;
  16244. int tabDepth;
  16245. int outlineThickness, edgeIndent;
  16246. friend class TabCompButtonBar;
  16247. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16248. TabbedComponent (const TabbedComponent&);
  16249. const TabbedComponent& operator= (const TabbedComponent&);
  16250. };
  16251. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16252. /********* End of inlined file: juce_TabbedComponent.h *********/
  16253. /********* Start of inlined file: juce_DocumentWindow.h *********/
  16254. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16255. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16256. /********* Start of inlined file: juce_MenuBarComponent.h *********/
  16257. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16258. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16259. /********* Start of inlined file: juce_MenuBarModel.h *********/
  16260. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16261. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16262. class MenuBarModel;
  16263. class JUCE_API MenuBarModelListener
  16264. {
  16265. public:
  16266. virtual ~MenuBarModelListener() {}
  16267. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16268. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16269. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16270. };
  16271. class JUCE_API MenuBarModel : private AsyncUpdater,
  16272. private ApplicationCommandManagerListener
  16273. {
  16274. public:
  16275. MenuBarModel() throw();
  16276. virtual ~MenuBarModel();
  16277. void menuItemsChanged();
  16278. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16279. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16280. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16281. virtual const StringArray getMenuBarNames() = 0;
  16282. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16283. const String& menuName) = 0;
  16284. virtual void menuItemSelected (int menuItemID,
  16285. int topLevelMenuIndex) = 0;
  16286. #if JUCE_MAC || DOXYGEN
  16287. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16288. const PopupMenu* extraAppleMenuItems = 0);
  16289. static MenuBarModel* getMacMainMenu();
  16290. #endif
  16291. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16292. void applicationCommandListChanged();
  16293. void handleAsyncUpdate();
  16294. juce_UseDebuggingNewOperator
  16295. private:
  16296. ApplicationCommandManager* manager;
  16297. SortedSet <void*> listeners;
  16298. MenuBarModel (const MenuBarModel&);
  16299. const MenuBarModel& operator= (const MenuBarModel&);
  16300. };
  16301. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16302. /********* End of inlined file: juce_MenuBarModel.h *********/
  16303. class JUCE_API MenuBarComponent : public Component,
  16304. private MenuBarModelListener,
  16305. private Timer
  16306. {
  16307. public:
  16308. MenuBarComponent (MenuBarModel* const model);
  16309. ~MenuBarComponent();
  16310. void setModel (MenuBarModel* const newModel);
  16311. void showMenu (const int menuIndex);
  16312. void paint (Graphics& g);
  16313. void resized();
  16314. void mouseEnter (const MouseEvent& e);
  16315. void mouseExit (const MouseEvent& e);
  16316. void mouseDown (const MouseEvent& e);
  16317. void mouseDrag (const MouseEvent& e);
  16318. void mouseUp (const MouseEvent& e);
  16319. void mouseMove (const MouseEvent& e);
  16320. void inputAttemptWhenModal();
  16321. void handleCommandMessage (int commandId);
  16322. bool keyPressed (const KeyPress& key);
  16323. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16324. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16325. const ApplicationCommandTarget::InvocationInfo& info);
  16326. juce_UseDebuggingNewOperator
  16327. private:
  16328. MenuBarModel* model;
  16329. StringArray menuNames;
  16330. Array <int> xPositions;
  16331. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16332. int lastMouseX, lastMouseY;
  16333. bool inModalState;
  16334. ScopedPointer <Component> currentPopup;
  16335. int getItemAt (int x, int y);
  16336. void updateItemUnderMouse (const int x, const int y);
  16337. void hideCurrentMenu();
  16338. void timerCallback();
  16339. void repaintMenuItem (int index);
  16340. MenuBarComponent (const MenuBarComponent&);
  16341. const MenuBarComponent& operator= (const MenuBarComponent&);
  16342. };
  16343. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16344. /********* End of inlined file: juce_MenuBarComponent.h *********/
  16345. class JUCE_API DocumentWindow : public ResizableWindow
  16346. {
  16347. public:
  16348. enum TitleBarButtons
  16349. {
  16350. minimiseButton = 1,
  16351. maximiseButton = 2,
  16352. closeButton = 4,
  16353. allButtons = 7
  16354. };
  16355. DocumentWindow (const String& name,
  16356. const Colour& backgroundColour,
  16357. const int requiredButtons,
  16358. const bool addToDesktop = true);
  16359. ~DocumentWindow();
  16360. void setName (const String& newName);
  16361. void setIcon (const Image* imageToUse);
  16362. void setTitleBarHeight (const int newHeight);
  16363. int getTitleBarHeight() const;
  16364. void setTitleBarButtonsRequired (const int requiredButtons,
  16365. const bool positionTitleBarButtonsOnLeft);
  16366. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16367. void setMenuBar (MenuBarModel* menuBarModel,
  16368. const int menuBarHeight = 0);
  16369. virtual void closeButtonPressed();
  16370. virtual void minimiseButtonPressed();
  16371. virtual void maximiseButtonPressed();
  16372. Button* getCloseButton() const throw();
  16373. Button* getMinimiseButton() const throw();
  16374. Button* getMaximiseButton() const throw();
  16375. enum ColourIds
  16376. {
  16377. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16378. and feel class how this is used. */
  16379. };
  16380. void paint (Graphics& g);
  16381. void resized();
  16382. void lookAndFeelChanged();
  16383. const BorderSize getBorderThickness();
  16384. const BorderSize getContentComponentBorder();
  16385. void mouseDoubleClick (const MouseEvent& e);
  16386. void userTriedToCloseWindow();
  16387. void activeWindowStatusChanged();
  16388. int getDesktopWindowStyleFlags() const;
  16389. void parentHierarchyChanged();
  16390. const Rectangle getTitleBarArea();
  16391. juce_UseDebuggingNewOperator
  16392. private:
  16393. int titleBarHeight, menuBarHeight, requiredButtons;
  16394. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16395. ScopedPointer <Button> titleBarButtons [3];
  16396. ScopedPointer <Image> titleBarIcon;
  16397. ScopedPointer <MenuBarComponent> menuBar;
  16398. MenuBarModel* menuBarModel;
  16399. class ButtonListenerProxy : public ButtonListener
  16400. {
  16401. public:
  16402. ButtonListenerProxy();
  16403. void buttonClicked (Button* button);
  16404. DocumentWindow* owner;
  16405. } buttonListener;
  16406. void repaintTitleBar();
  16407. DocumentWindow (const DocumentWindow&);
  16408. const DocumentWindow& operator= (const DocumentWindow&);
  16409. };
  16410. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16411. /********* End of inlined file: juce_DocumentWindow.h *********/
  16412. class MultiDocumentPanel;
  16413. class MDITabbedComponentInternal;
  16414. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16415. {
  16416. public:
  16417. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16418. ~MultiDocumentPanelWindow();
  16419. void maximiseButtonPressed();
  16420. void closeButtonPressed();
  16421. void activeWindowStatusChanged();
  16422. void broughtToFront();
  16423. juce_UseDebuggingNewOperator
  16424. private:
  16425. void updateOrder();
  16426. MultiDocumentPanel* getOwner() const throw();
  16427. };
  16428. class JUCE_API MultiDocumentPanel : public Component,
  16429. private ComponentListener
  16430. {
  16431. public:
  16432. MultiDocumentPanel();
  16433. ~MultiDocumentPanel();
  16434. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16435. bool addDocument (Component* const component,
  16436. const Colour& backgroundColour,
  16437. const bool deleteWhenRemoved);
  16438. bool closeDocument (Component* component,
  16439. const bool checkItsOkToCloseFirst);
  16440. int getNumDocuments() const throw();
  16441. Component* getDocument (const int index) const throw();
  16442. Component* getActiveDocument() const throw();
  16443. void setActiveDocument (Component* component);
  16444. virtual void activeDocumentChanged();
  16445. void setMaximumNumDocuments (const int maximumNumDocuments);
  16446. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16447. bool isFullscreenWhenOneDocument() const throw();
  16448. enum LayoutMode
  16449. {
  16450. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16451. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16452. };
  16453. void setLayoutMode (const LayoutMode newLayoutMode);
  16454. LayoutMode getLayoutMode() const throw() { return mode; }
  16455. void setBackgroundColour (const Colour& newBackgroundColour);
  16456. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16457. virtual bool tryToCloseDocument (Component* component) = 0;
  16458. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16459. void paint (Graphics& g);
  16460. void resized();
  16461. void componentNameChanged (Component&);
  16462. juce_UseDebuggingNewOperator
  16463. private:
  16464. LayoutMode mode;
  16465. Array <Component*> components;
  16466. TabbedComponent* tabComponent;
  16467. Colour backgroundColour;
  16468. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16469. friend class MultiDocumentPanelWindow;
  16470. friend class MDITabbedComponentInternal;
  16471. Component* getContainerComp (Component* c) const;
  16472. void updateOrder();
  16473. void addWindow (Component* component);
  16474. };
  16475. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16476. /********* End of inlined file: juce_MultiDocumentPanel.h *********/
  16477. #endif
  16478. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16479. #endif
  16480. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16481. #endif
  16482. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16483. #endif
  16484. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16485. /********* Start of inlined file: juce_StretchableLayoutManager.h *********/
  16486. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16487. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16488. class JUCE_API StretchableLayoutManager
  16489. {
  16490. public:
  16491. StretchableLayoutManager();
  16492. ~StretchableLayoutManager();
  16493. void setItemLayout (const int itemIndex,
  16494. const double minimumSize,
  16495. const double maximumSize,
  16496. const double preferredSize);
  16497. bool getItemLayout (const int itemIndex,
  16498. double& minimumSize,
  16499. double& maximumSize,
  16500. double& preferredSize) const;
  16501. void clearAllItems();
  16502. void layOutComponents (Component** const components,
  16503. int numComponents,
  16504. int x, int y, int width, int height,
  16505. const bool vertically,
  16506. const bool resizeOtherDimension);
  16507. int getItemCurrentPosition (const int itemIndex) const;
  16508. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16509. double getItemCurrentRelativeSize (const int itemIndex) const;
  16510. void setItemPosition (const int itemIndex,
  16511. int newPosition);
  16512. juce_UseDebuggingNewOperator
  16513. private:
  16514. struct ItemLayoutProperties
  16515. {
  16516. int itemIndex;
  16517. int currentSize;
  16518. double minSize, maxSize, preferredSize;
  16519. };
  16520. OwnedArray <ItemLayoutProperties> items;
  16521. int totalSize;
  16522. static int sizeToRealSize (double size, int totalSpace);
  16523. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16524. void setTotalSize (const int newTotalSize);
  16525. int fitComponentsIntoSpace (const int startIndex,
  16526. const int endIndex,
  16527. const int availableSpace,
  16528. int startPos);
  16529. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16530. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16531. void updatePrefSizesToMatchCurrentPositions();
  16532. StretchableLayoutManager (const StretchableLayoutManager&);
  16533. const StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16534. };
  16535. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16536. /********* End of inlined file: juce_StretchableLayoutManager.h *********/
  16537. #endif
  16538. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16539. /********* Start of inlined file: juce_StretchableLayoutResizerBar.h *********/
  16540. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16541. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16542. class JUCE_API StretchableLayoutResizerBar : public Component
  16543. {
  16544. public:
  16545. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16546. const int itemIndexInLayout,
  16547. const bool isBarVertical);
  16548. ~StretchableLayoutResizerBar();
  16549. virtual void hasBeenMoved();
  16550. void paint (Graphics& g);
  16551. void mouseDown (const MouseEvent& e);
  16552. void mouseDrag (const MouseEvent& e);
  16553. juce_UseDebuggingNewOperator
  16554. private:
  16555. StretchableLayoutManager* layout;
  16556. int itemIndex, mouseDownPos;
  16557. bool isVertical;
  16558. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16559. const StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16560. };
  16561. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16562. /********* End of inlined file: juce_StretchableLayoutResizerBar.h *********/
  16563. #endif
  16564. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16565. /********* Start of inlined file: juce_StretchableObjectResizer.h *********/
  16566. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16567. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16568. class StretchableObjectResizer
  16569. {
  16570. public:
  16571. StretchableObjectResizer();
  16572. ~StretchableObjectResizer();
  16573. void addItem (const double currentSize,
  16574. const double minSize,
  16575. const double maxSize,
  16576. const int order = 0);
  16577. void resizeToFit (const double targetSize);
  16578. int getNumItems() const throw() { return items.size(); }
  16579. double getItemSize (const int index) const throw();
  16580. juce_UseDebuggingNewOperator
  16581. private:
  16582. struct Item
  16583. {
  16584. double size;
  16585. double minSize;
  16586. double maxSize;
  16587. int order;
  16588. };
  16589. OwnedArray <Item> items;
  16590. StretchableObjectResizer (const StretchableObjectResizer&);
  16591. const StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16592. };
  16593. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16594. /********* End of inlined file: juce_StretchableObjectResizer.h *********/
  16595. #endif
  16596. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16597. #endif
  16598. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16599. #endif
  16600. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16601. #endif
  16602. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16603. /********* Start of inlined file: juce_LookAndFeel.h *********/
  16604. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16605. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16606. /********* Start of inlined file: juce_AlertWindow.h *********/
  16607. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16608. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16609. /********* Start of inlined file: juce_TextLayout.h *********/
  16610. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16611. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16612. class Graphics;
  16613. class JUCE_API TextLayout
  16614. {
  16615. public:
  16616. TextLayout() throw();
  16617. TextLayout (const TextLayout& other) throw();
  16618. TextLayout (const String& text, const Font& font) throw();
  16619. ~TextLayout() throw();
  16620. const TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16621. void clear() throw();
  16622. void appendText (const String& textToAppend,
  16623. const Font& fontToUse) throw();
  16624. void setText (const String& newText,
  16625. const Font& fontToUse) throw();
  16626. void layout (int maximumWidth,
  16627. const Justification& justification,
  16628. const bool attemptToBalanceLineLengths) throw();
  16629. int getWidth() const throw();
  16630. int getHeight() const throw();
  16631. int getNumLines() const throw() { return totalLines; }
  16632. int getLineWidth (const int lineNumber) const throw();
  16633. void draw (Graphics& g,
  16634. const int topLeftX,
  16635. const int topLeftY) const throw();
  16636. void drawWithin (Graphics& g,
  16637. int x, int y, int w, int h,
  16638. const Justification& layoutFlags) const throw();
  16639. juce_UseDebuggingNewOperator
  16640. class Token;
  16641. private:
  16642. OwnedArray <Token> tokens;
  16643. int totalLines;
  16644. };
  16645. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16646. /********* End of inlined file: juce_TextLayout.h *********/
  16647. class JUCE_API AlertWindow : public TopLevelWindow,
  16648. private ButtonListener
  16649. {
  16650. public:
  16651. enum AlertIconType
  16652. {
  16653. NoIcon, /**< No icon will be shown on the dialog box. */
  16654. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16655. user to answer a question. */
  16656. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16657. warning about something and shouldn't be ignored. */
  16658. InfoIcon /**< An icon that indicates that the dialog box is just
  16659. giving the user some information, which doesn't require
  16660. a response from them. */
  16661. };
  16662. AlertWindow (const String& title,
  16663. const String& message,
  16664. AlertIconType iconType,
  16665. Component* associatedComponent = 0);
  16666. ~AlertWindow();
  16667. AlertIconType getAlertType() const throw() { return alertIconType; }
  16668. void setMessage (const String& message);
  16669. void addButton (const String& name,
  16670. const int returnValue,
  16671. const KeyPress& shortcutKey1 = KeyPress(),
  16672. const KeyPress& shortcutKey2 = KeyPress());
  16673. int getNumButtons() const;
  16674. void addTextEditor (const String& name,
  16675. const String& initialContents,
  16676. const String& onScreenLabel = String::empty,
  16677. const bool isPasswordBox = false);
  16678. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16679. void addComboBox (const String& name,
  16680. const StringArray& items,
  16681. const String& onScreenLabel = String::empty);
  16682. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16683. void addTextBlock (const String& text);
  16684. void addProgressBarComponent (double& progressValue);
  16685. void addCustomComponent (Component* const component);
  16686. int getNumCustomComponents() const;
  16687. Component* getCustomComponent (const int index) const;
  16688. Component* removeCustomComponent (const int index);
  16689. bool containsAnyExtraComponents() const;
  16690. // easy-to-use message box functions:
  16691. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16692. const String& title,
  16693. const String& message,
  16694. const String& buttonText = String::empty,
  16695. Component* associatedComponent = 0);
  16696. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16697. const String& title,
  16698. const String& message,
  16699. const String& button1Text = String::empty,
  16700. const String& button2Text = String::empty,
  16701. Component* associatedComponent = 0);
  16702. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16703. const String& title,
  16704. const String& message,
  16705. const String& button1Text = String::empty,
  16706. const String& button2Text = String::empty,
  16707. const String& button3Text = String::empty,
  16708. Component* associatedComponent = 0);
  16709. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16710. const String& bodyText,
  16711. bool isOkCancel);
  16712. enum ColourIds
  16713. {
  16714. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16715. textColourId = 0x1001810, /**< The colour for the text. */
  16716. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16717. };
  16718. juce_UseDebuggingNewOperator
  16719. protected:
  16720. void paint (Graphics& g);
  16721. void mouseDown (const MouseEvent& e);
  16722. void mouseDrag (const MouseEvent& e);
  16723. bool keyPressed (const KeyPress& key);
  16724. void buttonClicked (Button* button);
  16725. void lookAndFeelChanged();
  16726. void userTriedToCloseWindow();
  16727. int getDesktopWindowStyleFlags() const;
  16728. private:
  16729. String text;
  16730. TextLayout textLayout;
  16731. AlertIconType alertIconType;
  16732. ComponentBoundsConstrainer constrainer;
  16733. ComponentDragger dragger;
  16734. Rectangle textArea;
  16735. VoidArray buttons, textBoxes, comboBoxes;
  16736. VoidArray progressBars, customComps, textBlocks, allComps;
  16737. StringArray textboxNames, comboBoxNames;
  16738. Font font;
  16739. Component* associatedComponent;
  16740. void updateLayout (const bool onlyIncreaseSize);
  16741. // disable copy constructor
  16742. AlertWindow (const AlertWindow&);
  16743. const AlertWindow& operator= (const AlertWindow&);
  16744. };
  16745. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  16746. /********* End of inlined file: juce_AlertWindow.h *********/
  16747. class ToggleButton;
  16748. class TextButton;
  16749. class AlertWindow;
  16750. class TextLayout;
  16751. class ScrollBar;
  16752. class BubbleComponent;
  16753. class ComboBox;
  16754. class Button;
  16755. class FilenameComponent;
  16756. class DocumentWindow;
  16757. class ResizableWindow;
  16758. class GroupComponent;
  16759. class MenuBarComponent;
  16760. class DropShadower;
  16761. class GlyphArrangement;
  16762. class PropertyComponent;
  16763. class TableHeaderComponent;
  16764. class Toolbar;
  16765. class ToolbarItemComponent;
  16766. class PopupMenu;
  16767. class ProgressBar;
  16768. class FileBrowserComponent;
  16769. class DirectoryContentsDisplayComponent;
  16770. class FilePreviewComponent;
  16771. class ImageButton;
  16772. class JUCE_API LookAndFeel
  16773. {
  16774. public:
  16775. LookAndFeel();
  16776. virtual ~LookAndFeel();
  16777. static LookAndFeel& getDefaultLookAndFeel() throw();
  16778. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  16779. const Colour findColour (const int colourId) const throw();
  16780. void setColour (const int colourId, const Colour& colour) throw();
  16781. bool isColourSpecified (const int colourId) const throw();
  16782. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  16783. void setDefaultSansSerifTypefaceName (const String& newName);
  16784. virtual const MouseCursor getMouseCursorFor (Component& component);
  16785. virtual void drawButtonBackground (Graphics& g,
  16786. Button& button,
  16787. const Colour& backgroundColour,
  16788. bool isMouseOverButton,
  16789. bool isButtonDown);
  16790. virtual const Font getFontForTextButton (TextButton& button);
  16791. virtual void drawButtonText (Graphics& g,
  16792. TextButton& button,
  16793. bool isMouseOverButton,
  16794. bool isButtonDown);
  16795. virtual void drawToggleButton (Graphics& g,
  16796. ToggleButton& button,
  16797. bool isMouseOverButton,
  16798. bool isButtonDown);
  16799. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  16800. virtual void drawTickBox (Graphics& g,
  16801. Component& component,
  16802. int x, int y, int w, int h,
  16803. const bool ticked,
  16804. const bool isEnabled,
  16805. const bool isMouseOverButton,
  16806. const bool isButtonDown);
  16807. virtual AlertWindow* createAlertWindow (const String& title,
  16808. const String& message,
  16809. const String& button1,
  16810. const String& button2,
  16811. const String& button3,
  16812. AlertWindow::AlertIconType iconType,
  16813. int numButtons,
  16814. Component* associatedComponent);
  16815. virtual void drawAlertBox (Graphics& g,
  16816. AlertWindow& alert,
  16817. const Rectangle& textArea,
  16818. TextLayout& textLayout);
  16819. virtual int getAlertBoxWindowFlags();
  16820. virtual int getAlertWindowButtonHeight();
  16821. virtual const Font getAlertWindowFont();
  16822. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  16823. int width, int height,
  16824. double progress, const String& textToShow);
  16825. // Draws a small image that spins to indicate that something's happening..
  16826. // This method should use the current time to animate itself, so just keep
  16827. // repainting it every so often.
  16828. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  16829. int x, int y, int w, int h);
  16830. virtual void drawScrollbarButton (Graphics& g,
  16831. ScrollBar& scrollbar,
  16832. int width, int height,
  16833. int buttonDirection,
  16834. bool isScrollbarVertical,
  16835. bool isMouseOverButton,
  16836. bool isButtonDown);
  16837. virtual void drawScrollbar (Graphics& g,
  16838. ScrollBar& scrollbar,
  16839. int x, int y,
  16840. int width, int height,
  16841. bool isScrollbarVertical,
  16842. int thumbStartPosition,
  16843. int thumbSize,
  16844. bool isMouseOver,
  16845. bool isMouseDown);
  16846. virtual ImageEffectFilter* getScrollbarEffect();
  16847. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  16848. virtual int getDefaultScrollbarWidth();
  16849. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  16850. virtual const Path getTickShape (const float height);
  16851. virtual const Path getCrossShape (const float height);
  16852. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  16853. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  16854. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  16855. // these return an image from the ImageCache, so use ImageCache::release() to free it
  16856. virtual Image* getDefaultFolderImage();
  16857. virtual Image* getDefaultDocumentFileImage();
  16858. virtual void createFileChooserHeaderText (const String& title,
  16859. const String& instructions,
  16860. GlyphArrangement& destArrangement,
  16861. int width);
  16862. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  16863. const String& filename, Image* icon,
  16864. const String& fileSizeDescription,
  16865. const String& fileTimeDescription,
  16866. const bool isDirectory,
  16867. const bool isItemSelected,
  16868. const int itemIndex);
  16869. virtual Button* createFileBrowserGoUpButton();
  16870. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  16871. DirectoryContentsDisplayComponent* fileListComponent,
  16872. FilePreviewComponent* previewComp,
  16873. ComboBox* currentPathBox,
  16874. TextEditor* filenameBox,
  16875. Button* goUpButton);
  16876. virtual void drawBubble (Graphics& g,
  16877. float tipX, float tipY,
  16878. float boxX, float boxY, float boxW, float boxH);
  16879. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  16880. virtual void drawPopupMenuItem (Graphics& g,
  16881. int width, int height,
  16882. const bool isSeparator,
  16883. const bool isActive,
  16884. const bool isHighlighted,
  16885. const bool isTicked,
  16886. const bool hasSubMenu,
  16887. const String& text,
  16888. const String& shortcutKeyText,
  16889. Image* image,
  16890. const Colour* const textColour);
  16891. virtual const Font getPopupMenuFont();
  16892. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  16893. int width, int height,
  16894. bool isScrollUpArrow);
  16895. virtual void getIdealPopupMenuItemSize (const String& text,
  16896. const bool isSeparator,
  16897. int standardMenuItemHeight,
  16898. int& idealWidth,
  16899. int& idealHeight);
  16900. virtual int getMenuWindowFlags();
  16901. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  16902. bool isMouseOverBar,
  16903. MenuBarComponent& menuBar);
  16904. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16905. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  16906. virtual void drawMenuBarItem (Graphics& g,
  16907. int width, int height,
  16908. int itemIndex,
  16909. const String& itemText,
  16910. bool isMouseOverItem,
  16911. bool isMenuOpen,
  16912. bool isMouseOverBar,
  16913. MenuBarComponent& menuBar);
  16914. virtual void drawComboBox (Graphics& g, int width, int height,
  16915. const bool isButtonDown,
  16916. int buttonX, int buttonY,
  16917. int buttonW, int buttonH,
  16918. ComboBox& box);
  16919. virtual const Font getComboBoxFont (ComboBox& box);
  16920. virtual Label* createComboBoxTextBox (ComboBox& box);
  16921. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  16922. virtual void drawLabel (Graphics& g, Label& label);
  16923. virtual void drawLinearSlider (Graphics& g,
  16924. int x, int y,
  16925. int width, int height,
  16926. float sliderPos,
  16927. float minSliderPos,
  16928. float maxSliderPos,
  16929. const Slider::SliderStyle style,
  16930. Slider& slider);
  16931. virtual void drawLinearSliderBackground (Graphics& g,
  16932. int x, int y,
  16933. int width, int height,
  16934. float sliderPos,
  16935. float minSliderPos,
  16936. float maxSliderPos,
  16937. const Slider::SliderStyle style,
  16938. Slider& slider);
  16939. virtual void drawLinearSliderThumb (Graphics& g,
  16940. int x, int y,
  16941. int width, int height,
  16942. float sliderPos,
  16943. float minSliderPos,
  16944. float maxSliderPos,
  16945. const Slider::SliderStyle style,
  16946. Slider& slider);
  16947. virtual int getSliderThumbRadius (Slider& slider);
  16948. virtual void drawRotarySlider (Graphics& g,
  16949. int x, int y,
  16950. int width, int height,
  16951. float sliderPosProportional,
  16952. const float rotaryStartAngle,
  16953. const float rotaryEndAngle,
  16954. Slider& slider);
  16955. virtual Button* createSliderButton (const bool isIncrement);
  16956. virtual Label* createSliderTextBox (Slider& slider);
  16957. virtual ImageEffectFilter* getSliderEffect();
  16958. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  16959. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  16960. virtual Button* createFilenameComponentBrowseButton (const String& text);
  16961. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  16962. ComboBox* filenameBox, Button* browseButton);
  16963. virtual void drawCornerResizer (Graphics& g,
  16964. int w, int h,
  16965. bool isMouseOver,
  16966. bool isMouseDragging);
  16967. virtual void drawResizableFrame (Graphics& g,
  16968. int w, int h,
  16969. const BorderSize& borders);
  16970. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  16971. const BorderSize& border,
  16972. ResizableWindow& window);
  16973. virtual void drawResizableWindowBorder (Graphics& g,
  16974. int w, int h,
  16975. const BorderSize& border,
  16976. ResizableWindow& window);
  16977. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  16978. Graphics& g, int w, int h,
  16979. int titleSpaceX, int titleSpaceW,
  16980. const Image* icon,
  16981. bool drawTitleTextOnLeft);
  16982. virtual Button* createDocumentWindowButton (int buttonType);
  16983. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  16984. int titleBarX, int titleBarY,
  16985. int titleBarW, int titleBarH,
  16986. Button* minimiseButton,
  16987. Button* maximiseButton,
  16988. Button* closeButton,
  16989. bool positionTitleBarButtonsOnLeft);
  16990. virtual int getDefaultMenuBarHeight();
  16991. virtual DropShadower* createDropShadowerForComponent (Component* component);
  16992. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  16993. int w, int h,
  16994. bool isVerticalBar,
  16995. bool isMouseOver,
  16996. bool isMouseDragging);
  16997. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  16998. const String& text,
  16999. const Justification& position,
  17000. GroupComponent& group);
  17001. virtual void createTabButtonShape (Path& p,
  17002. int width, int height,
  17003. int tabIndex,
  17004. const String& text,
  17005. Button& button,
  17006. TabbedButtonBar::Orientation orientation,
  17007. const bool isMouseOver,
  17008. const bool isMouseDown,
  17009. const bool isFrontTab);
  17010. virtual void fillTabButtonShape (Graphics& g,
  17011. const Path& path,
  17012. const Colour& preferredBackgroundColour,
  17013. int tabIndex,
  17014. const String& text,
  17015. Button& button,
  17016. TabbedButtonBar::Orientation orientation,
  17017. const bool isMouseOver,
  17018. const bool isMouseDown,
  17019. const bool isFrontTab);
  17020. virtual void drawTabButtonText (Graphics& g,
  17021. int x, int y, int w, int h,
  17022. const Colour& preferredBackgroundColour,
  17023. int tabIndex,
  17024. const String& text,
  17025. Button& button,
  17026. TabbedButtonBar::Orientation orientation,
  17027. const bool isMouseOver,
  17028. const bool isMouseDown,
  17029. const bool isFrontTab);
  17030. virtual int getTabButtonOverlap (int tabDepth);
  17031. virtual int getTabButtonSpaceAroundImage();
  17032. virtual int getTabButtonBestWidth (int tabIndex,
  17033. const String& text,
  17034. int tabDepth,
  17035. Button& button);
  17036. virtual void drawTabButton (Graphics& g,
  17037. int w, int h,
  17038. const Colour& preferredColour,
  17039. int tabIndex,
  17040. const String& text,
  17041. Button& button,
  17042. TabbedButtonBar::Orientation orientation,
  17043. const bool isMouseOver,
  17044. const bool isMouseDown,
  17045. const bool isFrontTab);
  17046. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17047. int w, int h,
  17048. TabbedButtonBar& tabBar,
  17049. TabbedButtonBar::Orientation orientation);
  17050. virtual Button* createTabBarExtrasButton();
  17051. virtual void drawImageButton (Graphics& g, Image* image,
  17052. int imageX, int imageY, int imageW, int imageH,
  17053. const Colour& overlayColour,
  17054. float imageOpacity,
  17055. ImageButton& button);
  17056. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17057. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17058. int width, int height,
  17059. bool isMouseOver, bool isMouseDown,
  17060. int columnFlags);
  17061. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17062. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17063. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17064. bool isMouseOver, bool isMouseDown,
  17065. ToolbarItemComponent& component);
  17066. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17067. const String& text, ToolbarItemComponent& component);
  17068. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17069. bool isOpen, int width, int height);
  17070. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17071. PropertyComponent& component);
  17072. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17073. PropertyComponent& component);
  17074. virtual const Rectangle getPropertyComponentContentPosition (PropertyComponent& component);
  17075. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17076. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17077. virtual void playAlertSound();
  17078. static void drawGlassSphere (Graphics& g,
  17079. const float x, const float y,
  17080. const float diameter,
  17081. const Colour& colour,
  17082. const float outlineThickness) throw();
  17083. static void drawGlassPointer (Graphics& g,
  17084. const float x, const float y,
  17085. const float diameter,
  17086. const Colour& colour, const float outlineThickness,
  17087. const int direction) throw();
  17088. static void drawGlassLozenge (Graphics& g,
  17089. const float x, const float y,
  17090. const float width, const float height,
  17091. const Colour& colour,
  17092. const float outlineThickness,
  17093. const float cornerSize,
  17094. const bool flatOnLeft, const bool flatOnRight,
  17095. const bool flatOnTop, const bool flatOnBottom) throw();
  17096. juce_UseDebuggingNewOperator
  17097. protected:
  17098. // xxx the following methods are only here to cause a compiler error, because they've been
  17099. // deprecated or their parameters have changed. Hopefully these definitions should cause an
  17100. // error if you try to build a subclass with the old versions.
  17101. virtual int drawTickBox (Graphics&, int, int, int, int, bool, const bool, const bool, const bool) { return 0; }
  17102. virtual int drawProgressBar (Graphics&, int, int, int, int, float) { return 0; }
  17103. virtual int drawProgressBar (Graphics&, ProgressBar&, int, int, int, int, float) { return 0; }
  17104. virtual void getTabButtonBestWidth (int, const String&, int) {}
  17105. virtual int drawTreeviewPlusMinusBox (Graphics&, int, int, int, int, bool) { return 0; }
  17106. private:
  17107. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17108. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17109. Array <int> colourIds;
  17110. Array <Colour> colours;
  17111. // default typeface names
  17112. String defaultSans, defaultSerif, defaultFixed;
  17113. void drawShinyButtonShape (Graphics& g,
  17114. float x, float y, float w, float h, float maxCornerSize,
  17115. const Colour& baseColour,
  17116. const float strokeWidth,
  17117. const bool flatOnLeft,
  17118. const bool flatOnRight,
  17119. const bool flatOnTop,
  17120. const bool flatOnBottom) throw();
  17121. LookAndFeel (const LookAndFeel&);
  17122. const LookAndFeel& operator= (const LookAndFeel&);
  17123. };
  17124. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17125. /********* End of inlined file: juce_LookAndFeel.h *********/
  17126. #endif
  17127. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17128. /********* Start of inlined file: juce_OldSchoolLookAndFeel.h *********/
  17129. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17130. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17131. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17132. {
  17133. public:
  17134. OldSchoolLookAndFeel();
  17135. virtual ~OldSchoolLookAndFeel();
  17136. virtual void drawButtonBackground (Graphics& g,
  17137. Button& button,
  17138. const Colour& backgroundColour,
  17139. bool isMouseOverButton,
  17140. bool isButtonDown);
  17141. virtual void drawToggleButton (Graphics& g,
  17142. ToggleButton& button,
  17143. bool isMouseOverButton,
  17144. bool isButtonDown);
  17145. virtual void drawTickBox (Graphics& g,
  17146. Component& component,
  17147. int x, int y, int w, int h,
  17148. const bool ticked,
  17149. const bool isEnabled,
  17150. const bool isMouseOverButton,
  17151. const bool isButtonDown);
  17152. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17153. int width, int height,
  17154. double progress, const String& textToShow);
  17155. virtual void drawScrollbarButton (Graphics& g,
  17156. ScrollBar& scrollbar,
  17157. int width, int height,
  17158. int buttonDirection,
  17159. bool isScrollbarVertical,
  17160. bool isMouseOverButton,
  17161. bool isButtonDown);
  17162. virtual void drawScrollbar (Graphics& g,
  17163. ScrollBar& scrollbar,
  17164. int x, int y,
  17165. int width, int height,
  17166. bool isScrollbarVertical,
  17167. int thumbStartPosition,
  17168. int thumbSize,
  17169. bool isMouseOver,
  17170. bool isMouseDown);
  17171. virtual ImageEffectFilter* getScrollbarEffect();
  17172. virtual void drawTextEditorOutline (Graphics& g,
  17173. int width, int height,
  17174. TextEditor& textEditor);
  17175. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17176. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17177. bool isMouseOverBar,
  17178. MenuBarComponent& menuBar);
  17179. virtual void drawComboBox (Graphics& g, int width, int height,
  17180. const bool isButtonDown,
  17181. int buttonX, int buttonY,
  17182. int buttonW, int buttonH,
  17183. ComboBox& box);
  17184. virtual const Font getComboBoxFont (ComboBox& box);
  17185. virtual void drawLinearSlider (Graphics& g,
  17186. int x, int y,
  17187. int width, int height,
  17188. float sliderPos,
  17189. float minSliderPos,
  17190. float maxSliderPos,
  17191. const Slider::SliderStyle style,
  17192. Slider& slider);
  17193. virtual int getSliderThumbRadius (Slider& slider);
  17194. virtual Button* createSliderButton (const bool isIncrement);
  17195. virtual ImageEffectFilter* getSliderEffect();
  17196. virtual void drawCornerResizer (Graphics& g,
  17197. int w, int h,
  17198. bool isMouseOver,
  17199. bool isMouseDragging);
  17200. virtual Button* createDocumentWindowButton (int buttonType);
  17201. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17202. int titleBarX, int titleBarY,
  17203. int titleBarW, int titleBarH,
  17204. Button* minimiseButton,
  17205. Button* maximiseButton,
  17206. Button* closeButton,
  17207. bool positionTitleBarButtonsOnLeft);
  17208. juce_UseDebuggingNewOperator
  17209. private:
  17210. DropShadowEffect scrollbarShadow;
  17211. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17212. const OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17213. };
  17214. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17215. /********* End of inlined file: juce_OldSchoolLookAndFeel.h *********/
  17216. #endif
  17217. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17218. #endif
  17219. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17220. #endif
  17221. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17222. #endif
  17223. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17224. #endif
  17225. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17226. #endif
  17227. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17228. #endif
  17229. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17230. #endif
  17231. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17232. #endif
  17233. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17234. /********* Start of inlined file: juce_LassoComponent.h *********/
  17235. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17236. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17237. /********* Start of inlined file: juce_SelectedItemSet.h *********/
  17238. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17239. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17240. template <class SelectableItemType>
  17241. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17242. {
  17243. public:
  17244. SelectedItemSet()
  17245. {
  17246. }
  17247. SelectedItemSet (const Array <SelectableItemType>& items)
  17248. : selectedItems (items)
  17249. {
  17250. }
  17251. SelectedItemSet (const SelectedItemSet& other)
  17252. : selectedItems (other.selectedItems)
  17253. {
  17254. }
  17255. const SelectedItemSet& operator= (const SelectedItemSet& other)
  17256. {
  17257. if (selectedItems != other.selectedItems)
  17258. {
  17259. selectedItems = other.selectedItems;
  17260. changed();
  17261. }
  17262. return *this;
  17263. }
  17264. ~SelectedItemSet()
  17265. {
  17266. }
  17267. void selectOnly (SelectableItemType item)
  17268. {
  17269. if (isSelected (item))
  17270. {
  17271. for (int i = selectedItems.size(); --i >= 0;)
  17272. {
  17273. if (selectedItems.getUnchecked(i) != item)
  17274. {
  17275. deselect (selectedItems.getUnchecked(i));
  17276. i = jmin (i, selectedItems.size());
  17277. }
  17278. }
  17279. }
  17280. else
  17281. {
  17282. deselectAll();
  17283. changed();
  17284. selectedItems.add (item);
  17285. itemSelected (item);
  17286. }
  17287. }
  17288. void addToSelection (SelectableItemType item)
  17289. {
  17290. if (! isSelected (item))
  17291. {
  17292. changed();
  17293. selectedItems.add (item);
  17294. itemSelected (item);
  17295. }
  17296. }
  17297. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17298. const ModifierKeys& modifiers)
  17299. {
  17300. if (modifiers.isShiftDown())
  17301. {
  17302. addToSelection (item);
  17303. }
  17304. else if (modifiers.isCommandDown())
  17305. {
  17306. if (isSelected (item))
  17307. deselect (item);
  17308. else
  17309. addToSelection (item);
  17310. }
  17311. else
  17312. {
  17313. selectOnly (item);
  17314. }
  17315. }
  17316. bool addToSelectionOnMouseDown (SelectableItemType item,
  17317. const ModifierKeys& modifiers)
  17318. {
  17319. if (isSelected (item))
  17320. {
  17321. return ! modifiers.isPopupMenu();
  17322. }
  17323. else
  17324. {
  17325. addToSelectionBasedOnModifiers (item, modifiers);
  17326. return false;
  17327. }
  17328. }
  17329. void addToSelectionOnMouseUp (SelectableItemType item,
  17330. const ModifierKeys& modifiers,
  17331. const bool wasItemDragged,
  17332. const bool resultOfMouseDownSelectMethod)
  17333. {
  17334. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17335. addToSelectionBasedOnModifiers (item, modifiers);
  17336. }
  17337. void deselect (SelectableItemType item)
  17338. {
  17339. const int i = selectedItems.indexOf (item);
  17340. if (i >= 0)
  17341. {
  17342. changed();
  17343. itemDeselected (selectedItems.remove (i));
  17344. }
  17345. }
  17346. void deselectAll()
  17347. {
  17348. if (selectedItems.size() > 0)
  17349. {
  17350. changed();
  17351. for (int i = selectedItems.size(); --i >= 0;)
  17352. {
  17353. itemDeselected (selectedItems.remove (i));
  17354. i = jmin (i, selectedItems.size());
  17355. }
  17356. }
  17357. }
  17358. int getNumSelected() const throw()
  17359. {
  17360. return selectedItems.size();
  17361. }
  17362. SelectableItemType getSelectedItem (const int index) const throw()
  17363. {
  17364. return selectedItems [index];
  17365. }
  17366. bool isSelected (const SelectableItemType item) const throw()
  17367. {
  17368. return selectedItems.contains (item);
  17369. }
  17370. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17371. virtual void itemSelected (SelectableItemType item) {}
  17372. virtual void itemDeselected (SelectableItemType item) {}
  17373. void changed (const bool synchronous = false)
  17374. {
  17375. if (synchronous)
  17376. sendSynchronousChangeMessage (this);
  17377. else
  17378. sendChangeMessage (this);
  17379. }
  17380. juce_UseDebuggingNewOperator
  17381. private:
  17382. Array <SelectableItemType> selectedItems;
  17383. };
  17384. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17385. /********* End of inlined file: juce_SelectedItemSet.h *********/
  17386. template <class SelectableItemType>
  17387. class LassoSource
  17388. {
  17389. public:
  17390. virtual ~LassoSource() {}
  17391. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17392. int x, int y, int width, int height) = 0;
  17393. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17394. };
  17395. template <class SelectableItemType>
  17396. class LassoComponent : public Component
  17397. {
  17398. public:
  17399. LassoComponent (const int outlineThickness_ = 1)
  17400. : source (0),
  17401. outlineThickness (outlineThickness_)
  17402. {
  17403. }
  17404. ~LassoComponent()
  17405. {
  17406. }
  17407. void beginLasso (const MouseEvent& e,
  17408. LassoSource <SelectableItemType>* const lassoSource)
  17409. {
  17410. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17411. jassert (lassoSource != 0); // the source can't be null!
  17412. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17413. source = lassoSource;
  17414. if (lassoSource != 0)
  17415. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17416. setSize (0, 0);
  17417. }
  17418. void dragLasso (const MouseEvent& e)
  17419. {
  17420. if (source != 0)
  17421. {
  17422. const int x1 = e.getMouseDownX();
  17423. const int y1 = e.getMouseDownY();
  17424. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17425. setVisible (true);
  17426. Array <SelectableItemType> itemsInLasso;
  17427. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17428. if (e.mods.isShiftDown())
  17429. {
  17430. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17431. itemsInLasso.addArray (originalSelection);
  17432. }
  17433. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17434. {
  17435. Array <SelectableItemType> originalMinusNew (originalSelection);
  17436. originalMinusNew.removeValuesIn (itemsInLasso);
  17437. itemsInLasso.removeValuesIn (originalSelection);
  17438. itemsInLasso.addArray (originalMinusNew);
  17439. }
  17440. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17441. }
  17442. }
  17443. void endLasso()
  17444. {
  17445. source = 0;
  17446. originalSelection.clear();
  17447. setVisible (false);
  17448. }
  17449. enum ColourIds
  17450. {
  17451. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17452. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17453. };
  17454. void paint (Graphics& g)
  17455. {
  17456. g.fillAll (findColour (lassoFillColourId));
  17457. g.setColour (findColour (lassoOutlineColourId));
  17458. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17459. // this suggests that you've left a lasso comp lying around after the
  17460. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17461. // mouse-up event.
  17462. jassert (isMouseButtonDownAnywhere());
  17463. }
  17464. bool hitTest (int x, int y) { return false; }
  17465. juce_UseDebuggingNewOperator
  17466. private:
  17467. Array <SelectableItemType> originalSelection;
  17468. LassoSource <SelectableItemType>* source;
  17469. int outlineThickness;
  17470. };
  17471. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17472. /********* End of inlined file: juce_LassoComponent.h *********/
  17473. #endif
  17474. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17475. #endif
  17476. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17477. #endif
  17478. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17479. /********* Start of inlined file: juce_MouseHoverDetector.h *********/
  17480. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17481. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17482. class JUCE_API MouseHoverDetector
  17483. {
  17484. public:
  17485. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17486. virtual ~MouseHoverDetector();
  17487. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17488. void setHoverComponent (Component* const newSourceComponent);
  17489. protected:
  17490. virtual void mouseHovered (int mouseX,
  17491. int mouseY) = 0;
  17492. virtual void mouseMovedAfterHover() = 0;
  17493. private:
  17494. class JUCE_API HoverDetectorInternal : public MouseListener,
  17495. public Timer
  17496. {
  17497. public:
  17498. MouseHoverDetector* owner;
  17499. int lastX, lastY;
  17500. void timerCallback();
  17501. void mouseEnter (const MouseEvent&);
  17502. void mouseExit (const MouseEvent&);
  17503. void mouseDown (const MouseEvent&);
  17504. void mouseUp (const MouseEvent&);
  17505. void mouseMove (const MouseEvent&);
  17506. void mouseWheelMove (const MouseEvent&, float, float);
  17507. } internalTimer;
  17508. friend class HoverDetectorInternal;
  17509. Component* source;
  17510. int hoverTimeMillisecs;
  17511. bool hasJustHovered;
  17512. void hoverTimerCallback();
  17513. void checkJustHoveredCallback();
  17514. MouseHoverDetector (const MouseHoverDetector&);
  17515. const MouseHoverDetector& operator= (const MouseHoverDetector&);
  17516. };
  17517. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17518. /********* End of inlined file: juce_MouseHoverDetector.h *********/
  17519. #endif
  17520. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17521. #endif
  17522. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17523. #endif
  17524. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17525. /********* Start of inlined file: juce_BooleanPropertyComponent.h *********/
  17526. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17527. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17528. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17529. private ButtonListener
  17530. {
  17531. protected:
  17532. BooleanPropertyComponent (const String& propertyName,
  17533. const String& buttonTextWhenTrue,
  17534. const String& buttonTextWhenFalse);
  17535. public:
  17536. BooleanPropertyComponent (const Value& valueToControl,
  17537. const String& propertyName,
  17538. const String& buttonText);
  17539. ~BooleanPropertyComponent();
  17540. virtual void setState (const bool newState);
  17541. virtual bool getState() const;
  17542. void paint (Graphics& g);
  17543. void refresh();
  17544. void buttonClicked (Button*);
  17545. juce_UseDebuggingNewOperator
  17546. private:
  17547. ToggleButton* button;
  17548. String onText, offText;
  17549. void createButton();
  17550. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17551. const BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17552. };
  17553. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17554. /********* End of inlined file: juce_BooleanPropertyComponent.h *********/
  17555. #endif
  17556. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17557. /********* Start of inlined file: juce_ButtonPropertyComponent.h *********/
  17558. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17559. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17560. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17561. private ButtonListener
  17562. {
  17563. public:
  17564. ButtonPropertyComponent (const String& propertyName,
  17565. const bool triggerOnMouseDown);
  17566. ~ButtonPropertyComponent();
  17567. virtual void buttonClicked() = 0;
  17568. virtual const String getButtonText() const = 0;
  17569. void refresh();
  17570. void buttonClicked (Button*);
  17571. juce_UseDebuggingNewOperator
  17572. private:
  17573. TextButton* button;
  17574. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17575. const ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17576. };
  17577. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17578. /********* End of inlined file: juce_ButtonPropertyComponent.h *********/
  17579. #endif
  17580. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17581. /********* Start of inlined file: juce_ChoicePropertyComponent.h *********/
  17582. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17583. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17584. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17585. private ComboBoxListener
  17586. {
  17587. protected:
  17588. ChoicePropertyComponent (const String& propertyName);
  17589. public:
  17590. ChoicePropertyComponent (const Value& valueToControl,
  17591. const String& propertyName,
  17592. const StringArray& choices);
  17593. ~ChoicePropertyComponent();
  17594. virtual void setIndex (const int newIndex);
  17595. virtual int getIndex() const;
  17596. const StringArray& getChoices() const;
  17597. void refresh();
  17598. void comboBoxChanged (ComboBox*);
  17599. juce_UseDebuggingNewOperator
  17600. protected:
  17601. StringArray choices;
  17602. private:
  17603. ComboBox* comboBox;
  17604. void createComboBox();
  17605. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17606. const ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17607. };
  17608. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17609. /********* End of inlined file: juce_ChoicePropertyComponent.h *********/
  17610. #endif
  17611. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17612. #endif
  17613. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17614. #endif
  17615. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17616. /********* Start of inlined file: juce_SliderPropertyComponent.h *********/
  17617. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17618. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17619. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17620. private SliderListener
  17621. {
  17622. protected:
  17623. SliderPropertyComponent (const String& propertyName,
  17624. const double rangeMin,
  17625. const double rangeMax,
  17626. const double interval,
  17627. const double skewFactor = 1.0);
  17628. public:
  17629. SliderPropertyComponent (Value& valueToControl,
  17630. const String& propertyName,
  17631. const double rangeMin,
  17632. const double rangeMax,
  17633. const double interval,
  17634. const double skewFactor = 1.0);
  17635. ~SliderPropertyComponent();
  17636. virtual void setValue (const double newValue);
  17637. virtual const double getValue() const;
  17638. void refresh();
  17639. void changeListenerCallback (void*);
  17640. void sliderValueChanged (Slider*);
  17641. juce_UseDebuggingNewOperator
  17642. protected:
  17643. Slider* slider;
  17644. SliderPropertyComponent (const SliderPropertyComponent&);
  17645. const SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17646. };
  17647. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17648. /********* End of inlined file: juce_SliderPropertyComponent.h *********/
  17649. #endif
  17650. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17651. /********* Start of inlined file: juce_TextPropertyComponent.h *********/
  17652. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17653. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17654. class JUCE_API TextPropertyComponent : public PropertyComponent
  17655. {
  17656. protected:
  17657. TextPropertyComponent (const String& propertyName,
  17658. const int maxNumChars,
  17659. const bool isMultiLine);
  17660. public:
  17661. TextPropertyComponent (const Value& valueToControl,
  17662. const String& propertyName,
  17663. const int maxNumChars,
  17664. const bool isMultiLine);
  17665. ~TextPropertyComponent();
  17666. virtual void setText (const String& newText);
  17667. virtual const String getText() const;
  17668. void refresh();
  17669. void textWasEdited();
  17670. juce_UseDebuggingNewOperator
  17671. private:
  17672. Label* textEditor;
  17673. void createEditor (const int maxNumChars, const bool isMultiLine);
  17674. TextPropertyComponent (const TextPropertyComponent&);
  17675. const TextPropertyComponent& operator= (const TextPropertyComponent&);
  17676. };
  17677. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17678. /********* End of inlined file: juce_TextPropertyComponent.h *********/
  17679. #endif
  17680. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17681. /********* Start of inlined file: juce_ActiveXControlComponent.h *********/
  17682. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17683. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17684. #if JUCE_WINDOWS || DOXYGEN
  17685. class JUCE_API ActiveXControlComponent : public Component
  17686. {
  17687. public:
  17688. ActiveXControlComponent();
  17689. ~ActiveXControlComponent();
  17690. bool createControl (const void* controlIID);
  17691. void deleteControl();
  17692. bool isControlOpen() const throw() { return control != 0; }
  17693. void* queryInterface (const void* iid) const;
  17694. void setMouseEventsAllowed (const bool eventsCanReachControl);
  17695. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  17696. void paint (Graphics& g);
  17697. void* originalWndProc;
  17698. juce_UseDebuggingNewOperator
  17699. private:
  17700. friend class ActiveXControlData;
  17701. void* control;
  17702. bool mouseEventsAllowed;
  17703. ActiveXControlComponent (const ActiveXControlComponent&);
  17704. const ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  17705. void setControlBounds (const Rectangle& bounds) const;
  17706. void setControlVisible (const bool b) const;
  17707. };
  17708. #endif
  17709. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17710. /********* End of inlined file: juce_ActiveXControlComponent.h *********/
  17711. #endif
  17712. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17713. /********* Start of inlined file: juce_AudioDeviceSelectorComponent.h *********/
  17714. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17715. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17716. class MidiInputSelectorComponentListBox;
  17717. class JUCE_API AudioDeviceSelectorComponent : public Component,
  17718. public ComboBoxListener,
  17719. public ButtonListener,
  17720. public ChangeListener
  17721. {
  17722. public:
  17723. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  17724. const int minAudioInputChannels,
  17725. const int maxAudioInputChannels,
  17726. const int minAudioOutputChannels,
  17727. const int maxAudioOutputChannels,
  17728. const bool showMidiInputOptions,
  17729. const bool showMidiOutputSelector,
  17730. const bool showChannelsAsStereoPairs,
  17731. const bool hideAdvancedOptionsWithButton);
  17732. ~AudioDeviceSelectorComponent();
  17733. void resized();
  17734. void comboBoxChanged (ComboBox*);
  17735. void buttonClicked (Button*);
  17736. void changeListenerCallback (void*);
  17737. void childBoundsChanged (Component*);
  17738. juce_UseDebuggingNewOperator
  17739. private:
  17740. AudioDeviceManager& deviceManager;
  17741. ComboBox* deviceTypeDropDown;
  17742. Label* deviceTypeDropDownLabel;
  17743. Component* audioDeviceSettingsComp;
  17744. String audioDeviceSettingsCompType;
  17745. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  17746. const bool showChannelsAsStereoPairs;
  17747. const bool hideAdvancedOptionsWithButton;
  17748. MidiInputSelectorComponentListBox* midiInputsList;
  17749. Label* midiInputsLabel;
  17750. ComboBox* midiOutputSelector;
  17751. Label* midiOutputLabel;
  17752. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  17753. const AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  17754. };
  17755. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17756. /********* End of inlined file: juce_AudioDeviceSelectorComponent.h *********/
  17757. #endif
  17758. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17759. /********* Start of inlined file: juce_BubbleComponent.h *********/
  17760. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17761. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17762. class JUCE_API BubbleComponent : public Component
  17763. {
  17764. protected:
  17765. BubbleComponent();
  17766. public:
  17767. ~BubbleComponent();
  17768. enum BubblePlacement
  17769. {
  17770. above = 1,
  17771. below = 2,
  17772. left = 4,
  17773. right = 8
  17774. };
  17775. void setAllowedPlacement (const int newPlacement);
  17776. void setPosition (Component* componentToPointTo);
  17777. void setPosition (const int arrowTipX,
  17778. const int arrowTipY);
  17779. void setPosition (const Rectangle& rectangleToPointTo);
  17780. protected:
  17781. virtual void getContentSize (int& width, int& height) = 0;
  17782. virtual void paintContent (Graphics& g, int width, int height) = 0;
  17783. public:
  17784. void paint (Graphics& g);
  17785. juce_UseDebuggingNewOperator
  17786. private:
  17787. Rectangle content;
  17788. int side, allowablePlacements;
  17789. float arrowTipX, arrowTipY;
  17790. DropShadowEffect shadow;
  17791. BubbleComponent (const BubbleComponent&);
  17792. const BubbleComponent& operator= (const BubbleComponent&);
  17793. };
  17794. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17795. /********* End of inlined file: juce_BubbleComponent.h *********/
  17796. #endif
  17797. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17798. /********* Start of inlined file: juce_BubbleMessageComponent.h *********/
  17799. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17800. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17801. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  17802. private Timer
  17803. {
  17804. public:
  17805. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  17806. ~BubbleMessageComponent();
  17807. void showAt (int x, int y,
  17808. const String& message,
  17809. const int numMillisecondsBeforeRemoving,
  17810. const bool removeWhenMouseClicked = true,
  17811. const bool deleteSelfAfterUse = false);
  17812. void showAt (Component* const component,
  17813. const String& message,
  17814. const int numMillisecondsBeforeRemoving,
  17815. const bool removeWhenMouseClicked = true,
  17816. const bool deleteSelfAfterUse = false);
  17817. void getContentSize (int& w, int& h);
  17818. void paintContent (Graphics& g, int w, int h);
  17819. void timerCallback();
  17820. juce_UseDebuggingNewOperator
  17821. private:
  17822. int fadeOutLength, mouseClickCounter;
  17823. TextLayout textLayout;
  17824. int64 expiryTime;
  17825. bool deleteAfterUse;
  17826. void init (const int numMillisecondsBeforeRemoving,
  17827. const bool removeWhenMouseClicked,
  17828. const bool deleteSelfAfterUse);
  17829. BubbleMessageComponent (const BubbleMessageComponent&);
  17830. const BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  17831. };
  17832. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  17833. /********* End of inlined file: juce_BubbleMessageComponent.h *********/
  17834. #endif
  17835. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17836. /********* Start of inlined file: juce_ColourSelector.h *********/
  17837. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  17838. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  17839. class JUCE_API ColourSelector : public Component,
  17840. public ChangeBroadcaster,
  17841. protected SliderListener
  17842. {
  17843. public:
  17844. enum ColourSelectorOptions
  17845. {
  17846. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  17847. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  17848. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  17849. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  17850. };
  17851. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  17852. const int edgeGap = 4,
  17853. const int gapAroundColourSpaceComponent = 7);
  17854. ~ColourSelector();
  17855. const Colour getCurrentColour() const;
  17856. void setCurrentColour (const Colour& newColour);
  17857. virtual int getNumSwatches() const;
  17858. virtual const Colour getSwatchColour (const int index) const;
  17859. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  17860. enum ColourIds
  17861. {
  17862. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  17863. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  17864. };
  17865. juce_UseDebuggingNewOperator
  17866. private:
  17867. friend class ColourSpaceView;
  17868. friend class HueSelectorComp;
  17869. Colour colour;
  17870. float h, s, v;
  17871. Slider* sliders[4];
  17872. Component* colourSpace;
  17873. Component* hueSelector;
  17874. class SwatchComponent;
  17875. OwnedArray <SwatchComponent> swatchComponents;
  17876. const int flags;
  17877. int topSpace, edgeGap;
  17878. void setHue (float newH);
  17879. void setSV (float newS, float newV);
  17880. void updateHSV();
  17881. void update();
  17882. void sliderValueChanged (Slider*);
  17883. void paint (Graphics& g);
  17884. void resized();
  17885. ColourSelector (const ColourSelector&);
  17886. const ColourSelector& operator= (const ColourSelector&);
  17887. // this constructor is here temporarily to prevent old code compiling, because the parameters
  17888. // have changed - if you get an error here, update your code to use the new constructor instead..
  17889. // (xxx - note to self: remember to remove this at some point in the future)
  17890. ColourSelector (const bool);
  17891. };
  17892. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  17893. /********* End of inlined file: juce_ColourSelector.h *********/
  17894. #endif
  17895. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  17896. #endif
  17897. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17898. /********* Start of inlined file: juce_MagnifierComponent.h *********/
  17899. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17900. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17901. class JUCE_API MagnifierComponent : public Component
  17902. {
  17903. public:
  17904. MagnifierComponent (Component* const contentComponent,
  17905. const bool deleteContentCompWhenNoLongerNeeded);
  17906. ~MagnifierComponent();
  17907. Component* getContentComponent() const { return content; }
  17908. void setScaleFactor (double newScaleFactor);
  17909. double getScaleFactor() const { return scaleFactor; }
  17910. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  17911. juce_UseDebuggingNewOperator
  17912. void childBoundsChanged (Component*);
  17913. private:
  17914. Component* content;
  17915. Component* holderComp;
  17916. double scaleFactor;
  17917. ComponentPeer* peer;
  17918. bool deleteContent;
  17919. Graphics::ResamplingQuality quality;
  17920. void paint (Graphics& g);
  17921. void mouseDown (const MouseEvent& e);
  17922. void mouseUp (const MouseEvent& e);
  17923. void mouseDrag (const MouseEvent& e);
  17924. void mouseMove (const MouseEvent& e);
  17925. void mouseEnter (const MouseEvent& e);
  17926. void mouseExit (const MouseEvent& e);
  17927. void mouseWheelMove (const MouseEvent& e, float, float);
  17928. int scaleInt (const int n) const;
  17929. MagnifierComponent (const MagnifierComponent&);
  17930. const MagnifierComponent& operator= (const MagnifierComponent&);
  17931. };
  17932. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  17933. /********* End of inlined file: juce_MagnifierComponent.h *********/
  17934. #endif
  17935. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17936. /********* Start of inlined file: juce_MidiKeyboardComponent.h *********/
  17937. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17938. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  17939. class JUCE_API MidiKeyboardComponent : public Component,
  17940. public MidiKeyboardStateListener,
  17941. public ChangeBroadcaster,
  17942. private Timer,
  17943. private AsyncUpdater
  17944. {
  17945. public:
  17946. enum Orientation
  17947. {
  17948. horizontalKeyboard,
  17949. verticalKeyboardFacingLeft,
  17950. verticalKeyboardFacingRight,
  17951. };
  17952. MidiKeyboardComponent (MidiKeyboardState& state,
  17953. const Orientation orientation);
  17954. ~MidiKeyboardComponent();
  17955. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  17956. void setMidiChannel (const int midiChannelNumber);
  17957. int getMidiChannel() const throw() { return midiChannel; }
  17958. void setMidiChannelsToDisplay (const int midiChannelMask);
  17959. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  17960. void setKeyWidth (const float widthInPixels);
  17961. float getKeyWidth() const throw() { return keyWidth; }
  17962. void setOrientation (const Orientation newOrientation);
  17963. const Orientation getOrientation() const throw() { return orientation; }
  17964. void setAvailableRange (const int lowestNote,
  17965. const int highestNote);
  17966. int getRangeStart() const throw() { return rangeStart; }
  17967. int getRangeEnd() const throw() { return rangeEnd; }
  17968. void setLowestVisibleKey (int noteNumber);
  17969. int getLowestVisibleKey() const throw() { return firstKey; }
  17970. int getBlackNoteLength() const throw() { return blackNoteLength; }
  17971. void setScrollButtonsVisible (const bool canScroll);
  17972. enum ColourIds
  17973. {
  17974. whiteNoteColourId = 0x1005000,
  17975. blackNoteColourId = 0x1005001,
  17976. keySeparatorLineColourId = 0x1005002,
  17977. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  17978. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  17979. textLabelColourId = 0x1005005,
  17980. upDownButtonBackgroundColourId = 0x1005006,
  17981. upDownButtonArrowColourId = 0x1005007
  17982. };
  17983. int getKeyStartPosition (const int midiNoteNumber) const;
  17984. void clearKeyMappings();
  17985. void setKeyPressForNote (const KeyPress& key,
  17986. const int midiNoteOffsetFromC);
  17987. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  17988. void setKeyPressBaseOctave (const int newOctaveNumber);
  17989. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  17990. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  17991. void paint (Graphics& g);
  17992. void resized();
  17993. void mouseMove (const MouseEvent& e);
  17994. void mouseDrag (const MouseEvent& e);
  17995. void mouseDown (const MouseEvent& e);
  17996. void mouseUp (const MouseEvent& e);
  17997. void mouseEnter (const MouseEvent& e);
  17998. void mouseExit (const MouseEvent& e);
  17999. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18000. void timerCallback();
  18001. bool keyStateChanged (const bool isKeyDown);
  18002. void focusLost (FocusChangeType cause);
  18003. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18004. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18005. void handleAsyncUpdate();
  18006. void colourChanged();
  18007. juce_UseDebuggingNewOperator
  18008. protected:
  18009. friend class MidiKeyboardUpDownButton;
  18010. virtual void drawWhiteNote (int midiNoteNumber,
  18011. Graphics& g,
  18012. int x, int y, int w, int h,
  18013. bool isDown, bool isOver,
  18014. const Colour& lineColour,
  18015. const Colour& textColour);
  18016. virtual void drawBlackNote (int midiNoteNumber,
  18017. Graphics& g,
  18018. int x, int y, int w, int h,
  18019. bool isDown, bool isOver,
  18020. const Colour& noteFillColour);
  18021. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18022. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18023. const bool isMouseOver,
  18024. const bool isButtonPressed,
  18025. const bool movesOctavesUp);
  18026. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18027. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18028. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18029. int& x, int& w) const;
  18030. private:
  18031. MidiKeyboardState& state;
  18032. int xOffset, blackNoteLength;
  18033. float keyWidth;
  18034. Orientation orientation;
  18035. int midiChannel, midiInChannelMask;
  18036. float velocity;
  18037. int noteUnderMouse, mouseDownNote;
  18038. BitArray keysPressed, keysCurrentlyDrawnDown;
  18039. int rangeStart, rangeEnd, firstKey;
  18040. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18041. Button* scrollDown;
  18042. Button* scrollUp;
  18043. Array <KeyPress> keyPresses;
  18044. Array <int> keyPressNotes;
  18045. int keyMappingOctave;
  18046. int octaveNumForMiddleC;
  18047. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18048. int xyToNote (int x, int y, float& mousePositionVelocity);
  18049. int remappedXYToNote (int x, int y, float& mousePositionVelocity) const;
  18050. void resetAnyKeysInUse();
  18051. void updateNoteUnderMouse (int x, int y);
  18052. void repaintNote (const int midiNoteNumber);
  18053. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18054. const MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18055. };
  18056. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18057. /********* End of inlined file: juce_MidiKeyboardComponent.h *********/
  18058. #endif
  18059. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18060. /********* Start of inlined file: juce_NSViewComponent.h *********/
  18061. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18062. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18063. #if ! DOXYGEN
  18064. class NSViewComponentInternal;
  18065. #endif
  18066. #if JUCE_MAC || DOXYGEN
  18067. class JUCE_API NSViewComponent : public Component
  18068. {
  18069. public:
  18070. NSViewComponent();
  18071. ~NSViewComponent();
  18072. void setView (void* nsView);
  18073. void* getView() const;
  18074. void paint (Graphics& g);
  18075. juce_UseDebuggingNewOperator
  18076. private:
  18077. friend class NSViewComponentInternal;
  18078. ScopedPointer <NSViewComponentInternal> info;
  18079. NSViewComponent (const NSViewComponent&);
  18080. const NSViewComponent& operator= (const NSViewComponent&);
  18081. };
  18082. #endif
  18083. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18084. /********* End of inlined file: juce_NSViewComponent.h *********/
  18085. #endif
  18086. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18087. /********* Start of inlined file: juce_OpenGLComponent.h *********/
  18088. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18089. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18090. // this is used to disable OpenGL, and is defined in juce_Config.h
  18091. #if JUCE_OPENGL || DOXYGEN
  18092. class OpenGLComponentWatcher;
  18093. class JUCE_API OpenGLPixelFormat
  18094. {
  18095. public:
  18096. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18097. const int alphaBits = 8,
  18098. const int depthBufferBits = 16,
  18099. const int stencilBufferBits = 0) throw();
  18100. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18101. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18102. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18103. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18104. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18105. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18106. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18107. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18108. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18109. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18110. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18111. static void getAvailablePixelFormats (Component* component,
  18112. OwnedArray <OpenGLPixelFormat>& results);
  18113. bool operator== (const OpenGLPixelFormat&) const throw();
  18114. juce_UseDebuggingNewOperator
  18115. };
  18116. class JUCE_API OpenGLContext
  18117. {
  18118. public:
  18119. virtual ~OpenGLContext();
  18120. virtual bool makeActive() const throw() = 0;
  18121. virtual bool makeInactive() const throw() = 0;
  18122. virtual bool isActive() const throw() = 0;
  18123. virtual void swapBuffers() = 0;
  18124. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18125. virtual int getSwapInterval() const = 0;
  18126. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18127. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18128. virtual void repaint() = 0;
  18129. virtual void* getRawContext() const throw() = 0;
  18130. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18131. const OpenGLPixelFormat& pixelFormat,
  18132. const OpenGLContext* const contextToShareWith);
  18133. static OpenGLContext* getCurrentContext();
  18134. juce_UseDebuggingNewOperator
  18135. protected:
  18136. OpenGLContext() throw();
  18137. };
  18138. class JUCE_API OpenGLComponent : public Component
  18139. {
  18140. public:
  18141. OpenGLComponent();
  18142. ~OpenGLComponent();
  18143. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18144. const OpenGLPixelFormat getPixelFormat() const;
  18145. void shareWith (OpenGLContext* contextToShareListsWith);
  18146. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18147. void swapBuffers();
  18148. virtual void renderOpenGL() = 0;
  18149. virtual void newOpenGLContextCreated() = 0;
  18150. OpenGLContext* getCurrentContext() const throw() { return context; }
  18151. bool makeCurrentContextActive();
  18152. void makeCurrentContextInactive();
  18153. bool isActiveContext() const throw();
  18154. virtual bool renderAndSwapBuffers();
  18155. CriticalSection& getContextLock() throw() { return contextLock; }
  18156. void paint (Graphics& g);
  18157. void* getNativeWindowHandle() const;
  18158. juce_UseDebuggingNewOperator
  18159. private:
  18160. friend class OpenGLComponentWatcher;
  18161. OpenGLComponentWatcher* componentWatcher;
  18162. OpenGLContext* context;
  18163. OpenGLContext* contextToShareListsWith;
  18164. CriticalSection contextLock;
  18165. OpenGLPixelFormat preferredPixelFormat;
  18166. bool needToUpdateViewport;
  18167. void deleteContext();
  18168. void updateContextPosition();
  18169. void internalRepaint (int x, int y, int w, int h);
  18170. OpenGLComponent (const OpenGLComponent&);
  18171. const OpenGLComponent& operator= (const OpenGLComponent&);
  18172. };
  18173. #endif
  18174. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18175. /********* End of inlined file: juce_OpenGLComponent.h *********/
  18176. #endif
  18177. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18178. /********* Start of inlined file: juce_PreferencesPanel.h *********/
  18179. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18180. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18181. class JUCE_API PreferencesPanel : public Component,
  18182. private ButtonListener
  18183. {
  18184. public:
  18185. PreferencesPanel();
  18186. ~PreferencesPanel();
  18187. void addSettingsPage (const String& pageTitle,
  18188. const Drawable* normalIcon,
  18189. const Drawable* overIcon,
  18190. const Drawable* downIcon);
  18191. void addSettingsPage (const String& pageTitle,
  18192. const char* imageData,
  18193. const int imageDataSize);
  18194. void showInDialogBox (const String& dialogtitle,
  18195. int dialogWidth,
  18196. int dialogHeight,
  18197. const Colour& backgroundColour = Colours::white);
  18198. virtual Component* createComponentForPage (const String& pageName) = 0;
  18199. void setCurrentPage (const String& pageName);
  18200. void resized();
  18201. void paint (Graphics& g);
  18202. void buttonClicked (Button* button);
  18203. juce_UseDebuggingNewOperator
  18204. private:
  18205. String currentPageName;
  18206. ScopedPointer <Component> currentPage;
  18207. int buttonSize;
  18208. PreferencesPanel (const PreferencesPanel&);
  18209. const PreferencesPanel& operator= (const PreferencesPanel&);
  18210. };
  18211. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18212. /********* End of inlined file: juce_PreferencesPanel.h *********/
  18213. #endif
  18214. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18215. /********* Start of inlined file: juce_QuickTimeMovieComponent.h *********/
  18216. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18217. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18218. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18219. // amalgamated build)
  18220. #if JUCE_WINDOWS
  18221. typedef ActiveXControlComponent QTCompBaseClass;
  18222. #elif JUCE_MAC
  18223. typedef NSViewComponent QTCompBaseClass;
  18224. #endif
  18225. // this is used to disable QuickTime, and is defined in juce_Config.h
  18226. #if JUCE_QUICKTIME || DOXYGEN
  18227. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18228. {
  18229. public:
  18230. QuickTimeMovieComponent();
  18231. ~QuickTimeMovieComponent();
  18232. static bool isQuickTimeAvailable() throw();
  18233. bool loadMovie (const File& movieFile,
  18234. const bool isControllerVisible);
  18235. bool loadMovie (const URL& movieURL,
  18236. const bool isControllerVisible);
  18237. bool loadMovie (InputStream* movieStream,
  18238. const bool isControllerVisible);
  18239. void closeMovie();
  18240. const File getCurrentMovieFile() const;
  18241. bool isMovieOpen() const;
  18242. double getMovieDuration() const;
  18243. void getMovieNormalSize (int& width, int& height) const;
  18244. void setBoundsWithCorrectAspectRatio (const Rectangle& spaceToFitWithin,
  18245. const RectanglePlacement& placement);
  18246. void play();
  18247. void stop();
  18248. bool isPlaying() const;
  18249. void goToStart();
  18250. void setPosition (const double seconds);
  18251. double getPosition() const;
  18252. void setSpeed (const float newSpeed);
  18253. void setMovieVolume (const float newVolume);
  18254. float getMovieVolume() const;
  18255. void setLooping (const bool shouldLoop);
  18256. bool isLooping() const;
  18257. bool isControllerVisible() const;
  18258. void paint (Graphics& g);
  18259. juce_UseDebuggingNewOperator
  18260. private:
  18261. File movieFile;
  18262. bool movieLoaded, controllerVisible, looping;
  18263. #if JUCE_WINDOWS
  18264. void parentHierarchyChanged();
  18265. void visibilityChanged();
  18266. void createControlIfNeeded();
  18267. bool isControlCreated() const;
  18268. void* internal;
  18269. #else
  18270. void* movie;
  18271. #endif
  18272. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18273. const QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18274. };
  18275. #endif
  18276. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18277. /********* End of inlined file: juce_QuickTimeMovieComponent.h *********/
  18278. #endif
  18279. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18280. /********* Start of inlined file: juce_SystemTrayIconComponent.h *********/
  18281. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18282. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18283. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18284. class JUCE_API SystemTrayIconComponent : public Component
  18285. {
  18286. public:
  18287. SystemTrayIconComponent();
  18288. ~SystemTrayIconComponent();
  18289. void setIconImage (const Image& newImage);
  18290. void setIconTooltip (const String& tooltip);
  18291. #if JUCE_LINUX
  18292. void paint (Graphics& g);
  18293. #endif
  18294. juce_UseDebuggingNewOperator
  18295. private:
  18296. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18297. const SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18298. };
  18299. #endif
  18300. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18301. /********* End of inlined file: juce_SystemTrayIconComponent.h *********/
  18302. #endif
  18303. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18304. /********* Start of inlined file: juce_WebBrowserComponent.h *********/
  18305. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18306. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18307. #if JUCE_WEB_BROWSER || DOXYGEN
  18308. #if ! DOXYGEN
  18309. class WebBrowserComponentInternal;
  18310. #endif
  18311. class JUCE_API WebBrowserComponent : public Component
  18312. {
  18313. public:
  18314. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18315. ~WebBrowserComponent();
  18316. void goToURL (const String& url,
  18317. const StringArray* headers = 0,
  18318. const MemoryBlock* postData = 0);
  18319. void stop();
  18320. void goBack();
  18321. void goForward();
  18322. void refresh();
  18323. virtual bool pageAboutToLoad (const String& newURL);
  18324. void paint (Graphics& g);
  18325. void resized();
  18326. void parentHierarchyChanged();
  18327. void visibilityChanged();
  18328. juce_UseDebuggingNewOperator
  18329. private:
  18330. WebBrowserComponentInternal* browser;
  18331. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18332. String lastURL;
  18333. StringArray lastHeaders;
  18334. MemoryBlock lastPostData;
  18335. void reloadLastURL();
  18336. void checkWindowAssociation();
  18337. WebBrowserComponent (const WebBrowserComponent&);
  18338. const WebBrowserComponent& operator= (const WebBrowserComponent&);
  18339. };
  18340. #endif
  18341. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18342. /********* End of inlined file: juce_WebBrowserComponent.h *********/
  18343. #endif
  18344. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18345. #endif
  18346. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18347. #endif
  18348. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18349. /********* Start of inlined file: juce_DialogWindow.h *********/
  18350. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18351. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18352. class JUCE_API DialogWindow : public DocumentWindow
  18353. {
  18354. public:
  18355. DialogWindow (const String& name,
  18356. const Colour& backgroundColour,
  18357. const bool escapeKeyTriggersCloseButton,
  18358. const bool addToDesktop = true);
  18359. ~DialogWindow();
  18360. static int showModalDialog (const String& dialogTitle,
  18361. Component* contentComponent,
  18362. Component* componentToCentreAround,
  18363. const Colour& backgroundColour,
  18364. const bool escapeKeyTriggersCloseButton,
  18365. const bool shouldBeResizable = false,
  18366. const bool useBottomRightCornerResizer = false);
  18367. juce_UseDebuggingNewOperator
  18368. protected:
  18369. void resized();
  18370. private:
  18371. bool escapeKeyTriggersCloseButton;
  18372. DialogWindow (const DialogWindow&);
  18373. const DialogWindow& operator= (const DialogWindow&);
  18374. };
  18375. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18376. /********* End of inlined file: juce_DialogWindow.h *********/
  18377. #endif
  18378. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18379. #endif
  18380. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18381. #endif
  18382. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18383. /********* Start of inlined file: juce_SplashScreen.h *********/
  18384. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18385. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18386. class JUCE_API SplashScreen : public Component,
  18387. public Timer,
  18388. private DeletedAtShutdown
  18389. {
  18390. public:
  18391. SplashScreen();
  18392. ~SplashScreen();
  18393. void show (const String& title,
  18394. Image* const backgroundImage,
  18395. const int minimumTimeToDisplayFor,
  18396. const bool useDropShadow,
  18397. const bool removeOnMouseClick = true);
  18398. void show (const String& title,
  18399. const int width,
  18400. const int height,
  18401. const int minimumTimeToDisplayFor,
  18402. const bool useDropShadow,
  18403. const bool removeOnMouseClick = true);
  18404. void paint (Graphics& g);
  18405. void timerCallback();
  18406. juce_UseDebuggingNewOperator
  18407. private:
  18408. Image* backgroundImage;
  18409. Time earliestTimeToDelete;
  18410. int originalClickCounter;
  18411. SplashScreen (const SplashScreen&);
  18412. const SplashScreen& operator= (const SplashScreen&);
  18413. };
  18414. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18415. /********* End of inlined file: juce_SplashScreen.h *********/
  18416. #endif
  18417. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18418. /********* Start of inlined file: juce_ThreadWithProgressWindow.h *********/
  18419. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18420. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18421. class JUCE_API ThreadWithProgressWindow : public Thread,
  18422. private Timer
  18423. {
  18424. public:
  18425. ThreadWithProgressWindow (const String& windowTitle,
  18426. const bool hasProgressBar,
  18427. const bool hasCancelButton,
  18428. const int timeOutMsWhenCancelling = 10000,
  18429. const String& cancelButtonText = JUCE_T("Cancel"));
  18430. ~ThreadWithProgressWindow();
  18431. bool runThread (const int threadPriority = 5);
  18432. void setProgress (const double newProgress);
  18433. void setStatusMessage (const String& newStatusMessage);
  18434. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18435. juce_UseDebuggingNewOperator
  18436. private:
  18437. void timerCallback();
  18438. double progress;
  18439. ScopedPointer <AlertWindow> alertWindow;
  18440. String message;
  18441. CriticalSection messageLock;
  18442. const int timeOutMsWhenCancelling;
  18443. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18444. const ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18445. };
  18446. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18447. /********* End of inlined file: juce_ThreadWithProgressWindow.h *********/
  18448. #endif
  18449. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18450. #endif
  18451. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18452. #endif
  18453. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18454. #endif
  18455. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18456. #endif
  18457. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18458. #endif
  18459. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18460. #endif
  18461. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18462. #endif
  18463. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18464. #endif
  18465. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18466. #endif
  18467. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18468. #endif
  18469. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18470. /********* Start of inlined file: juce_LowLevelGraphicsContext.h *********/
  18471. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18472. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18473. class JUCE_API LowLevelGraphicsContext
  18474. {
  18475. protected:
  18476. LowLevelGraphicsContext();
  18477. public:
  18478. virtual ~LowLevelGraphicsContext();
  18479. virtual bool isVectorDevice() const = 0;
  18480. virtual void setOrigin (int x, int y) = 0;
  18481. virtual bool clipToRectangle (const Rectangle& r) = 0;
  18482. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18483. virtual void excludeClipRectangle (const Rectangle& r) = 0;
  18484. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18485. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform) = 0;
  18486. virtual bool clipRegionIntersects (const Rectangle& r) = 0;
  18487. virtual const Rectangle getClipBounds() const = 0;
  18488. virtual bool isClipEmpty() const = 0;
  18489. virtual void saveState() = 0;
  18490. virtual void restoreState() = 0;
  18491. virtual void setFill (const FillType& fillType) = 0;
  18492. virtual void setOpacity (float newOpacity) = 0;
  18493. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18494. virtual void fillRect (const Rectangle& r, const bool replaceExistingContents) = 0;
  18495. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18496. virtual void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18497. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18498. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18499. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18500. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18501. virtual void setFont (const Font& newFont) = 0;
  18502. virtual const Font getFont() = 0;
  18503. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18504. };
  18505. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18506. /********* End of inlined file: juce_LowLevelGraphicsContext.h *********/
  18507. #endif
  18508. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18509. /********* Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h *********/
  18510. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18511. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18512. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18513. {
  18514. public:
  18515. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18516. const String& documentTitle,
  18517. const int totalWidth,
  18518. const int totalHeight);
  18519. ~LowLevelGraphicsPostScriptRenderer();
  18520. bool isVectorDevice() const;
  18521. void setOrigin (int x, int y);
  18522. bool clipToRectangle (const Rectangle& r);
  18523. bool clipToRectangleList (const RectangleList& clipRegion);
  18524. void excludeClipRectangle (const Rectangle& r);
  18525. void clipToPath (const Path& path, const AffineTransform& transform);
  18526. void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform);
  18527. void saveState();
  18528. void restoreState();
  18529. bool clipRegionIntersects (const Rectangle& r);
  18530. const Rectangle getClipBounds() const;
  18531. bool isClipEmpty() const;
  18532. void setFill (const FillType& fillType);
  18533. void setOpacity (float opacity);
  18534. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18535. void fillRect (const Rectangle& r, const bool replaceExistingContents);
  18536. void fillPath (const Path& path, const AffineTransform& transform);
  18537. void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18538. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18539. void drawLine (double x1, double y1, double x2, double y2);
  18540. void drawVerticalLine (const int x, double top, double bottom);
  18541. void drawHorizontalLine (const int x, double top, double bottom);
  18542. const Font getFont();
  18543. void setFont (const Font& newFont);
  18544. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18545. juce_UseDebuggingNewOperator
  18546. protected:
  18547. OutputStream& out;
  18548. int totalWidth, totalHeight;
  18549. bool needToClip;
  18550. Colour lastColour;
  18551. struct SavedState
  18552. {
  18553. SavedState();
  18554. ~SavedState();
  18555. RectangleList clip;
  18556. int xOffset, yOffset;
  18557. FillType fillType;
  18558. Font font;
  18559. private:
  18560. const SavedState& operator= (const SavedState&);
  18561. };
  18562. OwnedArray <SavedState> stateStack;
  18563. void writeClip();
  18564. void writeColour (const Colour& colour);
  18565. void writePath (const Path& path) const;
  18566. void writeXY (const float x, const float y) const;
  18567. void writeTransform (const AffineTransform& trans) const;
  18568. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  18569. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18570. const LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18571. };
  18572. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18573. /********* End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h *********/
  18574. #endif
  18575. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18576. /********* Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h *********/
  18577. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18578. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18579. class LLGCSavedState;
  18580. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18581. {
  18582. public:
  18583. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18584. ~LowLevelGraphicsSoftwareRenderer();
  18585. bool isVectorDevice() const;
  18586. void setOrigin (int x, int y);
  18587. bool clipToRectangle (const Rectangle& r);
  18588. bool clipToRectangleList (const RectangleList& clipRegion);
  18589. void excludeClipRectangle (const Rectangle& r);
  18590. void clipToPath (const Path& path, const AffineTransform& transform);
  18591. void clipToImageAlpha (const Image& sourceImage, const Rectangle& srcClip, const AffineTransform& transform);
  18592. bool clipRegionIntersects (const Rectangle& r);
  18593. const Rectangle getClipBounds() const;
  18594. bool isClipEmpty() const;
  18595. void saveState();
  18596. void restoreState();
  18597. void setFill (const FillType& fillType);
  18598. void setOpacity (float opacity);
  18599. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18600. void fillRect (const Rectangle& r, const bool replaceExistingContents);
  18601. void fillPath (const Path& path, const AffineTransform& transform);
  18602. void drawImage (const Image& sourceImage, const Rectangle& srcClip,
  18603. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18604. void drawLine (double x1, double y1, double x2, double y2);
  18605. void drawVerticalLine (const int x, double top, double bottom);
  18606. void drawHorizontalLine (const int x, double top, double bottom);
  18607. void setFont (const Font& newFont);
  18608. const Font getFont();
  18609. void drawGlyph (int glyphNumber, float x, float y);
  18610. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18611. juce_UseDebuggingNewOperator
  18612. protected:
  18613. Image& image;
  18614. ScopedPointer <LLGCSavedState> currentState;
  18615. OwnedArray <LLGCSavedState> stateStack;
  18616. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  18617. const LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  18618. };
  18619. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18620. /********* End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h *********/
  18621. #endif
  18622. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  18623. #endif
  18624. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  18625. #endif
  18626. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18627. /********* Start of inlined file: juce_DrawableComposite.h *********/
  18628. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18629. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18630. class JUCE_API DrawableComposite : public Drawable
  18631. {
  18632. public:
  18633. DrawableComposite();
  18634. virtual ~DrawableComposite();
  18635. void insertDrawable (Drawable* drawable,
  18636. const AffineTransform& transform = AffineTransform::identity,
  18637. const int index = -1);
  18638. void insertDrawable (const Drawable& drawable,
  18639. const AffineTransform& transform = AffineTransform::identity,
  18640. const int index = -1);
  18641. void removeDrawable (const int index, const bool deleteDrawable = true);
  18642. int getNumDrawables() const throw() { return drawables.size(); }
  18643. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  18644. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  18645. void bringToFront (const int index);
  18646. void render (const Drawable::RenderingContext& context) const;
  18647. void getBounds (float& x, float& y, float& width, float& height) const;
  18648. bool hitTest (float x, float y) const;
  18649. Drawable* createCopy() const;
  18650. ValueTree createValueTree() const throw();
  18651. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  18652. juce_UseDebuggingNewOperator
  18653. private:
  18654. OwnedArray <Drawable> drawables;
  18655. OwnedArray <AffineTransform> transforms;
  18656. DrawableComposite (const DrawableComposite&);
  18657. const DrawableComposite& operator= (const DrawableComposite&);
  18658. };
  18659. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18660. /********* End of inlined file: juce_DrawableComposite.h *********/
  18661. #endif
  18662. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18663. /********* Start of inlined file: juce_DrawableImage.h *********/
  18664. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18665. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18666. class JUCE_API DrawableImage : public Drawable
  18667. {
  18668. public:
  18669. DrawableImage();
  18670. virtual ~DrawableImage();
  18671. void setImage (const Image& imageToCopy);
  18672. void setImage (Image* imageToUse,
  18673. const bool releaseWhenNotNeeded);
  18674. Image* getImage() const throw() { return image; }
  18675. void clearImage();
  18676. void setOpacity (const float newOpacity);
  18677. float getOpacity() const throw() { return opacity; }
  18678. void setOverlayColour (const Colour& newOverlayColour);
  18679. const Colour& getOverlayColour() const throw() { return overlayColour; }
  18680. void render (const Drawable::RenderingContext& context) const;
  18681. void getBounds (float& x, float& y, float& width, float& height) const;
  18682. bool hitTest (float x, float y) const;
  18683. Drawable* createCopy() const;
  18684. ValueTree createValueTree() const throw();
  18685. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  18686. juce_UseDebuggingNewOperator
  18687. private:
  18688. Image* image;
  18689. bool canDeleteImage;
  18690. float opacity;
  18691. Colour overlayColour;
  18692. DrawableImage (const DrawableImage&);
  18693. const DrawableImage& operator= (const DrawableImage&);
  18694. };
  18695. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18696. /********* End of inlined file: juce_DrawableImage.h *********/
  18697. #endif
  18698. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18699. /********* Start of inlined file: juce_DrawablePath.h *********/
  18700. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18701. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  18702. class JUCE_API DrawablePath : public Drawable
  18703. {
  18704. public:
  18705. DrawablePath();
  18706. virtual ~DrawablePath();
  18707. void setPath (const Path& newPath) throw();
  18708. const Path& getPath() const throw() { return path; }
  18709. void setFill (const FillType& newFill) throw();
  18710. const FillType& getFill() const throw() { return mainFill; }
  18711. void setStrokeFill (const FillType& newStrokeFill) throw();
  18712. const FillType& getStrokeFill() const throw() { return strokeFill; }
  18713. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  18714. void setStrokeThickness (const float newThickness) throw();
  18715. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  18716. void render (const Drawable::RenderingContext& context) const;
  18717. void getBounds (float& x, float& y, float& width, float& height) const;
  18718. bool hitTest (float x, float y) const;
  18719. Drawable* createCopy() const;
  18720. ValueTree createValueTree() const throw();
  18721. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  18722. juce_UseDebuggingNewOperator
  18723. private:
  18724. Path path, stroke;
  18725. FillType mainFill, strokeFill;
  18726. PathStrokeType strokeType;
  18727. void updateOutline();
  18728. DrawablePath (const DrawablePath&);
  18729. const DrawablePath& operator= (const DrawablePath&);
  18730. };
  18731. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  18732. /********* End of inlined file: juce_DrawablePath.h *********/
  18733. #endif
  18734. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18735. /********* Start of inlined file: juce_DrawableText.h *********/
  18736. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18737. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  18738. class JUCE_API DrawableText : public Drawable
  18739. {
  18740. public:
  18741. DrawableText();
  18742. virtual ~DrawableText();
  18743. void setText (const GlyphArrangement& newText);
  18744. void setText (const String& newText, const Font& fontToUse);
  18745. const GlyphArrangement& getText() const throw() { return text; }
  18746. void setColour (const Colour& newColour);
  18747. const Colour& getColour() const throw() { return colour; }
  18748. void render (const Drawable::RenderingContext& context) const;
  18749. void getBounds (float& x, float& y, float& width, float& height) const;
  18750. bool hitTest (float x, float y) const;
  18751. Drawable* createCopy() const;
  18752. ValueTree createValueTree() const throw();
  18753. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  18754. juce_UseDebuggingNewOperator
  18755. private:
  18756. GlyphArrangement text;
  18757. Colour colour;
  18758. DrawableText (const DrawableText&);
  18759. const DrawableText& operator= (const DrawableText&);
  18760. };
  18761. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  18762. /********* End of inlined file: juce_DrawableText.h *********/
  18763. #endif
  18764. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  18765. #endif
  18766. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18767. /********* Start of inlined file: juce_GlowEffect.h *********/
  18768. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18769. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  18770. class JUCE_API GlowEffect : public ImageEffectFilter
  18771. {
  18772. public:
  18773. GlowEffect();
  18774. ~GlowEffect();
  18775. void setGlowProperties (const float newRadius,
  18776. const Colour& newColour);
  18777. void applyEffect (Image& sourceImage, Graphics& destContext);
  18778. juce_UseDebuggingNewOperator
  18779. private:
  18780. float radius;
  18781. Colour colour;
  18782. };
  18783. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  18784. /********* End of inlined file: juce_GlowEffect.h *********/
  18785. #endif
  18786. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  18787. #endif
  18788. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18789. /********* Start of inlined file: juce_ReduceOpacityEffect.h *********/
  18790. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18791. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18792. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  18793. {
  18794. public:
  18795. ReduceOpacityEffect (const float opacity = 1.0f);
  18796. ~ReduceOpacityEffect();
  18797. void setOpacity (const float newOpacity);
  18798. void applyEffect (Image& sourceImage, Graphics& destContext);
  18799. juce_UseDebuggingNewOperator
  18800. private:
  18801. float opacity;
  18802. };
  18803. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18804. /********* End of inlined file: juce_ReduceOpacityEffect.h *********/
  18805. #endif
  18806. #ifndef __JUCE_FONT_JUCEHEADER__
  18807. #endif
  18808. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  18809. #endif
  18810. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  18811. #endif
  18812. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  18813. #endif
  18814. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  18815. #endif
  18816. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  18817. #endif
  18818. #ifndef __JUCE_LINE_JUCEHEADER__
  18819. #endif
  18820. #ifndef __JUCE_PATH_JUCEHEADER__
  18821. #endif
  18822. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  18823. /********* Start of inlined file: juce_PathIterator.h *********/
  18824. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  18825. #define __JUCE_PATHITERATOR_JUCEHEADER__
  18826. class JUCE_API PathFlatteningIterator
  18827. {
  18828. public:
  18829. PathFlatteningIterator (const Path& path,
  18830. const AffineTransform& transform = AffineTransform::identity,
  18831. float tolerence = 6.0f) throw();
  18832. ~PathFlatteningIterator() throw();
  18833. bool next() throw();
  18834. float x1;
  18835. float y1;
  18836. float x2;
  18837. float y2;
  18838. bool closesSubPath;
  18839. int subPathIndex;
  18840. bool isLastInSubpath() const { return stackPos == stackBase
  18841. && (index >= path.numElements
  18842. || points [index] == Path::moveMarker); }
  18843. juce_UseDebuggingNewOperator
  18844. private:
  18845. const Path& path;
  18846. const AffineTransform transform;
  18847. float* points;
  18848. float tolerence, subPathCloseX, subPathCloseY;
  18849. bool isIdentityTransform;
  18850. HeapBlock <float> stackBase;
  18851. float* stackPos;
  18852. int index, stackSize;
  18853. PathFlatteningIterator (const PathFlatteningIterator&);
  18854. const PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  18855. };
  18856. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  18857. /********* End of inlined file: juce_PathIterator.h *********/
  18858. #endif
  18859. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  18860. #endif
  18861. #ifndef __JUCE_POINT_JUCEHEADER__
  18862. #endif
  18863. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18864. /********* Start of inlined file: juce_PositionedRectangle.h *********/
  18865. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18866. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18867. class JUCE_API PositionedRectangle
  18868. {
  18869. public:
  18870. PositionedRectangle() throw();
  18871. PositionedRectangle (const String& stringVersion) throw();
  18872. PositionedRectangle (const PositionedRectangle& other) throw();
  18873. const PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  18874. ~PositionedRectangle() throw();
  18875. const String toString() const throw();
  18876. const Rectangle getRectangle (const Rectangle& targetSpaceToBeRelativeTo) const throw();
  18877. void getRectangleDouble (const Rectangle& targetSpaceToBeRelativeTo,
  18878. double& x,
  18879. double& y,
  18880. double& width,
  18881. double& height) const throw();
  18882. void applyToComponent (Component& comp) const throw();
  18883. void updateFrom (const Rectangle& newPosition,
  18884. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18885. void updateFromDouble (const double x, const double y,
  18886. const double width, const double height,
  18887. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18888. void updateFromComponent (const Component& comp) throw();
  18889. enum AnchorPoint
  18890. {
  18891. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  18892. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  18893. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  18894. };
  18895. enum PositionMode
  18896. {
  18897. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  18898. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  18899. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  18900. 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. */
  18901. };
  18902. enum SizeMode
  18903. {
  18904. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  18905. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  18906. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  18907. };
  18908. void setModes (const AnchorPoint xAnchorMode,
  18909. const PositionMode xPositionMode,
  18910. const AnchorPoint yAnchorMode,
  18911. const PositionMode yPositionMode,
  18912. const SizeMode widthMode,
  18913. const SizeMode heightMode,
  18914. const Rectangle& targetSpaceToBeRelativeTo) throw();
  18915. AnchorPoint getAnchorPointX() const throw();
  18916. PositionMode getPositionModeX() const throw();
  18917. double getX() const throw() { return x; }
  18918. void setX (const double newX) throw() { x = newX; }
  18919. AnchorPoint getAnchorPointY() const throw();
  18920. PositionMode getPositionModeY() const throw();
  18921. double getY() const throw() { return y; }
  18922. void setY (const double newY) throw() { y = newY; }
  18923. SizeMode getWidthMode() const throw();
  18924. double getWidth() const throw() { return w; }
  18925. void setWidth (const double newWidth) throw() { w = newWidth; }
  18926. SizeMode getHeightMode() const throw();
  18927. double getHeight() const throw() { return h; }
  18928. void setHeight (const double newHeight) throw() { h = newHeight; }
  18929. bool isPositionAbsolute() const throw();
  18930. const bool operator== (const PositionedRectangle& other) const throw();
  18931. const bool operator!= (const PositionedRectangle& other) const throw();
  18932. juce_UseDebuggingNewOperator
  18933. private:
  18934. double x, y, w, h;
  18935. uint8 xMode, yMode, wMode, hMode;
  18936. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  18937. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  18938. void decodePosString (const String& s, uint8& mode, double& value) throw();
  18939. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  18940. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  18941. const uint8 xMode, const uint8 wMode,
  18942. const int parentPos, const int parentSize) const throw();
  18943. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  18944. const uint8 xMode, const uint8 wMode,
  18945. const int parentPos, const int parentSize) const throw();
  18946. };
  18947. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  18948. /********* End of inlined file: juce_PositionedRectangle.h *********/
  18949. #endif
  18950. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  18951. #endif
  18952. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  18953. #endif
  18954. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  18955. /********* Start of inlined file: juce_CameraDevice.h *********/
  18956. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  18957. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  18958. #if JUCE_USE_CAMERA
  18959. class CameraImageListener
  18960. {
  18961. public:
  18962. CameraImageListener() {}
  18963. virtual ~CameraImageListener() {}
  18964. virtual void imageReceived (Image& image) = 0;
  18965. };
  18966. class JUCE_API CameraDevice
  18967. {
  18968. public:
  18969. virtual ~CameraDevice();
  18970. static const StringArray getAvailableDevices();
  18971. static CameraDevice* openDevice (int deviceIndex,
  18972. int minWidth = 128, int minHeight = 64,
  18973. int maxWidth = 1024, int maxHeight = 768);
  18974. const String getName() const { return name; }
  18975. Component* createViewerComponent();
  18976. void startRecordingToFile (const File& file);
  18977. void stopRecording();
  18978. static const String getFileExtension();
  18979. const Time getTimeOfFirstRecordedFrame() const;
  18980. void addListener (CameraImageListener* listenerToAdd);
  18981. void removeListener (CameraImageListener* listenerToRemove);
  18982. juce_UseDebuggingNewOperator
  18983. protected:
  18984. CameraDevice (const String& name, int index);
  18985. private:
  18986. void* internal;
  18987. bool isRecording;
  18988. String name;
  18989. CameraDevice (const CameraDevice&);
  18990. const CameraDevice& operator= (const CameraDevice&);
  18991. };
  18992. #endif
  18993. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  18994. /********* End of inlined file: juce_CameraDevice.h *********/
  18995. #endif
  18996. #ifndef __JUCE_IMAGE_JUCEHEADER__
  18997. #endif
  18998. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  18999. /********* Start of inlined file: juce_ImageCache.h *********/
  19000. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19001. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19002. struct ImageCacheItem;
  19003. class JUCE_API ImageCache : private DeletedAtShutdown,
  19004. private Timer
  19005. {
  19006. public:
  19007. static Image* getFromFile (const File& file);
  19008. static Image* getFromMemory (const void* imageData,
  19009. const int dataSize);
  19010. static void release (Image* const imageToRelease);
  19011. static void releaseOrDelete (Image* const imageToRelease);
  19012. static bool isImageInCache (Image* const imageToLookFor);
  19013. static void incReferenceCount (Image* const image);
  19014. static Image* getFromHashCode (const int64 hashCode);
  19015. static void addImageToCache (Image* const image,
  19016. const int64 hashCode);
  19017. static void setCacheTimeout (const int millisecs);
  19018. juce_UseDebuggingNewOperator
  19019. private:
  19020. CriticalSection lock;
  19021. OwnedArray <ImageCacheItem> images;
  19022. ImageCache();
  19023. ImageCache (const ImageCache&);
  19024. const ImageCache& operator= (const ImageCache&);
  19025. ~ImageCache();
  19026. void timerCallback();
  19027. };
  19028. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19029. /********* End of inlined file: juce_ImageCache.h *********/
  19030. #endif
  19031. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19032. /********* Start of inlined file: juce_ImageConvolutionKernel.h *********/
  19033. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19034. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19035. class JUCE_API ImageConvolutionKernel
  19036. {
  19037. public:
  19038. ImageConvolutionKernel (const int size);
  19039. ~ImageConvolutionKernel();
  19040. void clear();
  19041. void setKernelValue (const int x,
  19042. const int y,
  19043. const float value);
  19044. void setOverallSum (const float desiredTotalSum);
  19045. void rescaleAllValues (const float multiplier);
  19046. void createGaussianBlur (const float blurRadius);
  19047. int getKernelSize() const { return size; }
  19048. float** getValues() const { return values; }
  19049. void applyToImage (Image& destImage,
  19050. const Image* sourceImage,
  19051. int x,
  19052. int y,
  19053. int width,
  19054. int height) const;
  19055. juce_UseDebuggingNewOperator
  19056. private:
  19057. HeapBlock <float> values;
  19058. const int size;
  19059. // no reason not to implement these one day..
  19060. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19061. const ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19062. };
  19063. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19064. /********* End of inlined file: juce_ImageConvolutionKernel.h *********/
  19065. #endif
  19066. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19067. /********* Start of inlined file: juce_ImageFileFormat.h *********/
  19068. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19069. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19070. class JUCE_API ImageFileFormat
  19071. {
  19072. protected:
  19073. ImageFileFormat() {}
  19074. public:
  19075. virtual ~ImageFileFormat() {}
  19076. virtual const String getFormatName() = 0;
  19077. virtual bool canUnderstand (InputStream& input) = 0;
  19078. virtual Image* decodeImage (InputStream& input) = 0;
  19079. virtual bool writeImageToStream (const Image& sourceImage,
  19080. OutputStream& destStream) = 0;
  19081. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19082. static Image* loadFrom (InputStream& input);
  19083. static Image* loadFrom (const File& file);
  19084. static Image* loadFrom (const void* rawData,
  19085. const int numBytesOfData);
  19086. };
  19087. class JUCE_API PNGImageFormat : public ImageFileFormat
  19088. {
  19089. public:
  19090. PNGImageFormat();
  19091. ~PNGImageFormat();
  19092. const String getFormatName();
  19093. bool canUnderstand (InputStream& input);
  19094. Image* decodeImage (InputStream& input);
  19095. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19096. };
  19097. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19098. {
  19099. public:
  19100. JPEGImageFormat();
  19101. ~JPEGImageFormat();
  19102. void setQuality (const float newQuality);
  19103. const String getFormatName();
  19104. bool canUnderstand (InputStream& input);
  19105. Image* decodeImage (InputStream& input);
  19106. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19107. private:
  19108. float quality;
  19109. };
  19110. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19111. /********* End of inlined file: juce_ImageFileFormat.h *********/
  19112. #endif
  19113. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19114. #endif
  19115. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19116. /********* Start of inlined file: juce_FileBasedDocument.h *********/
  19117. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19118. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19119. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19120. {
  19121. public:
  19122. FileBasedDocument (const String& fileExtension,
  19123. const String& fileWildCard,
  19124. const String& openFileDialogTitle,
  19125. const String& saveFileDialogTitle);
  19126. virtual ~FileBasedDocument();
  19127. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19128. virtual void changed();
  19129. void setChangedFlag (const bool hasChanged);
  19130. bool loadFrom (const File& fileToLoadFrom,
  19131. const bool showMessageOnFailure);
  19132. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19133. enum SaveResult
  19134. {
  19135. savedOk = 0, /**< indicates that a file was saved successfully. */
  19136. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19137. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19138. };
  19139. SaveResult save (const bool askUserForFileIfNotSpecified,
  19140. const bool showMessageOnFailure);
  19141. SaveResult saveIfNeededAndUserAgrees();
  19142. SaveResult saveAs (const File& newFile,
  19143. const bool warnAboutOverwritingExistingFiles,
  19144. const bool askUserForFileIfNotSpecified,
  19145. const bool showMessageOnFailure);
  19146. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19147. const File getFile() const { return documentFile; }
  19148. void setFile (const File& newFile);
  19149. protected:
  19150. virtual const String getDocumentTitle() = 0;
  19151. virtual const String loadDocument (const File& file) = 0;
  19152. virtual const String saveDocument (const File& file) = 0;
  19153. virtual const File getLastDocumentOpened() = 0;
  19154. virtual void setLastDocumentOpened (const File& file) = 0;
  19155. public:
  19156. juce_UseDebuggingNewOperator
  19157. private:
  19158. File documentFile;
  19159. bool changedSinceSave;
  19160. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19161. FileBasedDocument (const FileBasedDocument&);
  19162. const FileBasedDocument& operator= (const FileBasedDocument&);
  19163. };
  19164. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19165. /********* End of inlined file: juce_FileBasedDocument.h *********/
  19166. #endif
  19167. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19168. #endif
  19169. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19170. /********* Start of inlined file: juce_RecentlyOpenedFilesList.h *********/
  19171. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19172. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19173. class JUCE_API RecentlyOpenedFilesList
  19174. {
  19175. public:
  19176. RecentlyOpenedFilesList();
  19177. ~RecentlyOpenedFilesList();
  19178. void setMaxNumberOfItems (const int newMaxNumber);
  19179. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19180. int getNumFiles() const;
  19181. const File getFile (const int index) const;
  19182. const StringArray& getAllFilenames() const throw() { return files; }
  19183. void clear();
  19184. void addFile (const File& file);
  19185. void removeNonExistentFiles();
  19186. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19187. const int baseItemId,
  19188. const bool showFullPaths,
  19189. const bool dontAddNonExistentFiles,
  19190. const File** filesToAvoid = 0);
  19191. const String toString() const;
  19192. void restoreFromString (const String& stringifiedVersion);
  19193. juce_UseDebuggingNewOperator
  19194. private:
  19195. StringArray files;
  19196. int maxNumberOfItems;
  19197. };
  19198. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19199. /********* End of inlined file: juce_RecentlyOpenedFilesList.h *********/
  19200. #endif
  19201. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19202. #endif
  19203. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19204. /********* Start of inlined file: juce_SystemClipboard.h *********/
  19205. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19206. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19207. class JUCE_API SystemClipboard
  19208. {
  19209. public:
  19210. static void copyTextToClipboard (const String& text) throw();
  19211. static const String getTextFromClipboard() throw();
  19212. };
  19213. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19214. /********* End of inlined file: juce_SystemClipboard.h *********/
  19215. #endif
  19216. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19217. #endif
  19218. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19219. #endif
  19220. #endif
  19221. /********* End of inlined file: juce_app_includes.h *********/
  19222. #endif
  19223. #if JUCE_MSVC
  19224. #pragma warning (pop)
  19225. #pragma pack (pop)
  19226. #endif
  19227. #if JUCE_MAC || JUCE_IPHONE
  19228. #pragma align=reset
  19229. #endif
  19230. END_JUCE_NAMESPACE
  19231. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19232. #ifdef JUCE_NAMESPACE
  19233. // this will obviously save a lot of typing, but can be disabled by
  19234. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19235. using namespace JUCE_NAMESPACE;
  19236. #if JUCE_MAC && ! JUCE_DONT_DEFINE_MACROS
  19237. #define Component JUCE_NAMESPACE::Component
  19238. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19239. #define Point JUCE_NAMESPACE::Point
  19240. #define Button JUCE_NAMESPACE::Button
  19241. #endif
  19242. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19243. #define Rectangle JUCE_NAMESPACE::Rectangle
  19244. #endif
  19245. #endif
  19246. #endif
  19247. #if JUCE_MSVC
  19248. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19249. #ifdef JUCE_DLL
  19250. #ifdef JUCE_DEBUG
  19251. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19252. #else
  19253. #define AUTOLINKEDLIB "JUCE.lib"
  19254. #endif
  19255. #else
  19256. #ifdef JUCE_DEBUG
  19257. #ifdef _WIN64
  19258. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19259. #else
  19260. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19261. #endif
  19262. #else
  19263. #ifdef _WIN64
  19264. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19265. #else
  19266. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19267. #endif
  19268. #endif
  19269. #endif
  19270. #pragma comment(lib, AUTOLINKEDLIB)
  19271. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19272. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19273. #endif
  19274. // Auto-link the other win32 libs that are needed by library calls..
  19275. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19276. /********* Start of inlined file: juce_win32_AutoLinkLibraries.h *********/
  19277. // Auto-links to various win32 libs that are needed by library calls..
  19278. #pragma comment(lib, "kernel32.lib")
  19279. #pragma comment(lib, "user32.lib")
  19280. #pragma comment(lib, "shell32.lib")
  19281. #pragma comment(lib, "gdi32.lib")
  19282. #pragma comment(lib, "vfw32.lib")
  19283. #pragma comment(lib, "comdlg32.lib")
  19284. #pragma comment(lib, "winmm.lib")
  19285. #pragma comment(lib, "wininet.lib")
  19286. #pragma comment(lib, "ole32.lib")
  19287. #pragma comment(lib, "advapi32.lib")
  19288. #pragma comment(lib, "ws2_32.lib")
  19289. #pragma comment(lib, "comsupp.lib")
  19290. #pragma comment(lib, "version.lib")
  19291. #if JUCE_OPENGL
  19292. #pragma comment(lib, "OpenGL32.Lib")
  19293. #pragma comment(lib, "GlU32.Lib")
  19294. #endif
  19295. #if JUCE_QUICKTIME
  19296. #pragma comment (lib, "QTMLClient.lib")
  19297. #endif
  19298. #if JUCE_USE_CAMERA
  19299. #pragma comment (lib, "Strmiids.lib")
  19300. #endif
  19301. /********* End of inlined file: juce_win32_AutoLinkLibraries.h *********/
  19302. #endif
  19303. #endif
  19304. #endif
  19305. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19306. #define START_JUCE_APPLICATION(AppClass) \
  19307. int main (int argc, char* argv[]) \
  19308. { \
  19309. return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
  19310. }
  19311. #elif JUCE_WINDOWS
  19312. #ifdef _CONSOLE
  19313. #define START_JUCE_APPLICATION(AppClass) \
  19314. int main (int, char* argv[]) \
  19315. { \
  19316. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19317. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19318. }
  19319. #elif ! defined (_AFXDLL)
  19320. #ifdef _WINDOWS_
  19321. #define START_JUCE_APPLICATION(AppClass) \
  19322. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19323. { \
  19324. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19325. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19326. }
  19327. #else
  19328. #define START_JUCE_APPLICATION(AppClass) \
  19329. int __stdcall WinMain (int, int, const char*, int) \
  19330. { \
  19331. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19332. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19333. }
  19334. #endif
  19335. #endif
  19336. #endif
  19337. #endif // __JUCE_JUCEHEADER__
  19338. /********* End of inlined file: juce.h *********/
  19339. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__