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.

28340 lines
723KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  19. #define __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__
  20. #define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
  21. /*** Start of inlined file: juce.h ***/
  22. #ifndef __JUCE_JUCEHEADER__
  23. #define __JUCE_JUCEHEADER__
  24. #define JUCE_PUBLIC_INCLUDES 1
  25. // (this includes things that need defining outside of the JUCE namespace)
  26. /*** Start of inlined file: juce_StandardHeader.h ***/
  27. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  28. #define __JUCE_STANDARDHEADER_JUCEHEADER__
  29. #define JUCE_MAJOR_VERSION 1
  30. #define JUCE_MINOR_VERSION 51
  31. #define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8))
  32. /*** Start of inlined file: juce_TargetPlatform.h ***/
  33. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  34. #define __JUCE_TARGETPLATFORM_JUCEHEADER__
  35. #if (defined (_WIN32) || defined (_WIN64))
  36. #define JUCE_WIN32 1
  37. #define JUCE_WINDOWS 1
  38. #elif defined (LINUX) || defined (__linux__)
  39. #define JUCE_LINUX 1
  40. #elif defined(__APPLE_CPP__) || defined(__APPLE_CC__)
  41. #include <CoreFoundation/CoreFoundation.h> // (needed to find out what platform we're using)
  42. #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
  43. #define JUCE_IPHONE 1
  44. #else
  45. #define JUCE_MAC 1
  46. #endif
  47. #else
  48. #error "Unknown platform!"
  49. #endif
  50. #if JUCE_WINDOWS
  51. #ifdef _MSC_VER
  52. #ifdef _WIN64
  53. #define JUCE_64BIT 1
  54. #else
  55. #define JUCE_32BIT 1
  56. #endif
  57. #endif
  58. #ifdef _DEBUG
  59. #define JUCE_DEBUG 1
  60. #endif
  61. #ifdef __MINGW32__
  62. #define JUCE_MINGW 1
  63. #endif
  64. #define JUCE_LITTLE_ENDIAN 1
  65. #define JUCE_INTEL 1
  66. #endif
  67. #if JUCE_MAC
  68. #ifndef NDEBUG
  69. #define JUCE_DEBUG 1
  70. #endif
  71. #ifdef __LITTLE_ENDIAN__
  72. #define JUCE_LITTLE_ENDIAN 1
  73. #else
  74. #define JUCE_BIG_ENDIAN 1
  75. #endif
  76. #if defined (__ppc__) || defined (__ppc64__)
  77. #define JUCE_PPC 1
  78. #else
  79. #define JUCE_INTEL 1
  80. #endif
  81. #ifdef __LP64__
  82. #define JUCE_64BIT 1
  83. #else
  84. #define JUCE_32BIT 1
  85. #endif
  86. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  87. #error "Building for OSX 10.3 is no longer supported!"
  88. #endif
  89. #ifndef MAC_OS_X_VERSION_10_5
  90. #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
  91. #endif
  92. #endif
  93. #if JUCE_IPHONE
  94. #ifndef NDEBUG
  95. #define JUCE_DEBUG 1
  96. #endif
  97. #ifdef __LITTLE_ENDIAN__
  98. #define JUCE_LITTLE_ENDIAN 1
  99. #else
  100. #define JUCE_BIG_ENDIAN 1
  101. #endif
  102. #endif
  103. #if JUCE_LINUX
  104. #ifdef _DEBUG
  105. #define JUCE_DEBUG 1
  106. #endif
  107. // Allow override for big-endian Linux platforms
  108. #ifndef JUCE_BIG_ENDIAN
  109. #define JUCE_LITTLE_ENDIAN 1
  110. #endif
  111. #if defined (__LP64__) || defined (_LP64)
  112. #define JUCE_64BIT 1
  113. #else
  114. #define JUCE_32BIT 1
  115. #endif
  116. #define JUCE_INTEL 1
  117. #endif
  118. // Compiler type macros.
  119. #ifdef __GNUC__
  120. #define JUCE_GCC 1
  121. #elif defined (_MSC_VER)
  122. #define JUCE_MSVC 1
  123. #if _MSC_VER >= 1400
  124. #define JUCE_USE_INTRINSICS 1
  125. #endif
  126. #else
  127. #error unknown compiler
  128. #endif
  129. #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__
  130. /*** End of inlined file: juce_TargetPlatform.h ***/
  131. // (sets up the various JUCE_WINDOWS, JUCE_MAC, etc flags)
  132. /*** Start of inlined file: juce_Config.h ***/
  133. #ifndef __JUCE_CONFIG_JUCEHEADER__
  134. #define __JUCE_CONFIG_JUCEHEADER__
  135. #ifndef JUCE_NAMESPACE
  136. #define JUCE_NAMESPACE juce
  137. #endif
  138. #ifndef JUCE_FORCE_DEBUG
  139. //#define JUCE_FORCE_DEBUG 1
  140. #endif
  141. #ifndef JUCE_LOG_ASSERTIONS
  142. // #define JUCE_LOG_ASSERTIONS 1
  143. #endif
  144. #ifndef JUCE_ASIO
  145. #define JUCE_ASIO 1
  146. #endif
  147. #ifndef JUCE_WASAPI
  148. // #define JUCE_WASAPI 1
  149. #endif
  150. #ifndef JUCE_DIRECTSOUND
  151. #define JUCE_DIRECTSOUND 1
  152. #endif
  153. #ifndef JUCE_ALSA
  154. #define JUCE_ALSA 1
  155. #endif
  156. #ifndef JUCE_JACK
  157. #define JUCE_JACK 1
  158. #endif
  159. #if ! (defined (JUCE_QUICKTIME) || JUCE_LINUX || JUCE_IPHONE || (JUCE_WINDOWS && ! JUCE_MSVC))
  160. #define JUCE_QUICKTIME 1
  161. #endif
  162. #ifndef JUCE_OPENGL
  163. #define JUCE_OPENGL 1
  164. #endif
  165. #ifndef JUCE_USE_FLAC
  166. #define JUCE_USE_FLAC 1
  167. #endif
  168. #ifndef JUCE_USE_OGGVORBIS
  169. #define JUCE_USE_OGGVORBIS 1
  170. #endif
  171. #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
  172. #define JUCE_USE_CDBURNER 1
  173. #endif
  174. #ifndef JUCE_USE_CDREADER
  175. #define JUCE_USE_CDREADER 1
  176. #endif
  177. #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
  178. // #define JUCE_USE_CAMERA 1
  179. #endif
  180. #ifndef JUCE_ENABLE_REPAINT_DEBUGGING
  181. // #define JUCE_ENABLE_REPAINT_DEBUGGING 1
  182. #endif
  183. #ifndef JUCE_USE_XINERAMA
  184. #define JUCE_USE_XINERAMA 1
  185. #endif
  186. #ifndef JUCE_USE_XSHM
  187. #define JUCE_USE_XSHM 1
  188. #endif
  189. #ifndef JUCE_PLUGINHOST_VST
  190. // #define JUCE_PLUGINHOST_VST 1
  191. #endif
  192. #ifndef JUCE_PLUGINHOST_AU
  193. // #define JUCE_PLUGINHOST_AU 1
  194. #endif
  195. #ifndef JUCE_ONLY_BUILD_CORE_LIBRARY
  196. //#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
  197. #endif
  198. #ifndef JUCE_WEB_BROWSER
  199. #define JUCE_WEB_BROWSER 1
  200. #endif
  201. #ifndef JUCE_SUPPORT_CARBON
  202. #define JUCE_SUPPORT_CARBON 1
  203. #endif
  204. #ifndef JUCE_INCLUDE_ZLIB_CODE
  205. #define JUCE_INCLUDE_ZLIB_CODE 1
  206. #endif
  207. #ifndef JUCE_INCLUDE_FLAC_CODE
  208. #define JUCE_INCLUDE_FLAC_CODE 1
  209. #endif
  210. #ifndef JUCE_INCLUDE_OGGVORBIS_CODE
  211. #define JUCE_INCLUDE_OGGVORBIS_CODE 1
  212. #endif
  213. #ifndef JUCE_INCLUDE_PNGLIB_CODE
  214. #define JUCE_INCLUDE_PNGLIB_CODE 1
  215. #endif
  216. #ifndef JUCE_INCLUDE_JPEGLIB_CODE
  217. #define JUCE_INCLUDE_JPEGLIB_CODE 1
  218. #endif
  219. #ifndef JUCE_CHECK_MEMORY_LEAKS
  220. #define JUCE_CHECK_MEMORY_LEAKS 1
  221. #endif
  222. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  223. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  224. #endif
  225. #ifndef JUCE_STRINGS_ARE_UNICODE
  226. #define JUCE_STRINGS_ARE_UNICODE 1
  227. #endif
  228. // If only building the core classes, we can explicitly turn off some features to avoid including them:
  229. #if JUCE_ONLY_BUILD_CORE_LIBRARY
  230. #undef JUCE_QUICKTIME
  231. #define JUCE_QUICKTIME 0
  232. #undef JUCE_OPENGL
  233. #define JUCE_OPENGL 0
  234. #undef JUCE_USE_CDBURNER
  235. #define JUCE_USE_CDBURNER 0
  236. #undef JUCE_USE_CDREADER
  237. #define JUCE_USE_CDREADER 0
  238. #undef JUCE_WEB_BROWSER
  239. #define JUCE_WEB_BROWSER 0
  240. #undef JUCE_PLUGINHOST_AU
  241. #define JUCE_PLUGINHOST_AU 0
  242. #undef JUCE_PLUGINHOST_VST
  243. #define JUCE_PLUGINHOST_VST 0
  244. #endif
  245. #endif
  246. /*** End of inlined file: juce_Config.h ***/
  247. #ifdef JUCE_NAMESPACE
  248. #define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
  249. #define END_JUCE_NAMESPACE }
  250. #else
  251. #define BEGIN_JUCE_NAMESPACE
  252. #define END_JUCE_NAMESPACE
  253. #endif
  254. /*** Start of inlined file: juce_PlatformDefs.h ***/
  255. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  256. #define __JUCE_PLATFORMDEFS_JUCEHEADER__
  257. #ifdef JUCE_FORCE_DEBUG
  258. #undef JUCE_DEBUG
  259. #if JUCE_FORCE_DEBUG
  260. #define JUCE_DEBUG 1
  261. #endif
  262. #endif
  263. #if JUCE_MSVC
  264. #define JUCE_CALLTYPE __stdcall
  265. #else
  266. #define JUCE_CALLTYPE
  267. #endif
  268. // Debugging and assertion macros
  269. // (For info about JUCE_LOG_ASSERTIONS, have a look in juce_Config.h)
  270. #if JUCE_LOG_ASSERTIONS
  271. #define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
  272. #elif defined (JUCE_DEBUG)
  273. #define juce_LogCurrentAssertion fprintf (stderr, "JUCE Assertion failure in %s, line %d\n", __FILE__, __LINE__);
  274. #else
  275. #define juce_LogCurrentAssertion
  276. #endif
  277. #ifdef JUCE_DEBUG
  278. // If debugging is enabled..
  279. #define DBG(dbgtext) Logger::outputDebugString (dbgtext);
  280. #define DBG_PRINTF(dbgprintf) Logger::outputDebugPrintf dbgprintf;
  281. // Assertions..
  282. #if JUCE_WINDOWS || DOXYGEN
  283. #if JUCE_USE_INTRINSICS
  284. #pragma intrinsic (__debugbreak)
  285. #define juce_breakDebugger __debugbreak();
  286. #elif JUCE_GCC
  287. #define juce_breakDebugger asm("int $3");
  288. #else
  289. #define juce_breakDebugger { __asm int 3 }
  290. #endif
  291. #elif JUCE_MAC
  292. #define juce_breakDebugger Debugger();
  293. #elif JUCE_IPHONE
  294. #define juce_breakDebugger kill (0, SIGTRAP);
  295. #elif JUCE_LINUX
  296. #define juce_breakDebugger kill (0, SIGTRAP);
  297. #endif
  298. /** This will always cause an assertion failure.
  299. It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled
  300. in juce_Config.h).
  301. @see jassert()
  302. */
  303. #define jassertfalse { juce_LogCurrentAssertion; if (JUCE_NAMESPACE::juce_isRunningUnderDebugger()) juce_breakDebugger; }
  304. /** Platform-independent assertion macro.
  305. This gets optimised out when not being built with debugging turned on.
  306. Be careful not to call any functions within its arguments that are vital to
  307. the behaviour of the program, because these won't get called in the release
  308. build.
  309. @see jassertfalse
  310. */
  311. #define jassert(expression) { if (! (expression)) jassertfalse }
  312. #else
  313. // If debugging is disabled, these dummy debug and assertion macros are used..
  314. #define DBG(dbgtext)
  315. #define DBG_PRINTF(dbgprintf)
  316. #define jassertfalse { juce_LogCurrentAssertion }
  317. #if JUCE_LOG_ASSERTIONS
  318. #define jassert(expression) { if (! (expression)) jassertfalse }
  319. #else
  320. #define jassert(a) { }
  321. #endif
  322. #endif
  323. #ifndef DOXYGEN
  324. template <bool b> struct JuceStaticAssert;
  325. template <> struct JuceStaticAssert <true> { static void dummy() {} };
  326. #endif
  327. /** A compile-time assertion macro.
  328. If the expression parameter is false, the macro will cause a compile error.
  329. */
  330. #define static_jassert(expression) JuceStaticAssert<expression>::dummy();
  331. #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
  332. #define JUCE_TRY try
  333. #define JUCE_CATCH_EXCEPTION \
  334. catch (const std::exception& e) \
  335. { \
  336. JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); \
  337. } \
  338. catch (...) \
  339. { \
  340. JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); \
  341. }
  342. #define JUCE_CATCH_ALL catch (...) {}
  343. #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
  344. #else
  345. #define JUCE_TRY
  346. #define JUCE_CATCH_EXCEPTION
  347. #define JUCE_CATCH_ALL
  348. #define JUCE_CATCH_ALL_ASSERT
  349. #endif
  350. // Macros for inlining.
  351. #if JUCE_MSVC
  352. #ifndef JUCE_DEBUG
  353. #define forcedinline __forceinline
  354. #else
  355. #define forcedinline inline
  356. #endif
  357. #else
  358. #ifndef JUCE_DEBUG
  359. #define forcedinline inline __attribute__((always_inline))
  360. #else
  361. #define forcedinline inline
  362. #endif
  363. #endif
  364. #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
  365. /*** End of inlined file: juce_PlatformDefs.h ***/
  366. // Now we'll include any OS headers we need.. (at this point we are outside the Juce namespace).
  367. #if JUCE_MSVC
  368. #pragma warning (push)
  369. #pragma warning (disable: 4514 4245 4100)
  370. #endif
  371. #include <cstdlib>
  372. #include <cstdarg>
  373. #include <climits>
  374. #include <limits>
  375. #include <cmath>
  376. #include <cwchar>
  377. #include <stdexcept>
  378. #include <typeinfo>
  379. #include <cstring>
  380. #include <cstdio>
  381. #include <iostream>
  382. #if JUCE_USE_INTRINSICS
  383. #include <intrin.h>
  384. #endif
  385. #if JUCE_MAC || JUCE_IPHONE
  386. #include <libkern/OSAtomic.h>
  387. #endif
  388. #if JUCE_LINUX
  389. #include <signal.h>
  390. #endif
  391. #if JUCE_MSVC && JUCE_DEBUG
  392. #include <crtdbg.h>
  393. #endif
  394. #if JUCE_MSVC
  395. #include <malloc.h>
  396. #pragma warning (pop)
  397. #if ! JUCE_PUBLIC_INCLUDES
  398. #pragma warning (4: 4511 4512 4100) // (enable some warnings that are turned off in VC8)
  399. #endif
  400. #endif
  401. // DLL building settings on Win32
  402. #if JUCE_MSVC
  403. #ifdef JUCE_DLL_BUILD
  404. #define JUCE_API __declspec (dllexport)
  405. #pragma warning (disable: 4251)
  406. #elif defined (JUCE_DLL)
  407. #define JUCE_API __declspec (dllimport)
  408. #pragma warning (disable: 4251)
  409. #endif
  410. #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  411. #ifdef JUCE_DLL_BUILD
  412. #define JUCE_API __attribute__ ((visibility("default")))
  413. #endif
  414. #endif
  415. #ifndef JUCE_API
  416. #define JUCE_API
  417. #endif
  418. #define JUCE_PUBLIC_FUNCTION JUCE_API JUCE_CALLTYPE
  419. // Now include some basics that are needed by most of the Juce classes...
  420. BEGIN_JUCE_NAMESPACE
  421. extern bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger();
  422. #if JUCE_LOG_ASSERTIONS
  423. extern void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw();
  424. #endif
  425. /*** Start of inlined file: juce_Memory.h ***/
  426. #ifndef __JUCE_MEMORY_JUCEHEADER__
  427. #define __JUCE_MEMORY_JUCEHEADER__
  428. #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
  429. #ifndef JUCE_DLL
  430. // Win32 debug non-DLL versions..
  431. #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  432. #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  433. #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__)
  434. #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK)
  435. #else
  436. // Win32 debug DLL versions..
  437. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  438. // way all juce calls in the DLL and in the host API will all use the same allocator.
  439. extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line);
  440. extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line);
  441. extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line);
  442. extern JUCE_API void juce_DebugFree (void* const block);
  443. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__)
  444. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__)
  445. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__)
  446. #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location)
  447. #endif
  448. #if ! defined (_AFXDLL)
  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. #endif
  455. #elif defined (JUCE_DLL)
  456. // Win32 DLL (release) versions..
  457. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that
  458. // way all juce calls in the DLL and in the host API will all use the same allocator.
  459. extern JUCE_API void* juce_Malloc (const int size);
  460. extern JUCE_API void* juce_Calloc (const int size);
  461. extern JUCE_API void* juce_Realloc (void* const block, const int size);
  462. extern JUCE_API void juce_Free (void* const block);
  463. #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes)
  464. #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes)
  465. #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes)
  466. #define juce_free(location) JUCE_NAMESPACE::juce_Free (location)
  467. #define juce_UseDebuggingNewOperator \
  468. static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \
  469. static void* operator new (size_t, void* p) { return p; } \
  470. static void operator delete (void* p) { juce_free (p); } \
  471. static void operator delete (void*, void*) { }
  472. #else
  473. // Mac, Linux and Win32 (release) versions..
  474. #define juce_malloc(numBytes) malloc (numBytes)
  475. #define juce_calloc(numBytes) calloc (1, numBytes)
  476. #define juce_realloc(location, numBytes) realloc (location, numBytes)
  477. #define juce_free(location) free (location)
  478. #endif
  479. #ifndef juce_UseDebuggingNewOperator
  480. #define juce_UseDebuggingNewOperator
  481. #endif
  482. #if JUCE_MSVC
  483. #define juce_ThreadLocal __declspec(thread)
  484. #else
  485. #define juce_ThreadLocal __thread
  486. #endif
  487. #if JUCE_MINGW
  488. #define alloca __builtin_alloca
  489. #endif
  490. inline void zeromem (void* memory, size_t numBytes) { memset (memory, 0, numBytes); }
  491. template <typename Type>
  492. inline void zerostruct (Type& structure) { memset (&structure, 0, sizeof (structure)); }
  493. template <typename Type>
  494. inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; }
  495. #endif // __JUCE_MEMORY_JUCEHEADER__
  496. /*** End of inlined file: juce_Memory.h ***/
  497. /*** Start of inlined file: juce_MathsFunctions.h ***/
  498. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  499. #define __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  500. // Definitions for the int8, int16, int32, int64 and pointer_sized_int types.
  501. typedef signed char int8;
  502. typedef unsigned char uint8;
  503. typedef signed short int16;
  504. typedef unsigned short uint16;
  505. typedef signed int int32;
  506. typedef unsigned int uint32;
  507. #if JUCE_MSVC
  508. typedef __int64 int64;
  509. typedef unsigned __int64 uint64;
  510. #define literal64bit(longLiteral) ((__int64) longLiteral)
  511. #else
  512. typedef long long int64;
  513. typedef unsigned long long uint64;
  514. #define literal64bit(longLiteral) (longLiteral##LL)
  515. #endif
  516. #if JUCE_64BIT
  517. typedef int64 pointer_sized_int;
  518. typedef uint64 pointer_sized_uint;
  519. #elif _MSC_VER >= 1300
  520. typedef _W64 int pointer_sized_int;
  521. typedef _W64 unsigned int pointer_sized_uint;
  522. #else
  523. typedef int pointer_sized_int;
  524. typedef unsigned int pointer_sized_uint;
  525. #endif
  526. typedef wchar_t juce_wchar;
  527. // Some indispensible min/max functions
  528. template <typename Type>
  529. inline Type jmax (const Type a, const Type b) { return (a < b) ? b : a; }
  530. template <typename Type>
  531. inline Type jmax (const Type a, const Type b, const Type c) { return (a < b) ? ((b < c) ? c : b) : ((a < c) ? c : a); }
  532. template <typename Type>
  533. inline Type jmax (const Type a, const Type b, const Type c, const Type d) { return jmax (a, jmax (b, c, d)); }
  534. template <typename Type>
  535. inline Type jmin (const Type a, const Type b) { return (a > b) ? b : a; }
  536. template <typename Type>
  537. inline Type jmin (const Type a, const Type b, const Type c) { return (a > b) ? ((b > c) ? c : b) : ((a > c) ? c : a); }
  538. template <typename Type>
  539. inline Type jmin (const Type a, const Type b, const Type c, const Type d) { return jmin (a, jmin (b, c, d)); }
  540. template <typename Type>
  541. inline Type jlimit (const Type lowerLimit,
  542. const Type upperLimit,
  543. const Type valueToConstrain) throw()
  544. {
  545. jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
  546. return (valueToConstrain < lowerLimit) ? lowerLimit
  547. : ((valueToConstrain > upperLimit) ? upperLimit
  548. : valueToConstrain);
  549. }
  550. template <typename Type>
  551. inline void swapVariables (Type& variable1, Type& variable2)
  552. {
  553. const Type tempVal = variable1;
  554. variable1 = variable2;
  555. variable2 = tempVal;
  556. }
  557. template <typename Type>
  558. inline int numElementsInArray (Type& array) { return (int) (sizeof (array) / sizeof (array[0])); }
  559. // Some useful maths functions that aren't always present with all compilers and build settings.
  560. inline double juce_hypot (double a, double b)
  561. {
  562. #if JUCE_WINDOWS
  563. return _hypot (a, b);
  564. #else
  565. return hypot (a, b);
  566. #endif
  567. }
  568. inline float juce_hypotf (float a, float b)
  569. {
  570. #if JUCE_WINDOWS
  571. return (float) _hypot (a, b);
  572. #else
  573. return hypotf (a, b);
  574. #endif
  575. }
  576. inline int64 abs64 (const int64 n)
  577. {
  578. return (n >= 0) ? n : -n;
  579. }
  580. const double double_Pi = 3.1415926535897932384626433832795;
  581. const float float_Pi = 3.14159265358979323846f;
  582. template <typename FloatingPointType>
  583. inline bool juce_isfinite (FloatingPointType value)
  584. {
  585. #if JUCE_WINDOWS
  586. return _finite (value);
  587. #else
  588. return std::isfinite (value);
  589. #endif
  590. }
  591. template <typename FloatType>
  592. inline int roundToInt (const FloatType value) throw()
  593. {
  594. union { int asInt[2]; double asDouble; } n;
  595. n.asDouble = ((double) value) + 6755399441055744.0;
  596. #if JUCE_BIG_ENDIAN
  597. return n.asInt [1];
  598. #else
  599. return n.asInt [0];
  600. #endif
  601. }
  602. inline int roundToIntAccurate (const double value) throw()
  603. {
  604. return roundToInt (value + 1.5e-8);
  605. }
  606. inline int roundDoubleToInt (const double value) throw()
  607. {
  608. return roundToInt (value);
  609. }
  610. inline int roundFloatToInt (const float value) throw()
  611. {
  612. return roundToInt (value);
  613. }
  614. #endif // __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  615. /*** End of inlined file: juce_MathsFunctions.h ***/
  616. /*** Start of inlined file: juce_ByteOrder.h ***/
  617. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  618. #define __JUCE_BYTEORDER_JUCEHEADER__
  619. class JUCE_API ByteOrder
  620. {
  621. public:
  622. static uint16 swap (uint16 value);
  623. static uint32 swap (uint32 value);
  624. static uint64 swap (uint64 value);
  625. static uint16 swapIfBigEndian (const uint16 value);
  626. static uint32 swapIfBigEndian (const uint32 value);
  627. static uint64 swapIfBigEndian (const uint64 value);
  628. static uint16 swapIfLittleEndian (const uint16 value);
  629. static uint32 swapIfLittleEndian (const uint32 value);
  630. static uint64 swapIfLittleEndian (const uint64 value);
  631. static uint32 littleEndianInt (const char* const bytes);
  632. static uint16 littleEndianShort (const char* const bytes);
  633. static uint32 bigEndianInt (const char* const bytes);
  634. static uint16 bigEndianShort (const char* const bytes);
  635. static int littleEndian24Bit (const char* const bytes);
  636. static int bigEndian24Bit (const char* const bytes);
  637. static void littleEndian24BitToChars (const int value, char* const destBytes);
  638. static void bigEndian24BitToChars (const int value, char* const destBytes);
  639. static bool isBigEndian();
  640. };
  641. #if JUCE_USE_INTRINSICS
  642. #pragma intrinsic (_byteswap_ulong)
  643. #endif
  644. inline uint16 ByteOrder::swap (uint16 n)
  645. {
  646. #if JUCE_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
  647. return (uint16) _byteswap_ushort (n);
  648. #else
  649. return (uint16) ((n << 8) | (n >> 8));
  650. #endif
  651. }
  652. inline uint32 ByteOrder::swap (uint32 n)
  653. {
  654. #if JUCE_MAC || JUCE_IPHONE
  655. return OSSwapInt32 (n);
  656. #elif JUCE_GCC
  657. asm("bswap %%eax" : "=a"(n) : "a"(n));
  658. return n;
  659. #elif JUCE_USE_INTRINSICS
  660. return _byteswap_ulong (n);
  661. #else
  662. __asm {
  663. mov eax, n
  664. bswap eax
  665. mov n, eax
  666. }
  667. return n;
  668. #endif
  669. }
  670. inline uint64 ByteOrder::swap (uint64 value)
  671. {
  672. #if JUCE_MAC || JUCE_IPHONE
  673. return OSSwapInt64 (value);
  674. #elif JUCE_USE_INTRINSICS
  675. return _byteswap_uint64 (value);
  676. #else
  677. return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
  678. #endif
  679. }
  680. #if JUCE_LITTLE_ENDIAN
  681. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
  682. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
  683. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
  684. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
  685. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
  686. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
  687. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  688. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  689. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  690. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  691. inline bool ByteOrder::isBigEndian() { return false; }
  692. #else
  693. inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
  694. inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
  695. inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
  696. inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
  697. inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
  698. inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
  699. inline uint32 ByteOrder::littleEndianInt (const char* const bytes) { return swap (*(uint32*) bytes); }
  700. inline uint16 ByteOrder::littleEndianShort (const char* const bytes) { return swap (*(uint16*) bytes); }
  701. inline uint32 ByteOrder::bigEndianInt (const char* const bytes) { return *(uint32*) bytes; }
  702. inline uint16 ByteOrder::bigEndianShort (const char* const bytes) { return *(uint16*) bytes; }
  703. inline bool ByteOrder::isBigEndian() { return true; }
  704. #endif
  705. inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[0]); }
  706. inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((uint32) (uint8) bytes[1]) << 8) | ((uint32) (uint8) bytes[2]); }
  707. 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); }
  708. 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); }
  709. #endif // __JUCE_BYTEORDER_JUCEHEADER__
  710. /*** End of inlined file: juce_ByteOrder.h ***/
  711. /*** Start of inlined file: juce_Logger.h ***/
  712. #ifndef __JUCE_LOGGER_JUCEHEADER__
  713. #define __JUCE_LOGGER_JUCEHEADER__
  714. /*** Start of inlined file: juce_String.h ***/
  715. #ifndef __JUCE_STRING_JUCEHEADER__
  716. #define __JUCE_STRING_JUCEHEADER__
  717. /*** Start of inlined file: juce_CharacterFunctions.h ***/
  718. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  719. #define __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  720. #if JUCE_STRINGS_ARE_UNICODE
  721. #define JUCE_T(stringLiteral) (L##stringLiteral)
  722. typedef juce_wchar tchar;
  723. #define juce_tcharToWideChar(c) (c)
  724. #else
  725. #define JUCE_T(stringLiteral) (stringLiteral)
  726. typedef char tchar;
  727. #define juce_tcharToWideChar(c) ((juce_wchar) (unsigned char) (c))
  728. #endif
  729. #if ! JUCE_DONT_DEFINE_MACROS
  730. #define T(stringLiteral) JUCE_T(stringLiteral)
  731. #endif
  732. class JUCE_API CharacterFunctions
  733. {
  734. public:
  735. static int length (const char* const s) throw();
  736. static int length (const juce_wchar* const s) throw();
  737. static void copy (char* dest, const char* src, const int maxBytes) throw();
  738. static void copy (juce_wchar* dest, const juce_wchar* src, const int maxChars) throw();
  739. static void copy (juce_wchar* dest, const char* src, const int maxChars) throw();
  740. static void copy (char* dest, const juce_wchar* src, const int maxBytes) throw();
  741. static int bytesRequiredForCopy (const juce_wchar* src) throw();
  742. static void append (char* dest, const char* src) throw();
  743. static void append (juce_wchar* dest, const juce_wchar* src) throw();
  744. static int compare (const char* const s1, const char* const s2) throw();
  745. static int compare (const juce_wchar* s1, const juce_wchar* s2) throw();
  746. static int compare (const char* const s1, const char* const s2, const int maxChars) throw();
  747. static int compare (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  748. static int compareIgnoreCase (const char* const s1, const char* const s2) throw();
  749. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2) throw();
  750. static int compareIgnoreCase (const char* const s1, const char* const s2, const int maxChars) throw();
  751. static int compareIgnoreCase (const juce_wchar* s1, const juce_wchar* s2, int maxChars) throw();
  752. static const char* find (const char* const haystack, const char* const needle) throw();
  753. static const juce_wchar* find (const juce_wchar* haystack, const juce_wchar* const needle) throw();
  754. static int indexOfChar (const char* const haystack, const char needle, const bool ignoreCase) throw();
  755. static int indexOfChar (const juce_wchar* const haystack, const juce_wchar needle, const bool ignoreCase) throw();
  756. static int indexOfCharFast (const char* const haystack, const char needle) throw();
  757. static int indexOfCharFast (const juce_wchar* const haystack, const juce_wchar needle) throw();
  758. static int getIntialSectionContainingOnly (const char* const text, const char* const allowedChars) throw();
  759. static int getIntialSectionContainingOnly (const juce_wchar* const text, const juce_wchar* const allowedChars) throw();
  760. static int ftime (char* const dest, const int maxChars, const char* const format, const struct tm* const tm) throw();
  761. static int ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw();
  762. static int getIntValue (const char* const s) throw();
  763. static int getIntValue (const juce_wchar* s) throw();
  764. static int64 getInt64Value (const char* s) throw();
  765. static int64 getInt64Value (const juce_wchar* s) throw();
  766. static double getDoubleValue (const char* const s) throw();
  767. static double getDoubleValue (const juce_wchar* const s) throw();
  768. static char toUpperCase (const char character) throw();
  769. static juce_wchar toUpperCase (const juce_wchar character) throw();
  770. static void toUpperCase (char* s) throw();
  771. static void toUpperCase (juce_wchar* s) throw();
  772. static bool isUpperCase (const char character) throw();
  773. static bool isUpperCase (const juce_wchar character) throw();
  774. static char toLowerCase (const char character) throw();
  775. static juce_wchar toLowerCase (const juce_wchar character) throw();
  776. static void toLowerCase (char* s) throw();
  777. static void toLowerCase (juce_wchar* s) throw();
  778. static bool isLowerCase (const char character) throw();
  779. static bool isLowerCase (const juce_wchar character) throw();
  780. static bool isWhitespace (const char character) throw();
  781. static bool isWhitespace (const juce_wchar character) throw();
  782. static bool isDigit (const char character) throw();
  783. static bool isDigit (const juce_wchar character) throw();
  784. static bool isLetter (const char character) throw();
  785. static bool isLetter (const juce_wchar character) throw();
  786. static bool isLetterOrDigit (const char character) throw();
  787. static bool isLetterOrDigit (const juce_wchar character) throw();
  788. static int getHexDigitValue (const tchar digit) throw();
  789. static int printf (char* const dest, const int maxLength, const char* const format, ...) throw();
  790. static int printf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, ...) throw();
  791. static int vprintf (char* const dest, const int maxLength, const char* const format, va_list& args) throw();
  792. static int vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw();
  793. };
  794. #endif // __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  795. /*** End of inlined file: juce_CharacterFunctions.h ***/
  796. class JUCE_API String
  797. {
  798. public:
  799. String() throw();
  800. String (const String& other) throw();
  801. String (const char* const text) throw();
  802. String (const char* const text,
  803. const size_t maxChars) throw();
  804. String (const juce_wchar* const unicodeText) throw();
  805. String (const juce_wchar* const unicodeText,
  806. const size_t maxChars) throw();
  807. static const String charToString (const tchar character) throw();
  808. ~String() throw();
  809. static const String empty;
  810. int hashCode() const throw();
  811. int64 hashCode64() const throw();
  812. int length() const throw();
  813. // Assignment and concatenation operators..
  814. const String& operator= (const tchar* const other) throw();
  815. const String& operator= (const String& other) throw();
  816. const String& operator+= (const tchar* const textToAppend) throw();
  817. const String& operator+= (const String& stringToAppend) throw();
  818. const String& operator+= (const char characterToAppend) throw();
  819. const String& operator+= (const juce_wchar characterToAppend) throw();
  820. void append (const tchar* const textToAppend,
  821. const int maxCharsToTake) throw();
  822. const String operator+ (const String& stringToAppend) const throw();
  823. const String operator+ (const tchar* const textToAppend) const throw();
  824. const String operator+ (const tchar characterToAppend) const throw();
  825. String& operator<< (const char n) throw();
  826. String& operator<< (const juce_wchar n) throw();
  827. String& operator<< (const char* const text) throw();
  828. String& operator<< (const juce_wchar* const text) throw();
  829. String& operator<< (const String& text) throw();
  830. String& operator<< (const short number) throw();
  831. String& operator<< (const int number) throw();
  832. String& operator<< (const unsigned int number) throw();
  833. String& operator<< (const long number) throw();
  834. String& operator<< (const unsigned long number) throw();
  835. String& operator<< (const float number) throw();
  836. String& operator<< (const double number) throw();
  837. // Comparison methods..
  838. inline bool isEmpty() const throw() { return text->text[0] == 0; }
  839. inline bool isNotEmpty() const throw() { return text->text[0] != 0; }
  840. bool operator== (const String& other) const throw();
  841. bool operator== (const tchar* const other) const throw();
  842. bool operator!= (const String& other) const throw();
  843. bool operator!= (const tchar* const other) const throw();
  844. bool equalsIgnoreCase (const String& other) const throw();
  845. bool equalsIgnoreCase (const tchar* const other) const throw();
  846. bool operator> (const String& other) const throw();
  847. bool operator< (const tchar* const other) const throw();
  848. bool operator>= (const String& other) const throw();
  849. bool operator<= (const tchar* const other) const throw();
  850. int compare (const tchar* const other) const throw();
  851. int compareIgnoreCase (const tchar* const other) const throw();
  852. int compareLexicographically (const tchar* const other) const throw();
  853. bool startsWith (const tchar* const text) const throw();
  854. bool startsWithChar (const tchar character) const throw();
  855. bool startsWithIgnoreCase (const tchar* const text) const throw();
  856. bool endsWith (const tchar* const text) const throw();
  857. bool endsWithChar (const tchar character) const throw();
  858. bool endsWithIgnoreCase (const tchar* const text) const throw();
  859. bool contains (const tchar* const text) const throw();
  860. bool containsChar (const tchar character) const throw();
  861. bool containsIgnoreCase (const tchar* const text) const throw();
  862. bool containsWholeWord (const tchar* const wordToLookFor) const throw();
  863. bool containsWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  864. int indexOfWholeWord (const tchar* const wordToLookFor) const throw();
  865. int indexOfWholeWordIgnoreCase (const tchar* const wordToLookFor) const throw();
  866. bool containsAnyOf (const tchar* const charactersItMightContain) const throw();
  867. bool containsOnly (const tchar* const charactersItMightContain) const throw();
  868. bool containsNonWhitespaceChars() const throw();
  869. bool matchesWildcard (const tchar* wildcard, const bool ignoreCase) const throw();
  870. // Substring location methods..
  871. int indexOfChar (const tchar characterToLookFor) const throw();
  872. int indexOfChar (const int startIndex, const tchar characterToLookFor) const throw();
  873. int indexOfAnyOf (const tchar* const charactersToLookFor,
  874. const int startIndex = 0,
  875. const bool ignoreCase = false) const throw();
  876. int indexOf (const tchar* const text) const throw();
  877. int indexOf (const int startIndex,
  878. const tchar* const textToLookFor) const throw();
  879. int indexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  880. int indexOfIgnoreCase (const int startIndex,
  881. const tchar* const textToLookFor) const throw();
  882. int lastIndexOfChar (const tchar character) const throw();
  883. int lastIndexOf (const tchar* const textToLookFor) const throw();
  884. int lastIndexOfIgnoreCase (const tchar* const textToLookFor) const throw();
  885. int lastIndexOfAnyOf (const tchar* const charactersToLookFor,
  886. const bool ignoreCase = false) const throw();
  887. // Substring extraction and manipulation methods..
  888. /** Returns the character at this index in the string.
  889. No checks are made to see if the index is within a valid range, so be careful!
  890. */
  891. inline const tchar& operator[] (const int index) const throw() { jassert (((unsigned int) index) <= (unsigned int) length()); return text->text [index]; }
  892. tchar& operator[] (const int index) throw();
  893. tchar getLastCharacter() const throw();
  894. const String substring (int startIndex,
  895. int endIndex) const throw();
  896. const String substring (const int startIndex) const throw();
  897. const String dropLastCharacters (const int numberToDrop) const throw();
  898. const String getLastCharacters (const int numCharacters) const throw();
  899. const String fromFirstOccurrenceOf (const tchar* const substringToStartFrom,
  900. const bool includeSubStringInResult,
  901. const bool ignoreCase) const throw();
  902. const String fromLastOccurrenceOf (const tchar* const substringToFind,
  903. const bool includeSubStringInResult,
  904. const bool ignoreCase) const throw();
  905. const String upToFirstOccurrenceOf (const tchar* const substringToEndWith,
  906. const bool includeSubStringInResult,
  907. const bool ignoreCase) const throw();
  908. const String upToLastOccurrenceOf (const tchar* substringToFind,
  909. const bool includeSubStringInResult,
  910. const bool ignoreCase) const throw();
  911. const String trim() const throw();
  912. const String trimStart() const throw();
  913. const String trimEnd() const throw();
  914. const String trimCharactersAtStart (const tchar* charactersToTrim) const throw();
  915. const String trimCharactersAtEnd (const tchar* charactersToTrim) const throw();
  916. const String toUpperCase() const throw();
  917. const String toLowerCase() const throw();
  918. const String replaceSection (int startIndex,
  919. int numCharactersToReplace,
  920. const tchar* const stringToInsert) const throw();
  921. const String replace (const tchar* const stringToReplace,
  922. const tchar* const stringToInsertInstead,
  923. const bool ignoreCase = false) const throw();
  924. const String replaceCharacter (const tchar characterToReplace,
  925. const tchar characterToInsertInstead) const throw();
  926. const String replaceCharacters (const String& charactersToReplace,
  927. const tchar* const charactersToInsertInstead) const throw();
  928. const String retainCharacters (const tchar* const charactersToRetain) const throw();
  929. const String removeCharacters (const tchar* const charactersToRemove) const throw();
  930. const String initialSectionContainingOnly (const tchar* const permittedCharacters) const throw();
  931. const String initialSectionNotContaining (const tchar* const charactersToStopAt) const throw();
  932. bool isQuotedString() const throw();
  933. const String unquoted() const throw();
  934. const String quoted (const tchar quoteCharacter = JUCE_T('"')) const throw();
  935. void printf (const tchar* const format, ...) throw();
  936. static const String formatted (const tchar* const format, ...) throw();
  937. void vprintf (const tchar* const format, va_list& args) throw();
  938. static const String repeatedString (const tchar* const stringToRepeat,
  939. int numberOfTimesToRepeat) throw();
  940. static const String createStringFromData (const void* const data,
  941. const int size) throw();
  942. // Numeric conversions..
  943. explicit String (const int decimalInteger) throw();
  944. explicit String (const unsigned int decimalInteger) throw();
  945. explicit String (const short decimalInteger) throw();
  946. explicit String (const unsigned short decimalInteger) throw();
  947. explicit String (const int64 largeIntegerValue) throw();
  948. explicit String (const uint64 largeIntegerValue) throw();
  949. explicit String (const float floatValue,
  950. const int numberOfDecimalPlaces = 0) throw();
  951. explicit String (const double doubleValue,
  952. const int numberOfDecimalPlaces = 0) throw();
  953. int getIntValue() const throw();
  954. int64 getLargeIntValue() const throw();
  955. int getTrailingIntValue() const throw();
  956. float getFloatValue() const throw();
  957. double getDoubleValue() const throw();
  958. int getHexValue32() const throw();
  959. int64 getHexValue64() const throw();
  960. static const String toHexString (const int number) throw();
  961. static const String toHexString (const int64 number) throw();
  962. static const String toHexString (const short number) throw();
  963. static const String toHexString (const unsigned char* data,
  964. const int size,
  965. const int groupSize = 1) throw();
  966. // Casting to character arrays..
  967. #if JUCE_STRINGS_ARE_UNICODE
  968. operator const char*() const throw();
  969. inline operator const juce_wchar*() const throw() { return text->text; }
  970. #else
  971. inline operator const char*() const throw() { return text->text; }
  972. operator const juce_wchar*() const throw();
  973. #endif
  974. void copyToBuffer (char* const destBuffer,
  975. const int maxCharsToCopy) const throw();
  976. void copyToBuffer (juce_wchar* const destBuffer,
  977. const int maxCharsToCopy) const throw();
  978. int copyToUTF8 (uint8* const destBuffer, const int maxBufferSizeBytes = 0x7fffffff) const throw();
  979. const char* toUTF8() const throw();
  980. static const String fromUTF8 (const uint8* const utf8buffer,
  981. int bufferSizeBytes = -1) throw();
  982. void preallocateStorage (const size_t numCharsNeeded) throw();
  983. class JUCE_API Concatenator
  984. {
  985. public:
  986. Concatenator (String& stringToAppendTo);
  987. ~Concatenator();
  988. void append (const String& s);
  989. private:
  990. String& result;
  991. int nextIndex;
  992. Concatenator (const Concatenator&);
  993. const Concatenator& operator= (const Concatenator&);
  994. };
  995. juce_UseDebuggingNewOperator // (adds debugging info to find leaked objects)
  996. private:
  997. struct InternalRefCountedStringHolder
  998. {
  999. int refCount;
  1000. int allocatedNumChars;
  1001. #if JUCE_STRINGS_ARE_UNICODE
  1002. wchar_t text[1];
  1003. #else
  1004. char text[1];
  1005. #endif
  1006. };
  1007. InternalRefCountedStringHolder* text;
  1008. static InternalRefCountedStringHolder emptyString;
  1009. // internal constructor that preallocates a certain amount of memory
  1010. String (const int numChars, const int dummyVariable) throw();
  1011. void createInternal (const int numChars) throw();
  1012. void createInternal (const tchar* const text, const tchar* const textEnd) throw();
  1013. void appendInternal (const tchar* const text, const int numExtraChars) throw();
  1014. void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
  1015. void dupeInternalIfMultiplyReferenced() throw();
  1016. };
  1017. const String JUCE_PUBLIC_FUNCTION operator+ (const char* const string1,
  1018. const String& string2) throw();
  1019. const String JUCE_PUBLIC_FUNCTION operator+ (const juce_wchar* const string1,
  1020. const String& string2) throw();
  1021. #endif // __JUCE_STRING_JUCEHEADER__
  1022. /*** End of inlined file: juce_String.h ***/
  1023. class JUCE_API Logger
  1024. {
  1025. public:
  1026. virtual ~Logger();
  1027. static void JUCE_CALLTYPE setCurrentLogger (Logger* const newLogger,
  1028. const bool deleteOldLogger = false);
  1029. static void JUCE_CALLTYPE writeToLog (const String& message);
  1030. static void JUCE_CALLTYPE outputDebugString (const String& text) throw();
  1031. static void JUCE_CALLTYPE outputDebugPrintf (const tchar* format, ...) throw();
  1032. protected:
  1033. Logger();
  1034. virtual void logMessage (const String& message) = 0;
  1035. };
  1036. #endif // __JUCE_LOGGER_JUCEHEADER__
  1037. /*** End of inlined file: juce_Logger.h ***/
  1038. END_JUCE_NAMESPACE
  1039. #endif // __JUCE_STANDARDHEADER_JUCEHEADER__
  1040. /*** End of inlined file: juce_StandardHeader.h ***/
  1041. BEGIN_JUCE_NAMESPACE
  1042. #if JUCE_MSVC
  1043. // this is set explicitly in case the app is using a different packing size.
  1044. #pragma pack (push, 8)
  1045. #pragma warning (push)
  1046. #pragma warning (disable: 4786) // (old vc6 warning about long class names)
  1047. #endif
  1048. // this is where all the class header files get brought in..
  1049. /*** Start of inlined file: juce_core_includes.h ***/
  1050. #ifndef __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1051. #define __JUCE_JUCE_CORE_INCLUDES_INCLUDEFILES__
  1052. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1053. /*** Start of inlined file: juce_Array.h ***/
  1054. #ifndef __JUCE_ARRAY_JUCEHEADER__
  1055. #define __JUCE_ARRAY_JUCEHEADER__
  1056. /*** Start of inlined file: juce_ArrayAllocationBase.h ***/
  1057. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1058. #define __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1059. /*** Start of inlined file: juce_HeapBlock.h ***/
  1060. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  1061. #define __JUCE_HEAPBLOCK_JUCEHEADER__
  1062. template <class ElementType>
  1063. class HeapBlock
  1064. {
  1065. public:
  1066. HeapBlock() throw() : data (0)
  1067. {
  1068. }
  1069. HeapBlock (const size_t numElements)
  1070. : data ((ElementType*) ::juce_malloc (numElements * sizeof (ElementType)))
  1071. {
  1072. }
  1073. ~HeapBlock()
  1074. {
  1075. ::juce_free (data);
  1076. }
  1077. inline operator ElementType*() const throw() { return data; }
  1078. inline operator void*() const throw() { return (void*) data; }
  1079. inline ElementType* operator->() const throw() { return data; }
  1080. template <class CastType>
  1081. inline operator CastType*() const throw() { return (CastType*) data; }
  1082. template <typename IndexType>
  1083. inline ElementType& operator[] (IndexType index) const throw() { return data [index]; }
  1084. template <typename IndexType>
  1085. inline ElementType* operator+ (IndexType index) const throw() { return data + index; }
  1086. inline ElementType** operator&() const throw() { return (ElementType**) &data; }
  1087. inline bool operator== (const ElementType* const otherPointer) const throw() { return otherPointer == data; }
  1088. inline bool operator!= (const ElementType* const otherPointer) const throw() { return otherPointer != data; }
  1089. void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1090. {
  1091. ::juce_free (data);
  1092. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1093. }
  1094. void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1095. {
  1096. ::juce_free (data);
  1097. data = (ElementType*) ::juce_calloc (newNumElements * elementSize);
  1098. }
  1099. void allocate (const size_t newNumElements, const bool initialiseToZero)
  1100. {
  1101. ::juce_free (data);
  1102. if (initialiseToZero)
  1103. data = (ElementType*) ::juce_calloc (newNumElements * sizeof (ElementType));
  1104. else
  1105. data = (ElementType*) ::juce_malloc (newNumElements * sizeof (ElementType));
  1106. }
  1107. void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
  1108. {
  1109. if (data == 0)
  1110. data = (ElementType*) ::juce_malloc (newNumElements * elementSize);
  1111. else
  1112. data = (ElementType*) ::juce_realloc (data, newNumElements * elementSize);
  1113. }
  1114. void free()
  1115. {
  1116. ::juce_free (data);
  1117. data = 0;
  1118. }
  1119. void swapWith (HeapBlock <ElementType>& other) throw()
  1120. {
  1121. swapVariables (data, other.data);
  1122. }
  1123. private:
  1124. ElementType* data;
  1125. HeapBlock (const HeapBlock&);
  1126. const HeapBlock& operator= (const HeapBlock&);
  1127. };
  1128. #endif // __JUCE_HEAPBLOCK_JUCEHEADER__
  1129. /*** End of inlined file: juce_HeapBlock.h ***/
  1130. template <class ElementType, class TypeOfCriticalSectionToUse>
  1131. class ArrayAllocationBase : public TypeOfCriticalSectionToUse
  1132. {
  1133. public:
  1134. ArrayAllocationBase() throw()
  1135. : numAllocated (0)
  1136. {
  1137. }
  1138. ~ArrayAllocationBase()
  1139. {
  1140. }
  1141. void setAllocatedSize (const int numElements)
  1142. {
  1143. if (numAllocated != numElements)
  1144. {
  1145. if (numElements > 0)
  1146. elements.realloc (numElements);
  1147. else
  1148. elements.free();
  1149. numAllocated = numElements;
  1150. }
  1151. }
  1152. void ensureAllocatedSize (const int minNumElements)
  1153. {
  1154. if (minNumElements > numAllocated)
  1155. setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
  1156. }
  1157. void shrinkToNoMoreThan (const int maxNumElements)
  1158. {
  1159. if (maxNumElements < numAllocated)
  1160. setAllocatedSize (maxNumElements);
  1161. }
  1162. void swapWith (ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  1163. {
  1164. elements.swapWith (other.elements);
  1165. swapVariables (numAllocated, other.numAllocated);
  1166. }
  1167. HeapBlock <ElementType> elements;
  1168. int numAllocated;
  1169. private:
  1170. ArrayAllocationBase (const ArrayAllocationBase&);
  1171. ArrayAllocationBase& operator= (const ArrayAllocationBase&);
  1172. };
  1173. #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1174. /*** End of inlined file: juce_ArrayAllocationBase.h ***/
  1175. /*** Start of inlined file: juce_ElementComparator.h ***/
  1176. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1177. #define __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1178. template <class ElementType, class ElementComparator>
  1179. static void sortArray (ElementComparator& comparator,
  1180. ElementType* const array,
  1181. int firstElement,
  1182. int lastElement,
  1183. const bool retainOrderOfEquivalentItems)
  1184. {
  1185. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1186. // avoids getting warning messages about the parameter being unused
  1187. if (lastElement > firstElement)
  1188. {
  1189. if (retainOrderOfEquivalentItems)
  1190. {
  1191. for (int i = firstElement; i < lastElement; ++i)
  1192. {
  1193. if (comparator.compareElements (array[i], array [i + 1]) > 0)
  1194. {
  1195. const ElementType temp = array [i];
  1196. array [i] = array[i + 1];
  1197. array [i + 1] = temp;
  1198. if (i > firstElement)
  1199. i -= 2;
  1200. }
  1201. }
  1202. }
  1203. else
  1204. {
  1205. int fromStack[30], toStack[30];
  1206. int stackIndex = 0;
  1207. for (;;)
  1208. {
  1209. const int size = (lastElement - firstElement) + 1;
  1210. if (size <= 8)
  1211. {
  1212. int j = lastElement;
  1213. int maxIndex;
  1214. while (j > firstElement)
  1215. {
  1216. maxIndex = firstElement;
  1217. for (int k = firstElement + 1; k <= j; ++k)
  1218. if (comparator.compareElements (array[k], array [maxIndex]) > 0)
  1219. maxIndex = k;
  1220. const ElementType temp = array [maxIndex];
  1221. array [maxIndex] = array[j];
  1222. array [j] = temp;
  1223. --j;
  1224. }
  1225. }
  1226. else
  1227. {
  1228. const int mid = firstElement + (size >> 1);
  1229. ElementType temp = array [mid];
  1230. array [mid] = array [firstElement];
  1231. array [firstElement] = temp;
  1232. int i = firstElement;
  1233. int j = lastElement + 1;
  1234. for (;;)
  1235. {
  1236. while (++i <= lastElement
  1237. && comparator.compareElements (array[i], array [firstElement]) <= 0)
  1238. {}
  1239. while (--j > firstElement
  1240. && comparator.compareElements (array[j], array [firstElement]) >= 0)
  1241. {}
  1242. if (j < i)
  1243. break;
  1244. temp = array[i];
  1245. array[i] = array[j];
  1246. array[j] = temp;
  1247. }
  1248. temp = array [firstElement];
  1249. array [firstElement] = array[j];
  1250. array [j] = temp;
  1251. if (j - 1 - firstElement >= lastElement - i)
  1252. {
  1253. if (firstElement + 1 < j)
  1254. {
  1255. fromStack [stackIndex] = firstElement;
  1256. toStack [stackIndex] = j - 1;
  1257. ++stackIndex;
  1258. }
  1259. if (i < lastElement)
  1260. {
  1261. firstElement = i;
  1262. continue;
  1263. }
  1264. }
  1265. else
  1266. {
  1267. if (i < lastElement)
  1268. {
  1269. fromStack [stackIndex] = i;
  1270. toStack [stackIndex] = lastElement;
  1271. ++stackIndex;
  1272. }
  1273. if (firstElement + 1 < j)
  1274. {
  1275. lastElement = j - 1;
  1276. continue;
  1277. }
  1278. }
  1279. }
  1280. if (--stackIndex < 0)
  1281. break;
  1282. jassert (stackIndex < numElementsInArray (fromStack));
  1283. firstElement = fromStack [stackIndex];
  1284. lastElement = toStack [stackIndex];
  1285. }
  1286. }
  1287. }
  1288. }
  1289. template <class ElementType, class ElementComparator>
  1290. static int findInsertIndexInSortedArray (ElementComparator& comparator,
  1291. ElementType* const array,
  1292. const ElementType newElement,
  1293. int firstElement,
  1294. int lastElement)
  1295. {
  1296. jassert (firstElement <= lastElement);
  1297. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1298. // avoids getting warning messages about the parameter being unused
  1299. while (firstElement < lastElement)
  1300. {
  1301. if (comparator.compareElements (newElement, array [firstElement]) == 0)
  1302. {
  1303. ++firstElement;
  1304. break;
  1305. }
  1306. else
  1307. {
  1308. const int halfway = (firstElement + lastElement) >> 1;
  1309. if (halfway == firstElement)
  1310. {
  1311. if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1312. ++firstElement;
  1313. break;
  1314. }
  1315. else if (comparator.compareElements (newElement, array [halfway]) >= 0)
  1316. {
  1317. firstElement = halfway;
  1318. }
  1319. else
  1320. {
  1321. lastElement = halfway;
  1322. }
  1323. }
  1324. }
  1325. return firstElement;
  1326. }
  1327. template <class ElementType>
  1328. class IntegerElementComparator
  1329. {
  1330. public:
  1331. static int compareElements (const ElementType first,
  1332. const ElementType second) throw()
  1333. {
  1334. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1335. }
  1336. };
  1337. template <class ElementType>
  1338. class FloatElementComparator
  1339. {
  1340. public:
  1341. static int compareElements (const ElementType first,
  1342. const ElementType second) throw()
  1343. {
  1344. return (first < second) ? -1 : ((first == second) ? 0 : 1);
  1345. }
  1346. };
  1347. #endif // __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  1348. /*** End of inlined file: juce_ElementComparator.h ***/
  1349. /*** Start of inlined file: juce_CriticalSection.h ***/
  1350. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  1351. #define __JUCE_CRITICALSECTION_JUCEHEADER__
  1352. class JUCE_API CriticalSection
  1353. {
  1354. public:
  1355. CriticalSection() throw();
  1356. ~CriticalSection() throw();
  1357. void enter() const throw();
  1358. bool tryEnter() const throw();
  1359. void exit() const throw();
  1360. juce_UseDebuggingNewOperator
  1361. private:
  1362. #if JUCE_WIN32
  1363. #if JUCE_64BIT
  1364. // To avoid including windows.h in the public Juce includes, we'll just allocate a
  1365. // block of memory here that's big enough to be used internally as a windows critical
  1366. // section object.
  1367. uint8 internal [44];
  1368. #else
  1369. uint8 internal [24];
  1370. #endif
  1371. #else
  1372. mutable pthread_mutex_t internal;
  1373. #endif
  1374. CriticalSection (const CriticalSection&);
  1375. const CriticalSection& operator= (const CriticalSection&);
  1376. };
  1377. class JUCE_API DummyCriticalSection
  1378. {
  1379. public:
  1380. inline DummyCriticalSection() throw() {}
  1381. inline ~DummyCriticalSection() throw() {}
  1382. inline void enter() const throw() {}
  1383. inline void exit() const throw() {}
  1384. };
  1385. #endif // __JUCE_CRITICALSECTION_JUCEHEADER__
  1386. /*** End of inlined file: juce_CriticalSection.h ***/
  1387. template <typename ElementType,
  1388. typename TypeOfCriticalSectionToUse = DummyCriticalSection>
  1389. class Array
  1390. {
  1391. public:
  1392. Array() throw()
  1393. : numUsed (0)
  1394. {
  1395. }
  1396. Array (const Array<ElementType, TypeOfCriticalSectionToUse>& other)
  1397. {
  1398. other.lockArray();
  1399. numUsed = other.numUsed;
  1400. data.setAllocatedSize (other.numUsed);
  1401. for (int i = 0; i < numUsed; ++i)
  1402. new (data.elements + i) ElementType (other.data.elements[i]);
  1403. other.unlockArray();
  1404. }
  1405. explicit Array (const ElementType* values)
  1406. : numUsed (0)
  1407. {
  1408. while (*values != 0)
  1409. add (*values++);
  1410. }
  1411. Array (const ElementType* values, int numValues)
  1412. : numUsed (numValues)
  1413. {
  1414. data.setAllocatedSize (numValues);
  1415. for (int i = 0; i < numValues; ++i)
  1416. new (data.elements + i) ElementType (values[i]);
  1417. }
  1418. ~Array()
  1419. {
  1420. for (int i = 0; i < numUsed; ++i)
  1421. data.elements[i].~ElementType();
  1422. }
  1423. Array <ElementType, TypeOfCriticalSectionToUse>& operator= (const Array <ElementType, TypeOfCriticalSectionToUse>& other)
  1424. {
  1425. if (this != &other)
  1426. {
  1427. Array<ElementType, TypeOfCriticalSectionToUse> otherCopy (other);
  1428. swapWithArray (otherCopy);
  1429. }
  1430. return *this;
  1431. }
  1432. template <class OtherArrayType>
  1433. bool operator== (const OtherArrayType& other) const
  1434. {
  1435. data.enter();
  1436. if (numUsed != other.numUsed)
  1437. {
  1438. data.exit();
  1439. return false;
  1440. }
  1441. for (int i = numUsed; --i >= 0;)
  1442. {
  1443. if (data.elements [i] != other.data.elements [i])
  1444. {
  1445. data.exit();
  1446. return false;
  1447. }
  1448. }
  1449. data.exit();
  1450. return true;
  1451. }
  1452. template <class OtherArrayType>
  1453. bool operator!= (const OtherArrayType& other) const
  1454. {
  1455. return ! operator== (other);
  1456. }
  1457. void clear()
  1458. {
  1459. data.enter();
  1460. for (int i = 0; i < numUsed; ++i)
  1461. data.elements[i].~ElementType();
  1462. data.setAllocatedSize (0);
  1463. numUsed = 0;
  1464. data.exit();
  1465. }
  1466. void clearQuick()
  1467. {
  1468. data.enter();
  1469. for (int i = 0; i < numUsed; ++i)
  1470. data.elements[i].~ElementType();
  1471. numUsed = 0;
  1472. data.exit();
  1473. }
  1474. inline int size() const throw()
  1475. {
  1476. return numUsed;
  1477. }
  1478. inline ElementType operator[] (const int index) const
  1479. {
  1480. data.enter();
  1481. const ElementType result ((((unsigned int) index) < (unsigned int) numUsed)
  1482. ? data.elements [index]
  1483. : ElementType());
  1484. data.exit();
  1485. return result;
  1486. }
  1487. inline const ElementType getUnchecked (const int index) const
  1488. {
  1489. data.enter();
  1490. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1491. const ElementType result (data.elements [index]);
  1492. data.exit();
  1493. return result;
  1494. }
  1495. inline ElementType& getReference (const int index) const throw()
  1496. {
  1497. data.enter();
  1498. jassert (((unsigned int) index) < (unsigned int) numUsed);
  1499. ElementType& result = data.elements [index];
  1500. data.exit();
  1501. return result;
  1502. }
  1503. inline ElementType getFirst() const
  1504. {
  1505. data.enter();
  1506. const ElementType result ((numUsed > 0) ? data.elements [0]
  1507. : ElementType());
  1508. data.exit();
  1509. return result;
  1510. }
  1511. inline ElementType getLast() const
  1512. {
  1513. data.enter();
  1514. const ElementType result ((numUsed > 0) ? data.elements [numUsed - 1]
  1515. : ElementType());
  1516. data.exit();
  1517. return result;
  1518. }
  1519. int indexOf (const ElementType& elementToLookFor) const
  1520. {
  1521. int result = -1;
  1522. data.enter();
  1523. const ElementType* e = data.elements;
  1524. for (int i = numUsed; --i >= 0;)
  1525. {
  1526. if (elementToLookFor == *e)
  1527. {
  1528. result = (int) (e - data.elements);
  1529. break;
  1530. }
  1531. ++e;
  1532. }
  1533. data.exit();
  1534. return result;
  1535. }
  1536. bool contains (const ElementType& elementToLookFor) const
  1537. {
  1538. data.enter();
  1539. const ElementType* e = data.elements;
  1540. int num = numUsed;
  1541. while (num > 0)
  1542. {
  1543. if (elementToLookFor == *e)
  1544. {
  1545. data.exit();
  1546. return true;
  1547. }
  1548. --num;
  1549. ++e;
  1550. }
  1551. data.exit();
  1552. return false;
  1553. }
  1554. void add (const ElementType& newElement)
  1555. {
  1556. data.enter();
  1557. data.ensureAllocatedSize (numUsed + 1);
  1558. new (data.elements + numUsed++) ElementType (newElement);
  1559. data.exit();
  1560. }
  1561. void insert (int indexToInsertAt, const ElementType& newElement)
  1562. {
  1563. data.enter();
  1564. data.ensureAllocatedSize (numUsed + 1);
  1565. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1566. {
  1567. ElementType* const insertPos = data.elements + indexToInsertAt;
  1568. const int numberToMove = numUsed - indexToInsertAt;
  1569. if (numberToMove > 0)
  1570. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  1571. new (insertPos) ElementType (newElement);
  1572. ++numUsed;
  1573. }
  1574. else
  1575. {
  1576. new (data.elements + numUsed++) ElementType (newElement);
  1577. }
  1578. data.exit();
  1579. }
  1580. void insertMultiple (int indexToInsertAt, const ElementType& newElement,
  1581. int numberOfTimesToInsertIt)
  1582. {
  1583. if (numberOfTimesToInsertIt > 0)
  1584. {
  1585. data.enter();
  1586. data.ensureAllocatedSize (numUsed + numberOfTimesToInsertIt);
  1587. ElementType* insertPos;
  1588. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1589. {
  1590. insertPos = data.elements + indexToInsertAt;
  1591. const int numberToMove = numUsed - indexToInsertAt;
  1592. memmove (insertPos + numberOfTimesToInsertIt, insertPos, numberToMove * sizeof (ElementType));
  1593. }
  1594. else
  1595. {
  1596. insertPos = data.elements + numUsed;
  1597. }
  1598. numUsed += numberOfTimesToInsertIt;
  1599. while (--numberOfTimesToInsertIt >= 0)
  1600. new (insertPos++) ElementType (newElement);
  1601. data.exit();
  1602. }
  1603. }
  1604. void insertArray (int indexToInsertAt,
  1605. const ElementType* newElements,
  1606. int numberOfElements)
  1607. {
  1608. if (numberOfElements > 0)
  1609. {
  1610. data.enter();
  1611. data.ensureAllocatedSize (numUsed + numberOfElements);
  1612. ElementType* insertPos;
  1613. if (((unsigned int) indexToInsertAt) < (unsigned int) numUsed)
  1614. {
  1615. insertPos = data.elements + indexToInsertAt;
  1616. const int numberToMove = numUsed - indexToInsertAt;
  1617. memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ElementType));
  1618. }
  1619. else
  1620. {
  1621. insertPos = data.elements + numUsed;
  1622. }
  1623. numUsed += numberOfElements;
  1624. while (--numberOfElements >= 0)
  1625. new (insertPos++) ElementType (*newElements++);
  1626. data.exit();
  1627. }
  1628. }
  1629. void addIfNotAlreadyThere (const ElementType& newElement)
  1630. {
  1631. data.enter();
  1632. if (! contains (newElement))
  1633. add (newElement);
  1634. data.exit();
  1635. }
  1636. void set (const int indexToChange, const ElementType& newValue)
  1637. {
  1638. jassert (indexToChange >= 0);
  1639. data.enter();
  1640. if (((unsigned int) indexToChange) < (unsigned int) numUsed)
  1641. {
  1642. data.elements [indexToChange] = newValue;
  1643. }
  1644. else if (indexToChange >= 0)
  1645. {
  1646. data.ensureAllocatedSize (numUsed + 1);
  1647. new (data.elements + numUsed++) ElementType (newValue);
  1648. }
  1649. data.exit();
  1650. }
  1651. void setUnchecked (const int indexToChange, const ElementType& newValue)
  1652. {
  1653. data.enter();
  1654. jassert (((unsigned int) indexToChange) < (unsigned int) numUsed);
  1655. data.elements [indexToChange] = newValue;
  1656. data.exit();
  1657. }
  1658. void addArray (const ElementType* elementsToAdd, int numElementsToAdd)
  1659. {
  1660. data.enter();
  1661. if (numElementsToAdd > 0)
  1662. {
  1663. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  1664. while (--numElementsToAdd >= 0)
  1665. new (data.elements + numUsed++) ElementType (*elementsToAdd++);
  1666. }
  1667. data.exit();
  1668. }
  1669. void swapWithArray (Array <ElementType>& otherArray) throw()
  1670. {
  1671. data.enter();
  1672. otherArray.data.enter();
  1673. data.swapWith (otherArray.data);
  1674. swapVariables (numUsed, otherArray.numUsed);
  1675. otherArray.data.exit();
  1676. data.exit();
  1677. }
  1678. template <class OtherArrayType>
  1679. void addArray (const OtherArrayType& arrayToAddFrom,
  1680. int startIndex = 0,
  1681. int numElementsToAdd = -1)
  1682. {
  1683. arrayToAddFrom.lockArray();
  1684. data.enter();
  1685. if (startIndex < 0)
  1686. {
  1687. jassertfalse
  1688. startIndex = 0;
  1689. }
  1690. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  1691. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  1692. while (--numElementsToAdd >= 0)
  1693. add (arrayToAddFrom.getUnchecked (startIndex++));
  1694. data.exit();
  1695. arrayToAddFrom.unlockArray();
  1696. }
  1697. template <class ElementComparator>
  1698. void addSorted (ElementComparator& comparator, const ElementType& newElement)
  1699. {
  1700. data.enter();
  1701. insert (findInsertIndexInSortedArray (comparator, (ElementType*) data.elements, newElement, 0, numUsed), newElement);
  1702. data.exit();
  1703. }
  1704. template <class ElementComparator>
  1705. int indexOfSorted (ElementComparator& comparator, const ElementType& elementToLookFor) const
  1706. {
  1707. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1708. // avoids getting warning messages about the parameter being unused
  1709. data.enter();
  1710. int start = 0;
  1711. int end = numUsed;
  1712. for (;;)
  1713. {
  1714. if (start >= end)
  1715. {
  1716. data.exit();
  1717. return -1;
  1718. }
  1719. else if (comparator.compareElements (elementToLookFor, data.elements [start]) == 0)
  1720. {
  1721. data.exit();
  1722. return start;
  1723. }
  1724. else
  1725. {
  1726. const int halfway = (start + end) >> 1;
  1727. if (halfway == start)
  1728. {
  1729. data.exit();
  1730. return -1;
  1731. }
  1732. else if (comparator.compareElements (elementToLookFor, data.elements [halfway]) >= 0)
  1733. start = halfway;
  1734. else
  1735. end = halfway;
  1736. }
  1737. }
  1738. }
  1739. ElementType remove (const int indexToRemove)
  1740. {
  1741. data.enter();
  1742. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  1743. {
  1744. --numUsed;
  1745. ElementType* const e = data.elements + indexToRemove;
  1746. ElementType removed (*e);
  1747. e->~ElementType();
  1748. const int numberToShift = numUsed - indexToRemove;
  1749. if (numberToShift > 0)
  1750. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  1751. if ((numUsed << 1) < data.numAllocated)
  1752. minimiseStorageOverheads();
  1753. data.exit();
  1754. return removed;
  1755. }
  1756. else
  1757. {
  1758. data.exit();
  1759. return ElementType();
  1760. }
  1761. }
  1762. void removeValue (const ElementType& valueToRemove)
  1763. {
  1764. data.enter();
  1765. ElementType* e = data.elements;
  1766. for (int i = numUsed; --i >= 0;)
  1767. {
  1768. if (valueToRemove == *e)
  1769. {
  1770. remove ((int) (e - data.elements));
  1771. break;
  1772. }
  1773. ++e;
  1774. }
  1775. data.exit();
  1776. }
  1777. void removeRange (int startIndex, int numberToRemove)
  1778. {
  1779. data.enter();
  1780. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  1781. startIndex = jlimit (0, numUsed, startIndex);
  1782. if (endIndex > startIndex)
  1783. {
  1784. ElementType* e = data.elements + startIndex;
  1785. numberToRemove = endIndex - startIndex;
  1786. for (int i = 0; i < numberToRemove; ++i)
  1787. e[i].~ElementType();
  1788. const int numToShift = numUsed - endIndex;
  1789. if (numToShift > 0)
  1790. memmove (e, e + numberToRemove, numToShift * sizeof (ElementType));
  1791. numUsed -= numberToRemove;
  1792. if ((numUsed << 1) < data.numAllocated)
  1793. minimiseStorageOverheads();
  1794. }
  1795. data.exit();
  1796. }
  1797. void removeLast (int howManyToRemove = 1)
  1798. {
  1799. data.enter();
  1800. if (howManyToRemove > numUsed)
  1801. howManyToRemove = numUsed;
  1802. for (int i = 0; i < howManyToRemove; ++i)
  1803. data.elements [numUsed - i].~ElementType();
  1804. numUsed -= howManyToRemove;
  1805. if ((numUsed << 1) < data.numAllocated)
  1806. minimiseStorageOverheads();
  1807. data.exit();
  1808. }
  1809. template <class OtherArrayType>
  1810. void removeValuesIn (const OtherArrayType& otherArray)
  1811. {
  1812. otherArray.lockArray();
  1813. data.enter();
  1814. if (this == &otherArray)
  1815. {
  1816. clear();
  1817. }
  1818. else
  1819. {
  1820. if (otherArray.size() > 0)
  1821. {
  1822. for (int i = numUsed; --i >= 0;)
  1823. if (otherArray.contains (data.elements [i]))
  1824. remove (i);
  1825. }
  1826. }
  1827. data.exit();
  1828. otherArray.unlockArray();
  1829. }
  1830. template <class OtherArrayType>
  1831. void removeValuesNotIn (const OtherArrayType& otherArray)
  1832. {
  1833. otherArray.lockArray();
  1834. data.enter();
  1835. if (this != &otherArray)
  1836. {
  1837. if (otherArray.size() <= 0)
  1838. {
  1839. clear();
  1840. }
  1841. else
  1842. {
  1843. for (int i = numUsed; --i >= 0;)
  1844. if (! otherArray.contains (data.elements [i]))
  1845. remove (i);
  1846. }
  1847. }
  1848. data.exit();
  1849. otherArray.unlockArray();
  1850. }
  1851. void swap (const int index1,
  1852. const int index2)
  1853. {
  1854. data.enter();
  1855. if (((unsigned int) index1) < (unsigned int) numUsed
  1856. && ((unsigned int) index2) < (unsigned int) numUsed)
  1857. {
  1858. swapVariables (data.elements [index1],
  1859. data.elements [index2]);
  1860. }
  1861. data.exit();
  1862. }
  1863. void move (const int currentIndex, int newIndex) throw()
  1864. {
  1865. if (currentIndex != newIndex)
  1866. {
  1867. data.enter();
  1868. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  1869. {
  1870. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  1871. newIndex = numUsed - 1;
  1872. char tempCopy [sizeof (ElementType)];
  1873. memcpy (tempCopy, data.elements + currentIndex, sizeof (ElementType));
  1874. if (newIndex > currentIndex)
  1875. {
  1876. memmove (data.elements + currentIndex,
  1877. data.elements + currentIndex + 1,
  1878. (newIndex - currentIndex) * sizeof (ElementType));
  1879. }
  1880. else
  1881. {
  1882. memmove (data.elements + newIndex + 1,
  1883. data.elements + newIndex,
  1884. (currentIndex - newIndex) * sizeof (ElementType));
  1885. }
  1886. memcpy (data.elements + newIndex, tempCopy, sizeof (ElementType));
  1887. }
  1888. data.exit();
  1889. }
  1890. }
  1891. void minimiseStorageOverheads()
  1892. {
  1893. data.enter();
  1894. data.shrinkToNoMoreThan (numUsed);
  1895. data.exit();
  1896. }
  1897. void ensureStorageAllocated (const int minNumElements)
  1898. {
  1899. data.enter();
  1900. data.ensureAllocatedSize (minNumElements);
  1901. data.exit();
  1902. }
  1903. template <class ElementComparator>
  1904. void sort (ElementComparator& comparator,
  1905. const bool retainOrderOfEquivalentItems = false) const
  1906. {
  1907. (void) comparator; // if you pass in an object with a static compareElements() method, this
  1908. // avoids getting warning messages about the parameter being unused
  1909. data.enter();
  1910. sortArray (comparator, (ElementType*) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  1911. data.exit();
  1912. }
  1913. void lockArray() const throw()
  1914. {
  1915. data.enter();
  1916. }
  1917. void unlockArray() const throw()
  1918. {
  1919. data.exit();
  1920. }
  1921. juce_UseDebuggingNewOperator
  1922. private:
  1923. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  1924. int numUsed;
  1925. };
  1926. #endif // __JUCE_ARRAY_JUCEHEADER__
  1927. /*** End of inlined file: juce_Array.h ***/
  1928. #endif
  1929. #ifndef __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__
  1930. #endif
  1931. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1932. /*** Start of inlined file: juce_BitArray.h ***/
  1933. #ifndef __JUCE_BITARRAY_JUCEHEADER__
  1934. #define __JUCE_BITARRAY_JUCEHEADER__
  1935. class MemoryBlock;
  1936. class JUCE_API BitArray
  1937. {
  1938. public:
  1939. BitArray() throw();
  1940. BitArray (const unsigned int value) throw();
  1941. BitArray (const int value) throw();
  1942. BitArray (int64 value) throw();
  1943. BitArray (const BitArray& other) throw();
  1944. ~BitArray() throw();
  1945. BitArray& operator= (const BitArray& other) throw();
  1946. bool operator== (const BitArray& other) const throw();
  1947. bool operator!= (const BitArray& other) const throw();
  1948. void clear() throw();
  1949. void clearBit (const int bitNumber) throw();
  1950. void setBit (const int bitNumber) throw();
  1951. void setBit (const int bitNumber,
  1952. const bool shouldBeSet) throw();
  1953. void setRange (int startBit,
  1954. int numBits,
  1955. const bool shouldBeSet) throw();
  1956. void insertBit (const int bitNumber,
  1957. const bool shouldBeSet) throw();
  1958. bool operator[] (const int bit) const throw();
  1959. bool isEmpty() const throw();
  1960. const BitArray getBitRange (int startBit, int numBits) const throw();
  1961. int getBitRangeAsInt (int startBit, int numBits) const throw();
  1962. void setBitRangeAsInt (int startBit, int numBits,
  1963. unsigned int valueToSet) throw();
  1964. void orWith (const BitArray& other) throw();
  1965. void andWith (const BitArray& other) throw();
  1966. void xorWith (const BitArray& other) throw();
  1967. void add (const BitArray& other) throw();
  1968. void subtract (const BitArray& other) throw();
  1969. void multiplyBy (const BitArray& other) throw();
  1970. void divideBy (const BitArray& divisor, BitArray& remainder) throw();
  1971. const BitArray findGreatestCommonDivisor (BitArray other) const throw();
  1972. void modulo (const BitArray& divisor) throw();
  1973. void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
  1974. void inverseModulo (const BitArray& modulus) throw();
  1975. void shiftBits (int howManyBitsLeft,
  1976. int startBit = 0) throw();
  1977. int compare (const BitArray& other) const throw();
  1978. int compareAbsolute (const BitArray& other) const throw();
  1979. bool isNegative() const throw();
  1980. void setNegative (const bool shouldBeNegative) throw();
  1981. void negate() throw();
  1982. int countNumberOfSetBits() const throw();
  1983. int findNextSetBit (int startIndex = 0) const throw();
  1984. int findNextClearBit (int startIndex = 0) const throw();
  1985. int getHighestBit() const throw();
  1986. const String toString (const int base, const int minimumNumCharacters = 1) const throw();
  1987. void parseString (const String& text,
  1988. const int base) throw();
  1989. const MemoryBlock toMemoryBlock() const throw();
  1990. void loadFromMemoryBlock (const MemoryBlock& data) throw();
  1991. juce_UseDebuggingNewOperator
  1992. private:
  1993. void ensureSize (const int numVals) throw();
  1994. HeapBlock <unsigned int> values;
  1995. int numValues, highestBit;
  1996. bool negative;
  1997. };
  1998. #endif // __JUCE_BITARRAY_JUCEHEADER__
  1999. /*** End of inlined file: juce_BitArray.h ***/
  2000. #endif
  2001. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2002. /*** Start of inlined file: juce_DynamicObject.h ***/
  2003. #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2004. #define __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2005. /*** Start of inlined file: juce_NamedValueSet.h ***/
  2006. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2007. #define __JUCE_NAMEDVALUESET_JUCEHEADER__
  2008. /*** Start of inlined file: juce_Variant.h ***/
  2009. #ifndef __JUCE_VARIANT_JUCEHEADER__
  2010. #define __JUCE_VARIANT_JUCEHEADER__
  2011. /*** Start of inlined file: juce_OutputStream.h ***/
  2012. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2013. #define __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2014. /*** Start of inlined file: juce_InputStream.h ***/
  2015. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  2016. #define __JUCE_INPUTSTREAM_JUCEHEADER__
  2017. /*** Start of inlined file: juce_MemoryBlock.h ***/
  2018. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2019. #define __JUCE_MEMORYBLOCK_JUCEHEADER__
  2020. class JUCE_API MemoryBlock
  2021. {
  2022. public:
  2023. MemoryBlock() throw();
  2024. MemoryBlock (const size_t initialSize,
  2025. const bool initialiseToZero = false) throw();
  2026. MemoryBlock (const MemoryBlock& other) throw();
  2027. MemoryBlock (const void* const dataToInitialiseFrom,
  2028. const size_t sizeInBytes) throw();
  2029. ~MemoryBlock() throw();
  2030. MemoryBlock& operator= (const MemoryBlock& other) throw();
  2031. bool operator== (const MemoryBlock& other) const throw();
  2032. bool operator!= (const MemoryBlock& other) const throw();
  2033. bool matches (const void* data, size_t dataSize) const throw();
  2034. template <class DataType>
  2035. operator DataType*() const throw() { return (DataType*) data; }
  2036. void* getData() const throw() { return data; }
  2037. template <typename Type>
  2038. char& operator[] (const Type offset) const throw() { return data [offset]; }
  2039. size_t getSize() const throw() { return size; }
  2040. void setSize (const size_t newSize,
  2041. const bool initialiseNewSpaceToZero = false) throw();
  2042. void ensureSize (const size_t minimumSize,
  2043. const bool initialiseNewSpaceToZero = false) throw();
  2044. void fillWith (const uint8 valueToUse) throw();
  2045. void append (const void* const data,
  2046. const size_t numBytes) throw();
  2047. void swapWith (MemoryBlock& other) throw();
  2048. void copyFrom (const void* srcData,
  2049. int destinationOffset,
  2050. size_t numBytes) throw();
  2051. void copyTo (void* destData,
  2052. int sourceOffset,
  2053. size_t numBytes) const throw();
  2054. void removeSection (size_t startByte, size_t numBytesToRemove) throw();
  2055. const String toString() const throw();
  2056. void loadFromHexString (const String& sourceHexString) throw();
  2057. void setBitRange (size_t bitRangeStart,
  2058. size_t numBits,
  2059. int binaryNumberToApply) throw();
  2060. int getBitRange (size_t bitRangeStart,
  2061. size_t numBitsToRead) const throw();
  2062. const String toBase64Encoding() const throw();
  2063. bool fromBase64Encoding (const String& encodedString) throw();
  2064. juce_UseDebuggingNewOperator
  2065. private:
  2066. HeapBlock <char> data;
  2067. size_t size;
  2068. };
  2069. #endif // __JUCE_MEMORYBLOCK_JUCEHEADER__
  2070. /*** End of inlined file: juce_MemoryBlock.h ***/
  2071. class JUCE_API InputStream
  2072. {
  2073. public:
  2074. virtual ~InputStream() {}
  2075. virtual int64 getTotalLength() = 0;
  2076. virtual bool isExhausted() = 0;
  2077. virtual int read (void* destBuffer,
  2078. int maxBytesToRead) = 0;
  2079. virtual char readByte();
  2080. virtual bool readBool();
  2081. virtual short readShort();
  2082. virtual short readShortBigEndian();
  2083. virtual int readInt();
  2084. virtual int readIntBigEndian();
  2085. virtual int64 readInt64();
  2086. virtual int64 readInt64BigEndian();
  2087. virtual float readFloat();
  2088. virtual float readFloatBigEndian();
  2089. virtual double readDouble();
  2090. virtual double readDoubleBigEndian();
  2091. virtual int readCompressedInt();
  2092. virtual const String readNextLine();
  2093. virtual const String readString();
  2094. virtual const String readEntireStreamAsString();
  2095. virtual int readIntoMemoryBlock (MemoryBlock& destBlock,
  2096. int maxNumBytesToRead = -1);
  2097. virtual int64 getPosition() = 0;
  2098. virtual bool setPosition (int64 newPosition) = 0;
  2099. virtual void skipNextBytes (int64 numBytesToSkip);
  2100. juce_UseDebuggingNewOperator
  2101. protected:
  2102. InputStream() throw() {}
  2103. };
  2104. #endif // __JUCE_INPUTSTREAM_JUCEHEADER__
  2105. /*** End of inlined file: juce_InputStream.h ***/
  2106. class JUCE_API OutputStream
  2107. {
  2108. public:
  2109. virtual ~OutputStream();
  2110. virtual void flush() = 0;
  2111. virtual bool setPosition (int64 newPosition) = 0;
  2112. virtual int64 getPosition() = 0;
  2113. virtual bool write (const void* dataToWrite,
  2114. int howManyBytes) = 0;
  2115. virtual void writeByte (char byte);
  2116. virtual void writeBool (bool boolValue);
  2117. virtual void writeShort (short value);
  2118. virtual void writeShortBigEndian (short value);
  2119. virtual void writeInt (int value);
  2120. virtual void writeIntBigEndian (int value);
  2121. virtual void writeInt64 (int64 value);
  2122. virtual void writeInt64BigEndian (int64 value);
  2123. virtual void writeFloat (float value);
  2124. virtual void writeFloatBigEndian (float value);
  2125. virtual void writeDouble (double value);
  2126. virtual void writeDoubleBigEndian (double value);
  2127. virtual void writeCompressedInt (int value);
  2128. virtual void writeString (const String& text);
  2129. virtual void writeText (const String& text,
  2130. const bool asUnicode,
  2131. const bool writeUnicodeHeaderBytes);
  2132. virtual void printf (const char* format, ...);
  2133. virtual int writeFromInputStream (InputStream& source,
  2134. int maxNumBytesToWrite);
  2135. virtual OutputStream& operator<< (const int number);
  2136. virtual OutputStream& operator<< (const double number);
  2137. virtual OutputStream& operator<< (const char character);
  2138. virtual OutputStream& operator<< (const char* const text);
  2139. virtual OutputStream& operator<< (const juce_wchar* const text);
  2140. virtual OutputStream& operator<< (const String& text);
  2141. juce_UseDebuggingNewOperator
  2142. protected:
  2143. OutputStream() throw();
  2144. };
  2145. #endif // __JUCE_OUTPUTSTREAM_JUCEHEADER__
  2146. /*** End of inlined file: juce_OutputStream.h ***/
  2147. class JUCE_API DynamicObject;
  2148. class JUCE_API var
  2149. {
  2150. public:
  2151. typedef const var (DynamicObject::*MethodFunction) (const var* arguments, int numArguments);
  2152. var() throw();
  2153. ~var() throw();
  2154. static const var null;
  2155. var (const var& valueToCopy);
  2156. var (const int value) throw();
  2157. var (const bool value) throw();
  2158. var (const double value) throw();
  2159. var (const char* const value);
  2160. var (const juce_wchar* const value);
  2161. var (const String& value);
  2162. var (DynamicObject* const object);
  2163. var (MethodFunction method) throw();
  2164. var& operator= (const var& valueToCopy);
  2165. var& operator= (int value);
  2166. var& operator= (bool value);
  2167. var& operator= (double value);
  2168. var& operator= (const char* value);
  2169. var& operator= (const juce_wchar* value);
  2170. var& operator= (const String& value);
  2171. var& operator= (DynamicObject* object);
  2172. var& operator= (MethodFunction method);
  2173. void swapWith (var& other) throw();
  2174. operator int() const;
  2175. operator bool() const;
  2176. operator float() const;
  2177. operator double() const;
  2178. operator const String() const;
  2179. const String toString() const;
  2180. DynamicObject* getObject() const;
  2181. bool isVoid() const throw() { return type == voidType; }
  2182. bool isInt() const throw() { return type == intType; }
  2183. bool isBool() const throw() { return type == boolType; }
  2184. bool isDouble() const throw() { return type == doubleType; }
  2185. bool isString() const throw() { return type == stringType; }
  2186. bool isObject() const throw() { return type == objectType; }
  2187. bool isMethod() const throw() { return type == methodType; }
  2188. bool operator== (const var& other) const throw();
  2189. bool operator!= (const var& other) const throw();
  2190. void writeToStream (OutputStream& output) const;
  2191. static const var readFromStream (InputStream& input);
  2192. class JUCE_API identifier
  2193. {
  2194. public:
  2195. identifier() throw();
  2196. identifier (const char* const name);
  2197. identifier (const String& name);
  2198. ~identifier();
  2199. bool operator== (const identifier& other) const throw()
  2200. {
  2201. jassert (hashCode != other.hashCode || name == other.name); // check for name hash collisions
  2202. return hashCode == other.hashCode;
  2203. }
  2204. String name;
  2205. int hashCode;
  2206. };
  2207. const var operator[] (const identifier& propertyName) const;
  2208. const var call (const identifier& method) const;
  2209. const var call (const identifier& method, const var& arg1) const;
  2210. const var call (const identifier& method, const var& arg1, const var& arg2) const;
  2211. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3);
  2212. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
  2213. const var call (const identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
  2214. const var invoke (const identifier& method, const var* arguments, int numArguments) const;
  2215. const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
  2216. juce_UseDebuggingNewOperator
  2217. private:
  2218. enum Type
  2219. {
  2220. voidType = 0,
  2221. intType,
  2222. boolType,
  2223. doubleType,
  2224. stringType,
  2225. objectType,
  2226. methodType
  2227. };
  2228. union ValueUnion
  2229. {
  2230. int intValue;
  2231. bool boolValue;
  2232. double doubleValue;
  2233. String* stringValue;
  2234. DynamicObject* objectValue;
  2235. MethodFunction methodValue;
  2236. };
  2237. Type type;
  2238. ValueUnion value;
  2239. };
  2240. #endif // __JUCE_VARIANT_JUCEHEADER__
  2241. /*** End of inlined file: juce_Variant.h ***/
  2242. class JUCE_API NamedValueSet
  2243. {
  2244. public:
  2245. NamedValueSet() throw();
  2246. NamedValueSet (const NamedValueSet& other);
  2247. NamedValueSet& operator= (const NamedValueSet& other);
  2248. ~NamedValueSet();
  2249. int size() const throw();
  2250. const var& operator[] (const var::identifier& name) const;
  2251. const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const;
  2252. var* getItem (const var::identifier& name) const;
  2253. bool set (const var::identifier& name, const var& newValue);
  2254. bool contains (const var::identifier& name) const;
  2255. bool remove (const var::identifier& name);
  2256. const var::identifier getName (int index) const;
  2257. void clear();
  2258. juce_UseDebuggingNewOperator
  2259. private:
  2260. struct NamedValue
  2261. {
  2262. NamedValue() throw();
  2263. NamedValue (const var::identifier& name, const var& value);
  2264. var::identifier name;
  2265. var value;
  2266. };
  2267. Array <NamedValue> values;
  2268. };
  2269. #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__
  2270. /*** End of inlined file: juce_NamedValueSet.h ***/
  2271. /*** Start of inlined file: juce_ReferenceCountedObject.h ***/
  2272. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2273. #define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2274. /*** Start of inlined file: juce_Atomic.h ***/
  2275. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  2276. #define __JUCE_ATOMIC_JUCEHEADER__
  2277. class JUCE_API Atomic
  2278. {
  2279. public:
  2280. static void increment (int32& variable);
  2281. static int32 incrementAndReturn (int32& variable);
  2282. static void decrement (int32& variable);
  2283. static int32 decrementAndReturn (int32& variable);
  2284. static int32 compareAndExchange (int32& destination, int32 newValue, int32 requiredCurrentValue);
  2285. static void* swapPointers (void* volatile* value1, void* value2);
  2286. };
  2287. #if (JUCE_MAC || JUCE_IPHONE) // Mac and iPhone...
  2288. inline void Atomic::increment (int32& variable) { OSAtomicIncrement32 ((int32_t*) &variable); }
  2289. inline int32 Atomic::incrementAndReturn (int32& variable) { return OSAtomicIncrement32 ((int32_t*) &variable); }
  2290. inline void Atomic::decrement (int32& variable) { OSAtomicDecrement32 ((int32_t*) &variable); }
  2291. inline int32 Atomic::decrementAndReturn (int32& variable) { return OSAtomicDecrement32 ((int32_t*) &variable); }
  2292. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2293. { return OSAtomicCompareAndSwap32Barrier (oldValue, newValue, (int32_t*) &destination); }
  2294. inline void* Atomic::swapPointers (void* volatile* value1, void* volatile value2)
  2295. {
  2296. void* currentVal = *value1;
  2297. while (! OSAtomicCompareAndSwapPtr (currentVal, value2, value1)) { currentVal = *value1; }
  2298. return currentVal;
  2299. }
  2300. #elif JUCE_LINUX // Linux...
  2301. inline void Atomic::increment (int32& variable) { __sync_add_and_fetch (&variable, 1); }
  2302. inline int32 Atomic::incrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, 1); }
  2303. inline void Atomic::decrement (int32& variable) { __sync_add_and_fetch (&variable, -1); }
  2304. inline int32 Atomic::decrementAndReturn (int32& variable) { return __sync_add_and_fetch (&variable, -1); }
  2305. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2306. { return __sync_val_compare_and_swap (&destination, oldValue, newValue); }
  2307. inline void* Atomic::swapPointers (void* volatile* value1, void* volatile value2)
  2308. {
  2309. void* currentVal = *value1;
  2310. while (! __sync_bool_compare_and_swap (&value1, currentVal, value2)) { currentVal = *value1; }
  2311. return currentVal;
  2312. }
  2313. #elif JUCE_USE_INTRINSICS // Windows...
  2314. // (If JUCE_USE_INTRINSICS isn't enabled, a fallback version of these methods is
  2315. // declared in juce_win32_Threads.cpp)
  2316. #pragma intrinsic (_InterlockedIncrement)
  2317. #pragma intrinsic (_InterlockedDecrement)
  2318. #pragma intrinsic (_InterlockedCompareExchange)
  2319. inline void Atomic::increment (int32& variable) { _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2320. inline int32 Atomic::incrementAndReturn (int32& variable) { return _InterlockedIncrement (reinterpret_cast <volatile long*> (&variable)); }
  2321. inline void Atomic::decrement (int32& variable) { _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2322. inline int32 Atomic::decrementAndReturn (int32& variable) { return _InterlockedDecrement (reinterpret_cast <volatile long*> (&variable)); }
  2323. inline int32 Atomic::compareAndExchange (int32& destination, int32 newValue, int32 oldValue)
  2324. { return _InterlockedCompareExchange (reinterpret_cast <volatile long*> (&destination), newValue, oldValue); }
  2325. #endif
  2326. #endif // __JUCE_ATOMIC_JUCEHEADER__
  2327. /*** End of inlined file: juce_Atomic.h ***/
  2328. class JUCE_API ReferenceCountedObject
  2329. {
  2330. public:
  2331. inline void incReferenceCount() throw()
  2332. {
  2333. Atomic::increment (refCounts);
  2334. jassert (refCounts > 0);
  2335. }
  2336. inline void decReferenceCount() throw()
  2337. {
  2338. jassert (refCounts > 0);
  2339. if (Atomic::decrementAndReturn (refCounts) == 0)
  2340. delete this;
  2341. }
  2342. inline int getReferenceCount() const throw()
  2343. {
  2344. return refCounts;
  2345. }
  2346. protected:
  2347. ReferenceCountedObject()
  2348. : refCounts (0)
  2349. {
  2350. }
  2351. virtual ~ReferenceCountedObject()
  2352. {
  2353. // it's dangerous to delete an object that's still referenced by something else!
  2354. jassert (refCounts == 0);
  2355. }
  2356. private:
  2357. int refCounts;
  2358. };
  2359. template <class ReferenceCountedObjectClass>
  2360. class ReferenceCountedObjectPtr
  2361. {
  2362. public:
  2363. inline ReferenceCountedObjectPtr() throw()
  2364. : referencedObject (0)
  2365. {
  2366. }
  2367. inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) throw()
  2368. : referencedObject (refCountedObject)
  2369. {
  2370. if (refCountedObject != 0)
  2371. refCountedObject->incReferenceCount();
  2372. }
  2373. inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other) throw()
  2374. : referencedObject (other.referencedObject)
  2375. {
  2376. if (referencedObject != 0)
  2377. referencedObject->incReferenceCount();
  2378. }
  2379. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& other)
  2380. {
  2381. ReferenceCountedObjectClass* const newObject = other.referencedObject;
  2382. if (newObject != referencedObject)
  2383. {
  2384. if (newObject != 0)
  2385. newObject->incReferenceCount();
  2386. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2387. referencedObject = newObject;
  2388. if (oldObject != 0)
  2389. oldObject->decReferenceCount();
  2390. }
  2391. return *this;
  2392. }
  2393. const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& operator= (ReferenceCountedObjectClass* const newObject)
  2394. {
  2395. if (referencedObject != newObject)
  2396. {
  2397. if (newObject != 0)
  2398. newObject->incReferenceCount();
  2399. ReferenceCountedObjectClass* const oldObject = referencedObject;
  2400. referencedObject = newObject;
  2401. if (oldObject != 0)
  2402. oldObject->decReferenceCount();
  2403. }
  2404. return *this;
  2405. }
  2406. inline ~ReferenceCountedObjectPtr()
  2407. {
  2408. if (referencedObject != 0)
  2409. referencedObject->decReferenceCount();
  2410. }
  2411. inline operator ReferenceCountedObjectClass*() const throw()
  2412. {
  2413. return referencedObject;
  2414. }
  2415. inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
  2416. {
  2417. return referencedObject == object;
  2418. }
  2419. inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
  2420. {
  2421. return referencedObject != object;
  2422. }
  2423. // the -> operator is called on the referenced object
  2424. inline ReferenceCountedObjectClass* operator->() const throw()
  2425. {
  2426. return referencedObject;
  2427. }
  2428. private:
  2429. ReferenceCountedObjectClass* referencedObject;
  2430. };
  2431. #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  2432. /*** End of inlined file: juce_ReferenceCountedObject.h ***/
  2433. class JUCE_API DynamicObject : public ReferenceCountedObject
  2434. {
  2435. public:
  2436. DynamicObject();
  2437. virtual ~DynamicObject();
  2438. virtual bool hasProperty (const var::identifier& propertyName) const;
  2439. virtual const var getProperty (const var::identifier& propertyName) const;
  2440. virtual void setProperty (const var::identifier& propertyName, const var& newValue);
  2441. virtual void removeProperty (const var::identifier& propertyName);
  2442. virtual bool hasMethod (const var::identifier& methodName) const;
  2443. virtual const var invokeMethod (const var::identifier& methodName,
  2444. const var* parameters,
  2445. int numParameters);
  2446. void setMethod (const var::identifier& methodName,
  2447. var::MethodFunction methodFunction);
  2448. void clear();
  2449. juce_UseDebuggingNewOperator
  2450. private:
  2451. NamedValueSet properties;
  2452. };
  2453. #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__
  2454. /*** End of inlined file: juce_DynamicObject.h ***/
  2455. #endif
  2456. #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__
  2457. #endif
  2458. #ifndef __JUCE_HEAPBLOCK_JUCEHEADER__
  2459. #endif
  2460. #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__
  2461. #endif
  2462. #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__
  2463. #endif
  2464. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2465. /*** Start of inlined file: juce_OwnedArray.h ***/
  2466. #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__
  2467. #define __JUCE_OWNEDARRAY_JUCEHEADER__
  2468. /*** Start of inlined file: juce_ScopedPointer.h ***/
  2469. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2470. #define __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2471. template <class ObjectType>
  2472. class JUCE_API ScopedPointer
  2473. {
  2474. public:
  2475. inline ScopedPointer() throw() : object (0)
  2476. {
  2477. }
  2478. inline ScopedPointer (ObjectType* const objectToTakePossessionOf) throw()
  2479. : object (objectToTakePossessionOf)
  2480. {
  2481. }
  2482. ScopedPointer (ScopedPointer& objectToTransferFrom) throw()
  2483. : object (objectToTransferFrom.object)
  2484. {
  2485. objectToTransferFrom.object = 0;
  2486. }
  2487. inline ~ScopedPointer() { delete object; }
  2488. const ScopedPointer& operator= (ScopedPointer& objectToTransferFrom)
  2489. {
  2490. if (this != objectToTransferFrom.getAddress())
  2491. {
  2492. // Two ScopedPointers should never be able to refer to the same object - if
  2493. // this happens, you must have done something dodgy!
  2494. jassert (object != objectToTransferFrom.object);
  2495. ObjectType* const oldObject = object;
  2496. object = objectToTransferFrom.object;
  2497. objectToTransferFrom.object = 0;
  2498. delete oldObject;
  2499. }
  2500. return *this;
  2501. }
  2502. const ScopedPointer& operator= (ObjectType* const newObjectToTakePossessionOf)
  2503. {
  2504. if (object != newObjectToTakePossessionOf)
  2505. {
  2506. ObjectType* const oldObject = object;
  2507. object = newObjectToTakePossessionOf;
  2508. delete oldObject;
  2509. }
  2510. return *this;
  2511. }
  2512. inline operator ObjectType*() const throw() { return object; }
  2513. inline ObjectType& operator*() const throw() { return *object; }
  2514. inline ObjectType* operator->() const throw() { return object; }
  2515. template <class CastType>
  2516. inline operator CastType*() const throw() { return static_cast <CastType*> (object); }
  2517. inline ObjectType** operator&() const throw() { return (ObjectType**) &object; }
  2518. ObjectType* release() throw() { ObjectType* const o = object; object = 0; return o; }
  2519. inline bool operator== (const ObjectType* const otherPointer) const throw() { return otherPointer == object; }
  2520. inline bool operator!= (const ObjectType* const otherPointer) const throw() { return otherPointer != object; }
  2521. void swapWith (ScopedPointer <ObjectType>& other) throw()
  2522. {
  2523. // Two ScopedPointers should never be able to refer to the same object - if
  2524. // this happens, you must have done something dodgy!
  2525. jassert (object != other.object);
  2526. swapVariables (object, other.object);
  2527. }
  2528. private:
  2529. ObjectType* object;
  2530. // (Required as an alternative to the overloaded & operator).
  2531. ScopedPointer* getAddress() const throw() { return this; }
  2532. };
  2533. #endif // __JUCE_SCOPEDPOINTER_JUCEHEADER__
  2534. /*** End of inlined file: juce_ScopedPointer.h ***/
  2535. template <class ObjectClass,
  2536. class TypeOfCriticalSectionToUse = DummyCriticalSection>
  2537. class OwnedArray
  2538. {
  2539. public:
  2540. OwnedArray() throw()
  2541. : numUsed (0)
  2542. {
  2543. }
  2544. ~OwnedArray()
  2545. {
  2546. clear (true);
  2547. }
  2548. void clear (const bool deleteObjects = true)
  2549. {
  2550. data.enter();
  2551. if (deleteObjects)
  2552. {
  2553. while (numUsed > 0)
  2554. delete data.elements [--numUsed];
  2555. }
  2556. data.setAllocatedSize (0);
  2557. numUsed = 0;
  2558. data.exit();
  2559. }
  2560. inline int size() const throw()
  2561. {
  2562. return numUsed;
  2563. }
  2564. inline ObjectClass* operator[] (const int index) const throw()
  2565. {
  2566. data.enter();
  2567. ObjectClass* const result = (((unsigned int) index) < (unsigned int) numUsed)
  2568. ? data.elements [index]
  2569. : (ObjectClass*) 0;
  2570. data.exit();
  2571. return result;
  2572. }
  2573. inline ObjectClass* getUnchecked (const int index) const throw()
  2574. {
  2575. data.enter();
  2576. jassert (((unsigned int) index) < (unsigned int) numUsed);
  2577. ObjectClass* const result = data.elements [index];
  2578. data.exit();
  2579. return result;
  2580. }
  2581. inline ObjectClass* getFirst() const throw()
  2582. {
  2583. data.enter();
  2584. ObjectClass* const result = (numUsed > 0) ? data.elements [0]
  2585. : (ObjectClass*) 0;
  2586. data.exit();
  2587. return result;
  2588. }
  2589. inline ObjectClass* getLast() const throw()
  2590. {
  2591. data.enter();
  2592. ObjectClass* const result = (numUsed > 0) ? data.elements [numUsed - 1]
  2593. : (ObjectClass*) 0;
  2594. data.exit();
  2595. return result;
  2596. }
  2597. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  2598. {
  2599. int result = -1;
  2600. data.enter();
  2601. ObjectClass* const* e = data.elements;
  2602. for (int i = numUsed; --i >= 0;)
  2603. {
  2604. if (objectToLookFor == *e)
  2605. {
  2606. result = (int) (e - data.elements);
  2607. break;
  2608. }
  2609. ++e;
  2610. }
  2611. data.exit();
  2612. return result;
  2613. }
  2614. bool contains (const ObjectClass* const objectToLookFor) const throw()
  2615. {
  2616. data.enter();
  2617. ObjectClass* const* e = data.elements;
  2618. int i = numUsed;
  2619. while (i >= 4)
  2620. {
  2621. if (objectToLookFor == *e
  2622. || objectToLookFor == *++e
  2623. || objectToLookFor == *++e
  2624. || objectToLookFor == *++e)
  2625. {
  2626. data.exit();
  2627. return true;
  2628. }
  2629. i -= 4;
  2630. ++e;
  2631. }
  2632. while (i > 0)
  2633. {
  2634. if (objectToLookFor == *e)
  2635. {
  2636. data.exit();
  2637. return true;
  2638. }
  2639. --i;
  2640. ++e;
  2641. }
  2642. data.exit();
  2643. return false;
  2644. }
  2645. void add (const ObjectClass* const newObject) throw()
  2646. {
  2647. data.enter();
  2648. data.ensureAllocatedSize (numUsed + 1);
  2649. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2650. data.exit();
  2651. }
  2652. void insert (int indexToInsertAt,
  2653. const ObjectClass* const newObject) throw()
  2654. {
  2655. if (indexToInsertAt >= 0)
  2656. {
  2657. data.enter();
  2658. if (indexToInsertAt > numUsed)
  2659. indexToInsertAt = numUsed;
  2660. data.ensureAllocatedSize (numUsed + 1);
  2661. ObjectClass** const e = data.elements + indexToInsertAt;
  2662. const int numToMove = numUsed - indexToInsertAt;
  2663. if (numToMove > 0)
  2664. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  2665. *e = const_cast <ObjectClass*> (newObject);
  2666. ++numUsed;
  2667. data.exit();
  2668. }
  2669. else
  2670. {
  2671. add (newObject);
  2672. }
  2673. }
  2674. void addIfNotAlreadyThere (const ObjectClass* const newObject) throw()
  2675. {
  2676. data.enter();
  2677. if (! contains (newObject))
  2678. add (newObject);
  2679. data.exit();
  2680. }
  2681. void set (const int indexToChange,
  2682. const ObjectClass* const newObject,
  2683. const bool deleteOldElement = true)
  2684. {
  2685. if (indexToChange >= 0)
  2686. {
  2687. ScopedPointer <ObjectClass> toDelete;
  2688. data.enter();
  2689. if (indexToChange < numUsed)
  2690. {
  2691. if (deleteOldElement)
  2692. {
  2693. toDelete = data.elements [indexToChange];
  2694. if (toDelete == newObject)
  2695. toDelete = 0;
  2696. }
  2697. data.elements [indexToChange] = const_cast <ObjectClass*> (newObject);
  2698. }
  2699. else
  2700. {
  2701. data.ensureAllocatedSize (numUsed + 1);
  2702. data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
  2703. }
  2704. data.exit();
  2705. }
  2706. }
  2707. template <class ElementComparator>
  2708. void addSorted (ElementComparator& comparator,
  2709. ObjectClass* const newObject) throw()
  2710. {
  2711. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2712. // avoids getting warning messages about the parameter being unused
  2713. data.enter();
  2714. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  2715. data.exit();
  2716. }
  2717. template <class ElementComparator>
  2718. int indexOfSorted (ElementComparator& comparator,
  2719. const ObjectClass* const objectToLookFor) const throw()
  2720. {
  2721. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2722. // avoids getting warning messages about the parameter being unused
  2723. data.enter();
  2724. int start = 0;
  2725. int end = numUsed;
  2726. for (;;)
  2727. {
  2728. if (start >= end)
  2729. {
  2730. data.exit();
  2731. return -1;
  2732. }
  2733. else if (comparator.compareElements (objectToLookFor, data.elements [start]) == 0)
  2734. {
  2735. data.exit();
  2736. return start;
  2737. }
  2738. else
  2739. {
  2740. const int halfway = (start + end) >> 1;
  2741. if (halfway == start)
  2742. {
  2743. data.exit();
  2744. return -1;
  2745. }
  2746. else if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
  2747. start = halfway;
  2748. else
  2749. end = halfway;
  2750. }
  2751. }
  2752. }
  2753. void remove (const int indexToRemove,
  2754. const bool deleteObject = true)
  2755. {
  2756. ScopedPointer <ObjectClass> toDelete;
  2757. data.enter();
  2758. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  2759. {
  2760. ObjectClass** const e = data.elements + indexToRemove;
  2761. if (deleteObject)
  2762. toDelete = *e;
  2763. --numUsed;
  2764. const int numToShift = numUsed - indexToRemove;
  2765. if (numToShift > 0)
  2766. memmove (e, e + 1, numToShift * sizeof (ObjectClass*));
  2767. if ((numUsed << 1) < data.numAllocated)
  2768. minimiseStorageOverheads();
  2769. }
  2770. data.exit();
  2771. }
  2772. void removeObject (const ObjectClass* const objectToRemove,
  2773. const bool deleteObject = true)
  2774. {
  2775. data.enter();
  2776. ObjectClass** e = data.elements;
  2777. for (int i = numUsed; --i >= 0;)
  2778. {
  2779. if (objectToRemove == *e)
  2780. {
  2781. remove ((int) (e - data.elements), deleteObject);
  2782. break;
  2783. }
  2784. ++e;
  2785. }
  2786. data.exit();
  2787. }
  2788. void removeRange (int startIndex,
  2789. const int numberToRemove,
  2790. const bool deleteObjects = true)
  2791. {
  2792. data.enter();
  2793. const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
  2794. startIndex = jlimit (0, numUsed, startIndex);
  2795. if (endIndex > startIndex)
  2796. {
  2797. if (deleteObjects)
  2798. {
  2799. for (int i = startIndex; i < endIndex; ++i)
  2800. {
  2801. delete data.elements [i];
  2802. data.elements [i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  2803. }
  2804. }
  2805. const int rangeSize = endIndex - startIndex;
  2806. ObjectClass** e = data.elements + startIndex;
  2807. int numToShift = numUsed - endIndex;
  2808. numUsed -= rangeSize;
  2809. while (--numToShift >= 0)
  2810. {
  2811. *e = e [rangeSize];
  2812. ++e;
  2813. }
  2814. if ((numUsed << 1) < data.numAllocated)
  2815. minimiseStorageOverheads();
  2816. }
  2817. data.exit();
  2818. }
  2819. void removeLast (int howManyToRemove = 1,
  2820. const bool deleteObjects = true)
  2821. {
  2822. data.enter();
  2823. if (howManyToRemove >= numUsed)
  2824. {
  2825. clear (deleteObjects);
  2826. }
  2827. else
  2828. {
  2829. while (--howManyToRemove >= 0)
  2830. remove (numUsed - 1, deleteObjects);
  2831. }
  2832. data.exit();
  2833. }
  2834. void swap (const int index1,
  2835. const int index2) throw()
  2836. {
  2837. data.enter();
  2838. if (((unsigned int) index1) < (unsigned int) numUsed
  2839. && ((unsigned int) index2) < (unsigned int) numUsed)
  2840. {
  2841. swapVariables (data.elements [index1],
  2842. data.elements [index2]);
  2843. }
  2844. data.exit();
  2845. }
  2846. void move (const int currentIndex,
  2847. int newIndex) throw()
  2848. {
  2849. if (currentIndex != newIndex)
  2850. {
  2851. data.enter();
  2852. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  2853. {
  2854. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  2855. newIndex = numUsed - 1;
  2856. ObjectClass* const value = data.elements [currentIndex];
  2857. if (newIndex > currentIndex)
  2858. {
  2859. memmove (data.elements + currentIndex,
  2860. data.elements + currentIndex + 1,
  2861. (newIndex - currentIndex) * sizeof (ObjectClass*));
  2862. }
  2863. else
  2864. {
  2865. memmove (data.elements + newIndex + 1,
  2866. data.elements + newIndex,
  2867. (currentIndex - newIndex) * sizeof (ObjectClass*));
  2868. }
  2869. data.elements [newIndex] = value;
  2870. }
  2871. data.exit();
  2872. }
  2873. }
  2874. void swapWithArray (OwnedArray <ObjectClass>& otherArray) throw()
  2875. {
  2876. data.enter();
  2877. otherArray.data.enter();
  2878. data.swapWith (otherArray.data);
  2879. swapVariables (numUsed, otherArray.numUsed);
  2880. otherArray.data.exit();
  2881. data.exit();
  2882. }
  2883. void minimiseStorageOverheads() throw()
  2884. {
  2885. data.enter();
  2886. data.shrinkToNoMoreThan (numUsed);
  2887. data.exit();
  2888. }
  2889. void ensureStorageAllocated (const int minNumElements) throw()
  2890. {
  2891. data.enter();
  2892. data.ensureAllocatedSize (minNumElements);
  2893. data.exit();
  2894. }
  2895. template <class ElementComparator>
  2896. void sort (ElementComparator& comparator,
  2897. const bool retainOrderOfEquivalentItems = false) const throw()
  2898. {
  2899. (void) comparator; // if you pass in an object with a static compareElements() method, this
  2900. // avoids getting warning messages about the parameter being unused
  2901. data.enter();
  2902. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  2903. data.exit();
  2904. }
  2905. void lockArray() const throw()
  2906. {
  2907. data.enter();
  2908. }
  2909. void unlockArray() const throw()
  2910. {
  2911. data.exit();
  2912. }
  2913. juce_UseDebuggingNewOperator
  2914. private:
  2915. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  2916. int numUsed;
  2917. // disallow copy constructor and assignment
  2918. OwnedArray (const OwnedArray&);
  2919. OwnedArray& operator= (const OwnedArray&);
  2920. };
  2921. #endif // __JUCE_OWNEDARRAY_JUCEHEADER__
  2922. /*** End of inlined file: juce_OwnedArray.h ***/
  2923. #endif
  2924. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2925. /*** Start of inlined file: juce_PropertySet.h ***/
  2926. #ifndef __JUCE_PROPERTYSET_JUCEHEADER__
  2927. #define __JUCE_PROPERTYSET_JUCEHEADER__
  2928. /*** Start of inlined file: juce_StringPairArray.h ***/
  2929. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2930. #define __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  2931. /*** Start of inlined file: juce_StringArray.h ***/
  2932. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  2933. #define __JUCE_STRINGARRAY_JUCEHEADER__
  2934. #ifndef DOXYGEN
  2935. // (used in StringArray::appendNumbersToDuplicates)
  2936. static const tchar* const defaultPreNumberString = JUCE_T(" (");
  2937. static const tchar* const defaultPostNumberString = JUCE_T(")");
  2938. #endif
  2939. class JUCE_API StringArray
  2940. {
  2941. public:
  2942. StringArray() throw();
  2943. StringArray (const StringArray& other);
  2944. StringArray (const juce_wchar** const strings,
  2945. const int numberOfStrings);
  2946. StringArray (const char** const strings,
  2947. const int numberOfStrings);
  2948. explicit StringArray (const juce_wchar** const strings);
  2949. explicit StringArray (const char** const strings);
  2950. ~StringArray();
  2951. const StringArray& operator= (const StringArray& other);
  2952. bool operator== (const StringArray& other) const;
  2953. bool operator!= (const StringArray& other) const;
  2954. inline int size() const throw() { return strings.size(); };
  2955. const String& operator[] (const int index) const throw();
  2956. bool contains (const String& stringToLookFor,
  2957. const bool ignoreCase = false) const;
  2958. int indexOf (const String& stringToLookFor,
  2959. const bool ignoreCase = false,
  2960. int startIndex = 0) const;
  2961. void add (const String& stringToAdd);
  2962. void insert (const int index, const String& stringToAdd);
  2963. void addIfNotAlreadyThere (const String& stringToAdd, const bool ignoreCase = false);
  2964. void set (const int index, const String& newString);
  2965. void addArray (const StringArray& other,
  2966. int startIndex = 0,
  2967. int numElementsToAdd = -1);
  2968. int addTokens (const tchar* const stringToTokenise,
  2969. const bool preserveQuotedStrings);
  2970. int addTokens (const tchar* const stringToTokenise,
  2971. const tchar* breakCharacters,
  2972. const tchar* quoteCharacters);
  2973. int addLines (const tchar* stringToBreakUp);
  2974. void clear();
  2975. void remove (const int index);
  2976. void removeString (const String& stringToRemove,
  2977. const bool ignoreCase = false);
  2978. void removeDuplicates (const bool ignoreCase);
  2979. void removeEmptyStrings (const bool removeWhitespaceStrings = true);
  2980. void move (const int currentIndex, int newIndex) throw();
  2981. void trim();
  2982. void appendNumbersToDuplicates (const bool ignoreCaseWhenComparing,
  2983. const bool appendNumberToFirstInstance,
  2984. const tchar* const preNumberString = defaultPreNumberString,
  2985. const tchar* const postNumberString = defaultPostNumberString);
  2986. const String joinIntoString (const String& separatorString,
  2987. int startIndex = 0,
  2988. int numberOfElements = -1) const;
  2989. void sort (const bool ignoreCase);
  2990. void minimiseStorageOverheads();
  2991. juce_UseDebuggingNewOperator
  2992. private:
  2993. Array <String> strings;
  2994. };
  2995. #endif // __JUCE_STRINGARRAY_JUCEHEADER__
  2996. /*** End of inlined file: juce_StringArray.h ***/
  2997. class JUCE_API StringPairArray
  2998. {
  2999. public:
  3000. StringPairArray (const bool ignoreCaseWhenComparingKeys = true) throw();
  3001. StringPairArray (const StringPairArray& other) throw();
  3002. ~StringPairArray() throw();
  3003. const StringPairArray& operator= (const StringPairArray& other) throw();
  3004. bool operator== (const StringPairArray& other) const throw();
  3005. bool operator!= (const StringPairArray& other) const throw();
  3006. const String& operator[] (const String& key) const throw();
  3007. const String getValue (const String& key, const String& defaultReturnValue) const;
  3008. const StringArray& getAllKeys() const throw() { return keys; }
  3009. const StringArray& getAllValues() const throw() { return values; }
  3010. inline int size() const throw() { return keys.size(); };
  3011. void set (const String& key,
  3012. const String& value) throw();
  3013. void addArray (const StringPairArray& other);
  3014. void clear() throw();
  3015. void remove (const String& key) throw();
  3016. void remove (const int index) throw();
  3017. void setIgnoresCase (const bool shouldIgnoreCase) throw();
  3018. const String getDescription() const;
  3019. void minimiseStorageOverheads() throw();
  3020. juce_UseDebuggingNewOperator
  3021. private:
  3022. StringArray keys, values;
  3023. bool ignoreCase;
  3024. };
  3025. #endif // __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  3026. /*** End of inlined file: juce_StringPairArray.h ***/
  3027. /*** Start of inlined file: juce_XmlElement.h ***/
  3028. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  3029. #define __JUCE_XMLELEMENT_JUCEHEADER__
  3030. /*** Start of inlined file: juce_File.h ***/
  3031. #ifndef __JUCE_FILE_JUCEHEADER__
  3032. #define __JUCE_FILE_JUCEHEADER__
  3033. /*** Start of inlined file: juce_Time.h ***/
  3034. #ifndef __JUCE_TIME_JUCEHEADER__
  3035. #define __JUCE_TIME_JUCEHEADER__
  3036. /*** Start of inlined file: juce_RelativeTime.h ***/
  3037. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  3038. #define __JUCE_RELATIVETIME_JUCEHEADER__
  3039. class JUCE_API RelativeTime
  3040. {
  3041. public:
  3042. explicit RelativeTime (const double seconds = 0.0) throw();
  3043. RelativeTime (const RelativeTime& other) throw();
  3044. const RelativeTime& operator= (const RelativeTime& other) throw();
  3045. ~RelativeTime() throw();
  3046. static const RelativeTime milliseconds (const int milliseconds) throw();
  3047. static const RelativeTime milliseconds (const int64 milliseconds) throw();
  3048. static const RelativeTime minutes (const double numberOfMinutes) throw();
  3049. static const RelativeTime hours (const double numberOfHours) throw();
  3050. static const RelativeTime days (const double numberOfDays) throw();
  3051. static const RelativeTime weeks (const double numberOfWeeks) throw();
  3052. int64 inMilliseconds() const throw();
  3053. double inSeconds() const throw() { return seconds; }
  3054. double inMinutes() const throw();
  3055. double inHours() const throw();
  3056. double inDays() const throw();
  3057. double inWeeks() const throw();
  3058. const String getDescription (const String& returnValueForZeroTime = JUCE_T("0")) const throw();
  3059. bool operator== (const RelativeTime& other) const throw();
  3060. bool operator!= (const RelativeTime& other) const throw();
  3061. bool operator> (const RelativeTime& other) const throw();
  3062. bool operator< (const RelativeTime& other) const throw();
  3063. bool operator>= (const RelativeTime& other) const throw();
  3064. bool operator<= (const RelativeTime& other) const throw();
  3065. const RelativeTime operator+ (const RelativeTime& timeToAdd) const throw();
  3066. const RelativeTime operator- (const RelativeTime& timeToSubtract) const throw();
  3067. const RelativeTime operator+ (const double secondsToAdd) const throw();
  3068. const RelativeTime operator- (const double secondsToSubtract) const throw();
  3069. const RelativeTime& operator+= (const RelativeTime& timeToAdd) throw();
  3070. const RelativeTime& operator-= (const RelativeTime& timeToSubtract) throw();
  3071. const RelativeTime& operator+= (const double secondsToAdd) throw();
  3072. const RelativeTime& operator-= (const double secondsToSubtract) throw();
  3073. juce_UseDebuggingNewOperator
  3074. private:
  3075. double seconds;
  3076. };
  3077. #endif // __JUCE_RELATIVETIME_JUCEHEADER__
  3078. /*** End of inlined file: juce_RelativeTime.h ***/
  3079. class JUCE_API Time
  3080. {
  3081. public:
  3082. Time() throw();
  3083. Time (const Time& other) throw();
  3084. Time (const int64 millisecondsSinceEpoch) throw();
  3085. Time (const int year,
  3086. const int month,
  3087. const int day,
  3088. const int hours,
  3089. const int minutes,
  3090. const int seconds = 0,
  3091. const int milliseconds = 0,
  3092. const bool useLocalTime = true) throw();
  3093. ~Time() throw();
  3094. const Time& operator= (const Time& other) throw();
  3095. static const Time JUCE_CALLTYPE getCurrentTime() throw();
  3096. int64 toMilliseconds() const throw() { return millisSinceEpoch; }
  3097. int getYear() const throw();
  3098. int getMonth() const throw();
  3099. const String getMonthName (const bool threeLetterVersion) const throw();
  3100. int getDayOfMonth() const throw();
  3101. int getDayOfWeek() const throw();
  3102. const String getWeekdayName (const bool threeLetterVersion) const throw();
  3103. int getHours() const throw();
  3104. bool isAfternoon() const throw();
  3105. int getHoursInAmPmFormat() const throw();
  3106. int getMinutes() const throw();
  3107. int getSeconds() const throw();
  3108. int getMilliseconds() const throw();
  3109. bool isDaylightSavingTime() const throw();
  3110. const String getTimeZone() const throw();
  3111. const String toString (const bool includeDate,
  3112. const bool includeTime,
  3113. const bool includeSeconds = true,
  3114. const bool use24HourClock = false) const throw();
  3115. const String formatted (const tchar* const format) const throw();
  3116. const Time operator+ (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch + delta.inMilliseconds()); }
  3117. const Time operator- (const RelativeTime& delta) const throw() { return Time (millisSinceEpoch - delta.inMilliseconds()); }
  3118. const RelativeTime operator- (const Time& other) const throw() { return RelativeTime::milliseconds (millisSinceEpoch - other.millisSinceEpoch); }
  3119. bool operator== (const Time& other) const throw() { return millisSinceEpoch == other.millisSinceEpoch; }
  3120. bool operator!= (const Time& other) const throw() { return millisSinceEpoch != other.millisSinceEpoch; }
  3121. bool operator< (const Time& other) const throw() { return millisSinceEpoch < other.millisSinceEpoch; }
  3122. bool operator<= (const Time& other) const throw() { return millisSinceEpoch <= other.millisSinceEpoch; }
  3123. bool operator> (const Time& other) const throw() { return millisSinceEpoch > other.millisSinceEpoch; }
  3124. bool operator>= (const Time& other) const throw() { return millisSinceEpoch >= other.millisSinceEpoch; }
  3125. bool setSystemTimeToThisTime() const throw();
  3126. static const String getWeekdayName (int dayNumber,
  3127. const bool threeLetterVersion) throw();
  3128. static const String getMonthName (int monthNumber,
  3129. const bool threeLetterVersion) throw();
  3130. // Static methods for getting system timers directly..
  3131. static int64 currentTimeMillis() throw();
  3132. static uint32 getMillisecondCounter() throw();
  3133. static double getMillisecondCounterHiRes() throw();
  3134. static void waitForMillisecondCounter (const uint32 targetTime) throw();
  3135. static uint32 getApproximateMillisecondCounter() throw();
  3136. // High-resolution timers..
  3137. static int64 getHighResolutionTicks() throw();
  3138. static int64 getHighResolutionTicksPerSecond() throw();
  3139. static double highResolutionTicksToSeconds (const int64 ticks) throw();
  3140. static int64 secondsToHighResolutionTicks (const double seconds) throw();
  3141. private:
  3142. int64 millisSinceEpoch;
  3143. };
  3144. #endif // __JUCE_TIME_JUCEHEADER__
  3145. /*** End of inlined file: juce_Time.h ***/
  3146. class FileInputStream;
  3147. class FileOutputStream;
  3148. class JUCE_API File
  3149. {
  3150. public:
  3151. File() {}
  3152. File (const String& path);
  3153. File (const File& other);
  3154. ~File() {}
  3155. const File& operator= (const String& newFilePath);
  3156. const File& operator= (const File& otherFile);
  3157. static const File nonexistent;
  3158. bool exists() const;
  3159. bool existsAsFile() const;
  3160. bool isDirectory() const;
  3161. int64 getSize() const;
  3162. static const String descriptionOfSizeInBytes (const int64 bytes);
  3163. const String& getFullPathName() const { return fullPath; }
  3164. const String getFileName() const;
  3165. const String getRelativePathFrom (const File& directoryToBeRelativeTo) const;
  3166. const String getFileExtension() const;
  3167. bool hasFileExtension (const String& extensionToTest) const;
  3168. const File withFileExtension (const String& newExtension) const;
  3169. const String getFileNameWithoutExtension() const;
  3170. int hashCode() const;
  3171. int64 hashCode64() const;
  3172. const File getChildFile (String relativePath) const;
  3173. const File getSiblingFile (const String& siblingFileName) const;
  3174. const File getParentDirectory() const;
  3175. bool isAChildOf (const File& potentialParentDirectory) const;
  3176. const File getNonexistentChildFile (const String& prefix,
  3177. const String& suffix,
  3178. bool putNumbersInBrackets = true) const;
  3179. const File getNonexistentSibling (const bool putNumbersInBrackets = true) const;
  3180. bool operator== (const File& otherFile) const;
  3181. bool operator!= (const File& otherFile) const;
  3182. bool hasWriteAccess() const;
  3183. bool setReadOnly (const bool shouldBeReadOnly,
  3184. const bool applyRecursively = false) const;
  3185. bool isHidden() const;
  3186. const File getLinkedTarget() const;
  3187. const Time getLastModificationTime() const;
  3188. const Time getLastAccessTime() const;
  3189. const Time getCreationTime() const;
  3190. bool setLastModificationTime (const Time& newTime) const;
  3191. bool setLastAccessTime (const Time& newTime) const;
  3192. bool setCreationTime (const Time& newTime) const;
  3193. const String getVersion() const;
  3194. bool create() const;
  3195. bool createDirectory() const;
  3196. bool deleteFile() const;
  3197. bool deleteRecursively() const;
  3198. bool moveToTrash() const;
  3199. bool moveFileTo (const File& targetLocation) const;
  3200. bool copyFileTo (const File& targetLocation) const;
  3201. bool copyDirectoryTo (const File& newDirectory) const;
  3202. enum TypesOfFileToFind
  3203. {
  3204. findDirectories = 1, /**< Use this flag to indicate that you want to find directories. */
  3205. findFiles = 2, /**< Use this flag to indicate that you want to find files. */
  3206. findFilesAndDirectories = 3, /**< Use this flag to indicate that you want to find both files and directories. */
  3207. ignoreHiddenFiles = 4 /**< Add this flag to avoid returning any hidden files in the results. */
  3208. };
  3209. int findChildFiles (Array<File>& results,
  3210. const int whatToLookFor,
  3211. const bool searchRecursively,
  3212. const String& wildCardPattern = JUCE_T("*")) const;
  3213. int getNumberOfChildFiles (const int whatToLookFor,
  3214. const String& wildCardPattern = JUCE_T("*")) const;
  3215. bool containsSubDirectories() const;
  3216. FileInputStream* createInputStream() const;
  3217. FileOutputStream* createOutputStream (const int bufferSize = 0x8000) const;
  3218. bool loadFileAsData (MemoryBlock& result) const;
  3219. const String loadFileAsString() const;
  3220. bool appendData (const void* const dataToAppend,
  3221. const int numberOfBytes) const;
  3222. bool replaceWithData (const void* const dataToWrite,
  3223. const int numberOfBytes) const;
  3224. bool appendText (const String& textToAppend,
  3225. const bool asUnicode = false,
  3226. const bool writeUnicodeHeaderBytes = false) const;
  3227. bool replaceWithText (const String& textToWrite,
  3228. const bool asUnicode = false,
  3229. const bool writeUnicodeHeaderBytes = false) const;
  3230. static void findFileSystemRoots (Array<File>& results);
  3231. const String getVolumeLabel() const;
  3232. int getVolumeSerialNumber() const;
  3233. int64 getBytesFreeOnVolume() const;
  3234. int64 getVolumeTotalSize() const;
  3235. bool isOnCDRomDrive() const;
  3236. bool isOnHardDisk() const;
  3237. bool isOnRemovableDrive() const;
  3238. bool startAsProcess (const String& parameters = String::empty) const;
  3239. void revealToUser() const;
  3240. enum SpecialLocationType
  3241. {
  3242. userHomeDirectory,
  3243. userDocumentsDirectory,
  3244. userDesktopDirectory,
  3245. userApplicationDataDirectory,
  3246. commonApplicationDataDirectory,
  3247. tempDirectory,
  3248. currentExecutableFile,
  3249. currentApplicationFile,
  3250. invokedExecutableFile,
  3251. globalApplicationsDirectory,
  3252. userMusicDirectory,
  3253. userMoviesDirectory,
  3254. };
  3255. static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);
  3256. static const File createTempFile (const String& fileNameEnding);
  3257. static const File getCurrentWorkingDirectory();
  3258. bool setAsCurrentWorkingDirectory() const;
  3259. static const tchar separator;
  3260. static const tchar* separatorString;
  3261. static const String createLegalFileName (const String& fileNameToFix);
  3262. static const String createLegalPathName (const String& pathNameToFix);
  3263. static bool areFileNamesCaseSensitive();
  3264. static bool isAbsolutePath (const String& path);
  3265. static const File createFileWithoutCheckingPath (const String& path);
  3266. juce_UseDebuggingNewOperator
  3267. private:
  3268. String fullPath;
  3269. // internal way of contructing a file without checking the path
  3270. friend class DirectoryIterator;
  3271. File (const String&, int);
  3272. const String getPathUpToLastSlash() const;
  3273. };
  3274. #endif // __JUCE_FILE_JUCEHEADER__
  3275. /*** End of inlined file: juce_File.h ***/
  3276. #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
  3277. \
  3278. for (XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
  3279. childElementVariableName != 0; \
  3280. childElementVariableName = childElementVariableName->getNextElement())
  3281. #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
  3282. \
  3283. for (XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
  3284. childElementVariableName != 0; \
  3285. childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
  3286. class JUCE_API XmlElement
  3287. {
  3288. public:
  3289. XmlElement (const String& tagName) throw();
  3290. XmlElement (const XmlElement& other) throw();
  3291. const XmlElement& operator= (const XmlElement& other) throw();
  3292. ~XmlElement() throw();
  3293. bool isEquivalentTo (const XmlElement* const other,
  3294. const bool ignoreOrderOfAttributes) const throw();
  3295. const String createDocument (const String& dtdToUse,
  3296. const bool allOnOneLine = false,
  3297. const bool includeXmlHeader = true,
  3298. const String& encodingType = JUCE_T("UTF-8"),
  3299. const int lineWrapLength = 60) const throw();
  3300. void writeToStream (OutputStream& output,
  3301. const String& dtdToUse,
  3302. const bool allOnOneLine = false,
  3303. const bool includeXmlHeader = true,
  3304. const String& encodingType = JUCE_T("UTF-8"),
  3305. const int lineWrapLength = 60) const throw();
  3306. bool writeToFile (const File& destinationFile,
  3307. const String& dtdToUse,
  3308. const String& encodingType = JUCE_T("UTF-8"),
  3309. const int lineWrapLength = 60) const throw();
  3310. inline const String& getTagName() const throw() { return tagName; }
  3311. bool hasTagName (const String& possibleTagName) const throw();
  3312. int getNumAttributes() const throw();
  3313. const String& getAttributeName (const int attributeIndex) const throw();
  3314. const String& getAttributeValue (const int attributeIndex) const throw();
  3315. // Attribute-handling methods..
  3316. bool hasAttribute (const String& attributeName) const throw();
  3317. const String getStringAttribute (const String& attributeName,
  3318. const String& defaultReturnValue = String::empty) const throw();
  3319. bool compareAttribute (const String& attributeName,
  3320. const String& stringToCompareAgainst,
  3321. const bool ignoreCase = false) const throw();
  3322. int getIntAttribute (const String& attributeName,
  3323. const int defaultReturnValue = 0) const throw();
  3324. double getDoubleAttribute (const String& attributeName,
  3325. const double defaultReturnValue = 0.0) const throw();
  3326. bool getBoolAttribute (const String& attributeName,
  3327. const bool defaultReturnValue = false) const throw();
  3328. void setAttribute (const String& attributeName,
  3329. const String& newValue) throw();
  3330. void setAttribute (const String& attributeName,
  3331. const int newValue) throw();
  3332. void setAttribute (const String& attributeName,
  3333. const double newValue) throw();
  3334. void removeAttribute (const String& attributeName) throw();
  3335. void removeAllAttributes() throw();
  3336. // Child element methods..
  3337. XmlElement* getFirstChildElement() const throw() { return firstChildElement; }
  3338. inline XmlElement* getNextElement() const throw() { return nextElement; }
  3339. XmlElement* getNextElementWithTagName (const String& requiredTagName) const;
  3340. int getNumChildElements() const throw();
  3341. XmlElement* getChildElement (const int index) const throw();
  3342. XmlElement* getChildByName (const String& tagNameToLookFor) const throw();
  3343. void addChildElement (XmlElement* const newChildElement) throw();
  3344. void insertChildElement (XmlElement* const newChildNode,
  3345. int indexToInsertAt) throw();
  3346. XmlElement* createNewChildElement (const String& tagName);
  3347. bool replaceChildElement (XmlElement* const currentChildElement,
  3348. XmlElement* const newChildNode) throw();
  3349. void removeChildElement (XmlElement* const childToRemove,
  3350. const bool shouldDeleteTheChild) throw();
  3351. void deleteAllChildElements() throw();
  3352. void deleteAllChildElementsWithTagName (const String& tagName) throw();
  3353. bool containsChildElement (const XmlElement* const possibleChild) const throw();
  3354. XmlElement* findParentElementOf (const XmlElement* const elementToLookFor) throw();
  3355. template <class ElementComparator>
  3356. void sortChildElements (ElementComparator& comparator,
  3357. const bool retainOrderOfEquivalentItems = false) throw()
  3358. {
  3359. const int num = getNumChildElements();
  3360. if (num > 1)
  3361. {
  3362. HeapBlock <XmlElement*> elems (num);
  3363. getChildElementsAsArray (elems);
  3364. sortArray (comparator, (XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
  3365. reorderChildElements (elems, num);
  3366. }
  3367. }
  3368. bool isTextElement() const throw();
  3369. const String getText() const throw();
  3370. void setText (const String& newText) throw();
  3371. const String getAllSubText() const throw();
  3372. const String getChildElementAllSubText (const String& childTagName,
  3373. const String& defaultReturnValue) const throw();
  3374. void addTextElement (const String& text) throw();
  3375. void deleteAllTextElements() throw();
  3376. static XmlElement* createTextElement (const String& text) throw();
  3377. juce_UseDebuggingNewOperator
  3378. private:
  3379. friend class XmlDocument;
  3380. String tagName;
  3381. XmlElement* firstChildElement;
  3382. XmlElement* nextElement;
  3383. struct XmlAttributeNode
  3384. {
  3385. XmlAttributeNode (const XmlAttributeNode& other) throw();
  3386. XmlAttributeNode (const String& name, const String& value) throw();
  3387. String name, value;
  3388. XmlAttributeNode* next;
  3389. private:
  3390. const XmlAttributeNode& operator= (const XmlAttributeNode&);
  3391. };
  3392. XmlAttributeNode* attributes;
  3393. XmlElement (int) throw(); // for internal use
  3394. void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
  3395. void writeElementAsText (OutputStream& out,
  3396. const int indentationLevel,
  3397. const int lineWrapLength) const throw();
  3398. void getChildElementsAsArray (XmlElement**) const throw();
  3399. void reorderChildElements (XmlElement** const, const int) throw();
  3400. };
  3401. #endif // __JUCE_XMLELEMENT_JUCEHEADER__
  3402. /*** End of inlined file: juce_XmlElement.h ***/
  3403. class JUCE_API PropertySet
  3404. {
  3405. public:
  3406. PropertySet (const bool ignoreCaseOfKeyNames = false) throw();
  3407. PropertySet (const PropertySet& other) throw();
  3408. const PropertySet& operator= (const PropertySet& other) throw();
  3409. virtual ~PropertySet();
  3410. const String getValue (const String& keyName,
  3411. const String& defaultReturnValue = String::empty) const throw();
  3412. int getIntValue (const String& keyName,
  3413. const int defaultReturnValue = 0) const throw();
  3414. double getDoubleValue (const String& keyName,
  3415. const double defaultReturnValue = 0.0) const throw();
  3416. bool getBoolValue (const String& keyName,
  3417. const bool defaultReturnValue = false) const throw();
  3418. XmlElement* getXmlValue (const String& keyName) const;
  3419. void setValue (const String& keyName, const String& value) throw();
  3420. void setValue (const String& keyName, const tchar* const value) throw();
  3421. void setValue (const String& keyName, const int value) throw();
  3422. void setValue (const String& keyName, const double value) throw();
  3423. void setValue (const String& keyName, const bool value) throw();
  3424. void setValue (const String& keyName, const XmlElement* const xml);
  3425. void removeValue (const String& keyName) throw();
  3426. bool containsKey (const String& keyName) const throw();
  3427. void clear();
  3428. StringPairArray& getAllProperties() throw() { return properties; }
  3429. const CriticalSection& getLock() const throw() { return lock; }
  3430. XmlElement* createXml (const String& nodeName) const throw();
  3431. void restoreFromXml (const XmlElement& xml) throw();
  3432. void setFallbackPropertySet (PropertySet* fallbackProperties) throw();
  3433. PropertySet* getFallbackPropertySet() const throw() { return fallbackProperties; }
  3434. juce_UseDebuggingNewOperator
  3435. protected:
  3436. virtual void propertyChanged();
  3437. private:
  3438. StringPairArray properties;
  3439. PropertySet* fallbackProperties;
  3440. CriticalSection lock;
  3441. bool ignoreCaseOfKeys;
  3442. };
  3443. #endif // __JUCE_PROPERTYSET_JUCEHEADER__
  3444. /*** End of inlined file: juce_PropertySet.h ***/
  3445. #endif
  3446. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3447. /*** Start of inlined file: juce_ReferenceCountedArray.h ***/
  3448. #ifndef __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3449. #define __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3450. template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3451. class ReferenceCountedArray
  3452. {
  3453. public:
  3454. ReferenceCountedArray() throw()
  3455. : numUsed (0)
  3456. {
  3457. }
  3458. ReferenceCountedArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3459. {
  3460. other.lockArray();
  3461. numUsed = other.numUsed;
  3462. data.setAllocatedSize (numUsed);
  3463. memcpy (data.elements, other.data.elements, numUsed * sizeof (ObjectClass*));
  3464. for (int i = numUsed; --i >= 0;)
  3465. if (data.elements[i] != 0)
  3466. data.elements[i]->incReferenceCount();
  3467. other.unlockArray();
  3468. }
  3469. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) throw()
  3470. {
  3471. if (this != &other)
  3472. {
  3473. ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
  3474. swapWithArray (other);
  3475. }
  3476. return *this;
  3477. }
  3478. ~ReferenceCountedArray()
  3479. {
  3480. clear();
  3481. }
  3482. void clear()
  3483. {
  3484. data.enter();
  3485. while (numUsed > 0)
  3486. if (data.elements [--numUsed] != 0)
  3487. data.elements [numUsed]->decReferenceCount();
  3488. jassert (numUsed == 0);
  3489. data.setAllocatedSize (0);
  3490. data.exit();
  3491. }
  3492. inline int size() const throw()
  3493. {
  3494. return numUsed;
  3495. }
  3496. inline const ReferenceCountedObjectPtr<ObjectClass> operator[] (const int index) const throw()
  3497. {
  3498. data.enter();
  3499. const ReferenceCountedObjectPtr<ObjectClass> result ((((unsigned int) index) < (unsigned int) numUsed)
  3500. ? data.elements [index]
  3501. : (ObjectClass*) 0);
  3502. data.exit();
  3503. return result;
  3504. }
  3505. inline const ReferenceCountedObjectPtr<ObjectClass> getUnchecked (const int index) const throw()
  3506. {
  3507. data.enter();
  3508. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3509. const ReferenceCountedObjectPtr<ObjectClass> result (data.elements [index]);
  3510. data.exit();
  3511. return result;
  3512. }
  3513. inline const ReferenceCountedObjectPtr<ObjectClass> getFirst() const throw()
  3514. {
  3515. data.enter();
  3516. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [0]
  3517. : (ObjectClass*) 0);
  3518. data.exit();
  3519. return result;
  3520. }
  3521. inline const ReferenceCountedObjectPtr<ObjectClass> getLast() const throw()
  3522. {
  3523. data.enter();
  3524. const ReferenceCountedObjectPtr<ObjectClass> result ((numUsed > 0) ? data.elements [numUsed - 1]
  3525. : (ObjectClass*) 0);
  3526. data.exit();
  3527. return result;
  3528. }
  3529. int indexOf (const ObjectClass* const objectToLookFor) const throw()
  3530. {
  3531. int result = -1;
  3532. data.enter();
  3533. ObjectClass** e = data.elements;
  3534. for (int i = numUsed; --i >= 0;)
  3535. {
  3536. if (objectToLookFor == *e)
  3537. {
  3538. result = (int) (e - data.elements);
  3539. break;
  3540. }
  3541. ++e;
  3542. }
  3543. data.exit();
  3544. return result;
  3545. }
  3546. bool contains (const ObjectClass* const objectToLookFor) const throw()
  3547. {
  3548. data.enter();
  3549. ObjectClass** e = data.elements;
  3550. for (int i = numUsed; --i >= 0;)
  3551. {
  3552. if (objectToLookFor == *e)
  3553. {
  3554. data.exit();
  3555. return true;
  3556. }
  3557. ++e;
  3558. }
  3559. data.exit();
  3560. return false;
  3561. }
  3562. void add (ObjectClass* const newObject) throw()
  3563. {
  3564. data.enter();
  3565. data.ensureAllocatedSize (numUsed + 1);
  3566. data.elements [numUsed++] = newObject;
  3567. if (newObject != 0)
  3568. newObject->incReferenceCount();
  3569. data.exit();
  3570. }
  3571. void insert (int indexToInsertAt,
  3572. ObjectClass* const newObject) throw()
  3573. {
  3574. if (indexToInsertAt >= 0)
  3575. {
  3576. data.enter();
  3577. if (indexToInsertAt > numUsed)
  3578. indexToInsertAt = numUsed;
  3579. data.ensureAllocatedSize (numUsed + 1);
  3580. ObjectClass** const e = data.elements + indexToInsertAt;
  3581. const int numToMove = numUsed - indexToInsertAt;
  3582. if (numToMove > 0)
  3583. memmove (e + 1, e, numToMove * sizeof (ObjectClass*));
  3584. *e = newObject;
  3585. if (newObject != 0)
  3586. newObject->incReferenceCount();
  3587. ++numUsed;
  3588. data.exit();
  3589. }
  3590. else
  3591. {
  3592. add (newObject);
  3593. }
  3594. }
  3595. void addIfNotAlreadyThere (ObjectClass* const newObject) throw()
  3596. {
  3597. data.enter();
  3598. if (! contains (newObject))
  3599. add (newObject);
  3600. data.exit();
  3601. }
  3602. void set (const int indexToChange,
  3603. ObjectClass* const newObject)
  3604. {
  3605. if (indexToChange >= 0)
  3606. {
  3607. data.enter();
  3608. if (newObject != 0)
  3609. newObject->incReferenceCount();
  3610. if (indexToChange < numUsed)
  3611. {
  3612. if (data.elements [indexToChange] != 0)
  3613. data.elements [indexToChange]->decReferenceCount();
  3614. data.elements [indexToChange] = newObject;
  3615. }
  3616. else
  3617. {
  3618. data.ensureAllocatedSize (numUsed + 1);
  3619. data.elements [numUsed++] = newObject;
  3620. }
  3621. data.exit();
  3622. }
  3623. }
  3624. void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
  3625. int startIndex = 0,
  3626. int numElementsToAdd = -1) throw()
  3627. {
  3628. arrayToAddFrom.lockArray();
  3629. data.enter();
  3630. if (startIndex < 0)
  3631. {
  3632. jassertfalse
  3633. startIndex = 0;
  3634. }
  3635. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > arrayToAddFrom.size())
  3636. numElementsToAdd = arrayToAddFrom.size() - startIndex;
  3637. if (numElementsToAdd > 0)
  3638. {
  3639. data.ensureAllocatedSize (numUsed + numElementsToAdd);
  3640. while (--numElementsToAdd >= 0)
  3641. add (arrayToAddFrom.getUnchecked (startIndex++));
  3642. }
  3643. data.exit();
  3644. arrayToAddFrom.unlockArray();
  3645. }
  3646. template <class ElementComparator>
  3647. void addSorted (ElementComparator& comparator,
  3648. ObjectClass* newObject) throw()
  3649. {
  3650. data.enter();
  3651. insert (findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed), newObject);
  3652. data.exit();
  3653. }
  3654. template <class ElementComparator>
  3655. void addOrReplaceSorted (ElementComparator& comparator,
  3656. ObjectClass* newObject) throw()
  3657. {
  3658. data.enter();
  3659. const int index = findInsertIndexInSortedArray (comparator, (ObjectClass**) data.elements, newObject, 0, numUsed);
  3660. if (index > 0 && comparator.compareElements (newObject, data.elements [index - 1]) == 0)
  3661. set (index - 1, newObject); // replace an existing object that matches
  3662. else
  3663. insert (index, newObject); // no match, so insert the new one
  3664. data.exit();
  3665. }
  3666. void remove (const int indexToRemove)
  3667. {
  3668. data.enter();
  3669. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  3670. {
  3671. ObjectClass** const e = data.elements + indexToRemove;
  3672. if (*e != 0)
  3673. (*e)->decReferenceCount();
  3674. --numUsed;
  3675. const int numberToShift = numUsed - indexToRemove;
  3676. if (numberToShift > 0)
  3677. memmove (e, e + 1, numberToShift * sizeof (ObjectClass*));
  3678. if ((numUsed << 1) < data.numAllocated)
  3679. minimiseStorageOverheads();
  3680. }
  3681. data.exit();
  3682. }
  3683. void removeObject (ObjectClass* const objectToRemove)
  3684. {
  3685. data.enter();
  3686. remove (indexOf (objectToRemove));
  3687. data.exit();
  3688. }
  3689. void removeRange (const int startIndex,
  3690. const int numberToRemove)
  3691. {
  3692. data.enter();
  3693. const int start = jlimit (0, numUsed, startIndex);
  3694. const int end = jlimit (0, numUsed, startIndex + numberToRemove);
  3695. if (end > start)
  3696. {
  3697. int i;
  3698. for (i = start; i < end; ++i)
  3699. {
  3700. if (data.elements[i] != 0)
  3701. {
  3702. data.elements[i]->decReferenceCount();
  3703. data.elements[i] = 0; // (in case one of the destructors accesses this array and hits a dangling pointer)
  3704. }
  3705. }
  3706. const int rangeSize = end - start;
  3707. ObjectClass** e = data.elements + start;
  3708. i = numUsed - end;
  3709. numUsed -= rangeSize;
  3710. while (--i >= 0)
  3711. {
  3712. *e = e [rangeSize];
  3713. ++e;
  3714. }
  3715. if ((numUsed << 1) < data.numAllocated)
  3716. minimiseStorageOverheads();
  3717. }
  3718. data.exit();
  3719. }
  3720. void removeLast (int howManyToRemove = 1)
  3721. {
  3722. data.enter();
  3723. if (howManyToRemove > numUsed)
  3724. howManyToRemove = numUsed;
  3725. while (--howManyToRemove >= 0)
  3726. remove (numUsed - 1);
  3727. data.exit();
  3728. }
  3729. void swap (const int index1,
  3730. const int index2) throw()
  3731. {
  3732. data.enter();
  3733. if (((unsigned int) index1) < (unsigned int) numUsed
  3734. && ((unsigned int) index2) < (unsigned int) numUsed)
  3735. {
  3736. swapVariables (data.elements [index1],
  3737. data.elements [index2]);
  3738. }
  3739. data.exit();
  3740. }
  3741. void move (const int currentIndex,
  3742. int newIndex) throw()
  3743. {
  3744. if (currentIndex != newIndex)
  3745. {
  3746. data.enter();
  3747. if (((unsigned int) currentIndex) < (unsigned int) numUsed)
  3748. {
  3749. if (((unsigned int) newIndex) >= (unsigned int) numUsed)
  3750. newIndex = numUsed - 1;
  3751. ObjectClass* const value = data.elements [currentIndex];
  3752. if (newIndex > currentIndex)
  3753. {
  3754. memmove (data.elements + currentIndex,
  3755. data.elements + currentIndex + 1,
  3756. (newIndex - currentIndex) * sizeof (ObjectClass*));
  3757. }
  3758. else
  3759. {
  3760. memmove (data.elements + newIndex + 1,
  3761. data.elements + newIndex,
  3762. (currentIndex - newIndex) * sizeof (ObjectClass*));
  3763. }
  3764. data.elements [newIndex] = value;
  3765. }
  3766. data.exit();
  3767. }
  3768. }
  3769. void swapWithArray (ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& otherArray) throw()
  3770. {
  3771. data.enter();
  3772. otherArray.data.enter();
  3773. data.swapWith (otherArray.data);
  3774. swapVariables (numUsed, otherArray.numUsed);
  3775. otherArray.data.exit();
  3776. data.exit();
  3777. }
  3778. bool operator== (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3779. {
  3780. other.lockArray();
  3781. data.enter();
  3782. bool result = numUsed == other.numUsed;
  3783. if (result)
  3784. {
  3785. for (int i = numUsed; --i >= 0;)
  3786. {
  3787. if (data.elements [i] != other.data.elements [i])
  3788. {
  3789. result = false;
  3790. break;
  3791. }
  3792. }
  3793. }
  3794. data.exit();
  3795. other.unlockArray();
  3796. return result;
  3797. }
  3798. bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const throw()
  3799. {
  3800. return ! operator== (other);
  3801. }
  3802. template <class ElementComparator>
  3803. void sort (ElementComparator& comparator,
  3804. const bool retainOrderOfEquivalentItems = false) const throw()
  3805. {
  3806. (void) comparator; // if you pass in an object with a static compareElements() method, this
  3807. // avoids getting warning messages about the parameter being unused
  3808. data.enter();
  3809. sortArray (comparator, (ObjectClass**) data.elements, 0, size() - 1, retainOrderOfEquivalentItems);
  3810. data.exit();
  3811. }
  3812. void minimiseStorageOverheads() throw()
  3813. {
  3814. data.enter();
  3815. data.shrinkToNoMoreThan (numUsed);
  3816. data.exit();
  3817. }
  3818. void lockArray() const throw()
  3819. {
  3820. data.enter();
  3821. }
  3822. void unlockArray() const throw()
  3823. {
  3824. data.exit();
  3825. }
  3826. juce_UseDebuggingNewOperator
  3827. private:
  3828. ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
  3829. int numUsed;
  3830. };
  3831. #endif // __JUCE_REFERENCECOUNTEDARRAY_JUCEHEADER__
  3832. /*** End of inlined file: juce_ReferenceCountedArray.h ***/
  3833. #endif
  3834. #ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
  3835. #endif
  3836. #ifndef __JUCE_SCOPEDPOINTER_JUCEHEADER__
  3837. #endif
  3838. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3839. /*** Start of inlined file: juce_SortedSet.h ***/
  3840. #ifndef __JUCE_SORTEDSET_JUCEHEADER__
  3841. #define __JUCE_SORTEDSET_JUCEHEADER__
  3842. #if JUCE_MSVC
  3843. #pragma warning (push)
  3844. #pragma warning (disable: 4512)
  3845. #endif
  3846. template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
  3847. class SortedSet
  3848. {
  3849. public:
  3850. SortedSet() throw()
  3851. : numUsed (0)
  3852. {
  3853. }
  3854. SortedSet (const SortedSet<ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3855. {
  3856. other.lockSet();
  3857. numUsed = other.numUsed;
  3858. data.setAllocatedSize (other.numUsed);
  3859. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3860. other.unlockSet();
  3861. }
  3862. ~SortedSet() throw()
  3863. {
  3864. }
  3865. SortedSet <ElementType, TypeOfCriticalSectionToUse>& operator= (const SortedSet <ElementType, TypeOfCriticalSectionToUse>& other) throw()
  3866. {
  3867. if (this != &other)
  3868. {
  3869. other.lockSet();
  3870. data.enter();
  3871. data.ensureAllocatedSize (other.size());
  3872. numUsed = other.numUsed;
  3873. memcpy (data.elements, other.data.elements, numUsed * sizeof (ElementType));
  3874. minimiseStorageOverheads();
  3875. data.exit();
  3876. other.unlockSet();
  3877. }
  3878. return *this;
  3879. }
  3880. bool operator== (const SortedSet<ElementType>& other) const throw()
  3881. {
  3882. data.enter();
  3883. if (numUsed != other.numUsed)
  3884. {
  3885. data.exit();
  3886. return false;
  3887. }
  3888. for (int i = numUsed; --i >= 0;)
  3889. {
  3890. if (data.elements [i] != other.data.elements [i])
  3891. {
  3892. data.exit();
  3893. return false;
  3894. }
  3895. }
  3896. data.exit();
  3897. return true;
  3898. }
  3899. bool operator!= (const SortedSet<ElementType>& other) const throw()
  3900. {
  3901. return ! operator== (other);
  3902. }
  3903. void clear() throw()
  3904. {
  3905. data.enter();
  3906. data.setAllocatedSize (0);
  3907. numUsed = 0;
  3908. data.exit();
  3909. }
  3910. void clearQuick() throw()
  3911. {
  3912. data.enter();
  3913. numUsed = 0;
  3914. data.exit();
  3915. }
  3916. inline int size() const throw()
  3917. {
  3918. return numUsed;
  3919. }
  3920. inline ElementType operator[] (const int index) const throw()
  3921. {
  3922. data.enter();
  3923. const ElementType result = (((unsigned int) index) < (unsigned int) numUsed)
  3924. ? data.elements [index]
  3925. : (ElementType) 0;
  3926. data.exit();
  3927. return result;
  3928. }
  3929. inline ElementType getUnchecked (const int index) const throw()
  3930. {
  3931. data.enter();
  3932. jassert (((unsigned int) index) < (unsigned int) numUsed);
  3933. const ElementType result = data.elements [index];
  3934. data.exit();
  3935. return result;
  3936. }
  3937. inline ElementType getFirst() const throw()
  3938. {
  3939. data.enter();
  3940. const ElementType result = (numUsed > 0) ? data.elements [0]
  3941. : (ElementType) 0;
  3942. data.exit();
  3943. return result;
  3944. }
  3945. inline ElementType getLast() const throw()
  3946. {
  3947. data.enter();
  3948. const ElementType result = (numUsed > 0) ? data.elements [numUsed - 1]
  3949. : (ElementType) 0;
  3950. data.exit();
  3951. return result;
  3952. }
  3953. int indexOf (const ElementType elementToLookFor) const throw()
  3954. {
  3955. data.enter();
  3956. int start = 0;
  3957. int end = numUsed;
  3958. for (;;)
  3959. {
  3960. if (start >= end)
  3961. {
  3962. data.exit();
  3963. return -1;
  3964. }
  3965. else if (elementToLookFor == data.elements [start])
  3966. {
  3967. data.exit();
  3968. return start;
  3969. }
  3970. else
  3971. {
  3972. const int halfway = (start + end) >> 1;
  3973. if (halfway == start)
  3974. {
  3975. data.exit();
  3976. return -1;
  3977. }
  3978. else if (elementToLookFor >= data.elements [halfway])
  3979. start = halfway;
  3980. else
  3981. end = halfway;
  3982. }
  3983. }
  3984. }
  3985. bool contains (const ElementType elementToLookFor) const throw()
  3986. {
  3987. data.enter();
  3988. int start = 0;
  3989. int end = numUsed;
  3990. for (;;)
  3991. {
  3992. if (start >= end)
  3993. {
  3994. data.exit();
  3995. return false;
  3996. }
  3997. else if (elementToLookFor == data.elements [start])
  3998. {
  3999. data.exit();
  4000. return true;
  4001. }
  4002. else
  4003. {
  4004. const int halfway = (start + end) >> 1;
  4005. if (halfway == start)
  4006. {
  4007. data.exit();
  4008. return false;
  4009. }
  4010. else if (elementToLookFor >= data.elements [halfway])
  4011. start = halfway;
  4012. else
  4013. end = halfway;
  4014. }
  4015. }
  4016. }
  4017. void add (const ElementType newElement) throw()
  4018. {
  4019. data.enter();
  4020. int start = 0;
  4021. int end = numUsed;
  4022. for (;;)
  4023. {
  4024. if (start >= end)
  4025. {
  4026. jassert (start <= end);
  4027. insertInternal (start, newElement);
  4028. break;
  4029. }
  4030. else if (newElement == data.elements [start])
  4031. {
  4032. break;
  4033. }
  4034. else
  4035. {
  4036. const int halfway = (start + end) >> 1;
  4037. if (halfway == start)
  4038. {
  4039. if (newElement >= data.elements [halfway])
  4040. insertInternal (start + 1, newElement);
  4041. else
  4042. insertInternal (start, newElement);
  4043. break;
  4044. }
  4045. else if (newElement >= data.elements [halfway])
  4046. start = halfway;
  4047. else
  4048. end = halfway;
  4049. }
  4050. }
  4051. data.exit();
  4052. }
  4053. void addArray (const ElementType* elementsToAdd,
  4054. int numElementsToAdd) throw()
  4055. {
  4056. data.enter();
  4057. while (--numElementsToAdd >= 0)
  4058. add (*elementsToAdd++);
  4059. data.exit();
  4060. }
  4061. template <class OtherSetType>
  4062. void addSet (const OtherSetType& setToAddFrom,
  4063. int startIndex = 0,
  4064. int numElementsToAdd = -1) throw()
  4065. {
  4066. setToAddFrom.lockSet();
  4067. data.enter();
  4068. jassert (this != &setToAddFrom);
  4069. if (this != &setToAddFrom)
  4070. {
  4071. if (startIndex < 0)
  4072. {
  4073. jassertfalse
  4074. startIndex = 0;
  4075. }
  4076. if (numElementsToAdd < 0 || startIndex + numElementsToAdd > setToAddFrom.size())
  4077. numElementsToAdd = setToAddFrom.size() - startIndex;
  4078. addArray (setToAddFrom.elements + startIndex, numElementsToAdd);
  4079. }
  4080. data.exit();
  4081. setToAddFrom.unlockSet();
  4082. }
  4083. ElementType remove (const int indexToRemove) throw()
  4084. {
  4085. data.enter();
  4086. if (((unsigned int) indexToRemove) < (unsigned int) numUsed)
  4087. {
  4088. --numUsed;
  4089. ElementType* const e = data.elements + indexToRemove;
  4090. ElementType const removed = *e;
  4091. const int numberToShift = numUsed - indexToRemove;
  4092. if (numberToShift > 0)
  4093. memmove (e, e + 1, numberToShift * sizeof (ElementType));
  4094. if ((numUsed << 1) < data.numAllocated)
  4095. minimiseStorageOverheads();
  4096. data.exit();
  4097. return removed;
  4098. }
  4099. else
  4100. {
  4101. data.exit();
  4102. return 0;
  4103. }
  4104. }
  4105. void removeValue (const ElementType valueToRemove) throw()
  4106. {
  4107. data.enter();
  4108. remove (indexOf (valueToRemove));
  4109. data.exit();
  4110. }
  4111. template <class OtherSetType>
  4112. void removeValuesIn (const OtherSetType& otherSet) throw()
  4113. {
  4114. otherSet.lockSet();
  4115. data.enter();
  4116. if (this == &otherSet)
  4117. {
  4118. clear();
  4119. }
  4120. else
  4121. {
  4122. if (otherSet.size() > 0)
  4123. {
  4124. for (int i = numUsed; --i >= 0;)
  4125. if (otherSet.contains (data.elements [i]))
  4126. remove (i);
  4127. }
  4128. }
  4129. data.exit();
  4130. otherSet.unlockSet();
  4131. }
  4132. template <class OtherSetType>
  4133. void removeValuesNotIn (const OtherSetType& otherSet) throw()
  4134. {
  4135. otherSet.lockSet();
  4136. data.enter();
  4137. if (this != &otherSet)
  4138. {
  4139. if (otherSet.size() <= 0)
  4140. {
  4141. clear();
  4142. }
  4143. else
  4144. {
  4145. for (int i = numUsed; --i >= 0;)
  4146. if (! otherSet.contains (data.elements [i]))
  4147. remove (i);
  4148. }
  4149. }
  4150. data.exit();
  4151. otherSet.lockSet();
  4152. }
  4153. void minimiseStorageOverheads() throw()
  4154. {
  4155. data.enter();
  4156. data.shrinkToNoMoreThan (numUsed);
  4157. data.exit();
  4158. }
  4159. void lockSet() const throw()
  4160. {
  4161. data.enter();
  4162. }
  4163. void unlockSet() const throw()
  4164. {
  4165. data.exit();
  4166. }
  4167. juce_UseDebuggingNewOperator
  4168. private:
  4169. ArrayAllocationBase <ElementType, TypeOfCriticalSectionToUse> data;
  4170. int numUsed;
  4171. void insertInternal (const int indexToInsertAt, const ElementType newElement) throw()
  4172. {
  4173. data.ensureAllocatedSize (numUsed + 1);
  4174. ElementType* const insertPos = data.elements + indexToInsertAt;
  4175. const int numberToMove = numUsed - indexToInsertAt;
  4176. if (numberToMove > 0)
  4177. memmove (insertPos + 1, insertPos, numberToMove * sizeof (ElementType));
  4178. *insertPos = newElement;
  4179. ++numUsed;
  4180. }
  4181. };
  4182. #if JUCE_MSVC
  4183. #pragma warning (pop)
  4184. #endif
  4185. #endif // __JUCE_SORTEDSET_JUCEHEADER__
  4186. /*** End of inlined file: juce_SortedSet.h ***/
  4187. #endif
  4188. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4189. /*** Start of inlined file: juce_SparseSet.h ***/
  4190. #ifndef __JUCE_SPARSESET_JUCEHEADER__
  4191. #define __JUCE_SPARSESET_JUCEHEADER__
  4192. template <class Type>
  4193. class SparseSet
  4194. {
  4195. public:
  4196. SparseSet() throw()
  4197. {
  4198. }
  4199. SparseSet (const SparseSet<Type>& other) throw()
  4200. : values (other.values)
  4201. {
  4202. }
  4203. ~SparseSet() throw()
  4204. {
  4205. }
  4206. void clear() throw()
  4207. {
  4208. values.clear();
  4209. }
  4210. bool isEmpty() const throw()
  4211. {
  4212. return values.size() == 0;
  4213. }
  4214. Type size() const throw()
  4215. {
  4216. Type num = 0;
  4217. for (int i = 0; i < values.size(); i += 2)
  4218. num += values[i + 1] - values[i];
  4219. return num;
  4220. }
  4221. Type operator[] (int index) const throw()
  4222. {
  4223. for (int i = 0; i < values.size(); i += 2)
  4224. {
  4225. const Type s = values.getUnchecked(i);
  4226. const Type e = values.getUnchecked(i + 1);
  4227. if (index < e - s)
  4228. return s + index;
  4229. index -= e - s;
  4230. }
  4231. return (Type) 0;
  4232. }
  4233. bool contains (const Type valueToLookFor) const throw()
  4234. {
  4235. bool on = false;
  4236. for (int i = 0; i < values.size(); ++i)
  4237. {
  4238. if (values.getUnchecked(i) > valueToLookFor)
  4239. return on;
  4240. on = ! on;
  4241. }
  4242. return false;
  4243. }
  4244. int getNumRanges() const throw()
  4245. {
  4246. return values.size() >> 1;
  4247. }
  4248. bool getRange (const int rangeIndex,
  4249. Type& startValue,
  4250. Type& numValues) const throw()
  4251. {
  4252. if (((unsigned int) rangeIndex) < (unsigned int) getNumRanges())
  4253. {
  4254. startValue = values [rangeIndex << 1];
  4255. numValues = values [(rangeIndex << 1) + 1] - startValue;
  4256. return true;
  4257. }
  4258. return false;
  4259. }
  4260. bool getTotalRange (Type& lowestValue,
  4261. Type& highestValue) const throw()
  4262. {
  4263. if (values.size() > 0)
  4264. {
  4265. lowestValue = values.getUnchecked (0);
  4266. highestValue = values.getUnchecked (values.size() - 1);
  4267. return true;
  4268. }
  4269. return false;
  4270. }
  4271. void addRange (const Type firstValue,
  4272. const Type numValuesToAdd) throw()
  4273. {
  4274. jassert (numValuesToAdd >= 0);
  4275. if (numValuesToAdd > 0)
  4276. {
  4277. removeRange (firstValue, numValuesToAdd);
  4278. IntegerElementComparator<Type> sorter;
  4279. values.addSorted (sorter, firstValue);
  4280. values.addSorted (sorter, firstValue + numValuesToAdd);
  4281. simplify();
  4282. }
  4283. }
  4284. void removeRange (const Type firstValue,
  4285. const Type numValuesToRemove) throw()
  4286. {
  4287. jassert (numValuesToRemove >= 0);
  4288. if (numValuesToRemove >= 0
  4289. && firstValue < values.getLast())
  4290. {
  4291. const bool onAtStart = contains (firstValue - 1);
  4292. const Type lastValue = firstValue + jmin (numValuesToRemove, values.getLast() - firstValue);
  4293. const bool onAtEnd = contains (lastValue);
  4294. for (int i = values.size(); --i >= 0;)
  4295. {
  4296. if (values.getUnchecked(i) <= lastValue)
  4297. {
  4298. while (values.getUnchecked(i) >= firstValue)
  4299. {
  4300. values.remove (i);
  4301. if (--i < 0)
  4302. break;
  4303. }
  4304. break;
  4305. }
  4306. }
  4307. IntegerElementComparator<Type> sorter;
  4308. if (onAtStart)
  4309. values.addSorted (sorter, firstValue);
  4310. if (onAtEnd)
  4311. values.addSorted (sorter, lastValue);
  4312. simplify();
  4313. }
  4314. }
  4315. void invertRange (const Type firstValue,
  4316. const Type numValues)
  4317. {
  4318. SparseSet newItems;
  4319. newItems.addRange (firstValue, numValues);
  4320. int i;
  4321. for (i = getNumRanges(); --i >= 0;)
  4322. {
  4323. const int start = values [i << 1];
  4324. const int end = values [(i << 1) + 1];
  4325. newItems.removeRange (start, end);
  4326. }
  4327. removeRange (firstValue, numValues);
  4328. for (i = newItems.getNumRanges(); --i >= 0;)
  4329. {
  4330. const int start = newItems.values [i << 1];
  4331. const int end = newItems.values [(i << 1) + 1];
  4332. addRange (start, end);
  4333. }
  4334. }
  4335. bool overlapsRange (const Type firstValue,
  4336. const Type numValues) throw()
  4337. {
  4338. jassert (numValues >= 0);
  4339. if (numValues > 0)
  4340. {
  4341. for (int i = getNumRanges(); --i >= 0;)
  4342. {
  4343. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4344. return false;
  4345. if (firstValue + numValues > values.getUnchecked (i << 1))
  4346. return true;
  4347. }
  4348. }
  4349. return false;
  4350. }
  4351. bool containsRange (const Type firstValue,
  4352. const Type numValues) throw()
  4353. {
  4354. jassert (numValues >= 0);
  4355. if (numValues > 0)
  4356. {
  4357. for (int i = getNumRanges(); --i >= 0;)
  4358. {
  4359. if (firstValue >= values.getUnchecked ((i << 1) + 1))
  4360. return false;
  4361. if (firstValue >= values.getUnchecked (i << 1)
  4362. && firstValue + numValues <= values.getUnchecked ((i << 1) + 1))
  4363. return true;
  4364. }
  4365. }
  4366. return false;
  4367. }
  4368. bool operator== (const SparseSet<Type>& other) throw()
  4369. {
  4370. return values == other.values;
  4371. }
  4372. bool operator!= (const SparseSet<Type>& other) throw()
  4373. {
  4374. return values != other.values;
  4375. }
  4376. juce_UseDebuggingNewOperator
  4377. private:
  4378. // alternating start/end values of ranges of values that are present.
  4379. Array<Type, DummyCriticalSection> values;
  4380. void simplify() throw()
  4381. {
  4382. jassert ((values.size() & 1) == 0);
  4383. for (int i = values.size(); --i > 0;)
  4384. if (values.getUnchecked(i) == values.getUnchecked (i - 1))
  4385. values.removeRange (i - 1, 2);
  4386. }
  4387. };
  4388. #endif // __JUCE_SPARSESET_JUCEHEADER__
  4389. /*** End of inlined file: juce_SparseSet.h ***/
  4390. #endif
  4391. #ifndef __JUCE_VALUE_JUCEHEADER__
  4392. /*** Start of inlined file: juce_Value.h ***/
  4393. #ifndef __JUCE_VALUE_JUCEHEADER__
  4394. #define __JUCE_VALUE_JUCEHEADER__
  4395. /*** Start of inlined file: juce_AsyncUpdater.h ***/
  4396. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  4397. #define __JUCE_ASYNCUPDATER_JUCEHEADER__
  4398. /*** Start of inlined file: juce_MessageListener.h ***/
  4399. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  4400. #define __JUCE_MESSAGELISTENER_JUCEHEADER__
  4401. /*** Start of inlined file: juce_Message.h ***/
  4402. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  4403. #define __JUCE_MESSAGE_JUCEHEADER__
  4404. class MessageListener;
  4405. class MessageManager;
  4406. class JUCE_API Message
  4407. {
  4408. public:
  4409. Message() throw();
  4410. Message (const int intParameter1,
  4411. const int intParameter2,
  4412. const int intParameter3,
  4413. void* const pointerParameter) throw();
  4414. virtual ~Message() throw();
  4415. // These values can be used for carrying simple data that the application needs to
  4416. // pass around. For more complex messages, just create a subclass.
  4417. int intParameter1; /**< user-defined integer value. */
  4418. int intParameter2; /**< user-defined integer value. */
  4419. int intParameter3; /**< user-defined integer value. */
  4420. void* pointerParameter; /**< user-defined pointer value. */
  4421. juce_UseDebuggingNewOperator
  4422. private:
  4423. friend class MessageListener;
  4424. friend class MessageManager;
  4425. MessageListener* messageRecipient;
  4426. Message (const Message&);
  4427. const Message& operator= (const Message&);
  4428. };
  4429. #endif // __JUCE_MESSAGE_JUCEHEADER__
  4430. /*** End of inlined file: juce_Message.h ***/
  4431. class JUCE_API MessageListener
  4432. {
  4433. protected:
  4434. MessageListener() throw();
  4435. public:
  4436. virtual ~MessageListener();
  4437. virtual void handleMessage (const Message& message) = 0;
  4438. void postMessage (Message* const message) const throw();
  4439. bool isValidMessageListener() const throw();
  4440. };
  4441. #endif // __JUCE_MESSAGELISTENER_JUCEHEADER__
  4442. /*** End of inlined file: juce_MessageListener.h ***/
  4443. class JUCE_API AsyncUpdater
  4444. {
  4445. public:
  4446. AsyncUpdater() throw();
  4447. virtual ~AsyncUpdater();
  4448. void triggerAsyncUpdate() throw();
  4449. void cancelPendingUpdate() throw();
  4450. void handleUpdateNowIfNeeded();
  4451. virtual void handleAsyncUpdate() = 0;
  4452. private:
  4453. class AsyncUpdaterInternal : public MessageListener
  4454. {
  4455. public:
  4456. AsyncUpdaterInternal() throw() {}
  4457. ~AsyncUpdaterInternal() {}
  4458. void handleMessage (const Message&);
  4459. AsyncUpdater* owner;
  4460. private:
  4461. AsyncUpdaterInternal (const AsyncUpdaterInternal&);
  4462. const AsyncUpdaterInternal& operator= (const AsyncUpdaterInternal&);
  4463. };
  4464. AsyncUpdaterInternal internalAsyncHandler;
  4465. bool asyncMessagePending;
  4466. };
  4467. #endif // __JUCE_ASYNCUPDATER_JUCEHEADER__
  4468. /*** End of inlined file: juce_AsyncUpdater.h ***/
  4469. class JUCE_API Value
  4470. {
  4471. public:
  4472. Value();
  4473. Value (const Value& other);
  4474. Value (const var& initialValue);
  4475. ~Value();
  4476. const var getValue() const;
  4477. operator const var() const;
  4478. const String toString() const;
  4479. void setValue (const var& newValue);
  4480. const Value& operator= (const var& newValue);
  4481. void referTo (const Value& valueToReferTo);
  4482. bool refersToSameSourceAs (const Value& other) const;
  4483. bool operator== (const Value& other) const;
  4484. bool operator!= (const Value& other) const;
  4485. class JUCE_API Listener
  4486. {
  4487. public:
  4488. Listener() {}
  4489. virtual ~Listener() {}
  4490. virtual void valueChanged (Value& value) = 0;
  4491. };
  4492. void addListener (Listener* const listener);
  4493. void removeListener (Listener* const listener);
  4494. class JUCE_API ValueSource : public ReferenceCountedObject,
  4495. public AsyncUpdater
  4496. {
  4497. public:
  4498. ValueSource();
  4499. virtual ~ValueSource();
  4500. virtual const var getValue() const = 0;
  4501. virtual void setValue (const var& newValue) = 0;
  4502. void sendChangeMessage (const bool dispatchSynchronously);
  4503. juce_UseDebuggingNewOperator
  4504. protected:
  4505. friend class Value;
  4506. SortedSet <Value*> valuesWithListeners;
  4507. void handleAsyncUpdate();
  4508. ValueSource (const ValueSource&);
  4509. const ValueSource& operator= (const ValueSource&);
  4510. };
  4511. explicit Value (ValueSource* const valueSource);
  4512. ValueSource& getValueSource() { return *value; }
  4513. juce_UseDebuggingNewOperator
  4514. private:
  4515. friend class ValueSource;
  4516. ReferenceCountedObjectPtr <ValueSource> value;
  4517. SortedSet <Listener*> listeners;
  4518. void callListeners();
  4519. // This is disallowed to avoid confusion about whether it should
  4520. // do a by-value or by-reference copy.
  4521. const Value& operator= (const Value& other);
  4522. };
  4523. #endif // __JUCE_VALUE_JUCEHEADER__
  4524. /*** End of inlined file: juce_Value.h ***/
  4525. #endif
  4526. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4527. /*** Start of inlined file: juce_ValueTree.h ***/
  4528. #ifndef __JUCE_VALUETREE_JUCEHEADER__
  4529. #define __JUCE_VALUETREE_JUCEHEADER__
  4530. /*** Start of inlined file: juce_UndoManager.h ***/
  4531. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  4532. #define __JUCE_UNDOMANAGER_JUCEHEADER__
  4533. /*** Start of inlined file: juce_ChangeBroadcaster.h ***/
  4534. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4535. #define __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4536. /*** Start of inlined file: juce_ChangeListenerList.h ***/
  4537. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4538. #define __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4539. /*** Start of inlined file: juce_ChangeListener.h ***/
  4540. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  4541. #define __JUCE_CHANGELISTENER_JUCEHEADER__
  4542. class JUCE_API ChangeListener
  4543. {
  4544. public:
  4545. virtual ~ChangeListener() {}
  4546. virtual void changeListenerCallback (void* objectThatHasChanged) = 0;
  4547. };
  4548. #endif // __JUCE_CHANGELISTENER_JUCEHEADER__
  4549. /*** End of inlined file: juce_ChangeListener.h ***/
  4550. /*** Start of inlined file: juce_ScopedLock.h ***/
  4551. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  4552. #define __JUCE_SCOPEDLOCK_JUCEHEADER__
  4553. class JUCE_API ScopedLock
  4554. {
  4555. public:
  4556. inline ScopedLock (const CriticalSection& lock) throw() : lock_ (lock) { lock.enter(); }
  4557. inline ~ScopedLock() throw() { lock_.exit(); }
  4558. private:
  4559. const CriticalSection& lock_;
  4560. ScopedLock (const ScopedLock&);
  4561. const ScopedLock& operator= (const ScopedLock&);
  4562. };
  4563. class ScopedUnlock
  4564. {
  4565. public:
  4566. inline ScopedUnlock (const CriticalSection& lock) throw() : lock_ (lock) { lock.exit(); }
  4567. inline ~ScopedUnlock() throw() { lock_.enter(); }
  4568. private:
  4569. const CriticalSection& lock_;
  4570. ScopedUnlock (const ScopedLock&);
  4571. const ScopedUnlock& operator= (const ScopedUnlock&);
  4572. };
  4573. #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__
  4574. /*** End of inlined file: juce_ScopedLock.h ***/
  4575. class JUCE_API ChangeListenerList : public MessageListener
  4576. {
  4577. public:
  4578. ChangeListenerList() throw();
  4579. ~ChangeListenerList() throw();
  4580. void addChangeListener (ChangeListener* const listener) throw();
  4581. void removeChangeListener (ChangeListener* const listener) throw();
  4582. void removeAllChangeListeners() throw();
  4583. void sendChangeMessage (void* objectThatHasChanged) throw();
  4584. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4585. void dispatchPendingMessages();
  4586. void handleMessage (const Message&);
  4587. juce_UseDebuggingNewOperator
  4588. private:
  4589. SortedSet <void*> listeners;
  4590. CriticalSection lock;
  4591. void* lastChangedObject;
  4592. bool messagePending;
  4593. ChangeListenerList (const ChangeListenerList&);
  4594. const ChangeListenerList& operator= (const ChangeListenerList&);
  4595. };
  4596. #endif // __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  4597. /*** End of inlined file: juce_ChangeListenerList.h ***/
  4598. class JUCE_API ChangeBroadcaster
  4599. {
  4600. public:
  4601. ChangeBroadcaster() throw();
  4602. virtual ~ChangeBroadcaster();
  4603. void addChangeListener (ChangeListener* const listener) throw();
  4604. void removeChangeListener (ChangeListener* const listener) throw();
  4605. void removeAllChangeListeners() throw();
  4606. void sendChangeMessage (void* objectThatHasChanged) throw();
  4607. void sendSynchronousChangeMessage (void* objectThatHasChanged);
  4608. void dispatchPendingMessages();
  4609. private:
  4610. ChangeListenerList changeListenerList;
  4611. ChangeBroadcaster (const ChangeBroadcaster&);
  4612. const ChangeBroadcaster& operator= (const ChangeBroadcaster&);
  4613. };
  4614. #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  4615. /*** End of inlined file: juce_ChangeBroadcaster.h ***/
  4616. /*** Start of inlined file: juce_UndoableAction.h ***/
  4617. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  4618. #define __JUCE_UNDOABLEACTION_JUCEHEADER__
  4619. class JUCE_API UndoableAction
  4620. {
  4621. protected:
  4622. UndoableAction() throw() {}
  4623. public:
  4624. virtual ~UndoableAction() {}
  4625. virtual bool perform() = 0;
  4626. virtual bool undo() = 0;
  4627. virtual int getSizeInUnits() { return 10; }
  4628. };
  4629. #endif // __JUCE_UNDOABLEACTION_JUCEHEADER__
  4630. /*** End of inlined file: juce_UndoableAction.h ***/
  4631. class JUCE_API UndoManager : public ChangeBroadcaster
  4632. {
  4633. public:
  4634. UndoManager (const int maxNumberOfUnitsToKeep = 30000,
  4635. const int minimumTransactionsToKeep = 30);
  4636. ~UndoManager();
  4637. void clearUndoHistory();
  4638. int getNumberOfUnitsTakenUpByStoredCommands() const;
  4639. void setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
  4640. const int minimumTransactionsToKeep);
  4641. bool perform (UndoableAction* const action,
  4642. const String& actionName = String::empty);
  4643. void beginNewTransaction (const String& actionName = String::empty);
  4644. void setCurrentTransactionName (const String& newName);
  4645. bool canUndo() const;
  4646. const String getUndoDescription() const;
  4647. bool undo();
  4648. bool undoCurrentTransactionOnly();
  4649. void getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const;
  4650. int getNumActionsInCurrentTransaction() const;
  4651. bool canRedo() const;
  4652. const String getRedoDescription() const;
  4653. bool redo();
  4654. juce_UseDebuggingNewOperator
  4655. private:
  4656. OwnedArray <OwnedArray <UndoableAction> > transactions;
  4657. StringArray transactionNames;
  4658. String currentTransactionName;
  4659. int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
  4660. bool newTransaction, reentrancyCheck;
  4661. // disallow copy constructor
  4662. UndoManager (const UndoManager&);
  4663. const UndoManager& operator= (const UndoManager&);
  4664. };
  4665. #endif // __JUCE_UNDOMANAGER_JUCEHEADER__
  4666. /*** End of inlined file: juce_UndoManager.h ***/
  4667. class JUCE_API ValueTree
  4668. {
  4669. public:
  4670. ValueTree (const String& type);
  4671. ValueTree (const ValueTree& other);
  4672. const ValueTree& operator= (const ValueTree& other);
  4673. ~ValueTree();
  4674. bool operator== (const ValueTree& other) const;
  4675. bool operator!= (const ValueTree& other) const;
  4676. bool isValid() const { return object != 0; }
  4677. ValueTree createCopy() const;
  4678. const String getType() const;
  4679. bool hasType (const String& typeName) const;
  4680. const var& getProperty (const var::identifier& name) const;
  4681. const var& operator[] (const var::identifier& name) const;
  4682. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4683. bool hasProperty (const var::identifier& name) const;
  4684. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4685. void removeAllProperties (UndoManager* const undoManager);
  4686. int getNumProperties() const;
  4687. const var::identifier getPropertyName (int index) const;
  4688. Value getPropertyAsValue (const var::identifier& name, UndoManager* const undoManager) const;
  4689. int getNumChildren() const;
  4690. ValueTree getChild (int index) const;
  4691. ValueTree getChildWithName (const String& type) const;
  4692. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4693. void addChild (ValueTree child, int index, UndoManager* const undoManager);
  4694. void removeChild (ValueTree& child, UndoManager* const undoManager);
  4695. void removeChild (const int childIndex, UndoManager* const undoManager);
  4696. void removeAllChildren (UndoManager* const undoManager);
  4697. bool isAChildOf (const ValueTree& possibleParent) const;
  4698. ValueTree getParent() const;
  4699. XmlElement* createXml() const;
  4700. static ValueTree fromXml (const XmlElement& xml);
  4701. void writeToStream (OutputStream& output);
  4702. static ValueTree readFromStream (InputStream& input);
  4703. class JUCE_API Listener
  4704. {
  4705. public:
  4706. virtual ~Listener() {}
  4707. virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
  4708. const var::identifier& property) = 0;
  4709. virtual void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) = 0;
  4710. virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0;
  4711. };
  4712. void addListener (Listener* listener);
  4713. void removeListener (Listener* listener);
  4714. template <typename ElementComparator>
  4715. void sort (ElementComparator& comparator, const bool retainOrderOfEquivalentItems = false)
  4716. {
  4717. if (object != 0)
  4718. {
  4719. ComparatorAdapter <ElementComparator> adapter (comparator);
  4720. object->children.sort (adapter, retainOrderOfEquivalentItems);
  4721. object->sendChildChangeMessage();
  4722. }
  4723. }
  4724. juce_UseDebuggingNewOperator
  4725. private:
  4726. friend class ValueTreeSetPropertyAction;
  4727. friend class ValueTreeChildChangeAction;
  4728. class JUCE_API SharedObject : public ReferenceCountedObject
  4729. {
  4730. public:
  4731. SharedObject (const String& type);
  4732. SharedObject (const SharedObject& other);
  4733. ~SharedObject();
  4734. const String type;
  4735. NamedValueSet properties;
  4736. ReferenceCountedArray <SharedObject> children;
  4737. SortedSet <ValueTree*> valueTreesWithListeners;
  4738. SharedObject* parent;
  4739. void sendPropertyChangeMessage (const var::identifier& property);
  4740. void sendPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4741. void sendChildChangeMessage();
  4742. void sendChildChangeMessage (ValueTree& tree);
  4743. void sendParentChangeMessage();
  4744. const var& getProperty (const var::identifier& name) const;
  4745. void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager);
  4746. bool hasProperty (const var::identifier& name) const;
  4747. void removeProperty (const var::identifier& name, UndoManager* const undoManager);
  4748. void removeAllProperties (UndoManager* const undoManager);
  4749. bool isAChildOf (const SharedObject* const possibleParent) const;
  4750. ValueTree getChildWithName (const String& type) const;
  4751. ValueTree getChildWithProperty (const var::identifier& propertyName, const var& propertyValue) const;
  4752. void addChild (SharedObject* child, int index, UndoManager* const undoManager);
  4753. void removeChild (const int childIndex, UndoManager* const undoManager);
  4754. void removeAllChildren (UndoManager* const undoManager);
  4755. XmlElement* createXml() const;
  4756. juce_UseDebuggingNewOperator
  4757. private:
  4758. const SharedObject& operator= (const SharedObject&);
  4759. };
  4760. template <typename ElementComparator>
  4761. class ComparatorAdapter
  4762. {
  4763. public:
  4764. ComparatorAdapter (ElementComparator& comparator_) throw() : comparator (comparator_) {}
  4765. int compareElements (SharedObject* const first, SharedObject* const second)
  4766. {
  4767. return comparator.compareElements (ValueTree (first), ValueTree (second));
  4768. }
  4769. private:
  4770. ElementComparator& comparator;
  4771. };
  4772. friend class SharedObject;
  4773. typedef ReferenceCountedObjectPtr <SharedObject> SharedObjectPtr;
  4774. ReferenceCountedObjectPtr <SharedObject> object;
  4775. SortedSet <Listener*> listeners;
  4776. void deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property);
  4777. void deliverChildChangeMessage (ValueTree& tree);
  4778. void deliverParentChangeMessage (ValueTree& tree);
  4779. ValueTree (SharedObject* const object_);
  4780. };
  4781. #endif // __JUCE_VALUETREE_JUCEHEADER__
  4782. /*** End of inlined file: juce_ValueTree.h ***/
  4783. #endif
  4784. #ifndef __JUCE_VARIANT_JUCEHEADER__
  4785. #endif
  4786. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4787. /*** Start of inlined file: juce_VoidArray.h ***/
  4788. #ifndef __JUCE_VOIDARRAY_JUCEHEADER__
  4789. #define __JUCE_VOIDARRAY_JUCEHEADER__
  4790. typedef Array <void*> VoidArray;
  4791. #endif // __JUCE_VOIDARRAY_JUCEHEADER__
  4792. /*** End of inlined file: juce_VoidArray.h ***/
  4793. #endif
  4794. #ifndef __JUCE_ATOMIC_JUCEHEADER__
  4795. #endif
  4796. #ifndef __JUCE_BYTEORDER_JUCEHEADER__
  4797. #endif
  4798. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4799. /*** Start of inlined file: juce_FileLogger.h ***/
  4800. #ifndef __JUCE_FILELOGGER_JUCEHEADER__
  4801. #define __JUCE_FILELOGGER_JUCEHEADER__
  4802. class JUCE_API FileLogger : public Logger
  4803. {
  4804. public:
  4805. FileLogger (const File& fileToWriteTo,
  4806. const String& welcomeMessage,
  4807. const int maxInitialFileSizeBytes = 128 * 1024);
  4808. ~FileLogger();
  4809. void logMessage (const String& message);
  4810. static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
  4811. const String& logFileName,
  4812. const String& welcomeMessage,
  4813. const int maxInitialFileSizeBytes = 128 * 1024);
  4814. juce_UseDebuggingNewOperator
  4815. private:
  4816. File logFile;
  4817. CriticalSection logLock;
  4818. ScopedPointer <FileOutputStream> logStream;
  4819. void trimFileSize (int maxFileSizeBytes) const;
  4820. FileLogger (const FileLogger&);
  4821. const FileLogger& operator= (const FileLogger&);
  4822. };
  4823. #endif // __JUCE_FILELOGGER_JUCEHEADER__
  4824. /*** End of inlined file: juce_FileLogger.h ***/
  4825. #endif
  4826. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4827. /*** Start of inlined file: juce_Initialisation.h ***/
  4828. #ifndef __JUCE_INITIALISATION_JUCEHEADER__
  4829. #define __JUCE_INITIALISATION_JUCEHEADER__
  4830. void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI();
  4831. void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  4832. void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI();
  4833. void JUCE_PUBLIC_FUNCTION shutdownJuce_NonGUI();
  4834. class ScopedJuceInitialiser_NonGUI
  4835. {
  4836. public:
  4837. ScopedJuceInitialiser_NonGUI() { initialiseJuce_NonGUI(); }
  4838. ~ScopedJuceInitialiser_NonGUI() { shutdownJuce_NonGUI(); }
  4839. };
  4840. class ScopedJuceInitialiser_GUI
  4841. {
  4842. public:
  4843. ScopedJuceInitialiser_GUI() { initialiseJuce_GUI(); }
  4844. ~ScopedJuceInitialiser_GUI() { shutdownJuce_GUI(); }
  4845. };
  4846. #endif // __JUCE_INITIALISATION_JUCEHEADER__
  4847. /*** End of inlined file: juce_Initialisation.h ***/
  4848. #endif
  4849. #ifndef __JUCE_LOGGER_JUCEHEADER__
  4850. #endif
  4851. #ifndef __JUCE_MATHSFUNCTIONS_JUCEHEADER__
  4852. #endif
  4853. #ifndef __JUCE_MEMORY_JUCEHEADER__
  4854. #endif
  4855. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4856. /*** Start of inlined file: juce_PerformanceCounter.h ***/
  4857. #ifndef __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4858. #define __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4859. class JUCE_API PerformanceCounter
  4860. {
  4861. public:
  4862. PerformanceCounter (const String& counterName,
  4863. int runsPerPrintout = 100,
  4864. const File& loggingFile = File::nonexistent);
  4865. ~PerformanceCounter();
  4866. void start();
  4867. void stop();
  4868. void printStatistics();
  4869. juce_UseDebuggingNewOperator
  4870. private:
  4871. String name;
  4872. int numRuns, runsPerPrint;
  4873. double totalTime;
  4874. int64 started;
  4875. File outputFile;
  4876. };
  4877. #endif // __JUCE_PERFORMANCECOUNTER_JUCEHEADER__
  4878. /*** End of inlined file: juce_PerformanceCounter.h ***/
  4879. #endif
  4880. #ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__
  4881. #endif
  4882. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4883. /*** Start of inlined file: juce_PlatformUtilities.h ***/
  4884. #ifndef __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4885. #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4886. class JUCE_API PlatformUtilities
  4887. {
  4888. public:
  4889. static void beep();
  4890. static bool launchEmailWithAttachments (const String& targetEmailAddress,
  4891. const String& emailSubject,
  4892. const String& bodyText,
  4893. const StringArray& filesToAttach);
  4894. #if JUCE_MAC || JUCE_IPHONE || DOXYGEN
  4895. static const String cfStringToJuceString (CFStringRef cfString);
  4896. static CFStringRef juceStringToCFString (const String& s);
  4897. static bool makeFSRefFromPath (FSRef* destFSRef, const String& path);
  4898. static const String makePathFromFSRef (FSRef* file);
  4899. static const String convertToPrecomposedUnicode (const String& s);
  4900. static OSType getTypeOfFile (const String& filename);
  4901. static bool isBundle (const String& filename);
  4902. static void addItemToDock (const File& file);
  4903. static int getOSXMinorVersionNumber();
  4904. #endif
  4905. #if JUCE_WINDOWS || DOXYGEN
  4906. // Some registry helper functions:
  4907. static const String getRegistryValue (const String& regValuePath,
  4908. const String& defaultValue = String::empty);
  4909. static void setRegistryValue (const String& regValuePath,
  4910. const String& value);
  4911. static bool registryValueExists (const String& regValuePath);
  4912. static void deleteRegistryValue (const String& regValuePath);
  4913. static void deleteRegistryKey (const String& regKeyPath);
  4914. static void registerFileAssociation (const String& fileExtension,
  4915. const String& symbolicDescription,
  4916. const String& fullDescription,
  4917. const File& targetExecutable,
  4918. int iconResourceNumber);
  4919. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw();
  4920. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw();
  4921. static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
  4922. #endif
  4923. static void fpuReset();
  4924. #if JUCE_LINUX || JUCE_WINDOWS
  4925. static void* loadDynamicLibrary (const String& pathOrFilename);
  4926. static void freeDynamicLibrary (void* libraryHandle);
  4927. static void* getProcedureEntryPoint (void* libraryHandle,
  4928. const String& procedureName);
  4929. #endif
  4930. #if JUCE_LINUX || DOXYGEN
  4931. #endif
  4932. };
  4933. #if JUCE_MAC || JUCE_IPHONE
  4934. class ScopedAutoReleasePool
  4935. {
  4936. public:
  4937. ScopedAutoReleasePool();
  4938. ~ScopedAutoReleasePool();
  4939. private:
  4940. void* pool;
  4941. ScopedAutoReleasePool (const ScopedAutoReleasePool&);
  4942. const ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&);
  4943. };
  4944. #endif
  4945. #if JUCE_LINUX
  4946. class ScopedXLock
  4947. {
  4948. public:
  4949. ScopedXLock();
  4950. ~ScopedXLock();
  4951. };
  4952. #endif
  4953. #if JUCE_MAC
  4954. class JUCE_API AppleRemoteDevice
  4955. {
  4956. public:
  4957. AppleRemoteDevice();
  4958. virtual ~AppleRemoteDevice();
  4959. enum ButtonType
  4960. {
  4961. menuButton = 0, /**< The menu button (if it's held for a short time). */
  4962. playButton, /**< The play button. */
  4963. plusButton, /**< The plus or volume-up button. */
  4964. minusButton, /**< The minus or volume-down button. */
  4965. rightButton, /**< The right button (if it's held for a short time). */
  4966. leftButton, /**< The left button (if it's held for a short time). */
  4967. rightButton_Long, /**< The right button (if it's held for a long time). */
  4968. leftButton_Long, /**< The menu button (if it's held for a long time). */
  4969. menuButton_Long, /**< The menu button (if it's held for a long time). */
  4970. playButtonSleepMode,
  4971. switched
  4972. };
  4973. virtual void buttonPressed (const ButtonType buttonId, const bool isDown) = 0;
  4974. bool start (const bool inExclusiveMode);
  4975. void stop();
  4976. bool isActive() const;
  4977. int getRemoteId() const { return remoteId; }
  4978. juce_UseDebuggingNewOperator
  4979. void handleCallbackInternal();
  4980. private:
  4981. void* device;
  4982. void* queue;
  4983. int remoteId;
  4984. bool open (const bool openInExclusiveMode);
  4985. AppleRemoteDevice (const AppleRemoteDevice&);
  4986. const AppleRemoteDevice& operator= (const AppleRemoteDevice&);
  4987. };
  4988. #endif
  4989. #endif // __JUCE_PLATFORMUTILITIES_JUCEHEADER__
  4990. /*** End of inlined file: juce_PlatformUtilities.h ***/
  4991. #endif
  4992. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4993. /*** Start of inlined file: juce_Random.h ***/
  4994. #ifndef __JUCE_RANDOM_JUCEHEADER__
  4995. #define __JUCE_RANDOM_JUCEHEADER__
  4996. class JUCE_API Random
  4997. {
  4998. public:
  4999. Random (const int64 seedValue) throw();
  5000. ~Random() throw();
  5001. int nextInt() throw();
  5002. int nextInt (const int maxValue) throw();
  5003. int64 nextInt64() throw();
  5004. float nextFloat() throw();
  5005. double nextDouble() throw();
  5006. bool nextBool() throw();
  5007. const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
  5008. void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
  5009. static Random& getSystemRandom() throw();
  5010. void setSeed (const int64 newSeed) throw();
  5011. void setSeedRandomly();
  5012. juce_UseDebuggingNewOperator
  5013. private:
  5014. int64 seed;
  5015. };
  5016. #endif // __JUCE_RANDOM_JUCEHEADER__
  5017. /*** End of inlined file: juce_Random.h ***/
  5018. #endif
  5019. #ifndef __JUCE_RELATIVETIME_JUCEHEADER__
  5020. #endif
  5021. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5022. /*** Start of inlined file: juce_Singleton.h ***/
  5023. #ifndef __JUCE_SINGLETON_JUCEHEADER__
  5024. #define __JUCE_SINGLETON_JUCEHEADER__
  5025. #define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \
  5026. \
  5027. static classname* _singletonInstance; \
  5028. static JUCE_NAMESPACE::CriticalSection _singletonLock; \
  5029. \
  5030. static classname* getInstance() \
  5031. { \
  5032. if (_singletonInstance == 0) \
  5033. {\
  5034. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5035. \
  5036. if (_singletonInstance == 0) \
  5037. { \
  5038. static bool alreadyInside = false; \
  5039. static bool createdOnceAlready = false; \
  5040. \
  5041. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5042. jassert (! problem); \
  5043. if (! problem) \
  5044. { \
  5045. createdOnceAlready = true; \
  5046. alreadyInside = true; \
  5047. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5048. alreadyInside = false; \
  5049. \
  5050. _singletonInstance = newObject; \
  5051. } \
  5052. } \
  5053. } \
  5054. \
  5055. return _singletonInstance; \
  5056. } \
  5057. \
  5058. static inline classname* getInstanceWithoutCreating() throw() \
  5059. { \
  5060. return _singletonInstance; \
  5061. } \
  5062. \
  5063. static void deleteInstance() \
  5064. { \
  5065. const JUCE_NAMESPACE::ScopedLock sl (_singletonLock); \
  5066. if (_singletonInstance != 0) \
  5067. { \
  5068. classname* const old = _singletonInstance; \
  5069. _singletonInstance = 0; \
  5070. delete old; \
  5071. } \
  5072. } \
  5073. \
  5074. void clearSingletonInstance() throw() \
  5075. { \
  5076. if (_singletonInstance == this) \
  5077. _singletonInstance = 0; \
  5078. }
  5079. #define juce_ImplementSingleton(classname) \
  5080. \
  5081. classname* classname::_singletonInstance = 0; \
  5082. JUCE_NAMESPACE::CriticalSection classname::_singletonLock;
  5083. #define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \
  5084. \
  5085. static classname* _singletonInstance; \
  5086. \
  5087. static classname* getInstance() \
  5088. { \
  5089. if (_singletonInstance == 0) \
  5090. { \
  5091. static bool alreadyInside = false; \
  5092. static bool createdOnceAlready = false; \
  5093. \
  5094. const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \
  5095. jassert (! problem); \
  5096. if (! problem) \
  5097. { \
  5098. createdOnceAlready = true; \
  5099. alreadyInside = true; \
  5100. classname* newObject = new classname(); /* (use a stack variable to avoid setting the newObject value before the class has finished its constructor) */ \
  5101. alreadyInside = false; \
  5102. \
  5103. _singletonInstance = newObject; \
  5104. } \
  5105. } \
  5106. \
  5107. return _singletonInstance; \
  5108. } \
  5109. \
  5110. static inline classname* getInstanceWithoutCreating() throw() \
  5111. { \
  5112. return _singletonInstance; \
  5113. } \
  5114. \
  5115. static void deleteInstance() \
  5116. { \
  5117. if (_singletonInstance != 0) \
  5118. { \
  5119. classname* const old = _singletonInstance; \
  5120. _singletonInstance = 0; \
  5121. delete old; \
  5122. } \
  5123. } \
  5124. \
  5125. void clearSingletonInstance() throw() \
  5126. { \
  5127. if (_singletonInstance == this) \
  5128. _singletonInstance = 0; \
  5129. }
  5130. #define juce_DeclareSingleton_SingleThreaded_Minimal(classname) \
  5131. \
  5132. static classname* _singletonInstance; \
  5133. \
  5134. static classname* getInstance() \
  5135. { \
  5136. if (_singletonInstance == 0) \
  5137. _singletonInstance = new classname(); \
  5138. \
  5139. return _singletonInstance; \
  5140. } \
  5141. \
  5142. static inline classname* getInstanceWithoutCreating() throw() \
  5143. { \
  5144. return _singletonInstance; \
  5145. } \
  5146. \
  5147. static void deleteInstance() \
  5148. { \
  5149. if (_singletonInstance != 0) \
  5150. { \
  5151. classname* const old = _singletonInstance; \
  5152. _singletonInstance = 0; \
  5153. delete old; \
  5154. } \
  5155. } \
  5156. \
  5157. void clearSingletonInstance() throw() \
  5158. { \
  5159. if (_singletonInstance == this) \
  5160. _singletonInstance = 0; \
  5161. }
  5162. #define juce_ImplementSingleton_SingleThreaded(classname) \
  5163. \
  5164. classname* classname::_singletonInstance = 0;
  5165. #endif // __JUCE_SINGLETON_JUCEHEADER__
  5166. /*** End of inlined file: juce_Singleton.h ***/
  5167. #endif
  5168. #ifndef __JUCE_STANDARDHEADER_JUCEHEADER__
  5169. #endif
  5170. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5171. /*** Start of inlined file: juce_SystemStats.h ***/
  5172. #ifndef __JUCE_SYSTEMSTATS_JUCEHEADER__
  5173. #define __JUCE_SYSTEMSTATS_JUCEHEADER__
  5174. class JUCE_API SystemStats
  5175. {
  5176. public:
  5177. static const String getJUCEVersion() throw();
  5178. enum OperatingSystemType
  5179. {
  5180. UnknownOS = 0,
  5181. MacOSX = 0x1000,
  5182. Linux = 0x2000,
  5183. Win95 = 0x4001,
  5184. Win98 = 0x4002,
  5185. WinNT351 = 0x4103,
  5186. WinNT40 = 0x4104,
  5187. Win2000 = 0x4105,
  5188. WinXP = 0x4106,
  5189. WinVista = 0x4107,
  5190. Windows7 = 0x4108,
  5191. Windows = 0x4000, /**< To test whether any version of Windows is running,
  5192. you can use the expression ((getOperatingSystemType() & Windows) != 0). */
  5193. WindowsNT = 0x0100, /**< To test whether the platform is Windows NT or later (i.e. not Win95 or 98),
  5194. you can use the expression ((getOperatingSystemType() & WindowsNT) != 0). */
  5195. };
  5196. static OperatingSystemType getOperatingSystemType() throw();
  5197. static const String getOperatingSystemName() throw();
  5198. static bool isOperatingSystem64Bit() throw();
  5199. static const String getLogonName();
  5200. static const String getFullUserName();
  5201. // CPU and memory information..
  5202. static int getCpuSpeedInMegaherz() throw();
  5203. static const String getCpuVendor() throw();
  5204. static bool hasMMX() throw();
  5205. static bool hasSSE() throw();
  5206. static bool hasSSE2() throw();
  5207. static bool has3DNow() throw();
  5208. static int getNumCpus() throw();
  5209. static int64 getClockCycleCounter() throw();
  5210. static int getMemorySizeInMegabytes() throw();
  5211. static int getPageSize() throw();
  5212. static int getMACAddresses (int64* addresses, int maxNum,
  5213. #if JUCE_MAC
  5214. const bool littleEndian = true) throw();
  5215. #else
  5216. const bool littleEndian = false) throw();
  5217. #endif
  5218. // not-for-public-use platform-specific method gets called at startup to initialise things.
  5219. static void initialiseStats() throw();
  5220. };
  5221. #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__
  5222. /*** End of inlined file: juce_SystemStats.h ***/
  5223. #endif
  5224. #ifndef __JUCE_TARGETPLATFORM_JUCEHEADER__
  5225. #endif
  5226. #ifndef __JUCE_TIME_JUCEHEADER__
  5227. #endif
  5228. #ifndef __JUCE_UUID_JUCEHEADER__
  5229. /*** Start of inlined file: juce_Uuid.h ***/
  5230. #ifndef __JUCE_UUID_JUCEHEADER__
  5231. #define __JUCE_UUID_JUCEHEADER__
  5232. class JUCE_API Uuid
  5233. {
  5234. public:
  5235. Uuid();
  5236. ~Uuid() throw();
  5237. Uuid (const Uuid& other);
  5238. Uuid& operator= (const Uuid& other);
  5239. bool isNull() const throw();
  5240. bool operator== (const Uuid& other) const;
  5241. bool operator!= (const Uuid& other) const;
  5242. const String toString() const;
  5243. Uuid (const String& uuidString);
  5244. Uuid& operator= (const String& uuidString);
  5245. const uint8* getRawData() const throw() { return value.asBytes; }
  5246. Uuid (const uint8* const rawData);
  5247. Uuid& operator= (const uint8* const rawData);
  5248. juce_UseDebuggingNewOperator
  5249. private:
  5250. union
  5251. {
  5252. uint8 asBytes [16];
  5253. int asInt[4];
  5254. int64 asInt64[2];
  5255. } value;
  5256. };
  5257. #endif // __JUCE_UUID_JUCEHEADER__
  5258. /*** End of inlined file: juce_Uuid.h ***/
  5259. #endif
  5260. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5261. /*** Start of inlined file: juce_BlowFish.h ***/
  5262. #ifndef __JUCE_BLOWFISH_JUCEHEADER__
  5263. #define __JUCE_BLOWFISH_JUCEHEADER__
  5264. class JUCE_API BlowFish
  5265. {
  5266. public:
  5267. BlowFish (const uint8* keyData, int keyBytes);
  5268. BlowFish (const BlowFish& other);
  5269. const BlowFish& operator= (const BlowFish& other);
  5270. ~BlowFish();
  5271. void encrypt (uint32& data1, uint32& data2) const;
  5272. void decrypt (uint32& data1, uint32& data2) const;
  5273. juce_UseDebuggingNewOperator
  5274. private:
  5275. uint32 p[18];
  5276. HeapBlock <uint32> s[4];
  5277. uint32 F (uint32 x) const;
  5278. };
  5279. #endif // __JUCE_BLOWFISH_JUCEHEADER__
  5280. /*** End of inlined file: juce_BlowFish.h ***/
  5281. #endif
  5282. #ifndef __JUCE_MD5_JUCEHEADER__
  5283. /*** Start of inlined file: juce_MD5.h ***/
  5284. #ifndef __JUCE_MD5_JUCEHEADER__
  5285. #define __JUCE_MD5_JUCEHEADER__
  5286. class JUCE_API MD5
  5287. {
  5288. public:
  5289. MD5();
  5290. MD5 (const MD5& other);
  5291. const MD5& operator= (const MD5& other);
  5292. MD5 (const MemoryBlock& data);
  5293. MD5 (const char* data, const size_t numBytes);
  5294. MD5 (const String& text);
  5295. MD5 (InputStream& input, int64 numBytesToRead = -1);
  5296. MD5 (const File& file);
  5297. ~MD5();
  5298. const MemoryBlock getRawChecksumData() const;
  5299. const String toHexString() const;
  5300. bool operator== (const MD5& other) const;
  5301. bool operator!= (const MD5& other) const;
  5302. juce_UseDebuggingNewOperator
  5303. private:
  5304. uint8 result [16];
  5305. struct ProcessContext
  5306. {
  5307. uint8 buffer [64];
  5308. uint32 state [4];
  5309. uint32 count [2];
  5310. ProcessContext();
  5311. void processBlock (const uint8* const data, size_t dataSize);
  5312. void transform (const uint8* const buffer);
  5313. void finish (uint8* const result);
  5314. };
  5315. void processStream (InputStream& input, int64 numBytesToRead);
  5316. };
  5317. #endif // __JUCE_MD5_JUCEHEADER__
  5318. /*** End of inlined file: juce_MD5.h ***/
  5319. #endif
  5320. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5321. /*** Start of inlined file: juce_Primes.h ***/
  5322. #ifndef __JUCE_PRIMES_JUCEHEADER__
  5323. #define __JUCE_PRIMES_JUCEHEADER__
  5324. class JUCE_API Primes
  5325. {
  5326. public:
  5327. static const BitArray createProbablePrime (int bitLength,
  5328. int certainty,
  5329. const int* randomSeeds = 0,
  5330. int numRandomSeeds = 0) throw();
  5331. static bool isProbablyPrime (const BitArray& number,
  5332. int certainty) throw();
  5333. };
  5334. #endif // __JUCE_PRIMES_JUCEHEADER__
  5335. /*** End of inlined file: juce_Primes.h ***/
  5336. #endif
  5337. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5338. /*** Start of inlined file: juce_RSAKey.h ***/
  5339. #ifndef __JUCE_RSAKEY_JUCEHEADER__
  5340. #define __JUCE_RSAKEY_JUCEHEADER__
  5341. class JUCE_API RSAKey
  5342. {
  5343. public:
  5344. RSAKey() throw();
  5345. RSAKey (const String& stringRepresentation) throw();
  5346. ~RSAKey() throw();
  5347. const String toString() const throw();
  5348. bool applyToValue (BitArray& value) const throw();
  5349. static void createKeyPair (RSAKey& publicKey,
  5350. RSAKey& privateKey,
  5351. const int numBits,
  5352. const int* randomSeeds = 0,
  5353. const int numRandomSeeds = 0) throw();
  5354. juce_UseDebuggingNewOperator
  5355. protected:
  5356. BitArray part1, part2;
  5357. };
  5358. #endif // __JUCE_RSAKEY_JUCEHEADER__
  5359. /*** End of inlined file: juce_RSAKey.h ***/
  5360. #endif
  5361. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5362. /*** Start of inlined file: juce_DirectoryIterator.h ***/
  5363. #ifndef __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5364. #define __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5365. class JUCE_API DirectoryIterator
  5366. {
  5367. public:
  5368. DirectoryIterator (const File& directory,
  5369. bool isRecursive,
  5370. const String& wildCard = JUCE_T("*"),
  5371. const int whatToLookFor = File::findFiles);
  5372. ~DirectoryIterator();
  5373. bool next();
  5374. const File getFile() const;
  5375. float getEstimatedProgress() const;
  5376. juce_UseDebuggingNewOperator
  5377. private:
  5378. Array <File> filesFound;
  5379. Array <File> dirsFound;
  5380. String wildCard;
  5381. int index;
  5382. const int whatToLookFor;
  5383. ScopedPointer <DirectoryIterator> subIterator;
  5384. DirectoryIterator (const DirectoryIterator&);
  5385. const DirectoryIterator& operator= (const DirectoryIterator&);
  5386. };
  5387. #endif // __JUCE_DIRECTORYITERATOR_JUCEHEADER__
  5388. /*** End of inlined file: juce_DirectoryIterator.h ***/
  5389. #endif
  5390. #ifndef __JUCE_FILE_JUCEHEADER__
  5391. #endif
  5392. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5393. /*** Start of inlined file: juce_FileInputStream.h ***/
  5394. #ifndef __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5395. #define __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5396. class JUCE_API FileInputStream : public InputStream
  5397. {
  5398. public:
  5399. FileInputStream (const File& fileToRead);
  5400. ~FileInputStream();
  5401. const File& getFile() const throw() { return file; }
  5402. int64 getTotalLength();
  5403. int read (void* destBuffer, int maxBytesToRead);
  5404. bool isExhausted();
  5405. int64 getPosition();
  5406. bool setPosition (int64 pos);
  5407. juce_UseDebuggingNewOperator
  5408. private:
  5409. File file;
  5410. void* fileHandle;
  5411. int64 currentPosition, totalSize;
  5412. bool needToSeek;
  5413. FileInputStream (const FileInputStream&);
  5414. const FileInputStream& operator= (const FileInputStream&);
  5415. };
  5416. #endif // __JUCE_FILEINPUTSTREAM_JUCEHEADER__
  5417. /*** End of inlined file: juce_FileInputStream.h ***/
  5418. #endif
  5419. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5420. /*** Start of inlined file: juce_FileOutputStream.h ***/
  5421. #ifndef __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5422. #define __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5423. class JUCE_API FileOutputStream : public OutputStream
  5424. {
  5425. public:
  5426. FileOutputStream (const File& fileToWriteTo,
  5427. const int bufferSizeToUse = 16384);
  5428. ~FileOutputStream();
  5429. const File& getFile() const { return file; }
  5430. bool failedToOpen() const { return fileHandle == 0; }
  5431. void flush();
  5432. int64 getPosition();
  5433. bool setPosition (int64 pos);
  5434. bool write (const void* data, int numBytes);
  5435. juce_UseDebuggingNewOperator
  5436. private:
  5437. File file;
  5438. void* fileHandle;
  5439. int64 currentPosition;
  5440. int bufferSize, bytesInBuffer;
  5441. HeapBlock <char> buffer;
  5442. };
  5443. #endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
  5444. /*** End of inlined file: juce_FileOutputStream.h ***/
  5445. #endif
  5446. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5447. /*** Start of inlined file: juce_FileSearchPath.h ***/
  5448. #ifndef __JUCE_FILESEARCHPATH_JUCEHEADER__
  5449. #define __JUCE_FILESEARCHPATH_JUCEHEADER__
  5450. class JUCE_API FileSearchPath
  5451. {
  5452. public:
  5453. FileSearchPath();
  5454. FileSearchPath (const String& path);
  5455. FileSearchPath (const FileSearchPath& other);
  5456. ~FileSearchPath();
  5457. const FileSearchPath& operator= (const String& path);
  5458. int getNumPaths() const;
  5459. const File operator[] (const int index) const;
  5460. const String toString() const;
  5461. void add (const File& directoryToAdd,
  5462. const int insertIndex = -1);
  5463. void addIfNotAlreadyThere (const File& directoryToAdd);
  5464. void remove (const int indexToRemove);
  5465. void addPath (const FileSearchPath& other);
  5466. void removeRedundantPaths();
  5467. void removeNonExistentPaths();
  5468. int findChildFiles (Array<File>& results,
  5469. const int whatToLookFor,
  5470. const bool searchRecursively,
  5471. const String& wildCardPattern = JUCE_T("*")) const;
  5472. bool isFileInPath (const File& fileToCheck,
  5473. const bool checkRecursively) const;
  5474. juce_UseDebuggingNewOperator
  5475. private:
  5476. StringArray directories;
  5477. void init (const String& path);
  5478. };
  5479. #endif // __JUCE_FILESEARCHPATH_JUCEHEADER__
  5480. /*** End of inlined file: juce_FileSearchPath.h ***/
  5481. #endif
  5482. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5483. /*** Start of inlined file: juce_NamedPipe.h ***/
  5484. #ifndef __JUCE_NAMEDPIPE_JUCEHEADER__
  5485. #define __JUCE_NAMEDPIPE_JUCEHEADER__
  5486. class JUCE_API NamedPipe
  5487. {
  5488. public:
  5489. NamedPipe();
  5490. ~NamedPipe();
  5491. bool openExisting (const String& pipeName);
  5492. bool createNewPipe (const String& pipeName);
  5493. void close();
  5494. bool isOpen() const;
  5495. const String getName() const;
  5496. int read (void* destBuffer, int maxBytesToRead, int timeOutMilliseconds = 5000);
  5497. int write (const void* sourceBuffer, int numBytesToWrite,
  5498. int timeOutMilliseconds = 2000);
  5499. void cancelPendingReads();
  5500. juce_UseDebuggingNewOperator
  5501. private:
  5502. void* internal;
  5503. String currentPipeName;
  5504. NamedPipe (const NamedPipe&);
  5505. const NamedPipe& operator= (const NamedPipe&);
  5506. bool openInternal (const String& pipeName, const bool createPipe);
  5507. };
  5508. #endif // __JUCE_NAMEDPIPE_JUCEHEADER__
  5509. /*** End of inlined file: juce_NamedPipe.h ***/
  5510. #endif
  5511. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5512. /*** Start of inlined file: juce_TemporaryFile.h ***/
  5513. #ifndef __JUCE_TEMPORARYFILE_JUCEHEADER__
  5514. #define __JUCE_TEMPORARYFILE_JUCEHEADER__
  5515. class JUCE_API TemporaryFile
  5516. {
  5517. public:
  5518. enum OptionFlags
  5519. {
  5520. useHiddenFile = 1, /**< Indicates that the temporary file should be hidden -
  5521. i.e. its name should start with a dot. */
  5522. putNumbersInBrackets = 2 /**< Indicates that when numbers are appended to make sure
  5523. the file is unique, they should go in brackets rather
  5524. than just being appended (see File::getNonexistentSibling() )*/
  5525. };
  5526. TemporaryFile (const String& suffix = String::empty,
  5527. const int optionFlags = 0);
  5528. TemporaryFile (const File& targetFile,
  5529. const int optionFlags = 0);
  5530. ~TemporaryFile();
  5531. const File getFile() const { return temporaryFile; }
  5532. const File getTargetFile() const { return targetFile; }
  5533. bool overwriteTargetFileWithTemporary() const;
  5534. juce_UseDebuggingNewOperator
  5535. private:
  5536. File temporaryFile, targetFile;
  5537. void createTempFile (const File& parentDirectory, String name, const String& suffix, const int optionFlags);
  5538. TemporaryFile (const TemporaryFile&);
  5539. const TemporaryFile& operator= (const TemporaryFile&);
  5540. };
  5541. #endif // __JUCE_TEMPORARYFILE_JUCEHEADER__
  5542. /*** End of inlined file: juce_TemporaryFile.h ***/
  5543. #endif
  5544. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5545. /*** Start of inlined file: juce_ZipFile.h ***/
  5546. #ifndef __JUCE_ZIPFILE_JUCEHEADER__
  5547. #define __JUCE_ZIPFILE_JUCEHEADER__
  5548. /*** Start of inlined file: juce_InputSource.h ***/
  5549. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5550. #define __JUCE_INPUTSOURCE_JUCEHEADER__
  5551. class JUCE_API InputSource
  5552. {
  5553. public:
  5554. InputSource() throw() {}
  5555. virtual ~InputSource() {}
  5556. virtual InputStream* createInputStream() = 0;
  5557. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  5558. virtual int64 hashCode() const = 0;
  5559. juce_UseDebuggingNewOperator
  5560. };
  5561. #endif // __JUCE_INPUTSOURCE_JUCEHEADER__
  5562. /*** End of inlined file: juce_InputSource.h ***/
  5563. class JUCE_API ZipFile
  5564. {
  5565. public:
  5566. ZipFile (InputStream* const inputStream,
  5567. const bool deleteStreamWhenDestroyed) throw();
  5568. ZipFile (const File& file);
  5569. ZipFile (InputSource* const inputSource);
  5570. ~ZipFile() throw();
  5571. struct ZipEntry
  5572. {
  5573. String filename;
  5574. unsigned int uncompressedSize;
  5575. Time fileTime;
  5576. };
  5577. int getNumEntries() const throw();
  5578. const ZipEntry* getEntry (const int index) const throw();
  5579. int getIndexOfFileName (const String& fileName) const throw();
  5580. const ZipEntry* getEntry (const String& fileName) const throw();
  5581. void sortEntriesByFilename();
  5582. InputStream* createStreamForEntry (const int index);
  5583. void uncompressTo (const File& targetDirectory,
  5584. const bool shouldOverwriteFiles = true);
  5585. juce_UseDebuggingNewOperator
  5586. private:
  5587. class ZipInputStream;
  5588. class ZipFilenameComparator;
  5589. class ZipEntryInfo;
  5590. OwnedArray <ZipEntryInfo> entries;
  5591. CriticalSection lock;
  5592. InputStream* inputStream;
  5593. ScopedPointer <InputStream> streamToDelete;
  5594. ScopedPointer <InputSource> inputSource;
  5595. #ifdef JUCE_DEBUG
  5596. int numOpenStreams;
  5597. #endif
  5598. void init();
  5599. int findEndOfZipEntryTable (InputStream* in, int& numEntries);
  5600. static int compareElements (const ZipEntryInfo* first, const ZipEntryInfo* second);
  5601. ZipFile (const ZipFile&);
  5602. const ZipFile& operator= (const ZipFile&);
  5603. };
  5604. #endif // __JUCE_ZIPFILE_JUCEHEADER__
  5605. /*** End of inlined file: juce_ZipFile.h ***/
  5606. #endif
  5607. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5608. /*** Start of inlined file: juce_Socket.h ***/
  5609. #ifndef __JUCE_SOCKET_JUCEHEADER__
  5610. #define __JUCE_SOCKET_JUCEHEADER__
  5611. class JUCE_API StreamingSocket
  5612. {
  5613. public:
  5614. StreamingSocket();
  5615. ~StreamingSocket();
  5616. bool bindToPort (const int localPortNumber);
  5617. bool connect (const String& remoteHostname,
  5618. const int remotePortNumber,
  5619. const int timeOutMillisecs = 3000);
  5620. bool isConnected() const throw() { return connected; }
  5621. void close();
  5622. const String& getHostName() const throw() { return hostName; }
  5623. int getPort() const throw() { return portNumber; }
  5624. bool isLocal() const throw();
  5625. int waitUntilReady (const bool readyForReading,
  5626. const int timeoutMsecs) const;
  5627. int read (void* destBuffer, const int maxBytesToRead,
  5628. const bool blockUntilSpecifiedAmountHasArrived);
  5629. int write (const void* sourceBuffer, const int numBytesToWrite);
  5630. bool createListener (const int portNumber, const String& localHostName = String::empty);
  5631. StreamingSocket* waitForNextConnection() const;
  5632. juce_UseDebuggingNewOperator
  5633. private:
  5634. String hostName;
  5635. int volatile portNumber, handle;
  5636. bool connected, isListener;
  5637. StreamingSocket (const String& hostname, const int portNumber, const int handle);
  5638. StreamingSocket (const StreamingSocket&);
  5639. const StreamingSocket& operator= (const StreamingSocket&);
  5640. };
  5641. class JUCE_API DatagramSocket
  5642. {
  5643. public:
  5644. DatagramSocket (const int localPortNumber,
  5645. const bool enableBroadcasting = false);
  5646. ~DatagramSocket();
  5647. bool bindToPort (const int localPortNumber);
  5648. bool connect (const String& remoteHostname,
  5649. const int remotePortNumber,
  5650. const int timeOutMillisecs = 3000);
  5651. bool isConnected() const throw() { return connected; }
  5652. void close();
  5653. const String& getHostName() const throw() { return hostName; }
  5654. int getPort() const throw() { return portNumber; }
  5655. bool isLocal() const throw();
  5656. int waitUntilReady (const bool readyForReading,
  5657. const int timeoutMsecs) const;
  5658. int read (void* destBuffer, const int maxBytesToRead,
  5659. const bool blockUntilSpecifiedAmountHasArrived);
  5660. int write (const void* sourceBuffer, const int numBytesToWrite);
  5661. DatagramSocket* waitForNextConnection() const;
  5662. juce_UseDebuggingNewOperator
  5663. private:
  5664. String hostName;
  5665. int volatile portNumber, handle;
  5666. bool connected, allowBroadcast;
  5667. void* serverAddress;
  5668. DatagramSocket (const String& hostname, const int portNumber, const int handle, const int localPortNumber);
  5669. DatagramSocket (const DatagramSocket&);
  5670. const DatagramSocket& operator= (const DatagramSocket&);
  5671. };
  5672. #endif // __JUCE_SOCKET_JUCEHEADER__
  5673. /*** End of inlined file: juce_Socket.h ***/
  5674. #endif
  5675. #ifndef __JUCE_URL_JUCEHEADER__
  5676. /*** Start of inlined file: juce_URL.h ***/
  5677. #ifndef __JUCE_URL_JUCEHEADER__
  5678. #define __JUCE_URL_JUCEHEADER__
  5679. class JUCE_API URL
  5680. {
  5681. public:
  5682. URL();
  5683. URL (const String& url);
  5684. URL (const URL& other);
  5685. ~URL();
  5686. const URL& operator= (const URL& other);
  5687. const String toString (const bool includeGetParameters) const;
  5688. bool isWellFormed() const;
  5689. const String getDomain() const;
  5690. const String getSubPath() const;
  5691. const String getScheme() const;
  5692. const URL withNewSubPath (const String& newPath) const;
  5693. const URL withParameter (const String& parameterName,
  5694. const String& parameterValue) const;
  5695. const URL withFileToUpload (const String& parameterName,
  5696. const File& fileToUpload,
  5697. const String& mimeType) const;
  5698. const StringPairArray& getParameters() const;
  5699. const StringPairArray& getFilesToUpload() const;
  5700. const StringPairArray& getMimeTypesOfUploadFiles() const;
  5701. const URL withPOSTData (const String& postData) const;
  5702. const String getPostData() const { return postData; }
  5703. bool launchInDefaultBrowser() const;
  5704. static bool isProbablyAWebsiteURL (const String& possibleURL);
  5705. static bool isProbablyAnEmailAddress (const String& possibleEmailAddress);
  5706. typedef bool (OpenStreamProgressCallback) (void* context, int bytesSent, int totalBytes);
  5707. InputStream* createInputStream (const bool usePostCommand,
  5708. OpenStreamProgressCallback* const progressCallback = 0,
  5709. void* const progressCallbackContext = 0,
  5710. const String& extraHeaders = String::empty,
  5711. const int connectionTimeOutMs = 0) const;
  5712. bool readEntireBinaryStream (MemoryBlock& destData,
  5713. const bool usePostCommand = false) const;
  5714. const String readEntireTextStream (const bool usePostCommand = false) const;
  5715. XmlElement* readEntireXmlStream (const bool usePostCommand = false) const;
  5716. static const String addEscapeChars (const String& stringToAddEscapeCharsTo,
  5717. const bool isParameter);
  5718. static const String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom);
  5719. juce_UseDebuggingNewOperator
  5720. private:
  5721. String url, postData;
  5722. StringPairArray parameters, filesToUpload, mimeTypes;
  5723. };
  5724. #endif // __JUCE_URL_JUCEHEADER__
  5725. /*** End of inlined file: juce_URL.h ***/
  5726. #endif
  5727. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5728. /*** Start of inlined file: juce_BufferedInputStream.h ***/
  5729. #ifndef __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5730. #define __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5731. class JUCE_API BufferedInputStream : public InputStream
  5732. {
  5733. public:
  5734. BufferedInputStream (InputStream* const sourceStream,
  5735. const int bufferSize,
  5736. const bool deleteSourceWhenDestroyed);
  5737. ~BufferedInputStream();
  5738. int64 getTotalLength();
  5739. int64 getPosition();
  5740. bool setPosition (int64 newPosition);
  5741. int read (void* destBuffer, int maxBytesToRead);
  5742. const String readString();
  5743. bool isExhausted();
  5744. juce_UseDebuggingNewOperator
  5745. private:
  5746. InputStream* const source;
  5747. ScopedPointer <InputStream> sourceToDelete;
  5748. int bufferSize;
  5749. int64 position, lastReadPos, bufferStart, bufferOverlap;
  5750. HeapBlock <char> buffer;
  5751. void ensureBuffered();
  5752. BufferedInputStream (const BufferedInputStream&);
  5753. const BufferedInputStream& operator= (const BufferedInputStream&);
  5754. };
  5755. #endif // __JUCE_BUFFEREDINPUTSTREAM_JUCEHEADER__
  5756. /*** End of inlined file: juce_BufferedInputStream.h ***/
  5757. #endif
  5758. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5759. /*** Start of inlined file: juce_FileInputSource.h ***/
  5760. #ifndef __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5761. #define __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5762. class JUCE_API FileInputSource : public InputSource
  5763. {
  5764. public:
  5765. FileInputSource (const File& file);
  5766. ~FileInputSource();
  5767. InputStream* createInputStream();
  5768. InputStream* createInputStreamFor (const String& relatedItemPath);
  5769. int64 hashCode() const;
  5770. juce_UseDebuggingNewOperator
  5771. private:
  5772. const File file;
  5773. FileInputSource (const FileInputSource&);
  5774. const FileInputSource& operator= (const FileInputSource&);
  5775. };
  5776. #endif // __JUCE_FILEINPUTSOURCE_JUCEHEADER__
  5777. /*** End of inlined file: juce_FileInputSource.h ***/
  5778. #endif
  5779. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5780. /*** Start of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5781. #ifndef __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5782. #define __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5783. class GZIPCompressorHelper;
  5784. class JUCE_API GZIPCompressorOutputStream : public OutputStream
  5785. {
  5786. public:
  5787. GZIPCompressorOutputStream (OutputStream* const destStream,
  5788. int compressionLevel = 0,
  5789. const bool deleteDestStreamWhenDestroyed = false,
  5790. const bool noWrap = false);
  5791. ~GZIPCompressorOutputStream();
  5792. void flush();
  5793. int64 getPosition();
  5794. bool setPosition (int64 newPosition);
  5795. bool write (const void* destBuffer, int howMany);
  5796. juce_UseDebuggingNewOperator
  5797. private:
  5798. OutputStream* const destStream;
  5799. ScopedPointer <OutputStream> streamToDelete;
  5800. HeapBlock <uint8> buffer;
  5801. ScopedPointer <GZIPCompressorHelper> helper;
  5802. bool doNextBlock();
  5803. GZIPCompressorOutputStream (const GZIPCompressorOutputStream&);
  5804. const GZIPCompressorOutputStream& operator= (const GZIPCompressorOutputStream&);
  5805. };
  5806. #endif // __JUCE_GZIPCOMPRESSOROUTPUTSTREAM_JUCEHEADER__
  5807. /*** End of inlined file: juce_GZIPCompressorOutputStream.h ***/
  5808. #endif
  5809. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5810. /*** Start of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5811. #ifndef __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5812. #define __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5813. class GZIPDecompressHelper;
  5814. class JUCE_API GZIPDecompressorInputStream : public InputStream
  5815. {
  5816. public:
  5817. GZIPDecompressorInputStream (InputStream* const sourceStream,
  5818. const bool deleteSourceWhenDestroyed,
  5819. const bool noWrap = false,
  5820. const int64 uncompressedStreamLength = -1);
  5821. ~GZIPDecompressorInputStream();
  5822. int64 getPosition();
  5823. bool setPosition (int64 pos);
  5824. int64 getTotalLength();
  5825. bool isExhausted();
  5826. int read (void* destBuffer, int maxBytesToRead);
  5827. juce_UseDebuggingNewOperator
  5828. private:
  5829. InputStream* const sourceStream;
  5830. ScopedPointer <InputStream> streamToDelete;
  5831. const int64 uncompressedStreamLength;
  5832. const bool noWrap;
  5833. bool isEof;
  5834. int activeBufferSize;
  5835. int64 originalSourcePos, currentPos;
  5836. HeapBlock <uint8> buffer;
  5837. ScopedPointer <GZIPDecompressHelper> helper;
  5838. GZIPDecompressorInputStream (const GZIPDecompressorInputStream&);
  5839. const GZIPDecompressorInputStream& operator= (const GZIPDecompressorInputStream&);
  5840. };
  5841. #endif // __JUCE_GZIPDECOMPRESSORINPUTSTREAM_JUCEHEADER__
  5842. /*** End of inlined file: juce_GZIPDecompressorInputStream.h ***/
  5843. #endif
  5844. #ifndef __JUCE_INPUTSOURCE_JUCEHEADER__
  5845. #endif
  5846. #ifndef __JUCE_INPUTSTREAM_JUCEHEADER__
  5847. #endif
  5848. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5849. /*** Start of inlined file: juce_MemoryInputStream.h ***/
  5850. #ifndef __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5851. #define __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5852. class JUCE_API MemoryInputStream : public InputStream
  5853. {
  5854. public:
  5855. MemoryInputStream (const void* const sourceData,
  5856. const size_t sourceDataSize,
  5857. const bool keepInternalCopyOfData);
  5858. ~MemoryInputStream();
  5859. int64 getPosition();
  5860. bool setPosition (int64 pos);
  5861. int64 getTotalLength();
  5862. bool isExhausted();
  5863. int read (void* destBuffer, int maxBytesToRead);
  5864. juce_UseDebuggingNewOperator
  5865. private:
  5866. const char* data;
  5867. size_t dataSize, position;
  5868. MemoryBlock internalCopy;
  5869. };
  5870. #endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
  5871. /*** End of inlined file: juce_MemoryInputStream.h ***/
  5872. #endif
  5873. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5874. /*** Start of inlined file: juce_MemoryOutputStream.h ***/
  5875. #ifndef __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5876. #define __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5877. class JUCE_API MemoryOutputStream : public OutputStream
  5878. {
  5879. public:
  5880. MemoryOutputStream (const size_t initialSize = 256,
  5881. const size_t granularity = 256,
  5882. MemoryBlock* const memoryBlockToWriteTo = 0) throw();
  5883. ~MemoryOutputStream() throw();
  5884. const char* getData() const throw();
  5885. size_t getDataSize() const throw();
  5886. void reset() throw();
  5887. void flush();
  5888. bool write (const void* buffer, int howMany);
  5889. int64 getPosition();
  5890. bool setPosition (int64 newPosition);
  5891. juce_UseDebuggingNewOperator
  5892. private:
  5893. MemoryBlock* data;
  5894. ScopedPointer <MemoryBlock> dataToDelete;
  5895. size_t position, size, blockSize;
  5896. };
  5897. #endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
  5898. /*** End of inlined file: juce_MemoryOutputStream.h ***/
  5899. #endif
  5900. #ifndef __JUCE_OUTPUTSTREAM_JUCEHEADER__
  5901. #endif
  5902. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5903. /*** Start of inlined file: juce_SubregionStream.h ***/
  5904. #ifndef __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5905. #define __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5906. class JUCE_API SubregionStream : public InputStream
  5907. {
  5908. public:
  5909. SubregionStream (InputStream* const sourceStream,
  5910. const int64 startPositionInSourceStream,
  5911. const int64 lengthOfSourceStream,
  5912. const bool deleteSourceWhenDestroyed) throw();
  5913. ~SubregionStream() throw();
  5914. int64 getTotalLength();
  5915. int64 getPosition();
  5916. bool setPosition (int64 newPosition);
  5917. int read (void* destBuffer, int maxBytesToRead);
  5918. bool isExhausted();
  5919. juce_UseDebuggingNewOperator
  5920. private:
  5921. InputStream* const source;
  5922. ScopedPointer <InputStream> sourceToDelete;
  5923. const int64 startPositionInSourceStream, lengthOfSourceStream;
  5924. SubregionStream (const SubregionStream&);
  5925. const SubregionStream& operator= (const SubregionStream&);
  5926. };
  5927. #endif // __JUCE_SUBREGIONSTREAM_JUCEHEADER__
  5928. /*** End of inlined file: juce_SubregionStream.h ***/
  5929. #endif
  5930. #ifndef __JUCE_CHARACTERFUNCTIONS_JUCEHEADER__
  5931. #endif
  5932. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5933. /*** Start of inlined file: juce_LocalisedStrings.h ***/
  5934. #ifndef __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5935. #define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5936. #define TRANS(stringLiteral) \
  5937. LocalisedStrings::translateWithCurrentMappings (stringLiteral)
  5938. class JUCE_API LocalisedStrings
  5939. {
  5940. public:
  5941. LocalisedStrings (const String& fileContents);
  5942. LocalisedStrings (const File& fileToLoad);
  5943. ~LocalisedStrings();
  5944. static void setCurrentMappings (LocalisedStrings* newTranslations);
  5945. static LocalisedStrings* getCurrentMappings();
  5946. static const String translateWithCurrentMappings (const String& text);
  5947. static const String translateWithCurrentMappings (const char* text);
  5948. const String translate (const String& text) const;
  5949. const String getLanguageName() const { return languageName; }
  5950. const StringArray getCountryCodes() const { return countryCodes; }
  5951. void setIgnoresCase (const bool shouldIgnoreCase);
  5952. juce_UseDebuggingNewOperator
  5953. private:
  5954. String languageName;
  5955. StringArray countryCodes;
  5956. StringPairArray translations;
  5957. void loadFromText (const String& fileContents);
  5958. };
  5959. #endif // __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
  5960. /*** End of inlined file: juce_LocalisedStrings.h ***/
  5961. #endif
  5962. #ifndef __JUCE_STRING_JUCEHEADER__
  5963. #endif
  5964. #ifndef __JUCE_STRINGARRAY_JUCEHEADER__
  5965. #endif
  5966. #ifndef __JUCE_STRINGPAIRARRAY_JUCEHEADER__
  5967. #endif
  5968. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5969. /*** Start of inlined file: juce_XmlDocument.h ***/
  5970. #ifndef __JUCE_XMLDOCUMENT_JUCEHEADER__
  5971. #define __JUCE_XMLDOCUMENT_JUCEHEADER__
  5972. class JUCE_API XmlDocument
  5973. {
  5974. public:
  5975. XmlDocument (const String& documentText) throw();
  5976. XmlDocument (const File& file);
  5977. ~XmlDocument() throw();
  5978. XmlElement* getDocumentElement (const bool onlyReadOuterDocumentElement = false);
  5979. const String& getLastParseError() const throw();
  5980. void setInputSource (InputSource* const newSource) throw();
  5981. void setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw();
  5982. juce_UseDebuggingNewOperator
  5983. private:
  5984. String originalText;
  5985. const tchar* input;
  5986. bool outOfData, errorOccurred;
  5987. bool identifierLookupTable [128];
  5988. String lastError, dtdText;
  5989. StringArray tokenisedDTD;
  5990. bool needToLoadDTD, ignoreEmptyTextElements;
  5991. ScopedPointer <InputSource> inputSource;
  5992. void setLastError (const String& desc, const bool carryOn) throw();
  5993. void skipHeader() throw();
  5994. void skipNextWhiteSpace() throw();
  5995. tchar readNextChar() throw();
  5996. XmlElement* readNextElement (const bool alsoParseSubElements) throw();
  5997. void readChildElements (XmlElement* parent) throw();
  5998. int findNextTokenLength() throw();
  5999. void readQuotedString (String& result) throw();
  6000. void readEntity (String& result) throw();
  6001. static bool isXmlIdentifierCharSlow (const tchar c) throw();
  6002. bool isXmlIdentifierChar (const tchar c) const throw();
  6003. const String getFileContents (const String& filename) const;
  6004. const String expandEntity (const String& entity);
  6005. const String expandExternalEntity (const String& entity);
  6006. const String getParameterEntity (const String& entity);
  6007. };
  6008. #endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
  6009. /*** End of inlined file: juce_XmlDocument.h ***/
  6010. #endif
  6011. #ifndef __JUCE_XMLELEMENT_JUCEHEADER__
  6012. #endif
  6013. #ifndef __JUCE_CRITICALSECTION_JUCEHEADER__
  6014. #endif
  6015. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6016. /*** Start of inlined file: juce_InterProcessLock.h ***/
  6017. #ifndef __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6018. #define __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6019. class JUCE_API InterProcessLock
  6020. {
  6021. public:
  6022. InterProcessLock (const String& name);
  6023. ~InterProcessLock();
  6024. bool enter (int timeOutMillisecs = -1);
  6025. void exit();
  6026. juce_UseDebuggingNewOperator
  6027. private:
  6028. #if JUCE_WINDOWS
  6029. void* internal;
  6030. // #elif JUCE_64BIT
  6031. // long long internal;
  6032. #else
  6033. int internal;
  6034. #endif
  6035. String name;
  6036. int reentrancyLevel;
  6037. InterProcessLock (const InterProcessLock&);
  6038. const InterProcessLock& operator= (const InterProcessLock&);
  6039. };
  6040. #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__
  6041. /*** End of inlined file: juce_InterProcessLock.h ***/
  6042. #endif
  6043. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6044. /*** Start of inlined file: juce_Process.h ***/
  6045. #ifndef __JUCE_PROCESS_JUCEHEADER__
  6046. #define __JUCE_PROCESS_JUCEHEADER__
  6047. class JUCE_API Process
  6048. {
  6049. public:
  6050. enum ProcessPriority
  6051. {
  6052. LowPriority = 0,
  6053. NormalPriority = 1,
  6054. HighPriority = 2,
  6055. RealtimePriority = 3
  6056. };
  6057. static void setPriority (const ProcessPriority priority);
  6058. static void terminate();
  6059. static bool isForegroundProcess();
  6060. static void raisePrivilege();
  6061. static void lowerPrivilege();
  6062. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  6063. };
  6064. #endif // __JUCE_PROCESS_JUCEHEADER__
  6065. /*** End of inlined file: juce_Process.h ***/
  6066. #endif
  6067. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6068. /*** Start of inlined file: juce_ReadWriteLock.h ***/
  6069. #ifndef __JUCE_READWRITELOCK_JUCEHEADER__
  6070. #define __JUCE_READWRITELOCK_JUCEHEADER__
  6071. /*** Start of inlined file: juce_WaitableEvent.h ***/
  6072. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6073. #define __JUCE_WAITABLEEVENT_JUCEHEADER__
  6074. class JUCE_API WaitableEvent
  6075. {
  6076. public:
  6077. WaitableEvent() throw();
  6078. ~WaitableEvent() throw();
  6079. bool wait (const int timeOutMilliseconds = -1) const throw();
  6080. void signal() const throw();
  6081. void reset() const throw();
  6082. juce_UseDebuggingNewOperator
  6083. private:
  6084. void* internal;
  6085. WaitableEvent (const WaitableEvent&);
  6086. const WaitableEvent& operator= (const WaitableEvent&);
  6087. };
  6088. #endif // __JUCE_WAITABLEEVENT_JUCEHEADER__
  6089. /*** End of inlined file: juce_WaitableEvent.h ***/
  6090. /*** Start of inlined file: juce_Thread.h ***/
  6091. #ifndef __JUCE_THREAD_JUCEHEADER__
  6092. #define __JUCE_THREAD_JUCEHEADER__
  6093. class JUCE_API Thread
  6094. {
  6095. public:
  6096. Thread (const String& threadName);
  6097. virtual ~Thread();
  6098. virtual void run() = 0;
  6099. // Thread control functions..
  6100. void startThread();
  6101. void startThread (const int priority);
  6102. void stopThread (const int timeOutMilliseconds);
  6103. bool isThreadRunning() const;
  6104. void signalThreadShouldExit();
  6105. inline bool threadShouldExit() const { return threadShouldExit_; }
  6106. bool waitForThreadToExit (const int timeOutMilliseconds) const;
  6107. bool setPriority (const int priority);
  6108. static bool setCurrentThreadPriority (const int priority);
  6109. void setAffinityMask (const uint32 affinityMask);
  6110. static void setCurrentThreadAffinityMask (const uint32 affinityMask);
  6111. // this can be called from any thread that needs to pause..
  6112. static void JUCE_CALLTYPE sleep (int milliseconds);
  6113. static void JUCE_CALLTYPE yield();
  6114. bool wait (const int timeOutMilliseconds) const;
  6115. void notify() const;
  6116. typedef void* ThreadID;
  6117. static ThreadID getCurrentThreadId();
  6118. static Thread* getCurrentThread();
  6119. ThreadID getThreadId() const { return threadId_; }
  6120. const String getThreadName() const { return threadName_; }
  6121. static int getNumRunningThreads();
  6122. static void stopAllThreads (const int timeoutInMillisecs);
  6123. juce_UseDebuggingNewOperator
  6124. private:
  6125. const String threadName_;
  6126. void* volatile threadHandle_;
  6127. CriticalSection startStopLock;
  6128. WaitableEvent startSuspensionEvent_, defaultEvent_;
  6129. int threadPriority_;
  6130. ThreadID threadId_;
  6131. uint32 affinityMask_;
  6132. bool volatile threadShouldExit_;
  6133. friend void JUCE_API juce_threadEntryPoint (void*);
  6134. static void threadEntryPoint (Thread* thread);
  6135. Thread (const Thread&);
  6136. const Thread& operator= (const Thread&);
  6137. };
  6138. #endif // __JUCE_THREAD_JUCEHEADER__
  6139. /*** End of inlined file: juce_Thread.h ***/
  6140. class JUCE_API ReadWriteLock
  6141. {
  6142. public:
  6143. ReadWriteLock() throw();
  6144. ~ReadWriteLock() throw();
  6145. void enterRead() const throw();
  6146. void exitRead() const throw();
  6147. void enterWrite() const throw();
  6148. bool tryEnterWrite() const throw();
  6149. void exitWrite() const throw();
  6150. juce_UseDebuggingNewOperator
  6151. private:
  6152. CriticalSection accessLock;
  6153. WaitableEvent waitEvent;
  6154. mutable int numWaitingWriters, numWriters;
  6155. mutable Thread::ThreadID writerThreadId;
  6156. mutable Array <Thread::ThreadID> readerThreads;
  6157. ReadWriteLock (const ReadWriteLock&);
  6158. const ReadWriteLock& operator= (const ReadWriteLock&);
  6159. };
  6160. #endif // __JUCE_READWRITELOCK_JUCEHEADER__
  6161. /*** End of inlined file: juce_ReadWriteLock.h ***/
  6162. #endif
  6163. #ifndef __JUCE_SCOPEDLOCK_JUCEHEADER__
  6164. #endif
  6165. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6166. /*** Start of inlined file: juce_ScopedReadLock.h ***/
  6167. #ifndef __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6168. #define __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6169. class JUCE_API ScopedReadLock
  6170. {
  6171. public:
  6172. inline ScopedReadLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterRead(); }
  6173. inline ~ScopedReadLock() throw() { lock_.exitRead(); }
  6174. private:
  6175. const ReadWriteLock& lock_;
  6176. ScopedReadLock (const ScopedReadLock&);
  6177. const ScopedReadLock& operator= (const ScopedReadLock&);
  6178. };
  6179. #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__
  6180. /*** End of inlined file: juce_ScopedReadLock.h ***/
  6181. #endif
  6182. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6183. /*** Start of inlined file: juce_ScopedTryLock.h ***/
  6184. #ifndef __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6185. #define __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6186. class JUCE_API ScopedTryLock
  6187. {
  6188. public:
  6189. inline ScopedTryLock (const CriticalSection& lock) throw() : lock_ (lock), lockWasSuccessful (lock.tryEnter()) {}
  6190. inline ~ScopedTryLock() throw() { if (lockWasSuccessful) lock_.exit(); }
  6191. bool isLocked() const throw() { return lockWasSuccessful; }
  6192. private:
  6193. const CriticalSection& lock_;
  6194. const bool lockWasSuccessful;
  6195. ScopedTryLock (const ScopedTryLock&);
  6196. const ScopedTryLock& operator= (const ScopedTryLock&);
  6197. };
  6198. #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__
  6199. /*** End of inlined file: juce_ScopedTryLock.h ***/
  6200. #endif
  6201. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6202. /*** Start of inlined file: juce_ScopedWriteLock.h ***/
  6203. #ifndef __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6204. #define __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6205. class JUCE_API ScopedWriteLock
  6206. {
  6207. public:
  6208. inline ScopedWriteLock (const ReadWriteLock& lock) throw() : lock_ (lock) { lock.enterWrite(); }
  6209. inline ~ScopedWriteLock() throw() { lock_.exitWrite(); }
  6210. private:
  6211. const ReadWriteLock& lock_;
  6212. ScopedWriteLock (const ScopedWriteLock&);
  6213. const ScopedWriteLock& operator= (const ScopedWriteLock&);
  6214. };
  6215. #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__
  6216. /*** End of inlined file: juce_ScopedWriteLock.h ***/
  6217. #endif
  6218. #ifndef __JUCE_THREAD_JUCEHEADER__
  6219. #endif
  6220. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6221. /*** Start of inlined file: juce_ThreadPool.h ***/
  6222. #ifndef __JUCE_THREADPOOL_JUCEHEADER__
  6223. #define __JUCE_THREADPOOL_JUCEHEADER__
  6224. class ThreadPool;
  6225. class ThreadPoolThread;
  6226. class JUCE_API ThreadPoolJob
  6227. {
  6228. public:
  6229. ThreadPoolJob (const String& name);
  6230. virtual ~ThreadPoolJob();
  6231. const String getJobName() const;
  6232. void setJobName (const String& newName);
  6233. enum JobStatus
  6234. {
  6235. jobHasFinished = 0, /**< indicates that the job has finished and can be
  6236. removed from the pool. */
  6237. jobHasFinishedAndShouldBeDeleted, /**< indicates that the job has finished and that it
  6238. should be automatically deleted by the pool. */
  6239. jobNeedsRunningAgain /**< indicates that the job would like to be called
  6240. again when a thread is free. */
  6241. };
  6242. virtual JobStatus runJob() = 0;
  6243. bool isRunning() const { return isActive; }
  6244. bool shouldExit() const { return shouldStop; }
  6245. void signalJobShouldExit();
  6246. juce_UseDebuggingNewOperator
  6247. private:
  6248. friend class ThreadPool;
  6249. friend class ThreadPoolThread;
  6250. String jobName;
  6251. ThreadPool* pool;
  6252. bool shouldStop, isActive, shouldBeDeleted;
  6253. ThreadPoolJob (const ThreadPoolJob&);
  6254. const ThreadPoolJob& operator= (const ThreadPoolJob&);
  6255. };
  6256. class JUCE_API ThreadPool
  6257. {
  6258. public:
  6259. ThreadPool (const int numberOfThreads,
  6260. const bool startThreadsOnlyWhenNeeded = true,
  6261. const int stopThreadsWhenNotUsedTimeoutMs = 5000);
  6262. ~ThreadPool();
  6263. class JUCE_API JobSelector
  6264. {
  6265. public:
  6266. virtual ~JobSelector() {}
  6267. virtual bool isJobSuitable (ThreadPoolJob* job) = 0;
  6268. };
  6269. void addJob (ThreadPoolJob* const job);
  6270. bool removeJob (ThreadPoolJob* const job,
  6271. const bool interruptIfRunning,
  6272. const int timeOutMilliseconds);
  6273. bool removeAllJobs (const bool interruptRunningJobs,
  6274. const int timeOutMilliseconds,
  6275. const bool deleteInactiveJobs = false,
  6276. JobSelector* selectedJobsToRemove = 0);
  6277. int getNumJobs() const;
  6278. ThreadPoolJob* getJob (const int index) const;
  6279. bool contains (const ThreadPoolJob* const job) const;
  6280. bool isJobRunning (const ThreadPoolJob* const job) const;
  6281. bool waitForJobToFinish (const ThreadPoolJob* const job,
  6282. const int timeOutMilliseconds) const;
  6283. const StringArray getNamesOfAllJobs (const bool onlyReturnActiveJobs) const;
  6284. bool setThreadPriorities (const int newPriority);
  6285. juce_UseDebuggingNewOperator
  6286. private:
  6287. const int threadStopTimeout;
  6288. int priority;
  6289. class ThreadPoolThread;
  6290. OwnedArray <ThreadPoolThread> threads;
  6291. Array <ThreadPoolJob*> jobs;
  6292. CriticalSection lock;
  6293. uint32 lastJobEndTime;
  6294. WaitableEvent jobFinishedSignal;
  6295. friend class ThreadPoolThread;
  6296. bool runNextJob();
  6297. ThreadPool (const ThreadPool&);
  6298. const ThreadPool& operator= (const ThreadPool&);
  6299. };
  6300. #endif // __JUCE_THREADPOOL_JUCEHEADER__
  6301. /*** End of inlined file: juce_ThreadPool.h ***/
  6302. #endif
  6303. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6304. /*** Start of inlined file: juce_TimeSliceThread.h ***/
  6305. #ifndef __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6306. #define __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6307. class JUCE_API TimeSliceClient
  6308. {
  6309. public:
  6310. virtual ~TimeSliceClient() {}
  6311. virtual bool useTimeSlice() = 0;
  6312. };
  6313. class JUCE_API TimeSliceThread : public Thread
  6314. {
  6315. public:
  6316. TimeSliceThread (const String& threadName);
  6317. ~TimeSliceThread();
  6318. void addTimeSliceClient (TimeSliceClient* const client);
  6319. void removeTimeSliceClient (TimeSliceClient* const client);
  6320. int getNumClients() const;
  6321. TimeSliceClient* getClient (const int index) const;
  6322. void run();
  6323. juce_UseDebuggingNewOperator
  6324. private:
  6325. CriticalSection callbackLock, listLock;
  6326. Array <TimeSliceClient*> clients;
  6327. int index;
  6328. TimeSliceClient* clientBeingCalled;
  6329. bool clientsChanged;
  6330. TimeSliceThread (const TimeSliceThread&);
  6331. const TimeSliceThread& operator= (const TimeSliceThread&);
  6332. };
  6333. #endif // __JUCE_TIMESLICETHREAD_JUCEHEADER__
  6334. /*** End of inlined file: juce_TimeSliceThread.h ***/
  6335. #endif
  6336. #ifndef __JUCE_WAITABLEEVENT_JUCEHEADER__
  6337. #endif
  6338. #endif
  6339. /*** End of inlined file: juce_core_includes.h ***/
  6340. // if you're compiling a command-line app, you might want to just include the core headers,
  6341. // so you can set this macro before including juce.h
  6342. #if ! JUCE_ONLY_BUILD_CORE_LIBRARY
  6343. /*** Start of inlined file: juce_app_includes.h ***/
  6344. #ifndef __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6345. #define __JUCE_JUCE_APP_INCLUDES_INCLUDEFILES__
  6346. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6347. /*** Start of inlined file: juce_Application.h ***/
  6348. #ifndef __JUCE_APPLICATION_JUCEHEADER__
  6349. #define __JUCE_APPLICATION_JUCEHEADER__
  6350. /*** Start of inlined file: juce_ApplicationCommandTarget.h ***/
  6351. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6352. #define __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  6353. /*** Start of inlined file: juce_Component.h ***/
  6354. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  6355. #define __JUCE_COMPONENT_JUCEHEADER__
  6356. /*** Start of inlined file: juce_MouseCursor.h ***/
  6357. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  6358. #define __JUCE_MOUSECURSOR_JUCEHEADER__
  6359. class Image;
  6360. class SharedMouseCursorInternal;
  6361. class ComponentPeer;
  6362. class Component;
  6363. class JUCE_API MouseCursor
  6364. {
  6365. public:
  6366. enum StandardCursorType
  6367. {
  6368. NoCursor = 0, /**< An invisible cursor. */
  6369. NormalCursor, /**< The stardard arrow cursor. */
  6370. WaitCursor, /**< The normal hourglass or spinning-beachball 'busy' cursor. */
  6371. IBeamCursor, /**< A vertical I-beam for positioning within text. */
  6372. CrosshairCursor, /**< A pair of crosshairs. */
  6373. CopyingCursor, /**< The normal arrow cursor, but with a "+" on it to indicate
  6374. that you're dragging a copy of something. */
  6375. PointingHandCursor, /**< A hand with a pointing finger, for clicking on web-links. */
  6376. DraggingHandCursor, /**< An open flat hand for dragging heavy objects around. */
  6377. LeftRightResizeCursor, /**< An arrow pointing left and right. */
  6378. UpDownResizeCursor, /**< an arrow pointing up and down. */
  6379. UpDownLeftRightResizeCursor, /**< An arrow pointing up, down, left and right. */
  6380. TopEdgeResizeCursor, /**< A platform-specific cursor for resizing the top-edge of a window. */
  6381. BottomEdgeResizeCursor, /**< A platform-specific cursor for resizing the bottom-edge of a window. */
  6382. LeftEdgeResizeCursor, /**< A platform-specific cursor for resizing the left-edge of a window. */
  6383. RightEdgeResizeCursor, /**< A platform-specific cursor for resizing the right-edge of a window. */
  6384. TopLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the top-left-corner of a window. */
  6385. TopRightCornerResizeCursor, /**< A platform-specific cursor for resizing the top-right-corner of a window. */
  6386. BottomLeftCornerResizeCursor, /**< A platform-specific cursor for resizing the bottom-left-corner of a window. */
  6387. BottomRightCornerResizeCursor /**< A platform-specific cursor for resizing the bottom-right-corner of a window. */
  6388. };
  6389. MouseCursor() throw();
  6390. MouseCursor (const StandardCursorType type) throw();
  6391. MouseCursor (const Image& image,
  6392. const int hotSpotX,
  6393. const int hotSpotY) throw();
  6394. MouseCursor (const MouseCursor& other) throw();
  6395. const MouseCursor& operator= (const MouseCursor& other) throw();
  6396. ~MouseCursor() throw();
  6397. bool operator== (const MouseCursor& other) const throw();
  6398. bool operator!= (const MouseCursor& other) const throw();
  6399. static void showWaitCursor() throw();
  6400. static void hideWaitCursor() throw();
  6401. juce_UseDebuggingNewOperator
  6402. private:
  6403. ReferenceCountedObjectPtr <SharedMouseCursorInternal> cursorHandle;
  6404. friend class Component;
  6405. void showInWindow (ComponentPeer* window) const throw();
  6406. void showInAllWindows() const throw();
  6407. void* getHandle() const throw();
  6408. };
  6409. #endif // __JUCE_MOUSECURSOR_JUCEHEADER__
  6410. /*** End of inlined file: juce_MouseCursor.h ***/
  6411. /*** Start of inlined file: juce_MouseListener.h ***/
  6412. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  6413. #define __JUCE_MOUSELISTENER_JUCEHEADER__
  6414. /*** Start of inlined file: juce_MouseEvent.h ***/
  6415. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  6416. #define __JUCE_MOUSEEVENT_JUCEHEADER__
  6417. class Component;
  6418. /*** Start of inlined file: juce_ModifierKeys.h ***/
  6419. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  6420. #define __JUCE_MODIFIERKEYS_JUCEHEADER__
  6421. class JUCE_API ModifierKeys
  6422. {
  6423. public:
  6424. ModifierKeys (const int flags = 0) throw();
  6425. ModifierKeys (const ModifierKeys& other) throw();
  6426. const ModifierKeys& operator= (const ModifierKeys& other) throw();
  6427. inline bool isCommandDown() const throw() { return (flags & commandModifier) != 0; }
  6428. inline bool isPopupMenu() const throw() { return (flags & popupMenuClickModifier) != 0; }
  6429. inline bool isLeftButtonDown() const throw() { return (flags & leftButtonModifier) != 0; }
  6430. inline bool isRightButtonDown() const throw() { return (flags & rightButtonModifier) != 0; }
  6431. inline bool isMiddleButtonDown() const throw() { return (flags & middleButtonModifier) != 0; }
  6432. inline bool isAnyMouseButtonDown() const throw() { return (flags & allMouseButtonModifiers) != 0; }
  6433. inline bool isAnyModifierKeyDown() const throw() { return (flags & (shiftModifier | ctrlModifier | altModifier | commandModifier)) != 0; }
  6434. inline bool isShiftDown() const throw() { return (flags & shiftModifier) != 0; }
  6435. inline bool isCtrlDown() const throw() { return (flags & ctrlModifier) != 0; }
  6436. inline bool isAltDown() const throw() { return (flags & altModifier) != 0; }
  6437. enum Flags
  6438. {
  6439. shiftModifier = 1,
  6440. ctrlModifier = 2,
  6441. altModifier = 4,
  6442. leftButtonModifier = 16,
  6443. rightButtonModifier = 32,
  6444. middleButtonModifier = 64,
  6445. #if JUCE_MAC
  6446. commandModifier = 8,
  6447. popupMenuClickModifier = rightButtonModifier | ctrlModifier,
  6448. #else
  6449. commandModifier = ctrlModifier,
  6450. popupMenuClickModifier = rightButtonModifier,
  6451. #endif
  6452. allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
  6453. allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier,
  6454. };
  6455. inline int getRawFlags() const throw() { return flags; }
  6456. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  6457. int getNumMouseButtonsDown() const throw();
  6458. static const ModifierKeys getCurrentModifiers() throw();
  6459. static const ModifierKeys getCurrentModifiersRealtime() throw();
  6460. private:
  6461. int flags;
  6462. static int currentModifierFlags;
  6463. friend class ComponentPeer;
  6464. static void updateCurrentModifiers() throw();
  6465. };
  6466. #endif // __JUCE_MODIFIERKEYS_JUCEHEADER__
  6467. /*** End of inlined file: juce_ModifierKeys.h ***/
  6468. class JUCE_API MouseEvent
  6469. {
  6470. public:
  6471. MouseEvent (const int x, const int y,
  6472. const ModifierKeys& modifiers,
  6473. Component* const originator,
  6474. const Time& eventTime,
  6475. const int mouseDownX,
  6476. const int mouseDownY,
  6477. const Time& mouseDownTime,
  6478. const int numberOfClicks,
  6479. const bool mouseWasDragged) throw();
  6480. ~MouseEvent() throw();
  6481. int x;
  6482. int y;
  6483. ModifierKeys mods;
  6484. Component* eventComponent;
  6485. Component* originalComponent;
  6486. Time eventTime;
  6487. int getMouseDownX() const throw();
  6488. int getMouseDownY() const throw();
  6489. int getDistanceFromDragStart() const throw();
  6490. int getDistanceFromDragStartX() const throw();
  6491. int getDistanceFromDragStartY() const throw();
  6492. bool mouseWasClicked() const throw();
  6493. int getNumberOfClicks() const throw() { return numberOfClicks; }
  6494. int getLengthOfMousePress() const throw();
  6495. int getScreenX() const throw();
  6496. int getScreenY() const throw();
  6497. int getMouseDownScreenX() const throw();
  6498. int getMouseDownScreenY() const throw();
  6499. const MouseEvent getEventRelativeTo (Component* const otherComponent) const throw();
  6500. static void setDoubleClickTimeout (const int timeOutMilliseconds) throw();
  6501. static int getDoubleClickTimeout() throw();
  6502. juce_UseDebuggingNewOperator
  6503. private:
  6504. int mouseDownX, mouseDownY;
  6505. Time mouseDownTime;
  6506. int numberOfClicks;
  6507. bool wasMovedSinceMouseDown;
  6508. };
  6509. #endif // __JUCE_MOUSEEVENT_JUCEHEADER__
  6510. /*** End of inlined file: juce_MouseEvent.h ***/
  6511. class JUCE_API MouseListener
  6512. {
  6513. public:
  6514. virtual ~MouseListener() {}
  6515. virtual void mouseMove (const MouseEvent& e);
  6516. virtual void mouseEnter (const MouseEvent& e);
  6517. virtual void mouseExit (const MouseEvent& e);
  6518. virtual void mouseDown (const MouseEvent& e);
  6519. virtual void mouseDrag (const MouseEvent& e);
  6520. virtual void mouseUp (const MouseEvent& e);
  6521. virtual void mouseDoubleClick (const MouseEvent& e);
  6522. virtual void mouseWheelMove (const MouseEvent& e,
  6523. float wheelIncrementX,
  6524. float wheelIncrementY);
  6525. };
  6526. #endif // __JUCE_MOUSELISTENER_JUCEHEADER__
  6527. /*** End of inlined file: juce_MouseListener.h ***/
  6528. /*** Start of inlined file: juce_ComponentListener.h ***/
  6529. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6530. #define __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6531. class Component;
  6532. class JUCE_API ComponentListener
  6533. {
  6534. public:
  6535. virtual ~ComponentListener() {}
  6536. virtual void componentMovedOrResized (Component& component,
  6537. bool wasMoved,
  6538. bool wasResized);
  6539. virtual void componentBroughtToFront (Component& component);
  6540. virtual void componentVisibilityChanged (Component& component);
  6541. virtual void componentChildrenChanged (Component& component);
  6542. virtual void componentParentHierarchyChanged (Component& component);
  6543. virtual void componentNameChanged (Component& component);
  6544. };
  6545. #endif // __JUCE_COMPONENTLISTENER_JUCEHEADER__
  6546. /*** End of inlined file: juce_ComponentListener.h ***/
  6547. /*** Start of inlined file: juce_KeyListener.h ***/
  6548. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  6549. #define __JUCE_KEYLISTENER_JUCEHEADER__
  6550. /*** Start of inlined file: juce_KeyPress.h ***/
  6551. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  6552. #define __JUCE_KEYPRESS_JUCEHEADER__
  6553. class JUCE_API KeyPress
  6554. {
  6555. public:
  6556. KeyPress() throw();
  6557. KeyPress (const int keyCode,
  6558. const ModifierKeys& modifiers,
  6559. const juce_wchar textCharacter) throw();
  6560. KeyPress (const int keyCode) throw();
  6561. KeyPress (const KeyPress& other) throw();
  6562. const KeyPress& operator= (const KeyPress& other) throw();
  6563. bool operator== (const KeyPress& other) const throw();
  6564. bool operator!= (const KeyPress& other) const throw();
  6565. bool isValid() const throw() { return keyCode != 0; }
  6566. int getKeyCode() const throw() { return keyCode; }
  6567. const ModifierKeys getModifiers() const throw() { return mods; }
  6568. juce_wchar getTextCharacter() const throw() { return textCharacter; }
  6569. bool isKeyCode (const int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }
  6570. static const KeyPress createFromDescription (const String& textVersion) throw();
  6571. const String getTextDescription() const throw();
  6572. bool isCurrentlyDown() const throw();
  6573. static bool isKeyCurrentlyDown (int keyCode) throw();
  6574. // Key codes
  6575. //
  6576. // Note that the actual values of these are platform-specific and may change
  6577. // without warning, so don't store them anywhere as constants. For persisting/retrieving
  6578. // KeyPress objects, use getTextDescription() and createFromDescription() instead.
  6579. //
  6580. static const int spaceKey; /**< key-code for the space bar */
  6581. static const int escapeKey; /**< key-code for the escape key */
  6582. static const int returnKey; /**< key-code for the return key*/
  6583. static const int tabKey; /**< key-code for the tab key*/
  6584. static const int deleteKey; /**< key-code for the delete key (not backspace) */
  6585. static const int backspaceKey; /**< key-code for the backspace key */
  6586. static const int insertKey; /**< key-code for the insert key */
  6587. static const int upKey; /**< key-code for the cursor-up key */
  6588. static const int downKey; /**< key-code for the cursor-down key */
  6589. static const int leftKey; /**< key-code for the cursor-left key */
  6590. static const int rightKey; /**< key-code for the cursor-right key */
  6591. static const int pageUpKey; /**< key-code for the page-up key */
  6592. static const int pageDownKey; /**< key-code for the page-down key */
  6593. static const int homeKey; /**< key-code for the home key */
  6594. static const int endKey; /**< key-code for the end key */
  6595. static const int F1Key; /**< key-code for the F1 key */
  6596. static const int F2Key; /**< key-code for the F2 key */
  6597. static const int F3Key; /**< key-code for the F3 key */
  6598. static const int F4Key; /**< key-code for the F4 key */
  6599. static const int F5Key; /**< key-code for the F5 key */
  6600. static const int F6Key; /**< key-code for the F6 key */
  6601. static const int F7Key; /**< key-code for the F7 key */
  6602. static const int F8Key; /**< key-code for the F8 key */
  6603. static const int F9Key; /**< key-code for the F9 key */
  6604. static const int F10Key; /**< key-code for the F10 key */
  6605. static const int F11Key; /**< key-code for the F11 key */
  6606. static const int F12Key; /**< key-code for the F12 key */
  6607. static const int F13Key; /**< key-code for the F13 key */
  6608. static const int F14Key; /**< key-code for the F14 key */
  6609. static const int F15Key; /**< key-code for the F15 key */
  6610. static const int F16Key; /**< key-code for the F16 key */
  6611. static const int numberPad0; /**< key-code for the 0 on the numeric keypad. */
  6612. static const int numberPad1; /**< key-code for the 1 on the numeric keypad. */
  6613. static const int numberPad2; /**< key-code for the 2 on the numeric keypad. */
  6614. static const int numberPad3; /**< key-code for the 3 on the numeric keypad. */
  6615. static const int numberPad4; /**< key-code for the 4 on the numeric keypad. */
  6616. static const int numberPad5; /**< key-code for the 5 on the numeric keypad. */
  6617. static const int numberPad6; /**< key-code for the 6 on the numeric keypad. */
  6618. static const int numberPad7; /**< key-code for the 7 on the numeric keypad. */
  6619. static const int numberPad8; /**< key-code for the 8 on the numeric keypad. */
  6620. static const int numberPad9; /**< key-code for the 9 on the numeric keypad. */
  6621. static const int numberPadAdd; /**< key-code for the add sign on the numeric keypad. */
  6622. static const int numberPadSubtract; /**< key-code for the subtract sign on the numeric keypad. */
  6623. static const int numberPadMultiply; /**< key-code for the multiply sign on the numeric keypad. */
  6624. static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */
  6625. static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */
  6626. static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */
  6627. static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */
  6628. static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */
  6629. static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */
  6630. static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */
  6631. static const int fastForwardKey; /**< key-code for a multimedia 'fast-forward' key, (not all keyboards will have one) */
  6632. static const int rewindKey; /**< key-code for a multimedia 'rewind' key, (not all keyboards will have one) */
  6633. juce_UseDebuggingNewOperator
  6634. private:
  6635. int keyCode;
  6636. ModifierKeys mods;
  6637. juce_wchar textCharacter;
  6638. };
  6639. #endif // __JUCE_KEYPRESS_JUCEHEADER__
  6640. /*** End of inlined file: juce_KeyPress.h ***/
  6641. class Component;
  6642. class JUCE_API KeyListener
  6643. {
  6644. public:
  6645. virtual ~KeyListener() {}
  6646. virtual bool keyPressed (const KeyPress& key,
  6647. Component* originatingComponent) = 0;
  6648. virtual bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  6649. };
  6650. #endif // __JUCE_KEYLISTENER_JUCEHEADER__
  6651. /*** End of inlined file: juce_KeyListener.h ***/
  6652. /*** Start of inlined file: juce_KeyboardFocusTraverser.h ***/
  6653. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6654. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6655. class Component;
  6656. class JUCE_API KeyboardFocusTraverser
  6657. {
  6658. public:
  6659. KeyboardFocusTraverser();
  6660. virtual ~KeyboardFocusTraverser();
  6661. virtual Component* getNextComponent (Component* current);
  6662. virtual Component* getPreviousComponent (Component* current);
  6663. virtual Component* getDefaultComponent (Component* parentComponent);
  6664. };
  6665. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  6666. /*** End of inlined file: juce_KeyboardFocusTraverser.h ***/
  6667. /*** Start of inlined file: juce_ImageEffectFilter.h ***/
  6668. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6669. #define __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  6670. /*** Start of inlined file: juce_Graphics.h ***/
  6671. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  6672. #define __JUCE_GRAPHICS_JUCEHEADER__
  6673. /*** Start of inlined file: juce_Font.h ***/
  6674. #ifndef __JUCE_FONT_JUCEHEADER__
  6675. #define __JUCE_FONT_JUCEHEADER__
  6676. /*** Start of inlined file: juce_Typeface.h ***/
  6677. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  6678. #define __JUCE_TYPEFACE_JUCEHEADER__
  6679. /*** Start of inlined file: juce_Path.h ***/
  6680. #ifndef __JUCE_PATH_JUCEHEADER__
  6681. #define __JUCE_PATH_JUCEHEADER__
  6682. /*** Start of inlined file: juce_AffineTransform.h ***/
  6683. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6684. #define __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6685. class JUCE_API AffineTransform
  6686. {
  6687. public:
  6688. AffineTransform() throw();
  6689. AffineTransform (const AffineTransform& other) throw();
  6690. AffineTransform (const float mat00, const float mat01, const float mat02,
  6691. const float mat10, const float mat11, const float mat12) throw();
  6692. const AffineTransform& operator= (const AffineTransform& other) throw();
  6693. bool operator== (const AffineTransform& other) const throw();
  6694. bool operator!= (const AffineTransform& other) const throw();
  6695. static const AffineTransform identity;
  6696. void transformPoint (float& x,
  6697. float& y) const throw();
  6698. void transformPoint (double& x,
  6699. double& y) const throw();
  6700. const AffineTransform translated (const float deltaX,
  6701. const float deltaY) const throw();
  6702. static const AffineTransform translation (const float deltaX,
  6703. const float deltaY) throw();
  6704. const AffineTransform rotated (const float angleInRadians) const throw();
  6705. const AffineTransform rotated (const float angleInRadians,
  6706. const float pivotX,
  6707. const float pivotY) const throw();
  6708. static const AffineTransform rotation (const float angleInRadians) throw();
  6709. static const AffineTransform rotation (const float angleInRadians,
  6710. const float pivotX,
  6711. const float pivotY) throw();
  6712. const AffineTransform scaled (const float factorX,
  6713. const float factorY) const throw();
  6714. static const AffineTransform scale (const float factorX,
  6715. const float factorY) throw();
  6716. const AffineTransform sheared (const float shearX,
  6717. const float shearY) const throw();
  6718. const AffineTransform inverted() const throw();
  6719. const AffineTransform followedBy (const AffineTransform& other) const throw();
  6720. bool isIdentity() const throw();
  6721. bool isSingularity() const throw();
  6722. bool isOnlyTranslation() const throw();
  6723. float getTranslationX() const throw() { return mat02; }
  6724. float getTranslationY() const throw() { return mat12; }
  6725. juce_UseDebuggingNewOperator
  6726. float mat00, mat01, mat02;
  6727. float mat10, mat11, mat12;
  6728. private:
  6729. const AffineTransform followedBy (const float mat00, const float mat01, const float mat02,
  6730. const float mat10, const float mat11, const float mat12) const throw();
  6731. };
  6732. #endif // __JUCE_AFFINETRANSFORM_JUCEHEADER__
  6733. /*** End of inlined file: juce_AffineTransform.h ***/
  6734. /*** Start of inlined file: juce_Point.h ***/
  6735. #ifndef __JUCE_POINT_JUCEHEADER__
  6736. #define __JUCE_POINT_JUCEHEADER__
  6737. template <typename ValueType>
  6738. class Point
  6739. {
  6740. public:
  6741. Point() throw() : x (0), y (0) {}
  6742. Point (const Point& other) throw() : x (other.x), y (other.y) {}
  6743. Point (const ValueType initialX, const ValueType initialY) throw() : x (initialX), y (initialY) {}
  6744. ~Point() throw() {}
  6745. Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
  6746. inline ValueType getX() const throw() { return x; }
  6747. inline ValueType getY() const throw() { return y; }
  6748. void setXY (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6749. void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
  6750. const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
  6751. Point& operator+= (const Point& other) throw() { x += other.x; y += other.y; return *this; }
  6752. const Point operator- (const Point& other) const throw() { return Point (x - other.x, y - other.y); }
  6753. Point& operator-= (const Point& other) throw() { x -= other.x; y -= other.y; return *this; }
  6754. void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
  6755. juce_UseDebuggingNewOperator
  6756. private:
  6757. ValueType x, y;
  6758. };
  6759. #endif // __JUCE_POINT_JUCEHEADER__
  6760. /*** End of inlined file: juce_Point.h ***/
  6761. /*** Start of inlined file: juce_Rectangle.h ***/
  6762. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  6763. #define __JUCE_RECTANGLE_JUCEHEADER__
  6764. class RectangleList;
  6765. template <typename ValueType>
  6766. class Rectangle
  6767. {
  6768. public:
  6769. Rectangle() throw()
  6770. : x (0), y (0), w (0), h (0)
  6771. {
  6772. }
  6773. Rectangle (const Rectangle& other) throw()
  6774. : x (other.x), y (other.y),
  6775. w (other.w), h (other.h)
  6776. {
  6777. }
  6778. Rectangle (const ValueType initialX, const ValueType initialY,
  6779. const ValueType width, const ValueType height) throw()
  6780. : x (initialX), y (initialY),
  6781. w (width), h (height)
  6782. {
  6783. }
  6784. Rectangle (const ValueType width, const ValueType height) throw()
  6785. : x (0), y (0), w (width), h (height)
  6786. {
  6787. }
  6788. Rectangle& operator= (const Rectangle& other) throw()
  6789. {
  6790. x = other.x; y = other.y;
  6791. w = other.w; h = other.h;
  6792. return *this;
  6793. }
  6794. ~Rectangle() throw() {}
  6795. inline ValueType getX() const throw() { return x; }
  6796. inline ValueType getY() const throw() { return y; }
  6797. inline ValueType getWidth() const throw() { return w; }
  6798. inline ValueType getHeight() const throw() { return h; }
  6799. inline ValueType getRight() const throw() { return x + w; }
  6800. inline ValueType getBottom() const throw() { return y + h; }
  6801. inline ValueType getCentreX() const throw() { return x + w / (ValueType) 2; }
  6802. inline ValueType getCentreY() const throw() { return y + h / (ValueType) 2; }
  6803. bool isEmpty() const throw() { return w <= 0 || h <= 0; }
  6804. const Point<ValueType> getPosition() const throw() { return Point<ValueType> (x, y); }
  6805. void setPosition (const ValueType newX, const ValueType newY) throw() { x = newX; y = newY; }
  6806. void setSize (const ValueType newWidth, const ValueType newHeight) throw() { w = newWidth; h = newHeight; }
  6807. void setBounds (const ValueType newX, const ValueType newY,
  6808. const ValueType newWidth, const ValueType newHeight) throw()
  6809. {
  6810. x = newX; y = newY; w = newWidth; h = newHeight;
  6811. }
  6812. void setWidth (const ValueType newWidth) throw() { w = newWidth; }
  6813. void setHeight (const ValueType newHeight) throw() { h = newHeight; }
  6814. void setLeft (const ValueType newLeft) throw()
  6815. {
  6816. w = jmax (ValueType(), x + w - newLeft);
  6817. x = newLeft;
  6818. }
  6819. void setTop (const ValueType newTop) throw()
  6820. {
  6821. h = jmax (ValueType(), y + h - newTop);
  6822. y = newTop;
  6823. }
  6824. void setRight (const ValueType newRight) throw()
  6825. {
  6826. x = jmin (x, newRight);
  6827. w = newRight - x;
  6828. }
  6829. void setBottom (const ValueType newBottom) throw()
  6830. {
  6831. y = jmin (y, newBottom);
  6832. h = newBottom - y;
  6833. }
  6834. void translate (const ValueType deltaX,
  6835. const ValueType deltaY) throw()
  6836. {
  6837. x += deltaX;
  6838. y += deltaY;
  6839. }
  6840. const Rectangle translated (const ValueType deltaX,
  6841. const ValueType deltaY) const throw()
  6842. {
  6843. return Rectangle (x + deltaX, y + deltaY, w, h);
  6844. }
  6845. void expand (const ValueType deltaX,
  6846. const ValueType deltaY) throw()
  6847. {
  6848. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6849. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6850. setBounds (x - deltaX, y - deltaY, nw, nh);
  6851. }
  6852. const Rectangle expanded (const ValueType deltaX,
  6853. const ValueType deltaY) const throw()
  6854. {
  6855. const ValueType nw = jmax (ValueType(), w + deltaX * 2);
  6856. const ValueType nh = jmax (ValueType(), h + deltaY * 2);
  6857. return Rectangle (x - deltaX, y - deltaY, nw, nh);
  6858. }
  6859. void reduce (const ValueType deltaX,
  6860. const ValueType deltaY) throw()
  6861. {
  6862. expand (-deltaX, -deltaY);
  6863. }
  6864. const Rectangle reduced (const ValueType deltaX,
  6865. const ValueType deltaY) const throw()
  6866. {
  6867. return expanded (-deltaX, -deltaY);
  6868. }
  6869. bool operator== (const Rectangle& other) const throw()
  6870. {
  6871. return x == other.x && y == other.y
  6872. && w == other.w && h == other.h;
  6873. }
  6874. bool operator!= (const Rectangle& other) const throw()
  6875. {
  6876. return x != other.x || y != other.y
  6877. || w != other.w || h != other.h;
  6878. }
  6879. bool contains (const ValueType xCoord, const ValueType yCoord) const throw()
  6880. {
  6881. return xCoord >= x && yCoord >= y && xCoord < x + w && yCoord < y + h;
  6882. }
  6883. bool contains (const Rectangle& other) const throw()
  6884. {
  6885. return x <= other.x && y <= other.y
  6886. && x + w >= other.x + other.w && y + h >= other.y + other.h;
  6887. }
  6888. bool intersects (const Rectangle& other) const throw()
  6889. {
  6890. return x + w > other.x
  6891. && y + h > other.y
  6892. && x < other.x + other.w
  6893. && y < other.y + other.h
  6894. && w > ValueType() && h > ValueType();
  6895. }
  6896. const Rectangle getIntersection (const Rectangle& other) const throw()
  6897. {
  6898. const ValueType nx = jmax (x, other.x);
  6899. const ValueType ny = jmax (y, other.y);
  6900. const ValueType nw = jmin (x + w, other.x + other.w) - nx;
  6901. const ValueType nh = jmin (y + h, other.y + other.h) - ny;
  6902. if (nw >= ValueType() && nh >= ValueType())
  6903. return Rectangle (nx, ny, nw, nh);
  6904. return Rectangle();
  6905. }
  6906. bool intersectRectangle (ValueType& otherX, ValueType& otherY, ValueType& otherW, ValueType& otherH) const throw()
  6907. {
  6908. const int maxX = jmax (otherX, x);
  6909. otherW = jmin (otherX + otherW, x + w) - maxX;
  6910. if (otherW > 0)
  6911. {
  6912. const int maxY = jmax (otherY, y);
  6913. otherH = jmin (otherY + otherH, y + h) - maxY;
  6914. if (otherH > 0)
  6915. {
  6916. otherX = maxX; otherY = maxY;
  6917. return true;
  6918. }
  6919. }
  6920. return false;
  6921. }
  6922. const Rectangle getUnion (const Rectangle& other) const throw()
  6923. {
  6924. const ValueType newX = jmin (x, other.x);
  6925. const ValueType newY = jmin (y, other.y);
  6926. return Rectangle (newX, newY,
  6927. jmax (x + w, other.x + other.w) - newX,
  6928. jmax (y + h, other.y + other.h) - newY);
  6929. }
  6930. bool enlargeIfAdjacent (const Rectangle& other) throw()
  6931. {
  6932. if (x == other.x && getRight() == other.getRight()
  6933. && (other.getBottom() >= y && other.y <= getBottom()))
  6934. {
  6935. const ValueType newY = jmin (y, other.y);
  6936. h = jmax (getBottom(), other.getBottom()) - newY;
  6937. y = newY;
  6938. return true;
  6939. }
  6940. else if (y == other.y && getBottom() == other.getBottom()
  6941. && (other.getRight() >= x && other.x <= getRight()))
  6942. {
  6943. const ValueType newX = jmin (x, other.x);
  6944. w = jmax (getRight(), other.getRight()) - newX;
  6945. x = newX;
  6946. return true;
  6947. }
  6948. return false;
  6949. }
  6950. bool reduceIfPartlyContainedIn (const Rectangle& other) throw()
  6951. {
  6952. int inside = 0;
  6953. const int otherR = other.getRight();
  6954. if (x >= other.x && x < otherR) inside = 1;
  6955. const int otherB = other.getBottom();
  6956. if (y >= other.y && y < otherB) inside |= 2;
  6957. const int r = x + w;
  6958. if (r >= other.x && r < otherR) inside |= 4;
  6959. const int b = y + h;
  6960. if (b >= other.y && b < otherB) inside |= 8;
  6961. switch (inside)
  6962. {
  6963. case 1 + 2 + 8: w = r - otherR; x = otherR; return true;
  6964. case 1 + 2 + 4: h = b - otherB; y = otherB; return true;
  6965. case 2 + 4 + 8: w = other.x - x; return true;
  6966. case 1 + 4 + 8: h = other.y - y; return true;
  6967. }
  6968. return false;
  6969. }
  6970. const Rectangle<ValueType> transformed (const AffineTransform& transform) const throw()
  6971. {
  6972. float x1 = x, y1 = y;
  6973. float x2 = x + w, y2 = y;
  6974. float x3 = x, y3 = y + h;
  6975. float x4 = x2, y4 = y3;
  6976. transform.transformPoint (x1, y1);
  6977. transform.transformPoint (x2, y2);
  6978. transform.transformPoint (x3, y3);
  6979. transform.transformPoint (x4, y4);
  6980. const float x = jmin (x1, x2, x3, x4);
  6981. const float y = jmin (y1, y2, y3, y4);
  6982. return Rectangle (x, y,
  6983. jmax (x1, x2, x3, x4) - x,
  6984. jmax (y1, y2, y3, y4) - y);
  6985. }
  6986. const Rectangle<int> getSmallestIntegerContainer() const throw()
  6987. {
  6988. const int x1 = (int) floorf ((float) x);
  6989. const int y1 = (int) floorf ((float) y);
  6990. const int x2 = (int) floorf ((float) (x + w + 0.9999f));
  6991. const int y2 = (int) floorf ((float) (y + h + 0.9999f));
  6992. return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
  6993. }
  6994. static bool intersectRectangles (ValueType& x1, ValueType& y1, ValueType& w1, ValueType& h1,
  6995. const ValueType x2, const ValueType y2, const ValueType w2, const ValueType h2) throw()
  6996. {
  6997. const ValueType x = jmax (x1, x2);
  6998. w1 = jmin (x1 + w1, x2 + w2) - x;
  6999. if (w1 > 0)
  7000. {
  7001. const ValueType y = jmax (y1, y2);
  7002. h1 = jmin (y1 + h1, y2 + h2) - y;
  7003. if (h1 > 0)
  7004. {
  7005. x1 = x; y1 = y;
  7006. return true;
  7007. }
  7008. }
  7009. return false;
  7010. }
  7011. const String toString() const
  7012. {
  7013. String s;
  7014. s.preallocateStorage (16);
  7015. s << x << T(' ') << y << T(' ') << w << T(' ') << h;
  7016. return s;
  7017. }
  7018. static const Rectangle fromString (const String& stringVersion)
  7019. {
  7020. StringArray toks;
  7021. toks.addTokens (stringVersion.trim(), T(",; \t\r\n"), 0);
  7022. return Rectangle (toks[0].trim().getIntValue(),
  7023. toks[1].trim().getIntValue(),
  7024. toks[2].trim().getIntValue(),
  7025. toks[3].trim().getIntValue());
  7026. }
  7027. juce_UseDebuggingNewOperator
  7028. private:
  7029. friend class RectangleList;
  7030. ValueType x, y, w, h;
  7031. };
  7032. #endif // __JUCE_RECTANGLE_JUCEHEADER__
  7033. /*** End of inlined file: juce_Rectangle.h ***/
  7034. /*** Start of inlined file: juce_Justification.h ***/
  7035. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  7036. #define __JUCE_JUSTIFICATION_JUCEHEADER__
  7037. class JUCE_API Justification
  7038. {
  7039. public:
  7040. inline Justification (const int flags_) throw() : flags (flags_) {}
  7041. Justification (const Justification& other) throw();
  7042. const Justification& operator= (const Justification& other) throw();
  7043. inline int getFlags() const throw() { return flags; }
  7044. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  7045. int getOnlyVerticalFlags() const throw();
  7046. int getOnlyHorizontalFlags() const throw();
  7047. void applyToRectangle (int& x, int& y,
  7048. const int w, const int h,
  7049. const int spaceX, const int spaceY,
  7050. const int spaceW, const int spaceH) const throw();
  7051. enum
  7052. {
  7053. left = 1,
  7054. right = 2,
  7055. horizontallyCentred = 4,
  7056. top = 8,
  7057. bottom = 16,
  7058. verticallyCentred = 32,
  7059. horizontallyJustified = 64,
  7060. centred = 36,
  7061. centredLeft = 33,
  7062. centredRight = 34,
  7063. centredTop = 12,
  7064. centredBottom = 20,
  7065. topLeft = 9,
  7066. topRight = 10,
  7067. bottomLeft = 17,
  7068. bottomRight = 18
  7069. };
  7070. private:
  7071. int flags;
  7072. };
  7073. #endif // __JUCE_JUSTIFICATION_JUCEHEADER__
  7074. /*** End of inlined file: juce_Justification.h ***/
  7075. /*** Start of inlined file: juce_EdgeTable.h ***/
  7076. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  7077. #define __JUCE_EDGETABLE_JUCEHEADER__
  7078. class Path;
  7079. class RectangleList;
  7080. class Image;
  7081. class JUCE_API EdgeTable
  7082. {
  7083. public:
  7084. EdgeTable (const Rectangle<int>& clipLimits,
  7085. const Path& pathToAdd,
  7086. const AffineTransform& transform) throw();
  7087. EdgeTable (const Rectangle<int>& rectangleToAdd) throw();
  7088. EdgeTable (const RectangleList& rectanglesToAdd) throw();
  7089. EdgeTable (const float x, const float y,
  7090. const float w, const float h) throw();
  7091. EdgeTable (const EdgeTable& other) throw();
  7092. const EdgeTable& operator= (const EdgeTable& other) throw();
  7093. ~EdgeTable() throw();
  7094. void clipToRectangle (const Rectangle<int>& r) throw();
  7095. void excludeRectangle (const Rectangle<int>& r) throw();
  7096. void clipToEdgeTable (const EdgeTable& other);
  7097. void clipLineToMask (int x, int y, uint8* mask, int maskStride, int numPixels) throw();
  7098. bool isEmpty() throw();
  7099. const Rectangle<int>& getMaximumBounds() const throw() { return bounds; }
  7100. void translate (float dx, int dy) throw();
  7101. void optimiseTable() throw();
  7102. template <class EdgeTableIterationCallback>
  7103. void iterate (EdgeTableIterationCallback& iterationCallback) const throw()
  7104. {
  7105. const int* lineStart = table;
  7106. for (int y = 0; y < bounds.getHeight(); ++y)
  7107. {
  7108. const int* line = lineStart;
  7109. lineStart += lineStrideElements;
  7110. int numPoints = line[0];
  7111. if (--numPoints > 0)
  7112. {
  7113. int x = *++line;
  7114. jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());
  7115. int levelAccumulator = 0;
  7116. iterationCallback.setEdgeTableYPos (bounds.getY() + y);
  7117. while (--numPoints >= 0)
  7118. {
  7119. const int level = *++line;
  7120. jassert (((unsigned int) level) < (unsigned int) 256);
  7121. const int endX = *++line;
  7122. jassert (endX >= x);
  7123. const int endOfRun = (endX >> 8);
  7124. if (endOfRun == (x >> 8))
  7125. {
  7126. // small segment within the same pixel, so just save it for the next
  7127. // time round..
  7128. levelAccumulator += (endX - x) * level;
  7129. }
  7130. else
  7131. {
  7132. // plot the fist pixel of this segment, including any accumulated
  7133. // levels from smaller segments that haven't been drawn yet
  7134. levelAccumulator += (0xff - (x & 0xff)) * level;
  7135. levelAccumulator >>= 8;
  7136. x >>= 8;
  7137. if (levelAccumulator > 0)
  7138. {
  7139. if (levelAccumulator >> 8)
  7140. levelAccumulator = 0xff;
  7141. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7142. }
  7143. // if there's a run of similar pixels, do it all in one go..
  7144. if (level > 0)
  7145. {
  7146. jassert (endOfRun <= bounds.getRight());
  7147. const int numPix = endOfRun - ++x;
  7148. if (numPix > 0)
  7149. iterationCallback.handleEdgeTableLine (x, numPix, level);
  7150. }
  7151. // save the bit at the end to be drawn next time round the loop.
  7152. levelAccumulator = (endX & 0xff) * level;
  7153. }
  7154. x = endX;
  7155. }
  7156. if (levelAccumulator > 0)
  7157. {
  7158. levelAccumulator >>= 8;
  7159. if (levelAccumulator >> 8)
  7160. levelAccumulator = 0xff;
  7161. x >>= 8;
  7162. jassert (x >= bounds.getX() && x < bounds.getRight());
  7163. iterationCallback.handleEdgeTablePixel (x, levelAccumulator);
  7164. }
  7165. }
  7166. }
  7167. }
  7168. juce_UseDebuggingNewOperator
  7169. private:
  7170. // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc
  7171. HeapBlock<int> table;
  7172. Rectangle<int> bounds;
  7173. int maxEdgesPerLine, lineStrideElements;
  7174. bool needToCheckEmptinesss;
  7175. void addEdgePoint (const int x, const int y, const int winding) throw();
  7176. void remapTableForNumEdges (const int newNumEdgesPerLine) throw();
  7177. void intersectWithEdgeTableLine (const int y, const int* otherLine) throw();
  7178. void clipEdgeTableLineToRange (int* line, int x1, int x2) throw();
  7179. void sanitiseLevels (const bool useNonZeroWinding) throw();
  7180. };
  7181. #endif // __JUCE_EDGETABLE_JUCEHEADER__
  7182. /*** End of inlined file: juce_EdgeTable.h ***/
  7183. class Image;
  7184. class JUCE_API Path
  7185. {
  7186. public:
  7187. Path() throw();
  7188. Path (const Path& other) throw();
  7189. ~Path() throw();
  7190. const Path& operator= (const Path& other) throw();
  7191. bool isEmpty() const throw();
  7192. const Rectangle<float> getBounds() const throw();
  7193. const Rectangle<float> getBoundsTransformed (const AffineTransform& transform) const throw();
  7194. bool contains (const float x,
  7195. const float y,
  7196. const float tolerence = 10.0f) const throw();
  7197. bool intersectsLine (const float x1, const float y1,
  7198. const float x2, const float y2,
  7199. const float tolerence = 10.0f) throw();
  7200. void clear() throw();
  7201. void startNewSubPath (const float startX,
  7202. const float startY) throw();
  7203. void closeSubPath() throw();
  7204. void lineTo (const float endX,
  7205. const float endY) throw();
  7206. void quadraticTo (const float controlPointX,
  7207. const float controlPointY,
  7208. const float endPointX,
  7209. const float endPointY) throw();
  7210. void cubicTo (const float controlPoint1X,
  7211. const float controlPoint1Y,
  7212. const float controlPoint2X,
  7213. const float controlPoint2Y,
  7214. const float endPointX,
  7215. const float endPointY) throw();
  7216. const Point<float> getCurrentPosition() const;
  7217. void addRectangle (const float x, const float y,
  7218. const float w, const float h) throw();
  7219. void addRectangle (const Rectangle<int>& rectangle) throw();
  7220. void addRoundedRectangle (const float x, const float y,
  7221. const float w, const float h,
  7222. float cornerSize) throw();
  7223. void addRoundedRectangle (const float x, const float y,
  7224. const float w, const float h,
  7225. float cornerSizeX,
  7226. float cornerSizeY) throw();
  7227. void addTriangle (const float x1, const float y1,
  7228. const float x2, const float y2,
  7229. const float x3, const float y3) throw();
  7230. void addQuadrilateral (const float x1, const float y1,
  7231. const float x2, const float y2,
  7232. const float x3, const float y3,
  7233. const float x4, const float y4) throw();
  7234. void addEllipse (const float x, const float y,
  7235. const float width, const float height) throw();
  7236. void addArc (const float x, const float y,
  7237. const float width, const float height,
  7238. const float fromRadians,
  7239. const float toRadians,
  7240. const bool startAsNewSubPath = false) throw();
  7241. void addCentredArc (const float centreX, const float centreY,
  7242. const float radiusX, const float radiusY,
  7243. const float rotationOfEllipse,
  7244. const float fromRadians,
  7245. const float toRadians,
  7246. const bool startAsNewSubPath = false) throw();
  7247. void addPieSegment (const float x, const float y,
  7248. const float width, const float height,
  7249. const float fromRadians,
  7250. const float toRadians,
  7251. const float innerCircleProportionalSize);
  7252. void addLineSegment (const float startX, const float startY,
  7253. const float endX, const float endY,
  7254. float lineThickness) throw();
  7255. void addArrow (const float startX, const float startY,
  7256. const float endX, const float endY,
  7257. float lineThickness,
  7258. float arrowheadWidth,
  7259. float arrowheadLength) throw();
  7260. void addStar (const float centreX,
  7261. const float centreY,
  7262. const int numberOfPoints,
  7263. const float innerRadius,
  7264. const float outerRadius,
  7265. const float startAngle = 0.0f);
  7266. void addBubble (float bodyX, float bodyY,
  7267. float bodyW, float bodyH,
  7268. float cornerSize,
  7269. float arrowTipX,
  7270. float arrowTipY,
  7271. int whichSide,
  7272. float arrowPositionAlongEdgeProportional,
  7273. float arrowWidth);
  7274. void addPath (const Path& pathToAppend) throw();
  7275. void addPath (const Path& pathToAppend,
  7276. const AffineTransform& transformToApply) throw();
  7277. void swapWithPath (Path& other);
  7278. void applyTransform (const AffineTransform& transform) throw();
  7279. void scaleToFit (const float x, const float y,
  7280. const float width, const float height,
  7281. const bool preserveProportions) throw();
  7282. const AffineTransform getTransformToScaleToFit (const float x, const float y,
  7283. const float width, const float height,
  7284. const bool preserveProportions,
  7285. const Justification& justificationType = Justification::centred) const throw();
  7286. const Path createPathWithRoundedCorners (const float cornerRadius) const throw();
  7287. void setUsingNonZeroWinding (const bool isNonZeroWinding) throw();
  7288. bool isUsingNonZeroWinding() const { return useNonZeroWinding; }
  7289. class JUCE_API Iterator
  7290. {
  7291. public:
  7292. Iterator (const Path& path);
  7293. ~Iterator();
  7294. bool next();
  7295. enum PathElementType
  7296. {
  7297. startNewSubPath, /**< For this type, x1 and y1 will be set to indicate the first point in the subpath. */
  7298. lineTo, /**< For this type, x1 and y1 indicate the end point of the line. */
  7299. quadraticTo, /**< For this type, x1, y1, x2, y2 indicate the control point and endpoint of a quadratic curve. */
  7300. cubicTo, /**< For this type, x1, y1, x2, y2, x3, y3 indicate the two control points and the endpoint of a cubic curve. */
  7301. closePath /**< Indicates that the sub-path is being closed. None of the x or y values are valid in this case. */
  7302. };
  7303. PathElementType elementType;
  7304. float x1, y1, x2, y2, x3, y3;
  7305. private:
  7306. const Path& path;
  7307. int index;
  7308. Iterator (const Iterator&);
  7309. const Iterator& operator= (const Iterator&);
  7310. };
  7311. void loadPathFromStream (InputStream& source);
  7312. void loadPathFromData (const unsigned char* const data,
  7313. const int numberOfBytes) throw();
  7314. void writePathToStream (OutputStream& destination) const;
  7315. const String toString() const;
  7316. void restoreFromString (const String& stringVersion);
  7317. juce_UseDebuggingNewOperator
  7318. private:
  7319. friend class PathFlatteningIterator;
  7320. friend class Path::Iterator;
  7321. ArrayAllocationBase <float, DummyCriticalSection> data;
  7322. int numElements;
  7323. float pathXMin, pathXMax, pathYMin, pathYMax;
  7324. bool useNonZeroWinding;
  7325. static const float lineMarker;
  7326. static const float moveMarker;
  7327. static const float quadMarker;
  7328. static const float cubicMarker;
  7329. static const float closeSubPathMarker;
  7330. };
  7331. #endif // __JUCE_PATH_JUCEHEADER__
  7332. /*** End of inlined file: juce_Path.h ***/
  7333. class Font;
  7334. class JUCE_API Typeface : public ReferenceCountedObject
  7335. {
  7336. public:
  7337. typedef ReferenceCountedObjectPtr <Typeface> Ptr;
  7338. const String getName() const throw() { return name; }
  7339. static const Ptr createSystemTypefaceFor (const Font& font);
  7340. virtual ~Typeface();
  7341. virtual float getAscent() const = 0;
  7342. virtual float getDescent() const = 0;
  7343. virtual float getStringWidth (const String& text) = 0;
  7344. virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
  7345. virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
  7346. juce_UseDebuggingNewOperator
  7347. protected:
  7348. String name;
  7349. Typeface (const String& name) throw();
  7350. private:
  7351. Typeface (const Typeface&);
  7352. const Typeface& operator= (const Typeface&);
  7353. };
  7354. class JUCE_API CustomTypeface : public Typeface
  7355. {
  7356. public:
  7357. CustomTypeface();
  7358. CustomTypeface (InputStream& serialisedTypefaceStream);
  7359. ~CustomTypeface();
  7360. void clear();
  7361. void setCharacteristics (const String& name, const float ascent,
  7362. const bool isBold, const bool isItalic,
  7363. const juce_wchar defaultCharacter) throw();
  7364. void addGlyph (const juce_wchar character, const Path& path, const float width) throw();
  7365. void addKerningPair (const juce_wchar char1, const juce_wchar char2, const float extraAmount) throw();
  7366. void addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) throw();
  7367. bool writeToStream (OutputStream& outputStream);
  7368. // The following methods implement the basic Typeface behaviour.
  7369. float getAscent() const;
  7370. float getDescent() const;
  7371. float getStringWidth (const String& text);
  7372. void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets);
  7373. bool getOutlineForGlyph (int glyphNumber, Path& path);
  7374. int getGlyphForCharacter (juce_wchar character);
  7375. juce_UseDebuggingNewOperator
  7376. protected:
  7377. juce_wchar defaultCharacter;
  7378. float ascent;
  7379. bool isBold, isItalic;
  7380. virtual bool loadGlyphIfPossible (const juce_wchar characterNeeded);
  7381. private:
  7382. class GlyphInfo;
  7383. friend class OwnedArray<GlyphInfo>;
  7384. OwnedArray <GlyphInfo> glyphs;
  7385. short lookupTable [128];
  7386. CustomTypeface (const CustomTypeface&);
  7387. const CustomTypeface& operator= (const CustomTypeface&);
  7388. GlyphInfo* findGlyph (const juce_wchar character, const bool loadIfNeeded) throw();
  7389. GlyphInfo* findGlyphSubstituting (const juce_wchar character) throw();
  7390. };
  7391. #endif // __JUCE_TYPEFACE_JUCEHEADER__
  7392. /*** End of inlined file: juce_Typeface.h ***/
  7393. class LowLevelGraphicsContext;
  7394. class JUCE_API Font
  7395. {
  7396. public:
  7397. enum FontStyleFlags
  7398. {
  7399. plain = 0, /**< indicates a plain, non-bold, non-italic version of the font. @see setStyleFlags */
  7400. bold = 1, /**< boldens the font. @see setStyleFlags */
  7401. italic = 2, /**< finds an italic version of the font. @see setStyleFlags */
  7402. underlined = 4 /**< underlines the font. @see setStyleFlags */
  7403. };
  7404. Font (const float fontHeight,
  7405. const int styleFlags = plain) throw();
  7406. Font (const String& typefaceName,
  7407. const float fontHeight,
  7408. const int styleFlags) throw();
  7409. Font (const Font& other) throw();
  7410. Font (const Typeface::Ptr& typeface) throw();
  7411. Font() throw();
  7412. const Font& operator= (const Font& other) throw();
  7413. bool operator== (const Font& other) const throw();
  7414. bool operator!= (const Font& other) const throw();
  7415. ~Font() throw();
  7416. void setTypefaceName (const String& faceName) throw();
  7417. const String& getTypefaceName() const throw() { return font->typefaceName; }
  7418. static const String getDefaultSansSerifFontName() throw();
  7419. static const String getDefaultSerifFontName() throw();
  7420. static const String getDefaultMonospacedFontName() throw();
  7421. static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw();
  7422. float getHeight() const throw() { return font->height; }
  7423. void setHeight (float newHeight) throw();
  7424. void setHeightWithoutChangingWidth (float newHeight) throw();
  7425. float getAscent() const throw();
  7426. float getDescent() const throw();
  7427. int getStyleFlags() const throw() { return font->styleFlags; }
  7428. void setStyleFlags (const int newFlags) throw();
  7429. void setBold (const bool shouldBeBold) throw();
  7430. bool isBold() const throw();
  7431. void setItalic (const bool shouldBeItalic) throw();
  7432. bool isItalic() const throw();
  7433. void setUnderline (const bool shouldBeUnderlined) throw();
  7434. bool isUnderlined() const throw();
  7435. void setHorizontalScale (const float scaleFactor) throw();
  7436. float getHorizontalScale() const throw() { return font->horizontalScale; }
  7437. void setExtraKerningFactor (const float extraKerning) throw();
  7438. float getExtraKerningFactor() const throw() { return font->kerning; }
  7439. void setSizeAndStyle (float newHeight,
  7440. const int newStyleFlags,
  7441. const float newHorizontalScale,
  7442. const float newKerningAmount) throw();
  7443. int getStringWidth (const String& text) const throw();
  7444. float getStringWidthFloat (const String& text) const throw();
  7445. void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
  7446. Typeface* getTypeface() const throw();
  7447. static void findFonts (OwnedArray<Font>& results) throw();
  7448. static const StringArray findAllTypefaceNames() throw();
  7449. static const String getFallbackFontName() throw();
  7450. static void setFallbackFontName (const String& name) throw();
  7451. juce_UseDebuggingNewOperator
  7452. private:
  7453. friend class FontGlyphAlphaMap;
  7454. friend class TypefaceCache;
  7455. class SharedFontInternal : public ReferenceCountedObject
  7456. {
  7457. public:
  7458. SharedFontInternal (const String& typefaceName, const float height, const float horizontalScale,
  7459. const float kerning, const float ascent, const int styleFlags,
  7460. Typeface* const typeface) throw();
  7461. SharedFontInternal (const SharedFontInternal& other) throw();
  7462. String typefaceName;
  7463. float height, horizontalScale, kerning, ascent;
  7464. int styleFlags;
  7465. Typeface::Ptr typeface;
  7466. };
  7467. ReferenceCountedObjectPtr <SharedFontInternal> font;
  7468. void dupeInternalIfShared() throw();
  7469. };
  7470. #endif // __JUCE_FONT_JUCEHEADER__
  7471. /*** End of inlined file: juce_Font.h ***/
  7472. /*** Start of inlined file: juce_PathStrokeType.h ***/
  7473. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7474. #define __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7475. class JUCE_API PathStrokeType
  7476. {
  7477. public:
  7478. enum JointStyle
  7479. {
  7480. mitered, /**< Indicates that corners should be drawn with sharp joints.
  7481. Note that for angles that curve back on themselves, drawing a
  7482. mitre could require extending the point too far away from the
  7483. path, so a mitre limit is imposed and any corners that exceed it
  7484. are drawn as bevelled instead. */
  7485. curved, /**< Indicates that corners should be drawn as rounded-off. */
  7486. beveled /**< Indicates that corners should be drawn with a line flattening their
  7487. outside edge. */
  7488. };
  7489. enum EndCapStyle
  7490. {
  7491. butt, /**< Ends of lines are flat and don't extend beyond the end point. */
  7492. square, /**< Ends of lines are flat, but stick out beyond the end point for half
  7493. the thickness of the stroke. */
  7494. rounded /**< Ends of lines are rounded-off with a circular shape. */
  7495. };
  7496. PathStrokeType (const float strokeThickness,
  7497. const JointStyle jointStyle = mitered,
  7498. const EndCapStyle endStyle = butt) throw();
  7499. PathStrokeType (const PathStrokeType& other) throw();
  7500. const PathStrokeType& operator= (const PathStrokeType& other) throw();
  7501. ~PathStrokeType() throw();
  7502. void createStrokedPath (Path& destPath,
  7503. const Path& sourcePath,
  7504. const AffineTransform& transform = AffineTransform::identity,
  7505. const float extraAccuracy = 1.0f) const throw();
  7506. void createDashedStroke (Path& destPath,
  7507. const Path& sourcePath,
  7508. const float* dashLengths,
  7509. int numDashLengths,
  7510. const AffineTransform& transform = AffineTransform::identity,
  7511. const float extraAccuracy = 1.0f) const throw();
  7512. float getStrokeThickness() const throw() { return thickness; }
  7513. JointStyle getJointStyle() const throw() { return jointStyle; }
  7514. EndCapStyle getEndStyle() const throw() { return endStyle; }
  7515. juce_UseDebuggingNewOperator
  7516. bool operator== (const PathStrokeType& other) const throw();
  7517. bool operator!= (const PathStrokeType& other) const throw();
  7518. private:
  7519. float thickness;
  7520. JointStyle jointStyle;
  7521. EndCapStyle endStyle;
  7522. };
  7523. #endif // __JUCE_PATHSTROKETYPE_JUCEHEADER__
  7524. /*** End of inlined file: juce_PathStrokeType.h ***/
  7525. /*** Start of inlined file: juce_Line.h ***/
  7526. #ifndef __JUCE_LINE_JUCEHEADER__
  7527. #define __JUCE_LINE_JUCEHEADER__
  7528. class JUCE_API Line
  7529. {
  7530. public:
  7531. Line() throw();
  7532. Line (const Line& other) throw();
  7533. Line (const float startX,
  7534. const float startY,
  7535. const float endX,
  7536. const float endY) throw();
  7537. Line (const Point<float>& start,
  7538. const Point<float>& end) throw();
  7539. const Line& operator= (const Line& other) throw();
  7540. ~Line() throw();
  7541. inline float getStartX() const throw() { return startX; }
  7542. inline float getStartY() const throw() { return startY; }
  7543. inline float getEndX() const throw() { return endX; }
  7544. inline float getEndY() const throw() { return endY; }
  7545. const Point<float> getStart() const throw();
  7546. const Point<float> getEnd() const throw();
  7547. void setStart (const float newStartX,
  7548. const float newStartY) throw();
  7549. void setEnd (const float newEndX,
  7550. const float newEndY) throw();
  7551. void setStart (const Point<float>& newStart) throw();
  7552. void setEnd (const Point<float>& newEnd) throw();
  7553. void applyTransform (const AffineTransform& transform) throw();
  7554. float getLength() const throw();
  7555. bool isVertical() const throw();
  7556. bool isHorizontal() const throw();
  7557. float getAngle() const throw();
  7558. bool operator== (const Line& other) const throw();
  7559. bool operator!= (const Line& other) const throw();
  7560. bool intersects (const Line& line,
  7561. float& intersectionX,
  7562. float& intersectionY) const throw();
  7563. const Point<float> getPointAlongLine (const float distanceFromStart) const throw();
  7564. const Point<float> getPointAlongLine (const float distanceFromStart,
  7565. const float perpendicularDistance) const throw();
  7566. const Point<float> getPointAlongLineProportionally (const float proportionOfLength) const throw();
  7567. float getDistanceFromLine (const float x,
  7568. const float y) const throw();
  7569. float findNearestPointTo (const float x,
  7570. const float y) const throw();
  7571. bool isPointAbove (const float x, const float y) const throw();
  7572. const Line withShortenedStart (const float distanceToShortenBy) const throw();
  7573. const Line withShortenedEnd (const float distanceToShortenBy) const throw();
  7574. bool clipToPath (const Path& path,
  7575. const bool keepSectionOutsidePath) throw();
  7576. juce_UseDebuggingNewOperator
  7577. private:
  7578. float startX, startY, endX, endY;
  7579. };
  7580. #endif // __JUCE_LINE_JUCEHEADER__
  7581. /*** End of inlined file: juce_Line.h ***/
  7582. /*** Start of inlined file: juce_Colours.h ***/
  7583. #ifndef __JUCE_COLOURS_JUCEHEADER__
  7584. #define __JUCE_COLOURS_JUCEHEADER__
  7585. /*** Start of inlined file: juce_Colour.h ***/
  7586. #ifndef __JUCE_COLOUR_JUCEHEADER__
  7587. #define __JUCE_COLOUR_JUCEHEADER__
  7588. /*** Start of inlined file: juce_PixelFormats.h ***/
  7589. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  7590. #define __JUCE_PIXELFORMATS_JUCEHEADER__
  7591. #if JUCE_MSVC
  7592. #pragma pack (push, 1)
  7593. #define PACKED
  7594. #elif JUCE_GCC
  7595. #define PACKED __attribute__((packed))
  7596. #else
  7597. #define PACKED
  7598. #endif
  7599. class PixelRGB;
  7600. class PixelAlpha;
  7601. class JUCE_API PixelARGB
  7602. {
  7603. public:
  7604. PixelARGB() throw() {}
  7605. ~PixelARGB() throw() {}
  7606. PixelARGB (const uint32 argb_) throw()
  7607. : argb (argb_)
  7608. {
  7609. }
  7610. forcedinline uint32 getARGB() const throw() { return argb; }
  7611. forcedinline uint32 getRB() const throw() { return 0x00ff00ff & argb; }
  7612. forcedinline uint32 getAG() const throw() { return 0x00ff00ff & (argb >> 8); }
  7613. forcedinline uint8 getAlpha() const throw() { return components.a; }
  7614. forcedinline uint8 getRed() const throw() { return components.r; }
  7615. forcedinline uint8 getGreen() const throw() { return components.g; }
  7616. forcedinline uint8 getBlue() const throw() { return components.b; }
  7617. forcedinline void blend (const PixelARGB& src) throw()
  7618. {
  7619. uint32 sargb = src.getARGB();
  7620. const uint32 alpha = 0x100 - (sargb >> 24);
  7621. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7622. sargb += 0xff00ff00 & (getAG() * alpha);
  7623. argb = sargb;
  7624. }
  7625. forcedinline void blend (const PixelAlpha& src) throw();
  7626. forcedinline void blend (const PixelRGB& src) throw();
  7627. template <class Pixel>
  7628. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7629. {
  7630. ++extraAlpha;
  7631. uint32 sargb = ((extraAlpha * src.getAG()) & 0xff00ff00)
  7632. | (((extraAlpha * src.getRB()) >> 8) & 0x00ff00ff);
  7633. const uint32 alpha = 0x100 - (sargb >> 24);
  7634. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7635. sargb += 0xff00ff00 & (getAG() * alpha);
  7636. argb = sargb;
  7637. }
  7638. template <class Pixel>
  7639. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7640. {
  7641. uint32 drb = getRB();
  7642. drb += (((src.getRB() - drb) * amount) >> 8);
  7643. drb &= 0x00ff00ff;
  7644. uint32 dag = getAG();
  7645. dag += (((src.getAG() - dag) * amount) >> 8);
  7646. dag &= 0x00ff00ff;
  7647. dag <<= 8;
  7648. dag |= drb;
  7649. argb = dag;
  7650. }
  7651. template <class Pixel>
  7652. forcedinline void set (const Pixel& src) throw()
  7653. {
  7654. argb = src.getARGB();
  7655. }
  7656. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7657. {
  7658. components.a = newAlpha;
  7659. }
  7660. forcedinline void multiplyAlpha (int multiplier) throw()
  7661. {
  7662. ++multiplier;
  7663. argb = ((multiplier * getAG()) & 0xff00ff00)
  7664. | (((multiplier * getRB()) >> 8) & 0x00ff00ff);
  7665. }
  7666. forcedinline void multiplyAlpha (const float multiplier) throw()
  7667. {
  7668. multiplyAlpha ((int) (multiplier * 256.0f));
  7669. }
  7670. void setARGB (const uint8 a, const uint8 r, const uint8 g, const uint8 b) throw()
  7671. {
  7672. components.b = b;
  7673. components.g = g;
  7674. components.r = r;
  7675. components.a = a;
  7676. }
  7677. forcedinline void premultiply() throw()
  7678. {
  7679. const uint32 alpha = components.a;
  7680. if (alpha < 0xff)
  7681. {
  7682. if (alpha == 0)
  7683. {
  7684. components.b = 0;
  7685. components.g = 0;
  7686. components.r = 0;
  7687. }
  7688. else
  7689. {
  7690. components.b = (uint8) ((components.b * alpha + 0x7f) >> 8);
  7691. components.g = (uint8) ((components.g * alpha + 0x7f) >> 8);
  7692. components.r = (uint8) ((components.r * alpha + 0x7f) >> 8);
  7693. }
  7694. }
  7695. }
  7696. forcedinline void unpremultiply() throw()
  7697. {
  7698. const uint32 alpha = components.a;
  7699. if (alpha < 0xff)
  7700. {
  7701. if (alpha == 0)
  7702. {
  7703. components.b = 0;
  7704. components.g = 0;
  7705. components.r = 0;
  7706. }
  7707. else
  7708. {
  7709. components.b = (uint8) jmin ((uint32) 0xff, (components.b * 0xff) / alpha);
  7710. components.g = (uint8) jmin ((uint32) 0xff, (components.g * 0xff) / alpha);
  7711. components.r = (uint8) jmin ((uint32) 0xff, (components.r * 0xff) / alpha);
  7712. }
  7713. }
  7714. }
  7715. forcedinline void desaturate() throw()
  7716. {
  7717. if (components.a < 0xff && components.a > 0)
  7718. {
  7719. const int newUnpremultipliedLevel = (0xff * ((int) components.r + (int) components.g + (int) components.b) / (3 * components.a));
  7720. components.r = components.g = components.b
  7721. = (uint8) ((newUnpremultipliedLevel * components.a + 0x7f) >> 8);
  7722. }
  7723. else
  7724. {
  7725. components.r = components.g = components.b
  7726. = (uint8) (((int) components.r + (int) components.g + (int) components.b) / 3);
  7727. }
  7728. }
  7729. #if JUCE_BIG_ENDIAN
  7730. enum { indexA = 0, indexR = 1, indexG = 2, indexB = 3 };
  7731. #else
  7732. enum { indexA = 3, indexR = 2, indexG = 1, indexB = 0 };
  7733. #endif
  7734. private:
  7735. union
  7736. {
  7737. uint32 argb;
  7738. struct
  7739. {
  7740. #if JUCE_BIG_ENDIAN
  7741. uint8 a : 8, r : 8, g : 8, b : 8;
  7742. #else
  7743. uint8 b, g, r, a;
  7744. #endif
  7745. } PACKED components;
  7746. };
  7747. } PACKED;
  7748. class JUCE_API PixelRGB
  7749. {
  7750. public:
  7751. PixelRGB() throw() {}
  7752. ~PixelRGB() throw() {}
  7753. PixelRGB (const uint32 argb) throw()
  7754. {
  7755. r = (uint8) (argb >> 16);
  7756. g = (uint8) (argb >> 8);
  7757. b = (uint8) (argb);
  7758. }
  7759. forcedinline uint32 getARGB() const throw() { return 0xff000000 | b | (g << 8) | (r << 16); }
  7760. forcedinline uint32 getRB() const throw() { return b | (uint32) (r << 16); }
  7761. forcedinline uint32 getAG() const throw() { return 0xff0000 | g; }
  7762. forcedinline uint8 getAlpha() const throw() { return 0xff; }
  7763. forcedinline uint8 getRed() const throw() { return r; }
  7764. forcedinline uint8 getGreen() const throw() { return g; }
  7765. forcedinline uint8 getBlue() const throw() { return b; }
  7766. forcedinline void blend (const PixelARGB& src) throw()
  7767. {
  7768. uint32 sargb = src.getARGB();
  7769. const uint32 alpha = 0x100 - (sargb >> 24);
  7770. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7771. sargb += 0x0000ff00 & (g * alpha);
  7772. r = (uint8) (sargb >> 16);
  7773. g = (uint8) (sargb >> 8);
  7774. b = (uint8) sargb;
  7775. }
  7776. forcedinline void blend (const PixelRGB& src) throw()
  7777. {
  7778. set (src);
  7779. }
  7780. forcedinline void blend (const PixelAlpha& src) throw();
  7781. template <class Pixel>
  7782. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7783. {
  7784. ++extraAlpha;
  7785. const uint32 srb = (extraAlpha * src.getRB()) >> 8;
  7786. const uint32 sag = extraAlpha * src.getAG();
  7787. uint32 sargb = (sag & 0xff00ff00) | (srb & 0x00ff00ff);
  7788. const uint32 alpha = 0x100 - (sargb >> 24);
  7789. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7790. sargb += 0x0000ff00 & (g * alpha);
  7791. b = (uint8) sargb;
  7792. g = (uint8) (sargb >> 8);
  7793. r = (uint8) (sargb >> 16);
  7794. }
  7795. template <class Pixel>
  7796. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7797. {
  7798. uint32 drb = getRB();
  7799. drb += (((src.getRB() - drb) * amount) >> 8);
  7800. uint32 dag = getAG();
  7801. dag += (((src.getAG() - dag) * amount) >> 8);
  7802. b = (uint8) drb;
  7803. g = (uint8) dag;
  7804. r = (uint8) (drb >> 16);
  7805. }
  7806. template <class Pixel>
  7807. forcedinline void set (const Pixel& src) throw()
  7808. {
  7809. b = src.getBlue();
  7810. g = src.getGreen();
  7811. r = src.getRed();
  7812. }
  7813. forcedinline void setAlpha (const uint8) throw() {}
  7814. forcedinline void multiplyAlpha (int) throw() {}
  7815. void setARGB (const uint8, const uint8 r_, const uint8 g_, const uint8 b_) throw()
  7816. {
  7817. r = r_;
  7818. g = g_;
  7819. b = b_;
  7820. }
  7821. forcedinline void premultiply() throw() {}
  7822. forcedinline void unpremultiply() throw() {}
  7823. forcedinline void desaturate() throw()
  7824. {
  7825. r = g = b = (uint8) (((int) r + (int) g + (int) b) / 3);
  7826. }
  7827. #if JUCE_MAC
  7828. enum { indexR = 0, indexG = 1, indexB = 2 };
  7829. #else
  7830. enum { indexR = 2, indexG = 1, indexB = 0 };
  7831. #endif
  7832. private:
  7833. #if JUCE_MAC
  7834. uint8 r, g, b;
  7835. #else
  7836. uint8 b, g, r;
  7837. #endif
  7838. } PACKED;
  7839. forcedinline void PixelARGB::blend (const PixelRGB& src) throw()
  7840. {
  7841. set (src);
  7842. }
  7843. class JUCE_API PixelAlpha
  7844. {
  7845. public:
  7846. PixelAlpha() throw() {}
  7847. ~PixelAlpha() throw() {}
  7848. PixelAlpha (const uint32 argb) throw()
  7849. {
  7850. a = (uint8) (argb >> 24);
  7851. }
  7852. forcedinline uint32 getARGB() const throw() { return (((uint32) a) << 24) | (((uint32) a) << 16) | (((uint32) a) << 8) | a; }
  7853. forcedinline uint32 getRB() const throw() { return (((uint32) a) << 16) | a; }
  7854. forcedinline uint32 getAG() const throw() { return (((uint32) a) << 16) | a; }
  7855. forcedinline uint8 getAlpha() const throw() { return a; }
  7856. forcedinline uint8 getRed() const throw() { return 0; }
  7857. forcedinline uint8 getGreen() const throw() { return 0; }
  7858. forcedinline uint8 getBlue() const throw() { return 0; }
  7859. template <class Pixel>
  7860. forcedinline void blend (const Pixel& src) throw()
  7861. {
  7862. const int srcA = src.getAlpha();
  7863. a = (uint8) ((a * (0x100 - srcA) >> 8) + srcA);
  7864. }
  7865. template <class Pixel>
  7866. forcedinline void blend (const Pixel& src, uint32 extraAlpha) throw()
  7867. {
  7868. ++extraAlpha;
  7869. const int srcAlpha = (extraAlpha * src.getAlpha()) >> 8;
  7870. a = (uint8) ((a * (0x100 - srcAlpha) >> 8) + srcAlpha);
  7871. }
  7872. template <class Pixel>
  7873. forcedinline void tween (const Pixel& src, const uint32 amount) throw()
  7874. {
  7875. a += ((src,getAlpha() - a) * amount) >> 8;
  7876. }
  7877. template <class Pixel>
  7878. forcedinline void set (const Pixel& src) throw()
  7879. {
  7880. a = src.getAlpha();
  7881. }
  7882. forcedinline void setAlpha (const uint8 newAlpha) throw()
  7883. {
  7884. a = newAlpha;
  7885. }
  7886. forcedinline void multiplyAlpha (int multiplier) throw()
  7887. {
  7888. ++multiplier;
  7889. a = (uint8) ((a * multiplier) >> 8);
  7890. }
  7891. forcedinline void multiplyAlpha (const float multiplier) throw()
  7892. {
  7893. a = (uint8) (a * multiplier);
  7894. }
  7895. forcedinline void setARGB (const uint8 a_, const uint8 /*r*/, const uint8 /*g*/, const uint8 /*b*/) throw()
  7896. {
  7897. a = a_;
  7898. }
  7899. forcedinline void premultiply() throw()
  7900. {
  7901. }
  7902. forcedinline void unpremultiply() throw()
  7903. {
  7904. }
  7905. forcedinline void desaturate() throw()
  7906. {
  7907. }
  7908. private:
  7909. uint8 a : 8;
  7910. } PACKED;
  7911. forcedinline void PixelRGB::blend (const PixelAlpha& src) throw()
  7912. {
  7913. blend (PixelARGB (src.getARGB()));
  7914. }
  7915. forcedinline void PixelARGB::blend (const PixelAlpha& src) throw()
  7916. {
  7917. uint32 sargb = src.getARGB();
  7918. const uint32 alpha = 0x100 - (sargb >> 24);
  7919. sargb += 0x00ff00ff & ((getRB() * alpha) >> 8);
  7920. sargb += 0xff00ff00 & (getAG() * alpha);
  7921. argb = sargb;
  7922. }
  7923. #if JUCE_MSVC
  7924. #pragma pack (pop)
  7925. #endif
  7926. #undef PACKED
  7927. #endif // __JUCE_PIXELFORMATS_JUCEHEADER__
  7928. /*** End of inlined file: juce_PixelFormats.h ***/
  7929. class JUCE_API Colour
  7930. {
  7931. public:
  7932. Colour() throw();
  7933. Colour (const Colour& other) throw();
  7934. explicit Colour (const uint32 argb) throw();
  7935. Colour (const uint8 red,
  7936. const uint8 green,
  7937. const uint8 blue) throw();
  7938. static const Colour fromRGB (const uint8 red,
  7939. const uint8 green,
  7940. const uint8 blue) throw();
  7941. Colour (const uint8 red,
  7942. const uint8 green,
  7943. const uint8 blue,
  7944. const uint8 alpha) throw();
  7945. static const Colour fromRGBA (const uint8 red,
  7946. const uint8 green,
  7947. const uint8 blue,
  7948. const uint8 alpha) throw();
  7949. Colour (const uint8 red,
  7950. const uint8 green,
  7951. const uint8 blue,
  7952. const float alpha) throw();
  7953. static const Colour fromRGBAFloat (const uint8 red,
  7954. const uint8 green,
  7955. const uint8 blue,
  7956. const float alpha) throw();
  7957. Colour (const float hue,
  7958. const float saturation,
  7959. const float brightness,
  7960. const uint8 alpha) throw();
  7961. Colour (const float hue,
  7962. const float saturation,
  7963. const float brightness,
  7964. const float alpha) throw();
  7965. static const Colour fromHSV (const float hue,
  7966. const float saturation,
  7967. const float brightness,
  7968. const float alpha) throw();
  7969. ~Colour() throw();
  7970. const Colour& operator= (const Colour& other) throw();
  7971. bool operator== (const Colour& other) const throw();
  7972. bool operator!= (const Colour& other) const throw();
  7973. uint8 getRed() const throw() { return argb.getRed(); }
  7974. uint8 getGreen() const throw() { return argb.getGreen(); }
  7975. uint8 getBlue() const throw() { return argb.getBlue(); }
  7976. float getFloatRed() const throw();
  7977. float getFloatGreen() const throw();
  7978. float getFloatBlue() const throw();
  7979. const PixelARGB getPixelARGB() const throw();
  7980. uint32 getARGB() const throw();
  7981. uint8 getAlpha() const throw() { return argb.getAlpha(); }
  7982. float getFloatAlpha() const throw();
  7983. bool isOpaque() const throw();
  7984. bool isTransparent() const throw();
  7985. const Colour withAlpha (const uint8 newAlpha) const throw();
  7986. const Colour withAlpha (const float newAlpha) const throw();
  7987. const Colour withMultipliedAlpha (const float alphaMultiplier) const throw();
  7988. const Colour overlaidWith (const Colour& foregroundColour) const throw();
  7989. const Colour interpolatedWith (const Colour& other, float proportionOfOther) const throw();
  7990. float getHue() const throw();
  7991. float getSaturation() const throw();
  7992. float getBrightness() const throw();
  7993. void getHSB (float& hue,
  7994. float& saturation,
  7995. float& brightness) const throw();
  7996. const Colour withHue (const float newHue) const throw();
  7997. const Colour withSaturation (const float newSaturation) const throw();
  7998. const Colour withBrightness (const float newBrightness) const throw();
  7999. const Colour withRotatedHue (const float amountToRotate) const throw();
  8000. const Colour withMultipliedSaturation (const float multiplier) const throw();
  8001. const Colour withMultipliedBrightness (const float amount) const throw();
  8002. const Colour brighter (float amountBrighter = 0.4f) const throw();
  8003. const Colour darker (float amountDarker = 0.4f) const throw();
  8004. const Colour contrasting (const float amount = 1.0f) const throw();
  8005. static const Colour contrasting (const Colour& colour1,
  8006. const Colour& colour2) throw();
  8007. static const Colour greyLevel (const float brightness) throw();
  8008. const String toString() const throw();
  8009. static const Colour fromString (const String& encodedColourString);
  8010. juce_UseDebuggingNewOperator
  8011. private:
  8012. PixelARGB argb;
  8013. };
  8014. #endif // __JUCE_COLOUR_JUCEHEADER__
  8015. /*** End of inlined file: juce_Colour.h ***/
  8016. class Colours
  8017. {
  8018. public:
  8019. static JUCE_API const Colour
  8020. transparentBlack, /**< ARGB = 0x00000000 */
  8021. transparentWhite, /**< ARGB = 0x00ffffff */
  8022. black, /**< ARGB = 0xff000000 */
  8023. white, /**< ARGB = 0xffffffff */
  8024. blue, /**< ARGB = 0xff0000ff */
  8025. grey, /**< ARGB = 0xff808080 */
  8026. green, /**< ARGB = 0xff008000 */
  8027. red, /**< ARGB = 0xffff0000 */
  8028. yellow, /**< ARGB = 0xffffff00 */
  8029. aliceblue, antiquewhite, aqua, aquamarine,
  8030. azure, beige, bisque, blanchedalmond,
  8031. blueviolet, brown, burlywood, cadetblue,
  8032. chartreuse, chocolate, coral, cornflowerblue,
  8033. cornsilk, crimson, cyan, darkblue,
  8034. darkcyan, darkgoldenrod, darkgrey, darkgreen,
  8035. darkkhaki, darkmagenta, darkolivegreen, darkorange,
  8036. darkorchid, darkred, darksalmon, darkseagreen,
  8037. darkslateblue, darkslategrey, darkturquoise, darkviolet,
  8038. deeppink, deepskyblue, dimgrey, dodgerblue,
  8039. firebrick, floralwhite, forestgreen, fuchsia,
  8040. gainsboro, gold, goldenrod, greenyellow,
  8041. honeydew, hotpink, indianred, indigo,
  8042. ivory, khaki, lavender, lavenderblush,
  8043. lemonchiffon, lightblue, lightcoral, lightcyan,
  8044. lightgoldenrodyellow, lightgreen, lightgrey, lightpink,
  8045. lightsalmon, lightseagreen, lightskyblue, lightslategrey,
  8046. lightsteelblue, lightyellow, lime, limegreen,
  8047. linen, magenta, maroon, mediumaquamarine,
  8048. mediumblue, mediumorchid, mediumpurple, mediumseagreen,
  8049. mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred,
  8050. midnightblue, mintcream, mistyrose, navajowhite,
  8051. navy, oldlace, olive, olivedrab,
  8052. orange, orangered, orchid, palegoldenrod,
  8053. palegreen, paleturquoise, palevioletred, papayawhip,
  8054. peachpuff, peru, pink, plum,
  8055. powderblue, purple, rosybrown, royalblue,
  8056. saddlebrown, salmon, sandybrown, seagreen,
  8057. seashell, sienna, silver, skyblue,
  8058. slateblue, slategrey, snow, springgreen,
  8059. steelblue, tan, teal, thistle,
  8060. tomato, turquoise, violet, wheat,
  8061. whitesmoke, yellowgreen;
  8062. static JUCE_API const Colour findColourForName (const String& colourName,
  8063. const Colour& defaultColour);
  8064. private:
  8065. // this isn't a class you should ever instantiate - it's just here for the
  8066. // static values in it.
  8067. Colours();
  8068. };
  8069. #endif // __JUCE_COLOURS_JUCEHEADER__
  8070. /*** End of inlined file: juce_Colours.h ***/
  8071. /*** Start of inlined file: juce_FillType.h ***/
  8072. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  8073. #define __JUCE_FILLTYPE_JUCEHEADER__
  8074. /*** Start of inlined file: juce_ColourGradient.h ***/
  8075. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  8076. #define __JUCE_COLOURGRADIENT_JUCEHEADER__
  8077. class JUCE_API ColourGradient
  8078. {
  8079. public:
  8080. ColourGradient (const Colour& colour1,
  8081. const float x1,
  8082. const float y1,
  8083. const Colour& colour2,
  8084. const float x2,
  8085. const float y2,
  8086. const bool isRadial) throw();
  8087. ColourGradient() throw();
  8088. ~ColourGradient() throw();
  8089. void clearColours() throw();
  8090. void addColour (const double proportionAlongGradient,
  8091. const Colour& colour) throw();
  8092. void multiplyOpacity (const float multiplier) throw();
  8093. int getNumColours() const throw();
  8094. double getColourPosition (const int index) const throw();
  8095. const Colour getColour (const int index) const throw();
  8096. const Colour getColourAtPosition (const float position) const throw();
  8097. int createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& resultLookupTable) const throw();
  8098. bool isOpaque() const throw();
  8099. bool isInvisible() const throw();
  8100. float x1;
  8101. float y1;
  8102. float x2;
  8103. float y2;
  8104. bool isRadial;
  8105. juce_UseDebuggingNewOperator
  8106. private:
  8107. Array <uint32> colours;
  8108. };
  8109. #endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
  8110. /*** End of inlined file: juce_ColourGradient.h ***/
  8111. class Image;
  8112. class JUCE_API FillType
  8113. {
  8114. public:
  8115. FillType() throw();
  8116. FillType (const Colour& colour) throw();
  8117. FillType (const ColourGradient& gradient) throw();
  8118. FillType (const Image& image, const AffineTransform& transform) throw();
  8119. FillType (const FillType& other) throw();
  8120. const FillType& operator= (const FillType& other) throw();
  8121. ~FillType() throw();
  8122. bool isColour() const throw() { return gradient == 0 && image == 0; }
  8123. bool isGradient() const throw() { return gradient != 0; }
  8124. bool isTiledImage() const throw() { return image != 0; }
  8125. void setColour (const Colour& newColour) throw();
  8126. void setGradient (const ColourGradient& newGradient) throw();
  8127. void setTiledImage (const Image& image, const AffineTransform& transform) throw();
  8128. void setOpacity (const float newOpacity) throw();
  8129. float getOpacity() const throw() { return colour.getFloatAlpha(); }
  8130. Colour colour;
  8131. ScopedPointer <ColourGradient> gradient;
  8132. const Image* image;
  8133. AffineTransform transform;
  8134. juce_UseDebuggingNewOperator
  8135. };
  8136. #endif // __JUCE_FILLTYPE_JUCEHEADER__
  8137. /*** End of inlined file: juce_FillType.h ***/
  8138. /*** Start of inlined file: juce_RectanglePlacement.h ***/
  8139. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8140. #define __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8141. class JUCE_API RectanglePlacement
  8142. {
  8143. public:
  8144. inline RectanglePlacement (const int flags_) throw() : flags (flags_) {}
  8145. RectanglePlacement (const RectanglePlacement& other) throw();
  8146. const RectanglePlacement& operator= (const RectanglePlacement& other) throw();
  8147. enum
  8148. {
  8149. xLeft = 1,
  8150. xRight = 2,
  8151. xMid = 4,
  8152. yTop = 8,
  8153. yBottom = 16,
  8154. yMid = 32,
  8155. stretchToFit = 64,
  8156. fillDestination = 128,
  8157. onlyReduceInSize = 256,
  8158. onlyIncreaseInSize = 512,
  8159. doNotResize = (onlyIncreaseInSize | onlyReduceInSize),
  8160. centred = 4 + 32
  8161. };
  8162. inline int getFlags() const throw() { return flags; }
  8163. inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; }
  8164. void applyTo (double& sourceX,
  8165. double& sourceY,
  8166. double& sourceW,
  8167. double& sourceH,
  8168. const double destinationX,
  8169. const double destinationY,
  8170. const double destinationW,
  8171. const double destinationH) const throw();
  8172. const AffineTransform getTransformToFit (float sourceX,
  8173. float sourceY,
  8174. float sourceW,
  8175. float sourceH,
  8176. const float destinationX,
  8177. const float destinationY,
  8178. const float destinationW,
  8179. const float destinationH) const throw();
  8180. private:
  8181. int flags;
  8182. };
  8183. #endif // __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  8184. /*** End of inlined file: juce_RectanglePlacement.h ***/
  8185. class LowLevelGraphicsContext;
  8186. class Image;
  8187. class RectangleList;
  8188. class JUCE_API Graphics
  8189. {
  8190. public:
  8191. Graphics (Image& imageToDrawOnto) throw();
  8192. ~Graphics() throw();
  8193. void setColour (const Colour& newColour) throw();
  8194. void setOpacity (const float newOpacity) throw();
  8195. void setGradientFill (const ColourGradient& gradient) throw();
  8196. void setTiledImageFill (const Image& imageToUse,
  8197. const int anchorX,
  8198. const int anchorY,
  8199. const float opacity) throw();
  8200. void setFillType (const FillType& newFill) throw();
  8201. void setFont (const Font& newFont) throw();
  8202. void setFont (const float newFontHeight,
  8203. const int fontStyleFlags = Font::plain) throw();
  8204. void drawSingleLineText (const String& text,
  8205. const int startX,
  8206. const int baselineY) const throw();
  8207. void drawMultiLineText (const String& text,
  8208. const int startX,
  8209. const int baselineY,
  8210. const int maximumLineWidth) const throw();
  8211. void drawTextAsPath (const String& text,
  8212. const AffineTransform& transform) const throw();
  8213. void drawText (const String& text,
  8214. const int x,
  8215. const int y,
  8216. const int width,
  8217. const int height,
  8218. const Justification& justificationType,
  8219. const bool useEllipsesIfTooBig) const throw();
  8220. void drawFittedText (const String& text,
  8221. const int x,
  8222. const int y,
  8223. const int width,
  8224. const int height,
  8225. const Justification& justificationFlags,
  8226. const int maximumNumberOfLines,
  8227. const float minimumHorizontalScale = 0.7f) const throw();
  8228. void fillAll() const throw();
  8229. void fillAll (const Colour& colourToUse) const throw();
  8230. void fillRect (int x,
  8231. int y,
  8232. int width,
  8233. int height) const throw();
  8234. void fillRect (const Rectangle<int>& rectangle) const throw();
  8235. void fillRect (const float x,
  8236. const float y,
  8237. const float width,
  8238. const float height) const throw();
  8239. void fillRoundedRectangle (const float x,
  8240. const float y,
  8241. const float width,
  8242. const float height,
  8243. const float cornerSize) const throw();
  8244. void fillRoundedRectangle (const Rectangle<int>& rectangle,
  8245. const float cornerSize) const throw();
  8246. void fillCheckerBoard (int x, int y,
  8247. int width, int height,
  8248. const int checkWidth,
  8249. const int checkHeight,
  8250. const Colour& colour1,
  8251. const Colour& colour2) const throw();
  8252. void drawRect (const int x,
  8253. const int y,
  8254. const int width,
  8255. const int height,
  8256. const int lineThickness = 1) const throw();
  8257. void drawRect (const float x,
  8258. const float y,
  8259. const float width,
  8260. const float height,
  8261. const float lineThickness = 1.0f) const throw();
  8262. void drawRect (const Rectangle<int>& rectangle,
  8263. const int lineThickness = 1) const throw();
  8264. void drawRoundedRectangle (const float x,
  8265. const float y,
  8266. const float width,
  8267. const float height,
  8268. const float cornerSize,
  8269. const float lineThickness) const throw();
  8270. void drawRoundedRectangle (const Rectangle<int>& rectangle,
  8271. const float cornerSize,
  8272. const float lineThickness) const throw();
  8273. void drawBevel (const int x,
  8274. const int y,
  8275. const int width,
  8276. const int height,
  8277. const int bevelThickness,
  8278. const Colour& topLeftColour = Colours::white,
  8279. const Colour& bottomRightColour = Colours::black,
  8280. const bool useGradient = true,
  8281. const bool sharpEdgeOnOutside = true) const throw();
  8282. void setPixel (int x, int y) const throw();
  8283. void fillEllipse (const float x,
  8284. const float y,
  8285. const float width,
  8286. const float height) const throw();
  8287. void drawEllipse (const float x,
  8288. const float y,
  8289. const float width,
  8290. const float height,
  8291. const float lineThickness) const throw();
  8292. void drawLine (float startX,
  8293. float startY,
  8294. float endX,
  8295. float endY) const throw();
  8296. void drawLine (const float startX,
  8297. const float startY,
  8298. const float endX,
  8299. const float endY,
  8300. const float lineThickness) const throw();
  8301. void drawLine (const Line& line) const throw();
  8302. void drawLine (const Line& line,
  8303. const float lineThickness) const throw();
  8304. void drawDashedLine (const float startX,
  8305. const float startY,
  8306. const float endX,
  8307. const float endY,
  8308. const float* const dashLengths,
  8309. const int numDashLengths,
  8310. const float lineThickness = 1.0f) const throw();
  8311. void drawVerticalLine (const int x, float top, float bottom) const throw();
  8312. void drawHorizontalLine (const int y, float left, float right) const throw();
  8313. void fillPath (const Path& path,
  8314. const AffineTransform& transform = AffineTransform::identity) const throw();
  8315. void strokePath (const Path& path,
  8316. const PathStrokeType& strokeType,
  8317. const AffineTransform& transform = AffineTransform::identity) const throw();
  8318. void drawArrow (const float startX,
  8319. const float startY,
  8320. const float endX,
  8321. const float endY,
  8322. const float lineThickness,
  8323. const float arrowheadWidth,
  8324. const float arrowheadLength) const throw();
  8325. enum ResamplingQuality
  8326. {
  8327. lowResamplingQuality = 0, /**< Just uses a nearest-neighbour algorithm for resampling. */
  8328. mediumResamplingQuality = 1, /**< Uses bilinear interpolation for upsampling and area-averaging for downsampling. */
  8329. highResamplingQuality = 2 /**< Uses bicubic interpolation for upsampling and area-averaging for downsampling. */
  8330. };
  8331. void setImageResamplingQuality (const ResamplingQuality newQuality) throw();
  8332. void drawImageAt (const Image* const imageToDraw,
  8333. const int topLeftX,
  8334. const int topLeftY,
  8335. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8336. void drawImage (const Image* const imageToDraw,
  8337. int destX,
  8338. int destY,
  8339. int destWidth,
  8340. int destHeight,
  8341. int sourceX,
  8342. int sourceY,
  8343. int sourceWidth,
  8344. int sourceHeight,
  8345. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8346. void drawImageTransformed (const Image* const imageToDraw,
  8347. const Rectangle<int>& imageSubRegion,
  8348. const AffineTransform& transform,
  8349. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8350. void drawImageWithin (const Image* const imageToDraw,
  8351. const int destX,
  8352. const int destY,
  8353. const int destWidth,
  8354. const int destHeight,
  8355. const RectanglePlacement& placementWithinTarget,
  8356. const bool fillAlphaChannelWithCurrentBrush = false) const throw();
  8357. const Rectangle<int> getClipBounds() const throw();
  8358. bool clipRegionIntersects (const int x, const int y, const int width, const int height) const throw();
  8359. bool reduceClipRegion (const int x, const int y,
  8360. const int width, const int height) throw();
  8361. bool reduceClipRegion (const RectangleList& clipRegion) throw();
  8362. bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity) throw();
  8363. bool reduceClipRegion (const Image& image, const Rectangle<int>& sourceClipRegion,
  8364. const AffineTransform& transform) throw();
  8365. void excludeClipRegion (const int x, const int y,
  8366. const int width, const int height) throw();
  8367. bool isClipEmpty() const throw();
  8368. void saveState() throw();
  8369. void restoreState() throw();
  8370. void setOrigin (const int newOriginX,
  8371. const int newOriginY) throw();
  8372. void resetToDefaultState() throw();
  8373. bool isVectorDevice() const throw();
  8374. juce_UseDebuggingNewOperator
  8375. Graphics (LowLevelGraphicsContext* const internalContext) throw();
  8376. LowLevelGraphicsContext* getInternalContext() const throw() { return context; }
  8377. private:
  8378. LowLevelGraphicsContext* const context;
  8379. ScopedPointer <LowLevelGraphicsContext> contextToDelete;
  8380. bool saveStatePending;
  8381. void saveStateIfPending() throw();
  8382. const Graphics& operator= (const Graphics& other);
  8383. Graphics (const Graphics&);
  8384. };
  8385. #endif // __JUCE_GRAPHICS_JUCEHEADER__
  8386. /*** End of inlined file: juce_Graphics.h ***/
  8387. class JUCE_API ImageEffectFilter
  8388. {
  8389. public:
  8390. virtual void applyEffect (Image& sourceImage,
  8391. Graphics& destContext) = 0;
  8392. virtual ~ImageEffectFilter() {}
  8393. };
  8394. #endif // __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  8395. /*** End of inlined file: juce_ImageEffectFilter.h ***/
  8396. /*** Start of inlined file: juce_RectangleList.h ***/
  8397. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  8398. #define __JUCE_RECTANGLELIST_JUCEHEADER__
  8399. class JUCE_API RectangleList
  8400. {
  8401. public:
  8402. RectangleList() throw();
  8403. RectangleList (const RectangleList& other) throw();
  8404. RectangleList (const Rectangle<int>& rect) throw();
  8405. const RectangleList& operator= (const RectangleList& other) throw();
  8406. ~RectangleList() throw();
  8407. bool isEmpty() const throw();
  8408. int getNumRectangles() const throw() { return rects.size(); }
  8409. const Rectangle<int> getRectangle (const int index) const throw();
  8410. void clear() throw();
  8411. void add (const int x, const int y,
  8412. const int w, const int h) throw();
  8413. void add (const Rectangle<int>& rect) throw();
  8414. void addWithoutMerging (const Rectangle<int>& rect) throw();
  8415. void add (const RectangleList& other) throw();
  8416. void subtract (const Rectangle<int>& rect) throw();
  8417. void subtract (const RectangleList& otherList) throw();
  8418. bool clipTo (const Rectangle<int>& rect) throw();
  8419. bool clipTo (const RectangleList& other) throw();
  8420. bool getIntersectionWith (const Rectangle<int>& rect, RectangleList& destRegion) const throw();
  8421. void swapWith (RectangleList& otherList) throw();
  8422. bool containsPoint (const int x, const int y) const throw();
  8423. bool containsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8424. bool intersectsRectangle (const Rectangle<int>& rectangleToCheck) const throw();
  8425. bool intersects (const RectangleList& other) const throw();
  8426. const Rectangle<int> getBounds() const throw();
  8427. void consolidate() throw();
  8428. void offsetAll (const int dx, const int dy) throw();
  8429. const Path toPath() const throw();
  8430. class Iterator
  8431. {
  8432. public:
  8433. Iterator (const RectangleList& list) throw();
  8434. ~Iterator() throw();
  8435. bool next() throw();
  8436. const Rectangle<int>* getRectangle() const throw() { return current; }
  8437. juce_UseDebuggingNewOperator
  8438. private:
  8439. const Rectangle<int>* current;
  8440. const RectangleList& owner;
  8441. int index;
  8442. Iterator (const Iterator&);
  8443. const Iterator& operator= (const Iterator&);
  8444. };
  8445. juce_UseDebuggingNewOperator
  8446. private:
  8447. friend class Iterator;
  8448. Array <Rectangle<int> > rects;
  8449. };
  8450. #endif // __JUCE_RECTANGLELIST_JUCEHEADER__
  8451. /*** End of inlined file: juce_RectangleList.h ***/
  8452. /*** Start of inlined file: juce_BorderSize.h ***/
  8453. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  8454. #define __JUCE_BORDERSIZE_JUCEHEADER__
  8455. class JUCE_API BorderSize
  8456. {
  8457. public:
  8458. BorderSize() throw();
  8459. BorderSize (const BorderSize& other) throw();
  8460. BorderSize (const int topGap,
  8461. const int leftGap,
  8462. const int bottomGap,
  8463. const int rightGap) throw();
  8464. BorderSize (const int allGaps) throw();
  8465. ~BorderSize() throw();
  8466. int getTop() const throw() { return top; }
  8467. int getLeft() const throw() { return left; }
  8468. int getBottom() const throw() { return bottom; }
  8469. int getRight() const throw() { return right; }
  8470. int getTopAndBottom() const throw() { return top + bottom; }
  8471. int getLeftAndRight() const throw() { return left + right; }
  8472. void setTop (const int newTopGap) throw();
  8473. void setLeft (const int newLeftGap) throw();
  8474. void setBottom (const int newBottomGap) throw();
  8475. void setRight (const int newRightGap) throw();
  8476. const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
  8477. void subtractFrom (Rectangle<int>& rectangle) const throw();
  8478. const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
  8479. void addTo (Rectangle<int>& original) const throw();
  8480. bool operator== (const BorderSize& other) const throw();
  8481. bool operator!= (const BorderSize& other) const throw();
  8482. juce_UseDebuggingNewOperator
  8483. private:
  8484. int top, left, bottom, right;
  8485. };
  8486. #endif // __JUCE_BORDERSIZE_JUCEHEADER__
  8487. /*** End of inlined file: juce_BorderSize.h ***/
  8488. /*** Start of inlined file: juce_ComponentPeer.h ***/
  8489. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  8490. #define __JUCE_COMPONENTPEER_JUCEHEADER__
  8491. class Component;
  8492. class Graphics;
  8493. class ComponentBoundsConstrainer;
  8494. class ComponentDeletionWatcher;
  8495. class JUCE_API ComponentPeer : public MessageListener
  8496. {
  8497. public:
  8498. enum StyleFlags
  8499. {
  8500. windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding
  8501. entry on the taskbar (ignored on MacOSX) */
  8502. windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu,
  8503. tooltip, etc. */
  8504. windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
  8505. through it (may not be possible on some platforms). */
  8506. windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
  8507. title bar and frame\. if not specified, the window will be
  8508. borderless. */
  8509. windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
  8510. windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a
  8511. minimise button on it. */
  8512. windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a
  8513. maximise button on it. */
  8514. windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a
  8515. close button on it. */
  8516. windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may
  8517. not be possible on all platforms). */
  8518. windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to
  8519. do its own repainting, but only to repaint when the
  8520. performAnyPendingRepaintsNow() method is called. */
  8521. windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can
  8522. be used for things like plugin windows, to stop them interfering
  8523. with the host's shortcut keys */
  8524. windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */
  8525. };
  8526. ComponentPeer (Component* const component,
  8527. const int styleFlags) throw();
  8528. virtual ~ComponentPeer();
  8529. Component* getComponent() const throw() { return component; }
  8530. int getStyleFlags() const throw() { return styleFlags; }
  8531. virtual void* getNativeHandle() const = 0;
  8532. virtual void setVisible (bool shouldBeVisible) = 0;
  8533. virtual void setTitle (const String& title) = 0;
  8534. virtual void setPosition (int x, int y) = 0;
  8535. virtual void setSize (int w, int h) = 0;
  8536. virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;
  8537. virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
  8538. virtual int getScreenX() const = 0;
  8539. virtual int getScreenY() const = 0;
  8540. virtual void relativePositionToGlobal (int& x, int& y) = 0;
  8541. virtual void globalPositionToRelative (int& x, int& y) = 0;
  8542. virtual void setMinimised (bool shouldBeMinimised) = 0;
  8543. virtual bool isMinimised() const = 0;
  8544. virtual void setFullScreen (bool shouldBeFullScreen) = 0;
  8545. virtual bool isFullScreen() const = 0;
  8546. void setNonFullScreenBounds (const Rectangle<int>& newBounds) throw();
  8547. const Rectangle<int>& getNonFullScreenBounds() const throw();
  8548. virtual void setIcon (const Image& newIcon) = 0;
  8549. void setConstrainer (ComponentBoundsConstrainer* const newConstrainer) throw();
  8550. ComponentBoundsConstrainer* getConstrainer() const throw() { return constrainer; }
  8551. virtual bool contains (int x, int y, bool trueIfInAChildWindow) const = 0;
  8552. virtual const BorderSize getFrameSize() const = 0;
  8553. void handleMovedOrResized();
  8554. void handleScreenSizeChange();
  8555. void handlePaint (LowLevelGraphicsContext& contextToPaintTo);
  8556. virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0;
  8557. virtual void toFront (bool makeActive) = 0;
  8558. virtual void toBehind (ComponentPeer* other) = 0;
  8559. void handleBroughtToFront();
  8560. virtual bool isFocused() const = 0;
  8561. virtual void grabFocus() = 0;
  8562. virtual void textInputRequired (int x, int y) = 0;
  8563. void handleFocusGain();
  8564. void handleFocusLoss();
  8565. Component* getLastFocusedSubcomponent() const throw();
  8566. bool handleKeyPress (const int keyCode,
  8567. const juce_wchar textCharacter);
  8568. bool handleKeyUpOrDown (const bool isKeyDown);
  8569. void handleModifierKeysChange();
  8570. virtual void repaint (int x, int y, int w, int h) = 0;
  8571. virtual void performAnyPendingRepaintsNow() = 0;
  8572. void handleMouseEnter (int x, int y, const int64 time);
  8573. void handleMouseMove (int x, int y, const int64 time);
  8574. void handleMouseDown (int x, int y, const int64 time);
  8575. void handleMouseDrag (int x, int y, const int64 time);
  8576. void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8577. void handleMouseExit (int x, int y, const int64 time);
  8578. void handleMouseWheel (const int amountX, const int amountY, const int64 time);
  8579. void sendFakeMouseMove() throw();
  8580. void handleUserClosingWindow();
  8581. void handleFileDragMove (const StringArray& files, int x, int y);
  8582. void handleFileDragExit (const StringArray& files);
  8583. void handleFileDragDrop (const StringArray& files, int x, int y);
  8584. void clearMaskedRegion() throw();
  8585. void addMaskedRegion (int x, int y, int w, int h) throw();
  8586. static int getNumPeers() throw();
  8587. static ComponentPeer* getPeer (const int index) throw();
  8588. static bool isValidPeer (const ComponentPeer* const peer) throw();
  8589. static void bringModalComponentToFront();
  8590. virtual const StringArray getAvailableRenderingEngines() throw();
  8591. virtual int getCurrentRenderingEngine() throw();
  8592. virtual void setCurrentRenderingEngine (int index) throw();
  8593. juce_UseDebuggingNewOperator
  8594. protected:
  8595. Component* const component;
  8596. const int styleFlags;
  8597. RectangleList maskedRegion;
  8598. Rectangle<int> lastNonFullscreenBounds;
  8599. uint32 lastPaintTime;
  8600. ComponentBoundsConstrainer* constrainer;
  8601. static void updateCurrentModifiers() throw();
  8602. void handleMessage (const Message& message);
  8603. private:
  8604. Component* lastFocusedComponent;
  8605. ScopedPointer <ComponentDeletionWatcher> dragAndDropTargetComponent;
  8606. Component* lastDragAndDropCompUnderMouse;
  8607. bool fakeMouseMessageSent : 1, isWindowMinimised : 1;
  8608. friend class Component;
  8609. static ComponentPeer* getPeerFor (const Component* const component) throw();
  8610. void setLastDragDropTarget (Component* comp);
  8611. ComponentPeer (const ComponentPeer&);
  8612. const ComponentPeer& operator= (const ComponentPeer&);
  8613. };
  8614. #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
  8615. /*** End of inlined file: juce_ComponentPeer.h ***/
  8616. class LookAndFeel;
  8617. class JUCE_API Component : public MouseListener,
  8618. protected MessageListener
  8619. {
  8620. public:
  8621. Component() throw();
  8622. virtual ~Component();
  8623. Component (const String& componentName) throw();
  8624. const String& getName() const throw() { return componentName_; }
  8625. virtual void setName (const String& newName);
  8626. bool isValidComponent() const throw();
  8627. virtual void setVisible (bool shouldBeVisible);
  8628. bool isVisible() const throw() { return flags.visibleFlag; }
  8629. virtual void visibilityChanged();
  8630. bool isShowing() const throw();
  8631. void fadeOutComponent (const int lengthOfFadeOutInMilliseconds,
  8632. const int deltaXToMove = 0,
  8633. const int deltaYToMove = 0,
  8634. const float scaleFactorAtEnd = 1.0f);
  8635. virtual void addToDesktop (int windowStyleFlags,
  8636. void* nativeWindowToAttachTo = 0);
  8637. void removeFromDesktop();
  8638. bool isOnDesktop() const throw();
  8639. ComponentPeer* getPeer() const throw();
  8640. virtual void userTriedToCloseWindow();
  8641. virtual void minimisationStateChanged (bool isNowMinimised);
  8642. void toFront (const bool shouldAlsoGainFocus);
  8643. void toBack();
  8644. void toBehind (Component* const other);
  8645. void setAlwaysOnTop (const bool shouldStayOnTop);
  8646. bool isAlwaysOnTop() const throw();
  8647. inline int getX() const throw() { return bounds_.getX(); }
  8648. inline int getY() const throw() { return bounds_.getY(); }
  8649. inline int getWidth() const throw() { return bounds_.getWidth(); }
  8650. inline int getHeight() const throw() { return bounds_.getHeight(); }
  8651. int getRight() const throw() { return bounds_.getRight(); }
  8652. const Point<int> getPosition() const throw() { return bounds_.getPosition(); }
  8653. int getBottom() const throw() { return bounds_.getBottom(); }
  8654. const Rectangle<int>& getBounds() const throw() { return bounds_; }
  8655. void getVisibleArea (RectangleList& result,
  8656. const bool includeSiblings) const;
  8657. int getScreenX() const throw();
  8658. int getScreenY() const throw();
  8659. void relativePositionToGlobal (int& x, int& y) const throw();
  8660. void globalPositionToRelative (int& x, int& y) const throw();
  8661. void relativePositionToOtherComponent (const Component* const targetComponent,
  8662. int& x, int& y) const throw();
  8663. void setTopLeftPosition (const int x, const int y);
  8664. void setTopRightPosition (const int x, const int y);
  8665. void setSize (const int newWidth, const int newHeight);
  8666. void setBounds (int x, int y, int width, int height);
  8667. void setBounds (const Rectangle<int>& newBounds);
  8668. void setBoundsRelative (const float proportionalX, const float proportionalY,
  8669. const float proportionalWidth, const float proportionalHeight);
  8670. void setBoundsInset (const BorderSize& borders);
  8671. void setBoundsToFit (int x, int y, int width, int height,
  8672. const Justification& justification,
  8673. const bool onlyReduceInSize);
  8674. void setCentrePosition (const int x, const int y);
  8675. void setCentreRelative (const float x, const float y);
  8676. void centreWithSize (const int width, const int height);
  8677. int proportionOfWidth (const float proportion) const throw();
  8678. int proportionOfHeight (const float proportion) const throw();
  8679. int getParentWidth() const throw();
  8680. int getParentHeight() const throw();
  8681. const Rectangle<int> getParentMonitorArea() const throw();
  8682. int getNumChildComponents() const throw();
  8683. Component* getChildComponent (const int index) const throw();
  8684. int getIndexOfChildComponent (const Component* const child) const throw();
  8685. void addChildComponent (Component* const child,
  8686. int zOrder = -1);
  8687. void addAndMakeVisible (Component* const child,
  8688. int zOrder = -1);
  8689. void removeChildComponent (Component* const childToRemove);
  8690. Component* removeChildComponent (const int childIndexToRemove);
  8691. void removeAllChildren();
  8692. void deleteAllChildren();
  8693. Component* getParentComponent() const throw() { return parentComponent_; }
  8694. template <class TargetClass>
  8695. TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const
  8696. {
  8697. (void) dummyParameter;
  8698. Component* p = parentComponent_;
  8699. while (p != 0)
  8700. {
  8701. TargetClass* target = dynamic_cast <TargetClass*> (p);
  8702. if (target != 0)
  8703. return target;
  8704. p = p->parentComponent_;
  8705. }
  8706. return 0;
  8707. }
  8708. Component* getTopLevelComponent() const throw();
  8709. bool isParentOf (const Component* possibleChild) const throw();
  8710. virtual void parentHierarchyChanged();
  8711. virtual void childrenChanged();
  8712. virtual bool hitTest (int x, int y);
  8713. void setInterceptsMouseClicks (const bool allowClicksOnThisComponent,
  8714. const bool allowClicksOnChildComponents) throw();
  8715. void getInterceptsMouseClicks (bool& allowsClicksOnThisComponent,
  8716. bool& allowsClicksOnChildComponents) const throw();
  8717. virtual bool contains (int x, int y);
  8718. bool reallyContains (int x, int y,
  8719. const bool returnTrueIfWithinAChild);
  8720. Component* getComponentAt (const int x, const int y);
  8721. void repaint() throw();
  8722. void repaint (const int x, const int y,
  8723. const int width, const int height) throw();
  8724. void setBufferedToImage (const bool shouldBeBuffered) throw();
  8725. Image* createComponentSnapshot (const Rectangle<int>& areaToGrab,
  8726. const bool clipImageToComponentBounds = true);
  8727. void paintEntireComponent (Graphics& context);
  8728. void setComponentEffect (ImageEffectFilter* const newEffect);
  8729. ImageEffectFilter* getComponentEffect() const throw() { return effect_; }
  8730. LookAndFeel& getLookAndFeel() const throw();
  8731. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  8732. virtual void lookAndFeelChanged();
  8733. void sendLookAndFeelChange();
  8734. void setOpaque (const bool shouldBeOpaque) throw();
  8735. bool isOpaque() const throw();
  8736. void setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw();
  8737. bool isBroughtToFrontOnMouseClick() const throw();
  8738. // Keyboard focus methods
  8739. void setWantsKeyboardFocus (const bool wantsFocus) throw();
  8740. bool getWantsKeyboardFocus() const throw();
  8741. void setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus);
  8742. bool getMouseClickGrabsKeyboardFocus() const throw();
  8743. void grabKeyboardFocus();
  8744. bool hasKeyboardFocus (const bool trueIfChildIsFocused) const throw();
  8745. static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() throw();
  8746. void moveKeyboardFocusToSibling (const bool moveToNext);
  8747. virtual KeyboardFocusTraverser* createFocusTraverser();
  8748. int getExplicitFocusOrder() const throw();
  8749. void setExplicitFocusOrder (const int newFocusOrderIndex) throw();
  8750. void setFocusContainer (const bool shouldBeFocusContainer) throw();
  8751. bool isFocusContainer() const throw();
  8752. bool isEnabled() const throw();
  8753. void setEnabled (const bool shouldBeEnabled);
  8754. virtual void enablementChanged();
  8755. void setMouseCursor (const MouseCursor& cursorType) throw();
  8756. virtual const MouseCursor getMouseCursor();
  8757. void updateMouseCursor() const throw();
  8758. virtual void paint (Graphics& g);
  8759. virtual void paintOverChildren (Graphics& g);
  8760. virtual void mouseMove (const MouseEvent& e);
  8761. virtual void mouseEnter (const MouseEvent& e);
  8762. virtual void mouseExit (const MouseEvent& e);
  8763. virtual void mouseDown (const MouseEvent& e);
  8764. virtual void mouseDrag (const MouseEvent& e);
  8765. virtual void mouseUp (const MouseEvent& e);
  8766. virtual void mouseDoubleClick (const MouseEvent& e);
  8767. virtual void mouseWheelMove (const MouseEvent& e,
  8768. float wheelIncrementX,
  8769. float wheelIncrementY);
  8770. static void beginDragAutoRepeat (const int millisecondIntervalBetweenCallbacks);
  8771. void setRepaintsOnMouseActivity (const bool shouldRepaint) throw();
  8772. void addMouseListener (MouseListener* const newListener,
  8773. const bool wantsEventsForAllNestedChildComponents) throw();
  8774. void removeMouseListener (MouseListener* const listenerToRemove) throw();
  8775. void addKeyListener (KeyListener* const newListener) throw();
  8776. void removeKeyListener (KeyListener* const listenerToRemove) throw();
  8777. virtual bool keyPressed (const KeyPress& key);
  8778. virtual bool keyStateChanged (const bool isKeyDown);
  8779. virtual void modifierKeysChanged (const ModifierKeys& modifiers);
  8780. enum FocusChangeType
  8781. {
  8782. focusChangedByMouseClick, /**< Means that the user clicked the mouse to change focus. */
  8783. focusChangedByTabKey, /**< Means that the user pressed the tab key to move the focus. */
  8784. focusChangedDirectly /**< Means that the focus was changed by a call to grabKeyboardFocus(). */
  8785. };
  8786. virtual void focusGained (FocusChangeType cause);
  8787. virtual void focusLost (FocusChangeType cause);
  8788. virtual void focusOfChildComponentChanged (FocusChangeType cause);
  8789. bool isMouseOver() const throw();
  8790. bool isMouseButtonDown() const throw();
  8791. bool isMouseOverOrDragging() const throw();
  8792. static bool JUCE_CALLTYPE isMouseButtonDownAnywhere() throw();
  8793. void getMouseXYRelative (int& x, int& y) const throw();
  8794. static Component* JUCE_CALLTYPE getComponentUnderMouse() throw();
  8795. void enableUnboundedMouseMovement (bool shouldUnboundedMovementBeEnabled,
  8796. bool keepCursorVisibleUntilOffscreen = false) throw();
  8797. virtual void resized();
  8798. virtual void moved();
  8799. virtual void childBoundsChanged (Component* child);
  8800. virtual void parentSizeChanged();
  8801. virtual void broughtToFront();
  8802. void addComponentListener (ComponentListener* const newListener) throw();
  8803. void removeComponentListener (ComponentListener* const listenerToRemove) throw();
  8804. void postCommandMessage (const int commandId) throw();
  8805. virtual void handleCommandMessage (int commandId);
  8806. int runModalLoop();
  8807. void enterModalState (const bool takeKeyboardFocus = true);
  8808. void exitModalState (const int returnValue);
  8809. bool isCurrentlyModal() const throw();
  8810. static int JUCE_CALLTYPE getNumCurrentlyModalComponents() throw();
  8811. static Component* JUCE_CALLTYPE getCurrentlyModalComponent (int index = 0) throw();
  8812. bool isCurrentlyBlockedByAnotherModalComponent() const throw();
  8813. virtual bool canModalEventBeSentToComponent (const Component* targetComponent);
  8814. virtual void inputAttemptWhenModal();
  8815. NamedValueSet& getProperties() throw() { return properties; }
  8816. const NamedValueSet& getProperties() const throw() { return properties; }
  8817. const Colour findColour (const int colourId, const bool inheritFromParent = false) const throw();
  8818. void setColour (const int colourId, const Colour& colour);
  8819. void removeColour (const int colourId);
  8820. bool isColourSpecified (const int colourId) const throw();
  8821. void copyAllExplicitColoursTo (Component& target) const throw();
  8822. virtual void colourChanged();
  8823. void* getWindowHandle() const throw();
  8824. uint32 getComponentUID() const throw() { return componentUID; }
  8825. juce_UseDebuggingNewOperator
  8826. private:
  8827. friend class ComponentPeer;
  8828. friend class InternalDragRepeater;
  8829. static Component* currentlyFocusedComponent;
  8830. static Component* componentUnderMouse;
  8831. String componentName_;
  8832. Component* parentComponent_;
  8833. uint32 componentUID;
  8834. Rectangle<int> bounds_;
  8835. int numDeepMouseListeners;
  8836. Array <Component*> childComponentList_;
  8837. LookAndFeel* lookAndFeel_;
  8838. MouseCursor cursor_;
  8839. ImageEffectFilter* effect_;
  8840. Image* bufferedImage_;
  8841. VoidArray* mouseListeners_;
  8842. VoidArray* keyListeners_;
  8843. VoidArray* componentListeners_;
  8844. NamedValueSet properties;
  8845. struct ComponentFlags
  8846. {
  8847. bool hasHeavyweightPeerFlag : 1;
  8848. bool visibleFlag : 1;
  8849. bool opaqueFlag : 1;
  8850. bool ignoresMouseClicksFlag : 1;
  8851. bool allowChildMouseClicksFlag : 1;
  8852. bool wantsFocusFlag : 1;
  8853. bool isFocusContainerFlag : 1;
  8854. bool dontFocusOnMouseClickFlag : 1;
  8855. bool alwaysOnTopFlag : 1;
  8856. bool bufferToImageFlag : 1;
  8857. bool bringToFrontOnClickFlag : 1;
  8858. bool repaintOnMouseActivityFlag : 1;
  8859. bool draggingFlag : 1;
  8860. bool mouseOverFlag : 1;
  8861. bool mouseInsideFlag : 1;
  8862. bool currentlyModalFlag : 1;
  8863. bool isDisabledFlag : 1;
  8864. bool childCompFocusedFlag : 1;
  8865. #ifdef JUCE_DEBUG
  8866. bool isInsidePaintCall : 1;
  8867. #endif
  8868. };
  8869. union
  8870. {
  8871. uint32 componentFlags_;
  8872. ComponentFlags flags;
  8873. };
  8874. void internalMouseEnter (int x, int y, const int64 time);
  8875. void internalMouseExit (int x, int y, const int64 time);
  8876. void internalMouseDown (int x, int y, const int64 time);
  8877. void internalMouseUp (const int oldModifiers, int x, int y, const int64 time);
  8878. void internalMouseDrag (int x, int y, const int64 time);
  8879. void internalMouseMove (int x, int y, const int64 time);
  8880. void internalMouseWheel (const int intAmountX, const int intAmountY, const int64 time);
  8881. void internalBroughtToFront();
  8882. void internalFocusGain (const FocusChangeType cause);
  8883. void internalFocusLoss (const FocusChangeType cause);
  8884. void internalChildFocusChange (FocusChangeType cause);
  8885. void internalModalInputAttempt();
  8886. void internalModifierKeysChanged();
  8887. void internalChildrenChanged();
  8888. void internalHierarchyChanged();
  8889. void internalUpdateMouseCursor (const bool forcedUpdate) throw();
  8890. void sendMovedResizedMessages (const bool wasMoved, const bool wasResized);
  8891. void repaintParent() throw();
  8892. void sendFakeMouseMove() const;
  8893. void takeKeyboardFocus (const FocusChangeType cause);
  8894. void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true);
  8895. static void giveAwayFocus();
  8896. void sendEnablementChangeMessage();
  8897. static void* runModalLoopCallback (void*);
  8898. static void bringModalComponentToFront();
  8899. void subtractObscuredRegions (RectangleList& result,
  8900. const int deltaX, const int deltaY,
  8901. const Rectangle<int>& clipRect,
  8902. const Component* const compToAvoid) const throw();
  8903. void clipObscuredRegions (Graphics& g, const Rectangle<int>& clipRect,
  8904. const int deltaX, const int deltaY) const throw();
  8905. // how much of the component is not off the edges of its parents
  8906. const Rectangle<int> getUnclippedArea() const;
  8907. void sendVisibilityChangeMessage();
  8908. // This is included here just to cause a compile error if your code is still handling
  8909. // drag-and-drop with this method. If so, just update it to use the new FileDragAndDropTarget
  8910. // class, which is easy (just make your class inherit from FileDragAndDropTarget, and
  8911. // implement its methods instead of this Component method).
  8912. virtual void filesDropped (const StringArray&, int, int) {}
  8913. // components aren't allowed to have copy constructors, as this would mess up parent
  8914. // hierarchies. You might need to give your subclasses a private dummy constructor like
  8915. // this one to avoid compiler warnings.
  8916. Component (const Component&);
  8917. const Component& operator= (const Component&);
  8918. // (dummy method to cause a deliberate compile error - if you hit this, you need to update your
  8919. // subclass to use the new parameters to keyStateChanged)
  8920. virtual void keyStateChanged() {};
  8921. protected:
  8922. virtual void internalRepaint (int x, int y, int w, int h);
  8923. virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
  8924. void handleMessage (const Message&);
  8925. };
  8926. #endif // __JUCE_COMPONENT_JUCEHEADER__
  8927. /*** End of inlined file: juce_Component.h ***/
  8928. /*** Start of inlined file: juce_ApplicationCommandInfo.h ***/
  8929. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8930. #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8931. /*** Start of inlined file: juce_ApplicationCommandID.h ***/
  8932. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8933. #define __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8934. typedef int CommandID;
  8935. namespace StandardApplicationCommandIDs
  8936. {
  8937. static const CommandID quit = 0x1001;
  8938. static const CommandID del = 0x1002;
  8939. static const CommandID cut = 0x1003;
  8940. static const CommandID copy = 0x1004;
  8941. static const CommandID paste = 0x1005;
  8942. static const CommandID selectAll = 0x1006;
  8943. static const CommandID deselectAll = 0x1007;
  8944. }
  8945. #endif // __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  8946. /*** End of inlined file: juce_ApplicationCommandID.h ***/
  8947. struct JUCE_API ApplicationCommandInfo
  8948. {
  8949. ApplicationCommandInfo (const CommandID commandID) throw();
  8950. void setInfo (const String& shortName,
  8951. const String& description,
  8952. const String& categoryName,
  8953. const int flags) throw();
  8954. void setActive (const bool isActive) throw();
  8955. void setTicked (const bool isTicked) throw();
  8956. void addDefaultKeypress (const int keyCode,
  8957. const ModifierKeys& modifiers) throw();
  8958. CommandID commandID;
  8959. String shortName;
  8960. String description;
  8961. String categoryName;
  8962. Array <KeyPress> defaultKeypresses;
  8963. enum CommandFlags
  8964. {
  8965. isDisabled = 1 << 0,
  8966. isTicked = 1 << 1,
  8967. wantsKeyUpDownCallbacks = 1 << 2,
  8968. hiddenFromKeyEditor = 1 << 3,
  8969. readOnlyInKeyEditor = 1 << 4,
  8970. dontTriggerVisualFeedback = 1 << 5
  8971. };
  8972. int flags;
  8973. };
  8974. #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  8975. /*** End of inlined file: juce_ApplicationCommandInfo.h ***/
  8976. class JUCE_API ApplicationCommandTarget
  8977. {
  8978. public:
  8979. ApplicationCommandTarget();
  8980. virtual ~ApplicationCommandTarget();
  8981. struct JUCE_API InvocationInfo
  8982. {
  8983. InvocationInfo (const CommandID commandID) throw();
  8984. CommandID commandID;
  8985. int commandFlags;
  8986. enum InvocationMethod
  8987. {
  8988. direct = 0, /**< The command is being invoked directly by a piece of code. */
  8989. fromKeyPress, /**< The command is being invoked by a key-press. */
  8990. fromMenu, /**< The command is being invoked by a menu selection. */
  8991. fromButton /**< The command is being invoked by a button click. */
  8992. };
  8993. InvocationMethod invocationMethod;
  8994. Component* originatingComponent;
  8995. KeyPress keyPress;
  8996. bool isKeyDown;
  8997. int millisecsSinceKeyPressed;
  8998. };
  8999. virtual ApplicationCommandTarget* getNextCommandTarget() = 0;
  9000. virtual void getAllCommands (Array <CommandID>& commands) = 0;
  9001. virtual void getCommandInfo (const CommandID commandID,
  9002. ApplicationCommandInfo& result) = 0;
  9003. virtual bool perform (const InvocationInfo& info) = 0;
  9004. bool invoke (const InvocationInfo& invocationInfo,
  9005. const bool asynchronously);
  9006. bool invokeDirectly (const CommandID commandID,
  9007. const bool asynchronously);
  9008. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID);
  9009. bool isCommandActive (const CommandID commandID);
  9010. ApplicationCommandTarget* findFirstTargetParentComponent();
  9011. juce_UseDebuggingNewOperator
  9012. private:
  9013. // (for async invocation of commands)
  9014. class CommandTargetMessageInvoker : public MessageListener
  9015. {
  9016. public:
  9017. CommandTargetMessageInvoker (ApplicationCommandTarget* const owner);
  9018. ~CommandTargetMessageInvoker();
  9019. void handleMessage (const Message& message);
  9020. private:
  9021. ApplicationCommandTarget* const owner;
  9022. CommandTargetMessageInvoker (const CommandTargetMessageInvoker&);
  9023. const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
  9024. };
  9025. ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
  9026. friend class CommandTargetMessageInvoker;
  9027. bool tryToInvoke (const InvocationInfo& info, const bool async);
  9028. ApplicationCommandTarget (const ApplicationCommandTarget&);
  9029. const ApplicationCommandTarget& operator= (const ApplicationCommandTarget&);
  9030. };
  9031. #endif // __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9032. /*** End of inlined file: juce_ApplicationCommandTarget.h ***/
  9033. /*** Start of inlined file: juce_ActionListener.h ***/
  9034. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  9035. #define __JUCE_ACTIONLISTENER_JUCEHEADER__
  9036. class JUCE_API ActionListener
  9037. {
  9038. public:
  9039. virtual ~ActionListener() {}
  9040. virtual void actionListenerCallback (const String& message) = 0;
  9041. };
  9042. #endif // __JUCE_ACTIONLISTENER_JUCEHEADER__
  9043. /*** End of inlined file: juce_ActionListener.h ***/
  9044. class JUCE_API JUCEApplication : public ApplicationCommandTarget,
  9045. private ActionListener
  9046. {
  9047. protected:
  9048. JUCEApplication();
  9049. public:
  9050. virtual ~JUCEApplication();
  9051. static JUCEApplication* getInstance() throw();
  9052. virtual void initialise (const String& commandLineParameters) = 0;
  9053. bool isInitialising() const throw();
  9054. virtual void shutdown() = 0;
  9055. virtual const String getApplicationName() = 0;
  9056. virtual const String getApplicationVersion();
  9057. virtual bool moreThanOneInstanceAllowed();
  9058. virtual void anotherInstanceStarted (const String& commandLine);
  9059. virtual void systemRequestedQuit();
  9060. virtual void unhandledException (const std::exception* e,
  9061. const String& sourceFilename,
  9062. const int lineNumber);
  9063. static void quit();
  9064. void setApplicationReturnValue (const int newReturnValue) throw();
  9065. int getApplicationReturnValue() const throw() { return appReturnValue; }
  9066. const String getCommandLineParameters() const throw() { return commandLineParameters; }
  9067. // These are used by the START_JUCE_APPLICATION() macro and aren't for public use.
  9068. static int main (String& commandLine, JUCEApplication* const newApp);
  9069. static int main (int argc, char* argv[], JUCEApplication* const newApp);
  9070. static void sendUnhandledException (const std::exception* const e,
  9071. const char* const sourceFile,
  9072. const int lineNumber);
  9073. ApplicationCommandTarget* getNextCommandTarget();
  9074. void getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result);
  9075. void getAllCommands (Array <CommandID>& commands);
  9076. bool perform (const InvocationInfo& info);
  9077. void actionListenerCallback (const String& message);
  9078. private:
  9079. String commandLineParameters;
  9080. int appReturnValue;
  9081. bool stillInitialising;
  9082. InterProcessLock* appLock;
  9083. JUCEApplication (const JUCEApplication&);
  9084. const JUCEApplication& operator= (const JUCEApplication&);
  9085. public:
  9086. bool initialiseApp (String& commandLine);
  9087. static int shutdownAppAndClearUp();
  9088. };
  9089. #endif // __JUCE_APPLICATION_JUCEHEADER__
  9090. /*** End of inlined file: juce_Application.h ***/
  9091. #endif
  9092. #ifndef __JUCE_APPLICATIONCOMMANDID_JUCEHEADER__
  9093. #endif
  9094. #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
  9095. #endif
  9096. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9097. /*** Start of inlined file: juce_ApplicationCommandManager.h ***/
  9098. #ifndef __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9099. #define __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9100. /*** Start of inlined file: juce_Desktop.h ***/
  9101. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  9102. #define __JUCE_DESKTOP_JUCEHEADER__
  9103. /*** Start of inlined file: juce_DeletedAtShutdown.h ***/
  9104. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9105. #define __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9106. class JUCE_API DeletedAtShutdown
  9107. {
  9108. protected:
  9109. DeletedAtShutdown();
  9110. virtual ~DeletedAtShutdown();
  9111. public:
  9112. static void deleteAll();
  9113. private:
  9114. DeletedAtShutdown (const DeletedAtShutdown&);
  9115. const DeletedAtShutdown& operator= (const DeletedAtShutdown&);
  9116. };
  9117. #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  9118. /*** End of inlined file: juce_DeletedAtShutdown.h ***/
  9119. /*** Start of inlined file: juce_Timer.h ***/
  9120. #ifndef __JUCE_TIMER_JUCEHEADER__
  9121. #define __JUCE_TIMER_JUCEHEADER__
  9122. class InternalTimerThread;
  9123. class JUCE_API Timer
  9124. {
  9125. protected:
  9126. Timer() throw();
  9127. Timer (const Timer& other) throw();
  9128. public:
  9129. virtual ~Timer();
  9130. virtual void timerCallback() = 0;
  9131. void startTimer (const int intervalInMilliseconds) throw();
  9132. void stopTimer() throw();
  9133. bool isTimerRunning() const throw() { return periodMs > 0; }
  9134. int getTimerInterval() const throw() { return periodMs; }
  9135. private:
  9136. friend class InternalTimerThread;
  9137. int countdownMs, periodMs;
  9138. Timer* previous;
  9139. Timer* next;
  9140. const Timer& operator= (const Timer&);
  9141. };
  9142. #endif // __JUCE_TIMER_JUCEHEADER__
  9143. /*** End of inlined file: juce_Timer.h ***/
  9144. class JUCE_API FocusChangeListener
  9145. {
  9146. public:
  9147. virtual ~FocusChangeListener() {}
  9148. virtual void globalFocusChanged (Component* focusedComponent) = 0;
  9149. };
  9150. class JUCE_API Desktop : private DeletedAtShutdown,
  9151. private Timer,
  9152. private AsyncUpdater
  9153. {
  9154. public:
  9155. static Desktop& JUCE_CALLTYPE getInstance() throw();
  9156. const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
  9157. const Rectangle<int> getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
  9158. const Rectangle<int> getMonitorAreaContaining (int x, int y, const bool clippedToWorkArea = true) const throw();
  9159. static void getMousePosition (int& x, int& y) throw();
  9160. static void setMousePosition (int x, int y) throw();
  9161. static void getLastMouseDownPosition (int& x, int& y) throw();
  9162. static int getMouseButtonClickCounter() throw();
  9163. static void setScreenSaverEnabled (const bool isEnabled) throw();
  9164. static bool isScreenSaverEnabled() throw();
  9165. void addGlobalMouseListener (MouseListener* const listener) throw();
  9166. void removeGlobalMouseListener (MouseListener* const listener) throw();
  9167. void addFocusChangeListener (FocusChangeListener* const listener) throw();
  9168. void removeFocusChangeListener (FocusChangeListener* const listener) throw();
  9169. void setKioskModeComponent (Component* componentToUse,
  9170. const bool allowMenusAndBars = true);
  9171. Component* getKioskModeComponent() const { return kioskModeComponent; }
  9172. int getNumComponents() const throw();
  9173. Component* getComponent (const int index) const throw();
  9174. Component* findComponentAt (const int screenX,
  9175. const int screenY) const;
  9176. juce_UseDebuggingNewOperator
  9177. void refreshMonitorSizes() throw();
  9178. static bool canUseSemiTransparentWindows() throw();
  9179. private:
  9180. static Desktop* instance;
  9181. friend class Component;
  9182. friend class ComponentPeer;
  9183. SortedSet <void*> mouseListeners, focusListeners;
  9184. Array <Component*> desktopComponents;
  9185. friend class DeletedAtShutdown;
  9186. friend class TopLevelWindowManager;
  9187. Desktop() throw();
  9188. ~Desktop() throw();
  9189. Array <Rectangle<int> > monitorCoordsClipped, monitorCoordsUnclipped;
  9190. int lastFakeMouseMoveX, lastFakeMouseMoveY, mouseClickCounter;
  9191. bool mouseMovedSignificantlySincePressed;
  9192. struct RecentMouseDown
  9193. {
  9194. Point<int> position;
  9195. int64 time;
  9196. Component* component;
  9197. };
  9198. RecentMouseDown mouseDowns[4];
  9199. void incrementMouseClickCounter() throw();
  9200. void registerMouseDown (const Point<int>& position, int64 time, Component* component) throw();
  9201. void registerMouseDrag (const Point<int>& position) throw();
  9202. const Time getLastMouseDownTime() const throw();
  9203. int getNumberOfMultipleClicks() const throw();
  9204. Component* kioskModeComponent;
  9205. Rectangle<int> kioskComponentOriginalBounds;
  9206. void timerCallback();
  9207. void sendMouseMove();
  9208. void resetTimer() throw();
  9209. int getNumDisplayMonitors() const throw();
  9210. const Rectangle<int> getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
  9211. void addDesktopComponent (Component* const c) throw();
  9212. void removeDesktopComponent (Component* const c) throw();
  9213. void componentBroughtToFront (Component* const c) throw();
  9214. void triggerFocusCallback() throw();
  9215. void handleAsyncUpdate();
  9216. Desktop (const Desktop&);
  9217. const Desktop& operator= (const Desktop&);
  9218. };
  9219. #endif // __JUCE_DESKTOP_JUCEHEADER__
  9220. /*** End of inlined file: juce_Desktop.h ***/
  9221. class KeyPressMappingSet;
  9222. class ApplicationCommandManagerListener;
  9223. class JUCE_API ApplicationCommandManager : private AsyncUpdater,
  9224. private FocusChangeListener
  9225. {
  9226. public:
  9227. ApplicationCommandManager();
  9228. virtual ~ApplicationCommandManager();
  9229. void clearCommands();
  9230. void registerCommand (const ApplicationCommandInfo& newCommand);
  9231. void registerAllCommandsForTarget (ApplicationCommandTarget* target);
  9232. void removeCommand (const CommandID commandID);
  9233. void commandStatusChanged();
  9234. int getNumCommands() const throw() { return commands.size(); }
  9235. const ApplicationCommandInfo* getCommandForIndex (const int index) const throw() { return commands [index]; }
  9236. const ApplicationCommandInfo* getCommandForID (const CommandID commandID) const throw();
  9237. const String getNameOfCommand (const CommandID commandID) const throw();
  9238. const String getDescriptionOfCommand (const CommandID commandID) const throw();
  9239. const StringArray getCommandCategories() const throw();
  9240. const Array <CommandID> getCommandsInCategory (const String& categoryName) const throw();
  9241. KeyPressMappingSet* getKeyMappings() const throw() { return keyMappings; }
  9242. bool invokeDirectly (const CommandID commandID,
  9243. const bool asynchronously);
  9244. bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
  9245. const bool asynchronously);
  9246. virtual ApplicationCommandTarget* getFirstCommandTarget (const CommandID commandID);
  9247. void setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw();
  9248. ApplicationCommandTarget* getTargetForCommand (const CommandID commandID,
  9249. ApplicationCommandInfo& upToDateInfo);
  9250. void addListener (ApplicationCommandManagerListener* const listener) throw();
  9251. void removeListener (ApplicationCommandManagerListener* const listener) throw();
  9252. static ApplicationCommandTarget* findDefaultComponentTarget();
  9253. static ApplicationCommandTarget* findTargetForComponent (Component* component);
  9254. juce_UseDebuggingNewOperator
  9255. private:
  9256. OwnedArray <ApplicationCommandInfo> commands;
  9257. SortedSet <void*> listeners;
  9258. ScopedPointer <KeyPressMappingSet> keyMappings;
  9259. ApplicationCommandTarget* firstTarget;
  9260. void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info) const;
  9261. void handleAsyncUpdate();
  9262. void globalFocusChanged (Component*);
  9263. // xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
  9264. // version of this method.
  9265. virtual short getFirstCommandTarget() { return 0; }
  9266. };
  9267. class JUCE_API ApplicationCommandManagerListener
  9268. {
  9269. public:
  9270. virtual ~ApplicationCommandManagerListener() {}
  9271. virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info) = 0;
  9272. virtual void applicationCommandListChanged() = 0;
  9273. };
  9274. #endif // __JUCE_APPLICATIONCOMMANDMANAGER_JUCEHEADER__
  9275. /*** End of inlined file: juce_ApplicationCommandManager.h ***/
  9276. #endif
  9277. #ifndef __JUCE_APPLICATIONCOMMANDTARGET_JUCEHEADER__
  9278. #endif
  9279. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9280. /*** Start of inlined file: juce_ApplicationProperties.h ***/
  9281. #ifndef __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9282. #define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9283. /*** Start of inlined file: juce_PropertiesFile.h ***/
  9284. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  9285. #define __JUCE_PROPERTIESFILE_JUCEHEADER__
  9286. class JUCE_API PropertiesFile : public PropertySet,
  9287. public ChangeBroadcaster,
  9288. private Timer
  9289. {
  9290. public:
  9291. enum FileFormatOptions
  9292. {
  9293. ignoreCaseOfKeyNames = 1,
  9294. storeAsBinary = 2,
  9295. storeAsCompressedBinary = 4,
  9296. storeAsXML = 8
  9297. };
  9298. PropertiesFile (const File& file,
  9299. const int millisecondsBeforeSaving,
  9300. const int options);
  9301. ~PropertiesFile();
  9302. bool saveIfNeeded();
  9303. bool save();
  9304. bool needsToBeSaved() const;
  9305. const File getFile() const { return file; }
  9306. static PropertiesFile* createDefaultAppPropertiesFile (const String& applicationName,
  9307. const String& fileNameSuffix,
  9308. const String& folderName,
  9309. const bool commonToAllUsers,
  9310. const int millisecondsBeforeSaving,
  9311. const int propertiesFileOptions);
  9312. static const File getDefaultAppSettingsFile (const String& applicationName,
  9313. const String& fileNameSuffix,
  9314. const String& folderName,
  9315. const bool commonToAllUsers);
  9316. juce_UseDebuggingNewOperator
  9317. protected:
  9318. virtual void propertyChanged();
  9319. private:
  9320. File file;
  9321. int timerInterval;
  9322. const int options;
  9323. bool needsWriting;
  9324. void timerCallback();
  9325. PropertiesFile (const PropertiesFile&);
  9326. const PropertiesFile& operator= (const PropertiesFile&);
  9327. };
  9328. #endif // __JUCE_PROPERTIESFILE_JUCEHEADER__
  9329. /*** End of inlined file: juce_PropertiesFile.h ***/
  9330. class JUCE_API ApplicationProperties : public DeletedAtShutdown
  9331. {
  9332. public:
  9333. ApplicationProperties() throw();
  9334. ~ApplicationProperties();
  9335. juce_DeclareSingleton (ApplicationProperties, false)
  9336. void setStorageParameters (const String& applicationName,
  9337. const String& fileNameSuffix,
  9338. const String& folderName,
  9339. const int millisecondsBeforeSaving,
  9340. const int propertiesFileOptions) throw();
  9341. bool testWriteAccess (const bool testUserSettings,
  9342. const bool testCommonSettings,
  9343. const bool showWarningDialogOnFailure);
  9344. PropertiesFile* getUserSettings() throw();
  9345. PropertiesFile* getCommonSettings (const bool returnUserPropsIfReadOnly) throw();
  9346. bool saveIfNeeded();
  9347. void closeFiles();
  9348. juce_UseDebuggingNewOperator
  9349. private:
  9350. ScopedPointer <PropertiesFile> userProps, commonProps;
  9351. String appName, fileSuffix, folderName;
  9352. int msBeforeSaving, options;
  9353. int commonSettingsAreReadOnly;
  9354. ApplicationProperties (const ApplicationProperties&);
  9355. const ApplicationProperties& operator= (const ApplicationProperties&);
  9356. void openFiles() throw();
  9357. };
  9358. #endif // __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
  9359. /*** End of inlined file: juce_ApplicationProperties.h ***/
  9360. #endif
  9361. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9362. /*** Start of inlined file: juce_AiffAudioFormat.h ***/
  9363. #ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9364. #define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9365. /*** Start of inlined file: juce_AudioFormat.h ***/
  9366. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9367. #define __JUCE_AUDIOFORMAT_JUCEHEADER__
  9368. /*** Start of inlined file: juce_AudioFormatReader.h ***/
  9369. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9370. #define __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9371. class AudioFormat;
  9372. class JUCE_API AudioFormatReader
  9373. {
  9374. protected:
  9375. AudioFormatReader (InputStream* const sourceStream,
  9376. const String& formatName);
  9377. public:
  9378. virtual ~AudioFormatReader();
  9379. const String getFormatName() const throw() { return formatName; }
  9380. bool read (int** destSamples,
  9381. int numDestChannels,
  9382. int64 startSampleInSource,
  9383. int numSamplesToRead,
  9384. const bool fillLeftoverChannelsWithCopies);
  9385. virtual void readMaxLevels (int64 startSample,
  9386. int64 numSamples,
  9387. float& lowestLeft,
  9388. float& highestLeft,
  9389. float& lowestRight,
  9390. float& highestRight);
  9391. int64 searchForLevel (int64 startSample,
  9392. int64 numSamplesToSearch,
  9393. const double magnitudeRangeMinimum,
  9394. const double magnitudeRangeMaximum,
  9395. const int minimumConsecutiveSamples);
  9396. double sampleRate;
  9397. unsigned int bitsPerSample;
  9398. int64 lengthInSamples;
  9399. unsigned int numChannels;
  9400. bool usesFloatingPointData;
  9401. StringPairArray metadataValues;
  9402. InputStream* input;
  9403. virtual bool readSamples (int** destSamples,
  9404. int numDestChannels,
  9405. int startOffsetInDestBuffer,
  9406. int64 startSampleInFile,
  9407. int numSamples) = 0;
  9408. juce_UseDebuggingNewOperator
  9409. private:
  9410. String formatName;
  9411. AudioFormatReader (const AudioFormatReader&);
  9412. const AudioFormatReader& operator= (const AudioFormatReader&);
  9413. };
  9414. #endif // __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9415. /*** End of inlined file: juce_AudioFormatReader.h ***/
  9416. /*** Start of inlined file: juce_AudioFormatWriter.h ***/
  9417. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9418. #define __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9419. /*** Start of inlined file: juce_AudioSource.h ***/
  9420. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  9421. #define __JUCE_AUDIOSOURCE_JUCEHEADER__
  9422. /*** Start of inlined file: juce_AudioSampleBuffer.h ***/
  9423. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9424. #define __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9425. class AudioFormatReader;
  9426. class AudioFormatWriter;
  9427. class JUCE_API AudioSampleBuffer
  9428. {
  9429. public:
  9430. AudioSampleBuffer (const int numChannels,
  9431. const int numSamples) throw();
  9432. AudioSampleBuffer (float** dataToReferTo,
  9433. const int numChannels,
  9434. const int numSamples) throw();
  9435. AudioSampleBuffer (const AudioSampleBuffer& other) throw();
  9436. const AudioSampleBuffer& operator= (const AudioSampleBuffer& other) throw();
  9437. virtual ~AudioSampleBuffer() throw();
  9438. int getNumChannels() const throw() { return numChannels; }
  9439. int getNumSamples() const throw() { return size; }
  9440. float* getSampleData (const int channelNumber) const throw()
  9441. {
  9442. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9443. return channels [channelNumber];
  9444. }
  9445. float* getSampleData (const int channelNumber,
  9446. const int sampleOffset) const throw()
  9447. {
  9448. jassert (((unsigned int) channelNumber) < (unsigned int) numChannels);
  9449. jassert (((unsigned int) sampleOffset) < (unsigned int) size);
  9450. return channels [channelNumber] + sampleOffset;
  9451. }
  9452. float** getArrayOfChannels() const throw() { return channels; }
  9453. void setSize (const int newNumChannels,
  9454. const int newNumSamples,
  9455. const bool keepExistingContent = false,
  9456. const bool clearExtraSpace = false,
  9457. const bool avoidReallocating = false) throw();
  9458. void setDataToReferTo (float** dataToReferTo,
  9459. const int numChannels,
  9460. const int numSamples) throw();
  9461. void clear() throw();
  9462. void clear (const int startSample,
  9463. const int numSamples) throw();
  9464. void clear (const int channel,
  9465. const int startSample,
  9466. const int numSamples) throw();
  9467. void applyGain (const int channel,
  9468. const int startSample,
  9469. int numSamples,
  9470. const float gain) throw();
  9471. void applyGain (const int startSample,
  9472. const int numSamples,
  9473. const float gain) throw();
  9474. void applyGainRamp (const int channel,
  9475. const int startSample,
  9476. int numSamples,
  9477. float startGain,
  9478. float endGain) throw();
  9479. void addFrom (const int destChannel,
  9480. const int destStartSample,
  9481. const AudioSampleBuffer& source,
  9482. const int sourceChannel,
  9483. const int sourceStartSample,
  9484. int numSamples,
  9485. const float gainToApplyToSource = 1.0f) throw();
  9486. void addFrom (const int destChannel,
  9487. const int destStartSample,
  9488. const float* source,
  9489. int numSamples,
  9490. const float gainToApplyToSource = 1.0f) throw();
  9491. void addFromWithRamp (const int destChannel,
  9492. const int destStartSample,
  9493. const float* source,
  9494. int numSamples,
  9495. float startGain,
  9496. float endGain) throw();
  9497. void copyFrom (const int destChannel,
  9498. const int destStartSample,
  9499. const AudioSampleBuffer& source,
  9500. const int sourceChannel,
  9501. const int sourceStartSample,
  9502. int numSamples) throw();
  9503. void copyFrom (const int destChannel,
  9504. const int destStartSample,
  9505. const float* source,
  9506. int numSamples) throw();
  9507. void copyFrom (const int destChannel,
  9508. const int destStartSample,
  9509. const float* source,
  9510. int numSamples,
  9511. const float gain) throw();
  9512. void copyFromWithRamp (const int destChannel,
  9513. const int destStartSample,
  9514. const float* source,
  9515. int numSamples,
  9516. float startGain,
  9517. float endGain) throw();
  9518. void findMinMax (const int channel,
  9519. const int startSample,
  9520. int numSamples,
  9521. float& minVal,
  9522. float& maxVal) const throw();
  9523. float getMagnitude (const int channel,
  9524. const int startSample,
  9525. const int numSamples) const throw();
  9526. float getMagnitude (const int startSample,
  9527. const int numSamples) const throw();
  9528. float getRMSLevel (const int channel,
  9529. const int startSample,
  9530. const int numSamples) const throw();
  9531. void readFromAudioReader (AudioFormatReader* reader,
  9532. const int startSample,
  9533. const int numSamples,
  9534. const int readerStartSample,
  9535. const bool useReaderLeftChan,
  9536. const bool useReaderRightChan) throw();
  9537. void writeToAudioWriter (AudioFormatWriter* writer,
  9538. const int startSample,
  9539. const int numSamples) const throw();
  9540. juce_UseDebuggingNewOperator
  9541. private:
  9542. int numChannels, size;
  9543. size_t allocatedBytes;
  9544. float** channels;
  9545. HeapBlock <char> allocatedData;
  9546. float* preallocatedChannelSpace [32];
  9547. void allocateData();
  9548. void allocateChannels (float** const dataToReferTo);
  9549. };
  9550. #endif // __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  9551. /*** End of inlined file: juce_AudioSampleBuffer.h ***/
  9552. struct JUCE_API AudioSourceChannelInfo
  9553. {
  9554. AudioSampleBuffer* buffer;
  9555. int startSample;
  9556. int numSamples;
  9557. void clearActiveBufferRegion() const
  9558. {
  9559. if (buffer != 0)
  9560. buffer->clear (startSample, numSamples);
  9561. }
  9562. };
  9563. class JUCE_API AudioSource
  9564. {
  9565. protected:
  9566. AudioSource() throw() {}
  9567. public:
  9568. virtual ~AudioSource() {}
  9569. virtual void prepareToPlay (int samplesPerBlockExpected,
  9570. double sampleRate) = 0;
  9571. virtual void releaseResources() = 0;
  9572. virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
  9573. };
  9574. #endif // __JUCE_AUDIOSOURCE_JUCEHEADER__
  9575. /*** End of inlined file: juce_AudioSource.h ***/
  9576. class JUCE_API AudioFormatWriter
  9577. {
  9578. protected:
  9579. AudioFormatWriter (OutputStream* const destStream,
  9580. const String& formatName,
  9581. const double sampleRate,
  9582. const unsigned int numberOfChannels,
  9583. const unsigned int bitsPerSample);
  9584. public:
  9585. virtual ~AudioFormatWriter();
  9586. const String getFormatName() const throw() { return formatName; }
  9587. virtual bool write (const int** samplesToWrite,
  9588. int numSamples) = 0;
  9589. bool writeFromAudioReader (AudioFormatReader& reader,
  9590. int64 startSample,
  9591. int64 numSamplesToRead);
  9592. bool writeFromAudioSource (AudioSource& source,
  9593. int numSamplesToRead,
  9594. const int samplesPerBlock = 2048);
  9595. double getSampleRate() const throw() { return sampleRate; }
  9596. int getNumChannels() const throw() { return numChannels; }
  9597. int getBitsPerSample() const throw() { return bitsPerSample; }
  9598. bool isFloatingPoint() const throw() { return usesFloatingPointData; }
  9599. juce_UseDebuggingNewOperator
  9600. protected:
  9601. double sampleRate;
  9602. unsigned int numChannels;
  9603. unsigned int bitsPerSample;
  9604. bool usesFloatingPointData;
  9605. OutputStream* output;
  9606. private:
  9607. String formatName;
  9608. };
  9609. #endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9610. /*** End of inlined file: juce_AudioFormatWriter.h ***/
  9611. class JUCE_API AudioFormat
  9612. {
  9613. public:
  9614. virtual ~AudioFormat();
  9615. const String& getFormatName() const;
  9616. const StringArray& getFileExtensions() const;
  9617. virtual bool canHandleFile (const File& fileToTest);
  9618. virtual const Array <int> getPossibleSampleRates() = 0;
  9619. virtual const Array <int> getPossibleBitDepths() = 0;
  9620. virtual bool canDoStereo() = 0;
  9621. virtual bool canDoMono() = 0;
  9622. virtual bool isCompressed();
  9623. virtual const StringArray getQualityOptions();
  9624. virtual AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9625. const bool deleteStreamIfOpeningFails) = 0;
  9626. virtual AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9627. double sampleRateToUse,
  9628. unsigned int numberOfChannels,
  9629. int bitsPerSample,
  9630. const StringPairArray& metadataValues,
  9631. int qualityOptionIndex) = 0;
  9632. protected:
  9633. AudioFormat (const String& formatName,
  9634. const tchar** const fileExtensions);
  9635. private:
  9636. String formatName;
  9637. StringArray fileExtensions;
  9638. };
  9639. #endif // __JUCE_AUDIOFORMAT_JUCEHEADER__
  9640. /*** End of inlined file: juce_AudioFormat.h ***/
  9641. class JUCE_API AiffAudioFormat : public AudioFormat
  9642. {
  9643. public:
  9644. AiffAudioFormat();
  9645. ~AiffAudioFormat();
  9646. const Array <int> getPossibleSampleRates();
  9647. const Array <int> getPossibleBitDepths();
  9648. bool canDoStereo();
  9649. bool canDoMono();
  9650. #if JUCE_MAC
  9651. bool canHandleFile (const File& fileToTest);
  9652. #endif
  9653. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9654. const bool deleteStreamIfOpeningFails);
  9655. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9656. double sampleRateToUse,
  9657. unsigned int numberOfChannels,
  9658. int bitsPerSample,
  9659. const StringPairArray& metadataValues,
  9660. int qualityOptionIndex);
  9661. juce_UseDebuggingNewOperator
  9662. };
  9663. #endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
  9664. /*** End of inlined file: juce_AiffAudioFormat.h ***/
  9665. #endif
  9666. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9667. /*** Start of inlined file: juce_AudioCDBurner.h ***/
  9668. #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9669. #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9670. #if JUCE_USE_CDBURNER
  9671. class AudioCDBurner
  9672. {
  9673. public:
  9674. static const StringArray findAvailableDevices();
  9675. static AudioCDBurner* openDevice (const int deviceIndex);
  9676. ~AudioCDBurner();
  9677. bool isDiskPresent() const;
  9678. int getNumAvailableAudioBlocks() const;
  9679. bool addAudioTrack (AudioSource* source, int numSamples);
  9680. class BurnProgressListener
  9681. {
  9682. public:
  9683. BurnProgressListener() throw() {}
  9684. virtual ~BurnProgressListener() {}
  9685. virtual bool audioCDBurnProgress (float proportionComplete) = 0;
  9686. };
  9687. const String burn (BurnProgressListener* listener,
  9688. const bool ejectDiscAfterwards,
  9689. const bool peformFakeBurnForTesting);
  9690. juce_UseDebuggingNewOperator
  9691. private:
  9692. AudioCDBurner (const int deviceIndex);
  9693. void* internal;
  9694. };
  9695. #endif
  9696. #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
  9697. /*** End of inlined file: juce_AudioCDBurner.h ***/
  9698. #endif
  9699. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9700. /*** Start of inlined file: juce_AudioCDReader.h ***/
  9701. #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
  9702. #define __JUCE_AUDIOCDREADER_JUCEHEADER__
  9703. #if JUCE_USE_CDREADER
  9704. #if JUCE_MAC
  9705. #endif
  9706. class JUCE_API AudioCDReader : public AudioFormatReader
  9707. {
  9708. public:
  9709. static const StringArray getAvailableCDNames();
  9710. static AudioCDReader* createReaderForCD (const int index);
  9711. ~AudioCDReader();
  9712. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9713. int64 startSampleInFile, int numSamples);
  9714. bool isCDStillPresent() const;
  9715. int getNumTracks() const;
  9716. int getPositionOfTrackStart (int trackNum) const;
  9717. bool isTrackAudio (int trackNum) const;
  9718. void refreshTrackLengths();
  9719. void enableIndexScanning (bool enabled);
  9720. int getLastIndex() const;
  9721. const Array <int> findIndexesInTrack (const int trackNumber);
  9722. int getCDDBId();
  9723. void ejectDisk();
  9724. juce_UseDebuggingNewOperator
  9725. private:
  9726. #if JUCE_MAC
  9727. File volumeDir;
  9728. Array<File> tracks;
  9729. Array<int> trackStartSamples;
  9730. int currentReaderTrack;
  9731. ScopedPointer <AudioFormatReader> reader;
  9732. AudioCDReader (const File& volume);
  9733. public:
  9734. static int compareElements (const File&, const File&);
  9735. private:
  9736. #elif JUCE_WINDOWS
  9737. int numTracks;
  9738. int trackStarts[100];
  9739. bool audioTracks [100];
  9740. void* handle;
  9741. bool indexingEnabled;
  9742. int lastIndex, firstFrameInBuffer, samplesInBuffer;
  9743. MemoryBlock buffer;
  9744. AudioCDReader (void* handle);
  9745. int getIndexAt (int samplePos);
  9746. #elif JUCE_LINUX
  9747. AudioCDReader();
  9748. #endif
  9749. AudioCDReader (const AudioCDReader&);
  9750. const AudioCDReader& operator= (const AudioCDReader&);
  9751. };
  9752. #endif
  9753. #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
  9754. /*** End of inlined file: juce_AudioCDReader.h ***/
  9755. #endif
  9756. #ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__
  9757. #endif
  9758. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9759. /*** Start of inlined file: juce_AudioFormatManager.h ***/
  9760. #ifndef __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9761. #define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9762. class JUCE_API AudioFormatManager
  9763. {
  9764. public:
  9765. AudioFormatManager();
  9766. ~AudioFormatManager();
  9767. juce_DeclareSingleton (AudioFormatManager, false);
  9768. void registerFormat (AudioFormat* newFormat,
  9769. const bool makeThisTheDefaultFormat);
  9770. void registerBasicFormats();
  9771. void clearFormats();
  9772. int getNumKnownFormats() const;
  9773. AudioFormat* getKnownFormat (const int index) const;
  9774. AudioFormat* findFormatForFileExtension (const String& fileExtension) const;
  9775. AudioFormat* getDefaultFormat() const;
  9776. const String getWildcardForAllFormats() const;
  9777. AudioFormatReader* createReaderFor (const File& audioFile);
  9778. AudioFormatReader* createReaderFor (InputStream* audioFileStream);
  9779. juce_UseDebuggingNewOperator
  9780. private:
  9781. VoidArray knownFormats;
  9782. int defaultFormatIndex;
  9783. };
  9784. #endif // __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
  9785. /*** End of inlined file: juce_AudioFormatManager.h ***/
  9786. #endif
  9787. #ifndef __JUCE_AUDIOFORMATREADER_JUCEHEADER__
  9788. #endif
  9789. #ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
  9790. #endif
  9791. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9792. /*** Start of inlined file: juce_AudioSubsectionReader.h ***/
  9793. #ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9794. #define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9795. class JUCE_API AudioSubsectionReader : public AudioFormatReader
  9796. {
  9797. public:
  9798. AudioSubsectionReader (AudioFormatReader* const sourceReader,
  9799. const int64 subsectionStartSample,
  9800. const int64 subsectionLength,
  9801. const bool deleteSourceWhenDeleted);
  9802. ~AudioSubsectionReader();
  9803. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  9804. int64 startSampleInFile, int numSamples);
  9805. void readMaxLevels (int64 startSample,
  9806. int64 numSamples,
  9807. float& lowestLeft,
  9808. float& highestLeft,
  9809. float& lowestRight,
  9810. float& highestRight);
  9811. juce_UseDebuggingNewOperator
  9812. private:
  9813. AudioFormatReader* const source;
  9814. int64 startSample, length;
  9815. const bool deleteSourceWhenDeleted;
  9816. AudioSubsectionReader (const AudioSubsectionReader&);
  9817. const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
  9818. };
  9819. #endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
  9820. /*** End of inlined file: juce_AudioSubsectionReader.h ***/
  9821. #endif
  9822. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9823. /*** Start of inlined file: juce_AudioThumbnail.h ***/
  9824. #ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9825. #define __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9826. class AudioThumbnailCache;
  9827. class JUCE_API AudioThumbnail : public ChangeBroadcaster,
  9828. public TimeSliceClient,
  9829. private Timer
  9830. {
  9831. public:
  9832. AudioThumbnail (const int sourceSamplesPerThumbnailSample,
  9833. AudioFormatManager& formatManagerToUse,
  9834. AudioThumbnailCache& cacheToUse);
  9835. ~AudioThumbnail();
  9836. void setSource (InputSource* const newSource);
  9837. void loadFrom (InputStream& input);
  9838. void saveTo (OutputStream& output) const;
  9839. int getNumChannels() const throw();
  9840. double getTotalLength() const throw();
  9841. void drawChannel (Graphics& g,
  9842. int x, int y, int w, int h,
  9843. double startTimeSeconds,
  9844. double endTimeSeconds,
  9845. int channelNum,
  9846. const float verticalZoomFactor);
  9847. bool isFullyLoaded() const throw();
  9848. bool useTimeSlice();
  9849. void timerCallback();
  9850. juce_UseDebuggingNewOperator
  9851. private:
  9852. AudioFormatManager& formatManagerToUse;
  9853. AudioThumbnailCache& cache;
  9854. ScopedPointer <InputSource> source;
  9855. CriticalSection readerLock;
  9856. ScopedPointer <AudioFormatReader> reader;
  9857. MemoryBlock data, cachedLevels;
  9858. int orginalSamplesPerThumbnailSample;
  9859. int numChannelsCached, numSamplesCached;
  9860. double cachedStart, cachedTimePerPixel;
  9861. bool cacheNeedsRefilling;
  9862. void clear();
  9863. AudioFormatReader* createReader() const;
  9864. void generateSection (AudioFormatReader& reader,
  9865. int64 startSample,
  9866. int numSamples);
  9867. char* getChannelData (int channel) const;
  9868. void refillCache (const int numSamples,
  9869. double startTime,
  9870. const double timePerPixel);
  9871. friend class AudioThumbnailCache;
  9872. // true if it needs more callbacks from the readNextBlockFromAudioFile() method
  9873. bool initialiseFromAudioFile (AudioFormatReader& reader);
  9874. // returns true if more needs to be read
  9875. bool readNextBlockFromAudioFile (AudioFormatReader& reader);
  9876. };
  9877. #endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
  9878. /*** End of inlined file: juce_AudioThumbnail.h ***/
  9879. #endif
  9880. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9881. /*** Start of inlined file: juce_AudioThumbnailCache.h ***/
  9882. #ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9883. #define __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9884. struct ThumbnailCacheEntry;
  9885. class JUCE_API AudioThumbnailCache : public TimeSliceThread
  9886. {
  9887. public:
  9888. AudioThumbnailCache (const int maxNumThumbsToStore);
  9889. ~AudioThumbnailCache();
  9890. void clear();
  9891. bool loadThumb (AudioThumbnail& thumb, const int64 hashCode);
  9892. void storeThumb (const AudioThumbnail& thumb, const int64 hashCode);
  9893. juce_UseDebuggingNewOperator
  9894. private:
  9895. OwnedArray <ThumbnailCacheEntry> thumbs;
  9896. int maxNumThumbsToStore;
  9897. friend class AudioThumbnail;
  9898. void addThumbnail (AudioThumbnail* const thumb);
  9899. void removeThumbnail (AudioThumbnail* const thumb);
  9900. };
  9901. #endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
  9902. /*** End of inlined file: juce_AudioThumbnailCache.h ***/
  9903. #endif
  9904. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9905. /*** Start of inlined file: juce_FlacAudioFormat.h ***/
  9906. #ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9907. #define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9908. #if JUCE_USE_FLAC || defined (DOXYGEN)
  9909. class JUCE_API FlacAudioFormat : public AudioFormat
  9910. {
  9911. public:
  9912. FlacAudioFormat();
  9913. ~FlacAudioFormat();
  9914. const Array <int> getPossibleSampleRates();
  9915. const Array <int> getPossibleBitDepths();
  9916. bool canDoStereo();
  9917. bool canDoMono();
  9918. bool isCompressed();
  9919. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9920. const bool deleteStreamIfOpeningFails);
  9921. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9922. double sampleRateToUse,
  9923. unsigned int numberOfChannels,
  9924. int bitsPerSample,
  9925. const StringPairArray& metadataValues,
  9926. int qualityOptionIndex);
  9927. juce_UseDebuggingNewOperator
  9928. };
  9929. #endif
  9930. #endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
  9931. /*** End of inlined file: juce_FlacAudioFormat.h ***/
  9932. #endif
  9933. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9934. /*** Start of inlined file: juce_OggVorbisAudioFormat.h ***/
  9935. #ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9936. #define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9937. #if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
  9938. class JUCE_API OggVorbisAudioFormat : public AudioFormat
  9939. {
  9940. public:
  9941. OggVorbisAudioFormat();
  9942. ~OggVorbisAudioFormat();
  9943. const Array <int> getPossibleSampleRates();
  9944. const Array <int> getPossibleBitDepths();
  9945. bool canDoStereo();
  9946. bool canDoMono();
  9947. bool isCompressed();
  9948. const StringArray getQualityOptions();
  9949. int estimateOggFileQuality (const File& source);
  9950. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9951. const bool deleteStreamIfOpeningFails);
  9952. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9953. double sampleRateToUse,
  9954. unsigned int numberOfChannels,
  9955. int bitsPerSample,
  9956. const StringPairArray& metadataValues,
  9957. int qualityOptionIndex);
  9958. juce_UseDebuggingNewOperator
  9959. };
  9960. #endif
  9961. #endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
  9962. /*** End of inlined file: juce_OggVorbisAudioFormat.h ***/
  9963. #endif
  9964. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9965. /*** Start of inlined file: juce_QuickTimeAudioFormat.h ***/
  9966. #ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9967. #define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9968. #if JUCE_QUICKTIME
  9969. class JUCE_API QuickTimeAudioFormat : public AudioFormat
  9970. {
  9971. public:
  9972. QuickTimeAudioFormat();
  9973. ~QuickTimeAudioFormat();
  9974. const Array <int> getPossibleSampleRates();
  9975. const Array <int> getPossibleBitDepths();
  9976. bool canDoStereo();
  9977. bool canDoMono();
  9978. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  9979. const bool deleteStreamIfOpeningFails);
  9980. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  9981. double sampleRateToUse,
  9982. unsigned int numberOfChannels,
  9983. int bitsPerSample,
  9984. const StringPairArray& metadataValues,
  9985. int qualityOptionIndex);
  9986. juce_UseDebuggingNewOperator
  9987. };
  9988. #endif
  9989. #endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
  9990. /*** End of inlined file: juce_QuickTimeAudioFormat.h ***/
  9991. #endif
  9992. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9993. /*** Start of inlined file: juce_WavAudioFormat.h ***/
  9994. #ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9995. #define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  9996. class JUCE_API WavAudioFormat : public AudioFormat
  9997. {
  9998. public:
  9999. WavAudioFormat();
  10000. ~WavAudioFormat();
  10001. static const tchar* const bwavDescription;
  10002. static const tchar* const bwavOriginator;
  10003. static const tchar* const bwavOriginatorRef;
  10004. static const tchar* const bwavOriginationDate;
  10005. static const tchar* const bwavOriginationTime;
  10006. static const tchar* const bwavTimeReference;
  10007. static const tchar* const bwavCodingHistory;
  10008. static const StringPairArray createBWAVMetadata (const String& description,
  10009. const String& originator,
  10010. const String& originatorRef,
  10011. const Time& dateAndTime,
  10012. const int64 timeReferenceSamples,
  10013. const String& codingHistory);
  10014. const Array <int> getPossibleSampleRates();
  10015. const Array <int> getPossibleBitDepths();
  10016. bool canDoStereo();
  10017. bool canDoMono();
  10018. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  10019. const bool deleteStreamIfOpeningFails);
  10020. AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
  10021. double sampleRateToUse,
  10022. unsigned int numberOfChannels,
  10023. int bitsPerSample,
  10024. const StringPairArray& metadataValues,
  10025. int qualityOptionIndex);
  10026. bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
  10027. juce_UseDebuggingNewOperator
  10028. };
  10029. #endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
  10030. /*** End of inlined file: juce_WavAudioFormat.h ***/
  10031. #endif
  10032. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10033. /*** Start of inlined file: juce_AudioFormatReaderSource.h ***/
  10034. #ifndef __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10035. #define __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10036. /*** Start of inlined file: juce_PositionableAudioSource.h ***/
  10037. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10038. #define __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10039. class JUCE_API PositionableAudioSource : public AudioSource
  10040. {
  10041. protected:
  10042. PositionableAudioSource() throw() {}
  10043. public:
  10044. ~PositionableAudioSource() {}
  10045. virtual void setNextReadPosition (int newPosition) = 0;
  10046. virtual int getNextReadPosition() const = 0;
  10047. virtual int getTotalLength() const = 0;
  10048. virtual bool isLooping() const = 0;
  10049. };
  10050. #endif // __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10051. /*** End of inlined file: juce_PositionableAudioSource.h ***/
  10052. class JUCE_API AudioFormatReaderSource : public PositionableAudioSource
  10053. {
  10054. public:
  10055. AudioFormatReaderSource (AudioFormatReader* const sourceReader,
  10056. const bool deleteReaderWhenThisIsDeleted);
  10057. ~AudioFormatReaderSource();
  10058. void setLooping (const bool shouldLoop) throw();
  10059. bool isLooping() const { return looping; }
  10060. AudioFormatReader* getAudioFormatReader() const throw() { return reader; }
  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. juce_UseDebuggingNewOperator
  10068. private:
  10069. AudioFormatReader* reader;
  10070. bool deleteReader;
  10071. int volatile nextPlayPos;
  10072. bool volatile looping;
  10073. void readBufferSection (int start, int length, AudioSampleBuffer& buffer, int startSample);
  10074. AudioFormatReaderSource (const AudioFormatReaderSource&);
  10075. const AudioFormatReaderSource& operator= (const AudioFormatReaderSource&);
  10076. };
  10077. #endif // __JUCE_AUDIOFORMATREADERSOURCE_JUCEHEADER__
  10078. /*** End of inlined file: juce_AudioFormatReaderSource.h ***/
  10079. #endif
  10080. #ifndef __JUCE_AUDIOSOURCE_JUCEHEADER__
  10081. #endif
  10082. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10083. /*** Start of inlined file: juce_AudioSourcePlayer.h ***/
  10084. #ifndef __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10085. #define __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10086. /*** Start of inlined file: juce_AudioIODevice.h ***/
  10087. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10088. #define __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10089. class AudioIODevice;
  10090. class JUCE_API AudioIODeviceCallback
  10091. {
  10092. public:
  10093. virtual ~AudioIODeviceCallback() {}
  10094. virtual void audioDeviceIOCallback (const float** inputChannelData,
  10095. int numInputChannels,
  10096. float** outputChannelData,
  10097. int numOutputChannels,
  10098. int numSamples) = 0;
  10099. virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
  10100. virtual void audioDeviceStopped() = 0;
  10101. };
  10102. class JUCE_API AudioIODevice
  10103. {
  10104. public:
  10105. virtual ~AudioIODevice();
  10106. const String& getName() const throw() { return name; }
  10107. const String& getTypeName() const throw() { return typeName; }
  10108. virtual const StringArray getOutputChannelNames() = 0;
  10109. virtual const StringArray getInputChannelNames() = 0;
  10110. virtual int getNumSampleRates() = 0;
  10111. virtual double getSampleRate (int index) = 0;
  10112. virtual int getNumBufferSizesAvailable() = 0;
  10113. virtual int getBufferSizeSamples (int index) = 0;
  10114. virtual int getDefaultBufferSize() = 0;
  10115. virtual const String open (const BitArray& inputChannels,
  10116. const BitArray& outputChannels,
  10117. double sampleRate,
  10118. int bufferSizeSamples) = 0;
  10119. virtual void close() = 0;
  10120. virtual bool isOpen() = 0;
  10121. virtual void start (AudioIODeviceCallback* callback) = 0;
  10122. virtual void stop() = 0;
  10123. virtual bool isPlaying() = 0;
  10124. virtual const String getLastError() = 0;
  10125. virtual int getCurrentBufferSizeSamples() = 0;
  10126. virtual double getCurrentSampleRate() = 0;
  10127. virtual int getCurrentBitDepth() = 0;
  10128. virtual const BitArray getActiveOutputChannels() const = 0;
  10129. virtual const BitArray getActiveInputChannels() const = 0;
  10130. virtual int getOutputLatencyInSamples() = 0;
  10131. virtual int getInputLatencyInSamples() = 0;
  10132. virtual bool hasControlPanel() const;
  10133. virtual bool showControlPanel();
  10134. protected:
  10135. AudioIODevice (const String& deviceName,
  10136. const String& typeName);
  10137. String name, typeName;
  10138. };
  10139. #endif // __JUCE_AUDIOIODEVICE_JUCEHEADER__
  10140. /*** End of inlined file: juce_AudioIODevice.h ***/
  10141. class JUCE_API AudioSourcePlayer : public AudioIODeviceCallback
  10142. {
  10143. public:
  10144. AudioSourcePlayer();
  10145. virtual ~AudioSourcePlayer();
  10146. void setSource (AudioSource* newSource);
  10147. AudioSource* getCurrentSource() const throw() { return source; }
  10148. void setGain (const float newGain) throw();
  10149. void audioDeviceIOCallback (const float** inputChannelData,
  10150. int totalNumInputChannels,
  10151. float** outputChannelData,
  10152. int totalNumOutputChannels,
  10153. int numSamples);
  10154. void audioDeviceAboutToStart (AudioIODevice* device);
  10155. void audioDeviceStopped();
  10156. juce_UseDebuggingNewOperator
  10157. private:
  10158. CriticalSection readLock;
  10159. AudioSource* source;
  10160. double sampleRate;
  10161. int bufferSize;
  10162. float* channels [128];
  10163. float* outputChans [128];
  10164. const float* inputChans [128];
  10165. AudioSampleBuffer tempBuffer;
  10166. float lastGain, gain;
  10167. AudioSourcePlayer (const AudioSourcePlayer&);
  10168. const AudioSourcePlayer& operator= (const AudioSourcePlayer&);
  10169. };
  10170. #endif // __JUCE_AUDIOSOURCEPLAYER_JUCEHEADER__
  10171. /*** End of inlined file: juce_AudioSourcePlayer.h ***/
  10172. #endif
  10173. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10174. /*** Start of inlined file: juce_AudioTransportSource.h ***/
  10175. #ifndef __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10176. #define __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10177. /*** Start of inlined file: juce_BufferingAudioSource.h ***/
  10178. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10179. #define __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10180. class JUCE_API BufferingAudioSource : public PositionableAudioSource
  10181. {
  10182. public:
  10183. BufferingAudioSource (PositionableAudioSource* source,
  10184. const bool deleteSourceWhenDeleted,
  10185. int numberOfSamplesToBuffer);
  10186. ~BufferingAudioSource();
  10187. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10188. void releaseResources();
  10189. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10190. void setNextReadPosition (int newPosition);
  10191. int getNextReadPosition() const;
  10192. int getTotalLength() const { return source->getTotalLength(); }
  10193. bool isLooping() const { return source->isLooping(); }
  10194. juce_UseDebuggingNewOperator
  10195. private:
  10196. PositionableAudioSource* source;
  10197. bool deleteSourceWhenDeleted;
  10198. int numberOfSamplesToBuffer;
  10199. AudioSampleBuffer buffer;
  10200. CriticalSection bufferStartPosLock;
  10201. int volatile bufferValidStart, bufferValidEnd, nextPlayPos;
  10202. bool wasSourceLooping;
  10203. double volatile sampleRate;
  10204. friend class SharedBufferingAudioSourceThread;
  10205. bool readNextBufferChunk();
  10206. void readBufferSection (int start, int length, int bufferOffset);
  10207. BufferingAudioSource (const BufferingAudioSource&);
  10208. const BufferingAudioSource& operator= (const BufferingAudioSource&);
  10209. };
  10210. #endif // __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10211. /*** End of inlined file: juce_BufferingAudioSource.h ***/
  10212. /*** Start of inlined file: juce_ResamplingAudioSource.h ***/
  10213. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10214. #define __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10215. class JUCE_API ResamplingAudioSource : public AudioSource
  10216. {
  10217. public:
  10218. ResamplingAudioSource (AudioSource* const inputSource,
  10219. const bool deleteInputWhenDeleted);
  10220. ~ResamplingAudioSource();
  10221. void setResamplingRatio (const double samplesInPerOutputSample);
  10222. double getResamplingRatio() const throw() { return ratio; }
  10223. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10224. void releaseResources();
  10225. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10226. juce_UseDebuggingNewOperator
  10227. private:
  10228. AudioSource* const input;
  10229. const bool deleteInputWhenDeleted;
  10230. double ratio, lastRatio;
  10231. AudioSampleBuffer buffer;
  10232. int bufferPos, sampsInBuffer;
  10233. double subSampleOffset;
  10234. double coefficients[6];
  10235. CriticalSection ratioLock;
  10236. void setFilterCoefficients (double c1, double c2, double c3, double c4, double c5, double c6);
  10237. void createLowPass (const double proportionalRate);
  10238. struct FilterState
  10239. {
  10240. double x1, x2, y1, y2;
  10241. };
  10242. FilterState filterStates[2];
  10243. void resetFilters();
  10244. void applyFilter (float* samples, int num, FilterState& fs);
  10245. ResamplingAudioSource (const ResamplingAudioSource&);
  10246. const ResamplingAudioSource& operator= (const ResamplingAudioSource&);
  10247. };
  10248. #endif // __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10249. /*** End of inlined file: juce_ResamplingAudioSource.h ***/
  10250. class JUCE_API AudioTransportSource : public PositionableAudioSource,
  10251. public ChangeBroadcaster
  10252. {
  10253. public:
  10254. AudioTransportSource();
  10255. ~AudioTransportSource();
  10256. void setSource (PositionableAudioSource* const newSource,
  10257. int readAheadBufferSize = 0,
  10258. double sourceSampleRateToCorrectFor = 0.0);
  10259. void setPosition (double newPosition);
  10260. double getCurrentPosition() const;
  10261. bool hasStreamFinished() const throw() { return inputStreamEOF; }
  10262. void start();
  10263. void stop();
  10264. bool isPlaying() const throw() { return playing; }
  10265. void setGain (const float newGain) throw();
  10266. float getGain() const throw() { return gain; }
  10267. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10268. void releaseResources();
  10269. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10270. void setNextReadPosition (int newPosition);
  10271. int getNextReadPosition() const;
  10272. int getTotalLength() const;
  10273. bool isLooping() const;
  10274. juce_UseDebuggingNewOperator
  10275. private:
  10276. PositionableAudioSource* source;
  10277. ResamplingAudioSource* resamplerSource;
  10278. BufferingAudioSource* bufferingSource;
  10279. PositionableAudioSource* positionableSource;
  10280. AudioSource* masterSource;
  10281. CriticalSection callbackLock;
  10282. float volatile gain, lastGain;
  10283. bool volatile playing, stopped;
  10284. double sampleRate, sourceSampleRate;
  10285. int blockSize, readAheadBufferSize;
  10286. bool isPrepared, inputStreamEOF;
  10287. AudioTransportSource (const AudioTransportSource&);
  10288. const AudioTransportSource& operator= (const AudioTransportSource&);
  10289. };
  10290. #endif // __JUCE_AUDIOTRANSPORTSOURCE_JUCEHEADER__
  10291. /*** End of inlined file: juce_AudioTransportSource.h ***/
  10292. #endif
  10293. #ifndef __JUCE_BUFFERINGAUDIOSOURCE_JUCEHEADER__
  10294. #endif
  10295. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10296. /*** Start of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10297. #ifndef __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10298. #define __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10299. class ChannelRemappingAudioSource : public AudioSource
  10300. {
  10301. public:
  10302. ChannelRemappingAudioSource (AudioSource* const source,
  10303. const bool deleteSourceWhenDeleted);
  10304. ~ChannelRemappingAudioSource();
  10305. void setNumberOfChannelsToProduce (const int requiredNumberOfChannels) throw();
  10306. void clearAllMappings() throw();
  10307. void setInputChannelMapping (const int destChannelIndex,
  10308. const int sourceChannelIndex) throw();
  10309. void setOutputChannelMapping (const int sourceChannelIndex,
  10310. const int destChannelIndex) throw();
  10311. int getRemappedInputChannel (const int inputChannelIndex) const throw();
  10312. int getRemappedOutputChannel (const int outputChannelIndex) const throw();
  10313. XmlElement* createXml() const throw();
  10314. void restoreFromXml (const XmlElement& e) throw();
  10315. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10316. void releaseResources();
  10317. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10318. juce_UseDebuggingNewOperator
  10319. private:
  10320. int requiredNumberOfChannels;
  10321. Array <int> remappedInputs, remappedOutputs;
  10322. AudioSource* const source;
  10323. const bool deleteSourceWhenDeleted;
  10324. AudioSampleBuffer buffer;
  10325. AudioSourceChannelInfo remappedInfo;
  10326. CriticalSection lock;
  10327. ChannelRemappingAudioSource (const ChannelRemappingAudioSource&);
  10328. const ChannelRemappingAudioSource& operator= (const ChannelRemappingAudioSource&);
  10329. };
  10330. #endif // __JUCE_CHANNELREMAPPINGAUDIOSOURCE_JUCEHEADER__
  10331. /*** End of inlined file: juce_ChannelRemappingAudioSource.h ***/
  10332. #endif
  10333. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10334. /*** Start of inlined file: juce_IIRFilterAudioSource.h ***/
  10335. #ifndef __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10336. #define __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10337. /*** Start of inlined file: juce_IIRFilter.h ***/
  10338. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  10339. #define __JUCE_IIRFILTER_JUCEHEADER__
  10340. class JUCE_API IIRFilter
  10341. {
  10342. public:
  10343. IIRFilter() throw();
  10344. IIRFilter (const IIRFilter& other) throw();
  10345. ~IIRFilter() throw();
  10346. void reset() throw();
  10347. void processSamples (float* const samples,
  10348. const int numSamples) throw();
  10349. float processSingleSampleRaw (const float sample) throw();
  10350. void makeLowPass (const double sampleRate,
  10351. const double frequency) throw();
  10352. void makeHighPass (const double sampleRate,
  10353. const double frequency) throw();
  10354. void makeLowShelf (const double sampleRate,
  10355. const double cutOffFrequency,
  10356. const double Q,
  10357. const float gainFactor) throw();
  10358. void makeHighShelf (const double sampleRate,
  10359. const double cutOffFrequency,
  10360. const double Q,
  10361. const float gainFactor) throw();
  10362. void makeBandPass (const double sampleRate,
  10363. const double centreFrequency,
  10364. const double Q,
  10365. const float gainFactor) throw();
  10366. void makeInactive() throw();
  10367. void copyCoefficientsFrom (const IIRFilter& other) throw();
  10368. juce_UseDebuggingNewOperator
  10369. protected:
  10370. CriticalSection processLock;
  10371. void setCoefficients (double c1, double c2, double c3,
  10372. double c4, double c5, double c6) throw();
  10373. bool active;
  10374. float coefficients[6];
  10375. float x1, x2, y1, y2;
  10376. // (use the copyCoefficientsFrom() method instead of this operator)
  10377. const IIRFilter& operator= (const IIRFilter&);
  10378. };
  10379. #endif // __JUCE_IIRFILTER_JUCEHEADER__
  10380. /*** End of inlined file: juce_IIRFilter.h ***/
  10381. class JUCE_API IIRFilterAudioSource : public AudioSource
  10382. {
  10383. public:
  10384. IIRFilterAudioSource (AudioSource* const inputSource,
  10385. const bool deleteInputWhenDeleted);
  10386. ~IIRFilterAudioSource();
  10387. void setFilterParameters (const IIRFilter& newSettings);
  10388. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10389. void releaseResources();
  10390. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10391. juce_UseDebuggingNewOperator
  10392. private:
  10393. AudioSource* const input;
  10394. const bool deleteInputWhenDeleted;
  10395. OwnedArray <IIRFilter> iirFilters;
  10396. IIRFilterAudioSource (const IIRFilterAudioSource&);
  10397. const IIRFilterAudioSource& operator= (const IIRFilterAudioSource&);
  10398. };
  10399. #endif // __JUCE_IIRFILTERAUDIOSOURCE_JUCEHEADER__
  10400. /*** End of inlined file: juce_IIRFilterAudioSource.h ***/
  10401. #endif
  10402. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10403. /*** Start of inlined file: juce_MixerAudioSource.h ***/
  10404. #ifndef __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10405. #define __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10406. class JUCE_API MixerAudioSource : public AudioSource
  10407. {
  10408. public:
  10409. MixerAudioSource();
  10410. ~MixerAudioSource();
  10411. void addInputSource (AudioSource* newInput,
  10412. const bool deleteWhenRemoved);
  10413. void removeInputSource (AudioSource* input,
  10414. const bool deleteSource);
  10415. void removeAllInputs();
  10416. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10417. void releaseResources();
  10418. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10419. juce_UseDebuggingNewOperator
  10420. private:
  10421. VoidArray inputs;
  10422. BitArray inputsToDelete;
  10423. CriticalSection lock;
  10424. AudioSampleBuffer tempBuffer;
  10425. double currentSampleRate;
  10426. int bufferSizeExpected;
  10427. MixerAudioSource (const MixerAudioSource&);
  10428. const MixerAudioSource& operator= (const MixerAudioSource&);
  10429. };
  10430. #endif // __JUCE_MIXERAUDIOSOURCE_JUCEHEADER__
  10431. /*** End of inlined file: juce_MixerAudioSource.h ***/
  10432. #endif
  10433. #ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
  10434. #endif
  10435. #ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
  10436. #endif
  10437. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10438. /*** Start of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10439. #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10440. #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10441. class JUCE_API ToneGeneratorAudioSource : public AudioSource
  10442. {
  10443. public:
  10444. ToneGeneratorAudioSource();
  10445. ~ToneGeneratorAudioSource();
  10446. void setAmplitude (const float newAmplitude);
  10447. void setFrequency (const double newFrequencyHz);
  10448. void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
  10449. void releaseResources();
  10450. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
  10451. juce_UseDebuggingNewOperator
  10452. private:
  10453. double frequency, sampleRate;
  10454. double currentPhase, phasePerSample;
  10455. float amplitude;
  10456. ToneGeneratorAudioSource (const ToneGeneratorAudioSource&);
  10457. const ToneGeneratorAudioSource& operator= (const ToneGeneratorAudioSource&);
  10458. };
  10459. #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
  10460. /*** End of inlined file: juce_ToneGeneratorAudioSource.h ***/
  10461. #endif
  10462. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10463. /*** Start of inlined file: juce_AudioDeviceManager.h ***/
  10464. #ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10465. #define __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  10466. /*** Start of inlined file: juce_AudioIODeviceType.h ***/
  10467. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10468. #define __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10469. class AudioDeviceManager;
  10470. class Component;
  10471. class JUCE_API AudioIODeviceType
  10472. {
  10473. public:
  10474. const String& getTypeName() const throw() { return typeName; }
  10475. virtual void scanForDevices() = 0;
  10476. virtual const StringArray getDeviceNames (const bool wantInputNames = false) const = 0;
  10477. virtual int getDefaultDeviceIndex (const bool forInput) const = 0;
  10478. virtual int getIndexOfDevice (AudioIODevice* device, const bool asInput) const = 0;
  10479. virtual bool hasSeparateInputsAndOutputs() const = 0;
  10480. virtual AudioIODevice* createDevice (const String& outputDeviceName,
  10481. const String& inputDeviceName) = 0;
  10482. struct DeviceSetupDetails
  10483. {
  10484. AudioDeviceManager* manager;
  10485. int minNumInputChannels, maxNumInputChannels;
  10486. int minNumOutputChannels, maxNumOutputChannels;
  10487. bool useStereoPairs;
  10488. };
  10489. virtual ~AudioIODeviceType();
  10490. protected:
  10491. AudioIODeviceType (const tchar* const typeName);
  10492. private:
  10493. String typeName;
  10494. AudioIODeviceType (const AudioIODeviceType&);
  10495. const AudioIODeviceType& operator= (const AudioIODeviceType&);
  10496. };
  10497. #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  10498. /*** End of inlined file: juce_AudioIODeviceType.h ***/
  10499. /*** Start of inlined file: juce_MidiInput.h ***/
  10500. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  10501. #define __JUCE_MIDIINPUT_JUCEHEADER__
  10502. /*** Start of inlined file: juce_MidiMessage.h ***/
  10503. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  10504. #define __JUCE_MIDIMESSAGE_JUCEHEADER__
  10505. class JUCE_API MidiMessage
  10506. {
  10507. public:
  10508. MidiMessage (const int byte1,
  10509. const int byte2,
  10510. const int byte3,
  10511. const double timeStamp = 0) throw();
  10512. MidiMessage (const int byte1,
  10513. const int byte2,
  10514. const double timeStamp = 0) throw();
  10515. MidiMessage (const int byte1,
  10516. const double timeStamp = 0) throw();
  10517. MidiMessage (const uint8* const data,
  10518. const int dataSize,
  10519. const double timeStamp = 0) throw();
  10520. MidiMessage (const uint8* data,
  10521. int size,
  10522. int& numBytesUsed,
  10523. uint8 lastStatusByte,
  10524. double timeStamp = 0) throw();
  10525. MidiMessage (const MidiMessage& other) throw();
  10526. MidiMessage (const MidiMessage& other,
  10527. const double newTimeStamp) throw();
  10528. ~MidiMessage() throw();
  10529. const MidiMessage& operator= (const MidiMessage& other) throw();
  10530. uint8* getRawData() const throw() { return data; }
  10531. int getRawDataSize() const throw() { return size; }
  10532. double getTimeStamp() const throw() { return timeStamp; }
  10533. void setTimeStamp (const double newTimestamp) throw() { timeStamp = newTimestamp; }
  10534. void addToTimeStamp (const double delta) throw() { timeStamp += delta; }
  10535. int getChannel() const throw();
  10536. bool isForChannel (const int channelNumber) const throw();
  10537. void setChannel (const int newChannelNumber) throw();
  10538. bool isSysEx() const throw();
  10539. const uint8* getSysExData() const throw();
  10540. int getSysExDataSize() const throw();
  10541. bool isNoteOn (const bool returnTrueForVelocity0 = false) const throw();
  10542. static const MidiMessage noteOn (const int channel,
  10543. const int noteNumber,
  10544. const float velocity) throw();
  10545. static const MidiMessage noteOn (const int channel,
  10546. const int noteNumber,
  10547. const uint8 velocity) throw();
  10548. bool isNoteOff (const bool returnTrueForNoteOnVelocity0 = true) const throw();
  10549. static const MidiMessage noteOff (const int channel,
  10550. const int noteNumber) throw();
  10551. bool isNoteOnOrOff() const throw();
  10552. int getNoteNumber() const throw();
  10553. void setNoteNumber (const int newNoteNumber) throw();
  10554. uint8 getVelocity() const throw();
  10555. float getFloatVelocity() const throw();
  10556. void setVelocity (const float newVelocity) throw();
  10557. void multiplyVelocity (const float scaleFactor) throw();
  10558. bool isProgramChange() const throw();
  10559. int getProgramChangeNumber() const throw();
  10560. static const MidiMessage programChange (const int channel,
  10561. const int programNumber) throw();
  10562. bool isPitchWheel() const throw();
  10563. int getPitchWheelValue() const throw();
  10564. static const MidiMessage pitchWheel (const int channel,
  10565. const int position) throw();
  10566. bool isAftertouch() const throw();
  10567. int getAfterTouchValue() const throw();
  10568. static const MidiMessage aftertouchChange (const int channel,
  10569. const int noteNumber,
  10570. const int aftertouchAmount) throw();
  10571. bool isChannelPressure() const throw();
  10572. int getChannelPressureValue() const throw();
  10573. static const MidiMessage channelPressureChange (const int channel,
  10574. const int pressure) throw();
  10575. bool isController() const throw();
  10576. int getControllerNumber() const throw();
  10577. int getControllerValue() const throw();
  10578. static const MidiMessage controllerEvent (const int channel,
  10579. const int controllerType,
  10580. const int value) throw();
  10581. bool isAllNotesOff() const throw();
  10582. bool isAllSoundOff() const throw();
  10583. static const MidiMessage allNotesOff (const int channel) throw();
  10584. static const MidiMessage allSoundOff (const int channel) throw();
  10585. static const MidiMessage allControllersOff (const int channel) throw();
  10586. bool isMetaEvent() const throw();
  10587. int getMetaEventType() const throw();
  10588. const uint8* getMetaEventData() const throw();
  10589. int getMetaEventLength() const throw();
  10590. bool isTrackMetaEvent() const throw();
  10591. bool isEndOfTrackMetaEvent() const throw();
  10592. static const MidiMessage endOfTrack() throw();
  10593. bool isTrackNameEvent() const throw();
  10594. bool isTextMetaEvent() const throw();
  10595. const String getTextFromTextMetaEvent() const throw();
  10596. bool isTempoMetaEvent() const throw();
  10597. double getTempoMetaEventTickLength (const short timeFormat) const throw();
  10598. double getTempoSecondsPerQuarterNote() const throw();
  10599. static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw();
  10600. bool isTimeSignatureMetaEvent() const throw();
  10601. void getTimeSignatureInfo (int& numerator,
  10602. int& denominator) const throw();
  10603. static const MidiMessage timeSignatureMetaEvent (const int numerator,
  10604. const int denominator) throw();
  10605. bool isKeySignatureMetaEvent() const throw();
  10606. int getKeySignatureNumberOfSharpsOrFlats() const throw();
  10607. bool isMidiChannelMetaEvent() const throw();
  10608. int getMidiChannelMetaEventChannel() const throw();
  10609. static const MidiMessage midiChannelMetaEvent (const int channel) throw();
  10610. bool isActiveSense() const throw();
  10611. bool isMidiStart() const throw();
  10612. static const MidiMessage midiStart() throw();
  10613. bool isMidiContinue() const throw();
  10614. static const MidiMessage midiContinue() throw();
  10615. bool isMidiStop() const throw();
  10616. static const MidiMessage midiStop() throw();
  10617. bool isMidiClock() const throw();
  10618. static const MidiMessage midiClock() throw();
  10619. bool isSongPositionPointer() const throw();
  10620. int getSongPositionPointerMidiBeat() const throw();
  10621. static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw();
  10622. bool isQuarterFrame() const throw();
  10623. int getQuarterFrameSequenceNumber() const throw();
  10624. int getQuarterFrameValue() const throw();
  10625. static const MidiMessage quarterFrame (const int sequenceNumber,
  10626. const int value) throw();
  10627. enum SmpteTimecodeType
  10628. {
  10629. fps24 = 0,
  10630. fps25 = 1,
  10631. fps30drop = 2,
  10632. fps30 = 3
  10633. };
  10634. bool isFullFrame() const throw();
  10635. void getFullFrameParameters (int& hours,
  10636. int& minutes,
  10637. int& seconds,
  10638. int& frames,
  10639. SmpteTimecodeType& timecodeType) const throw();
  10640. static const MidiMessage fullFrame (const int hours,
  10641. const int minutes,
  10642. const int seconds,
  10643. const int frames,
  10644. SmpteTimecodeType timecodeType);
  10645. enum MidiMachineControlCommand
  10646. {
  10647. mmc_stop = 1,
  10648. mmc_play = 2,
  10649. mmc_deferredplay = 3,
  10650. mmc_fastforward = 4,
  10651. mmc_rewind = 5,
  10652. mmc_recordStart = 6,
  10653. mmc_recordStop = 7,
  10654. mmc_pause = 9
  10655. };
  10656. bool isMidiMachineControlMessage() const throw();
  10657. MidiMachineControlCommand getMidiMachineControlCommand() const throw();
  10658. static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
  10659. bool isMidiMachineControlGoto (int& hours,
  10660. int& minutes,
  10661. int& seconds,
  10662. int& frames) const throw();
  10663. static const MidiMessage midiMachineControlGoto (int hours,
  10664. int minutes,
  10665. int seconds,
  10666. int frames);
  10667. static const MidiMessage masterVolume (const float volume) throw();
  10668. static const MidiMessage createSysExMessage (const uint8* sysexData,
  10669. const int dataSize) throw();
  10670. static int readVariableLengthVal (const uint8* data,
  10671. int& numBytesUsed) throw();
  10672. static int getMessageLengthFromFirstByte (const uint8 firstByte) throw();
  10673. static const String getMidiNoteName (int noteNumber,
  10674. bool useSharps,
  10675. bool includeOctaveNumber,
  10676. int octaveNumForMiddleC) throw();
  10677. static const double getMidiNoteInHertz (int noteNumber) throw();
  10678. static const String getGMInstrumentName (int midiInstrumentNumber) throw();
  10679. static const String getGMInstrumentBankName (int midiBankNumber) throw();
  10680. static const String getRhythmInstrumentName (int midiNoteNumber) throw();
  10681. static const String getControllerName (int controllerNumber) throw();
  10682. juce_UseDebuggingNewOperator
  10683. private:
  10684. double timeStamp;
  10685. uint8* data;
  10686. int message, size;
  10687. };
  10688. #endif // __JUCE_MIDIMESSAGE_JUCEHEADER__
  10689. /*** End of inlined file: juce_MidiMessage.h ***/
  10690. class MidiInput;
  10691. class JUCE_API MidiInputCallback
  10692. {
  10693. public:
  10694. virtual ~MidiInputCallback() {}
  10695. virtual void handleIncomingMidiMessage (MidiInput* source,
  10696. const MidiMessage& message) = 0;
  10697. virtual void handlePartialSysexMessage (MidiInput* source,
  10698. const uint8* messageData,
  10699. const int numBytesSoFar,
  10700. const double timestamp)
  10701. {
  10702. // (this bit is just to avoid compiler warnings about unused variables)
  10703. (void) source; (void) messageData; (void) numBytesSoFar; (void) timestamp;
  10704. }
  10705. };
  10706. class JUCE_API MidiInput
  10707. {
  10708. public:
  10709. static const StringArray getDevices();
  10710. static int getDefaultDeviceIndex();
  10711. static MidiInput* openDevice (int deviceIndex,
  10712. MidiInputCallback* callback);
  10713. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10714. static MidiInput* createNewDevice (const String& deviceName,
  10715. MidiInputCallback* callback);
  10716. #endif
  10717. virtual ~MidiInput();
  10718. virtual const String getName() const throw() { return name; }
  10719. virtual void setName (const String& newName) throw() { name = newName; }
  10720. virtual void start();
  10721. virtual void stop();
  10722. juce_UseDebuggingNewOperator
  10723. protected:
  10724. String name;
  10725. void* internal;
  10726. MidiInput (const String& name);
  10727. MidiInput (const MidiInput&);
  10728. };
  10729. #endif // __JUCE_MIDIINPUT_JUCEHEADER__
  10730. /*** End of inlined file: juce_MidiInput.h ***/
  10731. /*** Start of inlined file: juce_MidiOutput.h ***/
  10732. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  10733. #define __JUCE_MIDIOUTPUT_JUCEHEADER__
  10734. /*** Start of inlined file: juce_MidiBuffer.h ***/
  10735. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  10736. #define __JUCE_MIDIBUFFER_JUCEHEADER__
  10737. class JUCE_API MidiBuffer
  10738. {
  10739. public:
  10740. MidiBuffer() throw();
  10741. MidiBuffer (const MidiMessage& message) throw();
  10742. MidiBuffer (const MidiBuffer& other) throw();
  10743. const MidiBuffer& operator= (const MidiBuffer& other) throw();
  10744. ~MidiBuffer() throw();
  10745. void clear() throw();
  10746. void clear (const int start,
  10747. const int numSamples) throw();
  10748. bool isEmpty() const throw();
  10749. int getNumEvents() const throw();
  10750. void addEvent (const MidiMessage& midiMessage,
  10751. const int sampleNumber) throw();
  10752. void addEvent (const uint8* const rawMidiData,
  10753. const int maxBytesOfMidiData,
  10754. const int sampleNumber) throw();
  10755. void addEvents (const MidiBuffer& otherBuffer,
  10756. const int startSample,
  10757. const int numSamples,
  10758. const int sampleDeltaToAdd) throw();
  10759. int getFirstEventTime() const throw();
  10760. int getLastEventTime() const throw();
  10761. void swap (MidiBuffer& other);
  10762. class Iterator
  10763. {
  10764. public:
  10765. Iterator (const MidiBuffer& buffer) throw();
  10766. ~Iterator() throw();
  10767. void setNextSamplePosition (const int samplePosition) throw();
  10768. bool getNextEvent (MidiMessage& result,
  10769. int& samplePosition) throw();
  10770. bool getNextEvent (const uint8* &midiData,
  10771. int& numBytesOfMidiData,
  10772. int& samplePosition) throw();
  10773. juce_UseDebuggingNewOperator
  10774. private:
  10775. const MidiBuffer& buffer;
  10776. const uint8* data;
  10777. Iterator (const Iterator&);
  10778. const Iterator& operator= (const Iterator&);
  10779. };
  10780. juce_UseDebuggingNewOperator
  10781. private:
  10782. friend class MidiBuffer::Iterator;
  10783. MemoryBlock data;
  10784. int bytesUsed;
  10785. uint8* findEventAfter (uint8* d, const int samplePosition) const throw();
  10786. };
  10787. #endif // __JUCE_MIDIBUFFER_JUCEHEADER__
  10788. /*** End of inlined file: juce_MidiBuffer.h ***/
  10789. class JUCE_API MidiOutput : private Thread
  10790. {
  10791. public:
  10792. static const StringArray getDevices();
  10793. static int getDefaultDeviceIndex();
  10794. static MidiOutput* openDevice (int deviceIndex);
  10795. #if JUCE_LINUX || JUCE_MAC || DOXYGEN
  10796. static MidiOutput* createNewDevice (const String& deviceName);
  10797. #endif
  10798. virtual ~MidiOutput();
  10799. virtual void sendMessageNow (const MidiMessage& message);
  10800. virtual void reset();
  10801. virtual bool getVolume (float& leftVol,
  10802. float& rightVol);
  10803. virtual void setVolume (float leftVol,
  10804. float rightVol);
  10805. virtual void sendBlockOfMessages (const MidiBuffer& buffer,
  10806. const double millisecondCounterToStartAt,
  10807. double samplesPerSecondForBuffer) throw();
  10808. virtual void clearAllPendingMessages() throw();
  10809. virtual void startBackgroundThread() throw();
  10810. virtual void stopBackgroundThread() throw();
  10811. juce_UseDebuggingNewOperator
  10812. protected:
  10813. void* internal;
  10814. struct PendingMessage
  10815. {
  10816. PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
  10817. MidiMessage message;
  10818. PendingMessage* next;
  10819. juce_UseDebuggingNewOperator
  10820. };
  10821. CriticalSection lock;
  10822. PendingMessage* firstMessage;
  10823. MidiOutput() throw();
  10824. MidiOutput (const MidiOutput&);
  10825. void run();
  10826. };
  10827. #endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
  10828. /*** End of inlined file: juce_MidiOutput.h ***/
  10829. /*** Start of inlined file: juce_ComboBox.h ***/
  10830. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  10831. #define __JUCE_COMBOBOX_JUCEHEADER__
  10832. /*** Start of inlined file: juce_Label.h ***/
  10833. #ifndef __JUCE_LABEL_JUCEHEADER__
  10834. #define __JUCE_LABEL_JUCEHEADER__
  10835. /*** Start of inlined file: juce_ComponentDeletionWatcher.h ***/
  10836. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10837. #define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10838. class JUCE_API ComponentDeletionWatcher
  10839. {
  10840. public:
  10841. ComponentDeletionWatcher (const Component* const componentToWatch) throw();
  10842. ~ComponentDeletionWatcher() throw();
  10843. bool hasBeenDeleted() const throw();
  10844. const Component* getComponent() const throw();
  10845. juce_UseDebuggingNewOperator
  10846. private:
  10847. const Component* const componentToWatch;
  10848. const uint32 componentUID;
  10849. ComponentDeletionWatcher (const ComponentDeletionWatcher&);
  10850. const ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
  10851. };
  10852. #endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  10853. /*** End of inlined file: juce_ComponentDeletionWatcher.h ***/
  10854. /*** Start of inlined file: juce_TextEditor.h ***/
  10855. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  10856. #define __JUCE_TEXTEDITOR_JUCEHEADER__
  10857. /*** Start of inlined file: juce_Viewport.h ***/
  10858. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  10859. #define __JUCE_VIEWPORT_JUCEHEADER__
  10860. /*** Start of inlined file: juce_ScrollBar.h ***/
  10861. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  10862. #define __JUCE_SCROLLBAR_JUCEHEADER__
  10863. /*** Start of inlined file: juce_Button.h ***/
  10864. #ifndef __JUCE_BUTTON_JUCEHEADER__
  10865. #define __JUCE_BUTTON_JUCEHEADER__
  10866. /*** Start of inlined file: juce_TooltipWindow.h ***/
  10867. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10868. #define __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10869. /*** Start of inlined file: juce_TooltipClient.h ***/
  10870. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10871. #define __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10872. class JUCE_API TooltipClient
  10873. {
  10874. public:
  10875. virtual ~TooltipClient() {}
  10876. virtual const String getTooltip() = 0;
  10877. };
  10878. class JUCE_API SettableTooltipClient : public TooltipClient
  10879. {
  10880. public:
  10881. virtual ~SettableTooltipClient() {}
  10882. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  10883. virtual const String getTooltip() { return tooltipString; }
  10884. juce_UseDebuggingNewOperator
  10885. protected:
  10886. String tooltipString;
  10887. };
  10888. #endif // __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  10889. /*** End of inlined file: juce_TooltipClient.h ***/
  10890. class JUCE_API TooltipWindow : public Component,
  10891. private Timer
  10892. {
  10893. public:
  10894. TooltipWindow (Component* parentComponent = 0,
  10895. const int millisecondsBeforeTipAppears = 700);
  10896. ~TooltipWindow();
  10897. void setMillisecondsBeforeTipAppears (const int newTimeMs = 700) throw();
  10898. enum ColourIds
  10899. {
  10900. backgroundColourId = 0x1001b00, /**< The colour to fill the background with. */
  10901. textColourId = 0x1001c00, /**< The colour to use for the text. */
  10902. outlineColourId = 0x1001c10 /**< The colour to use to draw an outline around the tooltip. */
  10903. };
  10904. juce_UseDebuggingNewOperator
  10905. private:
  10906. int millisecondsBeforeTipAppears;
  10907. int mouseX, mouseY, mouseClicks;
  10908. unsigned int lastCompChangeTime, lastHideTime;
  10909. Component* lastComponentUnderMouse;
  10910. bool changedCompsSinceShown;
  10911. String tipShowing, lastTipUnderMouse;
  10912. void paint (Graphics& g);
  10913. void mouseEnter (const MouseEvent& e);
  10914. void timerCallback();
  10915. static const String getTipFor (Component* const c);
  10916. void showFor (const String& tip);
  10917. void hide();
  10918. TooltipWindow (const TooltipWindow&);
  10919. const TooltipWindow& operator= (const TooltipWindow&);
  10920. };
  10921. #endif // __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  10922. /*** End of inlined file: juce_TooltipWindow.h ***/
  10923. class Button;
  10924. class JUCE_API ButtonListener
  10925. {
  10926. public:
  10927. virtual ~ButtonListener() {}
  10928. virtual void buttonClicked (Button* button) = 0;
  10929. virtual void buttonStateChanged (Button*) {}
  10930. };
  10931. class JUCE_API Button : public Component,
  10932. public SettableTooltipClient,
  10933. public ApplicationCommandManagerListener,
  10934. public Value::Listener,
  10935. private KeyListener
  10936. {
  10937. protected:
  10938. Button (const String& buttonName);
  10939. public:
  10940. virtual ~Button();
  10941. void setButtonText (const String& newText);
  10942. const String getButtonText() const { return text; }
  10943. bool isDown() const throw();
  10944. bool isOver() const throw();
  10945. void setToggleState (const bool shouldBeOn,
  10946. const bool sendChangeNotification);
  10947. bool getToggleState() const throw() { return isOn.getValue(); }
  10948. Value& getToggleStateValue() { return isOn; }
  10949. void setClickingTogglesState (const bool shouldToggle) throw();
  10950. bool getClickingTogglesState() const throw();
  10951. void setRadioGroupId (const int newGroupId);
  10952. int getRadioGroupId() const throw() { return radioGroupId; }
  10953. void addButtonListener (ButtonListener* const newListener);
  10954. void removeButtonListener (ButtonListener* const listener);
  10955. virtual void triggerClick();
  10956. void setCommandToTrigger (ApplicationCommandManager* commandManagerToUse,
  10957. const int commandID,
  10958. const bool generateTooltip);
  10959. int getCommandID() const throw() { return commandID; }
  10960. void addShortcut (const KeyPress& key);
  10961. void clearShortcuts();
  10962. bool isRegisteredForShortcut (const KeyPress& key) const;
  10963. void setRepeatSpeed (const int initialDelayInMillisecs,
  10964. const int repeatDelayInMillisecs,
  10965. const int minimumDelayInMillisecs = -1) throw();
  10966. void setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw();
  10967. uint32 getMillisecondsSinceButtonDown() const throw();
  10968. void setVisible (bool shouldBeVisible);
  10969. void setTooltip (const String& newTooltip);
  10970. // (implementation of the TooltipClient method)
  10971. const String getTooltip();
  10972. enum ConnectedEdgeFlags
  10973. {
  10974. ConnectedOnLeft = 1,
  10975. ConnectedOnRight = 2,
  10976. ConnectedOnTop = 4,
  10977. ConnectedOnBottom = 8
  10978. };
  10979. void setConnectedEdges (const int connectedEdgeFlags);
  10980. int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; }
  10981. bool isConnectedOnLeft() const throw() { return (connectedEdgeFlags & ConnectedOnLeft) != 0; }
  10982. bool isConnectedOnRight() const throw() { return (connectedEdgeFlags & ConnectedOnRight) != 0; }
  10983. bool isConnectedOnTop() const throw() { return (connectedEdgeFlags & ConnectedOnTop) != 0; }
  10984. bool isConnectedOnBottom() const throw() { return (connectedEdgeFlags & ConnectedOnBottom) != 0; }
  10985. enum ButtonState
  10986. {
  10987. buttonNormal,
  10988. buttonOver,
  10989. buttonDown
  10990. };
  10991. void setState (const ButtonState newState);
  10992. juce_UseDebuggingNewOperator
  10993. protected:
  10994. virtual void clicked();
  10995. virtual void clicked (const ModifierKeys& modifiers);
  10996. virtual void paintButton (Graphics& g,
  10997. bool isMouseOverButton,
  10998. bool isButtonDown) = 0;
  10999. virtual void buttonStateChanged();
  11000. virtual void internalClickCallback (const ModifierKeys& modifiers);
  11001. void handleCommandMessage (int commandId);
  11002. void mouseEnter (const MouseEvent& e);
  11003. void mouseExit (const MouseEvent& e);
  11004. void mouseDown (const MouseEvent& e);
  11005. void mouseDrag (const MouseEvent& e);
  11006. void mouseUp (const MouseEvent& e);
  11007. bool keyPressed (const KeyPress& key);
  11008. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  11009. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  11010. void paint (Graphics& g);
  11011. void parentHierarchyChanged();
  11012. void focusGained (FocusChangeType cause);
  11013. void focusLost (FocusChangeType cause);
  11014. void enablementChanged();
  11015. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&);
  11016. void applicationCommandListChanged();
  11017. void valueChanged (Value& value);
  11018. private:
  11019. Array <KeyPress> shortcuts;
  11020. Component* keySource;
  11021. String text;
  11022. SortedSet <void*> buttonListeners;
  11023. class RepeatTimer;
  11024. friend class ScopedPointer <RepeatTimer>;
  11025. ScopedPointer <RepeatTimer> repeatTimer;
  11026. uint32 buttonPressTime, lastTimeCallbackTime;
  11027. ApplicationCommandManager* commandManagerToUse;
  11028. int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
  11029. int radioGroupId, commandID, connectedEdgeFlags;
  11030. ButtonState buttonState;
  11031. Value isOn;
  11032. bool lastToggleState : 1;
  11033. bool clickTogglesState : 1;
  11034. bool needsToRelease : 1;
  11035. bool needsRepainting : 1;
  11036. bool isKeyDown : 1;
  11037. bool triggerOnMouseDown : 1;
  11038. bool generateTooltip : 1;
  11039. void repeatTimerCallback();
  11040. RepeatTimer& getRepeatTimer();
  11041. ButtonState updateState (const MouseEvent* const e);
  11042. bool isShortcutPressed() const;
  11043. void turnOffOtherButtonsInGroup (const bool sendChangeNotification);
  11044. void flashButtonState();
  11045. void sendClickMessage (const ModifierKeys& modifiers);
  11046. void sendStateMessage();
  11047. Button (const Button&);
  11048. const Button& operator= (const Button&);
  11049. };
  11050. #endif // __JUCE_BUTTON_JUCEHEADER__
  11051. /*** End of inlined file: juce_Button.h ***/
  11052. class ScrollBar;
  11053. class JUCE_API ScrollBarListener
  11054. {
  11055. public:
  11056. virtual ~ScrollBarListener() {}
  11057. virtual void scrollBarMoved (ScrollBar* scrollBarThatHasMoved,
  11058. const double newRangeStart) = 0;
  11059. };
  11060. class JUCE_API ScrollBar : public Component,
  11061. public AsyncUpdater,
  11062. private Timer
  11063. {
  11064. public:
  11065. ScrollBar (const bool isVertical,
  11066. const bool buttonsAreVisible = true);
  11067. ~ScrollBar();
  11068. bool isVertical() const throw() { return vertical; }
  11069. void setOrientation (const bool shouldBeVertical) throw();
  11070. void setButtonVisibility (const bool buttonsAreVisible);
  11071. void setAutoHide (const bool shouldHideWhenFullRange);
  11072. void setRangeLimits (const double minimum,
  11073. const double maximum) throw();
  11074. double getMinimumRangeLimit() const throw() { return minimum; }
  11075. double getMaximumRangeLimit() const throw() { return maximum; }
  11076. void setCurrentRange (double newStart,
  11077. double newSize) throw();
  11078. void setCurrentRangeStart (double newStart) throw();
  11079. double getCurrentRangeStart() const throw() { return rangeStart; }
  11080. double getCurrentRangeSize() const throw() { return rangeSize; }
  11081. void setSingleStepSize (const double newSingleStepSize) throw();
  11082. void moveScrollbarInSteps (const int howManySteps) throw();
  11083. void moveScrollbarInPages (const int howManyPages) throw();
  11084. void scrollToTop() throw();
  11085. void scrollToBottom() throw();
  11086. void setButtonRepeatSpeed (const int initialDelayInMillisecs,
  11087. const int repeatDelayInMillisecs,
  11088. const int minimumDelayInMillisecs = -1) throw();
  11089. enum ColourIds
  11090. {
  11091. backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
  11092. thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
  11093. 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. */
  11094. };
  11095. void addListener (ScrollBarListener* const listener) throw();
  11096. void removeListener (ScrollBarListener* const listener) throw();
  11097. bool keyPressed (const KeyPress& key);
  11098. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11099. void lookAndFeelChanged();
  11100. void handleAsyncUpdate();
  11101. void mouseDown (const MouseEvent& e);
  11102. void mouseDrag (const MouseEvent& e);
  11103. void mouseUp (const MouseEvent& e);
  11104. void paint (Graphics& g);
  11105. void resized();
  11106. juce_UseDebuggingNewOperator
  11107. private:
  11108. double minimum, maximum;
  11109. double rangeStart, rangeSize;
  11110. double singleStepSize, dragStartRange;
  11111. int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
  11112. int dragStartMousePos, lastMousePos;
  11113. int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
  11114. bool vertical, isDraggingThumb, alwaysVisible;
  11115. Button* upButton;
  11116. Button* downButton;
  11117. SortedSet <void*> listeners;
  11118. void updateThumbPosition() throw();
  11119. void timerCallback();
  11120. ScrollBar (const ScrollBar&);
  11121. const ScrollBar& operator= (const ScrollBar&);
  11122. };
  11123. #endif // __JUCE_SCROLLBAR_JUCEHEADER__
  11124. /*** End of inlined file: juce_ScrollBar.h ***/
  11125. class JUCE_API Viewport : public Component,
  11126. private ComponentListener,
  11127. private ScrollBarListener
  11128. {
  11129. public:
  11130. Viewport (const String& componentName = String::empty);
  11131. ~Viewport();
  11132. void setViewedComponent (Component* const newViewedComponent);
  11133. Component* getViewedComponent() const throw() { return contentComp; }
  11134. void setViewPosition (const int xPixelsOffset,
  11135. const int yPixelsOffset);
  11136. void setViewPositionProportionately (const double proportionX,
  11137. const double proportionY);
  11138. bool autoScroll (int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed);
  11139. int getViewPositionX() const throw() { return lastVX; }
  11140. int getViewPositionY() const throw() { return lastVY; }
  11141. int getViewWidth() const throw() { return lastVW; }
  11142. int getViewHeight() const throw() { return lastVH; }
  11143. int getMaximumVisibleWidth() const throw();
  11144. int getMaximumVisibleHeight() const throw();
  11145. virtual void visibleAreaChanged (int visibleX, int visibleY,
  11146. int visibleW, int visibleH);
  11147. void setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
  11148. const bool showHorizontalScrollbarIfNeeded);
  11149. bool isVerticalScrollBarShown() const throw() { return showVScrollbar; }
  11150. bool isHorizontalScrollBarShown() const throw() { return showHScrollbar; }
  11151. void setScrollBarThickness (const int thickness);
  11152. int getScrollBarThickness() const throw();
  11153. void setSingleStepSizes (const int stepX, const int stepY);
  11154. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11155. ScrollBar* getVerticalScrollBar() const throw() { return verticalScrollBar; }
  11156. ScrollBar* getHorizontalScrollBar() const throw() { return horizontalScrollBar; }
  11157. juce_UseDebuggingNewOperator
  11158. void resized();
  11159. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  11160. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11161. bool keyPressed (const KeyPress& key);
  11162. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11163. bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11164. private:
  11165. Component* contentComp;
  11166. int lastVX, lastVY, lastVW, lastVH;
  11167. int scrollBarThickness;
  11168. int singleStepX, singleStepY;
  11169. bool showHScrollbar, showVScrollbar;
  11170. Component* contentHolder;
  11171. ScrollBar* verticalScrollBar;
  11172. ScrollBar* horizontalScrollBar;
  11173. void updateVisibleRegion();
  11174. Viewport (const Viewport&);
  11175. const Viewport& operator= (const Viewport&);
  11176. };
  11177. #endif // __JUCE_VIEWPORT_JUCEHEADER__
  11178. /*** End of inlined file: juce_Viewport.h ***/
  11179. /*** Start of inlined file: juce_PopupMenu.h ***/
  11180. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  11181. #define __JUCE_POPUPMENU_JUCEHEADER__
  11182. class PopupMenuCustomComponent;
  11183. class JUCE_API PopupMenu
  11184. {
  11185. public:
  11186. PopupMenu();
  11187. PopupMenu (const PopupMenu& other);
  11188. ~PopupMenu();
  11189. const PopupMenu& operator= (const PopupMenu& other);
  11190. void clear();
  11191. void addItem (const int itemResultId,
  11192. const String& itemText,
  11193. const bool isActive = true,
  11194. const bool isTicked = false,
  11195. const Image* const iconToUse = 0);
  11196. void addCommandItem (ApplicationCommandManager* commandManager,
  11197. const int commandID,
  11198. const String& displayName = String::empty);
  11199. void addColouredItem (const int itemResultId,
  11200. const String& itemText,
  11201. const Colour& itemTextColour,
  11202. const bool isActive = true,
  11203. const bool isTicked = false,
  11204. const Image* const iconToUse = 0);
  11205. void addCustomItem (const int itemResultId,
  11206. PopupMenuCustomComponent* const customComponent);
  11207. void addCustomItem (const int itemResultId,
  11208. Component* customComponent,
  11209. int idealWidth, int idealHeight,
  11210. const bool triggerMenuItemAutomaticallyWhenClicked);
  11211. void addSubMenu (const String& subMenuName,
  11212. const PopupMenu& subMenu,
  11213. const bool isActive = true,
  11214. Image* const iconToUse = 0,
  11215. const bool isTicked = false);
  11216. void addSeparator();
  11217. void addSectionHeader (const String& title);
  11218. int getNumItems() const throw();
  11219. bool containsCommandItem (const int commandID) const;
  11220. bool containsAnyActiveItems() const throw();
  11221. int show (const int itemIdThatMustBeVisible = 0,
  11222. const int minimumWidth = 0,
  11223. const int maximumNumColumns = 0,
  11224. const int standardItemHeight = 0);
  11225. int showAt (const int screenX,
  11226. const int screenY,
  11227. const int itemIdThatMustBeVisible = 0,
  11228. const int minimumWidth = 0,
  11229. const int maximumNumColumns = 0,
  11230. const int standardItemHeight = 0);
  11231. int showAt (Component* componentToAttachTo,
  11232. const int itemIdThatMustBeVisible = 0,
  11233. const int minimumWidth = 0,
  11234. const int maximumNumColumns = 0,
  11235. const int standardItemHeight = 0);
  11236. static void JUCE_CALLTYPE dismissAllActiveMenus();
  11237. void setLookAndFeel (LookAndFeel* const newLookAndFeel);
  11238. enum ColourIds
  11239. {
  11240. backgroundColourId = 0x1000700, /**< The colour to fill the menu's background with. */
  11241. textColourId = 0x1000600, /**< The colour for normal menu item text, (unless the
  11242. colour is specified when the item is added). */
  11243. headerTextColourId = 0x1000601, /**< The colour for section header item text (see the
  11244. addSectionHeader() method). */
  11245. highlightedBackgroundColourId = 0x1000900, /**< The colour to fill the background of the currently
  11246. highlighted menu item. */
  11247. highlightedTextColourId = 0x1000800, /**< The colour to use for the text of the currently
  11248. highlighted item. */
  11249. };
  11250. class JUCE_API MenuItemIterator
  11251. {
  11252. public:
  11253. MenuItemIterator (const PopupMenu& menu);
  11254. ~MenuItemIterator();
  11255. bool next();
  11256. String itemName;
  11257. const PopupMenu* subMenu;
  11258. int itemId;
  11259. bool isSeparator;
  11260. bool isTicked;
  11261. bool isEnabled;
  11262. bool isCustomComponent;
  11263. bool isSectionHeader;
  11264. const Colour* customColour;
  11265. const Image* customImage;
  11266. ApplicationCommandManager* commandManager;
  11267. juce_UseDebuggingNewOperator
  11268. private:
  11269. const PopupMenu& menu;
  11270. int index;
  11271. MenuItemIterator (const MenuItemIterator&);
  11272. const MenuItemIterator& operator= (const MenuItemIterator&);
  11273. };
  11274. juce_UseDebuggingNewOperator
  11275. private:
  11276. class Item;
  11277. class ItemComponent;
  11278. class Window;
  11279. friend class MenuItemIterator;
  11280. friend class ItemComponent;
  11281. friend class Window;
  11282. friend class PopupMenuCustomComponent;
  11283. friend class OwnedArray <Item>;
  11284. friend class ScopedPointer <Window>;
  11285. OwnedArray <Item> items;
  11286. LookAndFeel* lookAndFeel;
  11287. bool separatorPending;
  11288. void addSeparatorIfPending();
  11289. int showMenu (const int x, const int y, const int w, const int h,
  11290. const int itemIdThatMustBeVisible,
  11291. const int minimumWidth,
  11292. const int maximumNumColumns,
  11293. const int standardItemHeight,
  11294. const bool alignToRectangle,
  11295. Component* const componentAttachedTo);
  11296. friend class MenuBarComponent;
  11297. Component* createMenuComponent (const int x, const int y, const int w, const int h,
  11298. const int itemIdThatMustBeVisible,
  11299. const int minimumWidth,
  11300. const int maximumNumColumns,
  11301. const int standardItemHeight,
  11302. const bool alignToRectangle,
  11303. Component* menuBarComponent,
  11304. ApplicationCommandManager** managerOfChosenCommand,
  11305. Component* const componentAttachedTo);
  11306. };
  11307. #endif // __JUCE_POPUPMENU_JUCEHEADER__
  11308. /*** End of inlined file: juce_PopupMenu.h ***/
  11309. class TextEditor;
  11310. class TextHolderComponent;
  11311. class JUCE_API TextEditorListener
  11312. {
  11313. public:
  11314. virtual ~TextEditorListener() {}
  11315. virtual void textEditorTextChanged (TextEditor& editor) = 0;
  11316. virtual void textEditorReturnKeyPressed (TextEditor& editor) = 0;
  11317. virtual void textEditorEscapeKeyPressed (TextEditor& editor) = 0;
  11318. virtual void textEditorFocusLost (TextEditor& editor) = 0;
  11319. };
  11320. class JUCE_API TextEditor : public Component,
  11321. public SettableTooltipClient
  11322. {
  11323. public:
  11324. TextEditor (const String& componentName = String::empty,
  11325. const tchar passwordCharacter = 0);
  11326. virtual ~TextEditor();
  11327. void setMultiLine (const bool shouldBeMultiLine,
  11328. const bool shouldWordWrap = true);
  11329. bool isMultiLine() const;
  11330. void setReturnKeyStartsNewLine (const bool shouldStartNewLine);
  11331. bool getReturnKeyStartsNewLine() const { return returnKeyStartsNewLine; }
  11332. void setTabKeyUsedAsCharacter (const bool shouldTabKeyBeUsed);
  11333. bool isTabKeyUsedAsCharacter() const { return tabKeyUsed; }
  11334. void setReadOnly (const bool shouldBeReadOnly);
  11335. bool isReadOnly() const;
  11336. void setCaretVisible (const bool shouldBeVisible);
  11337. bool isCaretVisible() const { return caretVisible; }
  11338. void setScrollbarsShown (bool shouldBeEnabled);
  11339. bool areScrollbarsShown() const { return scrollbarVisible; }
  11340. void setPasswordCharacter (const tchar passwordCharacter);
  11341. tchar getPasswordCharacter() const { return passwordCharacter; }
  11342. void setPopupMenuEnabled (const bool menuEnabled);
  11343. bool isPopupMenuEnabled() const { return popupMenuEnabled; }
  11344. bool isPopupMenuCurrentlyActive() const { return menuActive; }
  11345. enum ColourIds
  11346. {
  11347. backgroundColourId = 0x1000200, /**< The colour to use for the text component's background - this can be
  11348. transparent if necessary. */
  11349. textColourId = 0x1000201, /**< The colour that will be used when text is added to the editor. Note
  11350. that because the editor can contain multiple colours, calling this
  11351. method won't change the colour of existing text - to do that, call
  11352. applyFontToAllText() after calling this method.*/
  11353. highlightColourId = 0x1000202, /**< The colour with which to fill the background of highlighted sections of
  11354. the text - this can be transparent if you don't want to show any
  11355. highlighting.*/
  11356. highlightedTextColourId = 0x1000203, /**< The colour with which to draw the text in highlighted sections. */
  11357. caretColourId = 0x1000204, /**< The colour with which to draw the caret. */
  11358. outlineColourId = 0x1000205, /**< If this is non-transparent, it will be used to draw a box around
  11359. the edge of the component. */
  11360. focusedOutlineColourId = 0x1000206, /**< If this is non-transparent, it will be used to draw a box around
  11361. the edge of the component when it has focus. */
  11362. shadowColourId = 0x1000207, /**< If this is non-transparent, it'll be used to draw an inner shadow
  11363. around the edge of the editor. */
  11364. };
  11365. void setFont (const Font& newFont);
  11366. void applyFontToAllText (const Font& newFont);
  11367. const Font getFont() const;
  11368. void setSelectAllWhenFocused (const bool b);
  11369. void setInputRestrictions (const int maxTextLength,
  11370. const String& allowedCharacters = String::empty);
  11371. void setTextToShowWhenEmpty (const String& text, const Colour& colourToUse);
  11372. void setScrollBarThickness (const int newThicknessPixels);
  11373. void setScrollBarButtonVisibility (const bool buttonsVisible);
  11374. void addListener (TextEditorListener* const newListener);
  11375. void removeListener (TextEditorListener* const listenerToRemove);
  11376. const String getText() const;
  11377. const String getTextSubstring (const int startCharacter, const int endCharacter) const;
  11378. bool isEmpty() const;
  11379. void setText (const String& newText,
  11380. const bool sendTextChangeMessage = true);
  11381. Value& getTextValue();
  11382. void insertTextAtCursor (String textToInsert);
  11383. void clear();
  11384. void cut();
  11385. void copy();
  11386. void paste();
  11387. void setCaretPosition (const int newIndex);
  11388. int getCaretPosition() const;
  11389. void scrollEditorToPositionCaret (const int desiredCaretX,
  11390. const int desiredCaretY);
  11391. const Rectangle<int> getCaretRectangle();
  11392. void setHighlightedRegion (int startIndex,
  11393. int numberOfCharactersToHighlight);
  11394. int getHighlightedRegionStart() const { return selectionStart; }
  11395. int getHighlightedRegionLength() const { return jmax (0, selectionEnd - selectionStart); }
  11396. const String getHighlightedText() const;
  11397. int getTextIndexAt (const int x, const int y);
  11398. int getTotalNumChars() const;
  11399. int getTextWidth() const;
  11400. int getTextHeight() const;
  11401. void setIndents (const int newLeftIndent, const int newTopIndent);
  11402. void setBorder (const BorderSize& border);
  11403. const BorderSize getBorder() const;
  11404. void setScrollToShowCursor (const bool shouldScrollToShowCursor);
  11405. void paint (Graphics& g);
  11406. void paintOverChildren (Graphics& g);
  11407. void mouseDown (const MouseEvent& e);
  11408. void mouseUp (const MouseEvent& e);
  11409. void mouseDrag (const MouseEvent& e);
  11410. void mouseDoubleClick (const MouseEvent& e);
  11411. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  11412. bool keyPressed (const KeyPress& key);
  11413. bool keyStateChanged (const bool isKeyDown);
  11414. void focusGained (FocusChangeType cause);
  11415. void focusLost (FocusChangeType cause);
  11416. void resized();
  11417. void enablementChanged();
  11418. void colourChanged();
  11419. juce_UseDebuggingNewOperator
  11420. protected:
  11421. virtual void addPopupMenuItems (PopupMenu& menuToAddTo,
  11422. const MouseEvent* mouseClickEvent);
  11423. virtual void performPopupMenuAction (const int menuItemID);
  11424. void scrollToMakeSureCursorIsVisible();
  11425. void moveCaret (int newCaretPos);
  11426. void moveCursorTo (const int newPosition, const bool isSelecting);
  11427. void textChanged();
  11428. void newTransaction();
  11429. void doUndoRedo (const bool isRedo);
  11430. virtual void returnPressed();
  11431. virtual void escapePressed();
  11432. void handleCommandMessage (int commandId);
  11433. private:
  11434. ScopedPointer <Viewport> viewport;
  11435. TextHolderComponent* textHolder;
  11436. BorderSize borderSize;
  11437. bool readOnly : 1;
  11438. bool multiline : 1;
  11439. bool wordWrap : 1;
  11440. bool returnKeyStartsNewLine : 1;
  11441. bool caretVisible : 1;
  11442. bool popupMenuEnabled : 1;
  11443. bool selectAllTextWhenFocused : 1;
  11444. bool scrollbarVisible : 1;
  11445. bool wasFocused : 1;
  11446. bool caretFlashState : 1;
  11447. bool keepCursorOnScreen : 1;
  11448. bool tabKeyUsed : 1;
  11449. bool menuActive : 1;
  11450. bool valueTextNeedsUpdating : 1;
  11451. UndoManager undoManager;
  11452. float cursorX, cursorY, cursorHeight;
  11453. int maxTextLength;
  11454. int selectionStart, selectionEnd;
  11455. int leftIndent, topIndent;
  11456. unsigned int lastTransactionTime;
  11457. Font currentFont;
  11458. mutable int totalNumChars;
  11459. int caretPosition;
  11460. VoidArray sections;
  11461. String textToShowWhenEmpty;
  11462. Colour colourForTextWhenEmpty;
  11463. tchar passwordCharacter;
  11464. Value textValue;
  11465. enum
  11466. {
  11467. notDragging,
  11468. draggingSelectionStart,
  11469. draggingSelectionEnd
  11470. } dragType;
  11471. String allowedCharacters;
  11472. SortedSet <void*> listeners;
  11473. friend class TextEditorInsertAction;
  11474. friend class TextEditorRemoveAction;
  11475. void coalesceSimilarSections();
  11476. void splitSection (const int sectionIndex, const int charToSplitAt);
  11477. void clearInternal (UndoManager* const um);
  11478. void insert (const String& text,
  11479. const int insertIndex,
  11480. const Font& font,
  11481. const Colour& colour,
  11482. UndoManager* const um,
  11483. const int caretPositionToMoveTo);
  11484. void reinsert (const int insertIndex,
  11485. const VoidArray& sections);
  11486. void remove (const int startIndex,
  11487. int endIndex,
  11488. UndoManager* const um,
  11489. const int caretPositionToMoveTo);
  11490. void getCharPosition (const int index,
  11491. float& x, float& y,
  11492. float& lineHeight) const;
  11493. void updateCaretPosition();
  11494. void textWasChangedByValue();
  11495. int indexAtPosition (const float x,
  11496. const float y);
  11497. int findWordBreakAfter (const int position) const;
  11498. int findWordBreakBefore (const int position) const;
  11499. friend class TextHolderComponent;
  11500. friend class TextEditorViewport;
  11501. void drawContent (Graphics& g);
  11502. void updateTextHolderSize();
  11503. float getWordWrapWidth() const;
  11504. void timerCallbackInt();
  11505. void repaintCaret();
  11506. void repaintText (int textStartIndex, int textEndIndex);
  11507. TextEditor (const TextEditor&);
  11508. const TextEditor& operator= (const TextEditor&);
  11509. };
  11510. #endif // __JUCE_TEXTEDITOR_JUCEHEADER__
  11511. /*** End of inlined file: juce_TextEditor.h ***/
  11512. class Label;
  11513. class JUCE_API LabelListener
  11514. {
  11515. public:
  11516. virtual ~LabelListener() {}
  11517. virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
  11518. };
  11519. class JUCE_API Label : public Component,
  11520. public SettableTooltipClient,
  11521. protected TextEditorListener,
  11522. private ComponentListener,
  11523. private Value::Listener
  11524. {
  11525. public:
  11526. Label (const String& componentName,
  11527. const String& labelText);
  11528. ~Label();
  11529. void setText (const String& newText,
  11530. const bool broadcastChangeMessage);
  11531. const String getText (const bool returnActiveEditorContents = false) const throw();
  11532. Value& getTextValue() { return textValue; }
  11533. void setFont (const Font& newFont) throw();
  11534. const Font& getFont() const throw();
  11535. enum ColourIds
  11536. {
  11537. backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */
  11538. textColourId = 0x1000281, /**< The colour for the text. */
  11539. outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label.
  11540. Leave this transparent to not have an outline. */
  11541. };
  11542. void setJustificationType (const Justification& justification) throw();
  11543. const Justification getJustificationType() const throw() { return justification; }
  11544. void setBorderSize (int horizontalBorder, int verticalBorder);
  11545. int getHorizontalBorderSize() const throw() { return horizontalBorderSize; }
  11546. int getVerticalBorderSize() const throw() { return verticalBorderSize; }
  11547. void attachToComponent (Component* owner,
  11548. const bool onLeft);
  11549. Component* getAttachedComponent() const throw() { return ownerComponent; }
  11550. bool isAttachedOnLeft() const throw() { return leftOfOwnerComp; }
  11551. void setMinimumHorizontalScale (const float newScale);
  11552. float getMinimumHorizontalScale() const throw() { return minimumHorizontalScale; }
  11553. void addListener (LabelListener* const listener) throw();
  11554. void removeListener (LabelListener* const listener) throw();
  11555. void setEditable (const bool editOnSingleClick,
  11556. const bool editOnDoubleClick = false,
  11557. const bool lossOfFocusDiscardsChanges = false) throw();
  11558. bool isEditableOnSingleClick() const throw() { return editSingleClick; }
  11559. bool isEditableOnDoubleClick() const throw() { return editDoubleClick; }
  11560. bool doesLossOfFocusDiscardChanges() const throw() { return lossOfFocusDiscardsChanges; }
  11561. bool isEditable() const throw() { return editSingleClick || editDoubleClick; }
  11562. void showEditor();
  11563. void hideEditor (const bool discardCurrentEditorContents);
  11564. bool isBeingEdited() const throw();
  11565. juce_UseDebuggingNewOperator
  11566. protected:
  11567. virtual TextEditor* createEditorComponent();
  11568. virtual void textWasEdited();
  11569. virtual void textWasChanged();
  11570. virtual void editorShown (TextEditor* editorComponent);
  11571. virtual void editorAboutToBeHidden (TextEditor* editorComponent);
  11572. void paint (Graphics& g);
  11573. void resized();
  11574. void mouseUp (const MouseEvent& e);
  11575. void mouseDoubleClick (const MouseEvent& e);
  11576. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  11577. void componentParentHierarchyChanged (Component& component);
  11578. void componentVisibilityChanged (Component& component);
  11579. void inputAttemptWhenModal();
  11580. void focusGained (FocusChangeType);
  11581. void enablementChanged();
  11582. KeyboardFocusTraverser* createFocusTraverser();
  11583. void textEditorTextChanged (TextEditor& editor);
  11584. void textEditorReturnKeyPressed (TextEditor& editor);
  11585. void textEditorEscapeKeyPressed (TextEditor& editor);
  11586. void textEditorFocusLost (TextEditor& editor);
  11587. void colourChanged();
  11588. void valueChanged (Value&);
  11589. private:
  11590. Value textValue;
  11591. String lastTextValue;
  11592. Font font;
  11593. Justification justification;
  11594. ScopedPointer <TextEditor> editor;
  11595. SortedSet <void*> listeners;
  11596. Component* ownerComponent;
  11597. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  11598. int horizontalBorderSize, verticalBorderSize;
  11599. float minimumHorizontalScale;
  11600. bool editSingleClick : 1;
  11601. bool editDoubleClick : 1;
  11602. bool lossOfFocusDiscardsChanges : 1;
  11603. bool leftOfOwnerComp : 1;
  11604. bool updateFromTextEditorContents();
  11605. void callChangeListeners();
  11606. Label (const Label&);
  11607. const Label& operator= (const Label&);
  11608. };
  11609. #endif // __JUCE_LABEL_JUCEHEADER__
  11610. /*** End of inlined file: juce_Label.h ***/
  11611. class ComboBox;
  11612. class JUCE_API ComboBoxListener
  11613. {
  11614. public:
  11615. virtual ~ComboBoxListener() {}
  11616. virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
  11617. };
  11618. class JUCE_API ComboBox : public Component,
  11619. public SettableTooltipClient,
  11620. private LabelListener,
  11621. private AsyncUpdater,
  11622. private Value::Listener
  11623. {
  11624. public:
  11625. ComboBox (const String& componentName);
  11626. ~ComboBox();
  11627. void setEditableText (const bool isEditable);
  11628. bool isTextEditable() const throw();
  11629. void setJustificationType (const Justification& justification) throw();
  11630. const Justification getJustificationType() const throw();
  11631. void addItem (const String& newItemText,
  11632. const int newItemId) throw();
  11633. void addSeparator() throw();
  11634. void addSectionHeading (const String& headingName) throw();
  11635. void setItemEnabled (const int itemId,
  11636. const bool shouldBeEnabled) throw();
  11637. void changeItemText (const int itemId,
  11638. const String& newText) throw();
  11639. void clear (const bool dontSendChangeMessage = false);
  11640. int getNumItems() const throw();
  11641. const String getItemText (const int index) const throw();
  11642. int getItemId (const int index) const throw();
  11643. int indexOfItemId (const int itemId) const throw();
  11644. int getSelectedId() const throw();
  11645. Value& getSelectedIdAsValue() throw() { return currentId; }
  11646. void setSelectedId (const int newItemId,
  11647. const bool dontSendChangeMessage = false) throw();
  11648. int getSelectedItemIndex() const throw();
  11649. void setSelectedItemIndex (const int newItemIndex,
  11650. const bool dontSendChangeMessage = false) throw();
  11651. const String getText() const throw();
  11652. void setText (const String& newText,
  11653. const bool dontSendChangeMessage = false) throw();
  11654. void showEditor();
  11655. void addListener (ComboBoxListener* const listener) throw();
  11656. void removeListener (ComboBoxListener* const listener) throw();
  11657. void setTextWhenNothingSelected (const String& newMessage) throw();
  11658. const String getTextWhenNothingSelected() const throw();
  11659. void setTextWhenNoChoicesAvailable (const String& newMessage) throw();
  11660. const String getTextWhenNoChoicesAvailable() const throw();
  11661. void setTooltip (const String& newTooltip);
  11662. enum ColourIds
  11663. {
  11664. backgroundColourId = 0x1000b00, /**< The background colour to fill the box with. */
  11665. textColourId = 0x1000a00, /**< The colour for the text in the box. */
  11666. outlineColourId = 0x1000c00, /**< The colour for an outline around the box. */
  11667. buttonColourId = 0x1000d00, /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
  11668. arrowColourId = 0x1000e00, /**< The colour for the arrow shape that pops up the menu */
  11669. };
  11670. void labelTextChanged (Label*);
  11671. void enablementChanged();
  11672. void colourChanged();
  11673. void focusGained (Component::FocusChangeType cause);
  11674. void focusLost (Component::FocusChangeType cause);
  11675. void handleAsyncUpdate();
  11676. const String getTooltip() { return label->getTooltip(); }
  11677. void mouseDown (const MouseEvent&);
  11678. void mouseDrag (const MouseEvent&);
  11679. void mouseUp (const MouseEvent&);
  11680. void lookAndFeelChanged();
  11681. void paint (Graphics&);
  11682. void resized();
  11683. bool keyStateChanged (const bool isKeyDown);
  11684. bool keyPressed (const KeyPress&);
  11685. void valueChanged (Value&);
  11686. juce_UseDebuggingNewOperator
  11687. private:
  11688. struct ItemInfo
  11689. {
  11690. String name;
  11691. int itemId;
  11692. bool isEnabled : 1, isHeading : 1;
  11693. bool isSeparator() const throw();
  11694. bool isRealItem() const throw();
  11695. };
  11696. OwnedArray <ItemInfo> items;
  11697. Value currentId;
  11698. int lastCurrentId;
  11699. bool isButtonDown, separatorPending, menuActive, textIsCustom;
  11700. SortedSet <void*> listeners;
  11701. Label* label;
  11702. String textWhenNothingSelected, noChoicesMessage;
  11703. void showPopup();
  11704. ItemInfo* getItemForId (const int itemId) const throw();
  11705. ItemInfo* getItemForIndex (const int index) const throw();
  11706. ComboBox (const ComboBox&);
  11707. const ComboBox& operator= (const ComboBox&);
  11708. };
  11709. #endif // __JUCE_COMBOBOX_JUCEHEADER__
  11710. /*** End of inlined file: juce_ComboBox.h ***/
  11711. class JUCE_API AudioDeviceManager : public ChangeBroadcaster
  11712. {
  11713. public:
  11714. AudioDeviceManager();
  11715. ~AudioDeviceManager();
  11716. struct JUCE_API AudioDeviceSetup
  11717. {
  11718. AudioDeviceSetup();
  11719. bool operator== (const AudioDeviceSetup& other) const;
  11720. String outputDeviceName;
  11721. String inputDeviceName;
  11722. double sampleRate;
  11723. int bufferSize;
  11724. BitArray inputChannels;
  11725. bool useDefaultInputChannels;
  11726. BitArray outputChannels;
  11727. bool useDefaultOutputChannels;
  11728. };
  11729. const String initialise (const int numInputChannelsNeeded,
  11730. const int numOutputChannelsNeeded,
  11731. const XmlElement* const savedState,
  11732. const bool selectDefaultDeviceOnFailure,
  11733. const String& preferredDefaultDeviceName = String::empty,
  11734. const AudioDeviceSetup* preferredSetupOptions = 0);
  11735. XmlElement* createStateXml() const;
  11736. void getAudioDeviceSetup (AudioDeviceSetup& setup);
  11737. const String setAudioDeviceSetup (const AudioDeviceSetup& newSetup,
  11738. const bool treatAsChosenDevice);
  11739. AudioIODevice* getCurrentAudioDevice() const throw() { return currentAudioDevice; }
  11740. const String getCurrentAudioDeviceType() const throw() { return currentDeviceType; }
  11741. AudioIODeviceType* getCurrentDeviceTypeObject() const;
  11742. void setCurrentAudioDeviceType (const String& type,
  11743. const bool treatAsChosenDevice);
  11744. void closeAudioDevice();
  11745. void restartLastAudioDevice();
  11746. void addAudioCallback (AudioIODeviceCallback* newCallback);
  11747. void removeAudioCallback (AudioIODeviceCallback* callback);
  11748. double getCpuUsage() const;
  11749. void setMidiInputEnabled (const String& midiInputDeviceName,
  11750. const bool enabled);
  11751. bool isMidiInputEnabled (const String& midiInputDeviceName) const;
  11752. void addMidiInputCallback (const String& midiInputDeviceName,
  11753. MidiInputCallback* callback);
  11754. void removeMidiInputCallback (const String& midiInputDeviceName,
  11755. MidiInputCallback* callback);
  11756. void setDefaultMidiOutput (const String& deviceName);
  11757. const String getDefaultMidiOutputName() const throw() { return defaultMidiOutputName; }
  11758. MidiOutput* getDefaultMidiOutput() const throw() { return defaultMidiOutput; }
  11759. const OwnedArray <AudioIODeviceType>& getAvailableDeviceTypes();
  11760. virtual void createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& types);
  11761. void playTestSound();
  11762. void enableInputLevelMeasurement (const bool enableMeasurement);
  11763. double getCurrentInputLevel() const;
  11764. juce_UseDebuggingNewOperator
  11765. private:
  11766. OwnedArray <AudioIODeviceType> availableDeviceTypes;
  11767. OwnedArray <AudioDeviceSetup> lastDeviceTypeConfigs;
  11768. AudioDeviceSetup currentSetup;
  11769. ScopedPointer <AudioIODevice> currentAudioDevice;
  11770. SortedSet <AudioIODeviceCallback*> callbacks;
  11771. int numInputChansNeeded, numOutputChansNeeded;
  11772. String currentDeviceType;
  11773. BitArray inputChannels, outputChannels;
  11774. ScopedPointer <XmlElement> lastExplicitSettings;
  11775. mutable bool listNeedsScanning;
  11776. bool useInputNames;
  11777. int inputLevelMeasurementEnabledCount;
  11778. double inputLevel;
  11779. ScopedPointer <AudioSampleBuffer> testSound;
  11780. int testSoundPosition;
  11781. AudioSampleBuffer tempBuffer;
  11782. StringArray midiInsFromXml;
  11783. OwnedArray <MidiInput> enabledMidiInputs;
  11784. Array <MidiInputCallback*> midiCallbacks;
  11785. Array <MidiInput*> midiCallbackDevices;
  11786. String defaultMidiOutputName;
  11787. ScopedPointer <MidiOutput> defaultMidiOutput;
  11788. CriticalSection audioCallbackLock, midiCallbackLock;
  11789. double cpuUsageMs, timeToCpuScale;
  11790. class CallbackHandler : public AudioIODeviceCallback,
  11791. public MidiInputCallback
  11792. {
  11793. public:
  11794. AudioDeviceManager* owner;
  11795. void audioDeviceIOCallback (const float** inputChannelData,
  11796. int totalNumInputChannels,
  11797. float** outputChannelData,
  11798. int totalNumOutputChannels,
  11799. int numSamples);
  11800. void audioDeviceAboutToStart (AudioIODevice*);
  11801. void audioDeviceStopped();
  11802. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  11803. };
  11804. CallbackHandler callbackHandler;
  11805. friend class CallbackHandler;
  11806. void audioDeviceIOCallbackInt (const float** inputChannelData,
  11807. int totalNumInputChannels,
  11808. float** outputChannelData,
  11809. int totalNumOutputChannels,
  11810. int numSamples);
  11811. void audioDeviceAboutToStartInt (AudioIODevice* const device);
  11812. void audioDeviceStoppedInt();
  11813. void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
  11814. const String restartDevice (int blockSizeToUse, double sampleRateToUse,
  11815. const BitArray& ins, const BitArray& outs);
  11816. void stopDevice();
  11817. void updateXml();
  11818. void createDeviceTypesIfNeeded();
  11819. void scanDevicesIfNeeded();
  11820. void deleteCurrentDevice();
  11821. double chooseBestSampleRate (double preferred) const;
  11822. void insertDefaultDeviceNames (AudioDeviceSetup& setup) const;
  11823. AudioIODeviceType* findType (const String& inputName, const String& outputName);
  11824. AudioDeviceManager (const AudioDeviceManager&);
  11825. const AudioDeviceManager& operator= (const AudioDeviceManager&);
  11826. };
  11827. #endif // __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
  11828. /*** End of inlined file: juce_AudioDeviceManager.h ***/
  11829. #endif
  11830. #ifndef __JUCE_AUDIOIODEVICE_JUCEHEADER__
  11831. #endif
  11832. #ifndef __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__
  11833. #endif
  11834. #ifndef __JUCE_MIDIINPUT_JUCEHEADER__
  11835. #endif
  11836. #ifndef __JUCE_MIDIOUTPUT_JUCEHEADER__
  11837. #endif
  11838. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11839. /*** Start of inlined file: juce_AudioDataConverters.h ***/
  11840. #ifndef __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11841. #define __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11842. class JUCE_API AudioDataConverters
  11843. {
  11844. public:
  11845. static void convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11846. static void convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 2);
  11847. static void convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11848. static void convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 3);
  11849. static void convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11850. static void convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11851. static void convertFloatToFloat32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11852. static void convertFloatToFloat32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample = 4);
  11853. static void convertInt16LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11854. static void convertInt16BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 2);
  11855. static void convertInt24LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11856. static void convertInt24BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 3);
  11857. static void convertInt32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11858. static void convertInt32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11859. static void convertFloat32LEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11860. static void convertFloat32BEToFloat (const void* source, float* dest, int numSamples, const int srcBytesPerSample = 4);
  11861. enum DataFormat
  11862. {
  11863. int16LE,
  11864. int16BE,
  11865. int24LE,
  11866. int24BE,
  11867. int32LE,
  11868. int32BE,
  11869. float32LE,
  11870. float32BE,
  11871. };
  11872. static void convertFloatToFormat (const DataFormat destFormat,
  11873. const float* source, void* dest, int numSamples);
  11874. static void convertFormatToFloat (const DataFormat sourceFormat,
  11875. const void* source, float* dest, int numSamples);
  11876. static void interleaveSamples (const float** source, float* dest,
  11877. const int numSamples, const int numChannels);
  11878. static void deinterleaveSamples (const float* source, float** dest,
  11879. const int numSamples, const int numChannels);
  11880. };
  11881. #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__
  11882. /*** End of inlined file: juce_AudioDataConverters.h ***/
  11883. #endif
  11884. #ifndef __JUCE_AUDIOSAMPLEBUFFER_JUCEHEADER__
  11885. #endif
  11886. #ifndef __JUCE_IIRFILTER_JUCEHEADER__
  11887. #endif
  11888. #ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
  11889. #endif
  11890. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11891. /*** Start of inlined file: juce_MidiFile.h ***/
  11892. #ifndef __JUCE_MIDIFILE_JUCEHEADER__
  11893. #define __JUCE_MIDIFILE_JUCEHEADER__
  11894. /*** Start of inlined file: juce_MidiMessageSequence.h ***/
  11895. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11896. #define __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11897. class JUCE_API MidiMessageSequence
  11898. {
  11899. public:
  11900. MidiMessageSequence();
  11901. MidiMessageSequence (const MidiMessageSequence& other);
  11902. MidiMessageSequence& operator= (const MidiMessageSequence& other);
  11903. ~MidiMessageSequence();
  11904. class MidiEventHolder
  11905. {
  11906. public:
  11907. ~MidiEventHolder();
  11908. MidiMessage message;
  11909. MidiEventHolder* noteOffObject;
  11910. juce_UseDebuggingNewOperator
  11911. private:
  11912. friend class MidiMessageSequence;
  11913. MidiEventHolder (const MidiMessage& message);
  11914. };
  11915. void clear();
  11916. int getNumEvents() const;
  11917. MidiEventHolder* getEventPointer (const int index) const;
  11918. double getTimeOfMatchingKeyUp (const int index) const;
  11919. int getIndexOfMatchingKeyUp (const int index) const;
  11920. int getIndexOf (MidiEventHolder* const event) const;
  11921. int getNextIndexAtTime (const double timeStamp) const;
  11922. double getStartTime() const;
  11923. double getEndTime() const;
  11924. double getEventTime (const int index) const;
  11925. void addEvent (const MidiMessage& newMessage,
  11926. double timeAdjustment = 0);
  11927. void deleteEvent (const int index,
  11928. const bool deleteMatchingNoteUp);
  11929. void addSequence (const MidiMessageSequence& other,
  11930. double timeAdjustmentDelta,
  11931. double firstAllowableDestTime,
  11932. double endOfAllowableDestTimes);
  11933. void updateMatchedPairs();
  11934. void extractMidiChannelMessages (const int channelNumberToExtract,
  11935. MidiMessageSequence& destSequence,
  11936. const bool alsoIncludeMetaEvents) const;
  11937. void extractSysExMessages (MidiMessageSequence& destSequence) const;
  11938. void deleteMidiChannelMessages (const int channelNumberToRemove);
  11939. void deleteSysExMessages();
  11940. void addTimeToMessages (const double deltaTime);
  11941. void createControllerUpdatesForTime (const int channelNumber,
  11942. const double time,
  11943. OwnedArray<MidiMessage>& resultMessages);
  11944. void swapWith (MidiMessageSequence& other) throw();
  11945. juce_UseDebuggingNewOperator
  11946. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11947. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11948. private:
  11949. friend class MidiFile;
  11950. OwnedArray <MidiEventHolder> list;
  11951. void sort();
  11952. };
  11953. #endif // __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  11954. /*** End of inlined file: juce_MidiMessageSequence.h ***/
  11955. class JUCE_API MidiFile
  11956. {
  11957. public:
  11958. MidiFile() throw();
  11959. ~MidiFile() throw();
  11960. int getNumTracks() const throw();
  11961. const MidiMessageSequence* getTrack (const int index) const throw();
  11962. void addTrack (const MidiMessageSequence& trackSequence) throw();
  11963. void clear() throw();
  11964. short getTimeFormat() const throw();
  11965. void setTicksPerQuarterNote (const int ticksPerQuarterNote) throw();
  11966. void setSmpteTimeFormat (const int framesPerSecond,
  11967. const int subframeResolution) throw();
  11968. void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
  11969. void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
  11970. double getLastTimestamp() const;
  11971. bool readFrom (InputStream& sourceStream);
  11972. bool writeTo (OutputStream& destStream);
  11973. void convertTimestampTicksToSeconds();
  11974. juce_UseDebuggingNewOperator
  11975. static int compareElements (const MidiMessageSequence::MidiEventHolder* const first,
  11976. const MidiMessageSequence::MidiEventHolder* const second) throw();
  11977. private:
  11978. OwnedArray <MidiMessageSequence> tracks;
  11979. short timeFormat;
  11980. MidiFile (const MidiFile&);
  11981. const MidiFile& operator= (const MidiFile&);
  11982. void readNextTrack (const char* data, int size);
  11983. void writeTrack (OutputStream& mainOut, const int trackNum);
  11984. };
  11985. #endif // __JUCE_MIDIFILE_JUCEHEADER__
  11986. /*** End of inlined file: juce_MidiFile.h ***/
  11987. #endif
  11988. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11989. /*** Start of inlined file: juce_MidiKeyboardState.h ***/
  11990. #ifndef __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11991. #define __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  11992. class MidiKeyboardState;
  11993. class JUCE_API MidiKeyboardStateListener
  11994. {
  11995. public:
  11996. MidiKeyboardStateListener() throw() {}
  11997. virtual ~MidiKeyboardStateListener() {}
  11998. virtual void handleNoteOn (MidiKeyboardState* source,
  11999. int midiChannel, int midiNoteNumber, float velocity) = 0;
  12000. virtual void handleNoteOff (MidiKeyboardState* source,
  12001. int midiChannel, int midiNoteNumber) = 0;
  12002. };
  12003. class JUCE_API MidiKeyboardState
  12004. {
  12005. public:
  12006. MidiKeyboardState();
  12007. ~MidiKeyboardState();
  12008. void reset();
  12009. bool isNoteOn (const int midiChannel, const int midiNoteNumber) const throw();
  12010. bool isNoteOnForChannels (const int midiChannelMask, const int midiNoteNumber) const throw();
  12011. void noteOn (const int midiChannel, const int midiNoteNumber, const float velocity);
  12012. void noteOff (const int midiChannel, const int midiNoteNumber);
  12013. void allNotesOff (const int midiChannel);
  12014. void processNextMidiEvent (const MidiMessage& message);
  12015. void processNextMidiBuffer (MidiBuffer& buffer,
  12016. const int startSample,
  12017. const int numSamples,
  12018. const bool injectIndirectEvents);
  12019. void addListener (MidiKeyboardStateListener* const listener) throw();
  12020. void removeListener (MidiKeyboardStateListener* const listener) throw();
  12021. juce_UseDebuggingNewOperator
  12022. private:
  12023. CriticalSection lock;
  12024. uint16 noteStates [128];
  12025. MidiBuffer eventsToAdd;
  12026. VoidArray listeners;
  12027. void noteOnInternal (const int midiChannel, const int midiNoteNumber, const float velocity);
  12028. void noteOffInternal (const int midiChannel, const int midiNoteNumber);
  12029. MidiKeyboardState (const MidiKeyboardState&);
  12030. const MidiKeyboardState& operator= (const MidiKeyboardState&);
  12031. };
  12032. #endif // __JUCE_MIDIKEYBOARDSTATE_JUCEHEADER__
  12033. /*** End of inlined file: juce_MidiKeyboardState.h ***/
  12034. #endif
  12035. #ifndef __JUCE_MIDIMESSAGE_JUCEHEADER__
  12036. #endif
  12037. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12038. /*** Start of inlined file: juce_MidiMessageCollector.h ***/
  12039. #ifndef __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12040. #define __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12041. class JUCE_API MidiMessageCollector : public MidiKeyboardStateListener,
  12042. public MidiInputCallback
  12043. {
  12044. public:
  12045. MidiMessageCollector();
  12046. ~MidiMessageCollector();
  12047. void reset (const double sampleRate);
  12048. void addMessageToQueue (const MidiMessage& message);
  12049. void removeNextBlockOfMessages (MidiBuffer& destBuffer,
  12050. const int numSamples);
  12051. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  12052. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  12053. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  12054. juce_UseDebuggingNewOperator
  12055. private:
  12056. double lastCallbackTime;
  12057. CriticalSection midiCallbackLock;
  12058. MidiBuffer incomingMessages;
  12059. double sampleRate;
  12060. MidiMessageCollector (const MidiMessageCollector&);
  12061. const MidiMessageCollector& operator= (const MidiMessageCollector&);
  12062. };
  12063. #endif // __JUCE_MIDIMESSAGECOLLECTOR_JUCEHEADER__
  12064. /*** End of inlined file: juce_MidiMessageCollector.h ***/
  12065. #endif
  12066. #ifndef __JUCE_MIDIMESSAGESEQUENCE_JUCEHEADER__
  12067. #endif
  12068. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12069. /*** Start of inlined file: juce_AudioUnitPluginFormat.h ***/
  12070. #ifndef __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12071. #define __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12072. /*** Start of inlined file: juce_AudioPluginFormat.h ***/
  12073. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12074. #define __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12075. /*** Start of inlined file: juce_AudioPluginInstance.h ***/
  12076. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12077. #define __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12078. /*** Start of inlined file: juce_AudioProcessor.h ***/
  12079. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12080. #define __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12081. /*** Start of inlined file: juce_AudioProcessorEditor.h ***/
  12082. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12083. #define __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12084. class AudioProcessor;
  12085. class JUCE_API AudioProcessorEditor : public Component
  12086. {
  12087. protected:
  12088. AudioProcessorEditor (AudioProcessor* const owner);
  12089. public:
  12090. ~AudioProcessorEditor();
  12091. AudioProcessor* getAudioProcessor() const throw() { return owner; }
  12092. private:
  12093. AudioProcessor* const owner;
  12094. };
  12095. #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12096. /*** End of inlined file: juce_AudioProcessorEditor.h ***/
  12097. /*** Start of inlined file: juce_AudioProcessorListener.h ***/
  12098. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12099. #define __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12100. class AudioProcessor;
  12101. class JUCE_API AudioProcessorListener
  12102. {
  12103. public:
  12104. virtual ~AudioProcessorListener() {}
  12105. virtual void audioProcessorParameterChanged (AudioProcessor* processor,
  12106. int parameterIndex,
  12107. float newValue) = 0;
  12108. virtual void audioProcessorChanged (AudioProcessor* processor) = 0;
  12109. virtual void audioProcessorParameterChangeGestureBegin (AudioProcessor* processor,
  12110. int parameterIndex);
  12111. virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor,
  12112. int parameterIndex);
  12113. };
  12114. #endif // __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  12115. /*** End of inlined file: juce_AudioProcessorListener.h ***/
  12116. /*** Start of inlined file: juce_AudioPlayHead.h ***/
  12117. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12118. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12119. class JUCE_API AudioPlayHead
  12120. {
  12121. protected:
  12122. AudioPlayHead() {}
  12123. public:
  12124. virtual ~AudioPlayHead() {}
  12125. enum FrameRateType
  12126. {
  12127. fps24 = 0,
  12128. fps25 = 1,
  12129. fps2997 = 2,
  12130. fps30 = 3,
  12131. fps2997drop = 4,
  12132. fps30drop = 5,
  12133. fpsUnknown = 99
  12134. };
  12135. struct CurrentPositionInfo
  12136. {
  12137. double bpm;
  12138. int timeSigNumerator;
  12139. int timeSigDenominator;
  12140. double timeInSeconds;
  12141. double editOriginTime;
  12142. double ppqPosition;
  12143. double ppqPositionOfLastBarStart;
  12144. FrameRateType frameRate;
  12145. bool isPlaying;
  12146. bool isRecording;
  12147. };
  12148. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  12149. };
  12150. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12151. /*** End of inlined file: juce_AudioPlayHead.h ***/
  12152. class JUCE_API AudioProcessor
  12153. {
  12154. protected:
  12155. AudioProcessor();
  12156. public:
  12157. virtual ~AudioProcessor();
  12158. virtual const String getName() const = 0;
  12159. virtual void prepareToPlay (double sampleRate,
  12160. int estimatedSamplesPerBlock) = 0;
  12161. virtual void releaseResources() = 0;
  12162. virtual void processBlock (AudioSampleBuffer& buffer,
  12163. MidiBuffer& midiMessages) = 0;
  12164. AudioPlayHead* getPlayHead() const throw() { return playHead; }
  12165. double getSampleRate() const throw() { return sampleRate; }
  12166. int getBlockSize() const throw() { return blockSize; }
  12167. int getNumInputChannels() const throw() { return numInputChannels; }
  12168. int getNumOutputChannels() const throw() { return numOutputChannels; }
  12169. virtual const String getInputChannelName (const int channelIndex) const = 0;
  12170. virtual const String getOutputChannelName (const int channelIndex) const = 0;
  12171. virtual bool isInputChannelStereoPair (int index) const = 0;
  12172. virtual bool isOutputChannelStereoPair (int index) const = 0;
  12173. int getLatencySamples() const throw() { return latencySamples; }
  12174. void setLatencySamples (const int newLatency);
  12175. virtual bool acceptsMidi() const = 0;
  12176. virtual bool producesMidi() const = 0;
  12177. const CriticalSection& getCallbackLock() const throw() { return callbackLock; }
  12178. void suspendProcessing (const bool shouldBeSuspended);
  12179. bool isSuspended() const throw() { return suspended; }
  12180. virtual void reset();
  12181. bool isNonRealtime() const throw() { return nonRealtime; }
  12182. void setNonRealtime (const bool isNonRealtime) throw();
  12183. virtual AudioProcessorEditor* createEditor() = 0;
  12184. AudioProcessorEditor* getActiveEditor() const throw() { return activeEditor; }
  12185. AudioProcessorEditor* createEditorIfNeeded();
  12186. virtual int getNumParameters() = 0;
  12187. virtual const String getParameterName (int parameterIndex) = 0;
  12188. virtual float getParameter (int parameterIndex) = 0;
  12189. virtual const String getParameterText (int parameterIndex) = 0;
  12190. virtual void setParameter (int parameterIndex,
  12191. float newValue) = 0;
  12192. void setParameterNotifyingHost (int parameterIndex,
  12193. float newValue);
  12194. virtual bool isParameterAutomatable (int parameterIndex) const;
  12195. virtual bool isMetaParameter (int parameterIndex) const;
  12196. void beginParameterChangeGesture (int parameterIndex);
  12197. void endParameterChangeGesture (int parameterIndex);
  12198. void updateHostDisplay();
  12199. virtual int getNumPrograms() = 0;
  12200. virtual int getCurrentProgram() = 0;
  12201. virtual void setCurrentProgram (int index) = 0;
  12202. virtual const String getProgramName (int index) = 0;
  12203. virtual void changeProgramName (int index, const String& newName) = 0;
  12204. virtual void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData) = 0;
  12205. virtual void getCurrentProgramStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12206. virtual void setStateInformation (const void* data, int sizeInBytes) = 0;
  12207. virtual void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
  12208. void addListener (AudioProcessorListener* const newListener) throw();
  12209. void removeListener (AudioProcessorListener* const listenerToRemove) throw();
  12210. void editorBeingDeleted (AudioProcessorEditor* const editor) throw();
  12211. void setPlayHead (AudioPlayHead* const newPlayHead) throw();
  12212. void setPlayConfigDetails (const int numIns, const int numOuts,
  12213. const double sampleRate,
  12214. const int blockSize) throw();
  12215. juce_UseDebuggingNewOperator
  12216. protected:
  12217. static void copyXmlToBinary (const XmlElement& xml,
  12218. JUCE_NAMESPACE::MemoryBlock& destData);
  12219. static XmlElement* getXmlFromBinary (const void* data,
  12220. const int sizeInBytes);
  12221. AudioPlayHead* playHead;
  12222. void sendParamChangeMessageToListeners (const int parameterIndex, const float newValue);
  12223. private:
  12224. VoidArray listeners;
  12225. AudioProcessorEditor* activeEditor;
  12226. double sampleRate;
  12227. int blockSize, numInputChannels, numOutputChannels, latencySamples;
  12228. bool suspended, nonRealtime;
  12229. CriticalSection callbackLock, listenerLock;
  12230. #ifdef JUCE_DEBUG
  12231. BitArray changingParams;
  12232. #endif
  12233. AudioProcessor (const AudioProcessor&);
  12234. const AudioProcessor& operator= (const AudioProcessor&);
  12235. };
  12236. #endif // __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12237. /*** End of inlined file: juce_AudioProcessor.h ***/
  12238. /*** Start of inlined file: juce_PluginDescription.h ***/
  12239. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12240. #define __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12241. class JUCE_API PluginDescription
  12242. {
  12243. public:
  12244. PluginDescription() throw();
  12245. PluginDescription (const PluginDescription& other) throw();
  12246. const PluginDescription& operator= (const PluginDescription& other) throw();
  12247. ~PluginDescription() throw();
  12248. String name;
  12249. String pluginFormatName;
  12250. String category;
  12251. String manufacturerName;
  12252. String version;
  12253. String fileOrIdentifier;
  12254. Time lastFileModTime;
  12255. int uid;
  12256. bool isInstrument;
  12257. int numInputChannels;
  12258. int numOutputChannels;
  12259. bool isDuplicateOf (const PluginDescription& other) const;
  12260. const String createIdentifierString() const throw();
  12261. XmlElement* createXml() const;
  12262. bool loadFromXml (const XmlElement& xml);
  12263. juce_UseDebuggingNewOperator
  12264. };
  12265. #endif // __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12266. /*** End of inlined file: juce_PluginDescription.h ***/
  12267. class JUCE_API AudioPluginInstance : public AudioProcessor
  12268. {
  12269. public:
  12270. virtual ~AudioPluginInstance();
  12271. virtual void fillInPluginDescription (PluginDescription& description) const = 0;
  12272. juce_UseDebuggingNewOperator
  12273. protected:
  12274. AudioPluginInstance();
  12275. AudioPluginInstance (const AudioPluginInstance&);
  12276. const AudioPluginInstance& operator= (const AudioPluginInstance&);
  12277. };
  12278. #endif // __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12279. /*** End of inlined file: juce_AudioPluginInstance.h ***/
  12280. class PluginDescription;
  12281. class JUCE_API AudioPluginFormat
  12282. {
  12283. public:
  12284. virtual ~AudioPluginFormat();
  12285. virtual const String getName() const = 0;
  12286. virtual void findAllTypesForFile (OwnedArray <PluginDescription>& results,
  12287. const String& fileOrIdentifier) = 0;
  12288. virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc) = 0;
  12289. virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
  12290. virtual const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
  12291. virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
  12292. virtual const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
  12293. const bool recursive) = 0;
  12294. virtual const FileSearchPath getDefaultLocationsToSearch() = 0;
  12295. juce_UseDebuggingNewOperator
  12296. protected:
  12297. AudioPluginFormat() throw();
  12298. AudioPluginFormat (const AudioPluginFormat&);
  12299. const AudioPluginFormat& operator= (const AudioPluginFormat&);
  12300. };
  12301. #endif // __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12302. /*** End of inlined file: juce_AudioPluginFormat.h ***/
  12303. #if JUCE_PLUGINHOST_AU && JUCE_MAC
  12304. class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
  12305. {
  12306. public:
  12307. AudioUnitPluginFormat();
  12308. ~AudioUnitPluginFormat();
  12309. const String getName() const { return "AudioUnit"; }
  12310. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12311. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12312. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12313. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12314. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12315. bool doesPluginStillExist (const PluginDescription& desc);
  12316. const FileSearchPath getDefaultLocationsToSearch();
  12317. juce_UseDebuggingNewOperator
  12318. private:
  12319. AudioUnitPluginFormat (const AudioUnitPluginFormat&);
  12320. const AudioUnitPluginFormat& operator= (const AudioUnitPluginFormat&);
  12321. };
  12322. #endif
  12323. #endif // __JUCE_AUDIOUNITPLUGINFORMAT_JUCEHEADER__
  12324. /*** End of inlined file: juce_AudioUnitPluginFormat.h ***/
  12325. #endif
  12326. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12327. /*** Start of inlined file: juce_DirectXPluginFormat.h ***/
  12328. #ifndef __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12329. #define __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12330. #if JUCE_PLUGINHOST_DX && JUCE_WIN32
  12331. // Sorry, this file is just a placeholder at the moment!...
  12332. class JUCE_API DirectXPluginFormat : public AudioPluginFormat
  12333. {
  12334. public:
  12335. DirectXPluginFormat();
  12336. ~DirectXPluginFormat();
  12337. const String getName() const { return "DirectX"; }
  12338. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12339. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12340. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12341. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12342. const FileSearchPath getDefaultLocationsToSearch();
  12343. juce_UseDebuggingNewOperator
  12344. private:
  12345. DirectXPluginFormat (const DirectXPluginFormat&);
  12346. const DirectXPluginFormat& operator= (const DirectXPluginFormat&);
  12347. };
  12348. #endif
  12349. #endif // __JUCE_DIRECTXPLUGINFORMAT_JUCEHEADER__
  12350. /*** End of inlined file: juce_DirectXPluginFormat.h ***/
  12351. #endif
  12352. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12353. /*** Start of inlined file: juce_LADSPAPluginFormat.h ***/
  12354. #ifndef __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12355. #define __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12356. #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
  12357. // Sorry, this file is just a placeholder at the moment!...
  12358. class JUCE_API LADSPAPluginFormat : public AudioPluginFormat
  12359. {
  12360. public:
  12361. LADSPAPluginFormat();
  12362. ~LADSPAPluginFormat();
  12363. const String getName() const { return "LADSPA"; }
  12364. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12365. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12366. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12367. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; }
  12368. const FileSearchPath getDefaultLocationsToSearch();
  12369. juce_UseDebuggingNewOperator
  12370. private:
  12371. LADSPAPluginFormat (const LADSPAPluginFormat&);
  12372. const LADSPAPluginFormat& operator= (const LADSPAPluginFormat&);
  12373. };
  12374. #endif
  12375. #endif // __JUCE_LADSPAPLUGINFORMAT_JUCEHEADER__
  12376. /*** End of inlined file: juce_LADSPAPluginFormat.h ***/
  12377. #endif
  12378. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12379. /*** Start of inlined file: juce_VSTMidiEventList.h ***/
  12380. #ifdef __aeffect__
  12381. #ifndef __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12382. #define __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12383. class VSTMidiEventList
  12384. {
  12385. public:
  12386. VSTMidiEventList()
  12387. : numEventsUsed (0), numEventsAllocated (0)
  12388. {
  12389. }
  12390. ~VSTMidiEventList()
  12391. {
  12392. freeEvents();
  12393. }
  12394. void clear()
  12395. {
  12396. numEventsUsed = 0;
  12397. if (events != 0)
  12398. events->numEvents = 0;
  12399. }
  12400. void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
  12401. {
  12402. ensureSize (numEventsUsed + 1);
  12403. VstMidiEvent* const e = (VstMidiEvent*) (events->events [numEventsUsed]);
  12404. events->numEvents = ++numEventsUsed;
  12405. if (numBytes <= 4)
  12406. {
  12407. if (e->type == kVstSysExType)
  12408. {
  12409. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12410. e->type = kVstMidiType;
  12411. e->byteSize = sizeof (VstMidiEvent);
  12412. e->noteLength = 0;
  12413. e->noteOffset = 0;
  12414. e->detune = 0;
  12415. e->noteOffVelocity = 0;
  12416. }
  12417. e->deltaFrames = frameOffset;
  12418. memcpy (e->midiData, midiData, numBytes);
  12419. }
  12420. else
  12421. {
  12422. VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e;
  12423. if (se->type == kVstSysExType)
  12424. se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes);
  12425. else
  12426. se->sysexDump = (char*) juce_malloc (numBytes);
  12427. memcpy (se->sysexDump, midiData, numBytes);
  12428. se->type = kVstSysExType;
  12429. se->byteSize = sizeof (VstMidiSysexEvent);
  12430. se->deltaFrames = frameOffset;
  12431. se->flags = 0;
  12432. se->dumpBytes = numBytes;
  12433. se->resvd1 = 0;
  12434. se->resvd2 = 0;
  12435. }
  12436. }
  12437. // Handy method to pull the events out of an event buffer supplied by the host
  12438. // or plugin.
  12439. static void addEventsToMidiBuffer (const VstEvents* events, MidiBuffer& dest)
  12440. {
  12441. for (int i = 0; i < events->numEvents; ++i)
  12442. {
  12443. const VstEvent* const e = events->events[i];
  12444. if (e != 0)
  12445. {
  12446. if (e->type == kVstMidiType)
  12447. {
  12448. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiEvent*) e)->midiData,
  12449. 4, e->deltaFrames);
  12450. }
  12451. else if (e->type == kVstSysExType)
  12452. {
  12453. dest.addEvent ((const JUCE_NAMESPACE::uint8*) ((const VstMidiSysexEvent*) e)->sysexDump,
  12454. (int) ((const VstMidiSysexEvent*) e)->dumpBytes,
  12455. e->deltaFrames);
  12456. }
  12457. }
  12458. }
  12459. }
  12460. void ensureSize (int numEventsNeeded)
  12461. {
  12462. if (numEventsNeeded > numEventsAllocated)
  12463. {
  12464. numEventsNeeded = (numEventsNeeded + 32) & ~31;
  12465. const int size = 20 + sizeof (VstEvent*) * numEventsNeeded;
  12466. if (events == 0)
  12467. events.calloc (size, 1);
  12468. else
  12469. events.realloc (size, 1);
  12470. for (int i = numEventsAllocated; i < numEventsNeeded; ++i)
  12471. {
  12472. VstMidiEvent* const e = (VstMidiEvent*) juce_calloc (jmax ((int) sizeof (VstMidiEvent),
  12473. (int) sizeof (VstMidiSysexEvent)));
  12474. e->type = kVstMidiType;
  12475. e->byteSize = sizeof (VstMidiEvent);
  12476. events->events[i] = (VstEvent*) e;
  12477. }
  12478. numEventsAllocated = numEventsNeeded;
  12479. }
  12480. }
  12481. void freeEvents()
  12482. {
  12483. if (events != 0)
  12484. {
  12485. for (int i = numEventsAllocated; --i >= 0;)
  12486. {
  12487. VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]);
  12488. if (e->type == kVstSysExType)
  12489. juce_free (((VstMidiSysexEvent*) e)->sysexDump);
  12490. juce_free (e);
  12491. }
  12492. events.free();
  12493. numEventsUsed = 0;
  12494. numEventsAllocated = 0;
  12495. }
  12496. }
  12497. HeapBlock <VstEvents> events;
  12498. private:
  12499. int numEventsUsed, numEventsAllocated;
  12500. };
  12501. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12502. #endif // __JUCE_VSTMIDIEVENTLIST_JUCEHEADER__
  12503. /*** End of inlined file: juce_VSTMidiEventList.h ***/
  12504. #endif
  12505. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12506. /*** Start of inlined file: juce_VSTPluginFormat.h ***/
  12507. #ifndef __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12508. #define __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12509. #if JUCE_PLUGINHOST_VST
  12510. class JUCE_API VSTPluginFormat : public AudioPluginFormat
  12511. {
  12512. public:
  12513. VSTPluginFormat();
  12514. ~VSTPluginFormat();
  12515. const String getName() const { return "VST"; }
  12516. void findAllTypesForFile (OwnedArray <PluginDescription>& results, const String& fileOrIdentifier);
  12517. AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc);
  12518. bool fileMightContainThisPluginType (const String& fileOrIdentifier);
  12519. const String getNameOfPluginFromIdentifier (const String& fileOrIdentifier);
  12520. const StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive);
  12521. bool doesPluginStillExist (const PluginDescription& desc);
  12522. const FileSearchPath getDefaultLocationsToSearch();
  12523. juce_UseDebuggingNewOperator
  12524. private:
  12525. VSTPluginFormat (const VSTPluginFormat&);
  12526. const VSTPluginFormat& operator= (const VSTPluginFormat&);
  12527. void recursiveFileSearch (StringArray& results, const File& dir, const bool recursive);
  12528. };
  12529. #endif
  12530. #endif // __JUCE_VSTPLUGINFORMAT_JUCEHEADER__
  12531. /*** End of inlined file: juce_VSTPluginFormat.h ***/
  12532. #endif
  12533. #ifndef __JUCE_AUDIOPLUGINFORMAT_JUCEHEADER__
  12534. #endif
  12535. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12536. /*** Start of inlined file: juce_AudioPluginFormatManager.h ***/
  12537. #ifndef __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12538. #define __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12539. class JUCE_API AudioPluginFormatManager : public DeletedAtShutdown
  12540. {
  12541. public:
  12542. AudioPluginFormatManager() throw();
  12543. ~AudioPluginFormatManager() throw();
  12544. juce_DeclareSingleton_SingleThreaded (AudioPluginFormatManager, false);
  12545. void addDefaultFormats();
  12546. int getNumFormats() throw();
  12547. AudioPluginFormat* getFormat (const int index) throw();
  12548. void addFormat (AudioPluginFormat* const format) throw();
  12549. AudioPluginInstance* createPluginInstance (const PluginDescription& description,
  12550. String& errorMessage) const;
  12551. bool doesPluginStillExist (const PluginDescription& description) const;
  12552. juce_UseDebuggingNewOperator
  12553. private:
  12554. OwnedArray <AudioPluginFormat> formats;
  12555. AudioPluginFormatManager (const AudioPluginFormatManager&);
  12556. const AudioPluginFormatManager& operator= (const AudioPluginFormatManager&);
  12557. };
  12558. #endif // __JUCE_AUDIOPLUGINFORMATMANAGER_JUCEHEADER__
  12559. /*** End of inlined file: juce_AudioPluginFormatManager.h ***/
  12560. #endif
  12561. #ifndef __JUCE_AUDIOPLUGININSTANCE_JUCEHEADER__
  12562. #endif
  12563. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12564. /*** Start of inlined file: juce_KnownPluginList.h ***/
  12565. #ifndef __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12566. #define __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12567. class JUCE_API KnownPluginList : public ChangeBroadcaster
  12568. {
  12569. public:
  12570. KnownPluginList();
  12571. ~KnownPluginList();
  12572. void clear();
  12573. int getNumTypes() const throw() { return types.size(); }
  12574. PluginDescription* getType (const int index) const throw() { return types [index]; }
  12575. PluginDescription* getTypeForFile (const String& fileOrIdentifier) const throw();
  12576. PluginDescription* getTypeForIdentifierString (const String& identifierString) const throw();
  12577. bool addType (const PluginDescription& type);
  12578. void removeType (const int index) throw();
  12579. bool scanAndAddFile (const String& possiblePluginFileOrIdentifier,
  12580. const bool dontRescanIfAlreadyInList,
  12581. OwnedArray <PluginDescription>& typesFound,
  12582. AudioPluginFormat& formatToUse);
  12583. bool isListingUpToDate (const String& possiblePluginFileOrIdentifier) const throw();
  12584. void scanAndAddDragAndDroppedFiles (const StringArray& filenames,
  12585. OwnedArray <PluginDescription>& typesFound);
  12586. enum SortMethod
  12587. {
  12588. defaultOrder = 0,
  12589. sortAlphabetically,
  12590. sortByCategory,
  12591. sortByManufacturer,
  12592. sortByFileSystemLocation
  12593. };
  12594. void addToMenu (PopupMenu& menu,
  12595. const SortMethod sortMethod) const;
  12596. int getIndexChosenByMenu (const int menuResultCode) const;
  12597. void sort (const SortMethod method);
  12598. XmlElement* createXml() const;
  12599. void recreateFromXml (const XmlElement& xml);
  12600. juce_UseDebuggingNewOperator
  12601. private:
  12602. OwnedArray <PluginDescription> types;
  12603. KnownPluginList (const KnownPluginList&);
  12604. const KnownPluginList& operator= (const KnownPluginList&);
  12605. };
  12606. #endif // __JUCE_KNOWNPLUGINLIST_JUCEHEADER__
  12607. /*** End of inlined file: juce_KnownPluginList.h ***/
  12608. #endif
  12609. #ifndef __JUCE_PLUGINDESCRIPTION_JUCEHEADER__
  12610. #endif
  12611. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12612. /*** Start of inlined file: juce_PluginDirectoryScanner.h ***/
  12613. #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12614. #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12615. class JUCE_API PluginDirectoryScanner
  12616. {
  12617. public:
  12618. PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
  12619. AudioPluginFormat& formatToLookFor,
  12620. FileSearchPath directoriesToSearch,
  12621. const bool searchRecursively,
  12622. const File& deadMansPedalFile);
  12623. ~PluginDirectoryScanner();
  12624. bool scanNextFile (const bool dontRescanIfAlreadyInList);
  12625. const String getNextPluginFileThatWillBeScanned() const throw();
  12626. float getProgress() const { return progress; }
  12627. const StringArray& getFailedFiles() const throw() { return failedFiles; }
  12628. juce_UseDebuggingNewOperator
  12629. private:
  12630. KnownPluginList& list;
  12631. AudioPluginFormat& format;
  12632. StringArray filesOrIdentifiersToScan;
  12633. File deadMansPedalFile;
  12634. StringArray failedFiles;
  12635. int nextIndex;
  12636. float progress;
  12637. const StringArray getDeadMansPedalFile() throw();
  12638. void setDeadMansPedalFile (const StringArray& newContents) throw();
  12639. PluginDirectoryScanner (const PluginDirectoryScanner&);
  12640. const PluginDirectoryScanner& operator= (const PluginDirectoryScanner&);
  12641. };
  12642. #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
  12643. /*** End of inlined file: juce_PluginDirectoryScanner.h ***/
  12644. #endif
  12645. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12646. /*** Start of inlined file: juce_PluginListComponent.h ***/
  12647. #ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12648. #define __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12649. /*** Start of inlined file: juce_ListBox.h ***/
  12650. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  12651. #define __JUCE_LISTBOX_JUCEHEADER__
  12652. class ListViewport;
  12653. class JUCE_API ListBoxModel
  12654. {
  12655. public:
  12656. virtual ~ListBoxModel() {}
  12657. virtual int getNumRows() = 0;
  12658. virtual void paintListBoxItem (int rowNumber,
  12659. Graphics& g,
  12660. int width, int height,
  12661. bool rowIsSelected) = 0;
  12662. virtual Component* refreshComponentForRow (int rowNumber, bool isRowSelected,
  12663. Component* existingComponentToUpdate);
  12664. virtual void listBoxItemClicked (int row, const MouseEvent& e);
  12665. virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e);
  12666. virtual void backgroundClicked();
  12667. virtual void selectedRowsChanged (int lastRowSelected);
  12668. virtual void deleteKeyPressed (int lastRowSelected);
  12669. virtual void returnKeyPressed (int lastRowSelected);
  12670. virtual void listWasScrolled();
  12671. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  12672. virtual const String getTooltipForRow (int row);
  12673. };
  12674. class JUCE_API ListBox : public Component,
  12675. public SettableTooltipClient
  12676. {
  12677. public:
  12678. ListBox (const String& componentName,
  12679. ListBoxModel* const model);
  12680. ~ListBox();
  12681. void setModel (ListBoxModel* const newModel);
  12682. ListBoxModel* getModel() const throw() { return model; }
  12683. void updateContent();
  12684. void setMultipleSelectionEnabled (bool shouldBeEnabled);
  12685. void setMouseMoveSelectsRows (bool shouldSelect);
  12686. void selectRow (const int rowNumber,
  12687. bool dontScrollToShowThisRow = false,
  12688. bool deselectOthersFirst = true);
  12689. void selectRangeOfRows (int firstRow,
  12690. int lastRow);
  12691. void deselectRow (const int rowNumber);
  12692. void deselectAllRows();
  12693. void flipRowSelection (const int rowNumber);
  12694. const SparseSet<int> getSelectedRows() const;
  12695. void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
  12696. const bool sendNotificationEventToModel = true);
  12697. bool isRowSelected (const int rowNumber) const;
  12698. int getNumSelectedRows() const;
  12699. int getSelectedRow (const int index = 0) const;
  12700. int getLastRowSelected() const;
  12701. void selectRowsBasedOnModifierKeys (const int rowThatWasClickedOn,
  12702. const ModifierKeys& modifiers);
  12703. void setVerticalPosition (const double newProportion);
  12704. double getVerticalPosition() const;
  12705. void scrollToEnsureRowIsOnscreen (const int row);
  12706. ScrollBar* getVerticalScrollBar() const throw();
  12707. ScrollBar* getHorizontalScrollBar() const throw();
  12708. int getRowContainingPosition (const int x, const int y) const throw();
  12709. int getInsertionIndexForPosition (const int x, const int y) const throw();
  12710. const Rectangle<int> getRowPosition (const int rowNumber,
  12711. const bool relativeToComponentTopLeft) const throw();
  12712. Component* getComponentForRowNumber (const int rowNumber) const throw();
  12713. int getRowNumberOfComponent (Component* const rowComponent) const throw();
  12714. int getVisibleRowWidth() const throw();
  12715. void setRowHeight (const int newHeight);
  12716. int getRowHeight() const throw() { return rowHeight; }
  12717. int getNumRowsOnScreen() const throw();
  12718. enum ColourIds
  12719. {
  12720. backgroundColourId = 0x1002800, /**< The background colour to fill the list with.
  12721. Make this transparent if you don't want the background to be filled. */
  12722. outlineColourId = 0x1002810, /**< An optional colour to use to draw a border around the list.
  12723. Make this transparent to not have an outline. */
  12724. textColourId = 0x1002820 /**< The preferred colour to use for drawing text in the listbox. */
  12725. };
  12726. void setOutlineThickness (const int outlineThickness);
  12727. int getOutlineThickness() const throw() { return outlineThickness; }
  12728. void setHeaderComponent (Component* const newHeaderComponent);
  12729. void setMinimumContentWidth (const int newMinimumWidth);
  12730. int getVisibleContentWidth() const throw();
  12731. void repaintRow (const int rowNumber) throw();
  12732. Image* createSnapshotOfSelectedRows (int& x, int& y);
  12733. Viewport* getViewport() const throw();
  12734. bool keyPressed (const KeyPress& key);
  12735. bool keyStateChanged (const bool isKeyDown);
  12736. void paint (Graphics& g);
  12737. void paintOverChildren (Graphics& g);
  12738. void resized();
  12739. void visibilityChanged();
  12740. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  12741. void mouseMove (const MouseEvent&);
  12742. void mouseExit (const MouseEvent&);
  12743. void mouseUp (const MouseEvent&);
  12744. void colourChanged();
  12745. void startDragAndDrop (const MouseEvent& e, const String& dragDescription);
  12746. juce_UseDebuggingNewOperator
  12747. private:
  12748. friend class ListViewport;
  12749. friend class TableListBox;
  12750. ListBoxModel* model;
  12751. ListViewport* viewport;
  12752. Component* headerComponent;
  12753. int totalItems, rowHeight, minimumRowWidth;
  12754. int outlineThickness;
  12755. int lastMouseX, lastMouseY, lastRowSelected;
  12756. bool mouseMoveSelects, multipleSelection, hasDoneInitialUpdate;
  12757. SparseSet <int> selected;
  12758. void selectRowInternal (const int rowNumber,
  12759. bool dontScrollToShowThisRow,
  12760. bool deselectOthersFirst,
  12761. bool isMouseClick);
  12762. ListBox (const ListBox&);
  12763. const ListBox& operator= (const ListBox&);
  12764. };
  12765. #endif // __JUCE_LISTBOX_JUCEHEADER__
  12766. /*** End of inlined file: juce_ListBox.h ***/
  12767. /*** Start of inlined file: juce_TextButton.h ***/
  12768. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  12769. #define __JUCE_TEXTBUTTON_JUCEHEADER__
  12770. class JUCE_API TextButton : public Button
  12771. {
  12772. public:
  12773. TextButton (const String& buttonName,
  12774. const String& toolTip = String::empty);
  12775. ~TextButton();
  12776. enum ColourIds
  12777. {
  12778. buttonColourId = 0x1000100, /**< The colour used to fill the button shape (when the button is toggled
  12779. 'off'). The look-and-feel class might re-interpret this to add
  12780. effects, etc. */
  12781. buttonOnColourId = 0x1000101, /**< The colour used to fill the button shape (when the button is toggled
  12782. 'on'). The look-and-feel class might re-interpret this to add
  12783. effects, etc. */
  12784. textColourOffId = 0x1000102, /**< The colour to use for the button's text when the button's toggle state is "off". */
  12785. textColourOnId = 0x1000103 /**< The colour to use for the button's text.when the button's toggle state is "on". */
  12786. };
  12787. void changeWidthToFitText (const int newHeight = -1);
  12788. virtual const Font getFont();
  12789. juce_UseDebuggingNewOperator
  12790. protected:
  12791. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  12792. void colourChanged();
  12793. private:
  12794. TextButton (const TextButton&);
  12795. const TextButton& operator= (const TextButton&);
  12796. };
  12797. #endif // __JUCE_TEXTBUTTON_JUCEHEADER__
  12798. /*** End of inlined file: juce_TextButton.h ***/
  12799. class JUCE_API PluginListComponent : public Component,
  12800. public ListBoxModel,
  12801. public ChangeListener,
  12802. public ButtonListener,
  12803. public Timer
  12804. {
  12805. public:
  12806. PluginListComponent (KnownPluginList& listToRepresent,
  12807. const File& deadMansPedalFile,
  12808. PropertiesFile* const propertiesToUse);
  12809. ~PluginListComponent();
  12810. void resized();
  12811. bool isInterestedInFileDrag (const StringArray& files);
  12812. void filesDropped (const StringArray& files, int, int);
  12813. int getNumRows();
  12814. void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected);
  12815. void deleteKeyPressed (int lastRowSelected);
  12816. void buttonClicked (Button* b);
  12817. void changeListenerCallback (void*);
  12818. void timerCallback();
  12819. juce_UseDebuggingNewOperator
  12820. private:
  12821. KnownPluginList& list;
  12822. File deadMansPedalFile;
  12823. ListBox* listBox;
  12824. TextButton* optionsButton;
  12825. PropertiesFile* propertiesToUse;
  12826. int typeToScan;
  12827. void scanFor (AudioPluginFormat* format);
  12828. PluginListComponent (const PluginListComponent&);
  12829. const PluginListComponent& operator= (const PluginListComponent&);
  12830. };
  12831. #endif // __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__
  12832. /*** End of inlined file: juce_PluginListComponent.h ***/
  12833. #endif
  12834. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  12835. #endif
  12836. #ifndef __JUCE_AUDIOPROCESSOR_JUCEHEADER__
  12837. #endif
  12838. #ifndef __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
  12839. #endif
  12840. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12841. /*** Start of inlined file: juce_AudioProcessorGraph.h ***/
  12842. #ifndef __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12843. #define __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  12844. class JUCE_API AudioProcessorGraph : public AudioProcessor,
  12845. public AsyncUpdater
  12846. {
  12847. public:
  12848. AudioProcessorGraph();
  12849. ~AudioProcessorGraph();
  12850. class JUCE_API Node : public ReferenceCountedObject
  12851. {
  12852. public:
  12853. ~Node();
  12854. const uint32 id;
  12855. AudioProcessor* const processor;
  12856. NamedValueSet properties;
  12857. typedef ReferenceCountedObjectPtr <Node> Ptr;
  12858. juce_UseDebuggingNewOperator
  12859. private:
  12860. friend class AudioProcessorGraph;
  12861. bool isPrepared;
  12862. Node (const uint32 id, AudioProcessor* const processor);
  12863. void prepare (const double sampleRate, const int blockSize, AudioProcessorGraph* const graph);
  12864. void unprepare();
  12865. Node (const Node&);
  12866. const Node& operator= (const Node&);
  12867. };
  12868. struct JUCE_API Connection
  12869. {
  12870. public:
  12871. uint32 sourceNodeId;
  12872. int sourceChannelIndex;
  12873. uint32 destNodeId;
  12874. int destChannelIndex;
  12875. juce_UseDebuggingNewOperator
  12876. private:
  12877. };
  12878. void clear();
  12879. int getNumNodes() const { return nodes.size(); }
  12880. Node* getNode (const int index) const { return nodes [index]; }
  12881. Node* getNodeForId (const uint32 nodeId) const;
  12882. Node* addNode (AudioProcessor* const newProcessor,
  12883. uint32 nodeId = 0);
  12884. bool removeNode (const uint32 nodeId);
  12885. int getNumConnections() const { return connections.size(); }
  12886. const Connection* getConnection (const int index) const { return connections [index]; }
  12887. const Connection* getConnectionBetween (const uint32 sourceNodeId,
  12888. const int sourceChannelIndex,
  12889. const uint32 destNodeId,
  12890. const int destChannelIndex) const;
  12891. bool isConnected (const uint32 possibleSourceNodeId,
  12892. const uint32 possibleDestNodeId) const;
  12893. bool canConnect (const uint32 sourceNodeId, const int sourceChannelIndex,
  12894. const uint32 destNodeId, const int destChannelIndex) const;
  12895. bool addConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12896. const uint32 destNodeId, const int destChannelIndex);
  12897. void removeConnection (const int index);
  12898. bool removeConnection (const uint32 sourceNodeId, const int sourceChannelIndex,
  12899. const uint32 destNodeId, const int destChannelIndex);
  12900. bool disconnectNode (const uint32 nodeId);
  12901. bool removeIllegalConnections();
  12902. static const int midiChannelIndex;
  12903. class JUCE_API AudioGraphIOProcessor : public AudioPluginInstance
  12904. {
  12905. public:
  12906. enum IODeviceType
  12907. {
  12908. audioInputNode, /**< In this mode, the processor has output channels
  12909. representing all the audio input channels that are
  12910. coming into its parent audio graph. */
  12911. audioOutputNode, /**< In this mode, the processor has input channels
  12912. representing all the audio output channels that are
  12913. going out of its parent audio graph. */
  12914. midiInputNode, /**< In this mode, the processor has a midi output which
  12915. delivers the same midi data that is arriving at its
  12916. parent graph. */
  12917. midiOutputNode /**< In this mode, the processor has a midi input and
  12918. any data sent to it will be passed out of the parent
  12919. graph. */
  12920. };
  12921. IODeviceType getType() const { return type; }
  12922. AudioProcessorGraph* getParentGraph() const { return graph; }
  12923. bool isInput() const;
  12924. bool isOutput() const;
  12925. AudioGraphIOProcessor (const IODeviceType type);
  12926. ~AudioGraphIOProcessor();
  12927. const String getName() const;
  12928. void fillInPluginDescription (PluginDescription& d) const;
  12929. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12930. void releaseResources();
  12931. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12932. const String getInputChannelName (const int channelIndex) const;
  12933. const String getOutputChannelName (const int channelIndex) const;
  12934. bool isInputChannelStereoPair (int index) const;
  12935. bool isOutputChannelStereoPair (int index) const;
  12936. bool acceptsMidi() const;
  12937. bool producesMidi() const;
  12938. AudioProcessorEditor* createEditor();
  12939. int getNumParameters();
  12940. const String getParameterName (int);
  12941. float getParameter (int);
  12942. const String getParameterText (int);
  12943. void setParameter (int, float);
  12944. int getNumPrograms();
  12945. int getCurrentProgram();
  12946. void setCurrentProgram (int);
  12947. const String getProgramName (int);
  12948. void changeProgramName (int, const String&);
  12949. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12950. void setStateInformation (const void* data, int sizeInBytes);
  12951. void setParentGraph (AudioProcessorGraph* const graph);
  12952. juce_UseDebuggingNewOperator
  12953. private:
  12954. const IODeviceType type;
  12955. AudioProcessorGraph* graph;
  12956. AudioGraphIOProcessor (const AudioGraphIOProcessor&);
  12957. const AudioGraphIOProcessor& operator= (const AudioGraphIOProcessor&);
  12958. };
  12959. // AudioProcessor methods:
  12960. const String getName() const;
  12961. void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
  12962. void releaseResources();
  12963. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
  12964. const String getInputChannelName (const int channelIndex) const;
  12965. const String getOutputChannelName (const int channelIndex) const;
  12966. bool isInputChannelStereoPair (int index) const;
  12967. bool isOutputChannelStereoPair (int index) const;
  12968. bool acceptsMidi() const;
  12969. bool producesMidi() const;
  12970. AudioProcessorEditor* createEditor() { return 0; }
  12971. int getNumParameters() { return 0; }
  12972. const String getParameterName (int) { return String::empty; }
  12973. float getParameter (int) { return 0; }
  12974. const String getParameterText (int) { return String::empty; }
  12975. void setParameter (int, float) { }
  12976. int getNumPrograms() { return 0; }
  12977. int getCurrentProgram() { return 0; }
  12978. void setCurrentProgram (int) { }
  12979. const String getProgramName (int) { return String::empty; }
  12980. void changeProgramName (int, const String&) { }
  12981. void getStateInformation (JUCE_NAMESPACE::MemoryBlock& destData);
  12982. void setStateInformation (const void* data, int sizeInBytes);
  12983. void handleAsyncUpdate();
  12984. juce_UseDebuggingNewOperator
  12985. private:
  12986. ReferenceCountedArray <Node> nodes;
  12987. OwnedArray <Connection> connections;
  12988. int lastNodeId;
  12989. AudioSampleBuffer renderingBuffers;
  12990. OwnedArray <MidiBuffer> midiBuffers;
  12991. CriticalSection renderLock;
  12992. VoidArray renderingOps;
  12993. friend class AudioGraphIOProcessor;
  12994. AudioSampleBuffer* currentAudioInputBuffer;
  12995. AudioSampleBuffer currentAudioOutputBuffer;
  12996. MidiBuffer* currentMidiInputBuffer;
  12997. MidiBuffer currentMidiOutputBuffer;
  12998. void clearRenderingSequence();
  12999. void buildRenderingSequence();
  13000. bool isAnInputTo (const uint32 possibleInputId,
  13001. const uint32 possibleDestinationId,
  13002. const int recursionCheck) const;
  13003. AudioProcessorGraph (const AudioProcessorGraph&);
  13004. const AudioProcessorGraph& operator= (const AudioProcessorGraph&);
  13005. };
  13006. #endif // __JUCE_AUDIOPROCESSORGRAPH_JUCEHEADER__
  13007. /*** End of inlined file: juce_AudioProcessorGraph.h ***/
  13008. #endif
  13009. #ifndef __JUCE_AUDIOPROCESSORLISTENER_JUCEHEADER__
  13010. #endif
  13011. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13012. /*** Start of inlined file: juce_AudioProcessorPlayer.h ***/
  13013. #ifndef __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13014. #define __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13015. class JUCE_API AudioProcessorPlayer : public AudioIODeviceCallback,
  13016. public MidiInputCallback
  13017. {
  13018. public:
  13019. AudioProcessorPlayer();
  13020. virtual ~AudioProcessorPlayer();
  13021. void setProcessor (AudioProcessor* const processorToPlay);
  13022. AudioProcessor* getCurrentProcessor() const { return processor; }
  13023. MidiMessageCollector& getMidiMessageCollector() { return messageCollector; }
  13024. void audioDeviceIOCallback (const float** inputChannelData,
  13025. int totalNumInputChannels,
  13026. float** outputChannelData,
  13027. int totalNumOutputChannels,
  13028. int numSamples);
  13029. void audioDeviceAboutToStart (AudioIODevice* device);
  13030. void audioDeviceStopped();
  13031. void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
  13032. juce_UseDebuggingNewOperator
  13033. private:
  13034. AudioProcessor* processor;
  13035. CriticalSection lock;
  13036. double sampleRate;
  13037. int blockSize;
  13038. bool isPrepared;
  13039. int numInputChans, numOutputChans;
  13040. float* channels [128];
  13041. AudioSampleBuffer tempBuffer;
  13042. MidiBuffer incomingMidi;
  13043. MidiMessageCollector messageCollector;
  13044. AudioProcessorPlayer (const AudioProcessorPlayer&);
  13045. const AudioProcessorPlayer& operator= (const AudioProcessorPlayer&);
  13046. };
  13047. #endif // __JUCE_AUDIOPROCESSORPLAYER_JUCEHEADER__
  13048. /*** End of inlined file: juce_AudioProcessorPlayer.h ***/
  13049. #endif
  13050. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13051. /*** Start of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13052. #ifndef __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13053. #define __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13054. /*** Start of inlined file: juce_PropertyPanel.h ***/
  13055. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  13056. #define __JUCE_PROPERTYPANEL_JUCEHEADER__
  13057. /*** Start of inlined file: juce_PropertyComponent.h ***/
  13058. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13059. #define __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13060. class EditableProperty;
  13061. class JUCE_API PropertyComponent : public Component,
  13062. public SettableTooltipClient
  13063. {
  13064. public:
  13065. PropertyComponent (const String& propertyName,
  13066. const int preferredHeight = 25);
  13067. ~PropertyComponent();
  13068. int getPreferredHeight() const throw() { return preferredHeight; }
  13069. void setPreferredHeight (int newHeight) throw() { preferredHeight = newHeight; }
  13070. virtual void refresh() = 0;
  13071. void paint (Graphics& g);
  13072. void resized();
  13073. void enablementChanged();
  13074. juce_UseDebuggingNewOperator
  13075. protected:
  13076. int preferredHeight;
  13077. };
  13078. #endif // __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  13079. /*** End of inlined file: juce_PropertyComponent.h ***/
  13080. class JUCE_API PropertyPanel : public Component
  13081. {
  13082. public:
  13083. PropertyPanel();
  13084. ~PropertyPanel();
  13085. void clear();
  13086. void addProperties (const Array <PropertyComponent*>& newPropertyComponents);
  13087. void addSection (const String& sectionTitle,
  13088. const Array <PropertyComponent*>& newPropertyComponents,
  13089. const bool shouldSectionInitiallyBeOpen = true);
  13090. void refreshAll() const;
  13091. const StringArray getSectionNames() const;
  13092. bool isSectionOpen (const int sectionIndex) const;
  13093. void setSectionOpen (const int sectionIndex, const bool shouldBeOpen);
  13094. void setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled);
  13095. XmlElement* getOpennessState() const;
  13096. void restoreOpennessState (const XmlElement& newState);
  13097. void setMessageWhenEmpty (const String& newMessage);
  13098. const String& getMessageWhenEmpty() const;
  13099. void paint (Graphics& g);
  13100. void resized();
  13101. juce_UseDebuggingNewOperator
  13102. private:
  13103. Viewport* viewport;
  13104. Component* propertyHolderComponent;
  13105. String messageWhenEmpty;
  13106. void updatePropHolderLayout() const;
  13107. void updatePropHolderLayout (const int width) const;
  13108. };
  13109. #endif // __JUCE_PROPERTYPANEL_JUCEHEADER__
  13110. /*** End of inlined file: juce_PropertyPanel.h ***/
  13111. class JUCE_API GenericAudioProcessorEditor : public AudioProcessorEditor
  13112. {
  13113. public:
  13114. GenericAudioProcessorEditor (AudioProcessor* const owner);
  13115. ~GenericAudioProcessorEditor();
  13116. void paint (Graphics& g);
  13117. void resized();
  13118. juce_UseDebuggingNewOperator
  13119. private:
  13120. PropertyPanel* panel;
  13121. GenericAudioProcessorEditor (const GenericAudioProcessorEditor&);
  13122. const GenericAudioProcessorEditor& operator= (const GenericAudioProcessorEditor&);
  13123. };
  13124. #endif // __JUCE_GENERICAUDIOPROCESSOREDITOR_JUCEHEADER__
  13125. /*** End of inlined file: juce_GenericAudioProcessorEditor.h ***/
  13126. #endif
  13127. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13128. /*** Start of inlined file: juce_Sampler.h ***/
  13129. #ifndef __JUCE_SAMPLER_JUCEHEADER__
  13130. #define __JUCE_SAMPLER_JUCEHEADER__
  13131. /*** Start of inlined file: juce_Synthesiser.h ***/
  13132. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13133. #define __JUCE_SYNTHESISER_JUCEHEADER__
  13134. class JUCE_API SynthesiserSound : public ReferenceCountedObject
  13135. {
  13136. protected:
  13137. SynthesiserSound();
  13138. public:
  13139. virtual ~SynthesiserSound();
  13140. virtual bool appliesToNote (const int midiNoteNumber) = 0;
  13141. virtual bool appliesToChannel (const int midiChannel) = 0;
  13142. typedef ReferenceCountedObjectPtr <SynthesiserSound> Ptr;
  13143. juce_UseDebuggingNewOperator
  13144. };
  13145. class JUCE_API SynthesiserVoice
  13146. {
  13147. public:
  13148. SynthesiserVoice();
  13149. virtual ~SynthesiserVoice();
  13150. int getCurrentlyPlayingNote() const { return currentlyPlayingNote; }
  13151. const SynthesiserSound::Ptr getCurrentlyPlayingSound() const { return currentlyPlayingSound; }
  13152. virtual bool canPlaySound (SynthesiserSound* sound) = 0;
  13153. virtual void startNote (const int midiNoteNumber,
  13154. const float velocity,
  13155. SynthesiserSound* sound,
  13156. const int currentPitchWheelPosition) = 0;
  13157. virtual void stopNote (const bool allowTailOff) = 0;
  13158. virtual void pitchWheelMoved (const int newValue) = 0;
  13159. virtual void controllerMoved (const int controllerNumber,
  13160. const int newValue) = 0;
  13161. virtual void renderNextBlock (AudioSampleBuffer& outputBuffer,
  13162. int startSample,
  13163. int numSamples) = 0;
  13164. bool isPlayingChannel (const int midiChannel) const;
  13165. void setCurrentPlaybackSampleRate (const double newRate);
  13166. juce_UseDebuggingNewOperator
  13167. protected:
  13168. double getSampleRate() const { return currentSampleRate; }
  13169. void clearCurrentNote();
  13170. private:
  13171. friend class Synthesiser;
  13172. double currentSampleRate;
  13173. int currentlyPlayingNote;
  13174. uint32 noteOnTime;
  13175. SynthesiserSound::Ptr currentlyPlayingSound;
  13176. };
  13177. class JUCE_API Synthesiser
  13178. {
  13179. public:
  13180. Synthesiser();
  13181. virtual ~Synthesiser();
  13182. void clearVoices();
  13183. int getNumVoices() const { return voices.size(); }
  13184. SynthesiserVoice* getVoice (const int index) const;
  13185. void addVoice (SynthesiserVoice* const newVoice);
  13186. void removeVoice (const int index);
  13187. void clearSounds();
  13188. int getNumSounds() const { return sounds.size(); }
  13189. SynthesiserSound* getSound (const int index) const { return sounds [index]; }
  13190. void addSound (const SynthesiserSound::Ptr& newSound);
  13191. void removeSound (const int index);
  13192. void setNoteStealingEnabled (const bool shouldStealNotes);
  13193. bool isNoteStealingEnabled() const { return shouldStealNotes; }
  13194. virtual void noteOn (const int midiChannel,
  13195. const int midiNoteNumber,
  13196. const float velocity);
  13197. virtual void noteOff (const int midiChannel,
  13198. const int midiNoteNumber,
  13199. const bool allowTailOff);
  13200. virtual void allNotesOff (const int midiChannel,
  13201. const bool allowTailOff);
  13202. virtual void handlePitchWheel (const int midiChannel,
  13203. const int wheelValue);
  13204. virtual void handleController (const int midiChannel,
  13205. const int controllerNumber,
  13206. const int controllerValue);
  13207. void setCurrentPlaybackSampleRate (const double sampleRate);
  13208. void renderNextBlock (AudioSampleBuffer& outputAudio,
  13209. const MidiBuffer& inputMidi,
  13210. int startSample,
  13211. int numSamples);
  13212. juce_UseDebuggingNewOperator
  13213. protected:
  13214. CriticalSection lock;
  13215. OwnedArray <SynthesiserVoice> voices;
  13216. ReferenceCountedArray <SynthesiserSound> sounds;
  13217. int lastPitchWheelValues [16];
  13218. virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay,
  13219. const bool stealIfNoneAvailable) const;
  13220. void startVoice (SynthesiserVoice* const voice,
  13221. SynthesiserSound* const sound,
  13222. const int midiChannel,
  13223. const int midiNoteNumber,
  13224. const float velocity);
  13225. int findFreeVoice (const bool) const { return 0; }
  13226. private:
  13227. double sampleRate;
  13228. uint32 lastNoteOnCounter;
  13229. bool shouldStealNotes;
  13230. Synthesiser (const Synthesiser&);
  13231. const Synthesiser& operator= (const Synthesiser&);
  13232. };
  13233. #endif // __JUCE_SYNTHESISER_JUCEHEADER__
  13234. /*** End of inlined file: juce_Synthesiser.h ***/
  13235. class JUCE_API SamplerSound : public SynthesiserSound
  13236. {
  13237. public:
  13238. SamplerSound (const String& name,
  13239. AudioFormatReader& source,
  13240. const BitArray& midiNotes,
  13241. const int midiNoteForNormalPitch,
  13242. const double attackTimeSecs,
  13243. const double releaseTimeSecs,
  13244. const double maxSampleLengthSeconds);
  13245. ~SamplerSound();
  13246. const String& getName() const { return name; }
  13247. AudioSampleBuffer* getAudioData() const { return data; }
  13248. bool appliesToNote (const int midiNoteNumber);
  13249. bool appliesToChannel (const int midiChannel);
  13250. juce_UseDebuggingNewOperator
  13251. private:
  13252. friend class SamplerVoice;
  13253. String name;
  13254. ScopedPointer <AudioSampleBuffer> data;
  13255. double sourceSampleRate;
  13256. BitArray midiNotes;
  13257. int length, attackSamples, releaseSamples;
  13258. int midiRootNote;
  13259. };
  13260. class JUCE_API SamplerVoice : public SynthesiserVoice
  13261. {
  13262. public:
  13263. SamplerVoice();
  13264. ~SamplerVoice();
  13265. bool canPlaySound (SynthesiserSound* sound);
  13266. void startNote (const int midiNoteNumber,
  13267. const float velocity,
  13268. SynthesiserSound* sound,
  13269. const int currentPitchWheelPosition);
  13270. void stopNote (const bool allowTailOff);
  13271. void pitchWheelMoved (const int newValue);
  13272. void controllerMoved (const int controllerNumber,
  13273. const int newValue);
  13274. void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
  13275. juce_UseDebuggingNewOperator
  13276. private:
  13277. double pitchRatio;
  13278. double sourceSamplePosition;
  13279. float lgain, rgain, attackReleaseLevel, attackDelta, releaseDelta;
  13280. bool isInAttack, isInRelease;
  13281. };
  13282. #endif // __JUCE_SAMPLER_JUCEHEADER__
  13283. /*** End of inlined file: juce_Sampler.h ***/
  13284. #endif
  13285. #ifndef __JUCE_SYNTHESISER_JUCEHEADER__
  13286. #endif
  13287. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13288. /*** Start of inlined file: juce_ActionBroadcaster.h ***/
  13289. #ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13290. #define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13291. /*** Start of inlined file: juce_ActionListenerList.h ***/
  13292. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13293. #define __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13294. class JUCE_API ActionListenerList : public MessageListener
  13295. {
  13296. public:
  13297. ActionListenerList() throw();
  13298. ~ActionListenerList() throw();
  13299. void addActionListener (ActionListener* const listener) throw();
  13300. void removeActionListener (ActionListener* const listener) throw();
  13301. void removeAllActionListeners() throw();
  13302. void sendActionMessage (const String& message) const;
  13303. void handleMessage (const Message&);
  13304. juce_UseDebuggingNewOperator
  13305. private:
  13306. SortedSet <void*> actionListeners_;
  13307. CriticalSection actionListenerLock_;
  13308. ActionListenerList (const ActionListenerList&);
  13309. const ActionListenerList& operator= (const ActionListenerList&);
  13310. };
  13311. #endif // __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13312. /*** End of inlined file: juce_ActionListenerList.h ***/
  13313. class JUCE_API ActionBroadcaster
  13314. {
  13315. public:
  13316. ActionBroadcaster() throw();
  13317. virtual ~ActionBroadcaster();
  13318. void addActionListener (ActionListener* const listener);
  13319. void removeActionListener (ActionListener* const listener);
  13320. void removeAllActionListeners();
  13321. void sendActionMessage (const String& message) const;
  13322. private:
  13323. ActionListenerList actionListenerList;
  13324. ActionBroadcaster (const ActionBroadcaster&);
  13325. const ActionBroadcaster& operator= (const ActionBroadcaster&);
  13326. };
  13327. #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
  13328. /*** End of inlined file: juce_ActionBroadcaster.h ***/
  13329. #endif
  13330. #ifndef __JUCE_ACTIONLISTENER_JUCEHEADER__
  13331. #endif
  13332. #ifndef __JUCE_ACTIONLISTENERLIST_JUCEHEADER__
  13333. #endif
  13334. #ifndef __JUCE_ASYNCUPDATER_JUCEHEADER__
  13335. #endif
  13336. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13337. /*** Start of inlined file: juce_CallbackMessage.h ***/
  13338. #ifndef __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13339. #define __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13340. class JUCE_API CallbackMessage : public Message
  13341. {
  13342. public:
  13343. CallbackMessage() throw();
  13344. ~CallbackMessage() throw();
  13345. virtual void messageCallback() = 0;
  13346. void post();
  13347. juce_UseDebuggingNewOperator
  13348. private:
  13349. CallbackMessage (const CallbackMessage&);
  13350. const CallbackMessage& operator= (const CallbackMessage&);
  13351. };
  13352. #endif // __JUCE_CALLBACKMESSAGE_JUCEHEADER__
  13353. /*** End of inlined file: juce_CallbackMessage.h ***/
  13354. #endif
  13355. #ifndef __JUCE_CHANGEBROADCASTER_JUCEHEADER__
  13356. #endif
  13357. #ifndef __JUCE_CHANGELISTENER_JUCEHEADER__
  13358. #endif
  13359. #ifndef __JUCE_CHANGELISTENERLIST_JUCEHEADER__
  13360. #endif
  13361. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13362. /*** Start of inlined file: juce_InterprocessConnection.h ***/
  13363. #ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13364. #define __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13365. class InterprocessConnectionServer;
  13366. class JUCE_API InterprocessConnection : public Thread,
  13367. private MessageListener
  13368. {
  13369. public:
  13370. InterprocessConnection (const bool callbacksOnMessageThread = true,
  13371. const uint32 magicMessageHeaderNumber = 0xf2b49e2c);
  13372. ~InterprocessConnection();
  13373. bool connectToSocket (const String& hostName,
  13374. const int portNumber,
  13375. const int timeOutMillisecs);
  13376. bool connectToPipe (const String& pipeName,
  13377. const int pipeReceiveMessageTimeoutMs = -1);
  13378. bool createPipe (const String& pipeName,
  13379. const int pipeReceiveMessageTimeoutMs = -1);
  13380. void disconnect();
  13381. bool isConnected() const;
  13382. StreamingSocket* getSocket() const throw() { return socket; }
  13383. NamedPipe* getPipe() const throw() { return pipe; }
  13384. const String getConnectedHostName() const;
  13385. bool sendMessage (const MemoryBlock& message);
  13386. virtual void connectionMade() = 0;
  13387. virtual void connectionLost() = 0;
  13388. virtual void messageReceived (const MemoryBlock& message) = 0;
  13389. juce_UseDebuggingNewOperator
  13390. private:
  13391. CriticalSection pipeAndSocketLock;
  13392. ScopedPointer <StreamingSocket> socket;
  13393. ScopedPointer <NamedPipe> pipe;
  13394. bool callbackConnectionState;
  13395. const bool useMessageThread;
  13396. const uint32 magicMessageHeader;
  13397. int pipeReceiveMessageTimeout;
  13398. friend class InterprocessConnectionServer;
  13399. void initialiseWithSocket (StreamingSocket* const socket_);
  13400. void initialiseWithPipe (NamedPipe* const pipe_);
  13401. void handleMessage (const Message& message);
  13402. void connectionMadeInt();
  13403. void connectionLostInt();
  13404. void deliverDataInt (const MemoryBlock& data);
  13405. bool readNextMessageInt();
  13406. void run();
  13407. InterprocessConnection (const InterprocessConnection&);
  13408. const InterprocessConnection& operator= (const InterprocessConnection&);
  13409. };
  13410. #endif // __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__
  13411. /*** End of inlined file: juce_InterprocessConnection.h ***/
  13412. #endif
  13413. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13414. /*** Start of inlined file: juce_InterprocessConnectionServer.h ***/
  13415. #ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13416. #define __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13417. class JUCE_API InterprocessConnectionServer : private Thread
  13418. {
  13419. public:
  13420. InterprocessConnectionServer();
  13421. ~InterprocessConnectionServer();
  13422. bool beginWaitingForSocket (const int portNumber);
  13423. void stop();
  13424. protected:
  13425. virtual InterprocessConnection* createConnectionObject() = 0;
  13426. public:
  13427. juce_UseDebuggingNewOperator
  13428. private:
  13429. ScopedPointer <StreamingSocket> socket;
  13430. void run();
  13431. InterprocessConnectionServer (const InterprocessConnectionServer&);
  13432. const InterprocessConnectionServer& operator= (const InterprocessConnectionServer&);
  13433. };
  13434. #endif // __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__
  13435. /*** End of inlined file: juce_InterprocessConnectionServer.h ***/
  13436. #endif
  13437. #ifndef __JUCE_MESSAGE_JUCEHEADER__
  13438. #endif
  13439. #ifndef __JUCE_MESSAGELISTENER_JUCEHEADER__
  13440. #endif
  13441. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13442. /*** Start of inlined file: juce_MessageManager.h ***/
  13443. #ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13444. #define __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13445. class Component;
  13446. class MessageManagerLock;
  13447. typedef void* (MessageCallbackFunction) (void* userData);
  13448. class JUCE_API MessageManager
  13449. {
  13450. public:
  13451. static MessageManager* getInstance() throw();
  13452. void runDispatchLoop();
  13453. void stopDispatchLoop();
  13454. bool hasStopMessageBeenSent() const throw() { return quitMessagePosted; }
  13455. bool runDispatchLoopUntil (int millisecondsToRunFor);
  13456. void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
  13457. void* userData);
  13458. bool isThisTheMessageThread() const throw();
  13459. void setCurrentMessageThread (const Thread::ThreadID threadId) throw();
  13460. Thread::ThreadID getCurrentMessageThread() const throw() { return messageThreadId; }
  13461. bool currentThreadHasLockedMessageManager() const throw();
  13462. static void broadcastMessage (const String& messageText) throw();
  13463. void registerBroadcastListener (ActionListener* listener) throw();
  13464. void deregisterBroadcastListener (ActionListener* listener) throw();
  13465. void deliverMessage (void*);
  13466. void deliverBroadcastMessage (const String&);
  13467. ~MessageManager() throw();
  13468. juce_UseDebuggingNewOperator
  13469. private:
  13470. MessageManager() throw();
  13471. friend class MessageListener;
  13472. friend class ChangeBroadcaster;
  13473. friend class ActionBroadcaster;
  13474. friend class CallbackMessage;
  13475. static MessageManager* instance;
  13476. SortedSet <const MessageListener*> messageListeners;
  13477. ScopedPointer <ActionListenerList> broadcastListeners;
  13478. friend class JUCEApplication;
  13479. bool quitMessagePosted, quitMessageReceived;
  13480. Thread::ThreadID messageThreadId;
  13481. VoidArray modalComponents;
  13482. static void* exitModalLoopCallback (void*);
  13483. void postMessageToQueue (Message* const message);
  13484. void postCallbackMessage (Message* const message);
  13485. static void doPlatformSpecificInitialisation();
  13486. static void doPlatformSpecificShutdown();
  13487. friend class MessageManagerLock;
  13488. Thread::ThreadID volatile threadWithLock;
  13489. CriticalSection lockingLock;
  13490. MessageManager (const MessageManager&);
  13491. const MessageManager& operator= (const MessageManager&);
  13492. };
  13493. class JUCE_API MessageManagerLock
  13494. {
  13495. public:
  13496. MessageManagerLock (Thread* const threadToCheckForExitSignal = 0) throw();
  13497. MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal) throw();
  13498. ~MessageManagerLock() throw();
  13499. bool lockWasGained() const throw() { return locked; }
  13500. private:
  13501. bool locked, needsUnlocking;
  13502. void* sharedEvents;
  13503. void init (Thread* const thread, ThreadPoolJob* const job) throw();
  13504. MessageManagerLock (const MessageManagerLock&);
  13505. const MessageManagerLock& operator= (const MessageManagerLock&);
  13506. };
  13507. #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__
  13508. /*** End of inlined file: juce_MessageManager.h ***/
  13509. #endif
  13510. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13511. /*** Start of inlined file: juce_MultiTimer.h ***/
  13512. #ifndef __JUCE_MULTITIMER_JUCEHEADER__
  13513. #define __JUCE_MULTITIMER_JUCEHEADER__
  13514. class JUCE_API MultiTimer
  13515. {
  13516. protected:
  13517. MultiTimer() throw();
  13518. MultiTimer (const MultiTimer& other) throw();
  13519. public:
  13520. virtual ~MultiTimer();
  13521. virtual void timerCallback (const int timerId) = 0;
  13522. void startTimer (const int timerId, const int intervalInMilliseconds) throw();
  13523. void stopTimer (const int timerId) throw();
  13524. bool isTimerRunning (const int timerId) const throw();
  13525. int getTimerInterval (const int timerId) const throw();
  13526. private:
  13527. class MultiTimerCallback;
  13528. CriticalSection timerListLock;
  13529. OwnedArray <MultiTimerCallback> timers;
  13530. const MultiTimer& operator= (const MultiTimer&);
  13531. };
  13532. #endif // __JUCE_MULTITIMER_JUCEHEADER__
  13533. /*** End of inlined file: juce_MultiTimer.h ***/
  13534. #endif
  13535. #ifndef __JUCE_TIMER_JUCEHEADER__
  13536. #endif
  13537. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13538. /*** Start of inlined file: juce_ArrowButton.h ***/
  13539. #ifndef __JUCE_ARROWBUTTON_JUCEHEADER__
  13540. #define __JUCE_ARROWBUTTON_JUCEHEADER__
  13541. /*** Start of inlined file: juce_DropShadowEffect.h ***/
  13542. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13543. #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13544. class JUCE_API DropShadowEffect : public ImageEffectFilter
  13545. {
  13546. public:
  13547. DropShadowEffect();
  13548. ~DropShadowEffect();
  13549. void setShadowProperties (const float newRadius,
  13550. const float newOpacity,
  13551. const int newShadowOffsetX,
  13552. const int newShadowOffsetY);
  13553. void applyEffect (Image& sourceImage, Graphics& destContext);
  13554. juce_UseDebuggingNewOperator
  13555. private:
  13556. int offsetX, offsetY;
  13557. float radius, opacity;
  13558. };
  13559. #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  13560. /*** End of inlined file: juce_DropShadowEffect.h ***/
  13561. class JUCE_API ArrowButton : public Button
  13562. {
  13563. public:
  13564. ArrowButton (const String& buttonName,
  13565. float arrowDirection,
  13566. const Colour& arrowColour);
  13567. ~ArrowButton();
  13568. juce_UseDebuggingNewOperator
  13569. protected:
  13570. void paintButton (Graphics& g,
  13571. bool isMouseOverButton,
  13572. bool isButtonDown);
  13573. void buttonStateChanged();
  13574. private:
  13575. Colour colour;
  13576. DropShadowEffect shadow;
  13577. Path path;
  13578. int offset;
  13579. ArrowButton (const ArrowButton&);
  13580. const ArrowButton& operator= (const ArrowButton&);
  13581. };
  13582. #endif // __JUCE_ARROWBUTTON_JUCEHEADER__
  13583. /*** End of inlined file: juce_ArrowButton.h ***/
  13584. #endif
  13585. #ifndef __JUCE_BUTTON_JUCEHEADER__
  13586. #endif
  13587. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13588. /*** Start of inlined file: juce_DrawableButton.h ***/
  13589. #ifndef __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13590. #define __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13591. /*** Start of inlined file: juce_Drawable.h ***/
  13592. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  13593. #define __JUCE_DRAWABLE_JUCEHEADER__
  13594. class JUCE_API Drawable
  13595. {
  13596. protected:
  13597. Drawable();
  13598. public:
  13599. virtual ~Drawable();
  13600. virtual Drawable* createCopy() const = 0;
  13601. void draw (Graphics& g, const float opacity,
  13602. const AffineTransform& transform = AffineTransform::identity) const;
  13603. void drawAt (Graphics& g,
  13604. const float x,
  13605. const float y,
  13606. const float opacity) const;
  13607. void drawWithin (Graphics& g,
  13608. const int destX,
  13609. const int destY,
  13610. const int destWidth,
  13611. const int destHeight,
  13612. const RectanglePlacement& placement,
  13613. const float opacity) const;
  13614. class RenderingContext
  13615. {
  13616. public:
  13617. RenderingContext (Graphics& g, const AffineTransform& transform, const float opacity) throw();
  13618. Graphics& g;
  13619. AffineTransform transform;
  13620. float opacity;
  13621. private:
  13622. const RenderingContext& operator= (const RenderingContext&);
  13623. };
  13624. virtual void render (const RenderingContext& context) const = 0;
  13625. virtual const Rectangle<float> getBounds() const = 0;
  13626. virtual bool hitTest (float x, float y) const = 0;
  13627. const String& getName() const throw() { return name; }
  13628. void setName (const String& newName) throw() { name = newName; }
  13629. static Drawable* createFromImageData (const void* data, const size_t numBytes);
  13630. static Drawable* createFromImageDataStream (InputStream& dataSource);
  13631. static Drawable* createFromImageFile (const File& file);
  13632. static Drawable* createFromSVG (const XmlElement& svgDocument);
  13633. static Drawable* createFromValueTree (const ValueTree& tree) throw();
  13634. virtual ValueTree createValueTree() const throw() = 0;
  13635. juce_UseDebuggingNewOperator
  13636. private:
  13637. Drawable (const Drawable&);
  13638. const Drawable& operator= (const Drawable&);
  13639. String name;
  13640. };
  13641. #endif // __JUCE_DRAWABLE_JUCEHEADER__
  13642. /*** End of inlined file: juce_Drawable.h ***/
  13643. class JUCE_API DrawableButton : public Button
  13644. {
  13645. public:
  13646. enum ButtonStyle
  13647. {
  13648. ImageFitted, /**< The button will just display the images, but will resize and centre them to fit inside it. */
  13649. ImageRaw, /**< The button will just display the images in their normal size and position.
  13650. This leaves it up to the caller to make sure the images are the correct size and position for the button. */
  13651. ImageAboveTextLabel, /**< Draws the button as a text label across the bottom with the image resized and scaled to fit above it. */
  13652. ImageOnButtonBackground /**< Draws the button as a standard rounded-rectangle button with the image on top. */
  13653. };
  13654. DrawableButton (const String& buttonName,
  13655. const ButtonStyle buttonStyle);
  13656. ~DrawableButton();
  13657. void setImages (const Drawable* normalImage,
  13658. const Drawable* overImage = 0,
  13659. const Drawable* downImage = 0,
  13660. const Drawable* disabledImage = 0,
  13661. const Drawable* normalImageOn = 0,
  13662. const Drawable* overImageOn = 0,
  13663. const Drawable* downImageOn = 0,
  13664. const Drawable* disabledImageOn = 0);
  13665. void setButtonStyle (const ButtonStyle newStyle);
  13666. void setBackgroundColours (const Colour& toggledOffColour,
  13667. const Colour& toggledOnColour);
  13668. const Colour& getBackgroundColour() const throw();
  13669. void setEdgeIndent (const int numPixelsIndent);
  13670. const Drawable* getCurrentImage() const throw();
  13671. const Drawable* getNormalImage() const throw();
  13672. const Drawable* getOverImage() const throw();
  13673. const Drawable* getDownImage() const throw();
  13674. juce_UseDebuggingNewOperator
  13675. protected:
  13676. void paintButton (Graphics& g,
  13677. bool isMouseOverButton,
  13678. bool isButtonDown);
  13679. private:
  13680. ButtonStyle style;
  13681. ScopedPointer <Drawable> normalImage, overImage, downImage, disabledImage;
  13682. ScopedPointer <Drawable> normalImageOn, overImageOn, downImageOn, disabledImageOn;
  13683. Colour backgroundOff, backgroundOn;
  13684. int edgeIndent;
  13685. void deleteImages();
  13686. DrawableButton (const DrawableButton&);
  13687. const DrawableButton& operator= (const DrawableButton&);
  13688. };
  13689. #endif // __JUCE_DRAWABLEBUTTON_JUCEHEADER__
  13690. /*** End of inlined file: juce_DrawableButton.h ***/
  13691. #endif
  13692. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13693. /*** Start of inlined file: juce_HyperlinkButton.h ***/
  13694. #ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13695. #define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13696. class JUCE_API HyperlinkButton : public Button
  13697. {
  13698. public:
  13699. HyperlinkButton (const String& linkText,
  13700. const URL& linkURL);
  13701. ~HyperlinkButton();
  13702. void setFont (const Font& newFont,
  13703. const bool resizeToMatchComponentHeight,
  13704. const Justification& justificationType = Justification::horizontallyCentred);
  13705. enum ColourIds
  13706. {
  13707. textColourId = 0x1001f00, /**< The colour to use for the URL text. */
  13708. };
  13709. void setURL (const URL& newURL) throw();
  13710. const URL& getURL() const throw() { return url; }
  13711. void changeWidthToFitText();
  13712. juce_UseDebuggingNewOperator
  13713. protected:
  13714. void clicked();
  13715. void colourChanged();
  13716. void paintButton (Graphics& g,
  13717. bool isMouseOverButton,
  13718. bool isButtonDown);
  13719. private:
  13720. URL url;
  13721. Font font;
  13722. bool resizeFont;
  13723. Justification justification;
  13724. const Font getFontToUse() const;
  13725. HyperlinkButton (const HyperlinkButton&);
  13726. const HyperlinkButton& operator= (const HyperlinkButton&);
  13727. };
  13728. #endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
  13729. /*** End of inlined file: juce_HyperlinkButton.h ***/
  13730. #endif
  13731. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13732. /*** Start of inlined file: juce_ImageButton.h ***/
  13733. #ifndef __JUCE_IMAGEBUTTON_JUCEHEADER__
  13734. #define __JUCE_IMAGEBUTTON_JUCEHEADER__
  13735. class JUCE_API ImageButton : public Button
  13736. {
  13737. public:
  13738. ImageButton (const String& name);
  13739. ~ImageButton();
  13740. void setImages (const bool resizeButtonNowToFitThisImage,
  13741. const bool rescaleImagesWhenButtonSizeChanges,
  13742. const bool preserveImageProportions,
  13743. Image* const normalImage,
  13744. const float imageOpacityWhenNormal,
  13745. const Colour& overlayColourWhenNormal,
  13746. Image* const overImage,
  13747. const float imageOpacityWhenOver,
  13748. const Colour& overlayColourWhenOver,
  13749. Image* const downImage,
  13750. const float imageOpacityWhenDown,
  13751. const Colour& overlayColourWhenDown,
  13752. const float hitTestAlphaThreshold = 0.0f);
  13753. Image* getNormalImage() const throw();
  13754. Image* getOverImage() const throw();
  13755. Image* getDownImage() const throw();
  13756. juce_UseDebuggingNewOperator
  13757. protected:
  13758. bool hitTest (int x, int y);
  13759. void paintButton (Graphics& g,
  13760. bool isMouseOverButton,
  13761. bool isButtonDown);
  13762. private:
  13763. bool scaleImageToFit, preserveProportions;
  13764. unsigned char alphaThreshold;
  13765. int imageX, imageY, imageW, imageH;
  13766. Image* normalImage;
  13767. Image* overImage;
  13768. Image* downImage;
  13769. float normalOpacity, overOpacity, downOpacity;
  13770. Colour normalOverlay, overOverlay, downOverlay;
  13771. Image* getCurrentImage() const;
  13772. void deleteImages();
  13773. ImageButton (const ImageButton&);
  13774. const ImageButton& operator= (const ImageButton&);
  13775. };
  13776. #endif // __JUCE_IMAGEBUTTON_JUCEHEADER__
  13777. /*** End of inlined file: juce_ImageButton.h ***/
  13778. #endif
  13779. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13780. /*** Start of inlined file: juce_ShapeButton.h ***/
  13781. #ifndef __JUCE_SHAPEBUTTON_JUCEHEADER__
  13782. #define __JUCE_SHAPEBUTTON_JUCEHEADER__
  13783. class JUCE_API ShapeButton : public Button
  13784. {
  13785. public:
  13786. ShapeButton (const String& name,
  13787. const Colour& normalColour,
  13788. const Colour& overColour,
  13789. const Colour& downColour);
  13790. ~ShapeButton();
  13791. void setShape (const Path& newShape,
  13792. const bool resizeNowToFitThisShape,
  13793. const bool maintainShapeProportions,
  13794. const bool hasDropShadow);
  13795. void setColours (const Colour& normalColour,
  13796. const Colour& overColour,
  13797. const Colour& downColour);
  13798. void setOutline (const Colour& outlineColour,
  13799. const float outlineStrokeWidth);
  13800. juce_UseDebuggingNewOperator
  13801. protected:
  13802. void paintButton (Graphics& g,
  13803. bool isMouseOverButton,
  13804. bool isButtonDown);
  13805. private:
  13806. Colour normalColour, overColour, downColour, outlineColour;
  13807. DropShadowEffect shadow;
  13808. Path shape;
  13809. bool maintainShapeProportions;
  13810. float outlineWidth;
  13811. ShapeButton (const ShapeButton&);
  13812. const ShapeButton& operator= (const ShapeButton&);
  13813. };
  13814. #endif // __JUCE_SHAPEBUTTON_JUCEHEADER__
  13815. /*** End of inlined file: juce_ShapeButton.h ***/
  13816. #endif
  13817. #ifndef __JUCE_TEXTBUTTON_JUCEHEADER__
  13818. #endif
  13819. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13820. /*** Start of inlined file: juce_ToggleButton.h ***/
  13821. #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13822. #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13823. class JUCE_API ToggleButton : public Button
  13824. {
  13825. public:
  13826. ToggleButton (const String& buttonText);
  13827. ~ToggleButton();
  13828. void changeWidthToFitText();
  13829. enum ColourIds
  13830. {
  13831. textColourId = 0x1006501 /**< The colour to use for the button's text. */
  13832. };
  13833. juce_UseDebuggingNewOperator
  13834. protected:
  13835. void paintButton (Graphics& g,
  13836. bool isMouseOverButton,
  13837. bool isButtonDown);
  13838. void colourChanged();
  13839. private:
  13840. ToggleButton (const ToggleButton&);
  13841. const ToggleButton& operator= (const ToggleButton&);
  13842. };
  13843. #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__
  13844. /*** End of inlined file: juce_ToggleButton.h ***/
  13845. #endif
  13846. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13847. /*** Start of inlined file: juce_ToolbarButton.h ***/
  13848. #ifndef __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13849. #define __JUCE_TOOLBARBUTTON_JUCEHEADER__
  13850. /*** Start of inlined file: juce_ToolbarItemComponent.h ***/
  13851. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13852. #define __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  13853. /*** Start of inlined file: juce_Toolbar.h ***/
  13854. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  13855. #define __JUCE_TOOLBAR_JUCEHEADER__
  13856. /*** Start of inlined file: juce_DragAndDropContainer.h ***/
  13857. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13858. #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13859. /*** Start of inlined file: juce_DragAndDropTarget.h ***/
  13860. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13861. #define __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13862. class JUCE_API DragAndDropTarget
  13863. {
  13864. public:
  13865. virtual ~DragAndDropTarget() {}
  13866. virtual bool isInterestedInDragSource (const String& sourceDescription,
  13867. Component* sourceComponent) = 0;
  13868. virtual void itemDragEnter (const String& sourceDescription,
  13869. Component* sourceComponent,
  13870. int x,
  13871. int y);
  13872. virtual void itemDragMove (const String& sourceDescription,
  13873. Component* sourceComponent,
  13874. int x,
  13875. int y);
  13876. virtual void itemDragExit (const String& sourceDescription,
  13877. Component* sourceComponent);
  13878. virtual void itemDropped (const String& sourceDescription,
  13879. Component* sourceComponent,
  13880. int x,
  13881. int y) = 0;
  13882. virtual bool shouldDrawDragImageWhenOver();
  13883. };
  13884. #endif // __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  13885. /*** End of inlined file: juce_DragAndDropTarget.h ***/
  13886. class JUCE_API DragAndDropContainer
  13887. {
  13888. public:
  13889. DragAndDropContainer();
  13890. virtual ~DragAndDropContainer();
  13891. void startDragging (const String& sourceDescription,
  13892. Component* sourceComponent,
  13893. Image* dragImage = 0,
  13894. const bool allowDraggingToOtherJuceWindows = false,
  13895. const Point<int>* imageOffsetFromMouse = 0);
  13896. bool isDragAndDropActive() const;
  13897. const String getCurrentDragDescription() const;
  13898. static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
  13899. static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
  13900. static bool performExternalDragDropOfText (const String& text);
  13901. juce_UseDebuggingNewOperator
  13902. protected:
  13903. virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
  13904. Component* dragSourceComponent,
  13905. StringArray& files,
  13906. bool& canMoveFiles);
  13907. private:
  13908. friend class DragImageComponent;
  13909. ScopedPointer <Component> dragImageComponent;
  13910. String currentDragDesc;
  13911. };
  13912. #endif // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  13913. /*** End of inlined file: juce_DragAndDropContainer.h ***/
  13914. /*** Start of inlined file: juce_ComponentAnimator.h ***/
  13915. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13916. #define __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13917. class JUCE_API ComponentAnimator : public ChangeBroadcaster,
  13918. private Timer
  13919. {
  13920. public:
  13921. ComponentAnimator();
  13922. ~ComponentAnimator();
  13923. void animateComponent (Component* const component,
  13924. const Rectangle<int>& finalPosition,
  13925. const int millisecondsToSpendMoving,
  13926. const double startSpeed = 1.0,
  13927. const double endSpeed = 1.0);
  13928. void cancelAnimation (Component* const component,
  13929. const bool moveComponentToItsFinalPosition);
  13930. void cancelAllAnimations (const bool moveComponentsToTheirFinalPositions);
  13931. const Rectangle<int> getComponentDestination (Component* const component);
  13932. bool isAnimating (Component* component) const;
  13933. juce_UseDebuggingNewOperator
  13934. private:
  13935. VoidArray tasks;
  13936. uint32 lastTime;
  13937. void* findTaskFor (Component* const component) const;
  13938. void timerCallback();
  13939. };
  13940. #endif // __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  13941. /*** End of inlined file: juce_ComponentAnimator.h ***/
  13942. class ToolbarItemComponent;
  13943. class ToolbarItemFactory;
  13944. class MissingItemsComponent;
  13945. class JUCE_API Toolbar : public Component,
  13946. public DragAndDropContainer,
  13947. public DragAndDropTarget,
  13948. private ButtonListener
  13949. {
  13950. public:
  13951. Toolbar();
  13952. ~Toolbar();
  13953. void setVertical (const bool shouldBeVertical);
  13954. bool isVertical() const throw() { return vertical; }
  13955. int getThickness() const throw();
  13956. int getLength() const throw();
  13957. void clear();
  13958. void addItem (ToolbarItemFactory& factory,
  13959. const int itemId,
  13960. const int insertIndex = -1);
  13961. void removeToolbarItem (const int itemIndex);
  13962. int getNumItems() const throw();
  13963. int getItemId (const int itemIndex) const throw();
  13964. ToolbarItemComponent* getItemComponent (const int itemIndex) const throw();
  13965. void addDefaultItems (ToolbarItemFactory& factoryToUse);
  13966. enum ToolbarItemStyle
  13967. {
  13968. iconsOnly, /**< Means that the toolbar should just contain icons. */
  13969. iconsWithText, /**< Means that the toolbar should have text labels under each icon. */
  13970. textOnly /**< Means that the toolbar only display text labels for each item. */
  13971. };
  13972. ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  13973. void setStyle (const ToolbarItemStyle& newStyle);
  13974. enum CustomisationFlags
  13975. {
  13976. allowIconsOnlyChoice = 1, /**< If this flag is specified, the customisation dialog can
  13977. show the "icons only" option on its choice of toolbar styles. */
  13978. allowIconsWithTextChoice = 2, /**< If this flag is specified, the customisation dialog can
  13979. show the "icons with text" option on its choice of toolbar styles. */
  13980. allowTextOnlyChoice = 4, /**< If this flag is specified, the customisation dialog can
  13981. show the "text only" option on its choice of toolbar styles. */
  13982. showResetToDefaultsButton = 8, /**< If this flag is specified, the customisation dialog can
  13983. show a button to reset the toolbar to its default set of items. */
  13984. allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
  13985. };
  13986. void showCustomisationDialog (ToolbarItemFactory& factory,
  13987. const int optionFlags = allCustomisationOptionsEnabled);
  13988. void setEditingActive (const bool editingEnabled);
  13989. enum ColourIds
  13990. {
  13991. backgroundColourId = 0x1003200, /**< A colour to use to fill the toolbar's background. For
  13992. more control over this, override LookAndFeel::paintToolbarBackground(). */
  13993. separatorColourId = 0x1003210, /**< A colour to use to draw the separator lines. */
  13994. buttonMouseOverBackgroundColourId = 0x1003220, /**< A colour used to paint the background of buttons when the mouse is
  13995. over them. */
  13996. buttonMouseDownBackgroundColourId = 0x1003230, /**< A colour used to paint the background of buttons when the mouse is
  13997. held down on them. */
  13998. labelTextColourId = 0x1003240, /**< A colour to use for drawing the text under buttons
  13999. when the style is set to iconsWithText or textOnly. */
  14000. editingModeOutlineColourId = 0x1003250 /**< A colour to use for an outline around buttons when
  14001. the customisation dialog is active and the mouse moves over them. */
  14002. };
  14003. const String toString() const;
  14004. bool restoreFromString (ToolbarItemFactory& factoryToUse,
  14005. const String& savedVersion);
  14006. void paint (Graphics& g);
  14007. void resized();
  14008. void buttonClicked (Button*);
  14009. void mouseDown (const MouseEvent&);
  14010. bool isInterestedInDragSource (const String&, Component*);
  14011. void itemDragMove (const String&, Component*, int, int);
  14012. void itemDragExit (const String&, Component*);
  14013. void itemDropped (const String&, Component*, int, int);
  14014. void updateAllItemPositions (const bool animate);
  14015. static ToolbarItemComponent* createItem (ToolbarItemFactory&, const int itemId);
  14016. juce_UseDebuggingNewOperator
  14017. private:
  14018. Button* missingItemsButton;
  14019. bool vertical, isEditingActive;
  14020. ToolbarItemStyle toolbarStyle;
  14021. ComponentAnimator animator;
  14022. friend class MissingItemsComponent;
  14023. Array <ToolbarItemComponent*> items;
  14024. friend class ItemDragAndDropOverlayComponent;
  14025. static const tchar* const toolbarDragDescriptor;
  14026. void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex);
  14027. ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const;
  14028. Toolbar (const Toolbar&);
  14029. const Toolbar& operator= (const Toolbar&);
  14030. };
  14031. #endif // __JUCE_TOOLBAR_JUCEHEADER__
  14032. /*** End of inlined file: juce_Toolbar.h ***/
  14033. class ItemDragAndDropOverlayComponent;
  14034. class JUCE_API ToolbarItemComponent : public Button
  14035. {
  14036. public:
  14037. ToolbarItemComponent (const int itemId,
  14038. const String& labelText,
  14039. const bool isBeingUsedAsAButton);
  14040. ~ToolbarItemComponent();
  14041. int getItemId() const throw() { return itemId; }
  14042. Toolbar* getToolbar() const;
  14043. bool isToolbarVertical() const;
  14044. Toolbar::ToolbarItemStyle getStyle() const throw() { return toolbarStyle; }
  14045. virtual void setStyle (const Toolbar::ToolbarItemStyle& newStyle);
  14046. const Rectangle<int> getContentArea() const throw() { return contentArea; }
  14047. virtual bool getToolbarItemSizes (int toolbarThickness,
  14048. bool isToolbarVertical,
  14049. int& preferredSize,
  14050. int& minSize,
  14051. int& maxSize) = 0;
  14052. virtual void paintButtonArea (Graphics& g,
  14053. int width, int height,
  14054. bool isMouseOver, bool isMouseDown) = 0;
  14055. virtual void contentAreaChanged (const Rectangle<int>& newBounds) = 0;
  14056. enum ToolbarEditingMode
  14057. {
  14058. normalMode = 0, /**< Means that the component is active, inside a toolbar. */
  14059. editableOnToolbar, /**< Means that the component is on a toolbar, but the toolbar is in
  14060. customisation mode, and the items can be dragged around. */
  14061. editableOnPalette /**< Means that the component is on an new-item palette, so it can be
  14062. dragged onto a toolbar to add it to that bar.*/
  14063. };
  14064. void setEditingMode (const ToolbarEditingMode newMode);
  14065. ToolbarEditingMode getEditingMode() const throw() { return mode; }
  14066. void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown);
  14067. void resized();
  14068. juce_UseDebuggingNewOperator
  14069. private:
  14070. friend class Toolbar;
  14071. friend class ItemDragAndDropOverlayComponent;
  14072. const int itemId;
  14073. ToolbarEditingMode mode;
  14074. Toolbar::ToolbarItemStyle toolbarStyle;
  14075. ScopedPointer <Component> overlayComp;
  14076. int dragOffsetX, dragOffsetY;
  14077. bool isActive, isBeingDragged, isBeingUsedAsAButton;
  14078. Rectangle<int> contentArea;
  14079. ToolbarItemComponent (const ToolbarItemComponent&);
  14080. const ToolbarItemComponent& operator= (const ToolbarItemComponent&);
  14081. };
  14082. #endif // __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14083. /*** End of inlined file: juce_ToolbarItemComponent.h ***/
  14084. class JUCE_API ToolbarButton : public ToolbarItemComponent
  14085. {
  14086. public:
  14087. ToolbarButton (const int itemId,
  14088. const String& labelText,
  14089. Drawable* const normalImage,
  14090. Drawable* const toggledOnImage);
  14091. ~ToolbarButton();
  14092. bool getToolbarItemSizes (int toolbarDepth, bool isToolbarVertical, int& preferredSize,
  14093. int& minSize, int& maxSize);
  14094. void paintButtonArea (Graphics& g, int width, int height, bool isMouseOver, bool isMouseDown);
  14095. void contentAreaChanged (const Rectangle<int>& newBounds);
  14096. juce_UseDebuggingNewOperator
  14097. private:
  14098. ScopedPointer <Drawable> normalImage, toggledOnImage;
  14099. ToolbarButton (const ToolbarButton&);
  14100. const ToolbarButton& operator= (const ToolbarButton&);
  14101. };
  14102. #endif // __JUCE_TOOLBARBUTTON_JUCEHEADER__
  14103. /*** End of inlined file: juce_ToolbarButton.h ***/
  14104. #endif
  14105. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14106. /*** Start of inlined file: juce_CodeDocument.h ***/
  14107. #ifndef __JUCE_CODEDOCUMENT_JUCEHEADER__
  14108. #define __JUCE_CODEDOCUMENT_JUCEHEADER__
  14109. class CodeDocumentLine;
  14110. class JUCE_API CodeDocument
  14111. {
  14112. public:
  14113. CodeDocument();
  14114. ~CodeDocument();
  14115. class JUCE_API Position
  14116. {
  14117. public:
  14118. Position() throw();
  14119. Position (const CodeDocument* const ownerDocument,
  14120. const int line, const int indexInLine) throw();
  14121. Position (const CodeDocument* const ownerDocument,
  14122. const int charactersFromStartOfDocument) throw();
  14123. Position (const Position& other) throw();
  14124. ~Position() throw();
  14125. const Position& operator= (const Position& other) throw();
  14126. bool operator== (const Position& other) const throw();
  14127. bool operator!= (const Position& other) const throw();
  14128. void setPosition (const int charactersFromStartOfDocument) throw();
  14129. int getPosition() const throw() { return characterPos; }
  14130. void setLineAndIndex (const int newLine, const int newIndexInLine) throw();
  14131. int getLineNumber() const throw() { return line; }
  14132. int getIndexInLine() const throw() { return indexInLine; }
  14133. void setPositionMaintained (const bool isMaintained) throw();
  14134. void moveBy (int characterDelta) throw();
  14135. const Position movedBy (const int characterDelta) const throw();
  14136. const Position movedByLines (const int deltaLines) const throw();
  14137. const tchar getCharacter() const throw();
  14138. const String getLineText() const throw();
  14139. private:
  14140. CodeDocument* owner;
  14141. int characterPos, line, indexInLine;
  14142. bool positionMaintained;
  14143. };
  14144. const String getAllContent() const throw();
  14145. const String getTextBetween (const Position& start, const Position& end) const throw();
  14146. const String getLine (const int lineIndex) const throw();
  14147. int getNumCharacters() const throw();
  14148. int getNumLines() const throw() { return lines.size(); }
  14149. int getMaximumLineLength() throw();
  14150. void deleteSection (const Position& startPosition, const Position& endPosition);
  14151. void insertText (const Position& position, const String& text);
  14152. void replaceAllContent (const String& newContent);
  14153. bool loadFromStream (InputStream& stream);
  14154. bool writeToStream (OutputStream& stream);
  14155. const String getNewLineCharacters() const throw() { return newLineChars; }
  14156. void setNewLineCharacters (const String& newLine) throw();
  14157. void newTransaction();
  14158. void undo();
  14159. void redo();
  14160. void clearUndoHistory();
  14161. UndoManager& getUndoManager() throw() { return undoManager; }
  14162. void setSavePoint() throw();
  14163. bool hasChangedSinceSavePoint() const throw();
  14164. const Position findWordBreakAfter (const Position& position) const throw();
  14165. const Position findWordBreakBefore (const Position& position) const throw();
  14166. class JUCE_API Listener
  14167. {
  14168. public:
  14169. Listener() {}
  14170. virtual ~Listener() {}
  14171. virtual void codeDocumentChanged (const Position& affectedTextStart,
  14172. const Position& affectedTextEnd) = 0;
  14173. };
  14174. void addListener (Listener* const listener) throw();
  14175. void removeListener (Listener* const listener) throw();
  14176. class Iterator
  14177. {
  14178. public:
  14179. Iterator (CodeDocument* const document);
  14180. Iterator (const Iterator& other);
  14181. const Iterator& operator= (const Iterator& other) throw();
  14182. ~Iterator() throw();
  14183. juce_wchar nextChar();
  14184. juce_wchar peekNextChar() const;
  14185. void skip();
  14186. int getPosition() const throw() { return position; }
  14187. void skipWhitespace();
  14188. void skipToEndOfLine();
  14189. int getLine() const throw() { return line; }
  14190. bool isEOF() const throw();
  14191. private:
  14192. CodeDocument* document;
  14193. CodeDocumentLine* currentLine;
  14194. int line, position;
  14195. };
  14196. juce_UseDebuggingNewOperator
  14197. private:
  14198. friend class CodeDocumentInsertAction;
  14199. friend class CodeDocumentDeleteAction;
  14200. friend class Iterator;
  14201. friend class Position;
  14202. OwnedArray <CodeDocumentLine> lines;
  14203. Array <Position*> positionsToMaintain;
  14204. UndoManager undoManager;
  14205. int currentActionIndex, indexOfSavedState;
  14206. int maximumLineLength;
  14207. VoidArray listeners;
  14208. String newLineChars;
  14209. void sendListenerChangeMessage (const int startLine, const int endLine);
  14210. void insert (const String& text, const int insertPos, const bool undoable);
  14211. void remove (const int startPos, const int endPos, const bool undoable);
  14212. void checkLastLineStatus();
  14213. CodeDocument (const CodeDocument&);
  14214. const CodeDocument& operator= (const CodeDocument&);
  14215. };
  14216. #endif // __JUCE_CODEDOCUMENT_JUCEHEADER__
  14217. /*** End of inlined file: juce_CodeDocument.h ***/
  14218. #endif
  14219. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14220. /*** Start of inlined file: juce_CodeEditorComponent.h ***/
  14221. #ifndef __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14222. #define __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14223. /*** Start of inlined file: juce_CodeTokeniser.h ***/
  14224. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14225. #define __JUCE_CODETOKENISER_JUCEHEADER__
  14226. class JUCE_API CodeTokeniser
  14227. {
  14228. public:
  14229. CodeTokeniser() {}
  14230. virtual ~CodeTokeniser() {}
  14231. virtual int readNextToken (CodeDocument::Iterator& source) = 0;
  14232. virtual const StringArray getTokenTypes() = 0;
  14233. virtual const Colour getDefaultColour (const int tokenType) = 0;
  14234. juce_UseDebuggingNewOperator
  14235. };
  14236. #endif // __JUCE_CODETOKENISER_JUCEHEADER__
  14237. /*** End of inlined file: juce_CodeTokeniser.h ***/
  14238. class JUCE_API CodeEditorComponent : public Component,
  14239. public Timer,
  14240. public ScrollBarListener,
  14241. public CodeDocument::Listener,
  14242. public AsyncUpdater
  14243. {
  14244. public:
  14245. CodeEditorComponent (CodeDocument& document,
  14246. CodeTokeniser* const codeTokeniser);
  14247. ~CodeEditorComponent();
  14248. CodeDocument& getDocument() const throw() { return document; }
  14249. void loadContent (const String& newContent);
  14250. float getCharWidth() const throw() { return charWidth; }
  14251. int getLineHeight() const throw() { return lineHeight; }
  14252. int getNumLinesOnScreen() const throw() { return linesOnScreen; }
  14253. int getNumColumnsOnScreen() const throw() { return columnsOnScreen; }
  14254. const CodeDocument::Position getCaretPos() const { return caretPos; }
  14255. void moveCaretTo (const CodeDocument::Position& newPos, const bool selecting);
  14256. const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
  14257. const CodeDocument::Position getPositionAt (int x, int y);
  14258. void cursorLeft (const bool moveInWholeWordSteps, const bool selecting);
  14259. void cursorRight (const bool moveInWholeWordSteps, const bool selecting);
  14260. void cursorDown (const bool selecting);
  14261. void cursorUp (const bool selecting);
  14262. void pageDown (const bool selecting);
  14263. void pageUp (const bool selecting);
  14264. void scrollDown();
  14265. void scrollUp();
  14266. void scrollToLine (int newFirstLineOnScreen);
  14267. void scrollBy (int deltaLines);
  14268. void scrollToColumn (int newFirstColumnOnScreen);
  14269. void scrollToKeepCaretOnScreen();
  14270. void goToStartOfDocument (const bool selecting);
  14271. void goToStartOfLine (const bool selecting);
  14272. void goToEndOfDocument (const bool selecting);
  14273. void goToEndOfLine (const bool selecting);
  14274. void deselectAll();
  14275. void selectAll();
  14276. void insertTextAtCaret (const String& textToInsert);
  14277. void insertTabAtCaret();
  14278. void cut();
  14279. void copy();
  14280. void copyThenCut();
  14281. void paste();
  14282. void backspace (const bool moveInWholeWordSteps);
  14283. void deleteForward (const bool moveInWholeWordSteps);
  14284. void undo();
  14285. void redo();
  14286. void setTabSize (const int numSpacesPerTab,
  14287. const bool insertSpacesInsteadOfTabCharacters) throw();
  14288. int getTabSize() const throw() { return spacesPerTab; }
  14289. bool areSpacesInsertedForTabs() const { return useSpacesForTabs; }
  14290. void setFont (const Font& newFont);
  14291. void resetToDefaultColours();
  14292. void setColourForTokenType (const int tokenType, const Colour& colour);
  14293. const Colour getColourForTokenType (const int tokenType) const throw();
  14294. enum ColourIds
  14295. {
  14296. backgroundColourId = 0x1004500, /**< A colour to use to fill the editor's background. */
  14297. caretColourId = 0x1004501, /**< The colour to draw the caret. */
  14298. highlightColourId = 0x1004502, /**< The colour to use for the highlighted background under
  14299. selected text. */
  14300. defaultTextColourId = 0x1004503 /**< The colour to use for text when no syntax colouring is
  14301. enabled. */
  14302. };
  14303. void setScrollbarThickness (const int thickness) throw();
  14304. void resized();
  14305. void paint (Graphics& g);
  14306. bool keyPressed (const KeyPress& key);
  14307. void mouseDown (const MouseEvent& e);
  14308. void mouseDrag (const MouseEvent& e);
  14309. void mouseUp (const MouseEvent& e);
  14310. void mouseDoubleClick (const MouseEvent& e);
  14311. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14312. void timerCallback();
  14313. void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, const double newRangeStart);
  14314. void handleAsyncUpdate();
  14315. void codeDocumentChanged (const CodeDocument::Position& affectedTextStart,
  14316. const CodeDocument::Position& affectedTextEnd);
  14317. juce_UseDebuggingNewOperator
  14318. private:
  14319. CodeDocument& document;
  14320. Font font;
  14321. int firstLineOnScreen, gutter, spacesPerTab;
  14322. float charWidth;
  14323. int lineHeight, linesOnScreen, columnsOnScreen;
  14324. int scrollbarThickness, columnToTryToMaintain;
  14325. bool useSpacesForTabs;
  14326. double xOffset;
  14327. CodeDocument::Position caretPos;
  14328. CodeDocument::Position selectionStart, selectionEnd;
  14329. Component* caret;
  14330. ScrollBar* verticalScrollBar;
  14331. ScrollBar* horizontalScrollBar;
  14332. enum DragType
  14333. {
  14334. notDragging,
  14335. draggingSelectionStart,
  14336. draggingSelectionEnd
  14337. };
  14338. DragType dragType;
  14339. CodeTokeniser* codeTokeniser;
  14340. Array <Colour> coloursForTokenCategories;
  14341. class CodeEditorLine;
  14342. OwnedArray <CodeEditorLine> lines;
  14343. void rebuildLineTokens();
  14344. OwnedArray <CodeDocument::Iterator> cachedIterators;
  14345. void clearCachedIterators (const int firstLineToBeInvalid) throw();
  14346. void updateCachedIterators (int maxLineNum);
  14347. void getIteratorForPosition (int position, CodeDocument::Iterator& result);
  14348. void moveLineDelta (const int delta, const bool selecting);
  14349. void updateScrollBars();
  14350. void scrollToLineInternal (int line);
  14351. void scrollToColumnInternal (double column);
  14352. void newTransaction();
  14353. int indexToColumn (int line, int index) const throw();
  14354. int columnToIndex (int line, int column) const throw();
  14355. CodeEditorComponent (const CodeEditorComponent&);
  14356. const CodeEditorComponent& operator= (const CodeEditorComponent&);
  14357. };
  14358. #endif // __JUCE_CODEEDITORCOMPONENT_JUCEHEADER__
  14359. /*** End of inlined file: juce_CodeEditorComponent.h ***/
  14360. #endif
  14361. #ifndef __JUCE_CODETOKENISER_JUCEHEADER__
  14362. #endif
  14363. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14364. /*** Start of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14365. #ifndef __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14366. #define __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14367. class JUCE_API CPlusPlusCodeTokeniser : public CodeTokeniser
  14368. {
  14369. public:
  14370. CPlusPlusCodeTokeniser();
  14371. ~CPlusPlusCodeTokeniser();
  14372. enum TokenType
  14373. {
  14374. tokenType_error = 0,
  14375. tokenType_comment,
  14376. tokenType_builtInKeyword,
  14377. tokenType_identifier,
  14378. tokenType_integerLiteral,
  14379. tokenType_floatLiteral,
  14380. tokenType_stringLiteral,
  14381. tokenType_operator,
  14382. tokenType_bracket,
  14383. tokenType_punctuation,
  14384. tokenType_preprocessor
  14385. };
  14386. int readNextToken (CodeDocument::Iterator& source);
  14387. const StringArray getTokenTypes();
  14388. const Colour getDefaultColour (const int tokenType);
  14389. juce_UseDebuggingNewOperator
  14390. };
  14391. #endif // __JUCE_CPLUSPLUSCODETOKENISER_JUCEHEADER__
  14392. /*** End of inlined file: juce_CPlusPlusCodeTokeniser.h ***/
  14393. #endif
  14394. #ifndef __JUCE_COMBOBOX_JUCEHEADER__
  14395. #endif
  14396. #ifndef __JUCE_LABEL_JUCEHEADER__
  14397. #endif
  14398. #ifndef __JUCE_LISTBOX_JUCEHEADER__
  14399. #endif
  14400. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14401. /*** Start of inlined file: juce_ProgressBar.h ***/
  14402. #ifndef __JUCE_PROGRESSBAR_JUCEHEADER__
  14403. #define __JUCE_PROGRESSBAR_JUCEHEADER__
  14404. class JUCE_API ProgressBar : public Component,
  14405. public SettableTooltipClient,
  14406. private Timer
  14407. {
  14408. public:
  14409. ProgressBar (double& progress);
  14410. ~ProgressBar();
  14411. void setPercentageDisplay (const bool shouldDisplayPercentage);
  14412. void setTextToDisplay (const String& text);
  14413. enum ColourIds
  14414. {
  14415. backgroundColourId = 0x1001900, /**< The background colour, behind the bar. */
  14416. foregroundColourId = 0x1001a00, /**< The colour to use to draw the bar itself. LookAndFeel
  14417. classes will probably use variations on this colour. */
  14418. };
  14419. juce_UseDebuggingNewOperator
  14420. protected:
  14421. void paint (Graphics& g);
  14422. void lookAndFeelChanged();
  14423. void visibilityChanged();
  14424. void colourChanged();
  14425. private:
  14426. double& progress;
  14427. double currentValue;
  14428. bool displayPercentage;
  14429. String displayedMessage, currentMessage;
  14430. uint32 lastCallbackTime;
  14431. void timerCallback();
  14432. ProgressBar (const ProgressBar&);
  14433. const ProgressBar& operator= (const ProgressBar&);
  14434. };
  14435. #endif // __JUCE_PROGRESSBAR_JUCEHEADER__
  14436. /*** End of inlined file: juce_ProgressBar.h ***/
  14437. #endif
  14438. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14439. /*** Start of inlined file: juce_Slider.h ***/
  14440. #ifndef __JUCE_SLIDER_JUCEHEADER__
  14441. #define __JUCE_SLIDER_JUCEHEADER__
  14442. /*** Start of inlined file: juce_SliderListener.h ***/
  14443. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14444. #define __JUCE_SLIDERLISTENER_JUCEHEADER__
  14445. class Slider;
  14446. class JUCE_API SliderListener
  14447. {
  14448. public:
  14449. virtual ~SliderListener() {}
  14450. virtual void sliderValueChanged (Slider* slider) = 0;
  14451. virtual void sliderDragStarted (Slider* slider);
  14452. virtual void sliderDragEnded (Slider* slider);
  14453. };
  14454. #endif // __JUCE_SLIDERLISTENER_JUCEHEADER__
  14455. /*** End of inlined file: juce_SliderListener.h ***/
  14456. class JUCE_API Slider : public Component,
  14457. public SettableTooltipClient,
  14458. private AsyncUpdater,
  14459. private ButtonListener,
  14460. private LabelListener,
  14461. private Value::Listener
  14462. {
  14463. public:
  14464. Slider (const String& componentName);
  14465. ~Slider();
  14466. enum SliderStyle
  14467. {
  14468. LinearHorizontal, /**< A traditional horizontal slider. */
  14469. LinearVertical, /**< A traditional vertical slider. */
  14470. LinearBar, /**< A horizontal bar slider with the text label drawn on top of it. */
  14471. Rotary, /**< A rotary control that you move by dragging the mouse in a circular motion, like a knob.
  14472. @see setRotaryParameters */
  14473. RotaryHorizontalDrag, /**< A rotary control that you move by dragging the mouse left-to-right.
  14474. @see setRotaryParameters */
  14475. RotaryVerticalDrag, /**< A rotary control that you move by dragging the mouse up-and-down.
  14476. @see setRotaryParameters */
  14477. IncDecButtons, /**< A pair of buttons that increment or decrement the slider's value by the increment set in setRange(). */
  14478. TwoValueHorizontal, /**< A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14479. @see setMinValue, setMaxValue */
  14480. TwoValueVertical, /**< A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
  14481. @see setMinValue, setMaxValue */
  14482. ThreeValueHorizontal, /**< A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum
  14483. value, with the current value being somewhere between them.
  14484. @see setMinValue, setMaxValue */
  14485. ThreeValueVertical, /**< A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum
  14486. value, with the current value being somewhere between them.
  14487. @see setMinValue, setMaxValue */
  14488. };
  14489. void setSliderStyle (const SliderStyle newStyle);
  14490. SliderStyle getSliderStyle() const { return style; }
  14491. void setRotaryParameters (const float startAngleRadians,
  14492. const float endAngleRadians,
  14493. const bool stopAtEnd);
  14494. void setMouseDragSensitivity (const int distanceForFullScaleDrag);
  14495. void setVelocityBasedMode (const bool isVelocityBased);
  14496. bool getVelocityBasedMode() const { return isVelocityBased; }
  14497. void setVelocityModeParameters (const double sensitivity = 1.0,
  14498. const int threshold = 1,
  14499. const double offset = 0.0,
  14500. const bool userCanPressKeyToSwapMode = true);
  14501. double getVelocitySensitivity() const { return velocityModeSensitivity; }
  14502. int getVelocityThreshold() const { return velocityModeThreshold; }
  14503. double getVelocityOffset() const { return velocityModeOffset; }
  14504. bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; }
  14505. void setSkewFactor (const double factor);
  14506. void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint);
  14507. double getSkewFactor() const { return skewFactor; }
  14508. enum IncDecButtonMode
  14509. {
  14510. incDecButtonsNotDraggable,
  14511. incDecButtonsDraggable_AutoDirection,
  14512. incDecButtonsDraggable_Horizontal,
  14513. incDecButtonsDraggable_Vertical
  14514. };
  14515. void setIncDecButtonsMode (const IncDecButtonMode mode);
  14516. enum TextEntryBoxPosition
  14517. {
  14518. NoTextBox, /**< Doesn't display a text box. */
  14519. TextBoxLeft, /**< Puts the text box to the left of the slider, vertically centred. */
  14520. TextBoxRight, /**< Puts the text box to the right of the slider, vertically centred. */
  14521. TextBoxAbove, /**< Puts the text box above the slider, horizontally centred. */
  14522. TextBoxBelow /**< Puts the text box below the slider, horizontally centred. */
  14523. };
  14524. void setTextBoxStyle (const TextEntryBoxPosition newPosition,
  14525. const bool isReadOnly,
  14526. const int textEntryBoxWidth,
  14527. const int textEntryBoxHeight);
  14528. const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; }
  14529. int getTextBoxWidth() const { return textBoxWidth; }
  14530. int getTextBoxHeight() const { return textBoxHeight; }
  14531. void setTextBoxIsEditable (const bool shouldBeEditable);
  14532. bool isTextBoxEditable() const { return editableText; }
  14533. void showTextBox();
  14534. void hideTextBox (const bool discardCurrentEditorContents);
  14535. void setValue (double newValue,
  14536. const bool sendUpdateMessage = true,
  14537. const bool sendMessageSynchronously = false);
  14538. double getValue() const;
  14539. Value& getValueObject() { return currentValue; }
  14540. void setRange (const double newMinimum,
  14541. const double newMaximum,
  14542. const double newInterval = 0);
  14543. double getMaximum() const { return maximum; }
  14544. double getMinimum() const { return minimum; }
  14545. double getInterval() const { return interval; }
  14546. double getMinValue() const;
  14547. Value& getMinValueObject() { return valueMin; }
  14548. void setMinValue (double newValue,
  14549. const bool sendUpdateMessage = true,
  14550. const bool sendMessageSynchronously = false,
  14551. const bool allowNudgingOfOtherValues = false);
  14552. double getMaxValue() const;
  14553. Value& getMaxValueObject() { return valueMax; }
  14554. void setMaxValue (double newValue,
  14555. const bool sendUpdateMessage = true,
  14556. const bool sendMessageSynchronously = false,
  14557. const bool allowNudgingOfOtherValues = false);
  14558. void addListener (SliderListener* const listener);
  14559. void removeListener (SliderListener* const listener);
  14560. void setDoubleClickReturnValue (const bool isDoubleClickEnabled,
  14561. const double valueToSetOnDoubleClick);
  14562. double getDoubleClickReturnValue (bool& isEnabled) const;
  14563. void setChangeNotificationOnlyOnRelease (const bool onlyNotifyOnRelease);
  14564. void setSliderSnapsToMousePosition (const bool shouldSnapToMouse);
  14565. void setPopupDisplayEnabled (const bool isEnabled,
  14566. Component* const parentComponentToUse);
  14567. void setPopupMenuEnabled (const bool menuEnabled);
  14568. void setScrollWheelEnabled (const bool enabled);
  14569. int getThumbBeingDragged() const { return sliderBeingDragged; }
  14570. virtual void startedDragging();
  14571. virtual void stoppedDragging();
  14572. virtual void valueChanged();
  14573. /** Callback to indicate that the user has just moved the slider.
  14574. Note - the valueChanged() method has changed its format and now no longer has
  14575. any parameters. Update your code to use the new version.
  14576. This version has been left here with an int as its return value to cause
  14577. a syntax error if you've got existing code that uses the old version.
  14578. */
  14579. virtual int valueChanged (double) { jassertfalse; return 0; }
  14580. virtual double getValueFromText (const String& text);
  14581. virtual const String getTextFromValue (double value);
  14582. void setTextValueSuffix (const String& suffix);
  14583. virtual double proportionOfLengthToValue (double proportion);
  14584. virtual double valueToProportionOfLength (double value);
  14585. float getPositionOfValue (const double value);
  14586. virtual double snapValue (double attemptedValue, const bool userIsDragging);
  14587. void updateText();
  14588. bool isHorizontal() const;
  14589. bool isVertical() const;
  14590. enum ColourIds
  14591. {
  14592. backgroundColourId = 0x1001200, /**< A colour to use to fill the slider's background. */
  14593. thumbColourId = 0x1001300, /**< The colour to draw the thumb with. It's up to the look
  14594. and feel class how this is used. */
  14595. trackColourId = 0x1001310, /**< The colour to draw the groove that the thumb moves along. */
  14596. rotarySliderFillColourId = 0x1001311, /**< For rotary sliders, this colour fills the outer curve. */
  14597. rotarySliderOutlineColourId = 0x1001312, /**< For rotary sliders, this colour is used to draw the outer curve's outline. */
  14598. textBoxTextColourId = 0x1001400, /**< The colour for the text in the text-editor box used for editing the value. */
  14599. textBoxBackgroundColourId = 0x1001500, /**< The background colour for the text-editor box. */
  14600. textBoxHighlightColourId = 0x1001600, /**< The text highlight colour for the text-editor box. */
  14601. textBoxOutlineColourId = 0x1001700 /**< The colour to use for a border around the text-editor box. */
  14602. };
  14603. juce_UseDebuggingNewOperator
  14604. protected:
  14605. void labelTextChanged (Label*);
  14606. void paint (Graphics& g);
  14607. void resized();
  14608. void mouseDown (const MouseEvent& e);
  14609. void mouseUp (const MouseEvent& e);
  14610. void mouseDrag (const MouseEvent& e);
  14611. void mouseDoubleClick (const MouseEvent& e);
  14612. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  14613. void modifierKeysChanged (const ModifierKeys& modifiers);
  14614. void buttonClicked (Button* button);
  14615. void lookAndFeelChanged();
  14616. void enablementChanged();
  14617. void focusOfChildComponentChanged (FocusChangeType cause);
  14618. void handleAsyncUpdate();
  14619. void colourChanged();
  14620. void valueChanged (Value& value);
  14621. private:
  14622. SortedSet <void*> listeners;
  14623. Value currentValue, valueMin, valueMax;
  14624. double lastCurrentValue, lastValueMin, lastValueMax;
  14625. double minimum, maximum, interval, doubleClickReturnValue;
  14626. double valueWhenLastDragged, valueOnMouseDown, skewFactor, lastAngle;
  14627. double velocityModeSensitivity, velocityModeOffset, minMaxDiff;
  14628. int velocityModeThreshold;
  14629. float rotaryStart, rotaryEnd;
  14630. int numDecimalPlaces, mouseXWhenLastDragged, mouseYWhenLastDragged;
  14631. int mouseDragStartX, mouseDragStartY;
  14632. int sliderRegionStart, sliderRegionSize;
  14633. int sliderBeingDragged;
  14634. int pixelsForFullDragExtent;
  14635. Rectangle<int> sliderRect;
  14636. String textSuffix;
  14637. SliderStyle style;
  14638. TextEntryBoxPosition textBoxPos;
  14639. int textBoxWidth, textBoxHeight;
  14640. IncDecButtonMode incDecButtonMode;
  14641. bool editableText : 1, doubleClickToValue : 1;
  14642. bool isVelocityBased : 1, userKeyOverridesVelocity : 1, rotaryStop : 1;
  14643. bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
  14644. bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
  14645. bool scrollWheelEnabled : 1, snapsToMousePos : 1;
  14646. Font font;
  14647. Label* valueBox;
  14648. Button* incButton;
  14649. Button* decButton;
  14650. ScopedPointer <Component> popupDisplay;
  14651. Component* parentForPopupDisplay;
  14652. float getLinearSliderPos (const double value);
  14653. void restoreMouseIfHidden();
  14654. void sendDragStart();
  14655. void sendDragEnd();
  14656. double constrainedValue (double value) const;
  14657. void triggerChangeMessage (const bool synchronous);
  14658. bool incDecDragDirectionIsHorizontal() const;
  14659. Slider (const Slider&);
  14660. const Slider& operator= (const Slider&);
  14661. };
  14662. #endif // __JUCE_SLIDER_JUCEHEADER__
  14663. /*** End of inlined file: juce_Slider.h ***/
  14664. #endif
  14665. #ifndef __JUCE_SLIDERLISTENER_JUCEHEADER__
  14666. #endif
  14667. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14668. /*** Start of inlined file: juce_TableHeaderComponent.h ***/
  14669. #ifndef __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14670. #define __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14671. class TableHeaderComponent;
  14672. class JUCE_API TableHeaderListener
  14673. {
  14674. public:
  14675. TableHeaderListener() {}
  14676. virtual ~TableHeaderListener() {}
  14677. virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0;
  14678. virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0;
  14679. virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0;
  14680. virtual void tableColumnDraggingChanged (TableHeaderComponent* tableHeader,
  14681. int columnIdNowBeingDragged);
  14682. };
  14683. class JUCE_API TableHeaderComponent : public Component,
  14684. private AsyncUpdater
  14685. {
  14686. public:
  14687. TableHeaderComponent();
  14688. ~TableHeaderComponent();
  14689. enum ColumnPropertyFlags
  14690. {
  14691. 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. */
  14692. resizable = 2, /**< If this is set, the column can be resized by dragging it. */
  14693. draggable = 4, /**< If this is set, the column can be dragged around to change its order in the table. */
  14694. appearsOnColumnMenu = 8, /**< If this is set, the column will be shown on the pop-up menu allowing it to be hidden/shown. */
  14695. 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. */
  14696. sortedForwards = 32, /**< If this is set, the column is currently the one by which the table is sorted (forwards). */
  14697. sortedBackwards = 64, /**< If this is set, the column is currently the one by which the table is sorted (backwards). */
  14698. defaultFlags = (visible | resizable | draggable | appearsOnColumnMenu | sortable),
  14699. notResizable = (visible | draggable | appearsOnColumnMenu | sortable),
  14700. notResizableOrSortable = (visible | draggable | appearsOnColumnMenu),
  14701. notSortable = (visible | resizable | draggable | appearsOnColumnMenu)
  14702. };
  14703. void addColumn (const String& columnName,
  14704. const int columnId,
  14705. const int width,
  14706. const int minimumWidth = 30,
  14707. const int maximumWidth = -1,
  14708. const int propertyFlags = defaultFlags,
  14709. const int insertIndex = -1);
  14710. void removeColumn (const int columnIdToRemove);
  14711. void removeAllColumns();
  14712. int getNumColumns (const bool onlyCountVisibleColumns) const;
  14713. const String getColumnName (const int columnId) const;
  14714. void setColumnName (const int columnId, const String& newName);
  14715. void moveColumn (const int columnId, int newVisibleIndex);
  14716. int getColumnWidth (const int columnId) const;
  14717. void setColumnWidth (const int columnId, const int newWidth);
  14718. void setColumnVisible (const int columnId, const bool shouldBeVisible);
  14719. bool isColumnVisible (const int columnId) const;
  14720. void setSortColumnId (const int columnId, const bool sortForwards);
  14721. int getSortColumnId() const;
  14722. bool isSortedForwards() const;
  14723. void reSortTable();
  14724. int getTotalWidth() const;
  14725. int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const;
  14726. int getColumnIdOfIndex (int index, const bool onlyCountVisibleColumns) const;
  14727. const Rectangle<int> getColumnPosition (const int index) const;
  14728. int getColumnIdAtX (const int xToFind) const;
  14729. void setStretchToFitActive (const bool shouldStretchToFit);
  14730. bool isStretchToFitActive() const;
  14731. void resizeAllColumnsToFit (int targetTotalWidth);
  14732. void setPopupMenuActive (const bool hasMenu);
  14733. bool isPopupMenuActive() const;
  14734. const String toString() const;
  14735. void restoreFromString (const String& storedVersion);
  14736. void addListener (TableHeaderListener* const newListener);
  14737. void removeListener (TableHeaderListener* const listenerToRemove);
  14738. virtual void columnClicked (int columnId, const ModifierKeys& mods);
  14739. virtual void addMenuItems (PopupMenu& menu, const int columnIdClicked);
  14740. virtual void reactToMenuItem (const int menuReturnId, const int columnIdClicked);
  14741. void paint (Graphics& g);
  14742. void resized();
  14743. void mouseMove (const MouseEvent&);
  14744. void mouseEnter (const MouseEvent&);
  14745. void mouseExit (const MouseEvent&);
  14746. void mouseDown (const MouseEvent&);
  14747. void mouseDrag (const MouseEvent&);
  14748. void mouseUp (const MouseEvent&);
  14749. const MouseCursor getMouseCursor();
  14750. virtual void showColumnChooserMenu (const int columnIdClicked);
  14751. juce_UseDebuggingNewOperator
  14752. private:
  14753. struct ColumnInfo
  14754. {
  14755. String name;
  14756. int id, propertyFlags, width, minimumWidth, maximumWidth;
  14757. double lastDeliberateWidth;
  14758. bool isVisible() const;
  14759. };
  14760. OwnedArray <ColumnInfo> columns;
  14761. Array <TableHeaderListener*> listeners;
  14762. ScopedPointer <Component> dragOverlayComp;
  14763. bool columnsChanged, columnsResized, sortChanged, menuActive, stretchToFit;
  14764. int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth;
  14765. int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth;
  14766. ColumnInfo* getInfoForId (const int columnId) const;
  14767. int visibleIndexToTotalIndex (const int visibleIndex) const;
  14768. void sendColumnsChanged();
  14769. void handleAsyncUpdate();
  14770. void beginDrag (const MouseEvent&);
  14771. void endDrag (const int finalIndex);
  14772. int getResizeDraggerAt (const int mouseX) const;
  14773. void updateColumnUnderMouse (int x, int y);
  14774. void resizeColumnsToFit (int firstColumnIndex, int targetTotalWidth);
  14775. TableHeaderComponent (const TableHeaderComponent&);
  14776. const TableHeaderComponent operator= (const TableHeaderComponent&);
  14777. };
  14778. #endif // __JUCE_TABLEHEADERCOMPONENT_JUCEHEADER__
  14779. /*** End of inlined file: juce_TableHeaderComponent.h ***/
  14780. #endif
  14781. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14782. /*** Start of inlined file: juce_TableListBox.h ***/
  14783. #ifndef __JUCE_TABLELISTBOX_JUCEHEADER__
  14784. #define __JUCE_TABLELISTBOX_JUCEHEADER__
  14785. class JUCE_API TableListBoxModel
  14786. {
  14787. public:
  14788. TableListBoxModel() {}
  14789. virtual ~TableListBoxModel() {}
  14790. virtual int getNumRows() = 0;
  14791. virtual void paintRowBackground (Graphics& g,
  14792. int rowNumber,
  14793. int width, int height,
  14794. bool rowIsSelected) = 0;
  14795. virtual void paintCell (Graphics& g,
  14796. int rowNumber,
  14797. int columnId,
  14798. int width, int height,
  14799. bool rowIsSelected) = 0;
  14800. virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
  14801. Component* existingComponentToUpdate);
  14802. virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
  14803. virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);
  14804. virtual void backgroundClicked();
  14805. virtual void sortOrderChanged (int newSortColumnId, const bool isForwards);
  14806. virtual int getColumnAutoSizeWidth (int columnId);
  14807. virtual const String getCellTooltip (int rowNumber, int columnId);
  14808. virtual void selectedRowsChanged (int lastRowSelected);
  14809. virtual void deleteKeyPressed (int lastRowSelected);
  14810. virtual void returnKeyPressed (int lastRowSelected);
  14811. virtual void listWasScrolled();
  14812. virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
  14813. };
  14814. class JUCE_API TableListBox : public ListBox,
  14815. private ListBoxModel,
  14816. private TableHeaderListener
  14817. {
  14818. public:
  14819. TableListBox (const String& componentName,
  14820. TableListBoxModel* const model);
  14821. ~TableListBox();
  14822. void setModel (TableListBoxModel* const newModel);
  14823. TableListBoxModel* getModel() const { return model; }
  14824. TableHeaderComponent* getHeader() const { return header; }
  14825. void setHeaderHeight (const int newHeight);
  14826. int getHeaderHeight() const;
  14827. void autoSizeColumn (const int columnId);
  14828. void autoSizeAllColumns();
  14829. void setAutoSizeMenuOptionShown (const bool shouldBeShown);
  14830. bool isAutoSizeMenuOptionShown() const;
  14831. const Rectangle<int> getCellPosition (const int columnId,
  14832. const int rowNumber,
  14833. const bool relativeToComponentTopLeft) const;
  14834. void scrollToEnsureColumnIsOnscreen (const int columnId);
  14835. int getNumRows();
  14836. void paintListBoxItem (int, Graphics&, int, int, bool);
  14837. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  14838. void selectedRowsChanged (int lastRowSelected);
  14839. void deleteKeyPressed (int currentSelectedRow);
  14840. void returnKeyPressed (int currentSelectedRow);
  14841. void backgroundClicked();
  14842. void listWasScrolled();
  14843. void tableColumnsChanged (TableHeaderComponent*);
  14844. void tableColumnsResized (TableHeaderComponent*);
  14845. void tableSortOrderChanged (TableHeaderComponent*);
  14846. void tableColumnDraggingChanged (TableHeaderComponent*, int);
  14847. void resized();
  14848. juce_UseDebuggingNewOperator
  14849. private:
  14850. TableHeaderComponent* header;
  14851. TableListBoxModel* model;
  14852. int columnIdNowBeingDragged;
  14853. bool autoSizeOptionsShown;
  14854. void updateColumnComponents() const;
  14855. TableListBox (const TableListBox&);
  14856. const TableListBox& operator= (const TableListBox&);
  14857. };
  14858. #endif // __JUCE_TABLELISTBOX_JUCEHEADER__
  14859. /*** End of inlined file: juce_TableListBox.h ***/
  14860. #endif
  14861. #ifndef __JUCE_TEXTEDITOR_JUCEHEADER__
  14862. #endif
  14863. #ifndef __JUCE_TOOLBAR_JUCEHEADER__
  14864. #endif
  14865. #ifndef __JUCE_TOOLBARITEMCOMPONENT_JUCEHEADER__
  14866. #endif
  14867. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14868. /*** Start of inlined file: juce_ToolbarItemFactory.h ***/
  14869. #ifndef __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14870. #define __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14871. class JUCE_API ToolbarItemFactory
  14872. {
  14873. public:
  14874. ToolbarItemFactory();
  14875. virtual ~ToolbarItemFactory();
  14876. enum SpecialItemIds
  14877. {
  14878. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  14879. can be placed between sets of items to break them into groups. */
  14880. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  14881. items.*/
  14882. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  14883. either side of it, filling any available space. */
  14884. };
  14885. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  14886. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  14887. virtual ToolbarItemComponent* createItem (const int itemId) = 0;
  14888. };
  14889. #endif // __JUCE_TOOLBARITEMFACTORY_JUCEHEADER__
  14890. /*** End of inlined file: juce_ToolbarItemFactory.h ***/
  14891. #endif
  14892. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14893. /*** Start of inlined file: juce_ToolbarItemPalette.h ***/
  14894. #ifndef __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14895. #define __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14896. class JUCE_API ToolbarItemPalette : public Component,
  14897. public DragAndDropContainer
  14898. {
  14899. public:
  14900. ToolbarItemPalette (ToolbarItemFactory& factory,
  14901. Toolbar* const toolbar);
  14902. ~ToolbarItemPalette();
  14903. void resized();
  14904. juce_UseDebuggingNewOperator
  14905. private:
  14906. ToolbarItemFactory& factory;
  14907. Toolbar* toolbar;
  14908. Viewport* viewport;
  14909. friend class Toolbar;
  14910. void replaceComponent (ToolbarItemComponent* const comp);
  14911. ToolbarItemPalette (const ToolbarItemPalette&);
  14912. const ToolbarItemPalette& operator= (const ToolbarItemPalette&);
  14913. };
  14914. #endif // __JUCE_TOOLBARITEMPALETTE_JUCEHEADER__
  14915. /*** End of inlined file: juce_ToolbarItemPalette.h ***/
  14916. #endif
  14917. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14918. /*** Start of inlined file: juce_TreeView.h ***/
  14919. #ifndef __JUCE_TREEVIEW_JUCEHEADER__
  14920. #define __JUCE_TREEVIEW_JUCEHEADER__
  14921. /*** Start of inlined file: juce_FileDragAndDropTarget.h ***/
  14922. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14923. #define __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14924. class JUCE_API FileDragAndDropTarget
  14925. {
  14926. public:
  14927. virtual ~FileDragAndDropTarget() {}
  14928. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  14929. virtual void fileDragEnter (const StringArray& files, int x, int y);
  14930. virtual void fileDragMove (const StringArray& files, int x, int y);
  14931. virtual void fileDragExit (const StringArray& files);
  14932. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  14933. };
  14934. #endif // __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  14935. /*** End of inlined file: juce_FileDragAndDropTarget.h ***/
  14936. class TreeView;
  14937. class JUCE_API TreeViewItem
  14938. {
  14939. public:
  14940. TreeViewItem();
  14941. virtual ~TreeViewItem();
  14942. int getNumSubItems() const throw();
  14943. TreeViewItem* getSubItem (const int index) const throw();
  14944. void clearSubItems();
  14945. void addSubItem (TreeViewItem* const newItem,
  14946. const int insertPosition = -1);
  14947. void removeSubItem (const int index,
  14948. const bool deleteItem = true);
  14949. TreeView* getOwnerView() const throw() { return ownerView; }
  14950. TreeViewItem* getParentItem() const throw() { return parentItem; }
  14951. bool isOpen() const throw();
  14952. void setOpen (const bool shouldBeOpen);
  14953. bool isSelected() const throw();
  14954. void setSelected (const bool shouldBeSelected,
  14955. const bool deselectOtherItemsFirst);
  14956. const Rectangle<int> getItemPosition (const bool relativeToTreeViewTopLeft) const throw();
  14957. void treeHasChanged() const throw();
  14958. void repaintItem() const;
  14959. int getRowNumberInTree() const throw();
  14960. bool areAllParentsOpen() const throw();
  14961. void setLinesDrawnForSubItems (const bool shouldDrawLines) throw();
  14962. virtual bool mightContainSubItems() = 0;
  14963. virtual const String getUniqueName() const;
  14964. virtual void itemOpennessChanged (bool isNowOpen);
  14965. virtual int getItemWidth() const { return -1; }
  14966. virtual int getItemHeight() const { return 20; }
  14967. virtual bool canBeSelected() const { return true; }
  14968. virtual Component* createItemComponent() { return 0; }
  14969. virtual void paintItem (Graphics& g, int width, int height);
  14970. virtual void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver);
  14971. virtual void itemClicked (const MouseEvent& e);
  14972. virtual void itemDoubleClicked (const MouseEvent& e);
  14973. virtual void itemSelectionChanged (bool isNowSelected);
  14974. virtual const String getTooltip();
  14975. virtual const String getDragSourceDescription();
  14976. virtual bool isInterestedInFileDrag (const StringArray& files);
  14977. virtual void filesDropped (const StringArray& files, int insertIndex);
  14978. virtual bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  14979. virtual void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex);
  14980. void setDrawsInLeftMargin (bool canDrawInLeftMargin) throw();
  14981. XmlElement* getOpennessState() const throw();
  14982. void restoreOpennessState (const XmlElement& xml) throw();
  14983. int getIndexInParent() const throw();
  14984. bool isLastOfSiblings() const throw();
  14985. const String getItemIdentifierString() const;
  14986. juce_UseDebuggingNewOperator
  14987. private:
  14988. TreeView* ownerView;
  14989. TreeViewItem* parentItem;
  14990. OwnedArray <TreeViewItem> subItems;
  14991. int y, itemHeight, totalHeight, itemWidth, totalWidth;
  14992. int uid;
  14993. bool selected : 1;
  14994. bool redrawNeeded : 1;
  14995. bool drawLinesInside : 1;
  14996. bool drawsInLeftMargin : 1;
  14997. unsigned int openness : 2;
  14998. friend class TreeView;
  14999. friend class TreeViewContentComponent;
  15000. void updatePositions (int newY);
  15001. int getIndentX() const throw();
  15002. void setOwnerView (TreeView* const newOwner) throw();
  15003. void paintRecursively (Graphics& g, int width);
  15004. TreeViewItem* getTopLevelItem() throw();
  15005. TreeViewItem* findItemRecursively (int y) throw();
  15006. TreeViewItem* getDeepestOpenParentItem() throw();
  15007. int getNumRows() const throw();
  15008. TreeViewItem* getItemOnRow (int index) throw();
  15009. void deselectAllRecursively();
  15010. int countSelectedItemsRecursively() const throw();
  15011. TreeViewItem* getSelectedItemWithIndex (int index) throw();
  15012. TreeViewItem* getNextVisibleItem (const bool recurse) const throw();
  15013. TreeViewItem* findItemFromIdentifierString (const String& identifierString);
  15014. TreeViewItem (const TreeViewItem&);
  15015. const TreeViewItem& operator= (const TreeViewItem&);
  15016. };
  15017. class JUCE_API TreeView : public Component,
  15018. public SettableTooltipClient,
  15019. public FileDragAndDropTarget,
  15020. public DragAndDropTarget,
  15021. private AsyncUpdater
  15022. {
  15023. public:
  15024. TreeView (const String& componentName = String::empty);
  15025. ~TreeView();
  15026. void setRootItem (TreeViewItem* const newRootItem);
  15027. TreeViewItem* getRootItem() const throw() { return rootItem; }
  15028. void deleteRootItem();
  15029. void setRootItemVisible (const bool shouldBeVisible);
  15030. bool isRootItemVisible() const throw() { return rootItemVisible; }
  15031. void setDefaultOpenness (const bool isOpenByDefault);
  15032. bool areItemsOpenByDefault() const throw() { return defaultOpenness; }
  15033. void setMultiSelectEnabled (const bool canMultiSelect);
  15034. bool isMultiSelectEnabled() const throw() { return multiSelectEnabled; }
  15035. void setOpenCloseButtonsVisible (const bool shouldBeVisible);
  15036. bool areOpenCloseButtonsVisible() const throw() { return openCloseButtonsVisible; }
  15037. void clearSelectedItems();
  15038. int getNumSelectedItems() const throw();
  15039. TreeViewItem* getSelectedItem (const int index) const throw();
  15040. int getNumRowsInTree() const;
  15041. TreeViewItem* getItemOnRow (int index) const;
  15042. TreeViewItem* getItemAt (int yPosition) const throw();
  15043. void scrollToKeepItemVisible (TreeViewItem* item);
  15044. Viewport* getViewport() const throw() { return viewport; }
  15045. int getIndentSize() const throw() { return indentSize; }
  15046. void setIndentSize (const int newIndentSize);
  15047. TreeViewItem* findItemFromIdentifierString (const String& identifierString) const;
  15048. XmlElement* getOpennessState (const bool alsoIncludeScrollPosition) const;
  15049. void restoreOpennessState (const XmlElement& newState);
  15050. enum ColourIds
  15051. {
  15052. backgroundColourId = 0x1000500, /**< A background colour to fill the component with. */
  15053. linesColourId = 0x1000501, /**< The colour to draw the lines with.*/
  15054. dragAndDropIndicatorColourId = 0x1000502 /**< The colour to use for the drag-and-drop target position indicator. */
  15055. };
  15056. void paint (Graphics& g);
  15057. void resized();
  15058. bool keyPressed (const KeyPress& key);
  15059. void colourChanged();
  15060. void enablementChanged();
  15061. bool isInterestedInFileDrag (const StringArray& files);
  15062. void fileDragEnter (const StringArray& files, int x, int y);
  15063. void fileDragMove (const StringArray& files, int x, int y);
  15064. void fileDragExit (const StringArray& files);
  15065. void filesDropped (const StringArray& files, int x, int y);
  15066. bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent);
  15067. void itemDragEnter (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15068. void itemDragMove (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15069. void itemDragExit (const String& sourceDescription, Component* sourceComponent);
  15070. void itemDropped (const String& sourceDescription, Component* sourceComponent, int x, int y);
  15071. juce_UseDebuggingNewOperator
  15072. private:
  15073. friend class TreeViewItem;
  15074. friend class TreeViewContentComponent;
  15075. Viewport* viewport;
  15076. CriticalSection nodeAlterationLock;
  15077. TreeViewItem* rootItem;
  15078. Component* dragInsertPointHighlight;
  15079. Component* dragTargetGroupHighlight;
  15080. int indentSize;
  15081. bool defaultOpenness : 1;
  15082. bool needsRecalculating : 1;
  15083. bool rootItemVisible : 1;
  15084. bool multiSelectEnabled : 1;
  15085. bool openCloseButtonsVisible : 1;
  15086. void itemsChanged() throw();
  15087. void handleAsyncUpdate();
  15088. void moveSelectedRow (int delta);
  15089. void updateButtonUnderMouse (const MouseEvent& e);
  15090. void showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw();
  15091. void hideDragHighlight() throw();
  15092. void handleDrag (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15093. void handleDrop (const StringArray& files, const String& sourceDescription, Component* sourceComponent, int x, int y);
  15094. TreeViewItem* getInsertPosition (int& x, int& y, int& insertIndex,
  15095. const StringArray& files, const String& sourceDescription,
  15096. Component* sourceComponent) const throw();
  15097. TreeView (const TreeView&);
  15098. const TreeView& operator= (const TreeView&);
  15099. };
  15100. #endif // __JUCE_TREEVIEW_JUCEHEADER__
  15101. /*** End of inlined file: juce_TreeView.h ***/
  15102. #endif
  15103. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15104. /*** Start of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15105. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15106. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15107. /*** Start of inlined file: juce_DirectoryContentsList.h ***/
  15108. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15109. #define __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15110. /*** Start of inlined file: juce_FileFilter.h ***/
  15111. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15112. #define __JUCE_FILEFILTER_JUCEHEADER__
  15113. class JUCE_API FileFilter
  15114. {
  15115. public:
  15116. FileFilter (const String& filterDescription);
  15117. virtual ~FileFilter();
  15118. const String& getDescription() const throw();
  15119. virtual bool isFileSuitable (const File& file) const = 0;
  15120. virtual bool isDirectorySuitable (const File& file) const = 0;
  15121. protected:
  15122. String description;
  15123. };
  15124. #endif // __JUCE_FILEFILTER_JUCEHEADER__
  15125. /*** End of inlined file: juce_FileFilter.h ***/
  15126. /*** Start of inlined file: juce_Image.h ***/
  15127. #ifndef __JUCE_IMAGE_JUCEHEADER__
  15128. #define __JUCE_IMAGE_JUCEHEADER__
  15129. class JUCE_API Image
  15130. {
  15131. public:
  15132. enum PixelFormat
  15133. {
  15134. RGB, /**<< each pixel is a 3-byte packed RGB colour value. For byte order, see the PixelRGB class. */
  15135. ARGB, /**<< each pixel is a 4-byte ARGB premultiplied colour value. For byte order, see the PixelARGB class. */
  15136. SingleChannel /**<< each pixel is a 1-byte alpha channel value. */
  15137. };
  15138. Image (const PixelFormat format,
  15139. const int imageWidth,
  15140. const int imageHeight,
  15141. const bool clearImage);
  15142. Image (const Image& other);
  15143. virtual ~Image();
  15144. static Image* createNativeImage (const PixelFormat format,
  15145. const int imageWidth,
  15146. const int imageHeight,
  15147. const bool clearImage);
  15148. int getWidth() const throw() { return imageWidth; }
  15149. int getHeight() const throw() { return imageHeight; }
  15150. const Rectangle<int> getBounds() const throw() { return Rectangle<int> (0, 0, imageWidth, imageHeight); }
  15151. PixelFormat getFormat() const throw() { return format; }
  15152. bool isARGB() const throw() { return format == ARGB; }
  15153. bool isRGB() const throw() { return format == RGB; }
  15154. bool hasAlphaChannel() const throw() { return format != RGB; }
  15155. virtual void clear (int x, int y, int w, int h,
  15156. const Colour& colourToClearTo = Colour (0x00000000));
  15157. virtual Image* createCopy (int newWidth = -1,
  15158. int newHeight = -1,
  15159. const Graphics::ResamplingQuality quality = Graphics::mediumResamplingQuality) const;
  15160. virtual Image* createCopyOfAlphaChannel() const;
  15161. virtual const Colour getPixelAt (const int x, const int y) const;
  15162. virtual void setPixelAt (const int x, const int y, const Colour& colour);
  15163. virtual void multiplyAlphaAt (const int x, const int y, const float multiplier);
  15164. virtual void multiplyAllAlphas (const float amountToMultiplyBy);
  15165. virtual void desaturate();
  15166. class BitmapData
  15167. {
  15168. public:
  15169. BitmapData (Image& image, int x, int y, int w, int h, const bool needsToBeWritable);
  15170. BitmapData (const Image& image, int x, int y, int w, int h);
  15171. ~BitmapData();
  15172. inline uint8* getLinePointer (const int y) const { return data + y * lineStride; }
  15173. inline uint8* getPixelPointer (const int x, const int y) const { return data + y * lineStride + x * pixelStride; }
  15174. uint8* data;
  15175. int lineStride, pixelStride, width, height;
  15176. private:
  15177. BitmapData (const BitmapData&);
  15178. const BitmapData& operator= (const BitmapData&);
  15179. };
  15180. virtual void setPixelData (int destX, int destY, int destW, int destH,
  15181. const uint8* sourcePixelData, int sourceLineStride);
  15182. virtual void moveImageSection (int destX, int destY,
  15183. int sourceX, int sourceY,
  15184. int width, int height);
  15185. void createSolidAreaMask (RectangleList& result,
  15186. const float alphaThreshold = 0.5f) const;
  15187. juce_UseDebuggingNewOperator
  15188. virtual LowLevelGraphicsContext* createLowLevelContext();
  15189. protected:
  15190. friend class BitmapData;
  15191. const PixelFormat format;
  15192. const int imageWidth, imageHeight;
  15193. Image (const PixelFormat format,
  15194. const int imageWidth,
  15195. const int imageHeight);
  15196. int pixelStride, lineStride;
  15197. HeapBlock <uint8> imageDataAllocated;
  15198. uint8* imageData;
  15199. private:
  15200. const Image& operator= (const Image&);
  15201. };
  15202. #endif // __JUCE_IMAGE_JUCEHEADER__
  15203. /*** End of inlined file: juce_Image.h ***/
  15204. class JUCE_API DirectoryContentsList : public ChangeBroadcaster,
  15205. public TimeSliceClient
  15206. {
  15207. public:
  15208. DirectoryContentsList (const FileFilter* const fileFilter,
  15209. TimeSliceThread& threadToUse);
  15210. ~DirectoryContentsList();
  15211. void setDirectory (const File& directory,
  15212. const bool includeDirectories,
  15213. const bool includeFiles);
  15214. const File& getDirectory() const;
  15215. void clear();
  15216. void refresh();
  15217. bool isStillLoading() const;
  15218. void setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles);
  15219. bool ignoresHiddenFiles() const { return ignoreHiddenFiles; }
  15220. struct FileInfo
  15221. {
  15222. String filename;
  15223. int64 fileSize;
  15224. Time modificationTime;
  15225. Time creationTime;
  15226. bool isDirectory;
  15227. bool isReadOnly;
  15228. };
  15229. int getNumFiles() const;
  15230. bool getFileInfo (const int index,
  15231. FileInfo& resultInfo) const;
  15232. const File getFile (const int index) const;
  15233. const FileFilter* getFilter() const { return fileFilter; }
  15234. bool useTimeSlice();
  15235. TimeSliceThread& getTimeSliceThread() { return thread; }
  15236. static int compareElements (const DirectoryContentsList::FileInfo* const first,
  15237. const DirectoryContentsList::FileInfo* const second);
  15238. juce_UseDebuggingNewOperator
  15239. private:
  15240. File root;
  15241. const FileFilter* fileFilter;
  15242. TimeSliceThread& thread;
  15243. bool includeDirectories, includeFiles, ignoreHiddenFiles;
  15244. CriticalSection fileListLock;
  15245. OwnedArray <FileInfo> files;
  15246. void* volatile fileFindHandle;
  15247. bool volatile shouldStop;
  15248. void changed();
  15249. bool checkNextFile (bool& hasChanged);
  15250. bool addFile (const String& filename, const bool isDir, const bool isHidden,
  15251. const int64 fileSize, const Time& modTime,
  15252. const Time& creationTime, const bool isReadOnly);
  15253. DirectoryContentsList (const DirectoryContentsList&);
  15254. const DirectoryContentsList& operator= (const DirectoryContentsList&);
  15255. };
  15256. #endif // __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15257. /*** End of inlined file: juce_DirectoryContentsList.h ***/
  15258. /*** Start of inlined file: juce_FileBrowserListener.h ***/
  15259. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15260. #define __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15261. class JUCE_API FileBrowserListener
  15262. {
  15263. public:
  15264. virtual ~FileBrowserListener();
  15265. virtual void selectionChanged() = 0;
  15266. virtual void fileClicked (const File& file, const MouseEvent& e) = 0;
  15267. virtual void fileDoubleClicked (const File& file) = 0;
  15268. };
  15269. #endif // __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15270. /*** End of inlined file: juce_FileBrowserListener.h ***/
  15271. class JUCE_API DirectoryContentsDisplayComponent
  15272. {
  15273. public:
  15274. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  15275. virtual ~DirectoryContentsDisplayComponent();
  15276. virtual int getNumSelectedFiles() const = 0;
  15277. virtual const File getSelectedFile (int index) const = 0;
  15278. virtual void scrollToTop() = 0;
  15279. void addListener (FileBrowserListener* const listener) throw();
  15280. void removeListener (FileBrowserListener* const listener) throw();
  15281. enum ColourIds
  15282. {
  15283. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  15284. textColourId = 0x1000541, /**< The colour for the text. */
  15285. };
  15286. void sendSelectionChangeMessage();
  15287. void sendDoubleClickMessage (const File& file);
  15288. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  15289. juce_UseDebuggingNewOperator
  15290. protected:
  15291. DirectoryContentsList& fileList;
  15292. SortedSet <void*> listeners;
  15293. DirectoryContentsDisplayComponent (const DirectoryContentsDisplayComponent&);
  15294. const DirectoryContentsDisplayComponent& operator= (const DirectoryContentsDisplayComponent&);
  15295. };
  15296. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  15297. /*** End of inlined file: juce_DirectoryContentsDisplayComponent.h ***/
  15298. #endif
  15299. #ifndef __JUCE_DIRECTORYCONTENTSLIST_JUCEHEADER__
  15300. #endif
  15301. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15302. /*** Start of inlined file: juce_FileBrowserComponent.h ***/
  15303. #ifndef __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15304. #define __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15305. /*** Start of inlined file: juce_FilePreviewComponent.h ***/
  15306. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15307. #define __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15308. class JUCE_API FilePreviewComponent : public Component
  15309. {
  15310. public:
  15311. FilePreviewComponent();
  15312. ~FilePreviewComponent();
  15313. virtual void selectedFileChanged (const File& newSelectedFile) = 0;
  15314. juce_UseDebuggingNewOperator
  15315. private:
  15316. FilePreviewComponent (const FilePreviewComponent&);
  15317. const FilePreviewComponent& operator= (const FilePreviewComponent&);
  15318. };
  15319. #endif // __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15320. /*** End of inlined file: juce_FilePreviewComponent.h ***/
  15321. class JUCE_API FileBrowserComponent : public Component,
  15322. public ChangeBroadcaster,
  15323. private FileBrowserListener,
  15324. private TextEditorListener,
  15325. private ButtonListener,
  15326. private ComboBoxListener,
  15327. private FileFilter
  15328. {
  15329. public:
  15330. enum FileChooserFlags
  15331. {
  15332. openMode = 1, /**< specifies that the component should allow the user to
  15333. choose an existing file with the intention of opening it. */
  15334. saveMode = 2, /**< specifies that the component should allow the user to specify
  15335. the name of a file that will be used to save something. */
  15336. canSelectFiles = 4, /**< specifies that the user can select files (can be used in
  15337. conjunction with canSelectDirectories). */
  15338. canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
  15339. conjuction with canSelectFiles). */
  15340. canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
  15341. useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
  15342. filenameBoxIsReadOnly = 64 /**< specifies that the user can't type directly into the filename box. */
  15343. };
  15344. FileBrowserComponent (int flags,
  15345. const File& initialFileOrDirectory,
  15346. const FileFilter* fileFilter,
  15347. FilePreviewComponent* previewComp);
  15348. ~FileBrowserComponent();
  15349. int getNumSelectedFiles() const throw();
  15350. const File getSelectedFile (int index) const throw();
  15351. bool currentFileIsValid() const;
  15352. const File getHighlightedFile() const throw();
  15353. const File getRoot() const;
  15354. void setRoot (const File& newRootDirectory);
  15355. void goUp();
  15356. void refresh();
  15357. virtual const String getActionVerb() const;
  15358. bool isSaveMode() const throw();
  15359. void addListener (FileBrowserListener* const listener) throw();
  15360. void removeListener (FileBrowserListener* const listener) throw();
  15361. void resized();
  15362. void buttonClicked (Button* b);
  15363. void comboBoxChanged (ComboBox*);
  15364. void textEditorTextChanged (TextEditor& editor);
  15365. void textEditorReturnKeyPressed (TextEditor& editor);
  15366. void textEditorEscapeKeyPressed (TextEditor& editor);
  15367. void textEditorFocusLost (TextEditor& editor);
  15368. bool keyPressed (const KeyPress& key);
  15369. void selectionChanged();
  15370. void fileClicked (const File& f, const MouseEvent& e);
  15371. void fileDoubleClicked (const File& f);
  15372. bool isFileSuitable (const File& file) const;
  15373. bool isDirectorySuitable (const File&) const;
  15374. FilePreviewComponent* getPreviewComponent() const throw();
  15375. juce_UseDebuggingNewOperator
  15376. protected:
  15377. virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
  15378. private:
  15379. ScopedPointer <DirectoryContentsList> fileList;
  15380. const FileFilter* fileFilter;
  15381. int flags;
  15382. File currentRoot;
  15383. Array<File> chosenFiles;
  15384. SortedSet <void*> listeners;
  15385. DirectoryContentsDisplayComponent* fileListComponent;
  15386. FilePreviewComponent* previewComp;
  15387. ComboBox* currentPathBox;
  15388. TextEditor* filenameBox;
  15389. Button* goUpButton;
  15390. TimeSliceThread thread;
  15391. void sendListenerChangeMessage();
  15392. bool isFileOrDirSuitable (const File& f) const;
  15393. FileBrowserComponent (const FileBrowserComponent&);
  15394. const FileBrowserComponent& operator= (const FileBrowserComponent&);
  15395. };
  15396. #endif // __JUCE_FILEBROWSERCOMPONENT_JUCEHEADER__
  15397. /*** End of inlined file: juce_FileBrowserComponent.h ***/
  15398. #endif
  15399. #ifndef __JUCE_FILEBROWSERLISTENER_JUCEHEADER__
  15400. #endif
  15401. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15402. /*** Start of inlined file: juce_FileChooser.h ***/
  15403. #ifndef __JUCE_FILECHOOSER_JUCEHEADER__
  15404. #define __JUCE_FILECHOOSER_JUCEHEADER__
  15405. class JUCE_API FileChooser
  15406. {
  15407. public:
  15408. FileChooser (const String& dialogBoxTitle,
  15409. const File& initialFileOrDirectory = File::nonexistent,
  15410. const String& filePatternsAllowed = String::empty,
  15411. const bool useOSNativeDialogBox = true);
  15412. ~FileChooser();
  15413. bool browseForFileToOpen (FilePreviewComponent* previewComponent = 0);
  15414. bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = 0);
  15415. bool browseForFileToSave (const bool warnAboutOverwritingExistingFiles);
  15416. bool browseForDirectory();
  15417. bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = 0);
  15418. const File getResult() const;
  15419. const Array<File>& getResults() const;
  15420. juce_UseDebuggingNewOperator
  15421. private:
  15422. String title, filters;
  15423. File startingFile;
  15424. Array<File> results;
  15425. bool useNativeDialogBox;
  15426. bool showDialog (const bool selectsDirectories,
  15427. const bool selectsFiles,
  15428. const bool isSave,
  15429. const bool warnAboutOverwritingExistingFiles,
  15430. const bool selectMultipleFiles,
  15431. FilePreviewComponent* const previewComponent);
  15432. static void showPlatformDialog (Array<File>& results,
  15433. const String& title,
  15434. const File& file,
  15435. const String& filters,
  15436. bool selectsDirectories,
  15437. bool selectsFiles,
  15438. bool isSave,
  15439. bool warnAboutOverwritingExistingFiles,
  15440. bool selectMultipleFiles,
  15441. FilePreviewComponent* previewComponent);
  15442. };
  15443. #endif // __JUCE_FILECHOOSER_JUCEHEADER__
  15444. /*** End of inlined file: juce_FileChooser.h ***/
  15445. #endif
  15446. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15447. /*** Start of inlined file: juce_FileChooserDialogBox.h ***/
  15448. #ifndef __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15449. #define __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15450. /*** Start of inlined file: juce_ResizableWindow.h ***/
  15451. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15452. #define __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15453. /*** Start of inlined file: juce_TopLevelWindow.h ***/
  15454. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15455. #define __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15456. /*** Start of inlined file: juce_DropShadower.h ***/
  15457. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  15458. #define __JUCE_DROPSHADOWER_JUCEHEADER__
  15459. class JUCE_API DropShadower : public ComponentListener
  15460. {
  15461. public:
  15462. DropShadower (const float alpha = 0.5f,
  15463. const int xOffset = 1,
  15464. const int yOffset = 5,
  15465. const float blurRadius = 10.0f);
  15466. virtual ~DropShadower();
  15467. void setOwner (Component* componentToFollow);
  15468. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  15469. void componentBroughtToFront (Component& component);
  15470. void componentChildrenChanged (Component& component);
  15471. void componentParentHierarchyChanged (Component& component);
  15472. void componentVisibilityChanged (Component& component);
  15473. juce_UseDebuggingNewOperator
  15474. private:
  15475. Component* owner;
  15476. int numShadows;
  15477. Component* shadowWindows[4];
  15478. Image* shadowImageSections[12];
  15479. const int shadowEdge, xOffset, yOffset;
  15480. const float alpha, blurRadius;
  15481. bool inDestructor, reentrant;
  15482. void updateShadows();
  15483. void setShadowImage (Image* const src,
  15484. const int num,
  15485. const int w, const int h,
  15486. const int sx, const int sy);
  15487. void bringShadowWindowsToFront();
  15488. void deleteShadowWindows();
  15489. DropShadower (const DropShadower&);
  15490. const DropShadower& operator= (const DropShadower&);
  15491. };
  15492. #endif // __JUCE_DROPSHADOWER_JUCEHEADER__
  15493. /*** End of inlined file: juce_DropShadower.h ***/
  15494. class JUCE_API TopLevelWindow : public Component
  15495. {
  15496. public:
  15497. TopLevelWindow (const String& name,
  15498. const bool addToDesktop);
  15499. ~TopLevelWindow();
  15500. bool isActiveWindow() const throw() { return windowIsActive_; }
  15501. void centreAroundComponent (Component* componentToCentreAround,
  15502. const int width, const int height);
  15503. void setDropShadowEnabled (const bool useShadow);
  15504. void setUsingNativeTitleBar (const bool useNativeTitleBar);
  15505. bool isUsingNativeTitleBar() const throw() { return useNativeTitleBar && isOnDesktop(); }
  15506. static int getNumTopLevelWindows() throw();
  15507. static TopLevelWindow* getTopLevelWindow (const int index) throw();
  15508. static TopLevelWindow* getActiveTopLevelWindow() throw();
  15509. juce_UseDebuggingNewOperator
  15510. virtual void addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo = 0);
  15511. protected:
  15512. virtual void activeWindowStatusChanged();
  15513. void focusOfChildComponentChanged (FocusChangeType cause);
  15514. void parentHierarchyChanged();
  15515. void visibilityChanged();
  15516. virtual int getDesktopWindowStyleFlags() const;
  15517. void recreateDesktopWindow();
  15518. private:
  15519. friend class TopLevelWindowManager;
  15520. bool useDropShadow, useNativeTitleBar, windowIsActive_;
  15521. ScopedPointer <DropShadower> shadower;
  15522. void setWindowActive (const bool isNowActive) throw();
  15523. TopLevelWindow (const TopLevelWindow&);
  15524. const TopLevelWindow& operator= (const TopLevelWindow&);
  15525. };
  15526. #endif // __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  15527. /*** End of inlined file: juce_TopLevelWindow.h ***/
  15528. /*** Start of inlined file: juce_ComponentDragger.h ***/
  15529. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15530. #define __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15531. /*** Start of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15532. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15533. #define __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15534. class JUCE_API ComponentBoundsConstrainer
  15535. {
  15536. public:
  15537. ComponentBoundsConstrainer() throw();
  15538. virtual ~ComponentBoundsConstrainer();
  15539. void setMinimumWidth (const int minimumWidth) throw();
  15540. int getMinimumWidth() const throw() { return minW; }
  15541. void setMaximumWidth (const int maximumWidth) throw();
  15542. int getMaximumWidth() const throw() { return maxW; }
  15543. void setMinimumHeight (const int minimumHeight) throw();
  15544. int getMinimumHeight() const throw() { return minH; }
  15545. void setMaximumHeight (const int maximumHeight) throw();
  15546. int getMaximumHeight() const throw() { return maxH; }
  15547. void setMinimumSize (const int minimumWidth,
  15548. const int minimumHeight) throw();
  15549. void setMaximumSize (const int maximumWidth,
  15550. const int maximumHeight) throw();
  15551. void setSizeLimits (const int minimumWidth,
  15552. const int minimumHeight,
  15553. const int maximumWidth,
  15554. const int maximumHeight) throw();
  15555. void setMinimumOnscreenAmounts (const int minimumWhenOffTheTop,
  15556. const int minimumWhenOffTheLeft,
  15557. const int minimumWhenOffTheBottom,
  15558. const int minimumWhenOffTheRight) throw();
  15559. void setFixedAspectRatio (const double widthOverHeight) throw();
  15560. double getFixedAspectRatio() const throw();
  15561. virtual void checkBounds (int& x, int& y, int& w, int& h,
  15562. const Rectangle<int>& previousBounds,
  15563. const Rectangle<int>& limits,
  15564. const bool isStretchingTop,
  15565. const bool isStretchingLeft,
  15566. const bool isStretchingBottom,
  15567. const bool isStretchingRight);
  15568. virtual void resizeStart();
  15569. virtual void resizeEnd();
  15570. void setBoundsForComponent (Component* const component,
  15571. int x, int y, int w, int h,
  15572. const bool isStretchingTop,
  15573. const bool isStretchingLeft,
  15574. const bool isStretchingBottom,
  15575. const bool isStretchingRight);
  15576. void checkComponentBounds (Component* component);
  15577. virtual void applyBoundsToComponent (Component* component,
  15578. int x, int y, int w, int h);
  15579. juce_UseDebuggingNewOperator
  15580. private:
  15581. int minW, maxW, minH, maxH;
  15582. int minOffTop, minOffLeft, minOffBottom, minOffRight;
  15583. double aspectRatio;
  15584. ComponentBoundsConstrainer (const ComponentBoundsConstrainer&);
  15585. const ComponentBoundsConstrainer& operator= (const ComponentBoundsConstrainer&);
  15586. };
  15587. #endif // __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  15588. /*** End of inlined file: juce_ComponentBoundsConstrainer.h ***/
  15589. class JUCE_API ComponentDragger
  15590. {
  15591. public:
  15592. ComponentDragger();
  15593. virtual ~ComponentDragger();
  15594. void startDraggingComponent (Component* const componentToDrag,
  15595. ComponentBoundsConstrainer* constrainer);
  15596. void dragComponent (Component* const componentToDrag,
  15597. const MouseEvent& e);
  15598. juce_UseDebuggingNewOperator
  15599. private:
  15600. ComponentBoundsConstrainer* constrainer;
  15601. int originalX, originalY;
  15602. };
  15603. #endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  15604. /*** End of inlined file: juce_ComponentDragger.h ***/
  15605. /*** Start of inlined file: juce_ResizableBorderComponent.h ***/
  15606. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15607. #define __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15608. class JUCE_API ResizableBorderComponent : public Component
  15609. {
  15610. public:
  15611. ResizableBorderComponent (Component* const componentToResize,
  15612. ComponentBoundsConstrainer* const constrainer);
  15613. ~ResizableBorderComponent();
  15614. void setBorderThickness (const BorderSize& newBorderSize) throw();
  15615. const BorderSize getBorderThickness() const throw();
  15616. juce_UseDebuggingNewOperator
  15617. protected:
  15618. void paint (Graphics& g);
  15619. void mouseEnter (const MouseEvent& e);
  15620. void mouseMove (const MouseEvent& e);
  15621. void mouseDown (const MouseEvent& e);
  15622. void mouseDrag (const MouseEvent& e);
  15623. void mouseUp (const MouseEvent& e);
  15624. bool hitTest (int x, int y);
  15625. private:
  15626. Component* const component;
  15627. ComponentBoundsConstrainer* constrainer;
  15628. BorderSize borderSize;
  15629. int originalX, originalY, originalW, originalH;
  15630. int mouseZone;
  15631. void updateMouseZone (const MouseEvent& e) throw();
  15632. ResizableBorderComponent (const ResizableBorderComponent&);
  15633. const ResizableBorderComponent& operator= (const ResizableBorderComponent&);
  15634. };
  15635. #endif // __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  15636. /*** End of inlined file: juce_ResizableBorderComponent.h ***/
  15637. /*** Start of inlined file: juce_ResizableCornerComponent.h ***/
  15638. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15639. #define __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15640. class JUCE_API ResizableCornerComponent : public Component
  15641. {
  15642. public:
  15643. ResizableCornerComponent (Component* const componentToResize,
  15644. ComponentBoundsConstrainer* const constrainer);
  15645. ~ResizableCornerComponent();
  15646. juce_UseDebuggingNewOperator
  15647. protected:
  15648. void paint (Graphics& g);
  15649. void mouseDown (const MouseEvent& e);
  15650. void mouseDrag (const MouseEvent& e);
  15651. void mouseUp (const MouseEvent& e);
  15652. bool hitTest (int x, int y);
  15653. private:
  15654. Component* const component;
  15655. ComponentBoundsConstrainer* constrainer;
  15656. int originalX, originalY, originalW, originalH;
  15657. ResizableCornerComponent (const ResizableCornerComponent&);
  15658. const ResizableCornerComponent& operator= (const ResizableCornerComponent&);
  15659. };
  15660. #endif // __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  15661. /*** End of inlined file: juce_ResizableCornerComponent.h ***/
  15662. class JUCE_API ResizableWindow : public TopLevelWindow
  15663. {
  15664. public:
  15665. ResizableWindow (const String& name,
  15666. const bool addToDesktop);
  15667. ResizableWindow (const String& name,
  15668. const Colour& backgroundColour,
  15669. const bool addToDesktop);
  15670. ~ResizableWindow();
  15671. const Colour getBackgroundColour() const throw();
  15672. void setBackgroundColour (const Colour& newColour);
  15673. void setResizable (const bool shouldBeResizable,
  15674. const bool useBottomRightCornerResizer);
  15675. bool isResizable() const throw();
  15676. void setResizeLimits (const int newMinimumWidth,
  15677. const int newMinimumHeight,
  15678. const int newMaximumWidth,
  15679. const int newMaximumHeight) throw();
  15680. ComponentBoundsConstrainer* getConstrainer() throw() { return constrainer; }
  15681. void setConstrainer (ComponentBoundsConstrainer* newConstrainer);
  15682. void setBoundsConstrained (int x, int y, int width, int height);
  15683. bool isFullScreen() const;
  15684. void setFullScreen (const bool shouldBeFullScreen);
  15685. bool isMinimised() const;
  15686. void setMinimised (const bool shouldMinimise);
  15687. const String getWindowStateAsString();
  15688. bool restoreWindowStateFromString (const String& previousState);
  15689. Component* getContentComponent() const throw() { return contentComponent; }
  15690. void setContentComponent (Component* const newContentComponent,
  15691. const bool deleteOldOne = true,
  15692. const bool resizeToFit = false);
  15693. void setContentComponentSize (int width, int height);
  15694. enum ColourIds
  15695. {
  15696. backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
  15697. };
  15698. juce_UseDebuggingNewOperator
  15699. protected:
  15700. void paint (Graphics& g);
  15701. void moved();
  15702. void resized();
  15703. void mouseDown (const MouseEvent& e);
  15704. void mouseDrag (const MouseEvent& e);
  15705. void lookAndFeelChanged();
  15706. void childBoundsChanged (Component* child);
  15707. void parentSizeChanged();
  15708. void visibilityChanged();
  15709. void activeWindowStatusChanged();
  15710. int getDesktopWindowStyleFlags() const;
  15711. virtual const BorderSize getBorderThickness();
  15712. virtual const BorderSize getContentComponentBorder();
  15713. #ifdef JUCE_DEBUG
  15714. void addChildComponent (Component* const child, int zOrder = -1);
  15715. void addAndMakeVisible (Component* const child, int zOrder = -1);
  15716. #endif
  15717. ScopedPointer <ResizableCornerComponent> resizableCorner;
  15718. ScopedPointer <ResizableBorderComponent> resizableBorder;
  15719. private:
  15720. ScopedPointer <Component> contentComponent;
  15721. bool resizeToFitContent, fullscreen;
  15722. ComponentDragger dragger;
  15723. Rectangle<int> lastNonFullScreenPos;
  15724. ComponentBoundsConstrainer defaultConstrainer;
  15725. ComponentBoundsConstrainer* constrainer;
  15726. #ifdef JUCE_DEBUG
  15727. bool hasBeenResized;
  15728. #endif
  15729. void updateLastPos();
  15730. ResizableWindow (const ResizableWindow&);
  15731. const ResizableWindow& operator= (const ResizableWindow&);
  15732. // (xxx remove these eventually)
  15733. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15734. void getBorderThickness (int& left, int& top, int& right, int& bottom);
  15735. // temporarily here to stop old code compiling, as the parameters for these methods have changed..
  15736. void getContentComponentBorder (int& left, int& top, int& right, int& bottom);
  15737. };
  15738. #endif // __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  15739. /*** End of inlined file: juce_ResizableWindow.h ***/
  15740. /*** Start of inlined file: juce_GlyphArrangement.h ***/
  15741. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15742. #define __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15743. class JUCE_API PositionedGlyph
  15744. {
  15745. public:
  15746. juce_wchar getCharacter() const { return character; }
  15747. bool isWhitespace() const { return CharacterFunctions::isWhitespace (character); }
  15748. float getLeft() const { return x; }
  15749. float getRight() const { return x + w; }
  15750. float getBaselineY() const { return y; }
  15751. float getTop() const { return y - font.getAscent(); }
  15752. float getBottom() const { return y + font.getDescent(); }
  15753. void moveBy (const float deltaX,
  15754. const float deltaY);
  15755. void draw (const Graphics& g) const;
  15756. void draw (const Graphics& g, const AffineTransform& transform) const;
  15757. void createPath (Path& path) const;
  15758. bool hitTest (float x, float y) const;
  15759. juce_UseDebuggingNewOperator
  15760. private:
  15761. friend class GlyphArrangement;
  15762. float x, y, w;
  15763. Font font;
  15764. juce_wchar character;
  15765. int glyph;
  15766. PositionedGlyph();
  15767. };
  15768. class JUCE_API GlyphArrangement
  15769. {
  15770. public:
  15771. GlyphArrangement();
  15772. GlyphArrangement (const GlyphArrangement& other);
  15773. const GlyphArrangement& operator= (const GlyphArrangement& other);
  15774. ~GlyphArrangement();
  15775. int getNumGlyphs() const { return glyphs.size(); }
  15776. PositionedGlyph& getGlyph (const int index) const;
  15777. void clear();
  15778. void addLineOfText (const Font& font,
  15779. const String& text,
  15780. const float x,
  15781. const float y);
  15782. void addCurtailedLineOfText (const Font& font,
  15783. const String& text,
  15784. float x,
  15785. const float y,
  15786. const float maxWidthPixels,
  15787. const bool useEllipsis);
  15788. void addJustifiedText (const Font& font,
  15789. const String& text,
  15790. float x, float y,
  15791. const float maxLineWidth,
  15792. const Justification& horizontalLayout);
  15793. void addFittedText (const Font& font,
  15794. const String& text,
  15795. const float x, const float y,
  15796. const float width, const float height,
  15797. const Justification& layout,
  15798. int maximumLinesToUse,
  15799. const float minimumHorizontalScale = 0.7f);
  15800. void addGlyphArrangement (const GlyphArrangement& other);
  15801. void draw (const Graphics& g) const;
  15802. void draw (const Graphics& g, const AffineTransform& transform) const;
  15803. void createPath (Path& path) const;
  15804. int findGlyphIndexAt (float x, float y) const;
  15805. void getBoundingBox (int startIndex,
  15806. int numGlyphs,
  15807. float& left,
  15808. float& top,
  15809. float& right,
  15810. float& bottom,
  15811. const bool includeWhitespace) const;
  15812. void moveRangeOfGlyphs (int startIndex, int numGlyphs,
  15813. const float deltaX,
  15814. const float deltaY);
  15815. void removeRangeOfGlyphs (int startIndex, int numGlyphs);
  15816. void stretchRangeOfGlyphs (int startIndex, int numGlyphs,
  15817. const float horizontalScaleFactor);
  15818. void justifyGlyphs (const int startIndex, const int numGlyphs,
  15819. const float x,
  15820. const float y,
  15821. const float width,
  15822. const float height,
  15823. const Justification& justification);
  15824. juce_UseDebuggingNewOperator
  15825. private:
  15826. OwnedArray <PositionedGlyph> glyphs;
  15827. int insertEllipsis (const Font& font, const float maxXPos, const int startIndex, int endIndex);
  15828. int fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font& font,
  15829. const Justification& justification, float minimumHorizontalScale);
  15830. void spreadOutLine (const int start, const int numGlyphs, const float targetWidth);
  15831. };
  15832. #endif // __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  15833. /*** End of inlined file: juce_GlyphArrangement.h ***/
  15834. class JUCE_API FileChooserDialogBox : public ResizableWindow,
  15835. public ButtonListener,
  15836. public FileBrowserListener
  15837. {
  15838. public:
  15839. FileChooserDialogBox (const String& title,
  15840. const String& instructions,
  15841. FileBrowserComponent& browserComponent,
  15842. const bool warnAboutOverwritingExistingFiles,
  15843. const Colour& backgroundColour);
  15844. ~FileChooserDialogBox();
  15845. bool show (int width = 0,int height = 0);
  15846. enum ColourIds
  15847. {
  15848. titleTextColourId = 0x1000850, /**< The colour to use to draw the box's title. */
  15849. };
  15850. void buttonClicked (Button* button);
  15851. void closeButtonPressed();
  15852. void selectionChanged();
  15853. void fileClicked (const File& file, const MouseEvent& e);
  15854. void fileDoubleClicked (const File& file);
  15855. juce_UseDebuggingNewOperator
  15856. private:
  15857. class ContentComponent : public Component
  15858. {
  15859. public:
  15860. ContentComponent();
  15861. ~ContentComponent();
  15862. void paint (Graphics& g);
  15863. void resized();
  15864. String instructions;
  15865. GlyphArrangement text;
  15866. FileBrowserComponent* chooserComponent;
  15867. FilePreviewComponent* previewComponent;
  15868. TextButton* okButton;
  15869. TextButton* cancelButton;
  15870. };
  15871. ContentComponent* content;
  15872. const bool warnAboutOverwritingExistingFiles;
  15873. FileChooserDialogBox (const FileChooserDialogBox&);
  15874. const FileChooserDialogBox& operator= (const FileChooserDialogBox&);
  15875. };
  15876. #endif // __JUCE_FILECHOOSERDIALOGBOX_JUCEHEADER__
  15877. /*** End of inlined file: juce_FileChooserDialogBox.h ***/
  15878. #endif
  15879. #ifndef __JUCE_FILEFILTER_JUCEHEADER__
  15880. #endif
  15881. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15882. /*** Start of inlined file: juce_FileListComponent.h ***/
  15883. #ifndef __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15884. #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15885. class JUCE_API FileListComponent : public ListBox,
  15886. public DirectoryContentsDisplayComponent,
  15887. private ListBoxModel,
  15888. private ChangeListener
  15889. {
  15890. public:
  15891. FileListComponent (DirectoryContentsList& listToShow);
  15892. ~FileListComponent();
  15893. int getNumSelectedFiles() const;
  15894. const File getSelectedFile (int index = 0) const;
  15895. void scrollToTop();
  15896. void changeListenerCallback (void*);
  15897. int getNumRows();
  15898. void paintListBoxItem (int, Graphics&, int, int, bool);
  15899. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  15900. void selectedRowsChanged (int lastRowSelected);
  15901. void deleteKeyPressed (int currentSelectedRow);
  15902. void returnKeyPressed (int currentSelectedRow);
  15903. juce_UseDebuggingNewOperator
  15904. private:
  15905. FileListComponent (const FileListComponent&);
  15906. const FileListComponent& operator= (const FileListComponent&);
  15907. File lastDirectory;
  15908. };
  15909. #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__
  15910. /*** End of inlined file: juce_FileListComponent.h ***/
  15911. #endif
  15912. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15913. /*** Start of inlined file: juce_FilenameComponent.h ***/
  15914. #ifndef __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15915. #define __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15916. class FilenameComponent;
  15917. class JUCE_API FilenameComponentListener
  15918. {
  15919. public:
  15920. virtual ~FilenameComponentListener() {}
  15921. virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
  15922. };
  15923. class JUCE_API FilenameComponent : public Component,
  15924. public SettableTooltipClient,
  15925. public FileDragAndDropTarget,
  15926. private AsyncUpdater,
  15927. private ButtonListener,
  15928. private ComboBoxListener
  15929. {
  15930. public:
  15931. FilenameComponent (const String& name,
  15932. const File& currentFile,
  15933. const bool canEditFilename,
  15934. const bool isDirectory,
  15935. const bool isForSaving,
  15936. const String& fileBrowserWildcard,
  15937. const String& enforcedSuffix,
  15938. const String& textWhenNothingSelected);
  15939. ~FilenameComponent();
  15940. const File getCurrentFile() const;
  15941. void setCurrentFile (File newFile,
  15942. const bool addToRecentlyUsedList,
  15943. const bool sendChangeNotification = true);
  15944. void setFilenameIsEditable (const bool shouldBeEditable);
  15945. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15946. const StringArray getRecentlyUsedFilenames() const;
  15947. void setRecentlyUsedFilenames (const StringArray& filenames);
  15948. void addRecentlyUsedFile (const File& file);
  15949. void setMaxNumberOfRecentFiles (const int newMaximum);
  15950. void setBrowseButtonText (const String& browseButtonText);
  15951. void addListener (FilenameComponentListener* const listener) throw();
  15952. void removeListener (FilenameComponentListener* const listener) throw();
  15953. void setTooltip (const String& newTooltip);
  15954. void paintOverChildren (Graphics& g);
  15955. void resized();
  15956. void lookAndFeelChanged();
  15957. bool isInterestedInFileDrag (const StringArray& files);
  15958. void filesDropped (const StringArray& files, int, int);
  15959. void fileDragEnter (const StringArray& files, int, int);
  15960. void fileDragExit (const StringArray& files);
  15961. juce_UseDebuggingNewOperator
  15962. private:
  15963. ComboBox* filenameBox;
  15964. String lastFilename;
  15965. Button* browseButton;
  15966. int maxRecentFiles;
  15967. bool isDir, isSaving, isFileDragOver;
  15968. String wildcard, enforcedSuffix, browseButtonText;
  15969. SortedSet <void*> listeners;
  15970. File defaultBrowseFile;
  15971. void comboBoxChanged (ComboBox*);
  15972. void buttonClicked (Button* button);
  15973. void handleAsyncUpdate();
  15974. FilenameComponent (const FilenameComponent&);
  15975. const FilenameComponent& operator= (const FilenameComponent&);
  15976. };
  15977. #endif // __JUCE_FILENAMECOMPONENT_JUCEHEADER__
  15978. /*** End of inlined file: juce_FilenameComponent.h ***/
  15979. #endif
  15980. #ifndef __JUCE_FILEPREVIEWCOMPONENT_JUCEHEADER__
  15981. #endif
  15982. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15983. /*** Start of inlined file: juce_FileSearchPathListComponent.h ***/
  15984. #ifndef __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15985. #define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  15986. class JUCE_API FileSearchPathListComponent : public Component,
  15987. public SettableTooltipClient,
  15988. public FileDragAndDropTarget,
  15989. private ButtonListener,
  15990. private ListBoxModel
  15991. {
  15992. public:
  15993. FileSearchPathListComponent();
  15994. ~FileSearchPathListComponent();
  15995. const FileSearchPath& getPath() const throw() { return path; }
  15996. void setPath (const FileSearchPath& newPath);
  15997. void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
  15998. enum ColourIds
  15999. {
  16000. backgroundColourId = 0x1004100, /**< The background colour to fill the component with.
  16001. Make this transparent if you don't want the background to be filled. */
  16002. };
  16003. int getNumRows();
  16004. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  16005. void deleteKeyPressed (int lastRowSelected);
  16006. void returnKeyPressed (int lastRowSelected);
  16007. void listBoxItemDoubleClicked (int row, const MouseEvent&);
  16008. void selectedRowsChanged (int lastRowSelected);
  16009. void resized();
  16010. void paint (Graphics& g);
  16011. bool isInterestedInFileDrag (const StringArray& files);
  16012. void filesDropped (const StringArray& files, int, int);
  16013. void buttonClicked (Button* button);
  16014. juce_UseDebuggingNewOperator
  16015. private:
  16016. FileSearchPath path;
  16017. File defaultBrowseTarget;
  16018. ListBox* listBox;
  16019. Button* addButton;
  16020. Button* removeButton;
  16021. Button* changeButton;
  16022. Button* upButton;
  16023. Button* downButton;
  16024. void changed() throw();
  16025. void updateButtons() throw();
  16026. FileSearchPathListComponent (const FileSearchPathListComponent&);
  16027. const FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
  16028. };
  16029. #endif // __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
  16030. /*** End of inlined file: juce_FileSearchPathListComponent.h ***/
  16031. #endif
  16032. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16033. /*** Start of inlined file: juce_FileTreeComponent.h ***/
  16034. #ifndef __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16035. #define __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16036. class JUCE_API FileTreeComponent : public TreeView,
  16037. public DirectoryContentsDisplayComponent
  16038. {
  16039. public:
  16040. FileTreeComponent (DirectoryContentsList& listToShow);
  16041. ~FileTreeComponent();
  16042. int getNumSelectedFiles() const { return TreeView::getNumSelectedItems(); }
  16043. const File getSelectedFile (int index = 0) const;
  16044. void scrollToTop();
  16045. void setDragAndDropDescription (const String& description) throw();
  16046. const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }
  16047. juce_UseDebuggingNewOperator
  16048. private:
  16049. String dragAndDropDescription;
  16050. FileTreeComponent (const FileTreeComponent&);
  16051. const FileTreeComponent& operator= (const FileTreeComponent&);
  16052. };
  16053. #endif // __JUCE_FILETREECOMPONENT_JUCEHEADER__
  16054. /*** End of inlined file: juce_FileTreeComponent.h ***/
  16055. #endif
  16056. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16057. /*** Start of inlined file: juce_ImagePreviewComponent.h ***/
  16058. #ifndef __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16059. #define __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16060. class JUCE_API ImagePreviewComponent : public FilePreviewComponent,
  16061. private Timer
  16062. {
  16063. public:
  16064. ImagePreviewComponent();
  16065. ~ImagePreviewComponent();
  16066. void selectedFileChanged (const File& newSelectedFile);
  16067. void paint (Graphics& g);
  16068. void timerCallback();
  16069. juce_UseDebuggingNewOperator
  16070. private:
  16071. File fileToLoad;
  16072. ScopedPointer <Image> currentThumbnail;
  16073. String currentDetails;
  16074. void getThumbSize (int& w, int& h) const;
  16075. ImagePreviewComponent (const ImagePreviewComponent&);
  16076. const ImagePreviewComponent& operator= (const ImagePreviewComponent&);
  16077. };
  16078. #endif // __JUCE_IMAGEPREVIEWCOMPONENT_JUCEHEADER__
  16079. /*** End of inlined file: juce_ImagePreviewComponent.h ***/
  16080. #endif
  16081. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16082. /*** Start of inlined file: juce_WildcardFileFilter.h ***/
  16083. #ifndef __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16084. #define __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16085. class JUCE_API WildcardFileFilter : public FileFilter
  16086. {
  16087. public:
  16088. WildcardFileFilter (const String& fileWildcardPatterns,
  16089. const String& directoryWildcardPatterns,
  16090. const String& description);
  16091. ~WildcardFileFilter();
  16092. bool isFileSuitable (const File& file) const;
  16093. bool isDirectorySuitable (const File& file) const;
  16094. juce_UseDebuggingNewOperator
  16095. private:
  16096. StringArray fileWildcards, directoryWildcards;
  16097. static void parse (const String& pattern, StringArray& result) throw();
  16098. static bool match (const File& file, const StringArray& wildcards) throw();
  16099. };
  16100. #endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
  16101. /*** End of inlined file: juce_WildcardFileFilter.h ***/
  16102. #endif
  16103. #ifndef __JUCE_COMPONENT_JUCEHEADER__
  16104. #endif
  16105. #ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
  16106. #endif
  16107. #ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
  16108. #endif
  16109. #ifndef __JUCE_DESKTOP_JUCEHEADER__
  16110. #endif
  16111. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  16112. #endif
  16113. #ifndef __JUCE_KEYLISTENER_JUCEHEADER__
  16114. #endif
  16115. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16116. /*** Start of inlined file: juce_KeyMappingEditorComponent.h ***/
  16117. #ifndef __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16118. #define __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16119. /*** Start of inlined file: juce_KeyPressMappingSet.h ***/
  16120. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16121. #define __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16122. class JUCE_API KeyPressMappingSet : public KeyListener,
  16123. public ChangeBroadcaster,
  16124. public FocusChangeListener
  16125. {
  16126. public:
  16127. KeyPressMappingSet (ApplicationCommandManager* const commandManager) throw();
  16128. KeyPressMappingSet (const KeyPressMappingSet& other) throw();
  16129. ~KeyPressMappingSet();
  16130. ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }
  16131. const Array <KeyPress> getKeyPressesAssignedToCommand (const CommandID commandID) const throw();
  16132. void addKeyPress (const CommandID commandID,
  16133. const KeyPress& newKeyPress,
  16134. int insertIndex = -1) throw();
  16135. void resetToDefaultMappings() throw();
  16136. void resetToDefaultMapping (const CommandID commandID) throw();
  16137. void clearAllKeyPresses() throw();
  16138. void clearAllKeyPresses (const CommandID commandID) throw();
  16139. void removeKeyPress (const CommandID commandID,
  16140. const int keyPressIndex) throw();
  16141. void removeKeyPress (const KeyPress& keypress) throw();
  16142. bool containsMapping (const CommandID commandID,
  16143. const KeyPress& keyPress) const throw();
  16144. CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();
  16145. bool restoreFromXml (const XmlElement& xmlVersion);
  16146. XmlElement* createXml (const bool saveDifferencesFromDefaultSet) const;
  16147. bool keyPressed (const KeyPress& key, Component* originatingComponent);
  16148. bool keyStateChanged (const bool isKeyDown, Component* originatingComponent);
  16149. void globalFocusChanged (Component* focusedComponent);
  16150. juce_UseDebuggingNewOperator
  16151. private:
  16152. ApplicationCommandManager* commandManager;
  16153. struct CommandMapping
  16154. {
  16155. CommandID commandID;
  16156. Array <KeyPress> keypresses;
  16157. bool wantsKeyUpDownCallbacks;
  16158. };
  16159. OwnedArray <CommandMapping> mappings;
  16160. struct KeyPressTime
  16161. {
  16162. KeyPress key;
  16163. uint32 timeWhenPressed;
  16164. };
  16165. OwnedArray <KeyPressTime> keysDown;
  16166. void handleMessage (const Message& message);
  16167. void invokeCommand (const CommandID commandID,
  16168. const KeyPress& keyPress,
  16169. const bool isKeyDown,
  16170. const int millisecsSinceKeyPressed,
  16171. Component* const originatingComponent) const;
  16172. const KeyPressMappingSet& operator= (const KeyPressMappingSet&);
  16173. };
  16174. #endif // __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16175. /*** End of inlined file: juce_KeyPressMappingSet.h ***/
  16176. class JUCE_API KeyMappingEditorComponent : public Component,
  16177. public TreeViewItem,
  16178. public ChangeListener,
  16179. private ButtonListener
  16180. {
  16181. public:
  16182. KeyMappingEditorComponent (KeyPressMappingSet* const mappingSet,
  16183. const bool showResetToDefaultButton);
  16184. virtual ~KeyMappingEditorComponent();
  16185. void setColours (const Colour& mainBackground,
  16186. const Colour& textColour);
  16187. KeyPressMappingSet* getMappings() const throw() { return mappings; }
  16188. virtual bool shouldCommandBeIncluded (const CommandID commandID);
  16189. virtual bool isCommandReadOnly (const CommandID commandID);
  16190. virtual const String getDescriptionForKeyPress (const KeyPress& key);
  16191. enum ColourIds
  16192. {
  16193. backgroundColourId = 0x100ad00, /**< The background colour to fill the editor background. */
  16194. textColourId = 0x100ad01, /**< The colour for the text. */
  16195. };
  16196. void parentHierarchyChanged();
  16197. void resized();
  16198. void changeListenerCallback (void*);
  16199. bool mightContainSubItems();
  16200. const String getUniqueName() const;
  16201. void buttonClicked (Button* button);
  16202. juce_UseDebuggingNewOperator
  16203. private:
  16204. KeyPressMappingSet* mappings;
  16205. TreeView* tree;
  16206. friend class KeyMappingTreeViewItem;
  16207. friend class KeyCategoryTreeViewItem;
  16208. friend class KeyMappingItemComponent;
  16209. friend class KeyMappingChangeButton;
  16210. TextButton* resetButton;
  16211. void assignNewKey (const CommandID commandID, int index);
  16212. KeyMappingEditorComponent (const KeyMappingEditorComponent&);
  16213. const KeyMappingEditorComponent& operator= (const KeyMappingEditorComponent&);
  16214. };
  16215. #endif // __JUCE_KEYMAPPINGEDITORCOMPONENT_JUCEHEADER__
  16216. /*** End of inlined file: juce_KeyMappingEditorComponent.h ***/
  16217. #endif
  16218. #ifndef __JUCE_KEYPRESS_JUCEHEADER__
  16219. #endif
  16220. #ifndef __JUCE_KEYPRESSMAPPINGSET_JUCEHEADER__
  16221. #endif
  16222. #ifndef __JUCE_MODIFIERKEYS_JUCEHEADER__
  16223. #endif
  16224. #ifndef __JUCE_COMPONENTANIMATOR_JUCEHEADER__
  16225. #endif
  16226. #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__
  16227. #endif
  16228. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16229. /*** Start of inlined file: juce_ComponentMovementWatcher.h ***/
  16230. #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16231. #define __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16232. class JUCE_API ComponentMovementWatcher : public ComponentListener
  16233. {
  16234. public:
  16235. ComponentMovementWatcher (Component* const component);
  16236. ~ComponentMovementWatcher();
  16237. virtual void componentMovedOrResized (bool wasMoved, bool wasResized) = 0;
  16238. virtual void componentPeerChanged() = 0;
  16239. juce_UseDebuggingNewOperator
  16240. void componentParentHierarchyChanged (Component& component);
  16241. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  16242. private:
  16243. Component* const component;
  16244. ComponentPeer* lastPeer;
  16245. VoidArray registeredParentComps;
  16246. bool reentrant;
  16247. int lastX, lastY, lastWidth, lastHeight;
  16248. #ifdef JUCE_DEBUG
  16249. ScopedPointer <ComponentDeletionWatcher> deletionWatcher;
  16250. #endif
  16251. void unregister() throw();
  16252. void registerWithParentComps() throw();
  16253. ComponentMovementWatcher (const ComponentMovementWatcher&);
  16254. const ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
  16255. };
  16256. #endif // __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__
  16257. /*** End of inlined file: juce_ComponentMovementWatcher.h ***/
  16258. #endif
  16259. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16260. /*** Start of inlined file: juce_GroupComponent.h ***/
  16261. #ifndef __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16262. #define __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16263. class JUCE_API GroupComponent : public Component
  16264. {
  16265. public:
  16266. GroupComponent (const String& componentName,
  16267. const String& labelText);
  16268. ~GroupComponent();
  16269. void setText (const String& newText) throw();
  16270. const String getText() const throw();
  16271. void setTextLabelPosition (const Justification& justification);
  16272. const Justification getTextLabelPosition() const throw() { return justification; }
  16273. enum ColourIds
  16274. {
  16275. outlineColourId = 0x1005400, /**< The colour to use for drawing the line around the edge. */
  16276. textColourId = 0x1005410 /**< The colour to use to draw the text label. */
  16277. };
  16278. void paint (Graphics& g);
  16279. void enablementChanged();
  16280. void colourChanged();
  16281. private:
  16282. String text;
  16283. Justification justification;
  16284. GroupComponent (const GroupComponent&);
  16285. const GroupComponent& operator= (const GroupComponent&);
  16286. };
  16287. #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__
  16288. /*** End of inlined file: juce_GroupComponent.h ***/
  16289. #endif
  16290. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16291. /*** Start of inlined file: juce_MultiDocumentPanel.h ***/
  16292. #ifndef __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16293. #define __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16294. /*** Start of inlined file: juce_TabbedComponent.h ***/
  16295. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16296. #define __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16297. /*** Start of inlined file: juce_TabbedButtonBar.h ***/
  16298. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16299. #define __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16300. class TabbedButtonBar;
  16301. class JUCE_API TabBarButton : public Button
  16302. {
  16303. public:
  16304. TabBarButton (const String& name,
  16305. TabbedButtonBar* const ownerBar,
  16306. const int tabIndex);
  16307. ~TabBarButton();
  16308. virtual int getBestTabLength (const int depth);
  16309. void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown);
  16310. void clicked (const ModifierKeys& mods);
  16311. bool hitTest (int x, int y);
  16312. juce_UseDebuggingNewOperator
  16313. protected:
  16314. friend class TabbedButtonBar;
  16315. TabbedButtonBar* const owner;
  16316. int tabIndex, overlapPixels;
  16317. DropShadowEffect shadow;
  16318. void getActiveArea (int& x, int& y, int& w, int& h);
  16319. private:
  16320. TabBarButton (const TabBarButton&);
  16321. const TabBarButton& operator= (const TabBarButton&);
  16322. };
  16323. class JUCE_API TabbedButtonBar : public Component,
  16324. public ChangeBroadcaster,
  16325. public ButtonListener
  16326. {
  16327. public:
  16328. enum Orientation
  16329. {
  16330. TabsAtTop,
  16331. TabsAtBottom,
  16332. TabsAtLeft,
  16333. TabsAtRight
  16334. };
  16335. TabbedButtonBar (const Orientation orientation);
  16336. ~TabbedButtonBar();
  16337. void setOrientation (const Orientation orientation);
  16338. Orientation getOrientation() const throw() { return orientation; }
  16339. void clearTabs();
  16340. void addTab (const String& tabName,
  16341. const Colour& tabBackgroundColour,
  16342. int insertIndex = -1);
  16343. void setTabName (const int tabIndex,
  16344. const String& newName);
  16345. void removeTab (const int tabIndex);
  16346. void moveTab (const int currentIndex,
  16347. const int newIndex);
  16348. int getNumTabs() const;
  16349. const StringArray getTabNames() const;
  16350. void setCurrentTabIndex (int newTabIndex, const bool sendChangeMessage = true);
  16351. const String& getCurrentTabName() const throw() { return tabs [currentTabIndex]; }
  16352. int getCurrentTabIndex() const throw() { return currentTabIndex; }
  16353. TabBarButton* getTabButton (const int index) const;
  16354. virtual void currentTabChanged (const int newCurrentTabIndex,
  16355. const String& newCurrentTabName);
  16356. virtual void popupMenuClickOnTab (const int tabIndex,
  16357. const String& tabName);
  16358. const Colour getTabBackgroundColour (const int tabIndex);
  16359. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16360. enum ColourIds
  16361. {
  16362. tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
  16363. tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
  16364. the look and feel will choose an appropriate colour. */
  16365. frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
  16366. frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
  16367. this isn't specified, the look and feel will choose an appropriate
  16368. colour. */
  16369. };
  16370. void resized();
  16371. void buttonClicked (Button* button);
  16372. void lookAndFeelChanged();
  16373. juce_UseDebuggingNewOperator
  16374. protected:
  16375. virtual TabBarButton* createTabButton (const String& tabName,
  16376. const int tabIndex);
  16377. private:
  16378. Orientation orientation;
  16379. StringArray tabs;
  16380. Array <Colour> tabColours;
  16381. int currentTabIndex;
  16382. Component* behindFrontTab;
  16383. Button* extraTabsButton;
  16384. TabbedButtonBar (const TabbedButtonBar&);
  16385. const TabbedButtonBar& operator= (const TabbedButtonBar&);
  16386. };
  16387. #endif // __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16388. /*** End of inlined file: juce_TabbedButtonBar.h ***/
  16389. class JUCE_API TabbedComponent : public Component
  16390. {
  16391. public:
  16392. TabbedComponent (const TabbedButtonBar::Orientation orientation);
  16393. ~TabbedComponent();
  16394. void setOrientation (const TabbedButtonBar::Orientation orientation);
  16395. TabbedButtonBar::Orientation getOrientation() const throw();
  16396. void setTabBarDepth (const int newDepth);
  16397. int getTabBarDepth() const throw() { return tabDepth; }
  16398. void setOutline (const int newThickness);
  16399. void setIndent (const int indentThickness);
  16400. void clearTabs();
  16401. void addTab (const String& tabName,
  16402. const Colour& tabBackgroundColour,
  16403. Component* const contentComponent,
  16404. const bool deleteComponentWhenNotNeeded,
  16405. const int insertIndex = -1);
  16406. void setTabName (const int tabIndex,
  16407. const String& newName);
  16408. void removeTab (const int tabIndex);
  16409. int getNumTabs() const;
  16410. const StringArray getTabNames() const;
  16411. Component* getTabContentComponent (const int tabIndex) const throw();
  16412. const Colour getTabBackgroundColour (const int tabIndex) const throw();
  16413. void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
  16414. void setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage = true);
  16415. int getCurrentTabIndex() const;
  16416. const String& getCurrentTabName() const;
  16417. Component* getCurrentContentComponent() const throw() { return panelComponent; }
  16418. virtual void currentTabChanged (const int newCurrentTabIndex,
  16419. const String& newCurrentTabName);
  16420. virtual void popupMenuClickOnTab (const int tabIndex,
  16421. const String& tabName);
  16422. TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
  16423. enum ColourIds
  16424. {
  16425. backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
  16426. outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
  16427. (See setOutline) */
  16428. };
  16429. void paint (Graphics& g);
  16430. void resized();
  16431. void lookAndFeelChanged();
  16432. juce_UseDebuggingNewOperator
  16433. protected:
  16434. TabbedButtonBar* tabs;
  16435. virtual TabBarButton* createTabButton (const String& tabName,
  16436. const int tabIndex);
  16437. private:
  16438. Array <Component*> contentComponents;
  16439. Component* panelComponent;
  16440. int tabDepth;
  16441. int outlineThickness, edgeIndent;
  16442. friend class TabCompButtonBar;
  16443. void changeCallback (const int newCurrentTabIndex, const String& newTabName);
  16444. TabbedComponent (const TabbedComponent&);
  16445. const TabbedComponent& operator= (const TabbedComponent&);
  16446. };
  16447. #endif // __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16448. /*** End of inlined file: juce_TabbedComponent.h ***/
  16449. /*** Start of inlined file: juce_DocumentWindow.h ***/
  16450. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16451. #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16452. /*** Start of inlined file: juce_MenuBarComponent.h ***/
  16453. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16454. #define __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16455. /*** Start of inlined file: juce_MenuBarModel.h ***/
  16456. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  16457. #define __JUCE_MENUBARMODEL_JUCEHEADER__
  16458. class MenuBarModel;
  16459. class JUCE_API MenuBarModelListener
  16460. {
  16461. public:
  16462. virtual ~MenuBarModelListener() {}
  16463. virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
  16464. virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
  16465. const ApplicationCommandTarget::InvocationInfo& info) = 0;
  16466. };
  16467. class JUCE_API MenuBarModel : private AsyncUpdater,
  16468. private ApplicationCommandManagerListener
  16469. {
  16470. public:
  16471. MenuBarModel() throw();
  16472. virtual ~MenuBarModel();
  16473. void menuItemsChanged();
  16474. void setApplicationCommandManagerToWatch (ApplicationCommandManager* const manager) throw();
  16475. void addListener (MenuBarModelListener* const listenerToAdd) throw();
  16476. void removeListener (MenuBarModelListener* const listenerToRemove) throw();
  16477. virtual const StringArray getMenuBarNames() = 0;
  16478. virtual const PopupMenu getMenuForIndex (int topLevelMenuIndex,
  16479. const String& menuName) = 0;
  16480. virtual void menuItemSelected (int menuItemID,
  16481. int topLevelMenuIndex) = 0;
  16482. #if JUCE_MAC || DOXYGEN
  16483. static void setMacMainMenu (MenuBarModel* newMenuBarModel,
  16484. const PopupMenu* extraAppleMenuItems = 0);
  16485. static MenuBarModel* getMacMainMenu();
  16486. #endif
  16487. void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info);
  16488. void applicationCommandListChanged();
  16489. void handleAsyncUpdate();
  16490. juce_UseDebuggingNewOperator
  16491. private:
  16492. ApplicationCommandManager* manager;
  16493. SortedSet <void*> listeners;
  16494. MenuBarModel (const MenuBarModel&);
  16495. const MenuBarModel& operator= (const MenuBarModel&);
  16496. };
  16497. #endif // __JUCE_MENUBARMODEL_JUCEHEADER__
  16498. /*** End of inlined file: juce_MenuBarModel.h ***/
  16499. class JUCE_API MenuBarComponent : public Component,
  16500. private MenuBarModelListener,
  16501. private Timer
  16502. {
  16503. public:
  16504. MenuBarComponent (MenuBarModel* const model);
  16505. ~MenuBarComponent();
  16506. void setModel (MenuBarModel* const newModel);
  16507. void showMenu (const int menuIndex);
  16508. void paint (Graphics& g);
  16509. void resized();
  16510. void mouseEnter (const MouseEvent& e);
  16511. void mouseExit (const MouseEvent& e);
  16512. void mouseDown (const MouseEvent& e);
  16513. void mouseDrag (const MouseEvent& e);
  16514. void mouseUp (const MouseEvent& e);
  16515. void mouseMove (const MouseEvent& e);
  16516. void inputAttemptWhenModal();
  16517. void handleCommandMessage (int commandId);
  16518. bool keyPressed (const KeyPress& key);
  16519. void menuBarItemsChanged (MenuBarModel* menuBarModel);
  16520. void menuCommandInvoked (MenuBarModel* menuBarModel,
  16521. const ApplicationCommandTarget::InvocationInfo& info);
  16522. juce_UseDebuggingNewOperator
  16523. private:
  16524. MenuBarModel* model;
  16525. StringArray menuNames;
  16526. Array <int> xPositions;
  16527. int itemUnderMouse, currentPopupIndex, topLevelIndexClicked, indexToShowAgain;
  16528. int lastMouseX, lastMouseY;
  16529. bool inModalState;
  16530. ScopedPointer <Component> currentPopup;
  16531. int getItemAt (int x, int y);
  16532. void updateItemUnderMouse (const int x, const int y);
  16533. void hideCurrentMenu();
  16534. void timerCallback();
  16535. void repaintMenuItem (int index);
  16536. MenuBarComponent (const MenuBarComponent&);
  16537. const MenuBarComponent& operator= (const MenuBarComponent&);
  16538. };
  16539. #endif // __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  16540. /*** End of inlined file: juce_MenuBarComponent.h ***/
  16541. class JUCE_API DocumentWindow : public ResizableWindow
  16542. {
  16543. public:
  16544. enum TitleBarButtons
  16545. {
  16546. minimiseButton = 1,
  16547. maximiseButton = 2,
  16548. closeButton = 4,
  16549. allButtons = 7
  16550. };
  16551. DocumentWindow (const String& name,
  16552. const Colour& backgroundColour,
  16553. const int requiredButtons,
  16554. const bool addToDesktop = true);
  16555. ~DocumentWindow();
  16556. void setName (const String& newName);
  16557. void setIcon (const Image* imageToUse);
  16558. void setTitleBarHeight (const int newHeight);
  16559. int getTitleBarHeight() const;
  16560. void setTitleBarButtonsRequired (const int requiredButtons,
  16561. const bool positionTitleBarButtonsOnLeft);
  16562. void setTitleBarTextCentred (const bool textShouldBeCentred);
  16563. void setMenuBar (MenuBarModel* menuBarModel,
  16564. const int menuBarHeight = 0);
  16565. virtual void closeButtonPressed();
  16566. virtual void minimiseButtonPressed();
  16567. virtual void maximiseButtonPressed();
  16568. Button* getCloseButton() const throw();
  16569. Button* getMinimiseButton() const throw();
  16570. Button* getMaximiseButton() const throw();
  16571. enum ColourIds
  16572. {
  16573. textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
  16574. and feel class how this is used. */
  16575. };
  16576. void paint (Graphics& g);
  16577. void resized();
  16578. void lookAndFeelChanged();
  16579. const BorderSize getBorderThickness();
  16580. const BorderSize getContentComponentBorder();
  16581. void mouseDoubleClick (const MouseEvent& e);
  16582. void userTriedToCloseWindow();
  16583. void activeWindowStatusChanged();
  16584. int getDesktopWindowStyleFlags() const;
  16585. void parentHierarchyChanged();
  16586. const Rectangle<int> getTitleBarArea();
  16587. juce_UseDebuggingNewOperator
  16588. private:
  16589. int titleBarHeight, menuBarHeight, requiredButtons;
  16590. bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
  16591. ScopedPointer <Button> titleBarButtons [3];
  16592. ScopedPointer <Image> titleBarIcon;
  16593. ScopedPointer <MenuBarComponent> menuBar;
  16594. MenuBarModel* menuBarModel;
  16595. class ButtonListenerProxy;
  16596. friend class ScopedPointer <ButtonListenerProxy>;
  16597. ScopedPointer <ButtonListenerProxy> buttonListener;
  16598. void repaintTitleBar();
  16599. DocumentWindow (const DocumentWindow&);
  16600. const DocumentWindow& operator= (const DocumentWindow&);
  16601. };
  16602. #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  16603. /*** End of inlined file: juce_DocumentWindow.h ***/
  16604. class MultiDocumentPanel;
  16605. class MDITabbedComponentInternal;
  16606. class JUCE_API MultiDocumentPanelWindow : public DocumentWindow
  16607. {
  16608. public:
  16609. MultiDocumentPanelWindow (const Colour& backgroundColour);
  16610. ~MultiDocumentPanelWindow();
  16611. void maximiseButtonPressed();
  16612. void closeButtonPressed();
  16613. void activeWindowStatusChanged();
  16614. void broughtToFront();
  16615. juce_UseDebuggingNewOperator
  16616. private:
  16617. void updateOrder();
  16618. MultiDocumentPanel* getOwner() const throw();
  16619. };
  16620. class JUCE_API MultiDocumentPanel : public Component,
  16621. private ComponentListener
  16622. {
  16623. public:
  16624. MultiDocumentPanel();
  16625. ~MultiDocumentPanel();
  16626. bool closeAllDocuments (const bool checkItsOkToCloseFirst);
  16627. bool addDocument (Component* const component,
  16628. const Colour& backgroundColour,
  16629. const bool deleteWhenRemoved);
  16630. bool closeDocument (Component* component,
  16631. const bool checkItsOkToCloseFirst);
  16632. int getNumDocuments() const throw();
  16633. Component* getDocument (const int index) const throw();
  16634. Component* getActiveDocument() const throw();
  16635. void setActiveDocument (Component* component);
  16636. virtual void activeDocumentChanged();
  16637. void setMaximumNumDocuments (const int maximumNumDocuments);
  16638. void useFullscreenWhenOneDocument (const bool shouldUseTabs);
  16639. bool isFullscreenWhenOneDocument() const throw();
  16640. enum LayoutMode
  16641. {
  16642. FloatingWindows, /**< In this mode, there are overlapping DocumentWindow components for each document. */
  16643. MaximisedWindowsWithTabs /**< In this mode, a TabbedComponent is used to show one document at a time. */
  16644. };
  16645. void setLayoutMode (const LayoutMode newLayoutMode);
  16646. LayoutMode getLayoutMode() const throw() { return mode; }
  16647. void setBackgroundColour (const Colour& newBackgroundColour);
  16648. const Colour& getBackgroundColour() const throw() { return backgroundColour; }
  16649. virtual bool tryToCloseDocument (Component* component) = 0;
  16650. virtual MultiDocumentPanelWindow* createNewDocumentWindow();
  16651. void paint (Graphics& g);
  16652. void resized();
  16653. void componentNameChanged (Component&);
  16654. juce_UseDebuggingNewOperator
  16655. private:
  16656. LayoutMode mode;
  16657. Array <Component*> components;
  16658. TabbedComponent* tabComponent;
  16659. Colour backgroundColour;
  16660. int maximumNumDocuments, numDocsBeforeTabsUsed;
  16661. friend class MultiDocumentPanelWindow;
  16662. friend class MDITabbedComponentInternal;
  16663. Component* getContainerComp (Component* c) const;
  16664. void updateOrder();
  16665. void addWindow (Component* component);
  16666. };
  16667. #endif // __JUCE_MULTIDOCUMENTPANEL_JUCEHEADER__
  16668. /*** End of inlined file: juce_MultiDocumentPanel.h ***/
  16669. #endif
  16670. #ifndef __JUCE_RESIZABLEBORDERCOMPONENT_JUCEHEADER__
  16671. #endif
  16672. #ifndef __JUCE_RESIZABLECORNERCOMPONENT_JUCEHEADER__
  16673. #endif
  16674. #ifndef __JUCE_SCROLLBAR_JUCEHEADER__
  16675. #endif
  16676. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16677. /*** Start of inlined file: juce_StretchableLayoutManager.h ***/
  16678. #ifndef __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16679. #define __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16680. class JUCE_API StretchableLayoutManager
  16681. {
  16682. public:
  16683. StretchableLayoutManager();
  16684. ~StretchableLayoutManager();
  16685. void setItemLayout (const int itemIndex,
  16686. const double minimumSize,
  16687. const double maximumSize,
  16688. const double preferredSize);
  16689. bool getItemLayout (const int itemIndex,
  16690. double& minimumSize,
  16691. double& maximumSize,
  16692. double& preferredSize) const;
  16693. void clearAllItems();
  16694. void layOutComponents (Component** const components,
  16695. int numComponents,
  16696. int x, int y, int width, int height,
  16697. const bool vertically,
  16698. const bool resizeOtherDimension);
  16699. int getItemCurrentPosition (const int itemIndex) const;
  16700. int getItemCurrentAbsoluteSize (const int itemIndex) const;
  16701. double getItemCurrentRelativeSize (const int itemIndex) const;
  16702. void setItemPosition (const int itemIndex,
  16703. int newPosition);
  16704. juce_UseDebuggingNewOperator
  16705. private:
  16706. struct ItemLayoutProperties
  16707. {
  16708. int itemIndex;
  16709. int currentSize;
  16710. double minSize, maxSize, preferredSize;
  16711. };
  16712. OwnedArray <ItemLayoutProperties> items;
  16713. int totalSize;
  16714. static int sizeToRealSize (double size, int totalSpace);
  16715. ItemLayoutProperties* getInfoFor (const int itemIndex) const;
  16716. void setTotalSize (const int newTotalSize);
  16717. int fitComponentsIntoSpace (const int startIndex,
  16718. const int endIndex,
  16719. const int availableSpace,
  16720. int startPos);
  16721. int getMinimumSizeOfItems (const int startIndex, const int endIndex) const;
  16722. int getMaximumSizeOfItems (const int startIndex, const int endIndex) const;
  16723. void updatePrefSizesToMatchCurrentPositions();
  16724. StretchableLayoutManager (const StretchableLayoutManager&);
  16725. const StretchableLayoutManager& operator= (const StretchableLayoutManager&);
  16726. };
  16727. #endif // __JUCE_STRETCHABLELAYOUTMANAGER_JUCEHEADER__
  16728. /*** End of inlined file: juce_StretchableLayoutManager.h ***/
  16729. #endif
  16730. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16731. /*** Start of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16732. #ifndef __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16733. #define __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16734. class JUCE_API StretchableLayoutResizerBar : public Component
  16735. {
  16736. public:
  16737. StretchableLayoutResizerBar (StretchableLayoutManager* const layoutToUse,
  16738. const int itemIndexInLayout,
  16739. const bool isBarVertical);
  16740. ~StretchableLayoutResizerBar();
  16741. virtual void hasBeenMoved();
  16742. void paint (Graphics& g);
  16743. void mouseDown (const MouseEvent& e);
  16744. void mouseDrag (const MouseEvent& e);
  16745. juce_UseDebuggingNewOperator
  16746. private:
  16747. StretchableLayoutManager* layout;
  16748. int itemIndex, mouseDownPos;
  16749. bool isVertical;
  16750. StretchableLayoutResizerBar (const StretchableLayoutResizerBar&);
  16751. const StretchableLayoutResizerBar& operator= (const StretchableLayoutResizerBar&);
  16752. };
  16753. #endif // __JUCE_STRETCHABLELAYOUTRESIZERBAR_JUCEHEADER__
  16754. /*** End of inlined file: juce_StretchableLayoutResizerBar.h ***/
  16755. #endif
  16756. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16757. /*** Start of inlined file: juce_StretchableObjectResizer.h ***/
  16758. #ifndef __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16759. #define __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16760. class StretchableObjectResizer
  16761. {
  16762. public:
  16763. StretchableObjectResizer();
  16764. ~StretchableObjectResizer();
  16765. void addItem (const double currentSize,
  16766. const double minSize,
  16767. const double maxSize,
  16768. const int order = 0);
  16769. void resizeToFit (const double targetSize);
  16770. int getNumItems() const throw() { return items.size(); }
  16771. double getItemSize (const int index) const throw();
  16772. juce_UseDebuggingNewOperator
  16773. private:
  16774. struct Item
  16775. {
  16776. double size;
  16777. double minSize;
  16778. double maxSize;
  16779. int order;
  16780. };
  16781. OwnedArray <Item> items;
  16782. StretchableObjectResizer (const StretchableObjectResizer&);
  16783. const StretchableObjectResizer& operator= (const StretchableObjectResizer&);
  16784. };
  16785. #endif // __JUCE_STRETCHABLEOBJECTRESIZER_JUCEHEADER__
  16786. /*** End of inlined file: juce_StretchableObjectResizer.h ***/
  16787. #endif
  16788. #ifndef __JUCE_TABBEDBUTTONBAR_JUCEHEADER__
  16789. #endif
  16790. #ifndef __JUCE_TABBEDCOMPONENT_JUCEHEADER__
  16791. #endif
  16792. #ifndef __JUCE_VIEWPORT_JUCEHEADER__
  16793. #endif
  16794. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16795. /*** Start of inlined file: juce_LookAndFeel.h ***/
  16796. #ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
  16797. #define __JUCE_LOOKANDFEEL_JUCEHEADER__
  16798. /*** Start of inlined file: juce_AlertWindow.h ***/
  16799. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  16800. #define __JUCE_ALERTWINDOW_JUCEHEADER__
  16801. /*** Start of inlined file: juce_TextLayout.h ***/
  16802. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  16803. #define __JUCE_TEXTLAYOUT_JUCEHEADER__
  16804. class Graphics;
  16805. class JUCE_API TextLayout
  16806. {
  16807. public:
  16808. TextLayout() throw();
  16809. TextLayout (const TextLayout& other) throw();
  16810. TextLayout (const String& text, const Font& font) throw();
  16811. ~TextLayout() throw();
  16812. const TextLayout& operator= (const TextLayout& layoutToCopy) throw();
  16813. void clear() throw();
  16814. void appendText (const String& textToAppend,
  16815. const Font& fontToUse) throw();
  16816. void setText (const String& newText,
  16817. const Font& fontToUse) throw();
  16818. void layout (int maximumWidth,
  16819. const Justification& justification,
  16820. const bool attemptToBalanceLineLengths) throw();
  16821. int getWidth() const throw();
  16822. int getHeight() const throw();
  16823. int getNumLines() const throw() { return totalLines; }
  16824. int getLineWidth (const int lineNumber) const throw();
  16825. void draw (Graphics& g,
  16826. const int topLeftX,
  16827. const int topLeftY) const throw();
  16828. void drawWithin (Graphics& g,
  16829. int x, int y, int w, int h,
  16830. const Justification& layoutFlags) const throw();
  16831. juce_UseDebuggingNewOperator
  16832. private:
  16833. class Token;
  16834. friend class OwnedArray <Token>;
  16835. OwnedArray <Token> tokens;
  16836. int totalLines;
  16837. };
  16838. #endif // __JUCE_TEXTLAYOUT_JUCEHEADER__
  16839. /*** End of inlined file: juce_TextLayout.h ***/
  16840. class JUCE_API AlertWindow : public TopLevelWindow,
  16841. private ButtonListener
  16842. {
  16843. public:
  16844. enum AlertIconType
  16845. {
  16846. NoIcon, /**< No icon will be shown on the dialog box. */
  16847. QuestionIcon, /**< A question-mark icon, for dialog boxes that need the
  16848. user to answer a question. */
  16849. WarningIcon, /**< An exclamation mark to indicate that the dialog is a
  16850. warning about something and shouldn't be ignored. */
  16851. InfoIcon /**< An icon that indicates that the dialog box is just
  16852. giving the user some information, which doesn't require
  16853. a response from them. */
  16854. };
  16855. AlertWindow (const String& title,
  16856. const String& message,
  16857. AlertIconType iconType,
  16858. Component* associatedComponent = 0);
  16859. ~AlertWindow();
  16860. AlertIconType getAlertType() const throw() { return alertIconType; }
  16861. void setMessage (const String& message);
  16862. void addButton (const String& name,
  16863. const int returnValue,
  16864. const KeyPress& shortcutKey1 = KeyPress(),
  16865. const KeyPress& shortcutKey2 = KeyPress());
  16866. int getNumButtons() const;
  16867. void addTextEditor (const String& name,
  16868. const String& initialContents,
  16869. const String& onScreenLabel = String::empty,
  16870. const bool isPasswordBox = false);
  16871. const String getTextEditorContents (const String& nameOfTextEditor) const;
  16872. void addComboBox (const String& name,
  16873. const StringArray& items,
  16874. const String& onScreenLabel = String::empty);
  16875. ComboBox* getComboBoxComponent (const String& nameOfList) const;
  16876. void addTextBlock (const String& text);
  16877. void addProgressBarComponent (double& progressValue);
  16878. void addCustomComponent (Component* const component);
  16879. int getNumCustomComponents() const;
  16880. Component* getCustomComponent (const int index) const;
  16881. Component* removeCustomComponent (const int index);
  16882. bool containsAnyExtraComponents() const;
  16883. // easy-to-use message box functions:
  16884. static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
  16885. const String& title,
  16886. const String& message,
  16887. const String& buttonText = String::empty,
  16888. Component* associatedComponent = 0);
  16889. static bool JUCE_CALLTYPE showOkCancelBox (AlertIconType iconType,
  16890. const String& title,
  16891. const String& message,
  16892. const String& button1Text = String::empty,
  16893. const String& button2Text = String::empty,
  16894. Component* associatedComponent = 0);
  16895. static int JUCE_CALLTYPE showYesNoCancelBox (AlertIconType iconType,
  16896. const String& title,
  16897. const String& message,
  16898. const String& button1Text = String::empty,
  16899. const String& button2Text = String::empty,
  16900. const String& button3Text = String::empty,
  16901. Component* associatedComponent = 0);
  16902. static bool JUCE_CALLTYPE showNativeDialogBox (const String& title,
  16903. const String& bodyText,
  16904. bool isOkCancel);
  16905. enum ColourIds
  16906. {
  16907. backgroundColourId = 0x1001800, /**< The background colour for the window. */
  16908. textColourId = 0x1001810, /**< The colour for the text. */
  16909. outlineColourId = 0x1001820 /**< An optional colour to use to draw a border around the window. */
  16910. };
  16911. juce_UseDebuggingNewOperator
  16912. protected:
  16913. void paint (Graphics& g);
  16914. void mouseDown (const MouseEvent& e);
  16915. void mouseDrag (const MouseEvent& e);
  16916. bool keyPressed (const KeyPress& key);
  16917. void buttonClicked (Button* button);
  16918. void lookAndFeelChanged();
  16919. void userTriedToCloseWindow();
  16920. int getDesktopWindowStyleFlags() const;
  16921. private:
  16922. String text;
  16923. TextLayout textLayout;
  16924. AlertIconType alertIconType;
  16925. ComponentBoundsConstrainer constrainer;
  16926. ComponentDragger dragger;
  16927. Rectangle<int> textArea;
  16928. VoidArray buttons, textBoxes, comboBoxes;
  16929. VoidArray progressBars, customComps, textBlocks, allComps;
  16930. StringArray textboxNames, comboBoxNames;
  16931. Font font;
  16932. Component* associatedComponent;
  16933. void updateLayout (const bool onlyIncreaseSize);
  16934. // disable copy constructor
  16935. AlertWindow (const AlertWindow&);
  16936. const AlertWindow& operator= (const AlertWindow&);
  16937. };
  16938. #endif // __JUCE_ALERTWINDOW_JUCEHEADER__
  16939. /*** End of inlined file: juce_AlertWindow.h ***/
  16940. class ToggleButton;
  16941. class TextButton;
  16942. class AlertWindow;
  16943. class TextLayout;
  16944. class ScrollBar;
  16945. class BubbleComponent;
  16946. class ComboBox;
  16947. class Button;
  16948. class FilenameComponent;
  16949. class DocumentWindow;
  16950. class ResizableWindow;
  16951. class GroupComponent;
  16952. class MenuBarComponent;
  16953. class DropShadower;
  16954. class GlyphArrangement;
  16955. class PropertyComponent;
  16956. class TableHeaderComponent;
  16957. class Toolbar;
  16958. class ToolbarItemComponent;
  16959. class PopupMenu;
  16960. class ProgressBar;
  16961. class FileBrowserComponent;
  16962. class DirectoryContentsDisplayComponent;
  16963. class FilePreviewComponent;
  16964. class ImageButton;
  16965. class JUCE_API LookAndFeel
  16966. {
  16967. public:
  16968. LookAndFeel();
  16969. virtual ~LookAndFeel();
  16970. static LookAndFeel& getDefaultLookAndFeel() throw();
  16971. static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw();
  16972. const Colour findColour (const int colourId) const throw();
  16973. void setColour (const int colourId, const Colour& colour) throw();
  16974. bool isColourSpecified (const int colourId) const throw();
  16975. virtual const Typeface::Ptr getTypefaceForFont (const Font& font);
  16976. void setDefaultSansSerifTypefaceName (const String& newName);
  16977. virtual const MouseCursor getMouseCursorFor (Component& component);
  16978. virtual void drawButtonBackground (Graphics& g,
  16979. Button& button,
  16980. const Colour& backgroundColour,
  16981. bool isMouseOverButton,
  16982. bool isButtonDown);
  16983. virtual const Font getFontForTextButton (TextButton& button);
  16984. virtual void drawButtonText (Graphics& g,
  16985. TextButton& button,
  16986. bool isMouseOverButton,
  16987. bool isButtonDown);
  16988. virtual void drawToggleButton (Graphics& g,
  16989. ToggleButton& button,
  16990. bool isMouseOverButton,
  16991. bool isButtonDown);
  16992. virtual void changeToggleButtonWidthToFitText (ToggleButton& button);
  16993. virtual void drawTickBox (Graphics& g,
  16994. Component& component,
  16995. float x, float y, float w, float h,
  16996. const bool ticked,
  16997. const bool isEnabled,
  16998. const bool isMouseOverButton,
  16999. const bool isButtonDown);
  17000. virtual AlertWindow* createAlertWindow (const String& title,
  17001. const String& message,
  17002. const String& button1,
  17003. const String& button2,
  17004. const String& button3,
  17005. AlertWindow::AlertIconType iconType,
  17006. int numButtons,
  17007. Component* associatedComponent);
  17008. virtual void drawAlertBox (Graphics& g,
  17009. AlertWindow& alert,
  17010. const Rectangle<int>& textArea,
  17011. TextLayout& textLayout);
  17012. virtual int getAlertBoxWindowFlags();
  17013. virtual int getAlertWindowButtonHeight();
  17014. virtual const Font getAlertWindowFont();
  17015. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17016. int width, int height,
  17017. double progress, const String& textToShow);
  17018. // Draws a small image that spins to indicate that something's happening..
  17019. // This method should use the current time to animate itself, so just keep
  17020. // repainting it every so often.
  17021. virtual void drawSpinningWaitAnimation (Graphics& g, const Colour& colour,
  17022. int x, int y, int w, int h);
  17023. virtual void drawScrollbarButton (Graphics& g,
  17024. ScrollBar& scrollbar,
  17025. int width, int height,
  17026. int buttonDirection,
  17027. bool isScrollbarVertical,
  17028. bool isMouseOverButton,
  17029. bool isButtonDown);
  17030. virtual void drawScrollbar (Graphics& g,
  17031. ScrollBar& scrollbar,
  17032. int x, int y,
  17033. int width, int height,
  17034. bool isScrollbarVertical,
  17035. int thumbStartPosition,
  17036. int thumbSize,
  17037. bool isMouseOver,
  17038. bool isMouseDown);
  17039. virtual ImageEffectFilter* getScrollbarEffect();
  17040. virtual int getMinimumScrollbarThumbSize (ScrollBar& scrollbar);
  17041. virtual int getDefaultScrollbarWidth();
  17042. virtual int getScrollbarButtonSize (ScrollBar& scrollbar);
  17043. virtual const Path getTickShape (const float height);
  17044. virtual const Path getCrossShape (const float height);
  17045. virtual void drawTreeviewPlusMinusBox (Graphics& g, int x, int y, int w, int h, bool isPlus, bool isMouseOver);
  17046. virtual void fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor);
  17047. virtual void drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor);
  17048. // these return an image from the ImageCache, so use ImageCache::release() to free it
  17049. virtual Image* getDefaultFolderImage();
  17050. virtual Image* getDefaultDocumentFileImage();
  17051. virtual void createFileChooserHeaderText (const String& title,
  17052. const String& instructions,
  17053. GlyphArrangement& destArrangement,
  17054. int width);
  17055. virtual void drawFileBrowserRow (Graphics& g, int width, int height,
  17056. const String& filename, Image* icon,
  17057. const String& fileSizeDescription,
  17058. const String& fileTimeDescription,
  17059. const bool isDirectory,
  17060. const bool isItemSelected,
  17061. const int itemIndex);
  17062. virtual Button* createFileBrowserGoUpButton();
  17063. virtual void layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  17064. DirectoryContentsDisplayComponent* fileListComponent,
  17065. FilePreviewComponent* previewComp,
  17066. ComboBox* currentPathBox,
  17067. TextEditor* filenameBox,
  17068. Button* goUpButton);
  17069. virtual void drawBubble (Graphics& g,
  17070. float tipX, float tipY,
  17071. float boxX, float boxY, float boxW, float boxH);
  17072. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17073. virtual void drawPopupMenuItem (Graphics& g,
  17074. int width, int height,
  17075. const bool isSeparator,
  17076. const bool isActive,
  17077. const bool isHighlighted,
  17078. const bool isTicked,
  17079. const bool hasSubMenu,
  17080. const String& text,
  17081. const String& shortcutKeyText,
  17082. Image* image,
  17083. const Colour* const textColour);
  17084. virtual const Font getPopupMenuFont();
  17085. virtual void drawPopupMenuUpDownArrow (Graphics& g,
  17086. int width, int height,
  17087. bool isScrollUpArrow);
  17088. virtual void getIdealPopupMenuItemSize (const String& text,
  17089. const bool isSeparator,
  17090. int standardMenuItemHeight,
  17091. int& idealWidth,
  17092. int& idealHeight);
  17093. virtual int getMenuWindowFlags();
  17094. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17095. bool isMouseOverBar,
  17096. MenuBarComponent& menuBar);
  17097. virtual int getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17098. virtual const Font getMenuBarFont (MenuBarComponent& menuBar, int itemIndex, const String& itemText);
  17099. virtual void drawMenuBarItem (Graphics& g,
  17100. int width, int height,
  17101. int itemIndex,
  17102. const String& itemText,
  17103. bool isMouseOverItem,
  17104. bool isMenuOpen,
  17105. bool isMouseOverBar,
  17106. MenuBarComponent& menuBar);
  17107. virtual void drawComboBox (Graphics& g, int width, int height,
  17108. const bool isButtonDown,
  17109. int buttonX, int buttonY,
  17110. int buttonW, int buttonH,
  17111. ComboBox& box);
  17112. virtual const Font getComboBoxFont (ComboBox& box);
  17113. virtual Label* createComboBoxTextBox (ComboBox& box);
  17114. virtual void positionComboBoxText (ComboBox& box, Label& labelToPosition);
  17115. virtual void drawLabel (Graphics& g, Label& label);
  17116. virtual void drawLinearSlider (Graphics& g,
  17117. int x, int y,
  17118. int width, int height,
  17119. float sliderPos,
  17120. float minSliderPos,
  17121. float maxSliderPos,
  17122. const Slider::SliderStyle style,
  17123. Slider& slider);
  17124. virtual void drawLinearSliderBackground (Graphics& g,
  17125. int x, int y,
  17126. int width, int height,
  17127. float sliderPos,
  17128. float minSliderPos,
  17129. float maxSliderPos,
  17130. const Slider::SliderStyle style,
  17131. Slider& slider);
  17132. virtual void drawLinearSliderThumb (Graphics& g,
  17133. int x, int y,
  17134. int width, int height,
  17135. float sliderPos,
  17136. float minSliderPos,
  17137. float maxSliderPos,
  17138. const Slider::SliderStyle style,
  17139. Slider& slider);
  17140. virtual int getSliderThumbRadius (Slider& slider);
  17141. virtual void drawRotarySlider (Graphics& g,
  17142. int x, int y,
  17143. int width, int height,
  17144. float sliderPosProportional,
  17145. const float rotaryStartAngle,
  17146. const float rotaryEndAngle,
  17147. Slider& slider);
  17148. virtual Button* createSliderButton (const bool isIncrement);
  17149. virtual Label* createSliderTextBox (Slider& slider);
  17150. virtual ImageEffectFilter* getSliderEffect();
  17151. virtual void getTooltipSize (const String& tipText, int& width, int& height);
  17152. virtual void drawTooltip (Graphics& g, const String& text, int width, int height);
  17153. virtual Button* createFilenameComponentBrowseButton (const String& text);
  17154. virtual void layoutFilenameComponent (FilenameComponent& filenameComp,
  17155. ComboBox* filenameBox, Button* browseButton);
  17156. virtual void drawCornerResizer (Graphics& g,
  17157. int w, int h,
  17158. bool isMouseOver,
  17159. bool isMouseDragging);
  17160. virtual void drawResizableFrame (Graphics& g,
  17161. int w, int h,
  17162. const BorderSize& borders);
  17163. virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
  17164. const BorderSize& border,
  17165. ResizableWindow& window);
  17166. virtual void drawResizableWindowBorder (Graphics& g,
  17167. int w, int h,
  17168. const BorderSize& border,
  17169. ResizableWindow& window);
  17170. virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
  17171. Graphics& g, int w, int h,
  17172. int titleSpaceX, int titleSpaceW,
  17173. const Image* icon,
  17174. bool drawTitleTextOnLeft);
  17175. virtual Button* createDocumentWindowButton (int buttonType);
  17176. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17177. int titleBarX, int titleBarY,
  17178. int titleBarW, int titleBarH,
  17179. Button* minimiseButton,
  17180. Button* maximiseButton,
  17181. Button* closeButton,
  17182. bool positionTitleBarButtonsOnLeft);
  17183. virtual int getDefaultMenuBarHeight();
  17184. virtual DropShadower* createDropShadowerForComponent (Component* component);
  17185. virtual void drawStretchableLayoutResizerBar (Graphics& g,
  17186. int w, int h,
  17187. bool isVerticalBar,
  17188. bool isMouseOver,
  17189. bool isMouseDragging);
  17190. virtual void drawGroupComponentOutline (Graphics& g, int w, int h,
  17191. const String& text,
  17192. const Justification& position,
  17193. GroupComponent& group);
  17194. virtual void createTabButtonShape (Path& p,
  17195. int width, int height,
  17196. int tabIndex,
  17197. const String& text,
  17198. Button& button,
  17199. TabbedButtonBar::Orientation orientation,
  17200. const bool isMouseOver,
  17201. const bool isMouseDown,
  17202. const bool isFrontTab);
  17203. virtual void fillTabButtonShape (Graphics& g,
  17204. const Path& path,
  17205. const Colour& preferredBackgroundColour,
  17206. int tabIndex,
  17207. const String& text,
  17208. Button& button,
  17209. TabbedButtonBar::Orientation orientation,
  17210. const bool isMouseOver,
  17211. const bool isMouseDown,
  17212. const bool isFrontTab);
  17213. virtual void drawTabButtonText (Graphics& g,
  17214. int x, int y, int w, int h,
  17215. const Colour& preferredBackgroundColour,
  17216. int tabIndex,
  17217. const String& text,
  17218. Button& button,
  17219. TabbedButtonBar::Orientation orientation,
  17220. const bool isMouseOver,
  17221. const bool isMouseDown,
  17222. const bool isFrontTab);
  17223. virtual int getTabButtonOverlap (int tabDepth);
  17224. virtual int getTabButtonSpaceAroundImage();
  17225. virtual int getTabButtonBestWidth (int tabIndex,
  17226. const String& text,
  17227. int tabDepth,
  17228. Button& button);
  17229. virtual void drawTabButton (Graphics& g,
  17230. int w, int h,
  17231. const Colour& preferredColour,
  17232. int tabIndex,
  17233. const String& text,
  17234. Button& button,
  17235. TabbedButtonBar::Orientation orientation,
  17236. const bool isMouseOver,
  17237. const bool isMouseDown,
  17238. const bool isFrontTab);
  17239. virtual void drawTabAreaBehindFrontButton (Graphics& g,
  17240. int w, int h,
  17241. TabbedButtonBar& tabBar,
  17242. TabbedButtonBar::Orientation orientation);
  17243. virtual Button* createTabBarExtrasButton();
  17244. virtual void drawImageButton (Graphics& g, Image* image,
  17245. int imageX, int imageY, int imageW, int imageH,
  17246. const Colour& overlayColour,
  17247. float imageOpacity,
  17248. ImageButton& button);
  17249. virtual void drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header);
  17250. virtual void drawTableHeaderColumn (Graphics& g, const String& columnName, int columnId,
  17251. int width, int height,
  17252. bool isMouseOver, bool isMouseDown,
  17253. int columnFlags);
  17254. virtual void paintToolbarBackground (Graphics& g, int width, int height, Toolbar& toolbar);
  17255. virtual Button* createToolbarMissingItemsButton (Toolbar& toolbar);
  17256. virtual void paintToolbarButtonBackground (Graphics& g, int width, int height,
  17257. bool isMouseOver, bool isMouseDown,
  17258. ToolbarItemComponent& component);
  17259. virtual void paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  17260. const String& text, ToolbarItemComponent& component);
  17261. virtual void drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  17262. bool isOpen, int width, int height);
  17263. virtual void drawPropertyComponentBackground (Graphics& g, int width, int height,
  17264. PropertyComponent& component);
  17265. virtual void drawPropertyComponentLabel (Graphics& g, int width, int height,
  17266. PropertyComponent& component);
  17267. virtual const Rectangle<int> getPropertyComponentContentPosition (PropertyComponent& component);
  17268. virtual void drawLevelMeter (Graphics& g, int width, int height, float level);
  17269. virtual void drawKeymapChangeButton (Graphics& g, int width, int height, Button& button, const String& keyDescription);
  17270. virtual void playAlertSound();
  17271. static void drawGlassSphere (Graphics& g,
  17272. const float x, const float y,
  17273. const float diameter,
  17274. const Colour& colour,
  17275. const float outlineThickness) throw();
  17276. static void drawGlassPointer (Graphics& g,
  17277. const float x, const float y,
  17278. const float diameter,
  17279. const Colour& colour, const float outlineThickness,
  17280. const int direction) throw();
  17281. static void drawGlassLozenge (Graphics& g,
  17282. const float x, const float y,
  17283. const float width, const float height,
  17284. const Colour& colour,
  17285. const float outlineThickness,
  17286. const float cornerSize,
  17287. const bool flatOnLeft, const bool flatOnRight,
  17288. const bool flatOnTop, const bool flatOnBottom) throw();
  17289. juce_UseDebuggingNewOperator
  17290. private:
  17291. friend void JUCE_PUBLIC_FUNCTION shutdownJuce_GUI();
  17292. static void clearDefaultLookAndFeel() throw(); // called at shutdown
  17293. Array <int> colourIds;
  17294. Array <Colour> colours;
  17295. // default typeface names
  17296. String defaultSans, defaultSerif, defaultFixed;
  17297. void drawShinyButtonShape (Graphics& g,
  17298. float x, float y, float w, float h, float maxCornerSize,
  17299. const Colour& baseColour,
  17300. const float strokeWidth,
  17301. const bool flatOnLeft,
  17302. const bool flatOnRight,
  17303. const bool flatOnTop,
  17304. const bool flatOnBottom) throw();
  17305. LookAndFeel (const LookAndFeel&);
  17306. const LookAndFeel& operator= (const LookAndFeel&);
  17307. };
  17308. #endif // __JUCE_LOOKANDFEEL_JUCEHEADER__
  17309. /*** End of inlined file: juce_LookAndFeel.h ***/
  17310. #endif
  17311. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17312. /*** Start of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17313. #ifndef __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17314. #define __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17315. class JUCE_API OldSchoolLookAndFeel : public LookAndFeel
  17316. {
  17317. public:
  17318. OldSchoolLookAndFeel();
  17319. virtual ~OldSchoolLookAndFeel();
  17320. virtual void drawButtonBackground (Graphics& g,
  17321. Button& button,
  17322. const Colour& backgroundColour,
  17323. bool isMouseOverButton,
  17324. bool isButtonDown);
  17325. virtual void drawToggleButton (Graphics& g,
  17326. ToggleButton& button,
  17327. bool isMouseOverButton,
  17328. bool isButtonDown);
  17329. virtual void drawTickBox (Graphics& g,
  17330. Component& component,
  17331. int x, int y, int w, int h,
  17332. const bool ticked,
  17333. const bool isEnabled,
  17334. const bool isMouseOverButton,
  17335. const bool isButtonDown);
  17336. virtual void drawProgressBar (Graphics& g, ProgressBar& progressBar,
  17337. int width, int height,
  17338. double progress, const String& textToShow);
  17339. virtual void drawScrollbarButton (Graphics& g,
  17340. ScrollBar& scrollbar,
  17341. int width, int height,
  17342. int buttonDirection,
  17343. bool isScrollbarVertical,
  17344. bool isMouseOverButton,
  17345. bool isButtonDown);
  17346. virtual void drawScrollbar (Graphics& g,
  17347. ScrollBar& scrollbar,
  17348. int x, int y,
  17349. int width, int height,
  17350. bool isScrollbarVertical,
  17351. int thumbStartPosition,
  17352. int thumbSize,
  17353. bool isMouseOver,
  17354. bool isMouseDown);
  17355. virtual ImageEffectFilter* getScrollbarEffect();
  17356. virtual void drawTextEditorOutline (Graphics& g,
  17357. int width, int height,
  17358. TextEditor& textEditor);
  17359. virtual void drawPopupMenuBackground (Graphics& g, int width, int height);
  17360. virtual void drawMenuBarBackground (Graphics& g, int width, int height,
  17361. bool isMouseOverBar,
  17362. MenuBarComponent& menuBar);
  17363. virtual void drawComboBox (Graphics& g, int width, int height,
  17364. const bool isButtonDown,
  17365. int buttonX, int buttonY,
  17366. int buttonW, int buttonH,
  17367. ComboBox& box);
  17368. virtual const Font getComboBoxFont (ComboBox& box);
  17369. virtual void drawLinearSlider (Graphics& g,
  17370. int x, int y,
  17371. int width, int height,
  17372. float sliderPos,
  17373. float minSliderPos,
  17374. float maxSliderPos,
  17375. const Slider::SliderStyle style,
  17376. Slider& slider);
  17377. virtual int getSliderThumbRadius (Slider& slider);
  17378. virtual Button* createSliderButton (const bool isIncrement);
  17379. virtual ImageEffectFilter* getSliderEffect();
  17380. virtual void drawCornerResizer (Graphics& g,
  17381. int w, int h,
  17382. bool isMouseOver,
  17383. bool isMouseDragging);
  17384. virtual Button* createDocumentWindowButton (int buttonType);
  17385. virtual void positionDocumentWindowButtons (DocumentWindow& window,
  17386. int titleBarX, int titleBarY,
  17387. int titleBarW, int titleBarH,
  17388. Button* minimiseButton,
  17389. Button* maximiseButton,
  17390. Button* closeButton,
  17391. bool positionTitleBarButtonsOnLeft);
  17392. juce_UseDebuggingNewOperator
  17393. private:
  17394. DropShadowEffect scrollbarShadow;
  17395. OldSchoolLookAndFeel (const OldSchoolLookAndFeel&);
  17396. const OldSchoolLookAndFeel& operator= (const OldSchoolLookAndFeel&);
  17397. };
  17398. #endif // __JUCE_OLDSCHOOLLOOKANDFEEL_JUCEHEADER__
  17399. /*** End of inlined file: juce_OldSchoolLookAndFeel.h ***/
  17400. #endif
  17401. #ifndef __JUCE_MENUBARCOMPONENT_JUCEHEADER__
  17402. #endif
  17403. #ifndef __JUCE_MENUBARMODEL_JUCEHEADER__
  17404. #endif
  17405. #ifndef __JUCE_POPUPMENU_JUCEHEADER__
  17406. #endif
  17407. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17408. /*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/
  17409. #ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17410. #define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17411. class JUCE_API PopupMenuCustomComponent : public Component,
  17412. public ReferenceCountedObject
  17413. {
  17414. public:
  17415. ~PopupMenuCustomComponent();
  17416. virtual void getIdealSize (int& idealWidth,
  17417. int& idealHeight) = 0;
  17418. void triggerMenuItem();
  17419. bool isItemHighlighted() const throw() { return isHighlighted; }
  17420. protected:
  17421. PopupMenuCustomComponent (const bool isTriggeredAutomatically = true);
  17422. private:
  17423. friend class PopupMenu;
  17424. friend class PopupMenu::ItemComponent;
  17425. friend class PopupMenu::Window;
  17426. bool isHighlighted, isTriggeredAutomatically;
  17427. PopupMenuCustomComponent (const PopupMenuCustomComponent&);
  17428. PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&);
  17429. };
  17430. #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__
  17431. /*** End of inlined file: juce_PopupMenuCustomComponent.h ***/
  17432. #endif
  17433. #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__
  17434. #endif
  17435. #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
  17436. #endif
  17437. #ifndef __JUCE_DRAGANDDROPTARGET_JUCEHEADER__
  17438. #endif
  17439. #ifndef __JUCE_FILEDRAGANDDROPTARGET_JUCEHEADER__
  17440. #endif
  17441. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17442. /*** Start of inlined file: juce_LassoComponent.h ***/
  17443. #ifndef __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17444. #define __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17445. /*** Start of inlined file: juce_SelectedItemSet.h ***/
  17446. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17447. #define __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17448. template <class SelectableItemType>
  17449. class JUCE_API SelectedItemSet : public ChangeBroadcaster
  17450. {
  17451. public:
  17452. SelectedItemSet()
  17453. {
  17454. }
  17455. SelectedItemSet (const Array <SelectableItemType>& items)
  17456. : selectedItems (items)
  17457. {
  17458. }
  17459. SelectedItemSet (const SelectedItemSet& other)
  17460. : selectedItems (other.selectedItems)
  17461. {
  17462. }
  17463. const SelectedItemSet& operator= (const SelectedItemSet& other)
  17464. {
  17465. if (selectedItems != other.selectedItems)
  17466. {
  17467. selectedItems = other.selectedItems;
  17468. changed();
  17469. }
  17470. return *this;
  17471. }
  17472. ~SelectedItemSet()
  17473. {
  17474. }
  17475. void selectOnly (SelectableItemType item)
  17476. {
  17477. if (isSelected (item))
  17478. {
  17479. for (int i = selectedItems.size(); --i >= 0;)
  17480. {
  17481. if (selectedItems.getUnchecked(i) != item)
  17482. {
  17483. deselect (selectedItems.getUnchecked(i));
  17484. i = jmin (i, selectedItems.size());
  17485. }
  17486. }
  17487. }
  17488. else
  17489. {
  17490. deselectAll();
  17491. changed();
  17492. selectedItems.add (item);
  17493. itemSelected (item);
  17494. }
  17495. }
  17496. void addToSelection (SelectableItemType item)
  17497. {
  17498. if (! isSelected (item))
  17499. {
  17500. changed();
  17501. selectedItems.add (item);
  17502. itemSelected (item);
  17503. }
  17504. }
  17505. void addToSelectionBasedOnModifiers (SelectableItemType item,
  17506. const ModifierKeys& modifiers)
  17507. {
  17508. if (modifiers.isShiftDown())
  17509. {
  17510. addToSelection (item);
  17511. }
  17512. else if (modifiers.isCommandDown())
  17513. {
  17514. if (isSelected (item))
  17515. deselect (item);
  17516. else
  17517. addToSelection (item);
  17518. }
  17519. else
  17520. {
  17521. selectOnly (item);
  17522. }
  17523. }
  17524. bool addToSelectionOnMouseDown (SelectableItemType item,
  17525. const ModifierKeys& modifiers)
  17526. {
  17527. if (isSelected (item))
  17528. {
  17529. return ! modifiers.isPopupMenu();
  17530. }
  17531. else
  17532. {
  17533. addToSelectionBasedOnModifiers (item, modifiers);
  17534. return false;
  17535. }
  17536. }
  17537. void addToSelectionOnMouseUp (SelectableItemType item,
  17538. const ModifierKeys& modifiers,
  17539. const bool wasItemDragged,
  17540. const bool resultOfMouseDownSelectMethod)
  17541. {
  17542. if (resultOfMouseDownSelectMethod && ! wasItemDragged)
  17543. addToSelectionBasedOnModifiers (item, modifiers);
  17544. }
  17545. void deselect (SelectableItemType item)
  17546. {
  17547. const int i = selectedItems.indexOf (item);
  17548. if (i >= 0)
  17549. {
  17550. changed();
  17551. itemDeselected (selectedItems.remove (i));
  17552. }
  17553. }
  17554. void deselectAll()
  17555. {
  17556. if (selectedItems.size() > 0)
  17557. {
  17558. changed();
  17559. for (int i = selectedItems.size(); --i >= 0;)
  17560. {
  17561. itemDeselected (selectedItems.remove (i));
  17562. i = jmin (i, selectedItems.size());
  17563. }
  17564. }
  17565. }
  17566. int getNumSelected() const throw()
  17567. {
  17568. return selectedItems.size();
  17569. }
  17570. SelectableItemType getSelectedItem (const int index) const throw()
  17571. {
  17572. return selectedItems [index];
  17573. }
  17574. bool isSelected (const SelectableItemType item) const throw()
  17575. {
  17576. return selectedItems.contains (item);
  17577. }
  17578. const Array <SelectableItemType>& getItemArray() const throw() { return selectedItems; }
  17579. virtual void itemSelected (SelectableItemType item) {}
  17580. virtual void itemDeselected (SelectableItemType item) {}
  17581. void changed (const bool synchronous = false)
  17582. {
  17583. if (synchronous)
  17584. sendSynchronousChangeMessage (this);
  17585. else
  17586. sendChangeMessage (this);
  17587. }
  17588. juce_UseDebuggingNewOperator
  17589. private:
  17590. Array <SelectableItemType> selectedItems;
  17591. };
  17592. #endif // __JUCE_SELECTEDITEMSET_JUCEHEADER__
  17593. /*** End of inlined file: juce_SelectedItemSet.h ***/
  17594. template <class SelectableItemType>
  17595. class LassoSource
  17596. {
  17597. public:
  17598. virtual ~LassoSource() {}
  17599. virtual void findLassoItemsInArea (Array <SelectableItemType>& itemsFound,
  17600. int x, int y, int width, int height) = 0;
  17601. virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0;
  17602. };
  17603. template <class SelectableItemType>
  17604. class LassoComponent : public Component
  17605. {
  17606. public:
  17607. LassoComponent (const int outlineThickness_ = 1)
  17608. : source (0),
  17609. outlineThickness (outlineThickness_)
  17610. {
  17611. }
  17612. ~LassoComponent()
  17613. {
  17614. }
  17615. void beginLasso (const MouseEvent& e,
  17616. LassoSource <SelectableItemType>* const lassoSource)
  17617. {
  17618. jassert (source == 0); // this suggests that you didn't call endLasso() after the last drag...
  17619. jassert (lassoSource != 0); // the source can't be null!
  17620. jassert (getParentComponent() != 0); // you need to add this to a parent component for it to work!
  17621. source = lassoSource;
  17622. if (lassoSource != 0)
  17623. originalSelection = lassoSource->getLassoSelection().getItemArray();
  17624. setSize (0, 0);
  17625. }
  17626. void dragLasso (const MouseEvent& e)
  17627. {
  17628. if (source != 0)
  17629. {
  17630. const int x1 = e.getMouseDownX();
  17631. const int y1 = e.getMouseDownY();
  17632. setBounds (jmin (x1, e.x), jmin (y1, e.y), abs (e.x - x1), abs (e.y - y1));
  17633. setVisible (true);
  17634. Array <SelectableItemType> itemsInLasso;
  17635. source->findLassoItemsInArea (itemsInLasso, getX(), getY(), getWidth(), getHeight());
  17636. if (e.mods.isShiftDown())
  17637. {
  17638. itemsInLasso.removeValuesIn (originalSelection); // to avoid duplicates
  17639. itemsInLasso.addArray (originalSelection);
  17640. }
  17641. else if (e.mods.isCommandDown() || e.mods.isAltDown())
  17642. {
  17643. Array <SelectableItemType> originalMinusNew (originalSelection);
  17644. originalMinusNew.removeValuesIn (itemsInLasso);
  17645. itemsInLasso.removeValuesIn (originalSelection);
  17646. itemsInLasso.addArray (originalMinusNew);
  17647. }
  17648. source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso);
  17649. }
  17650. }
  17651. void endLasso()
  17652. {
  17653. source = 0;
  17654. originalSelection.clear();
  17655. setVisible (false);
  17656. }
  17657. enum ColourIds
  17658. {
  17659. lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
  17660. lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
  17661. };
  17662. void paint (Graphics& g)
  17663. {
  17664. g.fillAll (findColour (lassoFillColourId));
  17665. g.setColour (findColour (lassoOutlineColourId));
  17666. g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
  17667. // this suggests that you've left a lasso comp lying around after the
  17668. // mouse drag has finished.. Be careful to call endLasso() when you get a
  17669. // mouse-up event.
  17670. jassert (isMouseButtonDownAnywhere());
  17671. }
  17672. bool hitTest (int x, int y) { return false; }
  17673. juce_UseDebuggingNewOperator
  17674. private:
  17675. Array <SelectableItemType> originalSelection;
  17676. LassoSource <SelectableItemType>* source;
  17677. int outlineThickness;
  17678. };
  17679. #endif // __JUCE_LASSOCOMPONENT_JUCEHEADER__
  17680. /*** End of inlined file: juce_LassoComponent.h ***/
  17681. #endif
  17682. #ifndef __JUCE_MOUSECURSOR_JUCEHEADER__
  17683. #endif
  17684. #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__
  17685. #endif
  17686. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17687. /*** Start of inlined file: juce_MouseHoverDetector.h ***/
  17688. #ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17689. #define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17690. class JUCE_API MouseHoverDetector
  17691. {
  17692. public:
  17693. MouseHoverDetector (const int hoverTimeMillisecs = 400);
  17694. virtual ~MouseHoverDetector();
  17695. void setHoverTimeMillisecs (const int newTimeInMillisecs);
  17696. void setHoverComponent (Component* const newSourceComponent);
  17697. protected:
  17698. virtual void mouseHovered (int mouseX,
  17699. int mouseY) = 0;
  17700. virtual void mouseMovedAfterHover() = 0;
  17701. private:
  17702. class JUCE_API HoverDetectorInternal : public MouseListener,
  17703. public Timer
  17704. {
  17705. public:
  17706. MouseHoverDetector* owner;
  17707. int lastX, lastY;
  17708. void timerCallback();
  17709. void mouseEnter (const MouseEvent&);
  17710. void mouseExit (const MouseEvent&);
  17711. void mouseDown (const MouseEvent&);
  17712. void mouseUp (const MouseEvent&);
  17713. void mouseMove (const MouseEvent&);
  17714. void mouseWheelMove (const MouseEvent&, float, float);
  17715. } internalTimer;
  17716. friend class HoverDetectorInternal;
  17717. Component* source;
  17718. int hoverTimeMillisecs;
  17719. bool hasJustHovered;
  17720. void hoverTimerCallback();
  17721. void checkJustHoveredCallback();
  17722. MouseHoverDetector (const MouseHoverDetector&);
  17723. const MouseHoverDetector& operator= (const MouseHoverDetector&);
  17724. };
  17725. #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__
  17726. /*** End of inlined file: juce_MouseHoverDetector.h ***/
  17727. #endif
  17728. #ifndef __JUCE_MOUSELISTENER_JUCEHEADER__
  17729. #endif
  17730. #ifndef __JUCE_TOOLTIPCLIENT_JUCEHEADER__
  17731. #endif
  17732. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17733. /*** Start of inlined file: juce_BooleanPropertyComponent.h ***/
  17734. #ifndef __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17735. #define __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17736. class JUCE_API BooleanPropertyComponent : public PropertyComponent,
  17737. private ButtonListener
  17738. {
  17739. protected:
  17740. BooleanPropertyComponent (const String& propertyName,
  17741. const String& buttonTextWhenTrue,
  17742. const String& buttonTextWhenFalse);
  17743. public:
  17744. BooleanPropertyComponent (const Value& valueToControl,
  17745. const String& propertyName,
  17746. const String& buttonText);
  17747. ~BooleanPropertyComponent();
  17748. virtual void setState (const bool newState);
  17749. virtual bool getState() const;
  17750. void paint (Graphics& g);
  17751. void refresh();
  17752. void buttonClicked (Button*);
  17753. juce_UseDebuggingNewOperator
  17754. private:
  17755. ToggleButton* button;
  17756. String onText, offText;
  17757. void createButton();
  17758. BooleanPropertyComponent (const BooleanPropertyComponent&);
  17759. const BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
  17760. };
  17761. #endif // __JUCE_BOOLEANPROPERTYCOMPONENT_JUCEHEADER__
  17762. /*** End of inlined file: juce_BooleanPropertyComponent.h ***/
  17763. #endif
  17764. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17765. /*** Start of inlined file: juce_ButtonPropertyComponent.h ***/
  17766. #ifndef __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17767. #define __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17768. class JUCE_API ButtonPropertyComponent : public PropertyComponent,
  17769. private ButtonListener
  17770. {
  17771. public:
  17772. ButtonPropertyComponent (const String& propertyName,
  17773. const bool triggerOnMouseDown);
  17774. ~ButtonPropertyComponent();
  17775. virtual void buttonClicked() = 0;
  17776. virtual const String getButtonText() const = 0;
  17777. void refresh();
  17778. void buttonClicked (Button*);
  17779. juce_UseDebuggingNewOperator
  17780. private:
  17781. TextButton* button;
  17782. ButtonPropertyComponent (const ButtonPropertyComponent&);
  17783. const ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
  17784. };
  17785. #endif // __JUCE_BUTTONPROPERTYCOMPONENT_JUCEHEADER__
  17786. /*** End of inlined file: juce_ButtonPropertyComponent.h ***/
  17787. #endif
  17788. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17789. /*** Start of inlined file: juce_ChoicePropertyComponent.h ***/
  17790. #ifndef __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17791. #define __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17792. class JUCE_API ChoicePropertyComponent : public PropertyComponent,
  17793. private ComboBoxListener
  17794. {
  17795. protected:
  17796. ChoicePropertyComponent (const String& propertyName);
  17797. public:
  17798. ChoicePropertyComponent (const Value& valueToControl,
  17799. const String& propertyName,
  17800. const StringArray& choices,
  17801. const Array <int>* choiceIDs = 0);
  17802. ~ChoicePropertyComponent();
  17803. virtual void setIndex (const int newIndex);
  17804. virtual int getIndex() const;
  17805. const StringArray& getChoices() const;
  17806. void refresh();
  17807. void comboBoxChanged (ComboBox*);
  17808. juce_UseDebuggingNewOperator
  17809. protected:
  17810. StringArray choices;
  17811. private:
  17812. ComboBox* comboBox;
  17813. void createComboBox (const Array <int>* choiceIDs);
  17814. ChoicePropertyComponent (const ChoicePropertyComponent&);
  17815. const ChoicePropertyComponent& operator= (const ChoicePropertyComponent&);
  17816. };
  17817. #endif // __JUCE_CHOICEPROPERTYCOMPONENT_JUCEHEADER__
  17818. /*** End of inlined file: juce_ChoicePropertyComponent.h ***/
  17819. #endif
  17820. #ifndef __JUCE_PROPERTYCOMPONENT_JUCEHEADER__
  17821. #endif
  17822. #ifndef __JUCE_PROPERTYPANEL_JUCEHEADER__
  17823. #endif
  17824. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17825. /*** Start of inlined file: juce_SliderPropertyComponent.h ***/
  17826. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17827. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17828. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  17829. private SliderListener
  17830. {
  17831. protected:
  17832. SliderPropertyComponent (const String& propertyName,
  17833. const double rangeMin,
  17834. const double rangeMax,
  17835. const double interval,
  17836. const double skewFactor = 1.0);
  17837. public:
  17838. SliderPropertyComponent (Value& valueToControl,
  17839. const String& propertyName,
  17840. const double rangeMin,
  17841. const double rangeMax,
  17842. const double interval,
  17843. const double skewFactor = 1.0);
  17844. ~SliderPropertyComponent();
  17845. virtual void setValue (const double newValue);
  17846. virtual const double getValue() const;
  17847. void refresh();
  17848. void changeListenerCallback (void*);
  17849. void sliderValueChanged (Slider*);
  17850. juce_UseDebuggingNewOperator
  17851. protected:
  17852. Slider* slider;
  17853. SliderPropertyComponent (const SliderPropertyComponent&);
  17854. const SliderPropertyComponent& operator= (const SliderPropertyComponent&);
  17855. };
  17856. #endif // __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  17857. /*** End of inlined file: juce_SliderPropertyComponent.h ***/
  17858. #endif
  17859. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17860. /*** Start of inlined file: juce_TextPropertyComponent.h ***/
  17861. #ifndef __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17862. #define __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17863. class JUCE_API TextPropertyComponent : public PropertyComponent
  17864. {
  17865. protected:
  17866. TextPropertyComponent (const String& propertyName,
  17867. const int maxNumChars,
  17868. const bool isMultiLine);
  17869. public:
  17870. TextPropertyComponent (const Value& valueToControl,
  17871. const String& propertyName,
  17872. const int maxNumChars,
  17873. const bool isMultiLine);
  17874. ~TextPropertyComponent();
  17875. virtual void setText (const String& newText);
  17876. virtual const String getText() const;
  17877. void refresh();
  17878. void textWasEdited();
  17879. juce_UseDebuggingNewOperator
  17880. private:
  17881. Label* textEditor;
  17882. void createEditor (const int maxNumChars, const bool isMultiLine);
  17883. TextPropertyComponent (const TextPropertyComponent&);
  17884. const TextPropertyComponent& operator= (const TextPropertyComponent&);
  17885. };
  17886. #endif // __JUCE_TEXTPROPERTYCOMPONENT_JUCEHEADER__
  17887. /*** End of inlined file: juce_TextPropertyComponent.h ***/
  17888. #endif
  17889. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17890. /*** Start of inlined file: juce_ActiveXControlComponent.h ***/
  17891. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17892. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17893. #if JUCE_WINDOWS || DOXYGEN
  17894. class JUCE_API ActiveXControlComponent : public Component
  17895. {
  17896. public:
  17897. ActiveXControlComponent();
  17898. ~ActiveXControlComponent();
  17899. bool createControl (const void* controlIID);
  17900. void deleteControl();
  17901. bool isControlOpen() const throw() { return control != 0; }
  17902. void* queryInterface (const void* iid) const;
  17903. void setMouseEventsAllowed (const bool eventsCanReachControl);
  17904. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  17905. void paint (Graphics& g);
  17906. void* originalWndProc;
  17907. juce_UseDebuggingNewOperator
  17908. private:
  17909. friend class ActiveXControlData;
  17910. void* control;
  17911. bool mouseEventsAllowed;
  17912. ActiveXControlComponent (const ActiveXControlComponent&);
  17913. const ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  17914. void setControlBounds (const Rectangle<int>& bounds) const;
  17915. void setControlVisible (const bool b) const;
  17916. };
  17917. #endif
  17918. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  17919. /*** End of inlined file: juce_ActiveXControlComponent.h ***/
  17920. #endif
  17921. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17922. /*** Start of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  17923. #ifndef __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17924. #define __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17925. class MidiInputSelectorComponentListBox;
  17926. class JUCE_API AudioDeviceSelectorComponent : public Component,
  17927. public ComboBoxListener,
  17928. public ButtonListener,
  17929. public ChangeListener
  17930. {
  17931. public:
  17932. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  17933. const int minAudioInputChannels,
  17934. const int maxAudioInputChannels,
  17935. const int minAudioOutputChannels,
  17936. const int maxAudioOutputChannels,
  17937. const bool showMidiInputOptions,
  17938. const bool showMidiOutputSelector,
  17939. const bool showChannelsAsStereoPairs,
  17940. const bool hideAdvancedOptionsWithButton);
  17941. ~AudioDeviceSelectorComponent();
  17942. void resized();
  17943. void comboBoxChanged (ComboBox*);
  17944. void buttonClicked (Button*);
  17945. void changeListenerCallback (void*);
  17946. void childBoundsChanged (Component*);
  17947. juce_UseDebuggingNewOperator
  17948. private:
  17949. AudioDeviceManager& deviceManager;
  17950. ComboBox* deviceTypeDropDown;
  17951. Label* deviceTypeDropDownLabel;
  17952. Component* audioDeviceSettingsComp;
  17953. String audioDeviceSettingsCompType;
  17954. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  17955. const bool showChannelsAsStereoPairs;
  17956. const bool hideAdvancedOptionsWithButton;
  17957. MidiInputSelectorComponentListBox* midiInputsList;
  17958. Label* midiInputsLabel;
  17959. ComboBox* midiOutputSelector;
  17960. Label* midiOutputLabel;
  17961. AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
  17962. const AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);
  17963. };
  17964. #endif // __JUCE_AUDIODEVICESELECTORCOMPONENT_JUCEHEADER__
  17965. /*** End of inlined file: juce_AudioDeviceSelectorComponent.h ***/
  17966. #endif
  17967. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17968. /*** Start of inlined file: juce_BubbleComponent.h ***/
  17969. #ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17970. #define __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  17971. class JUCE_API BubbleComponent : public Component
  17972. {
  17973. protected:
  17974. BubbleComponent();
  17975. public:
  17976. ~BubbleComponent();
  17977. enum BubblePlacement
  17978. {
  17979. above = 1,
  17980. below = 2,
  17981. left = 4,
  17982. right = 8
  17983. };
  17984. void setAllowedPlacement (const int newPlacement);
  17985. void setPosition (Component* componentToPointTo);
  17986. void setPosition (const int arrowTipX,
  17987. const int arrowTipY);
  17988. void setPosition (const Rectangle<int>& rectangleToPointTo);
  17989. protected:
  17990. virtual void getContentSize (int& width, int& height) = 0;
  17991. virtual void paintContent (Graphics& g, int width, int height) = 0;
  17992. public:
  17993. void paint (Graphics& g);
  17994. juce_UseDebuggingNewOperator
  17995. private:
  17996. Rectangle<int> content;
  17997. int side, allowablePlacements;
  17998. float arrowTipX, arrowTipY;
  17999. DropShadowEffect shadow;
  18000. BubbleComponent (const BubbleComponent&);
  18001. const BubbleComponent& operator= (const BubbleComponent&);
  18002. };
  18003. #endif // __JUCE_BUBBLECOMPONENT_JUCEHEADER__
  18004. /*** End of inlined file: juce_BubbleComponent.h ***/
  18005. #endif
  18006. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18007. /*** Start of inlined file: juce_BubbleMessageComponent.h ***/
  18008. #ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18009. #define __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18010. class JUCE_API BubbleMessageComponent : public BubbleComponent,
  18011. private Timer
  18012. {
  18013. public:
  18014. BubbleMessageComponent (const int fadeOutLengthMs = 150);
  18015. ~BubbleMessageComponent();
  18016. void showAt (int x, int y,
  18017. const String& message,
  18018. const int numMillisecondsBeforeRemoving,
  18019. const bool removeWhenMouseClicked = true,
  18020. const bool deleteSelfAfterUse = false);
  18021. void showAt (Component* const component,
  18022. const String& message,
  18023. const int numMillisecondsBeforeRemoving,
  18024. const bool removeWhenMouseClicked = true,
  18025. const bool deleteSelfAfterUse = false);
  18026. void getContentSize (int& w, int& h);
  18027. void paintContent (Graphics& g, int w, int h);
  18028. void timerCallback();
  18029. juce_UseDebuggingNewOperator
  18030. private:
  18031. int fadeOutLength, mouseClickCounter;
  18032. TextLayout textLayout;
  18033. int64 expiryTime;
  18034. bool deleteAfterUse;
  18035. void init (const int numMillisecondsBeforeRemoving,
  18036. const bool removeWhenMouseClicked,
  18037. const bool deleteSelfAfterUse);
  18038. BubbleMessageComponent (const BubbleMessageComponent&);
  18039. const BubbleMessageComponent& operator= (const BubbleMessageComponent&);
  18040. };
  18041. #endif // __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
  18042. /*** End of inlined file: juce_BubbleMessageComponent.h ***/
  18043. #endif
  18044. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18045. /*** Start of inlined file: juce_ColourSelector.h ***/
  18046. #ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
  18047. #define __JUCE_COLOURSELECTOR_JUCEHEADER__
  18048. class JUCE_API ColourSelector : public Component,
  18049. public ChangeBroadcaster,
  18050. protected SliderListener
  18051. {
  18052. public:
  18053. enum ColourSelectorOptions
  18054. {
  18055. showAlphaChannel = 1 << 0, /**< if set, the colour's alpha channel can be changed as well as its RGB. */
  18056. showColourAtTop = 1 << 1, /**< if set, a swatch of the colour is shown at the top of the component. */
  18057. showSliders = 1 << 2, /**< if set, RGB sliders are shown at the bottom of the component. */
  18058. showColourspace = 1 << 3 /**< if set, a big HSV selector is shown. */
  18059. };
  18060. ColourSelector (const int sectionsToShow = (showAlphaChannel | showColourAtTop | showSliders | showColourspace),
  18061. const int edgeGap = 4,
  18062. const int gapAroundColourSpaceComponent = 7);
  18063. ~ColourSelector();
  18064. const Colour getCurrentColour() const;
  18065. void setCurrentColour (const Colour& newColour);
  18066. virtual int getNumSwatches() const;
  18067. virtual const Colour getSwatchColour (const int index) const;
  18068. virtual void setSwatchColour (const int index, const Colour& newColour) const;
  18069. enum ColourIds
  18070. {
  18071. backgroundColourId = 0x1007000, /**< the colour used to fill the component's background. */
  18072. labelTextColourId = 0x1007001 /**< the colour used for the labels next to the sliders. */
  18073. };
  18074. juce_UseDebuggingNewOperator
  18075. private:
  18076. friend class ColourSpaceView;
  18077. friend class HueSelectorComp;
  18078. Colour colour;
  18079. float h, s, v;
  18080. Slider* sliders[4];
  18081. Component* colourSpace;
  18082. Component* hueSelector;
  18083. class SwatchComponent;
  18084. OwnedArray <SwatchComponent> swatchComponents;
  18085. const int flags;
  18086. int topSpace, edgeGap;
  18087. void setHue (float newH);
  18088. void setSV (float newS, float newV);
  18089. void updateHSV();
  18090. void update();
  18091. void sliderValueChanged (Slider*);
  18092. void paint (Graphics& g);
  18093. void resized();
  18094. ColourSelector (const ColourSelector&);
  18095. const ColourSelector& operator= (const ColourSelector&);
  18096. // this constructor is here temporarily to prevent old code compiling, because the parameters
  18097. // have changed - if you get an error here, update your code to use the new constructor instead..
  18098. // (xxx - note to self: remember to remove this at some point in the future)
  18099. ColourSelector (const bool);
  18100. };
  18101. #endif // __JUCE_COLOURSELECTOR_JUCEHEADER__
  18102. /*** End of inlined file: juce_ColourSelector.h ***/
  18103. #endif
  18104. #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
  18105. #endif
  18106. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18107. /*** Start of inlined file: juce_MagnifierComponent.h ***/
  18108. #ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18109. #define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18110. class JUCE_API MagnifierComponent : public Component
  18111. {
  18112. public:
  18113. MagnifierComponent (Component* const contentComponent,
  18114. const bool deleteContentCompWhenNoLongerNeeded);
  18115. ~MagnifierComponent();
  18116. Component* getContentComponent() const { return content; }
  18117. void setScaleFactor (double newScaleFactor);
  18118. double getScaleFactor() const { return scaleFactor; }
  18119. void setResamplingQuality (Graphics::ResamplingQuality newQuality);
  18120. juce_UseDebuggingNewOperator
  18121. void childBoundsChanged (Component*);
  18122. private:
  18123. Component* content;
  18124. Component* holderComp;
  18125. double scaleFactor;
  18126. ComponentPeer* peer;
  18127. bool deleteContent;
  18128. Graphics::ResamplingQuality quality;
  18129. void paint (Graphics& g);
  18130. void mouseDown (const MouseEvent& e);
  18131. void mouseUp (const MouseEvent& e);
  18132. void mouseDrag (const MouseEvent& e);
  18133. void mouseMove (const MouseEvent& e);
  18134. void mouseEnter (const MouseEvent& e);
  18135. void mouseExit (const MouseEvent& e);
  18136. void mouseWheelMove (const MouseEvent& e, float, float);
  18137. int scaleInt (const int n) const;
  18138. MagnifierComponent (const MagnifierComponent&);
  18139. const MagnifierComponent& operator= (const MagnifierComponent&);
  18140. };
  18141. #endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
  18142. /*** End of inlined file: juce_MagnifierComponent.h ***/
  18143. #endif
  18144. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18145. /*** Start of inlined file: juce_MidiKeyboardComponent.h ***/
  18146. #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18147. #define __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18148. class JUCE_API MidiKeyboardComponent : public Component,
  18149. public MidiKeyboardStateListener,
  18150. public ChangeBroadcaster,
  18151. private Timer,
  18152. private AsyncUpdater
  18153. {
  18154. public:
  18155. enum Orientation
  18156. {
  18157. horizontalKeyboard,
  18158. verticalKeyboardFacingLeft,
  18159. verticalKeyboardFacingRight,
  18160. };
  18161. MidiKeyboardComponent (MidiKeyboardState& state,
  18162. const Orientation orientation);
  18163. ~MidiKeyboardComponent();
  18164. void setVelocity (const float velocity, const bool useMousePositionForVelocity);
  18165. void setMidiChannel (const int midiChannelNumber);
  18166. int getMidiChannel() const throw() { return midiChannel; }
  18167. void setMidiChannelsToDisplay (const int midiChannelMask);
  18168. int getMidiChannelsToDisplay() const throw() { return midiInChannelMask; }
  18169. void setKeyWidth (const float widthInPixels);
  18170. float getKeyWidth() const throw() { return keyWidth; }
  18171. void setOrientation (const Orientation newOrientation);
  18172. const Orientation getOrientation() const throw() { return orientation; }
  18173. void setAvailableRange (const int lowestNote,
  18174. const int highestNote);
  18175. int getRangeStart() const throw() { return rangeStart; }
  18176. int getRangeEnd() const throw() { return rangeEnd; }
  18177. void setLowestVisibleKey (int noteNumber);
  18178. int getLowestVisibleKey() const throw() { return firstKey; }
  18179. int getBlackNoteLength() const throw() { return blackNoteLength; }
  18180. void setScrollButtonsVisible (const bool canScroll);
  18181. enum ColourIds
  18182. {
  18183. whiteNoteColourId = 0x1005000,
  18184. blackNoteColourId = 0x1005001,
  18185. keySeparatorLineColourId = 0x1005002,
  18186. mouseOverKeyOverlayColourId = 0x1005003, /**< This colour will be overlaid on the normal note colour. */
  18187. keyDownOverlayColourId = 0x1005004, /**< This colour will be overlaid on the normal note colour. */
  18188. textLabelColourId = 0x1005005,
  18189. upDownButtonBackgroundColourId = 0x1005006,
  18190. upDownButtonArrowColourId = 0x1005007
  18191. };
  18192. int getKeyStartPosition (const int midiNoteNumber) const;
  18193. void clearKeyMappings();
  18194. void setKeyPressForNote (const KeyPress& key,
  18195. const int midiNoteOffsetFromC);
  18196. void removeKeyPressForNote (const int midiNoteOffsetFromC);
  18197. void setKeyPressBaseOctave (const int newOctaveNumber);
  18198. void setOctaveForMiddleC (const int octaveNumForMiddleC) throw();
  18199. int getOctaveForMiddleC() const throw() { return octaveNumForMiddleC; }
  18200. void paint (Graphics& g);
  18201. void resized();
  18202. void mouseMove (const MouseEvent& e);
  18203. void mouseDrag (const MouseEvent& e);
  18204. void mouseDown (const MouseEvent& e);
  18205. void mouseUp (const MouseEvent& e);
  18206. void mouseEnter (const MouseEvent& e);
  18207. void mouseExit (const MouseEvent& e);
  18208. void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
  18209. void timerCallback();
  18210. bool keyStateChanged (const bool isKeyDown);
  18211. void focusLost (FocusChangeType cause);
  18212. void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
  18213. void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
  18214. void handleAsyncUpdate();
  18215. void colourChanged();
  18216. juce_UseDebuggingNewOperator
  18217. protected:
  18218. friend class MidiKeyboardUpDownButton;
  18219. virtual void drawWhiteNote (int midiNoteNumber,
  18220. Graphics& g,
  18221. int x, int y, int w, int h,
  18222. bool isDown, bool isOver,
  18223. const Colour& lineColour,
  18224. const Colour& textColour);
  18225. virtual void drawBlackNote (int midiNoteNumber,
  18226. Graphics& g,
  18227. int x, int y, int w, int h,
  18228. bool isDown, bool isOver,
  18229. const Colour& noteFillColour);
  18230. virtual const String getWhiteNoteText (const int midiNoteNumber);
  18231. virtual void drawUpDownButton (Graphics& g, int w, int h,
  18232. const bool isMouseOver,
  18233. const bool isButtonPressed,
  18234. const bool movesOctavesUp);
  18235. virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e);
  18236. virtual void mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e);
  18237. virtual void getKeyPosition (int midiNoteNumber, float keyWidth,
  18238. int& x, int& w) const;
  18239. private:
  18240. MidiKeyboardState& state;
  18241. int xOffset, blackNoteLength;
  18242. float keyWidth;
  18243. Orientation orientation;
  18244. int midiChannel, midiInChannelMask;
  18245. float velocity;
  18246. int noteUnderMouse, mouseDownNote;
  18247. BitArray keysPressed, keysCurrentlyDrawnDown;
  18248. int rangeStart, rangeEnd, firstKey;
  18249. bool canScroll, mouseDragging, useMousePositionForVelocity;
  18250. Button* scrollDown;
  18251. Button* scrollUp;
  18252. Array <KeyPress> keyPresses;
  18253. Array <int> keyPressNotes;
  18254. int keyMappingOctave;
  18255. int octaveNumForMiddleC;
  18256. void getKeyPos (int midiNoteNumber, int& x, int& w) const;
  18257. int xyToNote (int x, int y, float& mousePositionVelocity);
  18258. int remappedXYToNote (int x, int y, float& mousePositionVelocity) const;
  18259. void resetAnyKeysInUse();
  18260. void updateNoteUnderMouse (int x, int y);
  18261. void repaintNote (const int midiNoteNumber);
  18262. MidiKeyboardComponent (const MidiKeyboardComponent&);
  18263. const MidiKeyboardComponent& operator= (const MidiKeyboardComponent&);
  18264. };
  18265. #endif // __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
  18266. /*** End of inlined file: juce_MidiKeyboardComponent.h ***/
  18267. #endif
  18268. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18269. /*** Start of inlined file: juce_NSViewComponent.h ***/
  18270. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18271. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18272. #if ! DOXYGEN
  18273. class NSViewComponentInternal;
  18274. #endif
  18275. #if JUCE_MAC || DOXYGEN
  18276. class JUCE_API NSViewComponent : public Component
  18277. {
  18278. public:
  18279. NSViewComponent();
  18280. ~NSViewComponent();
  18281. void setView (void* nsView);
  18282. void* getView() const;
  18283. void paint (Graphics& g);
  18284. juce_UseDebuggingNewOperator
  18285. private:
  18286. friend class NSViewComponentInternal;
  18287. ScopedPointer <NSViewComponentInternal> info;
  18288. NSViewComponent (const NSViewComponent&);
  18289. const NSViewComponent& operator= (const NSViewComponent&);
  18290. };
  18291. #endif
  18292. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  18293. /*** End of inlined file: juce_NSViewComponent.h ***/
  18294. #endif
  18295. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18296. /*** Start of inlined file: juce_OpenGLComponent.h ***/
  18297. #ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18298. #define __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18299. // this is used to disable OpenGL, and is defined in juce_Config.h
  18300. #if JUCE_OPENGL || DOXYGEN
  18301. class JUCE_API OpenGLPixelFormat
  18302. {
  18303. public:
  18304. OpenGLPixelFormat (const int bitsPerRGBComponent = 8,
  18305. const int alphaBits = 8,
  18306. const int depthBufferBits = 16,
  18307. const int stencilBufferBits = 0) throw();
  18308. int redBits; /**< The number of bits per pixel to use for the red channel. */
  18309. int greenBits; /**< The number of bits per pixel to use for the green channel. */
  18310. int blueBits; /**< The number of bits per pixel to use for the blue channel. */
  18311. int alphaBits; /**< The number of bits per pixel to use for the alpha channel. */
  18312. int depthBufferBits; /**< The number of bits per pixel to use for a depth buffer. */
  18313. int stencilBufferBits; /**< The number of bits per pixel to use for a stencil buffer. */
  18314. int accumulationBufferRedBits; /**< The number of bits per pixel to use for an accumulation buffer's red channel. */
  18315. int accumulationBufferGreenBits; /**< The number of bits per pixel to use for an accumulation buffer's green channel. */
  18316. int accumulationBufferBlueBits; /**< The number of bits per pixel to use for an accumulation buffer's blue channel. */
  18317. int accumulationBufferAlphaBits; /**< The number of bits per pixel to use for an accumulation buffer's alpha channel. */
  18318. uint8 fullSceneAntiAliasingNumSamples; /**< The number of samples to use in full-scene anti-aliasing (if available). */
  18319. static void getAvailablePixelFormats (Component* component,
  18320. OwnedArray <OpenGLPixelFormat>& results);
  18321. bool operator== (const OpenGLPixelFormat&) const throw();
  18322. juce_UseDebuggingNewOperator
  18323. };
  18324. class JUCE_API OpenGLContext
  18325. {
  18326. public:
  18327. virtual ~OpenGLContext();
  18328. virtual bool makeActive() const throw() = 0;
  18329. virtual bool makeInactive() const throw() = 0;
  18330. virtual bool isActive() const throw() = 0;
  18331. virtual void swapBuffers() = 0;
  18332. virtual bool setSwapInterval (const int numFramesPerSwap) = 0;
  18333. virtual int getSwapInterval() const = 0;
  18334. virtual const OpenGLPixelFormat getPixelFormat() const = 0;
  18335. virtual void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight) = 0;
  18336. virtual void repaint() = 0;
  18337. virtual void* getRawContext() const throw() = 0;
  18338. static OpenGLContext* createContextForWindow (Component* componentToDrawTo,
  18339. const OpenGLPixelFormat& pixelFormat,
  18340. const OpenGLContext* const contextToShareWith);
  18341. static OpenGLContext* getCurrentContext();
  18342. juce_UseDebuggingNewOperator
  18343. protected:
  18344. OpenGLContext() throw();
  18345. };
  18346. class JUCE_API OpenGLComponent : public Component
  18347. {
  18348. public:
  18349. OpenGLComponent();
  18350. ~OpenGLComponent();
  18351. void setPixelFormat (const OpenGLPixelFormat& formatToUse);
  18352. const OpenGLPixelFormat getPixelFormat() const;
  18353. void shareWith (OpenGLContext* contextToShareListsWith);
  18354. OpenGLContext* getShareContext() const throw() { return contextToShareListsWith; }
  18355. void swapBuffers();
  18356. virtual void renderOpenGL() = 0;
  18357. virtual void newOpenGLContextCreated() = 0;
  18358. OpenGLContext* getCurrentContext() const throw() { return context; }
  18359. bool makeCurrentContextActive();
  18360. void makeCurrentContextInactive();
  18361. bool isActiveContext() const throw();
  18362. virtual bool renderAndSwapBuffers();
  18363. CriticalSection& getContextLock() throw() { return contextLock; }
  18364. void paint (Graphics& g);
  18365. void* getNativeWindowHandle() const;
  18366. juce_UseDebuggingNewOperator
  18367. private:
  18368. class OpenGLComponentWatcher;
  18369. friend class ScopedPointer <OpenGLComponentWatcher>;
  18370. ScopedPointer <OpenGLComponentWatcher> componentWatcher;
  18371. OpenGLContext* context;
  18372. OpenGLContext* contextToShareListsWith;
  18373. CriticalSection contextLock;
  18374. OpenGLPixelFormat preferredPixelFormat;
  18375. bool needToUpdateViewport;
  18376. void deleteContext();
  18377. void updateContextPosition();
  18378. void internalRepaint (int x, int y, int w, int h);
  18379. OpenGLComponent (const OpenGLComponent&);
  18380. const OpenGLComponent& operator= (const OpenGLComponent&);
  18381. };
  18382. #endif
  18383. #endif // __JUCE_OPENGLCOMPONENT_JUCEHEADER__
  18384. /*** End of inlined file: juce_OpenGLComponent.h ***/
  18385. #endif
  18386. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18387. /*** Start of inlined file: juce_PreferencesPanel.h ***/
  18388. #ifndef __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18389. #define __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18390. class JUCE_API PreferencesPanel : public Component,
  18391. private ButtonListener
  18392. {
  18393. public:
  18394. PreferencesPanel();
  18395. ~PreferencesPanel();
  18396. void addSettingsPage (const String& pageTitle,
  18397. const Drawable* normalIcon,
  18398. const Drawable* overIcon,
  18399. const Drawable* downIcon);
  18400. void addSettingsPage (const String& pageTitle,
  18401. const char* imageData,
  18402. const int imageDataSize);
  18403. void showInDialogBox (const String& dialogtitle,
  18404. int dialogWidth,
  18405. int dialogHeight,
  18406. const Colour& backgroundColour = Colours::white);
  18407. virtual Component* createComponentForPage (const String& pageName) = 0;
  18408. void setCurrentPage (const String& pageName);
  18409. void resized();
  18410. void paint (Graphics& g);
  18411. void buttonClicked (Button* button);
  18412. juce_UseDebuggingNewOperator
  18413. private:
  18414. String currentPageName;
  18415. ScopedPointer <Component> currentPage;
  18416. int buttonSize;
  18417. PreferencesPanel (const PreferencesPanel&);
  18418. const PreferencesPanel& operator= (const PreferencesPanel&);
  18419. };
  18420. #endif // __JUCE_PREFERENCESPANEL_JUCEHEADER__
  18421. /*** End of inlined file: juce_PreferencesPanel.h ***/
  18422. #endif
  18423. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18424. /*** Start of inlined file: juce_QuickTimeMovieComponent.h ***/
  18425. #ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18426. #define __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18427. // (NB: This stuff mustn't go inside the "#if QUICKTIME" block, or it'll break the
  18428. // amalgamated build)
  18429. #if JUCE_WINDOWS
  18430. typedef ActiveXControlComponent QTCompBaseClass;
  18431. #elif JUCE_MAC
  18432. typedef NSViewComponent QTCompBaseClass;
  18433. #endif
  18434. // this is used to disable QuickTime, and is defined in juce_Config.h
  18435. #if JUCE_QUICKTIME || DOXYGEN
  18436. class JUCE_API QuickTimeMovieComponent : public QTCompBaseClass
  18437. {
  18438. public:
  18439. QuickTimeMovieComponent();
  18440. ~QuickTimeMovieComponent();
  18441. static bool isQuickTimeAvailable() throw();
  18442. bool loadMovie (const File& movieFile,
  18443. const bool isControllerVisible);
  18444. bool loadMovie (const URL& movieURL,
  18445. const bool isControllerVisible);
  18446. bool loadMovie (InputStream* movieStream,
  18447. const bool isControllerVisible);
  18448. void closeMovie();
  18449. const File getCurrentMovieFile() const;
  18450. bool isMovieOpen() const;
  18451. double getMovieDuration() const;
  18452. void getMovieNormalSize (int& width, int& height) const;
  18453. void setBoundsWithCorrectAspectRatio (const Rectangle<int>& spaceToFitWithin,
  18454. const RectanglePlacement& placement);
  18455. void play();
  18456. void stop();
  18457. bool isPlaying() const;
  18458. void goToStart();
  18459. void setPosition (const double seconds);
  18460. double getPosition() const;
  18461. void setSpeed (const float newSpeed);
  18462. void setMovieVolume (const float newVolume);
  18463. float getMovieVolume() const;
  18464. void setLooping (const bool shouldLoop);
  18465. bool isLooping() const;
  18466. bool isControllerVisible() const;
  18467. void paint (Graphics& g);
  18468. juce_UseDebuggingNewOperator
  18469. private:
  18470. File movieFile;
  18471. bool movieLoaded, controllerVisible, looping;
  18472. #if JUCE_WINDOWS
  18473. void parentHierarchyChanged();
  18474. void visibilityChanged();
  18475. void createControlIfNeeded();
  18476. bool isControlCreated() const;
  18477. void* internal;
  18478. #else
  18479. void* movie;
  18480. #endif
  18481. QuickTimeMovieComponent (const QuickTimeMovieComponent&);
  18482. const QuickTimeMovieComponent& operator= (const QuickTimeMovieComponent&);
  18483. };
  18484. #endif
  18485. #endif // __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
  18486. /*** End of inlined file: juce_QuickTimeMovieComponent.h ***/
  18487. #endif
  18488. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18489. /*** Start of inlined file: juce_SystemTrayIconComponent.h ***/
  18490. #ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18491. #define __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18492. #if JUCE_WINDOWS || JUCE_LINUX || DOXYGEN
  18493. class JUCE_API SystemTrayIconComponent : public Component
  18494. {
  18495. public:
  18496. SystemTrayIconComponent();
  18497. ~SystemTrayIconComponent();
  18498. void setIconImage (const Image& newImage);
  18499. void setIconTooltip (const String& tooltip);
  18500. #if JUCE_LINUX
  18501. void paint (Graphics& g);
  18502. #endif
  18503. juce_UseDebuggingNewOperator
  18504. private:
  18505. SystemTrayIconComponent (const SystemTrayIconComponent&);
  18506. const SystemTrayIconComponent& operator= (const SystemTrayIconComponent&);
  18507. };
  18508. #endif
  18509. #endif // __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
  18510. /*** End of inlined file: juce_SystemTrayIconComponent.h ***/
  18511. #endif
  18512. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18513. /*** Start of inlined file: juce_WebBrowserComponent.h ***/
  18514. #ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18515. #define __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18516. #if JUCE_WEB_BROWSER || DOXYGEN
  18517. #if ! DOXYGEN
  18518. class WebBrowserComponentInternal;
  18519. #endif
  18520. class JUCE_API WebBrowserComponent : public Component
  18521. {
  18522. public:
  18523. WebBrowserComponent (const bool unloadPageWhenBrowserIsHidden = true);
  18524. ~WebBrowserComponent();
  18525. void goToURL (const String& url,
  18526. const StringArray* headers = 0,
  18527. const MemoryBlock* postData = 0);
  18528. void stop();
  18529. void goBack();
  18530. void goForward();
  18531. void refresh();
  18532. virtual bool pageAboutToLoad (const String& newURL);
  18533. void paint (Graphics& g);
  18534. void resized();
  18535. void parentHierarchyChanged();
  18536. void visibilityChanged();
  18537. juce_UseDebuggingNewOperator
  18538. private:
  18539. WebBrowserComponentInternal* browser;
  18540. bool blankPageShown, unloadPageWhenBrowserIsHidden;
  18541. String lastURL;
  18542. StringArray lastHeaders;
  18543. MemoryBlock lastPostData;
  18544. void reloadLastURL();
  18545. void checkWindowAssociation();
  18546. WebBrowserComponent (const WebBrowserComponent&);
  18547. const WebBrowserComponent& operator= (const WebBrowserComponent&);
  18548. };
  18549. #endif
  18550. #endif // __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
  18551. /*** End of inlined file: juce_WebBrowserComponent.h ***/
  18552. #endif
  18553. #ifndef __JUCE_ALERTWINDOW_JUCEHEADER__
  18554. #endif
  18555. #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__
  18556. #endif
  18557. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18558. /*** Start of inlined file: juce_DialogWindow.h ***/
  18559. #ifndef __JUCE_DIALOGWINDOW_JUCEHEADER__
  18560. #define __JUCE_DIALOGWINDOW_JUCEHEADER__
  18561. class JUCE_API DialogWindow : public DocumentWindow
  18562. {
  18563. public:
  18564. DialogWindow (const String& name,
  18565. const Colour& backgroundColour,
  18566. const bool escapeKeyTriggersCloseButton,
  18567. const bool addToDesktop = true);
  18568. ~DialogWindow();
  18569. static int showModalDialog (const String& dialogTitle,
  18570. Component* contentComponent,
  18571. Component* componentToCentreAround,
  18572. const Colour& backgroundColour,
  18573. const bool escapeKeyTriggersCloseButton,
  18574. const bool shouldBeResizable = false,
  18575. const bool useBottomRightCornerResizer = false);
  18576. juce_UseDebuggingNewOperator
  18577. protected:
  18578. void resized();
  18579. private:
  18580. bool escapeKeyTriggersCloseButton;
  18581. DialogWindow (const DialogWindow&);
  18582. const DialogWindow& operator= (const DialogWindow&);
  18583. };
  18584. #endif // __JUCE_DIALOGWINDOW_JUCEHEADER__
  18585. /*** End of inlined file: juce_DialogWindow.h ***/
  18586. #endif
  18587. #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
  18588. #endif
  18589. #ifndef __JUCE_RESIZABLEWINDOW_JUCEHEADER__
  18590. #endif
  18591. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18592. /*** Start of inlined file: juce_SplashScreen.h ***/
  18593. #ifndef __JUCE_SPLASHSCREEN_JUCEHEADER__
  18594. #define __JUCE_SPLASHSCREEN_JUCEHEADER__
  18595. class JUCE_API SplashScreen : public Component,
  18596. public Timer,
  18597. private DeletedAtShutdown
  18598. {
  18599. public:
  18600. SplashScreen();
  18601. ~SplashScreen();
  18602. void show (const String& title,
  18603. Image* const backgroundImage,
  18604. const int minimumTimeToDisplayFor,
  18605. const bool useDropShadow,
  18606. const bool removeOnMouseClick = true);
  18607. void show (const String& title,
  18608. const int width,
  18609. const int height,
  18610. const int minimumTimeToDisplayFor,
  18611. const bool useDropShadow,
  18612. const bool removeOnMouseClick = true);
  18613. void paint (Graphics& g);
  18614. void timerCallback();
  18615. juce_UseDebuggingNewOperator
  18616. private:
  18617. Image* backgroundImage;
  18618. Time earliestTimeToDelete;
  18619. int originalClickCounter;
  18620. SplashScreen (const SplashScreen&);
  18621. const SplashScreen& operator= (const SplashScreen&);
  18622. };
  18623. #endif // __JUCE_SPLASHSCREEN_JUCEHEADER__
  18624. /*** End of inlined file: juce_SplashScreen.h ***/
  18625. #endif
  18626. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18627. /*** Start of inlined file: juce_ThreadWithProgressWindow.h ***/
  18628. #ifndef __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18629. #define __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18630. class JUCE_API ThreadWithProgressWindow : public Thread,
  18631. private Timer
  18632. {
  18633. public:
  18634. ThreadWithProgressWindow (const String& windowTitle,
  18635. const bool hasProgressBar,
  18636. const bool hasCancelButton,
  18637. const int timeOutMsWhenCancelling = 10000,
  18638. const String& cancelButtonText = JUCE_T("Cancel"));
  18639. ~ThreadWithProgressWindow();
  18640. bool runThread (const int threadPriority = 5);
  18641. void setProgress (const double newProgress);
  18642. void setStatusMessage (const String& newStatusMessage);
  18643. AlertWindow* getAlertWindow() const throw() { return alertWindow; }
  18644. juce_UseDebuggingNewOperator
  18645. private:
  18646. void timerCallback();
  18647. double progress;
  18648. ScopedPointer <AlertWindow> alertWindow;
  18649. String message;
  18650. CriticalSection messageLock;
  18651. const int timeOutMsWhenCancelling;
  18652. ThreadWithProgressWindow (const ThreadWithProgressWindow&);
  18653. const ThreadWithProgressWindow& operator= (const ThreadWithProgressWindow&);
  18654. };
  18655. #endif // __JUCE_THREADWITHPROGRESSWINDOW_JUCEHEADER__
  18656. /*** End of inlined file: juce_ThreadWithProgressWindow.h ***/
  18657. #endif
  18658. #ifndef __JUCE_TOOLTIPWINDOW_JUCEHEADER__
  18659. #endif
  18660. #ifndef __JUCE_TOPLEVELWINDOW_JUCEHEADER__
  18661. #endif
  18662. #ifndef __JUCE_COLOUR_JUCEHEADER__
  18663. #endif
  18664. #ifndef __JUCE_COLOURGRADIENT_JUCEHEADER__
  18665. #endif
  18666. #ifndef __JUCE_COLOURS_JUCEHEADER__
  18667. #endif
  18668. #ifndef __JUCE_PIXELFORMATS_JUCEHEADER__
  18669. #endif
  18670. #ifndef __JUCE_EDGETABLE_JUCEHEADER__
  18671. #endif
  18672. #ifndef __JUCE_FILLTYPE_JUCEHEADER__
  18673. #endif
  18674. #ifndef __JUCE_GRAPHICS_JUCEHEADER__
  18675. #endif
  18676. #ifndef __JUCE_JUSTIFICATION_JUCEHEADER__
  18677. #endif
  18678. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18679. /*** Start of inlined file: juce_LowLevelGraphicsContext.h ***/
  18680. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18681. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18682. class JUCE_API LowLevelGraphicsContext
  18683. {
  18684. protected:
  18685. LowLevelGraphicsContext();
  18686. public:
  18687. virtual ~LowLevelGraphicsContext();
  18688. virtual bool isVectorDevice() const = 0;
  18689. virtual void setOrigin (int x, int y) = 0;
  18690. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  18691. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  18692. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  18693. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  18694. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  18695. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  18696. virtual const Rectangle<int> getClipBounds() const = 0;
  18697. virtual bool isClipEmpty() const = 0;
  18698. virtual void saveState() = 0;
  18699. virtual void restoreState() = 0;
  18700. virtual void setFill (const FillType& fillType) = 0;
  18701. virtual void setOpacity (float newOpacity) = 0;
  18702. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  18703. virtual void fillRect (const Rectangle<int>& r, const bool replaceExistingContents) = 0;
  18704. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  18705. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18706. const AffineTransform& transform, const bool fillEntireClipAsTiles) = 0;
  18707. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  18708. virtual void drawVerticalLine (const int x, double top, double bottom) = 0;
  18709. virtual void drawHorizontalLine (const int y, double left, double right) = 0;
  18710. virtual void setFont (const Font& newFont) = 0;
  18711. virtual const Font getFont() = 0;
  18712. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  18713. };
  18714. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  18715. /*** End of inlined file: juce_LowLevelGraphicsContext.h ***/
  18716. #endif
  18717. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18718. /*** Start of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18719. #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18720. #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18721. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  18722. {
  18723. public:
  18724. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  18725. const String& documentTitle,
  18726. const int totalWidth,
  18727. const int totalHeight);
  18728. ~LowLevelGraphicsPostScriptRenderer();
  18729. bool isVectorDevice() const;
  18730. void setOrigin (int x, int y);
  18731. bool clipToRectangle (const Rectangle<int>& r);
  18732. bool clipToRectangleList (const RectangleList& clipRegion);
  18733. void excludeClipRectangle (const Rectangle<int>& r);
  18734. void clipToPath (const Path& path, const AffineTransform& transform);
  18735. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18736. void saveState();
  18737. void restoreState();
  18738. bool clipRegionIntersects (const Rectangle<int>& r);
  18739. const Rectangle<int> getClipBounds() const;
  18740. bool isClipEmpty() const;
  18741. void setFill (const FillType& fillType);
  18742. void setOpacity (float opacity);
  18743. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18744. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18745. void fillPath (const Path& path, const AffineTransform& transform);
  18746. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18747. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18748. void drawLine (double x1, double y1, double x2, double y2);
  18749. void drawVerticalLine (const int x, double top, double bottom);
  18750. void drawHorizontalLine (const int x, double top, double bottom);
  18751. const Font getFont();
  18752. void setFont (const Font& newFont);
  18753. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18754. juce_UseDebuggingNewOperator
  18755. protected:
  18756. OutputStream& out;
  18757. int totalWidth, totalHeight;
  18758. bool needToClip;
  18759. Colour lastColour;
  18760. struct SavedState
  18761. {
  18762. SavedState();
  18763. ~SavedState();
  18764. RectangleList clip;
  18765. int xOffset, yOffset;
  18766. FillType fillType;
  18767. Font font;
  18768. private:
  18769. const SavedState& operator= (const SavedState&);
  18770. };
  18771. OwnedArray <SavedState> stateStack;
  18772. void writeClip();
  18773. void writeColour (const Colour& colour);
  18774. void writePath (const Path& path) const;
  18775. void writeXY (const float x, const float y) const;
  18776. void writeTransform (const AffineTransform& trans) const;
  18777. void writeImage (const Image& im, const int sx, const int sy, const int maxW, const int maxH) const;
  18778. LowLevelGraphicsPostScriptRenderer (const LowLevelGraphicsPostScriptRenderer& other);
  18779. const LowLevelGraphicsPostScriptRenderer& operator= (const LowLevelGraphicsPostScriptRenderer&);
  18780. };
  18781. #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
  18782. /*** End of inlined file: juce_LowLevelGraphicsPostScriptRenderer.h ***/
  18783. #endif
  18784. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18785. /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18786. #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18787. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18788. class LLGCSavedState;
  18789. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  18790. {
  18791. public:
  18792. LowLevelGraphicsSoftwareRenderer (Image& imageToRenderOn);
  18793. ~LowLevelGraphicsSoftwareRenderer();
  18794. bool isVectorDevice() const;
  18795. void setOrigin (int x, int y);
  18796. bool clipToRectangle (const Rectangle<int>& r);
  18797. bool clipToRectangleList (const RectangleList& clipRegion);
  18798. void excludeClipRectangle (const Rectangle<int>& r);
  18799. void clipToPath (const Path& path, const AffineTransform& transform);
  18800. void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform);
  18801. bool clipRegionIntersects (const Rectangle<int>& r);
  18802. const Rectangle<int> getClipBounds() const;
  18803. bool isClipEmpty() const;
  18804. void saveState();
  18805. void restoreState();
  18806. void setFill (const FillType& fillType);
  18807. void setOpacity (float opacity);
  18808. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  18809. void fillRect (const Rectangle<int>& r, const bool replaceExistingContents);
  18810. void fillPath (const Path& path, const AffineTransform& transform);
  18811. void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  18812. const AffineTransform& transform, const bool fillEntireClipAsTiles);
  18813. void drawLine (double x1, double y1, double x2, double y2);
  18814. void drawVerticalLine (const int x, double top, double bottom);
  18815. void drawHorizontalLine (const int x, double top, double bottom);
  18816. void setFont (const Font& newFont);
  18817. const Font getFont();
  18818. void drawGlyph (int glyphNumber, float x, float y);
  18819. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  18820. juce_UseDebuggingNewOperator
  18821. protected:
  18822. Image& image;
  18823. ScopedPointer <LLGCSavedState> currentState;
  18824. OwnedArray <LLGCSavedState> stateStack;
  18825. LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other);
  18826. const LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&);
  18827. };
  18828. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  18829. /*** End of inlined file: juce_LowLevelGraphicsSoftwareRenderer.h ***/
  18830. #endif
  18831. #ifndef __JUCE_RECTANGLEPLACEMENT_JUCEHEADER__
  18832. #endif
  18833. #ifndef __JUCE_DRAWABLE_JUCEHEADER__
  18834. #endif
  18835. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18836. /*** Start of inlined file: juce_DrawableComposite.h ***/
  18837. #ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18838. #define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18839. class JUCE_API DrawableComposite : public Drawable
  18840. {
  18841. public:
  18842. DrawableComposite();
  18843. virtual ~DrawableComposite();
  18844. void insertDrawable (Drawable* drawable,
  18845. const AffineTransform& transform = AffineTransform::identity,
  18846. const int index = -1);
  18847. void insertDrawable (const Drawable& drawable,
  18848. const AffineTransform& transform = AffineTransform::identity,
  18849. const int index = -1);
  18850. void removeDrawable (const int index, const bool deleteDrawable = true);
  18851. int getNumDrawables() const throw() { return drawables.size(); }
  18852. Drawable* getDrawable (const int index) const throw() { return drawables [index]; }
  18853. const AffineTransform* getDrawableTransform (const int index) const throw() { return transforms [index]; }
  18854. void bringToFront (const int index);
  18855. void render (const Drawable::RenderingContext& context) const;
  18856. const Rectangle<float> getBounds() const;
  18857. bool hitTest (float x, float y) const;
  18858. Drawable* createCopy() const;
  18859. ValueTree createValueTree() const throw();
  18860. static DrawableComposite* createFromValueTree (const ValueTree& tree) throw();
  18861. juce_UseDebuggingNewOperator
  18862. private:
  18863. OwnedArray <Drawable> drawables;
  18864. OwnedArray <AffineTransform> transforms;
  18865. DrawableComposite (const DrawableComposite&);
  18866. const DrawableComposite& operator= (const DrawableComposite&);
  18867. };
  18868. #endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
  18869. /*** End of inlined file: juce_DrawableComposite.h ***/
  18870. #endif
  18871. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18872. /*** Start of inlined file: juce_DrawableImage.h ***/
  18873. #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18874. #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18875. class JUCE_API DrawableImage : public Drawable
  18876. {
  18877. public:
  18878. DrawableImage();
  18879. virtual ~DrawableImage();
  18880. void setImage (const Image& imageToCopy);
  18881. void setImage (Image* imageToUse,
  18882. const bool releaseWhenNotNeeded);
  18883. Image* getImage() const throw() { return image; }
  18884. void clearImage();
  18885. void setOpacity (const float newOpacity);
  18886. float getOpacity() const throw() { return opacity; }
  18887. void setOverlayColour (const Colour& newOverlayColour);
  18888. const Colour& getOverlayColour() const throw() { return overlayColour; }
  18889. void render (const Drawable::RenderingContext& context) const;
  18890. const Rectangle<float> getBounds() const;
  18891. bool hitTest (float x, float y) const;
  18892. Drawable* createCopy() const;
  18893. ValueTree createValueTree() const throw();
  18894. static DrawableImage* createFromValueTree (const ValueTree& tree) throw();
  18895. juce_UseDebuggingNewOperator
  18896. private:
  18897. Image* image;
  18898. bool canDeleteImage;
  18899. float opacity;
  18900. Colour overlayColour;
  18901. DrawableImage (const DrawableImage&);
  18902. const DrawableImage& operator= (const DrawableImage&);
  18903. };
  18904. #endif // __JUCE_DRAWABLEIMAGE_JUCEHEADER__
  18905. /*** End of inlined file: juce_DrawableImage.h ***/
  18906. #endif
  18907. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18908. /*** Start of inlined file: juce_DrawablePath.h ***/
  18909. #ifndef __JUCE_DRAWABLEPATH_JUCEHEADER__
  18910. #define __JUCE_DRAWABLEPATH_JUCEHEADER__
  18911. class JUCE_API DrawablePath : public Drawable
  18912. {
  18913. public:
  18914. DrawablePath();
  18915. virtual ~DrawablePath();
  18916. void setPath (const Path& newPath) throw();
  18917. const Path& getPath() const throw() { return path; }
  18918. void setFill (const FillType& newFill) throw();
  18919. const FillType& getFill() const throw() { return mainFill; }
  18920. void setStrokeFill (const FillType& newStrokeFill) throw();
  18921. const FillType& getStrokeFill() const throw() { return strokeFill; }
  18922. void setStrokeType (const PathStrokeType& newStrokeType) throw();
  18923. void setStrokeThickness (const float newThickness) throw();
  18924. const PathStrokeType& getStrokeType() const throw() { return strokeType; }
  18925. void render (const Drawable::RenderingContext& context) const;
  18926. const Rectangle<float> getBounds() const;
  18927. bool hitTest (float x, float y) const;
  18928. Drawable* createCopy() const;
  18929. ValueTree createValueTree() const throw();
  18930. static DrawablePath* createFromValueTree (const ValueTree& tree) throw();
  18931. juce_UseDebuggingNewOperator
  18932. private:
  18933. Path path, stroke;
  18934. FillType mainFill, strokeFill;
  18935. PathStrokeType strokeType;
  18936. void updateOutline();
  18937. DrawablePath (const DrawablePath&);
  18938. const DrawablePath& operator= (const DrawablePath&);
  18939. };
  18940. #endif // __JUCE_DRAWABLEPATH_JUCEHEADER__
  18941. /*** End of inlined file: juce_DrawablePath.h ***/
  18942. #endif
  18943. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18944. /*** Start of inlined file: juce_DrawableText.h ***/
  18945. #ifndef __JUCE_DRAWABLETEXT_JUCEHEADER__
  18946. #define __JUCE_DRAWABLETEXT_JUCEHEADER__
  18947. class JUCE_API DrawableText : public Drawable
  18948. {
  18949. public:
  18950. DrawableText();
  18951. virtual ~DrawableText();
  18952. void setText (const GlyphArrangement& newText);
  18953. void setText (const String& newText, const Font& fontToUse);
  18954. const GlyphArrangement& getText() const throw() { return text; }
  18955. void setColour (const Colour& newColour);
  18956. const Colour& getColour() const throw() { return colour; }
  18957. void render (const Drawable::RenderingContext& context) const;
  18958. const Rectangle<float> getBounds() const;
  18959. bool hitTest (float x, float y) const;
  18960. Drawable* createCopy() const;
  18961. ValueTree createValueTree() const throw();
  18962. static DrawableText* createFromValueTree (const ValueTree& tree) throw();
  18963. juce_UseDebuggingNewOperator
  18964. private:
  18965. GlyphArrangement text;
  18966. Colour colour;
  18967. DrawableText (const DrawableText&);
  18968. const DrawableText& operator= (const DrawableText&);
  18969. };
  18970. #endif // __JUCE_DRAWABLETEXT_JUCEHEADER__
  18971. /*** End of inlined file: juce_DrawableText.h ***/
  18972. #endif
  18973. #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
  18974. #endif
  18975. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18976. /*** Start of inlined file: juce_GlowEffect.h ***/
  18977. #ifndef __JUCE_GLOWEFFECT_JUCEHEADER__
  18978. #define __JUCE_GLOWEFFECT_JUCEHEADER__
  18979. class JUCE_API GlowEffect : public ImageEffectFilter
  18980. {
  18981. public:
  18982. GlowEffect();
  18983. ~GlowEffect();
  18984. void setGlowProperties (const float newRadius,
  18985. const Colour& newColour);
  18986. void applyEffect (Image& sourceImage, Graphics& destContext);
  18987. juce_UseDebuggingNewOperator
  18988. private:
  18989. float radius;
  18990. Colour colour;
  18991. };
  18992. #endif // __JUCE_GLOWEFFECT_JUCEHEADER__
  18993. /*** End of inlined file: juce_GlowEffect.h ***/
  18994. #endif
  18995. #ifndef __JUCE_IMAGEEFFECTFILTER_JUCEHEADER__
  18996. #endif
  18997. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  18998. /*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
  18999. #ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19000. #define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19001. class JUCE_API ReduceOpacityEffect : public ImageEffectFilter
  19002. {
  19003. public:
  19004. ReduceOpacityEffect (const float opacity = 1.0f);
  19005. ~ReduceOpacityEffect();
  19006. void setOpacity (const float newOpacity);
  19007. void applyEffect (Image& sourceImage, Graphics& destContext);
  19008. juce_UseDebuggingNewOperator
  19009. private:
  19010. float opacity;
  19011. };
  19012. #endif // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
  19013. /*** End of inlined file: juce_ReduceOpacityEffect.h ***/
  19014. #endif
  19015. #ifndef __JUCE_FONT_JUCEHEADER__
  19016. #endif
  19017. #ifndef __JUCE_GLYPHARRANGEMENT_JUCEHEADER__
  19018. #endif
  19019. #ifndef __JUCE_TEXTLAYOUT_JUCEHEADER__
  19020. #endif
  19021. #ifndef __JUCE_TYPEFACE_JUCEHEADER__
  19022. #endif
  19023. #ifndef __JUCE_AFFINETRANSFORM_JUCEHEADER__
  19024. #endif
  19025. #ifndef __JUCE_BORDERSIZE_JUCEHEADER__
  19026. #endif
  19027. #ifndef __JUCE_LINE_JUCEHEADER__
  19028. #endif
  19029. #ifndef __JUCE_PATH_JUCEHEADER__
  19030. #endif
  19031. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19032. /*** Start of inlined file: juce_PathIterator.h ***/
  19033. #ifndef __JUCE_PATHITERATOR_JUCEHEADER__
  19034. #define __JUCE_PATHITERATOR_JUCEHEADER__
  19035. class JUCE_API PathFlatteningIterator
  19036. {
  19037. public:
  19038. PathFlatteningIterator (const Path& path,
  19039. const AffineTransform& transform = AffineTransform::identity,
  19040. float tolerence = 6.0f) throw();
  19041. ~PathFlatteningIterator() throw();
  19042. bool next() throw();
  19043. float x1;
  19044. float y1;
  19045. float x2;
  19046. float y2;
  19047. bool closesSubPath;
  19048. int subPathIndex;
  19049. bool isLastInSubpath() const { return stackPos == stackBase
  19050. && (index >= path.numElements
  19051. || points [index] == Path::moveMarker); }
  19052. juce_UseDebuggingNewOperator
  19053. private:
  19054. const Path& path;
  19055. const AffineTransform transform;
  19056. float* points;
  19057. float tolerence, subPathCloseX, subPathCloseY;
  19058. bool isIdentityTransform;
  19059. HeapBlock <float> stackBase;
  19060. float* stackPos;
  19061. int index, stackSize;
  19062. PathFlatteningIterator (const PathFlatteningIterator&);
  19063. const PathFlatteningIterator& operator= (const PathFlatteningIterator&);
  19064. };
  19065. #endif // __JUCE_PATHITERATOR_JUCEHEADER__
  19066. /*** End of inlined file: juce_PathIterator.h ***/
  19067. #endif
  19068. #ifndef __JUCE_PATHSTROKETYPE_JUCEHEADER__
  19069. #endif
  19070. #ifndef __JUCE_POINT_JUCEHEADER__
  19071. #endif
  19072. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19073. /*** Start of inlined file: juce_PositionedRectangle.h ***/
  19074. #ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19075. #define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19076. class JUCE_API PositionedRectangle
  19077. {
  19078. public:
  19079. PositionedRectangle() throw();
  19080. PositionedRectangle (const String& stringVersion) throw();
  19081. PositionedRectangle (const PositionedRectangle& other) throw();
  19082. const PositionedRectangle& operator= (const PositionedRectangle& other) throw();
  19083. ~PositionedRectangle() throw();
  19084. const String toString() const throw();
  19085. const Rectangle<int> getRectangle (const Rectangle<int>& targetSpaceToBeRelativeTo) const throw();
  19086. void getRectangleDouble (const Rectangle<int>& targetSpaceToBeRelativeTo,
  19087. double& x,
  19088. double& y,
  19089. double& width,
  19090. double& height) const throw();
  19091. void applyToComponent (Component& comp) const throw();
  19092. void updateFrom (const Rectangle<int>& newPosition,
  19093. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19094. void updateFromDouble (const double x, const double y,
  19095. const double width, const double height,
  19096. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19097. void updateFromComponent (const Component& comp) throw();
  19098. enum AnchorPoint
  19099. {
  19100. anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
  19101. anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
  19102. anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
  19103. };
  19104. enum PositionMode
  19105. {
  19106. absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
  19107. absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
  19108. absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
  19109. 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. */
  19110. };
  19111. enum SizeMode
  19112. {
  19113. absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
  19114. parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
  19115. proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
  19116. };
  19117. void setModes (const AnchorPoint xAnchorMode,
  19118. const PositionMode xPositionMode,
  19119. const AnchorPoint yAnchorMode,
  19120. const PositionMode yPositionMode,
  19121. const SizeMode widthMode,
  19122. const SizeMode heightMode,
  19123. const Rectangle<int>& targetSpaceToBeRelativeTo) throw();
  19124. AnchorPoint getAnchorPointX() const throw();
  19125. PositionMode getPositionModeX() const throw();
  19126. double getX() const throw() { return x; }
  19127. void setX (const double newX) throw() { x = newX; }
  19128. AnchorPoint getAnchorPointY() const throw();
  19129. PositionMode getPositionModeY() const throw();
  19130. double getY() const throw() { return y; }
  19131. void setY (const double newY) throw() { y = newY; }
  19132. SizeMode getWidthMode() const throw();
  19133. double getWidth() const throw() { return w; }
  19134. void setWidth (const double newWidth) throw() { w = newWidth; }
  19135. SizeMode getHeightMode() const throw();
  19136. double getHeight() const throw() { return h; }
  19137. void setHeight (const double newHeight) throw() { h = newHeight; }
  19138. bool isPositionAbsolute() const throw();
  19139. const bool operator== (const PositionedRectangle& other) const throw();
  19140. const bool operator!= (const PositionedRectangle& other) const throw();
  19141. juce_UseDebuggingNewOperator
  19142. private:
  19143. double x, y, w, h;
  19144. uint8 xMode, yMode, wMode, hMode;
  19145. void addPosDescription (String& result, const uint8 mode, const double value) const throw();
  19146. void addSizeDescription (String& result, const uint8 mode, const double value) const throw();
  19147. void decodePosString (const String& s, uint8& mode, double& value) throw();
  19148. void decodeSizeString (const String& s, uint8& mode, double& value) throw();
  19149. void applyPosAndSize (double& xOut, double& wOut, const double x, const double w,
  19150. const uint8 xMode, const uint8 wMode,
  19151. const int parentPos, const int parentSize) const throw();
  19152. void updatePosAndSize (double& xOut, double& wOut, double x, const double w,
  19153. const uint8 xMode, const uint8 wMode,
  19154. const int parentPos, const int parentSize) const throw();
  19155. };
  19156. #endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
  19157. /*** End of inlined file: juce_PositionedRectangle.h ***/
  19158. #endif
  19159. #ifndef __JUCE_RECTANGLE_JUCEHEADER__
  19160. #endif
  19161. #ifndef __JUCE_RECTANGLELIST_JUCEHEADER__
  19162. #endif
  19163. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19164. /*** Start of inlined file: juce_CameraDevice.h ***/
  19165. #ifndef __JUCE_CAMERADEVICE_JUCEHEADER__
  19166. #define __JUCE_CAMERADEVICE_JUCEHEADER__
  19167. #if JUCE_USE_CAMERA
  19168. class CameraImageListener
  19169. {
  19170. public:
  19171. CameraImageListener() {}
  19172. virtual ~CameraImageListener() {}
  19173. virtual void imageReceived (Image& image) = 0;
  19174. };
  19175. class JUCE_API CameraDevice
  19176. {
  19177. public:
  19178. virtual ~CameraDevice();
  19179. static const StringArray getAvailableDevices();
  19180. static CameraDevice* openDevice (int deviceIndex,
  19181. int minWidth = 128, int minHeight = 64,
  19182. int maxWidth = 1024, int maxHeight = 768);
  19183. const String getName() const { return name; }
  19184. Component* createViewerComponent();
  19185. void startRecordingToFile (const File& file);
  19186. void stopRecording();
  19187. static const String getFileExtension();
  19188. const Time getTimeOfFirstRecordedFrame() const;
  19189. void addListener (CameraImageListener* listenerToAdd);
  19190. void removeListener (CameraImageListener* listenerToRemove);
  19191. juce_UseDebuggingNewOperator
  19192. protected:
  19193. CameraDevice (const String& name, int index);
  19194. private:
  19195. void* internal;
  19196. bool isRecording;
  19197. String name;
  19198. CameraDevice (const CameraDevice&);
  19199. const CameraDevice& operator= (const CameraDevice&);
  19200. };
  19201. #endif
  19202. #endif // __JUCE_CAMERADEVICE_JUCEHEADER__
  19203. /*** End of inlined file: juce_CameraDevice.h ***/
  19204. #endif
  19205. #ifndef __JUCE_IMAGE_JUCEHEADER__
  19206. #endif
  19207. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19208. /*** Start of inlined file: juce_ImageCache.h ***/
  19209. #ifndef __JUCE_IMAGECACHE_JUCEHEADER__
  19210. #define __JUCE_IMAGECACHE_JUCEHEADER__
  19211. struct ImageCacheItem;
  19212. class JUCE_API ImageCache : private DeletedAtShutdown,
  19213. private Timer
  19214. {
  19215. public:
  19216. static Image* getFromFile (const File& file);
  19217. static Image* getFromMemory (const void* imageData,
  19218. const int dataSize);
  19219. static void release (Image* const imageToRelease);
  19220. static void releaseOrDelete (Image* const imageToRelease);
  19221. static bool isImageInCache (Image* const imageToLookFor);
  19222. static void incReferenceCount (Image* const image);
  19223. static Image* getFromHashCode (const int64 hashCode);
  19224. static void addImageToCache (Image* const image,
  19225. const int64 hashCode);
  19226. static void setCacheTimeout (const int millisecs);
  19227. juce_UseDebuggingNewOperator
  19228. private:
  19229. CriticalSection lock;
  19230. OwnedArray <ImageCacheItem> images;
  19231. ImageCache();
  19232. ImageCache (const ImageCache&);
  19233. const ImageCache& operator= (const ImageCache&);
  19234. ~ImageCache();
  19235. void timerCallback();
  19236. };
  19237. #endif // __JUCE_IMAGECACHE_JUCEHEADER__
  19238. /*** End of inlined file: juce_ImageCache.h ***/
  19239. #endif
  19240. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19241. /*** Start of inlined file: juce_ImageConvolutionKernel.h ***/
  19242. #ifndef __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19243. #define __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19244. class JUCE_API ImageConvolutionKernel
  19245. {
  19246. public:
  19247. ImageConvolutionKernel (const int size);
  19248. ~ImageConvolutionKernel();
  19249. void clear();
  19250. void setKernelValue (const int x,
  19251. const int y,
  19252. const float value);
  19253. void setOverallSum (const float desiredTotalSum);
  19254. void rescaleAllValues (const float multiplier);
  19255. void createGaussianBlur (const float blurRadius);
  19256. int getKernelSize() const { return size; }
  19257. float** getValues() const { return values; }
  19258. void applyToImage (Image& destImage,
  19259. const Image* sourceImage,
  19260. int x,
  19261. int y,
  19262. int width,
  19263. int height) const;
  19264. juce_UseDebuggingNewOperator
  19265. private:
  19266. HeapBlock <float> values;
  19267. const int size;
  19268. // no reason not to implement these one day..
  19269. ImageConvolutionKernel (const ImageConvolutionKernel&);
  19270. const ImageConvolutionKernel& operator= (const ImageConvolutionKernel&);
  19271. };
  19272. #endif // __JUCE_IMAGECONVOLUTIONKERNEL_JUCEHEADER__
  19273. /*** End of inlined file: juce_ImageConvolutionKernel.h ***/
  19274. #endif
  19275. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19276. /*** Start of inlined file: juce_ImageFileFormat.h ***/
  19277. #ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19278. #define __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19279. class JUCE_API ImageFileFormat
  19280. {
  19281. protected:
  19282. ImageFileFormat() {}
  19283. public:
  19284. virtual ~ImageFileFormat() {}
  19285. virtual const String getFormatName() = 0;
  19286. virtual bool canUnderstand (InputStream& input) = 0;
  19287. virtual Image* decodeImage (InputStream& input) = 0;
  19288. virtual bool writeImageToStream (const Image& sourceImage,
  19289. OutputStream& destStream) = 0;
  19290. static ImageFileFormat* findImageFormatForStream (InputStream& input);
  19291. static Image* loadFrom (InputStream& input);
  19292. static Image* loadFrom (const File& file);
  19293. static Image* loadFrom (const void* rawData,
  19294. const int numBytesOfData);
  19295. };
  19296. class JUCE_API PNGImageFormat : public ImageFileFormat
  19297. {
  19298. public:
  19299. PNGImageFormat();
  19300. ~PNGImageFormat();
  19301. const String getFormatName();
  19302. bool canUnderstand (InputStream& input);
  19303. Image* decodeImage (InputStream& input);
  19304. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19305. };
  19306. class JUCE_API JPEGImageFormat : public ImageFileFormat
  19307. {
  19308. public:
  19309. JPEGImageFormat();
  19310. ~JPEGImageFormat();
  19311. void setQuality (const float newQuality);
  19312. const String getFormatName();
  19313. bool canUnderstand (InputStream& input);
  19314. Image* decodeImage (InputStream& input);
  19315. bool writeImageToStream (const Image& sourceImage, OutputStream& destStream);
  19316. private:
  19317. float quality;
  19318. };
  19319. #endif // __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
  19320. /*** End of inlined file: juce_ImageFileFormat.h ***/
  19321. #endif
  19322. #ifndef __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__
  19323. #endif
  19324. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19325. /*** Start of inlined file: juce_FileBasedDocument.h ***/
  19326. #ifndef __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19327. #define __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19328. class JUCE_API FileBasedDocument : public ChangeBroadcaster
  19329. {
  19330. public:
  19331. FileBasedDocument (const String& fileExtension,
  19332. const String& fileWildCard,
  19333. const String& openFileDialogTitle,
  19334. const String& saveFileDialogTitle);
  19335. virtual ~FileBasedDocument();
  19336. bool hasChangedSinceSaved() const { return changedSinceSave; }
  19337. virtual void changed();
  19338. void setChangedFlag (const bool hasChanged);
  19339. bool loadFrom (const File& fileToLoadFrom,
  19340. const bool showMessageOnFailure);
  19341. bool loadFromUserSpecifiedFile (const bool showMessageOnFailure);
  19342. enum SaveResult
  19343. {
  19344. savedOk = 0, /**< indicates that a file was saved successfully. */
  19345. userCancelledSave, /**< indicates that the user aborted the save operation. */
  19346. failedToWriteToFile /**< indicates that it tried to write to a file but this failed. */
  19347. };
  19348. SaveResult save (const bool askUserForFileIfNotSpecified,
  19349. const bool showMessageOnFailure);
  19350. SaveResult saveIfNeededAndUserAgrees();
  19351. SaveResult saveAs (const File& newFile,
  19352. const bool warnAboutOverwritingExistingFiles,
  19353. const bool askUserForFileIfNotSpecified,
  19354. const bool showMessageOnFailure);
  19355. SaveResult saveAsInteractive (const bool warnAboutOverwritingExistingFiles);
  19356. const File getFile() const { return documentFile; }
  19357. void setFile (const File& newFile);
  19358. protected:
  19359. virtual const String getDocumentTitle() = 0;
  19360. virtual const String loadDocument (const File& file) = 0;
  19361. virtual const String saveDocument (const File& file) = 0;
  19362. virtual const File getLastDocumentOpened() = 0;
  19363. virtual void setLastDocumentOpened (const File& file) = 0;
  19364. public:
  19365. juce_UseDebuggingNewOperator
  19366. private:
  19367. File documentFile;
  19368. bool changedSinceSave;
  19369. String fileExtension, fileWildcard, openFileDialogTitle, saveFileDialogTitle;
  19370. FileBasedDocument (const FileBasedDocument&);
  19371. const FileBasedDocument& operator= (const FileBasedDocument&);
  19372. };
  19373. #endif // __JUCE_FILEBASEDDOCUMENT_JUCEHEADER__
  19374. /*** End of inlined file: juce_FileBasedDocument.h ***/
  19375. #endif
  19376. #ifndef __JUCE_PROPERTIESFILE_JUCEHEADER__
  19377. #endif
  19378. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19379. /*** Start of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19380. #ifndef __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19381. #define __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19382. class JUCE_API RecentlyOpenedFilesList
  19383. {
  19384. public:
  19385. RecentlyOpenedFilesList();
  19386. ~RecentlyOpenedFilesList();
  19387. void setMaxNumberOfItems (const int newMaxNumber);
  19388. int getMaxNumberOfItems() const throw() { return maxNumberOfItems; }
  19389. int getNumFiles() const;
  19390. const File getFile (const int index) const;
  19391. const StringArray& getAllFilenames() const throw() { return files; }
  19392. void clear();
  19393. void addFile (const File& file);
  19394. void removeNonExistentFiles();
  19395. int createPopupMenuItems (PopupMenu& menuToAddItemsTo,
  19396. const int baseItemId,
  19397. const bool showFullPaths,
  19398. const bool dontAddNonExistentFiles,
  19399. const File** filesToAvoid = 0);
  19400. const String toString() const;
  19401. void restoreFromString (const String& stringifiedVersion);
  19402. juce_UseDebuggingNewOperator
  19403. private:
  19404. StringArray files;
  19405. int maxNumberOfItems;
  19406. };
  19407. #endif // __JUCE_RECENTLYOPENEDFILESLIST_JUCEHEADER__
  19408. /*** End of inlined file: juce_RecentlyOpenedFilesList.h ***/
  19409. #endif
  19410. #ifndef __JUCE_SELECTEDITEMSET_JUCEHEADER__
  19411. #endif
  19412. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19413. /*** Start of inlined file: juce_SystemClipboard.h ***/
  19414. #ifndef __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19415. #define __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19416. class JUCE_API SystemClipboard
  19417. {
  19418. public:
  19419. static void copyTextToClipboard (const String& text) throw();
  19420. static const String getTextFromClipboard() throw();
  19421. };
  19422. #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__
  19423. /*** End of inlined file: juce_SystemClipboard.h ***/
  19424. #endif
  19425. #ifndef __JUCE_UNDOABLEACTION_JUCEHEADER__
  19426. #endif
  19427. #ifndef __JUCE_UNDOMANAGER_JUCEHEADER__
  19428. #endif
  19429. #endif
  19430. /*** End of inlined file: juce_app_includes.h ***/
  19431. #endif
  19432. #if JUCE_MSVC
  19433. #pragma warning (pop)
  19434. #pragma pack (pop)
  19435. #endif
  19436. END_JUCE_NAMESPACE
  19437. #ifndef DONT_SET_USING_JUCE_NAMESPACE
  19438. #ifdef JUCE_NAMESPACE
  19439. // this will obviously save a lot of typing, but can be disabled by
  19440. // defining DONT_SET_USING_JUCE_NAMESPACE, in case there are conflicts.
  19441. using namespace JUCE_NAMESPACE;
  19442. #if (JUCE_MAC || JUCE_IPHONE) && ! JUCE_DONT_DEFINE_MACROS
  19443. #define Component JUCE_NAMESPACE::Component
  19444. #define MemoryBlock JUCE_NAMESPACE::MemoryBlock
  19445. #define Point JUCE_NAMESPACE::Point
  19446. #define Button JUCE_NAMESPACE::Button
  19447. #endif
  19448. #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS
  19449. #define Rectangle JUCE_NAMESPACE::Rectangle
  19450. #endif
  19451. #endif
  19452. #endif
  19453. #if JUCE_MSVC
  19454. #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY
  19455. #ifdef JUCE_DLL
  19456. #ifdef JUCE_DEBUG
  19457. #define AUTOLINKEDLIB "JUCE_debug.lib"
  19458. #else
  19459. #define AUTOLINKEDLIB "JUCE.lib"
  19460. #endif
  19461. #else
  19462. #ifdef JUCE_DEBUG
  19463. #ifdef _WIN64
  19464. #define AUTOLINKEDLIB "jucelib_static_x64_debug.lib"
  19465. #else
  19466. #define AUTOLINKEDLIB "jucelib_static_Win32_debug.lib"
  19467. #endif
  19468. #else
  19469. #ifdef _WIN64
  19470. #define AUTOLINKEDLIB "jucelib_static_x64.lib"
  19471. #else
  19472. #define AUTOLINKEDLIB "jucelib_static_Win32.lib"
  19473. #endif
  19474. #endif
  19475. #endif
  19476. #pragma comment(lib, AUTOLINKEDLIB)
  19477. #if ! DONT_LIST_JUCE_AUTOLINKEDLIBS
  19478. #pragma message("JUCE! Library to link to: " AUTOLINKEDLIB)
  19479. #endif
  19480. // Auto-link the other win32 libs that are needed by library calls..
  19481. #if ! (defined (DONT_AUTOLINK_TO_WIN32_LIBRARIES) || defined (JUCE_DLL))
  19482. /*** Start of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19483. // Auto-links to various win32 libs that are needed by library calls..
  19484. #pragma comment(lib, "kernel32.lib")
  19485. #pragma comment(lib, "user32.lib")
  19486. #pragma comment(lib, "shell32.lib")
  19487. #pragma comment(lib, "gdi32.lib")
  19488. #pragma comment(lib, "vfw32.lib")
  19489. #pragma comment(lib, "comdlg32.lib")
  19490. #pragma comment(lib, "winmm.lib")
  19491. #pragma comment(lib, "wininet.lib")
  19492. #pragma comment(lib, "ole32.lib")
  19493. #pragma comment(lib, "oleaut32.lib")
  19494. #pragma comment(lib, "advapi32.lib")
  19495. #pragma comment(lib, "ws2_32.lib")
  19496. #pragma comment(lib, "comsupp.lib")
  19497. #pragma comment(lib, "version.lib")
  19498. #if JUCE_OPENGL
  19499. #pragma comment(lib, "OpenGL32.Lib")
  19500. #pragma comment(lib, "GlU32.Lib")
  19501. #endif
  19502. #if JUCE_QUICKTIME
  19503. #pragma comment (lib, "QTMLClient.lib")
  19504. #endif
  19505. #if JUCE_USE_CAMERA
  19506. #pragma comment (lib, "Strmiids.lib")
  19507. #endif
  19508. /*** End of inlined file: juce_win32_AutoLinkLibraries.h ***/
  19509. #endif
  19510. #endif
  19511. #endif
  19512. #if defined (JUCE_GCC) || defined (__MWERKS__)
  19513. #define START_JUCE_APPLICATION(AppClass) \
  19514. int main (int argc, char* argv[]) \
  19515. { \
  19516. return JUCE_NAMESPACE::JUCEApplication::main (argc, argv, new AppClass()); \
  19517. }
  19518. #elif JUCE_WINDOWS
  19519. #ifdef _CONSOLE
  19520. #define START_JUCE_APPLICATION(AppClass) \
  19521. int main (int, char* argv[]) \
  19522. { \
  19523. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19524. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19525. }
  19526. #elif ! defined (_AFXDLL)
  19527. #ifdef _WINDOWS_
  19528. #define START_JUCE_APPLICATION(AppClass) \
  19529. int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int) \
  19530. { \
  19531. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19532. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19533. }
  19534. #else
  19535. #define START_JUCE_APPLICATION(AppClass) \
  19536. int __stdcall WinMain (int, int, const char*, int) \
  19537. { \
  19538. JUCE_NAMESPACE::String commandLineString (JUCE_NAMESPACE::PlatformUtilities::getCurrentCommandLineParams()); \
  19539. return JUCE_NAMESPACE::JUCEApplication::main (commandLineString, new AppClass()); \
  19540. }
  19541. #endif
  19542. #endif
  19543. #endif
  19544. #endif // __JUCE_JUCEHEADER__
  19545. /*** End of inlined file: juce.h ***/
  19546. #endif // __JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__